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 |
|---|---|---|---|---|---|
Provide a correct Python 3 solution for this coding contest problem.
We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes.
If M popular items ca... | instruction | 0 | 51,938 | 5 | 103,876 |
"Correct Solution:
```
n,m=map(int,input().split())
a=[int(i) for i in input().split()]
b=[i for i in a if i>=sum(a)/4/m]
print('Yes' if len(b)>=m else 'No')
``` | output | 1 | 51,938 | 5 | 103,877 |
Provide a correct Python 3 solution for this coding contest problem.
We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes.
If M popular items ca... | instruction | 0 | 51,939 | 5 | 103,878 |
"Correct Solution:
```
n, m = map(int, input().split())
L = sorted(map(int, input().split()), reverse=True)
if L[m-1]*m*4 < sum(L):
print('No')
else:
print('Yes')
``` | output | 1 | 51,939 | 5 | 103,879 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{... | instruction | 0 | 51,940 | 5 | 103,880 |
Yes | output | 1 | 51,940 | 5 | 103,881 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{... | instruction | 0 | 51,941 | 5 | 103,882 |
Yes | output | 1 | 51,941 | 5 | 103,883 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{... | instruction | 0 | 51,942 | 5 | 103,884 |
Yes | output | 1 | 51,942 | 5 | 103,885 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{... | instruction | 0 | 51,943 | 5 | 103,886 |
Yes | output | 1 | 51,943 | 5 | 103,887 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{... | instruction | 0 | 51,944 | 5 | 103,888 |
No | output | 1 | 51,944 | 5 | 103,889 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{... | instruction | 0 | 51,945 | 5 | 103,890 |
No | output | 1 | 51,945 | 5 | 103,891 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{... | instruction | 0 | 51,946 | 5 | 103,892 |
No | output | 1 | 51,946 | 5 | 103,893 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{... | instruction | 0 | 51,947 | 5 | 103,894 |
No | output | 1 | 51,947 | 5 | 103,895 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.
Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Da... | instruction | 0 | 51,974 | 5 | 103,948 |
Yes | output | 1 | 51,974 | 5 | 103,949 |
Provide a correct Python 3 solution for this coding contest problem.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
Constraints
* 1 \leq N,K ... | instruction | 0 | 51,996 | 5 | 103,992 |
"Correct Solution:
```
N, K = map(int, input().split())
ans = (N // K) ** 3
if K % 2 == 0:
T = (N + K // 2) // K
ans += T ** 3
print(ans)
``` | output | 1 | 51,996 | 5 | 103,993 |
Provide a correct Python 3 solution for this coding contest problem.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
Constraints
* 1 \leq N,K ... | instruction | 0 | 51,997 | 5 | 103,994 |
"Correct Solution:
```
n,k=map(int,input().split())
if k%2:
print((n//k)**3)
else:
k//=2
print((n//k//2)**3+(((n//k)+1)//2)**3)
``` | output | 1 | 51,997 | 5 | 103,995 |
Provide a correct Python 3 solution for this coding contest problem.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
Constraints
* 1 \leq N,K ... | instruction | 0 | 51,998 | 5 | 103,996 |
"Correct Solution:
```
N, K = map(int, input().split())
if K % 2 == 0:
n = (N+(K//2)) // K
ans = n**3 + (N//K)**3
else:
n = N // K
ans = n ** 3
print(ans)
``` | output | 1 | 51,998 | 5 | 103,997 |
Provide a correct Python 3 solution for this coding contest problem.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
Constraints
* 1 \leq N,K ... | instruction | 0 | 51,999 | 5 | 103,998 |
"Correct Solution:
```
n,k=map(int,input().split())
if k%2:
print((n//k)**3)
else:
l=k//2
print(((n+l)//k)**3+(n//k)**3)
``` | output | 1 | 51,999 | 5 | 103,999 |
Provide a correct Python 3 solution for this coding contest problem.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
Constraints
* 1 \leq N,K ... | instruction | 0 | 52,000 | 5 | 104,000 |
"Correct Solution:
```
n, k = list(map(int, input().split()))
print(((n//k)**3) + (((n-k//2)//k + 1)**3 if k%2 == 0 else 0))
``` | output | 1 | 52,000 | 5 | 104,001 |
Provide a correct Python 3 solution for this coding contest problem.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
Constraints
* 1 \leq N,K ... | instruction | 0 | 52,001 | 5 | 104,002 |
"Correct Solution:
```
n,k = map(int, input().split())
a = [i%k for i in range(1,n+1)]
c = 0
for i in range(k):
if (2*i) % k == 0:
c += a.count(i)**3
print(c)
``` | output | 1 | 52,001 | 5 | 104,003 |
Provide a correct Python 3 solution for this coding contest problem.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
Constraints
* 1 \leq N,K ... | instruction | 0 | 52,002 | 5 | 104,004 |
"Correct Solution:
```
read = lambda: map(int, input().split())
n, k = read()
if k % 2:
ans = (n // k) ** 3
else:
ans = (n // k) ** 3 + ((n + k // 2) // k) ** 3
print(ans)
``` | output | 1 | 52,002 | 5 | 104,005 |
Provide a correct Python 3 solution for this coding contest problem.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
Constraints
* 1 \leq N,K ... | instruction | 0 | 52,003 | 5 | 104,006 |
"Correct Solution:
```
n, k = map(int, input().split())
ans = (n//k)**3
if k%2 == 0:
ans += (1 + (n-k//2)//k)**3
print(ans)
``` | output | 1 | 52,003 | 5 | 104,007 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and s... | instruction | 0 | 52,004 | 5 | 104,008 |
Yes | output | 1 | 52,004 | 5 | 104,009 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and s... | instruction | 0 | 52,005 | 5 | 104,010 |
Yes | output | 1 | 52,005 | 5 | 104,011 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and s... | instruction | 0 | 52,006 | 5 | 104,012 |
Yes | output | 1 | 52,006 | 5 | 104,013 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and s... | instruction | 0 | 52,007 | 5 | 104,014 |
Yes | output | 1 | 52,007 | 5 | 104,015 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and s... | instruction | 0 | 52,008 | 5 | 104,016 |
No | output | 1 | 52,008 | 5 | 104,017 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and s... | instruction | 0 | 52,009 | 5 | 104,018 |
No | output | 1 | 52,009 | 5 | 104,019 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and s... | instruction | 0 | 52,010 | 5 | 104,020 |
No | output | 1 | 52,010 | 5 | 104,021 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and s... | instruction | 0 | 52,011 | 5 | 104,022 |
No | output | 1 | 52,011 | 5 | 104,023 |
Provide a correct Python 3 solution for this coding contest problem.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is guaranteed that, for the given integer N, there exists a... | instruction | 0 | 52,028 | 5 | 104,056 |
"Correct Solution:
```
N = int(input())
for i in range(1, 3501):
for j in range(1, 3501):
if 4 * i * j - N * i - N * j <= 0:
continue
k = (N * i * j) / (4 * i * j - N * i - N * j)
if k == round(k):
print(i, j, int(k))
exit()
``` | output | 1 | 52,028 | 5 | 104,057 |
Provide a correct Python 3 solution for this coding contest problem.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is guaranteed that, for the given integer N, there exists a... | instruction | 0 | 52,029 | 5 | 104,058 |
"Correct Solution:
```
N = int(input())
for h in range(1, 3501):
for n in range(1, 3501):
a = (4 * h * n) - N * h - N * n
if a <= 0:
continue
w = (N * h * n) / a
if w.is_integer() and 0 < w:
print(h, n, int(w))
exit(0)
``` | output | 1 | 52,029 | 5 | 104,059 |
Provide a correct Python 3 solution for this coding contest problem.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is guaranteed that, for the given integer N, there exists a... | instruction | 0 | 52,030 | 5 | 104,060 |
"Correct Solution:
```
N=int(input())
for h in range(1,3501):
for n in range(1,3501):
#print(n,h)
if 4*n*h-N*h-N*n<=0:
continue
w=(N*n*h)/(4*n*h-N*h-N*n)
if int(w)==w:
print(h,n,int(w))
exit()
``` | output | 1 | 52,030 | 5 | 104,061 |
Provide a correct Python 3 solution for this coding contest problem.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is guaranteed that, for the given integer N, there exists a... | instruction | 0 | 52,031 | 5 | 104,062 |
"Correct Solution:
```
N=int(input())
for h in range(1,3501):
if 4*h-N!=0:
n=(N*h)//(4*h-N)+1
if 4*h*n-N*(h+n)>0 and (N*h*n)%(4*h*n-N*(h+n))==0:
w=(N*h*n)//(4*h*n-N*(h+n))
break
print(h,n,w)
``` | output | 1 | 52,031 | 5 | 104,063 |
Provide a correct Python 3 solution for this coding contest problem.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is guaranteed that, for the given integer N, there exists a... | instruction | 0 | 52,032 | 5 | 104,064 |
"Correct Solution:
```
n = int(input())
for a in range(1,3501):
for b in range(1,3501):
if 4*a*b-n*a-n*b == 0:
continue
if 1 <= n*a*b//(4*a*b-n*(a+b)) <= 3500 and (n*a*b)%(4*a*b-n*a-n*b) == 0:
print(a,b,n*a*b//(4*a*b-n*(a+b)))
exit()
``` | output | 1 | 52,032 | 5 | 104,065 |
Provide a correct Python 3 solution for this coding contest problem.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is guaranteed that, for the given integer N, there exists a... | instruction | 0 | 52,033 | 5 | 104,066 |
"Correct Solution:
```
N = int(input())
for n in range(1,3501):
for w in range(n,3501):
if (4*n*w-w*N-n*N) > 0:
h = n*w*N/(4*n*w-w*N-n*N)
if h == int(h) and h > 0:
print(int(h),n,w)
exit()
``` | output | 1 | 52,033 | 5 | 104,067 |
Provide a correct Python 3 solution for this coding contest problem.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is guaranteed that, for the given integer N, there exists a... | instruction | 0 | 52,034 | 5 | 104,068 |
"Correct Solution:
```
N=int(input())
def Calc(N):
for h in range(1,3501):
for n in range(h,3501):
A=4*h*n-N*(h+n);B=N*h*n;
if A<=0 or B<=0:
continue
if B%A==0:
print(h,n,B//A)
return
Calc(N)
``` | output | 1 | 52,034 | 5 | 104,069 |
Provide a correct Python 3 solution for this coding contest problem.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is guaranteed that, for the given integer N, there exists a... | instruction | 0 | 52,035 | 5 | 104,070 |
"Correct Solution:
```
# very slow solution
def main():
N = int(input())
for n in range(1, 3502):
for h in range(1,3502):
t = n*h*N
p = 4*n*h-(n*N+h*N)
if p>0 and t%p==0:
w = t//p
print(n , h, w)
exit()
if __name__=="__main__":
main()
``` | output | 1 | 52,035 | 5 | 104,071 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is ... | instruction | 0 | 52,036 | 5 | 104,072 |
Yes | output | 1 | 52,036 | 5 | 104,073 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is ... | instruction | 0 | 52,037 | 5 | 104,074 |
Yes | output | 1 | 52,037 | 5 | 104,075 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is ... | instruction | 0 | 52,038 | 5 | 104,076 |
Yes | output | 1 | 52,038 | 5 | 104,077 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is ... | instruction | 0 | 52,039 | 5 | 104,078 |
Yes | output | 1 | 52,039 | 5 | 104,079 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is ... | instruction | 0 | 52,040 | 5 | 104,080 |
No | output | 1 | 52,040 | 5 | 104,081 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is ... | instruction | 0 | 52,041 | 5 | 104,082 |
No | output | 1 | 52,041 | 5 | 104,083 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is ... | instruction | 0 | 52,042 | 5 | 104,084 |
No | output | 1 | 52,042 | 5 | 104,085 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple solutions, any of them will be accepted.
Constraints
* It is ... | instruction | 0 | 52,043 | 5 | 104,086 |
No | output | 1 | 52,043 | 5 | 104,087 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality:
a + b + c + d = n
For example, for n = 35, we have 4 different combinations of (a, b, c, d):... | instruction | 0 | 52,066 | 5 | 104,132 |
"Correct Solution:
```
def main():
import sys
table = [0]*51
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
table[a+b+c+d] += 1
for line in sys.stdin:
n = int(line)
print(table[n])
if __name__ == '__main__':
main()
``` | output | 1 | 52,066 | 5 | 104,133 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality:
a + b + c + d = n
For example, for n = 35, we have 4 different combinations of (a, b, c, d):... | instruction | 0 | 52,067 | 5 | 104,134 |
"Correct Solution:
```
import sys
import math as mas
x=[0]*60
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
x[i+j+k+l]+=1
for i in sys.stdin:
print(x[int(i)])
# a,b=map(int,i.split())
# print(gcd(a,b),lcm(a,b))
``` | output | 1 | 52,067 | 5 | 104,135 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality:
a + b + c + d = n
For example, for n = 35, we have 4 different combinations of (a, b, c, d):... | instruction | 0 | 52,068 | 5 | 104,136 |
"Correct Solution:
```
import itertools
A = list(range(10))
A_sum = []
A_pair = list(itertools.product(A,repeat=4))
for i in range(len(A_pair)):
A_sum.append(sum(A_pair[i]))
while True:
try:
n = int(input())
except:
break
if 36<n:
print(0)
else:
print(A_sum.count(n))... | output | 1 | 52,068 | 5 | 104,137 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality:
a + b + c + d = n
For example, for n = 35, we have 4 different combinations of (a, b, c, d):... | instruction | 0 | 52,069 | 5 | 104,138 |
"Correct Solution:
```
while True:
try:
n = int(input())
except:
break
ans = 0
table = [[a,b,c,d] for a in range(10) for b in range(10) for c in range(10) for d in range(10)]
for abcd in table:
ans += sum(abcd) == n
print(ans)
``` | output | 1 | 52,069 | 5 | 104,139 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality:
a + b + c + d = n
For example, for n = 35, we have 4 different combinations of (a, b, c, d):... | instruction | 0 | 52,070 | 5 | 104,140 |
"Correct Solution:
```
while(1):
try:
n = int(input())
except:
break
cnt = 0
for a in range(10):
for b in range(10):
for c in range(10):
d = n - a - b - c
if 0 <= d < 10:
cnt += 1
print(cnt)
``` | output | 1 | 52,070 | 5 | 104,141 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality:
a + b + c + d = n
For example, for n = 35, we have 4 different combinations of (a, b, c, d):... | instruction | 0 | 52,071 | 5 | 104,142 |
"Correct Solution:
```
import sys
import itertools
def main():
l = list(range(10))
while True:
data = sys.stdin.readline().strip()
if data is None or data == '':
break
num = int(data)
#print('num:', num)
cnt = 0
for elem in itertools.product(l, ... | output | 1 | 52,071 | 5 | 104,143 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality:
a + b + c + d = n
For example, for n = 35, we have 4 different combinations of (a, b, c, d):... | instruction | 0 | 52,072 | 5 | 104,144 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
import os
import math
lst = sys.stdin.readlines()
#print(lst)
for s in lst:
cnt = 0
target_val = int(s)
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
if a +... | output | 1 | 52,072 | 5 | 104,145 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.