dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sumofsquare ( int n ) { int C [ n + 1 ] [ n + 1 ] ; int i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= min ( i , n ) ; j ++ ) { if ( j == 0 j == i ) C [ i ] [ j ] = 1 ; else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ; } } int sum = 0 ; for ( int i = 0 ; i <= n ; i ++ ) sum += ( C [ n ] [ i ] * C [ n ] [ i ] ) ; return sum ; } int main ( ) { int n = 4 ; cout << sumofsquare ( n ) << endl ; return 0 ; }

Index/key variables: i, j, n
Accumulator variables: i, j, stdc, sum
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sumOfSeries ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) for ( int j = 1 ; j <= i ; j ++ ) sum = sum + i ; return sum ; } int main ( ) { int n = 10 ; cout << sumOfSeries ( n ) ; return 0 ; }

Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int evenSum ( int n ) { int C [ n + 1 ] [ n + 1 ] ; int i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= min ( i , n ) ; j ++ ) { if ( j == 0 j == i ) C [ i ] [ j ] = 1 ; else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ; } } int sum = 0 ; for ( int i = 0 ; i <= n ; i += 2 ) sum += C [ n ] [ i ] ; return sum ; } int main ( ) { int n = 4 ; cout << evenSum ( n ) << endl ; return 0 ; }

Index/key variables: i, j, n
Accumulator variables: i, j, stdc, sum
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void checksum ( int n ) { if ( n % 3 == 0 ) cout << n / 3 - 1 << " ▁ " << n / 3 << " ▁ " << n / 3 + 1 ; else cout << " - 1" ; } int main ( ) { int n = 6 ; checksum ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int divisorSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; ++ i ) sum += ( n / i ) * i ; return sum ; } int main ( ) { int n = 4 ; cout << " ▁ " << divisorSum ( n ) << endl ; n = 5 ; cout << " ▁ " << divisorSum ( n ) << endl ; return 0 ; }

Accumulator variables: stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; long long sum_all_divisors ( long long num ) { long long sum = 0 ; for ( long long i = 1 ; i <= sqrt ( num ) ; i ++ ) { sum += t1 + t2 ; } return sum ; } int main ( ) { int n ; long long sum = sum_all_divisors ( n ) ; cout << sum << ' ' ; return 0 ; }

Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; double polite ( double n ) { n += 1 ; double base = 2 ; return n + ( log ( ( n + ( log ( n ) / log ( base ) ) ) ) ) / log ( base ) ; } int main ( ) { double n = 7 ; cout << ( int ) polite ( n ) ; return 0 ; }

Accumulator variables: n, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int solve ( int low , int high , int T ) { while ( low <= high ) { int mid = ( low + high ) / 2 ; if ( ( mid * ( mid + 1 ) ) == T ) return mid ; if ( mid > 0 && ( mid * ( mid + 1 ) ) > T && ( mid * ( mid - 1 ) ) <= T ) return mid - 1 ; if ( ( mid * ( mid + 1 ) ) > T ) high = mid - 1 ; else low = mid + 1 ; } return -1 ; } int main ( ) { int T = 15 ; int ans = solve ( 1 , T , 2 * T ) ; if ( ans != -1 ) ans -- ; cout << " Number ▁ of ▁ stair ▁ steps ▁ = ▁ " << ans << endl ; return 0 ; }

Accumulator variables: ans, stdc
C++ program:
#include <iostream>
using namespace std ; int oddSum ( int n ) { int sum = 0 , curr = 1 ; for ( int i = 0 ; i < n ; i ++ ) { sum += curr ; curr += 2 ; } return sum ; } int main ( ) { int n = 20 ; cout << " ▁ Sum ▁ of ▁ first ▁ " << n << " ▁ Odd ▁ Numbers ▁ is : ▁ " << oddSum ( n ) ; return 0 ; }

