dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPalindrome ( string str , int l , int r ) { while ( l < r ) { if ( str [ l ] != str [ r ] ) return false ; l ++ ; r -- ; } return true ; } int CyclicShifts ( string str ) { int n = str . length ( ) ; int left = 0 ; int right = n - 1 ; str = str + str ; int cnt = 0 ; while ( right < 2 * n - 1 ) { if ( isPalindrome ( str , left , right ) ) break ; cnt ++ ; left ++ ; right ++ ; } return cnt ; } int main ( ) { string str = " bccbbaab " ; cout << CyclicShifts ( str ) ; return 0 ; }

Index/key variables: l, r
Accumulator variables: cnt, l, left, r, right, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; string printString ( int n , string str ) { string str2 = " " ; int extraChar = n % 26 ; if ( extraChar >= 1 ) { for ( int i = 26 - ( extraChar + 1 ) ; i <= 25 ; i ++ ) str2 += str [ i ] ; } int countOfStr = n / 26 ; for ( int i = 1 ; i <= countOfStr ; i ++ ) { for ( int j = 0 ; j < 26 ; j ++ ) str2 += str [ j ] ; } return str2 ; } int main ( ) { int n = 30 ; string str = " zyxwvutsrqponmlkjihgfedcba " ; cout << printString ( n , str ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc, str2
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; string commonPrefixUtil ( string str1 , string str2 ) { string result ; int n1 = str1 . length ( ) , n2 = str2 . length ( ) ; for ( int i = 0 , j = 0 ; i <= n1 - 1 && j <= n2 - 1 ; i ++ , j ++ ) { if ( str1 [ i ] != str2 [ j ] ) break ; result . push_back ( str1 [ i ] ) ; } return ( result ) ; } void commonPrefix ( string arr [ ] , int n ) { sort ( arr , arr + n ) ; cout << commonPrefixUtil ( arr [ 0 ] , arr [ n - 1 ] ) ; } int main ( ) { string arr [ ] = { " geeksforgeeks " , " geeks " , " geek " , " geezer " } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; commonPrefix ( arr , n ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string multiply ( string num1 , string num2 ) { int n1 = num1 . size ( ) ; int n2 = num2 . size ( ) ; if ( n1 == 0 n2 == 0 ) return "0" ; vector < int > result ( n1 + n2 , 0 ) ; int i_n1 = 0 ; int i_n2 = 0 ; for ( int i = n1 - 1 ; i >= 0 ; i -- ) { int carry = 0 ; int n1 = num1 [ i ] - '0' ; i_n2 = 0 ; for ( int j = n2 - 1 ; j >= 0 ; j -- ) { int n2 = num2 [ j ] - '0' ; int sum = n1 * n2 + result [ i_n1 + i_n2 ] + carry ; carry = sum / 10 ; result [ i_n1 + i_n2 ] = sum % 10 ; i_n2 ++ ; } if ( carry > 0 ) result [ i_n1 + i_n2 ] += carry ; i_n1 ++ ; } int i = result . size ( ) - 1 ; while ( i >= 0 && result [ i ] == 0 ) i -- ; if ( i == -1 ) return "0" ; string s = " " ; while ( i >= 0 ) s += std :: to_string ( result [ i -- ] ) ; return s ; } int main ( ) { string str1 = "454545454545454545" ; cout << multiply ( str1 , str1 ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, i_n1, i_n2, j, s, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void countDigits ( string st , int n ) { if ( n > 0 ) { int cnt = 1 , i ; string st2 = " " ; for ( i = 1 ; i < st . length ( ) ; i ++ ) { if ( st [ i ] == st [ i - 1 ] ) cnt ++ ; else { st2 += ( '0' + cnt ) ; st2 += st [ i - 1 ] ; cnt = 1 ; } } st2 += ( '0' + cnt ) ; st2 += st [ i - 1 ] ; countDigits ( st2 , -- n ) ; } else cout << st ; } int main ( ) { string num = "123" ; int n = 3 ; countDigits ( num , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: cnt, i, st2, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void generateSubsequences ( string input , string output , int idx , vector < string > & ans ) { if ( input [ idx ] == ' \0' ) { if ( output . size ( ) ) ans . push_back ( output ) ; return ; } generateSubsequences ( input , output , idx + 1 , ans ) ; output += input [ idx ] ; generateSubsequences ( input , output , idx + 1 , ans ) ; output . pop_back ( ) ; char upper = input [ idx ] ; upper = toupper ( upper ) ; output += upper ; generateSubsequences ( input , output , idx + 1 , ans ) ; } void printSubsequences ( string S ) { string output ; vector < string > ans ; generateSubsequences ( S , output , 0 , ans ) ; sort ( ans . begin ( ) , ans . end ( ) ) ; for ( auto str : ans ) cout << str << " ▁ " ; } int main ( ) { string S = " ab " ; printSubsequences ( S ) ; return 0 ; }

Index/key variables: idx
Accumulator variables: output, stdc
Iterator variables: str
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool match_words ( string dictionary [ ] , string sentence [ ] , int n , int m ) { unordered_map < string , int > mp ; for ( int i = 0 ; i < n ; i ++ ) { mp [ dictionary [ i ] ] ++ ; } for ( int i = 0 ; i < m ; i ++ ) { if ( mp [ sentence [ i ] ] ) mp [ sentence [ i ] ] -= 1 ; else return false ; } return true ; } int main ( ) { string dictionary [ ] = { " find " , " a " , " geeks " , " all " , " for " , " on " , " geeks " , " answers " , " inter " } ; int n = sizeof ( dictionary ) / sizeof ( dictionary [ 0 ] ) ; string sentence [ ] = { " find " , " all " , " answers " , " on " , " geeks " , " for " , " geeks " } ; int m = sizeof ( sentence ) / sizeof ( sentence [ 0 ] ) ; if ( match_words ( dictionary , sentence , n , m ) ) 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 ; void printNum ( string s ) { int i = 0 , j = 0 , val = 0 ; map < int , int > mp ; val = ( s [ 0 ] - '0' ) * 100 + ( s [ 1 ] - '0' ) * 10 + ( s [ 2 ] - '0' ) ; mp [ val ] = 1 ; for ( i = 3 ; i < s . length ( ) ; i ++ ) { val = ( val % 100 ) * 10 + s [ i ] - '0' ; if ( mp . find ( val ) != mp . end ( ) ) { mp [ val ] = mp [ val ] + 1 ; } else { mp [ val ] = 1 ; } } for ( auto m : mp ) { int key = m . first ; int value = m . second ; if ( value > 1 ) cout << key << " ▁ - ▁ " << value << " ▁ times " << endl ; } } int main ( ) { string input = "123412345123456" ; printNum ( input ) ; }

Index/key variables: i, val
Accumulator variables: i, stdc
Iterator variables: i, m
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define int  long long
bool hasAllcodes ( string s , int k ) { unordered_set < string > us ; for ( int i = 0 ; i + k <= s . size ( ) ; i ++ ) { us . insert ( s . substr ( i , k ) ) ; } return us . size ( ) == 1 << k ; } signed main ( ) { string s = "00110110" ; int k = 2 ; if ( hasAllcodes ) { cout << " YES STRNEWLINE " ; } else { cout << " NO STRNEWLINE " ; } }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string addBinaryUtil ( string a , string b ) { string result = " " ; int s = 0 ; int i = a . size ( ) - 1 , j = b . size ( ) - 1 ; while ( i >= 0 j >= 0 s == 1 ) { s += ( ( i >= 0 ) ? a [ i ] - '0' : 0 ) ; s += ( ( j >= 0 ) ? b [ j ] - '0' : 0 ) ; result = char ( s % 2 + '0' ) + result ; s /= 2 ; i -- ; j -- ; } return result ; } string addBinary ( string arr [ ] , int n ) { string result = " " ; for ( int i = 0 ; i < n ; i ++ ) result = addBinaryUtil ( result , arr [ i ] ) ; return result ; } int main ( ) { string arr [ ] = { "1" , "10" , "11" } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << addBinary ( arr , n ) << endl ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, s, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void reverse ( char str [ ] , int start , int end ) { char temp ; while ( start <= end ) { temp = str [ start ] ; str [ start ] = str [ end ] ; str [ end ] = temp ; start ++ ; end -- ; } } void reverseletter ( char str [ ] , int start , int end ) { int wstart , wend ; for ( wstart = wend = start ; wend < end ; wend ++ ) { if ( str [ wend ] == ' ▁ ' ) continue ; while ( str [ wend ] != ' ▁ ' && wend <= end ) wend ++ ; wend -- ; reverse ( str , wstart , wend ) ; } } int main ( ) { char str [ 1000 ] = " Ashish ▁ Yadav ▁ Abhishek ▁ Rajput ▁ Sunil ▁ Pundir " ; reverseletter ( str , 0 , strlen ( str ) - 1 ) ; cout << str ; return 0 ; }

Index/key variables: end, start, wend
Accumulator variables: end, start, stdc, wend
Iterator variables: wstart
C++ program:
#include <bits/stdc++.h>
using namespace std ; void minimumFlip ( string s , int x , int y ) { s = s + s ; bool isOpposite = false ; if ( x > y ) { swap ( x , y ) ; isOpposite = true ; } int valClockwise = 0 ; char cur = s [ x ] ; for ( int i = x ; i <= y ; i ++ ) { if ( s [ i ] != cur ) { cur = s [ i ] ; valClockwise ++ ; } } int valAnticlockwise = 0 ; cur = s [ y ] ; x += s . length ( ) ; for ( int i = y ; i <= x ; i ++ ) { if ( s [ i ] != cur ) { cur = s [ i ] ; valAnticlockwise ++ ; } } if ( valClockwise <= valAnticlockwise ) { if ( ! isOpposite ) cout << " Clockwise ▁ " << valClockwise << endl ; else cout << " Anti - clockwise ▁ " << valAnticlockwise << endl ; } else { if ( ! isOpposite ) cout << " Anti - clockwise ▁ " << valAnticlockwise << endl ; else cout << " Clockwise ▁ " << valClockwise << endl ; } } int main ( ) { int x = 0 , y = 8 ; string s = "000110" ; minimumFlip ( s , x , y ) ; return 0 ; }

Index/key variables: i, x, y
Accumulator variables: i, stdc, valAnticlockwise, valClockwise, x
Iterator variables: i
Boolean variables: isOpposite
C++ program:
#include <bits/stdc++.h>
using namespace std ; int prefix ( string k , int n ) { int a = 0 , b = 0 , count = 0 ; int i = 0 ; int len = k . size ( ) ; for ( i = 0 ; i < len ; i ++ ) { if ( k [ i ] == ' a ' ) a ++ ; if ( k [ i ] == ' b ' ) b ++ ; if ( a > b ) { count ++ ; } } if ( count == 0 n == 1 ) { cout << count << endl ; return 0 ; } if ( count == len a - b == 0 ) { cout << count * n << endl ; return 0 ; } int n2 = n - 1 , count2 = 0 ; while ( n2 != 0 ) { for ( i = 0 ; i < len ; i ++ ) { if ( k [ i ] == ' a ' ) a ++ ; if ( k [ i ] == ' b ' ) b ++ ; if ( a > b ) { count2 ++ ; } } count += count2 ; n2 -- ; if ( count2 == 0 ) break ; if ( count2 == len ) { count += ( n2 * count2 ) ; break ; } count2 = 0 ; } return count ; } int main ( ) { string S = " aba " ; int N = 2 ; cout << prefix ( S , N ) << endl ; S = " baa " ; N = 3 ; cout << prefix ( S , N ) << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: a, b, count, count2, i, n2, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define N  20
int countPair ( char str [ N ] [ N ] , int n ) { int cnt [ 1 << 10 ] = { 0 } ; for ( int i = 0 ; i < n ; i ++ ) { int mask = 0 ; for ( int j = 0 ; str [ i ] [ j ] != ' \0' ; ++ j ) mask |= ( 1 << ( str [ i ] [ j ] - '0' ) ) ; cnt [ mask ] ++ ; } int ans = 0 ; for ( int m1 = 0 ; m1 <= 1023 ; m1 ++ ) for ( int m2 = 0 ; m2 <= 1023 ; m2 ++ ) if ( ( m1 m2 ) == 1023 ) { ans += ( ( m1 == m2 ) ? ( cnt [ m1 ] * ( cnt [ m1 ] - 1 ) ) : ( cnt [ m1 ] * cnt [ m2 ] ) ) ; } return ans / 2 ; } int main ( ) { int n = 5 ; char str [ ] [ N ] = { "129300455" , "5559948277" , "012334556" , "56789" , "123456879" } ; cout << countPair ( str , n ) << endl ; return 0 ; }

Index/key variables: N, i, j, m1, m2, mask
Accumulator variables: ans, i, m1, m2, mask, stdc
Iterator variables: i, j, m1, m2
C++ program:
#include <bits/stdc++.h>
#define mod  1000000007
#define max  1001
using namespace std ; long long int nCr [ 1003 ] [ 1003 ] ; void preComputeCoeff ( ) { for ( int i = 0 ; i < max ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { if ( j == 0 j == i ) nCr [ i ] [ j ] = 1 ; else nCr [ i ] [ j ] = ( nCr [ i - 1 ] [ j - 1 ] + nCr [ i - 1 ] [ j ] ) % mod ; } } } long long int computeStringCount ( int N ) { int n = N / 2 ; long long int ans = 0 ; for ( int i = 2 ; i <= n ; i += 2 ) ans = ( ans + ( ( nCr [ n ] [ i ] * nCr [ n ] [ i / 2 ] ) % mod ) ) % mod ; return ans ; } int main ( ) { preComputeCoeff ( ) ; int N = 3 ; cout << computeStringCount ( N ) << endl ; return 0 ; }

Index/key variables: i, j, n
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  100
void countSubsequence ( char s [ ] , int n ) { int cntG = 0 , cntF = 0 , result = 0 , C = 0 ; for ( int i = 0 ; i < n ; i ++ ) { switch ( s [ i ] ) { case ' G ' : cntG ++ ; result += C ; break ; case ' F ' : cntF ++ ; C += cntG ; break ; default : continue ; } } cout << result << endl ; } int main ( ) { char s [ ] = " GFGFG " ; int n = strlen ( s ) ; countSubsequence ( s , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: C, cntF, cntG, i, result, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string LexicographicalMaxString ( string str ) { string mx = " " ; for ( int i = 0 ; i < str . length ( ) ; ++ i ) mx = max ( mx , str . substr ( i ) ) ; return mx ; } int main ( ) { string str = " ababaa " ; cout << LexicographicalMaxString ( str ) ; return 0 ; }

Accumulator variables: stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string LexicographicalMaxString ( string str ) { char maxchar = ' a ' ; vector < int > index ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str [ i ] >= maxchar ) { maxchar = str [ i ] ; index . push_back ( i ) ; } } string maxstring = " " ; for ( int i = 0 ; i < index . size ( ) ; i ++ ) { if ( str . substr ( index [ i ] , str . length ( ) ) > maxstring ) { maxstring = str . substr ( index [ i ] , str . length ( ) ) ; } } return maxstring ; } int main ( ) { string str = " acbacbc " ; cout << LexicographicalMaxString ( str ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <iostream>
#include <algorithm>
#include <string>
using namespace std ; bool checkPalin ( string word ) { int n = word . length ( ) ; transform ( word . begin ( ) , word . end ( ) , word . begin ( ) , :: tolower ) ; for ( int i = 0 ; i < n ; i ++ , n -- ) if ( word [ i ] != word [ n - 1 ] ) return false ; return true ; } string longestPalin ( string str ) { str = str + " ▁ " ; string longestword = " " , word = " " ; int length , length1 = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char ch = str [ i ] ; if ( ch != ' ▁ ' ) word = word + ch ; else { length = word . length ( ) ; if ( checkPalin ( word ) && length > length1 ) { length1 = length ; longestword = word ; } word = " " ; } } return longestword ; } int main ( ) { string s = " My ▁ name ▁ is ▁ ava ▁ and ▁ i ▁ love " " ▁ Geeksforgeeks " ; if ( longestPalin ( s ) == " " ) cout << " No ▁ Palindrome " << " ▁ Word " ; else cout << longestPalin ( s ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, n
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isCommonBase ( string base , string s1 , string s2 ) { for ( int j = 0 ; j < s1 . length ( ) ; ++ j ) if ( base [ j % base . length ( ) ] != s1 [ j ] ) return false ; for ( int j = 0 ; j < s2 . length ( ) ; ++ j ) if ( base [ j % base . length ( ) ] != s2 [ j ] ) return false ; return true ; } int countCommonBases ( string s1 , string s2 ) { int n1 = s1 . length ( ) , n2 = s2 . length ( ) ; int count = 0 ; for ( int i = 1 ; i <= min ( n1 , n2 ) ; i ++ ) { string base = s1 . substr ( 0 , i ) ; if ( isCommonBase ( base , s1 , s2 ) ) count ++ ; } return count ; } int main ( ) { string s1 = " pqrspqrs " ; string s2 = " pqrspqrspqrspqrs " ; cout << countCommonBases ( s1 , s2 ) << endl ; return 0 ; }

Index/key variables: j
Accumulator variables: count, i, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; string findstring ( string s ) { int n = s . length ( ) ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( ( s . at ( i - 1 ) == '0' && s . at ( i + 1 ) == '0' ) ) { s . erase ( i , 1 ) ; i -- ; if ( i > 0 && s . at ( i - 1 ) == '0' ) i -- ; n = s . length ( ) ; } } return s ; } int main ( ) { cout << findstring ( "100100" ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPerfectSquareString ( string str ) { int sum = 0 ; int len = str . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) sum += ( int ) str [ i ] ; long double squareRoot = sqrt ( sum ) ; return ( ( squareRoot - floor ( squareRoot ) ) == 0 ) ; } int main ( ) { string str = " d " ; if ( isPerfectSquareString ( str ) ) cout << " Yes " ; else cout << " No " ; }

Index/key variables: i
Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int find_sub ( string s , int k ) { int len = s . length ( ) ; int lp = 0 , rp = 0 ; int ans = 0 ; int hash_char [ 26 ] = { 0 } ; for ( ; rp < len ; rp ++ ) { hash_char [ s [ rp ] - ' a ' ] ++ ; while ( hash_char [ s [ rp ] - ' a ' ] > k ) { hash_char [ s [ lp ] - ' a ' ] -- ; lp ++ ; } ans += rp - lp + 1 ; } return ans ; } int main ( ) { string s = " aaabb " ; int k = 2 ; cout << find_sub ( s , k ) << endl ; }

Index/key variables: lp, rp
Accumulator variables: ans, lp, rp, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool is_vow ( char c ) { return ( c == ' a ' ) || ( c == ' e ' ) || ( c == ' i ' ) || ( c == ' o ' ) || ( c == ' u ' ) ; } void removeVowels ( string str ) { printf ( " % c " , str [ 0 ] ) ; for ( int i = 1 ; str [ i ] ; i ++ ) if ( ( ! is_vow ( str [ i - 1 ] ) ) || ( ! is_vow ( str [ i ] ) ) ) printf ( " % c " , str [ i ] ) ; } int main ( ) { char str [ ] = " ▁ geeks ▁ for ▁ geeks " ; removeVowels ( str ) ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printNumbers ( int n , int d ) { string st = " " ; st += to_string ( d ) ; char ch = st [ 0 ] ; string p = " " ; p += ch ; for ( int i = 0 ; i <= n ; i ++ ) { st = " " ; st = st + to_string ( i ) ; int idx = st . find ( p ) ; if ( i == d idx != -1 ) cout << ( i ) << " ▁ " ; } } int main ( ) { int n = 100 , d = 5 ; printNumbers ( n , d ) ; }

Accumulator variables: i, p, st, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool transformString ( string & s ) { char ch = ' a ' ; if ( s . size ( ) < 26 ) return false ; for ( int i = 0 ; i < s . size ( ) ; i ++ ) { if ( int ( ch ) > int ( ' z ' ) ) break ; if ( s [ i ] <= ch ) { s [ i ] = ch ; ch = char ( int ( ch ) + 1 ) ; } } if ( ch <= ' z ' ) return false ; return true ; } int main ( ) { string str = " aaaaaaaaaaaaaaaaaaaaaaaaaa " ; if ( transformString ( str ) ) cout << str << endl ; else cout << " Not ▁ Possible " << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPanDigital ( string s ) { bool digits [ 10 ] = { false } ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) digits [ s [ i ] - '0' ] = true ; for ( int i = 0 ; i <= 9 ; i ++ ) if ( digits [ i ] == false ) return false ; return true ; } int countPandigitalPairs ( vector < string > & v ) { int pairs = 0 ; for ( int i = 0 ; i < v . size ( ) ; i ++ ) for ( int j = i + 1 ; j < v . size ( ) ; j ++ ) if ( isPanDigital ( v [ i ] + v [ j ] ) ) pairs ++ ; return pairs ; } int main ( ) { vector < string > v = { "123567" , "098234" , "14765" , "19804" } ; cout << countPandigitalPairs ( v ) << endl ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, pairs, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int pandigitalMask = ( ( 1 << 10 ) - 1 ) ; void computeMaskFrequencies ( vector < string > v , map < int , int > & freq ) { for ( int i = 0 ; i < v . size ( ) ; i ++ ) { int mask = 0 ; unordered_set < int > digits ; for ( int j = 0 ; j < v [ i ] . size ( ) ; j ++ ) digits . insert ( v [ i ] [ j ] - '0' ) ; for ( auto it = digits . begin ( ) ; it != digits . end ( ) ; it ++ ) { int digit = ( * it ) ; mask += ( 1 << digit ) ; } freq [ mask ] ++ ; } } int pandigitalConcatenations ( map < int , int > freq ) { int ans = 0 ; for ( int i = 1 ; i <= 1023 ; i ++ ) { for ( int j = 1 ; j <= 1023 ; j ++ ) { if ( ( i j ) == pandigitalMask ) { if ( i == j ) ans += ( freq [ i ] * ( freq [ i ] - 1 ) ) ; else ans += ( freq [ i ] * freq [ j ] ) ; } } } return ans / 2 ; } int countPandigitalPairs ( vector < string > v ) { map < int , int > freq ; computeMaskFrequencies ( v , freq ) ; return pandigitalConcatenations ( freq ) ; } int main ( ) { vector < string > v = { "123567" , "098234" , "14765" , "19804" } ; cout << countPandigitalPairs ( v ) << endl ; return 0 ; }

Index/key variables: i, j, mask
Accumulator variables: ans, i, it, j, mask, stdc
Iterator variables: i, it, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MAX = 256 ; void printPalindromePos ( string & str ) { vector < int > pos [ MAX ] ; int n = str . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) pos [ str [ i ] ] . push_back ( i + 1 ) ; int oddCount = 0 ; char oddChar ; for ( int i = 0 ; i < MAX ; i ++ ) { if ( pos [ i ] . size ( ) % 2 != 0 ) { oddCount ++ ; oddChar = i ; } } if ( oddCount > 1 ) cout << " NO ▁ PALINDROME " ; for ( int i = 0 ; i < MAX ; i ++ ) { int mid = pos [ i ] . size ( ) / 2 ; for ( int j = 0 ; j < mid ; j ++ ) cout << pos [ i ] [ j ] << " ▁ " ; } if ( oddCount > 0 ) { int last = pos [ oddChar ] . size ( ) - 1 ; cout << pos [ oddChar ] [ last ] << " ▁ " ; pos [ oddChar ] . pop_back ( ) ; } for ( int i = MAX - 1 ; i >= 0 ; i -- ) { int count = pos [ i ] . size ( ) ; for ( int j = count / 2 ; j < count ; j ++ ) cout << pos [ i ] [ j ] << " ▁ " ; } } int main ( ) { string s = " geeksgk " ; printPalindromePos ( s ) ; return 0 ; }

Index/key variables: MAX, i, j, last, oddChar
Accumulator variables: i, j, oddCount, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MAX_CHAR = 26 ; int minChanges ( string & str ) { int n = str . length ( ) ; if ( n > MAX_CHAR ) return -1 ; int dist_count = 0 ; int count [ MAX_CHAR ] = { 0 } ; for ( int i = 0 ; i < n ; i ++ ) { if ( count [ str [ i ] - ' a ' ] == 0 ) dist_count ++ ; count [ ( str [ i ] - ' a ' ) ] ++ ; } return ( n - dist_count ) ; } int main ( ) { string str = " aebaecedabbee " ; cout << minChanges ( str ) ; return 0 ; }

Index/key variables: MAX_CHAR, i
Accumulator variables: dist_count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { string c ; struct Node * next ; } ; struct Node * newNode ( string c ) { Node * temp = new Node ; temp -> c = c ; temp -> next = NULL ; return temp ; } ; void reverse_word ( string & str ) { reverse ( str . begin ( ) , str . end ( ) ) ; } void reverse ( struct Node * head ) { struct Node * ptr = head ; while ( ptr != NULL ) { reverse_word ( ptr -> c ) ; ptr = ptr -> next ; } } void printList ( struct Node * head ) { while ( head != NULL ) { cout << head -> c << " ▁ " ; head = head -> next ; } } int main ( ) { Node * head = newNode ( " Geeksforgeeks " ) ; head -> next = newNode ( " a " ) ; head -> next -> next = newNode ( " computer " ) ; head -> next -> next -> next = newNode ( " science " ) ; head -> next -> next -> next -> next = newNode ( " portal " ) ; head -> next -> next -> next -> next -> next = newNode ( " for " ) ; head -> next -> next -> next -> next -> next -> next = newNode ( " geeks " ) ; cout << " List ▁ before ▁ reverse : ▁ STRNEWLINE " ; printList ( head ) ; reverse ( head ) ; cout << " List after reverse : " ; printList ( head ) ; return 0 ; }

Accumulator variables: stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; int numofstring ( int n , int m ) { if ( n == 1 ) return m ; if ( n == 2 ) return m * ( m - 1 ) ; return m * ( m - 1 ) * pow ( m - 2 , n - 2 ) ; } int main ( ) { int n = 2 , m = 3 ; cout << numofstring ( n , m ) << endl ; return 0 ; }

Accumulator variables: stdc