dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <iostream>
using namespace std ; int val ( char c ) { if ( c >= '0' && c <= '9' ) return ( int ) c - '0' ; else return ( int ) c - ' A ' + 10 ; } int toDeci ( string str , int base ) { int len = str . length ( ) ; int power = 1 ; int num = 0 ; int i ; for ( i = len - 1 ; i >= 0 ; i -- ) { if ( val ( str [ i ] ) >= base ) { cout << " Invalid ▁ Number " ; return -1 ; } num += val ( str [ i ] ) * power ; power = power * base ; } return num ; } bool isEven ( string num , int N ) { int deci = toDeci ( num , N ) ; return ( deci % 2 == 0 ) ; } int main ( ) { string num = "11A " ; int N = 16 ; if ( isEven ( num , N ) ) { cout << " Even " ; } else { cout << " Odd " ; } }

Index/key variables: i
Accumulator variables: i, num
Iterator variables: i
C++ program:
#include " bits / stdc + + . h "
using namespace std ; long long fact [ 21 ] ; void preCompute ( ) { fact [ 0 ] = 1 ; for ( int i = 1 ; i < 18 ; i ++ ) fact [ i ] = ( fact [ i - 1 ] * i ) ; } void nextFactorial ( int N ) { for ( int i = 0 ; i < 21 ; i ++ ) { if ( N < fact [ i ] ) { cout << fact [ i ] ; break ; } } } int main ( ) { preCompute ( ) ; int N = 120 ; nextFactorial ( N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long int
void findDistinctOddSum ( ll n , ll k ) { if ( ( k * k ) <= n && ( n + k ) % 2 == 0 ) { int val = 1 ; int sum = 0 ; for ( int i = 1 ; i < k ; i ++ ) { cout << val << " ▁ " ; sum += val ; val += 2 ; } cout << n - sum << endl ; } else cout << " NO ▁ STRNEWLINE " ; } int main ( ) { ll n = 100 ; ll k = 4 ; findDistinctOddSum ( n , k ) ; return 0 ; }

Accumulator variables: i, stdc, sum, val
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void checkArray ( int a [ ] , int b [ ] , int n ) { int operations = 0 ; int i = 0 ; while ( i < n ) { if ( a [ i ] - b [ i ] == 0 ) { i ++ ; continue ; } int diff = a [ i ] - b [ i ] ; i ++ ; while ( i < n && a [ i ] - b [ i ] == diff ) { i ++ ; } operations ++ ; } cout << operations << " STRNEWLINE " ; } int main ( ) { int a [ ] = { 3 , 7 , 1 , 4 , 1 , 2 } ; int b [ ] = { 3 , 7 , 3 , 6 , 3 , 2 } ; int size = sizeof ( a ) / sizeof ( a [ 0 ] ) ; checkArray ( a , b , size ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, operations, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; map < int , int > insertPF ( map < int , int > primeFact , int fact ) { if ( primeFact . find ( fact ) != primeFact . end ( ) ) { primeFact [ fact ] ++ ; } else { primeFact [ fact ] = 1 ; } return primeFact ; } map < int , int > primeFactors ( int n ) { map < int , int > primeFact ; while ( n % 2 == 0 ) { primeFact = insertPF ( primeFact , 2 ) ; n /= 2 ; } for ( int i = 3 ; i <= sqrt ( n ) ; i += 2 ) { while ( n % i == 0 ) { primeFact = insertPF ( primeFact , i ) ; n /= i ; } } if ( n > 2 ) primeFact = insertPF ( primeFact , n ) ; return primeFact ; } string perfectCube ( int n ) { map < int , int > primeFact ; primeFact = primeFactors ( n ) ; for ( auto x : primeFact ) { if ( x . second % 3 != 0 ) return " No " ; } return " Yes " ; } int main ( ) { int N = 216 ; cout << perfectCube ( N ) ; return 0 ; }

Index/key variables: fact
Accumulator variables: i, n, stdc
Iterator variables: i, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int factorial ( int n ) { return ( n == 1 n == 0 ) ? 1 : n * factorial ( n - 1 ) ; } int ways ( int n ) { if ( n < 3 ) { return 0 ; } int c2 = 0 ; int c1 = n - 3 ; int l = c1 + 1 ; int s = 0 ; int exp_c2 = c1 / 2 ; while ( exp_c2 >= c2 ) { int f1 = factorial ( l ) ; int f2 = factorial ( c1 ) ; int f3 = factorial ( c2 ) ; int f4 = ( f2 * f3 ) ; s += f1 / f4 ; c2 += 1 ; c1 -= 2 ; l -= 1 ; } return s ; } int main ( ) { int n = 7 ; int ans = ways ( n ) ; cout << ans << endl ; return 0 ; }

Accumulator variables: c1, c2, l, s, stdc
C++ program:
#include " bits / stdc + + . h "
#define ll  long long int
using namespace std ; map < ll , ll > m ; int precompute ( ) { ll fact = 1 ; for ( ll i = 1 ; i <= 18 ; i ++ ) { fact = fact * i ; m [ fact ] = i ; } } int main ( ) { precompute ( ) ; int K = 120 ; cout << m [ K ] << endl ; K = 6 ; cout << m [ K ] << endl ; return 0 ; }

Index/key variables: K, fact
Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int calNum ( int year ) { return ( year / 4 ) - ( year / 100 ) + ( year / 400 ) ; } void leapNum ( int l , int r ) { l -- ; int num1 = calNum ( r ) ; int num2 = calNum ( l ) ; cout << num1 - num2 << endl ; } int main ( ) { int l1 = 1 , r1 = 400 ; leapNum ( l1 , r1 ) ; int l2 = 400 , r2 = 2000 ; leapNum ( l2 , r2 ) ; return 0 ; }

Accumulator variables: l, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; typedef struct cantor { double start , end ; struct cantor * next ; } Cantor ; Cantor * startList ( Cantor * head , double start_num , double end_num ) { if ( head == NULL ) { head = new Cantor ; head -> start = start_num ; head -> end = end_num ; head -> next = NULL ; } return head ; } Cantor * propagate ( Cantor * head ) { Cantor * temp = head ; if ( temp != NULL ) { Cantor * newNode = new Cantor ; double diff = ( ( ( temp -> end ) - ( temp -> start ) ) / 3 ) ; newNode -> end = temp -> end ; temp -> end = ( ( temp -> start ) + diff ) ; newNode -> start = ( newNode -> end ) - diff ; newNode -> next = temp -> next ; temp -> next = newNode ; propagate ( temp -> next -> next ) ; } return head ; } void print ( Cantor * temp ) { while ( temp != NULL ) { printf ( " [ % lf ] ▁ - - ▁ [ % lf ] TABSYMBOL " , temp -> start , temp -> end ) ; temp = temp -> next ; } cout << endl ; } void buildCantorSet ( int A , int B , int L ) { Cantor * head = NULL ; head = startList ( head , A , B ) ; for ( int i = 0 ; i < L ; i ++ ) { cout << " Level _ " << i << " ▁ : ▁ " ; print ( head ) ; propagate ( head ) ; } cout << " Level _ " << L << " ▁ : ▁ " ; print ( head ) ; } int main ( ) { int A = 0 ; int B = 9 ; int L = 2 ; buildCantorSet ( A , B , L ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
Class/struct names: cantor
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define N  100005
#define mod  (int)(1e9 + 7)
int factorial [ N ] , modinverse [ N ] ; int power ( int a , int m1 ) { if ( m1 == 0 ) return 1 ; else if ( m1 == 1 ) return a ; else if ( m1 == 2 ) return ( 1LL * a * a ) % mod ; else if ( m1 & 1 ) return ( 1LL * a * power ( power ( a , m1 / 2 ) , 2 ) ) % mod ; else return power ( power ( a , m1 / 2 ) , 2 ) % mod ; } void factorialfun ( ) { factorial [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) factorial [ i ] = ( 1LL * factorial [ i - 1 ] * i ) % mod ; } void modinversefun ( ) { modinverse [ N - 1 ] = power ( factorial [ N - 1 ] , mod - 2 ) % mod ; for ( int i = N - 2 ; i >= 0 ; i -- ) modinverse [ i ] = ( 1LL * modinverse [ i + 1 ] * ( i + 1 ) ) % mod ; } int binomial ( int n , int r ) { if ( r > n ) return 0 ; int a = ( 1LL * factorial [ n ] * modinverse [ n - r ] ) % mod ; a = ( 1LL * a * modinverse [ r ] ) % mod ; return a ; } int max_min ( int a [ ] , int n , int k ) { sort ( a , a + n ) ; factorialfun ( ) ; modinversefun ( ) ; long long ans = 0 ; k -- ; for ( int i = 0 ; i < n ; i ++ ) { int x = n - i - 1 ; if ( x >= k ) ans -= binomial ( x , k ) * a [ i ] % mod ; int y = i ; if ( y >= k ) ans += binomial ( y , k ) * a [ i ] % mod ; ans = ( ans + mod ) % mod ; } return ( int ) ( ans ) ; } int main ( ) { int a [ ] = { 1 , 1 , 3 , 4 } , k = 2 ; int n = sizeof ( a ) / sizeof ( int ) ; cout << max_min ( a , n , k ) ; return 0 ; }

Index/key variables: N, i, n, r
Accumulator variables: ans, i, k, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countNumber ( int N , int S ) { int countElements = 0 ; int currSum = 0 ; while ( currSum <= S ) { currSum += N ; N -- ; countElements ++ ; } return countElements ; } int main ( ) { int N , S ; N = 5 ; S = 11 ; int count = countNumber ( N , S ) ; cout << count << endl ; return 0 ; }

Accumulator variables: N, countElements, currSum, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countDistinct ( int n ) { int arr [ 10 ] = { 0 } ; int count = 0 ; while ( n ) { int r = n % 10 ; arr [ r ] = 1 ; n /= 10 ; } for ( int i = 0 ; i < 10 ; i ++ ) { if ( arr [ i ] ) count ++ ; } return count ; } int countDigit ( int n ) { int c = 0 ; while ( n ) { int r = n % 10 ; c ++ ; n /= 10 ; } return c ; } int nextNumberDistinctDigit ( int n ) { while ( n < INT_MAX ) { int distinct_digits = countDistinct ( n + 1 ) ; int total_digits = countDigit ( n + 1 ) ; if ( distinct_digits == total_digits ) { return n + 1 ; } else n ++ ; } return -1 ; } int main ( ) { int n = 2019 ; cout << nextNumberDistinctDigit ( n ) ; return 0 ; }

Index/key variables: i, r
Accumulator variables: c, count, i, n, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define mod  (int)(1e9 + 7)
#define N  1000005
int lpf [ N ] ; void least_prime_factor ( ) { for ( int i = 1 ; i < N ; i ++ ) lpf [ i ] = i ; for ( int i = 2 ; i < N ; i ++ ) if ( lpf [ i ] == i ) for ( int j = i * 2 ; j < N ; j += i ) if ( lpf [ j ] == j ) lpf [ j ] = i ; } int power ( int a , int m1 ) { if ( m1 == 0 ) return 1 ; else if ( m1 == 1 ) return a ; else if ( m1 == 2 ) return ( 1LL * a * a ) % mod ; else if ( m1 & 1 ) return ( 1LL * a * power ( power ( a , m1 / 2 ) , 2 ) ) % mod ; else return power ( power ( a , m1 / 2 ) , 2 ) % mod ; } long long sum_of_elements ( int a [ ] , int n ) { least_prime_factor ( ) ; map < int , int > prime_factor ; for ( int i = 0 ; i < n ; i ++ ) { int temp = a [ i ] ; map < int , int > single_number ; while ( temp > 1 ) { int x = lpf [ temp ] ; single_number [ x ] ++ ; temp /= x ; } if ( i == 0 ) prime_factor = single_number ; else { for ( auto x : single_number ) prime_factor [ x . first ] = max ( x . second , prime_factor [ x . first ] ) ; } } long long ans = 0 , lcm = 1 ; for ( auto x : prime_factor ) lcm = ( lcm * power ( x . first , x . second ) ) % mod ; for ( int i = 0 ; i < n ; i ++ ) ans = ( ans + ( lcm * power ( a [ i ] , mod - 2 ) ) % mod ) % mod ; return ans ; } int main ( ) { int a [ ] = { 2 , 3 , 4 } ; int n = sizeof ( a ) / sizeof ( int ) ; cout << sum_of_elements ( a , n ) ; return 0 ; }

Index/key variables: N, i, j, temp, x
Accumulator variables: i, j, stdc, temp
Iterator variables: i, j, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findNumberOfEvenCells ( int n , int q [ ] [ 2 ] , int size ) { int row [ n ] = { 0 } ; int col [ n ] = { 0 } ; for ( int i = 0 ; i < size ; i ++ ) { int x = q [ i ] [ 0 ] ; int y = q [ i ] [ 1 ] ; row [ x - 1 ] ++ ; col [ y - 1 ] ++ ; } int r1 = 0 , r2 = 0 ; int c1 = 0 , c2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( row [ i ] % 2 == 0 ) { r1 ++ ; } if ( row [ i ] % 2 == 1 ) { r2 ++ ; } if ( col [ i ] % 2 == 0 ) { c1 ++ ; } if ( col [ i ] % 2 == 1 ) { c2 ++ ; } } int count = r1 * c1 + r2 * c2 ; return count ; } int main ( ) { int n = 2 ; int q [ ] [ 2 ] = { { 1 , 1 } , { 1 , 2 } , { 2 , 1 } } ; int size = sizeof ( q ) / sizeof ( q [ 0 ] ) ; cout << findNumberOfEvenCells ( n , q , size ) ; return 0 ; }

Index/key variables: i, n
Accumulator variables: c1, c2, i, r1, r2, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maxHeight ( int h1 , int h2 ) { return ( ( h1 * h2 ) - h1 - h2 ) ; } int main ( ) { int h1 = 7 , h2 = 5 ; cout << max ( 0 , maxHeight ( h1 , h2 ) ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void FermatFactors ( int n ) { if ( n <= 0 ) { cout << " [ " << n << " ] " ; return ; } if ( ( n & 1 ) == 0 ) { cout << " [ " << n / 2.0 << " , " << 2 << " ] " ; return ; } int a = ceil ( sqrt ( n ) ) ; if ( a * a == n ) { cout << " [ " << a << " , " << a << " ] " ; return ; } int b ; while ( true ) { int b1 = a * a - n ; b = ( int ) sqrt ( b1 ) ; if ( b * b == b1 ) break ; else a += 1 ; } cout << " [ " << ( a - b ) << " , " << ( a + b ) << " ] " ; return ; } int main ( ) { FermatFactors ( 6557 ) ; return 0 ; }

Accumulator variables: a, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findNums ( int arr [ ] , int n ) { int S = 0 , X = 0 ; for ( int i = 0 ; i < n ; i ++ ) { S += arr [ i ] ; X ^= arr [ i ] ; } cout << X << " ▁ " << ( X + S ) ; } int main ( ) { int arr [ ] = { 1 , 7 } ; int n = sizeof ( arr ) / sizeof ( int ) ; findNums ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: S, X, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void solve ( int A , int B ) { double p = B / 2.0 ; int M = ceil ( 4 * p ) ; int N = 1 ; int O = - 2 * A ; int Q = ceil ( A * A + 4 * p * p ) ; cout << M << " ▁ " << N << " ▁ " << O << " ▁ " << Q ; } int main ( ) { int a = 1 ; int b = 1 ; solve ( a , b ) ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findLargest ( int * arr , int n ) { int gcd = 0 ; for ( int i = 0 ; i < n ; i ++ ) gcd = __gcd ( arr [ i ] , gcd ) ; return gcd ; } int main ( ) { int arr [ ] = { 3 , 6 , 9 } ; int n = sizeof ( arr ) / sizeof ( int ) ; cout << findLargest ( 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 digitSum ( int n ) { int sum = 0 ; while ( n > 0 ) { sum += ( n % 10 ) ; n /= 10 ; } return sum ; } bool isPalindrome ( int n ) { int divisor = 1 ; while ( n / divisor >= 10 ) divisor *= 10 ; while ( n != 0 ) { int leading = n / divisor ; int trailing = n % 10 ; if ( leading != trailing ) return false ; n = ( n % divisor ) / 10 ; divisor = divisor / 100 ; } return true ; } bool isDigitSumPalindrome ( int n ) { int sum = digitSum ( n ) ; if ( isPalindrome ( sum ) ) return true ; return false ; } int main ( ) { int n = 56 ; if ( isDigitSumPalindrome ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: divisor, n, stdc, sum
C++ program:
#include <bits/stdc++.h>
using namespace std ; int xorK ( int n , int k ) { if ( k % 2 == 1 ) return n ; return 0 ; } int main ( ) { int n = 123 , k = 3 ; cout << xorK ( n , k ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define N  100005
#define mod  (int)(1e9 + 7)
int factorial [ N ] , modinverse [ N ] ; int power ( int a , int m1 ) { if ( m1 == 0 ) return 1 ; else if ( m1 == 1 ) return a ; else if ( m1 == 2 ) return ( 1LL * a * a ) % mod ; else if ( m1 & 1 ) return ( 1LL * a * power ( power ( a , m1 / 2 ) , 2 ) ) % mod ; else return power ( power ( a , m1 / 2 ) , 2 ) % mod ; } void factorialfun ( ) { factorial [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) factorial [ i ] = ( 1LL * factorial [ i - 1 ] * i ) % mod ; } void modinversefun ( ) { modinverse [ N - 1 ] = power ( factorial [ N - 1 ] , mod - 2 ) % mod ; for ( int i = N - 2 ; i >= 0 ; i -- ) modinverse [ i ] = ( 1LL * modinverse [ i + 1 ] * ( i + 1 ) ) % mod ; } int binomial ( int n , int r ) { if ( r > n ) return 0 ; int a = ( 1LL * factorial [ n ] * modinverse [ n - r ] ) % mod ; a = ( 1LL * a * modinverse [ r ] ) % mod ; return a ; } int arrange ( int n , int m , int k ) { factorialfun ( ) ; modinversefun ( ) ; long long ans = 0 ; for ( int i = 1 ; i < n ; i ++ ) ans += ( 1LL * i * ( n - i ) * m * m ) % mod ; for ( int i = 1 ; i < m ; i ++ ) ans += ( 1LL * i * ( m - i ) * n * n ) % mod ; ans = ( ans * binomial ( n * m - 2 , k - 2 ) ) % mod ; return ( int ) ans ; } int main ( ) { int n = 2 , m = 2 , k = 2 ; cout << arrange ( n , m , k ) ; return 0 ; }

Index/key variables: N, i, n, r
Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findNthDigit ( int p , int q , int N ) { int res ; while ( N > 0 ) { N -- ; p *= 10 ; res = p / q ; p %= q ; } return res ; } int main ( ) { int p = 1 , q = 2 , N = 1 ; cout << findNthDigit ( p , q , N ) ; return 0 ; }

Accumulator variables: N, p, stdc
C++ program:
#include <iostream>
using namespace std ; int sumArr ( int arr [ ] , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; return sum ; } int sumModArr ( int arr [ ] , int n ) { int subSum = arr [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) { int curr = arr [ i ] ; arr [ i ] -= subSum ; subSum += curr ; } return sumArr ( arr , n ) ; } int main ( ) { int arr [ ] = { 40 , 25 , 12 , 10 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << sumModArr ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, subSum, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int NumUnsignBits = 64 ; unsigned long findNum ( unsigned long x ) { for ( int i = 0 ; i < NumUnsignBits - 1 ; i ++ ) { if ( ( ( x >> i ) & 1 ) != ( ( x >> ( i + 1 ) ) & 1 ) ) { x ^= ( 1 << i ) | ( 1 << ( i + 1 ) ) ; return x ; } } } int main ( ) { int n = 92 ; cout << findNum ( n ) ; return 0 ; }

Accumulator variables: i, stdc, x
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int cntCakes ( int n , int m ) { int sum = ( n * ( n + 1 ) ) / 2 ; int quo = m / sum ; int rem = m % sum ; double ans = m - quo * sum ; double x = ( -1 + pow ( ( 8 * rem ) + 1 , 0.5 ) ) / 2 ; ans = ans - x * ( x + 1 ) / 2 ; return int ( ans ) ; } int main ( ) { int n = 3 ; int m = 8 ; int ans = cntCakes ( n , m ) ; cout << ( ans ) ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int reverse ( int num ) { int rev = 0 ; while ( num > 0 ) { rev = rev * 10 + num % 10 ; num = num / 10 ; } return rev ; } bool isPalindrome ( int num ) { if ( num == reverse ( num ) ) return true ; return false ; } void printPalindromes ( int d ) { if ( d <= 0 ) return ; int smallest = pow ( 10 , d - 1 ) ; int largest = pow ( 10 , d ) - 1 ; for ( int i = smallest ; i <= largest ; i ++ ) { if ( isPalindrome ( i ) ) cout << i << " ▁ " ; } } int main ( ) { int d = 2 ; printPalindromes ( d ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void getXandYintercept ( int P [ ] , int Q [ ] ) { int a = P [ 1 ] - Q [ 1 ] ; int b = P [ 0 ] - Q [ 0 ] ; if ( b == 0 ) { cout << P [ 0 ] << endl ; cout << " infinity " ; return ; } if ( a == 0 ) { cout << " infinity " ; cout << P [ 1 ] << endl ; return ; } double m = a / ( b * 1.0 ) ; int x = P [ 0 ] ; int y = P [ 1 ] ; double c = y - m * x ; y = 0 ; double r = ( y - c ) / ( m * 1.0 ) ; cout << r << endl ; x = 0 ; y = m * x + c ; printf ( " % .8f " , c ) ; } int main ( ) { int p1 [ ] = { 5 , 2 } ; int p2 [ ] = { 2 , 7 } ; getXandYintercept ( p1 , p2 ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int min_moves ( int n ) { int ans = INT_MAX ; for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { ans = min ( ans , i + n / i - 2 ) ; } } return ans ; } int main ( ) { int n = 10 ; cout << min_moves ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MOD = 2019 ; int min_modulo ( int l , int r ) { if ( r - l >= MOD ) return 0 ; else { int ans = MOD - 1 ; for ( int i = l ; i <= r ; i ++ ) { for ( int j = i + 1 ; j <= r ; j ++ ) { ans = min ( ans , ( i * j ) % MOD ) ; } } return ans ; } } int main ( ) { int l = 2020 , r = 2040 ; cout << min_modulo ( l , r ) ; return 0 ; }

Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void find_numbers ( int N ) { if ( N == 1 ) { cout << -1 ; } else { cout << N << " ▁ " << N + 1 << " ▁ " << N * ( N + 1 ) ; } } int main ( ) { int N = 5 ; find_numbers ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countPairs ( int arr [ ] , int n ) { unordered_map < int , int > map ; for ( int i = 0 ; i < n ; i ++ ) map [ arr [ i ] - i ] ++ ; int res = 0 ; for ( auto x : map ) { int cnt = x . second ; res += ( ( cnt * ( cnt - 1 ) ) / 2 ) ; } return res ; } int main ( ) { int arr [ ] = { 1 , 5 , 6 , 7 , 9 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << countPairs ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, res, stdc
Iterator variables: i, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; string minInt ( string str ) { for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str [ i ] >= '5' ) { str [ i ] = ( '9' - str [ i ] ) + '0' ; } } if ( str [ 0 ] == '0' ) str [ 0 ] = '9' ; return str ; } int main ( ) { string str = "589" ; cout << minInt ( str ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; long long int minOperations ( long long int n ) { long long int count = 0 ; long long int d = 0 ; if ( n == 1 ) return 0 ; while ( n > 9 ) { d = max ( n % 10 , d ) ; n /= 10 ; count += 10 ; } d = max ( d , n - 1 ) ; count += abs ( d ) ; return count - 1 ; } int main ( ) { long long int n = 240 ; cout << minOperations ( n ) ; return 0 ; }

Accumulator variables: count, n, stdc
C++ program:
#include <iostream>
using namespace std ; string findMaximumNum ( string str , int n , int k ) { for ( int i = 0 ; i < n ; i ++ ) { if ( k < 1 ) break ; if ( str [ i ] != '9' ) { str [ i ] = '9' ; k -- ; } } return str ; } int main ( ) { string str = "569431" ; int n = str . length ( ) ; int k = 3 ; cout << findMaximumNum ( str , n , k ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, k
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool areAnagrams ( int a , int b ) { string c = to_string ( a ) ; string d = to_string ( b ) ; sort ( c . begin ( ) , c . end ( ) ) ; sort ( d . begin ( ) , d . end ( ) ) ; if ( c == d ) return true ; else return false ; } int main ( ) { int a = 240 ; int b = 204 ; if ( areAnagrams ( a , b ) ) cout << " Yes " ; else cout << " No " ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int solve ( int ang , int n ) { if ( ( ang * n ) > ( 180 * ( n - 2 ) ) ) { return 0 ; } else if ( ( ang * n ) % 180 != 0 ) { return 0 ; } int ans = 1 ; int freq = ( ang * n ) / 180 ; ans = ans * ( n - 1 - freq ) ; ans = ans * n ; return ans ; } int main ( ) { int ang = 90 , n = 4 ; cout << solve ( ang , n ) ; return 0 ; }

Accumulator variables: stdc
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 thirdNumber ( int a , int b ) { int sum = 0 , temp = 0 ; sum = a + b ; temp = 1 ; if ( sum & 1 ) { temp = 2 ; } while ( ! prime ( sum + temp ) ) { temp += 2 ; } cout << temp ; } int main ( ) { int a = 3 , b = 5 ; thirdNumber ( a , b ) ; return 0 ; }

Accumulator variables: i, stdc, temp
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 total_ways ( int N , int X ) { return ( nCr ( N - 1 , X - 1 ) + nCr ( N - 1 , X ) ) ; } int main ( ) { int N = 5 , X = 3 ; cout << total_ways ( N , X ) ; return 0 ; }

Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long
int calculate ( ll int n , ll int k , ll int m , ll int power ) { if ( n > m ) { if ( power == 0 ) return 0 ; else return power - 1 ; } else if ( n == m ) return power ; else return calculate ( n * k , k , m , power + 1 ) ; } int main ( ) { ll N = 1 , K = 2 , M = 5 ; cout << calculate ( N , K , M , 0 ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printNumber ( int holes ) { if ( holes == 0 ) cout << "1" ; else if ( holes == 1 ) cout << "0" ; else { int rem = 0 , quo = 0 ; rem = holes % 2 ; quo = holes / 2 ; if ( rem == 1 ) cout << "4" ; for ( int i = 0 ; i < quo ; i ++ ) cout << "8" ; } } int main ( ) { int holes = 3 ; printNumber ( holes ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i