dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; int totalPay ( int totalItems , int priceOfOneItem , int N , int M ) { int freeItems = 0 , actual = 0 ; freeItems = totalItems / ( N + M ) ; actual = totalItems - freeItems ; int amount = actual * priceOfOneItem ; return amount ; } int main ( ) { int T = 12 , P = 8 ; int N = 2 , M = 1 ; cout << " Amount ▁ = ▁ " << totalPay ( T , P , N , M ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define p  1000000007
long long power ( long long x , long long y ) { long long res = 1 ; x = x % p ; while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res % p ; } int main ( ) { long long n = 3 ; long long x = ( power ( 3 , n ) % p + 1 ) % p ; x = ( x - power ( 2 , n + 1 ) + p ) % p ; x = ( x * power ( 2 , p - 2 ) ) % p ; cout << x << " STRNEWLINE " ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int rightmostNonZero ( int a [ ] , int n ) { int c5 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { while ( a [ i ] > 0 && a [ i ] % 5 == 0 ) { a [ i ] /= 5 ; c5 ++ ; } } for ( int i = 0 ; i < n ; i ++ ) { while ( c5 && a [ i ] > 0 && ! ( a [ i ] & 1 ) ) { a [ i ] >>= 1 ; c5 -- ; } } long long ans = 1 ; for ( int i = 0 ; i < n ; i ++ ) { ans = ( ans * a [ i ] % 10 ) % 10 ; } if ( c5 ) ans = ( ans * 5 ) % 10 ; if ( ans ) return ans ; return -1 ; } int main ( ) { int a [ ] = { 7 , 42 , 11 , 64 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << rightmostNonZero ( a , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: c5, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findRemainder ( int n ) { int l = n % 10 ; while ( n >= 10 ) n /= 10 ; int f = n ; int remainder = f % l ; cout << remainder << endl ; } int main ( ) { int n = 5223 ; findRemainder ( n ) ; return 0 ; }

Accumulator variables: n, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; double increaseInVol ( double l , double b , double h ) { double percentInc = ( 1 + ( l / 100 ) ) * ( 1 + ( b / 100 ) ) * ( 1 + ( h / 100 ) ) ; percentInc -= 1 ; percentInc *= 100 ; return percentInc ; } int main ( ) { double l = 50 , b = 20 , h = 10 ; cout << increaseInVol ( l , b , h ) << " % " ; return 0 ; }

Accumulator variables: percentInc, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findFactors ( int a , int b ) { int c ; c = a + b - 1 ; cout << c ; } int main ( ) { int a , b ; a = 13 ; b = 36 ; findFactors ( a , b ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void TwentyoneMatchstick ( int arr [ ] , int N ) { for ( int i = 0 ; i < N ; i += 1 ) { cout << 5 - arr [ i ] << " ▁ " ; } cout << endl ; } int main ( ) { int arr [ ] = { 3 , 4 , 2 , 2 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; TwentyoneMatchstick ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void expressDigit ( int arr [ ] , int n ) { int min = 9 , index = 0 , temp = 0 ; temp = arr [ 0 ] ; for ( int i = 1 ; i < 10 ; i ++ ) { if ( arr [ i ] < min ) { min = arr [ i ] ; index = i ; } } if ( temp < min ) { cout << 1 ; for ( int i = 1 ; i <= temp + 1 ; i ++ ) cout << 0 ; } else { for ( int i = 0 ; i < min ; i ++ ) cout << index ; cout << index ; } } int main ( ) { int arr [ ] = { 2 , 2 , 1 , 2 , 1 , 1 , 3 , 1 , 1 , 1 } ; int N = 10 ; expressDigit ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countDigits ( int num ) { int cnt = 0 ; while ( num > 0 ) { cnt ++ ; num /= 10 ; } return cnt ; } int sumFromStart ( int num , int n , int rem ) { num /= ( ( int ) pow ( 10 , rem ) ) ; int sum = 0 ; while ( num > 0 ) { sum += ( num % 10 ) ; num /= 10 ; } return sum ; } int sumFromEnd ( int num , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += ( num % 10 ) ; num /= 10 ; } return sum ; } float getAverage ( int n , int k , int l ) { int totalDigits = countDigits ( n ) ; if ( totalDigits < ( k + l ) ) return -1 ; int sum1 = sumFromEnd ( n , l ) ; int sum2 = sumFromStart ( n , k , totalDigits - k ) ; return ( ( float ) ( sum1 + sum2 ) / ( float ) ( k + l ) ) ; } int main ( ) { int n = 123456 , k = 2 , l = 3 ; cout << getAverage ( n , k , l ) ; return 0 ; }

Accumulator variables: cnt, i, num, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Wythoff ( map < int , map < int , int > > & mp , int n , int k ) { double tau = ( sqrt ( 5 ) + 1 ) / 2.0 , t_n_k ; if ( mp [ n ] [ k ] != 0 ) return mp [ n ] [ k ] ; if ( k == -1 ) { return n - 1 ; } else if ( k == 0 ) { t_n_k = floor ( n * tau ) ; } else { t_n_k = Wythoff ( mp , n , k - 1 ) + Wythoff ( mp , n , k - 2 ) ; } mp [ n ] [ k ] = t_n_k ; return ( int ) t_n_k ; } void Wythoff_Array ( int n ) { int i = 0 , j = 0 , count = 0 ; map < int , map < int , int > > mp ; while ( count < n ) { cout << Wythoff ( mp , i + 1 , j + 1 ) ; count ++ ; if ( count != n ) cout << " , ▁ " ; i ++ ; j -- ; if ( j < 0 ) { j = i ; i = 0 ; } } } int main ( ) { int n = 15 ; Wythoff_Array ( n ) ; return 0 ; }

Index/key variables: k, n
Accumulator variables: count, i, j, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; double sum ( double a , double b , double c , double d , double x ) { double ans = ( x * ( a + b ) * ( c - d ) ) / ( ( a * d ) - ( b * c ) ) ; return ans ; } int main ( ) { double a = 1 , b = 2 , c = 9 , d = 13 , x = 5 ; cout << sum ( a , b , c , d , x ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool is_Prime ( int n ) { if ( n < 2 ) return false ; for ( int i = 2 ; i <= sqrt ( n ) ; i ++ ) if ( n % i == 0 ) return false ; return true ; } void set_primes ( map < int , map < int , int > > & mp , map < int , map < int , int > > & hash , int c ) { int count = 0 ; for ( int i = 2 ; count < c ; i ++ ) { if ( is_Prime ( i ) ) { mp [ 0 ] [ count ++ ] = i ; hash [ 0 ] [ count - 1 ] = 1 ; } } } int Gilbreath ( map < int , map < int , int > > & mp , map < int , map < int , int > > & hash , int n , int k ) { if ( hash [ n ] [ k ] != 0 ) return mp [ n ] [ k ] ; int ans = abs ( Gilbreath ( mp , hash , n - 1 , k + 1 ) - Gilbreath ( mp , hash , n - 1 , k ) ) ; mp [ n ] [ k ] = ans ; return ans ; } void solve ( int n ) { int i = 0 , j = 0 , count = 0 ; map < int , map < int , int > > mp , hash ; set_primes ( mp , hash , 100 ) ; while ( count < n ) { cout << Gilbreath ( mp , hash , i , j ) << " , ▁ " ; count ++ ; i -- ; j ++ ; if ( i < 0 ) { i = j ; j = 0 ; } } } int main ( ) { int n = 15 ; solve ( n ) ; return 0 ; }

Index/key variables: k, n
Accumulator variables: count, i, j, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printRoots ( long a , long b , long c ) { cout << 1 << " , ▁ " << c / ( a * 1.0 ) ; } int main ( ) { long a = 2 ; long b = 3 ; long c = -5 ; printRoots ( a , b , c ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
using namespace std ; int longestAlternativeSequence ( int a [ ] , int n ) { int maxi1 = 0 ; int f1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! f1 ) { if ( a [ i ] % 2 ) { f1 = 1 ; maxi1 ++ ; } } else { if ( a [ i ] % 2 == 0 ) { maxi1 ++ ; f1 = 0 ; } } } int maxi2 = 0 ; int f2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( f2 ) { if ( a [ i ] % 2 ) { f2 = 1 ; maxi2 ++ ; } } else { if ( a [ i ] % 2 == 0 ) { maxi2 ++ ; f2 = 0 ; } } } return max ( maxi1 , maxi2 ) ; } int main ( ) { int a [ ] = { 13 , 16 , 8 , 9 , 32 , 10 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << longestAlternativeSequence ( a , n ) ; }

Index/key variables: i
Accumulator variables: i, maxi1, maxi2
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string numbiarNumber ( string str , int i ) { if ( i > str . length ( ) ) return " " ; int firstDigit = str [ i ] - '0' ; int digitParity = firstDigit % 2 ; int sumDigits = 0 ; while ( i < str . length ( ) ) { sumDigits += ( str [ i ] - '0' ) ; int sumParity = sumDigits % 2 ; if ( digitParity != sumParity ) break ; i ++ ; } return ( to_string ( sumDigits ) + numbiarNumber ( str , i + 1 ) ) ; } int main ( ) { string str = "9880127431" ; cout << numbiarNumber ( str , 0 ) << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, sumDigits
C++ program:
#include <bits/stdc++.h>
using namespace std ; float Depreciation ( float v , float r , float t ) { float D = v * pow ( ( 1 - r / 100 ) , t ) ; return D ; } int main ( ) { float V1 = 200 , R = 10 , T = 2 ; cout << Depreciation ( V1 , R , T ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost :: multiprecision ; #define llu  int128_t
using namespace std ; llu power ( llu x , llu y ) { while ( y > 0 ) { if ( y & 1 ) res = res * x ; } return res ; } llu Fermat ( llu i ) { llu power2_i = power ( 2 , i ) ; llu power2_2_i = power ( 2 , power2_i ) ; return power2_2_i + 1 ; } void Fermat_Number ( llu n ) { for ( llu i = 0 ; i < n ; i ++ ) { cout << Fermat ( i ) ; if ( i != n - 1 ) cout << " , ▁ " ; } } int main ( ) { llu n = 7 ; Fermat_Number ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int phi ( int n ) { for ( int p = 2 ; p * p <= n ; ++ p ) { if ( n % p == 0 ) { while ( n % p == 0 ) n /= p ; result -= result / p ; } } if ( n > 1 ) result -= result / n ; return result ; } void Highly_Totient ( int n ) { int count = 0 , p_count = -1 , i = 1 ; map < int , int > mp ; for ( int i = 1 ; i < 100000 ; i ++ ) mp [ phi ( i ) ] ++ ; while ( count < n ) { if ( mp [ i ] > p_count ) { cout << i ; if ( count < n - 1 ) cout << " , ▁ " ; p_count = mp [ i ] ; count ++ ; } i ++ ; } } int main ( ) { int n = 20 ; Highly_Totient ( n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, n, result, stdc
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; float speedOfTrain ( float X , float Y ) { float Speed = 0 ; Speed = 1188 * ( ( X - Y ) / Y ) ; return Speed ; } int main ( ) { float X = 8 , Y = 7.2 ; cout << speedOfTrain ( X , Y ) << " ▁ km / hr " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Division ( int a [ ] , int n ) { int maxi = INT_MIN , mini = INT_MAX ; for ( int i = 0 ; i < n ; i ++ ) { maxi = max ( a [ i ] , maxi ) ; mini = min ( a [ i ] , mini ) ; } return maxi / mini ; } int main ( ) { int a [ ] = { 3 , 7 , 9 , 3 , 11 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << Division ( a , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  1000000
vector < int > addPrimes ( ) { int n = MAX ; 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 * p ; i <= n ; i += p ) prime [ i ] = false ; } } vector < int > ans ; for ( int p = 2 ; p <= n ; p ++ ) if ( prime [ p ] ) ans . push_back ( p ) ; return ans ; } int pi ( int x , vector < int > v ) { int l = 0 , r = v . size ( ) - 1 , m , in = -1 ; while ( l <= r ) { m = ( l + r ) / 2 ; if ( v [ m ] <= x ) { in = m ; l = m + 1 ; } else { r = m - 1 ; } } return in + 1 ; } int Ramanujan ( int n , vector < int > v ) { int upperbound = 4 * n * ( log ( 4 * n ) / log ( 2 ) ) ; for ( int i = upperbound ; ; i -- ) { if ( pi ( i , v ) - pi ( i / 2 , v ) < n ) return 1 + i ; } } void Ramanujan_Numbers ( int n ) { int c = 1 ; vector < int > v = addPrimes ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { cout << Ramanujan ( i , v ) ; if ( i != n ) cout << " , ▁ " ; } } int main ( ) { int n = 10 ; Ramanujan_Numbers ( n ) ; return 0 ; }

Index/key variables: i, m, p
Accumulator variables: i, p, stdc
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MAX = 130 ; bool validQuadruple ( int arr [ ] , int n ) { if ( n >= MAX ) return true ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) for ( int k = j + 1 ; k < n ; k ++ ) for ( int l = k + 1 ; l < n ; l ++ ) { if ( ( arr [ i ] ^ arr [ j ] ^ arr [ k ] ^ arr [ l ] ) == 0 ) { return true ; } } return false ; } int main ( ) { int arr [ ] = { 1 , 0 , 2 , 3 , 7 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; if ( validQuadruple ( arr , n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: i, j, k, l
Accumulator variables: i, j, k, l, stdc
Iterator variables: i, j, k, l
C++ program:
#include <bits/stdc++.h>
using namespace std ; int fact ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } int nCr ( int n , int r ) { return fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; } int NumberOfWays ( int X , int Y , int M , int N ) { return fact ( X + Y ) * nCr ( M , X ) * nCr ( N , Y ) ; } int main ( ) { int X = 2 , Y = 2 , M = 3 , N = 3 ; cout << NumberOfWays ( X , Y , M , N ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int fact ( int n ) { int i = 1 , fac = 1 ; for ( i = 1 ; i <= n ; i ++ ) fac = fac * i ; return fac ; } double log_Expansion ( double x , int n ) { double sum = 0 ; int i = 0 ; for ( i = 0 ; i < n ; i ++ ) { sum = sum + pow ( x , 2 * i ) / fact ( 2 * i ) ; } return sum ; } int main ( ) { double x = 1 ; int n = 10 ; cout << setprecision ( 12 ) << log_Expansion ( x , n ) << endl ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool prime ( int n ) { for ( int i = 2 ; i * i <= n ; i ++ ) if ( n % i == 0 ) return false ; return true ; } void prime_range ( int start , int end , int * a ) { for ( int i = start ; i < end ; i ++ ) { if ( prime ( a [ i ] ) ) cout << a [ i ] << " ▁ " ; } } void Print ( int arr [ ] , int n ) { cout << " Prime ▁ numbers ▁ in ▁ the ▁ first ▁ half ▁ are ▁ " ; prime_range ( 0 , n / 2 , arr ) ; cout << endl ; cout << " Prime ▁ numbers ▁ in ▁ the ▁ second ▁ half ▁ are ▁ " ; prime_range ( n / 2 , n , arr ) ; cout << endl ; } int main ( ) { int arr [ ] = { 2 , 5 , 10 , 15 , 17 , 21 , 23 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; Print ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countElements ( int arr [ ] , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; float mean = ( float ) sum / n ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { float newMean = ( float ) ( sum - arr [ i ] ) / ( n - 1 ) ; if ( newMean == mean ) cnt ++ ; } return cnt ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << countElements ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: cnt, i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  10000
#define MAX_ELEMENT  50
int dp [ MAX_ELEMENT ] [ MAX_ELEMENT ] [ MAX ] ; int Max_Xor ( int arr [ ] , int i , int j , int mask , int n ) { if ( i >= n ) { if ( j == 0 ) return mask ; else return 0 ; } if ( dp [ i ] [ j ] [ mask ] != -1 ) return dp [ i ] [ j ] [ mask ] ; int ans = 0 ; if ( j > 0 ) ans = Max_Xor ( arr , i + 1 , j - 1 , mask ^ arr [ i ] , n ) ; ans = max ( ans , Max_Xor ( arr , i + 1 , j , mask , n ) ) ; return dp [ i ] [ j ] [ mask ] = ans ; } int main ( ) { int arr [ ] = { 2 , 5 , 4 , 1 , 3 , 7 , 6 , 8 } ; int n = sizeof ( arr ) / sizeof ( int ) ; int k = 3 ; memset ( dp , -1 , sizeof ( dp ) ) ; cout << Max_Xor ( arr , 0 , k , 0 , n ) ; return 0 ; }

Index/key variables: MAX, MAX_ELEMENT, i, j, mask
Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool Prime ( int n ) { for ( int j = 2 ; j <= sqrt ( n ) ; j ++ ) if ( n % j == 0 ) return false ; return true ; } int find_prime ( int x , int xsqmodp , int y , int ysqmodp ) { int n = x * x - xsqmodp ; int n1 = y * y - ysqmodp ; for ( int j = 2 ; j <= max ( sqrt ( n ) , sqrt ( n1 ) ) ; j ++ ) { if ( n % j == 0 && ( x * x ) % j == xsqmodp && n1 % j == 0 && ( y * y ) % j == ysqmodp ) if ( Prime ( j ) ) return j ; int j1 = n / j ; if ( n % j1 == 0 && ( x * x ) % j1 == xsqmodp && n1 % j1 == 0 && ( y * y ) % j1 == ysqmodp ) if ( Prime ( j1 ) ) return j1 ; j1 = n1 / j ; if ( n % j1 == 0 && ( x * x ) % j1 == xsqmodp && n1 % j1 == 0 && ( y * y ) % j1 == ysqmodp ) if ( Prime ( j1 ) ) return j1 ; } if ( n == n1 ) return n ; } int main ( ) { int x = 3 , xsqmodp = 0 , y = 5 , ysqmodp = 1 ; cout << find_prime ( x , xsqmodp , y , ysqmodp ) ; return 0 ; }

Accumulator variables: j, stdc
Iterator variables: j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int numberOfMinutes ( int S , int S1 ) { int Min = 0 ; Min = ( ( S - S1 ) / floor ( S ) ) * 60 ; return Min ; } int main ( ) { int S = 30 , S1 = 10 ; cout << numberOfMinutes ( S , S1 ) << " ▁ min " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int FindElement ( int a [ ] , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum = sum + a [ i ] ; if ( sum % n == 0 ) { int m = sum / n ; for ( int i = 0 ; i < n ; i ++ ) if ( a [ i ] == m ) return m ; } return -1 ; } int main ( ) { int a [ ] = { 1 , 2 , 3 , 4 , 5 } ; int n = sizeof ( a ) / sizeof ( int ) ; cout << FindElement ( a , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int fac ( int num ) { if ( num == 0 ) return 1 ; int fact = 1 ; for ( int i = 1 ; i <= num ; i ++ ) fact = fact * i ; return fact ; } void Tanx_expansion ( int terms , int x ) { double sum = 0 ; for ( int i = 1 ; i <= terms ; i += 1 ) { double B = 0 ; int Bn = 2 * i ; for ( int k = 0 ; k <= Bn ; k ++ ) { double temp = 0 ; for ( int r = 0 ; r <= k ; r ++ ) temp = temp + pow ( -1 , r ) * fac ( k ) * pow ( r , Bn ) / ( fac ( r ) * fac ( k - r ) ) ; B = B + temp / ( ( double ) ( k + 1 ) ) ; } sum = sum + pow ( -4 , i ) * ( 1 - pow ( 4 , i ) ) * B * pow ( x , 2 * i - 1 ) / fac ( 2 * i ) ; } cout << setprecision ( 10 ) << sum ; } int main ( ) { int n = 6 , x = 1 ; Tanx_expansion ( n , x ) ; return 0 ; }

Accumulator variables: i, k, r, stdc
Iterator variables: i, k, r
C++ program:
#include <iostream>
using namespace std ; int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } int minimum_elements ( int n , int arr [ ] ) { if ( n < 3 ) return 0 ; int g , ans = 0 , diff , cnt ; diff = arr [ 1 ] - arr [ 0 ] ; g = diff ; for ( int i = 2 ; i < n ; i ++ ) { diff = arr [ i ] - arr [ i - 1 ] ; g = gcd ( g , diff ) ; } for ( int i = 1 ; i < n ; i ++ ) { diff = arr [ i ] - arr [ i - 1 ] ; cnt = diff / g ; ans += ( cnt - 1 ) ; } return ans ; } int main ( ) { int arr [ ] = { 1 , 5 , 8 , 10 , 12 , 16 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << minimum_elements ( n , arr ) ; return 0 ; }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool checkcomposite ( int n ) { for ( int i = 2 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) return 1 ; } return 0 ; } int power ( int x , int y , int mod ) { int res = 1 ; while ( y ) { if ( y & 1 ) res = ( res * x ) % mod ; y = y >> 1 ; x = ( x * x ) % mod ; } return res ; } bool Check ( int n , int a ) { if ( a > 1 && checkcomposite ( n ) && power ( a , n - 1 , n ) == 1 ) return 1 ; return 0 ; } int main ( ) { int N = 645 ; int a = 2 ; cout << Check ( N , a ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void Digits ( int n ) { int largest = 0 ; int smallest = 9 ; while ( n ) { int r = n % 10 ; largest = max ( r , largest ) ; smallest = min ( r , smallest ) ; n = n / 10 ; } cout << largest << " ▁ " << smallest ; } int main ( ) { int n = 2346 ; Digits ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int factorial ( int n ) { if ( n <= 1 ) return 1 ; return n * factorial ( n - 1 ) ; } int nCr ( int n , int r ) { return factorial ( n ) / ( factorial ( r ) * factorial ( n - r ) ) ; } float Probability ( int M , int N , int X ) { return ( float ) ( nCr ( M - N - 1 , X - 2 ) / ( nCr ( M - 1 , X - 1 ) * 1.0 ) ) ; } int main ( ) { int M = 9 , X = 3 , N = 4 ; cout << Probability ( M , N , X ) ; return 0 ; }

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

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int firstSetBit ( int n ) { int x = n & ( n - 1 ) ; return ( n ^ x ) ; } int main ( ) { int n = 12 ; cout << firstSetBit ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int ncr ( int n , int r ) { int res = 1 ; for ( int i = 1 ; i <= r ; i += 1 ) { res *= ( n - r + i ) ; res /= i ; } return res ; } int NoofSequences ( int N , int M ) { unordered_map < int , int > prime ; for ( int i = 2 ; i <= sqrt ( M ) ; i += 1 ) { while ( M % i == 0 ) { prime [ i ] += 1 ; M /= i ; } } if ( M > 1 ) { prime [ M ] += 1 ; } int ans = 1 ; for ( auto it : prime ) { ans *= ( ncr ( N + it . second - 1 , N - 1 ) ) ; } return ans ; } int main ( ) { int N = 2 , M = 6 ; cout << NoofSequences ( N , M ) ; return 0 ; }

Index/key variables: M, i
Accumulator variables: M, ans, i, res, stdc
Iterator variables: i, it
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findHours ( int a , int b , int k ) { if ( a >= b ) return -1 ; int time = k / ( b - a ) ; time = time + 1 ; return time ; } int main ( ) { int a = 4 , b = 5 , k = 1 ; cout << findHours ( a , b , k ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int ncr ( int n , int r ) { int ans = 1 ; for ( int i = 1 ; i <= r ; i += 1 ) { ans *= ( n - r + i ) ; ans /= i ; } return ans ; } int NoOfDistributions ( int N , int R ) { return ncr ( N - 1 , R - 1 ) ; } int main ( ) { int N = 4 ; int R = 3 ; cout << NoOfDistributions ( N , R ) ; return 0 ; }

Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int ncr ( int n , int r ) { int ans = 1 ; for ( int i = 1 ; i <= r ; i += 1 ) { ans *= ( n - r + i ) ; ans /= i ; } return ans ; } int NoOfDistributions ( int N , int R ) { return ncr ( N + R - 1 , R - 1 ) ; } int main ( ) { int N = 4 , R = 3 ; cout << NoOfDistributions ( N , R ) ; return 0 ; }

Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool checkPerfectcube ( int n ) { int d = cbrt ( n ) ; if ( d * d * d == n ) return true ; return false ; } int smallestPerfectCube ( int a [ ] , int n ) { int mini = INT_MAX ; for ( int i = 0 ; i < n ; i ++ ) { if ( checkPerfectcube ( a [ i ] ) ) { mini = min ( a [ i ] , mini ) ; } } return mini ; } int main ( ) { int a [ ] = { 16 , 8 , 25 , 2 , 3 , 10 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << smallestPerfectCube ( a , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Vertices ( int x , int y ) { int val = abs ( x ) + abs ( y ) ; cout << val * ( x < 0 ? -1 : 1 ) << " ▁ 0 ▁ " ; cout << "0 ▁ " << val * ( y < 0 ? -1 : 1 ) ; } int main ( ) { int x = 3 , y = 3 ; Vertices ( x , y ) ; return 0 ; }

Accumulator variables: stdc