dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define M  10
void PrintMatrix ( float a [ ] [ M ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j <= n ; j ++ ) cout << a [ i ] [ j ] << " ▁ " ; cout << endl ; } } int PerformOperation ( float a [ ] [ M ] , int n ) { int i , j , k = 0 , c , flag = 0 , m = 0 ; float pro = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( a [ i ] [ i ] == 0 ) { c = 1 ; while ( ( i + c ) < n && a [ i + c ] [ i ] == 0 ) c ++ ; if ( ( i + c ) == n ) { flag = 1 ; break ; } for ( j = i , k = 0 ; k <= n ; k ++ ) swap ( a [ j ] [ k ] , a [ j + c ] [ k ] ) ; } for ( j = 0 ; j < n ; j ++ ) { if ( i != j ) { float pro = a [ j ] [ i ] / a [ i ] [ i ] ; for ( k = 0 ; k <= n ; k ++ ) a [ j ] [ k ] = a [ j ] [ k ] - ( a [ i ] [ k ] ) * pro ; } } } return flag ; } void PrintResult ( float a [ ] [ M ] , int n , int flag ) { cout << " Result ▁ is ▁ : ▁ " ; if ( flag == 2 ) cout << " Infinite ▁ Solutions ▁ Exists " << endl ; else if ( flag == 3 ) cout << " No ▁ Solution ▁ Exists " << endl ; else { for ( int i = 0 ; i < n ; i ++ ) cout << a [ i ] [ n ] / a [ i ] [ i ] << " ▁ " ; } } int CheckConsistency ( float a [ ] [ M ] , int n , int flag ) { int i , j ; float sum ; flag = 3 ; for ( i = 0 ; i < n ; i ++ ) { sum = 0 ; for ( j = 0 ; j < n ; j ++ ) sum = sum + a [ i ] [ j ] ; if ( sum == a [ i ] [ j ] ) flag = 2 ; } return flag ; } int main ( ) { float a [ M ] [ M ] = { { 0 , 2 , 1 , 4 } , { 1 , 1 , 2 , 6 } , { 2 , 1 , 1 , 7 } } ; int n = 3 , flag = 0 ; flag = PerformOperation ( a , n ) ; if ( flag == 1 ) flag = CheckConsistency ( a , n , flag ) ; cout << " Final ▁ Augumented ▁ Matrix ▁ is ▁ : ▁ " << endl ; PrintMatrix ( a , n ) ; cout << endl ; PrintResult ( a , n , flag ) ; return 0 ; }

Index/key variables: M, i, j, k, n
Accumulator variables: c, i, j, k, stdc
Iterator variables: i, j, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; int number_of_digits ( int n ) { int i , res , sum = 0 ; for ( i = 4 , res = 1 ; ; i *= 4 , res ++ ) { sum += i ; if ( sum >= n ) break ; } return res ; } int main ( ) { int n = 21 ; cout << number_of_digits ( n ) << endl ; return 0 ; }

