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. Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are luc...
instruction
0
46,495
20
92,990
No
output
1
46,495
20
92,991
Provide tags and a correct Python 3 solution for this coding contest problem. Yaroslav likes algorithms. We'll describe one of his favorite algorithms. 1. The algorithm receives a string as the input. We denote this input string as a. 2. The algorithm consists of some number of command. Сommand number i looks ei...
instruction
0
46,565
20
93,130
Tags: constructive algorithms Correct Solution: ``` print('9??>>??0') for i in range(9): print(str(i)+'??<>'+str(i+1)) print('??<>1') for i in range(10): print('?'+str(i)+'>>'+str(i)+'?') print('?>>??') for i in range(10): print(str(i)+'>>'+str(i)+'?') ```
output
1
46,565
20
93,131
Provide tags and a correct Python 3 solution for this coding contest problem. Yaroslav likes algorithms. We'll describe one of his favorite algorithms. 1. The algorithm receives a string as the input. We denote this input string as a. 2. The algorithm consists of some number of command. Сommand number i looks ei...
instruction
0
46,566
20
93,132
Tags: constructive algorithms Correct Solution: ``` print(""" ??0>>0?? ??1>>1?? ??2>>2?? ??3>>3?? ??4>>4?? ??5>>5?? ??6>>6?? ??7>>7?? ??8>>8?? ??9>>9?? ??>>? 0?<>1 1?<>2 2?<>3 3?<>4 4?<>5 5?<>6 6?<>7 7?<>8 8?<>9 9?>>?0 ?<>1 >>?? """.strip()) ```
output
1
46,566
20
93,133
Provide tags and a correct Python 3 solution for this coding contest problem. Yaroslav likes algorithms. We'll describe one of his favorite algorithms. 1. The algorithm receives a string as the input. We denote this input string as a. 2. The algorithm consists of some number of command. Сommand number i looks ei...
instruction
0
46,567
20
93,134
Tags: constructive algorithms Correct Solution: ``` print("0??<>1"); print("1??<>2"); print("2??<>3"); print("3??<>4"); print("4??<>5"); print("5??<>6"); print("6??<>7"); print("7??<>8"); print("8??<>9"); print("9??>>??0"); print("??<>1"); print("?9>>9?"); print("?8>>8?"); print("?7>>7?"); print("?6>>6?"); print("?5>>5...
output
1
46,567
20
93,135
Provide tags and a correct Python 3 solution for this coding contest problem. Yaroslav likes algorithms. We'll describe one of his favorite algorithms. 1. The algorithm receives a string as the input. We denote this input string as a. 2. The algorithm consists of some number of command. Сommand number i looks ei...
instruction
0
46,568
20
93,136
Tags: constructive algorithms Correct Solution: ``` print("0??<>1\n1??<>2\n2??<>3\n3??<>4\n4??<>5\n5??<>6\n6??<>7\n7??<>8\n8??<>9\n9??>>??0\n??<>1\n?0>>0?\n?1>>1?\n?2>>2?\n?3>>3?\n?4>>4?\n?5>>5?\n?6>>6?\n?7>>7?\n?8>>8?\n?9>>9?\n>>?\n", end='') ```
output
1
46,568
20
93,137
Provide tags and a correct Python 3 solution for this coding contest problem. Yaroslav likes algorithms. We'll describe one of his favorite algorithms. 1. The algorithm receives a string as the input. We denote this input string as a. 2. The algorithm consists of some number of command. Сommand number i looks ei...
instruction
0
46,569
20
93,138
Tags: constructive algorithms Correct Solution: ``` print("0??<>1\n1??<>2\n2??<>3\n3??<>4\n4??<>5\n5??<>6\n6??<>7\n7??<>8\n8??<>9\n9??>>??0\n??<>1\n?0>>0?\n?1>>1?\n?2>>2?\n?3>>3?\n?4>>4?\n?5>>5?\n?6>>6?\n?7>>7?\n?8>>8?\n?9>>9?\n>>?") ```
output
1
46,569
20
93,139
Provide tags and a correct Python 3 solution for this coding contest problem. Yaroslav likes algorithms. We'll describe one of his favorite algorithms. 1. The algorithm receives a string as the input. We denote this input string as a. 2. The algorithm consists of some number of command. Сommand number i looks ei...
instruction
0
46,570
20
93,140
Tags: constructive algorithms Correct Solution: ``` print('9??>>??0') for i in range(9): print('{}??<>{}'.format(i, i + 1)) print('??<>1') for i in range(10): print('?{0}>>{0}?'.format(i)) print('?>>??') print('>>?') ```
output
1
46,570
20
93,141
Provide tags and a correct Python 3 solution for this coding contest problem. Yaroslav likes algorithms. We'll describe one of his favorite algorithms. 1. The algorithm receives a string as the input. We denote this input string as a. 2. The algorithm consists of some number of command. Сommand number i looks ei...
instruction
0
46,571
20
93,142
Tags: constructive algorithms Correct Solution: ``` print('9??>>??0') for i in range(9): print('{}??<>{}'.format(i, i + 1)) print('??<>1') for i in range(10): print('?{0}>>{0}?'.format(i)) print('?>>??') print('>>?') # Made By Mostafa_Khaled ```
output
1
46,571
20
93,143
Provide tags and a correct Python 3 solution for this coding contest problem. Yaroslav likes algorithms. We'll describe one of his favorite algorithms. 1. The algorithm receives a string as the input. We denote this input string as a. 2. The algorithm consists of some number of command. Сommand number i looks ei...
instruction
0
46,572
20
93,144
Tags: constructive algorithms Correct Solution: ``` print ( """0??<>1 1??<>2 2??<>3 3??<>4 4??<>5 5??<>6 6??<>7 7??<>8 8??<>9 9??>>??0 ??<>1 ?0>>0? ?1>>1? ?2>>2? ?3>>3? ?4>>4? ?5>>5? ?6>>6? ?7>>7? ?8>>8? ?9>>9? ?>>?? >>?""" ) ```
output
1
46,572
20
93,145
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric progressions. Arithmetic progression is a sequen...
instruction
0
46,576
20
93,152
Tags: implementation Correct Solution: ``` import sys c = [int(s) for s in input().split()] d = c[1] - c[0] c1 = [c[0]] for i in range(len(c)): c1.append(c1[-1]+d) d1 = c[1] / c[0] c2 = [c[0]] for i in range(len(c)): c2.append(c2[-1]*d1) if c + [(c[-1] + d)] == c1: print(c1[-1]) sys.exit() if c + [(c[-1...
output
1
46,576
20
93,153
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric progressions. Arithmetic progression is a sequen...
instruction
0
46,577
20
93,154
Tags: implementation Correct Solution: ``` a,b,c,d=map(int,input().split()) r=42 if b-a==c-b==d-c:r=d+b-a if b/a==c/b==d/c==int(d*c/b)/d:r=int(d*c/b) print(r) ```
output
1
46,577
20
93,155
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric progressions. Arithmetic progression is a sequen...
instruction
0
46,578
20
93,156
Tags: implementation Correct Solution: ``` a, b, c, d = map(int, input().split()) if b - a == c - b == d - c: print(d + (d - c)) elif b * b == a * c and c * c == b * d and (d * d) % c == 0: print((d * d) // c) else: print(42) ```
output
1
46,578
20
93,157
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric progressions. Arithmetic progression is a sequen...
instruction
0
46,579
20
93,158
Tags: implementation Correct Solution: ``` def main(): a, b, c, d = [int(i) for i in input().split()] p1, p2, p3 = b - a, c - b, d - c q1, q2, q3 = b / a, c / b, d / c if(p1 == p2 == p3): print(d + p3) elif(q1 == q2 == q3 and q1 != 1 and int(d * q3) == d * q3): print(int(d * q3)) ...
output
1
46,579
20
93,159
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric progressions. Arithmetic progression is a sequen...
instruction
0
46,580
20
93,160
Tags: implementation Correct Solution: ``` def isZ(a): return a == int(a) def geom(a,b,c,d): if 0 in (a,b,c,d) and not (a==b==c==d==0): return False if(b/a==c/b==d/c): nxt = d * (d/c) if not isZ(nxt): return False print(int(nxt)) return True return False def ar(a,...
output
1
46,580
20
93,161
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric progressions. Arithmetic progression is a sequen...
instruction
0
46,581
20
93,162
Tags: implementation Correct Solution: ``` nums = [int(x) for x in input().split()] history1 = [] history2 = [] for idx in range(4): if idx != 3: a, b = nums[idx], nums[idx+1] history1.append(b-a) history2.append(b/a) if len(set(history1)) == 1: print(nums[-1]+history1[0]) elif len(set...
output
1
46,581
20
93,163
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric progressions. Arithmetic progression is a sequen...
instruction
0
46,582
20
93,164
Tags: implementation Correct Solution: ``` import sys n=input().split() a=int(n[0]) b=int(n[1]) c=int(n[2]) d=int(n[3]) if(b-a==c-b==d-c): print(2*d-c) sys.exit() if(b*b==a*c and c*c==b*d): if(d*d%c==0): print(d*d//c) else: print(42) sys.exit() print(42) ```
output
1
46,582
20
93,165
Provide tags and a correct Python 3 solution for this coding contest problem. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric progressions. Arithmetic progression is a sequen...
instruction
0
46,583
20
93,166
Tags: implementation Correct Solution: ``` a=list(map(int,input().split()));n=len(a);o=1;d=a[1]-a[0];ok=1 for i in range(n-1): if(a[i+1]-a[i]!=d):ok=0 if(ok): print(a[n-1]+d) o=0 d=a[1]/a[0];ok=1 for i in range(n-1): if(a[i+1]/a[i]!=d):ok=0 if(ok and o): o=0 if(int(a[n-1]*d)==a[n-1]*d):print(int...
output
1
46,583
20
93,167
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric pr...
instruction
0
46,584
20
93,168
Yes
output
1
46,584
20
93,169
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric pr...
instruction
0
46,585
20
93,170
Yes
output
1
46,585
20
93,171
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric pr...
instruction
0
46,586
20
93,172
Yes
output
1
46,586
20
93,173
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric pr...
instruction
0
46,589
20
93,178
No
output
1
46,589
20
93,179
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric pr...
instruction
0
46,590
20
93,180
No
output
1
46,590
20
93,181
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya is preparing for IQ test and he has noticed that there many problems like: you are given a sequence, find the next number. Now Petya can solve only problems with arithmetic or geometric pr...
instruction
0
46,591
20
93,182
No
output
1
46,591
20
93,183
Provide tags and a correct Python 3 solution for this coding contest problem. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS a...
instruction
0
46,689
20
93,378
Tags: implementation, math Correct Solution: ``` import math n = input() arr = [int(i) for i in n] n = int(arr[0])*10000+int(arr[2])*1000+int(arr[4])*100+int(arr[3])*10+int(arr[1]) n = (n**5) % 100000 print('%05d' % n) ```
output
1
46,689
20
93,379
Provide tags and a correct Python 3 solution for this coding contest problem. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS a...
instruction
0
46,690
20
93,380
Tags: implementation, math Correct Solution: ``` n = input() m = [] m.append(n[0]) m.append(n[2]) m.append(n[4]) m.append(n[3]) m.append(n[1]) m = ''.join(m) m = int(m) m = (m ** 5) % (10**5) m = str(m) for i in range(5-len(m)): print('0', end='') print(m) ```
output
1
46,690
20
93,381
Provide tags and a correct Python 3 solution for this coding contest problem. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS a...
instruction
0
46,691
20
93,382
Tags: implementation, math Correct Solution: ``` import sys import math Number = int(input()) arr = [] for i in range(5): arr.append(1) arr[0] = int((Number/10000)%10); arr[1] = int((Number/1000)%10); arr[2] = int((Number/100)%10); arr[3] = int((Number/10)%10); arr[4] = Number%10; NewNumber = int(arr[0]*10000+arr[2]...
output
1
46,691
20
93,383
Provide tags and a correct Python 3 solution for this coding contest problem. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS a...
instruction
0
46,692
20
93,384
Tags: implementation, math Correct Solution: ``` n = input() n = int(n[0] + n[2] + n[4] + n[3] + n[1]) print(str(n**5)[-5:]) ```
output
1
46,692
20
93,385
Provide tags and a correct Python 3 solution for this coding contest problem. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS a...
instruction
0
46,693
20
93,386
Tags: implementation, math Correct Solution: ``` s = input() n = int(s[0] + s[2] + s[4] + s[3] + s[1]) res = n ** 5 % (10 ** 5) st = "" n = res if n < 10: st += "0" if n < 100: st += "0" if n < 1000: st += "0" if n < 10000: st += "0" print(st, res, sep="") ```
output
1
46,693
20
93,387
Provide tags and a correct Python 3 solution for this coding contest problem. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS a...
instruction
0
46,694
20
93,388
Tags: implementation, math Correct Solution: ``` num = input() digits = [int(z) for z in list(num)] stg1 = [digits[0], digits[2], digits[4], digits[3], digits[1]] stg2 = str(int(''.join([str(w) for w in stg1])) ** 5) print(stg2[-5:]) ```
output
1
46,694
20
93,389
Provide tags and a correct Python 3 solution for this coding contest problem. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS a...
instruction
0
46,695
20
93,390
Tags: implementation, math Correct Solution: ``` def shuffle(s): ans = s[0] + s[2] + s[4] + s[3] + s[1] return ans s = input() s = shuffle(s) s = int(s) s = s**5 s = str(s) a = int(len(s)) - 5 b = int(len(s)) for i in range(a, b): print(s[i], sep='', end='') ```
output
1
46,695
20
93,391
Provide tags and a correct Python 3 solution for this coding contest problem. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS a...
instruction
0
46,696
20
93,392
Tags: implementation, math Correct Solution: ``` inp = input() shuf = inp[0] + inp[2] + inp[4] + inp[3] + inp[1] shuf = int(shuf)**5 print("{:0>5d}".format(shuf % 100000)) ```
output
1
46,696
20
93,393
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to ...
instruction
0
46,697
20
93,394
Yes
output
1
46,697
20
93,395
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to ...
instruction
0
46,698
20
93,396
Yes
output
1
46,698
20
93,397
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to ...
instruction
0
46,699
20
93,398
Yes
output
1
46,699
20
93,399
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to ...
instruction
0
46,700
20
93,400
Yes
output
1
46,700
20
93,401
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to ...
instruction
0
46,701
20
93,402
No
output
1
46,701
20
93,403
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to ...
instruction
0
46,702
20
93,404
No
output
1
46,702
20
93,405
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to ...
instruction
0
46,703
20
93,406
No
output
1
46,703
20
93,407
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to ...
instruction
0
46,704
20
93,408
No
output
1
46,704
20
93,409
Provide tags and a correct Python 3 solution for this coding contest problem. Karen has just arrived at school, and she has a math test today! <image> The test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no time to make an actual tes...
instruction
0
46,766
20
93,532
Tags: brute force, combinatorics, constructive algorithms, math Correct Solution: ``` #!/usr/bin/env python3 from sys import stdin, stdout def main(): N = 400005 MOD = 10 ** 9 + 7 fact = [1] + [i+1 for i in range(N)] for i in range(1, N + 1): fact[i] *= fact[i - 1] fact[i] %= MOD ...
output
1
46,766
20
93,533
Provide tags and a correct Python 3 solution for this coding contest problem. Karen has just arrived at school, and she has a math test today! <image> The test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no time to make an actual tes...
instruction
0
46,767
20
93,534
Tags: brute force, combinatorics, constructive algorithms, math Correct Solution: ``` n = int(input()) p = list(map(int,input().split())) MOD = 10**9+7 mode = 0 if n%4 == 3: n-= 1 new = [] for i in range(n): if mode == 0: new.append(p[i]+p[i+1]) else: new.append(p[i]-p[i+1]) mode = ...
output
1
46,767
20
93,535
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya calls a number ...
instruction
0
47,116
20
94,232
Tags: brute force, number theory Correct Solution: ``` n = input() print(['NO', 'YES'][len(n) == n.count('4') + n.count('7') or any(int(n) % i == 0 for i in [4, 7, 47, 74, 44, 77, 444, 777, 477, 747, 774, 447, 474, 744])]) ```
output
1
47,116
20
94,233
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya calls a number ...
instruction
0
47,117
20
94,234
Tags: brute force, number theory Correct Solution: ``` def solve(n): if isLucky(n): return "YES" for x in range(2,n//2): if n % x == 0 and (isLucky(x) or isLucky(n//x)): return "YES" return "NO" def isLucky(n): while n > 0: digit = n % 10 if digit != 4 a...
output
1
47,117
20
94,235
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya calls a number ...
instruction
0
47,118
20
94,236
Tags: brute force, number theory Correct Solution: ``` s = input() l = ['4', '7', '47', '74', '444', '447', '477', '777'] if s in l: print('YES') elif 0 in [int(s) % int(i) for i in l]: print('YES') else: print('NO') ```
output
1
47,118
20
94,237
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya calls a number ...
instruction
0
47,119
20
94,238
Tags: brute force, number theory Correct Solution: ``` n=int(input()) lis=[4,7,47,74,44,444,447,474,477,777,774,744,747] for i in lis: i=int(i) for i in lis: if n%i==0: Flag=True break; else: Flag=False if Flag==True: print("YES") else: print("NO") ```
output
1
47,119
20
94,239
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya calls a number ...
instruction
0
47,120
20
94,240
Tags: brute force, number theory Correct Solution: ``` n = int(input()) if n%4==0 or n%7==0 or n%44==0 or n%47==0 or n%74==0 or n%444==0 or n%447==0 or n%474==0 or n%744==0 or n%477==0 or n%774==0 or n%777==0: print('YES') else: print('NO') ```
output
1
47,120
20
94,241
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya calls a number ...
instruction
0
47,121
20
94,242
Tags: brute force, number theory Correct Solution: ``` happy_numbers = [4, 7, 44, 47, 74, 77, 444, 447, 477, 774, 744, 747, 474, 777] def happy_divisibility(number): for elem in happy_numbers: if number % elem == 0: return "YES" return "NO" n = int(input()) print(happy_divisibility(n)) ...
output
1
47,121
20
94,243
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya calls a number ...
instruction
0
47,122
20
94,244
Tags: brute force, number theory Correct Solution: ``` def is_almost_lucky(n): lucky_numbers = [4,7,44,47,74,77, 444, 447, 474, 477, 744, \ 774, 777] for i in lucky_numbers: if n%i==0: return "YES" return "NO" if __name__ == "__main__": x = input() print(is_almost_luck...
output
1
47,122
20
94,245
Provide tags and a correct Python 3 solution for this coding contest problem. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya calls a number ...
instruction
0
47,123
20
94,246
Tags: brute force, number theory Correct Solution: ``` def lucky(a): c = True while a != 0: b = a % 10 a = a // 10 if b != 4 and b != 7: c = False a = 0 return c n = int(input()) division = [] c = 0 for i in range(1 , n + 1): if n % i == 0: divisio...
output
1
47,123
20
94,247
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky...
instruction
0
47,124
20
94,248
Yes
output
1
47,124
20
94,249