dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; import java . lang . * ; class GFG { static void printResult ( ArrayList < Integer > result ) { Collections . reverse ( result ) ; int i = 0 ; while ( i < result . size ( ) ) { System . out . print ( result . get ( i ) ) ; i ++ ; } } static void sumOfLargeNumbers ( String v [ ] , int k , int N ) { ArrayList < ArrayList < Integer > > x = new ArrayList < > ( 1000 ) ; for ( int i = 0 ; i < k ; i ++ ) x . add ( new ArrayList < Integer > ( ) ) ; for ( int i = 0 ; i < k ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { x . get ( i ) . add ( v [ i ] . charAt ( j ) - '0' ) ; } } int carry = 0 ; ArrayList < Integer > result = new ArrayList < > ( ) ; for ( int i = N - 1 ; i >= 0 ; i -- ) { int sum = 0 ; for ( int j = 0 ; j < k ; j ++ ) sum += x . get ( j ) . get ( i ) ; sum += carry ; int temp = sum ; int count = 0 ; while ( temp > 9 ) { temp = temp % 10 ; count ++ ; } long l = ( long ) Math . pow ( 10 , count ) ; if ( l != 1 ) carry = ( int ) ( sum / l ) ; sum = sum % 10 ; result . add ( sum ) ; } while ( carry != 0 ) { int a = carry % 10 ; result . add ( a ) ; carry = carry / 10 ; } printResult ( result ) ; } public static void main ( String [ ] args ) { int K = 10 ; int N = 5 ; String arr [ ] = { "1111111111" , "1111111111" , "1111111111" , "1111111111" , "1111111111" } ; sumOfLargeNumbers ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: count, i, j, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printRev ( String str ) { Stack < String > st = new Stack < String > ( ) ; String [ ] ss = str . split ( " ▁ " ) ; for ( String temp : ss ) { st . add ( temp ) ; } while ( ! st . isEmpty ( ) ) { System . out . print ( st . peek ( ) + " ▁ " ) ; st . pop ( ) ; } } public static void main ( String [ ] args ) { String str ; str = " geeks ▁ quiz ▁ practice ▁ code " ; printRev ( str ) ; } }

Iterator variables: temp
Class/struct names: GFG
Java program:
class GFG { static int countOfSubstringWithOnlyOnes ( String s ) { int res = 0 , count = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { count = s . charAt ( i ) == '1' ? count + 1 : 0 ; res = ( res + count ) ; } return res ; } public static void main ( String [ ] args ) { String s = "0110111" ; System . out . println ( countOfSubstringWithOnlyOnes ( s ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static final long mod = 1000000007 ; static long binExp ( long base , long power ) { long x = 1 ; while ( power != 0 ) { if ( power % 2 == 1 ) x = ( ( x % mod ) * ( base % mod ) ) % mod ; base = ( ( base % mod ) * ( base % mod ) ) % mod ; power = power / 2 ; } return x ; } static long fact ( long num ) { long result = 1 ; for ( long i = 1 ; i <= num ; ++ i ) { result = ( ( result % mod ) * ( i % mod ) ) % mod ; } return result ; } static long calculate_nCi ( long N , long i ) { long nfact = fact ( N ) ; long ifact = fact ( i ) ; long dfact = fact ( N - i ) ; long inv_ifact = binExp ( ifact , mod - 2 ) ; long inv_dfact = binExp ( dfact , mod - 2 ) ; long denm = ( ( inv_ifact % mod ) * ( inv_dfact % mod ) ) % mod ; long answer = ( ( nfact % mod ) * ( denm % mod ) ) % mod ; return answer ; } static void countSubstring ( long N , long s , long k ) { long allWays = binExp ( 26 , N ) ; long noWays = 0 ; for ( long i = 0 ; i < s ; ++ i ) { long nCi = calculate_nCi ( N , i ) ; long remaining = binExp ( 25 , N - i ) ; long multiply = ( ( nCi % mod ) * ( remaining % mod ) ) % mod ; noWays = ( ( noWays % mod ) + ( multiply % mod ) ) % mod ; } long answer = ( ( allWays % mod ) - ( noWays % mod ) ) % mod ; if ( answer < 0 ) answer += mod ; System . out . println ( answer ) ; } public static void main ( String [ ] args ) { String str = " abc " ; long k = 2 ; long s = str . length ( ) ; long N = s + k ; countSubstring ( N , s , k ) ; } }

Accumulator variables: answer
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int N = 1000000 + 5 ; static int [ ] prefix = new int [ N ] ; static int [ ] sum = new int [ N ] ; static int isSpecial ( char c , char [ ] special ) { for ( char i : special ) if ( i == c ) return 1 ; return 0 ; } static double countRatio ( char [ ] s , char [ ] special ) { int n = s . length ; for ( int i = 0 ; i < n ; i ++ ) { prefix [ i ] = ( isSpecial ( s [ i ] , special ) ) ; if ( i > 0 ) prefix [ i ] += prefix [ i - 1 ] ; } for ( int i = 0 ; i < n ; i ++ ) { sum [ i ] = prefix [ i ] ; if ( i > 0 ) sum [ i ] += sum [ i - 1 ] ; } double ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int count = sum [ n - 1 ] - ( i > 1 ? sum [ i - 2 ] : 0 ) ; count -= ( i < n ? sum [ n - i - 1 ] : 0 ) ; ans += ( double ) count / ( double ) i ; } return ans ; } public static void main ( String [ ] args ) { String s = " abcd " ; char [ ] special = { ' b ' , ' c ' } ; double ans = countRatio ( s . toCharArray ( ) , special ) ; System . out . format ( " % .6f " , ans ) ; } }

Index/key variables: N, i
Accumulator variables: ans, count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void count_minimum ( String s ) { int n = s . length ( ) ; int ans = 0 ; int i = 0 ; while ( i < n ) { int j = i ; while ( j < n && s . charAt ( j ) == s . charAt ( i ) ) { j ++ ; } int diff = j - i ; ans += diff / 2 ; i = j ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { String str = " caaab " ; count_minimum ( str ) ; } }

Accumulator variables: ans, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int min_cost ( String st ) { String vow = " aeiou " ; int cost = 0 ; for ( int i = 0 ; i < st . length ( ) ; i ++ ) { ArrayList < Integer > costs = new ArrayList < > ( ) ; for ( int j = 0 ; j < 5 ; j ++ ) costs . add ( Math . abs ( st . charAt ( i ) - vow . charAt ( j ) ) ) ; int minx = Integer . MAX_VALUE ; for ( int x : costs ) { if ( x < minx ) { minx = x ; } } cost += minx ; } return cost ; } public static void main ( String [ ] args ) { String str = " abcde " ; System . out . println ( min_cost ( str ) ) ; } }

Accumulator variables: cost, i, j
Iterator variables: i, j, x
Class/struct names: GFG
Java program:
import java . util . * ; import java . io . * ; class GFG { static boolean isPalindrome ( String str ) { int l = 0 ; int h = str . length ( ) - 1 ; while ( h > l ) { if ( str . charAt ( l ++ ) != str . charAt ( h -- ) ) return false ; } return true ; } static String makeOddString ( String str ) { String odd = " " ; for ( int i = 1 ; i < str . length ( ) ; i += 2 ) { odd += str . charAt ( i ) ; } return odd ; } static String makeevenString ( String str ) { String even = " " ; for ( int i = 0 ; i < str . length ( ) ; i += 2 ) { even += str . charAt ( i ) ; } return even ; } static void checkevenOddPalindrome ( String str ) { String odd = makeOddString ( str ) ; String even = makeevenString ( str ) ; if ( isPalindrome ( odd ) && isPalindrome ( even ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } public static void main ( String [ ] args ) { String str = " abzzab " ; checkevenOddPalindrome ( str ) ; } }

Accumulator variables: even, h, i, l, odd
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static long count_Strings ( long n ) { int x = 1 ; for ( int i = 1 ; i < n ; i ++ ) { x = ( 1 << x ) ; } return x - 1 ; } public static void main ( String [ ] args ) { long n = 3 ; System . out . print ( count_Strings ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void decrypt ( String Str , int Start , int End ) { if ( Start > End ) { return ; } int mid = ( Start + End ) >> 1 ; System . out . print ( Str . charAt ( mid ) ) ; decrypt ( Str , mid + 1 , End ) ; decrypt ( Str , Start , mid - 1 ) ; } public static void main ( String [ ] args ) { int N = 4 ; String Str = " abcd " ; decrypt ( Str , 0 , N - 1 ) ; System . out . print ( "NEW_LINE"); N = 6 ; Str = " gyuitp " ; decrypt ( Str , 0 , N - 1 ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean isSuffix ( String s1 , String s2 ) { int n1 = s1 . length ( ) , n2 = s2 . length ( ) ; if ( n1 > n2 ) return false ; for ( int i = 0 ; i < n1 ; i ++ ) if ( s1 . charAt ( n1 - i - 1 ) != s2 . charAt ( n2 - i - 1 ) ) return false ; return true ; } static boolean CheckBinaryEquivalent ( int N , String str ) { int B_Number = 0 ; int cnt = 0 ; while ( N != 0 ) { int rem = N % 2 ; int c = ( int ) Math . pow ( 10 , cnt ) ; B_Number += rem * c ; N /= 2 ; cnt ++ ; } String bin = Integer . toString ( B_Number ) ; return isSuffix ( str , bin ) ; } public static void main ( String [ ] args ) { int N = 23 ; String str = "111" ; if ( CheckBinaryEquivalent ( N , str ) ) System . out . print ( "YesNEW_LINE"); else System . out . print ( "NoNEW_LINE"); } }

Accumulator variables: B_Number, N, cnt, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isvowel ( char ch ) { return ( ch == ' a ' ch == ' e ' ch == ' i ' ch == ' o ' ch == ' u ' ) ; } static boolean isvalid ( String s ) { int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! isvowel ( s . charAt ( i ) ) ) return false ; } return true ; } static int CountTotal ( String s ) { int ans = 0 ; int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String temp = " " ; for ( int j = i ; j < n ; j ++ ) { temp += s . charAt ( j ) ; if ( isvalid ( temp ) ) ans += 1 ; } } return ans ; } public static void main ( String [ ] args ) { String s = " aeoibsddaaeiouudb " ; System . out . print ( ( CountTotal ( s ) ) + "NEW_LINE"); } }

Accumulator variables: ans, i, j, temp
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean isVowel ( char c ) { return ( c == ' a ' c == ' e ' c == ' i ' c == ' o ' c == ' u ' ) ; } static boolean isValid ( String s ) { int n = s . length ( ) ; if ( n == 1 ) return ( isVowel ( s . charAt ( 0 ) ) ) ; if ( isVowel ( s . charAt ( 0 ) ) == false ) return false ; for ( int i = 1 ; i < n ; i ++ ) { if ( s . charAt ( i ) == s . charAt ( i - 1 ) || ! isVowel ( s . charAt ( i ) ) ) return false ; } return true ; } static int findMaxLen ( String s ) { int maxLen = 0 ; int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String temp = " " ; for ( int j = i ; j < n ; j ++ ) { temp = temp + s . charAt ( j ) ; if ( isValid ( temp ) ) maxLen = Math . max ( maxLen , ( j - i + 1 ) ) ; } } return maxLen ; } public static void main ( String [ ] args ) { String Str = " aeoibsddaeiouudb " ; System . out . println ( findMaxLen ( Str ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { private static void BalancedNumber ( String s ) { int Leftsum = 0 ; int Rightsum = 0 ; for ( int i = 0 ; i < s . length ( ) / 2 ; i ++ ) { Leftsum += ( int ) ( s . charAt ( i ) - '0' ) ; Rightsum += ( int ) ( s . charAt ( s . length ( ) - 1 - i ) - '0' ) ; } if ( Leftsum == Rightsum ) System . out . println ( " Balanced " ) ; else System . out . println ( " Not ▁ Balanced " ) ; } public static void main ( String [ ] args ) { String s = "12321" ; BalancedNumber ( s ) ; } }

Accumulator variables: Leftsum, Rightsum, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int mod = ( int ) ( 1e9 + 7 ) ; static int expo ( int base , int exponent ) { int ans = 1 ; while ( exponent != 0 ) { if ( ( exponent & 1 ) == 1 ) { ans = ans * base ; ans = ans % mod ; } base = base * base ; base %= mod ; exponent >>= 1 ; } return ans % mod ; } static int findCount ( int N ) { int ans = ( expo ( 26 , N ) - expo ( 5 , N ) - expo ( 21 , N ) ) % mod ; ans += mod ; ans %= mod ; return ans ; } public static void main ( String [ ] args ) { int N = 3 ; System . out . print ( findCount ( N ) ) ; } }

Accumulator variables: ans
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int decompose ( Vector < Integer > S ) { Stack < Integer > s = new Stack < Integer > ( ) ; int N = S . size ( ) ; int ans = 0 ; int nix = Integer . MAX_VALUE ; for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( s . isEmpty ( ) ) { s . add ( S . get ( i ) ) ; nix = S . get ( i ) ; } else { if ( S . get ( i ) < s . peek ( ) ) { s . add ( S . get ( i ) ) ; nix = Math . min ( nix , S . get ( i ) ) ; } else { int val = S . get ( i ) ; while ( ! s . isEmpty ( ) && val >= s . peek ( ) ) { s . pop ( ) ; } nix = Math . min ( nix , S . get ( i ) ) ; s . add ( nix ) ; } } ans += s . size ( ) ; } return ans ; } public static void main ( String args [ ] ) { Vector < Integer > S = new Vector < Integer > ( ) ; S . add ( 9 ) ; S . add ( 6 ) ; S . add ( 9 ) ; S . add ( 35 ) ; System . out . println ( decompose ( S ) ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maxSetBitCount ( String s , int k ) { int maxCount = 0 , n = s . length ( ) ; int count = 0 ; for ( int i = 0 ; i < k ; i ++ ) { if ( s . charAt ( i ) == '1' ) count ++ ; } maxCount = count ; for ( int i = k ; i < n ; i ++ ) { if ( s . charAt ( i - k ) == '1' ) count -- ; if ( s . charAt ( i ) == '1' ) count ++ ; maxCount = Math . max ( maxCount , count ) ; } return maxCount ; } public static void main ( String [ ] args ) { String s = "100111010" ; int k = 3 ; System . out . println ( maxSetBitCount ( s , k ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int minDel ( String s1 , String s2 ) { int i = s1 . length ( ) ; int j = s2 . length ( ) ; while ( i > 0 && j > 0 ) { if ( s1 . charAt ( i - 1 ) != s2 . charAt ( j - 1 ) ) { break ; } i -- ; j -- ; } return i + j ; } public static void main ( String args [ ] ) { String s1 = " geeksforgeeks " , s2 = " peeks " ; System . out . print ( minDel ( s1 , s2 ) ) ; } }

Accumulator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int minDel ( String s1 , String s2 ) { int i = 0 ; while ( i < Math . min ( s1 . length ( ) , s2 . length ( ) ) ) { if ( s1 . charAt ( i ) != s2 . charAt ( i ) ) { break ; } i ++ ; } int ans = ( ( s1 . length ( ) - i ) + ( s2 . length ( ) - i ) ) ; return ans ; } public static void main ( String [ ] args ) { String s1 = " geeks " ; String s2 = " geeksfor " ; System . out . println ( minDel ( s1 , s2 ) ) ; } }

Accumulator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void CountValidTriplet ( String s , int n ) { int count_a = 0 , count_b = 0 , count_c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' a ' ) count_a ++ ; if ( s . charAt ( i ) == ' b ' ) count_b ++ ; if ( s . charAt ( i ) == ' c ' ) count_c ++ ; } int Total_triplet = count_a * count_b * count_c ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( ( 2 * j - i ) < n && s . charAt ( j ) != s . charAt ( i ) && s . charAt ( j * 2 - i ) != s . charAt ( j ) && s . charAt ( 2 * j - i ) != s . charAt ( i ) ) Total_triplet -- ; } } System . out . println ( Total_triplet ) ; } public static void main ( String [ ] args ) { String s = " abcbcabc " ; int n = s . length ( ) ; CountValidTriplet ( s , n ) ; } }

Accumulator variables: Total_triplet, count_a, count_b, count_c, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { public static boolean isBalanced ( String exp ) { boolean flag = true ; int count = 0 ; for ( int i = 0 ; i < exp . length ( ) ; i ++ ) { if ( exp . charAt ( i ) == ' ( ' ) { count ++ ; } else { count -- ; } if ( count < 0 ) { flag = false ; break ; } } if ( count != 0 ) { flag = false ; } return flag ; } public static void main ( String [ ] args ) { String exp1 = " ( ( ( ) ) ) ( ) ( ) " ; if ( isBalanced ( exp1 ) ) System . out . println ( " Balanced " ) ; else System . out . println ( " Not ▁ Balanced " ) ; String exp2 = " ( ) ) ( ( ( ) ) " ; if ( isBalanced ( exp2 ) ) System . out . println ( " Balanced " ) ; else System . out . println ( " Not ▁ Balanced " ) ; } }

Accumulator variables: count, i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void longestPalindrome ( String s ) { int n = s . length ( ) ; int [ ] [ ] pref = new int [ 26 ] [ n ] ; Vector < Integer > [ ] pos = new Vector [ 26 ] ; for ( int i = 0 ; i < pos . length ; i ++ ) pos [ i ] = new Vector < Integer > ( ) ; pref [ s . charAt ( 0 ) - ' a ' ] [ 0 ] ++ ; pos [ s . charAt ( 0 ) - ' a ' ] . add ( 0 ) ; for ( int i = 1 ; i < n ; i ++ ) { for ( int j = 0 ; j < 26 ; j ++ ) pref [ j ] [ i ] += pref [ j ] [ i - 1 ] ; int index = s . charAt ( i ) - ' a ' ; pref [ index ] [ i ] ++ ; pos [ index ] . add ( i ) ; } int ans = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { int size = pos [ i ] . size ( ) ; ans = Math . max ( ans , size ) ; for ( int j = 0 ; j < size / 2 ; j ++ ) { int l = pos [ i ] . elementAt ( j ) ; int r = pos [ i ] . elementAt ( size - j - 1 ) - 1 ; for ( int k = 0 ; k < 26 ; k ++ ) { int sum = pref [ k ] [ r ] - pref [ k ] [ l ] ; ans = Math . max ( ans , 2 * ( j + 1 ) + sum ) ; } } } System . out . print ( ans + "NEW_LINE"); } public static void main ( String [ ] args ) { String S = " bbccdcbb " ; longestPalindrome ( S ) ; } }

