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 can be selected, print `Yes`; otherwise, print `No`. Constraints * 1 \leq M \leq N \leq 100 * 1 \leq A_i \leq 1000 * A_i are distinct. * All values in input are integers. Input Input is given from Standard Input in the following format: N M A_1 ... A_N Output If M popular items can be selected, print `Yes`; otherwise, print `No`. Examples Input 4 1 5 4 2 1 Output Yes Input 3 2 380 19 1 Output No Input 12 3 4 56 78 901 2 345 67 890 123 45 6 789 Output Yes
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 can be selected, print `Yes`; otherwise, print `No`. Constraints * 1 \leq M \leq N \leq 100 * 1 \leq A_i \leq 1000 * A_i are distinct. * All values in input are integers. Input Input is given from Standard Input in the following format: N M A_1 ... A_N Output If M popular items can be selected, print `Yes`; otherwise, print `No`. Examples Input 4 1 5 4 2 1 Output Yes Input 3 2 380 19 1 Output No Input 12 3 4 56 78 901 2 345 67 890 123 45 6 789 Output Yes
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}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. Constraints * 1 \leq M \leq N \leq 100 * 1 \leq A_i \leq 1000 * A_i are distinct. * All values in input are integers. Input Input is given from Standard Input in the following format: N M A_1 ... A_N Output If M popular items can be selected, print `Yes`; otherwise, print `No`. Examples Input 4 1 5 4 2 1 Output Yes Input 3 2 380 19 1 Output No Input 12 3 4 56 78 901 2 345 67 890 123 45 6 789 Output Yes Submitted Solution: ``` N, M = map(int,input().split()) a = list(map(int,input().split())) a.sort(reverse=True) if a[M-1] >= sum(a) / (4*M): print("Yes") else: print("No") ```
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}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. Constraints * 1 \leq M \leq N \leq 100 * 1 \leq A_i \leq 1000 * A_i are distinct. * All values in input are integers. Input Input is given from Standard Input in the following format: N M A_1 ... A_N Output If M popular items can be selected, print `Yes`; otherwise, print `No`. Examples Input 4 1 5 4 2 1 Output Yes Input 3 2 380 19 1 Output No Input 12 3 4 56 78 901 2 345 67 890 123 45 6 789 Output Yes Submitted Solution: ``` n,m=map(int,input().split()) a=list(map(int,input().split())) a.sort() line=sum(a)/(4*m) print('Yes' if a[-m]>=line else 'No') ```
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}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. Constraints * 1 \leq M \leq N \leq 100 * 1 \leq A_i \leq 1000 * A_i are distinct. * All values in input are integers. Input Input is given from Standard Input in the following format: N M A_1 ... A_N Output If M popular items can be selected, print `Yes`; otherwise, print `No`. Examples Input 4 1 5 4 2 1 Output Yes Input 3 2 380 19 1 Output No Input 12 3 4 56 78 901 2 345 67 890 123 45 6 789 Output Yes Submitted Solution: ``` N,M=map(int,input().split()) A=list(map(int,input().split())) B=sorted(A) C=sum(B) if C<=B[-M]*4*M: print("Yes") else: print("No") ```
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}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. Constraints * 1 \leq M \leq N \leq 100 * 1 \leq A_i \leq 1000 * A_i are distinct. * All values in input are integers. Input Input is given from Standard Input in the following format: N M A_1 ... A_N Output If M popular items can be selected, print `Yes`; otherwise, print `No`. Examples Input 4 1 5 4 2 1 Output Yes Input 3 2 380 19 1 Output No Input 12 3 4 56 78 901 2 345 67 890 123 45 6 789 Output Yes Submitted Solution: ``` n, m = map(int, input().split()) a = list(map(int, input().split())) print('Yes' if len([ai for ai in a[:] if ai >= sum(a) / (4*m)]) >= m else 'No') ```
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}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. Constraints * 1 \leq M \leq N \leq 100 * 1 \leq A_i \leq 1000 * A_i are distinct. * All values in input are integers. Input Input is given from Standard Input in the following format: N M A_1 ... A_N Output If M popular items can be selected, print `Yes`; otherwise, print `No`. Examples Input 4 1 5 4 2 1 Output Yes Input 3 2 380 19 1 Output No Input 12 3 4 56 78 901 2 345 67 890 123 45 6 789 Output Yes Submitted Solution: ``` N, M = map(int, input().split()) arrayA = input().split() convertedArray = [int(ele) for ele in arrayA] count = 0 total = sum(convertedArray) con = int((1 / (4 * M)) * total) for A in convertedArray: if A > con: count += 1 if count >= M: print('Yes') else: print('No') ```
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}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. Constraints * 1 \leq M \leq N \leq 100 * 1 \leq A_i \leq 1000 * A_i are distinct. * All values in input are integers. Input Input is given from Standard Input in the following format: N M A_1 ... A_N Output If M popular items can be selected, print `Yes`; otherwise, print `No`. Examples Input 4 1 5 4 2 1 Output Yes Input 3 2 380 19 1 Output No Input 12 3 4 56 78 901 2 345 67 890 123 45 6 789 Output Yes Submitted Solution: ``` n,m = map(int,input().split()) a = list(map(int,input().split())) sum = 0 for i in range(len(a)): sum += a[i] min_hyou = int(1/(4*m) * sum) count = 0 for i in range(len(a)): if min_hyou < a[i]: count+=1 if count>=m: print("Yes") else: print("No") ```
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}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. Constraints * 1 \leq M \leq N \leq 100 * 1 \leq A_i \leq 1000 * A_i are distinct. * All values in input are integers. Input Input is given from Standard Input in the following format: N M A_1 ... A_N Output If M popular items can be selected, print `Yes`; otherwise, print `No`. Examples Input 4 1 5 4 2 1 Output Yes Input 3 2 380 19 1 Output No Input 12 3 4 56 78 901 2 345 67 890 123 45 6 789 Output Yes Submitted Solution: ``` n, m = list(map(int, input().split())) v = list(map(int, input().split())) t = sum(v)/(4*m) ct = 0 for i in v: if v>t: ct += 1 if ct >= m: print("Yes") else: print("No") ```
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}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. Constraints * 1 \leq M \leq N \leq 100 * 1 \leq A_i \leq 1000 * A_i are distinct. * All values in input are integers. Input Input is given from Standard Input in the following format: N M A_1 ... A_N Output If M popular items can be selected, print `Yes`; otherwise, print `No`. Examples Input 4 1 5 4 2 1 Output Yes Input 3 2 380 19 1 Output No Input 12 3 4 56 78 901 2 345 67 890 123 45 6 789 Output Yes Submitted Solution: ``` import numpy as np n, m = map(int, input().split()) vote_lists = list(map(int, input().split())) vote_arr = np.array(vote_lists) total_vote = vote_arr.sum() popular = total_vote / (4 * m) if len(vote_arr[vote_arr > popular]) >= m: print('Yes') else: print('No') ```
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, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1). When Mountain i (1 \leq i \leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N). One day, each of the mountains received a non-negative even number of liters of rain. As a result, Dam i (1 \leq i \leq N) accumulated a total of A_i liters of water. Find the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem. Constraints * All values in input are integers. * 3 \leq N \leq 10^5-1 * N is an odd number. * 0 \leq A_i \leq 10^9 * The situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain. Input Input is given from Standard Input in the following format: N A_1 A_2 ... A_N Output Print N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order. Examples Input 3 2 2 4 Output 4 0 4 Input 5 3 8 7 5 5 Output 2 4 12 2 8 Input 3 1000000000 1000000000 0 Output 0 2000000000 0 Submitted Solution: ``` N = int(input()) A = list(map(int,input().split())) x1 = sum(A) - 2 * sum(A[1::2]) print(x1, end=' ') for i in range(N-1): x1 = 2 * A[i] - x1 print(x1, end=' ') print() ```
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 \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191
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 \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191
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 \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191
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 \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191
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 \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191
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 \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191
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 \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191
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 \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191
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 some of them can be the same. Constraints * 1 \leq N,K \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191 Submitted Solution: ``` n, k = map(int, input().split()) ans = (n // k) ** 3 if (k & 1) == 0: ans += ((n + k // 2) // k) ** 3 print(ans) ```
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 some of them can be the same. Constraints * 1 \leq N,K \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191 Submitted Solution: ``` N, K = map(int, input().split()) if K % 2 != 0: print((N//K) ** 3) else: dK = N // K dK2 = N // (K // 2) - dK print(dK ** 3 + dK2 ** 3) ```
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 some of them can be the same. Constraints * 1 \leq N,K \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191 Submitted Solution: ``` n,k = map(int,input().split()) if k % 2 == 1: print((n//k)**3) else: if n % k >= k // 2: print((n//k)**3 + (n//k + 1)**3) else: print((n//k)**3 * 2) ```
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 some of them can be the same. Constraints * 1 \leq N,K \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191 Submitted Solution: ``` n,k=map(int,input().split()) ans=0 if k%2==0: ans+=(-((n//(k//2))//-2))**3 ans+=(n//k)**3 print(ans) ```
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 some of them can be the same. Constraints * 1 \leq N,K \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191 Submitted Solution: ``` a,b = map(int,input().split()) c = a//b d = a//(b//2) if b % 2 == 0: print(d**3) else: print(c**3) ```
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 some of them can be the same. Constraints * 1 \leq N,K \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191 Submitted Solution: ``` N, K = map(int, input().split()) if K % 2 == 1: tmp = N // K ans = tmp ** 3 print (ans)0 else: tmp = N // K ans = tmp ** 3 tmp = N // (K // 2) - tmp ans += tmp ** 3 print (ans) ```
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 some of them can be the same. Constraints * 1 \leq N,K \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191 Submitted Solution: ``` n, k = map(int, input().split()) if k % 2 == 0: zeros = (n - n % k)// k halfs = n // k if n % k >= n // k: halfs += 1 print(zeros ** 3 + halfs ** 3) else: zeros = (n - n % k) // k print(zeros ** 3) ```
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 some of them can be the same. Constraints * 1 \leq N,K \leq 2\times 10^5 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output Print 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. Examples Input 3 2 Output 9 Input 5 3 Output 1 Input 31415 9265 Output 27 Input 35897 932 Output 114191 Submitted Solution: ``` # -*- coding: utf-8 -*- n,k = [int(x) for x in input().split()] ret = 0 for b in range(1,n+1): r = k - b%k # print(b,r) if r==k: ret += (n//k)**2 elif (2*r)%k==0: # print("*", ((n+k)//k)**2) ret += ((n+k)//k)**2 print(ret) ```
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 solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498
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 solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498
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 solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498
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 solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498
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 solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498
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 solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498
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 solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498
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 solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498
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 guaranteed that, for the given integer N, there exists a solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498 Submitted Solution: ``` N=int(input()) for i in range(1,3501): for j in range(1,3501): bw=4*i*j-N*i-N*j if bw<=0: continue if (N*i*j)%bw==0: print(i,j,(N*i*j)//bw) exit() ```
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 guaranteed that, for the given integer N, there exists a solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498 Submitted Solution: ``` N = int(input()) for n in range(1, 3501): for h in range(1, 3501): a = N*n*h b = 4*n*h-N*(n+h) if b > 0 and a % b == 0: print(n, h, a//b) exit() ```
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 guaranteed that, for the given integer N, there exists a solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498 Submitted Solution: ``` def main(): N=int(input()) 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 and b%a==0: print(h,n,b//a) return if __name__ == "__main__": main() ```
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 guaranteed that, for the given integer N, there exists a solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498 Submitted Solution: ``` n=int(input()) a=n*3//4+3 for i in range(max(n//4,1),a): for j in range(a-3,3501): k=4*i*j-n*(i+j) if k==0: continue x,y=divmod(n*i*j,k) if y==0 and x>0: print(i,j,x) exit() ```
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 guaranteed that, for the given integer N, there exists a solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498 Submitted Solution: ``` N = int(input()) if N%2 == 0: print(N, N, N//2) else: for h in range(3500, -1, -1): num = N*h*3501; diff_num = N*h dem = 4*h*3501 - N*(h+3051); diff_dem = 4*h - N for n in range(3500, -1, -1): num -= diff_num dem -= diff_dem if dem <= 0: break if num%dem == 0: print(h, n, num//dem) quit() ```
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 guaranteed that, for the given integer N, there exists a solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498 Submitted Solution: ``` N = int(input()) mx = 3501 def func(): for x in range(1, mx): for y in range(x, mx): if (2*x*y-x*N-y*N) == 0: y += 1 w = (x*y*N) / (4*x*y-x*N-y*N) if w > 0 and int(w) == w: return x, y, int(w) A, B, C = func() print(A, B, C) ```
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 guaranteed that, for the given integer N, there exists a solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498 Submitted Solution: ``` from fractions import Fraction import math N = int(input()) ans = Fraction(4,N) point = [1,math.floor(N/4)] for h in range(1,3501): h_pro = Fraction(1,h) for n in range(1,3501): check = ans - h_pro n_pro = Fraction(1,n) check -= n_pro if type(check) == "int": if check ==1: print(h, end=" ") print(n, end=" ") print(1) exit() elif check.numerator == 1: print(h, end=" ") print(n, end=" ") print(check.denominator) exit() ```
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 guaranteed that, for the given integer N, there exists a solution such that h,n,w \leq 3500. Inputs Input is given from Standard Input in the following format: N Outputs Print a triple of positive integers h, n and w that satisfies the condition, in the following format: h n w Examples Input 2 Output 1 2 2 Input 3485 Output 872 1012974 1539173474040 Input 4664 Output 3498 3498 3498 Submitted Solution: ``` N = int(input()) for h in range(1, 3501): for w in range(1, 3501): u = 4*h*w-N*w-N*h d = N*h*w if u == 0: continue if d % u == 0: print(h, w, d//u) exit() assert 1 == 2 ```
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): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). Input The input consists of several datasets. Each dataset consists of n (1 ≤ n ≤ 50) in a line. The number of datasets is less than or equal to 50. Output Print the number of combination in a line. Example Input 35 1 Output 4 4
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): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). Input The input consists of several datasets. Each dataset consists of n (1 ≤ n ≤ 50) in a line. The number of datasets is less than or equal to 50. Output Print the number of combination in a line. Example Input 35 1 Output 4 4
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): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). Input The input consists of several datasets. Each dataset consists of n (1 ≤ n ≤ 50) in a line. The number of datasets is less than or equal to 50. Output Print the number of combination in a line. Example Input 35 1 Output 4 4
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): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). Input The input consists of several datasets. Each dataset consists of n (1 ≤ n ≤ 50) in a line. The number of datasets is less than or equal to 50. Output Print the number of combination in a line. Example Input 35 1 Output 4 4
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): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). Input The input consists of several datasets. Each dataset consists of n (1 ≤ n ≤ 50) in a line. The number of datasets is less than or equal to 50. Output Print the number of combination in a line. Example Input 35 1 Output 4 4
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): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). Input The input consists of several datasets. Each dataset consists of n (1 ≤ n ≤ 50) in a line. The number of datasets is less than or equal to 50. Output Print the number of combination in a line. Example Input 35 1 Output 4 4
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, repeat=4): sum = 0 for i in elem: sum += i if sum == num: cnt += 1 print(cnt) if __name__ == '__main__': main() ```
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): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). Input The input consists of several datasets. Each dataset consists of n (1 ≤ n ≤ 50) in a line. The number of datasets is less than or equal to 50. Output Print the number of combination in a line. Example Input 35 1 Output 4 4
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 + b + c + d == target_val: cnt += 1 print(cnt) ```
output
1
52,072
5
104,145