[Community Puzzle] Big Bang Theory - Sheldon's Array Puzzle


Send your feedback or ask for help here!

Created by @RaulButuc,validated by @anon79996792.
If you have any issues, feel free to ping them.

I removed a few extra whitespaces from the testcases, which make an input parsing like this one crash:
List<int> nums = Console.ReadLine().Split().Select(int.Parse).ToList();.

Then I noticed an issue at testcase 6 (“Medium 1”): according to the input specification we get n in the first line and n numbers in the following line.
However the mentioned testcase sets n to 150 and then only gives 100 numbers.
Furthermore I’m not happy with the stub, as it reads the 2nd line as a string, rather than a list of integers - which is why running the default code on test 6 won’t even cause a crash.

Pinging @RaulButuc and @anon79996792, as the @CommunityBot told me to do so.


@eulerscheZahl This problem is plagiarism (with a few cosmetic changes) from HackerRank. All the initial testcases and author solution were plagiarism from there too. The author modified a few things in a hurry, in particular the testcases, when I mentioned that in the comments.
The people who validated that obviously did not solve it (copy-paste the solution, period) nor did any kind of reviewing work.
So there are indeed a few issues here, beyond those you mention…


Niako: plagiarism… so it is even worse than I though. :frowning:

I also have issues with Test 6 (aka “Medium 1”).
If I apply the fix suggested by eulerscheZahl, the official solution answers 569820 instead of 4023883. This is the answer of my own bot (which actually ignores n ).

Can you confirm that the correct answer is indeed 569820 before I fix this stuff?

edit: stuff fixed.

1 Like

@Stilgart Confirmed.

But CG retweeted, so I assumed this was encouraged behavior?

JBM: Don’t make it even worse… :sob:

Thanks for the info @Niako. I had the feeling that it might be copied from another website (well crafted puzzles that require more thinking than coding always make me a little suspicious). I should improve my google skills.

And thank you for @Stilgart for correcting this and many other contributions.

Edit: this also explains the weird modulo of 10⁷+7 instead of 10⁹+7. While the latter is commonly used (easy to remember prime with a similar order of magnitude as MAX_INT), the number used here just feels random.

1 Like

Of course, he did not even bother to pick a prime number when trying to hide the plagiarism after it was revealed. Funny thing is that the previous official solution (which simply was a plagiarism of the first C++ solution on HR with modified variable names) relied on computing modular inverses by x^(mod-2), which only works when mod is prime. Thus he had to plagiarize another solution (using the standard additive relation for binomial coefficients instead, avoiding modular inversion) to make it compatible with the new constraints (but I don’t even know if he realized that in some way or if he just was lucky when picking the other solution)…


After making sure that the creator of the puzzle is legitimate, I checked the suspicious accounts which validated the contribution. They’re not related to the creator and I have deleted them.

About the puzzle, now that it is published, I have no easy way to put it back as “waiting for moderation”. If moderators think it should get back to the moderation phase, we could all badly rate it and the moderation bot would quickly do the rest.

I don’t have a major issue concerning plagiarism. As long as:

  • the original puzzle’s license allows it
  • the creator doesn’t abuse it
  • the puzzle fits CodinGame standards and respects the contribution guidelines

I think it is acceptable and I trust the moderation team to discuss and agree together if the puzzle is worth being published on CG.

You should consider playing with https://chadok.info/codingame/ part 3.
It shall help you finding related accounts. :roll_eyes:

you mean part 1, don’t you? This: https://chadok.info/codingame/leaderboard_xp.html ?

He’s talking about part 3, where you can see which user solved which problems in which programming language by entering the name of the user.

1 Like

I see nothing in the HackerRank ToS that allows content re-use. Relevant sections:

You (…) agree to all of the following (…): a. The Content represents Your own original work and/or You have all necessary rights to disclose the Content.

Except as expressly authorized by Interviewstreet, You agree not to sell, license, distribute, copy, modify, publicly perform or display, transmit, publish, edit, adapt, create derivative works from, or otherwise make unauthorized use of the Materials.

