text:
Lets take Beal's $1,000,000
Beal's Conjecture has a million dollar prize if you prove/disprove it.
It states that if  where A, B, C, x, y, and z are positive integers with x, y, z > 2, then A, B, and C have a common prime factor.
The challenge is to write a program that searches for a counter example to disprove this!
Rules

Write a program searching for a counter example of Beal's Conjecture
You can perform an exhaustive search (i.e., all possible combinations of numbers that fit this form) or use some optimizations (e.g., A and B are symmetrical).
You must use arbitrary-precision integers.

Notes

This is a popularity contest, be creative!
Speed isn't necessary, but makes it more interesting. Optimize!
I am also interested in seeing the shortest code too. You will get a +1 from me!
I'll run the winning program on a supercomputer that I have access to!
This conjecture is considered to be true, but that doesn't mean we can't try!
Peter Norvig of Google  has attempted this problem too. You may use his page as guidance. He has a short Python program you can use as an example.
Some other guy (who also happens to work at Google) has greatly improved on Norvig's approach, his page (with source code) can be found here.
My SO question related to this from two years ago may also be helpful: Fin all A^x in a given range.

Supercomputer? Now that's cool. Any chance of splitting the cash?

@Synthetica This conjecture has already been tested with very, very, very big numbers so this is mostly for fun. But of course we can split the cash :)

"It should either continue forever or allow a finite upper bound (no matter how large)." ...as opposed to what alternatives?

@undergroundmonorail Only working for small numbers.

Small numbers are a finite upper bound.

@undergroundmonorail Correct. That is why I also said (no matter how large)

"No matter how large" would seem to rule out writing in any existing language for any existing processor. Could this be relaxed to allow for the limitations of fixed-width pointers / array subscripts?

@PeterTaylor Removed that rule altogether. However, I kept "You must use arbitrary-precision integers" because this would overflow in seconds with fixed-width.

I'm being pathetically lazy (pun intended), but why not... seems to fulfill the rules.
Haskell, 204
import Control.Monad
import Control.Monad.Omega
main=print.filter(\[(a,x),(b,y),(c,z)]
 ->and$(a^x+b^y==c^z):zipWith(((>1).).gcd)[a,b,c][b,c,a])
 .runOmega$mapM(\_->liftM2(,)(each[1..])$each[3..])"123"

This prints1 all combinations which fulfill the counterexample property. I used the control-monad-omega package for diagonalising ℕ6... might be considered library-cheating. But seeing as someone will later post an APL answer where all this stuff is built into the language (or isn't it?), I don't give too much about it...
Of course, the program is way too slow (naïve exhaustion, and linked-lists as data structure) to be expectable of actually yielding a counterexample, but Haskell itself can actually achieve decent performance.

1Since it prints the tuples in list format, i.e. in one line, you need to switch your terminal's buffering off or you won't see when a result comes in. Alternatively, you can replace print with mapM_ print so you get a newline after each result, flushing a line-buffered terminal.
To test the program, change each[3..] to each[2..], then you'll simply get all non-coprime pythagorean tuples as result.

C#, no loops
OK, I skimmed a couple of those links, but to be honest they were a bit boring. I'm not interested in optimizing the hell out of it with hash tables and whatnot. Why should I need to? You've got a goddamn supercomputer!
Hell, I don't even want to bother with loops! This solution will follow the no-loops rule.
Please note that the code I'm about to write is not good code, or the kind of code I'd write in real life (in case any prospective employers happen to read this). This code emphasises brevity and the ability to work in a narrative, and deemphasises the proper conventions and rituals and loops and so on.
To demonstrate what I'm talking about, we'll start with a shocking class with public fields to store the operands of the equation:
class BealOperands
{
    public BigInteger A, B, C, x, y, z;
}

OK, we'll start with what is probably the hardest challenge. We need to figure out a way to permute through every combination of those operands. There are undoubtedly ways to do it more efficiently than checking every permutation, but I can't be bothered figuring them out. And why should I? We've got a goddamn supercomputer!
Here's the algorithm I came up with. It's incredibly inefficient, and goes over the same operands over and over again, but who cares? Supercomputer!

Treat the six operands as a base-2 number, and permute through every combination.
Treat the six operands as a base-3 number, and permute through every combination.
Treat the six operands as a base-4 number, and permute through every combination.
(...)

How to do all this without loops? Easy! Just implement an IEnumerable and associated IEnumerator to pump out the permutations. Later, we'll use LINQ to query it.
class BealOperandGenerator : IEnumerable<BealOperands>
{
    // Implementation of IEnumerable<> and IEnumerable -- basically boilerplate to get to BealOperandGeneratorEnumerator.
    public IEnumerator<BealOperands> GetEnumerator() { return new BealOperandGeneratorEnumerator(); }
    System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); }
}

class BealOperandGeneratorEnumerator : IEnumerator<BealOperands>
{
    public BealOperandGeneratorEnumerator() { Reset(); }

    private BealOperands operands;
    private BigInteger @base;

    public void Reset()
    {
        // A is set to 0, which is "before" its minimum value, because IEnumerators are supposed to
        // point to their first element *after* the first call to MoveNext().
        // All other operands are set to their minimum values.
        operands = new BealOperands { A = 0, B = 1, C = 1, x = 3, y = 3, z = 3 };
        @base = 2;
    }

    public BealOperands Current
    {
        get
        {
            // We need to return a copy, since we'll be manipulating our internal one.
            return new BealOperands {
                A = operands.A, B = operands.B, C = operands.C,
                x = operands.x, y = operands.y, z = operands.z };
        }
    }

    public bool MoveNext()
    {
        // Increment the lowest "digit" and "carry" as necessary.
        operands.A++;
        if (operands.A - 1 >= @base)
        {
            operands.A = 1; operands.B++;
            if (operands.B - 1 >= @base)
            {
                operands.B = 1; operands.C++;
                if (operands.C - 1 >= @base)
                {
                    operands.C = 1; operands.x++;
                    if (operands.x - 3 >= @base)
                    {
                        operands.x = 3; operands.y++;
                        if (operands.y - 3 >= @base)
                        {
                            operands.y = 3; operands.z++;
                            if (operands.z - 3 >= @base)
                            {
                                operands.z = 3; @base++;
                            }
                        }
                    }
                }
            }
        }
        // There will always be more elements in this sequence.
        return true;
    }

    // More boilerplate
    object System.Collections.IEnumerator.Current { get { return Current; } }
    public void Dispose() { }
}

Now we're in business! All we need to do is enumerate an instance of BealOperandGenerator and find a counterexample of Beal's Conjecture.
Our next big problem is that there doesn't seem to be a built-in way to raise a BigInteger to the power of a BigInteger. There's BigInteger.Pow(BigInteger value, int exponent), and BigInteger.ModPow(BigInteger value, BigInteger exponent, BigInteger modulus), but no method to raise a BigInteger, to the power of another BigInteger, modulo infinity.
What a shiny nail of a problem! It looks like it was made to be solved with our IEnumerable/IEnumerator hammer!
class BigIntegerPowerEnumerable : IEnumerable<Tuple<BigInteger, BigInteger>>
{
    public BigIntegerPowerEnumerable(BigInteger @base, BigInteger exponent) { this.@base = @base; this.exponent = exponent; }
    BigInteger @base, exponent;

    public IEnumerator<Tuple<BigInteger, BigInteger>> GetEnumerator() { return new BigIntegerPowerEnumerator(@base, exponent); }
    System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); }
}

class BigIntegerPowerEnumerator : IEnumerator<Tuple<BigInteger, BigInteger>>
{
    public BigIntegerPowerEnumerator(BigInteger @base, BigInteger exponent)
    {
        originalBase = @base;
        originalExponent = exponent;
        Reset();
    }

    BigInteger originalBase, currentBase, originalExponent, currentExponent;
    bool finished;

    public void Reset()
    {
        // IEnumerable.Reset() is a silly method. You're required to implement it when you implement IEnumerable,
        // but it isn't used by foreach or LINQ or anything. If you want to re-enumerate the enumerable, just get
        // a brand new enumerator.
        // In this case it gets in the way. The only reason I'm storing the original values is so I can implement
        // this useless method properly. I supposed I could just throw a NotImplementedException or something,
        // but it's done now.
        currentBase = originalBase;
        currentExponent = originalExponent;
        finished = false;
    }

    public bool MoveNext()
    {
        if (finished) return false;

        if (currentExponent <= Int32.MaxValue)
        {
            currentBase = BigInteger.Pow(currentBase, (Int32)currentExponent);
            currentExponent = 1;
            finished = true;
        }
        else
        {
            currentBase = BigInteger.Pow(currentBase, Int32.MaxValue);
            currentExponent -= Int32.MaxValue;
        }
        return true;
    }

    public Tuple<BigInteger, BigInteger> Current
    {
        get { return new Tuple<BigInteger, BigInteger>(currentBase, currentExponent); }
    }

    object System.Collections.IEnumerator.Current { get { return Current; } }
    public void Dispose() { }
}

static class BigIntegerPowExtension
{
    public static BigInteger Pow(this BigInteger @base, BigInteger exponent)
    {
        return new BigIntegerPowerEnumerable(@base, exponent).Last().Item1;
    }
}

Now we've got an extension method Pow, that can be called on a BigInteger, and takes a BigInteger exponent and no modulus.
OK, let's step back. How can we tell if a particular BealOperands is a counterexample of Beal's Conjecture? Well, two things need to be true:

The operands, when plugged into that formula up at the top of the page, must form a true equation.
A, B, and C must NOT have a common prime factor (i.e. their GCD is 1).

We've got what we need to check the first condition. And it turns out the second condition is a lot easier to check than it sounds. BigInteger provides a lovely GreatestCommonDivisor method, which allows us to conveniently sidestep the whole nightmare of trying to implement that without loops.
So we're ready to write a method to check if a BealOperands is a counterexample. Here goes...
static class BealOperandsExtensions
{
    public static bool IsBealsConjectureCounterExample(this BealOperands o)
    {
        // If the equation isn't even true, we don't have a counter example unfortunately
        if (o.A.Pow(o.x) + o.B.Pow(o.y) != o.C.Pow(o.z))
        {
            return false;
        }

        // We have a counterexample if A, B and C are coprime
        return BigInteger.GreatestCommonDivisor(o.A, o.B) == 1 &&
               BigInteger.GreatestCommonDivisor(o.A, o.C) == 1 &&
               BigInteger.GreatestCommonDivisor(o.B, o.C) == 1;
    }
}

And finally we can bring it all together with this rather slick Main method:
static class Program
{
    static void Main()
    {
        var bealOperandGenerator = new BealOperandGenerator();
        if (bealOperandGenerator.Any(o => o.IsBealsConjectureCounterExample()))
        {
            Console.WriteLine("IN YOUR FACE, BEAL!");
        }
    }
}

There are no counterexamples with C^Z <= 1.0E27.
As of Feb. 2019 I’m checking out to C^Z <= 1.0E29 on the assumption that either the “X” and/or “Y” exponent must be >= 5.
Current version of this program (“X” and/or “Y” >= 5) takes less than 1 second on an AMD 2920X to find  all solutions out to C^Z <= 1.0E15. (But all of the gcd(A,B,C) are >= 2)
Details at http://www.durangobill.com/BealsConjecture.html
I can modify the current code (Uses “C” and OpenMP) out beyond these limits but will need more than 128GB of RAM to run it. (Hundreds of CPUs would also help. Thousands of CPUs would be even better.) (If you have free access to something like this, please contact me.)
My email address is on my home page at http://www.durangobill.com

