Help determining correct answer based on response type AND time

Hello–
In my experiment, I need to determine a correct response based on WHAT response took place, and WHEN the response took place. Subjects are collecting data while a video is playing, and I want to give feedback based on responses and when the responses were made.

In the keyboard responses, I have this,

and my data output looks like this:

I need to compare this list of responses, and response times against the ‘correct responses’. That is, a list of responses and times that are ‘correct’. I want to compare these lists independently of order…if they gave a response within a 1s window of the correct, count it as correct.

Any help on how to program this comparison would be very helpful!

Were you able to solve this? I have a similar issue