Instruction stringlengths 45 106 | input_code stringlengths 1 13.7k | output_code stringlengths 1 13.7k |
|---|---|---|
Please provide an equivalent version of this REXX code in Java. |
say 'police sanitation fire'
say 'ββββββ ββββββββββ ββββ'
#=0
do p=1 for 7; if p//2 then iterate
do s=1 for 7; if s==p then iterate
do f=1 for 7; if f==s then iterate
if p + s + f \== 12 then iterate
#= # + 1
say center(p,6) center(s,10) center(f,4)
end
end
end
say 'ββββββ ββββββββββ ββββ'
say
say # ' solutions found.'
| public class DepartmentNumbers {
public static void main(String[] args) {
System.out.println("Police Sanitation Fire");
System.out.println("------ ---------- ----");
int count = 0;
for (int i = 2; i <= 6; i += 2) {
for (int j = 1; j <= 7; ++j) {
if (j == i) continue;
for (int k = 1; k <= 7; ++k) {
if (k == i || k == j) continue;
if (i + j + k != 12) continue;
System.out.printf(" %d %d %d\n", i, j, k);
count++;
}
}
}
System.out.printf("\n%d valid combinations", count);
}
}
|
Generate an equivalent Python version of this REXX code. |
say 'police sanitation fire'
say 'ββββββ ββββββββββ ββββ'
#=0
do p=1 for 7; if p//2 then iterate
do s=1 for 7; if s==p then iterate
do f=1 for 7; if f==s then iterate
if p + s + f \== 12 then iterate
#= # + 1
say center(p,6) center(s,10) center(f,4)
end
end
end
say 'ββββββ ββββββββββ ββββ'
say
say # ' solutions found.'
| from itertools import permutations
def solve():
c, p, f, s = "\\,Police,Fire,Sanitation".split(',')
print(f"{c:>3} {p:^6} {f:^4} {s:^10}")
c = 1
for p, f, s in permutations(range(1, 8), r=3):
if p + s + f == 12 and p % 2 == 0:
print(f"{c:>3}: {p:^6} {f:^4} {s:^10}")
c += 1
if __name__ == '__main__':
solve()
|
Write the same algorithm in Python as shown in this REXX implementation. |
say 'police sanitation fire'
say 'ββββββ ββββββββββ ββββ'
#=0
do p=1 for 7; if p//2 then iterate
do s=1 for 7; if s==p then iterate
do f=1 for 7; if f==s then iterate
if p + s + f \== 12 then iterate
#= # + 1
say center(p,6) center(s,10) center(f,4)
end
end
end
say 'ββββββ ββββββββββ ββββ'
say
say # ' solutions found.'
| from itertools import permutations
def solve():
c, p, f, s = "\\,Police,Fire,Sanitation".split(',')
print(f"{c:>3} {p:^6} {f:^4} {s:^10}")
c = 1
for p, f, s in permutations(range(1, 8), r=3):
if p + s + f == 12 and p % 2 == 0:
print(f"{c:>3}: {p:^6} {f:^4} {s:^10}")
c += 1
if __name__ == '__main__':
solve()
|
Transform the following REXX implementation into VB, maintaining the same output and logic. |
say 'police sanitation fire'
say 'ββββββ ββββββββββ ββββ'
#=0
do p=1 for 7; if p//2 then iterate
do s=1 for 7; if s==p then iterate
do f=1 for 7; if f==s then iterate
if p + s + f \== 12 then iterate
#= # + 1
say center(p,6) center(s,10) center(f,4)
end
end
end
say 'ββββββ ββββββββββ ββββ'
say
say # ' solutions found.'
| Module Module1
Sub Main()
For p = 2 To 7 Step 2
For s = 1 To 7
Dim f = 12 - p - s
If s >= f Then
Exit For
End If
If f > 7 Then
Continue For
End If
If s = p OrElse f = p Then
Continue For
End If
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}")
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}")
Next
Next
End Sub
End Module
|
Change the programming language of this snippet from REXX to VB without modifying what it does. |
say 'police sanitation fire'
say 'ββββββ ββββββββββ ββββ'
#=0
do p=1 for 7; if p//2 then iterate
do s=1 for 7; if s==p then iterate
do f=1 for 7; if f==s then iterate
if p + s + f \== 12 then iterate
#= # + 1
say center(p,6) center(s,10) center(f,4)
end
end
end
say 'ββββββ ββββββββββ ββββ'
say
say # ' solutions found.'
| Module Module1
Sub Main()
For p = 2 To 7 Step 2
For s = 1 To 7
Dim f = 12 - p - s
If s >= f Then
Exit For
End If
If f > 7 Then
Continue For
End If
If s = p OrElse f = p Then
Continue For
End If
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}")
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}")
Next
Next
End Sub
End Module
|
Rewrite the snippet below in Go so it works the same as the original REXX code. |
say 'police sanitation fire'
say 'ββββββ ββββββββββ ββββ'
#=0
do p=1 for 7; if p//2 then iterate
do s=1 for 7; if s==p then iterate
do f=1 for 7; if f==s then iterate
if p + s + f \== 12 then iterate
#= # + 1
say center(p,6) center(s,10) center(f,4)
end
end
end
say 'ββββββ ββββββββββ ββββ'
say
say # ' solutions found.'
| package main
import "fmt"
func main() {
fmt.Println("Police Sanitation Fire")
fmt.Println("------ ---------- ----")
count := 0
for i := 2; i < 7; i += 2 {
for j := 1; j < 8; j++ {
if j == i { continue }
for k := 1; k < 8; k++ {
if k == i || k == j { continue }
if i + j + k != 12 { continue }
fmt.Printf(" %d %d %d\n", i, j, k)
count++
}
}
}
fmt.Printf("\n%d valid combinations\n", count)
}
|
Ensure the translated Go code behaves exactly like the original REXX snippet. |
say 'police sanitation fire'
say 'ββββββ ββββββββββ ββββ'
#=0
do p=1 for 7; if p//2 then iterate
do s=1 for 7; if s==p then iterate
do f=1 for 7; if f==s then iterate
if p + s + f \== 12 then iterate
#= # + 1
say center(p,6) center(s,10) center(f,4)
end
end
end
say 'ββββββ ββββββββββ ββββ'
say
say # ' solutions found.'
| package main
import "fmt"
func main() {
fmt.Println("Police Sanitation Fire")
fmt.Println("------ ---------- ----")
count := 0
for i := 2; i < 7; i += 2 {
for j := 1; j < 8; j++ {
if j == i { continue }
for k := 1; k < 8; k++ {
if k == i || k == j { continue }
if i + j + k != 12 { continue }
fmt.Printf(" %d %d %d\n", i, j, k)
count++
}
}
}
fmt.Printf("\n%d valid combinations\n", count)
}
|
Write the same algorithm in C as shown in this Ruby implementation. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| #include<stdio.h>
int main()
{
int police,sanitation,fire;
printf("Police Sanitation Fire\n");
printf("----------------------------------");
for(police=2;police<=6;police+=2){
for(sanitation=1;sanitation<=7;sanitation++){
for(fire=1;fire<=7;fire++){
if(police!=sanitation && sanitation!=fire && fire!=police && police+fire+sanitation==12){
printf("\n%d\t\t%d\t\t%d",police,sanitation,fire);
}
}
}
}
return 0;
}
|
Write a version of this Ruby function in C with identical behavior. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| #include<stdio.h>
int main()
{
int police,sanitation,fire;
printf("Police Sanitation Fire\n");
printf("----------------------------------");
for(police=2;police<=6;police+=2){
for(sanitation=1;sanitation<=7;sanitation++){
for(fire=1;fire<=7;fire++){
if(police!=sanitation && sanitation!=fire && fire!=police && police+fire+sanitation==12){
printf("\n%d\t\t%d\t\t%d",police,sanitation,fire);
}
}
}
}
return 0;
}
|
Produce a language-to-language conversion: from Ruby to C#, same semantics. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| using System;
public class Program
{
public static void Main() {
for (int p = 2; p <= 7; p+=2) {
for (int s = 1; s <= 7; s++) {
int f = 12 - p - s;
if (s >= f) break;
if (f > 7) continue;
if (s == p || f == p) continue;
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}");
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}");
}
}
}
}
|
Preserve the algorithm and functionality while converting the code from Ruby to C#. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| using System;
public class Program
{
public static void Main() {
for (int p = 2; p <= 7; p+=2) {
for (int s = 1; s <= 7; s++) {
int f = 12 - p - s;
if (s >= f) break;
if (f > 7) continue;
if (s == p || f == p) continue;
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}");
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}");
}
}
}
}
|
Convert this Ruby block to C++, preserving its control flow and logic. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| #include <iostream>
#include <iomanip>
int main( int argc, char* argv[] ) {
int sol = 1;
std::cout << "\t\tFIRE\t\tPOLICE\t\tSANITATION\n";
for( int f = 1; f < 8; f++ ) {
for( int p = 1; p < 8; p++ ) {
for( int s = 1; s < 8; s++ ) {
if( f != p && f != s && p != s && !( p & 1 ) && ( f + s + p == 12 ) ) {
std::cout << "SOLUTION #" << std::setw( 2 ) << sol++ << std::setw( 2 )
<< ":\t" << std::setw( 2 ) << f << "\t\t " << std::setw( 3 ) << p
<< "\t\t" << std::setw( 6 ) << s << "\n";
}
}
}
}
return 0;
}
|
Rewrite this program in C++ while keeping its functionality equivalent to the Ruby version. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| #include <iostream>
#include <iomanip>
int main( int argc, char* argv[] ) {
int sol = 1;
std::cout << "\t\tFIRE\t\tPOLICE\t\tSANITATION\n";
for( int f = 1; f < 8; f++ ) {
for( int p = 1; p < 8; p++ ) {
for( int s = 1; s < 8; s++ ) {
if( f != p && f != s && p != s && !( p & 1 ) && ( f + s + p == 12 ) ) {
std::cout << "SOLUTION #" << std::setw( 2 ) << sol++ << std::setw( 2 )
<< ":\t" << std::setw( 2 ) << f << "\t\t " << std::setw( 3 ) << p
<< "\t\t" << std::setw( 6 ) << s << "\n";
}
}
}
}
return 0;
}
|
Generate a Java translation of this Ruby snippet without changing its computational steps. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| public class DepartmentNumbers {
public static void main(String[] args) {
System.out.println("Police Sanitation Fire");
System.out.println("------ ---------- ----");
int count = 0;
for (int i = 2; i <= 6; i += 2) {
for (int j = 1; j <= 7; ++j) {
if (j == i) continue;
for (int k = 1; k <= 7; ++k) {
if (k == i || k == j) continue;
if (i + j + k != 12) continue;
System.out.printf(" %d %d %d\n", i, j, k);
count++;
}
}
}
System.out.printf("\n%d valid combinations", count);
}
}
|
Translate the given Ruby code snippet into Java without altering its behavior. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| public class DepartmentNumbers {
public static void main(String[] args) {
System.out.println("Police Sanitation Fire");
System.out.println("------ ---------- ----");
int count = 0;
for (int i = 2; i <= 6; i += 2) {
for (int j = 1; j <= 7; ++j) {
if (j == i) continue;
for (int k = 1; k <= 7; ++k) {
if (k == i || k == j) continue;
if (i + j + k != 12) continue;
System.out.printf(" %d %d %d\n", i, j, k);
count++;
}
}
}
System.out.printf("\n%d valid combinations", count);
}
}
|
Translate this program into Python but keep the logic exactly as in Ruby. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| from itertools import permutations
def solve():
c, p, f, s = "\\,Police,Fire,Sanitation".split(',')
print(f"{c:>3} {p:^6} {f:^4} {s:^10}")
c = 1
for p, f, s in permutations(range(1, 8), r=3):
if p + s + f == 12 and p % 2 == 0:
print(f"{c:>3}: {p:^6} {f:^4} {s:^10}")
c += 1
if __name__ == '__main__':
solve()
|
Change the following Ruby code into Python without altering its purpose. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| from itertools import permutations
def solve():
c, p, f, s = "\\,Police,Fire,Sanitation".split(',')
print(f"{c:>3} {p:^6} {f:^4} {s:^10}")
c = 1
for p, f, s in permutations(range(1, 8), r=3):
if p + s + f == 12 and p % 2 == 0:
print(f"{c:>3}: {p:^6} {f:^4} {s:^10}")
c += 1
if __name__ == '__main__':
solve()
|
Rewrite this program in VB while keeping its functionality equivalent to the Ruby version. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| Module Module1
Sub Main()
For p = 2 To 7 Step 2
For s = 1 To 7
Dim f = 12 - p - s
If s >= f Then
Exit For
End If
If f > 7 Then
Continue For
End If
If s = p OrElse f = p Then
Continue For
End If
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}")
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}")
Next
Next
End Sub
End Module
|
Rewrite the snippet below in VB so it works the same as the original Ruby code. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| Module Module1
Sub Main()
For p = 2 To 7 Step 2
For s = 1 To 7
Dim f = 12 - p - s
If s >= f Then
Exit For
End If
If f > 7 Then
Continue For
End If
If s = p OrElse f = p Then
Continue For
End If
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}")
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}")
Next
Next
End Sub
End Module
|
Port the provided Ruby code into Go while preserving the original functionality. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| package main
import "fmt"
func main() {
fmt.Println("Police Sanitation Fire")
fmt.Println("------ ---------- ----")
count := 0
for i := 2; i < 7; i += 2 {
for j := 1; j < 8; j++ {
if j == i { continue }
for k := 1; k < 8; k++ {
if k == i || k == j { continue }
if i + j + k != 12 { continue }
fmt.Printf(" %d %d %d\n", i, j, k)
count++
}
}
}
fmt.Printf("\n%d valid combinations\n", count)
}
|
Generate a Go translation of this Ruby snippet without changing its computational steps. | (1..7).to_a.permutation(3){|p| puts p.join if p.first.even? && p.sum == 12 }
| package main
import "fmt"
func main() {
fmt.Println("Police Sanitation Fire")
fmt.Println("------ ---------- ----")
count := 0
for i := 2; i < 7; i += 2 {
for j := 1; j < 8; j++ {
if j == i { continue }
for k := 1; k < 8; k++ {
if k == i || k == j { continue }
if i + j + k != 12 { continue }
fmt.Printf(" %d %d %d\n", i, j, k)
count++
}
}
}
fmt.Printf("\n%d valid combinations\n", count)
}
|
Rewrite the snippet below in C so it works the same as the original Scala code. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| #include<stdio.h>
int main()
{
int police,sanitation,fire;
printf("Police Sanitation Fire\n");
printf("----------------------------------");
for(police=2;police<=6;police+=2){
for(sanitation=1;sanitation<=7;sanitation++){
for(fire=1;fire<=7;fire++){
if(police!=sanitation && sanitation!=fire && fire!=police && police+fire+sanitation==12){
printf("\n%d\t\t%d\t\t%d",police,sanitation,fire);
}
}
}
}
return 0;
}
|
Preserve the algorithm and functionality while converting the code from Scala to C. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| #include<stdio.h>
int main()
{
int police,sanitation,fire;
printf("Police Sanitation Fire\n");
printf("----------------------------------");
for(police=2;police<=6;police+=2){
for(sanitation=1;sanitation<=7;sanitation++){
for(fire=1;fire<=7;fire++){
if(police!=sanitation && sanitation!=fire && fire!=police && police+fire+sanitation==12){
printf("\n%d\t\t%d\t\t%d",police,sanitation,fire);
}
}
}
}
return 0;
}
|
Produce a functionally identical C# code for the snippet given in Scala. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| using System;
public class Program
{
public static void Main() {
for (int p = 2; p <= 7; p+=2) {
for (int s = 1; s <= 7; s++) {
int f = 12 - p - s;
if (s >= f) break;
if (f > 7) continue;
if (s == p || f == p) continue;
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}");
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}");
}
}
}
}
|
Maintain the same structure and functionality when rewriting this code in C#. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| using System;
public class Program
{
public static void Main() {
for (int p = 2; p <= 7; p+=2) {
for (int s = 1; s <= 7; s++) {
int f = 12 - p - s;
if (s >= f) break;
if (f > 7) continue;
if (s == p || f == p) continue;
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}");
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}");
}
}
}
}
|
Port the following code from Scala to C++ with equivalent syntax and logic. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| #include <iostream>
#include <iomanip>
int main( int argc, char* argv[] ) {
int sol = 1;
std::cout << "\t\tFIRE\t\tPOLICE\t\tSANITATION\n";
for( int f = 1; f < 8; f++ ) {
for( int p = 1; p < 8; p++ ) {
for( int s = 1; s < 8; s++ ) {
if( f != p && f != s && p != s && !( p & 1 ) && ( f + s + p == 12 ) ) {
std::cout << "SOLUTION #" << std::setw( 2 ) << sol++ << std::setw( 2 )
<< ":\t" << std::setw( 2 ) << f << "\t\t " << std::setw( 3 ) << p
<< "\t\t" << std::setw( 6 ) << s << "\n";
}
}
}
}
return 0;
}
|
Change the programming language of this snippet from Scala to C++ without modifying what it does. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| #include <iostream>
#include <iomanip>
int main( int argc, char* argv[] ) {
int sol = 1;
std::cout << "\t\tFIRE\t\tPOLICE\t\tSANITATION\n";
for( int f = 1; f < 8; f++ ) {
for( int p = 1; p < 8; p++ ) {
for( int s = 1; s < 8; s++ ) {
if( f != p && f != s && p != s && !( p & 1 ) && ( f + s + p == 12 ) ) {
std::cout << "SOLUTION #" << std::setw( 2 ) << sol++ << std::setw( 2 )
<< ":\t" << std::setw( 2 ) << f << "\t\t " << std::setw( 3 ) << p
<< "\t\t" << std::setw( 6 ) << s << "\n";
}
}
}
}
return 0;
}
|
Change the programming language of this snippet from Scala to Java without modifying what it does. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| public class DepartmentNumbers {
public static void main(String[] args) {
System.out.println("Police Sanitation Fire");
System.out.println("------ ---------- ----");
int count = 0;
for (int i = 2; i <= 6; i += 2) {
for (int j = 1; j <= 7; ++j) {
if (j == i) continue;
for (int k = 1; k <= 7; ++k) {
if (k == i || k == j) continue;
if (i + j + k != 12) continue;
System.out.printf(" %d %d %d\n", i, j, k);
count++;
}
}
}
System.out.printf("\n%d valid combinations", count);
}
}
|
Write a version of this Scala function in Java with identical behavior. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| public class DepartmentNumbers {
public static void main(String[] args) {
System.out.println("Police Sanitation Fire");
System.out.println("------ ---------- ----");
int count = 0;
for (int i = 2; i <= 6; i += 2) {
for (int j = 1; j <= 7; ++j) {
if (j == i) continue;
for (int k = 1; k <= 7; ++k) {
if (k == i || k == j) continue;
if (i + j + k != 12) continue;
System.out.printf(" %d %d %d\n", i, j, k);
count++;
}
}
}
System.out.printf("\n%d valid combinations", count);
}
}
|
Rewrite this program in Python while keeping its functionality equivalent to the Scala version. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| from itertools import permutations
def solve():
c, p, f, s = "\\,Police,Fire,Sanitation".split(',')
print(f"{c:>3} {p:^6} {f:^4} {s:^10}")
c = 1
for p, f, s in permutations(range(1, 8), r=3):
if p + s + f == 12 and p % 2 == 0:
print(f"{c:>3}: {p:^6} {f:^4} {s:^10}")
c += 1
if __name__ == '__main__':
solve()
|
Transform the following Scala implementation into Python, maintaining the same output and logic. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| from itertools import permutations
def solve():
c, p, f, s = "\\,Police,Fire,Sanitation".split(',')
print(f"{c:>3} {p:^6} {f:^4} {s:^10}")
c = 1
for p, f, s in permutations(range(1, 8), r=3):
if p + s + f == 12 and p % 2 == 0:
print(f"{c:>3}: {p:^6} {f:^4} {s:^10}")
c += 1
if __name__ == '__main__':
solve()
|
Write a version of this Scala function in VB with identical behavior. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| Module Module1
Sub Main()
For p = 2 To 7 Step 2
For s = 1 To 7
Dim f = 12 - p - s
If s >= f Then
Exit For
End If
If f > 7 Then
Continue For
End If
If s = p OrElse f = p Then
Continue For
End If
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}")
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}")
Next
Next
End Sub
End Module
|
Can you help me rewrite this code in VB instead of Scala, keeping it the same logically? |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| Module Module1
Sub Main()
For p = 2 To 7 Step 2
For s = 1 To 7
Dim f = 12 - p - s
If s >= f Then
Exit For
End If
If f > 7 Then
Continue For
End If
If s = p OrElse f = p Then
Continue For
End If
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}")
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}")
Next
Next
End Sub
End Module
|
Change the following Scala code into Go without altering its purpose. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| package main
import "fmt"
func main() {
fmt.Println("Police Sanitation Fire")
fmt.Println("------ ---------- ----")
count := 0
for i := 2; i < 7; i += 2 {
for j := 1; j < 8; j++ {
if j == i { continue }
for k := 1; k < 8; k++ {
if k == i || k == j { continue }
if i + j + k != 12 { continue }
fmt.Printf(" %d %d %d\n", i, j, k)
count++
}
}
}
fmt.Printf("\n%d valid combinations\n", count)
}
|
Generate a Go translation of this Scala snippet without changing its computational steps. |
fun main(args: Array<String>) {
println("Police Sanitation Fire")
println("------ ---------- ----")
var count = 0
for (i in 2..6 step 2) {
for (j in 1..7) {
if (j == i) continue
for (k in 1..7) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println("\n$count valid combinations")
}
| package main
import "fmt"
func main() {
fmt.Println("Police Sanitation Fire")
fmt.Println("------ ---------- ----")
count := 0
for i := 2; i < 7; i += 2 {
for j := 1; j < 8; j++ {
if j == i { continue }
for k := 1; k < 8; k++ {
if k == i || k == j { continue }
if i + j + k != 12 { continue }
fmt.Printf(" %d %d %d\n", i, j, k)
count++
}
}
}
fmt.Printf("\n%d valid combinations\n", count)
}
|
Port the provided Swift code into C while preserving the original functionality. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| #include<stdio.h>
int main()
{
int police,sanitation,fire;
printf("Police Sanitation Fire\n");
printf("----------------------------------");
for(police=2;police<=6;police+=2){
for(sanitation=1;sanitation<=7;sanitation++){
for(fire=1;fire<=7;fire++){
if(police!=sanitation && sanitation!=fire && fire!=police && police+fire+sanitation==12){
printf("\n%d\t\t%d\t\t%d",police,sanitation,fire);
}
}
}
}
return 0;
}
|
Port the following code from Swift to C with equivalent syntax and logic. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| #include<stdio.h>
int main()
{
int police,sanitation,fire;
printf("Police Sanitation Fire\n");
printf("----------------------------------");
for(police=2;police<=6;police+=2){
for(sanitation=1;sanitation<=7;sanitation++){
for(fire=1;fire<=7;fire++){
if(police!=sanitation && sanitation!=fire && fire!=police && police+fire+sanitation==12){
printf("\n%d\t\t%d\t\t%d",police,sanitation,fire);
}
}
}
}
return 0;
}
|
Rewrite the snippet below in C# so it works the same as the original Swift code. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| using System;
public class Program
{
public static void Main() {
for (int p = 2; p <= 7; p+=2) {
for (int s = 1; s <= 7; s++) {
int f = 12 - p - s;
if (s >= f) break;
if (f > 7) continue;
if (s == p || f == p) continue;
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}");
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}");
}
}
}
}
|
Write a version of this Swift function in C# with identical behavior. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| using System;
public class Program
{
public static void Main() {
for (int p = 2; p <= 7; p+=2) {
for (int s = 1; s <= 7; s++) {
int f = 12 - p - s;
if (s >= f) break;
if (f > 7) continue;
if (s == p || f == p) continue;
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}");
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}");
}
}
}
}
|
Write the same code in C++ as shown below in Swift. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| #include <iostream>
#include <iomanip>
int main( int argc, char* argv[] ) {
int sol = 1;
std::cout << "\t\tFIRE\t\tPOLICE\t\tSANITATION\n";
for( int f = 1; f < 8; f++ ) {
for( int p = 1; p < 8; p++ ) {
for( int s = 1; s < 8; s++ ) {
if( f != p && f != s && p != s && !( p & 1 ) && ( f + s + p == 12 ) ) {
std::cout << "SOLUTION #" << std::setw( 2 ) << sol++ << std::setw( 2 )
<< ":\t" << std::setw( 2 ) << f << "\t\t " << std::setw( 3 ) << p
<< "\t\t" << std::setw( 6 ) << s << "\n";
}
}
}
}
return 0;
}
|
Can you help me rewrite this code in C++ instead of Swift, keeping it the same logically? | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| #include <iostream>
#include <iomanip>
int main( int argc, char* argv[] ) {
int sol = 1;
std::cout << "\t\tFIRE\t\tPOLICE\t\tSANITATION\n";
for( int f = 1; f < 8; f++ ) {
for( int p = 1; p < 8; p++ ) {
for( int s = 1; s < 8; s++ ) {
if( f != p && f != s && p != s && !( p & 1 ) && ( f + s + p == 12 ) ) {
std::cout << "SOLUTION #" << std::setw( 2 ) << sol++ << std::setw( 2 )
<< ":\t" << std::setw( 2 ) << f << "\t\t " << std::setw( 3 ) << p
<< "\t\t" << std::setw( 6 ) << s << "\n";
}
}
}
}
return 0;
}
|
Please provide an equivalent version of this Swift code in Java. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| public class DepartmentNumbers {
public static void main(String[] args) {
System.out.println("Police Sanitation Fire");
System.out.println("------ ---------- ----");
int count = 0;
for (int i = 2; i <= 6; i += 2) {
for (int j = 1; j <= 7; ++j) {
if (j == i) continue;
for (int k = 1; k <= 7; ++k) {
if (k == i || k == j) continue;
if (i + j + k != 12) continue;
System.out.printf(" %d %d %d\n", i, j, k);
count++;
}
}
}
System.out.printf("\n%d valid combinations", count);
}
}
|
Produce a functionally identical Java code for the snippet given in Swift. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| public class DepartmentNumbers {
public static void main(String[] args) {
System.out.println("Police Sanitation Fire");
System.out.println("------ ---------- ----");
int count = 0;
for (int i = 2; i <= 6; i += 2) {
for (int j = 1; j <= 7; ++j) {
if (j == i) continue;
for (int k = 1; k <= 7; ++k) {
if (k == i || k == j) continue;
if (i + j + k != 12) continue;
System.out.printf(" %d %d %d\n", i, j, k);
count++;
}
}
}
System.out.printf("\n%d valid combinations", count);
}
}
|
Produce a language-to-language conversion: from Swift to Python, same semantics. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| from itertools import permutations
def solve():
c, p, f, s = "\\,Police,Fire,Sanitation".split(',')
print(f"{c:>3} {p:^6} {f:^4} {s:^10}")
c = 1
for p, f, s in permutations(range(1, 8), r=3):
if p + s + f == 12 and p % 2 == 0:
print(f"{c:>3}: {p:^6} {f:^4} {s:^10}")
c += 1
if __name__ == '__main__':
solve()
|
Produce a functionally identical Python code for the snippet given in Swift. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| from itertools import permutations
def solve():
c, p, f, s = "\\,Police,Fire,Sanitation".split(',')
print(f"{c:>3} {p:^6} {f:^4} {s:^10}")
c = 1
for p, f, s in permutations(range(1, 8), r=3):
if p + s + f == 12 and p % 2 == 0:
print(f"{c:>3}: {p:^6} {f:^4} {s:^10}")
c += 1
if __name__ == '__main__':
solve()
|
Produce a language-to-language conversion: from Swift to VB, same semantics. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| Module Module1
Sub Main()
For p = 2 To 7 Step 2
For s = 1 To 7
Dim f = 12 - p - s
If s >= f Then
Exit For
End If
If f > 7 Then
Continue For
End If
If s = p OrElse f = p Then
Continue For
End If
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}")
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}")
Next
Next
End Sub
End Module
|
Convert this Swift block to VB, preserving its control flow and logic. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| Module Module1
Sub Main()
For p = 2 To 7 Step 2
For s = 1 To 7
Dim f = 12 - p - s
If s >= f Then
Exit For
End If
If f > 7 Then
Continue For
End If
If s = p OrElse f = p Then
Continue For
End If
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}")
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}")
Next
Next
End Sub
End Module
|
Write the same algorithm in Go as shown in this Swift implementation. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| package main
import "fmt"
func main() {
fmt.Println("Police Sanitation Fire")
fmt.Println("------ ---------- ----")
count := 0
for i := 2; i < 7; i += 2 {
for j := 1; j < 8; j++ {
if j == i { continue }
for k := 1; k < 8; k++ {
if k == i || k == j { continue }
if i + j + k != 12 { continue }
fmt.Printf(" %d %d %d\n", i, j, k)
count++
}
}
}
fmt.Printf("\n%d valid combinations\n", count)
}
|
Write the same code in Go as shown below in Swift. | let res = [2, 4, 6].map({x in
return (1...7)
.filter({ $0 != x })
.map({y -> (Int, Int, Int)? in
let z = 12 - (x + y)
guard y != z && 1 <= z && z <= 7 else {
return nil
}
return (x, y, z)
}).compactMap({ $0 })
}).flatMap({ $0 })
for result in res {
print(result)
}
| package main
import "fmt"
func main() {
fmt.Println("Police Sanitation Fire")
fmt.Println("------ ---------- ----")
count := 0
for i := 2; i < 7; i += 2 {
for j := 1; j < 8; j++ {
if j == i { continue }
for k := 1; k < 8; k++ {
if k == i || k == j { continue }
if i + j + k != 12 { continue }
fmt.Printf(" %d %d %d\n", i, j, k)
count++
}
}
}
fmt.Printf("\n%d valid combinations\n", count)
}
|
Write a version of this Tcl function in C with identical behavior. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| #include<stdio.h>
int main()
{
int police,sanitation,fire;
printf("Police Sanitation Fire\n");
printf("----------------------------------");
for(police=2;police<=6;police+=2){
for(sanitation=1;sanitation<=7;sanitation++){
for(fire=1;fire<=7;fire++){
if(police!=sanitation && sanitation!=fire && fire!=police && police+fire+sanitation==12){
printf("\n%d\t\t%d\t\t%d",police,sanitation,fire);
}
}
}
}
return 0;
}
|
Produce a functionally identical C code for the snippet given in Tcl. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| #include<stdio.h>
int main()
{
int police,sanitation,fire;
printf("Police Sanitation Fire\n");
printf("----------------------------------");
for(police=2;police<=6;police+=2){
for(sanitation=1;sanitation<=7;sanitation++){
for(fire=1;fire<=7;fire++){
if(police!=sanitation && sanitation!=fire && fire!=police && police+fire+sanitation==12){
printf("\n%d\t\t%d\t\t%d",police,sanitation,fire);
}
}
}
}
return 0;
}
|
Convert this Tcl snippet to C# and keep its semantics consistent. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| using System;
public class Program
{
public static void Main() {
for (int p = 2; p <= 7; p+=2) {
for (int s = 1; s <= 7; s++) {
int f = 12 - p - s;
if (s >= f) break;
if (f > 7) continue;
if (s == p || f == p) continue;
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}");
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}");
}
}
}
}
|
Write the same algorithm in C# as shown in this Tcl implementation. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| using System;
public class Program
{
public static void Main() {
for (int p = 2; p <= 7; p+=2) {
for (int s = 1; s <= 7; s++) {
int f = 12 - p - s;
if (s >= f) break;
if (f > 7) continue;
if (s == p || f == p) continue;
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}");
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}");
}
}
}
}
|
Keep all operations the same but rewrite the snippet in C++. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| #include <iostream>
#include <iomanip>
int main( int argc, char* argv[] ) {
int sol = 1;
std::cout << "\t\tFIRE\t\tPOLICE\t\tSANITATION\n";
for( int f = 1; f < 8; f++ ) {
for( int p = 1; p < 8; p++ ) {
for( int s = 1; s < 8; s++ ) {
if( f != p && f != s && p != s && !( p & 1 ) && ( f + s + p == 12 ) ) {
std::cout << "SOLUTION #" << std::setw( 2 ) << sol++ << std::setw( 2 )
<< ":\t" << std::setw( 2 ) << f << "\t\t " << std::setw( 3 ) << p
<< "\t\t" << std::setw( 6 ) << s << "\n";
}
}
}
}
return 0;
}
|
Translate the given Tcl code snippet into C++ without altering its behavior. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| #include <iostream>
#include <iomanip>
int main( int argc, char* argv[] ) {
int sol = 1;
std::cout << "\t\tFIRE\t\tPOLICE\t\tSANITATION\n";
for( int f = 1; f < 8; f++ ) {
for( int p = 1; p < 8; p++ ) {
for( int s = 1; s < 8; s++ ) {
if( f != p && f != s && p != s && !( p & 1 ) && ( f + s + p == 12 ) ) {
std::cout << "SOLUTION #" << std::setw( 2 ) << sol++ << std::setw( 2 )
<< ":\t" << std::setw( 2 ) << f << "\t\t " << std::setw( 3 ) << p
<< "\t\t" << std::setw( 6 ) << s << "\n";
}
}
}
}
return 0;
}
|
Translate the given Tcl code snippet into Java without altering its behavior. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| public class DepartmentNumbers {
public static void main(String[] args) {
System.out.println("Police Sanitation Fire");
System.out.println("------ ---------- ----");
int count = 0;
for (int i = 2; i <= 6; i += 2) {
for (int j = 1; j <= 7; ++j) {
if (j == i) continue;
for (int k = 1; k <= 7; ++k) {
if (k == i || k == j) continue;
if (i + j + k != 12) continue;
System.out.printf(" %d %d %d\n", i, j, k);
count++;
}
}
}
System.out.printf("\n%d valid combinations", count);
}
}
|
Change the following Tcl code into Java without altering its purpose. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| public class DepartmentNumbers {
public static void main(String[] args) {
System.out.println("Police Sanitation Fire");
System.out.println("------ ---------- ----");
int count = 0;
for (int i = 2; i <= 6; i += 2) {
for (int j = 1; j <= 7; ++j) {
if (j == i) continue;
for (int k = 1; k <= 7; ++k) {
if (k == i || k == j) continue;
if (i + j + k != 12) continue;
System.out.printf(" %d %d %d\n", i, j, k);
count++;
}
}
}
System.out.printf("\n%d valid combinations", count);
}
}
|
Rewrite this program in Python while keeping its functionality equivalent to the Tcl version. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| from itertools import permutations
def solve():
c, p, f, s = "\\,Police,Fire,Sanitation".split(',')
print(f"{c:>3} {p:^6} {f:^4} {s:^10}")
c = 1
for p, f, s in permutations(range(1, 8), r=3):
if p + s + f == 12 and p % 2 == 0:
print(f"{c:>3}: {p:^6} {f:^4} {s:^10}")
c += 1
if __name__ == '__main__':
solve()
|
Convert this Tcl block to Python, preserving its control flow and logic. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| from itertools import permutations
def solve():
c, p, f, s = "\\,Police,Fire,Sanitation".split(',')
print(f"{c:>3} {p:^6} {f:^4} {s:^10}")
c = 1
for p, f, s in permutations(range(1, 8), r=3):
if p + s + f == 12 and p % 2 == 0:
print(f"{c:>3}: {p:^6} {f:^4} {s:^10}")
c += 1
if __name__ == '__main__':
solve()
|
Produce a language-to-language conversion: from Tcl to VB, same semantics. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| Module Module1
Sub Main()
For p = 2 To 7 Step 2
For s = 1 To 7
Dim f = 12 - p - s
If s >= f Then
Exit For
End If
If f > 7 Then
Continue For
End If
If s = p OrElse f = p Then
Continue For
End If
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}")
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}")
Next
Next
End Sub
End Module
|
Ensure the translated VB code behaves exactly like the original Tcl snippet. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| Module Module1
Sub Main()
For p = 2 To 7 Step 2
For s = 1 To 7
Dim f = 12 - p - s
If s >= f Then
Exit For
End If
If f > 7 Then
Continue For
End If
If s = p OrElse f = p Then
Continue For
End If
Console.WriteLine($"Police:{p}, Sanitation:{s}, Fire:{f}")
Console.WriteLine($"Police:{p}, Sanitation:{f}, Fire:{s}")
Next
Next
End Sub
End Module
|
Write a version of this Tcl function in Go with identical behavior. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| package main
import "fmt"
func main() {
fmt.Println("Police Sanitation Fire")
fmt.Println("------ ---------- ----")
count := 0
for i := 2; i < 7; i += 2 {
for j := 1; j < 8; j++ {
if j == i { continue }
for k := 1; k < 8; k++ {
if k == i || k == j { continue }
if i + j + k != 12 { continue }
fmt.Printf(" %d %d %d\n", i, j, k)
count++
}
}
}
fmt.Printf("\n%d valid combinations\n", count)
}
|
Ensure the translated Go code behaves exactly like the original Tcl snippet. |
proc .. max {
for {set i 1} {$i <= $max} {incr i} {
lappend l $i
}
return $l
}
proc anyEqual l {
if {[llength [lsort -unique $l]] != [llength $l]} {
return 1
}
return 0
}
proc odd n {
expr $n %2 != 0
}
proc sum args {
expr [join $args +]
}
set sanitation [.. 7]
set fire $sanitation
set police [lmap e $sanitation {
if [odd $e] continue
set e
}]
set valid 0
foreach p $police {
foreach s $sanitation {
foreach f $fire {
if [anyEqual [list $p $s $f]] continue
if {[sum $p $s $f] != 12} continue
puts "$p $s $f"
incr valid
}
}
}
puts "$valid valid combinations found."
| package main
import "fmt"
func main() {
fmt.Println("Police Sanitation Fire")
fmt.Println("------ ---------- ----")
count := 0
for i := 2; i < 7; i += 2 {
for j := 1; j < 8; j++ {
if j == i { continue }
for k := 1; k < 8; k++ {
if k == i || k == j { continue }
if i + j + k != 12 { continue }
fmt.Printf(" %d %d %d\n", i, j, k)
count++
}
}
}
fmt.Printf("\n%d valid combinations\n", count)
}
|
Transform the following Rust implementation into PHP, maintaining the same output and logic. | extern crate num_iter;
fn main() {
println!("Police Sanitation Fire");
println!("----------------------");
for police in num_iter::range_step(2, 7, 2) {
for sanitation in 1..8 {
for fire in 1..8 {
if police != sanitation
&& sanitation != fire
&& fire != police
&& police + fire + sanitation == 12
{
println!("{:6}{:11}{:4}", police, sanitation, fire);
}
}
}
}
}
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Please provide an equivalent version of this Rust code in PHP. | extern crate num_iter;
fn main() {
println!("Police Sanitation Fire");
println!("----------------------");
for police in num_iter::range_step(2, 7, 2) {
for sanitation in 1..8 {
for fire in 1..8 {
if police != sanitation
&& sanitation != fire
&& fire != police
&& police + fire + sanitation == 12
{
println!("{:6}{:11}{:4}", police, sanitation, fire);
}
}
}
}
}
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Generate an equivalent PHP version of this Ada code. | with Ada.Text_IO;
procedure Department_Numbers is
use Ada.Text_IO;
begin
Put_Line (" P S F");
for Police in 2 .. 6 loop
for Sanitation in 1 .. 7 loop
for Fire in 1 .. 7 loop
if
Police mod 2 = 0 and
Police + Sanitation + Fire = 12 and
Sanitation /= Police and
Sanitation /= Fire and
Police /= Fire
then
Put_Line (Police'Image & Sanitation'Image & Fire'Image);
end if;
end loop;
end loop;
end loop;
end Department_Numbers;
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Write the same code in PHP as shown below in Ada. | with Ada.Text_IO;
procedure Department_Numbers is
use Ada.Text_IO;
begin
Put_Line (" P S F");
for Police in 2 .. 6 loop
for Sanitation in 1 .. 7 loop
for Fire in 1 .. 7 loop
if
Police mod 2 = 0 and
Police + Sanitation + Fire = 12 and
Sanitation /= Police and
Sanitation /= Fire and
Police /= Fire
then
Put_Line (Police'Image & Sanitation'Image & Fire'Image);
end if;
end loop;
end loop;
end loop;
end Department_Numbers;
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Transform the following Arturo implementation into PHP, maintaining the same output and logic. | loop 1..7 'x [
loop 1..7 'y [
loop 1..7 'z [
if all? @[
even? x
12 = sum @[x y z]
3 = size unique @[x y z]
] -> print [x y z]
]
]
]
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Convert the following code from Arturo to PHP, ensuring the logic remains intact. | loop 1..7 'x [
loop 1..7 'y [
loop 1..7 'z [
if all? @[
even? x
12 = sum @[x y z]
3 = size unique @[x y z]
] -> print [x y z]
]
]
]
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Translate the given AutoHotKey code snippet into PHP without altering its behavior. | perm(elements, n, opt:="", Delim:="", str:="", res:="", j:=0, dup:="") {
res := IsObject(res) ? res : [], dup := IsObject(dup) ? dup : []
if (n > j)
Loop, parse, elements, % Delim
res := !(InStr(str, A_LoopField) && !(InStr(opt, "rep"))) ? perm(elements, n, opt, Delim, trim(str Delim A_LoopField, Delim), res, j+1, dup) : res
else if !(dup[x := perm_sort(str, Delim)] && (InStr(opt, "comb")))
dup[x] := 1, res.Insert(str)
return res, j++
}
perm_sort(str, Delim){
Loop, Parse, str, % Delim
res .= A_LoopField "`n"
Sort, res, D`n
return StrReplace(res, "`n", Delim)
}
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Generate an equivalent PHP version of this AutoHotKey code. | perm(elements, n, opt:="", Delim:="", str:="", res:="", j:=0, dup:="") {
res := IsObject(res) ? res : [], dup := IsObject(dup) ? dup : []
if (n > j)
Loop, parse, elements, % Delim
res := !(InStr(str, A_LoopField) && !(InStr(opt, "rep"))) ? perm(elements, n, opt, Delim, trim(str Delim A_LoopField, Delim), res, j+1, dup) : res
else if !(dup[x := perm_sort(str, Delim)] && (InStr(opt, "comb")))
dup[x] := 1, res.Insert(str)
return res, j++
}
perm_sort(str, Delim){
Loop, Parse, str, % Delim
res .= A_LoopField "`n"
Sort, res, D`n
return StrReplace(res, "`n", Delim)
}
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Generate a PHP translation of this AWK snippet without changing its computational steps. |
BEGIN {
print("
for (fire=1; fire<=7; fire++) {
for (police=1; police<=7; police++) {
for (sanitation=1; sanitation<=7; sanitation++) {
if (rules() ~ /^1+$/) {
printf("%2d %2d %2d %2d\n",++count,fire,police,sanitation)
}
}
}
}
exit(0)
}
function rules( stmt1,stmt2,stmt3) {
stmt1 = fire != police && fire != sanitation && police != sanitation
stmt2 = fire + police + sanitation == 12
stmt3 = police % 2 == 0
return(stmt1 stmt2 stmt3)
}
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Write a version of this AWK function in PHP with identical behavior. |
BEGIN {
print("
for (fire=1; fire<=7; fire++) {
for (police=1; police<=7; police++) {
for (sanitation=1; sanitation<=7; sanitation++) {
if (rules() ~ /^1+$/) {
printf("%2d %2d %2d %2d\n",++count,fire,police,sanitation)
}
}
}
}
exit(0)
}
function rules( stmt1,stmt2,stmt3) {
stmt1 = fire != police && fire != sanitation && police != sanitation
stmt2 = fire + police + sanitation == 12
stmt3 = police % 2 == 0
return(stmt1 stmt2 stmt3)
}
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Produce a functionally identical PHP code for the snippet given in BBC_Basic. |
max_dept_num% = 7
dept_sum% = 12
PRINT "police sanitation fire"
FOR police% = 2 TO max_dept_num% STEP 2
FOR sanitation% = 1 TO max_dept_num%
IF sanitation% <> police% THEN
fire% = (dept_sum% - police%) - sanitation%
IF fire% > 0 AND fire% <= max_dept_num% AND fire% <> sanitation% AND fire% <> police% THEN PRINT " "; police%; " "; sanitation%; " "; fire%
ENDIF
NEXT
NEXT
END
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Generate an equivalent PHP version of this BBC_Basic code. |
max_dept_num% = 7
dept_sum% = 12
PRINT "police sanitation fire"
FOR police% = 2 TO max_dept_num% STEP 2
FOR sanitation% = 1 TO max_dept_num%
IF sanitation% <> police% THEN
fire% = (dept_sum% - police%) - sanitation%
IF fire% > 0 AND fire% <= max_dept_num% AND fire% <> sanitation% AND fire% <> police% THEN PRINT " "; police%; " "; sanitation%; " "; fire%
ENDIF
NEXT
NEXT
END
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Keep all operations the same but rewrite the snippet in PHP. | (let [n (range 1 8)]
(for [police n
sanitation n
fire n
:when (distinct? police sanitation fire)
:when (even? police)
:when (= 12 (+ police sanitation fire))]
(println police sanitation fire)))
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Translate the given Clojure code snippet into PHP without altering its behavior. | (let [n (range 1 8)]
(for [police n
sanitation n
fire n
:when (distinct? police sanitation fire)
:when (even? police)
:when (= 12 (+ police sanitation fire))]
(println police sanitation fire)))
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Translate this program into PHP but keep the logic exactly as in Common_Lisp. | departmentNumbers
=validRows(
LAMBDA(ab,
LET(
x, INDEX(ab, 0, 1),
y, INDEX(ab, 0, 2),
z, 12 - (x + y),
IF(y <> z,
IF(1 <= z,
IF(7 >= z,
CHOOSE({1, 2, 3}, x, y, z),
NA()
),
NA()
),
NA()
)
)
)(
cartesianProduct({2
SEQUENCE(7, 1, 1, 1)
)
)
)
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Write a version of this Common_Lisp function in PHP with identical behavior. | departmentNumbers
=validRows(
LAMBDA(ab,
LET(
x, INDEX(ab, 0, 1),
y, INDEX(ab, 0, 2),
z, 12 - (x + y),
IF(y <> z,
IF(1 <= z,
IF(7 >= z,
CHOOSE({1, 2, 3}, x, y, z),
NA()
),
NA()
),
NA()
)
)
)(
cartesianProduct({2
SEQUENCE(7, 1, 1, 1)
)
)
)
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Produce a language-to-language conversion: from D to PHP, same semantics. | import std.stdio, std.range;
void main() {
int sol = 1;
writeln("\t\tFIRE\t\tPOLICE\t\tSANITATION");
foreach( f; iota(1,8) ) {
foreach( p; iota(1,8) ) {
foreach( s; iota(1,8) ) {
if( f != p && f != s && p != s && !( p & 1 ) && ( f + s + p == 12 ) ) {
writefln("SOLUTION #%2d:\t%2d\t\t%3d\t\t%6d", sol++, f, p, s);
}
}
}
}
}
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Ensure the translated PHP code behaves exactly like the original D snippet. | import std.stdio, std.range;
void main() {
int sol = 1;
writeln("\t\tFIRE\t\tPOLICE\t\tSANITATION");
foreach( f; iota(1,8) ) {
foreach( p; iota(1,8) ) {
foreach( s; iota(1,8) ) {
if( f != p && f != s && p != s && !( p & 1 ) && ( f + s + p == 12 ) ) {
writefln("SOLUTION #%2d:\t%2d\t\t%3d\t\t%6d", sol++, f, p, s);
}
}
}
}
}
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Translate this program into PHP but keep the logic exactly as in Delphi. | program Department_numbers;
uses
System.SysUtils;
var
i, j, k, count: Integer;
begin
writeln('Police Sanitation Fire');
writeln('------ ---------- ----');
count := 0;
i := 2;
while i < 7 do
begin
for j := 1 to 7 do
begin
if j = i then
Continue;
for k := 1 to 7 do
begin
if (k = i) or (k = j) then
Continue;
if i + j + k <> 12 then
Continue;
writeln(format(' %d %d %d', [i, j, k]));
inc(count);
end;
end;
inc(i, 2);
end;
writeln(#10, count, ' valid combinations');
readln;
end.
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Please provide an equivalent version of this Delphi code in PHP. | program Department_numbers;
uses
System.SysUtils;
var
i, j, k, count: Integer;
begin
writeln('Police Sanitation Fire');
writeln('------ ---------- ----');
count := 0;
i := 2;
while i < 7 do
begin
for j := 1 to 7 do
begin
if j = i then
Continue;
for k := 1 to 7 do
begin
if (k = i) or (k = j) then
Continue;
if i + j + k <> 12 then
Continue;
writeln(format(' %d %d %d', [i, j, k]));
inc(count);
end;
end;
inc(i, 2);
end;
writeln(#10, count, ' valid combinations');
readln;
end.
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Translate the given Elixir code snippet into PHP without altering its behavior. | IO.puts("P - F - S")
for p <- [2,4,6],
f <- 1..7,
s <- 1..7,
p != f and p != s and f != s and p + f + s == 12 do
"
end
|> Enum.each(&IO.puts/1)
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Convert this Elixir snippet to PHP and keep its semantics consistent. | IO.puts("P - F - S")
for p <- [2,4,6],
f <- 1..7,
s <- 1..7,
p != f and p != s and f != s and p + f + s == 12 do
"
end
|> Enum.each(&IO.puts/1)
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Produce a language-to-language conversion: from F# to PHP, same semantics. |
type dNum = {Police:int; Fire:int; Sanitation:int}
let fN n=n.Police%2=0&&n.Police+n.Fire+n.Sanitation=12&&n.Police<>n.Fire&&n.Police<>n.Sanitation&&n.Fire<>n.Sanitation
List.init (7*7*7) (fun n->{Police=n%7+1;Fire=(n/7)%7+1;Sanitation=(n/49)+1})|>List.filter fN|>List.iter(printfn "%A")
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Preserve the algorithm and functionality while converting the code from F# to PHP. |
type dNum = {Police:int; Fire:int; Sanitation:int}
let fN n=n.Police%2=0&&n.Police+n.Fire+n.Sanitation=12&&n.Police<>n.Fire&&n.Police<>n.Sanitation&&n.Fire<>n.Sanitation
List.init (7*7*7) (fun n->{Police=n%7+1;Fire=(n/7)%7+1;Sanitation=(n/49)+1})|>List.filter fN|>List.iter(printfn "%A")
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Produce a language-to-language conversion: from Factor to PHP, same semantics. | USING: formatting io kernel math math.combinatorics math.ranges
sequences sets ;
IN: rosetta-code.department-numbers
7 [1,b] 3 <k-permutations>
[ [ first even? ] [ sum 12 = ] bi and ] filter
"{ Police, Sanitation, Fire }" print nl
[ "%[%d,Β %]\n" printf ] each
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Rewrite the snippet below in PHP so it works the same as the original Factor code. | USING: formatting io kernel math math.combinatorics math.ranges
sequences sets ;
IN: rosetta-code.department-numbers
7 [1,b] 3 <k-permutations>
[ [ first even? ] [ sum 12 = ] bi and ] filter
"{ Police, Sanitation, Fire }" print nl
[ "%[%d,Β %]\n" printf ] each
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Keep all operations the same but rewrite the snippet in PHP. |
: fire
2dup = if 2drop drop exit then
2 pick over = if 2drop drop exit then
rot . swap . . cr ;
: sanitation
2dup = if 2drop exit then
12 over - 2 pick -
dup 1 < if 2drop drop exit then
dup 7 > if 2drop drop exit then
fire ;
: police
8 1 do dup i sanitation loop drop ;
: departments cr
8 2 do i police 2 +loop ;
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Produce a functionally identical PHP code for the snippet given in Forth. |
: fire
2dup = if 2drop drop exit then
2 pick over = if 2drop drop exit then
rot . swap . . cr ;
: sanitation
2dup = if 2drop exit then
12 over - 2 pick -
dup 1 < if 2drop drop exit then
dup 7 > if 2drop drop exit then
fire ;
: police
8 1 do dup i sanitation loop drop ;
: departments cr
8 2 do i police 2 +loop ;
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Transform the following Fortran implementation into PHP, maintaining the same output and logic. | INTEGER P,S,F
1 PP:DO P = 2,7,2
2 SS:DO S = 1,7
3 IF (P.EQ.S) CYCLE SS
4 F = 12 - (P + S)
5 IF (F.LE.0 .OR. F.GT.7) CYCLE SS
6 IF ((F - S)*(F - P)) 7,8,7
7 WRITE (6,"(3I2)") P,S,F
8 END DO SS
9 END DO PP
END
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Convert this Fortran block to PHP, preserving its control flow and logic. | INTEGER P,S,F
1 PP:DO P = 2,7,2
2 SS:DO S = 1,7
3 IF (P.EQ.S) CYCLE SS
4 F = 12 - (P + S)
5 IF (F.LE.0 .OR. F.GT.7) CYCLE SS
6 IF ((F - S)*(F - P)) 7,8,7
7 WRITE (6,"(3I2)") P,S,F
8 END DO SS
9 END DO PP
END
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Port the provided Groovy code into PHP while preserving the original functionality. | class DepartmentNumbers {
static void main(String[] args) {
println("Police Sanitation Fire")
println("------ ---------- ----")
int count = 0
for (int i = 2; i <= 6; i += 2) {
for (int j = 1; j <= 7; ++j) {
if (j == i) continue
for (int k = 1; k <= 7; ++k) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println()
println("$count valid combinations")
}
}
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Generate an equivalent PHP version of this Groovy code. | class DepartmentNumbers {
static void main(String[] args) {
println("Police Sanitation Fire")
println("------ ---------- ----")
int count = 0
for (int i = 2; i <= 6; i += 2) {
for (int j = 1; j <= 7; ++j) {
if (j == i) continue
for (int k = 1; k <= 7; ++k) {
if (k == i || k == j) continue
if (i + j + k != 12) continue
println(" $i $j $k")
count++
}
}
}
println()
println("$count valid combinations")
}
}
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Preserve the algorithm and functionality while converting the code from Haskell to PHP. | main :: IO ()
main =
mapM_ print $
[2, 4, 6] >>=
\x ->
[1 .. 7] >>=
\y ->
[12 - (x + y)] >>=
\z ->
case y /= z && 1 <= z && z <= 7 of
True -> [(x, y, z)]
_ -> []
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Port the following code from Haskell to PHP with equivalent syntax and logic. | main :: IO ()
main =
mapM_ print $
[2, 4, 6] >>=
\x ->
[1 .. 7] >>=
\y ->
[12 - (x + y)] >>=
\z ->
case y /= z && 1 <= z && z <= 7 of
True -> [(x, y, z)]
_ -> []
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Maintain the same structure and functionality when rewriting this code in PHP. | require 'stats'
permfrom=: ,/@(perm@[ {"_ 1 comb)
alluniq=: # = #@~.
addto12=: 12 = +/
iseven=: -.@(2&|)
policeeven=: {.@iseven
conditions=: policeeven *. addto12 *. alluniq
Validnums=: >: i.7
getDeptNums=: [: (#~ conditions"1) Validnums {~ permfrom
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Convert this J snippet to PHP and keep its semantics consistent. | require 'stats'
permfrom=: ,/@(perm@[ {"_ 1 comb)
alluniq=: # = #@~.
addto12=: 12 = +/
iseven=: -.@(2&|)
policeeven=: {.@iseven
conditions=: policeeven *. addto12 *. alluniq
Validnums=: >: i.7
getDeptNums=: [: (#~ conditions"1) Validnums {~ permfrom
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Change the programming language of this snippet from Julia to PHP without modifying what it does. | using Printf
function findsolution(rng=1:7)
rst = Matrix{Int}(0, 3)
for p in rng, f in rng, s in rng
if p != s != f != p && p + s + f == 12 && iseven(p)
rst = [rst; p s f]
end
end
return rst
end
function printsolutions(sol::Matrix{Int})
println(" Pol. Fire San.")
println(" ---- ---- ----")
for row in 1:size(sol, 1)
@printf("%2i | %4i%7i%7i\n", row, sol[row, :]...)
end
end
printsolutions(findsolution())
| <?php
$valid = 0;
for ($police = 2 ; $police <= 6 ; $police += 2) {
for ($sanitation = 1 ; $sanitation <= 7 ; $sanitation++) {
$fire = 12 - $police - $sanitation;
if ((1 <= $fire) and ($fire <= 7) and ($police != $sanitation) and ($sanitation != $fire)) {
echo 'Police: ', $police, ', Sanitation: ', $sanitation, ', Fire: ', $fire, PHP_EOL;
$valid++;
}
}
}
echo $valid, ' valid combinations found.', PHP_EOL;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.