Index/key variables: i, index, j, k, l, n, r
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean checkWord ( char [ ] [ ] board , String word , int index , int row , int col ) { if ( row < 0 col < 0 row >= board . length col >= board [ 0 ] . length ) return false ; if ( board [ row ] [ col ] != word . charAt ( index ) ) return false ; else if ( index == word . length ( ) - 1 ) return true ; char temp = board [ row ] [ col ] ; board [ row ] [ col ] = ' * ' ; if ( checkWord ( board , word , index + 1 , row + 1 , col ) || checkWord ( board , word , index + 1 , row - 1 , col ) || checkWord ( board , word , index + 1 , row , col + 1 ) || checkWord ( board , word , index + 1 , row , col - 1 ) ) { board [ row ] [ col ] = temp ; return true ; } board [ row ] [ col ] = temp ; return false ; } public static void main ( String [ ] args ) { char [ ] [ ] board = { { ' A ' , ' B ' , ' C ' , ' E ' } , { ' S ' , ' F ' , ' C ' , ' S ' } , { ' A ' , ' D ' , ' E ' , ' E ' } } ; String word = " CFDASABCESEE " ; for ( int i = 0 ; i < board . length ; i ++ ) { for ( int j = 0 ; j < board [ 0 ] . length ; j ++ ) { if ( board [ i ] [ j ] == word . charAt ( 0 ) && checkWord ( board , word , 0 , i , j ) ) { System . out . println ( " True " ) ; return ; } } } System . out . println ( " False " ) ; } }

