Finding sequential recurrences in a list of numbers
You're doing things the hard way.

dic = {}
for p1 in range(len(seq)):
    for p2 in range(p1+1,len(seq)):
        dic.setdefault(tuple(seq[p1:p2]), []).append((p1,p2))


For each range, you are calling .setdefault().  You should just use a default dictionary, which can automatically create a list for any unseen keys:

from collections import defaultdict

dic = defaultdict(list)

for p1 in range(len(seq)):
    for p2 in range(p1 + 1, len(seq)):
        dic[tuple(seq[p1:p2])].append((p1, p2))




Next, you're filtering the dictionary the hard way.

cleandic = {}
for key, value in dic.items():
    if len(value) &gt; 1:
        cleandic.setdefault(key,value)


This can be expressed in one line, using list comprehension:

cleandic = { key: val for key, val in dic.items() if len(val) &gt; 1 }




The next improvement comes from noting that the key portion of (-2, 3): [(0, 2), (2, 4)]} is completely recoverable from the value portion; using (0, 2) or (2, 4) as a slice of seq will return the appropriate sequence.  You do not need to maintain a dictionary; a list of lists is sufficient and less complex.  Instead of cleandic, you can have:

groups = [ val for val in dic.values() if len(val) &gt; 1 ]


Instead of removing the second of these two dictionary values:


  #(1,4,-5,1,4,-5) : [(7,13),(10,16)]
     #(1,4,-5) : [(7,10),(10,13)]  


You now just need to remove the second of these two list entries:


  [(7,13),(10,16)]
     [(7,10),(10,13)]  




You can still sort this by noting that (7,13) represents a sequence of length 6.

groups = sorted(groups, key=lambda item: item[0][1] - item[0][0], reverse=True)




Any time you have to .copy() is good time to stop and think if there is another way to solve the problem.

    for key2, values2 in sorteddic.copy().items():
        ...
                  sorteddic[key2].pop(sorteddic[key2].index(value2))


Here, you are modifying sorteddic inside the loop, so you clearly can't loop on the sorteddic itself, which explains the need to copy the dictionary first.  Since the copy is itself in another loop, you are doing a lot of copies!

Moreover, this isn't even a loop!  It is just a way to extract the first item from the dictionary.

for key1, values1 in sorteddic.items():
    ...
    break


Rework the algorithm to not modify the container you're looping over:

def subset_of(long_groups, group):
    return any(lg[0] &lt;= g[0] and g[1] &lt;= lg[1] for long_group in long_groups
               for lg in long_group for g in group)

...

longest_groups = []
for group in groups:
    if not subset_of(longest_groups, group):
        longest_group.append(group)


Finally, you can rebuild your dictionary with the sequence tuples as keys:

readydic = { tuple(seq[group[0][0]:group[0][1]]): group for group in longest_groups }


Since all the dictionary copying has been removed, this should be significantly faster.