dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static int [ ] spf = new int [ 100005 ] ; static void sieve ( ) { for ( int i = 2 ; i < 100005 ; i ++ ) { if ( spf [ i ] == 0 ) { spf [ i ] = i ; for ( int j = 2 * i ; j < 100005 ; j += i ) { if ( spf [ j ] == 0 ) spf [ j ] = i ; } } } } static void factorize ( int n , HashSet < Integer > s ) { while ( n > 1 ) { int z = spf [ n ] ; s . add ( z ) ; while ( n % z == 0 ) n /= z ; } } static int [ ] id = new int [ 100005 ] ; static int [ ] par = new int [ 100005 ] ; static int [ ] sizeContainer = new int [ 100005 ] ; static int root ( int i ) { if ( par [ i ] == i ) return i ; else return par [ i ] = root ( par [ i ] ) ; } static void merge ( int a , int b ) { int p = root ( a ) ; int q = root ( b ) ; if ( p == q ) return ; if ( sizeContainer [ p ] > sizeContainer [ q ] ) { p = p + q ; q = p - q ; p = p - q ; } par [ p ] = q ; sizeContainer [ q ] += sizeContainer [ p ] ; } static int maximumComponentsizeContainer ( int a [ ] , int n ) { for ( int i = 0 ; i < 100005 ; i ++ ) { par [ i ] = i ; sizeContainer [ i ] = 1 ; } sieve ( ) ; for ( int i = 0 ; i < n ; i ++ ) { HashSet < Integer > s = new HashSet < Integer > ( ) ; factorize ( a [ i ] , s ) ; for ( int it : s ) { if ( id [ it ] == 0 ) id [ it ] = i + 1 ; else merge ( i + 1 , id [ it ] ) ; } } int answer = 0 ; for ( int i = 0 ; i < n ; i ++ ) answer = Math . max ( answer , sizeContainer [ i ] ) ; return answer ; } public static void main ( String [ ] args ) { int n = 8 ; int A [ ] = { 2 , 3 , 6 , 7 , 4 , 12 , 21 , 39 } ; System . out . print ( maximumComponentsizeContainer ( A , n ) ) ; } }

Index/key variables: i, it, j, n, p, q
Accumulator variables: i, j, n
Iterator variables: i, it, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int N = 1000000 ; static Vector < Integer > prime = new Vector < Integer > ( ) ; static void SieveOfEratosthenes ( ) { boolean [ ] check = new boolean [ N + 1 ] ; Arrays . fill ( check , true ) ; for ( int p = 2 ; p * p <= N ; p ++ ) { if ( check [ p ] == true ) { prime . add ( p ) ; for ( int i = p * p ; i <= N ; i += p ) check [ i ] = false ; } } } static class Node { int key ; Node left , right ; } ; static Node newNode ( int key ) { Node temp = new Node ( ) ; temp . key = key ; temp . left = temp . right = null ; return ( temp ) ; } static boolean IsChilrenPrimeFactor ( Node parent , Node a ) { if ( prime . get ( a . key ) > 0 && ( parent . key % a . key == 0 ) ) return true ; else return false ; } static int GetCount ( Node node ) { if ( node == null ) return 0 ; Queue < Node > q = new LinkedList < > ( ) ; int count = 0 ; q . add ( node ) ; while ( ! q . isEmpty ( ) ) { Node temp = q . peek ( ) ; q . remove ( ) ; if ( temp . left == null && temp . right != null ) { if ( IsChilrenPrimeFactor ( temp , temp . right ) ) count ++ ; } else { if ( temp . right == null && temp . left != null ) { if ( IsChilrenPrimeFactor ( temp , temp . left ) ) count ++ ; } else { if ( temp . left != null && temp . right != null ) { if ( IsChilrenPrimeFactor ( temp , temp . right ) && IsChilrenPrimeFactor ( temp , temp . left ) ) count ++ ; } } } if ( temp . left != null ) q . add ( temp . left ) ; if ( temp . right != null ) q . add ( temp . right ) ; } return count ; } public static void main ( String [ ] args ) { Node root = newNode ( 10 ) ; root . left = newNode ( 2 ) ; root . right = newNode ( 5 ) ; root . right . left = newNode ( 18 ) ; root . right . right = newNode ( 12 ) ; root . right . left . left = newNode ( 2 ) ; root . right . left . right = newNode ( 3 ) ; root . right . right . left = newNode ( 3 ) ; root . right . right . right = newNode ( 14 ) ; root . right . right . right . left = newNode ( 7 ) ; SieveOfEratosthenes ( ) ; System . out . print ( GetCount ( root ) + "NEW_LINE"); } }

