message stringlengths 2 44.5k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 42 109k | cluster float64 5 5 | __index_level_0__ int64 84 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
Input
The only line contains odd integer n (1 ≤ n ≤ 49).
Output
Prin... | instruction | 0 | 74,636 | 5 | 149,272 |
Yes | output | 1 | 74,636 | 5 | 149,273 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
Input
The only line contains odd integer n (1 ≤ n ≤ 49).
Output
Prin... | instruction | 0 | 74,637 | 5 | 149,274 |
Yes | output | 1 | 74,637 | 5 | 149,275 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
Input
The only line contains odd integer n (1 ≤ n ≤ 49).
Output
Prin... | instruction | 0 | 74,639 | 5 | 149,278 |
No | output | 1 | 74,639 | 5 | 149,279 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
Input
The only line contains odd integer n (1 ≤ n ≤ 49).
Output
Prin... | instruction | 0 | 74,640 | 5 | 149,280 |
No | output | 1 | 74,640 | 5 | 149,281 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
Input
The only line contains odd integer n (1 ≤ n ≤ 49).
Output
Prin... | instruction | 0 | 74,641 | 5 | 149,282 |
No | output | 1 | 74,641 | 5 | 149,283 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* All values in input are integers.
Input
Input is given f... | instruction | 0 | 74,827 | 5 | 149,654 |
"Correct Solution:
```
a, b = map(int, input().split())
aplusb = a + b
ab = a * b
if aplusb == 15:
print("+")
elif ab == 15:
print("*")
else:
print("x")
``` | output | 1 | 74,827 | 5 | 149,655 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* All values in input are integers.
Input
Input is given f... | instruction | 0 | 74,828 | 5 | 149,656 |
"Correct Solution:
```
x, y = map(int,input().split())
if x*y == 15:
print("*")
elif x+y == 15:
print("+")
else:
print("x")
``` | output | 1 | 74,828 | 5 | 149,657 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* All values in input are integers.
Input
Input is given f... | instruction | 0 | 74,829 | 5 | 149,658 |
"Correct Solution:
```
a,b = map(int,input().split(" "))
if a + b == 15:
print('+')
elif a * b == 15:
print('*')
else:
print('x')
``` | output | 1 | 74,829 | 5 | 149,659 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* All values in input are integers.
Input
Input is given f... | instruction | 0 | 74,830 | 5 | 149,660 |
"Correct Solution:
```
def resolve():
a, b = map(int, input().split())
print("+" if a+b == 15 else "*" if a*b == 15 else "x")
resolve()
``` | output | 1 | 74,830 | 5 | 149,661 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* All values in input are integers.
Input
Input is given f... | instruction | 0 | 74,831 | 5 | 149,662 |
"Correct Solution:
```
n = input().split() # "1 2 3"と入力
a = n[0]
b = n[1]
if int(a) * int(b) == 15:
print("*")
elif int(a) + int(b) == 15:
print("+")
else:
print("x")
``` | output | 1 | 74,831 | 5 | 149,663 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* All values in input are integers.
Input
Input is given f... | instruction | 0 | 74,832 | 5 | 149,664 |
"Correct Solution:
```
a, b = input().split(" ")
a = int(a)
b = int(b)
if a+b==15:
print("+")
elif a*b==15:
print("*")
else:
print("x")
``` | output | 1 | 74,832 | 5 | 149,665 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* All values in input are integers.
Input
Input is given f... | instruction | 0 | 74,833 | 5 | 149,666 |
"Correct Solution:
```
a, b = [int(i) for i in input().split()]
if a*b == 15:
print("*")
elif a+b == 15:
print("+")
else:
print("x")
``` | output | 1 | 74,833 | 5 | 149,667 |
Provide a correct Python 3 solution for this coding contest problem.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* All values in input are integers.
Input
Input is given f... | instruction | 0 | 74,834 | 5 | 149,668 |
"Correct Solution:
```
s=input();print("".join(c*(eval(s.replace(" ",c))==15)for c in"+*")or"x")
``` | output | 1 | 74,834 | 5 | 149,669 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* Al... | instruction | 0 | 74,835 | 5 | 149,670 |
Yes | output | 1 | 74,835 | 5 | 149,671 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* Al... | instruction | 0 | 74,836 | 5 | 149,672 |
Yes | output | 1 | 74,836 | 5 | 149,673 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* Al... | instruction | 0 | 74,837 | 5 | 149,674 |
Yes | output | 1 | 74,837 | 5 | 149,675 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* Al... | instruction | 0 | 74,838 | 5 | 149,676 |
Yes | output | 1 | 74,838 | 5 | 149,677 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* Al... | instruction | 0 | 74,839 | 5 | 149,678 |
No | output | 1 | 74,839 | 5 | 149,679 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* Al... | instruction | 0 | 74,840 | 5 | 149,680 |
No | output | 1 | 74,840 | 5 | 149,681 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* Al... | instruction | 0 | 74,841 | 5 | 149,682 |
No | output | 1 | 74,841 | 5 | 149,683 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not hold at the same time.
Constraints
* 1 \leq a,b \leq 15
* Al... | instruction | 0 | 74,842 | 5 | 149,684 |
No | output | 1 | 74,842 | 5 | 149,685 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have two strings A = A_1 A_2 ... A_n and B = B_1 B_2 ... B_n of the same length consisting of 0 and 1. The number of 1's in A and B is equal.
You've decided to transform A using the followi... | instruction | 0 | 74,843 | 5 | 149,686 |
No | output | 1 | 74,843 | 5 | 149,687 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (N) $.
Example of calculating the function $ f (5) $:
W... | instruction | 0 | 74,920 | 5 | 149,840 |
"Correct Solution:
```
n = int(input())
a = bin(n)[2:]
if '0' in a:
print(len(a)-1)
else:
print(len(a))
``` | output | 1 | 74,920 | 5 | 149,841 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (N) $.
Example of calculating the function $ f (5) $:
W... | instruction | 0 | 74,921 | 5 | 149,842 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
from math import log2
print(int(log2(int(input()) + 1)))
``` | output | 1 | 74,921 | 5 | 149,843 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (N) $.
Example of calculating the function $ f (5) $:
W... | instruction | 0 | 74,922 | 5 | 149,844 |
"Correct Solution:
```
n = int(input())
cnt = 0
n += 1
while 1:
n //= 2
cnt += 1
if n == 1:
break
print(cnt)
``` | output | 1 | 74,922 | 5 | 149,845 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (N) $.
Example of calculating the function $ f (5) $:
W... | instruction | 0 | 74,923 | 5 | 149,846 |
"Correct Solution:
```
N = int(input())
ans = 0
x = 1
while 2*x-1 <= N:
x = 2*x
ans += 1
print(ans)
``` | output | 1 | 74,923 | 5 | 149,847 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (N) $.
Example of calculating the function $ f (5) $:
W... | instruction | 0 | 74,925 | 5 | 149,850 |
"Correct Solution:
```
x = int(input())
ans = 0
i = 0
while (1 << i) <= x:
if x & (1 << i):
ans += 1
i += 1
print(max(ans, i - 1))
``` | output | 1 | 74,925 | 5 | 149,851 |
Provide a correct Python 3 solution for this coding contest problem.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (N) $.
Example of calculating the function $ f (5) $:
W... | instruction | 0 | 74,927 | 5 | 149,854 |
"Correct Solution:
```
N = int(input())
ans = 0
s = 1
while 2 * s - 1 <= N:
s *= 2
ans += 1
print(ans)
``` | output | 1 | 74,927 | 5 | 149,855 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (... | instruction | 0 | 74,928 | 5 | 149,856 |
Yes | output | 1 | 74,928 | 5 | 149,857 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (... | instruction | 0 | 74,929 | 5 | 149,858 |
Yes | output | 1 | 74,929 | 5 | 149,859 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (... | instruction | 0 | 74,930 | 5 | 149,860 |
Yes | output | 1 | 74,930 | 5 | 149,861 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (... | instruction | 0 | 74,931 | 5 | 149,862 |
Yes | output | 1 | 74,931 | 5 | 149,863 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (... | instruction | 0 | 74,932 | 5 | 149,864 |
No | output | 1 | 74,932 | 5 | 149,865 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (... | instruction | 0 | 74,933 | 5 | 149,866 |
No | output | 1 | 74,933 | 5 | 149,867 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (... | instruction | 0 | 74,934 | 5 | 149,868 |
No | output | 1 | 74,934 | 5 | 149,869 |
Provide a correct Python 3 solution for this coding contest problem.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete the first element which has the key of x from the list.... | instruction | 0 | 74,935 | 5 | 149,870 |
"Correct Solution:
```
from collections import deque
n = int(input())
d = deque()
for i in range(n):
x = input().split()
if x[0] == "insert":
d.appendleft(x[1])
elif x[0] == "delete":
if x[1] in d:
d.remove(x[1])
elif x[0] == "deleteFirst":
d.popleft()
elif x[0] ... | output | 1 | 74,935 | 5 | 149,871 |
Provide a correct Python 3 solution for this coding contest problem.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete the first element which has the key of x from the list.... | instruction | 0 | 74,936 | 5 | 149,872 |
"Correct Solution:
```
from collections import deque
n = int(input())
l = deque()
for i in range(n):
command = input()
if command == "deleteFirst":
l.popleft()
elif command == "deleteLast":
l.pop()
else:
order, num = command.split()
if order == "insert":
l.app... | output | 1 | 74,936 | 5 | 149,873 |
Provide a correct Python 3 solution for this coding contest problem.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete the first element which has the key of x from the list.... | instruction | 0 | 74,937 | 5 | 149,874 |
"Correct Solution:
```
from collections import deque
from sys import stdin
q = deque()
input()
for s in stdin:
c, *k = s.split()
k = k[0] if k else None
if c[0] == 'i':
q.appendleft(k)
elif c[0] == 'd':
if c[6:7] == 'F':
q.popleft()
elif c[6:7] == 'L':
q.p... | output | 1 | 74,937 | 5 | 149,875 |
Provide a correct Python 3 solution for this coding contest problem.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete the first element which has the key of x from the list.... | instruction | 0 | 74,938 | 5 | 149,876 |
"Correct Solution:
```
from collections import deque
N = int(input())
x_list=deque()
for i in range(N):
a = input().split()
if a[0] == "insert":
x_list.appendleft(a[1])
elif a[0] == "delete":
try:
x_list.remove(a[1])
except:
pass
elif a[0] == "deleteFirs... | output | 1 | 74,938 | 5 | 149,877 |
Provide a correct Python 3 solution for this coding contest problem.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete the first element which has the key of x from the list.... | instruction | 0 | 74,939 | 5 | 149,878 |
"Correct Solution:
```
from collections import deque
N = int(input())
d = deque()
for _ in range(N):
command = input().split()
if command[0] == 'insert':
d.appendleft(command[1])
elif command[0] == 'delete':
try:
d.remove(command[1])
except ValueError:
... | output | 1 | 74,939 | 5 | 149,879 |
Provide a correct Python 3 solution for this coding contest problem.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete the first element which has the key of x from the list.... | instruction | 0 | 74,941 | 5 | 149,882 |
"Correct Solution:
```
from collections import deque
c=deque([])
n=int(input())
for i in range(n):
a=input()
if "deleteFirst"in a:
c.popleft()
elif "deleteLast"in a:
c.pop()
else:
a,b=a.split()
if "insert"in a:
c.appendleft(b)
else:
try:
... | output | 1 | 74,941 | 5 | 149,883 |
Provide a correct Python 3 solution for this coding contest problem.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete the first element which has the key of x from the list.... | instruction | 0 | 74,942 | 5 | 149,884 |
"Correct Solution:
```
from collections import deque
n=int(input())
Deq=deque()
for i in range(n):
command=input().split()
if len(command)>1:
x=command[1]
if command[0]=="insert":
Deq.appendleft(x)
elif command[0]=="delete":
try:
Deq.remove(x)
except:
... | output | 1 | 74,942 | 5 | 149,885 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete... | instruction | 0 | 74,943 | 5 | 149,886 |
Yes | output | 1 | 74,943 | 5 | 149,887 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete... | instruction | 0 | 74,944 | 5 | 149,888 |
Yes | output | 1 | 74,944 | 5 | 149,889 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete... | instruction | 0 | 74,945 | 5 | 149,890 |
Yes | output | 1 | 74,945 | 5 | 149,891 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete... | instruction | 0 | 74,946 | 5 | 149,892 |
Yes | output | 1 | 74,946 | 5 | 149,893 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete... | instruction | 0 | 74,948 | 5 | 149,896 |
No | output | 1 | 74,948 | 5 | 149,897 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete... | instruction | 0 | 74,949 | 5 | 149,898 |
No | output | 1 | 74,949 | 5 | 149,899 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an element with key x into the front of the list.
* delete x: delete... | instruction | 0 | 74,950 | 5 | 149,900 |
No | output | 1 | 74,950 | 5 | 149,901 |
Provide a correct Python 3 solution for this coding contest problem.
Your task is to perform a simple table calculation.
Write a program which reads the number of rows r, columns c and a table of r × c elements, and prints a new table, which includes the total sum for each row and column.
Constraints
* 1 ≤ r, c ≤ 1... | instruction | 0 | 74,951 | 5 | 149,902 |
"Correct Solution:
```
r, c = map(int, input().split())
matrix = [list(map(int, input().split())) for _ in range(r)]
for i in range(r):
matrix[i].append(sum(matrix[i]))
matrix.append(list(map(sum, zip(*matrix))))
# matrix.append([sum(i) for i in zip(*matrix)])
for row in matrix:
print(' '.join(str(e) for e ... | output | 1 | 74,951 | 5 | 149,903 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.