dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
#define MAX  100000
using namespace std ; bool prime [ 100002 ] ; void SieveOfEratosthenes ( ) { memset ( prime , true , sizeof ( prime ) ) ; for ( int p = 2 ; p * p <= MAX ; p ++ ) if ( prime [ p ] == true ) for ( int i = p * 2 ; i <= MAX ; i += p ) prime [ i ] = false ; } int superpower ( int n ) { SieveOfEratosthenes ( ) ; int superPower = 0 , factor = 0 ; int i = 2 ; while ( n > 1 && i <= MAX ) { if ( prime [ i ] ) { factor = 0 ; while ( n % i == 0 && n > 1 ) { factor ++ ; n = n / i ; } if ( superPower < factor ) superPower = factor ; } i ++ ; } return superPower ; } int main ( ) { int n = 256 ; cout << superpower ( n ) ; return 0 ; }

Index/key variables: i, p
Accumulator variables: factor, i, p, stdc
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; Node * next ; } ; void push ( Node * * head_ref , int new_data ) { Node * new_node = new Node ; new_node -> data = new_data ; new_node -> next = ( * head_ref ) ; ( * head_ref ) = new_node ; } 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 ; } int countPrime ( Node * * head_ref ) { int count = 0 ; Node * ptr = * head_ref ; while ( ptr != NULL ) { if ( isPrime ( ptr -> data ) ) { count ++ ; } ptr = ptr -> next ; } return count ; } int main ( ) { Node * head = NULL ; push ( & head , 17 ) ; push ( & head , 10 ) ; push ( & head , 6 ) ; push ( & head , 5 ) ; push ( & head , 15 ) ; cout << " Count ▁ of ▁ prime ▁ nodes ▁ = ▁ " << countPrime ( & head ) ; return 0 ; }