Accumulator variables: curr, i, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printKPFNums ( int A , int B , int K ) { bool prime [ B + 1 ] = { true } ; int p_factors [ B + 1 ] = { 0 } ; for ( int p = 2 ; p <= B ; p ++ ) if ( p_factors [ p ] == 0 ) for ( int i = p ; i <= B ; i += p ) p_factors [ i ] ++ ; for ( int i = A ; i <= B ; i ++ ) if ( p_factors [ i ] == K ) cout << i << " ▁ " ; } int main ( ) { int A = 14 , B = 18 , K = 2 ; printKPFNums ( A , B , K ) ; return 0 ; }

Index/key variables: i, p
Accumulator variables: i, p, stdc
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  100005
bool prime [ MAX ] ; int prefix [ MAX ] , suffix [ MAX ] ; void precompute ( int prefix [ ] , int suffix [ ] ) { memset ( prime , true , sizeof ( prime ) ) ; for ( int i = 2 ; i * i < MAX ; i ++ ) { if ( prime [ i ] ) { for ( int j = i * i ; j < MAX ; j += i ) prime [ j ] = false ; } } prefix [ 1 ] = 1 ; suffix [ MAX - 1 ] = 1e9 + 7 ; for ( int i = 2 ; i < MAX ; i ++ ) { if ( prime [ i ] ) prefix [ i ] = i ; else prefix [ i ] = prefix [ i - 1 ] ; } for ( int i = MAX - 1 ; i > 1 ; i -- ) { if ( prime [ i ] ) suffix [ i ] = i ; else suffix [ i ] = suffix [ i + 1 ] ; } } int query ( int prefix [ ] , int suffix [ ] , int L , int R ) { if ( prefix [ R ] < L suffix [ L ] > R ) return 0 ; else return prefix [ R ] - suffix [ L ] ; } int main ( ) { int q = 3 ; int L [ ] = { 2 , 2 , 24 } ; int R [ ] = { 5 , 2 , 28 } ; precompute ( prefix , suffix ) ; for ( int i = 0 ; i < q ; i ++ ) cout << query ( prefix , suffix , L [ i ] , R [ i ] ) << endl ; return 0 ; }

