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

Issue:
Day 285
Good morning! Here's your coding interview problem for today.

This problem was asked by Mailchimp.

You are given an array representing the heights of neighboring buildings on a city street, from east to west. The city assessor would like you to write an algorithm that returns how many of these buildings have a view of the setting sun, in order to properly value the street.

For example, given the array `[3, 7, 8, 3, 6, 1]`, you should return 3, since the top floors of the buildings with heights `8, 6, and 1` all have an unobstructed view to the west.

Can you do this using just one forward pass through the array?

Pull request:
Day285
Resolves #583.

Patch:
diff --git a/README.md b/README.md
index 5014d04..e9c79db 100644
--- a/README.md
+++ b/README.md
@@ -293,3 +293,4 @@ problems from
 * [Day 282](https://github.com/vaskoz/dailycodingproblem-go/issues/575)
 * [Day 283](https://github.com/vaskoz/dailycodingproblem-go/issues/577)
 * [Day 284](https://github.com/vaskoz/dailycodingproblem-go/issues/578)
+* [Day 285](https://github.com/vaskoz/dailycodingproblem-go/issues/583)
diff --git a/day285/problem.go b/day285/problem.go
new file mode 100644
index 0000000..eb4e811
--- /dev/null
+++ b/day285/problem.go
@@ -0,0 +1,20 @@
+package day285
+
+// SunsetViews returns the number of building with some amount
+// of sunset views.
+// Buildings are ordered from east to west.
+// Runs in O(N) time and O(1) space.
+func SunsetViews(buildingHeights []int) int {
+	if len(buildingHeights) == 0 {
+		return 0
+	}
+	sunsetViews := 1
+	shadow := buildingHeights[len(buildingHeights)-1]
+	for i := len(buildingHeights) - 2; i >= 0; i-- {
+		if buildingHeights[i] > shadow {
+			sunsetViews++
+			shadow = buildingHeights[i]
+		}
+	}
+	return sunsetViews
+}


Test patch:
diff --git a/day285/problem_test.go b/day285/problem_test.go
new file mode 100644
index 0000000..bbd03fd
--- /dev/null
+++ b/day285/problem_test.go
@@ -0,0 +1,30 @@
+package day285
+
+import "testing"
+
+// nolint
+var testcases = []struct {
+	buildingHeights []int
+	sunsetViews     int
+}{
+	{[]int{3, 7, 8, 3, 6, 1}, 3},
+	{nil, 0},
+	{[]int{}, 0},
+}
+
+func TestSunsetViews(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if sunsets := SunsetViews(tc.buildingHeights); sunsets != tc.sunsetViews {
+			t.Errorf("Expected %v, got %v", tc.sunsetViews, sunsets)
+		}
+	}
+}
+
+func BenchmarkSunsetViews(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			SunsetViews(tc.buildingHeights)
+		}
+	}
+}
Repository: svg/svgo (js)

Issue:
collapseGroups and "inherit" value 
For this file from the SVG Test suite: https://www.w3.org/Graphics/SVG/Test/20061213/svggen/color-prop-01-b.svg

svgo (specifically the `collapseGroups` plugin) removes the outermost `<g>` from this markup:

```svg
<g color="red">
	<g color="inherit" fill="none" stroke="none">
		<!-- inherit to check the property value, not the string, is being used -->
		<circle cx="130" cy="80" r="60" fill="currentColor"/>
		<circle cx="350" cy="80" r="60" stroke="currentColor" stroke-width="4"/>
	</g>
</g>
```

When the attribute is inheritable, and is present on the inner element, but has the value `inherit`, the attribute on the outer group should be maintained.

Pull request:
Fixes #915 for collapseGroups
When the inner element has the `inherit` value, overwrite with the value from the parent `<g>` element.

Patch:
diff --git a/plugins/collapseGroups.js b/plugins/collapseGroups.js
index f0a1343..6e38651 100644
--- a/plugins/collapseGroups.js
+++ b/plugins/collapseGroups.js
@@ -63,6 +63,8 @@ exports.fn = function(item) {
                                 inner.addAttr(attr);
                             } else if (attr.name == 'transform') {
                                 inner.attr(attr.name).value = attr.value + ' ' + inner.attr(attr.name).value;
+                            } else if (inner.hasAttr(attr.name, 'inherit')) {
+                                inner.attr(attr.name).value = attr.value;
                             } else if (
                                 attrsInheritable.indexOf(attr.name) < 0 &&
                                 !inner.hasAttr(attr.name, attr.value)


Test patch:
diff --git a/test/plugins/collapseGroups.15.svg b/test/plugins/collapseGroups.15.svg
new file mode 100644
index 0000000..411020c
--- /dev/null
+++ b/test/plugins/collapseGroups.15.svg
@@ -0,0 +1,17 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+	<g color="red">
+		<g color="inherit" fill="none" stroke="none">
+			<circle cx="130" cy="80" r="60" fill="currentColor"/>
+			<circle cx="350" cy="80" r="60" stroke="currentColor" stroke-width="4"/>
+		</g>
+	</g>
+</svg>
+
+@@@
+
+<svg xmlns="http://www.w3.org/2000/svg">
+    <g color="red" fill="none" stroke="none">
+        <circle cx="130" cy="80" r="60" fill="currentColor"/>
+        <circle cx="350" cy="80" r="60" stroke="currentColor" stroke-width="4"/>
+    </g>
+</svg>
\ No newline at end of file
Repository: goccy/go-yaml (go)

Issue:
cannot parse correctly when block string contains empty line
複数行文字列が空行を含む場合、空行で切られ、後続の部分がうまく処理されないです
https://play.golang.org/p/9Kdff4wBcP3

Pull request:
Fix handling of literal token include empty line
resolve #46 

Patch:
diff --git a/scanner/scanner.go b/scanner/scanner.go
index 47e9c88..fdcffe8 100644
--- a/scanner/scanner.go
+++ b/scanner/scanner.go
@@ -102,6 +102,9 @@ func (s *Scanner) isNeededKeepPreviousIndentNum(ctx *Context, c rune) bool {
 }
 
 func (s *Scanner) updateIndent(ctx *Context, c rune) {
+	if s.isFirstCharAtLine && c == '\n' && ctx.isDocument() {
+		return
+	}
 	if s.isFirstCharAtLine && c == ' ' {
 		s.indentNum++
 		return


Test patch:
diff --git a/parser/parser_test.go b/parser/parser_test.go
index c3cbc3b..5577f96 100644
--- a/parser/parser_test.go
+++ b/parser/parser_test.go
@@ -414,6 +414,24 @@ a:
     hoge
     fuga
     piyo
+`,
+		},
+		{
+			`
+a: |
+   bbbbbbb
+
+
+   ccccccc
+d: eeeeeeeeeeeeeeeee
+`,
+			`
+a: |
+   bbbbbbb
+
+
+   ccccccc
+d: eeeeeeeeeeeeeeeee
 `,
 		},
 	}
Repository: sanic-org/sanic-ext (python)

Issue:
[Feature Request] If `API_SCHEMES` is defined in config and is not a list, try to convert it into one
**Is your feature request related to a problem? Please describe your use case.**
Currently the config value for `API_SCHEMES` is interpreted as-is but is used as an iterable, which makes it hard to use when it is defined using environment variables, as these are always strings.
https://github.com/sanic-org/sanic-ext/blob/993d9d7e92efe90909af90d521a664bf742c8035/sanic_ext/extensions/openapi/blueprint.py#L161 

**Describe the solution you'd like**
It would be nice if, in cases in which it is a string, it would split the string automatically (maybe in `,`) to convert it into a list.

**Additional context**
N/A.


Pull request:
Add API_SCHEMES parsing
Closes #24 

Patch:
diff --git a/sanic_ext/extensions/openapi/blueprint.py b/sanic_ext/extensions/openapi/blueprint.py
index b02b749..612ab09 100644
--- a/sanic_ext/extensions/openapi/blueprint.py
+++ b/sanic_ext/extensions/openapi/blueprint.py
@@ -177,7 +177,10 @@ def add_static_info_to_spec_from_config(app, specification):
         getattr(app.config, "API_CONTACT_EMAIL", None),
     )
 
-    for scheme in getattr(app.config, "API_SCHEMES", ["http"]):
+    schemes = getattr(app.config, "API_SCHEMES", ["http"]) or ["http"]
+    if isinstance(schemes, str):
+        schemes = [s.strip() for s in schemes.split(",")]
+    for scheme in schemes:
         host = getattr(app.config, "API_HOST", None)
         basePath = getattr(app.config, "API_BASEPATH", "")
         if host is None or basePath is None:


Test patch:
diff --git a/tests/extensions/openapi/test_config.py b/tests/extensions/openapi/test_config.py
new file mode 100644
index 0000000..df47828
--- /dev/null
+++ b/tests/extensions/openapi/test_config.py
@@ -0,0 +1,34 @@
+import pytest
+
+from .utils import get_spec
+
+
+@pytest.mark.parametrize(
+    "schemes,expected",
+    (
+        (None, ("http://example.com/",)),
+        ("https", ("https://example.com/",)),
+        (
+            "http,https",
+            (
+                "http://example.com/",
+                "https://example.com/",
+            ),
+        ),
+        (
+            ["http", "https"],
+            (
+                "http://example.com/",
+                "https://example.com/",
+            ),
+        ),
+    ),
+)
+def test_config_scheme(app, schemes, expected):
+    app.config.API_SCHEMES = schemes
+    app.config.API_HOST = "example.com"
+
+    spec = get_spec(app)
+    urls = {s["url"] for s in spec["servers"]}
+
+    assert urls == set(expected)
Repository: blitz-js/superjson (ts)

Issue:
Serialized errors should not include `stack` by default
Currently stack is preserved for errors: https://github.com/blitz-js/superjson/blob/16cae250549e4822a22a014bb96597468dfff33f/src/transformer.ts#L110

Pull request:
Fix #108
Closes #108 

Patch:
diff --git a/src/transformer.ts b/src/transformer.ts
index aee8956..f195acc 100644
--- a/src/transformer.ts
+++ b/src/transformer.ts
@@ -107,7 +107,6 @@ const simpleRules = [
       const baseError: any = {
         name: v.name,
         message: v.message,
-        stack: v.stack,
       };
 
       allowedErrorProps.forEach(prop => {


Test patch:
diff --git a/src/index.test.ts b/src/index.test.ts
index 0a33c9c..18368a0 100644
--- a/src/index.test.ts
+++ b/src/index.test.ts
@@ -188,9 +188,6 @@ describe('stringify & parse', () => {
       output: ({ e }: any) => {
         expect(e.name).toBe('Error');
         expect(e.message).toBe('epic fail');
-        expect(e.stack.startsWith('Error: epic fail\n    at Suite.')).toBe(
-          true
-        );
       },
       outputAnnotations: {
         values: {
@@ -843,3 +840,19 @@ test('regression #95: no undefined', () => {
 
   expect(parsed).toEqual(input);
 });
+
+test('regression #108: Error#stack should not be included by default', () => {
+  const input = new Error("Beep boop, you don't wanna see me. I'm an error!");
+  expect(input).toHaveProperty('stack');
+
+  const { stack: thatShouldBeUndefined } = SuperJSON.parse(
+    SuperJSON.stringify(input)
+  ) as any;
+  expect(thatShouldBeUndefined).toBeUndefined();
+
+  SuperJSON.allowErrorProps('stack');
+  const { stack: thatShouldExist } = SuperJSON.parse(
+    SuperJSON.stringify(input)
+  ) as any;
+  expect(thatShouldExist).toEqual(input.stack);
+});
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 158
Good morning! Here's your coding interview problem for today.

This problem was asked by Slack.

You are given an N by M matrix of 0s and 1s. Starting from the top left corner, how many ways are there to reach the bottom right corner?

You can only move right and down. 0 represents an empty space while 1 represents a wall you cannot walk through.

For example, given the following matrix:
```
[[0, 0, 1],
 [0, 0, 1],
 [1, 0, 0]]
```
Return two, as there are only two ways to get to the bottom right:

Right, down, down, right
Down, right, down, right

The top left corner and bottom right corner will always be 0.

Pull request:
Day158
Resolves #329.

Patch:
diff --git a/README.md b/README.md
index 3cbba53..4d48781 100644
--- a/README.md
+++ b/README.md
@@ -168,3 +168,4 @@ problems from
 * [Day 155](https://github.com/vaskoz/dailycodingproblem-go/issues/322)
 * [Day 156](https://github.com/vaskoz/dailycodingproblem-go/issues/325)
 * [Day 157](https://github.com/vaskoz/dailycodingproblem-go/issues/327)
+* [Day 158](https://github.com/vaskoz/dailycodingproblem-go/issues/329)
diff --git a/day158/problem.go b/day158/problem.go
new file mode 100644
index 0000000..1d323f6
--- /dev/null
+++ b/day158/problem.go
@@ -0,0 +1,21 @@
+package day158
+
+// Maze is a matrix of walls and free space.
+// 1 - is a wall. 0 - is free space.
+type Maze [][]int
+
+// NumRoutesThruMaze returns the number of routes
+// from the upper-left to the bottom-right.
+func NumRoutesThruMaze(maze Maze) int {
+	return numRoutesThruMaze(maze, 0, 0)
+}
+
+func numRoutesThruMaze(maze Maze, row, col int) int {
+	if row >= len(maze) || col >= len(maze[0]) || maze[row][col] == 1 {
+		return 0
+	} else if row == len(maze)-1 && col == len(maze[row])-1 {
+		return 1
+	}
+	return numRoutesThruMaze(maze, row+1, col) +
+		numRoutesThruMaze(maze, row, col+1)
+}


Test patch:
diff --git a/day158/problem_test.go b/day158/problem_test.go
new file mode 100644
index 0000000..2beee44
--- /dev/null
+++ b/day158/problem_test.go
@@ -0,0 +1,31 @@
+package day158
+
+import "testing"
+
+var testcases = []struct {
+	maze     Maze
+	expected int
+}{
+	{[][]int{
+		{0, 0, 1},
+		{0, 0, 1},
+		{1, 0, 0},
+	}, 2},
+}
+
+func TestNumRoutesThruMaze(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := NumRoutesThruMaze(tc.maze); result != tc.expected {
+			t.Errorf("Expected %v got %v", tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkNumRoutesThruMaze(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			NumRoutesThruMaze(tc.maze)
+		}
+	}
+}