PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: sindresorhus/dot-prop (js)

Issue:
get() method's switch to object.prototype.propertyIsEnumerable broke my code
<!-- Issuehunt Badges -->

[<img alt="Issuehunt badges" src="https://issuehunt.io/r/sindresorhus/dot-prop/issues/46/badge.svg" />](https://issuehunt.io/r/sindresorhus/dot-prop/issues/46)

<!-- /Issuehunt Badges -->

This change was made in July 2016:

    use `object.prototype.propertyIsEnumerable instead of `Object.getOwnPropertyDescriptor`

Unfortunately, this change broke my code. Specifically, I was using it like this in the [Express](http://expressjs.com/) framework:

    dot = require( "dot-prop" );
    req.app.locals.foo = 1;
    console.log( "foo = " + dot.get( req, "app.locals.foo" ) );

where the `req` object is defined [here](http://expressjs.com/en/4x/api.html#req).

Before this change, `foo = 1` was logged.
After this change, `foo = undefined` was logged.

The problem appears to be that `req.app` isn't an enumerable property because it is an **inherited** property.

So, here's my question: why are we discriminating against inherited properties inside the `get()` method? That doesn't seem right to me.
<!-- Issuehunt content -->



> There is a $40.00 open bounty on this issue. Add more on [Issuehunt](https://issuehunt.io/r/sindresorhus/dot-prop/issues/46).
> - Checkout the [Issuehunt explorer](https://issuehunt.io/r/sindresorhus/dot-prop/) to discover more funded issues.
> - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on Issuehunt to raise funds.


<!-- /Issuehunt content-->

Pull request:
Allow getting non-enumerable properties
Changes the way to check property for enumerability, fixes #46 

Patch:
diff --git a/index.js b/index.js
index a90f599..74a7a61 100644
--- a/index.js
+++ b/index.js
@@ -43,10 +43,6 @@ module.exports = {
 		}
 
 		for (let i = 0; i < pathArray.length; i++) {
-			if (!Object.prototype.propertyIsEnumerable.call(object, pathArray[i])) {
-				return value;
-			}
-
 			object = object[pathArray[i]];
 
 			if (object === undefined || object === null) {


Test patch:
diff --git a/test.js b/test.js
index a33361f..d9731b7 100644
--- a/test.js
+++ b/test.js
@@ -30,8 +30,8 @@ test('get', t => {
 		value: 'bar',
 		enumerable: false
 	});
-	t.is(dotProp.get(fixture2, 'foo'), undefined);
-	t.is(dotProp.get({}, 'hasOwnProperty'), undefined);
+	t.is(dotProp.get(fixture2, 'foo'), 'bar');
+	t.is(dotProp.get({}, 'hasOwnProperty'), Object.prototype.hasOwnProperty);
 
 	function fn() {}
 	fn.foo = {bar: 1};
@@ -50,6 +50,11 @@ test('get', t => {
 	t.false(dotProp.get('foo', 'foo.bar', false));
 	t.false(dotProp.get([], 'foo.bar', false));
 	t.false(dotProp.get(undefined, 'foo.bar', false));
+
+	class F4Class {}
+	F4Class.prototype.foo = 1;
+	const f4 = new F4Class();
+	t.is(dotProp.get(f4, 'foo'), 1); // #46
 });
 
 test('set', t => {
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 377
Good morning! Here's your coding interview problem for today.

This problem was asked by Microsoft.

Given an array of numbers arr and a window of size `k`, print out the median of each window of size `k` starting from the left and moving right by one position each time.

For example, given the following array and `k = 3`:
```
[-1, 5, 13, 8, 2, 3, 3, 1]
```
Your function should print out the following:
```
5 <- median of [-1, 5, 13]
8 <- median of [5, 13, 8]
8 <- median of [13, 8, 2]
3 <- median of [8, 2, 3]
3 <- median of [2, 3, 3]
3 <- median of [3, 3, 1]
```
**Recall that the median of an even-sized list is the average of the two middle numbers.**

Pull request:
Day377
Resolves #760.

Patch:
diff --git a/README.md b/README.md
index 216311c..376991b 100644
--- a/README.md
+++ b/README.md
@@ -372,4 +372,5 @@ problems from
 * [Day 374](https://github.com/vaskoz/dailycodingproblem-go/issues/754)
 * [Day 375](https://github.com/vaskoz/dailycodingproblem-go/issues/756)
 * [Day 376](https://github.com/vaskoz/dailycodingproblem-go/issues/758)
+* [Day 377](https://github.com/vaskoz/dailycodingproblem-go/issues/760)
 
diff --git a/day377/problem.go b/day377/problem.go
new file mode 100644
index 0000000..ffa2885
--- /dev/null
+++ b/day377/problem.go
@@ -0,0 +1,24 @@
+package day377
+
+import "sort"
+
+// BruteKMedians calculates the median of every k-sized
+// window using brute force.
+// It runs in O(N*K log K).
+func BruteKMedians(nums []float64, k int) []float64 {
+	ans := make([]float64, 0, len(nums)-k)
+	window := make([]float64, k)
+
+	for i := 0; i <= len(nums)-k; i++ {
+		copy(window, nums[i:k+i])
+		sort.Float64s(window)
+
+		if k%2 == 0 {
+			ans = append(ans, (window[k/2]+window[(k/2)-1])/2)
+		} else {
+			ans = append(ans, window[k/2])
+		}
+	}
+
+	return ans
+}


Test patch:
diff --git a/day377/problem_test.go b/day377/problem_test.go
new file mode 100644
index 0000000..f2b2748
--- /dev/null
+++ b/day377/problem_test.go
@@ -0,0 +1,42 @@
+package day377
+
+import (
+	"reflect"
+	"testing"
+)
+
+// nolint
+var testcases = []struct {
+	input    []float64
+	k        int
+	expected []float64
+}{
+	{
+		[]float64{-1, 5, 13, 8, 2, 3, 3, 1},
+		3,
+		[]float64{5, 8, 8, 3, 3, 3},
+	},
+	{
+		[]float64{-1, 5, 13, 8, 2, 3, 3, 1},
+		4,
+		[]float64{6.5, 6.5, 5.5, 3, 2.5},
+	},
+}
+
+func TestBruteKMedians(t *testing.T) {
+	t.Parallel()
+
+	for _, tc := range testcases {
+		if result := BruteKMedians(tc.input, tc.k); !reflect.DeepEqual(result, tc.expected) {
+			t.Errorf("Expected %v, got %v", tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkBruteKMedians(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			BruteKMedians(tc.input, tc.k)
+		}
+	}
+}