dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static void calculateFact ( int [ ] fact , int N ) { fact [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) { fact [ i ] = fact [ i - 1 ] * i ; } } static int nCr ( int [ ] fact , int N , int R ) { if ( R > N ) return 0 ; int res = fact [ N ] / fact [ R ] ; res /= fact [ N - R ] ; return res ; } static int countWays ( List < int > arr , int [ ] fact ) { int N = arr . Count ; if ( N <= 2 ) { return 1 ; } List < int > leftSubTree = new List < int > ( ) ; List < int > rightSubTree = new List < int > ( ) ; int root = arr [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { if ( arr [ i ] < root ) { leftSubTree . Add ( arr [ i ] ) ; } else { rightSubTree . Add ( arr [ i ] ) ; } } int N1 = leftSubTree . Count ; int N2 = rightSubTree . Count ; int countLeft = countWays ( leftSubTree , fact ) ; int countRight = countWays ( rightSubTree , fact ) ; return nCr ( fact , N - 1 , N1 ) * countLeft * countRight ; } public static void Main ( String [ ] args ) { int [ ] a = { 3 , 4 , 5 , 1 , 2 } ; List < int > arr = new List < int > ( ) ; foreach ( int i in a ) arr . Add ( i ) ; int N = a . Length ; int [ ] fact = new int [ N ] ; calculateFact ( fact , N ) ; Console . Write ( countWays ( arr , fact ) ) ; } }