Index/key variables: L, MAX, R, i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <math.h>
#include <iostream>
#include <boost/format.hpp>
class gfg { public : double sum ( int x , int n ) { double i , total = 1.0 ; for ( i = 1 ; i <= n ; i ++ ) total = total + ( pow ( x , i ) / i ) ; return total ; } } ; int main ( ) { gfg g ; int x = 2 ; int n = 5 ; std :: cout << boost :: format ( " % .2f " ) % g . sum ( x , n ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
Class/struct names: gfg
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isMember ( int a , int d , int x ) { if ( d == 0 ) return ( x == a ) ; return ( ( x - a ) % d == 0 && ( x - a ) / d >= 0 ) ; } int main ( ) { int a = 1 , x = 7 , d = 3 ; if ( isMember ( a , d , x ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int binomialCoeff ( int n , int k ) { int C [ k + 1 ] ; memset ( C , 0 , sizeof ( C ) ) ; C [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = min ( i , k ) ; j > 0 ; j -- ) C [ j ] = C [ j ] + C [ j - 1 ] ; } return C [ k ] ; } long long subsequences ( int a [ ] , int n , int r ) { unordered_map < int , int > left , right ; long long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) right [ a [ i ] ] ++ ; if ( r == 1 ) { for ( auto i : right ) { ans += binomialCoeff ( i . second , 3 ) ; } return ans ; } for ( int i = 0 ; i < n ; i ++ ) { long long c1 = 0 , c2 = 0 ; if ( a [ i ] % r == 0 ) c1 = left [ a [ i ] / r ] ; right [ a [ i ] ] -- ; c2 = right [ a [ i ] * r ] ; ans += c1 * c2 ; left [ a [ i ] ] ++ ; } return ans ; } int main ( ) { int a [ ] = { 1 , 2 , 6 , 2 , 3 , 6 , 9 , 18 , 3 , 9 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; int r = 3 ; cout << subsequences ( a , n , r ) ; return 0 ; }

Index/key variables: i, j, k
Accumulator variables: ans, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool sumSquare ( int n ) { for ( long i = 1 ; i * i <= n ; i ++ ) for ( long j = 1 ; j * j <= n ; j ++ ) if ( i * i + j * j == n ) { cout << i << " ^ 2 ▁ + ▁ " << j << " ^ 2" << endl ; return true ; } return false ; } int main ( ) { int n = 25 ; if ( sumSquare ( n ) ) cout << " Yes " ; else cout << " No " ; }

Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define M  6
#define N  7
void preCompute ( int mat [ M ] [ N ] , int prefixCnt [ M ] [ N ] ) { for ( int i = 0 ; i < M ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { if ( mat [ i ] [ j ] == 0 ) { prefixCnt [ i ] [ j ] = 1 ; } else { prefixCnt [ i ] [ j ] = 0 ; } } } for ( int i = 0 ; i < M ; i ++ ) for ( int j = 1 ; j < N ; j ++ ) prefixCnt [ i ] [ j ] += prefixCnt [ i ] [ j - 1 ] ; for ( int i = 1 ; i < M ; i ++ ) for ( int j = 0 ; j < N ; j ++ ) prefixCnt [ i ] [ j ] += prefixCnt [ i - 1 ] [ j ] ; } int countQuery ( int prefixCnt [ M ] [ N ] , int pi , int pj , int qi , int qj ) { int cnt = prefixCnt [ qi ] [ qj ] ; if ( pi > 0 ) cnt -= prefixCnt [ pi - 1 ] [ qj ] ; if ( pj > 0 ) cnt -= prefixCnt [ qi ] [ pj - 1 ] ; if ( pi > 0 && pj > 0 ) cnt += prefixCnt [ pi - 1 ] [ pj - 1 ] ; return cnt ; } void count0s ( int mat [ M ] [ N ] , int Q [ ] [ 4 ] , int sizeQ ) { int prefixCnt [ M ] [ N ] ; preCompute ( mat , prefixCnt ) ; for ( int i = 0 ; i < sizeQ ; i ++ ) { cout << countQuery ( prefixCnt , Q [ i ] [ 0 ] , Q [ i ] [ 1 ] , Q [ i ] [ 2 ] , Q [ i ] [ 3 ] ) << ' ▁ ' ; } } int main ( ) { int mat [ M ] [ N ] = { { 0 , 1 , 0 , 1 , 1 , 1 , 0 } , { 1 , 0 , 1 , 1 , 1 , 0 , 1 } , { 1 , 1 , 0 , 0 , 1 , 1 , 0 } , { 1 , 1 , 1 , 1 , 1 , 0 , 1 } , { 0 , 0 , 1 , 0 , 1 , 1 , 1 } , { 1 , 1 , 0 , 1 , 1 , 0 , 1 } } ; int Q [ ] [ 4 ] = { { 0 , 1 , 3 , 2 } , { 2 , 2 , 4 , 5 } , { 4 , 3 , 5 , 6 } } ; int sizeQ = sizeof ( Q ) / sizeof ( Q [ 0 ] ) ; count0s ( mat , Q , sizeQ ) ; return 0 ; }

Index/key variables: M, N, i, j, qi, qj
Accumulator variables: cnt, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool check ( long long a , long long b ) { long long int c = 0 ; while ( a != 0 ) { c = c + a % 10 ; a = a / 10 ; } return ( c == b ) ; } long long root ( long long n ) { bool found = 0 ; long long mx = 1e18 ; for ( long long i = 0 ; i <= 90 ; i ++ ) { long long s = i * i + 4 * n ; long long sq = sqrt ( s ) ; if ( sq * sq == s && check ( ( sq - i ) / 2 , i ) ) { found = 1 ; mx = min ( mx , ( sq - i ) / 2 ) ; } } if ( found ) return mx ; else return -1 ; } int main ( ) { long long n = 110 ; cout << root ( n ) ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int calculate ( int n , int power ) { int sum = 0 ; int bp = ( int ) pow ( n , power ) ; while ( bp != 0 ) { int d = bp % 10 ; sum += d ; bp /= 10 ; } return sum ; } int main ( ) { int n = 5 ; int power = 4 ; cout << calculate ( n , power ) ; }

Accumulator variables: bp, stdc, sum
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool coprime ( int a , int b ) { return ( __gcd ( a , b ) == 1 ) ; } void pairSum ( int n ) { int mid = n / 2 ; for ( int i = mid ; i >= 1 ; i -- ) { if ( coprime ( i , n - i ) == 1 ) { cout << i << " ▁ " << n - i ; break ; } } } int main ( ) { int n = 11 ; pairSum ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; typedef long long ll ; void modBigNumber ( string num , ll m ) { vector < int > vec ; ll mod = 0 ; for ( int i = 0 ; i < num . size ( ) ; i ++ ) { int digit = num [ i ] - '0' ; mod = mod * 10 + digit ; int quo = mod / m ; vec . push_back ( quo ) ; mod = mod % m ; } cout << " Remainder : " ▁ < < ▁ mod ▁ < < ▁ " " cout << " Quotient ▁ : ▁ " ; bool zeroflag = 0 ; for ( int i = 0 ; i < vec . size ( ) ; i ++ ) { if ( vec [ i ] == 0 && zeroflag == 0 ) continue ; zeroflag = 1 ; cout << vec [ i ] ; } return ; } int main ( ) { string num = "14598499948265358486" ; ll m = 487 ; modBigNumber ( num , m ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int N = 1e6 ; bool fourDiv [ N + 1 ] ; memset ( fourDiv , false , sizeof ( fourDiv ) ) ; void fourDistinctFactors ( ) { bool primeAll [ N + 1 ] ; memset ( primeAll , true , sizeof ( primeAll ) ) ; for ( int p = 2 ; p * p <= N ; p ++ ) { if ( primeAll [ p ] == true ) { for ( int i = p * 2 ; i <= N ; i += p ) primeAll [ i ] = false ; } } vector < int > prime ; for ( int p = 2 ; p <= N ; p ++ ) if ( primeAll [ p ] ) prime . push_back ( p ) ; for ( int i = 0 ; i < prime . size ( ) ; ++ i ) { int p = prime [ i ] ; if ( 1LL * p * p * p <= N ) fourDiv [ p * p * p ] = true ; for ( int j = i + 1 ; j < prime . size ( ) ; ++ j ) { int q = prime [ j ] ; if ( 1LL * p * q > N ) break ; fourDiv [ p * q ] = true ; } } } int main ( ) { fourDistinctFactors ( ) ; int num = 10 ; if ( fourDiv [ num ] ) cout << " Yes STRNEWLINE " ; else cout << " No STRNEWLINE " ; num = 12 ; if ( fourDiv [ num ] ) cout << " Yes STRNEWLINE " ; else cout << " No STRNEWLINE " ; return 0 ; }

Index/key variables: i, j, num, p
Accumulator variables: i, p, stdc
Iterator variables: i, j, p
C++ program:
#include <iostream>
using namespace std ; int leonardo ( int n ) { int dp [ n + 1 ] ; dp [ 0 ] = dp [ 1 ] = 1 ; for ( int i = 2 ; i <= n ; i ++ ) dp [ i ] = dp [ i - 1 ] + dp [ i - 2 ] + 1 ; return dp [ n ] ; } int main ( ) { cout << leonardo ( 3 ) ; return 0 ; }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MAX = 100 ; void Cholesky_Decomposition ( int matrix [ ] [ MAX ] , int n ) { int lower [ n ] [ n ] ; memset ( lower , 0 , sizeof ( lower ) ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { int sum = 0 ; { for ( int k = 0 ; k < j ; k ++ ) sum += pow ( lower [ j ] [ k ] , 2 ) ; lower [ j ] [ j ] = sqrt ( matrix [ j ] [ j ] - sum ) ; } else { for ( int k = 0 ; k < j ; k ++ ) sum += ( lower [ i ] [ k ] * lower [ j ] [ k ] ) ; lower [ i ] [ j ] = ( matrix [ i ] [ j ] - sum ) / lower [ j ] [ j ] ; } } } cout << setw ( 6 ) << " ▁ Lower ▁ Triangular " << setw ( 30 ) << " Transpose " << endl ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) cout << setw ( 6 ) << lower [ i ] [ j ] << " TABSYMBOL " ; cout << " TABSYMBOL " ; for ( int j = 0 ; j < n ; j ++ ) cout << setw ( 6 ) << lower [ j ] [ i ] << " TABSYMBOL " ; cout << endl ; } } int main ( ) { int n = 3 ; int matrix [ ] [ MAX ] = { { 4 , 12 , -16 } , { 12 , 37 , -43 } , { -16 , -43 , 98 } } ; Cholesky_Decomposition ( matrix , n ) ; return 0 ; }

Index/key variables: MAX, i, j, k, n
Accumulator variables: i, j, k, stdc, sum
Iterator variables: i, j, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; float sumOfAP ( float a , float d , float n ) { float sum = ( n / 2 ) * ( 2 * a + ( n - 1 ) * d ) ; return sum ; } int main ( ) { float n = 20 ; float a = 2.5 , d = 1.5 ; cout << sumOfAP ( a , d , n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  10
int findValue ( int arr [ ] , int n ) { int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) ans = max ( ans , abs ( arr [ i ] - arr [ j ] ) + abs ( i - j ) ) ; return ans ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 1 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << findValue ( arr , n ) << endl ; 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 findValue ( int arr [ ] , int n ) { int a [ n ] , b [ n ] , tmp ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = ( arr [ i ] + i ) ; b [ i ] = ( arr [ i ] - i ) ; } int x = a [ 0 ] , y = a [ 0 ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] > x ) x = a [ i ] ; if ( a [ i ] < y ) y = a [ i ] ; } int ans1 = ( x - y ) ; x = b [ 0 ] ; y = b [ 0 ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( b [ i ] > x ) x = b [ i ] ; if ( b [ i ] < y ) y = b [ i ] ; } int ans2 = ( x - y ) ; return max ( ans1 , ans2 ) ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 1 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << findValue ( arr , n ) << endl ; return 0 ; }

Index/key variables: i, n
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; int countsubarray ( int array [ ] , int n , int k ) { int count = 0 ; int i , j , mul ; for ( i = 0 ; i < n ; i ++ ) { if ( array [ i ] < k ) count ++ ; mul = array [ i ] ; for ( j = i + 1 ; j < n ; j ++ ) { mul = mul * array [ j ] ; if ( mul < k ) count ++ ; else break ; } } return count ; } int main ( ) { int array [ ] = { 1 , 2 , 3 , 4 } ; int k = 10 ; int size = sizeof ( array ) / sizeof ( array [ 0 ] ) ; int count = countsubarray ( array , size , k ) ; cout << count << " STRNEWLINE " ; }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int noOfFactors ( int N ) { if ( N == 1 ) return 1 ; int count = 0 ; int ans = 1 ; while ( N % 2 == 0 ) { count ++ ; N = N / 2 ; } ans *= ( count / 3 + 1 ) ; for ( int i = 3 ; i * i <= N ; i = i + 2 ) { count = 0 ; while ( N % i == 0 ) { count ++ ; N = N / i ; } ans *= ( count / 3 + 1 ) ; } return ans ; } int main ( ) { int N = 216 ; cout << noOfFactors ( N ) ; return 0 ; }

Accumulator variables: ans, count, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MAX = 1000001 ; int factor [ MAX ] = { 0 } ; void generatePrimeFactors ( ) { factor [ 1 ] = 1 ; for ( int i = 2 ; i < MAX ; i ++ ) factor [ i ] = i ; for ( int i = 4 ; i < MAX ; i += 2 ) factor [ i ] = 2 ; for ( int i = 3 ; i * i < MAX ; i ++ ) { if ( factor [ i ] == i ) { for ( int j = i * i ; j < MAX ; j += i ) { if ( factor [ j ] == j ) factor [ j ] = i ; } } } } int calculateNoOFactors ( int n ) { if ( n == 1 ) return 1 ; int ans = 1 ; int dup = factor [ n ] ; int c = 1 ; int j = n / factor [ n ] ; while ( j != 1 ) { if ( factor [ j ] == dup ) c += 1 ; else { dup = factor [ j ] ; ans = ans * ( c + 1 ) ; c = 1 ; } j = j / factor [ j ] ; } ans = ans * ( c + 1 ) ; return ans ; } int main ( ) { generatePrimeFactors ( ) ; int a [ ] = { 10 , 30 , 100 , 450 , 987 } ; int q = sizeof ( a ) / sizeof ( a [ 0 ] ) ; for ( int i = 0 ; i < q ; i ++ ) cout << calculateNoOFactors ( a [ i ] ) << " ▁ " ; return 0 ; }

Index/key variables: MAX, i, j, n
Accumulator variables: c, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void digit_product_Sum ( int N ) { int a [ N ] ; int product = 1 ; a [ 0 ] = 1 ; for ( int i = 1 ; i <= N ; i ++ ) { product = a [ i - 1 ] / 10 ; if ( product == 0 ) product = 1 ; else product = a [ i - 1 ] % 10 ; int val = a [ i - 1 ] / 10 ; if ( val == 0 ) val = a [ i - 1 ] ; a [ i ] = a [ i - 1 ] + ( val * product ) ; } for ( int i = 0 ; i < N ; i ++ ) cout << a [ i ] << " ▁ " ; } int main ( ) { int N = 10 ; digit_product_Sum ( N ) ; return 0 ; }

Index/key variables: N, i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; float geometricMean ( int arr [ ] , int n ) { float product = 1 ; for ( int i = 0 ; i < n ; i ++ ) product = product * arr [ i ] ; float gm = pow ( product , ( float ) 1 / n ) ; return gm ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << geometricMean ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define SIZE  4
bool productOfSingelDgt ( int n ) { if ( n >= 0 && n <= 9 ) return true ; int prime [ ] = { 2 , 3 , 5 , 7 } ; for ( int i = 0 ; i < SIZE && n > 1 ; i ++ ) while ( n % prime [ i ] == 0 ) n = n / prime [ i ] ; return ( n == 1 ) ; } int main ( ) { int n = 24 ; productOfSingelDgt ( n ) ? cout << " Yes " : cout << " No " ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maxPrimefactorNum ( int N ) { if ( N < 2 ) return 0 ; bool arr [ N + 1 ] ; memset ( arr , true , sizeof ( arr ) ) ; int prod = 1 , res = 0 ; for ( int p = 2 ; p * p <= N ; p ++ ) { if ( arr [ p ] == true ) { for ( int i = p * 2 ; i <= N ; i += p ) arr [ i ] = false ; prod *= p ; if ( prod > N ) return res ; res ++ ; } } return res ; } int main ( ) { int N = 500 ; cout << maxPrimefactorNum ( N ) << endl ; return 0 ; }

Index/key variables: i, p
Accumulator variables: i, p, prod, res, stdc
Iterator variables: i, p
C++ program:
#include <iostream>
using namespace std ; int main ( ) { int n = 8 ; int range = 12 ; for ( int i = 1 ; i <= range ; ++ i ) cout << n << " ▁ * ▁ " << i << " ▁ = ▁ " << n * i << endl ; return 0 ; }

Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPalindrome ( int ) ; bool isPalindrome ( int n ) { int divisor = 1 ; while ( n / divisor >= 10 ) divisor *= 10 ; while ( n != 0 ) { int leading = n / divisor ; int trailing = n % 10 ; if ( leading != trailing ) return false ; n = ( n % divisor ) / 10 ; divisor = divisor / 100 ; } return true ; } int main ( ) { isPalindrome ( 1001 ) ? cout << " Yes , ▁ it ▁ is ▁ Palindrome " : cout << " No , ▁ not ▁ Palindrome " ; return 0 ; }

Accumulator variables: divisor, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; string printDemlo ( string str ) { int len = str . length ( ) ; string res = " " ; for ( int i = 1 ; i <= len ; i ++ ) res += char ( i + '0' ) ; for ( int i = len - 1 ; i >= 1 ; i -- ) res += char ( i + '0' ) ; return res ; } int main ( ) { string str = "111111" ; cout << printDemlo ( str ) ; return 0 ; }

Accumulator variables: i, res, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define pi  3.142857
const int m = 8 , n = 8 ; int dctTransform ( int matrix [ ] [ n ] ) { int i , j , k , l ; float dct [ m ] [ n ] ; float ci , cj , dct1 , sum ; for ( i = 0 ; i < m ; i ++ ) { for ( j = 0 ; j < n ; j ++ ) { if ( i == 0 ) ci = 1 / sqrt ( m ) ; else ci = sqrt ( 2 ) / sqrt ( m ) ; if ( j == 0 ) cj = 1 / sqrt ( n ) ; else cj = sqrt ( 2 ) / sqrt ( n ) ; sum = 0 ; for ( k = 0 ; k < m ; k ++ ) { for ( l = 0 ; l < n ; l ++ ) { dct1 = matrix [ k ] [ l ] * cos ( ( 2 * k + 1 ) * i * pi / ( 2 * m ) ) * cos ( ( 2 * l + 1 ) * j * pi / ( 2 * n ) ) ; sum = sum + dct1 ; } } dct [ i ] [ j ] = ci * cj * sum ; } } for ( i = 0 ; i < m ; i ++ ) { for ( j = 0 ; j < n ; j ++ ) { printf ( " % f TABSYMBOL " , dct [ i ] [ j ] ) ; } printf ( " STRNEWLINE " ) ; } } int main ( ) { int matrix [ m ] [ n ] = { { 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 } , { 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 } , { 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 } , { 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 } , { 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 } , { 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 } , { 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 } , { 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 } } ; dctTransform ( matrix ) ; return 0 ; }

Index/key variables: i, j, k, l, m, n
Accumulator variables: i, j, k, l, stdc
Iterator variables: i, j, k, l
C++ program:
#include <bits/stdc++.h>
using namespace std ; int NumberofTimes ( string str ) { int temporary_sum = 0 , count = 0 ; while ( str . length ( ) > 1 ) { temporary_sum = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) temporary_sum += ( str [ i ] - '0' ) ; str = to_string ( temporary_sum ) ; count ++ ; } return count ; } int main ( ) { string s = "991" ; cout << NumberofTimes ( s ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, stdc, temporary_sum
Iterator variables: i
C++ program:
#include <iostream>
int calculateLeaps ( int n ) { if ( n == 0 n == 1 ) { return 1 ; } else { int leaps = 0 ; for ( int i = 0 ; i < n ; i ++ ) leaps += calculateLeaps ( i ) ; return leaps ; } } int main ( ) { int calculateLeaps ( int ) ; std :: cout << calculateLeaps ( 4 ) << std :: endl ; return 0 ; }

Accumulator variables: i, leaps
Iterator variables: i