dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isValid ( int arr [ ] , int i , int j , int m , int c ) { if ( i == j ) return false ; int lhs = arr [ j ] ; int rhs = m * arr [ i ] + c ; return ( lhs == rhs ) ; } int findOrderedPoints ( int arr [ ] , int n , int m , int c ) { int counter = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { int firstIndex = i , secondIndex = j ; if ( isValid ( arr , firstIndex , secondIndex , m , c ) ) counter ++ ; } } return counter ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 , 2 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int m = 1 , c = 1 ; cout << findOrderedPoints ( arr , n , m , c ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: counter, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool checkcircle ( int r , int R , int r1 , int x1 , int y1 ) { int dis = sqrt ( x1 * x1 + y1 * y1 ) ; return ( dis - r1 >= R && dis + r1 <= r ) ; } int main ( ) { int r = 8 , R = 4 , r1 = 2 , x1 = 6 , y1 = 0 ; if ( checkcircle ( r , R , r1 , x1 , y1 ) ) cout << " yes " << endl ; else cout << " no " << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; double surface_area_octahedron ( double side ) { return ( 2 * ( sqrt ( 3 ) ) * ( side * side ) ) ; } int main ( ) { double side = 7 ; cout << " Surface ▁ area ▁ of ▁ octahedron ▁ = " << surface_area_octahedron ( side ) << endl ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int nCk ( int n , int k ) { int C [ k + 1 ] ; memset ( C , 0 , sizeof ( C ) ) ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = min ( i , k ) ; j > 0 ; j -- ) C [ j ] = C [ j ] + C [ j - 1 ] ; } return C [ k ] ; } int count_Straightlines ( int n , int m ) { return ( nCk ( n , 2 ) - nCk ( m , 2 ) + 1 ) ; } int main ( ) { int n = 4 , m = 3 ; cout << count_Straightlines ( n , m ) ; return 0 ; }

Index/key variables: j, k
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; double vol_of_dodecahedron ( int side ) { return ( ( ( 15 + ( 7 * ( sqrt ( 5 ) ) ) ) / 4 ) * ( pow ( side , 3 ) ) ) ; } int main ( ) { int side = 4 ; cout << " Volume ▁ of ▁ dodecahedron ▁ = ▁ " << vol_of_dodecahedron ( side ) ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void overflow ( int H , int r , int h , int N , int R ) { float tank_cap = 3.14 * r * r * H ; float water_vol = 3.14 * r * r * h ; float balls_vol = N * ( 4 / 3 ) * 3.14 * R * R * R ; float vol = water_vol + balls_vol ; if ( vol > tank_cap ) { cout << " Overflow " << endl ; } else { cout << " Not ▁ in ▁ overflow ▁ state " << endl ; } } int main ( ) { int H = 10 , r = 5 , h = 5 , N = 2 , R = 2 ; overflow ( H , r , h , N , R ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; float volume ( int radius , int height ) { return ( ( 22 / 7 ) * radius * radius * height ) ; } void check_and_print ( float required_time , float given_time ) { if ( required_time < given_time ) cout << " Overflow " ; else if ( required_time > given_time ) cout << " Underflow " ; else cout << " Filled " ; } int main ( ) { int radius = 5 , height = 10 , rate_of_flow = 10 ; float given_time = 70.0 ; float required_time = volume ( radius , height ) / rate_of_flow ; check_and_print ( required_time , given_time ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; float cal_cos ( float n ) { float accuracy = 0.0001 , x1 , denominator , cosx , cosval ; n = n * ( 3.142 / 180.0 ) ; x1 = 1 ; cosx = x1 ; cosval = cos ( n ) ; int i = 1 ; do { denominator = 2 * i * ( 2 * i - 1 ) ; x1 = - x1 * n * n / denominator ; cosx = cosx + x1 ; i = i + 1 ; } while ( accuracy <= fabs ( cosval - cosx ) ) ; return cosx ; } float third_side ( int a , int b , float c ) { float angle = cal_cos ( c ) ; return sqrt ( ( a * a ) + ( b * b ) - 2 * a * b * angle ) ; } int main ( ) { float c = 49 ; int a = 5 , b = 8 ; cout << third_side ( a , b , c ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void fitOrNotFit ( int R , int r , int x , int y , int rad ) { double val = sqrt ( pow ( x , 2 ) + pow ( y , 2 ) ) ; if ( val + rad <= R && val - rad >= R - r ) cout << " Fits STRNEWLINE " ; else cout << " Doesn ' t ▁ Fit STRNEWLINE " ; } int main ( ) { int R = 8 , r = 4 ; int x = 5 , y = 3 , rad = 3 ; fitOrNotFit ( R , r , x , y , rad ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define EPSILON  numeric_limits<double>::epsilon()
bool compareDoubles ( double A , double B ) { double diff = A - B ; return ( diff < EPSILON ) && ( - diff < EPSILON ) ; } int numberOfTringles ( int a [ ] , int b [ ] , int c [ ] , int n ) { double slope [ n ] ; for ( int i = 0 ; i < n ; i ++ ) slope [ i ] = ( a [ i ] * 1.0 ) / b [ i ] ; sort ( slope , slope + n ) ; int count [ n ] , k = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( compareDoubles ( slope [ i ] , slope [ i - 1 ] ) ) this_count ++ ; else { count [ k ++ ] = this_count ; this_count = 1 ; } } count [ k ++ ] = this_count ; int sum1 = 0 ; for ( int i = 0 ; i < k ; i ++ ) sum1 += count [ i ] ; int sum2 = 0 ; for ( int i = 0 ; i < k ; i ++ ) { temp [ i ] = count [ i ] * ( sum1 - count [ i ] ) ; sum2 += temp [ i ] ; } sum2 /= 2 ; int sum3 = 0 ; for ( int i = 0 ; i < k ; i ++ ) sum3 += count [ i ] * ( sum2 - temp [ i ] ) ; sum3 /= 3 ; return sum3 ; } int main ( ) { int a [ ] = { 1 , 2 , 3 , 4 } ; int b [ ] = { 2 , 4 , 5 , 5 } ; int c [ ] = { 5 , 7 , 8 , 6 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << " The ▁ number ▁ of ▁ triangles ▁ that " " ▁ can ▁ be ▁ formed ▁ are : ▁ " << numberOfTringles ( a , b , c , n ) ; return 0 ; }

Index/key variables: i, n
Accumulator variables: i, k, stdc, sum1, sum2, sum3, this_count
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool checkPolygonWithMidpoints ( int arr [ ] , int N , int midpoints ) { for ( int j = 0 ; j < midpoints ; j ++ ) { int val = 1 ; for ( int k = j ; k < N ; k += midpoints ) { val &= arr [ k ] ; } if ( val && N / midpoints > 2 ) { cout << " Polygon ▁ possible ▁ with ▁ side ▁ length ▁ " << << ( N / midpoints ) << endl ; return true ; } } return false ; } void isPolygonPossible ( int arr [ ] , int N ) { int limit = sqrt ( N ) ; for ( int i = 1 ; i <= limit ; i ++ ) { if ( N % i == 0 ) { if ( checkPolygonWithMidpoints ( arr , N , i ) || checkPolygonWithMidpoints ( arr , N , ( N / i ) ) ) return ; } } cout << " Not ▁ possiblen " ; } int main ( ) { int arr [ ] = { 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 1 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; isPolygonPossible ( arr , N ) ; return 0 ; }

Index/key variables: k
Accumulator variables: i, j, k, stdc, val
Iterator variables: i, j, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } pair < int , int > getReducedForm ( int dy , int dx ) { int g = gcd ( abs ( dy ) , abs ( dx ) ) ; bool sign = ( dy < 0 ) ^ ( dx < 0 ) ; if ( sign ) return make_pair ( - abs ( dy ) / g , abs ( dx ) / g ) ; else return make_pair ( abs ( dy ) / g , abs ( dx ) / g ) ; } int minLinesToCoverPoints ( int points [ ] [ 2 ] , int N , int xO , int yO ) { set < pair < int , int > > st ; pair < int , int > temp ; int minLines = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int curX = points [ i ] [ 0 ] ; int curY = points [ i ] [ 1 ] ; temp = getReducedForm ( curY - yO , curX - xO ) ; if ( st . find ( temp ) == st . end ( ) ) { st . insert ( temp ) ; minLines ++ ; } } return minLines ; } int main ( ) { int xO , yO ; xO = 1 ; yO = 0 ; int points [ ] [ 2 ] = { { -1 , 3 } , { 4 , 3 } , { 2 , 1 } , { -1 , -2 } , { 3 , -3 } } ; int N = sizeof ( points ) / sizeof ( points [ 0 ] ) ; cout << minLinesToCoverPoints ( points , N , xO , yO ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, minLines, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; float squareRoot ( float n ) { float x = n ; float y = 1 ; float e = 0.000001 ; while ( x - y > e ) { x = ( x + y ) / 2 ; y = n / x ; } return x ; } int findMaximumHeight ( int N ) { int n = 1 + 8 * N ; int maxH = ( -1 + squareRoot ( n ) ) / 2 ; return maxH ; } int main ( ) { int N = 12 ; cout << findMaximumHeight ( N ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
#include <cmath>
using namespace std ; class Point { public : int x , y ; Point ( int a = 0 , int b = 0 ) : x ( a ) , y ( b ) { } } ; int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } int getCount ( Point p , Point q ) { if ( p . x == q . x ) return abs ( p . y - q . y ) - 1 ; if ( p . y == q . y ) return abs ( p . x - q . x ) - 1 ; return gcd ( abs ( p . x - q . x ) , abs ( p . y - q . y ) ) - 1 ; } int main ( ) { Point p ( 1 , 9 ) ; Point q ( 8 , 16 ) ; cout << " The ▁ number ▁ of ▁ integral ▁ points ▁ between ▁ " << " ( " << p . x << " , ▁ " << p . y << " ) ▁ and ▁ ( " << q . x << " , ▁ " << q . y << " ) ▁ is ▁ " << getCount ( p , q ) ; return 0 ; }

Class/struct names: Point
C++ program:
#include <iostream>
using namespace std ; struct Point { int x , y ; } ; int distSq ( Point p , Point q ) { return ( p . x - q . x ) * ( p . x - q . x ) + ( p . y - q . y ) * ( p . y - q . y ) ; } bool isSquare ( Point p1 , Point p2 , Point p3 , Point p4 ) { if ( d2 == 0 d3 == 0 d4 == 0 ) return false ; if ( d2 == d3 && 2 * d2 == d4 && 2 * distSq ( p2 , p4 ) == distSq ( p2 , p3 ) ) { return true ; } if ( d3 == d4 && 2 * d3 == d2 && 2 * distSq ( p3 , p2 ) == distSq ( p3 , p4 ) ) { return true ; } if ( d2 == d4 && 2 * d2 == d3 && 2 * distSq ( p2 , p3 ) == distSq ( p2 , p4 ) ) { return true ; } return false ; } int main ( ) { Point p1 = { 20 , 10 } , p2 = { 10 , 20 } , p3 = { 20 , 20 } , p4 = { 10 , 10 } ; isSquare ( p1 , p2 , p3 , p4 ) ? cout << " Yes " : cout << " No " ; return 0 ; }

Class/struct names: Point
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countDivisors ( int n ) { int divisors = 0 ; int i ; for ( i = 1 ; i * i < n ; i ++ ) { if ( n % i == 0 ) { divisors ++ ; } } if ( i - ( n / i ) == 1 ) { i -- ; } for ( ; i >= 1 ; i -- ) { if ( n % i == 0 ) { divisors ++ ; } } return divisors ; } int possibleTriplets ( int N ) { int count = 0 ; for ( int i = 1 ; i < N ; i ++ ) { count += countDivisors ( N - i ) ; } return count ; } int main ( ) { int N = 10 ; cout << possibleTriplets ( N ) ; return 0 ; }

Accumulator variables: count, divisors, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maxPlanes ( int A [ ] , int B [ ] , int N ) { set < int > St ; for ( int i = 0 ; i < N ; i ++ ) { int t = ( A [ i ] % B [ i ] > 0 ) ? 1 : 0 ; t += ( A [ i ] / B [ i ] ) + t ; St . insert ( t ) ; } return St . size ( ) ; } int main ( ) { int A [ ] = { 1 , 3 , 5 , 4 , 8 } ; int B [ ] = { 1 , 2 , 2 , 1 , 2 } ; int N = sizeof ( A ) / sizeof ( A [ 0 ] ) ; cout << maxPlanes ( A , B , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, t
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; void maxRightmostElement ( int N , int k , int arr [ ] ) { int ans = arr [ N - 1 ] ; for ( int i = N - 2 ; i >= 0 ; i -- ) { int d = min ( arr [ i ] / 2 , k / ( N - 1 - i ) ) ; k -= d * ( N - 1 - i ) ; ans += d * 2 ; } cout << ans << endl ; } int main ( ) { int N = 4 , k = 5 , arr [ ] = { 3 , 8 , 1 , 4 } ; maxRightmostElement ( N , k , arr ) ; return 0 ; }

Index/key variables: i
Accumulator variables: ans, i, k
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string findIfPossible ( int N , int S , int X ) { if ( S >= X and S % 2 == X % 2 ) { if ( N >= 3 ) { return " Yes " ; } if ( N == 1 ) { if ( S == X ) { return " Yes " ; } else { return " No " ; } } if ( N == 2 ) { int C = ( S - X ) / 2 ; int A = C ; int B = C ; A = A + X ; if ( ( ( A ^ B ) == X ) ) { return " Yes " ; } else { return " No " ; } } } else { return " No " ; } } int main ( ) { int N = 3 , S = 10 , X = 4 ; cout << findIfPossible ( N , S , X ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; string isPossible ( int arr [ ] , int n ) { int mini = INT_MAX ; for ( int i = 0 ; i < n ; i ++ ) mini = min ( mini , arr [ i ] ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == mini ) continue ; int Max = ( arr [ i ] + 1 ) / 2 - 1 ; if ( mini < 0 mini > Max ) return " No " ; } return " Yes " ; } int main ( ) { int arr [ ] = { 1 , 1 , 3 , 4 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << isPossible ( 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 gcdOfTwoNos ( int num1 , int num2 ) { if ( num1 == 0 ) return num2 ; if ( num2 == 0 ) return num1 ; if ( num1 == num2 ) return num1 ; if ( num1 > num2 ) return gcdOfTwoNos ( num1 - num2 , num2 ) ; return gcdOfTwoNos ( num1 , num2 - num1 ) ; } int Min_sum ( int arr [ ] , int N ) { int min_sum = 1000000 , maxGcd = 1 ; for ( int i = 0 ; i < N ; i ++ ) { int gcd ; if ( i == 0 ) gcd = arr [ 1 ] ; else { gcd = arr [ i - 1 ] ; } for ( int j = 0 ; j < N ; j ++ ) { if ( j != i ) gcd = gcdOfTwoNos ( gcd , arr [ j ] ) ; } int c = arr [ i ] ; if ( gcd > maxGcd ) maxGcd = gcd ; } return maxGcd ; } int main ( ) { int arr [ ] = { 16 , 5 , 10 , 25 } ; int N = sizeof ( arr ) / sizeof ( int ) ; cout << Min_sum ( arr , N ) ; 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 ; int countOddIntegers ( int arr [ ] , int N ) { int Fact [ N ] = { } ; Fact [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) { Fact [ i ] = i * Fact [ i - 1 ] ; } int freq [ 10 ] = { } ; for ( int i = 0 ; i < N ; i ++ ) { freq [ arr [ i ] ] ++ ; } int ans = 0 ; for ( int i = 1 ; i <= 9 ; i += 2 ) { if ( ! freq [ i ] ) continue ; freq [ i ] -- ; for ( int j = 1 ; j <= 9 ; j ++ ) { int cur_ans = 0 ; if ( freq [ j ] == 0 ) { continue ; } freq [ j ] -- ; cur_ans = Fact [ N - 2 ] ; for ( int k = 0 ; k <= 9 ; k ++ ) { cur_ans = cur_ans / Fact [ freq [ k ] ] ; } ans += cur_ans ; freq [ j ] ++ ; } freq [ i ] ++ ; } return ans ; } int main ( ) { int A [ ] = { 2 , 3 , 4 , 1 , 2 , 3 } ; int N = sizeof ( A ) / sizeof ( int ) ; cout << countOddIntegers ( A , N ) ; return 0 ; }

Index/key variables: N, i, j, k
Accumulator variables: ans, i, j, k, stdc
Iterator variables: i, j, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sumOfDigits ( int N ) { int sum = 0 ; while ( N ) { sum += ( N % 10 ) ; N = N / 10 ; } return sum ; } int CountPair ( int arr [ ] , int n ) { unordered_map < int , int > mp ; for ( int i = 0 ; i < n ; i ++ ) { int val = arr [ i ] + sumOfDigits ( arr [ i ] ) ; mp [ val ] ++ ; } int count = 0 ; for ( auto x : mp ) { int val = x . first ; int times = x . second ; count += ( ( times * ( times - 1 ) ) / 2 ) ; } return count ; } int main ( ) { int arr [ ] = { 105 , 96 , 20 , 2 , 87 , 96 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << CountPair ( arr , N ) ; return 0 ; }

Index/key variables: i, val
Accumulator variables: count, i, stdc, sum
Iterator variables: i, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; void build_tree ( int * b , vector < int > & seg_tree , int l , int r , int vertex ) { if ( l == r ) { seg_tree [ vertex ] = b [ l ] ; return ; } int mid = ( l + r ) / 2 ; build_tree ( b , seg_tree , l , mid , 2 * vertex ) ; build_tree ( b , seg_tree , mid + 1 , r , 2 * vertex + 1 ) ; seg_tree [ vertex ] = __gcd ( seg_tree [ 2 * vertex ] , seg_tree [ 2 * vertex + 1 ] ) ; } int range_gcd ( vector < int > & seg_tree , int v , int tl , int tr , int l , int r ) { if ( l > r ) return 0 ; if ( l == tl && r == tr ) return seg_tree [ v ] ; int tm = ( tl + tr ) / 2 ; return __gcd ( range_gcd ( seg_tree , 2 * v , tl , tm , l , min ( tm , r ) ) , range_gcd ( seg_tree , 2 * v + 1 , tm + 1 , tr , max ( tm + 1 , l ) , r ) ) ; } void maxSubarrayLen ( int arr [ ] , int n ) { vector < int > seg_tree ( 4 * ( n ) + 1 , 0 ) ; build_tree ( arr , seg_tree , 0 , n - 1 , 1 ) ; int maxLen = 0 ; int l = 0 , r = 0 ; while ( r < n && l < n ) { if ( range_gcd ( seg_tree , 1 , 0 , n - 1 , l , r ) == 1 ) { l ++ ; } maxLen = max ( maxLen , r - l + 1 ) ; r ++ ; } cout << maxLen ; } int main ( ) { int arr [ ] = { 410 , 52 , 51 , 180 , 222 , 33 , 33 } ; int N = sizeof ( arr ) / sizeof ( int ) ; maxSubarrayLen ( arr , N ) ; return 0 ; }

Index/key variables: l, v, vertex
Accumulator variables: l, r, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findAandB ( int N ) { int K = log2 ( N ) ; int B = ( 1 << K ) ; int A = B ^ N ; cout << A << ' ▁ ' << B ; } int main ( ) { int N = 26 ; findAandB ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findValuesOfK ( int g ) { int count = 0 ; for ( int i = 1 ; i * i <= g ; i ++ ) { if ( g % i == 0 ) { if ( i != g / i ) { if ( i & 1 ) { count ++ ; } if ( ( g / i ) & 1 ) { count ++ ; } } else if ( i & 1 ) { count ++ ; } } } cout << count ; } int main ( ) { int G = 125 ; findValuesOfK ( G ) ; return 0 ; }

Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; double Avgdifference ( double arr [ ] , int N , int K ) { double sum = 0 ; for ( int i = 0 ; i < K ; i ++ ) sum += arr [ i ] ; double min = sum ; double max = sum ; for ( int i = K ; i <= N - K + 1 ; i ++ ) { sum += arr [ i ] - arr [ i - K ] ; if ( min > sum ) min = sum ; if ( max < sum ) max = sum ; } return ( max - min ) / K ; } int main ( ) { double arr [ ] = { 3 , 8 , 9 , 15 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int K = 2 ; cout << Avgdifference ( arr , N , K ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findSet ( int N , int K ) { vector < int > a ; for ( int i = 1 ; i <= N ; i ++ ) { if ( i != K ) a . push_back ( i ) ; } int MaxDistinct = ( N - K ) + ( K / 2 ) ; reverse ( a . begin ( ) , a . end ( ) ) ; for ( int i = 0 ; i < MaxDistinct ; i ++ ) cout << a [ i ] << " ▁ " ; } int main ( ) { int N = 5 , K = 3 ; findSet ( N , K ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; long long ExtendedEuclidAlgo ( long long a , long long b , long long & x , long long & y ) { if ( b == 0 ) { x = 1 ; y = 0 ; return a ; } else { long long x1 , y1 ; long long gcd = ExtendedEuclidAlgo ( b , a % b , x1 , y1 ) ; x = y1 ; y = x1 - floor ( a / b ) * y1 ; return gcd ; } } void linearCongruence ( long long A , long long B , long long N ) { A = A % N ; B = B % N ; long long u = 0 , v = 0 ; long long d = ExtendedEuclidAlgo ( A , N , u , v ) ; if ( B % d != 0 ) { cout << -1 << endl ; return ; } long long x0 = ( u * ( B / d ) ) % N ; if ( x0 < 0 ) x0 += N ; for ( long long i = 0 ; i <= d - 1 ; i ++ ) cout << ( x0 + i * ( N / d ) ) % N << " ▁ " ; } int main ( ) { long long A = 15 ; long long B = 9 ; long long N = 18 ; linearCongruence ( A , B , N ) ; return 0 ; }

Accumulator variables: i, stdc, x0
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int factorialWithoutMul ( int N ) { int ans = N ; for ( int i = N - 1 ; i > 0 ; i -- ) { int sum = 0 ; for ( int j = 0 ; j < i ; j ++ ) sum += ans ; ans = sum ; } return ans ; } int main ( ) { int N = 5 ; cout << factorialWithoutMul ( N ) << endl ; return 0 ; }

Accumulator variables: i, j, stdc, sum
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void tripletAndSum ( int arr [ ] , int n ) { int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { for ( int k = j + 1 ; k < n ; k ++ ) { ans += arr [ i ] & arr [ j ] & arr [ k ] ; } } } cout << ans ; } int main ( ) { int arr [ ] = { 3 , 5 , 4 , 7 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; tripletAndSum ( arr , N ) ; return 0 ; }

Index/key variables: i, j, k
Accumulator variables: ans, i, j, k, stdc
Iterator variables: i, j, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; int tripletAndSum ( int arr [ ] , int n ) { int ans = 0 ; for ( int bit = 0 ; bit < 32 ; bit ++ ) { int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] & ( 1 << bit ) ) cnt ++ ; } ans += ( 1 << bit ) * cnt * ( cnt - 1 ) * ( cnt - 2 ) / 6 ; } return ans ; } int main ( ) { int arr [ ] = { 3 , 5 , 4 , 7 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << tripletAndSum ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: ans, bit, cnt, i, stdc
Iterator variables: bit, i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void smallestPermutation ( int arr [ ] , int N ) { vector < bool > w ( 2 * N + 1 ) ; for ( int i = 0 ; i < N ; i ++ ) { w [ arr [ i ] ] = true ; } set < int > S ; for ( int i = 1 ; i <= 2 * N ; i ++ ) { if ( ! w [ i ] ) S . insert ( i ) ; } bool found = true ; vector < int > P ; for ( int i = 0 ; i < N ; i ++ ) { auto it = S . lower_bound ( arr [ i ] ) ; if ( it == S . end ( ) ) { found = false ; break ; } P . push_back ( arr [ i ] ) ; P . push_back ( * it ) ; S . erase ( it ) ; } if ( ! found ) { cout << " - 1 STRNEWLINE " ; } else { for ( int i = 0 ; i < 2 * N ; i ++ ) cout << P [ i ] << " ▁ " ; } } int main ( ) { int arr [ ] = { 4 , 1 , 3 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; smallestPermutation ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
Boolean variables: found
C++ program:
#include <bits/stdc++.h>
using namespace std ; void maximumSubsequenceSum ( int A [ ] , int N ) { int ans = 0 ; map < int , int > mp ; for ( int i = 0 ; i < N ; i ++ ) { mp [ A [ i ] - i ] += A [ i ] ; ans = max ( ans , mp [ A [ i ] - i ] ) ; } cout << ans << endl ; } int main ( ) { int A [ ] = { 10 , 7 , 1 , 9 , 10 , 1 } ; int N = sizeof ( A ) / sizeof ( A [ 0 ] ) ; maximumSubsequenceSum ( A , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void nearestPerfectSquare ( int arr [ ] , int N ) { for ( int i = 0 ; i < N ; i ++ ) { int sr = sqrt ( arr [ i ] ) ; int a = sr * sr ; int b = ( sr + 1 ) * ( sr + 1 ) ; if ( ( arr [ i ] - a ) < ( b - arr [ i ] ) ) cout << a << " ▁ " ; else cout << b << " ▁ " ; } } int main ( ) { int arr [ ] = { 5 , 2 , 7 , 13 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; nearestPerfectSquare ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool prime [ 100001 ] ; void SieveOfEratosthenes ( int n ) { 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 ; } } } void NumberofSets ( int N ) { SieveOfEratosthenes ( N ) ; if ( N == 2 ) { cout << 1 << endl ; } else if ( N == 3 ) { cout << 2 << endl ; } else { int ans = 1 ; for ( int i = N / 2 + 1 ; i <= N ; i ++ ) { if ( prime [ i ] ) { ans += 1 ; } } cout << ans << endl ; } } int main ( ) { int N = 9 ; NumberofSets ( N ) ; return 0 ; }

Index/key variables: i, p
Accumulator variables: ans, i, p, stdc
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; int floorDifference ( int A [ ] , int N , int X ) { int totalSum = 0 ; int perElementSum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { totalSum += A [ i ] ; perElementSum += A [ i ] / X ; } int totalFloorSum = totalSum / X ; return abs ( totalFloorSum - perElementSum ) ; } int main ( ) { int A [ ] = { 1 , 2 , 3 , 4 , 5 , 6 } ; int X = 4 ; int N = sizeof ( A ) / sizeof ( A [ 0 ] ) ; cout << floorDifference ( A , N , X ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, perElementSum, stdc, totalSum
Iterator variables: i