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

Issue:
Day 203
Good morning! Here's your coding interview problem for today.

This problem was asked by Uber.

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. Find the minimum element in O(log N) time. You may assume the array does not contain duplicates.

For example, given `[5, 7, 10, 3, 4]`, return `3`.

Pull request:
Day203
Resolves #419.

Patch:
diff --git a/README.md b/README.md
index 15ae13e..503807c 100644
--- a/README.md
+++ b/README.md
@@ -213,3 +213,4 @@ problems from
 * [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)
+* [Day 203](https://github.com/vaskoz/dailycodingproblem-go/issues/419)
diff --git a/day203/problem.go b/day203/problem.go
new file mode 100644
index 0000000..7c8c485
--- /dev/null
+++ b/day203/problem.go
@@ -0,0 +1,17 @@
+package day203
+
+// FindSmallestOnRotated is binary search for the smallest value
+// on a sorted but rotated slice.
+// Runs in O(log N) time and O(1) space.
+func FindSmallestOnRotated(nums []int) int {
+	left, right := 0, len(nums)-1
+	for left < right {
+		mid := (left + right) / 2
+		if nums[mid] < nums[right] {
+			right = mid
+		} else {
+			left = mid + 1
+		}
+	}
+	return nums[left]
+}


Test patch:
diff --git a/day203/problem_test.go b/day203/problem_test.go
new file mode 100644
index 0000000..7b22cba
--- /dev/null
+++ b/day203/problem_test.go
@@ -0,0 +1,32 @@
+package day203
+
+import "testing"
+
+var testcases = []struct {
+	nums     []int
+	smallest int
+}{
+	{[]int{5, 7, 10, 3, 4}, 3},
+	{[]int{3, 4, 5, 7, 10}, 3},
+	{[]int{10, 3, 4, 5, 7}, 3},
+	{[]int{7, 10, 3, 4, 5}, 3},
+	{[]int{4, 5, 7, 10, 3}, 3},
+	{[]int{4, 4, 4, 4, 3}, 3},
+}
+
+func TestFindSmallestOnRotated(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if smallest := FindSmallestOnRotated(tc.nums); smallest != tc.smallest {
+			t.Errorf("Expected %v, got %v", tc.smallest, smallest)
+		}
+	}
+}
+
+func BenchmarkFindSmallestOnRotated(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			FindSmallestOnRotated(tc.nums)
+		}
+	}
+}
Repository: capricorn86/happy-dom (ts)

Issue:
direct write document.title does not work
**Describe the bug**
I use `document.title = 'title'`, but this does not work.

**To Reproduce**
Steps to reproduce the behavior:
1. open https://stackblitz.com/edit/node-jyhhtp?file=package.json,index.mjs
2. run `node index.mjs`

**Expected behavior**
described in the link above.

**Device:**
 - nodejs v16.14.2



Pull request:
#785@minor: Add document.title.
close #785 

Patch:
diff --git a/packages/happy-dom/src/nodes/document/Document.ts b/packages/happy-dom/src/nodes/document/Document.ts
index 3518766f..4b09e7e3 100644
--- a/packages/happy-dom/src/nodes/document/Document.ts
+++ b/packages/happy-dom/src/nodes/document/Document.ts
@@ -227,6 +227,34 @@ export default class Document extends Node implements IDocument {
 		return charset ? charset : 'UTF-8';
 	}
 
