dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; void depthFirst ( int v , vector < int > graph [ ] , vector < bool > & visited , vector < int > & storeChain ) { visited [ v ] = true ; storeChain . push_back ( v ) ; for ( auto i : graph [ v ] ) { if ( visited [ i ] == false ) { depthFirst ( i , graph , visited , storeChain ) ; } } } void createMap ( unordered_map < string , char > * um ) { ( * um ) [ "000" ] = '0' ; ( * um ) [ "001" ] = '1' ; ( * um ) [ "010" ] = '2' ; ( * um ) [ "011" ] = '3' ; ( * um ) [ "100" ] = '4' ; ( * um ) [ "101" ] = '5' ; ( * um ) [ "110" ] = '6' ; ( * um ) [ "111" ] = '7' ; } string Octal ( string bin ) { int l = bin . size ( ) ; int t = bin . find_first_of ( ' . ' ) ; int len_left = t != -1 ? t : l ; for ( int i = 1 ; i <= ( 3 - len_left % 3 ) % 3 ; i ++ ) bin = '0' + bin ; if ( t != -1 ) { int len_right = l - len_left - 1 ; for ( int i = 1 ; i <= ( 3 - len_right % 3 ) % 3 ; i ++ ) bin = bin + '0' ; } unordered_map < string , char > bin_oct_map ; createMap ( & bin_oct_map ) ; int i = 0 ; string octal = " " ; while ( 1 ) { octal += bin_oct_map [ bin . substr ( i , 3 ) ] ; i += 3 ; if ( i == bin . size ( ) ) break ; if ( bin . at ( i ) == ' . ' ) { octal += ' . ' ; i ++ ; } } return octal ; } void octalValue ( vector < int > graph [ ] , int vertices , vector < int > values ) { vector < bool > visited ( 1001 , false ) ; for ( int i = 1 ; i <= vertices ; i ++ ) { if ( visited [ i ] == false ) { int sizeChain ; vector < int > storeChain ; depthFirst ( i , graph , visited , storeChain ) ; sizeChain = storeChain . size ( ) ; int chainValues [ sizeChain + 1 ] ; for ( int i = 0 ; i < sizeChain ; i ++ ) { int temp = values [ storeChain [ i ] - 1 ] ; chainValues [ i ] = temp ; } cout << " Chain ▁ = ▁ " ; for ( int i = 0 ; i < sizeChain ; i ++ ) { cout << chainValues [ i ] << " ▁ " ; } cout << " TABSYMBOL " ; stringstream ss ; ss << chainValues [ 0 ] ; string s = ss . str ( ) ; for ( int i = 1 ; i < sizeChain ; i ++ ) { stringstream ss1 ; ss1 << chainValues [ i ] ; string s1 = ss1 . str ( ) ; s . append ( s1 ) ; } cout << " Octal ▁ equivalent ▁ = ▁ " ; cout << Octal ( s ) << endl ; } } } int main ( ) { vector < int > graph [ 1001 ] ; int E , V ; E = 4 ; V = 7 ; vector < int > values ; values . push_back ( 0 ) ; values . push_back ( 1 ) ; values . push_back ( 0 ) ; values . push_back ( 0 ) ; values . push_back ( 0 ) ; values . push_back ( 1 ) ; values . push_back ( 1 ) ; graph [ 1 ] . push_back ( 2 ) ; graph [ 2 ] . push_back ( 1 ) ; graph [ 3 ] . push_back ( 4 ) ; graph [ 4 ] . push_back ( 3 ) ; graph [ 4 ] . push_back ( 5 ) ; graph [ 5 ] . push_back ( 4 ) ; graph [ 6 ] . push_back ( 7 ) ; graph [ 7 ] . push_back ( 6 ) ; octalValue ( graph , V , values ) ; return 0 ; }

