• + 0 comments

    int main() { char* n_endptr; char* n_str = readline(); int n = strtol(n_str, &n_endptr, 10);

    int xfirst;
    int yfirst;
    int h = true;
    int v = true;
    if (n_endptr == n_str || *n_endptr != '\0') { exit(EXIT_FAILURE); }
    struct point *point_xy = malloc(sizeof(struct point) * n);
    for (int n_itr = 0; n_itr < n; n_itr++) 
    {
        char** xy = split_string(readline());
        char* x_endptr;
        char* x_str = xy[0];
        int x = strtol(x_str, &x_endptr, 10);
        if (x_endptr == x_str || *x_endptr != '\0') { exit(EXIT_FAILURE); }
        char* y_endptr;
        char* y_str = xy[1];
        int y = strtol(y_str, &y_endptr, 10);
        if (y_endptr == y_str || *y_endptr != '\0') { exit(EXIT_FAILURE); } 
    
        point_xy[n_itr].x = x;
        point_xy[n_itr].y = y;
    }
    xfirst = point_xy[0].x;
    yfirst = point_xy[0].y;
    //  dprintf(2,"%d <----xfirst----- -----yfirst------>%d\n",xfirst,yfirst);
     for (int i = 0; i < n;i++)
     {
        //  dprintf(2,"%d <----xfirst----- -----yfirst------>%d\n",xfirst,yfirst);
        // dprintf(2,"%d <----xfirst----- -----points------>%d\n",xfirst,point_xy[i].x);
        if (point_xy[i].x != xfirst)
        {
            h = false;
            break;
        }
     }
     for (int j = 0; j < n;j++)
     {
    
        if (point_xy[j].y != yfirst)
        {
            v = false;
            break;
        }
    
     }
    if (h || v)
        printf("YES");
    else 
        printf("NO");
    return 0;
    

    }