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. Your job is to find out the secret number hidden in a matrix, each of whose element is a digit ('0'-'9') or a letter ('A'-'Z'). You can see an example matrix in Figure 1. <image> Figure 1: A Matrix The secret number and other non-secret ones are c...
instruction
0
48,745
20
97,490
"Correct Solution: ``` # AOJ 1126: The Secret Number # Python3 2018.7.16 bal4u while True: W, H = map(int, input().split()) if W == 0: break d = [list(input()) for r in range(H)] a = [[0 for c in range(W)] for r in range(H)] ans = 0 for r in range(H): for c in range(W): if not d[r][c].isdigit(): continue ...
output
1
48,745
20
97,491
Provide a correct Python 3 solution for this coding contest problem. Your job is to find out the secret number hidden in a matrix, each of whose element is a digit ('0'-'9') or a letter ('A'-'Z'). You can see an example matrix in Figure 1. <image> Figure 1: A Matrix The secret number and other non-secret ones are c...
instruction
0
48,746
20
97,492
"Correct Solution: ``` import sys from collections import deque W,H,C = None,None,None mmax = None def main(): global W,H,C,mmax while True: W,H = map(int,input().split()) if not W and not H: return C = [] mmax = [[-1]*(W+1) for _ in range(H+1)] for _ in ra...
output
1
48,746
20
97,493
Provide a correct Python 3 solution for this coding contest problem. Your job is to find out the secret number hidden in a matrix, each of whose element is a digit ('0'-'9') or a letter ('A'-'Z'). You can see an example matrix in Figure 1. <image> Figure 1: A Matrix The secret number and other non-secret ones are c...
instruction
0
48,747
20
97,494
"Correct Solution: ``` while True: w,h = map(int,input().split()) if w == 0: break c = [input() for i in range(h)] dp = [[0]*w for i in range(h)] ans = 0 for i in range(h): for j in range(w): d = ord(c[i][j]) - ord('0') if not (d>=0 and d<=9): ...
output
1
48,747
20
97,495
Provide a correct Python 3 solution for this coding contest problem. Your job is to find out the secret number hidden in a matrix, each of whose element is a digit ('0'-'9') or a letter ('A'-'Z'). You can see an example matrix in Figure 1. <image> Figure 1: A Matrix The secret number and other non-secret ones are c...
instruction
0
48,748
20
97,496
"Correct Solution: ``` # coding: utf-8 def check(a,b): if (a,b) in memo: return memo[(a,b)] if 0<=a<h and 0<=b<w and field[a][b].isdigit(): x=check(a+1,b) y=check(a,b+1) memo[(a,b)]=field[a][b]+(x if len(x)>len(y) else x if len(x)==len(y) and len(x)!=0 and int(x)>int(y) else y) ...
output
1
48,748
20
97,497
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Your job is to find out the secret number hidden in a matrix, each of whose element is a digit ('0'-'9') or a letter ('A'-'Z'). You can see an example matrix in Figure 1. <image> Figure 1: A M...
instruction
0
48,749
20
97,498
Yes
output
1
48,749
20
97,499
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Your job is to find out the secret number hidden in a matrix, each of whose element is a digit ('0'-'9') or a letter ('A'-'Z'). You can see an example matrix in Figure 1. <image> Figure 1: A M...
instruction
0
48,750
20
97,500
Yes
output
1
48,750
20
97,501
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Your job is to find out the secret number hidden in a matrix, each of whose element is a digit ('0'-'9') or a letter ('A'-'Z'). You can see an example matrix in Figure 1. <image> Figure 1: A M...
instruction
0
48,751
20
97,502
Yes
output
1
48,751
20
97,503
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Your job is to find out the secret number hidden in a matrix, each of whose element is a digit ('0'-'9') or a letter ('A'-'Z'). You can see an example matrix in Figure 1. <image> Figure 1: A M...
instruction
0
48,752
20
97,504
No
output
1
48,752
20
97,505
Provide tags and a correct Python 3 solution for this coding contest problem. There is an infinite set generated as follows: * 1 is in this set. * If x is in this set, x ⋅ a and x+b both are in this set. For example, when a=3 and b=6, the five smallest elements of the set are: * 1, * 3 (1 is in this se...
instruction
0
49,092
20
98,184
Tags: constructive algorithms, math, number theory Correct Solution: ``` import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mo...
output
1
49,092
20
98,185
Provide tags and a correct Python 3 solution for this coding contest problem. There is an infinite set generated as follows: * 1 is in this set. * If x is in this set, x ⋅ a and x+b both are in this set. For example, when a=3 and b=6, the five smallest elements of the set are: * 1, * 3 (1 is in this se...
instruction
0
49,093
20
98,186
Tags: constructive algorithms, math, number theory Correct Solution: ``` def solve(x, a, b): if a == 1: if (x - 1) % b == 0: return 'Yes' return 'No' an = 1 while an <= x: if (x - an) % b == 0: return 'Yes' an *= a return 'No' t = int(input()) for i in range(t): x, a, b = map(i...
output
1
49,093
20
98,187
Provide tags and a correct Python 3 solution for this coding contest problem. There is an infinite set generated as follows: * 1 is in this set. * If x is in this set, x ⋅ a and x+b both are in this set. For example, when a=3 and b=6, the five smallest elements of the set are: * 1, * 3 (1 is in this se...
instruction
0
49,097
20
98,194
Tags: constructive algorithms, math, number theory Correct Solution: ``` for _ in range(int(input())): n,a,b = list(map(int,input().split())) if n == 1 or b == 1: print('Yes') elif a == 1: if (n-1)%b == 0: print('Yes') else: print('No') else: ans = 'No' x = 1 while x<=n: if (n-x)%b == 0: an...
output
1
49,097
20
98,195
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by two. After clicking...
instruction
0
49,207
20
98,414
Tags: dfs and similar, graphs, greedy, implementation, math, shortest paths Correct Solution: ``` n,m=map(int,input().split()) count=0 while m!=n: if m%2==1: m+=1 count+=1 elif m<n: m+=1 count+=1 elif m%2==0: m=m//2 count+=1 print(count) ```
output
1
49,207
20
98,415
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by two. After clicking...
instruction
0
49,208
20
98,416
Tags: dfs and similar, graphs, greedy, implementation, math, shortest paths Correct Solution: ``` from collections import defaultdict x,y=map(int,input().split()) q=[x] #vis=[1]*100000001 v=[0] d=defaultdict(lambda:1) d[x]=0 while 1: lol=q.pop(0) k=v.pop(0) #print(lol,q) if lol==y: break if...
output
1
49,208
20
98,417
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by two. After clicking...
instruction
0
49,209
20
98,418
Tags: dfs and similar, graphs, greedy, implementation, math, shortest paths Correct Solution: ``` def fun(n, m): if n >= m: return (n-m) Q = [n] mySet = set() cnt = 1 while(True): new_Q = [] for num in Q: x = 2*num y = num-1 if x == m or y ...
output
1
49,209
20
98,419
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by two. After clicking...
instruction
0
49,210
20
98,420
Tags: dfs and similar, graphs, greedy, implementation, math, shortest paths Correct Solution: ``` a,b=map(int,input().split()) op=0 while a!=b: op+=1 if(b<a or b&1): b+=1 else: b//=2 print(op) ```
output
1
49,210
20
98,421
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by two. After clicking...
instruction
0
49,211
20
98,422
Tags: dfs and similar, graphs, greedy, implementation, math, shortest paths Correct Solution: ``` import math def main(): n,m=map(int,input().split()) i=0 while n!=m: i+=1 if m%2==1 or m<n: m+=1 else: m=m//2 print(i) if __name__=='__main__': main...
output
1
49,211
20
98,423
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by two. After clicking...
instruction
0
49,212
20
98,424
Tags: dfs and similar, graphs, greedy, implementation, math, shortest paths Correct Solution: ``` n, m = map(int, input().split()) if n >= m: print(n - m) else: actions = 0 while n != m: if m % 2 == 1: m += 1 actions += 1 m //= 2 actions += 1 if m < n:...
output
1
49,212
20
98,425
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by two. After clicking...
instruction
0
49,213
20
98,426
Tags: dfs and similar, graphs, greedy, implementation, math, shortest paths Correct Solution: ``` n,m = map(int, input().split()) ans = 0 if n >= m: print(n-m) else: if m % 2 == 1: ans = 1 m += 1 while m > n: if m % 2 == 0: ...
output
1
49,213
20
98,427
Provide tags and a correct Python 3 solution for this coding contest problem. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by two. After clicking...
instruction
0
49,214
20
98,428
Tags: dfs and similar, graphs, greedy, implementation, math, shortest paths Correct Solution: ``` # coding: utf-8 from collections import deque n, m = [int(i) for i in input().split()] ans = [-1]*((n+m)*2+1) ans[m] = 0 queue = deque([m]) while queue: k = queue.popleft() if ans[k+1] == -1: ans[k+1] = ans...
output
1
49,214
20
98,429
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multipl...
instruction
0
49,215
20
98,430
Yes
output
1
49,215
20
98,431
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multipl...
instruction
0
49,216
20
98,432
Yes
output
1
49,216
20
98,433
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multipl...
instruction
0
49,217
20
98,434
Yes
output
1
49,217
20
98,435
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multipl...
instruction
0
49,218
20
98,436
Yes
output
1
49,218
20
98,437
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multipl...
instruction
0
49,219
20
98,438
No
output
1
49,219
20
98,439
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multipl...
instruction
0
49,220
20
98,440
No
output
1
49,220
20
98,441
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multipl...
instruction
0
49,221
20
98,442
No
output
1
49,221
20
98,443
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multipl...
instruction
0
49,222
20
98,444
No
output
1
49,222
20
98,445
Provide a correct Python 3 solution for this coding contest problem. Mr. Morishita was in trouble ... I had Mr. Anehara write a program, but the program crashed. Mr. Anehara wrote a program that reads the formula in Reverse Polish Notation and outputs the calculation result. According to the crash log, it seems that ...
instruction
0
49,575
20
99,150
"Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**13 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int...
output
1
49,575
20
99,151
Provide tags and a correct Python 3 solution for this coding contest problem. Ivan unexpectedly saw a present from one of his previous birthdays. It is array of n numbers from 1 to 200. Array is old and some numbers are hard to read. Ivan remembers that for all elements at least one of its neighbours ls not less than ...
instruction
0
49,648
20
99,296
Tags: dp Correct Solution: ``` import os numb, sign = 0, 1 a = [] s = os.read(0, os.fstat(0).st_size) for i in range(len(s)): if s[i] >= 48: numb = 10 * numb + s[i] - 48 else: if s[i] == 45: sign = -1 elif s[i]!=13: #'\r' check a.append(sign * numb) n...
output
1
49,648
20
99,297
Provide tags and a correct Python 3 solution for this coding contest problem. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus developed in Japan. T...
instruction
0
49,979
20
99,958
Tags: implementation Correct Solution: ``` def soroban(n): n=list(n) n=[int(x) for x in n] for i in reversed(n): if i<5: count=0 print('O-|',end='') for j in range(i): print('O',end='') count=count+1 print('-',end='') ...
output
1
49,979
20
99,959
Provide tags and a correct Python 3 solution for this coding contest problem. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus developed in Japan. T...
instruction
0
49,980
20
99,960
Tags: implementation Correct Solution: ``` for d in reversed(input()): x, y = divmod(int(d), 5) A = list('OO|OOOOO') A[1-x] = A[y-5] = '-' print(*A, sep='') ```
output
1
49,980
20
99,961
Provide tags and a correct Python 3 solution for this coding contest problem. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus developed in Japan. T...
instruction
0
49,981
20
99,962
Tags: implementation Correct Solution: ``` n = input() l = len(n) for i in range(l-1,-1,-1): dig = int(n[i]) if dig<5: print("O-", end="") else: print("-O", end="") print("|", end="") extra = dig % 5 bead_rem = 4 - extra print("O"*extra + "-" + "O"*bead_rem) ```
output
1
49,981
20
99,963
Provide tags and a correct Python 3 solution for this coding contest problem. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus developed in Japan. T...
instruction
0
49,982
20
99,964
Tags: implementation Correct Solution: ``` #code x=input() for i in x[::-1]: i=int(i) if(i<5): k="O-|" for j in range(i): k=k+"O" k+='-' for j in range(4-i): k+="O" else: k="-O|" for j in range(i-5): k+='O' k+='-' ...
output
1
49,982
20
99,965
Provide tags and a correct Python 3 solution for this coding contest problem. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus developed in Japan. T...
instruction
0
49,983
20
99,966
Tags: implementation Correct Solution: ``` n = input() for i in n[::-1]: line = "" if int(i) >= 5: line+= "-O|" else: line += "O-|" a = int(i)%5 line += "O"*a line += "-" line += "O"*(4-a) print(line) ```
output
1
49,983
20
99,967
Provide tags and a correct Python 3 solution for this coding contest problem. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus developed in Japan. T...
instruction
0
49,984
20
99,968
Tags: implementation Correct Solution: ``` r = [ "O-|-OOOO", "O-|O-OOO", "O-|OO-OO", "O-|OOO-O", "O-|OOOO-", "-O|-OOOO", "-O|O-OOO", "-O|OO-OO", "-O|OOO-O", "-O|OOOO-", ] n = input() n = str(n) for d in reversed(n): d = int(d) print(r[d]) ```
output
1
49,984
20
99,969
Provide tags and a correct Python 3 solution for this coding contest problem. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus developed in Japan. T...
instruction
0
49,985
20
99,970
Tags: implementation Correct Solution: ``` n = int(input()) while True: d = n % 10 s = '' if d < 5: s = 'O-|' else: s = '-O|' d -= 5 s += 'O' * d + '-' + 'O' * (4 - d) print(s) n //= 10 if n == 0: break ```
output
1
49,985
20
99,971
Provide tags and a correct Python 3 solution for this coding contest problem. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus developed in Japan. T...
instruction
0
49,986
20
99,972
Tags: implementation Correct Solution: ``` ns=input() for i in range(len(ns)-1,-1,-1): if int(ns[i])<5: print("O-|",end='') else: print("-O|",end='') c=int(ns[i])%5 for j in range(5): if j==c: print("-",end='') else: print("O",end='') print() ```
output
1
49,986
20
99,973
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count us...
instruction
0
49,987
20
99,974
Yes
output
1
49,987
20
99,975
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count us...
instruction
0
49,988
20
99,976
Yes
output
1
49,988
20
99,977
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count us...
instruction
0
49,989
20
99,978
Yes
output
1
49,989
20
99,979
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count us...
instruction
0
49,990
20
99,980
Yes
output
1
49,990
20
99,981
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count us...
instruction
0
49,991
20
99,982
No
output
1
49,991
20
99,983
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count us...
instruction
0
49,992
20
99,984
No
output
1
49,992
20
99,985
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count us...
instruction
0
49,993
20
99,986
No
output
1
49,993
20
99,987
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count us...
instruction
0
49,994
20
99,988
No
output
1
49,994
20
99,989
Provide tags and a correct Python 3 solution for this coding contest problem. Piegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number <image>, in particular that q2 = q + 1, and she thinks it would make a good base for her new un...
instruction
0
49,996
20
99,992
Tags: math, meet-in-the-middle Correct Solution: ``` def clean(d): ans = ['0'] for c in list(d): ans.append(c) i = len(ans) - 1 #find last index while i > 1 and ans[i-2]== '0' and ans[i - 1] == '1' and ans[i] == '1': ans[i - 2] = '1' ans[i - 1] = '0' a...
output
1
49,996
20
99,993
Provide tags and a correct Python 3 solution for this coding contest problem. Piegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number <image>, in particular that q2 = q + 1, and she thinks it would make a good base for her new un...
instruction
0
49,997
20
99,994
Tags: math, meet-in-the-middle Correct Solution: ``` from sys import stdin s=list(stdin.readline().strip()[::-1]) s1=list(stdin.readline().strip()[::-1]) def trans(s): s.append("0") i=len(s)-1 while i>1: while i>=len(s): s.append("0") if s[i-1]=="1" and s[i-2]=="1": s...
output
1
49,997
20
99,995
Provide tags and a correct Python 3 solution for this coding contest problem. Piegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number <image>, in particular that q2 = q + 1, and she thinks it would make a good base for her new un...
instruction
0
49,998
20
99,996
Tags: math, meet-in-the-middle Correct Solution: ``` u = v = 0 a, b = input(), input() n, m = len(a), len(b) if n > m: b = '0' * (n - m) + b else: a = '0' * (m - n) + a for i in range(max(n, m)): u, v = v + u, u + int(a[i]) - int(b[i]) if u > 1: print('>') exit(0) elif u < -1: print(...
output
1
49,998
20
99,997
Provide tags and a correct Python 3 solution for this coding contest problem. Piegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number <image>, in particular that q2 = q + 1, and she thinks it would make a good base for her new un...
instruction
0
49,999
20
99,998
Tags: math, meet-in-the-middle Correct Solution: ``` u = v = 0 a, b = input(), input() n, m = len(a), len(b) if n > m: b = '0' * (n - m) + b else: a = '0' * (m - n) + a for i in range(max(n, m)): u, v = v + u, u + int(a[i]) - int(b[i]) if u > 1: print('>') exit(0) elif u < -1: ...
output
1
49,999
20
99,999
Provide tags and a correct Python 3 solution for this coding contest problem. Piegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number <image>, in particular that q2 = q + 1, and she thinks it would make a good base for her new un...
instruction
0
50,000
20
100,000
Tags: math, meet-in-the-middle Correct Solution: ``` from itertools import dropwhile, chain def main(): zeroes = lambda a: not a a, b = [list(chain([0, 0], dropwhile(zeroes, map(int, input())))) for _ in range(2)] def tofib(l): i = 0 while i < len(l) - 1: if l[i] >...
output
1
50,000
20
100,001