dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printPermutation ( int arr [ ] , int n , int k ) { bool flag = false ; sort ( arr , arr + n ) ; do { int sum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { sum += arr [ i ] & arr [ i + 1 ] ; } if ( sum >= k ) { flag = true ; for ( int i = 0 ; i < n ; i ++ ) { cout << arr [ i ] << " ▁ " ; } cout << " STRNEWLINE " ; } } while ( next_permutation ( arr , arr + n ) ) ; if ( flag == false ) { cout << " - 1" ; } } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 } ; int K = 8 ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; printPermutation ( arr , N , K ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, sum
Iterator variables: i
Boolean variables: flag
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findMissingNumbers ( int arr [ ] , int len ) { const int M = 15 ; bitset < M > bset ; for ( int i = 0 ; i < M ; i ++ ) { bset . set ( i ) ; } for ( int i = 0 ; i < len ; i ++ ) { bset . set ( arr [ i ] - 1 , 0 ) ; } for ( int i = bset . _Find_first ( ) ; i < bset . size ( ) ; i = bset . _Find_next ( i ) ) { if ( i + 1 > len ) break ; cout << i + 1 << endl ; } } int main ( ) { int arr [ ] = { 1 , 2 , 4 , 6 , 8 , 9 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; findMissingNumbers ( 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 findSum ( int a , int b , int n ) { if ( n == 1 ) { cout << a ; return ; } int s = a + b ; for ( int i = 0 ; i < n - 2 ; i ++ ) { int x = a xor b ; s += x ; a = b ; b = x ; } cout << s ; } int main ( ) { int a = 2 , b = 5 , N = 8 ; findSum ( a , b , N ) ; return 0 ; }

Accumulator variables: i, s, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findSum ( int a , int b , int n ) { int sum = 0 ; int x = a ^ b ; if ( n % 3 == 0 ) { sum = ( n / 3 ) * ( a + b + x ) ; } else if ( n % 3 == 1 ) { sum = ( n / 3 ) * ( a + b + x ) + a ; } else { sum = ( n / 3 ) * ( a + b + x ) + a + b ; } cout << sum ; } int main ( ) { int a = 2 , b = 5 , N = 8 ; findSum ( a , b , N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int LongestLenXORK ( int arr [ ] , int N , int K ) { int prefixXOR = 0 ; int maxLen = 0 ; map < int , int > mp ; mp [ 0 ] = -1 ; for ( int i = 0 ; i < N ; i ++ ) { prefixXOR ^= arr [ i ] ; if ( mp . count ( prefixXOR ^ K ) ) { maxLen = max ( maxLen , ( i - mp [ prefixXOR ^ K ] ) ) ; } if ( ! mp . count ( prefixXOR ) ) { mp [ prefixXOR ] = i ; } } return maxLen ; } int main ( ) { int arr [ ] = { 1 , 2 , 4 , 7 , 2 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int K = 1 ; cout << LongestLenXORK ( arr , N , K ) ; return 0 ; }

Index/key variables: i, prefixXOR
Accumulator variables: i, prefixXOR, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define N  3
#define M  3
void intializeDiff ( int D [ N ] [ M + 1 ] , int A [ N ] [ M ] ) { for ( int i = 0 ; i < N ; i ++ ) { D [ i ] [ 0 ] = A [ i ] [ 0 ] ; D [ i ] [ M ] = 0 ; } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 1 ; j < M ; j ++ ) D [ i ] [ j ] = A [ i ] [ j ] - A [ i ] [ j - 1 ] ; } } void update ( int D [ N ] [ M + 1 ] , int k , int r1 , int c1 , int r2 , int c2 ) { for ( int i = r1 ; i <= r2 ; i ++ ) { D [ i ] [ c1 ] += k ; D [ i ] [ c2 + 1 ] -= k ; } } void printArray ( int A [ N ] [ M ] , int D [ N ] [ M + 1 ] ) { for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { if ( j == 0 ) A [ i ] [ j ] = D [ i ] [ j ] ; else A [ i ] [ j ] = D [ i ] [ j ] + A [ i ] [ j - 1 ] ; cout << A [ i ] [ j ] << " ▁ " ; } cout << endl ; } } void performQueries ( int A [ N ] [ M ] , vector < vector < int > > Queries ) { int D [ N ] [ M + 1 ] ; intializeDiff ( D , A ) ; int Q = Queries . size ( ) ; for ( int i = 0 ; i < Q ; i ++ ) { update ( D , Queries [ i ] [ 0 ] , Queries [ i ] [ 1 ] , Queries [ i ] [ 2 ] , Queries [ i ] [ 3 ] , Queries [ i ] [ 4 ] ) ; } printArray ( A , D ) ; } int main ( ) { int A [ N ] [ M ] = { { 1 , 2 , 3 } , { 1 , 1 , 0 } , { 4 , -2 , 2 } } ; vector < vector < int > > Queries = { { 2 , 0 , 0 , 1 , 1 } , { -1 , 1 , 0 , 2 , 2 } } ; performQueries ( A , Queries ) ; return 0 ; }

Index/key variables: M, N, c1, i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; unsigned int onesComplement ( unsigned int n , int maxElement ) { int bits = floor ( log2 ( maxElement ) ) + 1 ; return ( ( 1 << bits ) - 1 ) ^ n ; } int findNumber ( int arr [ ] , int n ) { unsigned int res = 0 ; int maxElement = 0 ; for ( int i = 0 ; i < n ; i ++ ) { res = res ^ arr [ i ] ; if ( maxElement < arr [ i ] ) maxElement = arr [ i ] ; } res = onesComplement ( res , maxElement ) ; return ( res ) ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << findNumber ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; vector < int > calculateFactorial ( int N ) { vector < int > fact ( N + 1 ) ; fact [ 0 ] = 1 ; for ( int i = 1 ; i <= N ; i ++ ) { fact [ i ] = fact [ i - 1 ] * i ; } return fact ; } int cntWaysSelection ( int arr [ ] , int N , int K , int L , int R ) { int cntWays = 0 ; int cntNum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] >= L && arr [ i ] <= R ) { cntNum ++ ; } } vector < int > fact = calculateFactorial ( cntNum ) ; for ( int i = K ; i <= cntNum ; i ++ ) { cntWays += fact [ cntNum ] / ( fact [ i ] * fact [ cntNum - i ] ) ; } return cntWays ; } int main ( ) { int arr [ ] = { 12 , 4 , 6 , 13 , 5 , 10 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int K = 3 ; int L = 4 ; int R = 10 ; cout << cntWaysSelection ( arr , N , K , L , R ) ; }

Index/key variables: cntNum, i
Accumulator variables: cntNum, cntWays, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int TotalAndPair ( int arr [ ] , int N ) { int totalAND = ( 1 << 30 ) - 1 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { totalAND &= arr [ i ] & arr [ j ] ; } } return totalAND ; } int main ( ) { int arr [ ] = { 4 , 5 , 12 , 15 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << TotalAndPair ( arr , N ) ; }

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

Accumulator variables: N, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define M  1000000007
long long findTripleSum ( long long A , long long B , long long C ) { long long sum = 0 ; for ( long long i = 1 ; i <= A ; i ++ ) { for ( long long j = 1 ; j <= B ; j ++ ) { for ( long long k = 1 ; k <= C ; k ++ ) { long long prod = ( ( ( i % M ) * ( j % M ) ) % M * ( k % M ) ) % M ; sum = ( sum + prod ) % M ; } } } return sum ; } int main ( ) { long long A = 10 ; long long B = 100 ; long long C = 1000 ; cout << findTripleSum ( A , B , C ) ; return 0 ; }

Accumulator variables: i, j, k, stdc
Iterator variables: i, j, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define M  1000000007
long long power ( long long x , long long N ) { long long res = 1 ; while ( N > 0 ) { if ( N & 1 ) { res = ( res * x ) % M ; } x = ( x * x ) % M ; N = N >> 1 ; } return res ; } long long modinv ( long long X ) { return power ( X , M - 2 ) ; } int findTripleSum ( long long A , long long B , long long C ) { long long MMI = modinv ( 8 ) ; long long res = 0 ; res = ( ( ( ( A % M * ( A + 1 ) % M ) % M * ( B % M * ( B + 1 ) % M ) % M ) % M * ( C % M * ( C + 1 ) % M ) % M ) % M * MMI ) % M ; return res ; } int main ( ) { long long A = 10 ; long long B = 100 ; long long C = 1000 ; cout << findTripleSum ( A , B , C ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getMaximum ( int N , int M , vector < vector < int > > mat ) { int global_max = INT_MIN ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { int row_min = INT_MAX ; for ( int k = 0 ; k < M ; k ++ ) { int m = max ( mat [ i ] [ k ] , mat [ j ] [ k ] ) ; row_min = min ( row_min , m ) ; } global_max = max ( global_max , row_min ) ; } } return global_max ; } int main ( ) { vector < vector < int > > mat = { { 5 , 0 , 3 , 1 , 2 } , { 1 , 8 , 9 , 1 , 3 } , { 1 , 2 , 3 , 4 , 5 } , { 9 , 1 , 0 , 3 , 7 } , { 2 , 3 , 0 , 6 , 3 } , { 6 , 4 , 1 , 7 , 0 } } ; int N = 6 , M = 5 ; cout << getMaximum ( N , M , mat ) ; return 0 ; }

Index/key variables: i, j, k
Accumulator variables: i, j, k, stdc
Iterator variables: i, j, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; void makeTree ( vector < int > tree [ ] , pair < int , int > edges [ ] , int N ) { for ( int i = 0 ; i < N - 1 ; i ++ ) { int u = edges [ i ] . first ; int v = edges [ i ] . second ; tree [ u ] . push_back ( v ) ; } } pair < int , int > dfs ( int node , vector < int > tree [ ] ) { int mex = 0 ; int size = 1 ; for ( int u : tree [ node ] ) { pair < int , int > temp = dfs ( u , tree ) ; mex = max ( mex , temp . first ) ; size += temp . second ; } return { mex + size , size } ; } int main ( ) { int N = 7 ; pair < int , int > edges [ ] = { { 1 , 4 } , { 1 , 5 } , { 5 , 2 } , { 5 , 3 } , { 4 , 7 } , { 7 , 6 } } ; vector < int > tree [ N + 1 ] ; makeTree ( tree , edges , N ) ; cout << dfs ( 1 , tree ) . first ; return 0 ; }

Index/key variables: i, node, u
Accumulator variables: i, size, stdc
Iterator variables: i, u
C++ program:
#include <bits/stdc++.h>
using namespace std ; int divisorCount ( int n ) { int x = 0 ; for ( int i = 1 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == n / i ) x ++ ; else x += 2 ; } } return x ; } int minvalue_y ( int x ) { int a = divisorCount ( x ) ; int y = x + 1 ; while ( ( a & 1 ) == ( divisorCount ( y ) & 1 ) ) y ++ ; return y ; } int main ( ) { int x = 5 ; cout << minvalue_y ( x ) << endl ; return 0 ; }

Accumulator variables: i, stdc, x, y
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minvalue_y ( int x ) { int n = sqrt ( x ) ; if ( n * n == x ) return x + 1 ; return pow ( n + 1 , 2 ) ; } int main ( ) { int x = 5 ; cout << minvalue_y ( x ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int alternatingSumOfFirst_N ( int N ) { int alternateSum = 0 ; if ( N % 2 == 0 ) { alternateSum = ( - N ) / 2 ; } else { alternateSum = ( N + 1 ) / 2 ; } return alternateSum ; } int main ( ) { int N = 6 ; cout << alternatingSumOfFirst_N ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minStartValue ( vector < int > & nums ) { int minValue = 0 ; int sum = 0 ; for ( auto n : nums ) { sum += n ; minValue = min ( minValue , sum ) ; } int startValue = 1 - minValue ; return startValue ; } int main ( ) { vector < int > nums = { -3 , 2 , -3 , 4 , 2 } ; cout << minStartValue ( nums ) ; return 0 ; }

Accumulator variables: stdc, sum
Iterator variables: n
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countSubArrayRemove ( int arr [ ] , int N ) { unordered_map < int , int > prefix_element_count , suffix_element_count ; int total_sum_of_elements = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { total_sum_of_elements += arr [ i ] ; suffix_element_count [ arr [ i ] ] ++ ; } int prefix_sum = 0 ; int suffix_sum = 0 ; int count_subarray_equal_sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { prefix_sum += arr [ i ] ; prefix_element_count [ arr [ i ] ] ++ ; suffix_sum = total_sum_of_elements - prefix_sum ; suffix_element_count [ arr [ i ] ] -- ; int difference = prefix_sum - suffix_sum ; int number_of_subarray_at_i_split = prefix_element_count [ difference ] + suffix_element_count [ - difference ] ; count_subarray_equal_sum += number_of_subarray_at_i_split ; } return count_subarray_equal_sum ; } int main ( ) { int arr [ ] = { 1 , 2 , 1 , 1 , 3 , 1 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << countSubArrayRemove ( arr , N ) ; return 0 ; }

Index/key variables: difference, i
Accumulator variables: count_subarray_equal_sum, i, prefix_sum, stdc, total_sum_of_elements
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countXORSetBitsAdjElemRange1_N ( int N ) { int total_set_bits = 0 ; int bit_Position = 1 ; while ( N ) { total_set_bits += ( ( N + 1 ) / 2 * bit_Position ) ; N -= ( N + 1 ) / 2 ; bit_Position ++ ; } return total_set_bits ; } int main ( ) { int N = 4 ; cout << countXORSetBitsAdjElemRange1_N ( N ) ; return 0 ; }

Accumulator variables: N, bit_Position, stdc, total_set_bits
C++ program:
#include <bits/stdc++.h>
using namespace std ; int checkPerfectSquare ( int N ) { if ( N <= 0 ) { return 0 ; } double sq = sqrt ( N ) ; if ( floor ( sq ) == ceil ( sq ) ) { return 1 ; } return 0 ; } bool checktwoSidesareRighTriangle ( int A , int B ) { bool checkTriangle = false ; if ( checkPerfectSquare ( A * A + B * B ) ) { checkTriangle = true ; } if ( checkPerfectSquare ( A * A - B * B ) ) { checkTriangle = true ; } if ( checkPerfectSquare ( B * B - A * A ) ) { checkTriangle = true ; } return checkTriangle ; } int main ( ) { int A = 3 , B = 4 ; if ( checktwoSidesareRighTriangle ( A , B ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }

Accumulator variables: stdc
Boolean variables: checkTriangle
C++ program:
#include <bits/stdc++.h>
using namespace std ; int array_sum ( int arr [ ] , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; return sum ; } int countOperations ( int arr [ ] , int N ) { int count_zeros = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] == 0 ) count_zeros ++ ; } int sum = array_sum ( arr , N ) ; if ( count_zeros ) return count_zeros ; if ( sum == 0 ) return 1 ; return 0 ; } int main ( ) { int arr [ ] = { -1 , -1 , 0 , 0 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << countOperations ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count_zeros, i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int TotalBitwiseORPair ( int arr [ ] , int N ) { int totalOR = 0 ; for ( int i = 0 ; i < N ; i ++ ) { totalOR |= arr [ i ] ; } return totalOR ; } int main ( ) { int arr [ ] = { 4 , 5 , 12 , 15 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << TotalBitwiseORPair ( arr , N ) ; }

Index/key variables: i
Accumulator variables: i, stdc, totalOR
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findDifference ( vector < int > & p , vector < int > & q , int N ) { vector < int > A ( N ) ; for ( int i = 0 ; i < N ; i ++ ) A [ i ] = i + 1 ; bool IsCorrect ; int a = 1 , b = 1 ; do { IsCorrect = true ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] != p [ i ] ) { IsCorrect = false ; break ; } } if ( IsCorrect ) break ; a ++ ; } while ( next_permutation ( A . begin ( ) , A . end ( ) ) ) ; for ( int i = 0 ; i < N ; i ++ ) A [ i ] = i + 1 ; do { IsCorrect = true ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] != q [ i ] ) { IsCorrect = false ; break ; } } if ( IsCorrect ) break ; b ++ ; } while ( next_permutation ( A . begin ( ) , A . end ( ) ) ) ; cout << abs ( a - b ) << endl ; } int main ( ) { vector < int > p = { 1 , 3 , 2 } ; vector < int > q = { 3 , 1 , 2 } ; int n = p . size ( ) ; findDifference ( p , q , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: a, b, i, stdc
Iterator variables: i
Boolean variables: IsCorrect
C++ program:
#include <iostream>
using namespace std ; #define ll  long long int
int printFinalArray ( int * a , int n , int * operations , int p , int capacity ) { int i , curr = 0 ; bool picked = false ; for ( i = 0 ; i < p ; i ++ ) { int s = operations [ i ] ; bool flag = false ; switch ( s ) { case 1 : if ( curr != 0 ) curr -- ; break ; case 2 : if ( curr != n - 1 ) curr ++ ; break ; case 3 : if ( picked == false && a [ curr ] != 0 ) { picked = true ; a [ curr ] -- ; } break ; case 4 : if ( picked == true && a [ curr ] != capacity ) { picked = false ; a [ curr ] ++ ; } break ; default : flag = true ; } if ( flag == true ) break ; } for ( i = 0 ; i < n ; i ++ ) { cout << a [ i ] << " ▁ " ; } } int main ( ) { int capacity = 5 ; int a [ ] = { 2 , 5 , 2 } ; int N = sizeof ( a ) / sizeof ( a [ 0 ] ) ; int operations [ ] = { 3 , 2 , 4 , 1 , 4 , 5 } ; int M = sizeof ( operations ) / sizeof ( operations [ 0 ] ) ; printFinalArray ( a , N , operations , M , capacity ) ; return 0 ; }

Index/key variables: curr, i
Accumulator variables: curr, i
Iterator variables: i
Boolean variables: flag, picked
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } void CheckSumPrime ( int A [ ] , int N ) { int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { string s = to_string ( A [ i ] ) ; sum += s . length ( ) ; } if ( isPrime ( sum ) ) { cout << " Yes " << endl ; } else { cout << " No " << endl ; } } int main ( ) { int A [ ] = { 1 , 11 , 12 } ; int N = sizeof ( A ) / sizeof ( A [ 0 ] ) ; CheckSumPrime ( A , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; long long int power ( long long int x , long long int N ) { long long int res = 1 ; while ( N > 0 ) { if ( N & 1 ) { res = ( res * x ) ; } x = ( x * x ) ; N = N >> 1 ; } return res ; } void probablityPrimeprod ( long long int N ) { long long int N_E = 3 * N ; long long int N_S = power ( 6 , N ) ; cout << N_E << " ▁ / ▁ " << N_S ; } int main ( ) { long long int N = 2 ; probablityPrimeprod ( N ) ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool checkPalindrome ( int N ) { int rev = 0 ; int temp = N ; while ( N != 0 ) { rev = rev * 10 + N % 10 ; N = N / 10 ; } N = temp ; if ( N == rev ) { return true ; } return false ; } int closestSmallerPalindrome ( int N ) { do { N -- ; } while ( N >= 0 && ! checkPalindrome ( N ) ) ; return N ; } int main ( ) { int N = 4000 ; cout << closestSmallerPalindrome ( N ) ; return 0 ; }

Accumulator variables: N, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int MinimumOperationReq ( int N ) { int cntDecr = 0 ; int temp = N ; while ( temp > 0 ) { int X = sqrt ( temp ) ; if ( X * X == temp ) { break ; } temp = temp - 2 ; cntDecr += 1 ; } int cntIncr = 0 ; while ( true ) { int X = sqrt ( N ) ; if ( X * X == N ) { break ; } N = N + 2 ; cntIncr += 1 ; } return min ( cntIncr , cntDecr ) ; } int main ( ) { int N = 15 ; cout << MinimumOperationReq ( N ) ; return 0 ; }

Accumulator variables: cntDecr, cntIncr, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define M  1000000007
long long power ( long long x , long long N ) { long long res = 1 ; while ( N > 0 ) { if ( N & 1 ) { res = ( res * x ) % M ; } x = ( x * x ) % M ; N = N >> 1 ; } return res ; } long long moduloInverse ( long long X ) { return power ( X , M - 2 ) ; } long long F_1 ( long long N , long long F_N ) { long long P_2 = power ( 2 , N - 1 ) ; long long modInv = moduloInverse ( P_2 ) ; long long res ; res = ( ( modInv % M ) * ( F_N % M ) ) % M ; return res ; } int main ( ) { long long N = 3 ; long long F_N = 6 ; cout << F_1 ( N , F_N ) ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define int  long long
void add ( vector < int > & arr , int x ) { arr . push_back ( x ) ; } void update ( int & effect , int x ) { effect = effect ^ x ; } void computeResults ( vector < int > & arr , int effect ) { for ( int i = 0 ; i < arr . size ( ) ; i ++ ) { arr [ i ] = arr [ i ] ^ effect ; cout << arr [ i ] << " ▁ " ; } } signed main ( ) { vector < int > arr = { 0 } ; int effect = 0 ; add ( arr , 5 ) ; update ( effect , 2 ) ; computeResults ( arr , effect ) ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findSubArray ( vector < int > arr , int k ) { pair < int , int > ans ; int i , sum = 0 ; for ( i = 0 ; i < k ; i ++ ) { sum += arr [ i ] ; } int found = 0 ; if ( sum % 3 == 0 ) { ans = make_pair ( 0 , i - 1 ) ; found = 1 ; } for ( int j = i ; j < arr . size ( ) ; j ++ ) { if ( found == 1 ) break ; sum = sum + arr [ j ] - arr [ j - k ] ; if ( sum % 3 == 0 ) { ans = make_pair ( j - k + 1 , j ) ; found = 1 ; } } if ( found == 0 ) ans = make_pair ( -1 , 0 ) ; if ( ans . first == -1 ) { cout << -1 ; } else { for ( i = ans . first ; i <= ans . second ; i ++ ) { cout << arr [ i ] << " ▁ " ; } } } int main ( ) { vector < int > arr = { 84 , 23 , 45 , 12 , 56 , 82 } ; int K = 3 ; findSubArray ( arr , K ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc, sum
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void calculateFact ( int fact [ ] , int N ) { fact [ 0 ] = 1 ; for ( long long int i = 1 ; i < N ; i ++ ) { fact [ i ] = fact [ i - 1 ] * i ; } } int nCr ( int fact [ ] , int N , int R ) { if ( R > N ) return 0 ; int res = fact [ N ] / fact [ R ] ; res /= fact [ N - R ] ; return res ; } int countWays ( vector < int > & arr , int fact [ ] ) { int N = arr . size ( ) ; if ( N <= 2 ) { return 1 ; } vector < int > leftSubTree ; vector < int > rightSubTree ; int root = arr [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { if ( arr [ i ] < root ) { leftSubTree . push_back ( arr [ i ] ) ; } else { rightSubTree . push_back ( arr [ i ] ) ; } } int N1 = leftSubTree . size ( ) ; int N2 = rightSubTree . size ( ) ; int countLeft = countWays ( leftSubTree , fact ) ; int countRight = countWays ( rightSubTree , fact ) ; return nCr ( fact , N - 1 , N1 ) * countLeft * countRight ; } int main ( ) { vector < int > arr ; arr = { 3 , 4 , 5 , 1 , 2 } ; int N = arr . size ( ) ; int fact [ N ] ; calculateFact ( fact , N ) ; cout << countWays ( arr , fact ) ; return 0 ; }

Index/key variables: N, R, i
Accumulator variables: i, res, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sumOfProd ( int arr [ ] , int N ) { int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += arr [ i ] ; } return sum * sum ; } int main ( ) { int arr [ ] = { 2 , 3 , 1 , 5 , 4 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << sumOfProd ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int rev ( int num ) { int rev_num = 0 ; while ( num > 0 ) { rev_num = rev_num * 10 + num % 10 ; num = num / 10 ; } return rev_num ; } bool check ( int n ) { return 2 * rev ( n ) == n + 1 ; } int main ( ) { int n = 73 ; if ( check ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPower ( int x , int y ) { int res1 = log ( y ) / log ( x ) ; double res2 = log ( y ) / log ( x ) ; return ( res1 == res2 ) ; } bool check ( int n ) { int x = ( n + 7 ) / 8 ; if ( ( n + 7 ) % 8 == 0 && isPower ( 10 , x ) ) return true ; else return false ; } int main ( ) { int n = 73 ; if ( check ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: stdc