dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <iostream>
using namespace std ; int power ( long long int x , long long int y , long long int p ) { long long int res = 1 ; while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } int numberOfDigits ( int x ) { int i = 0 ; while ( x ) { x /= 10 ; i ++ ; } return i ; } void printLastKDigits ( int a , int b , int k ) { cout << " Last ▁ " << k ; cout << " ▁ digits ▁ of ▁ " << a ; cout << " ^ " << b << " ▁ = ▁ " ; int temp = 1 ; for ( int i = 1 ; i <= k ; i ++ ) temp *= 10 ; temp = power ( a , b , temp ) ; for ( int i = 0 ; i < k - numberOfDigits ( temp ) ; i ++ ) cout << 0 ; if ( temp ) cout << temp ; } int main ( ) { int a = 11 ; int b = 3 ; int k = 2 ; printLastKDigits ( a , b , k ) ; return 0 ; }

Accumulator variables: i, temp, x
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int reverseDigits ( int num ) { int rev = 0 ; while ( num > 0 ) { rev = rev * 10 + num % 10 ; num /= 10 ; } return rev ; } int square ( int num ) { return ( num * num ) ; } bool checkAdamNumber ( int num ) { int a = square ( num ) ; int b = square ( reverseDigits ( num ) ) ; if ( a == reverseDigits ( b ) ) return true ; return false ; } int main ( ) { int num = 12 ; if ( checkAdamNumber ( num ) ) cout << " Adam ▁ Number " ; else cout << " Not ▁ a ▁ Adam ▁ Number " ; return 0 ; }

Accumulator variables: num, stdc
C++ program:
#include <bits/stdc++.h>
#define P2 ( n )  n, n ^ 1, n ^ 1, n
#define P4 ( n )  P2(n), P2(n ^ 1), P2(n ^ 1), P2(n)
#define P6 ( n )  P4(n), P4(n ^ 1), P4(n ^ 1), P4(n)
#define LOOK_UP  P6(0), P6(1), P6(1), P6(0)
unsigned int table [ 256 ] = { LOOK_UP } ; int Parity ( int num ) { int max = 16 ; while ( max >= 8 ) { num = num ^ ( num >> max ) ; max = max / 2 ; } return table [ num & 0xff ] ; } int main ( ) { unsigned int num = 1742346774 ; bool result = Parity ( num ) ; result ? std :: cout << " Odd ▁ Parity " : std :: cout << " Even ▁ Parity " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int totalDigits ( int n ) { int number_of_digits = 0 ; for ( int i = 1 ; i <= n ; i *= 10 ) number_of_digits += ( n - i + 1 ) ; return number_of_digits ; } int main ( ) { int n = 13 ; cout << totalDigits ( n ) << endl ; return 0 ; }

Accumulator variables: i, number_of_digits, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void numbersWith3Divisors ( int n ) { bool prime [ n + 1 ] ; memset ( prime , true , sizeof ( prime ) ) ; prime [ 0 ] = prime [ 1 ] = 0 ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= n ; i += p ) prime [ i ] = false ; } } cout << " Numbers ▁ with ▁ 3 ▁ divisors ▁ : STRNEWLINE " ; for ( int i = 0 ; i * i <= n ; i ++ ) if ( prime [ i ] ) cout << i * i << " ▁ " ; } int main ( ) { int n = 96 ; numbersWith3Divisors ( n ) ; return 0 ; }

