dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long
const int MAX = 100001 ; vector < ll > p ; void sieve ( ) { ll isPrime [ MAX + 1 ] ; for ( ll i = 2 ; i <= MAX ; i ++ ) { if ( isPrime [ i ] == 0 ) { p . push_back ( i ) ; for ( ll j = 2 ; i * j <= MAX ; j ++ ) isPrime [ i * j ] = 1 ; } } } ll phi ( ll n ) { ll res = n ; for ( ll i = 0 ; p [ i ] * p [ i ] <= n ; i ++ ) { if ( n % p [ i ] == 0 ) { res -= ( res / p [ i ] ) ; while ( n % p [ i ] == 0 ) n /= p [ i ] ; } } if ( n > 1 ) res -= ( res / n ) ; return res ; } int main ( ) { sieve ( ) ; cout << phi ( 11 ) << " STRNEWLINE " ; cout << phi ( 21 ) << " STRNEWLINE " ; cout << phi ( 31 ) << " STRNEWLINE " ; cout << phi ( 41 ) << " STRNEWLINE " ; cout << phi ( 51 ) << " STRNEWLINE " ; cout << phi ( 61 ) << " STRNEWLINE " ; cout << phi ( 91 ) << " STRNEWLINE " ; cout << phi ( 101 ) << " STRNEWLINE " ; return 0 ; }

Index/key variables: i
Accumulator variables: i, j, n, res, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void nthprimedigitsnumber ( long long n ) { long long len = 1 ; long long prev_count = 0 ; while ( true ) { long long curr_count = prev_count + pow ( 4 , len ) ; if ( prev_count < n && curr_count >= n ) break ; len ++ ; prev_count = curr_count ; } for ( int i = 1 ; i <= len ; i ++ ) { for ( long long j = 1 ; j <= 4 ; j ++ ) { if ( prev_count + pow ( 4 , len - i ) < n ) prev_count += pow ( 4 , len - i ) ; else { if ( j == 1 ) cout << "2" ; else if ( j == 2 ) cout << "3" ; else if ( j == 3 ) cout << "5" ; else if ( j == 4 ) cout << "7" ; break ; } } } cout << endl ; } int main ( ) { nthprimedigitsnumber ( 10 ) ; nthprimedigitsnumber ( 21 ) ; return 0 ; }

