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

https://www.codingame.com/training/hard/big-bang-theory---sheldons-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.

2 Likes

@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ā€¦

2 Likes

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)ā€¦

2 Likes

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.

3 Likes

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