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

Issue:
Day 386
Good morning! Here's your coding interview problem for today.

This problem was asked by Twitter.

Given a string, sort it in decreasing order based on the frequency of characters. If there are multiple possible solutions, return any of them.

For example, given the string `tweet`, return `tteew`. `eettw` would also be acceptable.

Pull request:
Day386
Resolves #778.

Patch:
diff --git a/README.md b/README.md
index ac83cca..d5a0b0b 100644
--- a/README.md
+++ b/README.md
@@ -381,4 +381,5 @@ problems from
 * [Day 383](https://github.com/vaskoz/dailycodingproblem-go/issues/772)
 * [Day 384](https://github.com/vaskoz/dailycodingproblem-go/issues/776)
 * [Day 385](https://github.com/vaskoz/dailycodingproblem-go/issues/774)
+* [Day 386](https://github.com/vaskoz/dailycodingproblem-go/issues/778)
 
diff --git a/day386/problem.go b/day386/problem.go
new file mode 100644
index 0000000..7c19bd0
--- /dev/null
+++ b/day386/problem.go
@@ -0,0 +1,28 @@
+package day386
+
+import "sort"
+
+// SortStringByCharFreq sorts the string by character
+// frequency with the most frequent letters first.
+// For a tie-breaker, they're sorted in reverse alphabetical
+// order.
+func SortStringByCharFreq(s string) string {
+	freq := make(map[rune]int)
+	runes := []rune(s)
+
+	for _, r := range runes {
+		freq[r]++
+	}
+
+	sort.Slice(runes, func(i, j int) bool {
+		if f1, f2 := freq[runes[i]], freq[runes[j]]; f1 > f2 {
+			return true
+		} else if f1 == f2 {
+			return runes[i] > runes[j]
+		}
+
+		return false
+	})
+
+	return string(runes)
+}


Test patch:
diff --git a/day386/problem_test.go b/day386/problem_test.go
new file mode 100644
index 0000000..fd6f5a3
--- /dev/null
+++ b/day386/problem_test.go
@@ -0,0 +1,29 @@
+package day386
+
+import "testing"
+
+// nolint
+var testcases = []struct {
+	input, expected string
+}{
+	{"tweet", "tteew"},
+	{"happiness", "ssppnihea"},
+}
+
+func TestSortStringByCharFreq(t *testing.T) {
+	t.Parallel()
+
+	for _, tc := range testcases {
+		if res := SortStringByCharFreq(tc.input); res != tc.expected {
+			t.Errorf("Expected %v, got %v", tc.expected, res)
+		}
+	}
+}
+
+func BenchmarkSortStringByCharFreq(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			SortStringByCharFreq(tc.input)
+		}
+	}
+}
Repository: cobalt-org/liquid-rust (rust)

Issue:
parser: byte index 1 is not a char boundary
While fuzz testing parser, encountered following panic:

```rust
#[test]
fn test_fuzz() {
    if let Ok(_) = liquid::ParserBuilder::with_stdlib()
        .build()
        .unwrap()
        .parse("˄{%")
    {}
}
```

```sh
thread 'test_fuzz' panicked at crates/core/src/parser/parser.rs:659:70:
byte index 1 is not a char boundary; it is inside '˄' (bytes 0..2) of `˄{%`
stack backtrace:
```

Panicked at:
https://github.com/cobalt-org/liquid-rust/blob/8de2d34629fd387295312f2d625556ac40921bcc/crates/core/src/parser/parser.rs#L659

Crash input: 
[crash-2dbc79c17b5c840978e94df8716233b7203e1e08.txt](https://github.com/user-attachments/files/16403759/crash-2dbc79c17b5c840978e94df8716233b7203e1e08.txt)



liquid-rust version: 0.26.8
rust version: 1.78.0
OS: Ubuntu 20.04.6 LTS


Pull request:
fix(parser): Correctly bind 'char' boundaries
Fixes #553

Patch:
diff --git a/crates/core/src/parser/parser.rs b/crates/core/src/parser/parser.rs
index 92f7ddb..a1dbed6 100644
--- a/crates/core/src/parser/parser.rs
+++ b/crates/core/src/parser/parser.rs
@@ -649,7 +649,10 @@ impl<'a> InvalidLiquidToken<'a> {
         let invalid_token_position = invalid_token_span.start_pos();
         let (offset_l, offset_c) = invalid_token_position.line_col();
         let offset_l = offset_l - 1;
-        let offset_c = offset_c - 1;
+        let offset_c = (0..offset_c)
+            .rev()
+            .find(|i| invalid_token_position.line_of().is_char_boundary(*i))
+            .unwrap_or(0);
 
         let end_position = match next_elements.last() {
             Some(element) => element.as_span().end_pos(),


Test patch:
diff --git a/tests/errors.rs b/tests/errors.rs
new file mode 100644
index 0000000..86c8a13
--- /dev/null
+++ b/tests/errors.rs
@@ -0,0 +1,25 @@
+use snapbox::assert_data_eq;
+use snapbox::str;
+
+#[test]
+fn test_fuzz() {
+    match liquid::ParserBuilder::with_stdlib()
+        .build()
+        .unwrap()
+        .parse("˄{%")
+    {
+        Ok(_) => panic!("should fail"),
+        Err(err) => assert_data_eq!(
+            err.to_string(),
+            str![[r#"
+liquid:  --> 1:3
+  |
+1 | {%
+  |   ^---
+  |
+  = expected Identifier
+
+"#]]
+        ),
+    }
+}
Repository: JoshuaKGoldberg/create-typescript-app (ts)

Issue:
🐛 Bug: File permissions in blockPrettier don't match what fs.stat reads
### Bug Report Checklist

- [X] I have tried restarting my IDE and the issue persists.
- [X] I have pulled the latest `main` branch of the repository.
- [X] I have [searched for related issues](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aissue) and found none that matched my issue.

### Expected

`blockPrettier` should create files with a chmod mode that stays the same after `fs.stat` reads them.

### Actual

Running `fs.statSync(".husky/pre-commit").mode` gives `mode: 33279`. Converting that `.toString(16)` gives `81ff`. `.toString(8)` gives `100777`. Which visually matches the `777` I'm trying to write them as.

🤷 

### Additional Info

I don't want to dive deep into file permissions bits/integers now. So I'll just go with it.

Prototyped in #1839.

💖 

Pull request:
fix: correct blockPrettier .husky/pre-commit mode to 33279 / -rwxrwxrwx
# PR Checklist

- [x] Addresses an existing open issue: fixes #1875
- [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken

## Overview

🤷 

Patch:
diff --git a/src/next/blocks/blockPrettier.ts b/src/next/blocks/blockPrettier.ts
index 628a556..f08bf42 100644
--- a/src/next/blocks/blockPrettier.ts
+++ b/src/next/blocks/blockPrettier.ts
@@ -95,7 +95,7 @@ pnpm format --write
 			files: {
 				".husky": {
 					".gitignore": "_\n",
-					"pre-commit": ["npx lint-staged\n", { mode: 0x777 }],
+					"pre-commit": ["npx lint-staged\n", { mode: 33279 }],
 				},
 				".prettierignore": formatIgnoreFile(
 					["/.husky", "/lib", "/pnpm-lock.yaml", ...ignores].sort(),


Test patch:
diff --git a/src/next/blocks/blockPrettier.test.ts b/src/next/blocks/blockPrettier.test.ts
index fc9787c..3bdad76 100644
--- a/src/next/blocks/blockPrettier.test.ts
+++ b/src/next/blocks/blockPrettier.test.ts
@@ -94,7 +94,7 @@ describe("blockPrettier", () => {
 			        "npx lint-staged
 			",
 			        {
-			          "mode": 1911,
+			          "mode": 33279,
 			        },
 			      ],
 			    },
@@ -206,7 +206,7 @@ describe("blockPrettier", () => {
 			        "npx lint-staged
 			",
 			        {
-			          "mode": 1911,
+			          "mode": 33279,
 			        },
 			      ],
 			    },
@@ -335,7 +335,7 @@ describe("blockPrettier", () => {
 			        "npx lint-staged
 			",
 			        {
-			          "mode": 1911,
+			          "mode": 33279,
 			        },
 			      ],
 			    },
Repository: goccy/go-yaml (go)

Issue:
Allow new-line and indented map as value of slice
I want to decode new-line and indented map as value of slice.

like follows

```yaml
a:
-
  b: d
  c: e
-
  b: f
  c: g
```

| | go-yaml/yaml | goccy/go-yaml v1.4.1 |
| --- | --- | --- | 
| decode | can decode | error |
| play.golang.org | [here](https://play.golang.org/p/Niu8FXan10A) | [here](https://play.golang.org/p/6G8ZrkdsoXb) | 

I have tried this problem but have not solved it yet ... so I first register this issue.


Pull request:
Fix handling of sequence indicator
resolve #94


Patch:
diff --git a/scanner/scanner.go b/scanner/scanner.go
index 0b287bb..4bff241 100644
--- a/scanner/scanner.go
+++ b/scanner/scanner.go
@@ -431,7 +431,7 @@ func (s *Scanner) scan(ctx *Context) (pos int) {
 				continue
 			}
 			nc := ctx.nextChar()
-			if nc == ' ' {
+			if nc == ' ' || s.isNewLineChar(nc) {
 				s.addBufferedTokenIfExists(ctx)
 				ctx.addOriginBuf(c)
 				tk := token.SequenceEntry(string(ctx.obuf), s.pos())


Test patch:
diff --git a/parser/parser_test.go b/parser/parser_test.go
index f4747c3..e08e208 100644
--- a/parser/parser_test.go
+++ b/parser/parser_test.go
@@ -497,6 +497,24 @@ a - b - c: value
 `,
 			`
 a - b - c: value
+`,
+		},
+		{
+			`
+a:
+-
+  b: c
+  d: e
+-
+  f: g
+  h: i
+`,
+			`
+a:
+- b: c
+  d: e
+- f: g
+  h: i
 `,
 		},
 	}
Repository: kmyk/online-judge-tools (python)

Issue:
AtCoderContest.get_penalty() fails if it has a singular form, "1 minute"
``` python
$ python3 -c 'from onlinejudge.service.atcoder import * ; AtCoderContest.from_url("https://atcoder.jp/contests/chokudai_S002").get_name()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/user/GitHub/online-judge-tools/onlinejudge/service/atcoder.py", line 261, in get_name
    self._load_details(lang='en', session=session)
  File "/home/user/GitHub/online-judge-tools/onlinejudge/service/atcoder.py", line 255, in _load_details
    assert m
AssertionError
```

Pull request:
#444: fix a bug of AtCoderContest.get_penalty()
close #444

ペナルティの表記に `minute` の形があることを見落としていていました。これを修正します。

Patch:
diff --git a/onlinejudge/service/atcoder.py b/onlinejudge/service/atcoder.py
index dc5e473..e5b58d3 100644
--- a/onlinejudge/service/atcoder.py
+++ b/onlinejudge/service/atcoder.py
@@ -251,7 +251,7 @@ class AtCoderContest(object):
         _, _, self._can_participate = soup.find('span', text=re.compile(r'^(Can Participate|参加対象): ')).text.partition(': ')
         _, _, self._rated_range = soup.find('span', text=re.compile(r'^(Rated Range|Rated対象): ')).text.partition(': ')
         penalty_text = soup.find('span', text=re.compile(r'^(Penalty|ペナルティ): ')).text
-        m = re.match(r'(Penalty|ペナルティ): (\d+)( minutes|分)', penalty_text)
+        m = re.match(r'(Penalty|ペナルティ): (\d+)( minutes?|分)', penalty_text)
         assert m
         self._penalty = datetime.timedelta(minutes=int(m.group(2)))
 


Test patch:
diff --git a/tests/service_atcoder.py b/tests/service_atcoder.py
index cb8c00b..7bc6063 100644
--- a/tests/service_atcoder.py
+++ b/tests/service_atcoder.py
@@ -59,6 +59,10 @@ class AtCoderContestTest(unittest.TestCase):
         self.assertEqual(contest.get_rated_range(), '-')
         self.assertEqual(contest.get_penalty().total_seconds(), 5 * 60)
 
+    def test_get_penalty_a_singular_form(self):
+        contest = AtCoderContest.from_url('https://atcoder.jp/contests/chokudai_S002')
+        self.assertEqual(contest.get_penalty().total_seconds(), 60)  # Penalty is written as "1 minute", not  "1 minutes"
+
     def test_list_problems(self):
         contest = AtCoderContest.from_url('https://atcoder.jp/contests/agc028')
         problems = contest.list_problems()