Index/key variables: i, p
Accumulator variables: count, i, p
Iterator variables: i, p
Class/struct names: GFG, Node
Java program:
import java . util . * ; class GFG { static String check ( int [ ] Arr , int n , int M , int K ) { int flag = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( Arr [ i ] == 0 ) flag = 1 ; } if ( K % 2 != 0 && flag == 0 ) return " No " ; else return " Yes " ; } public static void main ( String args [ ] ) { int [ ] Arr = { 1 , 1 , 2 , 4 , 7 , 8 } ; int M = 5 ; int K = 6 ; int n = Arr . length ; System . out . println ( check ( Arr , n , M , K ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int [ ] pref = new int [ 100001 ] ; static int checkArmstrong ( 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 x ; return 0 ; } static void preCompute ( ) { for ( int i = 1 ; i < 100001 ; i ++ ) { pref [ i ] = pref [ i - 1 ] + checkArmstrong ( i ) ; } } static void printSum ( int L , int R ) { System . out . println ( pref [ R ] - pref [ L - 1 ] ) ; } static void printSumarmstrong ( int [ ] [ ] arr , int Q ) { preCompute ( ) ; for ( int i = 0 ; i < Q ; i ++ ) { printSum ( arr [ i ] [ 0 ] , arr [ i ] [ 1 ] ) ; } } public static void main ( String [ ] args ) { int Q = 2 ; int [ ] [ ] arr = { { 1 , 13 } , { 121 , 211 } } ; printSumarmstrong ( arr , Q ) ; } }

Index/key variables: R, i
Accumulator variables: i, sum1, temp
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int [ ] prime = new int [ 100001 ] ; static int [ ] k = new int [ 100001 ] ; static void Sieve ( ) { for ( int i = 1 ; i < 100001 ; i ++ ) k [ i ] = i ; for ( int i = 2 ; i < 100001 ; i ++ ) { if ( prime [ i ] == 0 ) for ( int j = i ; j < 100001 ; j += i ) { prime [ j ] = 1 ; while ( k [ j ] % ( i * i ) == 0 ) k [ j ] /= ( i * i ) ; } } } static int countPairs ( int arr [ ] , int n ) { HashMap < Integer , Integer > freq = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( freq . containsKey ( k [ arr [ i ] ] ) ) { freq . put ( k [ arr [ i ] ] , freq . get ( k [ arr [ i ] ] ) + 1 ) ; } else freq . put ( k [ arr [ i ] ] , 1 ) ; } int sum = 0 ; for ( Map . Entry < Integer , Integer > i : freq . entrySet ( ) ) { sum += ( ( i . getValue ( ) - 1 ) * i . getValue ( ) ) / 2 ; } return sum ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 4 , 8 , 5 , 6 } ; int n = arr . length ; Sieve ( ) ; System . out . print ( countPairs ( arr , n ) + "NEW_LINE"); } }

Index/key variables: i, j
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { public static int [ ] pref = new int [ 100010 ] ; static int isPerfectCube ( int x ) { double cr = Math . round ( Math . cbrt ( x ) ) ; if ( cr * cr * cr == ( double ) x ) return x ; return 0 ; } static void compute ( ) { for ( int i = 1 ; i <= 100000 ; ++ i ) { pref [ i ] = pref [ i - 1 ] + isPerfectCube ( i ) ; } } static void printSum ( int L , int R ) { long sum = pref [ R ] - pref [ L - 1 ] ; System . out . print ( sum + " ▁ " ) ; } public static void main ( String [ ] args ) { compute ( ) ; int Q = 4 ; int [ ] [ ] arr = { { 1 , 10 } , { 1 , 100 } , { 2 , 25 } , { 4 , 50 } } ; for ( int i = 0 ; i < Q ; i ++ ) { printSum ( arr [ i ] [ 0 ] , arr [ i ] [ 1 ] ) ; } } }