+	/**
+	 * Returns title.
+	 *
+	 * @returns Title.
+	 */
+	public get title(): string {
+		const el = this.querySelector('title');
+		if (el) {
+			return el.textContent;
+		}
+		return '';
+	}
+
+	/**
+	 * Returns set title.
+	 *
+	 */
+	public set title(title: string) {
+		const el = this.querySelector('title');
+		if (el) {
+			el.textContent = title;
+		} else {
+			const titleEl = this.createElement('title');
+			titleEl.textContent = title;
+			this.head.appendChild(titleEl);
+		}
+	}
+
 	/**
 	 * Last element child.
 	 *
diff --git a/packages/happy-dom/src/nodes/document/IDocument.ts b/packages/happy-dom/src/nodes/document/IDocument.ts
index 56e16eb0..b345a341 100644
--- a/packages/happy-dom/src/nodes/document/IDocument.ts
+++ b/packages/happy-dom/src/nodes/document/IDocument.ts
@@ -45,6 +45,7 @@ export default interface IDocument extends IParentNode {
 	readonly visibilityState: VisibilityStateEnum;
 	readonly hidden: boolean;
 	cookie: string;
+	title: string;
 
 	// Events
 	onreadystatechange: (event: Event) => void;


Test patch:
diff --git a/packages/happy-dom/test/nodes/document/Document.test.ts b/packages/happy-dom/test/nodes/document/Document.test.ts
index ce9730d1..d1509e41 100644
--- a/packages/happy-dom/test/nodes/document/Document.test.ts
+++ b/packages/happy-dom/test/nodes/document/Document.test.ts
@@ -228,6 +228,20 @@ describe('Document', () => {
 		});
 	});
 
+	describe('get title() and set title()', () => {
+		it('Returns and sets title.', () => {
+			document.title = 'test title';
+			expect(document.title).toBe('test title');
+			const title = document.head.querySelector('title');
+			expect(title.textContent).toBe('test title');
+			document.title = 'new title';
+			expect(document.title).toBe('new title');
+			expect(title.textContent).toBe('new title');
+			title.textContent = 'new title 2';
+			expect(document.title).toBe('new title 2');
+		});
+	});
+
 	describe('get body()', () => {
 		it('Returns <body> element.', () => {
 			expect(document.body === document.children[0].children[1]).toBe(true);
Repository: delvedor/find-my-way (js)

Issue:
httpMethods is a snapshot from Node 18.12.0 meaning methods from newer versions are unsupported
Why this has been done rather than using `http.METHODS`?

Pull request:
fix: add QUERY to httpMethods which was added in Node 22.2.0
fixes #379 

Patch:
diff --git a/lib/http-methods.js b/lib/http-methods.js
index 39e340e..c681f7a 100644
--- a/lib/http-methods.js
+++ b/lib/http-methods.js
@@ -1,11 +1,11 @@
 'use strict'
 
-// defined by Node.js http module, a snapshot from Node.js 18.12.0
+// defined by Node.js http module, a snapshot from Node.js 22.9.0
 const httpMethods = [
   'ACL', 'BIND', 'CHECKOUT', 'CONNECT', 'COPY', 'DELETE',
   'GET', 'HEAD', 'LINK', 'LOCK', 'M-SEARCH', 'MERGE',
   'MKACTIVITY', 'MKCALENDAR', 'MKCOL', 'MOVE', 'NOTIFY', 'OPTIONS',
-  'PATCH', 'POST', 'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT',
+  'PATCH', 'POST', 'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT', 'QUERY',
   'REBIND', 'REPORT', 'SEARCH', 'SOURCE', 'SUBSCRIBE', 'TRACE',
   'UNBIND', 'UNLINK', 'UNLOCK', 'UNSUBSCRIBE'
 ]


Test patch:
diff --git a/test/pretty-print.test.js b/test/pretty-print.test.js
index 50f622c..c265350 100644
--- a/test/pretty-print.test.js
+++ b/test/pretty-print.test.js
@@ -673,8 +673,8 @@ test('pretty print - print all methods', t => {
 └── /
     └── test (ACL, BIND, CHECKOUT, CONNECT, COPY, DELETE, GET, HEAD, LINK, LOCK, \
 M-SEARCH, MERGE, MKACTIVITY, MKCALENDAR, MKCOL, MOVE, NOTIFY, OPTIONS, PATCH, \
-POST, PROPFIND, PROPPATCH, PURGE, PUT, REBIND, REPORT, SEARCH, SOURCE, SUBSCRIBE, \
-TRACE, UNBIND, UNLINK, UNLOCK, UNSUBSCRIBE)
+POST, PROPFIND, PROPPATCH, PURGE, PUT, QUERY, REBIND, REPORT, SEARCH, SOURCE, \
+SUBSCRIBE, TRACE, UNBIND, UNLINK, UNLOCK, UNSUBSCRIBE)
 `
   t.equal(typeof tree, 'string')
   t.equal(tree, expected)
Repository: fredrikekre/Runic.jl (julia)

Issue:
Runic breaks unpacking of only the first element of a tuple
```julia
julia> Runic.format_string("x, = (1, 2, 3)")
"x = (1, 2, 3)"
```
That is, of course, not equivalent:
```julia
julia> x, = (1, 2, 3); x
1

julia> x = (1, 2, 3); x
(1, 2, 3)
```

Pull request:
This patch fixes the usage of trailing commas in implicit tuples when used in destructuring assignment, e.g. `x, = z`. In this context the trailing comma is needed to preserve the tuple node, which is different from e.g. implicit tuples in `do`-blocks. A trailing comma is allowed (e.g. preserved from the source) for multi-item implicit tuples so that e.g. `x, y, = z` can be used to signal that z contains more than two items. Closes #58.

Patch:
diff --git a/src/runestone.jl b/src/runestone.jl
index c1b4956..00dbabc 100644
--- a/src/runestone.jl
+++ b/src/runestone.jl
@@ -308,6 +308,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
         if opening_leaf_idx === nothing
             # Implicit tuple without (), for example arguments in a do-block
             implicit_tuple = true
+            @assert kind(node) === K"tuple"
             opening_leaf_idx = findfirst(!JuliaSyntax.is_whitespace, kids)
             if opening_leaf_idx === nothing
                 # All whitespace... return?
@@ -366,7 +367,13 @@ function spaces_in_listlike(ctx::Context, node::Node)
     if kind(node) in KSet"call dotcall macrocall"
         require_trailing_comma = false
     elseif implicit_tuple
-        require_trailing_comma = false
+        # Trailing commas in implicit tuples in the LHS of an assignment, e.g. `x, = 1, 2`,
+        # is required for single item tuples and allowed for multiple items (to allow e.g.
+        # `x, y, = z` signaling that z contains more items).
+        # Note that an implicit single item tuple can never(?) end up on the RHS so there is
+        # no need to make sure this is the LHS node.
+        require_trailing_comma = n_items == 1 && ctx.lineage_kinds[end] === K"="
+        allow_trailing_comma = ctx.lineage_kinds[end] === K"="
     elseif kind(node) === K"tuple" && n_items == 1 && ctx.lineage_kinds[end] !== K"function" &&
             kind(kids[first_item_idx::Int]) !== K"parameters"
         # TODO: May also have to check for K"where" and K"::" in the lineage above


Test patch:
diff --git a/test/runtests.jl b/test/runtests.jl
index c32586d..a0943d4 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -824,6 +824,10 @@ end
         # implicit tuple
         @test format_string("a,\n$(sp)b") == "a,\n    b"
         @test format_string("a,\n$(sp)b + \nb") == "a,\n    b +\n    b"
+        # implicit tuple in destructuring (LHS of K"=")
+        @test format_string("a,$(sp)=$(sp)z") == "a, = z"
+        @test format_string("a,$(sp)b$(sp)=$(sp)z") == "a, b = z"
+        @test format_string("a,$(sp)b$(sp),$(sp)=$(sp)z") == "a, b, = z"
         # K"cartesian_iterator"
         @test format_string("for i in I,\n$(sp)j in J\n# body\nend") ==
             "for i in I,\n        j in J\n    # body\nend"