Accumulator variables: i, res, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void Reverseorder ( int n ) { bool prime [ n + 1 ] ; memset ( prime , true , sizeof ( prime ) ) ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= n ; i += p ) prime [ i ] = false ; } } for ( int p = n ; p >= 2 ; p -- ) if ( prime [ p ] ) cout << p << " ▁ " ; } int main ( ) { int N = 25 ; cout << " Prime ▁ number ▁ in ▁ reverse ▁ order " << endl ; if ( N == 1 ) cout << " No ▁ prime ▁ no ▁ exist ▁ in ▁ this ▁ range " ; else 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 ; void checkVantieghemsTheorem ( int limit ) { long long unsigned prod = 1 ; for ( long long unsigned n = 2 ; n < limit ; n ++ ) { if ( ( ( prod - n ) % ( ( 1LL << n ) - 1 ) ) == 0 ) cout << n << " ▁ is ▁ prime STRNEWLINE " ; prod *= ( ( 1LL << n ) - 1 ) ; } } int main ( ) { checkVantieghemsTheorem ( 10 ) ; return 0 ; }

Accumulator variables: n, prod, stdc
Iterator variables: n
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int mod = 1e9 + 7 ; const int N = 1000005 ; int fact [ N ] , invfact [ N ] ; int check ( int x , int a , int b ) { if ( x == 0 ) return 0 ; while ( x ) { if ( x % 10 != a and x % 10 != b ) return 0 ; x /= 10 ; } return 1 ; } int modInverse ( int a , int m ) { int m0 = m ; int y = 0 , x = 1 ; if ( m == 1 ) return 0 ; while ( a > 1 ) { int q = a / m ; int t = m ; m = a % m , a = t ; t = y ; y = x - q * y ; x = t ; } if ( x < 0 ) x += m0 ; return x ; } void pregenFact ( ) { fact [ 0 ] = fact [ 1 ] = 1 ; for ( int i = 1 ; i <= 1000000 ; ++ i ) fact [ i ] = ( long long ) fact [ i - 1 ] * i % mod ; } void pregenInverse ( ) { invfact [ 0 ] = invfact [ 1 ] = 1 ; invfact [ 1000000 ] = modInverse ( fact [ 1000000 ] , mod ) ; for ( int i = 999999 ; i > 1 ; -- i ) invfact [ i ] = ( ( long long ) invfact [ i + 1 ] * ( long long ) ( i + 1 ) ) % mod ; } int comb ( int big , int small ) { return ( long long ) fact [ big ] * invfact [ small ] % mod * invfact [ big - small ] % mod ; } int count ( int a , int b , int n ) { pregenFact ( ) ; pregenInverse ( ) ; if ( a == b ) return ( check ( a * n , a , b ) ) ; int ans = 0 ; for ( int i = 0 ; i <= n ; ++ i ) if ( check ( i * a + ( n - i ) * b , a , b ) ) ans = ( ans + comb ( n , i ) ) % mod ; return ans ; } int main ( ) { int a = 3 , b = 4 , n = 11028 ; cout << count ( a , b , n ) ; return 0 ; }

Index/key variables: N, big, i, small
Accumulator variables: stdc, x
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int magicOfSequence ( int N ) { int sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) sum += ( i * i * i + i * 2 ) ; return sum ; } int main ( ) { int N = 4 ; cout << magicOfSequence ( N ) << endl ; return 0 ; }

Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countOddFactors ( long long n ) { int odd_factors = 0 ; for ( int i = 1 ; 1ll * i * i <= n ; i ++ ) { if ( n % i == 0 ) { if ( 1ll * i * i == n ) { if ( i & 1 ) odd_factors ++ ; } else { if ( i & 1 ) odd_factors ++ ; int factor = n / i ; if ( factor & 1 ) odd_factors ++ ; } } } return odd_factors - 1 ; } int main ( ) { long long int N = 15 ; cout << countOddFactors ( N ) << endl ; N = 10 ; cout << countOddFactors ( N ) << endl ; return 0 ; }