If you can flesh this out with some code this may be a valid answer, otherwise it's probably best suited as a comment on the question. However either way the work you've done on this is impressive.

Many universities have high-performance clusters. If you reached out to one, they might be able to grant you access. I've seen too many clusters just idling!

The 2nd variation of the Beal’s search program has finished. The results are:
1) There are no counterexamples with \$C^Z < 10^{26}\$.
A complete list of all general solutions to \$A^X + B^Y = C^Z\$ with at least one of the exponents \$(X,Y) >= 4\$ can be seen at:  http://www.durangobill.com/BealXgt3e27.txt
2) If you assume that at least of of the exponents \$(X,Y)\$ must be \$>= 5\$, there are no counterexamples with \$C^Z < 10^{28}\$.
A complete list of all general solutions to \$A^X + B^Y = C^Z\$ with at least one of the exponents \$(X,Y) >= 5\$ and C^Z < 1.0E29 can be seen at:  http://www.durangobill.com/BealXgt4e29.txt
Details at: http://www.durangobill.com/BealsConjecture.html
The next two questions are::
1) Can a supercomputer extend the search?
2) If a supercomputer could extend the search, would it be practical?
1) To extend either of the above searches to 1.0E30, 300GB of RAM would be required per core unless cores can share the 300GB. For each additional further incremental increase in the exponential power beyond 1.0E30, the amount of required RAM increases by a factor of at least 2.2.
2) The amount of processing power needed for each further incremental increase in the exponent to and beyond 1.0E30 multiplies the combined CPU time by about 3.8. The search to 1.0E29 took 2 weeks using 12 cores. Supercomputer time is not generally “free”, and there is very little prospect that there are any counterexamples.
As a guide to the efficiency of the code at durangobill.com/BealE29code.txt, each of the 12 cores averaged 220 million loop iterations per second for the inner loop. (Average is for the 2-week run.) (An increase in RAM memory beyond what I have would increase this average speed by up to a factor of 2.)
I’ll let Austin answer 1) and 2) since he has access to a supercomputer and I don’t. (If by any remote chance that both 1) and 2) are a "go", I can supply the "C" code with the caveat that I'm not familiar with multi-thread instructions for large supercomputer clusters.)

Can you please use only one answer to the question, rather than spreading it out to three? You know you can edit your previous answers, right?

I appreciate that you find a counterexample and then don't print it... Also this isn't very code-golfy...

Had to put this in 2 comments to get it to fit.
The major arrays are allocated as follows:
SortHeads = calloc(PRIME1+1, 8);
X2YmodPrime1 = calloc(ARRAYSIZE+1, 4);
X2YmodPrime2 = calloc(ARRAYSIZE+1, 4);
Base = calloc(ARRAYSIZE+1, 4);
Power = malloc(ARRAYSIZE+1);

(You will need 128GB of RAM for these arrays)
with:
#define PRIME1 2147483647LLU
#define PRIME2 2147483629LLU
#define ARRAYSIZE 4700000000LL

“Base” actually needs 33 bits (cbrt(1.0E29)) - the extra bit is stuffed in “Power” (which only needs 7 bits.)
The arrays operate similar to a hash table. However, since they are sorted by PRIME1 and only used as look-up tables, you don’t need the linked lists to access them. The result is thus a very fast linear time lookup to see if a trial A^X + B^Y = any C^Z.
Thus statements in the innermost loop are only two loops deep.
“Pragma” statements control the number of multi processing cores that are used (in this case 12) - all can access the single copy of the arrays.
Here’s the “main” code (in “C”) (Hope the comments fit the posted line length. If not, copy them out and paste the code in some document that has a longer line length.)

