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

Issue:
Day 162
Good morning! Here's your coding interview problem for today.

This problem was asked by Square.

Given a list of words, return the shortest unique prefix of each word. For example, given the list:
```
* dog
* cat
* apple
* apricot
* fish
```
Return the list:
```
* d
* c
* app
* apr
* f
```

Pull request:
Day162
Resolves #335.

Patch:
diff --git a/README.md b/README.md
index 9e5c104..cb4b438 100644
--- a/README.md
+++ b/README.md
@@ -170,4 +170,5 @@ problems from
 * [Day 157](https://github.com/vaskoz/dailycodingproblem-go/issues/327)
 * [Day 158](https://github.com/vaskoz/dailycodingproblem-go/issues/329)
 * [Day 159](https://github.com/vaskoz/dailycodingproblem-go/issues/331)
+* [Day 162](https://github.com/vaskoz/dailycodingproblem-go/issues/335)
 * [Day 163](https://github.com/vaskoz/dailycodingproblem-go/issues/336)
diff --git a/day162/problem.go b/day162/problem.go
new file mode 100644
index 0000000..329a56a
--- /dev/null
+++ b/day162/problem.go
@@ -0,0 +1,39 @@
+package day162
+
+import "strings"
+
+// Trie is a prefix search tree.
+type Trie struct {
+	freq map[rune]int
+	ptr  map[rune]*Trie
+}
+
+// ShortestUniquePrefix returns the shortest unique prefix for each word
+// amongst the words in the list.
+func ShortestUniquePrefix(words []string) []string {
+	root := &Trie{make(map[rune]int), make(map[rune]*Trie)}
+	for _, word := range words {
+		curr := root
+		for _, r := range word {
+			curr.freq[r]++
+			if curr.ptr[r] == nil {
+				curr.ptr[r] = &Trie{make(map[rune]int), make(map[rune]*Trie)}
+			}
+			curr = curr.ptr[r]
+		}
+	}
+	results := make([]string, 0, len(words))
+	for _, word := range words {
+		var sb strings.Builder
+		curr := root
+		for _, r := range word {
+			sb.WriteRune(r)
+			if curr.freq[r] == 1 {
+				results = append(results, sb.String())
+				break
+			}
+			curr = curr.ptr[r]
+		}
+	}
+	return results
+}


Test patch:
diff --git a/day162/problem_test.go b/day162/problem_test.go
new file mode 100644
index 0000000..bf97b8e
--- /dev/null
+++ b/day162/problem_test.go
@@ -0,0 +1,29 @@
+package day162
+
+import (
+	"reflect"
+	"testing"
+)
+
+var testcases = []struct {
+	words, prefixes []string
+}{
+	{[]string{"dog", "cat", "apple", "apricot", "fish"}, []string{"d", "c", "app", "apr", "f"}},
+}
+
+func TestShortestUniquePrefix(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := ShortestUniquePrefix(tc.words); !reflect.DeepEqual(result, tc.prefixes) {
+			t.Errorf("Expected %v got %v", tc.prefixes, result)
+		}
+	}
+}
+
+func BenchmarkShortestUniquePrefix(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			ShortestUniquePrefix(tc.words)
+		}
+	}
+}
Repository: PyCQA/pyflakes (python)

Issue:
On Python 3, __class__ can be used without self
*Original report by [icordasc](https://launchpad.net/~icordasc) (@sigmavirus24?) on [Launchpad](https://bugs.launchpad.net/bugs/1487725):*

------------------------------------

On Python 3, the following code raises a warning:

```python
class Test(object):
    def __init__(self):
        print(__class__.__name__)
        self.x = 1

t = Test()
```

This is actually valid Python 3 code, but PyFlakes doesn't quite understand that:

    test.py:3: undefined name '__class__'


Pull request:
Support `__class__` without `self` in Python 3
This fixes #223.

I created this patch previously in:

https://github.com/PyCQA/pyflakes/commit/83ab002d6fab2b717df91e854624c6fdfd9b9213

But I deleted that branch for some reason. I can't recall why I disliked it enough to delete it. But since I can't remember, I'll commit it to a branch again for others to look at.

Patch:
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index baef833..9b39e6c 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -710,10 +710,14 @@ class Checker(object):
 
         # try enclosing function scopes and global scope
         for scope in self.scopeStack[-1::-1]:
-            # only generators used in a class scope can access the names
-            # of the class. this is skipped during the first iteration
-            if in_generators is False and isinstance(scope, ClassScope):
-                continue
+            if isinstance(scope, ClassScope):
+                if not PY2 and name == '__class__':
+                    return
+                elif in_generators is False:
+                    # only generators used in a class scope can access the
+                    # names of the class. this is skipped during the first
+                    # iteration
+                    continue
 
             try:
                 scope[name].used = (self.scope, node)


Test patch:
diff --git a/pyflakes/test/test_undefined_names.py b/pyflakes/test/test_undefined_names.py
index 3d19210..d53e529 100644
--- a/pyflakes/test/test_undefined_names.py
+++ b/pyflakes/test/test_undefined_names.py
@@ -799,6 +799,24 @@ class Test(TestCase):
         any(lambda: id(y) for x in range(10))
         ''', m.UndefinedName)
 
+    def test_dunderClass(self):
+        """
+        `__class__` is defined in class scope under Python 3, but is not
+        in Python 2.
+        """
+        code = '''
+        class Test(object):
+            def __init__(self):
+                print(__class__.__name__)
+                self.x = 1
+
+        t = Test()
+        '''
+        if version_info < (3,):
+            self.flakes(code, m.UndefinedName)
+        else:
+            self.flakes(code)
+
 
 class NameTests(TestCase):
     """