codeparrot/xlcost-text-to-code huggingface dataset:
Find points at a given distance on a line of given slope | Java program to find the points on a line of slope M at distance L ; Class to represent a co - ordinate point ; Function to print pair of points at distance ' l ' and having a slope ' m ' from the source ; m is the slope of line , and the required Point lies distance l away from the source Point ; Slope is 0 ; If slope is infinite ; Print the first Point ; Print the second Point ; Driver code
class GFG { static class Point { float x , y ; Point ( ) { x = y = 0 ; } Point ( float a , float b ) { x = a ; y = b ; } } ; static void printPoints ( Point source , float l , int m ) { Point a = new Point ( ) ; Point b = new Point ( ) ; if ( m == 0 ) { a . x = source . x + l ; a . y = source . y ; b . x = source . x - l ; b . y = source . y ; } else if ( Double . isInfinite ( m ) ) { a . x = source . x ; a . y = source . y + l ; b . x = source . x ; b . y = source . y - l ; } else { float dx = ( float ) ( l / Math . sqrt ( 1 + ( m * m ) ) ) ; float dy = m * dx ; a . x = source . x + dx ; a . y = source . y + dy ; b . x = source . x - dx ; b . y = source . y - dy ; } System . out . println ( a . x + " , ▁ " + a . y ) ; System . out . println ( b . x + " , ▁ " + b . y ) ; } public static void main ( String [ ] args ) { Point p = new Point ( 2 , 1 ) , q = new Point ( 1 , 0 ) ; printPoints ( p , ( float ) Math . sqrt ( 2 ) , 1 ) ; System . out . println ( ) ; printPoints ( q , 5 , 0 ) ; } }
Minimum block jumps to reach destination | Java program to find minimum jumps to reach a given destination from a given source ; To represent point in 2D space ; To represent line of ( ax + by + c ) format ; Returns 1 if evaluation is greater > 0 , else returns - 1 ; Returns minimum jumps to reach dest point from start point ; get sign of evaluation from point co - ordinate and line equation ; if both evaluation are of opposite sign , increase jump by 1 ; Driver code
class GFG { static class point { int x , y ; public point ( int x , int y ) { super ( ) ; this . x = x ; this . y = y ; } } ; static class line { public line ( int a , int b , int c ) { this . a = a ; this . b = b ; this . c = c ; } int a , b , c ; line ( ) { } } ; static int evalPointOnLine ( point p , line curLine ) { int eval = curLine . a * p . x + curLine . b * p . y + curLine . c ; if ( eval > 0 ) return 1 ; return - 1 ; } static int minJumpToReachDestination ( point start , point dest , line lines [ ] , int N ) { int jumps = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int signStart = evalPointOnLine ( start , lines [ i ] ) ; int signDest = evalPointOnLine ( dest , lines [ i ] ) ; if ( signStart * signDest < 0 ) jumps ++ ; } return jumps ; } public static void main ( String [ ] args ) { point start = new point ( 1 , 1 ) ; point dest = new point ( - 2 , - 1 ) ; line [ ] lines = new line [ 3 ] ; lines [ 0 ] = new line ( 1 , 0 , 0 ) ; lines [ 1 ] = new line ( 0 , 1 , 0 ) ; lines [ 2 ] = new line ( 1 , 1 , - 2 ) ; System . out . print ( minJumpToReachDestination ( start , dest , lines , 3 ) ) ; } }
Minimum distance to travel to cover all intervals | Java program to find minimum distance to travel to cover all intervals ; Structure to store an interval ; Method returns minimum distance to travel to cover all intervals ; Looping over all intervals to get right most start and left most end ; If rightmost start > leftmost end then all intervals are not aligned and it is not possible to cover all of them ; If x is in between rightmoststart and leftmostend then no need to travel any distance ; Choose minimum according to current position x ; Driver code
import java . util . * ; class GFG { static class Interval { int start , end ; Interval ( int start , int end ) { this . start = start ; this . end = end ; } } ; static int minDistanceToCoverIntervals ( Interval intervals [ ] , int N , int x ) { int rightMostStart = Integer . MIN_VALUE ; int leftMostEnd = Integer . MAX_VALUE ; for ( int i = 0 ; i < N ; i ++ ) { if ( rightMostStart < intervals [ i ] . start ) rightMostStart = intervals [ i ] . start ; if ( leftMostEnd > intervals [ i ] . end ) leftMostEnd = intervals [ i ] . end ; } int res ; if ( rightMostStart > leftMostEnd ) res = - 1 ; else if ( rightMostStart <= x && x <= leftMostEnd ) res = 0 ; else res = ( x < rightMostStart ) ? ( rightMostStart - x ) : ( x - leftMostEnd ) ; return res ; } public static void main ( String [ ] args ) { int x = 3 ; Interval [ ] intervals = { new Interval ( 0 , 7 ) , new Interval ( 2 , 14 ) , new Interval ( 4 , 6 ) } ; int N = intervals . length ; int res = minDistanceToCoverIntervals ( intervals , N , x ) ; if ( res == - 1 ) System . out . print ( " Not ▁ Possible ▁ to ▁ " + "cover all intervalsNEW_LINE"); else System . out . print ( res + "NEW_LINE"); } }
Count of acute , obtuse and right triangles with given sides | Java program to count of acute , obtuse and right triangles in an array ; Find the number of acute , right , obtuse triangle that can be formed from given array . ; Finding the square of each element of array . ; Sort the sides of array and their squares . ; x for acute triangles y for right triangles z for obtuse triangles ; Finding the farthest point p where a ^ 2 + b ^ 2 >= c ^ 2. ; Finding the farthest point q where a + b > c . ; If point p make right triangle . ; All triangle between j and p are acute triangles . So add p - j - 1 in x . ; Increment y by 1. ; All triangle between q and p are acute triangles . So add q - p in z . ; If no right triangle ; All triangle between j and p are acute triangles . So add p - j in x . ; All triangle between q and p are acute triangles . So add q - p in z . ; Driver Code
import java . util . * ; class GFG { static void findTriangle ( int a [ ] , int n ) { int b [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) b [ i ] = a [ i ] * a [ i ] ; Arrays . sort ( a ) ; Arrays . sort ( b ) ; int x = 0 , y = 0 , z = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int p = i + 1 ; int q = i + 1 ; for ( int j = i + 1 ; j < n ; j ++ ) { while ( p < n - 1 && b [ i ] + b [ j ] >= b [ p + 1 ] ) p ++ ; q = Math . max ( q , p ) ; while ( q < n - 1 && a [ i ] + a [ j ] > a [ q + 1 ] ) q ++ ; if ( b [ i ] + b [ j ] == b [ p ] ) { x += Math . max ( p - j - 1 , 0 ) ; y ++ ; z += q - p ; } else { x += Math . max ( p - j , 0 ) ; z += q - p ; } } } System . out . println ( " Acute ▁ Triangle : ▁ " + x ) ; System . out . println ( " Right ▁ Triangle : ▁ " + y ) ; System . out . println ( " Obtuse ▁ Triangle : ▁ " + z ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 , 9 , 10 , 12 , 15 } ; int n = arr . length ; findTriangle ( arr , n ) ; } }
Check whether a point exists in circle sector or not . | Java program to check if a point lies inside a circle sector . ; calculate endAngle ; Calculate polar co - ordinates ; Check whether polarradius is less then radius of circle or not and Angle is between startAngle and endAngle or not ; Driver Program to test above function
class GFG { static void checkPoint ( int radius , int x , int y , float percent , float startAngle ) { float endAngle = 360 / percent + startAngle ; double polarradius = Math . sqrt ( x * x + y * y ) ; double Angle = Math . atan ( y / x ) ; if ( Angle >= startAngle && Angle <= endAngle && polarradius < radius ) System . out . print ( " Point " + " ( " + x + " , " + y + " ) " + " exist in the circle sectorNEW_LINE"); else System . out . print ( " Point " + " ( " + x + " , " + y + " ) " + " exist in the circle sectorNEW_LINE"); } public static void main ( String arg [ ] ) { int radius = 8 , x = 3 , y = 4 ; float percent = 12 , startAngle = 0 ; checkPoint ( radius , x , y , percent , startAngle ) ; } }
Program to find the Type of Triangle from the given Coordinates | Java program to classify a given triangle ; Utility method to return square of x ; Utility method to sort a , b , c ; after this method a <= b <= c ; Utility method to return Square of distance between two points ; Method to classify side ; if all sides are equal ; if any two sides are equal ; Method to classify angle ; If addition of sum of square of two side is less , then acute ; by pythagoras theorem ; Method to classify the triangle by sides and angles ; Find squares of distances between points ; Sort all squares of distances in increasing order ; Driver code
import java . util . * ; class GFG { static class point { int x , y ; point ( ) { } public point ( int x , int y ) { this . x = x ; this . y = y ; } } ; static int square ( int x ) { return x * x ; } static int a , b , c ; static void order ( ) { int [ ] copy = new int [ 3 ] ; copy [ 0 ] = a ; copy [ 1 ] = b ; copy [ 2 ] = c ; Arrays . sort ( copy ) ; a = copy [ 0 ] ; b = copy [ 1 ] ; c = copy [ 2 ] ; } static int euclidDistSquare ( point p1 , point p2 ) { return square ( p1 . x - p2 . x ) + square ( p1 . y - p2 . y ) ; } static String getSideClassification ( int a , int b , int c ) { if ( a == b && b == c ) return " Equilateral " ; else if ( a == b b == c ) return " Isosceles " ; else return " Scalene " ; } static String getAngleClassification ( int a , int b , int c ) { if ( a + b > c ) return " acute " ; else if ( a + b == c ) return " right " ; else return " obtuse " ; } static void classifyTriangle ( point p1 , point p2 , point p3 ) { a = euclidDistSquare ( p1 , p2 ) ; b = euclidDistSquare ( p1 , p3 ) ; c = euclidDistSquare ( p2 , p3 ) ; order ( ) ; System . out . println ( " Triangle ▁ is ▁ " + getAngleClassification ( a , b , c ) + " ▁ and ▁ " + getSideClassification ( a , b , c ) ) ; } public static void main ( String [ ] args ) { point p1 , p2 , p3 ; p1 = new point ( 3 , 0 ) ; p2 = new point ( 0 , 4 ) ; p3 = new point ( 4 , 7 ) ; classifyTriangle ( p1 , p2 , p3 ) ; p1 = new point ( 0 , 0 ) ; p2 = new point ( 1 , 1 ) ; p3 = new point ( 1 , 2 ) ; classifyTriangle ( p1 , p2 , p3 ) ; } }
Area of a polygon with given n ordered vertices | Java program to evaluate area of a polygon using shoelace formula ; ( X [ i ] , Y [ i ] ) are coordinates of i 'th point. ; Initialize area ; Calculate value of shoelace formula ; j is previous vertex to i ; Return absolute value ; Driver program
import java . io . * ; class GFG { public static double polygonArea ( double X [ ] , double Y [ ] , int n ) { double area = 0.0 ; int j = n - 1 ; for ( int i = 0 ; i < n ; i ++ ) { area += ( X [ j ] + X [ i ] ) * ( Y [ j ] - Y [ i ] ) ; j = i ; } return Math . abs ( area / 2.0 ) ; } public static void main ( String [ ] args ) { double X [ ] = { 0 , 2 , 4 } ; double Y [ ] = { 1 , 3 , 7 } ; int n = 3 ; System . out . println ( polygonArea ( X , Y , n ) ) ; } }
Difference of count of distinct elements present to left and right for each array element | Java program for the above approach ; Function to find the difference of count of distince elements to the left and right for each array elements ; Stores distinct array element in the left and right ; Traverse the array ; Insert all element to the left in the set S1 ; Insert all element to the right in the set S2 ; Print the difference ; Driver Code
import java . util . HashSet ; class GFG { public static void findDifferenceArray ( int arr [ ] , int N ) { HashSet < Integer > S1 = new HashSet < Integer > ( ) ; HashSet < Integer > S2 = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < i ; j ++ ) { S1 . add ( arr [ j ] ) ; } for ( int j = i + 1 ; j < N ; j ++ ) { S2 . add ( arr [ j ] ) ; } System . out . print ( Math . abs ( S1 . size ( ) - S2 . size ( ) ) + " ▁ " ) ; S1 . clear ( ) ; S2 . clear ( ) ; } } public static void main ( String args [ ] ) { int arr [ ] = { 7 , 7 , 3 , 2 , 3 } ; int N = arr . length ; findDifferenceArray ( arr , N ) ; } }
Maximum subarray sum with same first and last element formed by removing elements | Java program for the above approach ; Function to find the maximum sum of sub - array ; Initialize the variables ; Traverse over the range ; Add the current value to the variable currsum for prefix sum ; Calculate the result ; Return the answer ; Driver Code
import java . io . * ; import java . util . * ; class GFG { static int maximumSubarraySum ( int arr [ ] , int N ) { HashMap < Integer , Integer > memo = new HashMap < > ( ) ; int res = Integer . MIN_VALUE ; int currsum = 0 , currval = 0 ; for ( int i = 0 ; i < N ; ++ i ) { currval = arr [ i ] ; currsum = currsum + currval ; if ( memo . containsKey ( currval ) ) { if ( currval > 0 ) res = Math . max ( res , currsum - memo . get ( currval ) + currval ) ; else res = Math . max ( res , currsum - memo . get ( currval ) + 2 * currval ) ; } else memo . put ( currval , currsum ) ; if ( currval < 0 ) currsum = currsum - currval ; } return res ; } public static void main ( String [ ] args ) { int arr [ ] = { - 1 , - 3 , 4 , 0 , - 1 , - 2 } ; int N = 6 ; System . out . println ( maximumSubarraySum ( arr , N ) ) ; } }
Find Nth root of a number using Bisection method | Java program for the above approach ; Function that returns the value of the function at a given value of x ; calculating the value of the differential of the function ; The function that returns the root of given number ; Defining range on which answer can be found ; finding mid value ; Driver code
import java . util . * ; class GFG { static double f ( double x , int p , double num ) { return Math . pow ( x , p ) - num ; } static double f_prime ( double x , int p ) { return p * Math . pow ( x , p - 1 ) ; } static double root ( double num , int p ) { double left = - num ; double right = num ; double x ; while ( true ) { x = ( left + right ) / 2.0 ; double value = f ( x , p , num ) ; double prime = f_prime ( x , p ) ; if ( value * prime <= 0 ) left = x ; else right = x ; if ( value < 0.000001 && value >= 0 ) { return x ; } } } public static void main ( String args [ ] ) { double P = 1234321 ; int N = 2 ; double ans = root ( P , N ) ; System . out . print ( ans ) ; } }
Convert 0 to N by adding 1 or multiplying by 2 in minimum steps | Java program for the above approach ; Function to count number of set bits in N ; Stores the count of set bits ; If N is odd , then it a set bit ; Return the result ; Driver Code
import java . io . * ; class GFG { static int minimumAdditionOperation ( int N ) { int count = 0 ; while ( N > 0 ) { if ( N % 2 == 1 ) { count ++ ; } N = N >> 1 ; } return count ; } public static void main ( String [ ] args ) { int N = 6 ; System . out . println ( minimumAdditionOperation ( N ) ) ; } }
Minimum divide by 2 operations required to make GCD odd for given Array | Java program for the above approach ; Function to find the minimum number of operations to make the GCD of the array odd ; Stores the minimum operations required ; Stores the powers of two for the current array element ; Dividing by 2 ; Increment the count ; Update the minimum operation required ; Return the result required ; Driver Code
class GFG { public static int minimumOperations ( int arr [ ] , int N ) { int mini = Integer . MAX_VALUE ; for ( int i = 0 ; i < N ; i ++ ) { int count = 0 ; while ( arr [ i ] % 2 == 0 ) { arr [ i ] = arr [ i ] / 2 ; count ++ ; } if ( mini > count ) { mini = count ; } } return mini ; } public static void main ( String args [ ] ) { int arr [ ] = { 4 , 6 } ; int N = arr . length ; System . out . println ( minimumOperations ( arr , N ) ) ; } }
Minimum size of the array with MEX as A and XOR of the array elements as B | Java program for the above approach ; Function to find the minimum size of array with given MEX and XOR ; Find the XOR of values from 0 to A - 1 ; If A is a multiple of 4 ; If A % 4 gives remainder 1 ; If A % 4 gives remainder 2 ; Initializing array size by A ; If XOR of all values of array is equal to B ; If the required integer to be added is equal to A ; Else any integer can be added ; Driver Code
public class GFG { static int minimumSizeArr ( int A , int B ) { int currXor = 0 ; int reminder = ( A - 1 ) % 4 ; if ( reminder == 0 ) currXor = A - 1 ; else if ( reminder == 1 ) currXor = 1 ; else if ( reminder == 2 ) currXor = A ; int minSize = A ; if ( currXor == B ) return minSize ; else if ( ( currXor ^ B ) == A ) return minSize + 2 ; else return minSize + 1 ; } public static void main ( String [ ] args ) { int A = 1 ; int B = 999 ; System . out . println ( minimumSizeArr ( A , B ) ) ; } }
Count of triplets till N whose product is at most N | Java program for the above approach ; Function to find number of triplets ( A , B , C ) having A * B * C <= N ; Stores the count of triplets ; Iterate a loop fixing the value of A ; Iterate a loop fixing the value of A ; Find the total count of triplets and add it to cnt ; Return the total triplets formed ; Driver Code
import java . io . * ; class GFG { static int countTriplets ( int N ) { int cnt = 0 ; for ( int A = 1 ; A <= N ; ++ A ) { for ( int B = 1 ; B <= N / A ; ++ B ) { cnt += N / ( A * B ) ; } } return cnt ; } public static void main ( String [ ] args ) { int N = 2 ; System . out . println ( countTriplets ( N ) ) ; } }
Largest integer upto N having greatest prime factor greater than its square root | Java program for the above approach ; Stores the Greatest Prime Factor ; Modified Sieve to find the Greatest Prime Factor of all integers in the range [ 1 , maxn ] ; Initialize the array with 0 ; Iterate through all values of i ; If i is not a prime number ; Update the multiples of i ; Function to find integer in the range [ 1 , N ] such that its Greatest Prime factor is greater than its square root ; Iterate through all values of i in the range [ N , 1 ] ; If greatest prime factor of i is greater than its sqare root ; Return answer ; If no valid integer exist ; Driver Code
public class GFG { final static int maxn = 100001 ; static int gpf [ ] = new int [ maxn ] ; static void modifiedSieve ( ) { for ( int i = 0 ; i < maxn ; i ++ ) gpf [ i ] = 0 ; gpf [ 0 ] = 0 ; gpf [ 1 ] = 1 ; for ( int i = 2 ; i < maxn ; i ++ ) { if ( gpf [ i ] > 0 ) continue ; for ( int j = i ; j < maxn ; j += i ) { gpf [ j ] = Math . max ( i , gpf [ j ] ) ; } } } static int greatestValidInt ( int N ) { modifiedSieve ( ) ; for ( int i = N ; i > 0 ; i -- ) { if ( gpf [ i ] > Math . sqrt ( i ) ) { return i ; } } return - 1 ; } public static void main ( String [ ] args ) { int N = 25 ; System . out . println ( greatestValidInt ( N ) ) ; } }
Count of pass required to visit same index again by moving arr [ i ] to index arr [ i ] | Java program for the above approach ; Function to find the number of moves required to visit the same index again for every array element ; Make given array 0 index based ; Stores the number of moves ; Store index value ; Update the value of cnt ; Make a pass ; Print the value of cnt ; Driver Code
import java . io . * ; class GFG { static void numberOfPasses ( int [ ] arr , int N ) { for ( int i = 0 ; i < N ; ++ i ) { -- arr [ i ] ; } for ( int i = 0 ; i < N ; ++ i ) { int cnt = 0 ; int k = i ; do { ++ cnt ; k = arr [ k ] ; } while ( k != i ) ; System . out . print ( cnt + " ▁ " ) ; } } public static void main ( String [ ] args ) { int [ ] arr = { 4 , 6 , 2 , 1 , 5 , 3 } ; int N = arr . length ; numberOfPasses ( arr , N ) ; } }
Find subfactorial of a number | / Java program for the above approach ; Function to find the subfactorial of the number ; Initialize variables ; Iterating over range N ; Fact variable store factorial of the i ; If count is even ; Increase the value of count by 1 ; Driver Code
import java . util . * ; class GFG { static double subfactorial ( int N ) { double res = 0 , fact = 1 ; int count = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { fact = fact * i ; if ( count % 2 == 0 ) res = res - ( 1 / fact ) ; else res = res + ( 1 / fact ) ; count ++ ; } return fact * ( 1 + res ) ; } public static void main ( String [ ] args ) { int N = 4 ; System . out . println ( ( int ) ( subfactorial ( N ) ) ) ; } }
Minimize operations to delete all elements of permutation A by removing a subsequence having order as array B | Java program for the above approach ; Function to find the minimum number of operations to delete all elements of permutation A in order described by B ; Stores the count of operations ; Stores the index of current integer in B to be deleted ; Loop to iterate over all values of B ; Stores the current index in A ; Iterate over all values A ; If current integer of B and A equal , increment the index of the current integer of B ; As the permutation A has been traversed completely , increment the count of operations by 1 ; Return Answer ; Driver Code
import java . util . * ; class GFG { static int minOperations ( int A [ ] , int B [ ] , int N ) { int cnt = 0 ; int i = 0 ; while ( i < N ) { int j = 0 ; while ( j < N && i < N ) { if ( B [ i ] == A [ j ] ) { i ++ ; } j ++ ; } cnt ++ ; } return cnt ; } public static void main ( String [ ] args ) { int A [ ] = { 2 , 4 , 6 , 1 , 5 , 3 } ; int B [ ] = { 6 , 5 , 4 , 2 , 3 , 1 } ; int N = A . length ; System . out . print ( minOperations ( A , B , N ) ) ; } }
Count of pair of integers ( x , y ) such that difference between square of x and y is a perfect square | Java program for the above approach ; Function to find number of pairs ( x , y ) such that x ^ 2 - y is a square number ; Stores the count of total pairs ; Iterate q value 1 to Math . sqrt ( N ) ; Maximum possible value of p is Math . min ( 2 * N - q , N / q ) ; P must be greater than or equal to q ; Total number of pairs are ; Adding all valid pairs to res ; Return total no of pairs ( x , y ) ; Driver Code
import java . util . * ; class GFG { static int countPairs ( int N ) { int res = 0 ; for ( int q = 1 ; q * q <= N ; q ++ ) { int maxP = Math . min ( 2 * N - q , N / q ) ; if ( maxP < q ) continue ; int cnt = maxP - q + 1 ; res += ( cnt / 2 + ( cnt & 1 ) ) ; } return res ; } public static void main ( String [ ] args ) { int N = 3 ; System . out . print ( countPairs ( N ) ) ; } }
Maximum size of subset such that product of all subset elements is a factor of N | Java program for the above approach ; Function to find the maximum size of the subset such that the product of subset elements is a factor of N ; Base Case ; Stores maximum size of valid subset ; Traverse the given array ; If N % arr [ i ] = 0 , include arr [ i ] in a subset and recursively call for the remaining array integers ; Return Answer ; Driver Code
import java . util . * ; class GFG { static int maximizeSubset ( int N , int [ ] arr , int M , int x ) { if ( x == M ) { return 0 ; } int ans = 0 ; for ( int i = x ; i < M ; i ++ ) { if ( N % arr [ i ] == 0 ) { ans = Math . max ( ans , maximizeSubset ( N / arr [ i ] , arr , M , x + 1 ) + 1 ) ; } } return ans ; } public static void main ( String [ ] args ) { int N = 64 ; int [ ] arr = { 1 , 2 , 4 , 8 , 16 , 32 } ; int M = arr . length ; System . out . println ( maximizeSubset ( N , arr , M , 0 ) ) ; } }
Count of distinct sums formed by N numbers taken form range [ L , R ] | Java program for the above approach ; Function to find total number of different sums of N numbers in the range [ L , R ] ; To store minimum possible sum with N numbers with all as L ; To store maximum possible sum with N numbers with all as R ; All other numbers in between maxSum and minSum can also be formed so numbers in this range is the final answer ; Driver Code
import java . util . * ; class GFG { static int countDistinctSums ( int N , int L , int R ) { int minSum = L * N ; int maxSum = R * N ; return maxSum - minSum + 1 ; } public static void main ( String [ ] args ) { int N = 2 , L = 1 , R = 3 ; System . out . print ( countDistinctSums ( N , L , R ) ) ; } }