dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <algorithm>
#include <bits/stdc++.h>
using namespace std ; long squareSeries ( long n ) { return ( n * ( n + 1 ) * ( 2 * n + 1 ) ) / 6 ; } long maxPeople ( long n ) { long low = 0 ; long high = 1000000L ; long ans = 0L ; while ( low <= high ) { long mid = low + ( ( high - low ) / 2 ) ; long value = squareSeries ( mid ) ; if ( value <= n ) { ans = mid ; low = mid + 1 ; } else { high = mid - 1 ; } } return ans ; } int main ( ) { long p = 14 ; cout << maxPeople ( p ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findIndex ( int a [ ] , int n , int k ) { int index = -1 , max_ceil = INT_MIN ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = ( a [ i ] + k - 1 ) / k ; } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] >= max_ceil ) { max_ceil = a [ i ] ; index = i ; } } return index ; } int main ( ) { int arr [ ] = { 31 , 12 , 25 , 27 , 32 , 19 } ; int K = 5 ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << findIndex ( arr , N , K ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAXN  60
int solveQuery ( int L , int X ) { int res ; int a [ MAXN ] , b [ L ] ; int ref = X , size_a = 0 ; while ( ref > 0 ) { a [ size_a ] = ref % 2 ; ref /= 2 ; size_a ++ ; } for ( int i = 0 ; i < min ( size_a , L ) ; i ++ ) { if ( a [ i ] == 1 ) b [ i ] = 0 ; else b [ i ] = 1 ; } for ( int i = min ( size_a , L ) ; i < L ; i ++ ) b [ i ] = 1 ; b [ L - 1 ] = 1 ; int temp = 0 , p = 1 ; for ( int i = 0 ; i < L ; i ++ ) { temp += b [ i ] * p ; p *= 2 ; } res = temp ^ X ; return res ; } int main ( ) { int queries [ ] [ 2 ] = { { 2 , 5 } , { 3 , 15 } } ; int q = sizeof ( queries ) / sizeof ( queries [ 0 ] ) ; for ( int i = 0 ; i < q ; i ++ ) cout << solveQuery ( queries [ i ] [ 0 ] , queries [ i ] [ 1 ] ) << endl ; return 0 ; }

Index/key variables: L, MAXN, i, size_a
Accumulator variables: i, p, ref, size_a, stdc, temp
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Count_Segment ( int p [ ] , int n ) { int count = 0 ; int upto [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) upto [ i ] = 0 ; int j = 0 , curr = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { if ( p [ i ] > p [ i - 1 ] and p [ i ] > p [ i + 1 ] ) { curr = p [ i ] ; j = i - 1 ; while ( j >= 0 and p [ j ] < curr ) { upto [ p [ j ] ] = curr ; j -= 1 ; } j = i + 1 ; while ( j < n and p [ j ] < curr ) { if ( upto [ curr - p [ j ] ] == curr ) count += 1 ; j += 1 ; } } } return count ; } int main ( ) { int p [ ] = { 3 , 4 , 1 , 5 , 2 } ; int n = sizeof ( p ) / sizeof ( p [ 0 ] ) ; cout << ( Count_Segment ( p , n ) ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: count, i, j, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int closetAND ( int arr [ ] , int n , int k ) { int ans = INT_MAX ; for ( int i = 0 ; i < n ; i ++ ) { int X = arr [ i ] ; for ( int j = i ; j < n ; j ++ ) { X &= arr [ j ] ; ans = min ( ans , abs ( k - X ) ) ; } } return ans ; } int main ( ) { int arr [ ] = { 4 , 7 , 10 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int k = 2 ; cout << closetAND ( arr , n , k ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: X, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; float Rate ( int N1 , int N2 ) { float rate = ( N2 - N1 ) * 100 / float ( N1 ) ; return rate ; } int main ( ) { int N1 = 100 , N2 = 120 ; cout << Rate ( N1 , N2 ) << " ▁ % " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getPrime ( int arr [ ] , int n ) { int max_val = * max_element ( arr , arr + n ) ; vector < bool > prime ( max_val + 1 , true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= max_val ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= max_val ; i += p ) prime [ i ] = false ; } } int maximum = -1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime [ arr [ i ] ] ) maximum = max ( maximum , arr [ i ] ) ; } return maximum ; } int main ( ) { int arr [ ] = { 2 , 10 , 15 , 7 , 6 , 8 , 13 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << getPrime ( arr , n ) ; return 0 ; }

Index/key variables: i, p
Accumulator variables: i, p, stdc
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; long getMinNum ( int N ) { int lcm = 1 ; for ( int i = 2 ; i <= N ; i ++ ) lcm = ( ( i * lcm ) / ( __gcd ( i , lcm ) ) ) ; return ( lcm + 1 ) ; } int main ( ) { int N = 5 ; cout << getMinNum ( N ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maxEdges ( int N ) { int edges = 0 ; edges = floor ( ( N * N ) / 4 ) ; return edges ; } int main ( ) { int N = 5 ; cout << maxEdges ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isSafe ( int N , int M , string str ) { int coll = 0 , colr = 0 , rowu = 0 , rowd = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str [ i ] == ' L ' ) { coll ++ ; if ( colr > 0 ) { colr -- ; } if ( coll == M ) { break ; } } else if ( str [ i ] == ' R ' ) { colr ++ ; if ( coll > 0 ) { coll -- ; } if ( colr == M ) { break ; } } else if ( str [ i ] == ' U ' ) { - rowu ++ ; if ( rowd > 0 ) { rowd -- ; } if ( rowu == N ) { break ; } } else if ( str [ i ] == ' D ' ) { rowd ++ ; if ( rowu > 0 ) { rowu -- ; } if ( rowd == N ) { break ; } } } if ( abs ( rowd ) < N && abs ( rowu ) < N && abs ( coll ) < M && abs ( colr ) < M ) { return true ; } return false ; } int main ( ) { int N = 1 , M = 1 ; string str = " R " ; if ( isSafe ( N , M , str ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: i
Accumulator variables: coll, colr, i, rowd, rowu, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printAns ( int x , int y , int num ) { cout << " Indices ▁ in ▁ array ▁ " << num << " ▁ : ▁ " ; for ( int i = x ; i < y ; ++ i ) { cout << i << " , ▁ " ; } cout << y << " STRNEWLINE " ; } void findSubarray ( int N , int a [ ] , int b [ ] , bool swap ) { std :: map < int , pair < int , int > > index ; int difference ; index [ 0 ] = make_pair ( -1 , -1 ) ; int j = 0 ; for ( int i = 0 ; i < N ; ++ i ) { while ( b [ j ] < a [ i ] ) { j ++ ; } difference = b [ j ] - a [ i ] ; if ( index . find ( difference ) != index . end ( ) ) { if ( swap ) { pair < int , int > idx = index [ b [ j ] - a [ i ] ] ; printAns ( idx . second + 1 , j , 1 ) ; printAns ( idx . first + 1 , i , 2 ) ; } else { pair < int , int > idx = index [ b [ j ] - a [ i ] ] ; printAns ( idx . first + 1 , i , 1 ) ; printAns ( idx . second + 1 , j , 2 ) ; } return ; } index [ difference ] = make_pair ( i , j ) ; } cout << " - 1" ; } void cumulativeSum ( int arr [ ] , int n ) { for ( int i = 1 ; i < n ; ++ i ) arr [ i ] += arr [ i - 1 ] ; } int main ( ) { int a [ ] = { 1 , 2 , 3 , 4 , 5 } ; int b [ ] = { 6 , 2 , 1 , 5 , 4 } ; int N = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cumulativeSum ( a , N ) ; cumulativeSum ( b , N ) ; if ( b [ N - 1 ] > a [ N - 1 ] ) { findSubarray ( N , a , b , false ) ; } else { findSubarray ( N , b , a , true ) ; } return 0 ; }

Index/key variables: difference, i, j
Accumulator variables: j, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void Permutation ( int n , int k ) { int p [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) p [ i ] = i ; for ( int i = 1 ; i < n - k ; i ++ ) p [ i + 1 ] = i ; p [ 1 ] = n - k ; for ( int i = 1 ; i <= n ; i ++ ) cout << p [ i ] << " ▁ " ; } int main ( ) { int n = 5 , k = 2 ; Permutation ( n , k ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countOnes ( int arr [ ] , int N ) { for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = i ; j <= N ; j ++ ) { if ( j % i == 0 ) { if ( arr [ j - 1 ] == 0 ) else } } } int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) if ( arr [ i ] == 1 ) return count ; } int main ( ) { int arr [ 10 ] = { 0 } ; int ans = countOnes ( arr , N ) ; cout << ans ; return 0 ; }

Index/key variables: i
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int validPosition ( int arr [ ] , int N , int K ) { int count = 0 , sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += arr [ i ] ; } for ( int i = 0 ; i < N ; i ++ ) { if ( ( arr [ i ] + K ) > ( sum - arr [ i ] ) ) count ++ ; } return count ; } int main ( ) { int arr [ ] = { 2 , 1 , 6 , 7 } , K = 4 ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << validPosition ( arr , N , K ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void count_unique ( unordered_set < int > & s , int n ) { if ( s . count ( n ) ) return ; s . insert ( n ) ; n += 1 ; while ( n % 10 == 0 ) { n = n / 10 ; } count_unique ( s , n ) ; } int main ( ) { int n = 10 ; unordered_set < int > s ; count_unique ( s , n ) ; cout << s . size ( ) ; return 0 ; }

Accumulator variables: n, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; ; int maxBitElement ( int arr [ ] , int n ) { int num = 0 , max = -1 ; for ( int i = 0 ; i < n ; i ++ ) { int cnt = __builtin_popcount ( arr [ i ] ) ; if ( cnt > max ) { max = cnt ; num = arr [ i ] ; } } return num ; } int main ( ) { int arr [ ] = { 3 , 2 , 4 , 7 , 1 , 10 , 5 , 8 , 9 , 6 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << maxBitElement ( 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 ; const int N = 1000 ; int countPairs ( int arr [ ] , int n ) { int size = ( 2 * N ) + 1 ; int freq [ size ] = { 0 } ; for ( int i = 0 ; i < n ; i ++ ) { int x = arr [ i ] ; freq [ x + N ] ++ ; } int ans = 0 ; for ( int i = 0 ; i < size ; i ++ ) { if ( freq [ i ] > 0 ) { ans += ( ( freq [ i ] ) * ( freq [ i ] - 1 ) ) / 2 ; for ( int j = i + 2 ; j < 2001 ; j += 2 ) { if ( freq [ j ] > 0 && ( freq [ ( i + j ) / 2 ] > 0 ) ) { ans += ( freq [ i ] * freq [ j ] ) ; } } } } return ans ; } int main ( ) { int arr [ ] = { 4 , 2 , 5 , 1 , 3 , 5 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << countPairs ( arr , n ) ; return 0 ; }

Index/key variables: i, j, size
Accumulator variables: ans, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int smallestSum ( int n ) { if ( n == 1 ) return 0 ; return ( 2 * pow ( 10 , n - 1 ) ) ; } int largestSum ( int n ) { return ( 2 * ( pow ( 10 , n ) - 1 ) ) ; } int main ( ) { int n = 4 ; cout << " Largest ▁ = ▁ " << largestSum ( n ) << endl ; cout << " Smallest ▁ = ▁ " << smallestSum ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int count_pairs ( int a [ ] , int b [ ] , int n , int m ) { int odd1 = 0 , even1 = 0 ; int odd2 = 0 , even2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 ) odd1 ++ ; else even1 ++ ; } for ( int i = 0 ; i < m ; i ++ ) { if ( b [ i ] % 2 ) odd2 ++ ; else even2 ++ ; } int pairs = min ( odd1 , even2 ) + min ( odd2 , even1 ) ; return pairs ; } int main ( ) { int a [ ] = { 9 , 14 , 6 , 2 , 11 } ; int b [ ] = { 8 , 4 , 7 , 20 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; int m = sizeof ( b ) / sizeof ( b [ 0 ] ) ; cout << count_pairs ( a , b , n , m ) ; return 0 ; }

Index/key variables: i
Accumulator variables: even1, even2, i, odd1, odd2, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int find_leftmost_unsetbit ( int n ) { int ind = -1 ; int i = 1 ; while ( n ) { if ( ! ( n & 1 ) ) ind = i ; i ++ ; n >>= 1 ; } return ind ; } void perform_steps ( int n ) { int left = find_leftmost_unsetbit ( n ) ; if ( left == -1 ) { cout << " No ▁ steps ▁ required " ; return ; } int step = 1 ; while ( find_leftmost_unsetbit ( n ) != -1 ) { if ( step % 2 == 0 ) { n += 1 ; cout << " Step " << step << " : ▁ Increase ▁ by ▁ 1 STRNEWLINE " ; } else { int m = find_leftmost_unsetbit ( n ) ; int num = pow ( 2 , m ) - 1 ; n = n ^ num ; cout << " Step " << step << " : ▁ Xor ▁ with ▁ " << num << endl ; } step += 1 ; } } int main ( ) { int n = 39 ; perform_steps ( n ) ; return 0 ; }

Accumulator variables: i, n, stdc, step
C++ program:
#include <bits/stdc++.h>
using namespace std ; int vertices ( int N , int A , int B ) { int position = 0 ; int minisum = INT_MAX ; int sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( i == A i == B ) continue ; else { int x = abs ( i - A ) ; int y = abs ( i - B ) ; sum = x + y ; if ( sum < minisum ) { minisum = sum ; position = i ; } } } return position ; } int main ( ) { int N = 3 , A = 1 , B = 2 ; cout << " Vertex ▁ = ▁ " << vertices ( N , A , B ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <iostream>
#include <bits/stdc++.h>
using namespace std ; int factorial ( int n ) { int f = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { f *= i ; } return f ; } int sumFactorial ( int * arr , int n ) { int s = 0 , i ; for ( i = 0 ; i < n ; i ++ ) { s += factorial ( arr [ i ] ) ; } return s ; } int main ( ) { int arr [ ] = { 7 , 3 , 5 , 4 , 8 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << sumFactorial ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: f, i, s, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int ans = 0 ; vector < int > gr [ 100005 ] ; void Add_Edge ( int u , int v ) { gr [ u ] . push_back ( v ) ; gr [ v ] . push_back ( u ) ; } void dfs ( int child , int par , int color [ ] ) { if ( color [ child ] != color [ par ] ) ans ++ ; for ( auto it : gr [ child ] ) { if ( it == par ) continue ; dfs ( it , child , color ) ; } } int main ( ) { int color [ ] = { 0 , 1 , 2 , 3 , 2 , 2 , 3 } ; Add_Edge ( 1 , 2 ) ; Add_Edge ( 1 , 3 ) ; Add_Edge ( 2 , 4 ) ; Add_Edge ( 2 , 5 ) ; Add_Edge ( 3 , 6 ) ; dfs ( 1 , 0 , color ) ; cout << ans ; return 0 ; }

Index/key variables: child, par, u, v
Accumulator variables: ans, stdc
Iterator variables: it
C++ program:
#include <bits/stdc++.h>
using namespace std ; int highestPower ( string str , int len ) { int ans = 0 ; for ( int i = len - 1 ; i >= 0 ; i -- ) { if ( str [ i ] == '0' ) ans ++ ; else break ; } return ans ; } int main ( ) { string str = "100100" ; int len = str . length ( ) ; cout << highestPower ( str , len ) ; return 0 ; }

Index/key variables: i
Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long
#define mod  (ll)(1e9 + 7)
ll factorial ( ll n , ll p ) { for ( int i = 2 ; i <= n ; i ++ ) res = ( res * i ) % p ; return res ; } ll power ( ll x , ll y , ll p ) { while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } ll modInverse ( ll n , ll p ) { return power ( n , p - 2 , p ) ; } ll nCrModP ( ll n , ll r , ll p ) { if ( r == 0 ) return 1 ; ll fac [ n + 1 ] ; fac [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) fac [ i ] = fac [ i - 1 ] * i % p ; return ( fac [ n ] * modInverse ( fac [ r ] , p ) % p * modInverse ( fac [ n - r ] , p ) % p ) % p ; } ll countArrangements ( ll n , ll k , ll p ) { return ( factorial ( n , p ) * nCrModP ( k , n , p ) ) % p ; } int main ( ) { ll N = 5 , K = 8 ; cout << countArrangements ( N , K , mod ) ; return 0 ; }

Index/key variables: i, n, r
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maxProd ( int N ) { if ( N == 0 ) return 1 ; if ( N < 10 ) return N ; return max ( maxProd ( N / 10 ) * ( N % 10 ) , maxProd ( N / 10 - 1 ) * 9 ) ; } int main ( ) { int N = 390 ; cout << maxProd ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define N  2
#define M  3
bool check ( int mat [ N ] [ M ] ) { int xorr = 0 ; for ( int i = 0 ; i < N ; i ++ ) { xorr ^= mat [ i ] [ 0 ] ; } if ( xorr != 0 ) return true ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 1 ; j < M ; j ++ ) { if ( mat [ i ] [ j ] != mat [ i ] [ 0 ] ) return true ; } } return false ; } int main ( ) { int mat [ N ] [ M ] = { { 7 , 7 , 7 } , { 10 , 10 , 7 } } ; if ( check ( mat ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: M, N, i, j
Accumulator variables: i, j, stdc, xorr
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sumodd ( int n ) { return ( n * n ) ; } int sumeven ( int n ) { return ( n * ( n + 1 ) ) ; } int findSum ( int num ) { int sumo = 0 ; int sume = 0 ; int x = 1 ; int cur = 0 ; int ans = 0 ; while ( num > 0 ) { int inc = min ( x , num ) ; num -= inc ; if ( cur == 0 ) { ans = ans + sumodd ( sumo + inc ) - sumodd ( sumo ) ; sumo += inc ; } else { ans = ans + sumeven ( sume + inc ) - sumeven ( sume ) ; sume += inc ; } x *= 2 ; cur ^= 1 ; } return ans ; } int main ( ) { int n = 4 ; cout << findSum ( n ) ; return 0 ; }

Accumulator variables: cur, num, stdc, sume, sumo, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int oddTriangularNumber ( int N ) { return ( N * ( ( 2 * N ) - 1 ) ) ; } int main ( ) { int N = 3 ; cout << oddTriangularNumber ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void idstrt ( double a1 , double b1 , double c1 , double a2 , double b2 , double c2 ) { if ( ( a1 / a2 == b1 / b2 ) && ( a1 / a2 == c1 / c2 ) && ( b1 / b2 == c1 / c2 ) ) cout << " The ▁ given ▁ straight " << " ▁ lines ▁ are ▁ identical " << endl ; else cout << " The ▁ given ▁ straight " << " ▁ lines ▁ are ▁ not ▁ identical " << endl ; } int main ( ) { double a1 = -2 , b1 = 4 , c1 = 3 , a2 = -6 , b2 = 12 , c2 = 9 ; idstrt ( a1 , b1 , c1 , a2 , b2 , c2 ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long
#define MAXN  (ll)(1e5 + 1)
#define mod  (ll)(1e9 + 7)
ll spf [ MAXN ] ; map < ll , ll > cnt ; void sieve ( ) { spf [ 1 ] = 1 ; for ( int i = 2 ; i < MAXN ; i ++ ) spf [ i ] = i ; for ( int i = 4 ; i < MAXN ; i += 2 ) spf [ i ] = 2 ; for ( int i = 3 ; i * i < MAXN ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j < MAXN ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } void factorize ( ll f ) { while ( f > 1 ) { ll x = spf [ f ] ; while ( f % x == 0 ) { cnt [ x ] ++ ; f /= x ; } } } ll factorial ( ll n , ll p ) { ll res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = ( res * i ) % p ; return res ; } ll power ( ll x , ll y , ll p ) { ll res = 1 ; x = x % p ; while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } ll modInverse ( ll n , ll p ) { return power ( n , p - 2 , p ) ; } ll nCrModP ( ll n , ll r , ll p ) { if ( r == 0 ) return 1 ; ll fac [ n + 1 ] ; fac [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) fac [ i ] = fac [ i - 1 ] * i % p ; return ( fac [ n ] * modInverse ( fac [ r ] , p ) % p * modInverse ( fac [ n - r ] , p ) % p ) % p ; } ll countArrays ( ll arr [ ] , ll N , ll K , ll P ) { ll res = 1 ; sieve ( ) ; for ( int i = 0 ; i < N ; i ++ ) { factorize ( arr [ i ] ) ; } for ( auto i : cnt ) { int ci = i . second ; res = ( res * nCrModP ( ci + K - 1 , K - 1 , P ) ) % P ; } return res ; } int main ( ) { ll arr [ ] = { 1 , 3 , 5 , 2 } , K = 3 ; ll N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << countArrays ( arr , N , K , mod ) ; return 0 ; }

Index/key variables: MAXN, f, i, j, n, r, x
Accumulator variables: f, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long
#define MAXN  100000
#define MOD  1000000007
ll fact [ MAXN ] ; void factorial ( ) { fact [ 0 ] = 1 ; for ( int i = 1 ; i < MAXN ; i ++ ) fact [ i ] = ( fact [ i - 1 ] * i ) % MOD ; } ll power ( ll x , ll y , ll p ) { while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } ll modInverse ( ll x , ll p ) { return power ( x , p - 2 , p ) ; } ll countDifferentNumbers ( ll arr [ ] , ll P ) { factorial ( ) ; ll res = 0 , X = 0 ; for ( int i = 0 ; i < 10 ; i ++ ) X += arr [ i ] ; res = fact [ X ] ; for ( int i = 0 ; i < 10 ; i ++ ) { if ( arr [ i ] > 1 ) res = ( res * modInverse ( fact [ arr [ i ] ] , P ) ) % P ; } return res ; } int main ( ) { ll arr [ ] = { 1 , 0 , 2 , 0 , 0 , 7 , 4 , 0 , 0 , 3 } ; cout << countDifferentNumbers ( arr , MOD ) ; return 0 ; }

Index/key variables: MAXN, X, i
Accumulator variables: X, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define N  3
#define M  7
void printOriginalMatrix ( int a [ ] , int b [ ] , int mat [ N ] [ M ] ) { for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { if ( mat [ i ] [ j ] == 1 ) cout << min ( a [ i ] , b [ j ] ) << " ▁ " ; else cout << 0 << " ▁ " ; } cout << endl ; } } int main ( ) { int a [ ] = { 2 , 1 , 3 } ; int b [ ] = { 2 , 3 , 0 , 0 , 2 , 0 , 1 } ; int mat [ N ] [ M ] = { { 1 , 0 , 0 , 0 , 1 , 0 , 0 } , { 0 , 0 , 0 , 0 , 0 , 0 , 1 } , { 1 , 1 , 0 , 0 , 0 , 0 , 0 } } ; printOriginalMatrix ( a , b , mat ) ; return 0 ; }

Index/key variables: M, N, i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; float percent ( int n , int x ) { float p = n * x ; p /= 100 ; return p ; } float getLoss ( int price [ ] , int quantity [ ] , int X [ ] , int n ) { float loss = 0 ; for ( int i = 0 ; i < n ; i ++ ) { float originalPrice = price [ i ] ; float sellingPrice = originalPrice + percent ( originalPrice , X [ i ] ) ; float afterDiscount = sellingPrice - percent ( sellingPrice , X [ i ] ) ; loss += ( ( originalPrice - afterDiscount ) * quantity [ i ] ) ; } return loss ; } int main ( ) { int price [ ] = { 20 , 48 , 200 , 100 } ; int quantity [ ] = { 20 , 48 , 1 , 1 } ; int X [ ] = { 0 , 48 , 200 , 5 } ; int n = sizeof ( X ) / sizeof ( X [ 0 ] ) ; cout << getLoss ( price , quantity , X , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, loss, p, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maxAbsDiff ( int arr [ ] , int n ) { int minEle = arr [ 0 ] ; int maxEle = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { minEle = min ( minEle , arr [ i ] ) ; maxEle = max ( maxEle , arr [ i ] ) ; } return ( maxEle - minEle ) ; } int main ( ) { int arr [ ] = { 2 , 1 , 5 , 3 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << maxAbsDiff ( 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 maxSubArraySum ( int a [ ] , int size ) { int max_so_far = INT_MIN , max_ending_here = 0 ; for ( int i = 0 ; i < size ; i ++ ) { max_ending_here = max_ending_here + a [ i ] ; if ( max_so_far < max_ending_here ) max_so_far = max_ending_here ; if ( max_ending_here < 0 ) max_ending_here = 0 ; } return max_so_far ; } int maximizeSum ( int a [ ] , int n ) { int cnt = 0 ; int mini = INT_MAX ; int minSubarray = INT_MAX ; int sum = maxSubArraySum ( a , n ) ; int max_so_far = INT_MIN , max_ending_here = 0 ; for ( int i = 0 ; i < n ; i ++ ) { max_ending_here = max_ending_here + a [ i ] ; cnt ++ ; minSubarray = min ( a [ i ] , minSubarray ) ; if ( sum == max_ending_here ) { if ( cnt == 1 ) mini = min ( mini , 0 ) ; else mini = min ( mini , minSubarray ) ; } if ( max_ending_here < 0 ) { max_ending_here = 0 ; cnt = 0 ; minSubarray = INT_MAX ; } } return sum - mini ; } int main ( ) { int a [ ] = { 1 , 2 , 3 , -2 , 3 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << maximizeSum ( a , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: cnt, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isOsiris ( int n ) { int a = n % 10 ; int b = ( n / 10 ) % 10 ; int c = n / 100 ; int digit_sum = a + b + c ; if ( n == ( 2 * ( digit_sum ) * 11 ) ) { return true ; } return false ; } int main ( ) { int n = 132 ; if ( isOsiris ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: stdc