For icloud data:
Check if the device has FMI/iCloud turned on using IMEI
here.
If locked, try resetting password using
iforgot.apple.com and once you get the password, you can get access to the icloud data by logging in. But it still depends on the info provided, level of security that is activated (2FA), etc.
If you meant passcode instead, there is no way to get access. You can reset the device and it will be back with erased data and asking you sign in using icloud, if you had one. Else use it as a plain new device.
For Mac computers, depending on what type of lock (efi, pin, icloud) i can send you instructions. I haven’t dealt with mac pc’s previously.
But with all that said, try scheduling up a call with apple cc. They are the best cc i have ever interacted. 💯