dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
#define ll  long long int
using namespace std ; ll modPower ( ll x , ll y , ll p ) { while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } ll gcd ( ll a , ll b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } ll gcdPow ( ll a , ll n , ll c ) { if ( a % c == 0 ) return c ; ll modexpo = modPower ( a , n , c ) ; return gcd ( modexpo , c ) ; } int main ( ) { ll a = 10248585 , n = 1000000 , c = 12564 ; cout << gcdPow ( a , n , c ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countOddSum ( int ar [ ] , int n ) { int result = 0 ; for ( int i = 0 ; i <= n - 1 ; i ++ ) { int val = 0 ; for ( int j = i ; j <= n - 1 ; j ++ ) { val = val + ar [ j ] ; if ( val % 2 != 0 ) result ++ ; } } return ( result ) ; } int main ( ) { int ar [ ] = { 5 , 4 , 4 , 5 , 1 , 3 } ; int n = sizeof ( ar ) / sizeof ( ar [ 0 ] ) ; cout << " The ▁ Number ▁ of ▁ Subarrays ▁ with ▁ odd " " ▁ sum ▁ is ▁ " << countOddSum ( ar , n ) ; return ( 0 ) ; }

Index/key variables: j
Accumulator variables: i, j, result, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countOddSum ( int ar [ ] , int n ) { int temp [ 2 ] = { 1 , 0 } ; int result = 0 , val = 0 ; for ( int i = 0 ; i <= n - 1 ; i ++ ) { val = ( ( val + ar [ i ] ) % 2 + 2 ) % 2 ; temp [ val ] ++ ; } result = ( temp [ 0 ] * temp [ 1 ] ) ; return ( result ) ; } int main ( ) { int ar [ ] = { 5 , 4 , 4 , 5 , 1 , 3 } ; int n = sizeof ( ar ) / sizeof ( ar [ 0 ] ) ; cout << " The ▁ Number ▁ of ▁ Subarrays ▁ with ▁ odd " " ▁ sum ▁ is ▁ " << countOddSum ( ar , n ) ; return ( 0 ) ; }

Index/key variables: i, val
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; void printPFsInPairs ( int n ) { for ( int i = 1 ; i * i <= n ; i ++ ) if ( n % i == 0 ) cout << i << " * " << n / i << endl ; } int main ( ) { int n = 24 ; printPFsInPairs ( n ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int rangesum ( int n , int l , int r ) { int arr [ n ] ; int c = 1 , i = 0 ; while ( c <= n ) { arr [ i ++ ] = c ; c += 2 ; } c = 2 ; while ( c <= n ) { arr [ i ++ ] = c ; c += 2 ; } int sum = 0 ; for ( i = l - 1 ; i < r ; i ++ ) { sum += arr [ i ] ; } return sum ; } int main ( ) { int n = 12 ; int l = 1 , r = 11 ; cout << ( rangesum ( n , l , r ) ) ; }

Index/key variables: i, n
Accumulator variables: c, i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sumeven ( int n , int l , int r ) { int sum = 0 ; int mid = n / 2 ; if ( r <= mid ) { int first = ( 2 * l - 1 ) ; int last = ( 2 * r - 1 ) ; int no_of_terms = r - l + 1 ; sum = ( ( no_of_terms ) * ( ( first + last ) ) ) / 2 ; } else if ( l >= mid ) { int first = ( 2 * ( l - n / 2 ) ) ; int last = ( 2 * ( r - n / 2 ) ) ; int no_of_terms = r - l + 1 ; sum = ( ( no_of_terms ) * ( ( first + last ) ) ) / 2 ; } else { int sumleft = 0 , sumright = 0 ; int first_term1 = ( 2 * l - 1 ) ; int last_term1 = ( 2 * ( n / 2 ) - 1 ) ; int no_of_terms1 = n / 2 - l + 1 ; sumleft = ( ( no_of_terms1 ) * ( ( first_term1 + last_term1 ) ) ) / 2 ; int first_term2 = 2 ; int last_term2 = ( 2 * ( r - n / 2 ) ) ; int no_of_terms2 = r - mid ; sumright = ( ( no_of_terms2 ) * ( ( first_term2 + last_term2 ) ) ) / 2 ; sum = ( sumleft + sumright ) ; } return sum ; } int sumodd ( int n , int l , int r ) { int mid = n / 2 + 1 ; int sum = 0 ; if ( r <= mid ) { int first = ( 2 * l - 1 ) ; int last = ( 2 * r - 1 ) ; int no_of_terms = r - l + 1 ; sum = ( ( no_of_terms ) * ( ( first + last ) ) ) / 2 ; } else if ( l > mid ) { int first = ( 2 * ( l - mid ) ) ; int last = ( 2 * ( r - mid ) ) ; int no_of_terms = r - l + 1 ; sum = ( ( no_of_terms ) * ( ( first + last ) ) ) / 2 ; } else { int sumleft = 0 , sumright = 0 ; int first_term1 = ( 2 * l - 1 ) ; int last_term1 = ( 2 * mid - 1 ) ; int no_of_terms1 = mid - l + 1 ; sumleft = ( ( no_of_terms1 ) * ( ( first_term1 + last_term1 ) ) ) / 2 ; int first_term2 = 2 ; int last_term2 = ( 2 * ( r - mid ) ) ; int no_of_terms2 = r - mid ; sumright = ( ( no_of_terms2 ) * ( ( first_term2 + last_term2 ) ) ) / 2 ; sum = ( sumleft + sumright ) ; } return sum ; } int rangesum ( int n , int l , int r ) { int sum = 0 ; if ( n % 2 == 0 ) return sumeven ( n , l , r ) ; else return sumodd ( n , l , r ) ; } int main ( ) { int n = 12 ; int l = 1 , r = 11 ; cout << ( rangesum ( n , l , r ) ) ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std ; void distance ( float x1 , float y1 , float z1 , float x2 , float y2 , float z2 ) { float d = sqrt ( pow ( x2 - x1 , 2 ) + pow ( y2 - y1 , 2 ) + pow ( z2 - z1 , 2 ) * 1.0 ) ; std :: cout << std :: fixed ; std :: cout << std :: setprecision ( 2 ) ; cout << " ▁ Distance ▁ is ▁ " << d ; return ; } int main ( ) { float x1 = 2 ; float y1 = -5 ; float z1 = 7 ; float x2 = 3 ; float y2 = 4 ; float z2 = 5 ; distance ( x1 , y1 , z1 , x2 , y2 , z2 ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool DivisibleBy41 ( int first , int second , int c , int n ) { int digit [ n ] ; digit [ 0 ] = first ; digit [ 1 ] = second ; for ( int i = 2 ; i < n ; i ++ ) digit [ i ] = ( digit [ i - 1 ] * c + digit [ i - 2 ] ) % 10 ; int ans = digit [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) ans = ( ans * 10 + digit [ i ] ) % 41 ; if ( ans % 41 == 0 ) return true ; else return false ; } int main ( ) { int first = 1 , second = 2 , c = 1 , n = 3 ; if ( DivisibleBy41 ( first , second , c , n ) ) cout << " YES " ; else cout << " NO " ; return 0 ; }

Index/key variables: i, n
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findTetrahedralNumber ( int n ) { return ( ( n * ( n + 1 ) * ( n + 2 ) ) / 6 ) ; } void printSeries ( int n ) { int prev = 0 ; int curr ; for ( int i = 1 ; i <= n ; i ++ ) { curr = findTetrahedralNumber ( i ) ; curr = curr + prev ; cout << curr << " ▁ " ; prev = curr ; } } int main ( ) { int n = 10 ; printSeries ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printSeries ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { int num = ( i * ( i + 1 ) * ( i + 2 ) * ( i + 3 ) / 24 ) ; cout << num << " ▁ " ; } } int main ( ) { int n = 10 ; printSeries ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; long findTriangularNumber ( int n ) { return ( n * ( n + 1 ) ) / 2 ; } void printSeries ( int n ) { int prev = 0 ; int curr ; for ( int i = 1 ; i <= n ; i ++ ) { curr = findTriangularNumber ( i ) ; curr = curr + prev ; cout << curr << " ▁ " ; prev = curr ; } } int main ( ) { int n = 10 ; printSeries ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printSeries ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { int num = i * ( i + 1 ) * ( i + 2 ) / 6 ; cout << num << " ▁ " ; } } int main ( ) { int n = 10 ; printSeries ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void count_even_odd ( int min , int max , int steps [ ] [ 2 ] ) { int a , b , even , odd ; bool beven = true , aeven = false ; int n = 2 ; for ( int i = 0 ; i < n ; i ++ ) { a = steps [ i ] [ 0 ] , b = steps [ i ] [ 1 ] ; if ( ! ( aeven a & 1 ) ) aeven = true ; if ( beven ) { if ( b & 1 ) beven = false ; } else if ( ! ( a & 1 ) ) { if ( ! ( b & 1 ) ) beven = true ; } else { if ( b & 1 ) beven = true ; } } if ( beven ) { even = ( int ) max / 2 - ( int ) ( min - 1 ) / 2 ; odd = 0 ; } else { even = ( int ) max / 2 - ( int ) ( min - 1 ) / 2 ; odd = 0 ; } if ( ! ( beven ^ aeven ) ) even += max - min + 1 - ( int ) max / 2 + ( int ) ( min - 1 ) / 2 ; else odd += max - min + 1 - ( int ) max / 2 + ( int ) ( min - 1 ) / 2 ; cout << " even ▁ = ▁ " << even << " , ▁ odd ▁ = ▁ " << odd << endl ; } int main ( ) { int min = 1 , max = 4 ; int steps [ ] [ 2 ] = { { 1 , 2 } , { 3 , 4 } } ; count_even_odd ( min , max , steps ) ; return 0 ; }

Index/key variables: i
Accumulator variables: even, i, odd, stdc
Iterator variables: i
Boolean variables: aeven, beven
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getMaxOnes ( int n , int x ) { int zeroes = ( n / x ) ; zeroes = zeroes * zeroes ; int total = n * n ; int ans = total - zeroes ; return ans ; } int main ( ) { int n = 5 ; int x = 2 ; cout << getMaxOnes ( n , x ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minimumOperations ( int a [ ] , int n ) { unordered_map < int , int > mp ; for ( int i = 0 ; i < n ; i ++ ) mp [ a [ i ] ] += 1 ; int count = 0 ; for ( auto it = mp . begin ( ) ; it != mp . end ( ) ; it ++ ) { if ( ( * it ) . second > 1 ) count += ( * it ) . second - 1 ; } return count ; } int main ( ) { int a [ ] = { 2 , 1 , 2 , 3 , 3 , 4 , 3 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << minimumOperations ( a , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, it, stdc
Iterator variables: i, it
C++ program:
#include <bits/stdc++.h>
using namespace std ; void check ( int n , int m ) { if ( n == 2 m == 2 n % m == 0 ) { cout << " Yes " << endl ; } else { cout << " No " << endl ; } } int main ( ) { int m = 3 , n = 9 ; check ( n , m ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findSurfaceArea ( float a , float h ) { float Area ; Area = 6 * a * h + 3 * sqrt ( 3 ) * a * a ; cout << " Surface ▁ Area : ▁ " << Area ; cout << " STRNEWLINE " ; } void findVolume ( float a , float h ) { float Volume ; Volume = 3 * sqrt ( 3 ) * a * a * h / 2 ; cout << " Volume : ▁ " << Volume ; } int main ( ) { float a = 5 , h = 10 ; findSurfaceArea ( a , h ) ; findVolume ( a , h ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
#define ll  long long int
using namespace std ; long long int MinimumMail ( int n , int k , int x ) { ll m = ( n - 1 ) + ( ll ) ceil ( ( n - 1 ) * 1.0 / x ) * ( n - 1 ) + ( ll ) ceil ( n * 1.0 / x ) * ( k - n ) ; return m ; } int main ( ) { int N = 4 ; int K = 9 ; int X = 2 ; cout << MinimumMail ( N , K , X ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findArea ( float a , float b ) { float Area ; Area = 3.142 * a * b ; cout << " Area : ▁ " << Area ; } int main ( ) { float a = 5 , b = 4 ; findArea ( a , b ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int calculate ( int x , int k , int m ) { int result = x ; k -- ; while ( k -- ) { result = pow ( result , x ) ; if ( result > m ) result %= m ; } return result ; } int main ( ) { int x = 5 , k = 2 , m = 3 ; cout << calculate ( x , k , m ) ; return 0 ; }

Accumulator variables: k, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int rev ( int n , int temp ) { if ( n == 0 ) return temp ; temp = ( temp * 10 ) + ( n % 10 ) ; return rev ( n / 10 , temp ) ; } int main ( ) { int n = 121 ; int temp = rev ( n , 0 ) ; if ( temp == n ) cout << " yes " << endl ; else cout << " no " << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findGreater ( int a , int b , int n ) { if ( ! ( n & 1 ) ) { a = abs ( a ) ; b = abs ( b ) ; } if ( a == b ) cout << " a ^ n ▁ is ▁ equal ▁ to ▁ b ^ n " ; else if ( a > b ) cout << " a ^ n ▁ is ▁ greater ▁ than ▁ b ^ n " ; else cout << " b ^ n ▁ is ▁ greater ▁ than ▁ a ^ n " ; } int main ( ) { int a = 12 , b = 24 , n = 5 ; findGreater ( a , b , n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void fibonacci ( int n ) { long long int fib ; for ( long long int i = 0 ; i < n ; i ++ ) { fib = ( pow ( ( 1 + sqrt ( 5 ) ) , i ) - pow ( ( 1 - sqrt ( 5 ) ) , i ) ) / ( pow ( 2 , i ) * sqrt ( 5 ) ) ; cout << fib << " ▁ " ; } } int main ( ) { long long int n = 8 ; fibonacci ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int center_hexadecagonal_num ( long int n ) { return 8 * n * n - 8 * n + 1 ; } int main ( ) { long int n = 2 ; cout << n << " th ▁ centered ▁ hexadecagonal ▁ number ▁ : ▁ " << center_hexadecagonal_num ( n ) ; cout << endl ; n = 12 ; cout << n << " th ▁ centered ▁ hexadecagonal ▁ numbe ▁ : ▁ " << center_hexadecagonal_num ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  100
bool findNature ( int a , int b , int n ) { int seq [ MAX ] = { 0 } ; seq [ 0 ] = a ; seq [ 1 ] = b ; for ( int i = 2 ; i <= n ; i ++ ) seq [ i ] = seq [ i - 1 ] + seq [ i - 2 ] ; return ( seq [ n ] & 1 ) ; } int main ( ) { int a = 2 , b = 4 ; int n = 3 ; ( findNature ( a , b , n ) ? ( cout << " Odd " << " ▁ " ) : ( cout << " Even " << " ▁ " ) ) ; return 0 ; }

Index/key variables: MAX, i, n
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void check ( unsigned long long m , unsigned long long int n ) { double RHS = m * ( double ) log ( n ) ; double LHS = n * ( double ) log ( m ) ; if ( LHS > RHS ) cout << " m ^ n ▁ > ▁ n ^ m " ; else if ( LHS < RHS ) cout << " m ^ n ▁ < ▁ n ^ m " ; else cout << " m ^ n ▁ = ▁ n ^ m " ; } int main ( ) { unsigned long long m = 987654321 , n = 123456987 ; check ( m , n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printMatrix ( int n ) { float H [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { H [ i ] [ j ] = ( float ) 1.0 / ( ( i + 1 ) + ( j + 1 ) - 1.0 ) ; } } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) cout << H [ i ] [ j ] << " ▁ " ; cout << endl ; } } int main ( ) { int n = 3 ; printMatrix ( n ) ; return 0 ; }

Index/key variables: i, j, n
Accumulator variables: i, j, stdc
Iterator variables: i, j
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 maxDivisorRange ( int a , int b , int l , int h ) { int g = gcd ( a , b ) ; int res = -1 ; for ( int i = l ; i * i <= g && i <= h ; i ++ ) if ( g % i == 0 ) res = max ( { res , i , g / i } ) ; return res ; } int main ( ) { int a = 3 , b = 27 , l = 1 , h = 5 ; cout << maxDivisorRange ( a , b , l , h ) << endl ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void checksum ( int n ) { if ( n == 0 ) { cout << " - 2 ▁ - 1 ▁ 0 ▁ 1 ▁ 2" << endl ; return ; } int inc ; if ( n > 0 ) inc = 1 ; else inc = -1 ; for ( int i = 0 ; i <= n - 4 ; i += inc ) { if ( i + i + 1 + i + 2 + i + 3 + i + 4 == n ) { cout << i << " ▁ " << i + 1 << " ▁ " << i + 2 << " ▁ " << i + 3 << " ▁ " << i + 4 ; return ; } } cout << " - 1" ; } int main ( ) { int n = 15 ; checksum ( n ) ; return 0 ; }

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

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define N  1000001
int visited [ N ] ; int goesTo [ N ] ; int dfs ( int i ) { if ( visited [ i ] == 1 ) return 0 ; visited [ i ] = 1 ; int x = dfs ( goesTo [ i ] ) ; return ( x + 1 ) ; } int noOfTranspositions ( int P [ ] , int n ) { for ( int i = 1 ; i <= n ; i ++ ) visited [ i ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) goesTo [ P [ i ] ] = i + 1 ; int transpositions = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( visited [ i ] == 0 ) { int ans = dfs ( i ) ; transpositions += ans - 1 ; } } return transpositions ; } int main ( ) { int permutation [ ] = { 5 , 1 , 4 , 3 , 2 } ; int n = sizeof ( permutation ) / sizeof ( permutation [ 0 ] ) ; cout << noOfTranspositions ( permutation , n ) ; return 0 ; }

Index/key variables: N, i
Accumulator variables: i, stdc, transpositions
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; int sumOfSeries ( int n ) { int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) ans += i * i * i * i ; return ans ; } int main ( ) { int n = 4 ; cout << sumOfSeries ( n ) ; return 0 ; }

Accumulator variables: ans, i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countUnmarked ( int N ) { if ( N % 2 == 0 ) return N / 2 ; else return N / 2 + 1 ; } int main ( ) { int N = 4 ; cout << " Number ▁ of ▁ unmarked ▁ elements : ▁ " << countUnmarked ( N ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int factorial ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } int calculateSeries ( int n ) { return factorial ( n + 1 ) - 1 ; } int main ( ) { int n = 3 ; cout << calculateSeries ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int factorial ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } int calculateSeries ( int n ) { return 2 + ( n * n + n - 2 ) * factorial ( n + 1 ) ; } int main ( ) { int n = 3 ; cout << calculateSeries ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getSum ( int n ) { for ( int i = 1 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) sum = sum + i ; { sum = sum + i ; sum = sum + ( n / i ) ; } } } return sum - n ; } int getAliquot ( int n ) { unordered_set < int > s ; s . insert ( n ) ; int next = 0 ; while ( n > 0 ) { n = getSum ( n ) ; if ( s . find ( n ) != s . end ( ) ) return n ; s . insert ( n ) ; } return 0 ; } bool isPerfect ( int n ) { long long int sum = 1 ; for ( long long int i = 2 ; i * i <= n ; i ++ ) if ( n % i == 0 ) sum = sum + i + n / i ; if ( sum == n && n != 1 ) return true ; return false ; } bool isAspiring ( int n ) { int alq = getAliquot ( n ) ; if ( isPerfect ( alq ) && ! isPerfect ( n ) ) return true ; else return false ; } int main ( ) { int n = 25 ; if ( isAspiring ( n ) ) cout << " Aspiring " << endl ; else cout << " Not ▁ Aspiring " << endl ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minimumLength ( int x , int y , int z ) { return 1 + abs ( x - y ) + abs ( y - z ) ; } int main ( ) { int x = 3 , y = 1 , z = 2 ; cout << minimumLength ( x , y , z ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; float proterm ( int i , float value , float x [ ] ) { float pro = 1 ; for ( int j = 0 ; j < i ; j ++ ) { pro = pro * ( value - x [ j ] ) ; } return pro ; } void dividedDiffTable ( float x [ ] , float y [ ] [ 10 ] , int n ) { for ( int i = 1 ; i < n ; i ++ ) { for ( int j = 0 ; j < n - i ; j ++ ) { y [ j ] [ i ] = ( y [ j ] [ i - 1 ] - y [ j + 1 ] [ i - 1 ] ) / ( x [ j ] - x [ i + j ] ) ; } } } float applyFormula ( float value , float x [ ] , float y [ ] [ 10 ] , int n ) { float sum = y [ 0 ] [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { sum = sum + ( proterm ( i , value , x ) * y [ 0 ] [ i ] ) ; } return sum ; } void printDiffTable ( float y [ ] [ 10 ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n - i ; j ++ ) { cout << setprecision ( 4 ) << y [ i ] [ j ] << " TABSYMBOL ▁ " ; } cout << " STRNEWLINE " ; } } int main ( ) { int n = 4 ; float value , sum , y [ 10 ] [ 10 ] ; float x [ ] = { 5 , 6 , 9 , 11 } ; y [ 0 ] [ 0 ] = 12 ; y [ 1 ] [ 0 ] = 13 ; y [ 2 ] [ 0 ] = 14 ; y [ 3 ] [ 0 ] = 16 ; dividedDiffTable ( x , y , n ) ; printDiffTable ( y , n ) ; value = 7 ; cout << " Value at " ▁ < < ▁ value ▁ < < ▁ " is " << applyFormula ( value , x , y , 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 centered_heptagonal_num ( long int n ) { return ( 7 * n * n - 7 * n + 2 ) / 2 ; } int main ( ) { long int n = 5 ; cout << n << " th ▁ Centered ▁ heptagonal ▁ number ▁ : ▁ " ; cout << centered_heptagonal_num ( n ) ; return 0 ; }

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

Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define N  4
bool checkHankelMatrix ( int n , int m [ N ] [ N ] ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i + j < n ) { if ( m [ i ] [ j ] != m [ i + j ] [ 0 ] ) return false ; } else { if ( m [ i ] [ j ] != m [ i + j - n + 1 ] [ n - 1 ] ) return false ; } } } return true ; } int main ( ) { int n = 4 ; int m [ N ] [ N ] = { { 1 , 2 , 3 , 5 } , { 2 , 3 , 5 , 8 } , { 3 , 5 , 8 , 0 } , { 5 , 8 , 0 , 9 } } ; checkHankelMatrix ( n , m ) ? ( cout << " Yes " ) : ( cout << " No " ) ; return 0 ; }

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 isPower ( unsigned int n ) { for ( int x = 2 ; x <= sqrt ( n ) ; x ++ ) { float f = log ( n ) / log ( x ) ; if ( ( f - ( int ) f ) == 0.0 ) return true ; } return false ; } int main ( ) { for ( int i = 2 ; i < 100 ; i ++ ) if ( isPower ( i ) ) cout << i << " ▁ " ; return 0 ; }

Accumulator variables: i, stdc, x
Iterator variables: i, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define N  1000005
void sumOddDigit ( int digitSum [ ] ) { for ( int i = 1 ; i < N ; i ++ ) { digitSum [ i ] = digitSum [ i / 10 ] + ( i & 1 ) * ( i % 10 ) ; } } void sumFactor ( int digitSum [ ] , int factorDigitSum [ ] ) { for ( int i = 1 ; i < N ; i ++ ) { for ( int j = i ; j < N ; j += i ) { factorDigitSum [ j ] += digitSum [ i ] ; } } } void wrapper ( int q , int n [ ] ) { int digitSum [ N ] ; int factorDigitSum [ N ] ; sumOddDigit ( digitSum ) ; sumFactor ( digitSum , factorDigitSum ) ; for ( int i = 0 ; i < q ; i ++ ) cout << factorDigitSum [ n [ i ] ] << " ▁ " ; } int main ( ) { int q = 2 ; int n [ ] = { 10 , 36 } ; wrapper ( q , n ) ; return 0 ; }

Index/key variables: N, i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j