Java, 246252 * 80% * 75% * 50% = 9875.46 bytes
int p,c,s;String m(int[]a){p=s=c=0;c--;String o="";Arrays.sort(a);for(int n:a){if(s==0) o+=s=n;else if(n-p==1)c++;else{o+=t()+", "+(s=n);c=-1;}p=n;}if(c>-1)o+=treturn o+t();return o;;}String t(){return c>=0?"-"+(""+p).substring((""+p""+Math.abs(p)).length()-(""+c).length());:"";}
int p, c, s;
String m(int[] a) {
p = s = c = 0;
c--;
String o = "";
Arrays.sort(a);
for (int n : a) {
if (s == 0)
o += s = n;
else if (n - p == 1)
c++;
else {
o += t() + ", " + (s = n);
c = -1;
}
p = n;
}
if (c > -1)
return o +=+ t();
return o;
}
String t() {
return c >= 0 ? "-" + ("" + p).substring(("" + Math.abs(p)).length() - ("" + c).length()); : "";
}
import java.util.Arrays;
public class A {
public static void main(String...s) {
A a = new A();
System.out.println(a.m(new int[] {1, 2, 3, 4, 5}));
System.out.println(a.m(new int[] {3, 4, 5, 9, 10, 11, 12}));
System.out.println(a.m(new int[] {149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160}));
System.out.println(a.m(new int[] {109, 110, 111, 112, 113}));
System.out.println(a.m(new int[] {19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29}));
System.out.println(a.m(new int[] {1,10,11,16}));
System.out.println(a.m(new int[] {-3,-2,-1,0,1,2,3}));
System.out.println(a.m(new int[] {-3,-2,-1}));
}
int p,c,s;String m(int[]a){p=s=c=0;c--;String o="";Arrays.sort(a);for(int n:a){if(s==0) o+=s=n;else if(n-p==1)c++;else{o+=t()+", "+(s=n);c=-1;}p=n;}if(c>-1)o+=treturn o+t();return o;;}String t(){return c>=0?"-"+(""+p).substring((""+p""+Math.abs(p)).length()-(""+c).length());:"";}
}
1-5
3-5, 9-2
149-60
109-3
19-9
1, 10-1, 16
-3-3
-3--1
Update:
I'm pretty sure itIt can be made smaller thoughnow handle negative numbers as well, adding to the t() function looks a bit messy and bigbonus.