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

Issue:
Day 296
Good morning! Here's your coding interview problem for today.

This problem was asked by Etsy.

Given a sorted array, convert it into a height-balanced binary search tree.

Pull request:
Day296
Resolves #605.

Patch:
diff --git a/README.md b/README.md
index 70851d2..2534731 100644
--- a/README.md
+++ b/README.md
@@ -303,3 +303,4 @@ problems from
 * [Day 291](https://github.com/vaskoz/dailycodingproblem-go/issues/596)
 * [Day 294](https://github.com/vaskoz/dailycodingproblem-go/issues/600)
 * [Day 295](https://github.com/vaskoz/dailycodingproblem-go/issues/601)
+* [Day 296](https://github.com/vaskoz/dailycodingproblem-go/issues/605)
diff --git a/day296/problem.go b/day296/problem.go
new file mode 100644
index 0000000..f7ecf0f
--- /dev/null
+++ b/day296/problem.go
@@ -0,0 +1,19 @@
+package day296
+
+// BST is a binary search tree of integers.
+type BST struct {
+	Value       int
+	Left, Right *BST
+}
+
+// SortedSliceToBST constructs a BST from a sorted slice of ints.
+func SortedSliceToBST(sorted []int) *BST {
+	if len(sorted) == 0 {
+		return nil
+	}
+	mid := len(sorted) / 2
+	root := &BST{Value: sorted[mid]}
+	root.Left = SortedSliceToBST(sorted[:mid])
+	root.Right = SortedSliceToBST(sorted[mid+1:])
+	return root
+}


Test patch:
diff --git a/day296/problem_test.go b/day296/problem_test.go
new file mode 100644
index 0000000..29bf378
--- /dev/null
+++ b/day296/problem_test.go
@@ -0,0 +1,57 @@
+package day296
+
+import "testing"
+
+// nolint
+var testcases = []struct {
+	sorted   []int
+	expected *BST
+}{
+	{
+		[]int{1, 2, 3, 4, 5, 6, 7},
+		&BST{
+			4,
+			&BST{
+				2,
+				&BST{Value: 1},
+				&BST{Value: 3},
+			},
+			&BST{
+				6,
+				&BST{Value: 5},
+				&BST{Value: 7},
+			},
+		},
+	},
+}
+
+func TestSortedSliceToBST(t *testing.T) {
+	t.Parallel()
+	for tcid, tc := range testcases {
+		if result := SortedSliceToBST(tc.sorted); !equal(tc.expected, result) {
+			t.Errorf("BSTs don't match in TCID%d", tcid)
+		}
+	}
+}
+
+func BenchmarkSortedSliceToBST(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			SortedSliceToBST(tc.sorted)
+		}
+	}
+}
+
+func equal(a, b *BST) bool {
+	switch {
+	case a == nil && b != nil:
+		return false
+	case a != nil && b == nil:
+		return false
+	case a == nil && b == nil:
+		return true
+	case a.Value != b.Value:
+		return false
+	}
+	return equal(a.Left, b.Left) && equal(a.Right, b.Right)
+}
Repository: goccy/go-yaml (go)

Issue:
Cannot detect it is multiline string or object
Related to: #75 (fixed by #78)

if the receiver type is `interface{}` and unmarshaling with `UnmarshalYAML([]byte)`, it seems impossible to detect it is multiline string or object.

e.g. the `value` in https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/api-with-examples.yaml#L18 and the `value` in https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/api-with-examples.yaml#L51 have same type but the result of unmarshal is not same, they are defined as `interface{}` and former one should be unmarshaled to `map[string]interface{}`, later one should unmarshaled to `string`

before #78, the passed bytes contains `|` at first character so we could detect it is string or object

is there any way to detect? (or, should revert the change?)

Pull request:
Fix decoding for literal with BytesUnmarshaler
resolve #89

Add `|` header to string for decoding literal

Patch:
diff --git a/ast/ast.go b/ast/ast.go
index 1a88f2e..df51140 100644
--- a/ast/ast.go
+++ b/ast/ast.go
@@ -472,7 +472,7 @@ func (n *LiteralNode) AddColumn(col int) {
 
 // GetValue returns string value
 func (n *LiteralNode) GetValue() interface{} {
-	return n.Value.GetValue()
+	return n.String()
 }
 
 // String literal to text


Test patch:
diff --git a/decode_test.go b/decode_test.go
index 1dfeb6b..254ab30 100644
--- a/decode_test.go
+++ b/decode_test.go
@@ -1585,3 +1585,35 @@ func TestUnmarshalablePtrInt(t *testing.T) {
 		}
 	})
 }
+
+type literalContainer struct {
+	v string
+}
+
+func (c *literalContainer) UnmarshalYAML(v []byte) error {
+	var lit string
+	if err := yaml.Unmarshal(v, &lit); err != nil {
+		return err
+	}
+	c.v = lit
+	return nil
+}
+
+func TestDecode_Literal(t *testing.T) {
+	yml := `---
+value: |
+  {
+     "key": "value"
+  }
+`
+	var v map[string]*literalContainer
+	if err := yaml.Unmarshal([]byte(yml), &v); err != nil {
+		t.Fatalf("failed to unmarshal %+v", err)
+	}
+	if v["value"] == nil {
+		t.Fatal("failed to unmarshal literal with bytes unmarshaler")
+	}
+	if v["value"].v == "" {
+		t.Fatal("failed to unmarshal literal with bytes unmarshaler")
+	}
+}
Repository: fgnass/node-dev (js)

Issue:
Don't set NODE_ENV
Hey @fgnass (and contributors), great ongoing work. We've been using node-dev for several years now and it's been awesome.

We just updated after a long time, and we hit the same issue with node-dev now setting `NODE_ENV` that @gasi did in https://github.com/fgnass/node-dev/issues/62#issuecomment-131992922.

It sounded like you agreed that node-dev should just not set `NODE_ENV` at all, since the caller who's calling `node-dev` can always set any environment variable they want. (Put another way, `NODE_ENV=development` doesn't tell you you're running in node-dev, so it's not serving that purpose. Instead, it's just assuming that code wants to set `NODE_ENV` by default, and to `development`.)

If that's still the case, I wanted to open this issue to capture this request. Would be great to have node-dev no longer set `NODE_ENV`! Thanks for your consideration. =)


Pull request:
Do not set NODE_ENV to development when it is unset
Fixes #133

Patch:
diff --git a/lib/wrap.js b/lib/wrap.js
index 7a7ed91..e54c7a0 100755
--- a/lib/wrap.js
+++ b/lib/wrap.js
@@ -14,9 +14,6 @@ var main = resolveMain(process.argv[1]);
 
 var cfg = require('./cfg')(main);
 
-// Set NODE_ENV to 'development' unless already set
-if (!process.env.NODE_ENV) process.env.NODE_ENV = 'development';
-
 if (process.env.NODE_DEV_PRELOAD) {
   require(process.env.NODE_DEV_PRELOAD);
 }


Test patch:
diff --git a/test/spawn.js b/test/spawn.js
index 600b51a..7f75c7f 100644
--- a/test/spawn.js
+++ b/test/spawn.js
@@ -117,9 +117,9 @@ tap.test('should kill the forked processes', function (t) {
   });
 });
 
-tap.test('should set NODE_ENV', function (t) {
+tap.test('should *not* set NODE_ENV', function (t) {
   spawn('env.js', function (out) {
-    t.like(out, /development/);
+    t.notLike(out, /development/);
     return { exit: t.end.bind(t) };
   });
 });