PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: JuliaData/Tables.jl (julia)

Issue:
Copying in matrix(table(A)) when A is a matrix
I was expecting that if `A` is a matrix and I do `t = table(A)` then `matrix(t)` just unwraps `A`, ie no copying.  But evidently this is not the case:

```julia
julia> A = [1 2; 2 4]
2×2 Array{Int64,2}:
 1  2
 2  4

julia> a = Tables.matrix(Tables.table(A))
2×2 Array{Int64,2}:
 1  2
 2  4

julia> A[1, 1] = 10_000
10000

julia> a
2×2 Array{Int64,2}:
 1  2
 2  4
```

Is there a reason for wanting this behaviour?

Pull request:
This PR resolves #182 by adding specific method for `matrix(table::MatrixTable)`. This avoids creating a copy of the wrapped matrix.

Patch:
diff --git a/src/matrix.jl b/src/matrix.jl
index b9b70a4..dcdf47a 100644
--- a/src/matrix.jl
+++ b/src/matrix.jl
@@ -59,10 +59,12 @@ end
 """
     Tables.matrix(table; transpose::Bool=false)
 
-Materialize any table source input as a `Matrix`. If the table column types are not homogenous,
+Materialize any table source input as a new `Matrix` or in the case of a `MatrixTable`
+return the originally wrapped matrix. If the table column types are not homogenous,
 they will be promoted to a common type in the materialized `Matrix`. Note that column names are
 ignored in the conversion. By default, input table columns will be materialized as corresponding
-matrix columns; passing `transpose=true` will transpose the input with input columns as matrix rows.
+matrix columns; passing `transpose=true` will transpose the input with input columns as matrix rows
+or in the case of a `MatrixTable` apply `permutedims` to the originally wrapped matrix.
 """
 function matrix(table; transpose::Bool=false)
     cols = columns(table)
@@ -82,3 +84,9 @@ function matrix(table; transpose::Bool=false)
     end
     return matrix
 end
+	
+function matrix(table::MatrixTable; transpose::Bool=false) 
+    matrix = getfield(table, :matrix)
+    transpose || return matrix
+    return permutedims(matrix)
+end


Test patch:
diff --git a/test/runtests.jl b/test/runtests.jl
index 57bc8f6..749caf6 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -241,9 +241,14 @@ end
     @test propertynames(mattbl) == propertynames(matrow) == [:Column1, :Column2, :Column3]
 
     # #155
-    T = Tables.table(hcat([1,2,3],[1,2,3]))
+    m = hcat([1,2,3],[1,2,3])
+    T = Tables.table(m)
     M = Tables.matrix(T)
+    Mt = Tables.matrix(T, transpose=true)
     @test M[:, 1] == [1, 2, 3]
+    # 182
+    @test M === m #checks that both are the same object in memory
+    @test Mt == permutedims(m) 
     # 167
     @test !Tables.istable(Matrix{Union{}}(undef, 2, 3))
 end
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 380
Good morning! Here's your coding interview problem for today.

This problem was asked by Nextdoor.

Implement integer division without using the division operator. Your function should return a tuple of (dividend, remainder) and it should take two numbers, the product and divisor.

For example, calling `divide(10, 3)` should return `(3, 1)` since the divisor is 3 and the remainder is 1.

Bonus: Can you do it in O(log n) time?

Pull request:
Day380
Resolves #766.

Patch:
diff --git a/README.md b/README.md
index e3d0159..aa76e21 100644
--- a/README.md
+++ b/README.md
@@ -375,4 +375,5 @@ problems from
 * [Day 377](https://github.com/vaskoz/dailycodingproblem-go/issues/760)
 * [Day 378](https://github.com/vaskoz/dailycodingproblem-go/issues/762)
 * [Day 379](https://github.com/vaskoz/dailycodingproblem-go/issues/764)
+* [Day 380](https://github.com/vaskoz/dailycodingproblem-go/issues/766)
 
diff --git a/day380/problem.go b/day380/problem.go
new file mode 100644
index 0000000..8f3f499
--- /dev/null
+++ b/day380/problem.go
@@ -0,0 +1,43 @@
+package day380
+
+// DivisionBrute returns the quotient and remainder of division
+// without using the division operator using brute-force.
+func DivisionBrute(dividend, divisor int) (int, int) {
+	if divisor == 0 {
+		panic("divide by zero")
+	}
+
+	var dividendNeg, divisorNeg bool
+
+	if dividend < 0 {
+		dividendNeg = true
+		dividend = -dividend
+	}
+
+	if divisor < 0 {
+		divisorNeg = true
+		divisor = -divisor
+	}
+
+	var quotient int
+
+	for dividend >= 0 {
+		dividend -= divisor
+		quotient++
+	}
+
+	remainder := dividend + divisor
+	quotient--
+
+	if dividendNeg {
+		quotient = -quotient
+		remainder = -remainder
+	}
+
+	if divisorNeg {
+		quotient = -quotient
+		remainder = -remainder
+	}
+
+	return quotient, remainder
+}


Test patch:
diff --git a/day380/problem_test.go b/day380/problem_test.go
new file mode 100644
index 0000000..f5dfaf5
--- /dev/null
+++ b/day380/problem_test.go
@@ -0,0 +1,44 @@
+package day380
+
+import "testing"
+
+// nolint
+var testcases = []struct {
+	dividend, divisor   int
+	quotient, remainder int
+}{
+	{10, 3, 3, 1},
+	{9, 3, 3, 0},
+	{-9, 3, -3, 0},
+	{9, -3, -3, 0},
+	{-9, -3, 3, 0},
+}
+
+func TestDivisionBrute(t *testing.T) {
+	t.Parallel()
+
+	for _, tc := range testcases {
+		if q, r := DivisionBrute(tc.dividend, tc.divisor); q != tc.quotient || r != tc.remainder {
+			t.Errorf("Expected (%v,%v), got (%v,%v)", tc.quotient, tc.remainder, q, r)
+		}
+	}
+}
+
+func TestDivisionBruteDivideByZero(t *testing.T) {
+	t.Parallel()
+
+	defer func() {
+		if err := recover(); err == nil {
+			t.Errorf("expected a panic when divisor is zero")
+		}
+	}()
+	DivisionBrute(1, 0)
+}
+
+func BenchmarkDivisionBrute(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			DivisionBrute(tc.dividend, tc.divisor)
+		}
+	}
+}