Index/key variables: col, i, j, row
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int count ( String N , int X , String subStr , int index , int n ) { if ( index == n ) return 0 ; String a = subStr + N . charAt ( index ) ; int b = 0 ; if ( Long . valueOf ( a ) % X == 0 ) b = 1 ; int m1 = count ( N , X , a , index + 1 , n ) ; int m2 = b + count ( N , X , " " , index + 1 , n ) ; return Math . max ( m1 , m2 ) ; } public static void main ( String [ ] args ) { String N = "00001242" ; int K = 3 ; int l = N . length ( ) ; System . out . print ( count ( N , K , " " , 0 , l ) + "NEW_LINE"); } }

Class/struct names: GFG
Java program:
class GFG { public static boolean checkSuffix ( int A , int B ) { String s1 = String . valueOf ( A ) ; String s2 = String . valueOf ( B ) ; int n1 = s1 . length ( ) ; int n2 = s2 . length ( ) ; if ( n1 < n2 ) { return false ; } for ( int i = 0 ; i < n2 ; i ++ ) { if ( s1 . charAt ( n1 - i - 1 ) != s2 . charAt ( n2 - i - 1 ) ) { return false ; } } return true ; } public static void main ( String [ ] args ) { int A = 12345 , B = 45 ; boolean result = checkSuffix ( A , B ) ; if ( result ) { System . out . print ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void checkSuffix ( int A , int B ) { String s1 = String . valueOf ( A ) ; String s2 = String . valueOf ( B ) ; boolean result ; result = s1 . endsWith ( s2 ) ; if ( result ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } public static void main ( String [ ] args ) { int A = 12345 , B = 45 ; checkSuffix ( A , B ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void depthFirst ( int v , List < List < Integer > > graph , boolean [ ] visited , List < Integer > storeChain ) { visited [ v ] = true ; storeChain . add ( v ) ; for ( int i : graph . get ( v ) ) { if ( visited [ i ] == false ) { depthFirst ( i , graph , visited , storeChain ) ; } } } static void createMap ( Map < String , Character > um ) { um . put ( "000" , '0' ) ; um . put ( "001" , '1' ) ; um . put ( "010" , '2' ) ; um . put ( "011" , '3' ) ; um . put ( "100" , '4' ) ; um . put ( "101" , '5' ) ; um . put ( "110" , '6' ) ; um . put ( "111" , '7' ) ; } static String octal ( String bin ) { int l = bin . length ( ) ; int t = bin . indexOf ( ' . ' ) ; 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' ; } Map < String , Character > bin_oct_map = new HashMap < String , Character > ( ) ; createMap ( bin_oct_map ) ; int i = 0 ; String octal = " " ; while ( true ) { octal += bin_oct_map . get ( bin . substring ( i , i + 3 ) ) ; i += 3 ; if ( i == bin . length ( ) ) break ; if ( bin . charAt ( i ) == ' . ' ) { octal += ' . ' ; i ++ ; } } return octal ; } static void octalValue ( List < List < Integer > > graph , int vertices , List < Integer > values ) { boolean [ ] visited = new boolean [ 1001 ] ; for ( int i = 1 ; i <= vertices ; i ++ ) { if ( visited [ i ] == false ) { int sizeChain ; List < Integer > storeChain = new ArrayList < Integer > ( ) ; depthFirst ( i , graph , visited , storeChain ) ; sizeChain = storeChain . size ( ) ; int [ ] chainValues = new int [ sizeChain + 1 ] ; for ( int j = 0 ; j < sizeChain ; j ++ ) { int temp = values . get ( storeChain . get ( j ) - 1 ) ; chainValues [ j ] = temp ; } System . out . print ( " Chain ▁ = ▁ " ) ; for ( int j = 0 ; j < sizeChain ; j ++ ) { System . out . print ( chainValues [ j ] + " ▁ " ) ; } System . out . print ( " TABSYMBOL " ) ; String s = " " ; for ( int j = 0 ; j < sizeChain ; j ++ ) { String s1 = String . valueOf ( chainValues [ j ] ) ; s += s1 ; } System . out . println ( " Octal ▁ equivalent ▁ = ▁ " + octal ( s ) ) ; } } } public static void main ( String [ ] args ) { @ SuppressWarnings ( " unchecked " ) List < List < Integer > > graph = new ArrayList ( ) ; for ( int i = 0 ; i < 1001 ; i ++ ) graph . add ( new ArrayList < Integer > ( ) ) ; int E = 4 , V = 7 ; List < Integer > values = new ArrayList < Integer > ( ) ; values . add ( 0 ) ; values . add ( 1 ) ; values . add ( 0 ) ; values . add ( 0 ) ; values . add ( 0 ) ; values . add ( 1 ) ; values . add ( 1 ) ; graph . get ( 1 ) . add ( 2 ) ; graph . get ( 2 ) . add ( 1 ) ; graph . get ( 3 ) . add ( 4 ) ; graph . get ( 4 ) . add ( 3 ) ; graph . get ( 4 ) . add ( 5 ) ; graph . get ( 5 ) . add ( 4 ) ; graph . get ( 6 ) . add ( 7 ) ; graph . get ( 7 ) . add ( 6 ) ; octalValue ( graph , V , values ) ; } }

Index/key variables: i, j, v
Accumulator variables: i, j, octal, s
Iterator variables: i, j
Class/struct names: GFG