message
stringlengths
2
59.7k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
37
108k
cluster
float64
20
20
__index_level_0__
int64
74
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let \mathrm{popcount}(n) be the number of `1`s in the binary representation of n. For example, \mathrm{popcount}(3) = 2, \mathrm{popcount}(7) = 3, and \mathrm{popcount}(0) = 0. Let f(n) be the ...
instruction
0
89,894
20
179,788
No
output
1
89,894
20
179,789
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let \mathrm{popcount}(n) be the number of `1`s in the binary representation of n. For example, \mathrm{popcount}(3) = 2, \mathrm{popcount}(7) = 3, and \mathrm{popcount}(0) = 0. Let f(n) be the ...
instruction
0
89,895
20
179,790
No
output
1
89,895
20
179,791
Provide a correct Python 3 solution for this coding contest problem. The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example * 1 * 1 x 2 x 2 = 4 * 1 x 2 x 2 x 3 x 5 x 5 = 300 Etc. are humming numbers, but 11, 13, 14 etc. are not humming numbers. A...
instruction
0
90,026
20
180,052
"Correct Solution: ``` # -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0162 """ import sys from sys import stdin from bisect import bisect_right, bisect_left from math import ceil, log input = stdin.readline def main(args): hammings = [] temp = set() for i in range(c...
output
1
90,026
20
180,053
Provide a correct Python 3 solution for this coding contest problem. The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example * 1 * 1 x 2 x 2 = 4 * 1 x 2 x 2 x 3 x 5 x 5 = 300 Etc. are humming numbers, but 11, 13, 14 etc. are not humming numbers. A...
instruction
0
90,027
20
180,054
"Correct Solution: ``` while 1: n=list(map(int,input().split())) if n[0]==0:break a=0 for i in range(n[0],n[1]+1): b=i while b%5==0: b/=5 while b%3==0: b/=3 while b%2==0: b/=2 if b==1:a+=1 print(a) ```
output
1
90,027
20
180,055
Provide a correct Python 3 solution for this coding contest problem. The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example * 1 * 1 x 2 x 2 = 4 * 1 x 2 x 2 x 3 x 5 x 5 = 300 Etc. are humming numbers, but 11, 13, 14 etc. are not humming numbers. A...
instruction
0
90,028
20
180,056
"Correct Solution: ``` while True: A = list(map(int, input().split())) if A[0] == 0: break n, m = A[0], A[1] ans = 0 for i in range(n, m+1): b = i while b % 5 == 0: b //= 5 while b % 3 == 0: b //= 3 while b % 2 == 0: b //=...
output
1
90,028
20
180,057
Provide a correct Python 3 solution for this coding contest problem. The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example * 1 * 1 x 2 x 2 = 4 * 1 x 2 x 2 x 3 x 5 x 5 = 300 Etc. are humming numbers, but 11, 13, 14 etc. are not humming numbers. A...
instruction
0
90,029
20
180,058
"Correct Solution: ``` MAX = 1000000 hamming_list = [False] * (MAX + 1) hamming_list[0] = False hamming_list[1] = True for index in range(2, MAX + 1): if index % 2 == 0: if hamming_list[index // 2]: hamming_list[index] = True elif index % 3 == 0: if hamming_list[index // 3]: ...
output
1
90,029
20
180,059
Provide a correct Python 3 solution for this coding contest problem. The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example * 1 * 1 x 2 x 2 = 4 * 1 x 2 x 2 x 3 x 5 x 5 = 300 Etc. are humming numbers, but 11, 13, 14 etc. are not humming numbers. A...
instruction
0
90,030
20
180,060
"Correct Solution: ``` MAX = 1000000 hamming_list = [False] * (MAX + 1) hamming_list[0] = False hamming_list[1] = True for index in range(2, MAX + 1): if index / 2 % 1 == 0: if hamming_list[index // 2]: hamming_list[index] = True elif index / 3 % 1 == 0: if hamming_list[index // ...
output
1
90,030
20
180,061
Provide a correct Python 3 solution for this coding contest problem. The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example * 1 * 1 x 2 x 2 = 4 * 1 x 2 x 2 x 3 x 5 x 5 = 300 Etc. are humming numbers, but 11, 13, 14 etc. are not humming numbers. A...
instruction
0
90,031
20
180,062
"Correct Solution: ``` H = [False for i in range(1000001)] H[1] = True for i in range(20): for j in range(13): for k in range(9): if (2 ** i) * (3 ** j) * (5 ** k) < 1000001: H[(2 ** i) * (3 ** j) * (5 ** k)] = True else: break while True: L = in...
output
1
90,031
20
180,063
Provide a correct Python 3 solution for this coding contest problem. The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example * 1 * 1 x 2 x 2 = 4 * 1 x 2 x 2 x 3 x 5 x 5 = 300 Etc. are humming numbers, but 11, 13, 14 etc. are not humming numbers. A...
instruction
0
90,032
20
180,064
"Correct Solution: ``` while 1: n=list(map(int,input().split())) if n[0]==0:break a=0 for i in range(n[0],n[1]+1): b=i while b%2==0: b/=2 while b%3==0: b/=3 while b%5==0: b/=5 if b==1:a+=1 print(a) ```
output
1
90,032
20
180,065
Provide a correct Python 3 solution for this coding contest problem. The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example * 1 * 1 x 2 x 2 = 4 * 1 x 2 x 2 x 3 x 5 x 5 = 300 Etc. are humming numbers, but 11, 13, 14 etc. are not humming numbers. A...
instruction
0
90,033
20
180,066
"Correct Solution: ``` while 1: datas = list(map(int, input().split())) if datas[0] == 0: break n, m = datas[0], datas[1] cnt = 0 for i in range(n, m+1): b = i while b % 5 == 0: b //= 5 while b % 3 == 0: b //= 3 while b % 2 == 0: ...
output
1
90,033
20
180,067
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example * 1 * 1 x 2 x 2 = 4 * 1 x 2 x 2 x 3 x 5 x 5 = 300 Etc. are humming ...
instruction
0
90,034
20
180,068
Yes
output
1
90,034
20
180,069
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example * 1 * 1 x 2 x 2 = 4 * 1 x 2 x 2 x 3 x 5 x 5 = 300 Etc. are humming ...
instruction
0
90,036
20
180,072
Yes
output
1
90,036
20
180,073
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example * 1 * 1 x 2 x 2 = 4 * 1 x 2 x 2 x 3 x 5 x 5 = 300 Etc. are humming ...
instruction
0
90,038
20
180,076
No
output
1
90,038
20
180,077
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then numbers 47, 744, 4 ...
instruction
0
90,419
20
180,838
Tags: bitmasks, brute force, dfs and similar Correct Solution: ``` from itertools import product n = int(input().strip()) if n<102: print(n) else: res = set() combination = (str(i)+str(j) for i in range(10) for j in range(i+1,10)) for it in (product(comb,repeat=l) for comb in combination for l in range(...
output
1
90,419
20
180,839
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then numbers 47, 744, 4 ...
instruction
0
90,420
20
180,840
Tags: bitmasks, brute force, dfs and similar Correct Solution: ``` def p(k): if 0 < k <= n: s.add(k) k *= 10 p(k + x) p(k + y) n = int(input()) s = set() for x in range(10): for y in range(10): p(x) print(len(s)) ```
output
1
90,420
20
180,841
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then numbers 47, 744, 4 ...
instruction
0
90,421
20
180,842
Tags: bitmasks, brute force, dfs and similar Correct Solution: ``` # https://codeforces.com/contest/244/problem/B def gen(digit, x, length, S): S.append(x) if length == 10: return if len(digit) == 1: for i in range(0, 10): next_x = x * 10 + i i...
output
1
90,421
20
180,843
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then numbers 47, 744, 4 ...
instruction
0
90,422
20
180,844
Tags: bitmasks, brute force, dfs and similar Correct Solution: ``` #CF Round 150. Div II Prob. A - Dividing Orange import sys dp = [[[-1 for j in range(3)] for i in range (1 << 10)] for k in range(11)] In = sys.stdin n = In.readline().strip() def go (idx, mask, equal): if dp[idx][mask][equal] != -1: retu...
output
1
90,422
20
180,845
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then numbers 47, 744, 4 ...
instruction
0
90,423
20
180,846
Tags: bitmasks, brute force, dfs and similar Correct Solution: ``` def dfs(k): if 0 < k <= n: s.add(k) k *= 10 dfs(k + x) dfs(k + y) n = int(input()) s = set() for x in range(10): for y in range(10): dfs(x) print(len(s)) ```
output
1
90,423
20
180,847
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then numbers 47, 744, 4 ...
instruction
0
90,424
20
180,848
Tags: bitmasks, brute force, dfs and similar Correct Solution: ``` def findNum(num): if 0 < num <= n: s.add(num) num*=10 findNum(num+x) findNum(num+y) n = int(input()) s = set() for x in range(10): for y in range(10): findNum(x) print(len(s)) ```
output
1
90,424
20
180,849
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then numbers 47, 744, 4 ...
instruction
0
90,425
20
180,850
Tags: bitmasks, brute force, dfs and similar Correct Solution: ``` n=int(input()) def bruteforce(number): res=0 liste=[] while number>0: integer=number%10 if integer not in liste: liste.append(integer) number=number//10 return len(liste)<=2 answer=[0] def ...
output
1
90,425
20
180,851
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then numbers 47, 744, 4 ...
instruction
0
90,426
20
180,852
Tags: bitmasks, brute force, dfs and similar Correct Solution: ``` ii=lambda:int(input()) kk=lambda:map(int, input().split()) ll=lambda:list(kk()) q =[] s=set() n=ii() for x in range(10): for y in range(10): q.append(x) while q: q2 = [] for item in q: if item > 0 and item <= n: s.add(item) item...
output
1
90,426
20
180,853
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example...
instruction
0
90,427
20
180,854
Yes
output
1
90,427
20
180,855
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example...
instruction
0
90,428
20
180,856
Yes
output
1
90,428
20
180,857
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example...
instruction
0
90,429
20
180,858
Yes
output
1
90,429
20
180,859
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example...
instruction
0
90,430
20
180,860
Yes
output
1
90,430
20
180,861
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example...
instruction
0
90,431
20
180,862
No
output
1
90,431
20
180,863
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example...
instruction
0
90,432
20
180,864
No
output
1
90,432
20
180,865
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example...
instruction
0
90,433
20
180,866
No
output
1
90,433
20
180,867
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example...
instruction
0
90,434
20
180,868
No
output
1
90,434
20
180,869
Provide tags and a correct Python 3 solution for this coding contest problem. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers a, b, c (1 ≤ a < b ≤ 105, 0 ≤ c ≤ 9). Output ...
instruction
0
90,642
20
181,284
Tags: math, number theory Correct Solution: ``` a, b, c = map(int, input().split()) pos = -1 for i in range(1, 309): if int((a * pow(10, i) // b)) % 10 == c: pos = i break print(pos) #128 7 0 ```
output
1
90,642
20
181,285
Provide tags and a correct Python 3 solution for this coding contest problem. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers a, b, c (1 ≤ a < b ≤ 105, 0 ≤ c ≤ 9). Output ...
instruction
0
90,643
20
181,286
Tags: math, number theory Correct Solution: ``` import decimal a, b, c = map(int, input().split()) decimal.getcontext().prec = 3 * b + 100 s = str(decimal.Decimal(a) / decimal.Decimal(b)).ljust(3 * b + 100, '0') r = s.find(str(c), 2, 2 * b + 8) - 1 if r == -2: print(-1) else: print(r) ```
output
1
90,643
20
181,287
Provide tags and a correct Python 3 solution for this coding contest problem. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers a, b, c (1 ≤ a < b ≤ 105, 0 ≤ c ≤ 9). Output ...
instruction
0
90,644
20
181,288
Tags: math, number theory Correct Solution: ``` from decimal import * getcontext().prec = 300 split_strings = input().split() [a, b, c] = map(lambda x: int(x), split_strings) a = Decimal(a) b = Decimal(b) decimal = (a / b) * 10 for i in range(1, 300): ones = int(decimal) fractional = decimal % 1 if o...
output
1
90,644
20
181,289
Provide tags and a correct Python 3 solution for this coding contest problem. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers a, b, c (1 ≤ a < b ≤ 105, 0 ≤ c ≤ 9). Output ...
instruction
0
90,645
20
181,290
Tags: math, number theory Correct Solution: ``` a,b,c = map(int,input().split(" ")) a = a%b i = 1 while i <= b : if a==0: if c==0 : print(i) exit() else : print(-1) exit() if a<b : a *= 10 while(a<b) : if c==0 : print(i) ...
output
1
90,645
20
181,291
Provide tags and a correct Python 3 solution for this coding contest problem. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers a, b, c (1 ≤ a < b ≤ 105, 0 ≤ c ≤ 9). Output ...
instruction
0
90,646
20
181,292
Tags: math, number theory Correct Solution: ``` a, b, c = input().split() a = int(a) b = int(b) c = int(c) num = [] cnt = 0 while True: cnt += 1 num.append( a ) n = a*10//b if n == c: break a = a*10 - n*b if a in num: cnt = -1 break print( cnt ) ```
output
1
90,646
20
181,293
Provide tags and a correct Python 3 solution for this coding contest problem. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers a, b, c (1 ≤ a < b ≤ 105, 0 ≤ c ≤ 9). Output ...
instruction
0
90,647
20
181,294
Tags: math, number theory Correct Solution: ``` from decimal import * getcontext().prec = 10000 a, b, c = map(int, input().split()) d = Decimal(a)/Decimal(b) # print(d) s = str(d)[2:] if len(s) > 900: s = s[:-1] else: s += '0' # print(s) try: ans = s.index(str(c)) except ValueError: print(-1) else: ...
output
1
90,647
20
181,295
Provide tags and a correct Python 3 solution for this coding contest problem. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers a, b, c (1 ≤ a < b ≤ 105, 0 ≤ c ≤ 9). Output ...
instruction
0
90,648
20
181,296
Tags: math, number theory Correct Solution: ``` a,b,c=map(int,input().split()) r=a%b t=b cnt=1 f=0 while(t!=0): r*=10 k=r//b r=r%b if(k==c): f=1 break cnt+=1 t-=1 if(f): print(cnt) else: print(-1) ```
output
1
90,648
20
181,297
Provide tags and a correct Python 3 solution for this coding contest problem. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers a, b, c (1 ≤ a < b ≤ 105, 0 ≤ c ≤ 9). Output ...
instruction
0
90,649
20
181,298
Tags: math, number theory Correct Solution: ``` from decimal import * getcontext().prec = 2048 getcontext().rounding = ROUND_DOWN num, denom, target = [int(x) for x in input().split()] a = Decimal(num)/Decimal(denom) a = str(a) a = a[a.find('.') : ] if len(a) < 2047: a = a + '0' print(a.find(str(target))) ```
output
1
90,649
20
181,299
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers...
instruction
0
90,650
20
181,300
Yes
output
1
90,650
20
181,301
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers...
instruction
0
90,651
20
181,302
Yes
output
1
90,651
20
181,303
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers...
instruction
0
90,652
20
181,304
Yes
output
1
90,652
20
181,305
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers...
instruction
0
90,653
20
181,306
Yes
output
1
90,653
20
181,307
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers...
instruction
0
90,654
20
181,308
No
output
1
90,654
20
181,309
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers...
instruction
0
90,655
20
181,310
No
output
1
90,655
20
181,311
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers...
instruction
0
90,656
20
181,312
No
output
1
90,656
20
181,313
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. Input The first contains three single positive integers...
instruction
0
90,657
20
181,314
No
output
1
90,657
20
181,315
Provide tags and a correct Python 3 solution for this coding contest problem. Let's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers 1, 5, 10 and 50 respectively. The use of other roman digits is not allowed. Numbers in this system are written as ...
instruction
0
90,694
20
181,388
Tags: brute force, combinatorics, dp, greedy, math Correct Solution: ``` from sys import setrecursionlimit setrecursionlimit((10**9)) n = int(input()) s = set() arr = [1,5,10,50] def comb(num, digit): global n if digit == n: s.add(num) else: for i in range(4): comb(num+arr[i], di...
output
1
90,694
20
181,389
Provide tags and a correct Python 3 solution for this coding contest problem. Let's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers 1, 5, 10 and 50 respectively. The use of other roman digits is not allowed. Numbers in this system are written as ...
instruction
0
90,695
20
181,390
Tags: brute force, combinatorics, dp, greedy, math Correct Solution: ``` #!/usr/bin/env python # -*- coding: utf-8 -*- n = int(input()) if n < 12: print([1, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292][n]) else: print(n*50-n-247) ```
output
1
90,695
20
181,391
Provide tags and a correct Python 3 solution for this coding contest problem. Let's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers 1, 5, 10 and 50 respectively. The use of other roman digits is not allowed. Numbers in this system are written as ...
instruction
0
90,696
20
181,392
Tags: brute force, combinatorics, dp, greedy, math Correct Solution: ``` def check(n, b, c): for tb in range(0, 9): for tc in range(0, min(n - tb + 1, 9)): s1 = 9 * b + 4 * c s2 = 9 * tb + 4 * tc if s1 > s2 and (s1 - s2) % 49 == 0: return False return...
output
1
90,696
20
181,393
Provide tags and a correct Python 3 solution for this coding contest problem. Let's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers 1, 5, 10 and 50 respectively. The use of other roman digits is not allowed. Numbers in this system are written as ...
instruction
0
90,697
20
181,394
Tags: brute force, combinatorics, dp, greedy, math Correct Solution: ``` a = [0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292] n = int(input()) if n < len(a): print (a[n]) else: print (a[11] + 49*(n-11)) ```
output
1
90,697
20
181,395
Provide tags and a correct Python 3 solution for this coding contest problem. Let's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers 1, 5, 10 and 50 respectively. The use of other roman digits is not allowed. Numbers in this system are written as ...
instruction
0
90,698
20
181,396
Tags: brute force, combinatorics, dp, greedy, math Correct Solution: ``` def ceildiv(a, b): return -(-a // b) def test_ceildiv(): assert ceildiv(6, 3) == 2 assert ceildiv(7, 3) == 3 assert ceildiv(5, 3) == 2 def brute_force(n, m): """Count numbers in range [0; m] equal to 4a + 9b + 49c ...f...
output
1
90,698
20
181,397