Index/key variables: i, p
Accumulator variables: i, p, stdc
Iterator variables: i, p
C++ program:
#include <iostream>
using namespace std ; void decToHexa ( int n ) { char hexaDeciNum [ 100 ] ; int i = 0 ; while ( n != 0 ) { int temp = 0 ; temp = n % 16 ; if ( temp < 10 ) { hexaDeciNum [ i ] = temp + 48 ; i ++ ; } else { hexaDeciNum [ i ] = temp + 55 ; i ++ ; } n = n / 16 ; } for ( int j = i - 1 ; j >= 0 ; j -- ) cout << hexaDeciNum [ j ] ; } int main ( ) { int n = 2545 ; decToHexa ( n ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: j
C++ program:
#include <iostream>
using namespace std ; void decToBinary ( int n ) { int binaryNum [ 32 ] ; int i = 0 ; while ( n > 0 ) { binaryNum [ i ] = n % 2 ; n = n / 2 ; i ++ ; } for ( int j = i - 1 ; j >= 0 ; j -- ) cout << binaryNum [ j ] ; } int main ( ) { int n = 17 ; decToBinary ( n ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: j
C++ program:
#include <bits/stdc++.h>
#define ll  long long int
using namespace std ; ll count_of_ways ( ll n ) { ll count ; count = ( n + 1 ) * ( n + 2 ) / 2 ; return count ; } int main ( ) { ll n = 3 ; cout << count_of_ways ( n ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int flipSign ( int a ) { int neg = 0 ; int tmp = a < 0 ? 1 : -1 ; while ( a != 0 ) { neg += tmp ; a += tmp ; } return neg ; } bool areDifferentSign ( int a , int b ) { return ( ( a < 0 && b > 0 ) || ( a > 0 && b < 0 ) ) ; } int sub ( int a , int b ) { return a + flipSign ( b ) ; } int mul ( int a , int b ) { if ( a < b ) return mul ( b , a ) ; int sum = 0 ; for ( int i = abs ( b ) ; i > 0 ; i -- ) sum += a ; if ( b < 0 ) sum = flipSign ( sum ) ; return sum ; } int division ( int a , int b ) { if ( b == 0 ) throw ( b ) ; int quotient = 0 , dividend ; int divisor = flipSign ( abs ( b ) ) ; for ( dividend = abs ( a ) ; dividend >= abs ( divisor ) ; dividend += divisor ) quotient ++ ; if ( areDifferentSign ( a , b ) ) quotient = flipSign ( quotient ) ; return quotient ; } int main ( ) { cout << " Subtraction ▁ is ▁ " << sub ( 4 , -2 ) << endl ; cout << " Product ▁ is ▁ " << mul ( -9 , 6 ) << endl ; try { cout << " Division ▁ is ▁ " << division ( 8 , 2 ) ; } catch ( int k ) { cout << " ▁ Exception ▁ : - ▁ Divide ▁ by ▁ 0" ; } return 0 ; }

Accumulator variables: a, dividend, i, neg, quotient, stdc, sum
Iterator variables: dividend, i
C++ program:
#include <iostream>
using namespace std ; int numOfCombinations ( int arr [ ] , int N ) { int C [ 3 ] = { 0 , 0 , 0 } ; for ( int i = 0 ; i < N ; ++ i ) ++ C [ arr [ i ] % 3 ] ; return C [ 1 ] * C [ 2 ] + C [ 0 ] * ( C [ 0 ] - 1 ) / 2 + C [ 0 ] * ( C [ 0 ] - 1 ) * ( C [ 0 ] - 2 ) / 6 + C [ 1 ] * ( C [ 1 ] - 1 ) * ( C [ 1 ] - 2 ) / 6 + C [ 2 ] * ( C [ 2 ] - 1 ) * ( C [ 2 ] - 2 ) / 6 + C [ 0 ] * C [ 1 ] * C [ 2 ] ; } int main ( ) { int arr1 [ 6 ] = { 1 , 5 , 7 , 2 , 9 , 14 } ; cout << numOfCombinations ( arr1 , 6 ) << " STRNEWLINE " ; int arr2 [ 4 ] = { 3 , 6 , 9 , 12 } ; cout << numOfCombinations ( arr2 , 4 ) << " STRNEWLINE " ; return 0 ; }

Index/key variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int FindLCM ( int a , int b ) { return ( a * b ) / __gcd ( a , b ) ; } int rangeDivisor ( int m , int n , int a , int b ) { int lcm = FindLCM ( a , b ) ; int a_divisor = n / a - ( m - 1 ) / a ; int b_divisor = n / b - ( m - 1 ) / b ; int common_divisor = n / lcm - ( m - 1 ) / lcm ; int ans = a_divisor + b_divisor - common_divisor ; return ans ; } int main ( ) { int m = 3 , n = 11 , a = 2 , b = 3 ; cout << rangeDivisor ( m , n , a , b ) << endl ; m = 11 , n = 1000000 , a = 6 , b = 35 ; cout << rangeDivisor ( m , n , a , b ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printUnique ( int l , int r ) { for ( int i = l ; i <= r ; i ++ ) { int num = i ; bool visited [ 10 ] = { false } ; while ( num ) { if ( visited [ num % 10 ] ) break ; visited [ num % 10 ] = true ; num = num / 10 ; } if ( num == 0 ) cout << i << " ▁ " ; } } int main ( ) { int l = 1 , r = 20 ; printUnique ( l , r ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findMinZero ( int p ) { int first = 1 , second = 1 , number = 2 , next = 1 ; while ( next ) { next = ( first + second ) % p ; first = second ; second = next ; number ++ ; } return number ; } int main ( ) { int p = 7 ; cout << " Minimal ▁ zero ▁ is : ▁ " << findMinZero ( p ) << endl ; return 0 ; }

Accumulator variables: number, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printCubes ( int a , int b ) { for ( int i = a ; i <= b ; i ++ ) { for ( int j = 1 ; j * j * j <= i ; j ++ ) { if ( j * j * j == i ) { cout << j * j * j << " ▁ " ; break ; } } } } int main ( ) { int a = 1 , b = 100 ; cout << " Perfect ▁ cubes ▁ in ▁ given ▁ range : STRNEWLINE ▁ " ; printCubes ( a , b ) ; return 0 ; }

Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <iostream>
#include <string>
using namespace std ; string toBinary ( double n ) { if ( n >= 1 n <= 0 ) return " ERROR " ; string answer ; double frac = 0.5 ; answer . append ( " . " ) ; while ( n > 0 ) { if ( answer . length ( ) >= 32 ) return " ERROR " ; if ( n >= frac ) { answer . append ( "1" ) ; n = n - frac ; } else { answer . append ( "0" ) ; } frac /= 2 ; } return answer ; } int main ( ) { double n = 0.625 ; string result = toBinary ( n ) ; cout << " ( 0" << result << " ) ▁ in ▁ base ▁ 2" << endl ; double m = 0.72 ; result = toBinary ( m ) ; cout << " ( " << result << " ) " << endl ; }

Accumulator variables: frac
C++ program:
#include <bits/stdc++.h>
using namespace std ; unsigned long long firstkdigits ( int n , int k ) { unsigned long long product = 1 ; for ( int i = 0 ; i < n ; i ++ ) product *= n ; while ( ( int ) ( product / pow ( 10 , k ) ) != 0 ) product = product / 10 ; return product ; } int main ( ) { int n = 15 ; int k = 4 ; cout << firstkdigits ( n , k ) ; return 0 ; }

Accumulator variables: i, product, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int check ( string str ) { int n = str . length ( ) ; int digitSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) digitSum += ( str [ i ] - '0' ) ; return ( digitSum % 9 == 0 ) ; } int main ( ) { string str = "99333" ; check ( str ) ? cout << " Yes " : cout << " No ▁ " ; return 0 ; }

Index/key variables: i
Accumulator variables: digitSum, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getTotalXorOfSubarrayXors ( int arr [ ] , int N ) { int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) for ( int j = i ; j < N ; j ++ ) for ( int k = i ; k <= j ; k ++ ) res = res ^ arr [ k ] ; return res ; } int main ( ) { int arr [ ] = { 3 , 5 , 2 , 4 , 6 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << getTotalXorOfSubarrayXors ( arr , N ) ; return 0 ; }

Index/key variables: k
Accumulator variables: i, j, k, stdc
Iterator variables: i, j, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getTotalXorOfSubarrayXors ( int arr [ ] , int N ) { int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int freq = ( i + 1 ) * ( N - i ) ; if ( freq % 2 == 1 ) res = res ^ arr [ i ] ; } return res ; } int main ( ) { int arr [ ] = { 3 , 5 , 2 , 4 , 6 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << getTotalXorOfSubarrayXors ( 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 gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } int findGCD ( int arr [ ] , int n ) { int result = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { result = gcd ( arr [ i ] , result ) ; if ( result == 1 ) { return 1 ; } } return result ; } int main ( ) { int arr [ ] = { 2 , 4 , 6 , 8 , 16 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << findGCD ( arr , n ) << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int GcdOfArray ( vector < int > & arr , int idx ) { if ( idx == arr . size ( ) - 1 ) { return arr [ idx ] ; } int a = arr [ idx ] ; int b = GcdOfArray ( arr , idx + 1 ) ; return __gcd ( a , b ) ; } int main ( ) { vector < int > arr = { 1 , 2 , 3 } ; cout << GcdOfArray ( arr , 0 ) << " STRNEWLINE " ; arr = { 2 , 4 , 6 , 8 } ; cout << GcdOfArray ( arr , 0 ) << " STRNEWLINE " ; return 0 ; }

Index/key variables: idx
Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int divSum ( int num ) { int result = 0 ; for ( int i = 1 ; i * i <= num ; ++ i ) { if ( num % i == 0 ) { if ( i == ( num / i ) ) result += i ; else result += ( i + num / i ) ; } } return result ; } bool isSuperPerfect ( int n ) { int n1 = divSum ( n ) ; return ( 2 * n == divSum ( n1 ) ) ; } int main ( ) { int n = 16 ; cout << ( isSuperPerfect ( n ) ? " Yes STRNEWLINE " : " No STRNEWLINE " ) ; n = 6 ; cout << ( isSuperPerfect ( n ) ? " Yes STRNEWLINE " : " No STRNEWLINE " ) ; return 0 ; }

Accumulator variables: result, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
bool isRefactorableNumber ( int n ) { int divCount = 0 ; for ( int i = 1 ; i <= sqrt ( n ) ; ++ i ) { if ( n % i == 0 ) { if ( n / i == i ) ++ divCount ; else divCount += 2 ; } } return n % divCount == 0 ; } int main ( ) { int n = 8 ; if ( isRefactorableNumber ( n ) ) puts ( " yes " ) ; else puts ( " no " ) ; n = 14 ; if ( isRefactorableNumber ( n ) ) puts ( " yes " ) ; else puts ( " no " ) ; return 0 ; }

Accumulator variables: divCount, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPerfectSquare ( int n ) { int sq = ( int ) sqrt ( n ) ; return ( n == sq * sq ) ; } int countPerfectDivisors ( int n ) { int count = 0 ; for ( int i = 1 ; i * i <= n ; ++ i ) { if ( n % i == 0 ) { if ( isPerfectSquare ( i ) ) ++ count ; if ( n / i != i && isPerfectSquare ( n / i ) ) ++ count ; } } return count ; } int main ( ) { int n = 16 ; cout << " Total ▁ perfect ▁ divisors ▁ of ▁ " << n << " ▁ = ▁ " << countPerfectDivisors ( n ) << " STRNEWLINE " ; n = 12 ; cout << " Total ▁ perfect ▁ divisors ▁ of ▁ " << n << " ▁ = ▁ " << countPerfectDivisors ( n ) ; return 0 ; }

Accumulator variables: stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void nearestGcd ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; ++ i ) { int closest = -1 ; for ( int j = i - 1 , k = i + 1 ; j > 0 k <= n ; -- j , ++ k ) { if ( j >= 0 && __gcd ( arr [ i ] , arr [ j ] ) > 1 ) { closest = j + 1 ; break ; } if ( k < n && __gcd ( arr [ i ] , arr [ k ] ) > 1 ) { closest = k + 1 ; break ; } } cout << closest << " ▁ " ; } } int main ( ) { int arr [ ] = { 2 , 9 , 4 , 3 , 13 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; nearestGcd ( arr , n ) ; return 0 ; }

Index/key variables: i, j, k
Accumulator variables: stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  100001
int prime [ MAX ] , countdiv [ MAX ] ; void SieveOfEratosthenes ( ) { for ( int i = 2 ; i * i <= MAX ; ++ i ) { if ( ! prime [ i ] ) for ( int j = i * 2 ; j <= MAX ; j += i ) prime [ j ] = i ; } for ( int i = 1 ; i < MAX ; ++ i ) if ( ! prime [ i ] ) prime [ i ] = i ; } int largestGCDSubsequence ( int arr [ ] , int n ) { int ans = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int element = arr [ i ] ; while ( element > 1 ) { int div = prime [ element ] ; ++ countdiv [ div ] ; ans = max ( ans , countdiv [ div ] ) ; while ( element % div == 0 ) element /= div ; } } return ans ; } int main ( ) { SieveOfEratosthenes ( ) ; int arr [ ] = { 10 , 15 , 7 , 25 , 9 , 35 } ; int size = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << largestGCDSubsequence ( arr , size ) ; return 0 ; }

Index/key variables: MAX, div, element, i, j
Accumulator variables: element, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countOfBinaryNumberLessThanN ( int N ) { queue < int > q ; q . push ( 1 ) ; int cnt = 0 ; int t ; while ( ! q . empty ( ) ) { t = q . front ( ) ; q . pop ( ) ; if ( t <= N ) { cnt ++ ; q . push ( t * 10 ) ; q . push ( t * 10 + 1 ) ; } } return cnt ; } int main ( ) { int N = 200 ; cout << countOfBinaryNumberLessThanN ( N ) ; return 0 ; }

Accumulator variables: cnt, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sumofproduct ( int n ) { int ans = 0 ; for ( int x = 1 ; x <= n ; x ++ ) { int y = n / x ; ans += ( y * x ) ; } return ans ; } int main ( ) { int n = 10 ; cout << sumofproduct ( n ) << endl ; return 0 ; }

Accumulator variables: ans, stdc, x
Iterator variables: x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int per ( int n ) { int a = 3 , b = 0 , c = 2 , i ; int m ; if ( n == 0 ) return a ; if ( n == 1 ) return b ; if ( n == 2 ) return c ; while ( n > 2 ) { m = a + b ; a = b ; b = c ; c = m ; n -- ; } return m ; } int main ( ) { int n = 9 ; cout << per ( n ) ; return 0 ; }

Accumulator variables: n, stdc
C++ program:
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using boost :: multiprecision :: cpp_int ; using namespace std ; cpp_int fact ( int n ) { cpp_int num = 1 ; for ( int i = 1 ; i <= n ; i ++ ) num = num * i ; return num ; } int Special_Factorial_Number ( int k ) { for ( int i = 1 ; i <= k ; i ++ ) { if ( ( fact ( i ) % k ) == 0 ) { return i ; } } } int main ( ) { int k = 16 ; cout << Special_Factorial_Number ( k ) ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int gcd ( int i , int j ) { if ( i == j ) return i ; if ( i > j ) return gcd ( i - j , j ) ; return gcd ( i , j - i ) ; } bool ispossible ( int x , int y , int a , int b ) { x = abs ( x ) , y = abs ( y ) , a = abs ( a ) , b = abs ( b ) ; return ( gcd ( x , y ) == gcd ( a , b ) ) ; } int main ( ) { int x = 35 , y = 15 ; int a = 20 , b = 25 ; ( ispossible ( x , y , a , b ) ) ? ( cout << " Yes " ) : ( cout << " No " ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MAX = 10000 ; vector < int > primes ; void sieveSundaram ( ) { bool marked [ MAX / 2 + 1 ] = { 0 } ; for ( int i = 1 ; i <= ( sqrt ( MAX ) - 1 ) / 2 ; i ++ ) for ( int j = ( i * ( i + 1 ) ) << 1 ; j <= MAX / 2 ; j = j + 2 * i + 1 ) marked [ j ] = true ; primes . push_back ( 2 ) ; for ( int i = 1 ; i <= MAX / 2 ; i ++ ) if ( marked [ i ] == false ) primes . push_back ( 2 * i + 1 ) ; } bool isEquidigital ( int n ) { if ( n == 1 ) return true ; int original_no = n ; int sumDigits = 0 ; while ( original_no > 0 ) { sumDigits ++ ; original_no = original_no / 10 ; } int pDigit = 0 , count_exp = 0 , p ; for ( int i = 0 ; primes [ i ] <= n / 2 ; i ++ ) { while ( n % primes [ i ] == 0 ) { p = primes [ i ] ; n = n / p ; count_exp ++ ; } while ( p > 0 ) { pDigit ++ ; p = p / 10 ; } while ( count_exp > 1 ) { pDigit ++ ; count_exp = count_exp / 10 ; } } if ( n != 1 ) { while ( n > 0 ) { pDigit ++ ; n = n / 10 ; } } return ( pDigit == sumDigits ) ; } int main ( ) { sieveSundaram ( ) ; cout << " Printing ▁ first ▁ few ▁ Equidigital ▁ Numbers " " ▁ using ▁ isEquidigital ( ) STRNEWLINE " ; for ( int i = 1 ; i < 20 ; i ++ ) if ( isEquidigital ( i ) ) cout << i << " ▁ " ; return 0 ; }

Index/key variables: i, j
Accumulator variables: count_exp, i, pDigit, stdc, sumDigits
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getMaximumSumWithLCMN ( int N ) { int sum = 0 ; int LIM = sqrt ( N ) ; for ( int i = 1 ; i <= LIM ; i ++ ) { if ( N % i == 0 ) { if ( i == ( N / i ) ) sum += i ; else sum += ( i + N / i ) ; } } return sum ; } int main ( ) { int N = 12 ; cout << getMaximumSumWithLCMN ( N ) << endl ; return 0 ; }

Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int hcf ( int a , int b ) { if ( b == 0 ) return a ; return hcf ( b , a % b ) ; } int findlcm ( int a , int b ) { if ( b == 1 ) return a ; a = ( a * b ) / hcf ( a , b ) ; b -= 1 ; return findlcm ( a , b ) ; } int main ( ) { int n = 7 ; if ( n < 3 ) cout << n ; else cout << findlcm ( n , n - 1 ) ; return 0 ; }

Accumulator variables: b, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; long long lcm ( long long n ) { long long ans = 1 ; for ( long long i = 1 ; i <= n ; i ++ ) ans = ( ans * i ) / ( __gcd ( ans , i ) ) ; return ans ; } int main ( ) { long long n = 20 ; cout << lcm ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <stdio.h>
float y ( float x ) { return 1 / ( 1 + x * x ) ; } float trapezoidal ( float a , float b , float n ) { float h = ( b - a ) / n ; float s = y ( a ) + y ( b ) ; for ( int i = 1 ; i < n ; i ++ ) s += 2 * y ( a + i * h ) ; return ( h / 2 ) * s ; } int main ( ) { float x0 = 0 ; float xn = 1 ; int n = 6 ; printf ( " Value ▁ of ▁ integral ▁ is ▁ % 6.4f STRNEWLINE " , trapezoidal ( x0 , xn , n ) ) ; return 0 ; }

Accumulator variables: i, s
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; int maxProd ( int n ) { if ( n == 2 n == 3 ) return ( n - 1 ) ; int res = 1 ; while ( n > 4 ) { n -= 3 ; res *= 3 ; } return ( n * res ) ; } int main ( ) { cout << " Maximum ▁ Product ▁ is ▁ " << maxProd ( 45 ) ; return 0 ; }

Accumulator variables: n, res
C++ program:
#include <bits/stdc++.h>
using namespace std ; long long numberOfDigits ( long long n ) { if ( n == 1 ) return 1 ; long double d = ( n * log10 ( 1.6180339887498948 ) ) - ( ( log10 ( 5 ) ) / 2 ) ; return ceil ( d ) ; } int main ( ) { long long i ; for ( i = 1 ; i <= 10 ; i ++ ) cout << " Number ▁ of ▁ Digits ▁ in ▁ F ( " << i << " ) ▁ - ▁ " << numberOfDigits ( i ) << " STRNEWLINE " ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countOddSquares ( int n , int m ) { return ( int ) pow ( m , 0.5 ) - ( int ) pow ( n - 1 , 0.5 ) ; } int main ( ) { int n = 5 , m = 100 ; cout << " Count ▁ is ▁ " << countOddSquares ( n , m ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; typedef long long int ll ; void boomNumber ( ll k ) { queue < string > q ; q . push ( " " ) ; ll count = 0 ; while ( count <= k ) { string s1 = q . front ( ) ; q . pop ( ) ; string s2 = s1 ; q . push ( s1 . append ( "2" ) ) ; count ++ ; if ( count == k ) { cout << s1 << endl ; break ; } q . push ( s2 . append ( "3" ) ) ; count ++ ; if ( count == k ) { cout << s2 << endl ; break ; } } return ; } int main ( ) { ll k = 1000000 ; boomNumber ( k ) ; return 0 ; }

Accumulator variables: count, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool factors ( int n , int k ) { vector < int > v ; while ( n % 2 == 0 ) { v . push_back ( 2 ) ; n /= 2 ; } if ( v . size ( ) >= k ) return true ; for ( int i = 3 ; i * i <= n ; i += 2 ) { while ( n % i == 0 ) { n = n / i ; v . push_back ( i ) ; } if ( v . size ( ) >= k ) return true ; } if ( n > 2 ) v . push_back ( n ) ; if ( v . size ( ) >= k ) return true ; return false ; } void operation ( int n , int k ) { bool answered = false ; if ( n < k ) { answered = true ; cout << " No " << " STRNEWLINE " ; } bool ok = factors ( n , k ) ; if ( ! ok && ! answered ) { answered = true ; cout << " No " << " STRNEWLINE " ; } if ( ok && ! answered ) cout << " Yes " << " STRNEWLINE " ; } int main ( ) { int n = 4 ; int k = 2 ; operation ( n , k ) ; return 0 ; }

Accumulator variables: i, n, stdc
Iterator variables: i
Boolean variables: answered
C++ program:
#include <bits/stdc++.h>
using namespace std ; string generateOTP ( int len ) { string str = " abcdefghijklmnopqrstuvwxyzABCD " " EFGHIJKLMNOPQRSTUVWXYZ0123456789" ; int n = str . length ( ) ; string OTP ; for ( int i = 1 ; i <= len ; i ++ ) OTP . push_back ( str [ rand ( ) % n ] ) ; return ( OTP ) ; } int main ( ) { srand ( time ( NULL ) ) ; int len = 6 ; printf ( " Your ▁ OTP ▁ is ▁ - ▁ % s " , generateOTP ( len ) . c_str ( ) ) ; return ( 0 ) ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; typedef long long int ll ; void sieve ( int n , bool prime [ ] ) { for ( int i = 1 ; i <= n ; i ++ ) prime [ i ] = 1 ; prime [ 1 ] = 0 ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( prime [ i ] ) { for ( int j = i * i ; j <= n ; j += i ) prime [ j ] = 0 ; } } } int expFactor ( int n , int p ) { int x = p ; int exponent = 0 ; while ( ( n / x ) > 0 ) { exponent += n / x ; x *= p ; } return exponent ; } ll countFactors ( int n ) { ll ans = 1 ; bool prime [ n + 1 ] ; sieve ( n , prime ) ; for ( int p = 1 ; p <= n ; p ++ ) { if ( prime [ p ] == 1 ) ans *= ( expFactor ( n , p ) + 1 ) ; } return ans ; } int main ( ) { int n = 16 ; printf ( " Count ▁ of ▁ factors ▁ of ▁ % d ! ▁ is ▁ % lld STRNEWLINE " , n , countFactors ( n ) ) ; return 0 ; }

Index/key variables: i, j, p
Accumulator variables: ans, exponent, i, j, p, stdc, x
Iterator variables: i, j, p