PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 241
Good morning! Here's your coding interview problem for today.

This problem was asked by Palantir.

In academia, the h-index is a metric used to calculate the impact of a researcher's papers. It is calculated as follows:

A researcher has index h if at least h of her N papers have h citations each. If there are multiple h satisfying this formula, the maximum is chosen.

For example, suppose `N = 5`, and the respective citations of each paper are `[4, 3, 0, 1, 5]`. Then the h-index would be `3`, since the researcher has 3 papers with at least 3 citations.

Given a list of paper citations of a researcher, calculate their h-index.

Pull request:
Day241
Resolves #493.

Patch:
diff --git a/README.md b/README.md
index c87a6a6..bcb745e 100644
--- a/README.md
+++ b/README.md
@@ -247,3 +247,4 @@ problems from
 * [Day 236](https://github.com/vaskoz/dailycodingproblem-go/issues/485)
 * [Day 237](https://github.com/vaskoz/dailycodingproblem-go/issues/487)
 * [Day 238](https://github.com/vaskoz/dailycodingproblem-go/issues/489)
+* [Day 241](https://github.com/vaskoz/dailycodingproblem-go/issues/493)
diff --git a/day241/problem.go b/day241/problem.go
new file mode 100644
index 0000000..a56f4ef
--- /dev/null
+++ b/day241/problem.go
@@ -0,0 +1,20 @@
+package day241
+
+import "sort"
+
+// HIndex returns the H-Index of the citations from an author.
+// Runs in O(N log N) using O(N) extra memory because we
+// don't want to mutate the original data by sorting.
+func HIndex(citations []int) int {
+	copied := make([]int, len(citations))
+	copy(copied, citations)
+	sort.Slice(copied, func(i, j int) bool {
+		return copied[i] > copied[j]
+	})
+	for paper, citationCount := range copied {
+		if citationCount < paper+1 {
+			return paper
+		}
+	}
+	return len(copied)
+}


Test patch:
diff --git a/day241/problem_test.go b/day241/problem_test.go
new file mode 100644
index 0000000..cdea427
--- /dev/null
+++ b/day241/problem_test.go
@@ -0,0 +1,28 @@
+package day241
+
+import "testing"
+
+var testcases = []struct {
+	citations []int
+	hindex    int
+}{
+	{[]int{4, 3, 0, 1, 5}, 3},
+	{[]int{10}, 1},
+}
+
+func TestHIndex(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := HIndex(tc.citations); result != tc.hindex {
+			t.Errorf("Expected %v, got %v", tc.hindex, result)
+		}
+	}
+}
+
+func BenchmarkHIndex(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			HIndex(tc.citations)
+		}
+	}
+}
Repository: babel/babel-eslint (js)

Issue:
The `type` of the hash(#) token is not a string.
I'm using babel-eslint@8.2.6.

Parsing the following source code with `babel-eslint` creates an invalid token.

```js
  export default class TouristNumber extends Vue {
    #pro1='hello'
  }
```

token:

```ts
Token {
  type: 
   TokenType {
     label: '#',
     keyword: undefined,
     beforeExpr: false,
     startsExpr: false,
     rightAssociative: false,
     isLoop: false,
     isAssign: false,
     prefix: false,
     postfix: false,
     binop: null,
     updateContext: null },
  value: undefined,
  start: 92,
  end: 93,
  loc: SourceLocation { start: { line: 4, column: 0 }, end: { line: 4, column: 1 } },
  range: [ 92, 93 ] }
```

The `type` of the token must be a string.
https://eslint.org/docs/developer-guide/working-with-custom-parsers#the-ast-specification

But the result is not a string.

I think that you should add `tt.hash` to [convertToken.js](https://github.com/babel/babel-eslint/blob/master/lib/babylon-to-espree/convertToken.js)

---

ref https://github.com/vuejs/eslint-plugin-vue/issues/814

Pull request:
Fix to convert hash token.
Fixed #752 

This pull request makes the hash token of the class private field to be converted to the token specification of ESLint.

Patch:
diff --git a/lib/babylon-to-espree/convertToken.js b/lib/babylon-to-espree/convertToken.js
index 3e0ba45..2d8e9b1 100644
--- a/lib/babylon-to-espree/convertToken.js
+++ b/lib/babylon-to-espree/convertToken.js
@@ -44,6 +44,7 @@ module.exports = function(token, tt, source) {
     type === tt.bang ||
     type === tt.tilde ||
     type === tt.doubleColon ||
+    type === tt.hash ||
     type.isAssign
   ) {
     token.type = "Punctuator";


Test patch:
diff --git a/test/specs/babel-eslint.js b/test/specs/babel-eslint.js
index 849e37a..02328e8 100644
--- a/test/specs/babel-eslint.js
+++ b/test/specs/babel-eslint.js
@@ -267,6 +267,17 @@ describe("babylon-to-espree", () => {
     assert.strictEqual(babylonAST.tokens[1].type, "Punctuator");
   });
 
+  // Espree doesn't support the private fields yet
+  it("hash (token)", () => {
+    const code = "class A { #x }";
+    const babylonAST = babelEslint.parseForESLint(code, {
+      eslintVisitorKeys: true,
+      eslintScopeManager: true,
+    }).ast;
+    assert.strictEqual(babylonAST.tokens[3].type, "Punctuator");
+    assert.strictEqual(babylonAST.tokens[3].value, "#");
+  });
+
   it.skip("empty program with line comment", () => {
     parseAndAssertSame("// single comment");
   });
Repository: tweag/nickel (rust)

Issue:
Wrong handling of `#` character in multiline strings
**Describe the bug**
A `#` or a sequence of `#` in a multiline string causes a parse error.

**To Reproduce**
 ```
% nickel <<< 'm#"Hel#lo"#m'
error: Unexpected token
  ┌─ <stdin>:1:7
  │
1│ m#"Hel#lo"#m
  │       ^
```

**Expected behavior**
The program evaluates without error:
```
% nickel <<< 'm#"Hel#lo"#m'
Done: Str("Hel#lo")
```

Pull request:
[Fix]Mishandling of `#` in mutliline strings
Close #230.

Patch:
diff --git a/src/parser/lexer.rs b/src/parser/lexer.rs
index 43b65e01..ca098a79 100644
--- a/src/parser/lexer.rs
+++ b/src/parser/lexer.rs
@@ -278,7 +278,7 @@ pub enum MultiStringToken<'input> {
     #[regex("\"#+m")]
     CandidateEnd(&'input str),
     // Same as `FalseEnd` and `CandidateEnd` but for an interpolation sequence.
-    #[token("#+")]
+    #[regex("#+")]
     FalseInterpolation(&'input str),
     #[regex("#+\\{")]
     CandidateInterpolation(&'input str),


Test patch:
diff --git a/src/parser/tests.rs b/src/parser/tests.rs
index 048c5261..6bcb6a40 100644
--- a/src/parser/tests.rs
+++ b/src/parser/tests.rs
@@ -281,3 +281,16 @@ fn str_escape() {
         mk_single_chunk("#a#b#c#{d#"),
     );
 }
+
+/// Regression test for [#230](https://github.com/tweag/nickel/issues/230).
+#[test]
+fn multiline_str_escape() {
+    assert_eq!(
+        parse_without_pos(r##"m#"#Hel##lo###"#m"##),
+        mk_single_chunk("#Hel##lo###"),
+    );
+    assert_eq!(
+        parse_without_pos(r##"m#"#Hel##{lo###{"#m"##),
+        mk_single_chunk("#Hel##{lo###{"),
+    );
+}