import subprocess
obj1 = subprocess.Popen("squeue | grep -E '^ +[0-9]'| awk '{print $1,$4}'", shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
res1 = obj1.stdout.read().decode("UTF-8")
l = res1.split()
l1 = l[::2]
l2 = l[1::2]
obj2 = subprocess.Popen("sacct -X -j " + ",".join(l1) + "| grep -E '^[0-9]'| awk '{print $1}'",shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
res2 = obj2.stdout.read().decode("UTF-8")
t1 = set(res1.split())
t2 = set(res2.split())
t3 = t1 - t2
for i in t3:
for index, j in enumerate(l1):
if i == j:
print(j, l2[index])