dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static boolean isVowel ( char ch ) { ch = Character . toUpperCase ( ch ) ; return ( ch == ' A ' ch == ' E ' ch == ' I ' ch == ' O ' ch == ' U ' ) ; } static String duplicateVowels ( String str ) { int t = str . length ( ) ; String res = " " ; for ( int i = 0 ; i < t ; i ++ ) { if ( isVowel ( str . charAt ( i ) ) ) res += str . charAt ( i ) ; res += str . charAt ( i ) ; } return res ; } public static void main ( String [ ] args ) { String str = " helloworld " ; System . out . println ( " Original ▁ String : ▁ " + str ) ; String res = duplicateVowels ( str ) ; System . out . println ( " String ▁ with ▁ Vowels ▁ duplicated : ▁ " + res ) ; } }

Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static int stringToInt ( String str ) { if ( str . length ( ) == 1 ) return ( str . charAt ( 0 ) - '0' ) ; double y = stringToInt ( str . substring ( 1 ) ) ; double x = str . charAt ( 0 ) - '0' ; x = x * Math . pow ( 10 , str . length ( ) - 1 ) + y ; return ( int ) ( x ) ; } public static void main ( String [ ] args ) { String str = "1235" ; System . out . print ( stringToInt ( str ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int MAX = 26 ; static int largestSubSeq ( String arr [ ] , int n ) { int [ ] count = new int [ MAX ] ; for ( int i = 0 ; i < n ; i ++ ) { String str = arr [ i ] ; boolean [ ] hash = new boolean [ MAX ] ; for ( int j = 0 ; j < str . length ( ) ; j ++ ) { hash [ str . charAt ( j ) - ' a ' ] = true ; } for ( int j = 0 ; j < MAX ; j ++ ) { if ( hash [ j ] ) count [ j ] ++ ; } } int max = - 1 ; for ( int i = 0 ; i < MAX ; i ++ ) { if ( max < count [ i ] ) max = count [ i ] ; } return max ; } public static void main ( String [ ] args ) { String arr [ ] = { " ab " , " bc " , " de " } ; int n = arr . length ; System . out . println ( largestSubSeq ( arr , n ) ) ; } }

Index/key variables: MAX, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static boolean isPalindrome ( String str ) { int len = str . length ( ) ; for ( int i = 0 ; i < len / 2 ; i ++ ) { if ( str . charAt ( i ) != str . charAt ( len - 1 - i ) ) return false ; } return true ; } static boolean createStringAndCheckPalindrome ( int N ) { String sub = " " + N , res_str = " " ; int sum = 0 ; while ( N > 0 ) { int digit = N % 10 ; sum += digit ; N = N / 10 ; } while ( res_str . length ( ) < sum ) res_str += sub ; if ( res_str . length ( ) > sum ) res_str = res_str . substring ( 0 , sum ) ; if ( isPalindrome ( res_str ) ) return true ; return false ; } public static void main ( String args [ ] ) { int N = 10101 ; if ( createStringAndCheckPalindrome ( N ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: i, res_str, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int minimumLength ( String s ) { int maxOcc = 0 , n = s . length ( ) ; int arr [ ] = new int [ 26 ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ s . charAt ( i ) - ' a ' ] ++ ; for ( int i = 0 ; i < 26 ; i ++ ) if ( arr [ i ] > maxOcc ) maxOcc = arr [ i ] ; return ( n - maxOcc ) ; } public static void main ( String [ ] args ) { String str = " afddewqd " ; System . out . println ( minimumLength ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void removeSpecialCharacter ( String s ) { for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) < ' A ' || s . charAt ( i ) > ' Z ' && s . charAt ( i ) < ' a ' || s . charAt ( i ) > ' z ' ) { s = s . substring ( 0 , i ) + s . substring ( i + 1 ) ; i -- ; } } System . out . print ( s ) ; } public static void main ( String [ ] args ) { String s = " $ Gee * k ; s . . fo , ▁ r ' Ge ^ eks ? " ; removeSpecialCharacter ( s ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void removeSpecialCharacter ( String str ) { char [ ] s = str . toCharArray ( ) ; int j = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( ( s [ i ] >= ' A ' && s [ i ] <= ' Z ' ) || ( s [ i ] >= ' a ' && s [ i ] <= ' z ' ) ) { s [ j ] = s [ i ] ; j ++ ; } } System . out . println ( String . valueOf ( s ) . substring ( 0 , j ) ) ; } public static void main ( String [ ] args ) { String s = " $ Gee * k ; s . . fo , ▁ r ' Ge ^ eks ? " ; removeSpecialCharacter ( s ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int findRepeatFirstN2 ( String s ) { int p = - 1 , i , j ; for ( i = 0 ; i < s . length ( ) ; i ++ ) { for ( j = i + 1 ; j < s . length ( ) ; j ++ ) { if ( s . charAt ( i ) == s . charAt ( j ) ) { p = i ; break ; } } if ( p != - 1 ) break ; } return p ; } static public void main ( String [ ] args ) { String str = " geeksforgeeks " ; int pos = findRepeatFirstN2 ( str ) ; if ( pos == - 1 ) System . out . println ( " Not ▁ found " ) ; else System . out . println ( str . charAt ( pos ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class Gfg { public static void prCharWithFreq ( String s ) { Map < Character , Integer > d = new HashMap < Character , Integer > ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( d . containsKey ( s . charAt ( i ) ) ) { d . put ( s . charAt ( i ) , d . get ( s . charAt ( i ) ) + 1 ) ; } else { d . put ( s . charAt ( i ) , 1 ) ; } } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( d . get ( s . charAt ( i ) ) != 0 ) { System . out . print ( s . charAt ( i ) ) ; System . out . print ( d . get ( s . charAt ( i ) ) + " ▁ " ) ; d . put ( s . charAt ( i ) , 0 ) ; } } } public static void main ( String [ ] args ) { String S = " geeksforgeeks " ; prCharWithFreq ( S ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: Gfg
Java program:
class GFG { static int possibleStrings ( int n , int r , int b , int g ) { int fact [ ] = new int [ n + 1 ] ; fact [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) fact [ i ] = fact [ i - 1 ] * i ; int left = n - ( r + g + b ) ; int sum = 0 ; for ( int i = 0 ; i <= left ; i ++ ) { for ( int j = 0 ; j <= left - i ; j ++ ) { int k = left - ( i + j ) ; sum = sum + fact [ n ] / ( fact [ i + r ] * fact [ j + b ] * fact [ k + g ] ) ; } } return sum ; } public static void main ( String [ ] args ) { int n = 4 , r = 2 ; int b = 0 , g = 1 ; System . out . println ( possibleStrings ( n , r , b , g ) ) ; } }

Index/key variables: i, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int remAnagram ( String str1 , String str2 ) { int count1 [ ] = new int [ 26 ] ; int count2 [ ] = new int [ 26 ] ; for ( int i = 0 ; i < str1 . length ( ) ; i ++ ) count1 [ str1 . charAt ( i ) - ' a ' ] ++ ; for ( int i = 0 ; i < str2 . length ( ) ; i ++ ) count2 [ str2 . charAt ( i ) - ' a ' ] ++ ; int result = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) result += Math . abs ( count1 [ i ] - count2 [ i ] ) ; return result ; } public static void main ( String [ ] args ) { String str1 = " bcadeh " , str2 = " hea " ; System . out . println ( remAnagram ( str1 , str2 ) ) ; } }

Index/key variables: i
Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
Java program:
public class GFG { static int CHARS = 26 ; static boolean isValidString ( String str ) { int freq [ ] = new int [ CHARS ] ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { freq [ str . charAt ( i ) - ' a ' ] ++ ; } int i , freq1 = 0 , count_freq1 = 0 ; for ( i = 0 ; i < CHARS ; i ++ ) { if ( freq [ i ] != 0 ) { freq1 = freq [ i ] ; count_freq1 = 1 ; break ; } } int j , freq2 = 0 , count_freq2 = 0 ; for ( j = i + 1 ; j < CHARS ; j ++ ) { if ( freq [ j ] != 0 ) { if ( freq [ j ] == freq1 ) { count_freq1 ++ ; } else { count_freq2 = 1 ; freq2 = freq [ j ] ; break ; } } } for ( int k = j + 1 ; k < CHARS ; k ++ ) { if ( freq [ k ] != 0 ) { if ( freq [ k ] == freq1 ) { count_freq1 ++ ; } if ( freq [ k ] == freq2 ) { count_freq2 ++ ; { return false ; } } if ( count_freq1 > 1 && count_freq2 > 1 ) { return false ; } } return true ; } public static void main ( String [ ] args ) { String str = " abcbc " ; if ( isValidString ( str ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

Index/key variables: CHARS, i, j, k
Accumulator variables: count_freq1, count_freq2, i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; public class AllCharsWithSameFrequencyWithOneVarAllowed { public static boolean checkForVariation ( String str ) { if ( str == null || str . isEmpty ( ) ) { return true ; } Map < Character , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { map . put ( str . charAt ( i ) , map . getOrDefault ( str . charAt ( i ) , 0 ) + 1 ) ; } Iterator < Integer > itr = map . values ( ) . iterator ( ) ; boolean first = true , second = true ; int val1 = 0 , val2 = 0 ; int countOfVal1 = 0 , countOfVal2 = 0 ; while ( itr . hasNext ( ) ) { int i = itr . next ( ) ; if ( first ) { val1 = i ; first = false ; countOfVal1 ++ ; continue ; } if ( i == val1 ) { countOfVal1 ++ ; continue ; } if ( second ) { val2 = i ; countOfVal2 ++ ; second = false ; continue ; } if ( i == val2 ) { countOfVal2 ++ ; continue ; } return false ; } if ( countOfVal1 > 1 && countOfVal2 > 1 ) { return false ; } else { return true ; } } public static void main ( String [ ] args ) { System . out . println ( checkForVariation ( " abcbc " ) ) ; } }

Accumulator variables: countOfVal1, countOfVal2, i
Iterator variables: i
Boolean variables: first, second
Class/struct names: AllCharsWithSameFrequencyWithOneVarAllowed
Java program:
class GFG { static int countCompletePairs ( String set1 [ ] , String set2 [ ] , int n , int m ) { int result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { String concat = set1 [ i ] + set2 [ j ] ; int frequency [ ] = new int [ 26 ] ; for ( int k = 0 ; k < concat . length ( ) ; k ++ ) { frequency [ concat . charAt ( k ) - ' a ' ] ++ ; } int k ; for ( k = 0 ; k < 26 ; k ++ ) { if ( frequency [ k ] < 1 ) { break ; } } if ( k == 26 ) { result ++ ; } } } return result ; } static public void main ( String [ ] args ) { String set1 [ ] = { " abcdefgh " , " geeksforgeeks " , " lmnopqrst " , " abc " } ; String set2 [ ] = { " ijklmnopqrstuvwxyz " , " abcdefghijklmnopqrstuvwxyz " , " defghijklmnopqrstuvwxyz " } ; int n = set1 . length ; int m = set2 . length ; System . out . println ( countCompletePairs ( set1 , set2 , n , m ) ) ; } }

Index/key variables: i, j, k
Accumulator variables: i, j, k, result
Iterator variables: i, j, k
Class/struct names: GFG
Java program:
class GFG { static int countCompletePairs ( String set1 [ ] , String set2 [ ] , int n , int m ) { int result = 0 ; int [ ] con_s1 = new int [ n ] ; int [ ] con_s2 = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { con_s1 [ i ] = 0 ; for ( int j = 0 ; j < set1 [ i ] . length ( ) ; j ++ ) { con_s1 [ i ] = con_s1 [ i ] | ( 1 << ( set1 [ i ] . charAt ( j ) - ' a ' ) ) ; } } for ( int i = 0 ; i < m ; i ++ ) { con_s2 [ i ] = 0 ; for ( int j = 0 ; j < set2 [ i ] . length ( ) ; j ++ ) { con_s2 [ i ] = con_s2 [ i ] | ( 1 << ( set2 [ i ] . charAt ( j ) - ' a ' ) ) ; } } long complete = ( 1 << 26 ) - 1 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( ( con_s1 [ i ] con_s2 [ j ] ) == complete ) { result ++ ; } } } return result ; } public static void main ( String args [ ] ) { String set1 [ ] = { " abcdefgh " , " geeksforgeeks " , " lmnopqrst " , " abc " } ; String set2 [ ] = { " ijklmnopqrstuvwxyz " , " abcdefghijklmnopqrstuvwxyz " , " defghijklmnopqrstuvwxyz " } ; int n = set1 . length ; int m = set2 . length ; System . out . println ( countCompletePairs ( set1 , set2 , n , m ) ) ; } }

Index/key variables: i, j, m, n
Accumulator variables: i, j, result
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static String encodeString ( String str ) { HashMap < Character , Integer > map = new HashMap < > ( ) ; String res = " " ; int i = 0 ; char ch ; for ( int j = 0 ; j < str . length ( ) ; j ++ ) { ch = str . charAt ( j ) ; if ( ! map . containsKey ( ch ) ) map . put ( ch , i ++ ) ; res += map . get ( ch ) ; } return res ; } static void findMatchedWords ( String [ ] dict , String pattern ) { int len = pattern . length ( ) ; String hash = encodeString ( pattern ) ; for ( String word : dict ) { if ( word . length ( ) == len && encodeString ( word ) . equals ( hash ) ) System . out . print ( word + " ▁ " ) ; } } public static void main ( String args [ ] ) { String [ ] dict = { " abb " , " abc " , " xyz " , " xyy " } ; String pattern = " foo " ; findMatchedWords ( dict , pattern ) ; } }

Accumulator variables: i, j, res
Iterator variables: j, word
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean check ( String pattern , String word ) { if ( pattern . length ( ) != word . length ( ) ) return false ; int [ ] ch = new int [ 128 ] ; int Len = word . length ( ) ; for ( int i = 0 ; i < Len ; i ++ ) { if ( ch [ ( int ) pattern . charAt ( i ) ] == 0 ) { ch [ ( int ) pattern . charAt ( i ) ] = word . charAt ( i ) ; } else if ( ch [ ( int ) pattern . charAt ( i ) ] != word . charAt ( i ) ) { return false ; } } return true ; } static void findMatchedWords ( HashSet < String > dict , String pattern ) { int Len = pattern . length ( ) ; String result = " ▁ " ; for ( String word : dict ) { if ( check ( pattern , word ) ) { result = word + " ▁ " + result ; } } System . out . print ( result ) ; } public static void main ( String [ ] args ) { HashSet < String > dict = new HashSet < String > ( ) ; dict . add ( " abb " ) ; dict . add ( " abc " ) ; dict . add ( " xyz " ) ; dict . add ( " xyy " ) ; String pattern = " foo " ; findMatchedWords ( dict , pattern ) ; } }

Accumulator variables: i
Iterator variables: i, word
Class/struct names: GFG
Java program:
class GFG { public static int countWords ( String str ) { if ( str == null || str . isEmpty ( ) ) return 0 ; int wordCount = 0 ; boolean isWord = false ; int endOfLine = str . length ( ) - 1 ; char [ ] ch = str . toCharArray ( ) ; for ( int i = 0 ; i < ch . length ; i ++ ) { if ( Character . isLetter ( ch [ i ] ) && i != endOfLine ) isWord = true ; else if ( ! Character . isLetter ( ch [ i ] ) && isWord ) { wordCount ++ ; isWord = false ; } else if ( Character . isLetter ( ch [ i ] ) && i == endOfLine ) wordCount ++ ; } return wordCount ; } public static void main ( String args [ ] ) { String str = "One two	three four five "; System . out . println ( " No ▁ of ▁ words ▁ : ▁ " + countWords ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i, wordCount
Iterator variables: i
Boolean variables: isWord
Class/struct names: GFG
Java program:
class GFG { public static String [ ] RevString ( String [ ] s , int l ) { if ( l % 2 == 0 ) { int j = l / 2 ; while ( j <= l - 1 ) { String temp ; temp = s [ l - j - 1 ] ; s [ l - j - 1 ] = s [ j ] ; s [ j ] = temp ; j += 1 ; } } else { int j = ( l / 2 ) + 1 ; while ( j <= l - 1 ) { String temp ; temp = s [ l - j - 1 ] ; s [ l - j - 1 ] = s [ j ] ; s [ j ] = temp ; j += 1 ; } } return s ; } public static void main ( String [ ] args ) { String s = " getting ▁ good ▁ at ▁ coding ▁ " + " needs ▁ a ▁ lot ▁ of ▁ practice " ; String [ ] words = s . split ( " \\ s " ) ; words = RevString ( words , words . length ) ; s = String . join ( " ▁ " , words ) ; System . out . println ( s ) ; } }

Index/key variables: j
Accumulator variables: j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void printPath ( Vector < Integer > res , int nThNode , int kThNode ) { if ( kThNode > nThNode ) return ; res . add ( kThNode ) ; for ( int i = 0 ; i < res . size ( ) ; i ++ ) System . out . print ( res . get ( i ) + " ▁ " ) ; System . out . print ( "NEW_LINE"); printPath ( res , nThNode , kThNode * 2 ) ; printPath ( res , nThNode , kThNode * 2 + 1 ) ; res . remove ( res . size ( ) - 1 ) ; } static void printPathToCoverAllNodeUtil ( int nThNode ) { Vector < Integer > res = new Vector < Integer > ( ) ; printPath ( res , nThNode , 1 ) ; } public static void main ( String args [ ] ) { int nThNode = 7 ; printPathToCoverAllNodeUtil ( nThNode ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int getMid ( int s , int e ) { return s + ( e - s ) / 2 ; } static boolean isArmstrong ( int x ) { int n = String . valueOf ( x ) . length ( ) ; int sum1 = 0 ; int temp = x ; while ( temp > 0 ) { int digit = temp % 10 ; sum1 += Math . pow ( digit , n ) ; temp /= 10 ; } if ( sum1 == x ) return true ; return false ; } static int MaxUtil ( int [ ] st , int ss , int se , int l , int r , int node ) { if ( l <= ss && r >= se ) return st [ node ] ; if ( se < l ss > r ) return - 1 ; int mid = getMid ( ss , se ) ; return Math . max ( MaxUtil ( st , ss , mid , l , r , 2 * node ) , MaxUtil ( st , mid + 1 , se , l , r , 2 * node + 1 ) ) ; } static void updateValue ( int arr [ ] , int [ ] st , int ss , int se , int index , int value , int node ) { if ( index < ss index > se ) { System . out . print ( " Invalid ▁ Input " + "NEW_LINE"); return ; } if ( ss == se ) { arr [ index ] = value ; if ( isArmstrong ( value ) ) st [ node ] = value ; else st [ node ] = - 1 ; } else { int mid = getMid ( ss , se ) ; if ( index >= ss && index <= mid ) updateValue ( arr , st , ss , mid , index , value , 2 * node ) ; else updateValue ( arr , st , mid + 1 , se , index , value , 2 * node + 1 ) ; st [ node ] = Math . max ( st [ 2 * node + 1 ] , st [ 2 * node + 2 ] ) ; } return ; } static int getMax ( int [ ] st , int n , int l , int r ) { if ( l < 0 r > n - 1 l > r ) { System . out . printf ( " Invalid ▁ Input " ) ; return - 1 ; } return MaxUtil ( st , 0 , n - 1 , l , r , 0 ) ; } static int constructSTUtil ( int arr [ ] , int ss , int se , int [ ] st , int si ) { if ( ss == se ) { if ( isArmstrong ( arr [ ss ] ) ) st [ si ] = arr [ ss ] ; else st [ si ] = - 1 ; return st [ si ] ; } int mid = getMid ( ss , se ) ; st [ si ] = Math . max ( constructSTUtil ( arr , ss , mid , st , si * 2 ) , constructSTUtil ( arr , mid + 1 , se , st , si * 2 + 1 ) ) ; return st [ si ] ; } static int [ ] constructST ( int arr [ ] , int n ) { int x = ( int ) ( Math . ceil ( Math . log ( n ) ) ) ; int max_size = 2 * ( int ) Math . pow ( 2 , x ) - 1 ; int [ ] st = new int [ max_size ] ; constructSTUtil ( arr , 0 , n - 1 , st , 0 ) ; return st ; } public static void main ( String [ ] args ) { int arr [ ] = { 192 , 113 , 535 , 7 , 19 , 111 } ; int n = arr . length ; int [ ] st = constructST ( arr , n ) ; System . out . print ( " Maximum ▁ armstrong ▁ " + " number ▁ in ▁ given ▁ range ▁ = ▁ " + getMax ( st , n , 1 , 3 ) + "NEW_LINE"); updateValue ( arr , st , 0 , n - 1 , 1 , 153 , 0 ) ; System . out . print ( " Updated ▁ Maximum ▁ armstrong ▁ " + " number ▁ in ▁ given ▁ range ▁ = ▁ " + getMax ( st , n , 1 , 3 ) + "NEW_LINE"); } }

Index/key variables: index, max_size, node, si, ss
Accumulator variables: sum1, temp
Class/struct names: GFG
Java program:
class GFG { static void maxRegions ( int n ) { int num ; num = n * ( n + 1 ) / 2 + 1 ; System . out . println ( num ) ; ; } public static void main ( String [ ] args ) { int n = 10 ; maxRegions ( n ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void checkSolveable ( int n , int m ) { if ( n == 1 m == 1 ) System . out . print ( " YES " ) ; else if ( m == 2 && n == 2 ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } public static void main ( String [ ] args ) { int n = 1 , m = 3 ; checkSolveable ( n , m ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int GCD ( int a , int b ) { if ( b == 0 ) return a ; else return GCD ( b , a % b ) ; } static void check ( int x , int y ) { if ( GCD ( x , y ) == 1 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } public static void main ( String [ ] args ) { int X = 2 , Y = 7 ; check ( X , Y ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final int size = 1000001 ; static void seiveOfEratosthenes ( int [ ] prime ) { prime [ 0 ] = 1 ; prime [ 1 ] = 0 ; for ( int i = 2 ; i * i < 1000001 ; i ++ ) { if ( prime [ i ] == 0 ) { for ( int j = i * i ; j < 1000001 ; j += i ) { prime [ j ] = 1 ; } } } } static float probabiltyEuler ( int [ ] prime , int L , int R , int M ) { int [ ] arr = new int [ size ] ; int [ ] eulerTotient = new int [ size ] ; int count = 0 ; for ( int i = L ; i <= R ; i ++ ) { eulerTotient [ i - L ] = i ; arr [ i - L ] = i ; } for ( int i = 2 ; i < 1000001 ; i ++ ) { if ( prime [ i ] == 0 ) { for ( int j = ( L / i ) * i ; j <= R ; j += i ) { if ( j - L >= 0 ) { eulerTotient [ j - L ] = eulerTotient [ j - L ] / i * ( i - 1 ) ; while ( arr [ j - L ] % i == 0 ) { arr [ j - L ] /= i ; } } } } } for ( int i = L ; i <= R ; i ++ ) { if ( arr [ i - L ] > 1 ) { eulerTotient [ i - L ] = ( eulerTotient [ i - L ] / arr [ i - L ] ) * ( arr [ i - L ] - 1 ) ; } } for ( int i = L ; i <= R ; i ++ ) { if ( ( eulerTotient [ i - L ] % M ) == 0 ) { count ++ ; } } return ( float ) ( 1.0 * count / ( R + 1 - L ) ) ; } public static void main ( String [ ] args ) { int [ ] prime = new int [ size ] ; seiveOfEratosthenes ( prime ) ; int L = 1 , R = 7 , M = 3 ; System . out . print ( probabiltyEuler ( prime , L , R , M ) ) ; } }

Index/key variables: i, j, size
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static void findWinner ( int n , int k ) { int cnt = 0 ; if ( n == 1 ) System . out . println ( " No " ) ; else if ( ( n & 1 ) != 0 n == 2 ) System . out . println ( " Yes " ) ; else { int tmp = n ; int val = 1 ; while ( tmp > k && tmp % 2 == 0 ) { tmp /= 2 ; val *= 2 ; } for ( int i = 3 ; i <= Math . sqrt ( tmp ) ; i ++ ) { while ( tmp % i == 0 ) { cnt ++ ; tmp /= i ; } } if ( tmp > 1 ) cnt ++ ; if ( val == n ) System . out . println ( " No " ) ; else if ( n / tmp == 2 && cnt == 1 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } public static void main ( String [ ] args ) { int n = 1 , k = 1 ; findWinner ( n , k ) ; } }

Accumulator variables: cnt, i, tmp, val
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void pen_hex ( long n ) { long pn = 1 ; for ( long i = 1 ; i < n ; i ++ ) { pn = i * ( 3 * i - 1 ) / 2 ; if ( pn > n ) break ; double seqNum = ( 1 + Math . sqrt ( 8 * pn + 1 ) ) / 4 ; if ( seqNum == ( long ) seqNum ) System . out . print ( pn + " , ▁ " ) ; } } public static void main ( String [ ] args ) { long N = 1000000 ; pen_hex ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isPal ( int a [ ] [ ] , int n , int m ) { for ( int i = 0 ; i < n / 2 ; i ++ ) { for ( int j = 0 ; j < m - 1 ; j ++ ) { if ( a [ i ] [ j ] != a [ n - 1 - i ] [ m - 1 - j ] ) return false ; } } return true ; } public static void main ( String [ ] args ) { int n = 3 , m = 3 ; int a [ ] [ ] = { { 1 , 2 , 3 } , { 4 , 5 , 4 } , { 3 , 2 , 1 } } ; if ( isPal ( a , n , m ) ) { System . out . print ( " YES " + "NEW_LINE"); } else { System . out . print ( " NO " + "NEW_LINE"); } } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int getSum ( int n ) { int sum = 0 ; while ( n != 0 ) { sum = sum + n % 10 ; n = n / 10 ; } return sum ; } static void smallestNumber ( int N ) { int i = 1 ; while ( 1 != 0 ) { if ( getSum ( i ) == N ) { System . out . print ( i ) ; break ; } i ++ ; } } public static void main ( String [ ] args ) { int N = 10 ; smallestNumber ( N ) ; } }

Accumulator variables: i
Class/struct names: GFG