Unless either one of those is the case:

  • RaulButuc and darkshadows are the same person (but then he’d have copyright on the content, and no need to nonsense it down in that misguided attempt to camouflage the plagiarism); or
  • RaulButuc has licensed the content as expressly authorized by Interviewstreet,

then this is red-handed plagiarism and blatant copyright infringement.


Your quoted paragraphs are talking about different stuff. First one is about users’ content, the second is about Hacker Rank (HR) itself.

HR allows content reuse. In fact they don’t own users’ work but have a perpetual license:

Content that You own and post on or through HR belongs to You and You may use it in any way, except as prohibited by applicable law or regulations. By using HR, You are granting Us permission to use the Content as described in these Terms.

Grant a permission is different than owning that content. They state “you own”.

By using HR You are granting Us a non­exclusive, (…) license to use (…) Your Content. If You post Content on or through HR, You represent and warrant that You have the right to post the Content and to grant the above rights to Us.

Non exclusive license to use.

In short, HR ToS are irrelevant in that issue, their ToS are just there to cover their “backs” from any copyright infringement on users’ content.
The important point is the original puzzle’s license as you and Thibaud stated.

Even HR clean their hands on possible issues:

4 . We cannot and need not control all Content posted by Hackers on or through HR, and We do not guarantee the accuracy, integrity or quality of such Content
6 . You are solely responsible for Your Content and the consequences of posting or publishing it.(…) You affirm, represent, and warrant that: (i) You own, or have the necessary licenses,

With all the new content creation I think CG should do the same, update their ToS to avoid copyright issues and delegate these responsabilities to content creators. HR does that in many terms (Content and Code of Conduct are pretty much about that)

1 Like

Let me introduce by stating I’m not too knowledgeable about HR : I know about it, but I “am” not there. But I do know a thing or two about authorship and copyright.

I’m aware of that. I quoted the first part to highlight the user-submited content is presumed owned or licensed by its authors; the second one to underline HR extends license to use on nothing: neither their self-produced nor the user-submitted material.

I didn’t mean they don’t authorize re-use in the sense they forbid it, I meant they don’t authorize it as they’re not in a position to since they don’t own it.

But then we’re back to my two: it is very possible that the alleged plagiarizer either authored that content, or totally legally licensed it from its author. It just seemed very unlikely to me.

I disagree. I recognize their contents are mostly superfluous as they don’t change the default situation valid in most countries about authorship and copyright. But at least:

  1. They state their agreement with that.
  2. They give us something to quote, that neither of us has disputed. Since they’re reasonable.
  3. They’re the expression of the (undebated, for now) default situation wrt content ownership on their platform.

Cookie-cutter. This needs context.

They have no problem with users submitting re-used contents, since this is the users’ responsibility. They’re certainly even very happy about it, since it gives them bigger “content” counts until somebody notices and complains. Kind of like CG, I suspect.

They certainly do not grant anyone the right re-use the content they host. Expressly forbidden by the ToS for the content they own, implicitly (but still expressly) not authorized (by them) for the content they merely host.

So despite your confrontational tone I agree with everything you wrote. (except the cookie-cutter, of course).

On CG, I recall seeing CC-BY-SA (2 or later boxes) in the earliest content submission forms, but indeed I’m not so sure they’re still there. They mostly* respect it anyway, whether or not they’re still explicit about it.

[*] for my content anyway. No promises for others.

As far as I know, the only competitive programming website to be clear about licenses is Kattis where each problems has an explicitly specified license – mostly CC BY-SA it seems, which still requires Attribution (BY) and I think it would be good practice to ask for any contribution that is legally copied or strongly inspired to always explicitly mention the source. I’m pretty sure the content on any other site I know of should be considered copyrighted.

In fact 10^7 + 7 is worse than random-looking because it actually looks like it is prime.
Maybe the description can be updated with a warning: “Be careful: 10000007=941*10627 is not prime”

@Fluxor Yeah, but, well… This problem should have been deleted IMO (the statement, the testcases and the solution code were plagiarized, moreover the 3 reviewers who validated it have been banned, the author survived for some reason though). Period.

1 Like