giulio98/xlcost-single-prompt huggingface dataset:
# find the maximum angle at which we can tilt the bottle without spilling any water | python3 program to find the maximum angle at which we can tilt the bottle without spilling any water ; now we have the volume of rectangular prism a * a * b ; now we have 2 cases ! ; taking the tangent inverse of value d as we want to take out the required angle ; taking the tangent inverse of value d as we want to take out the required angle ; as of now the angle is in radian . so we have to convert it in degree . ; 

from math import *


def find_angle(x, y, z):
    volume = x * x * y
    ans = 0
    if (z < volume // 2):
        d = (x * y * y) / (2.0 * z)
        ans = atan(d)
    else:
        z = volume - z
        d = (2 * z) / (float)(x * x * x)
        ans = atan(d)
    ans = (ans * 180) / 3.14159265
    return round(ans, 4)


if __name__ == "__main__":
    x = 12
    y = 21
    z = 10
    print(find_angle(x, y, z))

# Expected output:
89.7835
# find same contacts in a list of contacts | structure for storing contact details . ; a utility function to fill entries in adjacency matrix representation of graph ; initialize the adjacency matrix ; traverse through all contacts ; add mat from i to j and vice versa , if possible . since length of each contact field is at max some constant . ( say 30 ) so body execution of this for loop takes constant time . ; a recuesive function to perform dfs with vertex i as source ; finds similar contacrs in an array of contacts ; vector for storing the solution ; declare 2d adjaceny matrix for mats ; visited array to keep track of visited nodes ; fill adjacency matrix ; since , we made a graph with contacts as nodes with fields as links . two nodes are linked if they represent the same person . so , total number of connected components and nodes in each component will be our answer . ; add delimeter to separate nodes of one component from other . ; print the solution ; 

class contact:
    def __init__(self, field1, field2, field3):
        self .field1 = field1
        self .field2 = field2
        self .field3 = field3


def buildGraph(arr, n, mat):
    for i in range(n):
        for j in range(n):
            mat[i][j] = 0
    for i in range(n):
        for j in range(i + 1, n):
            if (arr[i].field1 == arr[j].field1 or arr[i].field1 == arr[j].field2 or arr[i].field1 == arr[j].field3 or arr[i].field2 == arr[j].field1 or arr[i].field2 ==
                    arr[j].field2 or arr[i].field2 == arr[j].field3 or arr[i].field3 == arr[j].field1 or arr[i].field3 == arr[j].field2 or arr[i].field3 == arr[j].field3):
                mat[i][j] = 1
                mat[j][i] = 1
                break


def DFSvisit(i, mat, visited, sol, n):
    visited[i] = True
    sol .append(i)
    for j in range(n):
        if (mat[i][j] and not visited[j]):
            DFSvisit(j, mat, visited, sol, n)


def findSameContacts(arr, n):
    sol = []
    mat = [[None] * n for i in range(n)]
    visited = [0] * n
    buildGraph(arr, n, mat)
    for i in range(n):
        if (not visited[i]):
            DFSvisit(i, mat, visited, sol, n)
            sol .append(-1)
    for i in range(len(sol)):
        if (sol[i] == -1):
            print()
        else:
            print(sol[i], end=" ")


if __name__ == '__main__':
    arr = [
        contact(
            "Gaurav",
            "gaurav@gmail.com",
            "gaurav@gfgQA.com"),
        contact(
            "Lucky",
            "lucky@gmail.com",
            "+1234567"),
        contact(
            "gaurav123",
            "+5412312",
            "gaurav123@skype.com"),
        contact(
            "gaurav1993",
            "+5412312",
            "gaurav@gfgQA.com"),
        contact(
            "raja",
            "+2231210",
            "raja@gfg.com"),
        contact(
            "bahubali",
            "+878312",
            "raja")]
    n = len(arr)
    findSameContacts(arr, n)

# Expected output:
0 3 2 
1 
4 5
# area of the biggest ellipse inscribed within a rectangle | function to find the area of the ellipse ; the sides cannot be negative ; area of the ellipse ; 
def ellipse(l, b):
    if l < 0 or b < 0:
        return -1
    x = (3.14 * l * b) / 4
    return x


if __name__ == "__main__":
    l, b = 5, 3
    print(ellipse(l, b))

# Expected output:
11.775
# determine the number of squares of unit area that a given line will pass through . | python3 program to determine the number of squares that line will pass through ; function to return the required position ; 

from math import gcd


def noOfSquares(x1, y1, x2, y2):
    dx = abs(x2 - x1)
    dy = abs(y2 - y1)
    ans = dx + dy - gcd(dx, dy)
    print(ans)


if __name__ == "__main__":
    x1 = 1
    y1 = 1
    x2 = 4
    y2 = 3
    noOfSquares(x1, y1, x2, y2)

# Expected output:
4
# count paths with distance equal to manhattan distance | function to return the value of nck ; since c ( n , k ) = c ( n , n - k ) ; calculate value of [ n * ( n - 1 ) * -- - * ( n - k + 1 ) ] / [ k * ( k - 1 ) * -- - * 1 ] ; function to return the number of paths ; difference between the ' x ' coordinates of the given points ; difference between the ' y ' coordinates of the given points ; 
def binomialCoeff(n, k):
    res = 1
    if (k > n - k):
        k = n - k
    for i in range(k):
        res *= (n - i)
        res //= (i + 1)
    return res


def countPaths(x1, y1, x2, y2):
    m = abs(x1 - x2)
    n = abs(y1 - y2)
    return (binomialCoeff(m + n, n))


x1, y1, x2, y2 = 2, 3, 4, 5
print(countPaths(x1, y1, x2, y2))

# Expected output:
6
# find the area of largest circle inscribed in ellipse | python3 program implementation of above approach ; area of the reuleaux triangle ; 

import math


def areaCircle(b):
    area = math .pi * b * b
    return area


a = 10
b = 8
print(areaCircle(b))

# Expected output:
201.06192982974676
# section formula for 3 d | function to find the section of the line ; applying section formula ; printing result ; 
def section(x1, x2, y1, y2, z1, z2, m, n):
    x = ((m * x2) + (n * x1)) / (m + n)
    y = ((m * y2) + (n * y1)) / (m + n)
    z = ((m * z2) + (n * z1)) / (m + n)
    print("(", x, ",", y, ",", z, ")")


if __name__ == '__main__':
    x1 = 2
    x2 = 4
    y1 = -1
    y2 = 3
    z1 = 4
    z2 = 2
    m = 2
    n = 3
    section(x1, x2, y1, y2, z1, z2, m, n)

# Expected output:
( 2.8 , 0.6 , 3.2 )
# program to find the circumcircle of any regular polygon | python3 program to find the radius of the circumcircle of the given polygon ; function to find the radius of the circumcircle ; these cannot be negative ; radius of the circumcircle ; return the radius ; 

from math import *


def findRadiusOfcircumcircle(n, a):
    if n < 0 or a < 0:
        return -1
    radius = a / sqrt(2 - (2 * cos(360 / n)))
    return radius


if __name__ == "__main__":
    n, a = 5, 6
    print(round(findRadiusOfcircumcircle(n, a), 5))

# Expected output:
3.02487
# program to find the radius of the incircle of the triangle | function to find the radius of the incircle ; the sides cannot be negative ; semi - perimeter of the circle ; area of the triangle ; radius of the incircle ; return the radius ; 

import math


def findRadiusOfIncircle(a, b, c):
    if (a < 0 or b < 0 or c < 0):
        return -1
    p = (a + b + c) / 2
    area = math.sqrt(p * (p - a) * (p - b) * (p - c))
    radius = area / p
    return radius


if __name__ == "__main__":
    a, b, c = 2, 2, 3
    print(round(findRadiusOfIncircle(a, b, c), 6))

# Expected output:
0.566947
# find area of triangle if two vectors of two adjacent sides are given | python code to calculate area of triangle if vectors of 2 adjacent sides are given ; function to calculate area of triangle ; 

import math


def area(x1, y1, z1, x2, y2, z2):
    area = math .sqrt((y1 * z2 - y2 * z1)**2 + (x1 * z2 -
                      x2 * z1)**2 + (x1 * y2 - x2 * y1)**2)
    area = area / 2
    return area


def main():
    x1 = -2
    y1 = 0
    z1 = -5
    x2 = 1
    y2 = -2
    z2 = -1
    a = area(x1, y1, z1, x2, y2, z2)
    print("Area = ", a)


if __name__ == "__main__":
    main()

# Expected output:
Area =  6.422616289332565
# largest trapezoid that can be inscribed in a semicircle | python 3 program to find the biggest trapezoid which can be inscribed within the semicircle ; function to find the area of the biggest trapezoid ; the radius cannot be negative ; area of the trapezoid ; 

from math import *


def trapezoidarea(r):
    if r < 0:
        return -1
    a = (3 * sqrt(3) * pow(r, 2)) / 4
    return a


if __name__ == "__main__":
    r = 5
    print(round(trapezoidarea(r), 3))

# Expected output:
32.476
# maximum distinct lines passing through a single point | python3 program to find maximum number of lines which can pass through a single point ; function to find maximum lines which passes through a single point ; 

import sys


def maxLines(n, x1, y1, x2, y2):
    s = []
    slope = sys .maxsize
    for i in range(n):
        if (x1[i] == x2[i]):
            slope = sys .maxsize
        else:
            slope = (y2[i] - y1[i]) * 1.0 / (x2[i] - x1[i]) * 1.0
        s .append(slope)
    return len(s)


n = 2
x1 = [1, 2]
y1 = [1, 2]
x2 = [2, 4]
y2 = [2, 10]
print(maxLines(n, x1, y1, x2, y2))

# Expected output:
2
# find area of parallelogram if vectors of two adjacent sides are given | python code to calculate area of parallelogram if vectors of 2 adjacent sides are given ; function to calculate area of parallelogram ; 

import math


def area(x1, y1, z1, x2, y2, z2):
    area = math .sqrt((y1 * z2 - y2 * z1)**2 + (x1 * z2 -
                      x2 * z1)**2 + (x1 * y2 - x2 * y1)**2)
    return area


def main():
    x1 = 3
    y1 = 1
    z1 = -2
    x2 = 1
    y2 = -3
    z2 = 4
    a = area(x1, y1, z1, x2, y2, z2)
    print("Area = ", a)


if __name__ == "__main__":
    main()

# Expected output:
Area =  17.320508075688775
# maximum possible intersection by moving centers of line segments | function to print the maximum intersection ; case 1 ; case 2 ; case 3 ; 
def max_intersection(center, length, k):
    center .sort()
    if (center[2] - center[0] >= 2 * k + length):
        return 0
    elif (center[2] - center[0] >= 2 * k):
        return (2 * k - (center[2] - center[0] - length))
    else:
        return length


center = [1, 2, 3]
L = 1
K = 1
print(max_intersection(center, L, K))

# Expected output:
1
# haversine formula to find distance between two points on a sphere | python 3 program for the haversine formula ; distance between latitudes and longitudes ; convert to radians ; apply formulae ; 

import math


def haversine(lat1, lon1, lat2, lon2):
    dLat = (lat2 - lat1) * math .pi / 180.0
    dLon = (lon2 - lon1) * math .pi / 180.0
    lat1 = (lat1) * math .pi / 180.0
    lat2 = (lat2) * math .pi / 180.0
    a = (pow(math .sin(dLat / 2), 2) + pow(math .sin(dLon / 2), 2)
         * math .cos(lat1) * math .cos(lat2))
    rad = 6371
    c = 2 * math .asin(math .sqrt(a))
    return rad * c


if __name__ == "__main__":
    lat1 = 51.5007
    lon1 = 0.1246
    lat2 = 40.6892
    lon2 = 74.0445
    print(haversine(lat1, lon1, lat2, lon2), "K.M.")

# Expected output:
5574.840456848555 K.M.
# heptagonal number | function to find nth heptagonal number ; 
def heptagonalNumber(n):
    return ((5 * n * n) - (3 * n)) // 2


if __name__ == '__main__':
    n = 2
    print(heptagonalNumber(n))
    n = 15
    print(heptagonalNumber(n))

# Expected output:
7
540
# icosidigonal number | function to calculate icosidigonal number ; formula for finding nth icosidigonal number ; 
def icosidigonal_num(n):
    return (20 * n * n - 18 * n) // 2


if __name__ == '__main__':
    n = 4
    print(n, "th Icosidigonal " + "number : ", icosidigonal_num(n))
    n = 8
    print(n, "th Icosidigonal " + "number : ", icosidigonal_num(n))

# Expected output:
4 th Icosidigonal number :  124
8 th Icosidigonal number :  568
# Hypercube Graph | function to find power of 2 ; Dricer code
def power(n):
    if n == 1:
        return 2
    return 2 * power(n - 1)


n = 4
print(power(n))

# Expected output:
16
# reflection of a point at 180 degree rotation of another point | python3 program for find the 180 degree reflection of one point around another point . ; 
def findPoint(x1, y1, x2, y2):
    print("(", 2 * x2 - x1, ",", 2 * y2 - y1, ")")


x1 = 0
y1 = 0
x2 = 1
y2 = 1
findPoint(x1, y1, x2, y2)

# Expected output:
( 2 , 2 )
# program to check if the points are parallel to x axis or y axis | to check for parallel line ; checking for parallel to x and y axis condition ; to display the output ; 
def parallel(n, a):
    x = True
    y = True
    for i in range(n - 1):
        if (a[i][0] != a[i + 1][0]):
            x = False
        if (a[i][1] != a[i + 1][1]):
            y = False
    if (x):
        print("Parallel to Y Axis")
    elif (y):
        print("Parallel to X Axis")
    else:
        print("Not Parallel to X and Y Axis")


a = [[1, 2], [1, 4], [1, 6], [1, 0]]
n = len(a)
parallel(n, a)

# Expected output:
Parallel to Y Axis
# triangular matchstick number | python program to find x - th triangular matchstick number ; 
def numberOfSticks(x):
    return (3 * x * (x + 1)) / 2


print(int(numberOfSticks(7)))

# Expected output:
84
# total area of two overlapping rectangles | python program to find total area of two overlapping rectangles returns total area of two overlap rectangles ; area of 1 st rectangle ; area of 2 nd rectangle ; length of intersecting part i . e start from max ( l1 [ x ] , l2 [ x ] ) of x - coordinate and end at min ( r1 [ x ] , r2 [ x ] ) x - coordinate by subtracting start from end we get required lengths ; 
def overlappingArea(l1, r1, l2, r2):
    x = 0
    y = 1
    area1 = abs(l1[x] - r1[x]) * abs(l1[y] - r1[y])
    area2 = abs(l2[x] - r2[x]) * abs(l2[y] - r2[y])
    x_dist = (min(r1[x], r2[x]) - max(l1[x], l2[x]))
    y_dist = (min(r1[y], r2[y]) - max(l1[y], l2[y]))
    areaI = 0
    if x_dist > 0 and y_dist > 0:
        areaI = x_dist * y_dist
    return (area1 + area2 - areaI)


l1 = [2, 2]
r1 = [5, 7]
l2 = [3, 4]
r2 = [6, 9]
print(overlappingArea(l1, r1, l2, r2))

# Expected output:
24
# Area of square Circumscribed by Circle | Function to find area of square ; Radius of a circle ; Call Function to find an area of square
def find_Area(r):
    return (2 * r * r)


r = 3
print(" Area of square = ", find_Area(r))

# Expected output:
 Area of square =  18
# check whether triangle is valid or not if sides are given | function to check if three sides form a triangle or not ; check condition ; 
def checkValidity(a, b, c):
    if (a + b <= c) or (a + c <= b) or (b + c <= a):
        return False
    else:
        return True


a = 7
b = 10
c = 5
if checkValidity(a, b, c):
    print("Valid")
else:
    print("Invalid")

# Expected output:
Valid
# find the surface area of a 3d figure | declaring the size of the matrix ; absolute difference between the height of two consecutive blocks ; function to calculate the total surfacearea . ; traversing the matrix . ; if we are traveling the topmost row in the matrix , we declare the wall above it as 0 as there is no wall above it . ; if we are traveling the leftmost column in the matrix , we declare the wall left to it as 0 as there is no wall left it . ; if its not the topmost row ; if its not the leftmost column ; summing up the contribution of by the current block ; if its the rightmost block of the matrix it will contribute area equal to its height as a wall on the right of the figure ; if its the lowest block of the matrix it will contribute area equal to its height as a wall on the bottom of the figure ; adding the contribution by the base and top of the figure ; 

M = 3
N = 3


def contribution_height(current, previous):
    return abs(current - previous)


def surfaceArea(A):
    ans = 0
    for i in range(N):
        for j in range(M):
            up = 0
            left = 0
            if (i > 0):
                up = A[i - 1][j]
            if (j > 0):
                left = A[i][j - 1]
            ans += contribution_height(A[i][j], up) + \
                contribution_height(A[i][j], left)
            if (i == N - 1):
                ans += A[i][j]
            if (j == M - 1):
                ans += A[i][j]
    ans += N * M * 2
    return ans


A = [[1, 3, 4], [2, 2, 3], [1, 2, 4]]
print(surfaceArea(A))

# Expected output:
60
# program to calculate area and volume of a tetrahedron | python3 program to calculate area of tetrahedron ;  ; 

import math


def area_of_tetrahedron(side):
    return (math .sqrt(3) * (side * side))


side = 3
print("Area of Tetrahedron = ", round(area_of_tetrahedron(side), 4))

# Expected output:
Area of Tetrahedron =  15.5885
# program to calculate area and volume of a tetrahedron | python code to find the volume of a tetrahedron ; function to calculate volume ; 

import math


def vol_tetra(side):
    volume = (side ** 3 / (6 * math .sqrt(2)))
    return round(volume, 2)


side = 3
vol = vol_tetra(side)
print(vol)

# Expected output:
3.18
# counting pairs when a person can form pair with at most one | number of ways in which participant can take part . ; 
def numberOfWays(x):
    dp = []
    dp .append(1)
    dp .append(1)
    for i in range(2, x + 1):
        dp .append(dp[i - 1] + (i - 1) * dp[i - 2])
    return (dp[x])


x = 3
print(numberOfWays(x))

# Expected output:
4
# program to find slope of a line | python3 program to find slope ; function to find the slope of a straight line ; 

import sys


def slope(x1, y1, x2, y2):
    if x1 == x2:
        return (sys .maxsize)
    return ((y2 - y1) / (x2 - x1))


x1 = 4
y1 = 2
x2 = 2
y2 = 5
print("Slope is :", slope(4, 2, 2, 5))

# Expected output:
Slope is : -1.5
# maximum integral co | making set of coordinates such that any two points are non - integral distance apart ; used to avoid duplicates in result ; 
def printSet(x, y):
    arr = []
    for i in range(min(x, y) + 1):
        pq = [i, min(x, y) - i]
        arr .append(pq)
    for it in arr:
        print(it[0], it[1])


if __name__ == "__main__":
    x = 4
    y = 4
    printSet(x, y)

# Expected output:
0 4
1 3
2 2
3 1
4 0
# program to find circumference of a circle | python3 code to find circumference of circle ; utility function ; 

PI = 3.1415


def circumference(r):
    return (2 * PI * r)


print('%.3f' % circumference(5))

# Expected output:
31.415
# program to check if three points are collinear | function to check if point collinear or not ; 
def collinear(x1, y1, x2, y2, x3, y3):
    if ((y3 - y2) * (x2 - x1) == (y2 - y1) * (x3 - x2)):
        print("Yes")
    else:
        print("No")


x1, x2, x3, y1, y2, y3 = 1, 1, 0, 1, 6, 9
collinear(x1, y1, x2, y2, x3, y3)

# Expected output:
No
# number of rectangles in n * m grid | python3 program to count number of rectangles in a n x m grid ; 
def rectCount(n, m):
    return (m * n * (n + 1) * (m + 1)) // 4


n, m = 5, 4
print(rectCount(n, m))

# Expected output:
150
# number of unique rectangles formed using n unit squares | python3 program to count rotationally equivalent rectangles with n unit squares ; height >= length is maintained ; 

import math


def countRect(n):
    ans = 0
    for length in range(1, int(math .sqrt(n)) + 1):
        height = length
        while (height * length <= n):
            ans += 1
            height += 1
    return ans


n = 5
print(countRect(n))

# Expected output:
6
# represent a given set of points by the best possible straight line | function to calculate m and c that best fit points represented by x [ ] and y [ ] ; 
def bestApproximate(x, y, n):
    sum_x = 0
    sum_y = 0
    sum_xy = 0
    sum_x2 = 0
    for i in range(0, n):
        sum_x += x[i]
        sum_y += y[i]
        sum_xy += x[i] * y[i]
        sum_x2 += pow(x[i], 2)
    m = (float)((n * sum_xy - sum_x * sum_y) / (n * sum_x2 - pow(sum_x, 2)))
    c = (float)(sum_y - m * sum_x) / n
    print("m = ", m)
    print("c = ", c)


x = [1, 2, 3, 4, 5]
y = [14, 27, 40, 55, 68]
n = len(x)
bestApproximate(x, y, n)

# Expected output:
m =  13.6
c =  0.0
# check for star graph | define the size of incidence matrix ; def to find star graph ; initialize number of vertex with deg 1 and n - 1 ; check for s1 ; check for s2 ; check for sn ( n > 2 ) ; 

size = 4


def checkStar(mat):
    global size
    vertexD1 = 0
    vertexDn_1 = 0
    if (size == 1):
        return (mat[0][0] == 0)
    if (size == 2):
        return (mat[0][0] == 0 and mat[0][1] ==
                1 and mat[1][0] == 1 and mat[1][1] == 0)
    for i in range(0, size):
        degreeI = 0
        for j in range(0, size):
            if (mat[i][j]):
                degreeI = degreeI + 1
        if (degreeI == 1):
            vertexD1 = vertexD1 + 1
        elif (degreeI == size - 1):
            vertexDn_1 = vertexDn_1 + 1
    return (vertexD1 == (size - 1) and vertexDn_1 == 1)


mat = [[0, 1, 1, 1], [1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0]]
if (checkStar(mat)):
    print("Star Graph")
else:
    print("Not a Star Graph")

# Expected output:
Star Graph
# dynamic convex hull | adding points to an existing convex hull | python 3 program to add given a point p to a given convext hull . the program assumes that the point of given convext hull are in anti - clockwise order . ; checks whether the point crosses the convex hull or not ; returns the square of distance between two input points ; checks whether the point is inside the convex hull or not ; initialize the centroid of the convex hull ; multiplying with n to avoid floating point arithmetic . ; if the mid and the given point lies always on the same side w . r . t every edge of the convex hull , then the point lies inside the convex hull ; adds a point p to given convex hull a [ ] ; if point is inside p ; point having minimum distance from the point p ; find the upper tangent ; find the lower tangent ; initialize result ; making the final hull by traversing points from up to low of given convex hull . ; modify the original vector ; 

import copy


def orientation(a, b, c):
    res = ((b[1] - a[1]) * (c[0] - b[0]) - (c[1] - b[1]) * (b[0] - a[0]))
    if (res == 0):
        return 0
    if (res > 0):
        return 1
    return -1


def sqDist(p1, p2):
    return ((p1[0] - p2[0]) * (p1[0] - p2[0]) +
            (p1[1] - p2[1]) * (p1[1] - p2[1]))


def inside(a, p):
    mid = [0, 0]
    n = len(a)
    p[0] *= n
    p[1] *= n
    for i in range(n):
        mid[0] += a[i][0]
        mid[1] += a[i][1]
        a[i][0] *= n
        a[i][1] *= n
    for i in range(n):
        j = (i + 1) % n
        x1 = a[i][0]
        x2 = a[j][0]
        y1 = a[i][1]
        y2 = a[j][1]
        a1 = y1 - y2
        b1 = x2 - x1
        c1 = x1 * y2 - y1 * x2
        for_mid = a1 * mid[0] + b1 * mid[1] + c1
        for_p = a1 * p[0] + b1 * p[1] + c1
        if (for_mid * for_p < 0):
            return False
    return True


def addPoint(a, p):
    arr = copy .deepcopy(a)
    prr = p .copy()
    if (inside(arr, prr)):
        return
    ind = 0
    n = len(a)
    for i in range(1, n):
        if (sqDist(p, a[i]) < sqDist(p, a[ind])):
            ind = i
    up = ind
    while (orientation(p, a[up], a[(up + 1) % n]) >= 0):
        up = (up + 1) % n
    low = ind
    while (orientation(p, a[low], a[(n + low - 1) % n]) <= 0):
        low = (n + low - 1) % n
    ret = []
    curr = up
    ret .append(a[curr])
    while (curr != low):
        curr = (curr + 1) % n
        ret .append(a[curr])
    ret .append(p)
    a .clear()
    for i in range(len(ret)):
        a .append(ret[i])


if __name__ == "__main__":
    a = []
    a .append([0, 0])
    a .append([3, -1])
    a .append([4, 5])
    a .append([-1, 4])
    n = len(a)
    p = [100, 100]
    addPoint(a, p)
    for e in a:
        print("(", e[0], ", ", e[1], ") ", end=" ")

# Expected output:
( -1 ,  4 )  ( 0 ,  0 )  ( 3 ,  -1 )  ( 100 ,  100 )