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
Provide a correct Python 3 solution for this coding contest problem. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod ...
instruction
0
33,168
20
66,336
"Correct Solution: ``` n=int(input()) if n==1 or n==2: print(0) exit() d=0 for i in range(1,int(n**0.5)+1): if n%i==0: if i!=n//i and i!=n//i-1: d=d+n//i-1 print(d) ```
output
1
33,168
20
66,337
Provide a correct Python 3 solution for this coding contest problem. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod ...
instruction
0
33,169
20
66,338
"Correct Solution: ``` import math n=int(input()) rt=int(math.sqrt(n+1))-1 r=1 ans=0 while r<=rt: if n%r==0: ans+=n//r-1 r+=1 print(ans) ```
output
1
33,169
20
66,339
Provide a correct Python 3 solution for this coding contest problem. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod ...
instruction
0
33,170
20
66,340
"Correct Solution: ``` N = int(input()) x,r = 1,0 while x*x < N: if N%x==0: if x>1 and N//(x-1)==N%(x-1): r += x-1 t = N//x-1 if N//t==N%t: r += t x += 1 print(r) ```
output
1
33,170
20
66,341
Provide a correct Python 3 solution for this coding contest problem. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod ...
instruction
0
33,171
20
66,342
"Correct Solution: ``` import math N=int(input()) ans=0 for i in range(1, math.ceil(N**0.5)): if N % i == 0: if i < N//i-1: ans+=N//i-1 print(ans) ```
output
1
33,171
20
66,343
Provide a correct Python 3 solution for this coding contest problem. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod ...
instruction
0
33,172
20
66,344
"Correct Solution: ``` N = int(input()) S = 0 for i in range(1, int(N**(1/2))+1): if N % i == 0 and N // i > i + 1: S += N // i - 1 print(S) ```
output
1
33,172
20
66,345
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m ar...
instruction
0
33,173
20
66,346
Yes
output
1
33,173
20
66,347
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m ar...
instruction
0
33,174
20
66,348
Yes
output
1
33,174
20
66,349
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m ar...
instruction
0
33,175
20
66,350
Yes
output
1
33,175
20
66,351
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m ar...
instruction
0
33,176
20
66,352
Yes
output
1
33,176
20
66,353
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m ar...
instruction
0
33,177
20
66,354
No
output
1
33,177
20
66,355
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m ar...
instruction
0
33,178
20
66,356
No
output
1
33,178
20
66,357
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m ar...
instruction
0
33,179
20
66,358
No
output
1
33,179
20
66,359
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Snuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied: * The quotient and remainder of N divided by m ar...
instruction
0
33,180
20
66,360
No
output
1
33,180
20
66,361
Provide a correct Python 3 solution for this coding contest problem. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. The letters "m", ...
instruction
0
33,266
20
66,532
"Correct Solution: ``` # coding: utf-8 r=list('mcxi') m=r[::-1] n=int(input()) for i in range(n): a,b=input().split() x=int(''.join(['0' if len(a.split(c))==1 else '1' if a.split(c)[0]=='' or a.split(c)[0][-1] in 'mcxi' else a.split(c)[0][-1] for c in r])) y=int(''.join(['0' if len(b.split(c))==1 else '1' i...
output
1
33,266
20
66,533
Provide a correct Python 3 solution for this coding contest problem. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. The letters "m", ...
instruction
0
33,267
20
66,534
"Correct Solution: ``` mcxi = "mcxi" mcxinum = [1000, 100, 10, 1] n = int(input()) for z in range(n): nums = list(input().split()) ans = 0 for num in nums: for ind, c in enumerate(mcxi): if c in num: prestr, num = num.split(c) pre = 1 if ...
output
1
33,267
20
66,535
Provide a correct Python 3 solution for this coding contest problem. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. The letters "m", ...
instruction
0
33,268
20
66,536
"Correct Solution: ``` d = {'m':1000,'c':100,'x':10,'i':1} k = ['i','x','c','m'] def digit(s): r,p = 0,1 for x in s: if x.isdigit(): p = int(x) else: r += p*d[x] p = 1 return r for _ in range(int(input())): a,b = input().split() s = digit(a)+digit(b) r = ...
output
1
33,268
20
66,537
Provide a correct Python 3 solution for this coding contest problem. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. The letters "m", ...
instruction
0
33,269
20
66,538
"Correct Solution: ``` import re for i in range(int(input())): s=input().replace(" ","") print(re.sub(r'0.','',''.join([i+j for(i,j)in zip(str(10000+sum([eval(i[0]+'0'*'ixcm'.find(i[1]))for i in['1'+i for i in''.join(re.split(r'\d\w',s))]+re.findall(r'\d\w',s)])),list('1mcxi'))]).replace('1',''))) ```
output
1
33,269
20
66,539
Provide a correct Python 3 solution for this coding contest problem. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. The letters "m", ...
instruction
0
33,270
20
66,540
"Correct Solution: ``` import sys sys.setrecursionlimit(10**5) def L(): return [x for x in input().split()] def LI(): return [int(x) for x in input().split()] def LF(): return [float(x) for x in input().split()] def LI_(): return [-1*int(x) for x in input().split()] def II(): return int(input()) def IF(): return float...
output
1
33,270
20
66,541
Provide a correct Python 3 solution for this coding contest problem. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. The letters "m", ...
instruction
0
33,271
20
66,542
"Correct Solution: ``` #2005_c n = int(input()) k = list("mcxi") for i in range(n): d = {"m":0,"c":0,"x":0,"i":0} a,b = input().split() a = list(a) b = list(b) a.insert(0,1) b.insert(0,1) for j in range(1,len(a)): if a[j] in k: if a[j-1] in k: d[a[j]] +=...
output
1
33,271
20
66,543
Provide a correct Python 3 solution for this coding contest problem. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. The letters "m", ...
instruction
0
33,272
20
66,544
"Correct Solution: ``` def encode(n): ns = [] mcxi = ['m','c','x','i'] v = 1000 for i in range(4): m = 0 while n >= v: n -= v m += 1 v = int(v/10) if m > 0: ns.append(str(m)+mcxi[i]) return ''.join(ns).replace('1','') def decode(s)...
output
1
33,272
20
66,545
Provide a correct Python 3 solution for this coding contest problem. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. The letters "m", ...
instruction
0
33,273
20
66,546
"Correct Solution: ``` #!/usr/bin/env python3 # -*- coding: utf-8 -*- import re PATTERN = re.compile(r"[2-9]*[mcxi]") NUMBERS = "23456789" TABLE = {"m": 1000, "c": 100, "x": 10, "i": 1} def mcxi2int(mcxi_str): answer = 0 for segment in re.findall(PATTERN, mcxi_str): answer += TABLE[segment[-1]] * \ ...
output
1
33,273
20
66,547
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use di...
instruction
0
33,274
20
66,548
Yes
output
1
33,274
20
66,549
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use di...
instruction
0
33,275
20
66,550
Yes
output
1
33,275
20
66,551
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use di...
instruction
0
33,276
20
66,552
Yes
output
1
33,276
20
66,553
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use di...
instruction
0
33,277
20
66,554
Yes
output
1
33,277
20
66,555
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use di...
instruction
0
33,278
20
66,556
No
output
1
33,278
20
66,557
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use di...
instruction
0
33,279
20
66,558
No
output
1
33,279
20
66,559
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use di...
instruction
0
33,280
20
66,560
No
output
1
33,280
20
66,561
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use di...
instruction
0
33,281
20
66,562
No
output
1
33,281
20
66,563
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For example, ticket 350178 is l...
instruction
0
33,320
20
66,640
Tags: implementation Correct Solution: ``` n = int(input()) A = list(map(int, input())) S = [A[0]] for i in range(1, n): if A[i] != 0: S.append(A[i] + S[len(S) - 1]) ans = "NO" for d in S: k = 2 for i in range(len(S) - 1): if d * k == S[i]: k += 1 if S[len(S) - 1] == d *...
output
1
33,320
20
66,641
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For example, ticket 350178 is l...
instruction
0
33,321
20
66,642
Tags: implementation Correct Solution: ``` n = int(input()) digits = [int(d) for d in input()] ret = "NO" for i in range(n - 1): sum1 = 0 for i2 in range(i + 1): sum1 += digits[i2] next1 = i + 1 temp = 0 reseted = False #print("try with sum = " + str(sum1)) while next1 != n: ...
output
1
33,321
20
66,643
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For example, ticket 350178 is l...
instruction
0
33,322
20
66,644
Tags: implementation Correct Solution: ``` n = int(input()) number = input() sum = 0 flag = False counter = 0 for i in range (n) : sum = sum + int(number[i]) if (sum == 0 and n > 1) : flag = True for i in range (2, sum+1) : if (sum % i == 0) : for j in range (n) : counter = counter + int...
output
1
33,322
20
66,645
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For example, ticket 350178 is l...
instruction
0
33,323
20
66,646
Tags: implementation Correct Solution: ``` a=int(input()) b=list(map(int,input().replace('',' ').split()));k=0;o=sum(b) for i in range(452): j=0;s=0;p=[] while j<a: if s+b[j]<i:s+=b[j] elif s+b[j]==i:p+=[s+b[j]];s=0 else:p=[];break j+=1 if s==0 and len(p)!=1 and len(set(p))==...
output
1
33,323
20
66,647
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For example, ticket 350178 is l...
instruction
0
33,324
20
66,648
Tags: implementation Correct Solution: ``` def main(): n = int(input()) s = input() maxi = -1 for x in range(901): f = False acc = 0 cnt = 0 for y in range(n): if acc + int(s[y]) > x: f = True break elif acc + int...
output
1
33,324
20
66,649
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For example, ticket 350178 is l...
instruction
0
33,325
20
66,650
Tags: implementation Correct Solution: ``` n = int(input()) s = input() s = str(s).strip('0') n = len(s) m = [] for i in s: m.append(int(i)) from itertools import accumulate ac = list(accumulate(m)) res = 0 if n==0: res = 1 for i in range(n-1): check = 1 if ac[i] == 0: for j in ac[i+1:]: ...
output
1
33,325
20
66,651
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For example, ticket 350178 is l...
instruction
0
33,326
20
66,652
Tags: implementation Correct Solution: ``` import sys n = int(input()) s = input() s2 = '' maxx = 0 all_zero = True for i in s: maxx += int(i) if i != '0': all_zero = False s2 += i s = s2 n = len(s) if all_zero: print("YES") sys.exit() for i in range(0, maxx): start = 0 p = 0 ...
output
1
33,326
20
66,653
Provide tags and a correct Python 3 solution for this coding contest problem. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For example, ticket 350178 is l...
instruction
0
33,327
20
66,654
Tags: implementation Correct Solution: ``` n = int(input()) aS = list(map(int, input())) a = [] for i in aS: if i > 0: a.append(i) n = len(a) if n == 0: print("YES") exit() cur = 0 for i in range(n - 1): cur += a[i] ans = True co = i + 1 while co < n: ad = 0 while co ...
output
1
33,327
20
66,655
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments w...
instruction
0
33,328
20
66,656
Yes
output
1
33,328
20
66,657
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments w...
instruction
0
33,329
20
66,658
Yes
output
1
33,329
20
66,659
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments w...
instruction
0
33,330
20
66,660
Yes
output
1
33,330
20
66,661
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments w...
instruction
0
33,331
20
66,662
Yes
output
1
33,331
20
66,663
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments w...
instruction
0
33,332
20
66,664
No
output
1
33,332
20
66,665
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments w...
instruction
0
33,333
20
66,666
No
output
1
33,333
20
66,667
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments w...
instruction
0
33,334
20
66,668
No
output
1
33,334
20
66,669
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently Vasya found a golden ticket — a sequence which consists of n digits a_1a_2... a_n. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments w...
instruction
0
33,335
20
66,670
No
output
1
33,335
20
66,671
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in w...
instruction
0
33,627
20
67,254
No
output
1
33,627
20
67,255
Provide tags and a correct Python 3 solution for this coding contest problem. Giga Tower is the tallest and deepest building in Cyberland. There are 17 777 777 777 floors, numbered from - 8 888 888 888 to 8 888 888 888. In particular, there is floor 0 between floor - 1 and floor 1. Every day, thousands of tourists c...
instruction
0
33,765
20
67,530
Tags: brute force Correct Solution: ``` n=int(input()) cnt=0 def ch(n): n=abs(n) while(n>0): t=int(n%10) if(t==8): return True n/=10 return False cnt+=1 n+=1 while(ch(n)==False): n+=1 cnt+=1 #print(n,cnt) print(cnt) ```
output
1
33,765
20
67,531
Provide tags and a correct Python 3 solution for this coding contest problem. Giga Tower is the tallest and deepest building in Cyberland. There are 17 777 777 777 floors, numbered from - 8 888 888 888 to 8 888 888 888. In particular, there is floor 0 between floor - 1 and floor 1. Every day, thousands of tourists c...
instruction
0
33,766
20
67,532
Tags: brute force Correct Solution: ``` n = int(input()) b = 0 while True: n += 1 b += 1 digits = list(map(int,list(str(abs(n))))) if 8 in digits: print(b) break ```
output
1
33,766
20
67,533
Provide tags and a correct Python 3 solution for this coding contest problem. Giga Tower is the tallest and deepest building in Cyberland. There are 17 777 777 777 floors, numbered from - 8 888 888 888 to 8 888 888 888. In particular, there is floor 0 between floor - 1 and floor 1. Every day, thousands of tourists c...
instruction
0
33,767
20
67,534
Tags: brute force Correct Solution: ``` a = int(input()) res = 1 a += 1 while '8' not in str(a): res += 1 a += 1 print(res) ```
output
1
33,767
20
67,535
Provide tags and a correct Python 3 solution for this coding contest problem. Giga Tower is the tallest and deepest building in Cyberland. There are 17 777 777 777 floors, numbered from - 8 888 888 888 to 8 888 888 888. In particular, there is floor 0 between floor - 1 and floor 1. Every day, thousands of tourists c...
instruction
0
33,768
20
67,536
Tags: brute force Correct Solution: ``` n = int(input()) if -8 <= n <= 7: print(8-n) elif n >= 8: n += 1 temp = list(str(n)) if temp.count('8') > 0: print(1) elif temp[len(temp)-1] == '9': carry = 1 temp.insert(0, '0') i = len(temp)-1 while i >= 0: ...
output
1
33,768
20
67,537