def sim_key_by_press(x, y, thresh=10, div=1):
    key_x = key_y = None
    if (x > 100):
        x = 100
    if (y > 100):
        y = 100
    if (x < (- 100)):
        x = (- 100)
    if (y < (- 100)):
        y = (- 100)
    if ((x < (- thresh)) or (x > thresh)):
        if (x > 0):
            key_x = r
        else:
            key_x = l
        x = (abs(x) - thresh)
    else:
        x = 0
    if ((y < (- thresh)) or (y > thresh)):
        if (y > 0):
            key_y = u
        else:
            key_y = d
        y = (abs(y) - thresh)
    else:
        y = 0
    x = (x // div)
    y = (y // div)
    t1 = time()
    while ((x > 0) or (y > 0)):
        if (x >= y):
            press(key_x)
            x -= x
        else:
            press(key_y)
            y -= y
    print((x + y), (time() - t1))
def sim_key_by_press(x, y, thresh=10, div=1):
    key_x = key_y = None
    if (x > 100):
        x = 100
    if (y > 100):
        y = 100
    if (x < (- 100)):
        x = (- 100)
    if (y < (- 100)):
        y = (- 100)
    if ((x < (- thresh)) or (x > thresh)):
        if (x > 0):
            key_x = r
        else:
            key_x = l
        x = (abs(x) - thresh)
    else:
        x = 0
    if ((y < (- thresh)) or (y > thresh)):
        if (y > 0):
            key_y = u
        else:
            key_y = d
        y = (abs(y) - thresh)
    else:
        y = 0
    x = (x // div)
    y = (y // div)
    t1 = time()
    while ((x > 0) or (y > 0)):
        if (x >= y):
            press(key_x)
            x -= x
        else:
            press(key_y)
            y -= y
    print((x + y), (time() - t1))