dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; void productExceptSelf ( int arr [ ] , int N ) { int product = 1 ; int z = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] ) product *= arr [ i ] ; z += ( arr [ i ] == 0 ) ; } int a = abs ( product ) , b ; for ( int i = 0 ; i < N ; i ++ ) { if ( z == 1 ) { if ( arr [ i ] ) arr [ i ] = 0 ; else arr [ i ] = product ; continue ; } else if ( z > 1 ) { arr [ i ] = 0 ; continue ; } int b = abs ( arr [ i ] ) ; int curr = round ( exp ( log ( a ) - log ( b ) ) ) ; if ( arr [ i ] < 0 && product < 0 ) arr [ i ] = curr ; else if ( arr [ i ] > 0 && product > 0 ) arr [ i ] = curr ; else arr [ i ] = -1 * curr ; } for ( int i = 0 ; i < N ; i ++ ) { cout << arr [ i ] << " ▁ " ; } } int main ( ) { int arr [ ] = { 10 , 3 , 5 , 6 , 2 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; productExceptSelf ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, product, stdc, z
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int singleDigitSubarrayCount ( int arr [ ] , int N ) { int res = 0 ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] <= 9 ) { count ++ ; res += count ; } else { count = 0 ; } } cout << res ; } int main ( ) { int arr [ ] = { 0 , 1 , 14 , 2 , 5 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; singleDigitSubarrayCount ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, res, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPossible ( int N ) { return ( ( N & ( N - 1 ) ) && N ) ; } void countElements ( int N ) { int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( isPossible ( i ) ) count ++ ; } cout << count ; } int main ( ) { int N = 15 ; countElements ( N ) ; return 0 ; }

Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void countElements ( int N ) { int Cur_Ele = 1 ; int Count = 0 ; while ( Cur_Ele <= N ) { Count ++ ; Cur_Ele = Cur_Ele * 2 ; } cout << N - Count ; } int main ( ) { int N = 15 ; countElements ( N ) ; return 0 ; }

Accumulator variables: Count, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void maxAdjacent ( int * arr , int N ) { vector < int > res ; int arr_max = INT_MIN ; for ( int i = 1 ; i < N ; i ++ ) { arr_max = max ( arr_max , abs ( arr [ i - 1 ] - arr [ i ] ) ) ; } for ( int i = 1 ; i < N - 1 ; i ++ ) { int curr_max = abs ( arr [ i - 1 ] - arr [ i + 1 ] ) ; int ans = max ( curr_max , arr_max ) ; res . push_back ( ans ) ; } for ( auto x : res ) cout << x << " ▁ " ; cout << endl ; } int main ( ) { int arr [ ] = { 1 , 3 , 4 , 7 , 8 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; maxAdjacent ( arr , N ) ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minimumIncrement ( int arr [ ] , int N ) { if ( N % 2 != 0 ) { cout << " - 1" ; exit ( 0 ) ; } int cntEven = 0 ; int cntOdd = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 == 0 ) { cntEven += 1 ; } } cntOdd = N - cntEven ; return abs ( cntEven - cntOdd ) / 2 ; } int main ( ) { int arr [ ] = { 1 , 3 , 4 , 9 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << minimumIncrement ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: cntEven, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void cntWaysConsArray ( int A [ ] , int N ) { int total = 1 ; int oddArray = 1 ; for ( int i = 0 ; i < N ; i ++ ) { total = total * 3 ; if ( A [ i ] % 2 == 0 ) { oddArray *= 2 ; } } cout << total - oddArray << " STRNEWLINE " ; } int main ( ) { int A [ ] = { 2 , 4 } ; int N = sizeof ( A ) / sizeof ( A [ 0 ] ) ; cntWaysConsArray ( A , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, oddArray, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countNumberHavingKthBitSet ( int N , int K ) { int numbers_rightmost_setbit_K ; for ( int i = 1 ; i <= K ; i ++ ) { int numbers_rightmost_bit_i = ( N + 1 ) / 2 ; N -= numbers_rightmost_bit_i ; if ( i == K ) { numbers_rightmost_setbit_K = numbers_rightmost_bit_i ; } } cout << numbers_rightmost_setbit_K ; } int main ( ) { int N = 15 ; int K = 2 ; countNumberHavingKthBitSet ( N , K ) ; return 0 ; }

Accumulator variables: N, i, stdc
Iterator variables: i
C++ program:
#include <iostream>
#include <math.h>
using namespace std ; int countSetBits ( int N ) { int count = 0 ; while ( N ) { N = N & ( N - 1 ) ; count ++ ; } return count ; } int main ( ) { int N = 4 ; int bits = countSetBits ( N ) ; cout << " Odd ▁ " << " : ▁ " << pow ( 2 , bits ) << " STRNEWLINE " ; cout << " Even ▁ " << " : ▁ " << N + 1 - pow ( 2 , bits ) << " STRNEWLINE " ; return 0 ; }

Accumulator variables: count
C++ program:
#include <bits/stdc++.h>
using namespace std ; void minMoves ( int arr [ ] , int N ) { int odd_element_cnt = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 != 0 ) { odd_element_cnt ++ ; } } int moves = ( odd_element_cnt ) / 2 ; if ( odd_element_cnt % 2 != 0 ) moves += 2 ; cout << moves ; } int main ( ) { int arr [ ] = { 5 , 6 , 3 , 7 , 20 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; minMoves ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, moves, odd_element_cnt, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void minimumSubsetDifference ( int N ) { int blockOfSize8 = N / 8 ; string str = " ABBABAAB " ; int subsetDifference = 0 ; string partition = " " ; while ( blockOfSize8 -- ) { partition += str ; } vector < int > A , B ; for ( int i = 0 ; i < N ; i ++ ) { if ( partition [ i ] == ' A ' ) { A . push_back ( ( i + 1 ) * ( i + 1 ) ) ; } else { B . push_back ( ( i + 1 ) * ( i + 1 ) ) ; } } cout << subsetDifference << " STRNEWLINE " ; for ( int i = 0 ; i < A . size ( ) ; i ++ ) cout << A [ i ] << " ▁ " ; cout << " STRNEWLINE " ; for ( int i = 0 ; i < B . size ( ) ; i ++ ) cout << B [ i ] << " ▁ " ; } int main ( ) { int N = 8 ; minimumSubsetDifference ( N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: blockOfSize8, i, partition, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findTheGreatestX ( int P , int Q ) { map < int , int > divisiors ; for ( int i = 2 ; i * i <= Q ; i ++ ) { while ( Q % i == 0 and Q > 1 ) { Q /= i ; divisiors [ i ] ++ ; } } if ( Q > 1 ) divisiors [ Q ] ++ ; int ans = 0 ; for ( auto i : divisiors ) { int frequency = i . second ; int temp = P ; int cur = 0 ; while ( temp % i . first == 0 ) { temp /= i . first ; cur ++ ; } if ( cur < frequency ) { ans = P ; break ; } temp = P ; for ( int j = cur ; j >= frequency ; j -- ) { temp /= i . first ; } ans = max ( temp , ans ) ; } cout << ans ; } int main ( ) { int P = 10 , Q = 4 ; findTheGreatestX ( P , Q ) ; return 0 ; }

Index/key variables: Q, i
Accumulator variables: Q, cur, i, j, stdc, temp
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; string checkRearrangements ( vector < vector < int > > mat , int N , int M ) { for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 1 ; j < M ; j ++ ) { if ( mat [ i ] [ 0 ] != mat [ i ] [ j ] ) { return " Yes " ; } } } return " No " ; } string nonZeroXor ( vector < vector < int > > mat , int N , int M ) { int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { res = res ^ mat [ i ] [ 0 ] ; } if ( res != 0 ) return " Yes " ; else return checkRearrangements ( mat , N , M ) ; } int main ( ) { vector < vector < int > > mat = { { 1 , 1 , 2 } , { 2 , 2 , 2 } , { 3 , 3 , 3 } } ; int N = mat . size ( ) ; int M = mat [ 0 ] . size ( ) ; cout << nonZeroXor ( mat , N , M ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define size_int  32
int functionMax ( int arr [ ] , int n ) { vector < int > setBit [ 32 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < size_int ; j ++ ) { if ( arr [ i ] & ( 1 << j ) ) setBit [ j ] . push_back ( i ) ; } } for ( int i = size_int ; i >= 0 ; i -- ) { if ( setBit [ i ] . size ( ) == 1 ) { swap ( arr [ 0 ] , arr [ setBit [ i ] [ 0 ] ] ) ; break ; } } int maxAnd = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { maxAnd = maxAnd & ( ~ arr [ i ] ) ; } return maxAnd ; } int main ( ) { int arr [ ] = { 1 , 2 , 4 , 8 , 16 } ; int n = sizeof arr / sizeof arr [ 0 ] ; cout << functionMax ( arr , n ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int nCr ( int n , int r ) { int res = 1 ; if ( r > n - r ) r = n - r ; for ( int i = 0 ; i < r ; ++ i ) { res *= ( n - i ) ; res /= ( i + 1 ) ; } return res ; } int solve ( int n , int m , int k ) { int sum = 0 ; for ( int i = 0 ; i <= k ; i ++ ) sum += nCr ( n , i ) * nCr ( m , k - i ) ; return sum ; } int main ( ) { int n = 3 , m = 2 , k = 2 ; cout << solve ( n , m , k ) ; return 0 ; }

Accumulator variables: i, res, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findMaximumGcd ( int n ) { int max_gcd = 1 ; for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { if ( i > max_gcd ) max_gcd = i ; if ( ( n / i != i ) && ( n / i != n ) && ( ( n / i ) > max_gcd ) ) max_gcd = n / i ; } } return max_gcd ; } int main ( ) { int N = 10 ; cout << findMaximumGcd ( N ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
#define x  2000021
using namespace std ; long long int v [ x ] ; void sieve ( ) { v [ 1 ] = 1 ; for ( long long int i = 2 ; i < x ; i ++ ) v [ i ] = i ; for ( long long int i = 4 ; i < x ; i += 2 ) v [ i ] = 2 ; for ( long long int i = 3 ; i * i < x ; i ++ ) { if ( v [ i ] == i ) { for ( long long int j = i * i ; j < x ; j += i ) { if ( v [ j ] == j ) { v [ j ] = i ; } } } } } long long int prime_factors ( long long n ) { set < long long int > s ; while ( n != 1 ) { s . insert ( v [ n ] ) ; n = n / v [ n ] ; } return s . size ( ) ; } void distinctPrimes ( long long int m , long long int k ) { vector < long long int > result ; for ( long long int i = 14 ; i < m + k ; i ++ ) { long long count = prime_factors ( i ) ; if ( count == k ) { result . push_back ( i ) ; } } long long int p = result . size ( ) ; for ( long long int index = 0 ; index < p - 1 ; index ++ ) { long long element = result [ index ] ; long long count = 1 , z = index ; while ( z < p - 1 && count <= k && result [ z ] + 1 == result [ z + 1 ] ) { count ++ ; z ++ ; } if ( count >= k ) cout << element << ' ▁ ' ; } } int main ( ) { sieve ( ) ; long long int N = 1000 , K = 3 ; distinctPrimes ( N , K ) ; return 0 ; }

Index/key variables: i, index, j, n, x, z
Accumulator variables: count, i, index, j, stdc, z
Iterator variables: i, index, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void print_product ( int a , int b , int c , int d ) { int prod1 = a * c ; int prod2 = b * d ; int prod3 = ( a + b ) * ( c + d ) ; int real = prod1 - prod2 ; int imag = prod3 - ( prod1 + prod2 ) ; cout << real << " ▁ + ▁ " << imag << " i " ; } int main ( ) { int a , b , c , d ; a = 2 ; b = 3 ; c = 4 ; d = 5 ; print_product ( a , b , c , d ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isInsolite ( int n ) { int N = n ; int sum = 0 ; int product = 1 ; while ( n != 0 ) { int r = n % 10 ; sum = sum + r * r ; product = product * r * r ; n = n / 10 ; } return ( N % sum == 0 ) && ( N % product == 0 ) ; } int main ( ) { int N = 111 ; if ( isInsolite ( N ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sigma ( int n ) { if ( n == 1 ) return 1 ; int result = 0 ; for ( int i = 2 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == ( n / i ) ) result += i ; else result += ( i + n / i ) ; } } return ( result + n + 1 ) ; } bool isSuperabundant ( int N ) { for ( float i = 1 ; i < N ; i ++ ) { float x = sigma ( i ) / i ; float y = sigma ( N ) / ( N * 1.0 ) ; if ( x > y ) return false ; } return true ; } int main ( ) { int N = 4 ; isSuperabundant ( N ) ? cout << " Yes " : cout << " No " ; return 0 ; }

Accumulator variables: i, result, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int isDNum ( int n ) { if ( n < 4 ) return false ; int numerator , hcf ; for ( int k = 2 ; k <= n ; k ++ ) { numerator = pow ( k , n - 2 ) - k ; hcf = __gcd ( n , k ) ; } if ( hcf == 1 && ( numerator % n ) != 0 ) return false ; return true ; } int main ( ) { int n = 15 ; int a = isDNum ( n ) ; if ( a ) cout << " Yes " ; else cout << " No " ; }

Accumulator variables: k, stdc
Iterator variables: k
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Sum ( int N ) { int SumOfPrimeDivisors [ N + 1 ] = { 0 } ; for ( int i = 2 ; i <= N ; ++ i ) { if ( ! SumOfPrimeDivisors [ i ] ) { for ( int j = i ; j <= N ; j += i ) { SumOfPrimeDivisors [ j ] += i ; } } } return SumOfPrimeDivisors [ N ] ; } bool RuthAaronNumber ( int n ) { if ( Sum ( n ) == Sum ( n + 1 ) ) return true ; else return false ; } int main ( ) { int N = 714 ; if ( RuthAaronNumber ( N ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }

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

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int mod = 1000000007 ; int linearSum ( int n ) { return ( n * ( n + 1 ) / 2 ) % mod ; } int rangeSum ( int b , int a ) { return ( linearSum ( b ) - linearSum ( a ) ) % mod ; } int totalSum ( int n ) { int result = 0 ; int i = 1 ; while ( true ) { result += rangeSum ( n / i , n / ( i + 1 ) ) * ( i % mod ) % mod ; result %= mod ; if ( i == n ) break ; i = n / ( n / ( i + 1 ) ) ; } return result ; } int main ( ) { int N = 4 ; cout << totalSum ( N ) << endl ; N = 12 ; cout << totalSum ( N ) << endl ; return 0 ; }

Accumulator variables: result, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isDouble ( int num ) { string s = to_string ( num ) ; int l = s . length ( ) ; if ( s [ 0 ] == s [ 1 ] ) return false ; if ( l % 2 == 1 ) { s = s + s [ 1 ] ; l ++ ; } string s1 = s . substr ( 0 , l / 2 ) ; string s2 = s . substr ( l / 2 ) ; return s1 == s2 ; } bool isNontrivialUndulant ( int N ) { return N > 100 && isDouble ( N ) ; } int main ( ) { int n = 121 ; if ( isNontrivialUndulant ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: l, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int MegagonNum ( int n ) { return ( 999998 * n * n - 999996 * n ) / 2 ; } int main ( ) { int n = 3 ; cout << MegagonNum ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define mod  1000000007
int productPairs ( int arr [ ] , int n ) { int product = 1 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { product *= ( arr [ i ] % mod * arr [ j ] % mod ) % mod ; product = product % mod ; } } return product % mod ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << productPairs ( arr , n ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, product, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define mod  1000000007
#define ll  long long int
int power ( int x , unsigned int y ) { int p = 1000000007 ; int res = 1 ; x = x % p ; while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } ll productPairs ( ll arr [ ] , ll n ) { ll product = 1 ; for ( int i = 0 ; i < n ; i ++ ) { product = ( product % mod * ( int ) power ( arr [ i ] , ( 2 * n ) ) % mod ) % mod ; } return product % mod ; } int main ( ) { ll arr [ ] = { 1 , 2 , 3 } ; ll n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << productPairs ( 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 constructArray ( int N ) { int arr [ N ] ; for ( int i = 1 ; i <= N ; i ++ ) { arr [ i - 1 ] = i ; } for ( int i = 0 ; i < N ; i ++ ) { cout << arr [ i ] << " , ▁ " ; } } int main ( ) { int N = 6 ; constructArray ( N ) ; return 0 ; }

Index/key variables: N, i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPrime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i < n ; i ++ ) if ( n % i == 0 ) return false ; return true ; } int countSubsequences ( int arr [ ] , int n ) { int totalSubsequence = pow ( 2 , n ) - 1 ; int countPrime = 0 , countOnes = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 1 ) countOnes ++ ; else if ( isPrime ( arr [ i ] ) ) countPrime ++ ; } int compositeSubsequence ; int onesSequence = pow ( 2 , countOnes ) - 1 ; compositeSubsequence = totalSubsequence - countPrime - onesSequence - onesSequence * countPrime ; return compositeSubsequence ; } int main ( ) { int arr [ ] = { 2 , 1 , 2 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << countSubsequences ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: countOnes, countPrime, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void checksum ( int n , int k ) { float first_term = ( ( 2 * n ) / k + ( 1 - k ) ) / 2.0 ; if ( first_term - int ( first_term ) == 0 ) { for ( int i = first_term ; i <= first_term + k - 1 ; i ++ ) { cout << i << " ▁ " ; } } else cout << " - 1" ; } int main ( ) { int n = 33 , k = 6 ; checksum ( n , k ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void sumEvenNumbers ( int N , int K ) { int check = N - 2 * ( K - 1 ) ; if ( check > 0 && check % 2 == 0 ) { for ( int i = 0 ; i < K - 1 ; i ++ ) { cout << "2 ▁ " ; } cout << check ; } else { cout << " - 1" ; } } int main ( ) { int N = 8 ; int K = 2 ; sumEvenNumbers ( N , K ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; vector < int > calculateWays ( int N ) { int x = 0 ; vector < int > v ; for ( int i = 0 ; i < N ; i ++ ) v . push_back ( 0 ) ; for ( int i = 0 ; i <= N / 2 ; i ++ ) { if ( N % 2 == 0 && i == N / 2 ) break ; x = N * ( i + 1 ) - ( i + 1 ) * i ; v [ i ] = x ; v [ N - i - 1 ] = x ; } return v ; } void printArray ( vector < int > v ) { for ( int i = 0 ; i < v . size ( ) ; i ++ ) cout << v [ i ] << " ▁ " ; } int main ( ) { vector < int > v ; v = calculateWays ( 4 ) ; printArray ( v ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAXN  10000000
int sumOfDigits ( int n ) { int sum = 0 ; while ( n > 0 ) { sum += n % 10 ; n /= 10 ; } return sum ; } int smallestNum ( int X , int Y ) { int res = -1 ; for ( int i = X ; i < MAXN ; i ++ ) { int sum_of_digit = sumOfDigits ( i ) ; if ( sum_of_digit % Y == 0 ) { res = i ; break ; } } return res ; } int main ( ) { int X = 5923 , Y = 13 ; cout << smallestNum ( X , Y ) ; return 0 ; }

Accumulator variables: i, n, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countValues ( int N ) { vector < int > div ; for ( int i = 2 ; i * i <= N ; i ++ ) { if ( N % i == 0 ) { div . push_back ( i ) ; if ( N != i * i ) { div . push_back ( N / i ) ; } } } int answer = 0 ; for ( int i = 1 ; i * i <= N - 1 ; i ++ ) { if ( ( N - 1 ) % i == 0 ) { if ( i * i == N - 1 ) answer ++ ; else answer += 2 ; } } for ( auto d : div ) { int K = N ; while ( K % d == 0 ) K /= d ; if ( ( K - 1 ) % d == 0 ) answer ++ ; } return answer ; } int main ( ) { int N = 6 ; cout << countValues ( N ) ; return 0 ; }

Accumulator variables: K, answer, i, stdc
Iterator variables: d, i
C++ program:
#include <iostream>
using namespace std ; #define ll  long long int
void findMaxPrimeDivisor ( int n ) { int max_possible_prime = 0 ; while ( n % 2 == 0 ) { max_possible_prime ++ ; n = n / 2 ; } for ( int i = 3 ; i * i <= n ; i = i + 2 ) { while ( n % i == 0 ) { max_possible_prime ++ ; n = n / i ; } } if ( n > 2 ) { max_possible_prime ++ ; } cout << max_possible_prime << " STRNEWLINE " ; } int main ( ) { int n = 4 ; findMaxPrimeDivisor ( n ) ; return 0 ; }

Accumulator variables: max_possible_prime
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int CountWays ( int n ) { int ans = ( n - 1 ) / 2 ; return ans ; } int main ( ) { int N = 8 ; cout << CountWays ( N ) ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void Solve ( int arr [ ] , int size , int n ) { vector < int > v ( n + 1 ) ; for ( int i = 0 ; i < size ; i ++ ) v [ arr [ i ] ] ++ ; int max1 = ( max_element ( v . begin ( ) , v . end ( ) ) - v . begin ( ) ) ; int diff1 = n + 1 - count ( v . begin ( ) , v . end ( ) , 0 ) ; int max_size = max ( min ( v [ max1 ] - 1 , diff1 ) , min ( v [ max1 ] , diff1 - 1 ) ) ; cout << " Maximum ▁ size ▁ is ▁ : " << max_size << " STRNEWLINE " ; cout << " The ▁ First ▁ Array ▁ Is ▁ : ▁ STRNEWLINE " ; for ( int i = 0 ; i < max_size ; i ++ ) { cout << max1 << " ▁ " ; v [ max1 ] -= 1 ; } cout << " STRNEWLINE " ; cout << " The ▁ Second ▁ Array ▁ Is ▁ : ▁ STRNEWLINE " ; for ( int i = 0 ; i < ( n + 1 ) ; i ++ ) { if ( v [ i ] > 0 ) { cout << i << " ▁ " ; max_size -- ; } if ( max_size < 1 ) break ; } cout << " STRNEWLINE " ; } int main ( ) { int n = 7 ; int arr [ ] = { 1 , 2 , 1 , 5 , 1 , 6 , 7 , 2 } ; int size = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; Solve ( arr , size , n ) ; return 0 ; }

Index/key variables: i, max1
Accumulator variables: i, max_size, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int power ( int x , int y , int p ) { int res = 1 ; x = x % p ; while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } int modInverse ( int n , int p ) { return power ( n , p - 2 , p ) ; } int nCrModPFermat ( int n , int r , int p ) { if ( r == 0 ) return 1 ; if ( n < r ) return 0 ; int fac [ n + 1 ] ; fac [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) fac [ i ] = fac [ i - 1 ] * i % p ; return ( fac [ n ] * modInverse ( fac [ r ] , p ) % p * modInverse ( fac [ n - r ] , p ) % p ) % p ; } int SumOfXor ( int a [ ] , int n ) { int mod = 10037 ; int answer = 0 ; for ( int k = 0 ; k < 32 ; k ++ ) { int x = 0 , y = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] & ( 1 << k ) ) x ++ ; else y ++ ; } answer += ( ( 1 << k ) % mod * ( nCrModPFermat ( x , 3 , mod ) + x * nCrModPFermat ( y , 2 , mod ) ) % mod ) % mod ; } return answer ; } int main ( ) { int n = 5 ; int A [ n ] = { 3 , 5 , 2 , 18 , 7 } ; cout << SumOfXor ( A , n ) ; return 0 ; }

Index/key variables: i, n, r
Accumulator variables: answer, i, k, stdc, x, y
Iterator variables: i, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; float round ( float var , int digit ) { float value = ( int ) ( var * pow ( 10 , digit ) + .5 ) ; return ( float ) value / pow ( 10 , digit ) ; } int probability ( int N ) { int a = 2 ; int b = 3 ; if ( N == 1 ) { return a ; } else if ( N == 2 ) { return b ; } else { for ( int i = 3 ; i <= N ; i ++ ) { int c = a + b ; a = b ; b = c ; } return b ; } } float operations ( int N ) { int x = probability ( N ) ; int y = pow ( 2 , N ) ; return round ( ( float ) x / ( float ) y , 2 ) ; } int main ( ) { int N = 10 ; cout << ( operations ( N ) ) ; }

Accumulator variables: i, stdc
Iterator variables: i