Index/key variables: R, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . lang . * ; class GFG { public static int binomialCoeff ( int n , int k ) { int [ ] [ ] C = new int [ n + 1 ] [ k + 1 ] ; int i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= Math . min ( i , k ) ; j ++ ) { if ( j == 0 j == i ) C [ i ] [ j ] = 1 ; else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ; } } return C [ n ] [ k ] ; } public static int count ( int n , int k ) { int sum = 0 ; for ( int j = 1 ; j <= k ; j ++ ) { sum = sum + binomialCoeff ( n , j ) ; } return sum ; } public static void main ( String args [ ] ) { GFG g = new GFG ( ) ; int n = 3 , k = 2 ; System . out . print ( count ( n , k ) ) ; int n1 = 5 , k1 = 2 ; System . out . print ( count ( n1 , k1 ) ) ; } }

Index/key variables: i, j, k, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class Node { int data ; Node left , right ; Node ( int item ) { data = item ; left = right ; } } class BinaryTree { Node root1 , root2 ; boolean isIsomorphic ( Node n1 , Node n2 ) { if ( n1 == null && n2 == null ) return true ; if ( n1 == null n2 == null ) return false ; if ( n1 . data != n2 . data ) return false ; return ( isIsomorphic ( n1 . left , n2 . left ) && isIsomorphic ( n1 . right , n2 . right ) ) || ( isIsomorphic ( n1 . left , n2 . right ) && isIsomorphic ( n1 . right , n2 . left ) ) ; } public static void main ( String args [ ] ) { BinaryTree tree = new BinaryTree ( ) ; tree . root1 = new Node ( 1 ) ; tree . root1 . left = new Node ( 2 ) ; tree . root1 . right = new Node ( 3 ) ; tree . root1 . left . left = new Node ( 4 ) ; tree . root1 . left . right = new Node ( 5 ) ; tree . root1 . right . left = new Node ( 6 ) ; tree . root1 . left . right . left = new Node ( 7 ) ; tree . root1 . left . right . right = new Node ( 8 ) ; tree . root2 = new Node ( 1 ) ; tree . root2 . left = new Node ( 3 ) ; tree . root2 . right = new Node ( 2 ) ; tree . root2 . right . left = new Node ( 4 ) ; tree . root2 . right . right = new Node ( 5 ) ; tree . root2 . left . right = new Node ( 6 ) ; tree . root2 . right . right . left = new Node ( 8 ) ; tree . root2 . right . right . right = new Node ( 7 ) ; if ( tree . isIsomorphic ( tree . root1 , tree . root2 ) == true ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Class/struct names: BinaryTree, Node
Java program:
import java . util . * ; class GFG { static String findNumber ( int s , int d ) { String num = " " ; int val = s / d ; int rem = s % d ; int i ; for ( i = 1 ; i <= d - rem ; i ++ ) { num = num + String . valueOf ( val ) ; } if ( rem > 0 ) { val ++ ; for ( i = d - rem + 1 ; i <= d ; i ++ ) { num = num + String . valueOf ( val ) ; } } return num ; } public static void main ( String [ ] args ) { int s = 25 , d = 4 ; System . out . print ( findNumber ( s , d ) ) ; } }

Accumulator variables: i, val
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int kthSmallest ( int a , int k ) { int res = 0 ; int j = 0 ; for ( int i = 0 ; i < 32 ; i ++ ) { while ( j < 32 && ( a & ( 1 << j ) ) > 0 ) j ++ ; if ( ( k & ( 1 << i ) ) > 0 ) res |= ( 1 << j ) ; j ++ ; } return res ; } public static void main ( String [ ] args ) { int a = 10 , k = 3 ; System . out . print ( kthSmallest ( a , k ) + "NEW_LINE"); } }

Accumulator variables: i, j, res
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int fastmod ( int base , int exp , int mod ) { if ( exp == 0 ) return 1 ; else if ( exp % 2 == 0 ) { int ans = fastmod ( base , exp / 2 , mod ) ; return ( ans % mod * ans % mod ) % mod ; } else return ( fastmod ( base , exp - 1 , mod ) % mod * base % mod ) % mod ; } static int countSetBits ( int n ) { int count = 0 ; while ( n > 0 ) { count += n & 1 ; n >>= 1 ; } return count ; } static int findPowerSum ( int n , int ar [ ] ) { final int mod = ( int ) 1e9 + 7 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int base = countSetBits ( ar [ i ] ) ; int exp = ar [ i ] ; sum += fastmod ( base , exp , mod ) ; sum %= mod ; } return sum ; } public static void main ( String [ ] args ) { int n = 3 ; int ar [ ] = { 1 , 2 , 3 } ; System . out . println ( findPowerSum ( n , ar ) ) ; } }

