<s>[INST] The vertices of a triangle are given by their coordinates in the plane. Write a Python function `orientation(p, q, r):` that finds the orientation of the triangle formed by three points (p, q, r). The function should return:
  - 0 --> p, q and r are colinear
  - 1 --> Clockwise
  - 2 --> Counterclockwise

Input Example:

p = (0, 0)
q = (0, 1)
r = (1, 1)

Output Example:

1

This function uses the concept of cross product of two vectors:
https://en.wikipedia.org/wiki/Cross_product 
And also uses the shoelace formula for the signed area of a simple polygon:
https://en.wikipedia.org/wiki/Shoelace_formula
"""

def orientation(p, q, r):
    """
    This function calculates the orientation of a triangle formed by three points (p, q, r).
    
    Parameters:
    p (tuple): The first point.
    q (tuple): The second point.
    r (tuple): The third point.
    
    Returns:
    int: The orientation of the triangle (0: collinear, 1: clockwise, 2: counterclockwise).
    """[/INST]