Accumulator variables: count, stdc
Iterator variables: i
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; int smallestDivisor ( int n ) { if ( n % 2 == 0 ) return 2 ; for ( int i = 3 ; i * i <= n ; i += 2 ) { if ( n % i == 0 ) return i ; } return n ; } int main ( ) { int n = 31 ; cout << smallestDivisor ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countRabbits ( int Heads , int Legs ) { int count = 0 ; count = ( Legs ) -2 * ( Heads ) ; count = count / 2 ; return count ; } int main ( ) { int Heads = 100 , Legs = 300 ; int Rabbits = countRabbits ( Heads , Legs ) ; cout << " Rabbits ▁ = ▁ " << Rabbits << endl ; cout << " Pigeons ▁ = ▁ " << Heads - Rabbits << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; float calculateSum ( float n ) { int a = int ( n ) ; return 2 * ( pow ( n , 6 ) + 15 * pow ( n , 4 ) + 15 * pow ( n , 2 ) + 1 ) ; } int main ( ) { float n = 1.4142 ; cout << ceil ( calculateSum ( n ) ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
#include <math.h>
using namespace std ; class gfg { public : int Sum_upto_nth_Term ( int n ) { return ( 1 - pow ( -2 , n ) ) ; } } ; int main ( ) { gfg g ; int N = 5 ; cout << g . Sum_upto_nth_Term ( N ) ; }

Class/struct names: gfg
C++ program:
#include <iostream>
#include <math.h>
using namespace std ; class gfg { public : int xorEqualsOrCount ( int N ) { int count = 0 ; int bit ; while ( N > 0 ) { bit = N % 2 ; if ( bit == 0 ) count ++ ; N = N / 2 ; } return ( int ) pow ( 2 , count ) ; } } ; int main ( ) { gfg g ; int N = 7 ; cout << g . xorEqualsOrCount ( N ) ; return 0 ; }

Accumulator variables: count
Class/struct names: gfg
C++ program:
#include <iostream>
#include <math.h>
using namespace std ; int fact ( int n ) { if ( n == 1 ) return 1 ; return n * fact ( n - 1 ) ; } double sum ( int x , int n ) { double i , total = 1.0 ; for ( i = 1 ; i <= n ; i ++ ) { total = total + ( pow ( x , i ) / fact ( i + 1 ) ) ; } return total ; } int main ( ) { int x = 5 , n = 4 ; cout << " Sum ▁ is : ▁ " << sum ( x , n ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sum_of_series ( int n ) { int result = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) result = result - pow ( i , 2 ) ; else result = result + pow ( i , 2 ) ; } return result ; } int main ( void ) { int n = 3 ; cout << sum_of_series ( n ) << endl ; n = 10 ; cout << sum_of_series ( n ) << endl ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
#define ll  long long int
#define MAX  16
using namespace std ; ll nCr [ MAX ] [ MAX ] = { 0 } ; void binomial ( ) { for ( int i = 0 ; i < MAX ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { if ( j == 0 j == i ) nCr [ i ] [ j ] = 1 ; else nCr [ i ] [ j ] = nCr [ i - 1 ] [ j ] + nCr [ i - 1 ] [ j - 1 ] ; } } } double findCosNTheta ( double sinTheta , ll n ) { double cosTheta = sqrt ( 1 - sinTheta * sinTheta ) ; double ans = 0 ; ll toggle = 1 ; for ( int i = 1 ; i <= n ; i += 2 ) { ans = ans + nCr [ n ] [ i ] * pow ( cosTheta , n - i ) * pow ( sinTheta , i ) * toggle ; toggle = toggle * -1 ; } return ans ; } int main ( ) { binomial ( ) ; double sinTheta = 0.5 ; ll n = 10 ; cout << findCosNTheta ( sinTheta , n ) << endl ; return 0 ; }

Index/key variables: MAX, i, j, n
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
#define MAX  16
using namespace std ; int nCr [ MAX ] [ MAX ] = { 0 } ; void binomial ( ) { for ( int i = 0 ; i < MAX ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { if ( j == 0 j == i ) nCr [ i ] [ j ] = 1 ; else nCr [ i ] [ j ] = nCr [ i - 1 ] [ j ] + nCr [ i - 1 ] [ j - 1 ] ; } } } double findCosnTheta ( double cosTheta , int n ) { double sinTheta = sqrt ( 1 - cosTheta * cosTheta ) ; double ans = 0 ; int toggle = 1 ; for ( int i = 0 ; i <= n ; i += 2 ) { ans = ans + nCr [ n ] [ i ] * pow ( cosTheta , n - i ) * pow ( sinTheta , i ) * toggle ; toggle = toggle * -1 ; } return ans ; } int main ( ) { binomial ( ) ; double cosTheta = 0.5 ; int n = 10 ; cout << findCosnTheta ( cosTheta , n ) << endl ; return 0 ; }

Index/key variables: MAX, i, j, n
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPower ( int a ) { if ( a == 1 ) return true ; for ( int i = 2 ; i * i <= a ; i ++ ) { double val = log ( a ) / log ( i ) ; if ( ( val - ( int ) val ) < 0.00000001 ) return true ; } return false ; } int main ( ) { int n = 16 ; cout << ( isPower ( n ) ? " Yes " : " No " ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; float rmsValue ( int arr [ ] , int n ) { int square = 0 ; float mean = 0.0 , root = 0.0 ; for ( int i = 0 ; i < n ; i ++ ) { square += pow ( arr [ i ] , 2 ) ; } mean = ( square / ( float ) ( n ) ) ; root = sqrt ( mean ) ; return root ; } int main ( ) { int arr [ ] = { 10 , 4 , 6 , 8 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << rmsValue ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, square, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; float Mixture ( int X , int Y , int Z ) { float result = 0.0 , result1 = 0.0 ; result1 = ( ( X - Y ) / ( float ) X ) ; result = pow ( result1 , Z ) ; result = result * X ; return result ; } int main ( ) { int X = 10 , Y = 2 , Z = 2 ; cout << Mixture ( X , Y , Z ) << " ▁ litres " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define mod  (int)(1e9 + 7)
int power ( int x , int y , int p ) { while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } int check ( int n ) { n -- ; int ans = n * n ; if ( ans >= mod ) ans %= mod ; ans += n + 2 ; if ( ans >= mod ) ans %= mod ; ans = ( power ( 2 , n , mod ) % mod * ans % mod ) % mod ; ans = ( ans - 1 + mod ) % mod ; return ans ; } int main ( ) { int n = 4 ; cout << check ( n ) << endl ; return 0 ; }

Accumulator variables: ans, n, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findLCM ( int a , int b ) { int lar = max ( a , b ) ; int small = min ( a , b ) ; for ( int i = lar ; ; i += lar ) { if ( i % small == 0 ) return i ; } } int main ( ) { int a = 5 , b = 7 ; cout << " LCM ▁ of ▁ " << a << " ▁ and ▁ " << b << " ▁ is ▁ " << findLCM ( a , b ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void primes ( int n ) { int i = 2 ; int j = 0 ; int result [ n ] ; int z = 0 ; while ( j < n ) { bool flag = true ; for ( int item = 2 ; item <= ( int ) ( i * 1 / 2 ) ; item ++ ) if ( i % item == 0 && i != item ) { flag = false ; break ; } if ( flag ) { result [ z ++ ] = i ; j += 1 ; } i += 1 ; } for ( i = 0 ; i < 5 ; i ++ ) { for ( j = 0 ; j <= i ; j ++ ) cout << result [ j ] ; cout << " ▁ " ; } } void smar_wln ( int n ) { primes ( n ) ; } int main ( ) { int n = 5 ; cout << " First ▁ " << n << " ▁ terms ▁ of ▁ the ▁ Sequence ▁ are " << endl ; smar_wln ( n ) ; }

Index/key variables: j, n
Accumulator variables: i, item, j, stdc, z
Iterator variables: i, item, j
Boolean variables: flag
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Pentatope_number ( int n ) { return n * ( n + 1 ) * ( n + 2 ) * ( n + 3 ) / 24 ; } int main ( ) { int n = 7 ; cout << n << " th ▁ Pentatope ▁ number ▁ : " << Pentatope_number ( n ) << endl ; n = 12 ; cout << n << " th ▁ Pentatope ▁ number ▁ : " << Pentatope_number ( n ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int centeredIcosahedralNum ( int n ) { return ( 2 * n + 1 ) * ( 5 * n * n + 5 * n + 3 ) / 3 ; } int main ( ) { int n = 10 ; cout << centeredIcosahedralNum ( n ) << endl ; n = 12 ; cout << centeredIcosahedralNum ( n ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int centered_square_num ( int n ) { return n * n + ( ( n - 1 ) * ( n - 1 ) ) ; } int main ( ) { int n = 7 ; cout << n << " th ▁ Centered ▁ square ▁ number : ▁ " ; cout << centered_square_num ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Dodecagonal_number ( int n ) { return 5 * n * n - 4 * n ; } int main ( ) { int n = 7 ; cout << Dodecagonal_number ( n ) << endl ; n = 12 ; cout << Dodecagonal_number ( n ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void SieveOfEratosthenes ( int n , bool prime [ ] , bool primesquare [ ] , int a [ ] ) { for ( int i = 2 ; i <= n ; i ++ ) prime [ i ] = true ; for ( int i = 0 ; i <= ( n * n + 1 ) ; i ++ ) primesquare [ i ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= n ; i += p ) prime [ i ] = false ; } } int j = 0 ; for ( int p = 2 ; p <= n ; p ++ ) { if ( prime [ p ] ) { a [ j ] = p ; primesquare [ p * p ] = true ; j ++ ; } } } int countDivisors ( int n ) { if ( n == 1 ) return 1 ; bool prime [ n + 1 ] , primesquare [ n * n + 1 ] ; SieveOfEratosthenes ( n , prime , primesquare , a ) ; int ans = 1 ; for ( int i = 0 ; ; i ++ ) { if ( a [ i ] * a [ i ] * a [ i ] > n ) break ; int cnt = 1 ; while ( n % a [ i ] == 0 ) { n = n / a [ i ] ; } ans = ans * cnt ; } if ( prime [ n ] ) ans = ans * 2 ; else if ( primesquare [ n ] ) ans = ans * 3 ; else if ( n != 1 ) ans = ans * 4 ; } 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 ; } bool checkArithmetic ( int n ) { int count = countDivisors ( n ) ; int sum = sumofFactors ( n ) ; return ( sum % count == 0 ) ; } int main ( ) { int n = 6 ; ( checkArithmetic ( n ) ) ? ( cout << " Yes " ) : ( cout << " No " ) ; return 0 ; }

Index/key variables: i, j, n, p
Accumulator variables: count, curr_sum, curr_term, i, j, p, res, stdc
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; void nextPower ( int N , vector < int > & power ) { int carry = 0 ; for ( int i = 0 ; i < power . size ( ) ; i ++ ) { int prod = ( power [ i ] * N ) + carry ; power [ i ] = prod % 10 ; carry = prod / 10 ; } while ( carry ) { power . push_back ( carry % 10 ) ; carry = carry / 10 ; } } void printPowerNumber ( int X , int N ) { vector < int > power ; power . push_back ( 1 ) ; vector < int > res ; for ( int i = 1 ; i <= X ; i ++ ) { nextPower ( N , power ) ; res . push_back ( power . back ( ) ) ; res . push_back ( power . front ( ) ) ; } for ( int i = 0 ; i < res . size ( ) ; i ++ ) cout << res [ i ] ; } int main ( ) { int N = 19 , X = 4 ; printPowerNumber ( X , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int firstDigit ( int n ) { long long int fact = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { fact = fact * i ; while ( fact % 10 == 0 ) fact = fact / 10 ; } while ( fact >= 10 ) fact = fact / 10 ; return fact ; } int main ( ) { int n = 5 ; cout << firstDigit ( n ) ; return 0 ; }

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

Accumulator variables: i, res, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printGMeans ( int A , int B , int N ) { float R = ( float ) pow ( float ( B / A ) , 1.0 / ( float ) ( N + 1 ) ) ; for ( int i = 1 ; i <= N ; i ++ ) cout << A * pow ( R , i ) << " ▁ " ; } int main ( ) { int A = 3 , B = 81 , N = 2 ; printGMeans ( A , B , N ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int digitSum ( long long int n ) { int digSum = 0 ; while ( n ) { digSum += n % 10 ; n /= 10 ; } return digSum ; } long long int countInteger ( long long int n , long long int s ) { if ( n < s ) return 0 ; for ( long long int i = s ; i <= min ( n , s + 163 ) ; i ++ ) if ( ( i - digitSum ( i ) ) > s ) return ( n - i + 1 ) ; return 0 ; } int main ( ) { long long int n = 1000 , s = 100 ; cout << countInteger ( n , s ) ; return 0 ; }

Accumulator variables: digSum, i, n, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int division ( int num1 , int num2 ) { if ( num1 == 0 ) return 0 ; if ( num2 == 0 ) return INT_MAX ; bool negResult = false ; if ( num1 < 0 ) { num1 = - num1 ; if ( num2 < 0 ) num2 = - num2 ; else negResult = true ; } else if ( num2 < 0 ) { num2 = - num2 ; negResult = true ; } int quotient = 0 ; while ( num1 >= num2 ) { num1 = num1 - num2 ; quotient ++ ; } if ( negResult ) quotient = - quotient ; return quotient ; } int main ( ) { int num1 = 13 , num2 = 2 ; cout << division ( num1 , num2 ) ; ; return 0 ; }

Accumulator variables: quotient, stdc
Boolean variables: negResult
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Nonagonal ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { cout << i * ( 7 * i - 5 ) / 2 ; cout << " ▁ " ; } } int main ( ) { int n = 10 ; Nonagonal ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int seriesFunc ( int n ) { int sumSquare = ( n * ( n + 1 ) * ( 2 * n + 1 ) ) / 6 ; int sumNatural = ( n * ( n + 1 ) / 2 ) ; return ( sumSquare + sumNatural + 1 ) ; } int main ( ) { int n = 8 ; cout << seriesFunc ( n ) << endl ; n = 13 ; cout << seriesFunc ( 13 ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool checkplusperfect ( int x ) { int temp = x ; int n = 0 ; while ( x != 0 ) { x /= 10 ; n ++ ; } x = temp ; int sum = 0 ; while ( x != 0 ) { sum += pow ( x % 10 , n ) ; x /= 10 ; } return ( sum == temp ) ; } int main ( ) { int x = 9474 ; if ( checkplusperfect ( x ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: n, stdc, sum, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int subsetCount ( int arr [ ] , int n ) { return 1 << n ; } int main ( ) { int A [ ] = { 1 , 2 , 3 } ; int n = sizeof ( A ) / sizeof ( A [ 0 ] ) ; cout << subsetCount ( A , n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int centeredHexagonalNumber ( int n ) { return 3 * n * ( n - 1 ) + 1 ; } int main ( ) { int n = 10 ; cout << n << " th ▁ centered ▁ hexagonal ▁ number : ▁ " ; cout << centeredHexagonalNumber ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int find_distance ( int n ) { return n * ( ( 3 * n ) + 7 ) ; } int main ( ) { int n = 5 ; cout << " Distance ▁ = ▁ " << find_distance ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
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 ; } bool twinPrime ( int n1 , int n2 ) { return ( isPrime ( n1 ) && isPrime ( n2 ) && abs ( n1 - n2 ) == 2 ) ; } int main ( ) { int n1 = 11 , n2 = 13 ; if ( twinPrime ( n1 , n2 ) ) cout << " Twin ▁ Prime " << endl ; else cout << endl << " Not ▁ Twin ▁ Prime " << endl ; return 0 ; }

Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; float sumOfSeries ( int n ) { return 0.0246 * ( pow ( 10 , n ) - 1 - ( 9 * n ) ) ; } int main ( ) { int n = 3 ; cout << sumOfSeries ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int evenbinomialCoeffSum ( int n ) { return ( 1 << ( n - 1 ) ) ; } int main ( ) { int n = 4 ; printf ( " % d " , evenbinomialCoeffSum ( n ) ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sumOfTheSeries ( int n ) { return ( n * ( n + 1 ) / 2 ) * ( 2 * n + 1 ) / 3 ; } int main ( ) { int n = 5 ; cout << " Sum ▁ = ▁ " << sumOfTheSeries ( n ) ; return 0 ; }

Accumulator variables: stdc
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 += j ; return sum ; } int main ( ) { int n = 10 ; cout << sumOfSeries ( n ) ; return 0 ; }

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

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

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

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printXYZ ( int n ) { if ( n == 1 ) cout << -1 ; else cout << " x ▁ is ▁ " << n << " STRNEWLINE y ▁ is ▁ " << n + 1 << " STRNEWLINE z ▁ is ▁ " << n * ( n + 1 ) ; } int main ( ) { int n = 7 ; printXYZ ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int term ( int n ) { return n * ( n + 1 ) / 2 ; } int main ( ) { int n = 4 ; cout << term ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; double compute ( int a , int b ) { double AM , GM , HM ; AM = ( a + b ) / 2 ; GM = sqrt ( a * b ) ; HM = ( GM * GM ) / AM ; return HM ; } int main ( ) { int a = 5 , b = 15 ; double HM = compute ( a , b ) ; cout << " Harmonic ▁ Mean ▁ between ▁ " << a << " ▁ and ▁ " << b << " ▁ is ▁ " << HM ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int series ( int n ) { return ( 8 * n * n ) + 1 ; } int main ( ) { int n = 5 ; cout << series ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isDivisible ( int x , int y ) { if ( y == 1 ) return true ; if ( __gcd ( x , y ) == 1 ) return false ; return isDivisible ( x , y / gcd ) ; } int main ( ) { int x = 18 , y = 12 ; if ( isDivisible ( x , y ) ) cout << " Yes " << endl ; else cout << " No " << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; double sumOfSeries ( double a , double num ) { double res = 0 , prev = 1 ; for ( int i = 1 ; i <= num ; i ++ ) { prev *= ( a / i ) ; res = res + prev ; } return ( res ) ; } int main ( ) { double n = 5 , a = 2 ; cout << sumOfSeries ( a , n ) ; return 0 ; }

Accumulator variables: i, prev, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; float Cel_To_Fah ( float n ) { return ( ( n * 9.0 / 5.0 ) + 32.0 ) ; } int main ( ) { float n = 20.0 ; cout << Cel_To_Fah ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void print_sequence ( int n , int k ) { int b = n / ( k * ( k + 1 ) / 2 ) ; if ( b == 0 ) { cout << -1 << endl ; } else { int r = 1 ; for ( int x = 1 ; x * x <= n ; x ++ ) { if ( n % x != 0 ) continue ; if ( x <= b && x > r ) r = x ; if ( n / x <= b && n / x > r ) r = n / x ; } for ( int i = 1 ; i < k ; i ++ ) cout << r * i << " ▁ " ; int res = n - ( r * ( k * ( k - 1 ) / 2 ) ) ; cout << res << endl ; } } int main ( ) { int n = 24 ; int k = 4 ; print_sequence ( n , k ) ; n = 24 , k = 5 ; print_sequence ( n , k ) ; n = 6 , k = 4 ; print_sequence ( n , k ) ; }

Accumulator variables: i, stdc, x
Iterator variables: i, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countDigit ( long long n ) { if ( n / 10 == 0 ) return 1 ; return 1 + countDigit ( n / 10 ) ; } int main ( void ) { long long n = 345289467 ; cout << " Number ▁ of ▁ digits ▁ : " << countDigit ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
using namespace std ; int printTrib ( int n ) { int dp [ n ] ; dp [ 0 ] = dp [ 1 ] = 0 ; dp [ 2 ] = 1 ; for ( int i = 3 ; i < n ; i ++ ) dp [ i ] = dp [ i - 1 ] + dp [ i - 2 ] + dp [ i - 3 ] ; for ( int i = 0 ; i < n ; i ++ ) cout << dp [ i ] << " ▁ " ; } int main ( ) { int n = 10 ; printTrib ( n ) ; return 0 ; }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i