The comment box will only let me use 600 characters, and I need 3,000+ for the code. (Any suggestions?)  (I can post the code on my web page if I can't post it here.)

I put the “main” “C” code here.
http://www.durangobill.com/BealE29code.txt
If nothing else, it’s an example of “how to do it” for multiple thread processing in “C”.

Welcome to the site.  While the comment boxes are limited to 600 characters your answer is not.  You should be able to fit your code in your answer easily.  If you are not try trimming the comments off.  Also I reformatted your answer to use code blocks.  These can be done with 4 spaces as I did. When you move your code to your answer you should put it in a code block or it will be entirely unreadable.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Anonymize names - sort of
Edit: There will be a bonus of -20 for random masking
Hello fellow Whistleblowers and carriers of secret knowledge.
I am due to an interview by mail and I - of course - cannot say specific names in full length. But as I want to disclose it in a rather not-so-obvious-way I need your help.
I will provide these names in the form of

"evil_company_that_makes_me_shiver"

but surely I do not want to spell it out completely. Your task to help me and the whole world is that you provide a nice program that turns the above into
"ev**************************"

or
"**il************************"

or even
"****_c**********************"

I think you get it. But there is one flaw: I want to disclose the name in total, so I need to pass the number of occurrences and the word itself to the script and it will disclose the letters bit by bit. An example could be
~$ ./whistle NSA 3
> "N**"
> "**A"
> "*S*"

or
~$ ./whistle nuclear 3
> "nu*****"
> "***lea*"
> "**c***r"

or
~$ ./whistle nuclear 2
> "nuc****"
> "***lear"

I hope you can help me and as we know that size matters the shortest code wins. Help make this world a better place!

You give no details about how the masking should happen, so you should get whatever is shortest code, no matter your examples.

I thought that it was clear that the shortest code wins? Hmmm, maybe I need to improve my english grammar according to this :(
/Edit: I don't really care on how the masking ist done, the above is just an example, but it should be "unreadable" if you read one accorrence alone"

Yes, shortest code was clear. But you will mostly get "regular" masking, not like your samples. Perhaps, since you don't mind anyway, change your sample outputs to regular ones. Specifically your second example of it running, plus the example in your question

Or you could a bonus for random masking.

GolfScript, 26 charaters
Since no specific way of disclosure was specified I decided to go for the shortest:
:f,\`{{\)f%.!@42if}%\;n}+%

You may experiment with this code online.
Example:
> "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 7
******G******N******U*****
*****F******M******T******
****E******L******S******Z
***D******K******R******Y*
**C******J******Q******X**
*B******I******P******W***
A******H******O******V****

Commented code:
:f           # Save the second input to variable f
,            # Makes the array [0 1 2 .... f-1]
\`{          # \´{}+% builds a code block where
             # first the input string is pushed (done
             # via the + operator and afterwards the whole
             # block is applied to above array, i.e.
             # For each line 0, 1, ...
             #   Here, the stack contains the line number (counter)
             #   and the string
  {          #   {}% -> map to each character of the string
             #     Stack contains counter and current character
    \)f%     #     Increase the counter by one and calculate modulo f
    .        #     Duplicate counter (will be used for the if below)
    !        #     and test for zero
             #     I.e. if counter==0
    @        #       Then Current character
    42       #       Else 42 (which is '*')
    if       #
  }%         #   The mapping operation masked most of the characters
  \;         #   Discard the counter
  n          #   Add newline
}+%

Nice! Could you explain what each part of the code does?

Can't see why. GolfScript is so self-documenting.

@JohnOdom Nevertheless I added some comments to the code.

if you randomly decide whether or not you're going to shift all *'s by one to the right, does that count for the random masking bonus?

PHP - 80 bytes
<?for(;($c=$argv[1][~-$i+=1])?:$k^++$j;)echo$c?$i%$k=&$argv[2]^$j?'*':$c:$i='
';

Sample usage:
$ php whistle-blower.php ABCDEFGHIJKLMNOPQRSTUVWXYZ 7
******G******N******U*****
A******H******O******V****
*B******I******P******W***
**C******J******Q******X**
***D******K******R******Y*
****E******L******S******Z
*****F******M******T******

Python (157 149 139 138-20=118):
def f(a,b):
 from random import*;c=[["*"]*len(a) for i in range(b)]
 for d in range(len(a)):choice(c)[d]=a[d]
 for e in c:print "".join(e)

 Cheesy python (55 35):
You didn't tell me the required distribution ;)
g=lambda a,b:["*"*len(a)]*(b-1)+[a]

Uniform python (129 123 122):
def h(a,b):
 c=[["*"]*len(a)for i in range(b)]
 for d in range(len(a)):c=c[1:]+c[:1];c[0][d]=a[d]
 for e in c:print"".join(e)

Output:
a="Synthetica 'Evil' the Second"
b=7
f(a,b)
print
for i in g(a,b): print i
print
h(a,b)

gives
***t***i***'***** *********d
******************t** ******
******t*** ***********Se**n*
S**************l****e*******
*y******c***E************o**
**n*h****a**************c***
*****e*******vi*'**h********

****************************
****************************
****************************
****************************
****************************
****************************
Synthetica 'Evil' the Second

******t******v******e******d
S******i******i****** ******
*y******c******l******S*****
**n******a******'******e****
***t****** ****** ******c***
****h******'******t******o**
*****e******E******h******n*

Your cheesy python can be shortened to g=lambda a,b:[a]+["*"*len(a)]*(b-1). :P

@Trimsty I see, thanks :)

I think but surely I do not want to spell it out completely clearly invalidates a solution which does not ensure that at least one character is masked in each line of output.

@Howard I know it is stretching the rules, but disclose the letters bit by bit can also mean first, disclose the first bit (that just happens to be the entire thing), repeat until the b is met. This can also happen for the first answer, so just claim you used that one, and it juuust happend to produce this result. (I just realized that you could also write it as ["*"*len(a)]*(b-1)+[a], so that you start by disclosing bits that just happen to contain 0 bytes of actual information, and on the last line, you disclose another bit.) I do however, realize, that this is stretching to the max.

Bash, 80 bytes
m=${1//?/*}
for((i=1;d=i*${#1}/$2,i++<=$2;c=d)){
echo "${m:0:c}${1:c:d-c}${m:d}"
}

In action:

$ ./anon.sh stackoverflow.com 6
st***************
**ack************
*****ove*********
********rfl******
***********ow.***
**************com
$

C#, 226
This can be trimmed down if you replace the random stuff with a more simple distribution (think modulus) but the randomness is what got me interested. =)
Anyway, putting everything on just one line I get 226 characters. In readable code it looks like this:
private void F(string n, int i)
{
    var l = n.Length;
    var r = new Random();
    var a = new string[i];

    for (var p = 0; p < l; p++)
    {
        var x = r.Next(0, i);
        for (var j = 0; j < i; j++)
        {
            a[j] += j == x ? n.Substring(p, 1) : "*";
        }
    }

    for (var j = 0; j < i; j++)
    {
        Console.WriteLine(a[j]);
    }
}

Sample output:
Anonymize.exe ABCDEFGHIJKLMNOPQRSTUVWXYZ 7
*****F**I**********T**W***
A*****************S****X**
**CDE**H*JKL**************
*************N************
**************O*****U****Z
*B****G*****M***QR********
***************P*****V**Y*

Does it guarantee at least on character from the input always?

Hmm.. no, probably not; good catch. For short strings and low values of i you probably could end up with ***/test.

Perl, 24
$_ x=<>;s/(.|
)./\1*/g

Requires the -p switch, which accounts for two of the bytes. Reads from STDIN.
How it works

Because of the -p switch, Perl reads the first input lie and stores its contents in $_.
The command $_ x=<>; duplicates the first input line the number of times the second input line (<>) specifies.
The command s/(.|\n)./\1*/g; consumes two characters and replaces the second (which cannot be a newline) with an asterisk. It does this until it has consumed the entire contents of $_.
Since newlines count as the first character, this will obfuscate all even characters on the first line and all odd characters on the remaining lines.
Because of the -p switch, Perl prints the contents of $_.

Example input
codegolf
4

Example output
c*d*g*l*
*o*e*o*f
*o*e*o*f
*o*e*o*f

duplicate strings, not very clean...

What made you think you could mess around with the input to have it on two lines?

@BillWoodger: The question specifies no form of input.

Fair enough. could lets you through :-)

Since newlines count as the first character, this will obfuscate all even characters on the first line and all odd characters on the remaining lines. Sounds like it will fail for codegolf\n1

@Cruncher: If the company is mentioned only once, I do not want to spell it out completely and I want to disclose it are incompatible requirements.

JavaScript - 170
function s(a,e){o="",b=a.length,x=b/e|0,y=b-x*e;for(c=1;c<=e;c++){r="*";o+=Array((c-1)*x+1).join(r)+a.substr(c*x-x,c==e?x+y:x)+Array(c<e?b-c*x+1:0).join(r)+"\n"}return o}

Quick one, breaks if you supply a name and ask for more pieces than characters, but works up to that point and down to 1. Could be golfed more I assume, so may revise or take advice, as it's a bit of a mess.
Edit: Golfed further (from 187) with removal of brackets (@Synthetica) and Math.floor replacement from @toothbrush. For loop change as suggested results in errors in the output.

function s(d,a){o="";b=d.length;x=Math.floor(b/a);y=b-x*a;for(c=1;c<=a;c++)r="*",o+=Array((c-1)*x+1).join(r)+d.substr(c*x-x,c==a?x+y:x)+Array(c<a?b-c*x+1:0).join(r)+"\n";return o}; http://closure-compiler.appspot.com/home was capable of shaving off 8 chars ;)

Are you saying if the text is five chars and it is asked for six replacements it breaks?

@BillWoodger He saying that using the closure compiler he shaved 8 chars from the total length of the code.

@EduardFlorinescu, sorry, I was unclear, I meant this bit breaks if you supply a name and ask for more pieces than characters

@BillWoodger You are right s("four",5)

Use x=b/e|0 instead of x=Math.floor(b/e). Also, for(c=1;c<=e;c++) can be shortened to for(c=1;c++<=e;).

Golfed more with suggestions, thanks. And yes, there is no input validation of any kind :)

Java - 490
Yeah, not really golfed or anything. Oh well, here it is:
import java.util.ArrayList;public class Anonymise {public static void  main(String[] args){ArrayList[] c=new ArrayList[Integer.parseInt(args[1])];for(int i=0;i<c.length;i++)c[i]=new ArrayList();for(char a:args[0].toCharArray()){int f=new java.util.Random().nextInt(c.length);c[f].add(a);for(int i=0;i<c.length;i++)if(i!=f)c[i].add('*');}ArrayList<String> b = new ArrayList<String>();for(ArrayList a:c){String s = "";for(Object o : a)s += o;b.add(s);}for(String s : b)System.out.println(s);}}

In a nice, legible format:
import java.util.ArrayList;

public class Anonymise {

public static void main(String[] args){
    ArrayList[] c = new ArrayList[Integer.parseInt(args[1])];
    for(int i=0;i<c.length;i++)
        c[i]=new ArrayList();
    for(char a:args[0].toCharArray()){
        int f = new java.util.Random().nextInt(c.length);
        c[f].add(a);
        for(int i=0;i<c.length;i++)
            if(i!=f)c[i].add('*');
    }
    ArrayList<String> b = new ArrayList<String>();
    for(ArrayList a:c){
        String s = "";
        for(Object o : a)
            s += o;b.add(s);
    }
    for(String s : b)
        System.out.println(s);
}
}

Sample usage (When run from the compiled class)
> java Anonymise OnlinePerson 3
*n****P***o*
O*li***e****
****ne**rs*n

Are you running that or typing? How does P get to be p?

No problem. Just tidy away the used comments now

Just import java.util.* Also, ArrayList<String> = new ArrayList<>(); will work. You can also remove a lot of spaces. And most of the time, you can use List instead of ArrayList.

Python 3 - 187 (-20 = 167)
Took me a while to write, could probably be golfed more.
import sys,random as a
b=sys.argv
x=[""for i in' '*int(b[2])]
for i in range(len(b[1])):n=a.randrange(len(x));x=[c+["*",b[1][len(c)]][j==n]for j,c in enumerate(x)]
for i in x:print(i)

Sample usage:
$ python tx.py super_anonymous_user 3
s******n**y*ou****e*
**p***a**n*m**s_us*r
*u*er_**o***********

As a function - 161 (-20 = 141)
from random import*
def f(c,n):
    x=[""for i in' '*n]
    for i in range(len(c)):n=randrange(len(x));x=[v+["*",c[len(v)]][j==n]for j,v in enumerate(x)]
    return x

Does it guarantee at least on character from the input always?

@BillWoodger No.

Sorry, personally I regard it as not working then. then.

Some simple ways to shorten things: Unpack sys.argv in the assignment, and initialize x as x=['']*int(b[2]) (with b[2] replaced by whatever you name the variable you use in the unpacking).

@BillWoodger Yeah, the OP didn't say that was a requirement. The chances of it doing that is very little, and it allows for it to work with any amount of outputs.

@user2357112 I'll try that initialization. I was just scared of the same string being pointed to by every entry. :P

It'll happen first time up in Production :-) It was a hole from OP, and has indicated no great worry about what the masking looks like, so why not?

I think but surely I do not want to spell it out completely clearly invalidates a solution which does not ensure that at least one character is masked in each line of output.

@Howard So I should just throw an error if n <= 1?

C# 184
namespace System.Linq{class P{static void Main(string[] a){int n=int.Parse(a[1]);for(int i=0;i<n;i++)Console.WriteLine(new String(a[0].Select((c,x)=>(i+x)%n==0?c:'*').ToArray()));}}}

Non-golfed
namespace System.Linq
{
    class P
    {
        static void Main(string[] a)
        {
            int n = int.Parse(a[1]);
            for (int i = 0; i < n; i++)
                Console.WriteLine(new String(a[0].Select((c, x) => (i + x) % n == 0 ? c : '*').ToArray()));
        }
    }
}

Sample:
> Anonymize.exe "qwertyuio" 4
q***t***o
***r***i*
**e***u**
*w***y***

Perl 6 (77 bytes)
This may count as cheating, but it solves the problem (it doesn't print the string entirely).
($_,$!)=@*ARGS;.say for .chop~"*","*"x.chars-1~.substr(*-1),"*"x.chars xx$!-2

And the sample output.
> ./script.p6 ultimately_awesome 6
ultimately_awesom*
*****************e
******************
******************
******************
******************

R, (120-20)=100 bytes (2 different solutions of same length)
Beside the conciseness, R for sure features the best random number generator! :)
Here the 1st solution of length 120:
function(s,n){
  c=strsplit(s,"")[[1]]
  e=sample(n,nchar(s),T)
  sapply(1:n,function(i)paste(ifelse(e==i,c,"*"),collapse=""))
}

If the function is named as f, the output looks like:
> f("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 7)
"******GH*****************Z"
"ABCD*********N************"
"***********L**O***********"
"*********J**M**P*RS*U**X**"
"**********K***********W***"
"*****F**I*******Q*********"
"****E**************T*V**Y*"

And here the 2nd solution, again with random masking, and again 120 bytes long:
function(s,n){
  x=matrix("*",n,(m=nchar(s)))
  x[cbind(sample(n,m,T),1:m)]=strsplit(s,"")[[1]]
  apply(x,1,paste,collapse="")
}

JavaScript - 139-20=119
function e(s,c){r=[];for(i=c;i--;)r[i]='';for(i=0;i<s.length*c;i++)x=i%c,n=(x<1?Math.random()*c|0:n),r[x]+=(n!=x?'*':s[(i/c)|0]);return r}

Usage and sample output:
console.log(e("evil_company_that_makes_me_shiver", 3));

["**i*_**mp*****h**_ma**********v**",
 "*****co**a***t*a******s*me_*hi*e*",
 "ev*l******ny_***t***ke*_***s****r"]

As the masking is random, the output may also look like this:
console.log(e("evil_company_that_makes_me_shiver", 2));

["evil_company_that_makes_me_shiver",
 "*********************************"]

F# - 81 80 75
This is fairly similar to others that have been offered:
let a s n=[for i in 0..n-1->String.mapi(fun j c->[c;'*'].[min((j+i)%n)1])s]

Sample:
a "evil_company_that_makes_me_shiver" 7

e******m******h******e******h****
******o******t******k******s*****
*****c******_******a******_******
****_******y******m******e******r
***l******n******_******m******e*
**i******a******t******_******v**
*v******p******a******s******i***

As a full, stand-alone application it comes out to 160 155 156 characters:
[<EntryPoint>]let m (a:string array)=
 let n=System.Int32.Parse a.[1]
 for i in 0..n-1 do printfn"%s"(String.mapi(fun j c->[c;'*'].[min((j+i)%n)1])a.[0])
 0

Julia 56-20=36 (works often)
f(s,n)=[join([rand()<1.9/n?c:"*" for c in s]) for r=1:n]

julia> f("evilcompany!!!",4)
4-element Array{Union(UTF8String,ASCIIString),1}:
 "e**l**mp*ny*!*"
 "***lco********"
 "e*il**m*a*y!*!"
 "evil**m*an***!"

Trying to go for a shorter random solution I decided to sacrifice guaranteed functioning for a shorter solution. It's really not a very good solution.

Scala (1) 177 bytes
After the solution in R I also found one in Scala, here it is:
def f(s:String, n:Int)={
  def c=s map (z=>z.toString)
  def r=(1 to s.length) map (v=>v%n+1)
  (for (i<-1 to n) yield s zip r map (t=>if(t._2==i) t._1 else "*") mkString "") map println
}

Scala (2) 129 bytes
After a short research I found the method zipWithIndex. Wonderful :)
def f(s:String, n:Int)={
  (for (i<-0 until n) yield s.zipWithIndex.map (t=>if(t._2 % n==i) t._1 else "*") mkString "") map println
}

Here the solution:
f("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 4)
***D***H***L***P***T***X**
A***E***I***M***Q***U***Y*
*B***F***J***N***R***V***Z
**C***G***K***O***S***W***

Javascript - 166
function s(b,a){o="";k=Array(a).join("*");t=k+b+k;for(i=a;0<i;i--)o+=t.replace(RegExp(".{"+(a-1)+"}(.)","g"),k+"$1").substr(i-1,b.length)+"\n",t=t.substr(1);return o}

Using regex.
Sample
> s("four",5)
f***
*o**
**u*
***r
****

> s("evil_company_that_makes_me_shiver",3)
e**l**o**a**_**a**m**e**m**s**v**
*v**_**m**n**t**t**a**s**e**h**e*
**i**c**p**y**h**_**k**_**_**i**r

k [50-20=30 chars]
{.{@[y#"*";z;:;x z]}[x;c]'=_d*y%#d:<<(-d)?!d:c:#x}

Explanation

Input: x=String which needs to be masked, y=number of lines
Count the number of characters c in string and create y buckets.
Place c mod y characters in each bucket.
For each bucket, print "*" for the remaining numbers not in that bucket.

Example
{.{@[y#"*";z;:;x z]}[x;c]'=_d*y%#d:<<(-d)?!d:c:#x}["abcdefghijklmnopqrstuvwxyz";4]

Output
"ab*d*f***j**********u*w***"
"**c*e*gh**k*****q*s*******"
"********i***mn*****t*v**y*"
"***********l**op*r*****x*z"

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Hack Sequence : Simplify Hi = 2014*Hi-1 + 69*Hi-2
Can someone help me with simplifying this sequence. I write code to loop through entire n, I am getting timeout.
Hack sequence of IndiaHacks-2014 if given as below
 Hi = 2014*Hi-1 + 69*Hi-2 for (i > 2); Hi = 1 for (i <= 2)
Given n, you need to find nth term of Hack sequence modulo (109 + 7), i.e Hn % (109 + 7).
This is a Code golf problem. You need to write code with minimum number of characters.
Input: First line contain T, the number of test cases. Each of next T lines contain an integer n.
Output: For each test case output a single integer which is Hn modulo (109 + 7).
Constraints : 1 ≤ T ≤ 103, 1 ≤ n ≤ 1015

I'm sure that this would make sense on the IndiaHacks website if I could be bothered to create an account in order to see it, but in copying it across you've lost whatever formatting it had and it no longer makes sense.

Although if I'm correctly guessing what the formatting should be, it's essentially a duplicate of Fibonacci sequence.

Can you please tell me how to format questions here

Click on the help button next to the editor. It explains it in lots of detail.

For fibonacci, we loop n completely. We can solve this problem without looping completely.

Improved your formatting, but are you sure about the % (109 + 7) part? Or should it be % 109 + 7? BTW to see how I formatted your question, you can go to the review history (by clicking the "edited x minutes ago") and choose "side-by-side markdown"

sorry.. it should be 10^9 + 7

If you're getting a timeout, it's probably not code golf.

Which other values are missing superscripts? I'm now suspicious of the bounds on the input, and half-suspicious of the number 2014.

Hi = 2014Hi-1 + 69Hi-2 for (i > 2);                  Hi = 1 for (i <= 2)  (H1 =1 & H2 = 1)

As for "looping completely", this problem is the same as the Fibonacci problem but with different parameters. Exactly the same approaches (direct recurrence, dynamic programming, matrix exponentiation, Binet's formula) apply.

Think this can be done by matrix exponentiation


text:
If community would have been a person
Well the community is just a bot. But what if it would have been a person?
Your task is to find what community's reputation might have been if it would have been given reputation for the edits it makes.(simply 2*edits)
This should work for any site, but we would consider PP&CG for this question.
Use any language, even data.stackexchange would work.
As it is code golf, smallest code wins as much reputation I gain+15(via bounty, I will leave 101 for myself :P ).
EDIT: consider all kind of edits that increase reputation.

What if you have downvotes? Will you give us negative reputation as well?

Should we count only suggested edits or normal edits (which do NOT increase rep) as well? What about tag wiki edits?

Why'd you link to history beta?

@thedoctor my mistake.Please change it to PPCG link.I don't have access to my computer currently.

@doorknob thanks. I have edited post

Do we have to consider the cutoff? There is a maximum of reputation that can be gained in this manner. My guess is that on many sites, community would have reached this maximum.

@TimSeguine Good point. The daily maximum reputation is 200 points, and there is a total of 1000 for each user. (Source)

I think the main reason about not having many answers is that you question is not very clear and specific - You still haven't accounted for the max rep gained by suggested edits (1000), and the daily max rep (200).

@ace I thought the 200 rep cap is un nessesary because community has not crossed the limit on most site(not on codegolf at least) and also that changing it now may in validate already posted answers. from next time onwards I would take due care not to miss anything.Thank you.

@PatilAditya Should we include the 1 reputation Community has already? (I.e. [num of revisions]*2+1) If so, my answer is the only valid one (so that may be a problem), if not, I can shorten my entry with two chars.

I know URL shorteners are cheaty but since everyone else is using them I probably should.

Bash, with bc and URL shortener: 67 62 60 58 54
bc<<<`wget x.co/4Ccg3 -qO-|grep -oP "(?<='>)[0-9]+"`*2

Downloads the relevant page to STDOUT, then searches for '> followed by a sequence of digits - it misuses the fact that in the page's source code, single quotes are only rarely used; in fact the sequence '> occurs twice, and only once followed by a number, which is the number of edits. Using the Perl-style lookbehind, the '> isn't actually included in the match.
The -o option makes grep output only the matched string rather than the entire line containing it (there is a h1 on the same line and I don't want that).
The resulting number of edits is concatenated with *2 and sent to bc.
@11684 pointed out that you start out with 1 reputation, but the asker clearly forgot that so it's not mentioned in the question (it would break existing answers if it was). If you want to add that in just put in +1 at the end of the code, adding 2 chars.
SHELF, 36 - doesn't count as the language was created after the question
, `W x.co/4Ccg3|t "(?<='>)[0-9]+"`*2

SHELF is a golfed version of Bash, like PYG is for Python.

I'm going to steal your shortened link, as x.co is shorter than goo.gl. :)

@11684 i don't mind, i already gave it to Synthetica

URL shortening, clever ;)

JavaScript (EcmaScript 6 + jQuery) - 80 Characters
$.get('/users/-1/?tab=activity&sort=revisions',r=>alert($('.count',r).text()*2))

Run it in the JavaScript console on any StackExchange page (although ECMAScript 6 arrow functions are only supported on FireFox at the moment so it will have do be done in that browser until the others catch up) and will get Community's reputation on that domain. So running it on http://codegolf.stackexchange.com will get the Code Golf Community's reputation (currently 118) and running it on http://academia.stackexchange.com/ would get the reputation from that site (currently 162).
Which hopefully answers the

This should work for any site

bit of the question.

I feel like using jQuery should add 83532 to the end score

Python (191 181 170 126 117)
@Henrik: Good idea to use an url shortener. Don't mind if I just borrow yours, do you? Just to kick it off, this will probably get beaten very, very fast ;)
i=__import__("urllib2").urlopen("http://x.co/4Ccg3").read();j=i[i.index("<span class='count")+20:];print 2*int(j[:2])

Searches for the  that contains the amount of reputation the bot has.

You should be able to remove community from the url.

Er, this doesn't work. Traceback (most recent call last):   File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 10: ''

@ace Something buggered up somewhere, not sure why. Anyways: it does work now.

more shorterer: http://x.co/4Ccg3

JavaScript (with jQuery) - 141
$.get('http://codegolf.stackexchange.com/users/-1/?tab=activity&sort=revisions',function(o){alert($('').html(o).find('.count').html()*2)})

EDIT : only works if executed from any StackExchange page... or if same origin policy is disabed.
If same origin policy is disabled, can be shorten to 96 chars :
$.get('http://tinyurl.com/pfmsq8w',function(o){alert($('').html(o).find('.count').html()*2)})

I've included the 1 reputation that you start with!
jQuery, 76
$a=$("body");$a.load("//x.co/4Ccg3 .count",function(){$a.text($a.text()*2+1)

on any page with jQuery and requested by http.
jQuery, only works on the relevant page - 23
$(".count").text()*2+1;

The page it runs on is http://goo.gl/JOqzpF.

StackExchange Data 78 chars
Click here to run the query
SELECT COUNT(*)*2FROM PostHistory WHERE UserId=-1AND PostHistoryTypeId IN(4,5)

PowerShell (143)
My first ever PowerShell script! Counts the number of revisions and times it by two (very inspired by @Synthetica's Python answer).
$s=(New-Object Net.WebClient).DownloadString("http://tinyurl.com/pfmsq8w");(0+($s.Substring($s.IndexOf("s='cou")+10,8) -replace "[^\d]",""))*2


text:
Longest code to reduce words
Write a code in your favorite language which reduces words To first three characters.
Input  : One word
Output : First three letters

For example
INPUT  : ProGramming
OUTPUT : Pro

INPUT  : puZZles
OUTPUT : puZ

INPUT  : BoWling
OUTPUT : BoW

Output needs to be case sensitive
Rule-1
All statements should be meaningful and useful.
For example
the C++ snippet below surely increases the score but is unnecessary.
The similar code snippets below is banned.
std::cout<<"abcabc";
std::cout<<"\b\b\b\b\b\b";

Rule-2
Do not use infinite add-subtract or multiplication-division (or any other kind of) infinite progressions to increase the score.
For example
The similar code snippets below is banned.
if(strcmp(str,"monday")==0)  //The function strcmp() returns 0 if both
                             //strings are same (including NULL character)
cout<<110+1-1+1-1+1-1....inf //110 is ASCII value of 'm'

Winner
Winner will be chosen on the basis of score (Most score wins) after 4 days from now.
If there is a tie then the one who submitted the answer first is the winner

Also, ThRUsday -> ThRU: Are you stripping the last four characters there?

@m.buettner thanks I fixed that anything else ?

Whoa,..Whoa I am getting negative attacks, I would like to know why? BTW I have changed the question from day-names to words.

@MukulKumar One big reason for the big negative votes is that the question was very trivial in between a whole bunch of other low-quality questions. When people see enough low-quality questions, they automatically downvote other questions which could be improved.

Befunge 98, 6 bytes
~~~,,,

Any other statements would be meaningless and useless. I could possibly do this though (18 bytes):
3^,<
 @
 w~^
 0
 :

But everything but the , and the ~ are meaningless and useless because it could be done so much simpler.

DUDE, This is Code-Bowling means you have to write longest code and not some Code-Trolling or Code-Golf

@MukulKumar This was the longest I could write :-)

I have changed the question again please read the question again


text:
Dwarves and Coins
The Situation:
Several (M) dwarves have found a goblin's chest with N gold coins and have to divide them. Due to ancient rules governing the allocation of loot to pirates in order of seniority, the oldest dwarf should get one coin more than the next oldest dwarf, and so on, so that the youngest dwarf gets M-1 fewer coins than the oldest dwarf. Additionally, no dwarf has to pitch in any coins (ie no negative coins to any dwarfs)
Help the dwarves to divide the coins in this way, or tell them that this is impossible.
Winner's code must always answer correctly (this challenge is deterministic) and follow the general code-golf rules.
Input
You are given an integer N (3 ≤ N ≤ 1000) for number of coins and an integer M (3 ≤ M ≤ N) for number of dwarves, space-separated.
Output
If it is impossible to divide the coins in the way that dwarves want, print -1 (minus one). Otherwise, print the numbers of coins that each dwarf will receive, from oldest to youngest. Separate the numbers with spaces.
Samples:
input
3 3

output
2 1 0

input
9 3

output
4 3 2

input
7 3

output
-1

input
6 4

output
3 2 1 0

You missed a "pirate".

relevant

Good find, @Raystafarian. Perhaps when the teacher gets a general solver for M dwarves instead of just 3, s/he will recognize that the user crowdsourced the answer :)  -- especially if that solver is in J.

Homework or not, its a Smurfing good question!

J - 32 29 28 25
Not shorter than other J solution, but and uses a different idea
(]{.[:i:-:@-.@]-%)/ ::_1:

The answer for the number of coins the highest rank gnome is getting is simply N/M+(M-1)/2 (if it's an integer), we construct the negative of this -:@-.@]-%. Then i: makes an array like that 2 1 0 _1 _2 for argument _2 and we take M elements from it.

+1 for a brilliant usage of i:. You can save another three char by writing % instead of [%], and by using -.@] instead of (1-]).

@algorithmshark Thanks fellow J enthusiast!

Can't +1 as @swish seems to be with the gnomes we just robbed. ;)

J - 30 char
Very fun to golf. A lot of things worked out neatly.
((+/@s~i.[){ ::_1:s=.+/&i.&-)/

Explanation:

/ - Take the space-separated integers as argument, and slip the function between them. That is to say, consider N the left argument to the function in the brackets (...) and M the right argument.
i.&- - Negate (-) and then take integers (i.). Normally, when you do something like i.5 you get 0 1 2 3 4. Whenever i. receives a negative number, however, it reverses that output list. So e.g. i._5 will give 4 3 2 1 0.
s=.+/& - Perform the above action on each argument (&) and then make an addition table (+/) out of these arrays. We now have a table where each row is a possible coin distribution to M dwarves, though maybe not when there's N coins. Finally, this table-making verb is so useful we're going to call it s and use it again later.
+/@s~ - Now, we use s again, but we swap (~) the order of the arguments, so that we transpose the table. This is a golfy way of taking the sum of each row after creating the table (+/@), having to do with the way J sums multidimensional lists.
i.[ - In this list of sums, we search for the left argument to the verb, i.e. N. If N is an item, we get that index: else we get the length of the list, which notably is an invalid index.
{ ::_1: - Now we try to use the index to pull out a row from table in s. { will throw a domain error if the index was invalid, so in that case we catch the error (::) and return -1 (_1:). This handles everything. Since we use i.&- previously, the coin distribution will be in descending order, as was required.

Usage:
   ((+/@s~i.[){ ::_1:s=.+/&i.&-)/ 9 3
4 3 2
   ((+/@s~i.[){ ::_1:s=.+/&i.&-)/ 7 3
_1
   ((+/@s~i.[){ ::_1:s=.+/&i.&-)/ 6 4
3 2 1 0
   ((+/@s~i.[){ ::_1:s=.+/&i.&-)/ 204 17
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4

Input 9 3 should return 4 3 2, not -1. Seems there is a transposition in your example usage?

@ProgrammerDan Thanks, didn't catch that. I typed up the examples wrong. 9 3 gives 4 3 2 and 7 3 gives _1, as expected.

Saw the fix and +1'd appropriately :D. I should look into J, looks nifty.

R - 71 70 67 66 65 chars
s=scan();m=s[2];x=s[1]-sum(1:m);cat(if(x%%m|-m>x)-1 else x/m+m:1)

Ungolfed:
s = scan()    # Reads N and M by stdin.
m = s[2]
x = s[1] - m*(m-1)/2
cat(if (x %% m | x < -m) -1 else x/m + m:1)

Solution:
If M the number of dwarfs, then the sequence of paid gold can be decomposed to two singular series. First a series ending in zero: M-1, ..., 2, 1, 0 and a constant series of c, c, ..., c. The sum of the first series is always M*(M-1)/2. So if the remainder (x = N - M*(M-1)/2) could be divided without remainder (modulo equal 0), each dwarf gets x/M plus the part of the decreasing series.
Usage:
> s=scan()
1: 10 4
3:
Read 2 items
> m=s[2]
> x = s[1] - m*(m-1)/2
> cat(if (x %% m || x<0) -1 else x/m + (m-1):0)
4 3 2 1

-1, the question requires to write a complete program and not a function. See http://meta.codegolf.stackexchange.com/a/1146/8766

@user80551 You are right. Now I corrected the snippet: now it takes the space-separated input; the output also does not show anymore the '[1]'.

You can save another character replacing m*(m+1)/2 with sum(1:m)

@Brian Thx, I will modify my code!

PHP (187)
It's my first attempt at golfing, and I know it could be better, but still :)
Golfed:
<?php
$b=fgets(STDIN);list($c,$d)=explode(' ',$b);if((($d&1)AND($c%$d==0))OR($c%$d==$d/2)){for($e=floor($c/$d)+floor($d/2);$e>floor($c/$d)-round($d/2);$e--){echo"$e ";}}else{die('-1');}?>

Ungolfed:
<?php
$a = fgets(STDIN);
list($coins, $dwarves) = explode(' ', $a);
if ((($dwarves & 1) AND ($coins % $dwarves == 0)) OR ($coins % $dwarves == $dwarves / 2)) {
    for (
        $i = floor($coins / $dwarves) + floor($dwarves / 2);
        $i > floor($coins / $dwarves) - round($dwarves / 2);
        $i--
    ) {
        echo "$i ";
    }
}
else {
  die('-1');
}
?>

Execute in a shell
Basic idea:
Coins can be separated by these rules, if one of these is true:

The dwarves are odd number, and the coins are divisible by the dwarves with no remains
The dwarves are even number, and the coins remaining after dividing coins / dwarves is equal to half of the dwarves number

If so, we take for base the average coins per dwarf (ACPD). But we have to start from the highest and output until we reach the lowest. So we make a loop with counter starting from ACPD + the count of the rest of the dwarves towards the higher end, and go on until we reach the ACPD - the count of the rest of the dwarves towards the lower end.
It's basically the same if the dwarves are odd (i.e. 5 dwarves - the middle one is 3, and in both ends there remain 2), but not if they are even - which is why we rely on floor AND round.
Problems so far:
Works with too low coins number, which means some dwarves will be smacked down and robbed of their precious earnings. And this is sad. Or at least if you like dwarves.
Solution:

Think of a way to calculate the lowest amount of coins so the calculation doesn't end up with dwarves in the dust.
Design not-so-greedy dwarves.

Smarter solution:
Coins are metal. Make the dwarves melt them all, and then cast them in smaller/larger amount of coins, so they are divisible in any case.
Smartest solution:
Steal their mountain, rename yourself to Smaug and keep it all for yourself. After all, why do you have to bother with grumpy dwarves?

Python 3 (100)
Using the same idea as @Geobits but conforming to the input and output requirements.
n,m=map(int,input().split())
κ,ρ=divmod(n-m*(m-1)//2,m)
x=[-1]if ρ else range(κ,κ+m)[::-1]
print(*x)

Thanks for the heads-up. Didn't notice the space-separation added to the input reqs.

Those may be 100 characters, but because of the greek variable names, it requires 105 bytes.

Python 3 - 109 107 103 102 90 93
Using the same idea as Evpok, but with a number of improvements.
n,m=map(int,input().split())
k=n/m+m/2
a=int(k)
print(*(range(a,a-m,-1),[-1])[k-a-.5or~a>-m])

The improvements are:

Eliminating the space after else and before ' '. 1 character
Eliminating the ' ' inside split(), because splitting on spaces is a default. 3 characters
Lowering x by 1 changing the -1 to +1 inside divmod, and then changing the range function to use the range's reversed order option. 3 characters.
EDIT: ... if ... else ... changed to ... and ... or ... 2 characters.
EDIT: Divmod made explicit, r removed. 4 characters.
EDIT: x removed, m//n used explicitly. 1 character
EDIT: used starred expressions instead of ' '.join(map(str,...)), added x to avoid repeating print(). 12 characters.
EDIT: I realized that I was allowing negative numbers of coins to be given to the Dwarves. I changed the code to avoid this.

Well done, it was instructive :) I changed my answer to strip the unnecessary space, but your trick to save the [::-1] is better than my solution. +1

I may be missing something, but I counted 93 bytes instead of 94.

Python 3 - 114
n,m=map(int,input().split(' '))
r=range(m);n-=sum(r)
if n%m<1:
 for x in r:print(m-x+n//m-1,end=' ')
else:print -1

Works by checking if N-(M*(M-1)/2) is evenly divisible by M. New to python, so any tips appreciated.
Ideone.com example
Input:
735 30
Output:
39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10

Was there ever a Python 3 version that supported Python 2's print statement style? Or how does the last line (else:print -1) not result in an error?

C# - 322
using System;using System.Linq;namespace D{class P{static void Main(string[]args){int n=Convert.ToInt16(args[0]);int m=Convert.ToInt16(args[1]);bool b=false;int q=n/2+1;g:b=!b;int[]z=new int[m];for(int i=0;i<m;i++){z[i]=q-i;}if(z.Sum()==n)foreach(int p in z)Console.Write(p+" ");else{q--;if(b)goto g;Console.Write(-1);}}}}

Horrible score but I took a different approach and got to use goto :)
I will shorten it later.

You can definitely shorten all of those Convert.ToInt16 calls to just int.Parse. You can declare any pre-assigned variable with var (instead of e.g. int[]). Your command-line params don't need to be called args. And you can alias frequently-used types like using C = Console. I also think that for a solution this long, it's better to present with line spacing intact rather than saving just a couple of characters. Oh, and I'm not really sure why goto is better than alternatives here, either...

R: 77 73 70 chars
a=scan();r=a[2]:1-1;while((n=sum(r))<a[1])r=r+1;cat(`if`(n>a[1],-1,r))

Create a vector going from (M-1) to 0 and adds 1 to each number until the sum is no longer inferior to N. If it is superior, output -1 else output the vector.
Indented and slightly ungolfed:
a=scan()   #Reads in stdin (by default numeric, space-separated)
r=a[2]:1-1 #Creates vector (M-1) to 0
while(sum(r)<a[1])r=r+1 #Increments all member of vector by 1 until sum is not inferior to N
cat( #Outputs to stdout
    `if`(sum(r)>a[1], -1, r) #If superior to N: impossible, returns -1
    )

Example usage:
> a=scan();r=a[2]:1-1;while((n=sum(r))<a[1])r=r+1;cat(`if`(n>a[1],-1,r))
1: 9 3
3:
Read 2 items
4 3 2
> a=scan();r=a[2]:1-1;while((n=sum(r))<a[1])r=r+1;cat(`if`(n>a[1],-1,r))
1: 7 3
3:
Read 2 items
-1
> a=scan();r=a[2]:1-1;while((n=sum(r))<a[1])r=r+1;cat(`if`(n>a[1],-1,r))
1: 204 17
3:
Read 2 items
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4

Java 210
class A { public static void main(String[] a){int d=Integer.parseInt(a[0]),c=Integer.parseInt(a[1]);if (2*c%d==0) for (int i=0;i<d;i++) System.out.print((((1+(2*c/d)-d)/2)+i)+" "); else System.out.print(-1);}}

Welcome to PPCG, I see you have a lot of whitespace which can be removed.

You can strip out a lot more spaces to golf your answer a bit further -- for instance, class A{public static void main(String[]a) is valid, and saves you 3 characters. After each if, and around each for, remove the whitespace ... etc.

It's crazy that the "public static void main(S" part is as long as that entire J solution :)

Golfscript, 35
~:M.(*2/-.M%{;-1}{M/M+,-1%M<' '*}if

How it works
In the following example, the input is 9 3.
          # STACK: "9 3"
~         # Interpret the input string.
          # STACK: 9 3
:M        # Store the top of the stack (number of dwarves) in variable `M'.
.         # Duplicate the top of the stack.
          # STACK: 9 3 3
(         # Decrement the top of the stack.
          # STACK: 9 3 2
*         # Multiply the topmost elements of the stack.
          # STACK: 9 6
2/        # Divide the top of the stack by `2'.
          # STACK: 9 3
          # So far, we've transformed `M' into `M*(M-1)/2', which is the minimum amount of
          # coins all dwarves together will get. This number comes from the fact that the
          # youngest dwarf will get at least 0 coins, the next at least 1 coin, etc., and
          # 0 + 1 + ... + (M - 1) = M*(M-1)/2.
-         # Subtract the topmost elements of the stack.
          # STACK: 6
          # The remaining coins have to get reparted evenly to all dwarves.
.         # Duplicate the top of the stack.
          # STACK: 6 6
M%        # Calculate the top of the stack modulus `M'.
          # STACK: 6 0
{         # If the modulus is positive, the remaining coins cannot get reparted evenly.
    ;-1   # Replace the top of the stack by `-1'.
}
{         # If the modulus is zero, the remaining coins can get reparted evenly.
    M/    # Divide the top of the stack by `M'.
          # STACK: 2
          # This is the number of coins all dwarves will get after giving 1 to the second
          # youngest, etc.
    M+    # Add `M' to the top of the stack.
          # STACK: 5
    ,     # Replace the top of the stack by an array of that many elements.
          # STACK: [ 0 1 2 3 4 ]
          # The rightmost element is the number of coins the oldest dwarf will get.
    -1%   # Reverse the array.
          # STACK: [ 4 3 2 1 0 ]
    M<    # Keep the leftmost `M' elements.
          # STACK: [ 4 3 2 ]
          # There are only `M' dwarves.
    ' '*  # Join the array, separating by spaces.
          # STACK: "4 3 2"
}if

JavaScript - 76

 Observe that k + (k - 1) + ... + (k - (M - 1)) = M(k - (M - 1)/2)
 Setting this equal to N gives k = N/M + (M-1)/2 for the highest amount.
 If this is integer, then k % 1 == 0 and the amounts we are looking for are k, k - 1, ..., k - (M - 1).

I could probably have written this shorter in another language, but there was no JS solution yet so here it is:
N=3;M=3;if((r=N/M+(M-1)/2)%1)console.log(-1);else while(M--)console.log(r--)

Run in the console.
Example input:
N=3;M=3;if((r=N/M+(M-1)/2)%1)console.log(-1);else while(M--)console.log(r--)

Output:
3
2
1

Input:
N=6;M=4;if((r=N/M+(M-1)/2)%1)console.log(-1);else while(M--)console.log(r--)

Output:
3
2
1
0

Input:
N=7;M=3;if((r=N/M+(M-1)/2)%1)console.log(-1);else while(M--)console.log(r--)

Output:
    -1
Too bad console.log is so long to spell :)
Unfortunately declaring l=console.log.bind(console) does not make it any shorter, and just l=console.log does not work.
Input:
"N=3;M=3;if((r=N/M+(M-1)/2)%1)console.log(-1);else while(M--)console.log(r--)".length

Output:
76

You can use c=console and c.log() to shorten it.

    Julia, 45
f(n,m)=(x=n/m-m/2+1/2;x%1==0?[x+m-1:-1:x]:-1)
julia> f(6,4)'
1x4 Array{Float64,2}:
 3.0  2.0  1.0  0.0

Just a bit of algebra, took me way longer than it should have.

Mathematica 65
The function, g, generates all the increasing-by-one sequences, of length m, from 0 to n and checks whether any of them sum to m.  If successful, the sequence is returned; otherwise, -1 is returned.
The sequences are made by Partitioning the list {0,1,2,3… m} into all possible sublists of n contiguous integers.
There are, of course, more efficient ways to achieve the same effect, but those that I have found require more code.
n_~g~m_:=If[(s=Select[Partition[0~Range~n,m,1],Tr@#==n&])=={},-1,s]

Examples
g[9, 3]

{{2, 3, 4}}

g[3, 3]

{{0, 1, 2}}

g[7, 3]

-1

g[705, 3]

{{234, 235, 236}}

g[840, 16]

{{45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60}}

g[839, 16]

-1

Delphi XE3 (176)
uses SysUtils;var d,c,i:integer;begin read(c,d);for I:=1to d-1do c:=c-i;if c mod d>0then writeln(-1)else begin c:=c div d;for I:=d-1downto 0do write(IntToStr(i+c)+' ');end;end.

How it works.
Reads 2 integers, coins and dwarves.
Substracts the difference per dwarf.
If the remainder mod dwarves>0 its impossible.
Else get equal share per dwarf in a loop of dwarves-1 to 0 and prints dwarfIndex+equal share
Ungolfed
uses SysUtils;
var
  d,c,i:integer;
begin
  read(c,d);
  for I:=1to d-1do
    c:=c-i;
  if c mod d>0then
    writeln(-1)
  else
  begin
    c:=c div d;
    for I:=d-1downto 0do
      write(IntToStr(i+c)+' ');
  end;
end.

Cobra - 198
Cobra Website
class P
    def main
        x,y=Console.readLine.split
        a,b=x to int,y to int
        l=[]
        t=n=0
        for i in b,t+=i
        while (t+=b)<=a,n+=1
        for i in b,l.insert(0,i+n)
        print if(t-b<>a,-1,l.join(" "))

Explained:
class P
    def main

Required for the code to run
        x,y=Console.readLine.split
        a,b=x to int,y to int

Takes input and stores it as a and b
        l=[]
        t=n=0

Initializes the output list l, and initializes the total required money t and number of coins to add to each dwarves pile n
        for i in b,t+=i

Finds the lowest possible money value that will result in all dwarves having an allowable number of coins in their pile
        while (t+=b)<=a,n+=1

Determines how many coins to add to each pile so that the total required money is >= to the total available money
        for i in b,l.insert(0,i+n)

Fills the list with the different sized piles of money
        print if(t-b<>a,-1,l.join(" "))

Outputs either -1 or l depending whether the total required money is equal to the total available money

C 131
#include <edk.h>
main(int a,char **v){int j=atoi(*++v),k=atoi(*++v)-j*(j-1)/2;k<0||k%j?j=1,k=-1:k/=j;while(j--)printf("%d ",k+j);}

Ungolfed
#include <edk.h> //Shortest standard header including stdio.h and stdlib.h
main(int a,char **v)
{
    int j=atoi(*++v),k=atoi(*++v)-j*(j-1)/2;

    k<0||k%j?j=1,k=-1:k/=j;  // If youngest dwarf gets < 0 or amount not equally divisible then set values such that ...

    while(j--)printf("%d ",k+j); // ... loop prints out correct values
}

This compiles with a warning because main has no type.  If this is not valid in the rules of golf, I would have to add five characters.

Perl 5, 78 + 1 (-n) = 79 bytes
($d)=/ (.*)/;$,=$";say(($b=$_-($d**2-$d)/2)%$d?-1:map$_+$b/$d,reverse 0..$d-1)

Try it online!

Python (100 96 94):
A nice, round-scoring answer. Not any more, but it IS shorter now.
def f(n,m):a=range(m)[::-1];b=n-sum(a);c=b/m;d=[i+c for i in a];return(d,-1)[-1in d or c*m!=b]

Ungolfed:
def f(n,m):
 a = range(m)[::-1]
 b = sum(a)
 c = (n-b)/m
 if c * m != n-b: return -1
 d = [i+c for i in a]
 return (d,-1)[-1 in d or c!=n-b]
 if -d in d or c*m!=n-b:
  return -1
 return d

Output:
def f(n,m):a=range(m)[::-1];b=sum(a);c=(n-b)/m;d=[i+c for i in a];return (d,-1)[-1 in d or c*m!=n-b]

f(3,3)
Out[2]: [2, 1, 0]

f(9,3)
Out[3]: [4, 3, 2]

f(7,3)
Out[4]: -1

f(6,4)
Out[5]: [3, 2, 1, 0]

This doesn't follow the input requirement.

-1, the question requires to write a complete program and not a function. See http://meta.codegolf.stackexchange.com/a/1146/8766

authors: Роман Гостюшкин


text:
Remove a letter to make a palindrome
Problem
Let's say that a word is almost a palindrome if it is possible to remove one of its letters so that the word becomes a palindrome. Your task is to write a program that for a given word determines which letter to remove to get a palindrome.
The shortest code to do this in any programming language wins.
Input
Input consists of a word of lowercase letters from 2 to 1000 characters long.
Output
Output the 1-indexed position (leftmost letter has position 1, the next one has position 2 and so on) of the letter which should be removed. If there are possible choices that lead to the palindrome, output any of those positions. Note that you are required to remove a letter even if the given word is already a palindrome. If the given word is not almost a palindrome, output -1.

Examples
The input:
racercar

might produce either of these outputs:
4
5

because removing the 4th letter produces racrcar and removing the 5th letter produces racecar, which are both palindromes.
Also, the input
racecar

can still produce the output
4

because removing the 4th letter to produce raccar is still a palindrome.
The input
golf

should produce the output
-1

because there is no way to remove a single letter to make it a palindrome.

No examples posted? And what to output if it is not possible to make the input into a Palindrome?

Sorry didn't realize i had the fastest code their its just shortest code

@Arm103 you are still missing the examples you are referring to

What are you trying to achieve here?

Warning: "(see example 3)". This suggests that this is homework since no examples were ever posted.

@Quincunx Be sure to read the thread on the Mathematica submission, too. :-)

Just saying that this is a question from a competition currently running,

This is a comment, not an answer. And can you show where the competition is running?

I suggest you ask folks to test the following cases: {"abcc1ba", "aaaaaa", "abcde", "", "a"}

related: http://stackoverflow.com/questions/22843523/almost-palindrome-python

@Quincunx maybe this, but it looks like that contest was over a year ago. http://uva.onlinejudge.org/contests/324-482540ea/hunan2013_v4.doc

@Spook see above

This question appears to be off-topic because example 3 is missing from the question.

The problem in that Hunan contest is different in that it asks for finding the longest almost-palindrome, while in this problem the question is asking for which letter should be removed in an almost-palindrome.

What do we return if the string is already a palindrome but reducing a letter also produces a palindrome. Eg @DavidCarraher example aaaaaaa

@user80551 you return the position of that letter.

This question appears to be off-topic because it looks like homework

Interestingly, racercar can have the e removed, because racrcar is a palindrome, too. So the "left-most" index would be 3.

J - 31 25 char
(_1{ ::[1+[:I.1(-:|.)\.])

Largely standard fare for J, so I'll just point out the cool bits.

The adverb \. is called Outfix. x u\. y removes every infix of length x from y and applies u to the result of each removal. Here, x is 1, y is the input string, and u is (-:|.), a test for whether the string matches its reverse. Hence the result of this application of \. is a list of booleans, 1 in the place of each character whose removal makes the input a palindrome.
I. creates an list of all the indices (0-origin) from above where there was a 1. Adding 1 with 1+ makes these 1-origin indices. If no indices were 1, the list is empty. Now, we try to take the last element with _1{. (We are allowed to output any of the removable letters!) If this works, we return. However, if the list was empty, there were no elements at all, so { throws a domain error which we catch with :: and return the -1 with [.

Usage (recall that NB. is for comments):
   (_1{ ::[1+[:I.1(-:|.)\.]) 'RACECAR'    NB. remove the E
4
   (_1{ ::[1+[:I.1(-:|.)\.]) 'RAACECAR'   NB. remove an A
3
   (_1{ ::[1+[:I.1(-:|.)\.]) 'RAAACECAR'  NB. no valid removal
_1

I should learn J. Any tutorials for a python programmer?

@Synthetica the official one is good

@Synthetica Nothing specifically for Pythoners, but J for C Programmers is a great resource for anybody migrating from imperative programming.

Not-PHP Python (73):
[a[:g]+a[g+1:]==(a[:g]+a[g+1:])[::-1] for g in range(len(a))].index(1)

Where a is the string you want to check. This, however, throws an error if you can't turn it in an palindrome. Instead, you could use
try:print [a[:g]+a[g+1:]==(a[:g]+a[g+1:])[::-1] for g in range(len(a))].index(True)
except ValueError:print -1

EDIT: No, wait, it does work!
try: eval("<?php $line = fgets(STDIN); ?>")
except: print [a[:g]+a[g+1:]==(a[:g]+a[g+1:])[::-1] for g in range(len(a))].index(1)

Thanks, this does indeed raise the php-contents of this script by about 25% (that's what you want, right?)

+1 for "Not PHP" ;)

@User011001 Where would that fit in?

Just gave up trying to fit this in, I can't get it to work. Maybe you could post a full snippet of your suggestion?

You could save a char each by writing 1>0 instead of True and by removing the space between ] and for in ...[::-1] for g...

You don't have to supply  ValueError for that except statement in your second piece of code. :P Well done!

Oh, also, you can replace index with find, it's shorter and doesn't throw ValueError if it isn't found.

@Trimsty That was actually what  I was looking for, but I thought it was called search

@Kaya You can simply use 1 instead of True as well. 1 == True, after all.

aren't sumbitions supposed to be functions?

Mathematica, 106 98 87 91 characters
I suppose I'm slightly handicapped by the long function names, but problems like this are quite fun in Mathematica:
f=Tr@Append[Position[c~Drop~{#}&/@Range@Length[c=Characters@#],l_/;l==Reverse@l,{1}],{-1}]&

It throws some warnings, because the l_ pattern also matches all the characters inside, which Reverse can't operate on. But hey, it works!
Somewhat ungolfed:
f[s_] :=
  Append[
    Cases[
      Map[{#, Drop[Characters[s], {# }]} &, Range[StringLength[s]]],
      {_, l_} /; l == Reverse[l]
    ],
    {-1}
  ][[1, 1]]

Could you do this in php?

@Arm103 I could, but I'll leave that to someone else. ;)

@Arm103 wait, is this your homework?

@JanDvorak There are CS courses that use PHP? That would be scary.

@ChrisJester-Young I'm afraid there are :-/

@Jan Dvorak Nope just a question I have but My main programming language is php so I can acctually understand it then

@Arm103 no. You can't ;-)

@Arm103 Understanding golfed PHP? That's quite a stretch ;)

@JanDvorak My main programming language is php I write all my programs in php.

Somehow this seems to be missing I/O

@JanDvorak sorry, I interpreted I/O as function parameter and return value here. :-/

@m.buettner but, you were asked to write a program.

@JanDvorak hmmm, what's a program in Mathematica?

There are still some flaws in the code. Try these cases: {"abcc1ba", "aaaaaa", "abcde", "", "a"}

@DavidCarraher okay, the second and last two don't work, I'll look into that. but the first and third work as they should, I think?

@DavidCarraher fixed it at the cost of four characters

Much better. [As you may know, the second one could return any or all of {1,2,3,4,5,6}.]

@DavidCarraher Yes, it does output 1 in my case. Or what do you mean?

I first thought it should return {1,2,3,4,5,6} but then noticed that the challenge requires only one case to be returned.  Good work.

GolfScript, 28 26 characters
:I,,{)I/();\+.-1%=}?-2]0=)

Thanks to Peter for shortening by 2 characters. Try the test cases online:
> "RACECAR"
4
> "RAACECAR"
2
> "RAAACECAR"
-1
> "ABCC1BA"
5
> "AAAAAA"
1
> "ABCDE"
-1
> ""
-1
> "A"
1

Guess there must be a shorter way but I didn't find it.

RACECAR is still a palindrome with the E. Is it necessary to specify a character to remove, when the inputted word is already a palindrome?

@unclemeat, yes. Penultimate sentence of the spec.

Why -2]$-1=)? At the start of that block you have at most one item on the stack, so you can easily shorten to -2]0=). (Or for the same length, ]-2or). I've learnt to love or for special cases).

@PeterTaylor Of course. Thank you. But it still feels wrong...

It's pretty much exactly what I would have written.

@PeterTaylor But still longer than the J solution...

@Howard If I had a nickel for every time I felt that way about Golfscript...

Jelly, 8 bytes
ŒḂ-ƤTȯ-Ḣ

Try it online!
Not overwriting my older answer since it's among my first Jelly answers, but it's still way too embarrassing not to fix. I can't blame myself for not coming up with this exactly since nilad-Ƥ is pretty obscure documentation-wise, but at least JœPẎŒḂɗƇȯ-Ḣ should have been in reach...
  -Ƥ        For each "1-outfix" (remove a single item) of the input,
ŒḂ          is it a palindrome?
    T       List all truthy indices.
     ȯ-     Replace an empty list with -1,
       Ḣ    and return the first element.

Jelly, 17 14 bytes
ŒPṖLÐṀṚŒḂ€TXo-

Try it online!
           X      A random
          T       truthy index
ŒP                from the powerset of the input
  Ṗ               excluding the input
   LÐṀ            and all proper subsequences with non-maximal length
      Ṛ           reversed
       ŒḂ€        with each element replaced with whether or not it's a palindrome,
            o-    or -1.

Since I changed my approach fast enough for the old version not to show up in edit history, it was this: ŒPṚḊŒḂ€TṂ©’<La®o-

Stax, 8 10 bytes
ú·àA÷¡%5Ñ╙

Run and debug it
This program shows all 1-based indices that can be removed from the string to form a palindrome.  And if there are none, it shows -1.

This outputs the last index instead of -1 if no palindrome is found (i.e. aaabb outputs 5 instead of -1).

@KevinCruijssen:  Right you are.  I fixed it at the cost of 2 bytes.

05AB1E, 10 9 bytes
ā.Δõs<ǝÂQ

Try it online or verify some more test cases.
Explanation:
ā          # Push a list in the range [1, (implicit) input-length]
 .Δ        # Pop and find the first value in this list which is truthy for:
           # (which will result in -1 if none are truthy)
   õ       #  Push an empty string ""
    s      #  Swap to get the current integer of the find_first-loop
     <     #  Decrease it by 1 because 05AB1E uses 0-based indexing
      ǝ    #  In the (implicit) input-String, replace the character at that index with
           #  the empty string ""
       Â   #  Then bifurcate the string (short for Duplicate & Reverse copy)
        Q  #  And check if the reversed copy is equal to the original string
           #  (so `ÂQ` basically checks if a string is a palindrome)
           # (after which the result is output implicitly)

Japt, 8 bytes
a@jYÉ êS

Try it
a@jYÉ êS     :Implicit input of string
a            :Last 0-based index that returns true (or -1 if none do)
 @           :When passed through the following function as Y
  j          :  Remove the character in U at index
   YÉ        :    Y-1
      êS     :  Is palindrome?

C#, 134 Characters
static int F(string s,int i=0){if(i==s.Length)return-1;var R=s.Remove(i,1);return R.SequenceEqual(R.Reverse())?i+1:F(s,i+1);}

I know I lose :( but it was still fun :D
Readable version:
using System.Linq;

// namespace and class

static int PalindromeCharIndex(string str, int i = 0)
{
    if (i == str.Length) return -1;
    var removed = str.Remove(i, 1);
    return removed.SequenceEqual(removed.Reverse())
        ? i+1
        : PalindromeCharIndex(str, i + 1);
}

Yay fun!!!!! :)

In the golfed version, where is R defined and used?

oh yeah, it should say var R = s.Remove(i,1). good catch

Rebol (81)
r: -1 repeat i length? s[t: head remove at copy s i if t = reverse copy t[r: i]]r

Example usage in Rebol console:
>> s: "racercar"
== "racercar"

>> r: -1 repeat i length? s[t: head remove at copy s i if t = reverse copy t[r: i]]r
== 5

>> s: "1234"
== "1234"

>> r: -1 repeat i length? s[t: head remove at copy s i if t = reverse copy t[r: i]]r
== -1

Above returns index of last palindrome found.  An alternative solution (85 chars) which returns every palindrome found would be:
collect[repeat i length? s[t: head remove at copy s i if t = reverse copy t[keep i]]]

So for "racercar" this would return list [4 5].

If you used the Rebmu dialect that first solution is just 37 characters, despite being basically the same code  :-)  Invoke as rebmu/args "Rng01rpNl?A[ThdRMatCYaNieTrvCYt[Rn]]r" "racecar".  Note that the Rebmu documentation has been improved, and recent changes have tightened it up a bit...still looking to feedback before everyone and their D starts using it.  :-)

Not Python PHP, 85 83 81 bytes
while($argn[$x])$s!=strrev($s=substr_replace($argn,'',$x++,1))?:die("$x");echo-1;

-2 bytes thanks to @Night2!

Try it online!
Unnecessarily recursive:
PHP, 96 bytes
function f($a,$b='',$d=1){return$a?$c==strrev($c=$b.$e=substr($a,1))?$d:f($e,$b.$a[0],$d+1):-1;}

Try it online!

Brachylog, 20 bytes
l⟧∋.&↻↺↙.b↺↻↙.I↔I∨_1

Try it online!
It was too long

Still seemed too long ;)

Ruby (61):
(1..s.size+1).find{|i|b=s.dup;b.slice!(i-1);b.reverse==b}||-1

Here, have a ruby solution. It will return the position of the character to remove or -1 if it cannot be done.
I can't help but feel there's improvement to be made with the dup and slice section, but Ruby doesn't appear to have a String method that will remove a character at a specific index and return the new string -__-.
Edited as per comment, ty!

You can save some space by not wrapping in a function/method.  However your code currently returns 0-based index (needs to be 1-based) and it also needs to return -1 if no palindrome found.

Fixed the -1, thanks. Not sure what you have in mind regards taking it out a method though, I'll have a think.

Ok, took your advise on board and rewrote it :), ty.

You're welcome!  Now that is much better :) +1

Perl 5 -p, 56 52 bytes
("$`$'"eq reverse"$`$'")&&($\=pos)while/./g}{$\||=-1

Try it online!

i came across this answer, 44bytes : Try it online!

Brachylog, 24 bytes
{l+₁≥.ℕ₂≜&↔⊇ᶠ↖.tT↔T∨0}-₁

Try it online!
Feels way too long.
Could be two bytes shorter if the output could be 2-indexed:
l+₁≥.ℕ₂≜&↔⊇ᶠ↖.tT↔T∨_1

Two earlier and even worse iterations:
ẹ~c₃C⟨hct⟩P↔P∧C;Ȯ⟨kt⟩hl<|∧_1
l>X⁰ℕ≜<.&{iI¬tX⁰∧Ih}ᶠP↔P∨_1

The latter's use of a global variable necessitates a different testing header.

Python 3, 681 bytes

from itertools import groupby

def solution(x):
    if len(x) == 1:
        return 1
    lst = [''.join(g) for _, g in groupby(sorted(x))]
    print(lst)
    pal_str_len = 0
    single_elements = False
    odd_elements = False
    for i in lst:
        if len(i)%2 == 0:
            pal_str_len +=len(i)
        elif len(i)%2 == 1:
            if odd_elements:
                pal_str_len +=len(i)-1
            else:
                odd_elements = True
                pal_str_len +=len(i)
        elif len(i) == 1:
            if not odd_elements and not single_elements:
                single_elements = True
                pal_str_len += 1

    return len(x)-pal_str_len
x = 'AAABBC'
print(solution(x))

Welcome to CGCC! This site is for competitive coding challenges, and this challenge is tagged [tag:code-golf], so answers are expected to be as short as possible. You can improve your answer's score by doing things like eliminating unnecessary whitespace, shortening variable names, and using tips that can be found here.

How many bytes is this?

I have submitted an edit to add the link to the Python website, and also count the byte counts for this one (not including the extra two lines, which are for running solutions). Feel free to edit this if you want to make some changes on your own.

C++, 247 150 bytes
-97 thanks to ceilingcat
TIO Link
#import<map>
int P(std::string s){int i=0,j,q,r=-1;for(;s[i++]*!~r;r=q?r:i)for(auto t=s.substr(j=q=0,i-1)+&s[i];t[j];)q|=t[j]-*(end(t)-++j);return r;}

Test code example :
std::cout << P("RACERCAR") << '\n';

Brachylog, 17 bytes
~cLkʰcP↔P∧Lhl.∨_1

Try it online! (Can be rather slow for inputs that are not almost-palindromes. For faster performance, replace the ~c with ~c₂.)
Explanation
~c                 "Unconcatenate" the string into a list of strings
  L                Call that list of substrings L
   kʰ              Remove the last character from the first substring
     c             Concatenate the list of strings together again
      P            Call that new string P
       ↔           Reverse
        P          Assert that the result is still the same (i.e. P is a palindrome)
         ∧L        Also, going back to the list L
           h       Get its first element
            l      Get its length
             .     This is the output of the predicate
              ∨    Or, if there is no way to satisfy the previous conditions
               _1  Output -1 instead

C# (184 characters)
I admit this is not the best language to do code-golfing...
using System.Linq;class C{static void Main(string[]a){int i=0,r=-1;while(i<a[0].Length){var x=a[0].Remove(i++,1);if(x==new string(x.Reverse().ToArray()))r=i;}System.Console.Write(r);}}

Formatted and commented:
using System.Linq;

class C
{
    static void Main(string[] a)
    {
        int i = 0, r = -1;
        // try all positions
        while (i < a[0].Length)
        {
            // create a string with the i-th character removed
            var x = a[0].Remove(i++, 1);
            // and test if it is a palindrome
            if (x == new string(x.Reverse().ToArray())) r = i;
        }
        Console.Write(r);
    }
}

C# (84 Characters)
int x=0,o=i.Select(c=>i.Remove(x++,1)).Any(s=>s.Reverse().SequenceEqual(s))?x:-1;

LINQpad statement expecting the variable i to contain the input string. Output is stored in the o variable.

Haskell, 80
a%b|b<1=0-1|(\x->x==reverse x)$take(b-1)a++b`drop`a=b|1<2=a%(b-1)
f a=a%length a

Called like this:
λ> f "racercar"
5

Haskell, 107 characters:
(x:y)!1=y;(x:y)!n=x:y!(n-1)
main=getLine>>= \s->print$head$filter(\n->s!n==reverse(s!n))[1..length s]++[-1]

As a function (85 characters):
(x:y)!1=y;(x:y)!n=x:y!(n-1)
f s=head$filter(\n->s!n==reverse(s!n))[1..length s]++[-1]

original ungolfed version:
f str = case filter cp [1..length str] of
          x:_ -> x
          _   -> -1
    where cp n = palindrome $ cut n str
          cut (x:xs) 1 = xs
          cut (x:xs) n = x : cut xs (n-1)
          palindrome x = x == reverse x

Python 3, 71 bytes
def f(s,i=1):n=s[:i-1]+s[i:];return(n==n[::-1])*i-(i>len(s))or f(s,i+1)

Try it online!
Returns the 1-indexed character if the operation can be done and -1 otherwise.

C (gcc), 180 168 159 157 140 139 bytes
f(char*s){int j=strlen(s),m=j--/2,p=-1,i=0;for(;p&&i<m;)p=s[i++]^s[j--]&&!++p?s[i]-s[j+1]?s[i-1]-s[j]?p:j--+2:i++:p;return p<0?m+1:p?p:-1;}

Try it online!
2 16 17 bytes shaved off thanks to ceilingcat! And 3 more bytes since the rules state the minimum length of the input is 2 characters, so don't have to check for empty strings.
Ungolfed:
f(char *s) {
  int j = strlen(s);             // j = length of input
  int m = j-- / 2;               // m = midpoint of string,
                                 // j = index of right character
  int p = -1;                    // p = position of extra character
                                 //     -1 means no extra character found yet
                                 //     0 means invalid input
  int i = 0;                     // i = index of left character

  for (; p && i < m; i++) {      // loop over the string from both sides,
                                 // as long as the input is valid.
    p = s[i] ^ s[j--]            // if (left character != right character
        && !++p ?                //     and we didn't remove a character yet*)
          s[i + 1] - s[j + 1] ?  //   if (left+1 char != right char)
            s[i] - s[j] ?        //     if (left char != right-1 char)
              p                  //       do nothing,
            :                    //     else
              j-- + 2            //       remove right char.
          :                      //   else
            ++i                  //       remove left char.
        :                        // else
          p;                     //     do nothing, or:
                                 //     *the input is marked invalid
  }

  return p < 0 ?                 // if (input valid and we didn't remove a character yet)
           m + 1                 //   return the midpoint character,
         :                       // else
           p ?                   //   if (we did remove a character)
             p                   //     return that character,
           :                     //   else
             -1;                 //     the input was invalid.
}
```

@ceilingcat That &&!++p is just devious to explain :)

Wolfram Language (Mathematica), 56 bytes
FirstCase[Range@Tr[1^#],a_/;PalindromeQ@Delete[#,a],-1]&

Try it online!
Takes input as a list of characters. For string input, append @*Characters.
PalindromeQ was introduced in 2015. The alternative costs +4 bytes.

Vyxal G, 58 bitsv1, 7.25 bytes
ẏ⋎:R=T›uJ

Try it Online!
Hehe vyncode go brrr

Incomplete but could be used to potentially save some bytes?

@emirps [best I could get with that is 8.625 bytes: L‹ḋ‡Ḃ=ḟ›uJ](https://vyxal.pythonanywhere.com/?v=1#WyJHPSIsIiIsIkzigLnhuIvigKHhuII94bif4oC6dUoiLCIiLCJyYWNlcmNhciJd)

JavaScript (Node.js), 75 90 bytes

-15 bytes thanks to @Shaggy 's conversion into a recursive function, simplification of the array comparison, and replacement of a map with a reduce.

JS might not be the right tool for this job, but i was surprised no one posted a JS answer before.

For each character of the word, we test if the removal of this character gives a word that is a palindrome, and we retain the index +1 of the last character that succeeded (or -1 if there weren't any).
f=(s,r=i=-1)=>s[++i]?f(s,(a=[...s]).splice(i,1)&&a+``==a.reverse()?i+1:r):r

Try it online!

77 bytes

75 bytes

@Shaggy Thanks! I'm still not entirely confortable with recursive functions, but i should have seen that for once the reduce was shorter. Nice trick for the array comparison, i didn't know about it!

sed -E,  266 258 254  238 bytes
(230 bytes with ugly GNU extensions and bugs)
Unfortunally, sed needs to be tought how to count; otherwise this could have been much shorter. Anyhow, I think this is quite a clever approach and highly golfed. The idea is to put a 1 in front of the first char (line 1, along with counting helper), then to double the word with an increased number at an increased position (line 3). Then comes some overhead to count past 9 and even more overhead to count past 99. Could be golfed by switching to non-decimal output.
Finally, starting from :3, all strings are eaten up from the start and from the end, until there is only 1 or no char left. I'm pretty sure this is the shortest way to check for a palindrome.
s/.*/0123456789#:-1:1&:/
:1
s/(.)(.).*:([a-z]*)(.*)\1([a-z])([^:]*:)$/&\3\5\4\2\6/
s/([a-z])(9*)#/\10\2#/
:2
s/((.)(.).*)\2#/\1\30/
t2
/[0-9].:$/!b1
s/([a-z]*)([0-9]+)[^:]/\2\1/g
:3
s/([0-9])(.)([^:]*)\2:/\1\3:/
t3
s/.*:([-0-9]*).?:.*/\1/

Try it online!

Julia, 72 68 bytes
!s=[filter(i->(t=s[1:i-1]s[i+1:end])==reverse(t),1:length(s));-1][1]

Attempt This Online!

-4 bytes: by MarcMush

68 bytes: !s=[filter(i->(t=s[1:i-1]s[i+1:end])==reverse(t),1:length(s));-1][1]

Haskell, 118C
m s|f s==[]=(-1)|True=f s!!0
f s=[i|i<-[1..length s],r s i==(reverse$r s i)]
r s i=let(a,_:b)=splitAt (i-1) s in a++b

Ungolfed:
fix s
    |indices s==[] = (-1)
    |True = indices s!!0
indices s = [i|i<-[1..length s],remove s i==(reverse$remove s i)]
remove s i = let (a,_:b) = (splitAt (i-1) s) in a++b

k, 21 characters
No surprises, generates the list of strings that are the result of removing a character from each index, checks each for pallindrome, take the first index where true, filling with -1 if null
{-1^*&{x~|x}'x_/:!#x}

Uiua, 21 bytes
a←
▽∵(≅⇌.▽≠⇡⧻,∶a).⇡⧻a

I'm sure it could be done better, it does as you expect, filtering a range of indexes by which ones produce a palindrome (inside the brackets is the palindrome checker).

Go, 166 bytes
func P(s string)bool{for i:=range s{if s[i]!=s[len(s)-i-1]{return 0>1}}
return 0<1}
func f(s string)int{for i:=0;i<len(s);i++{if P(s[:i]+s[i+1:]){return i}}
return-1}

Attempt This Online!
Returns the first 0-based index that creates a palindrome when removed.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/