Index/key variables: i
Accumulator variables: count, i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
class Gfg { public static int CountTriangles ( int n ) { int curr = 1 ; int Tri_count = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { Tri_count = ( curr * 3 ) + 2 ; curr = Tri_count ; } return Tri_count ; } public static void main ( String [ ] args ) { int n = 10 ; System . out . println ( CountTriangles ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: Gfg
Java program:
import java . util . * ; class GFG { static int numSeq ( int n ) { return ( int ) ( ( Math . pow ( 3 , n ) + 3 * Math . pow ( - 1 , n ) ) / 4 ) ; } public static void main ( String [ ] args ) { int N = 10 ; System . out . printf ( " % d " , numSeq ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class gfg { static int sub_arrays ( int [ ] a , int n , int k ) { int sum [ ] = new int [ n + 2 ] ; for ( int i = 0 ; i < n + 2 ; i ++ ) { sum [ i ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { a [ i ] -- ; a [ i ] %= k ; sum [ i + 1 ] += sum [ i ] + a [ i ] ; sum [ i + 1 ] %= k ; } int ans = 0 , l = 0 , r = 0 ; HashMap < Integer , Integer > mp = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n + 1 ; i ++ ) { mp . put ( sum [ i ] , 0 ) ; } int temp ; for ( int i = 0 ; i < n + 1 ; i ++ ) { ans += ( int ) mp . get ( sum [ i ] ) ; temp = ( int ) mp . get ( sum [ i ] ) + 1 ; mp . put ( sum [ i ] , temp ) ; r ++ ; if ( r - l >= k ) { temp = ( int ) mp . get ( sum [ l ] ) - 1 ; mp . put ( sum [ l ] , temp ) ; l ++ ; } } return ans ; } public static void main ( String args [ ] ) { int [ ] a = { 1 , 4 , 2 , 3 , 5 } ; int n = a . length ; int k = 4 ; System . out . print ( sub_arrays ( a , n , k ) ) ; } }

Index/key variables: i, l
Accumulator variables: ans, i, l, r
Iterator variables: i
Class/struct names: gfg
Java program:
import java . util . * ; class GFG { static void sieve ( boolean prime [ ] , int n ) { prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * p ; i <= n ; i += p ) prime [ i ] = false ; } } } static int sumPrime ( int d ) { int maxVal = ( int ) ( Math . pow ( 2 , d ) - 1 ) ; boolean [ ] prime = new boolean [ maxVal + 1 ] ; Arrays . fill ( prime , true ) ; sieve ( prime , maxVal ) ; int sum = 0 ; for ( int i = 2 ; i <= maxVal ; i ++ ) { if ( prime [ i ] ) { sum += i ; } } return sum ; } public static void main ( String [ ] args ) { int d = 8 ; System . out . println ( sumPrime ( d ) ) ; } }

Index/key variables: i, p
Accumulator variables: i, p, sum
Iterator variables: i, p
Class/struct names: GFG
Java program:
class GFG { static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } static boolean isPossible ( int [ ] arr , int n , int p ) { int gcd = 0 ; for ( int i = 0 ; i < n ; i ++ ) gcd = __gcd ( gcd , arr [ i ] ) ; if ( p % gcd == 0 ) return true ; return false ; } public static void main ( String [ ] args ) { int arr [ ] = { 6 , 9 } ; int n = arr . length ; int p = 3 ; if ( isPossible ( arr , n , p ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int max_element ( int a [ ] , int n ) { int m = Integer . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) m = Math . max ( m , a [ i ] ) ; return m ; } static void findNum ( int a [ ] , int n , int b [ ] , int m ) { int x = max_element ( a , n ) ; int y = max_element ( b , m ) ; System . out . print ( x + " ▁ " + y ) ; } public static void main ( String args [ ] ) { int a [ ] = { 3 , 2 , 2 } ; int n = a . length ; int b [ ] = { 1 , 5 , 7 , 7 , 9 } ; int m = b . length ; findNum ( a , n , b , m ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; class GFG { static void printArr ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) System . out . print ( arr [ i ] + " ▁ " ) ; } static void generateArr ( int arr [ ] , int n ) { boolean flip = true ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( arr [ i ] & 1 ) != 0 ) { if ( flip ^= true ) System . out . print ( ( int ) ( Math . ceil ( arr [ i ] / 2.0 ) ) + " ▁ " ) ; else System . out . print ( ( int ) ( Math . floor ( arr [ i ] / 2.0 ) ) + " ▁ " ) ; } else { System . out . print ( arr [ i ] / 2 + " ▁ " ) ; } } } public static void main ( String [ ] args ) { int arr [ ] = { 3 , - 5 , - 7 , 9 , 2 , - 2 } ; int n = arr . length ; generateArr ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: flip, i
Iterator variables: i
Boolean variables: flip
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int binomialCoeff ( int n , int k ) { int C [ ] [ ] = new int [ n + 1 ] [ k + 1 ] ; int i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= Math . min ( i , k ) ; j ++ ) { if ( j == 0 j == i ) C [ i ] [ j ] = 1 ; else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ; } } return C [ n ] [ k ] ; } static int cntSubSeq ( int arr [ ] , int n , int k ) { Arrays . sort ( arr ) ; int num = arr [ k - 1 ] ; int Y = 0 ; for ( int i = k - 1 ; i >= 0 ; i -- ) { if ( arr [ i ] == num ) Y ++ ; } int cntX = Y ; for ( int i = k ; i < n ; i ++ ) { if ( arr [ i ] == num ) cntX ++ ; } return binomialCoeff ( cntX , Y ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 } ; int n = arr . length ; int k = 2 ; System . out . println ( cntSubSeq ( arr , n , k ) ) ; } }

Index/key variables: i, j, k, n
Accumulator variables: Y, cntX, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static void convertToBinary ( int num , int a [ ] , int n ) { int pointer = n - 1 ; while ( num > 0 ) { a [ pointer ] = num % 2 ; num = num / 2 ; pointer -- ; } } static void checkforsum ( int a [ ] , int n ) { int sum1 = 0 ; int sum2 = 0 ; int mid = n / 2 ; for ( int i = 0 ; i < mid ; i ++ ) sum1 = sum1 + a [ i ] ; for ( int j = mid ; j < n ; j ++ ) sum2 = sum2 + a [ j ] ; if ( sum1 == sum2 ) { for ( int i = 0 ; i < n ; i ++ ) System . out . print ( a [ i ] ) ; System . out . println ( ) ; } } static void print_seq ( int m ) { int n = ( 2 * m ) ; int a [ ] = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { a [ j ] = 0 ; } for ( int i = 0 ; i < ( int ) Math . pow ( 2 , n ) ; i ++ ) { convertToBinary ( i , a , n ) ; checkforsum ( a , n ) ; } } public static void main ( String [ ] args ) { int m = 2 ; print_seq ( m ) ; } }

Index/key variables: i, j, n, pointer
Accumulator variables: i, j, pointer
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } static boolean coprime ( int a , int b ) { if ( __gcd ( a , b ) == 1 ) return true ; else return false ; } static boolean isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n == 2 n == 3 ) return true ; for ( int i = 2 ; i * i <= n ; i ++ ) if ( n % i == 0 ) return false ; return true ; } static void findNumbers ( int a , int b , int n ) { boolean possible = true ; if ( ! coprime ( a , b ) ) possible = false ; int c1 = 1 ; int c2 = 1 ; int num1 , num2 ; HashSet < Integer > st = new HashSet < Integer > ( ) ; if ( possible ) { while ( ( int ) st . size ( ) != n ) { num1 = a + ( c1 * b ) ; if ( isPrime ( num1 ) ) { st . add ( num1 ) ; } c1 ++ ; num2 = b + ( c2 * a ) ; if ( isPrime ( num2 ) ) { st . add ( num2 ) ; } c2 ++ ; } for ( int i : st ) System . out . print ( i + " ▁ " ) ; } else System . out . print ( " - 1" ) ; } public static void main ( String [ ] args ) { int a = 3 ; int b = 5 ; int n = 4 ; findNumbers ( a , b , n ) ; } }