Accumulator variables: i, j, len, prev_count, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int cassini ( int n ) { return ( n & 1 ) ? -1 : 1 ; } int main ( ) { int n = 5 ; cout << cassini ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool findNoIsDivisibleOrNot ( int a [ ] , int n , int l ) { for ( int i = 0 ; i < l ; i ++ ) { if ( a [ i ] % n != 0 ) return false ; } return true ; } int main ( ) { int a [ ] = { 14 , 12 , 4 , 18 } ; int n = 2 ; int l = ( sizeof ( a ) / sizeof ( a [ 0 ] ) ) ; if ( findNoIsDivisibleOrNot ( a , n , l ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int factorial ( int n ) { if ( n == 0 ) return 1 ; return n * factorial ( n - 1 ) ; } int printRange ( int n ) { int a = factorial ( n + 2 ) + 2 ; int b = a + n - 1 ; cout << " [ " << a << " , ▁ " << b << " ] " ; return 0 ; } int main ( ) { int n = 3 ; printRange ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
#define ll  long long
#define ld  long double
using namespace std ; ll findMinValue ( ll arr [ ] , ll n ) { sort ( arr , arr + n ) ; for ( int i = 0 ; i < n ; i ++ ) val += ( ld ) ( log ( ( ld ) ( arr [ i ] ) ) ) ; ll left = arr [ 0 ] , right = arr [ n - 1 ] + 1 ; ll ans ; while ( left <= right ) { ll mid = ( left + right ) / 2 ; ld temp = ( ld ) n * ( ld ) ( log ( ( ld ) ( mid ) ) ) ; if ( val < temp ) { ans = mid ; right = mid - 1 ; } else left = mid + 1 ; } return ans ; } int main ( ) { ll arr [ ] = { 4 , 2 , 1 , 10 , 6 } ; ll n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << findMinValue ( arr , n ) << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, val
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sumOfTermsInNthRow ( int n ) { int sum = n * ( 2 * pow ( n , 2 ) + 1 ) ; return sum ; } int main ( ) { int n = 4 ; cout << " Sum ▁ of ▁ all ▁ the ▁ terms ▁ in ▁ nth ▁ row ▁ = ▁ " << sumOfTermsInNthRow ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int firstDigit ( int x ) { while ( x >= 10 ) x = x / 10 ; return x ; } int main ( ) { cout << firstDigit ( 12345 ) << endl ; cout << firstDigit ( 5432 ) << endl ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getOccurence ( int n , int d ) { int itr = d ; while ( itr <= n ) { if ( itr % 10 == d ) result ++ ; if ( itr != 0 && itr / 10 == d ) { result ++ ; itr ++ ; } else if ( itr / 10 == d - 1 ) itr = itr + ( 10 - d ) ; else itr = itr + 10 ; } return result ; } int main ( void ) { int n = 11 , d = 1 ; cout << getOccurence ( n , d ) ; return 0 ; }

Accumulator variables: itr, result, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printUnique ( int l , int r ) { for ( int i = l ; i <= r ; i ++ ) { string s = to_string ( i ) ; set < int > uniDigits ( s . begin ( ) , s . end ( ) ) ; if ( s . size ( ) == uniDigits . size ( ) ) { 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 ; void multiply ( vector < int > & v , int x ) { int carry = 0 , res ; int size = v . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { int res = carry + v [ i ] * x ; v [ i ] = res % 10 ; carry = res / 10 ; } while ( carry != 0 ) { v . push_back ( carry % 10 ) ; carry /= 10 ; } } int findSumOfDigits ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) multiply ( v , i ) ; int sum = 0 ; int size = v . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) sum += v [ i ] ; return sum ; } int main ( ) { int n = 1000 ; cout << findSumOfDigits ( n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: carry, i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printOtherSides ( int n ) { if ( n & 1 ) { if ( n == 1 ) cout << -1 << endl ; else { int b = ( n * n - 1 ) / 2 ; int c = ( n * n + 1 ) / 2 ; cout << " b ▁ = ▁ " << b << " , ▁ c ▁ = ▁ " << c << endl ; } } else { if ( n == 2 ) cout << -1 << endl ; else { int b = n * n / 4 - 1 ; int c = n * n / 4 + 1 ; cout << " b ▁ = ▁ " << b << " , ▁ c ▁ = ▁ " << c << endl ; } } } int main ( ) { int a = 3 ; printOtherSides ( a ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
using namespace std ; int makeOdd ( int n ) { if ( n % 2 != 0 ) return 1 ; for ( int i = 2 ; i <= n ; i ++ ) if ( ( n % i == 0 ) && ( ( n / i ) % 2 == 1 ) ) return i ; } int main ( ) { int n = 36 ; cout << makeOdd ( n ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getTotalXorOfSubarrayXors ( int arr [ ] , int N ) { if ( N % 2 == 0 ) return 0 ; int res = 0 ; for ( int i = 0 ; i < N ; i += 2 ) 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, res, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countIterations ( int arr [ ] , int n ) { bool oneFound = false ; int res = 0 ; for ( int i = 0 ; i < n ; ) { if ( arr [ i ] == 1 ) oneFound = true ; while ( i < n && arr [ i ] == 1 ) i ++ ; int count_zero = 0 ; while ( i < n && arr [ i ] == 0 ) { count_zero ++ ; i ++ ; } if ( oneFound == false && i == n ) return -1 ; int curr_count ; if ( i < n && oneFound == true ) { if ( count_zero & 1 == 0 ) curr_count = count_zero / 2 ; else curr_count = ( count_zero + 1 ) / 2 ; count_zero = 0 ; } else { curr_count = count_zero ; count_zero = 0 ; } res = max ( res , curr_count ) ; } return res ; } int main ( ) { int arr [ ] = { 0 , 1 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << countIterations ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count_zero, i, stdc
Iterator variables: i
Boolean variables: oneFound
C++ program:
#include <iostream>
using namespace std ; #define MAX  100
int main ( ) { long long int arr [ MAX ] ; arr [ 0 ] = 0 ; arr [ 1 ] = 1 ; for ( int i = 2 ; i < MAX ; i ++ ) arr [ i ] = arr [ i - 1 ] + arr [ i - 2 ] ; cout << " Fibonacci ▁ numbers ▁ divisible ▁ by ▁ " " their ▁ indexes ▁ are ▁ : STRNEWLINE " ; for ( int i = 1 ; i < MAX ; i ++ ) if ( arr [ i ] % i == 0 ) cout << " ▁ " << i ; }

Index/key variables: MAX, i
Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printConsecutive ( int last , int first ) { cout << first ++ ; for ( int x = first ; x <= last ; x ++ ) cout << " ▁ + ▁ " << x ; } void findConsecutive ( int N ) { for ( int last = 1 ; last < N ; last ++ ) { for ( int first = 0 ; first < last ; first ++ ) { if ( 2 * N == ( last - first ) * ( last + first + 1 ) ) { cout << N << " ▁ = ▁ " ; printConsecutive ( last , first + 1 ) ; return ; } } } cout << " - 1" ; } int main ( ) { int n = 12 ; findConsecutive ( n ) ; return 0 ; }

Accumulator variables: first, last, stdc, x
Iterator variables: first, last, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int printNthElement ( int n ) { int arr [ n + 1 ] ; arr [ 1 ] = 4 ; arr [ 2 ] = 7 ; for ( int i = 3 ; i <= n ; i ++ ) { if ( i % 2 != 0 ) arr [ i ] = arr [ i / 2 ] * 10 + 4 ; else arr [ i ] = arr [ ( i / 2 ) - 1 ] * 10 + 7 ; } return arr [ n ] ; } int main ( ) { int n = 6 ; cout << printNthElement ( n ) ; return 0 ; }

Index/key variables: i, n
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maxSumLCM ( int n ) { for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { max_sum += i ; if ( n / i != i ) max_sum += ( n / i ) ; } } return max_sum ; } int main ( ) { int n = 2 ; cout << MaxSumLCM ( n ) << endl ; return 0 ; }

Accumulator variables: i, max_sum, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
int main ( void ) { double n = 12 ; printf ( " % lf ▁ " , sqrt ( n ) ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
using namespace std ; bool func ( int a [ ] , int k , int n ) { for ( int i = 0 ; i < n ; i ++ ) if ( a [ i ] % k == 0 ) return true ; return false ; } int main ( ) { int a [ ] = { 14 , 27 , 38 , 76 , 84 } ; int k = 19 ; bool res = func ( a , k , 5 ) ; if ( res ) cout << " true " ; else cout << " false " ; return 0 ; }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; char * tidyNum ( char str [ ] , int len ) { for ( int i = len - 2 ; i >= 0 ; i -- ) { if ( str [ i ] > str [ i + 1 ] ) { ( char ) str [ i ] -- ; for ( int j = i + 1 ; j < len ; j ++ ) str [ j ] = '9' ; } } return str ; } int main ( ) { char str [ ] = "11333445538" ; int len = strlen ( str ) ; char * num = tidyNum ( str , len ) ; printf ( " % s STRNEWLINE " , num ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void createMap ( unordered_map < string , char > * um ) { ( * um ) [ "0000" ] = '0' ; ( * um ) [ "0001" ] = '1' ; ( * um ) [ "0010" ] = '2' ; ( * um ) [ "0011" ] = '3' ; ( * um ) [ "0100" ] = '4' ; ( * um ) [ "0101" ] = '5' ; ( * um ) [ "0110" ] = '6' ; ( * um ) [ "0111" ] = '7' ; ( * um ) [ "1000" ] = '8' ; ( * um ) [ "1001" ] = '9' ; ( * um ) [ "1010" ] = ' A ' ; ( * um ) [ "1011" ] = ' B ' ; ( * um ) [ "1100" ] = ' C ' ; ( * um ) [ "1101" ] = ' D ' ; ( * um ) [ "1110" ] = ' E ' ; ( * um ) [ "1111" ] = ' F ' ; } string convertBinToHex ( string bin ) { int l = bin . size ( ) ; int t = bin . find_first_of ( ' . ' ) ; int len_left = t != -1 ? t : l ; for ( int i = 1 ; i <= ( 4 - len_left % 4 ) % 4 ; i ++ ) bin = '0' + bin ; if ( t != -1 ) { int len_right = l - len_left - 1 ; for ( int i = 1 ; i <= ( 4 - len_right % 4 ) % 4 ; i ++ ) bin = bin + '0' ; } unordered_map < string , char > bin_hex_map ; createMap ( & bin_hex_map ) ; int i = 0 ; string hex = " " ; while ( 1 ) { hex += bin_hex_map [ bin . substr ( i , 4 ) ] ; i += 4 ; if ( i == bin . size ( ) ) break ; if ( bin . at ( i ) == ' . ' ) { hex += ' . ' ; i ++ ; } } return hex ; } int main ( ) { string bin = "1111001010010100001.010110110011011" ; cout << " Hexadecimal ▁ number ▁ = ▁ " << convertBinToHex ( bin ) ; return 0 ; }

Accumulator variables: hex, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findCount ( int m , int n ) { int num1 = 0 ; for ( int i = 0 ; i < m ; i ++ ) num1 = ( num1 * 10 ) + 9 ; int num2 = 0 ; for ( int i = 0 ; i < ( m - 1 ) ; i ++ ) num2 = ( num2 * 10 ) + 9 ; return ( ( num1 / n ) - ( num2 / n ) ) ; } int main ( ) { int m = 2 , n = 6 ; printf ( " % d STRNEWLINE " , findCount ( m , n ) ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findNthEvenDigitNumber ( int n ) { int count = 0 ; for ( int i = 0 ; ; i ++ ) { int curr = i ; bool isCurrEvenDigit = true ; while ( curr != 0 ) { if ( curr % 10 == 1 curr % 10 == 3 curr % 10 == 5 curr % 10 == 7 curr % 10 == 9 ) isCurrEvenDigit = false ; curr = curr / 10 ; } if ( isCurrEvenDigit == true ) count ++ ; if ( count == n ) return i ; } } int main ( ) { cout << findNthEvenDigitNumber ( 2 ) << endl ; cout << findNthEvenDigitNumber ( 10 ) << endl ; return 0 ; }

Accumulator variables: count, i, stdc
Iterator variables: i
Boolean variables: isCurrEvenDigit
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findNthEvenDigitNumber ( int n ) { if ( n == 1 ) return 0 ; vector < int > v ; n = n - 1 ; while ( n > 0 ) { v . push_back ( n % 5 ) ; n = n / 5 ; } int result = 0 ; for ( int i = v . size ( ) - 1 ; i >= 0 ; i -- ) { result = result * 10 ; result = result + v [ i ] ; } return 2 * result ; } int main ( ) { cout << findNthEvenDigitNumber ( 2 ) << endl ; cout << findNthEvenDigitNumber ( 10 ) << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isDivisibleBy25 ( string str ) { int n = str . length ( ) ; if ( n == 1 ) return false ; return ( ( str [ n - 1 ] - '0' == 0 && str [ n - 2 ] - '0' == 0 ) || ( ( str [ n - 2 ] - '0' ) * 10 + ( str [ n - 1 ] - '0' ) ) % 25 == 0 ) ; } int main ( ) { string str = "76955" ; isDivisibleBy25 ( str ) ? cout << " Yes " : cout << " No ▁ " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool check ( string str ) { int n = str . length ( ) ; if ( n == 0 && n == 1 ) return false ; if ( n == 2 ) return ( ( ( str [ n - 2 ] - '0' ) * 10 + ( str [ n - 1 ] - '0' ) ) % 16 == 0 ) ; if ( n == 3 ) return ( ( ( str [ n - 3 ] - '0' ) * 100 + ( str [ n - 2 ] - '0' ) * 10 + ( str [ n - 1 ] - '0' ) ) % 16 == 0 ) ; int last = str [ n - 1 ] - '0' ; int second_last = str [ n - 2 ] - '0' ; int third_last = str [ n - 3 ] - '0' ; int fourth_last = str [ n - 4 ] - '0' ; return ( ( fourth_last * 1000 + third_last * 100 + second_last * 10 + last ) % 16 == 0 ) ; } int main ( ) { string str = "769528" ; check ( str ) ? cout << " Yes " : cout << " No ▁ " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
int findIndex ( int n ) { if ( n <= 1 ) return n ; int a = 0 , b = 1 , c = 1 ; int res = 1 ; while ( c < n ) { c = a + b ; res ++ ; a = b ; b = c ; } return res ; } int main ( ) { int result = findIndex ( 21 ) ; printf ( " % d STRNEWLINE " , result ) ; }

Accumulator variables: res, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isLeap ( int y ) { if ( y % 100 != 0 && y % 4 == 0 y % 400 == 0 ) return true ; return false ; } int offsetDays ( int d , int m , int y ) { int offset = d ; switch ( m - 1 ) { case 11 : offset += 30 ; case 10 : offset += 31 ; case 9 : offset += 30 ; case 8 : offset += 31 ; case 7 : offset += 31 ; case 6 : offset += 30 ; case 5 : offset += 31 ; case 4 : offset += 30 ; case 3 : offset += 31 ; case 2 : offset += 28 ; case 1 : offset += 31 ; } if ( isLeap ( y ) && m > 2 ) offset += 1 ; return offset ; } void revoffsetDays ( int offset , int y , int * d , int * m ) { int month [ 13 ] = { 0 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; if ( isLeap ( y ) ) month [ 2 ] = 29 ; int i ; for ( i = 1 ; i <= 12 ; i ++ ) { if ( offset <= month [ i ] ) break ; offset = offset - month [ i ] ; } * d = offset ; * m = i ; } void addDays ( int d1 , int m1 , int y1 , int x ) { int offset1 = offsetDays ( d1 , m1 , y1 ) ; int remDays = isLeap ( y1 ) ? ( 366 - offset1 ) : ( 365 - offset1 ) ; int y2 , offset2 ; if ( x <= remDays ) { y2 = y1 ; offset2 = offset1 + x ; } else { x -= remDays ; y2 = y1 + 1 ; int y2days = isLeap ( y2 ) ? 366 : 365 ; while ( x >= y2days ) { x -= y2days ; y2 ++ ; y2days = isLeap ( y2 ) ? 366 : 365 ; } offset2 = x ; } int m2 , d2 ; revoffsetDays ( offset2 , y2 , & d2 , & m2 ) ; cout << " d2 ▁ = ▁ " << d2 << " , ▁ m2 ▁ = ▁ " << m2 << " , ▁ y2 ▁ = ▁ " << y2 ; } int main ( ) { int d = 14 , m = 3 , y = 2015 ; int x = 366 ; addDays ( d , m , y , x ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, offset, stdc, x, y2
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int divisorSum ( int N , int K ) { int sum = 0 ; for ( int i = 2 ; i <= ceil ( sqrt ( N ) ) ; i ++ ) if ( N % i == 0 ) sum += ( i + N / i ) ; return sum ; } bool isPrime ( int n ) { if ( n == 1 n == 0 ) 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 isHyperPerfect ( int N , int K ) { int sum = divisorSum ( N , K ) ; if ( ( 1 + K * ( sum ) ) == N ) return true ; else return false ; } int main ( ) { int N1 = 1570153 , K1 = 12 ; int N2 = 321 , K2 = 3 ; if ( isHyperPerfect ( N1 , K1 ) ) cout << N1 << " ▁ is ▁ " << K1 << " - HyperPerfect " << " STRNEWLINE " ; else cout << N1 << " ▁ is ▁ not ▁ " << K1 << " - HyperPerfect " << " STRNEWLINE " ; if ( isHyperPerfect ( N2 , K2 ) ) cout << N2 << " ▁ is ▁ " << K2 << " - HyperPerfect " << " STRNEWLINE " ; else cout << N2 << " ▁ is ▁ not ▁ " << K2 << " - HyperPerfect " << " STRNEWLINE " ; return 0 ; }

Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printWellOrdered ( int number , int x , int k ) { if ( k == 0 ) { cout << number << " ▁ " ; return ; } for ( int i = ( x + 1 ) ; i < 10 ; i ++ ) printWellOrdered ( number * 10 + i , i , k - 1 ) ; } void generateWellOrdered ( int k ) { printWellOrdered ( 0 , 0 , k ) ; } int main ( ) { int k = 3 ; generateWellOrdered ( k ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; long long moduloMultiplication ( long long a , long long b , long long mod ) { a %= mod ; while ( b ) { if ( b & 1 ) res = ( res + a ) % mod ; a = ( 2 * a ) % mod ; } return res ; } int main ( ) { long long a = 426 ; long long b = 964 ; long long m = 235 ; cout << moduloMultiplication ( a , b , m ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int numberOf2sinRange ( int n ) { string s = " " ; for ( int i = 0 ; i < n + 1 ; i ++ ) s += to_string ( i ) ; int count = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s [ i ] == '2' ) { count ++ ; } } return count ; } int main ( ) { int n = 30 ; cout << numberOf2sinRange ( n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, s, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int count2sinRangeAtDigit ( int number , int d ) { int powerOf10 = ( int ) pow ( 10 , d ) ; int nextPowerOf10 = powerOf10 * 10 ; int right = number % powerOf10 ; int roundDown = number - number % nextPowerOf10 ; int roundup = roundDown + nextPowerOf10 ; int digit = ( number / powerOf10 ) % 10 ; if ( digit < 2 ) return roundDown / 10 ; if ( digit == 2 ) return roundDown / 10 + right + 1 ; return roundup / 10 ; } int numberOf2sinRange ( int number ) { stringstream convert ; convert << number ; string s = convert . str ( ) ; int len = s . length ( ) ; int count = 0 ; for ( int digit = 0 ; digit < len ; digit ++ ) count += count2sinRangeAtDigit ( number , digit ) ; return count ; } int main ( ) { cout << numberOf2sinRange ( 22 ) << endl ; cout << numberOf2sinRange ( 100 ) ; return 0 ; }

Accumulator variables: count, digit, stdc
Iterator variables: digit
C++ program:
unsigned long long factorial ( int n ) { const unsigned int M = 1000000007 ; unsigned long long f = 1 ; for ( int i = 1 ; i <= n ; i ++ ) return f % M ; }

Accumulator variables: i
Iterator variables: i
C++ program:
unsigned long long factorial ( int n ) { const unsigned int M = 1000000007 ; unsigned long long f = 1 ; for ( int i = 1 ; i <= n ; i ++ ) return f ; }

Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isDivisibleBy5 ( string str ) { int n = str . length ( ) ; return ( ( ( str [ n - 1 ] - '0' ) == 0 ) || ( ( str [ n - 1 ] - '0' ) == 5 ) ) ; } int main ( ) { string str = "76955" ; isDivisibleBy5 ( str ) ? cout << " Yes " : cout << " No ▁ " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
using namespace std ; bool isTidy ( int num ) { int prev = 10 ; while ( num ) { int rem = num % 10 ; num /= 10 ; if ( rem > prev ) return false ; prev = rem ; } return true ; } int main ( ) { int num = 1556 ; isTidy ( num ) ? cout << " Yes " : cout << " No " ; return 0 ; }

Accumulator variables: num
C++ program:
#include <bits/stdc++.h>
using namespace std ; int squareFree ( int n ) { int cnt = 0 ; for ( int i = 1 ; ; i ++ ) { bool isSqFree = true ; for ( int j = 2 ; j * j <= i ; j ++ ) { if ( i % ( j * j ) == 0 ) { isSqFree = false ; break ; } } if ( isSqFree == true ) { cnt ++ ; if ( cnt == n ) return i ; } } return 0 ; } int main ( ) { int n = 10 ; cout << squareFree ( n ) << endl ; return 0 ; }

Accumulator variables: cnt, i, j, stdc
Iterator variables: i, j
Boolean variables: isSqFree
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MAX_PRIME = 100000 ; const int MAX_RES = 2000000000l ; void SieveOfEratosthenes ( vector < long long > & a ) { bool prime [ MAX_PRIME + 1 ] ; memset ( prime , true , sizeof ( prime ) ) ; for ( long long p = 2 ; p * p <= MAX_PRIME ; p ++ ) { if ( prime [ p ] == true ) { for ( long long i = p * 2 ; i <= MAX_PRIME ; i += p ) prime [ i ] = false ; } } for ( long long p = 2 ; p <= MAX_PRIME ; p ++ ) if ( prime [ p ] ) a . push_back ( p ) ; } long long countSquares ( long long i , long long cur , long long k , vector < long long > & a ) { long long square = a [ i ] * a [ i ] ; long long newCur = square * cur ; if ( newCur > k ) return 0 ; long long cnt = k / ( newCur ) ; cnt += countSquares ( i + 1 , cur , k , a ) ; cnt -= countSquares ( i + 1 , newCur , k , a ) ; return cnt ; } long long squareFree ( long long n ) { vector < long long > a ; SieveOfEratosthenes ( a ) ; long long low = 1 ; long long high = MAX_RES ; while ( low < high ) { long long mid = low + ( high - low ) / 2 ; long long c = mid - countSquares ( 0 , 1 , mid , a ) ; if ( c < n ) low = mid + 1 ; else high = mid ; } return low ; } int main ( ) { int n = 10 ; cout << squareFree ( n ) << endl ; return 0 ; }

Index/key variables: i, p
Accumulator variables: cnt, i, p, stdc
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; void kFactors ( int n , int k ) { vector < int > P ; while ( n % 2 == 0 ) { P . push_back ( 2 ) ; n /= 2 ; } for ( int i = 3 ; i * i <= n ; i = i + 2 ) { while ( n % i == 0 ) { n = n / i ; P . push_back ( i ) ; } } if ( n > 2 ) P . push_back ( n ) ; if ( P . size ( ) < k ) { cout << " - 1" << endl ; return ; } for ( int i = 0 ; i < k - 1 ; i ++ ) cout << P [ i ] << " , ▁ " ; int product = 1 ; for ( int i = k - 1 ; i < P . size ( ) ; i ++ ) product = product * P [ i ] ; cout << product << endl ; } int main ( ) { int n = 54 , k = 3 ; kFactors ( n , k ) ; return 0 ; }

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