Index/key variables: i, v
Accumulator variables: i, octal, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string build_binary_str ( int p , int q , int r ) { string ans = " " ; if ( q == 0 ) { if ( p != 0 && r != 0 ) { return " - 1" ; } else { if ( p ) { ans = string ( p + 1 , '0' ) ; } else { ans = string ( r + 1 , '1' ) ; } } } else { for ( int i = 1 ; i <= q + 1 ; i ++ ) { if ( i % 2 == 0 ) { ans += '0' ; } else { ans += '1' ; } } ans . insert ( 1 , string ( p , '0' ) ) ; ans . insert ( 0 , string ( r , '1' ) ) ; } return ans ; } int main ( ) { int p = 1 , q = 2 , r = 2 ; cout << build_binary_str ( p , q , r ) ; return 0 ; }

Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool check ( string s ) { bool ok = true ; for ( int i = 0 ; i + 1 < s . size ( ) ; ++ i ) ok &= ( abs ( s [ i ] - s [ i + 1 ] ) != 1 ) ; return ok ; } string monotonousString ( string s ) { string odd = " " , even = " " ; for ( int i = 0 ; i < s . size ( ) ; ++ i ) { if ( s [ i ] % 2 == 0 ) odd += s [ i ] ; else even += s [ i ] ; } sort ( odd . begin ( ) , odd . end ( ) ) ; sort ( even . begin ( ) , even . end ( ) ) ; if ( check ( odd + even ) ) return " Yes " ; else if ( check ( even + odd ) ) return " Yes " ; return " No " ; } int main ( ) { string str = " abcd " ; string ans ; ans = monotonousString ( str ) ; cout << ans << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: even, odd, ok, stdc
Iterator variables: i
Boolean variables: ok
C++ program:
#include <bits/stdc++.h>
using namespace std ; int get_index ( char ch ) { if ( ch == ' a ' ) return 0 ; else if ( ch == ' e ' ) return 1 ; else if ( ch == ' i ' ) return 2 ; else if ( ch == ' o ' ) return 3 ; else if ( ch == ' u ' ) return 4 ; else return -1 ; } int findMinLength ( string s ) { int n = s . size ( ) ; int ans = n + 1 ; int start = 0 ; int count [ 5 ] = { 0 } ; for ( int x = 0 ; x < n ; x ++ ) { int idx = get_index ( s [ x ] ) ; if ( idx != -1 ) { count [ idx ] ++ ; } int idx_start = get_index ( s [ start ] ) ; while ( idx_start == -1 count [ idx_start ] > 1 ) { if ( idx_start != -1 ) { count [ idx_start ] -- ; } start ++ ; if ( start < n ) idx_start = get_index ( s [ start ] ) ; } if ( count [ 0 ] > 0 && count [ 1 ] > 0 && count [ 2 ] > 0 && count [ 3 ] > 0 && count [ 4 ] > 0 ) { ans = min ( ans , x - start + 1 ) ; } } if ( ans == n + 1 ) return -1 ; return ans ; } int main ( ) { string s = " aaeebbeaccaaoiuooooooooiuu " ; cout << findMinLength ( s ) ; return 0 ; }

Index/key variables: idx, idx_start, start, x
Accumulator variables: start, stdc, x
Iterator variables: x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countStrings ( string s ) { int cnt = 0 ; for ( int i = 1 ; s [ i ] ; i ++ ) { if ( s [ i ] == s [ i + 1 ] ) { cnt ++ ; } } return cnt ; } int main ( ) { string str ( " aacbb " ) ; cout << countStrings ( str ) ; return 0 ; }

Index/key variables: i
Accumulator variables: cnt, i, stdc
Iterator variables: i
C++ program:
#include " bits / stdc + + . h "
using namespace std ; bool checkValidString ( string str ) { int freq [ 26 ] = { 0 } ; for ( int i = 0 ; str [ i ] ; i ++ ) { freq [ str [ i ] - ' a ' ] ++ ; } for ( int i = 0 ; i < 26 ; i ++ ) { if ( freq [ i ] != 0 ) { if ( freq [ i ] != i + 1 ) { return false ; } } } return true ; } int main ( ) { string str = " abbcccdddd " ; if ( checkValidString ( str ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
#include <string.h>
using namespace std ; void removeRepeating ( string s1 , string s2 ) { string s3 = s1 + " ▁ " + s2 + " ▁ " ; string words = " " ; int i = 0 ; for ( auto x : s3 ) { if ( x == ' ▁ ' ) { if ( s1 . find ( words ) == string :: npos || s2 . find ( words ) == string :: npos ) cout << words ; words = " " ; } else { words = words + x ; } } } int main ( ) { string s1 = " I ▁ have ▁ go ▁ a ▁ pen " ; string s2 = " I ▁ want ▁ to ▁ go ▁ park " ; removeRepeating ( s1 , s2 ) ; return 0 ; }

Accumulator variables: stdc
Iterator variables: x
C++ program:
#include <bits/stdc++.h>
using namespace std ; string convert ( string input ) { int len = input . length ( ) ; for ( int i = 0 ; i < len ; ) { if ( input [ i ] == ' , ▁ ' ) { input . erase ( input . begin ( ) + i ) ; len -- ; i -- ; } else if ( input [ i ] == ' ▁ ' ) { input . erase ( input . begin ( ) + i ) ; len -- ; i -- ; } else { i ++ ; } } reverse ( input . begin ( ) , input . end ( ) ) ; string output ; for ( int i = 0 ; i < len ; i ++ ) { if ( i == 2 ) { output += input [ i ] ; output += " , ▁ " ; } else if ( i > 2 && i % 2 == 0 && i + 1 < len ) { output += input [ i ] ; output += " , ▁ " ; } else { output += input [ i ] ; } } reverse ( output . begin ( ) , output . end ( ) ) ; return output ; } int main ( ) { string input1 = "123 , ▁ 456 , ▁ 789" ; string input2 = "90 , ▁ 050 , ▁ 000 , ▁ 000" ; cout << convert ( input1 ) << endl ; cout << convert ( input2 ) ; }

Index/key variables: i
Accumulator variables: i, len, output, stdc
Iterator variables: i
C++ program:
#include " bits / stdc + + . h "
using namespace std ; bool isPrime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) return false ; } return true ; } bool isPossibleSum ( int N ) { if ( isPrime ( N ) && isPrime ( N - 2 ) ) { return true ; } else { return false ; } } bool checkSemiprime ( int num ) { int cnt = 0 ; for ( int i = 2 ; cnt < 2 && i * i <= num ; ++ i ) { while ( num % i == 0 ) { num /= i , ++ cnt ; } } if ( num > 1 ) { ++ cnt ; } return cnt == 2 ; } void makeCypherString ( int N ) { string semiPrime = " " ; string sumOfPrime = " " ; string str = to_string ( N ) ; if ( checkSemiprime ( N ) ) { for ( int i = 0 ; str [ i ] ; i ++ ) { if ( i & 1 ) { semiPrime += str [ i ] ; } else { semiPrime += char ( str [ i ] - '0' + 65 ) ; } } } if ( isPossibleSum ( N ) ) { for ( int i = 0 ; str [ i ] ; i ++ ) { if ( i & 1 ) { sumOfPrime += char ( str [ i ] - '0' + 65 ) ; } else { sumOfPrime += str [ i ] ; } } } if ( semiPrime + sumOfPrime == " " ) { cout << " - 1" ; } else { cout << semiPrime + sumOfPrime ; } } int main ( ) { int N = 1011243 ; makeCypherString ( N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, num, semiPrime, sumOfPrime
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void max_segments ( string str , int K ) { int n = str . length ( ) ; int s = 0 , sum = 0 , count = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { int a = str [ i ] - '0' ; sum += a * pow ( 2 , s ) ; s ++ ; if ( sum != 0 && sum % K == 0 ) { count ++ ; sum = 0 ; s = 0 ; } } if ( sum != 0 ) cout << " - 1" << endl ; else cout << count << endl ; } int main ( ) { string str = "10111001" ; int K = 5 ; max_segments ( str , K ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, s, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string findStr ( string S ) { int n = S . size ( ) ; for ( int i = 0 ; i < n / 2 ; ++ i ) { if ( S [ i ] != ' a ' ) { S [ i ] = ' a ' ; return S ; } } S [ n - 1 ] = ' b ' ; return n < 2 ? " ▁ - 1 ▁ " : S ; } int main ( ) { string str = " a " ; cout << findStr ( str ) << endl ; string str1 = " abccba " ; cout << findStr ( str1 ) << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void kth_string ( int n , int k ) { for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( k <= ( n - i - 1 ) ) { for ( int j = 0 ; j < n ; j ++ ) { if ( j == i or j == n - k ) cout << ' Y ' ; else cout << ' X ' ; } break ; } k -= ( n - i - 1 ) ; } } int main ( ) { int n = 5 , k = 7 ; kth_string ( n , k ) ; return 0 ; }

Accumulator variables: i, j, k, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void convertString ( string str1 , string str2 , string str3 ) { map < char , int > freq ; for ( int i = 0 ; str3 [ i ] ; i ++ ) { freq [ str3 [ i ] ] ++ ; } int ptr1 = 0 ; int ptr2 = 0 ; bool flag = true ; while ( ptr1 < str1 . length ( ) && ptr2 < str2 . length ( ) ) { if ( str1 [ ptr1 ] == str2 [ ptr2 ] ) { ptr1 ++ ; ptr2 ++ ; } else { if ( freq [ str3 [ ptr2 ] ] > 0 ) { freq [ str3 [ ptr2 ] ] -- ; ptr2 ++ ; } else { flag = false ; break ; } } } if ( flag && ptr1 == str1 . length ( ) && ptr2 == str2 . length ( ) ) { cout << " YES " << endl ; } else { cout << " NO " << endl ; } } int main ( ) { string str1 = " abyzfe " ; string str2 = " abcdeyzf " ; string str3 = " popode " ; convertString ( str1 , str2 , str3 ) ; return 0 ; }

Index/key variables: i, ptr1, ptr2
Accumulator variables: i, ptr1, ptr2, stdc
Iterator variables: i
Boolean variables: flag
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MOD = 26 ; int modulo_by_26 ( string num ) { int res = 0 ; for ( int i = 0 ; i < num . length ( ) ; i ++ ) res = ( res * 10 + ( int ) num [ i ] - '0' ) % MOD ; return res ; } string decrypt_message ( string s ) { string decrypted_str = " " ; string num_found_so_far = " " ; for ( int i = 0 ; i < s . length ( ) ; ++ i ) { if ( s [ i ] >= '0' && s [ i ] <= '9' ) { num_found_so_far += s [ i ] ; } else if ( num_found_so_far . length ( ) > 0 ) { decrypted_str += ' a ' + modulo_by_26 ( num_found_so_far ) ; num_found_so_far = " " ; } } if ( num_found_so_far . length ( ) > 0 ) { decrypted_str += ' a ' + modulo_by_26 ( num_found_so_far ) ; } return decrypted_str ; } int main ( ) { string s = "32ytAAcV4ui30hf10hj18" ; cout << decrypt_message ( s ) ; return 0 ; }

Index/key variables: i
Accumulator variables: decrypted_str, i, num_found_so_far, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maxOverlap ( string S , string T ) { string str = T ; int count [ T . length ( ) ] = { 0 } ; int overlap = 0 ; int max_overlap = 0 ; for ( int i = 0 ; i <= S . length ( ) ; i ++ ) { int index = str . find ( S [ i ] ) ; if ( index == 0 ) { overlap ++ ; if ( overlap >= 2 ) max_overlap = max ( overlap , max_overlap ) ; count [ index ] ++ ; } else { if ( count [ index - 1 ] <= 0 ) return -1 ; count [ index ] ++ ; count [ index - 1 ] -- ; } if ( index == 4 ) overlap -- ; } if ( overlap == 0 ) return max_overlap ; else return -1 ; } int main ( ) { string S = " chcirphirp " ; string T = " chirp " ; cout << maxOverlap ( S , T ) ; return 0 ; }

Index/key variables: i, index
Accumulator variables: i, overlap, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
#define MAX  500001
using namespace std ; int parent [ MAX ] ; int Rank [ MAX ] ; int find ( int x ) { return parent [ x ] = parent [ x ] == x ? x : find ( parent [ x ] ) ; } void merge ( int r1 , int r2 ) { if ( r1 != r2 ) { if ( Rank [ r1 ] > Rank [ r2 ] ) { parent [ r2 ] = r1 ; Rank [ r1 ] += Rank [ r2 ] ; } else { parent [ r1 ] = r2 ; Rank [ r2 ] += Rank [ r1 ] ; } } } void minimumOperations ( string s1 , string s2 ) { for ( int i = 1 ; i <= 26 ; i ++ ) { parent [ i ] = i ; Rank [ i ] = 1 ; } vector < pair < char , char > > ans ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { if ( s1 [ i ] != s2 [ i ] ) { if ( find ( s1 [ i ] - 96 ) != find ( s2 [ i ] - 96 ) ) { int x = find ( s1 [ i ] - 96 ) ; int y = find ( s2 [ i ] - 96 ) ; merge ( x , y ) ; ans . push_back ( { s1 [ i ] , s2 [ i ] } ) ; } } } cout << ans . size ( ) << endl ; for ( int i = 0 ; i < ans . size ( ) ; i ++ ) cout << ans [ i ] . first << " - > " << ans [ i ] . second << endl ; } int main ( ) { string s1 , s2 ; s1 = " abb " ; s2 = " dad " ; minimumOperations ( s1 , s2 ) ; return 0 ; }

Index/key variables: MAX, i, r1, r2, x
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void string_permutation ( long long int n , string str ) { stack < int > s ; string result ; n = n - 1 ; for ( int i = 1 ; i < str . size ( ) + 1 ; i ++ ) { s . push ( n % i ) ; n = n / i ; } for ( int i = 0 ; i < str . size ( ) ; i ++ ) { int a = s . top ( ) ; result += str [ a ] ; int j ; for ( j = a ; j < str . length ( ) ; j ++ ) str [ j ] = str [ j + 1 ] ; str [ j + 1 ] = ' \0' ; s . pop ( ) ; } cout << result << endl ; } int main ( ) { string str = " abcde " ; long long int n = 11 ; string_permutation ( n , str ) ; return 0 ; }

Index/key variables: a, j
Accumulator variables: i, j, result, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; string GeberateDefangIP ( string str ) { string defangIP = " " ; for ( char c : str ) ( c == ' . ' ) ? defangIP += " [ . ] " : defangIP += c ; return defangIP ; } int main ( ) { string str = "255.100.50.0" ; cout << GeberateDefangIP ( str ) ; return 0 ; }

Accumulator variables: defangIP, stdc
Iterator variables: c
C++ program:
#include <bits/stdc++.h>
using namespace std ; int kmp ( string s ) { vector < int > lps ( s . size ( ) , 0 ) ; for ( int i = 1 ; i < s . size ( ) ; i ++ ) { int previous_index = lps [ i - 1 ] ; while ( previous_index > 0 && s [ i ] != s [ previous_index ] ) { previous_index = lps [ previous_index - 1 ] ; } lps [ i ] = previous_index + ( s [ i ] == s [ previous_index ] ? 1 : 0 ) ; } return lps [ lps . size ( ) - 1 ] ; } int remainingStringLongestPallindrome ( string s ) { string t = s + " ? " ; reverse ( s . begin ( ) , s . end ( ) ) ; t += s ; return kmp ( t ) ; } string longestPrefixSuffixPallindrome ( string s ) { int length = 0 ; int n = s . size ( ) ; for ( int i = 0 , j = n - 1 ; i < j ; i ++ , j -- ) { if ( s [ i ] != s [ j ] ) { break ; } length ++ ; } string ans = s . substr ( 0 , length ) ; string remaining = s . substr ( length , ( n - ( 2 * length ) ) ) ; if ( remaining . size ( ) ) { int longest_prefix = remainingStringLongestPallindrome ( remaining ) ; reverse ( remaining . begin ( ) , remaining . end ( ) ) ; int longest_suffix = remainingStringLongestPallindrome ( remaining ) ; if ( longest_prefix > longest_suffix ) { reverse ( remaining . begin ( ) , remaining . end ( ) ) ; ans += remaining . substr ( 0 , longest_prefix ) ; } else { ans += remaining . substr ( 0 , longest_suffix ) ; } } ans += s . substr ( n - length , length ) ; return ans ; } int main ( ) { string str = " rombobinnimor " ; cout << longestPrefixSuffixPallindrome ( str ) << endl ; }

Index/key variables: i, j, previous_index
Accumulator variables: ans, i, j, length, stdc, t
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string generateTheString ( int n ) { string ans = " " ; if ( n % 2 ) { for ( int i = 0 ; i < min ( n , 24 ) ; i ++ ) { ans += ( char ) ( ' b ' + i ) ; } if ( n > 24 ) { for ( int i = 0 ; i < ( n - 24 ) ; i ++ ) ans += ' a ' ; } } else { for ( int i = 0 ; i < min ( n , 25 ) ; i ++ ) { ans += ( char ) ( ' b ' + i ) ; } if ( n > 25 ) { for ( int i = 0 ; i < ( n - 25 ) ; i ++ ) ans += ' a ' ; } } return ans ; } int main ( ) { int n = 34 ; cout << generateTheString ( n ) ; return 0 ; }

Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void moveAtEnd ( string s , int i , int l ) { if ( i >= l ) return ; char curr = s [ i ] ; if ( curr != ' x ' ) cout << curr ; moveAtEnd ( s , i + 1 , l ) ; if ( curr == ' x ' ) cout << curr ; return ; } int main ( ) { string s = " geekxsforgexxeksxx " ; int l = s . length ( ) ; moveAtEnd ( s , 0 , l ) ; return 0 ; }

Index/key variables: i
Accumulator variables: stdc
C++ program:
#include <iostream>
using namespace std ; void String ( int l , int x , int y ) { int p = 97 ; for ( int j = 0 ; j < l ; j ++ ) { char ans = ( char ) ( p + ( j % y ) ) ; cout << ans ; } } int main ( ) { int l = 6 ; int x = 5 ; int y = 3 ; String ( l , x , y ) ; return 0 ; }

Accumulator variables: j
Iterator variables: j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void finalCoordinates ( int SX , int SY , string D ) { for ( int i = 0 ; i < D . length ( ) ; i ++ ) { if ( D [ i ] == ' N ' ) SY += 1 ; else if ( D [ i ] == ' S ' ) SY -= 1 ; else if ( D [ i ] == ' E ' ) SX += 1 ; else SX -= 1 ; } string ans = ' ( ' + to_string ( SX ) + ' , ' + to_string ( SY ) + ' ) ' ; cout << ans << endl ; } int main ( ) { int SX = 2 , SY = 2 ; string D = " NSSE " ; finalCoordinates ( SX , SY , D ) ; }

Index/key variables: i
Accumulator variables: SX, SY, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countMinFreq ( string s ) { sort ( s . begin ( ) , s . end ( ) ) ; return count ( s . begin ( ) , s . end ( ) , s [ 0 ] ) ; } void countLessThan ( vector < string > & arr1 , vector < string > & arr2 ) { vector < int > freq ; for ( string s : arr2 ) { int f = countMinFreq ( s ) ; freq . push_back ( f ) ; } sort ( freq . begin ( ) , freq . end ( ) ) ; for ( string s : arr1 ) { int f = countMinFreq ( s ) ; auto it = upper_bound ( freq . begin ( ) , freq . end ( ) , f ) ; int cnt = freq . size ( ) - ( it - freq . begin ( ) ) ; cout << cnt << ' ▁ ' ; } } int main ( ) { vector < string > arr1 , arr2 ; arr1 = { " yyy " , " zz " } ; arr2 = { " x " , " xx " , " xxx " , " xxxx " } ; countLessThan ( arr1 , arr2 ) ; return 0 ; }

Accumulator variables: stdc
Iterator variables: s
C++ program:
#include <bits/stdc++.h>
using namespace std ; void shortestPalindrome ( string s ) { int abcd [ 26 ] = { 0 } ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) abcd [ s [ i ] - 97 ] = 1 ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( abcd [ i ] == 1 ) cout << char ( i + 97 ) << " ▁ " ; } } int main ( ) { string s = " geeksforgeeks " ; shortestPalindrome ( s ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string removeDuplicates ( string str ) { int n = str . length ( ) ; string res = " " ; for ( int i = 0 ; i < n ; i ++ ) { int j ; for ( j = i + 1 ; j < n ; j ++ ) if ( str [ i ] == str [ j ] ) break ; if ( j == n ) res = res + str [ i ] ; } return res ; } int main ( ) { string str = " geeksforgeeks " ; cout << removeDuplicates ( str ) ; 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 ; string removeDuplicates ( string str ) { int n = str . length ( ) ; unordered_set < char > s ; string res = " " ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( s . find ( str [ i ] ) == s . end ( ) ) { res = res + str [ i ] ; s . insert ( str [ i ] ) ; } } reverse ( res . begin ( ) , res . end ( ) ) ; return res ; } int main ( ) { string str = " geeksforgeeks " ; cout << removeDuplicates ( str ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void contain ( int L , int U , int M ) { int count = 0 ; for ( int j = L ; j < U ; j ++ ) { set < string > num ; string str = to_string ( j ) ; num . insert ( str ) ; if ( j % M == 0 and num . find ( to_string ( M ) ) == num . end ( ) ) { count += 1 ; } } cout << count - 2 ; } int main ( ) { int L = 106 ; int U = 200 ; int M = 7 ; contain ( L , U , M ) ; }

Accumulator variables: count, j, stdc
Iterator variables: j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int max1 = 0 ; int MaxLength ( vector < string > v , int i , int m ) { if ( i >= m ) { return m - 1 ; } for ( int k = 0 ; k < 26 ; k ++ ) { char c = ' a ' + k ; vector < string > v1 ; for ( int j = 0 ; j < v . size ( ) ; j ++ ) { if ( v [ j ] [ i ] == c ) { v1 . push_back ( v [ j ] ) ; } } if ( v1 . size ( ) >= 2 ) { max1 = max ( max1 , MaxLength ( v1 , i + 1 , m ) ) ; } else { max1 = max ( max1 , i - 1 ) ; } } return max1 ; } int main ( ) { string s1 , s2 , s3 , s4 , s5 ; s1 = " abcde " ; s2 = " abcsd " ; s3 = " bcsdf " ; s4 = " abcda " ; s5 = " abced " ; vector < string > v ; v . push_back ( s1 ) ; v . push_back ( s2 ) ; v . push_back ( s3 ) ; v . push_back ( s4 ) ; v . push_back ( s5 ) ; int m = v [ 0 ] . size ( ) ; cout << MaxLength ( v , 0 , m ) + 1 << endl ; return 0 ; }

Index/key variables: i, j
Accumulator variables: j, k, stdc
Iterator variables: j, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findPeriodicString ( string S ) { int l = 2 * S . length ( ) ; int count = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { if ( S [ i ] == '1' ) count ++ ; } if ( count == S . length ( ) count == 0 ) cout << S << " STRNEWLINE " ; else { char arr [ l ] ; for ( int i = 0 ; i < l ; i += 2 ) { arr [ i ] = '1' ; arr [ i + 1 ] = '0' ; } for ( int i = 0 ; i < l ; i ++ ) cout << arr [ i ] ; cout << " STRNEWLINE " ; } } int main ( ) { string S = "1111001" ; findPeriodicString ( S ) ; return 0 ; }

Index/key variables: i, l
Accumulator variables: count, i, stdc
Iterator variables: i