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

Issue:
Day 202
Good morning! Here's your coding interview problem for today.

This problem was asked by Palantir.

Write a program that checks whether an integer is a palindrome. For example, 121 is a palindrome, as well as 888. 678 is not a palindrome. Do not convert the integer into a string.

Pull request:
Day202
Resolves #417.

Patch:
diff --git a/README.md b/README.md
index 2974ac2..15ae13e 100644
--- a/README.md
+++ b/README.md
@@ -212,3 +212,4 @@ problems from
 * [Day 199](https://github.com/vaskoz/dailycodingproblem-go/issues/409)
 * [Day 200](https://github.com/vaskoz/dailycodingproblem-go/issues/411)
 * [Day 201](https://github.com/vaskoz/dailycodingproblem-go/issues/415)
+* [Day 202](https://github.com/vaskoz/dailycodingproblem-go/issues/417)
diff --git a/day202/problem.go b/day202/problem.go
new file mode 100644
index 0000000..ba7c5e5
--- /dev/null
+++ b/day202/problem.go
@@ -0,0 +1,38 @@
+package day202
+
+// IsIntegerPalindrome returns true if the integer is a
+// palindrome.
+// Runs in O(digits) time and O(digits) space.
+func IsIntegerPalindrome(i int) bool {
+	var digits []int
+	for i != 0 {
+		digits = append(digits, i%10)
+		i /= 10
+	}
+	for i := 0; i < len(digits)/2; i++ {
+		if digits[i] != digits[len(digits)-1-i] {
+			return false
+		}
+	}
+	return true
+}
+
+// IsIntegerPalindromeFaster returns true if the integer is a
+// palindrome.
+// Runs in O(digits) time and O(1) space.
+func IsIntegerPalindromeFaster(i int) bool {
+	divisor := 1
+	for temp := i; temp/divisor > 10; divisor = divisor * 10 {
+	}
+	for i >= 10 {
+		highest := i / divisor
+		lowest := i % 10
+		if highest != lowest {
+			return false
+		}
+		i %= divisor
+		i /= 10
+		divisor /= 100
+	}
+	return true
+}


Test patch:
diff --git a/day202/problem_test.go b/day202/problem_test.go
new file mode 100644
index 0000000..b2ed366
--- /dev/null
+++ b/day202/problem_test.go
@@ -0,0 +1,49 @@
+package day202
+
+import "testing"
+
+var testcases = []struct {
+	num      int
+	expected bool
+}{
+	{888, true},
+	{121, true},
+	{678, false},
+	{123124234323, false},
+	{123454321, true},
+	{23455432, true},
+}
+
+func TestIsIntegerPalindrome(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := IsIntegerPalindrome(tc.num); result != tc.expected {
+			t.Errorf("For input %v, expected %v, got %v", tc.num, tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkIsIntegerPalindrome(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			IsIntegerPalindrome(tc.num)
+		}
+	}
+}
+
+func TestIsIntegerPalindromeFaster(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := IsIntegerPalindromeFaster(tc.num); result != tc.expected {
+			t.Errorf("For input %v, expected %v, got %v", tc.num, tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkIsIntegerPalindromeFaster(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			IsIntegerPalindromeFaster(tc.num)
+		}
+	}
+}
Repository: zh-lx/pinyin-pro (ts)

Issue:
开启拼音模式后，"乐"字在姓名中的读音也变了
代码：
  console.log(
    "不开启姓氏模式,曾乐的读音:",
    pinyin("曾乐", {
      toneType: "none",
    })
  );

  console.log(
    "开启姓氏模式,曾乐的读音:",
    pinyin("曾乐", {
      toneType: "none",
      mode: "surname",
    })
  );

结果：
不开启姓氏模式,曾乐的读音: ceng le
开启姓氏模式,曾乐的读音: zeng yue

试了一下其他姓氏也会这样

问：姓氏模式打开应该只会订正姓的读音，而不应该订正名字的读音？请问是否有这个功能呢


Pull request:
fix: 修复 surname:head 对于复姓开头不生效的问题
close #237 

Patch:
diff --git a/lib/common/segmentit/index.ts b/lib/common/segmentit/index.ts
index a8e8353..c297eb2 100644
--- a/lib/common/segmentit/index.ts
+++ b/lib/common/segmentit/index.ts
@@ -176,7 +176,7 @@ export class AC {
           if (surname === "off") {
             return item.priority !== Priority.Surname;
           } else if (surname === "head") {
-            return i === 0;
+            return item.length - 1 - i === 0;
           } else {
             return true;
           }
@@ -193,7 +193,7 @@ export class AC {
             if (surname === "off") {
               return item.priority !== Priority.Surname;
             } else if (surname === "head") {
-              return i === 0;
+              return item.length - 1 - i === 0;
             } else {
               return true;
             }


Test patch:
diff --git a/test/surname.test.js b/test/surname.test.js
index 41d8727..ace1f1d 100644
--- a/test/surname.test.js
+++ b/test/surname.test.js
@@ -46,4 +46,12 @@ describe("surname", () => {
       "zēng jīng cāng hǎi nán wèi shuǐ hǎo hǎo xué xí lè"
     );
   });
+
+  it("[surname]surname head double", () => {
+    const result = pinyin("令狐冲", { surname: "head" });
+    expect(result).to.be.equal("líng hú chōng");
+
+    const result1 = pinyin("万俟英", { surname: "head" });
+    expect(result1).to.be.equal("mò qí yīng");
+  });
 });
Repository: pytest-dev/pluggy (python)

Issue:
Remove manual kwargs-only check?
A little trivial issue.

The hookcaller `__call__` (e.g. `pm.hook.myhook(...)`) requires keyword-only arguments. This is currently checked manually:

https://github.com/pytest-dev/pluggy/blob/172ca9f59e8f1029ec734647b38ce4e2c4d7dba2/src/pluggy/_hooks.py#L384-L386

and provides a nice exception message (though it could be nicer...).

An alternative is to make the function itself kwargs-only:

```py
    def __call__(self, **kwargs: object) -> Any:
```

then Python itself checks it. This provides a worse exception message: `_HookCaller.__call__() takes 1 positional argument but 2 were given` (it's still possible to find the line which has the problem from the stacktrace).

On the other hand, the Python kwargs-only approach has the better typing (i.e. mypy will be able to catch bad usages), and removes the slight overhead of the check (likely not significant though).

I'm inclined to make the change but wonder if others agree.

Pull request:
Remove manual kwargs-only check in call
Fix #350.

Patch:
diff --git a/src/pluggy/_hooks.py b/src/pluggy/_hooks.py
index d38cece..8316115 100644
--- a/src/pluggy/_hooks.py
+++ b/src/pluggy/_hooks.py
@@ -381,9 +381,7 @@ class _HookCaller:
                     )
                     break
 
-    def __call__(self, *args: object, **kwargs: object) -> Any:
-        if args:
-            raise TypeError("hook calling supports only keyword arguments")
+    def __call__(self, **kwargs: object) -> Any:
         assert (
             not self.is_historic()
         ), "Cannot directly call a historic hook - use call_historic instead."


Test patch:
diff --git a/testing/test_invocations.py b/testing/test_invocations.py
index 03f53b5..0c31642 100644
--- a/testing/test_invocations.py
+++ b/testing/test_invocations.py
@@ -33,10 +33,10 @@ def test_only_kwargs(pm: PluginManager) -> None:
 
     pm.add_hookspecs(Api)
     with pytest.raises(TypeError) as exc:
-        pm.hook.hello(3)
+        pm.hook.hello(3)  # type: ignore[call-arg]
 
-    comprehensible = "hook calling supports only keyword arguments"
-    assert comprehensible in str(exc.value)
+    message = "__call__() takes 1 positional argument but 2 were given"
+    assert message in str(exc.value)
 
 
 def test_opt_in_args(pm: PluginManager) -> None: