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

Issue:
Day 135
Good morning! Here's your coding interview problem for today.

This question was asked by Apple.

Given a binary tree, find a minimum path sum from root to a leaf.

For example, the minimum path in this tree is `[10, 5, 1, -1]`, which has sum `15`.
```
  10
 /  \
5    5
 \     \
   2    1
       /
     -1
```

Pull request:
Day135
Resolves #280.

Patch:
diff --git a/README.md b/README.md
index 565b564..451ceb1 100644
--- a/README.md
+++ b/README.md
@@ -143,3 +143,4 @@ problems from
 * [Day 132](https://github.com/vaskoz/dailycodingproblem-go/issues/272)
 * [Day 133](https://github.com/vaskoz/dailycodingproblem-go/issues/275)
 * [Day 134](https://github.com/vaskoz/dailycodingproblem-go/issues/278)
+* [Day 135](https://github.com/vaskoz/dailycodingproblem-go/issues/280)
diff --git a/day135/problem.go b/day135/problem.go
new file mode 100644
index 0000000..4764992
--- /dev/null
+++ b/day135/problem.go
@@ -0,0 +1,30 @@
+package day135
+
+// BinaryTree is a binary tree.
+type BinaryTree struct {
+	Value       int
+	Left, Right *BinaryTree
+}
+
+// MinPathSum returns the sum of the minimum sum path from root to leaf.
+func MinPathSum(head *BinaryTree) int {
+	if head.Left == nil && head.Right == nil {
+		return head.Value
+	}
+	if head.Left != nil && head.Right != nil {
+		left := head.Value + MinPathSum(head.Left)
+		right := head.Value + MinPathSum(head.Right)
+		return min(left, right)
+	} else if head.Left != nil {
+		return head.Value + MinPathSum(head.Left)
+	} else {
+		return head.Value + MinPathSum(head.Right)
+	}
+}
+
+func min(a, b int) int {
+	if a < b {
+		return a
+	}
+	return b
+}


Test patch:
diff --git a/day135/problem_test.go b/day135/problem_test.go
new file mode 100644
index 0000000..122c484
--- /dev/null
+++ b/day135/problem_test.go
@@ -0,0 +1,34 @@
+package day135
+
+import "testing"
+
+var testcases = []struct {
+	tree   *BinaryTree
+	minSum int
+}{
+	{&BinaryTree{10,
+		&BinaryTree{5, nil, &BinaryTree{2, nil, nil}},
+		&BinaryTree{5, nil, &BinaryTree{1, &BinaryTree{-1, nil, nil}, nil}},
+	}, 15},
+	{&BinaryTree{10,
+		&BinaryTree{5, nil, &BinaryTree{1, &BinaryTree{-1, nil, nil}, nil}},
+		&BinaryTree{5, nil, &BinaryTree{2, nil, nil}},
+	}, 15},
+}
+
+func TestMinPathSum(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := MinPathSum(tc.tree); result != tc.minSum {
+			t.Errorf("Expected %v got %v", tc.minSum, result)
+		}
+	}
+}
+
+func BenchmarkMinPathSum(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			MinPathSum(tc.tree)
+		}
+	}
+}
Repository: alicebob/miniredis (go)

Issue:
ZINTERSTORE does not store values if the destination is used in intersection
Redis behaviour:
```
redis> ZADD zset1 1 "one"
(integer) 1
redis> ZADD zset1 2 "two"
(integer) 1
redis> ZADD zset2 1 "one"
(integer) 1
redis> ZADD zset2 2 "two"
(integer) 1
redis> ZADD zset2 3 "three"
(integer) 1
redis> ZINTERSTORE zset1 2 zset1 zset2 WEIGHTS 2 3
(integer) 2
redis> ZRANGE zset1 0 -1 WITHSCORES
1) "one"
2) "5"
3) "two"
4) "10"
```
miniredis behaviour:
```
redis> ZADD zset1 1 "one"
(integer) 1
redis> ZADD zset1 2 "two"
(integer) 1
redis> ZADD zset2 1 "one"
(integer) 1
redis> ZADD zset2 2 "two"
(integer) 1
redis> ZADD zset2 3 "three"
(integer) 1
redis> ZINTERSTORE zset1 2 zset1 zset2 WEIGHTS 2 3
(integer) 0
redis> ZRANGE zset1 0 -1 WITHSCORES
(empty array)
```
As you can see, the INTERSTORE command does not store the intersected values into the destination `zset1`, if the destination was also used as one of the ZSTORE argumenets.

Pull request:
fix ZINTERSTORE where target is one of the source sets
fixes #378

Patch:
diff --git a/cmd_sorted_set.go b/cmd_sorted_set.go
index ab943ad..e92c82a 100644
--- a/cmd_sorted_set.go
+++ b/cmd_sorted_set.go
@@ -433,9 +433,6 @@ func (m *Miniredis) makeCmdZinter(store bool) func(c *server.Peer, cmd string, a
 
 		withTx(m, c, func(c *server.Peer, ctx *connCtx) {
 			db := m.db(ctx.selectedDB)
-			if opts.Store {
-				db.del(opts.Destination, true)
-			}
 
 			// We collect everything and remove all keys which turned out not to be
 			// present in every set.
@@ -493,6 +490,7 @@ func (m *Miniredis) makeCmdZinter(store bool) func(c *server.Peer, cmd string, a
 
 			if opts.Store {
 				// ZINTERSTORE mode
+				db.del(opts.Destination, true)
 				db.ssetSet(opts.Destination, sset)
 				c.WriteInt(len(sset))
 				return


Test patch:
diff --git a/integration/sorted_set_test.go b/integration/sorted_set_test.go
index 60cc9c1..79ff45b 100644
--- a/integration/sorted_set_test.go
+++ b/integration/sorted_set_test.go
@@ -854,6 +854,11 @@ func TestZinter(t *testing.T) {
 		c.Do("ZINTERSTORE", "dest", "2", "q1", "q2")
 		c.Do("ZRANGE", "dest", "0", "-1", "withscores")
 
+		// store into self
+		c.Do("ZINTERSTORE", "q1", "2", "q1", "q2")
+		c.Do("ZRANGE", "q1", "0", "-1", "withscores")
+		c.Do("SMEMBERS", "q2")
+
 		// Error cases
 		c.Error("wrong number", "ZINTERSTORE")
 		c.Error("wrong number", "ZINTERSTORE", "h")
Repository: validatorjs/validator.js (js)

Issue:
isMobilePhone with locale es-CU matches numbers of any length > 8 when the number starts with 5
**Describe the bug**
`isMobilePhone` with locale es-CU matches any string that start with a 5 followed by at least 7 digits. This is because that locale's [regex is missing the end of line matcher](https://github.com/validatorjs/validator.js/blob/master/src/lib/isMobilePhone.js#L79)


**Examples**
Repl.it demo: https://replit.com/join/vcsakenqug-klaframboise1
<img width="1440" alt="Screenshot 2023-03-03 at 3 51 07 PM" src="https://user-images.githubusercontent.com/6961215/222827052-2e31ebab-660a-48ad-bf63-fbab35d44df6.png">


**Additional context**
Validator.js version: 13.9.0
Node.js version: 18.12.1
OS platform: linux + macOS


Pull request:
fix(isMobilePhone): fixed es-CU matching all numbers that start with 5 longer than 8 digits
fixes #2196 

This MR fixes the es-CU locale isMobilePhone regex by adding the missing end of line matcher.

## Checklist

- [x] PR contains only changes related; no stray files, etc.
- [x] README updated (where applicable)
- [x] Tests written (where applicable)
- [x] References provided in PR (where applicable)


Patch:
diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js
index c6ded55..a901a94 100644
--- a/src/lib/isMobilePhone.js
+++ b/src/lib/isMobilePhone.js
@@ -76,7 +76,7 @@ const phones = {
   'es-CO': /^(\+?57)?3(0(0|1|2|4|5)|1\d|2[0-4]|5(0|1))\d{7}$/,
   'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/,
   'es-CR': /^(\+506)?[2-8]\d{7}$/,
-  'es-CU': /^(\+53|0053)?5\d{7}/,
+  'es-CU': /^(\+53|0053)?5\d{7}$/,
   'es-DO': /^(\+?1)?8[024]9\d{7}$/,
   'es-HN': /^(\+?504)?[9|8|3|2]\d{7}$/,
   'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/,


Test patch:
diff --git a/test/validators.test.js b/test/validators.test.js
index 239f172..6816a3b 100644
--- a/test/validators.test.js
+++ b/test/validators.test.js
@@ -8296,6 +8296,7 @@ describe('Validators', () => {
           '',
           'abc',
           '+535123457',
+          '56043029304',
         ],
       },
       {
Repository: segmentio/encoding (go)

Issue:
json: Go 1.16 allows for ; in json tags
https://golang.org/doc/go1.16#encoding/json

```
package main

import (
	"encoding/json"
	"fmt"

	sjson "github.com/segmentio/encoding/json"
)

type S struct {
	F string `json:"a;b"`
}

func main() {
	data := []byte(`{"a;b": "hello"}`)

	var s1 S
	err1 := json.Unmarshal(data, &s1)
	fmt.Printf("stdlib: err=%s s=%s\n", err1, s1)

	var s2 S
	err2 := sjson.Unmarshal(data, &s2)
	fmt.Printf("segment: err=%s s=%s\n", err2, s2)

	if err1 != err2 {
		panic("err mismatch")
	}
	if s1 != s2 {
		panic("value mismatch")
	}
}
```
https://play.golang.com/p/l3RoNt3FYnB

```
~/tmp$ go version && go run main.go
go version go1.16.2 linux/amd64
stdlib: err=%!s(<nil>) s={hello}
segment: err=%!s(<nil>) s={}
panic: value mismatch

goroutine 1 [running]:
main.main()
	/home/thomas/tmp/main.go:29 +0x389
exit status 2
~/tmp$ go1.15 version && go1.15 run main.go
go version go1.15.10 linux/amd64
stdlib: err=%!s(<nil>) s={}
segment: err=%!s(<nil>) s={}
```

Pull request:
json: accept ; in json field tag
Accept ; in `json` field tag to match the behavior of Go 1.16.

https://go-review.googlesource.com/c/go/+/234818/4/src/encoding/json/encode.go

Fixes #86

Patch:
diff --git a/json/codec.go b/json/codec.go
index 5e06a99..22d35fd 100644
--- a/json/codec.go
+++ b/json/codec.go
@@ -844,7 +844,7 @@ func isValidTag(s string) bool {
 	}
 	for _, c := range s {
 		switch {
-		case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c):
+		case strings.ContainsRune("!#$%&()*+-./:;<=>?@[]^_{|}~ ", c):
 			// Backslash and quote chars are reserved, but
 			// otherwise any punctuation chars are allowed
 			// in a tag name.


Test patch:
diff --git a/json/golang_tagkey_test.go b/json/golang_tagkey_test.go
index f77c49c..17d4c03 100644
--- a/json/golang_tagkey_test.go
+++ b/json/golang_tagkey_test.go
@@ -41,7 +41,7 @@ type percentSlashTag struct {
 }
 
 type punctuationTag struct {
-	V string `json:"!#$%&()*+-./:<=>?@[]^_{|}~"` // https://golang.org/issue/3546
+	V string `json:"!#$%&()*+-./:;<=>?@[]^_{|}~"` // https://golang.org/issue/3546
 }
 
 type dashTag struct {
@@ -90,7 +90,7 @@ var structTagObjectKeyTests = []struct {
 	{badFormatTag{"Orfevre"}, "Orfevre", "Y"},
 	{badCodeTag{"Reliable Man"}, "Reliable Man", "Z"},
 	{percentSlashTag{"brut"}, "brut", "text/html%"},
-	{punctuationTag{"Union Rags"}, "Union Rags", "!#$%&()*+-./:<=>?@[]^_{|}~"},
+	{punctuationTag{"Union Rags"}, "Union Rags", "!#$%&()*+-./:;<=>?@[]^_{|}~"},
 	{spaceTag{"Perreddu"}, "Perreddu", "With space"},
 	{unicodeTag{"Loukanikos"}, "Loukanikos", "Ελλάδα"},
 }
Repository: semantic-release/semantic-release (js)

Issue:
semantic-release --no-ci logs [secure]ecure][[secure]9[secu...
## Current behavior

```
$ ./node_modules/.bin/semantic-release --no-ci
[secure]ecure][[secure]9[secure]0[secure]m[secure][[secure]S[secure]e[secure]m[secure]a[secure]n[secure]t[secure]i[secure]c[secure] [secure]r[secure]e[secure]l[secure]e[secure]a[secure]s[secure]e[secure]][secure]:[secur....
```

## Expected behavior

should only mask sensitive tokens

## Environment

- **semantic-release** version: 13.1.3, 12.4.1
- Plugins used: none
- **semantic-release** configuration: 
  ```json
  "release": {
    "publish": [
      "@semantic-release/npm",
      {
        "path": "@semantic-release/github",
        "assets": [
          "dist/*"
        ]
      }
    ]
  }
  ```
- CI logs: does not apply

Pull request:
fix: exclude empty env var value from replacement
Fix #646

Patch:
diff --git a/lib/hide-sensitive.js b/lib/hide-sensitive.js
index cd5709e..1fbd834 100644
--- a/lib/hide-sensitive.js
+++ b/lib/hide-sensitive.js
@@ -1,6 +1,9 @@
 const {escapeRegExp} = require('lodash');
 
-const toReplace = Object.keys(process.env).filter(envVar => /token|password|credential|secret|private/i.test(envVar));
+const toReplace = Object.keys(process.env).filter(
+  envVar => /token|password|credential|secret|private/i.test(envVar) && process.env[envVar].trim()
+);
+
 const regexp = new RegExp(toReplace.map(envVar => escapeRegExp(process.env[envVar])).join('|'), 'g');
 
 module.exports = output => {


Test patch:
diff --git a/test/hide-sensitive.test.js b/test/hide-sensitive.test.js
index 815f867..1109cb1 100644
--- a/test/hide-sensitive.test.js
+++ b/test/hide-sensitive.test.js
@@ -40,3 +40,18 @@ test.serial('Accept "undefined" input', t => {
 test.serial('Return same string if no environment variable has to be replaced', t => {
   t.is(require('../lib/hide-sensitive')('test'), 'test');
 });
+
+test.serial('Exclude empty environment variables from the regexp', t => {
+  process.env.SOME_PASSWORD = 'password';
+  process.env.SOME_TOKEN = '';
+  t.is(
+    require('../lib/hide-sensitive')(`https://user:${process.env.SOME_PASSWORD}@host.com?token=`),
+    'https://user:[secure]@host.com?token='
+  );
+});
+
+test.serial('Exclude empty environment variables from the regexp if there is only empty ones', t => {
+  process.env.SOME_PASSWORD = '';
+  process.env.SOME_TOKEN = ' \n ';
+  t.is(require('../lib/hide-sensitive')(`https://host.com?token=`), 'https://host.com?token=');
+});
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 213
Good morning! Here's your coding interview problem for today.

This problem was asked by Snapchat.

Given a string of digits, generate all possible valid IP address combinations.

IP addresses must follow the format A.B.C.D, where A, B, C, and D are numbers between 0 and 255. Zero-prefixed numbers, such as 01 and 065, are not allowed, except for 0 itself.

For example, given "2542540123", you should return ['254.25.40.123', '254.254.0.123'].

Pull request:
Day213
Resolves #439. 

Patch:
diff --git a/README.md b/README.md
index ff4e2f2..baaae24 100644
--- a/README.md
+++ b/README.md
@@ -223,3 +223,4 @@ problems from
 * [Day 210](https://github.com/vaskoz/dailycodingproblem-go/issues/432)
 * [Day 211](https://github.com/vaskoz/dailycodingproblem-go/issues/434)
 * [Day 212](https://github.com/vaskoz/dailycodingproblem-go/issues/436)
+* [Day 213](https://github.com/vaskoz/dailycodingproblem-go/issues/439)
diff --git a/day213/problem.go b/day213/problem.go
new file mode 100644
index 0000000..63636b0
--- /dev/null
+++ b/day213/problem.go
@@ -0,0 +1,43 @@
+package day213
+
+import (
+	"fmt"
+	"strconv"
+)
+
+// ValidIPAddresses returns all the possible valid
+// IPv4 addresses using all the digits in the string.
+func ValidIPAddresses(digits string) []string {
+	return validIPAddresses(digits, 0)
+}
+
+func validIPAddresses(digits string, octet int) []string {
+	if octet == 4 {
+		if len(digits) == 0 {
+			return []string{""}
+		}
+		return nil
+	}
+	var one, two, three, result []string
+	if len(digits) > 0 {
+		one = validIPAddresses(digits[1:], octet+1)
+	}
+	if len(digits) > 1 && digits[0] != byte('0') {
+		two = validIPAddresses(digits[2:], octet+1)
+	}
+	if len(digits) > 2 && digits[0] != byte('0') {
+		if third, _ := strconv.Atoi(digits[:3]); third < 256 && third > 99 {
+			three = validIPAddresses(digits[3:], octet+1)
+		}
+	}
+	for i, ips := range [][]string{one, two, three} {
+		for _, ip := range ips {
+			if len(ip) != 0 {
+				result = append(result, fmt.Sprintf("%s.%s", digits[:i+1], ip))
+			} else {
+				result = append(result, digits[:i+1])
+			}
+		}
+	}
+	return result
+}


Test patch:
diff --git a/day213/problem_test.go b/day213/problem_test.go
new file mode 100644
index 0000000..a4365bf
--- /dev/null
+++ b/day213/problem_test.go
@@ -0,0 +1,30 @@
+package day213
+
+import (
+	"reflect"
+	"testing"
+)
+
+var testcases = []struct {
+	digits string
+	ips    []string
+}{
+	{"2542540123", []string{"254.25.40.123", "254.254.0.123"}},
+}
+
+func TestValidIPAddresses(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := ValidIPAddresses(tc.digits); !reflect.DeepEqual(tc.ips, result) {
+			t.Errorf("Expected %v, got %v", tc.ips, result)
+		}
+	}
+}
+
+func BenchmarkValidIPAddresses(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			ValidIPAddresses(tc.digits)
+		}
+	}
+}