Accumulator variables: c1, c2, i
Iterator variables: i
Boolean variables: possible
Class/struct names: GFG
Java program:
class GFG { static void findIntegers ( int n , int a [ ] , int x , int t1 , int t2 ) { boolean flag = true ; for ( int i = 0 ; i < n ; i ++ ) { int temp = ( int ) Math . pow ( a [ i ] , 2 ) + x ; if ( temp % 10 != t1 && temp % 10 != t2 ) { System . out . print ( temp + " ▁ " ) ; flag = false ; } } if ( flag ) { System . out . println ( ) ; System . out . print ( " - 1" ) ; } } public static void main ( String args [ ] ) { int N = 4 ; int X = 10 ; int T1 = 5 ; int T2 = 6 ; int a [ ] = { 3 , 1 , 4 , 7 } ; findIntegers ( N , a , X , T1 , T2 ) ; N = 4 ; X = 2 ; T1 = 5 ; T2 = 6 ; int b [ ] = { 2 , 18 , 22 , 8 } ; findIntegers ( N , b , X , T1 , T2 ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
Java program:
class GFG { final static int TEN = 10 ; static int digitSum ( int n ) { int sum = 0 ; while ( n > 0 ) { sum += n % TEN ; n /= TEN ; } return sum ; } static int getNthTerm ( int n ) { int sum = digitSum ( n ) ; if ( sum % TEN == 0 ) return ( n * TEN ) ; int extra = TEN - ( sum % TEN ) ; return ( ( n * TEN ) + extra ) ; } static void firstNTerms ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( getNthTerm ( i ) + " ▁ " ) ; } public static void main ( String [ ] args ) { int n = 10 ; firstNTerms ( n ) ; } }

Accumulator variables: i, n, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int min1 = Integer . MAX_VALUE ; static int count = 0 ; public int permutation ( String str1 , int i , int n , int p ) { if ( i == n ) { int q = Integer . parseInt ( str1 ) ; if ( q - p > 0 && q < min1 ) { min1 = q ; count = 1 ; } } else { for ( int j = i ; j <= n ; j ++ ) { str1 = swap ( str1 , i , j ) ; permutation ( str1 , i + 1 , n , p ) ; str1 = swap ( str1 , i , j ) ; } } return min1 ; } public String swap ( String str , int i , int j ) { char ch [ ] = str . toCharArray ( ) ; char temp = ch [ i ] ; ch [ i ] = ch [ j ] ; ch [ j ] = temp ; return String . valueOf ( ch ) ; } public static void main ( String [ ] args ) { int A = 213 ; int B = 111 ; GFG gfg = new GFG ( ) ; String str1 = Integer . toString ( A ) ; int len = str1 . length ( ) ; int h = gfg . permutation ( str1 , 0 , len - 1 , B ) ; if ( count == 1 ) System . out . println ( h ) ; else System . out . println ( - 1 ) ; } }

Index/key variables: i, j
Accumulator variables: j
Iterator variables: j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int Alcuin ( int n ) { double _n = n , ans ; ans = Math . round ( ( _n * _n ) / 12 ) - Math . floor ( _n / 4 ) * Math . floor ( ( _n + 2 ) / 4 ) ; return ( int ) ans ; } static void solve ( int n ) { int i = 0 ; for ( i = 1 ; i <= n ; i ++ ) { System . out . print ( Alcuin ( i ) + " , ▁ " ) ; } } public static void main ( String [ ] args ) { int n = 15 ; solve ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static int [ ] solve ( int [ ] arr , int n ) { int [ ] b = new int [ n ] ; int p = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { b [ p ] = arr [ i -- ] ; if ( i >= 0 ) b [ n - 1 - p ] = arr [ i ] ; p ++ ; } return b ; } public static void main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int n = arr . length ; int [ ] b = solve ( arr , n ) ; System . out . println ( Arrays . toString ( b ) ) ; } }

Index/key variables: i, n, p
Accumulator variables: i, p
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean productsDistinct ( int N ) { String s = " " ; while ( N > 0 ) { s += ( char ) ( N % 10 + '0' ) ; N /= 10 ; } s = reverse ( s ) ; int sz = s . length ( ) ; HashSet < Integer > se = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < sz ; i ++ ) { int product = 1 ; for ( int j = i ; j < sz ; j ++ ) { product *= ( int ) ( s . charAt ( j ) - '0' ) ; if ( se . contains ( product ) ) return false ; else se . add ( product ) ; } } return true ; } static String reverse ( String input ) { char [ ] a = input . toCharArray ( ) ; int l , r ; r = a . length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return String . valueOf ( a ) ; } public static void main ( String [ ] args ) { int N = 2345 ; if ( productsDistinct ( N ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Index/key variables: l, r
Accumulator variables: N, i, j, l, product, r, s
Iterator variables: i, j, l
Class/struct names: GFG