Accumulator variables: i, odd_factors, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPossibleToZero ( int a [ ] , int n ) { int even = 0 , odd = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i & 1 ) odd += a [ i ] ; else even += a [ i ] ; } return ( odd == even ) ; } int main ( ) { int arr [ ] = { 0 , 1 , 1 , 0 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; if ( isPossibleToZero ( arr , n ) ) cout << " YES " ; else cout << " NO " ; }

Index/key variables: i
Accumulator variables: even, i, odd, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; const double PI = 3.142 ; double cosXSertiesSum ( double x , int n ) { x = x * ( PI / 180.0 ) ; double res = 1 ; double sign = 1 , fact = 1 , pow = 1 ; for ( int i = 1 ; i < 5 ; i ++ ) { sign = sign * -1 ; fact = fact * ( 2 * i - 1 ) * ( 2 * i ) ; pow = pow * x * x ; res = res + sign * pow / fact ; } return res ; } int main ( ) { float x = 50 ; int n = 5 ; cout << cosXSertiesSum ( x , 5 ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int solve ( int n , int base ) { int result = 0 ; while ( n > 0 ) { int remainder = n % base ; result = result + remainder ; n = n / base ; } return result ; } void printSumsOfDigits ( int n ) { for ( int base = 2 ; base < n ; ++ base ) cout << solve ( n , base ) << " ▁ " ; } int main ( ) { int n = 8 ; printSumsOfDigits ( n ) ; return 0 ; }

Accumulator variables: stdc
Iterator variables: base
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool check ( int N , int D ) { int temp = ( N * ( N + 1 ) ) / 2 + D ; return ( temp % 2 == 0 ) ; } int main ( ) { int N = 5 ; int M = 7 ; if ( check ( N , M ) ) cout << " yes " ; else cout << " no " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int perfectSquare ( string s ) { int n = s . size ( ) ; int ans = -1 ; string num ; for ( int i = 1 ; i < ( 1 << n ) ; i ++ ) { string str = " " ; for ( int j = 0 ; j < n ; j ++ ) { if ( ( i >> j ) & 1 ) { str += s [ j ] ; } } if ( str [ 0 ] != '0' ) { int temp = 0 ; for ( int j = 0 ; j < str . size ( ) ; j ++ ) temp = temp * 10 + ( int ) ( str [ j ] - '0' ) ; int k = sqrt ( temp ) ; if ( k * k == temp ) { if ( ans < ( int ) str . size ( ) ) { ans = ( int ) str . size ( ) ; num = str ; } } } } if ( ans == -1 ) return ans ; else { cout << num << " ▁ " ; return n - ans ; } } int main ( ) { cout << perfectSquare ( "8314" ) << endl ; cout << perfectSquare ( "753" ) << endl ; return 0 ; }

Index/key variables: j
Accumulator variables: i, j, stdc, str
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printFourSquares ( int a ) { for ( int i = 0 ; i * i <= a ; i ++ ) { for ( int j = i ; j * j <= a ; j ++ ) { for ( int k = j ; k * k <= a ; k ++ ) { for ( int l = k ; l * l <= a ; l ++ ) { if ( i * i + j * j + k * k + l * l == a ) { cout << a << " ▁ = ▁ " << i << " * " << i << " ▁ + ▁ " << j << " * " << j << " ▁ + ▁ " ; cout << k << " * " << k << " ▁ + ▁ " << l << " * " << l << " STRNEWLINE " ; } } } } } } int main ( ) { int a = 74 ; printFourSquares ( a ) ; return 0 ; }

Accumulator variables: i, j, k, l, stdc
Iterator variables: i, j, k, l
C++ program:
#include <bits/stdc++.h>
using namespace std ; int exactPrimeFactorCount ( int n ) { int count = 0 ; if ( n % 2 == 0 ) { count ++ ; while ( n % 2 == 0 ) n = n / 2 ; } for ( int i = 3 ; i <= sqrt ( n ) ; i = i + 2 ) { if ( n % i == 0 ) { count ++ ; while ( n % i == 0 ) n = n / i ; } } if ( n > 2 ) count ++ ; return count ; } int main ( ) { int n = 51242183 ; cout << " The ▁ number ▁ of ▁ distinct ▁ prime ▁ factors ▁ is / are ▁ " << exactPrimeFactorCount ( n ) << endl ; cout << " The ▁ value ▁ of ▁ log ( log ( n ) ) ▁ is ▁ " << log ( log ( n ) ) << endl ; return 0 ; }

Accumulator variables: count, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int checkSemiprime ( int num ) { int cnt = 0 ; for ( int i = 2 ; cnt < 2 && i * i <= num ; ++ i ) { while ( num % i == 0 ) { num /= i ; ++ cnt ; } } if ( num > 1 ) ++ cnt ; return cnt == 2 ; } bool isEmirpimes ( int n ) { if ( checkSemiprime ( n ) == false ) return false ; int r = 0 ; for ( int t = n ; t != 0 ; t = t / n ) r = r * 10 + t % 10 ; if ( r == n ) return false ; return ( checkSemiprime ( r ) ) ; } int main ( ) { int n = 15 ; if ( isEmirpimes ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: num, stdc
Iterator variables: i, t
C++ program:
#include <bits/stdc++.h>
using namespace std ; void add ( int ac [ ] , int x [ ] , int qrn ) { int i , c = 0 ; for ( i = 0 ; i < qrn ; i ++ ) { ac [ i ] = ac [ i ] + x [ i ] + c ; if ( ac [ i ] > 1 ) { ac [ i ] = ac [ i ] % 2 ; c = 1 ; } else c = 0 ; } } void complement ( int a [ ] , int n ) { int i ; int x [ 8 ] = { 0 } ; x [ 0 ] = 1 ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = ( a [ i ] + 1 ) % 2 ; } add ( a , x , n ) ; } void rightShift ( int ac [ ] , int qr [ ] , int & qn , int qrn ) { int temp , i ; temp = ac [ 0 ] ; qn = qr [ 0 ] ; cout << " TABSYMBOL TABSYMBOL rightShift TABSYMBOL " ; for ( i = 0 ; i < qrn - 1 ; i ++ ) { ac [ i ] = ac [ i + 1 ] ; qr [ i ] = qr [ i + 1 ] ; } qr [ qrn - 1 ] = temp ; } void display ( int ac [ ] , int qr [ ] , int qrn ) { int i ; for ( i = qrn - 1 ; i >= 0 ; i -- ) cout << ac [ i ] ; cout << " TABSYMBOL " ; for ( i = qrn - 1 ; i >= 0 ; i -- ) cout << qr [ i ] ; } void boothAlgorithm ( int br [ ] , int qr [ ] , int mt [ ] , int qrn , int sc ) { int qn = 0 , ac [ 10 ] = { 0 } ; int temp = 0 ; cout << " qn TABSYMBOL q [ n + 1 ] TABSYMBOL TABSYMBOL BR TABSYMBOL TABSYMBOL AC TABSYMBOL QR TABSYMBOL TABSYMBOL sc STRNEWLINE " ; cout << " TABSYMBOL TABSYMBOL TABSYMBOL initial TABSYMBOL TABSYMBOL " ; display ( ac , qr , qrn ) ; cout << " TABSYMBOL TABSYMBOL " << sc << " STRNEWLINE " ; while ( sc != 0 ) { cout << qr [ 0 ] << " TABSYMBOL " << qn ; if ( ( qn + qr [ 0 ] ) == 1 ) { if ( temp == 0 ) { add ( ac , mt , qrn ) ; cout << " TABSYMBOL TABSYMBOL A ▁ = ▁ A ▁ - ▁ BR TABSYMBOL " ; for ( int i = qrn - 1 ; i >= 0 ; i -- ) cout << ac [ i ] ; temp = 1 ; } else if ( temp == 1 ) { add ( ac , br , qrn ) ; cout << " TABSYMBOL TABSYMBOL A ▁ = ▁ A ▁ + ▁ BR TABSYMBOL " ; for ( int i = qrn - 1 ; i >= 0 ; i -- ) cout << ac [ i ] ; temp = 0 ; } cout << " STRNEWLINE TABSYMBOL " ; rightShift ( ac , qr , qn , qrn ) ; } else if ( qn - qr [ 0 ] == 0 ) rightShift ( ac , qr , qn , qrn ) ; display ( ac , qr , qrn ) ; cout << " TABSYMBOL " ; sc -- ; cout << " TABSYMBOL " << sc << " STRNEWLINE " ; } } int main ( int argc , char * * arg ) { int mt [ 10 ] , sc ; int brn , qrn ; brn = 4 ; int br [ ] = { 0 , 1 , 1 , 0 } ; for ( int i = brn - 1 ; i >= 0 ; i -- ) mt [ i ] = br [ i ] ; reverse ( br , br + brn ) ; complement ( mt , brn ) ; qrn = 4 ; sc = qrn ; int qr [ ] = { 1 , 0 , 1 , 0 } ; reverse ( qr , qr + qrn ) ; boothAlgorithm ( br , qr , mt , qrn , sc ) ; cout << endl << " Result ▁ = ▁ " ; for ( int i = qrn - 1 ; i >= 0 ; i -- ) cout << qr [ i ] ; }

Index/key variables: i
Accumulator variables: i, sc, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; vector < long long int > gen ( long long int n , vector < long long int > r ) { long long int a = r [ r . size ( ) - 1 ] ; a ++ ; for ( int i = 1 ; i <= n ; a += 2 , i ++ ) r . push_back ( a ) ; return r ; } vector < long long int > conell ( long long int n ) { vector < long long int > res ; long long int k = 1 ; res . push_back ( 0 ) ; while ( 1 ) { res = gen ( k , res ) ; k ++ ; int j = res . size ( ) - 1 ; while ( j != n && j + k > n ) k -- ; if ( j >= n ) break ; } res . erase ( res . begin ( ) ) ; return res ; } int main ( ) { long long int n = 10 ; cout << " The ▁ first ▁ " << n << " ▁ terms ▁ are " << endl ; vector < long long int > res = conell ( n ) ; for ( int i = 0 ; i < res . size ( ) ; i ++ ) cout << res [ i ] << " ▁ " ; cout << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: a, i, k, stdc
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; unsigned long long int factorial ( unsigned int n ) { unsigned long long int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res *= i ; return res ; } void printNComposite ( int n ) { unsigned long long int fact = factorial ( n + 1 ) ; for ( int i = 2 ; i <= n + 1 ; ++ i ) cout << fact + i << " ▁ " ; } int main ( ) { int n = 4 ; printNComposite ( n ) ; return 0 ; }

Accumulator variables: i, res
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; vector < long long int > primes ( long long int n ) { bool prime [ n + 1 ] ; memset ( prime , true , sizeof ( prime ) ) ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( prime [ i ] == true ) { for ( int j = i * 2 ; j <= n ; j += i ) prime [ j ] = false ; } } vector < long long int > arr ; for ( int i = 2 ; i < n ; i ++ ) if ( prime [ i ] ) arr . push_back ( i ) ; return arr ; } int countDigits ( long long int n ) { long long int temp = n ; int c = 0 ; while ( temp != 0 ) { temp = temp / 10 ; c ++ ; } return c ; } bool frugal ( long long int n ) { vector < long long int > r = primes ( n ) ; long long int t = n ; long long int s = 0 ; for ( int i = 0 ; i < r . size ( ) ; i ++ ) { if ( t % r [ i ] == 0 ) { long long int k = 0 ; while ( t % r [ i ] == 0 ) { t = t / r [ i ] ; k ++ ; } if ( k == 1 ) s = s + countDigits ( r [ i ] ) ; else if ( k != 1 ) s = s + countDigits ( r [ i ] ) + countDigits ( k ) ; } } return ( countDigits ( n ) > s && s != 0 ) ; } int main ( ) { long long int n = 343 ; if ( frugal ( n ) ) cout << " A ▁ Frugal ▁ number STRNEWLINE " ; else cout << " Not ▁ a ▁ frugal ▁ number STRNEWLINE " ; return 0 ; }

Index/key variables: i, j
Accumulator variables: c, i, j, k, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int nthSquareCube ( int n ) { return n * n * n * n * n * n ; } int main ( ) { int n = 5 ; cout << nthSquareCube ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
using namespace std ; int findS ( int s ) { int sum = 0 ; for ( int n = 1 ; sum < s ; n ++ ) { sum += n * n * n ; if ( sum == s ) return n ; } return -1 ; } int main ( ) { int s = 9 ; int n = findS ( s ) ; n == -1 ? cout << " - 1" : cout << n ; return 0 ; }

Accumulator variables: n, sum
Iterator variables: n
C++ program:
#include <bits/stdc++.h>
using namespace std ; long long int findKthGoodNo ( long long int n ) { int lastDig = n % 10 ; if ( lastDig >= 0 && lastDig <= 4 ) return n << 1 ; else return ( n << 1 ) + 1 ; } int main ( ) { long long int n = 10 ; cout << findKthGoodNo ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void NicomachuTheorum_sum ( int n ) { int sum = 0 ; for ( int k = 1 ; k <= n ; k ++ ) sum += k * k * k ; int triNo = n * ( n + 1 ) / 2 ; if ( sum == triNo * triNo ) cout << " Yes " ; else cout << " No " ; } int main ( ) { int n = 5 ; NicomachuTheorum_sum ( n ) ; return 0 ; }

Accumulator variables: k, stdc, sum
Iterator variables: k
C++ program:
#include <bits/stdc++.h>
using namespace std ; int checkDigits ( int n ) { while ( n ) { return 0 ; n /= 10 ; } return 1 ; } int largestNumber ( int n ) { for ( int i = n ; ; i -- ) if ( checkDigits ( i ) ) return i ; } int main ( ) { int N = 23 ; cout << largestNumber ( N ) ; return 0 ; }

Accumulator variables: i, n, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int largestNumber ( int n ) { string s = " " ; int duplicate = n ; while ( n ) { s = char ( n % 10 + 48 ) + s ; n /= 10 ; } int index = -1 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( ( s [ i ] - '0' ) % 2 & 1 ) { index = i ; break ; } } if ( index == -1 ) return duplicate ; int num = 0 ; for ( int i = 0 ; i < index ; i ++ ) num = num * 10 + ( s [ i ] - '0' ) ; num = num * 10 + ( s [ index ] - '0' - 1 ) ; for ( int i = index + 1 ; i < s . length ( ) ; i ++ ) num = num * 10 + 8 ; return num ; } int main ( ) { int N = 24578 ; cout << largestNumber ( N ) ; return 0 ; }

Index/key variables: i, index
Accumulator variables: i, n, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countDigits ( int n ) { return ( n * log10 ( 2 ) + 1 ) ; } int main ( ) { int n = 5 ; cout << countDigits ( n ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findBucketNo ( int p ) { return ceil ( ( sqrt ( 8 * p + 1 ) - 1 ) / 2 ) ; } int main ( ) { int p = 10 ; cout << findBucketNo ( p ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; unsigned int factorial ( unsigned int n ) { if ( n == 0 ) return 1 ; return n * factorial ( n - 1 ) ; } int LCMOfNeighbourFact ( int n ) { return factorial ( n + 1 ) ; } int main ( ) { int N = 5 ; cout << LCMOfNeighbourFact ( N ) << " STRNEWLINE " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  50002
vector < int > primes ; void sieve ( ) { bool isPrime [ MAX ] ; memset ( isPrime , true , sizeof ( isPrime ) ) ; for ( int p = 2 ; p * p < MAX ; p ++ ) { if ( isPrime [ p ] == true ) { for ( int i = p * 2 ; i < MAX ; i += p ) isPrime [ i ] = false ; } } for ( int p = 2 ; p < MAX ; p ++ ) if ( isPrime [ p ] ) primes . push_back ( p ) ; } long long int power ( long long int x , long long int y ) { long long int count = 0 ; long long int z = y ; while ( x >= z ) { count += ( x / z ) ; z *= y ; } return count ; } long long int modMult ( long long int a , long long int b , long long int mod ) { long long int res = 0 ; a = a % mod ; while ( b > 0 ) { if ( b % 2 == 1 ) res = ( res + a ) % mod ; a = ( a * 2 ) % mod ; b /= 2 ; } return res % mod ; } long long int countWays ( long long int n , long long int m ) { long long int ans = 1 ; for ( int i = 1 ; i < primes . size ( ) ; i ++ ) { long long int powers = power ( n , primes [ i ] ) ; if ( powers == 0 ) break ; ans = modMult ( ans , powers + 1 , m ) % m ; } if ( ( ( ans - 1 ) % m ) < 0 ) return ( ans - 1 + m ) % m ; else return ( ans - 1 ) % m ; } int main ( ) { sieve ( ) ; long long int n = 4 , m = 7 ; cout << countWays ( n , m ) ; return 0 ; }

Index/key variables: MAX, i, p
Accumulator variables: b, count, i, p, stdc, z
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sumofFactors ( int n ) { int res = 1 ; for ( int i = 2 ; i <= sqrt ( n ) ; i ++ ) { int count = 0 , curr_sum = 1 ; int curr_term = 1 ; while ( n % i == 0 ) { count ++ ; n = n / i ; curr_term *= i ; curr_sum += curr_term ; } res *= curr_sum ; } if ( n >= 2 ) res *= ( 1 + n ) ; return res ; } int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } bool checkFriendly ( int n , int m ) { int sumFactors_n = sumofFactors ( n ) ; int sumFactors_m = sumofFactors ( m ) ; int gcd_n = gcd ( n , sumFactors_n ) ; int gcd_m = gcd ( m , sumFactors_m ) ; if ( n / gcd_n == m / gcd_m && sumFactors_n / gcd_n == sumFactors_m / gcd_m ) return true ; else return false ; } int main ( ) { int n = 6 , m = 28 ; checkFriendly ( n , m ) ? ( cout << " Yes STRNEWLINE " ) : ( cout << " No STRNEWLINE " ) ; return 0 ; }

Accumulator variables: count, curr_sum, curr_term, i, res, stdc
Iterator variables: i
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 ; } long long int primorial ( long long int n ) { long long int p = 2 ; n -- ; for ( int i = 3 ; n != 0 ; i ++ ) { if ( isPrime ( i ) ) { p = p * i ; n -- ; } i ++ ; } return p ; } long long int findNextPrime ( long long int n ) { long long int nextPrime = n + 2 ; while ( true ) { if ( isPrime ( nextPrime ) ) break ; nextPrime ++ ; } return nextPrime ; } long long int fortunateNumber ( int n ) { long long int p = primorial ( n ) ; return findNextPrime ( p ) - p ; } int main ( ) { long long int n = 5 ; cout << fortunateNumber ( n ) << " STRNEWLINE " ; return 0 ; }

Accumulator variables: i, n, nextPrime, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; double procal ( int n ) { return ( 3.0 * n ) / ( 4.0 * ( n * n ) - 1 ) ; } int main ( ) { int a [ ] = { 1 , 2 , 3 , 4 , 5 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << procal ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void testSomeNumbers ( int limit , int n ) { if ( n < 3 ) return ; for ( int a = 1 ; a <= limit ; a ++ ) for ( int b = a ; b <= limit ; b ++ ) { int pow_sum = pow ( a , n ) + pow ( b , n ) ; double c = pow ( pow_sum , 1.0 / n ) ; int c_pow = pow ( ( int ) c , n ) ; if ( c_pow == pow_sum ) { cout << " Count ▁ example ▁ found " ; return ; } } cout << " No ▁ counter ▁ example ▁ within ▁ given " " ▁ range ▁ and ▁ data " ; } int main ( ) { testSomeNumbers ( 10 , 3 ) ; return 0 ; }

Accumulator variables: a, b, stdc
Iterator variables: a, b
C++ program:
#include <bits/stdc++.h>
using namespace std ; int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } void productReduce ( int n , int num [ ] , int den [ ] ) { int new_num = 1 , new_den = 1 ; for ( int i = 0 ; i < n ; i ++ ) { new_num *= num [ i ] ; new_den *= den [ i ] ; } int GCD = gcd ( new_num , new_den ) ; new_num /= GCD ; new_den /= GCD ; cout << new_num << " / " << new_den << endl ; } int main ( ) { int n = 3 ; int num [ ] = { 1 , 2 , 5 } ; int den [ ] = { 2 , 1 , 6 } ; productReduce ( n , num , den ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, new_den, new_num, stdc
Iterator variables: i