Index/key variables: N, R, i
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumOfProd ( int [ ] arr , int N ) { int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += arr [ i ] ; } return sum * sum ; } static void Main ( ) { int [ ] arr = { 2 , 3 , 1 , 5 , 4 } ; int N = arr . Length ; Console . WriteLine ( sumOfProd ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int rev ( int num ) { int rev_num = 0 ; while ( num > 0 ) { rev_num = rev_num * 10 + num % 10 ; num = num / 10 ; } return rev_num ; } static bool check ( int n ) { return 2 * rev ( n ) == n + 1 ; } public static void Main ( String [ ] args ) { int n = 73 ; if ( check ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPower ( int x , int y ) { double res1 = Math . Log ( y ) / Math . Log ( x ) ; double res2 = Math . Log ( y ) / Math . Log ( x ) ; return ( res1 == res2 ) ; } static bool check ( int n ) { int x = ( n + 7 ) / 8 ; if ( ( n + 7 ) % 8 == 0 && isPower ( 10 , x ) ) return true ; else return false ; } static public void Main ( ) { int n = 73 ; if ( check ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static double mod = 1e9 + 7 ; static void NthTerm ( int [ ] F , int [ ] C , int K , int n ) { int [ ] ans = new int [ n + 1 ] ; for ( int i = 0 ; i < K ; i ++ ) ans [ i ] = F [ i ] ; for ( int i = K ; i <= n ; i ++ ) { for ( int j = i - K ; j < i ; j ++ ) { ans [ i ] += ans [ j ] ; ans [ i ] %= ( int ) mod ; } } Console . WriteLine ( ans [ n ] ) ; } public static void Main ( String [ ] args ) { int [ ] F = { 0 , 1 } ; int [ ] C = { 1 , 1 } ; int K = 2 ; int N = 10 ; NthTerm ( F , C , K , N ) ; } }

Index/key variables: i, j, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countFreq ( int [ ] arr , int n ) { Dictionary < int , int > mp1 = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { if ( mp1 . ContainsKey ( arr [ i ] ) ) { mp1 [ arr [ i ] ] = mp1 [ arr [ i ] ] + 1 ; } else { mp1 . Add ( arr [ i ] , 1 ) ; } } Dictionary < int , int > mp2 = new Dictionary < int , int > ( ) ; foreach ( KeyValuePair < int , int > it in mp1 ) { if ( mp2 . ContainsKey ( it . Value ) ) { mp2 [ it . Value ] = mp2 [ it . Value ] + 1 ; } else { mp2 . Add ( it . Value , 1 ) ; } } int M = int . MinValue ; foreach ( KeyValuePair < int , int > it in mp2 ) { M = Math . Max ( M , it . Value ) ; } foreach ( KeyValuePair < int , int > it in mp2 ) { if ( M == it . Value ) { return it . Key ; } } return 0 ; } public static void Main ( String [ ] args ) { int [ ] arr = { 6 , 10 , 3 , 10 , 8 , 3 , 6 , 4 } ; int n = arr . Length ; Console . Write ( countFreq ( arr , n ) ) ; } }

Index/key variables: i
Iterator variables: i, it
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxDisconnected ( int N , int E ) { int curr = 1 ; int rem = E ; while ( rem > 0 ) { rem = rem - Math . Min ( curr , rem ) ; curr ++ ; } if ( curr > 1 ) { return N - curr ; } else { return N ; } } public static void Main ( String [ ] args ) { int N = 5 , E = 1 ; Console . Write ( maxDisconnected ( N , E ) ) ; } }

Accumulator variables: curr
Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkPalindromeB ( int N , int B ) { int rev = 0 ; int N1 = N ; while ( N1 > 0 ) { rev = rev * B + N1 % B ; N1 = N1 / B ; } return N == rev ; } public static void Main ( String [ ] args ) { int N = 5 , B = 2 ; if ( checkPalindromeB ( N , B ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static int findProduct ( int N ) { int result = 1 ; for ( int i = 2 ; i < N ; i ++ ) { if ( gcd ( i , N ) == 1 ) { result *= i ; } } return result ; } public static void Main ( String [ ] args ) { int N = 5 ; Console . Write ( findProduct ( N ) ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countEqual ( int n ) { return ( n + 1 ) / 2 ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 6 } ; int n = arr . Length ; Console . WriteLine ( countEqual ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static int countPairs ( int [ ] A , int [ ] B , int N , int M , int [ , ] List ) { int count = 0 ; int [ ] par = new int [ N + 1 ] ; for ( int i = 0 ; i <= N ; i ++ ) par [ i ] = i ; for ( int i = 0 ; i < M ; i ++ ) { int index1 = find ( par , List [ i , 0 ] - 1 ) ; int index2 = find ( par , List [ i , 1 ] - 1 ) ; if ( index1 != index2 ) { union ( par , index1 , index2 ) ; } } Dictionary < int , int > map = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( map . ContainsKey ( A [ i ] ) ) map [ A [ i ] ] = i ; else map . Add ( A [ i ] , i ) ; } for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] != B [ i ] ) { if ( ! map . ContainsKey ( B [ i ] ) ) { count ++ ; continue ; } int j = map [ B [ i ] ] ; if ( find ( par , i ) != find ( par , j ) ) count ++ ; } } return count ; } public static int find ( int [ ] par , int x ) { if ( par [ x ] == x ) return x ; else return par [ x ] = find ( par , par [ x ] ) ; } public static void union ( int [ ] par , int a , int b ) { a = find ( par , a ) ; b = find ( par , b ) ; if ( a == b ) return ; par [ a ] = b ; } public static void Main ( String [ ] args ) { int N = 5 ; int M = 4 ; int [ ] A = { 1 , 5 , 9 , 2 , 3 } ; int [ ] B = { 2 , 4 , 5 , 1 , 3 } ; int [ , ] List = { { 1 , 4 } , { 2 , 3 } , { 3 , 5 } , { 2 , 5 } } ; Console . WriteLine ( countPairs ( A , B , N , M , List ) ) ; } }

Index/key variables: a, i, x
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void max_valid_triplet ( int [ ] A , int n ) { int ans = - 1 ; for ( int i = 0 ; i < n - 2 ; i ++ ) { for ( int j = i + 1 ; j < n - 1 ; j ++ ) { for ( int k = j + 1 ; k < n ; k ++ ) { if ( A [ i ] < A [ j ] && A [ j ] < A [ k ] ) { int value = A [ i ] + A [ j ] * A [ k ] ; if ( value > ans ) { ans = value ; } } } } } Console . WriteLine ( ans ) ; } public static void Main ( String [ ] args ) { int [ ] arr = new int [ ] { 7 , 9 , 3 , 8 , 11 , 10 } ; int n = arr . Length ; max_valid_triplet ( arr , n ) ; } }

Index/key variables: i, j, k
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int mod = 1000000007 ; static long [ ] ans = new long [ 100002 ] ; static void preCompute ( ) { for ( int i = 2 ; i <= 100000 / 2 ; i ++ ) { for ( int j = 2 * i ; j <= 100000 ; j += i ) { ans [ j ] = ( ans [ j ] * i ) % mod ; } } } static long productOfProperDivi ( int num ) { return ans [ num ] ; } public static void Main ( String [ ] args ) { for ( int i = 0 ; i < 100002 ; i ++ ) ans [ i ] = 1 ; preCompute ( ) ; int queries = 5 ; int [ ] a = { 4 , 6 , 8 , 16 , 36 } ; for ( int i = 0 ; i < queries ; i ++ ) { Console . Write ( productOfProperDivi ( a [ i ] ) + " , ▁ " ) ; } } }

Index/key variables: i, j, num
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int findlcm ( int n ) { int ans = 1 ; for ( int i = 1 ; i <= n ; i ++ ) ans = ( ( ( i * ans ) ) / ( __gcd ( i , ans ) ) ) ; return ans ; } static int highestPower ( int n ) { int lcm = findlcm ( n ) ; int ans = 0 ; for ( int i = 1 ; ; i ++ ) { int x = ( int ) Math . Pow ( 2 , i ) ; if ( lcm % x == 0 ) { ans = i ; } if ( x > n ) break ; } return ans ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int n = 15 ; Console . Write ( highestPower ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int highestPower ( int n ) { return ( int ) ( Math . Log ( n ) / Math . Log ( 2 ) ) ; } public static void Main ( String [ ] args ) { int n = 15 ; Console . WriteLine ( highestPower ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static String deleteIth ( String str , int i ) { str = str . Substring ( 0 , i ) + str . Substring ( i + 1 ) ; return str ; } static bool isPrimePossible ( int N ) { String s = String . Join ( " " , N ) ; int l = s . Length ; if ( l < 2 ) return false ; for ( int i = 0 ; i < l ; i ++ ) { String str = deleteIth ( s , i ) ; int num = Int32 . Parse ( str ) ; if ( isPrime ( num ) ) return true ; } return false ; } public static void Main ( String [ ] args ) { int N = 610 ; if ( isPrimePossible ( N ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void checkFactors ( long N ) { long ev_count = 0 , od_count = 0 ; for ( long i = 1 ; i <= Math . Sqrt ( N ) + 1 ; i ++ ) { if ( N % i == 0 ) { if ( i == N / i ) { if ( i % 2 == 0 ) ev_count += 1 ; else od_count += 1 ; } else { if ( i % 2 == 0 ) ev_count += 1 ; else od_count += 1 ; if ( ( N / i ) % 2 == 0 ) ev_count += 1 ; else od_count += 1 ; } } } if ( ev_count % 2 == 0 && od_count % 2 == 1 ) Console . Write ( " Yes " + " STRNEWLINE " ) ; else Console . Write ( " No " + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { long N = 36 ; checkFactors ( N ) ; } }

Accumulator variables: ev_count, i, od_count
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countofPermutations ( int N ) { return ( int ) ( 3 * Math . Pow ( 2 , N - 1 ) ) ; } public static void Main ( String [ ] args ) { int N = 5 ; Console . Write ( countofPermutations ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void answer ( int L , int R ) { if ( 2 * L <= R ) Console . WriteLine ( L + " , ▁ " + ( 2 * L ) ) ; else Console . WriteLine ( " - 1" ) ; } public static void Main ( ) { int L = 3 , R = 8 ; answer ( L , R ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int x , int y ) { if ( x % y == 0 ) return y ; else return gcd ( y , x % y ) ; } static int countPairwiseCoprime ( int N , int M ) { int answer = 1 ; int g = gcd ( N , M ) ; int temp = g ; for ( int i = 2 ; i * i <= g ; i ++ ) { if ( temp % i == 0 ) { answer ++ ; while ( temp % i == 0 ) temp /= i ; } } if ( temp != 1 ) answer ++ ; return answer ; } static void countCoprimePair ( int [ , ] arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( countPairwiseCoprime ( arr [ i , 0 ] , arr [ i , 1 ] ) + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ , ] arr = { { 12 , 18 } , { 420 , 660 } } ; int N = arr . GetLength ( 0 ) ; countCoprimePair ( arr , N ) ; } }

Accumulator variables: answer, i, temp
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getProduct ( int [ ] a , int n ) { int p = 1 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { p *= Math . Abs ( a [ i ] - a [ j ] ) ; } } return p ; } public static void Main ( string [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int N = arr . Length ; Console . Write ( getProduct ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, p
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void print ( int N ) { for ( int i = 0 ; i < 100000 ; i ++ ) { if ( Math . Pow ( i + 1 , 3 ) - Math . Pow ( i , 3 ) == N ) { int j = i + 1 ; Console . WriteLine ( i + " ▁ " + j ) ; return ; } } } static bool isPerfectSquare ( double x ) { double sr = Math . Sqrt ( x ) ; return ( ( sr - Math . Floor ( sr ) ) == 0 ) ; } static bool diffCube ( int N ) { return isPerfectSquare ( 12 * N - 3 ) ; } public static void Main ( String [ ] args ) { int N = 19 ; if ( diffCube ( N ) ) { Console . WriteLine ( " Yes " ) ; print ( N ) ; } else { Console . WriteLine ( " No " ) ; } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int totalCountDifference ( int n ) { if ( n == 1 ) return 1 ; return n + totalCountDifference ( n / 2 ) ; } public static void Main ( ) { int N = 5 ; Console . WriteLine ( totalCountDifference ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findSum ( int [ ] arr , int n , int left , int right ) { int k = right - left + 1 ; int d = arr [ 1 ] / arr [ 0 ] ; int ans = arr [ left - 1 ] ; if ( d == 1 ) ans = ans * d * k ; else ans = ans * ( ( int ) Math . Pow ( d , k ) - 1 / ( d - 1 ) ) ; return ans ; } public static void Main ( string [ ] args ) { int [ ] arr = { 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 } ; int queries = 3 ; int [ , ] q = { { 2 , 4 } , { 2 , 6 } , { 5 , 8 } } ; int n = arr . Length ; for ( int i = 0 ; i < queries ; i ++ ) Console . Write ( findSum ( arr , n , q [ i , 0 ] , q [ i , 1 ] ) + " STRNEWLINE " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static long modPower ( long a , long b , long M ) { long res = 1 ; while ( b > 0 ) { if ( b % 2 == 1 ) res = res * a % M ; a = a * a % M ; b >>= 1 ; } return res ; } static void findFirstAndLastM ( long N , long K , long M ) { long lastM = modPower ( N , K , ( 1L ) * ( long ) Math . Pow ( 10 , M ) ) ; long firstM ; double y = ( double ) K * Math . Log10 ( N * 1.0 ) ; y = y - ( long ) y ; double temp = Math . Pow ( 10.0 , y ) ; firstM = ( long ) ( temp * ( 1L ) * Math . Pow ( 10 , ( M - 1 ) ) ) ; Console . Write ( firstM + " ▁ " + lastM + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { long N = 12 , K = 12 , M = 4 ; findFirstAndLastM ( N , K , M ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int Find_min ( HashSet < int > diff_mod , Dictionary < int , int > count_mod , int k ) { int min_oprn = int . MaxValue ; int oprn = 0 ; for ( int x = 0 ; x < k ; x ++ ) { oprn = 0 ; foreach ( int w in diff_mod ) { if ( w != x ) { if ( w == 0 ) { oprn += Math . Min ( x , k - x ) * count_mod [ w ] ; } else { oprn += Math . Min ( Math . Abs ( x - w ) , k + x - w ) * count_mod [ w ] ; } } } if ( oprn < min_oprn ) min_oprn = oprn ; } return min_oprn ; } static int Cal_min ( int [ ] arr , int n , int k ) { HashSet < int > diff_mod = new HashSet < int > ( ) ; Dictionary < int , int > count_mod = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { diff_mod . Add ( arr [ i ] % k ) ; if ( count_mod . ContainsKey ( ( arr [ i ] % k ) ) ) count_mod [ arr [ i ] % k ] = count_mod [ ( arr [ i ] % k ) ] + 1 ; else count_mod . Add ( arr [ i ] % k , 1 ) ; } return Find_min ( diff_mod , count_mod , k ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 35 , 48 , 23 , 52 } ; int n = arr . Length ; int k = 3 ; Console . Write ( Cal_min ( arr , n , k ) ) ; } }

Index/key variables: i, w
Accumulator variables: i, oprn, x
Iterator variables: i, w, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static int findlcm ( int [ ] arr , int n ) { int ans = 1 ; for ( int i = 1 ; i <= n ; i ++ ) ans = ( ( ( arr [ i ] * ans ) ) / ( gcd ( arr [ i ] , ans ) ) ) ; return ans ; } static void minimumSteps ( int [ ] arr , int n ) { int i ; int [ ] dat = new int [ n + 1 ] ; for ( i = 1 ; i <= n ; i ++ ) dat [ arr [ i - 1 ] ] = i ; int [ ] b = new int [ n + 1 ] ; int j = 0 , c ; for ( i = 1 ; i <= n ; i ++ ) { c = 1 ; j = dat [ i ] ; while ( j != i ) { c ++ ; j = dat [ j ] ; } b [ i ] = c ; } Console . WriteLine ( findlcm ( b , n ) ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 5 , 1 , 4 , 3 , 2 , 7 , 6 } ; int N = arr . Length ; minimumSteps ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: c, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double maximum ( double a , double b ) { if ( a > b ) return a ; return b ; } static double maxSubarrayRatio ( double [ ] arr , int n ) { double maxRatio = int . MinValue ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { double ratio = arr [ i ] ; for ( int k = i + 1 ; k <= j ; k ++ ) { ratio = ratio / arr [ k ] ; } maxRatio = maximum ( maxRatio , ratio ) ; } } return maxRatio ; } public static void Main ( String [ ] args ) { double [ ] arr = { 2 , 2 , 4 , - 0.2 , - 1 } ; int n = arr . Length ; Console . WriteLine ( maxSubarrayRatio ( arr , n ) ) ; } }

Index/key variables: i, k
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { private static void check ( long num ) { long root = ( long ) Math . Sqrt ( num ) ; long pow = ( long ) ( Math . Log ( root ) / Math . Log ( 2 ) ) ; if ( num == ( long ) ( Math . Pow ( 2 , pow ) * ( Math . Pow ( 2 , pow + 1 ) - 1 ) ) ) { if ( isPrime ( pow + 1 ) ) { if ( isPrime ( ( long ) Math . Pow ( 2 , pow + 1 ) - 1 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } else Console . WriteLine ( " No " ) ; } else Console . WriteLine ( " No " ) ; } public static bool isPrime ( long n ) { if ( n <= 1 ) return false ; else if ( n == 2 n == 3 ) return true ; else { if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( long i = 5 ; i <= Math . Sqrt ( n ) ; i += 6 ) { if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; } return true ; } } public static void Main ( String [ ] args ) { long num = 6 ; check ( num ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isTriplet ( int [ ] ar , int n ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { for ( int k = j + 1 ; k < n ; k ++ ) { if ( Math . Abs ( ar [ i ] - ar [ j ] ) == 1 || Math . Abs ( ar [ j ] - ar [ k ] ) == 1 || Math . Abs ( ar [ i ] - ar [ k ] ) == 1 ) { int x = ar [ i ] * ar [ i ] , y = ar [ j ] * ar [ j ] , z = ar [ k ] * ar [ k ] ; if ( x == y + z y == x + z z == x + y ) return true ; } } } } return false ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 1 , 4 , 6 , 5 } ; int ar_size = arr . Length ; if ( isTriplet ( arr , ar_size ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i, j, k
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static void closestDivisors ( int n ) { for ( int i = ( int ) Math . Sqrt ( n + 2 ) ; i > 0 ; i -- ) { if ( ( n + 1 ) % i == 0 ) { Console . Write ( i + " , ▁ " + ( n + 1 ) / i ) ; break ; } if ( ( n + 2 ) % i == 0 ) { Console . Write ( i + " , ▁ " + ( n + 2 ) / i ) ; break ; } } } public static void Main ( string [ ] args ) { int N = 123 ; closestDivisors ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool is_possible ( int x , int y ) { if ( x < 2 && y != 0 ) return false ; y = y - x + 1 ; if ( y % 2 == 0 && y >= 0 ) return true ; else return false ; } public static void Main ( string [ ] args ) { int x = 5 , y = 2 ; if ( is_possible ( x , y ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int count ( int n ) { int [ ] phi = new int [ n + 1 ] ; int [ ] divs = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { phi [ i ] += i ; for ( int j = i * 2 ; j <= n ; j += i ) phi [ j ] -= phi [ i ] ; for ( int j = i ; j <= n ; j += i ) divs [ j ] ++ ; } return ( n - phi [ n ] - divs [ n ] + 1 ) ; } public static void Main ( String [ ] args ) { int N = 42 ; Console . WriteLine ( count ( N ) ) ; } }

Index/key variables: i, j, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int sum_of_differences ( int [ ] arr , int N ) { int sum = 0 ; int i , j , flag ; for ( i = 0 ; i < N - 1 ; i ++ ) { if ( arr [ i ] < arr [ i + 1 ] ) { flag = 0 ; for ( j = i + 1 ; j < N - 1 ; j ++ ) { if ( arr [ j ] >= arr [ j + 1 ] ) { sum += ( arr [ j ] - arr [ i ] ) ; i = j ; flag = 1 ; break ; } } if ( flag == 0 && arr [ i ] < arr [ N - 1 ] ) { sum += ( arr [ N - 1 ] - arr [ i ] ) ; break ; } } } return sum ; } public static void Main ( string [ ] args ) { int [ ] arr = { 6 , 1 , 2 , 5 , 3 , 4 } ; int N = arr . Length ; Console . Write ( sum_of_differences ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class Node { public int data ; public Node left , right ; public Node ( int data , Node left , Node right ) { this . data = data ; this . left = left ; this . right = right ; } static Node newNode ( int data ) { return new Node ( data , null , null ) ; } static void inorder ( Node node ) { if ( node == null ) return ; inorder ( node . left ) ; Console . Write ( " { 0 } ▁ " , node . data ) ; inorder ( node . right ) ; } static Node MaximumBinaryTree ( Node t1 , Node t2 ) { if ( t1 == null ) return t2 ; if ( t2 == null ) return t1 ; t1 . data = Math . Max ( t1 . data , t2 . data ) ; t1 . left = MaximumBinaryTree ( t1 . left , t2 . left ) ; t1 . right = MaximumBinaryTree ( t1 . right , t2 . right ) ; return t1 ; } public static void Main ( String [ ] args ) { Node root1 = newNode ( 3 ) ; root1 . left = newNode ( 2 ) ; root1 . right = newNode ( 6 ) ; root1 . left . left = newNode ( 20 ) ; Node root2 = newNode ( 5 ) ; root2 . left = newNode ( 1 ) ; root2 . right = newNode ( 8 ) ; root2 . left . right = newNode ( 2 ) ; root2 . right . right = newNode ( 8 ) ; Node root3 = MaximumBinaryTree ( root1 , root2 ) ; inorder ( root3 ) ; } }

Class/struct names: Node