lang
stringclasses
1 value
prompt
stringlengths
1.38k
11.3k
eval_prompt
stringlengths
37
8.09k
ground_truth
stringlengths
1
328
unit_tests
stringclasses
145 values
task_id
stringlengths
23
25
split
stringclasses
2 values
python
Complete the code in python to solve this programming problem: Description: There is a grid with $$$n$$$ rows and $$$m$$$ columns, and three types of cells: An empty cell, denoted with '.'. A stone, denoted with '*'. An obstacle, denoted with the lowercase Latin letter 'o'. All stones fall down until they meet the...
# Write your code here :-) # Fall Down def solution(): n, m = [int(i) for i in input().split()] grid = [list(input()) for _ in range(n)] for i in range(m): for j in range(n - 1, -1, -1): if grid[j][i] == "*": grid[j][i] = "." pos = j while ...
pos += 1
[{"input": "3\n6 10\n.*.*....*.\n.*.......*\n...o....o.\n.*.*....*.\n..........\n.o......o*\n2 9\n...***ooo\n.*o.*o.*o\n5 5\n*****\n*....\n*****\n....*\n*****", "output": ["..........\n...*....*.\n.*.o....o.\n.*........\n.*......**\n.o.*....o*\n\n....**ooo\n.*o**o.*o\n\n.....\n*...*\n*****\n*****\n*****"]}]
block_completion_000846
block
python
Complete the code in python to solve this programming problem: Description: There is a grid with $$$n$$$ rows and $$$m$$$ columns, and three types of cells: An empty cell, denoted with '.'. A stone, denoted with '*'. An obstacle, denoted with the lowercase Latin letter 'o'. All stones fall down until they meet the...
def res(s): a=s.split('o');t='' for i in a:t+=i.count('*')*'*'+i.count('.')*'.'+'o' return t[:-1] for _ in[0]*int(input()): n,m=map(int,input().split()) a=[[*input()] for x in[0]*n] b=[] for i in range(m):b+=res(''.join([a[~j][i] for j in range(n)])), for i in range(n): for j in range(m):{{complet...
print(b[j][~i],end='')
[{"input": "3\n6 10\n.*.*....*.\n.*.......*\n...o....o.\n.*.*....*.\n..........\n.o......o*\n2 9\n...***ooo\n.*o.*o.*o\n5 5\n*****\n*....\n*****\n....*\n*****", "output": ["..........\n...*....*.\n.*.o....o.\n.*........\n.*......**\n.o.*....o*\n\n....**ooo\n.*o**o.*o\n\n.....\n*...*\n*****\n*****\n*****"]}]
block_completion_000847
block
python
Complete the code in python to solve this programming problem: Description: There is a grid with $$$n$$$ rows and $$$m$$$ columns, and three types of cells: An empty cell, denoted with '.'. A stone, denoted with '*'. An obstacle, denoted with the lowercase Latin letter 'o'. All stones fall down until they meet the...
c=input() for _ in range(int(c)): b=input().split() a=[] for i in range(int(b[0])): a.append(list(input())) for i in range(int(b[1])): count=0 row=int(b[0])-1 for j in range(int(b[0])): if a[row][i]=='.': count+=1 elif a...
count=0
[{"input": "3\n6 10\n.*.*....*.\n.*.......*\n...o....o.\n.*.*....*.\n..........\n.o......o*\n2 9\n...***ooo\n.*o.*o.*o\n5 5\n*****\n*....\n*****\n....*\n*****", "output": ["..........\n...*....*.\n.*.o....o.\n.*........\n.*......**\n.o.*....o*\n\n....**ooo\n.*o**o.*o\n\n.....\n*...*\n*****\n*****\n*****"]}]
block_completion_000848
block
python
Complete the code in python to solve this programming problem: Description: There is a grid with $$$n$$$ rows and $$$m$$$ columns, and three types of cells: An empty cell, denoted with '.'. A stone, denoted with '*'. An obstacle, denoted with the lowercase Latin letter 'o'. All stones fall down until they meet the...
c=input() for _ in range(int(c)): b=input().split() a=[] for i in range(int(b[0])): a.append(list(input())) for i in range(int(b[1])): count=0 row=int(b[0])-1 for j in range(int(b[0])): if a[row][i]=='.': count+=1 elif a...
a[row][i],a[row+count][i]='.',a[row][i]
[{"input": "3\n6 10\n.*.*....*.\n.*.......*\n...o....o.\n.*.*....*.\n..........\n.o......o*\n2 9\n...***ooo\n.*o.*o.*o\n5 5\n*****\n*....\n*****\n....*\n*****", "output": ["..........\n...*....*.\n.*.o....o.\n.*........\n.*......**\n.o.*....o*\n\n....**ooo\n.*o**o.*o\n\n.....\n*...*\n*****\n*****\n*****"]}]
block_completion_000849
block
python
Complete the code in python to solve this programming problem: Description: There is a grid with $$$n$$$ rows and $$$m$$$ columns, and three types of cells: An empty cell, denoted with '.'. A stone, denoted with '*'. An obstacle, denoted with the lowercase Latin letter 'o'. All stones fall down until they meet the...
import sys input = sys.stdin.readline for _ in [0]*int(input()): n,m=map(int,input().split()) s=['']*m for _ in [0]*n: s=[s[i]+j for i,j in zip(range(m),input())] col=['']*n k=0 for i in s: bl=0 x='' for j in i[::-1]: if j=='o': ...
x=j+x
[{"input": "3\n6 10\n.*.*....*.\n.*.......*\n...o....o.\n.*.*....*.\n..........\n.o......o*\n2 9\n...***ooo\n.*o.*o.*o\n5 5\n*****\n*....\n*****\n....*\n*****", "output": ["..........\n...*....*.\n.*.o....o.\n.*........\n.*......**\n.o.*....o*\n\n....**ooo\n.*o**o.*o\n\n.....\n*...*\n*****\n*****\n*****"]}]
block_completion_000850
block
python
Complete the code in python to solve this programming problem: Description: There is a grid with $$$n$$$ rows and $$$m$$$ columns, and three types of cells: An empty cell, denoted with '.'. A stone, denoted with '*'. An obstacle, denoted with the lowercase Latin letter 'o'. All stones fall down until they meet the...
import sys input = sys.stdin.readline for _ in [0]*int(input()): n,m=map(int,input().split()) s=['']*m for _ in [0]*n: s=[s[i]+j for i,j in zip(range(m),input())] col=['']*n k=0 for i in s: bl=0 x='' for j in i[::-1]: if j=='o': ...
bl=bl+1
[{"input": "3\n6 10\n.*.*....*.\n.*.......*\n...o....o.\n.*.*....*.\n..........\n.o......o*\n2 9\n...***ooo\n.*o.*o.*o\n5 5\n*****\n*....\n*****\n....*\n*****", "output": ["..........\n...*....*.\n.*.o....o.\n.*........\n.*......**\n.o.*....o*\n\n....**ooo\n.*o**o.*o\n\n.....\n*...*\n*****\n*****\n*****"]}]
block_completion_000851
block
python
Complete the code in python to solve this programming problem: Description: There is a grid with $$$n$$$ rows and $$$m$$$ columns, and three types of cells: An empty cell, denoted with '.'. A stone, denoted with '*'. An obstacle, denoted with the lowercase Latin letter 'o'. All stones fall down until they meet the...
for i in range(int(input())): n,m=map(int,input().split()) s=[list(input()) for j in range(n)] for _ in range(n): for a in reversed(range(n-1)): for b in range(m): if s[a][b]=='*': if s[a+1][b]=='o' or s[a+1][b]=='*': continue ...
s[a][b]='.' s[a+1][b]='*'
[{"input": "3\n6 10\n.*.*....*.\n.*.......*\n...o....o.\n.*.*....*.\n..........\n.o......o*\n2 9\n...***ooo\n.*o.*o.*o\n5 5\n*****\n*....\n*****\n....*\n*****", "output": ["..........\n...*....*.\n.*.o....o.\n.*........\n.*......**\n.o.*....o*\n\n....**ooo\n.*o**o.*o\n\n.....\n*...*\n*****\n*****\n*****"]}]
block_completion_000852
block
python
Complete the code in python to solve this programming problem: Description: There is a grid with $$$n$$$ rows and $$$m$$$ columns, and three types of cells: An empty cell, denoted with '.'. A stone, denoted with '*'. An obstacle, denoted with the lowercase Latin letter 'o'. All stones fall down until they meet the...
I=lambda:map(int,input().split()) for _ in range(int(input())): n,m=I() a=[input() for _ in range(n)] at=[''.join(col).split('o') for col in zip(*a)] f=lambda s:''.join(sorted(s,reverse=True)) at=['o'.join(map(f, col)) for col in at] for row in zip(*at): {{completion}}
print(''.join(row))
[{"input": "3\n6 10\n.*.*....*.\n.*.......*\n...o....o.\n.*.*....*.\n..........\n.o......o*\n2 9\n...***ooo\n.*o.*o.*o\n5 5\n*****\n*....\n*****\n....*\n*****", "output": ["..........\n...*....*.\n.*.o....o.\n.*........\n.*......**\n.o.*....o*\n\n....**ooo\n.*o**o.*o\n\n.....\n*...*\n*****\n*****\n*****"]}]
block_completion_000853
block
python
Complete the code in python to solve this programming problem: Description: There is a grid with $$$n$$$ rows and $$$m$$$ columns, and three types of cells: An empty cell, denoted with '.'. A stone, denoted with '*'. An obstacle, denoted with the lowercase Latin letter 'o'. All stones fall down until they meet the...
I = input for _ in range(int(I())): n,m = map(int,I().split()) grid = [I().strip() for __ in range(n)] res = [] for col in range(m): newcol = '' for seg in (''.join(grid[row][col] for row in range(n))).split('o'): {{completion}} res.append(newcol[0:-1]) ...
newcol += '.'*seg.count('.')+'*'*seg.count('*')+'o'
[{"input": "3\n6 10\n.*.*....*.\n.*.......*\n...o....o.\n.*.*....*.\n..........\n.o......o*\n2 9\n...***ooo\n.*o.*o.*o\n5 5\n*****\n*....\n*****\n....*\n*****", "output": ["..........\n...*....*.\n.*.o....o.\n.*........\n.*......**\n.o.*....o*\n\n....**ooo\n.*o**o.*o\n\n.....\n*...*\n*****\n*****\n*****"]}]
block_completion_000854
block
python
Complete the code in python to solve this programming problem: Description: There is a grid with $$$n$$$ rows and $$$m$$$ columns, and three types of cells: An empty cell, denoted with '.'. A stone, denoted with '*'. An obstacle, denoted with the lowercase Latin letter 'o'. All stones fall down until they meet the...
for ii in range(int(input())): n,m = map(int, input().split()) mat=[] r=[0]*m for jj in range(n): a=list(input()) for kk in range(m): if a[kk]=="*": r[kk]+=1 a[kk]="." elif a[kk]=="o": while r[kk]: {{completion}} mat.append(a) for jj in range(m): while r[jj]: mat[n...
mat[jj-r[kk]][kk]="*" r[kk]-=1
[{"input": "3\n6 10\n.*.*....*.\n.*.......*\n...o....o.\n.*.*....*.\n..........\n.o......o*\n2 9\n...***ooo\n.*o.*o.*o\n5 5\n*****\n*....\n*****\n....*\n*****", "output": ["..........\n...*....*.\n.*.o....o.\n.*........\n.*......**\n.o.*....o*\n\n....**ooo\n.*o**o.*o\n\n.....\n*...*\n*****\n*****\n*****"]}]
block_completion_000855
block
python
Complete the code in python to solve this programming problem: Description: There is a grid with $$$n$$$ rows and $$$m$$$ columns, and three types of cells: An empty cell, denoted with '.'. A stone, denoted with '*'. An obstacle, denoted with the lowercase Latin letter 'o'. All stones fall down until they meet the...
t = int(input()) for i in range (t): n, m = map(int,input().split()) arr = [[0]*m]*n for j in range(n): arr[j] = list(input()) # for h in range(m): # print(arr[j][h]) for k in range(m): for l in range(n-1, -1, -1): if arr[l][k]=='.': ...
arr[f][k]='.' arr[l][k]='*' break
[{"input": "3\n6 10\n.*.*....*.\n.*.......*\n...o....o.\n.*.*....*.\n..........\n.o......o*\n2 9\n...***ooo\n.*o.*o.*o\n5 5\n*****\n*....\n*****\n....*\n*****", "output": ["..........\n...*....*.\n.*.o....o.\n.*........\n.*......**\n.o.*....o*\n\n....**ooo\n.*o**o.*o\n\n.....\n*...*\n*****\n*****\n*****"]}]
block_completion_000856
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
from collections import Counter for _ in range(int(input())): n = int(input()) num = Counter(input() for x in [1]*n) cnt = 0 for x in num: for y in num: if x!=y and (x[0] == y[0] or x[1] == y[1]): {{completion}} print(cnt//2)
cnt+=num[x]*num[y]
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000880
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
from collections import Counter from itertools import islice from sys import stdin LETTERS = 'abcdefghijk' data = (line.strip() for line in stdin.readlines()[1:]) res = [] for line in data: n = int(line) s = 0 ctr = Counter() for ab in islice(data, n): a, b = ab ctr[ab] += 1 f...
s += ctr[f'{l}{b}']
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000881
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
from collections import Counter from itertools import islice from sys import stdin LETTERS = 'abcdefghijk' data = (line.strip() for line in stdin.readlines()[1:]) res = [] for line in data: n = int(line) s = 0 ctr = Counter() for ab in islice(data, n): a, b = ab ctr[ab] += 1 f...
s += ctr[f'{a}{l}']
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000882
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
for i in range(int(input())): data = [[0 for l in range(11)] for k in range(11)] for j in range(int(input())): first, second = input() data[ord(first)-ord('a')][ord(second)-ord('a')] += 1 answer = 0 for j in range(11): for k in range(11): for l in range(11...
answer += data[j][k]*data[l][k]
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000883
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
for i in range(int(input())): data = [[0 for l in range(11)] for k in range(11)] for j in range(int(input())): first, second = input() data[ord(first)-ord('a')][ord(second)-ord('a')] += 1 answer = 0 for j in range(11): for k in range(11): for l in range(11...
answer += data[j][k]*data[j][l]
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000884
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
from collections import defaultdict ak = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"] t = int(input()) for _ in range(t): count = 0 d = defaultdict(int) n = int(input()) for i in range(n): s = input() for c in ak: if c != s[0]: if d[c +...
count += d[c + s[1]]
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000885
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
from collections import defaultdict ak = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"] t = int(input()) for _ in range(t): count = 0 d = defaultdict(int) n = int(input()) for i in range(n): s = input() for c in ak: if c != s[0]: if d[c +...
count += d[s[0] + c]
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000886
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
for ii in range(int(input())): n=int(input()) a=[] co=0 x=set() for jj in range(n): a.append(input()) for jj in range(n): mul=1 if jj not in x: for kk in range(jj+1,n): if a[jj][0]!=a[kk][0] and a[jj][1]==a[kk][1]: co+=mul elif a[jj][0]==a[kk][0] and a[jj][1]!=a[kk][1]: {{...
co+=mul
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000887
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
for ii in range(int(input())): n=int(input()) a=[] co=0 x=set() for jj in range(n): a.append(input()) for jj in range(n): mul=1 if jj not in x: for kk in range(jj+1,n): if a[jj][0]!=a[kk][0] and a[jj][1]==a[kk][1]: co+=mul elif a[jj][0]==a[kk][0] and a[jj][1]!=a[kk][1]: co...
mul+=1 x.add(kk)
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000888
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
t=int(input()) for i in range(t): n=int(input()) result=0 dic1={} dic2={} dic3={} for i in range(n): S=input() if S[0] in dic1: result+=dic1[S[0]] dic1[S[0]]+=1 else: {{completion}} if S[1] in dic2: result+=dic2[S[1]] dic2[S[1]]+=1 else: ...
dic1[S[0]]=1
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000889
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
t=int(input()) for i in range(t): n=int(input()) result=0 dic1={} dic2={} dic3={} for i in range(n): S=input() if S[0] in dic1: result+=dic1[S[0]] dic1[S[0]]+=1 else: dic1[S[0]]=1 if S[1] in dic2: result+=dic2[S[1]] dic2[S[1]]+=1 else: ...
dic2[S[1]]=1
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000890
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
for i in range(int(input())): n= int(input()) a = dict() b = dict() c = dict() ans = 0 for j in range(n): d,e = str(input()) try: ans += a[d] a[d] += 1 except KeyError: {{completion}} try: ans += b[e] ...
a[d] = 1
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000891
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
for i in range(int(input())): n= int(input()) a = dict() b = dict() c = dict() ans = 0 for j in range(n): d,e = str(input()) try: ans += a[d] a[d] += 1 except KeyError: a[d] = 1 try: ans += b[e] ...
b[e] = 1
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000892
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
from collections import Counter t=int(input()) while(t!=0): n=int(input()) s = Counter(input() for x in [1]*n) cnt = 0 for x in s: for y in s: if(x!=y and (x[1]==y[1] or x[0]==y[0])): {{completion}} print(cnt//2) t-=1
cnt += s[x]*s[y]
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000893
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
t = int(input()) for x in range(t): n = int(input()) d1 = {} for i in range(97,109): for j in range(97,109): d1[chr(i)+chr(j)] = 0 ans1 = 0 for y in range(n): s = input() for l in range(2): for m in range(97,109): a = list(s...
continue
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000894
block
python
Complete the code in python to solve this programming problem: Description: Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string diff...
for n in range(int(input())): a = {} for j in range(int(input())): c = input() if c not in a: a[c] = 1 elif c in a: a[c] += 1 count = 0 for i in a.keys(): for j in a.keys(): if i != j and (i[0] == j[0] or i[1] == j[1]): ...
count += a[i] * a[j]
[{"input": "4\n6\nab\ncb\ndb\naa\ncc\nef\n7\naa\nbb\ncc\nac\nca\nbb\naa\n4\nkk\nkk\nab\nab\n5\njf\njf\njk\njk\njk", "output": ["5\n6\n0\n6"]}]
block_completion_000895
block
python
Complete the code in python to solve this programming problem: Description: A row of $$$n$$$ cells is given, all initially white. Using a stamp, you can stamp any two neighboring cells such that one becomes red and the other becomes blue. A stamp can be rotated, i.e. it can be used in both ways: as $$$\color{blue}{\te...
for s in[*open(0)][2::2]:{{completion}}
print('YNEOS'[1in map(len,map(set,s[:-1].split('W')))::2])
[{"input": "12\n5\nBRBBW\n1\nB\n2\nWB\n2\nRW\n3\nBRB\n3\nRBB\n7\nWWWWWWW\n9\nRBWBWRRBW\n10\nBRBRBRBRRB\n12\nBBBRWWRRRWBR\n10\nBRBRBRBRBW\n5\nRBWBW", "output": ["YES\nNO\nNO\nNO\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nNO"]}]
block_completion_000923
block
python
Complete the code in python to solve this programming problem: Description: A row of $$$n$$$ cells is given, all initially white. Using a stamp, you can stamp any two neighboring cells such that one becomes red and the other becomes blue. A stamp can be rotated, i.e. it can be used in both ways: as $$$\color{blue}{\te...
for _ in range(int(input())) : {{completion}}
l = int(input()) print("NO" if any (len(set(x)) == 1 for x in input().split('W') ) else "YES")
[{"input": "12\n5\nBRBBW\n1\nB\n2\nWB\n2\nRW\n3\nBRB\n3\nRBB\n7\nWWWWWWW\n9\nRBWBWRRBW\n10\nBRBRBRBRRB\n12\nBBBRWWRRRWBR\n10\nBRBRBRBRBW\n5\nRBWBW", "output": ["YES\nNO\nNO\nNO\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nNO"]}]
block_completion_000924
block
python
Complete the code in python to solve this programming problem: Description: A row of $$$n$$$ cells is given, all initially white. Using a stamp, you can stamp any two neighboring cells such that one becomes red and the other becomes blue. A stamp can be rotated, i.e. it can be used in both ways: as $$$\color{blue}{\te...
def solve(): n = int(input()) s = input().split('W') for i in s: bs = 'B' in i rs = 'R' in i if bs ^ rs: {{completion}} print('YES') for t in range(int(input())): solve()
print('NO') return
[{"input": "12\n5\nBRBBW\n1\nB\n2\nWB\n2\nRW\n3\nBRB\n3\nRBB\n7\nWWWWWWW\n9\nRBWBWRRBW\n10\nBRBRBRBRRB\n12\nBBBRWWRRRWBR\n10\nBRBRBRBRBW\n5\nRBWBW", "output": ["YES\nNO\nNO\nNO\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nNO"]}]
block_completion_000925
block
python
Complete the code in python to solve this programming problem: Description: A row of $$$n$$$ cells is given, all initially white. Using a stamp, you can stamp any two neighboring cells such that one becomes red and the other becomes blue. A stamp can be rotated, i.e. it can be used in both ways: as $$$\color{blue}{\te...
g = input() for i in range(int(g)): input() numb = input().split('W') ans = 'yes' for z in numb: if z == '': pass else: if ('R' in z) and ('B' in z): pass else: {{completion}} print(ans)
ans = 'no'
[{"input": "12\n5\nBRBBW\n1\nB\n2\nWB\n2\nRW\n3\nBRB\n3\nRBB\n7\nWWWWWWW\n9\nRBWBWRRBW\n10\nBRBRBRBRRB\n12\nBBBRWWRRRWBR\n10\nBRBRBRBRBW\n5\nRBWBW", "output": ["YES\nNO\nNO\nNO\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nNO"]}]
block_completion_000926
block
python
Complete the code in python to solve this programming problem: Description: A row of $$$n$$$ cells is given, all initially white. Using a stamp, you can stamp any two neighboring cells such that one becomes red and the other becomes blue. A stamp can be rotated, i.e. it can be used in both ways: as $$$\color{blue}{\te...
for s in[*open(0)][2::2]: b=0 for i in s[:-1].split('W'):{{completion}} print('YNEOS'[b::2])
b|=len({*i})%2
[{"input": "12\n5\nBRBBW\n1\nB\n2\nWB\n2\nRW\n3\nBRB\n3\nRBB\n7\nWWWWWWW\n9\nRBWBWRRBW\n10\nBRBRBRBRRB\n12\nBBBRWWRRRWBR\n10\nBRBRBRBRBW\n5\nRBWBW", "output": ["YES\nNO\nNO\nNO\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nNO"]}]
block_completion_000927
block
python
Complete the code in python to solve this programming problem: Description: A row of $$$n$$$ cells is given, all initially white. Using a stamp, you can stamp any two neighboring cells such that one becomes red and the other becomes blue. A stamp can be rotated, i.e. it can be used in both ways: as $$$\color{blue}{\te...
t=int(input()) for i in range(t): n=int(input()) s=input() s=s.strip("W") temp=list(s.split('W')) for i in temp: if i: if 'B' not in i or 'R' not in i: {{completion}} else: print("YES")
print("NO") break
[{"input": "12\n5\nBRBBW\n1\nB\n2\nWB\n2\nRW\n3\nBRB\n3\nRBB\n7\nWWWWWWW\n9\nRBWBWRRBW\n10\nBRBRBRBRRB\n12\nBBBRWWRRRWBR\n10\nBRBRBRBRBW\n5\nRBWBW", "output": ["YES\nNO\nNO\nNO\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nNO"]}]
block_completion_000928
block
python
Complete the code in python to solve this programming problem: Description: A row of $$$n$$$ cells is given, all initially white. Using a stamp, you can stamp any two neighboring cells such that one becomes red and the other becomes blue. A stamp can be rotated, i.e. it can be used in both ways: as $$$\color{blue}{\te...
for i in range(int(input())): {{completion}}
num = int(input()) line = [elem for elem in input().split("W") if elem != ""] print("YES" if all(["B" in elem and "R" in elem for elem in line]) else "NO")
[{"input": "12\n5\nBRBBW\n1\nB\n2\nWB\n2\nRW\n3\nBRB\n3\nRBB\n7\nWWWWWWW\n9\nRBWBWRRBW\n10\nBRBRBRBRRB\n12\nBBBRWWRRRWBR\n10\nBRBRBRBRBW\n5\nRBWBW", "output": ["YES\nNO\nNO\nNO\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nNO"]}]
block_completion_000929
block
python
Complete the code in python to solve this programming problem: Description: A row of $$$n$$$ cells is given, all initially white. Using a stamp, you can stamp any two neighboring cells such that one becomes red and the other becomes blue. A stamp can be rotated, i.e. it can be used in both ways: as $$$\color{blue}{\te...
for s in[*open(0)][2::2]: b = 0 for i in s[:-1].split("W"): {{completion}} print('YNEOS '[b::2])
b|=(len(set(i))==1)
[{"input": "12\n5\nBRBBW\n1\nB\n2\nWB\n2\nRW\n3\nBRB\n3\nRBB\n7\nWWWWWWW\n9\nRBWBWRRBW\n10\nBRBRBRBRRB\n12\nBBBRWWRRRWBR\n10\nBRBRBRBRBW\n5\nRBWBW", "output": ["YES\nNO\nNO\nNO\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nNO"]}]
block_completion_000930
block
python
Complete the code in python to solve this programming problem: Description: A row of $$$n$$$ cells is given, all initially white. Using a stamp, you can stamp any two neighboring cells such that one becomes red and the other becomes blue. A stamp can be rotated, i.e. it can be used in both ways: as $$$\color{blue}{\te...
t = int(input()) Ans = [-1]*t for z in range(t): n = int(input()) l = input().split('W') bad = False for s in l: b1 = 'R' in s b2 = 'B' in s if (b1 ^ b2): {{completion}} print("NO" if bad else "YES")
bad = True
[{"input": "12\n5\nBRBBW\n1\nB\n2\nWB\n2\nRW\n3\nBRB\n3\nRBB\n7\nWWWWWWW\n9\nRBWBWRRBW\n10\nBRBRBRBRRB\n12\nBBBRWWRRRWBR\n10\nBRBRBRBRBW\n5\nRBWBW", "output": ["YES\nNO\nNO\nNO\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nNO"]}]
block_completion_000931
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
n=int(input()) l=[int(i) for i in input().split()] def f(l): cur = 0 n = 0 for i in l: {{completion}} return n print(min(f(l[i+1:])+f(l[:i][::-1]) for i in range(n)))
n += cur // i + 1 cur = i * (cur // i + 1)
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000974
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
n = int(input().strip()) a = list(map(int, input().strip().split())) ans = None for i in range(n): acc, p = 0, 0 for j in range(i-1, -1, -1): {{completion}} p = 0 for j in range(i+1, n): x = (p + a[j]) // a[j] acc += x p = x * a[j] ans = min(ans, acc) if...
x = (p - 1) // a[j] acc += -x p = x * a[j]
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000975
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
n = int(input().strip()) a = list(map(int, input().strip().split())) ans = None for i in range(n): acc, p = 0, 0 for j in range(i-1, -1, -1): x = (p - 1) // a[j] acc += -x p = x * a[j] p = 0 for j in range(i+1, n): {{completion}} ans = min(ans, acc) if a...
x = (p + a[j]) // a[j] acc += x p = x * a[j]
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000976
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
from math import ceil n=int(input()) a=list(map(int,input().split())) ans=float("inf") for i in range(len(a)): t=[0]*n temp=0 j=i-1 prev =0 while j>=0: {{completion}} k=i+1 prev=0 while k<len(a): x=(ceil((prev+1)/a[k])) temp+=x prev=(...
x=(ceil((prev+1)/a[j])) temp+=x prev=(a[j]*x) j-=1
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000977
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
from math import ceil n=int(input()) a=list(map(int,input().split())) ans=float("inf") for i in range(len(a)): t=[0]*n temp=0 j=i-1 prev =0 while j>=0: x=(ceil((prev+1)/a[j])) temp+=x prev=(a[j]*x) j-=1 k=i+1 prev=0 while k<len(a): ...
x=(ceil((prev+1)/a[k])) temp+=x prev=(a[k]*x) k+=1
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000978
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
for _ in range(1): n = int(input()) a = list(map(int, input().split())) Min = 1e18 for l in range(n): m = a[l] answer = 1 for i in range(l-1, -1, -1): answer += (m + a[i]) // a[i] m = a[i] * ((m + a[i]) // a[i]) if l + 1 < n: ...
answer += (m + a[i]) // a[i] m = a[i] * ((m + a[i]) // a[i])
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000979
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
m=int(input()) a=[int(i)for i in input().split()] t1,min=0,10**20 while(t1<m): t2=t1 k,t=0,0 while(t2<m-1): {{completion}} t2=t1 k=0 while(t2>0): t+=(k//a[t2-1]+1) k=a[t2-1]*(k//a[t2-1]+1) t2-=1 if(min>t): min=t t1+=1 print(min)
t+=(k//a[t2+1]+1) k=a[t2+1]*(k//a[t2+1]+1) t2+=1
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000980
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
m=int(input()) a=[int(i)for i in input().split()] t1,min=0,10**20 while(t1<m): t2=t1 k,t=0,0 while(t2<m-1): t+=(k//a[t2+1]+1) k=a[t2+1]*(k//a[t2+1]+1) t2+=1 t2=t1 k=0 while(t2>0): {{completion}} if(min>t): min=t t1+=1 print(min)
t+=(k//a[t2-1]+1) k=a[t2-1]*(k//a[t2-1]+1) t2-=1
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000981
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
import math n = int(input()) a = list(map(int, input().split(' '))) # numbers w/ ws c = None d = 0 for i in range(len(a)): p = 0 t = 0 for k in a[i+1:]: {{completion}} t = 0 for k in reversed(a[:i]): d = math.ceil((t+1)/k) t = k*d p += d if c == None or p < c: c = p print(c)
d = math.ceil((t+1)/k) t = k*d p += d
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000982
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
import math n = int(input()) a = list(map(int, input().split(' '))) # numbers w/ ws c = None d = 0 for i in range(len(a)): p = 0 t = 0 for k in a[i+1:]: d = math.ceil((t+1)/k) t = k*d p += d t = 0 for k in reversed(a[:i]): {{completion}} if c == None or p < c: c = p print(c)
d = math.ceil((t+1)/k) t = k*d p += d
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000983
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
def f(b, i): return e(b[::-1], i) def e(b, i): if b == []: {{completion}} count = 0 ggg = [0] * len(b) for i in range(len(b)): ggg[i] = (b[i - 1] * ggg[i - 1]) // b[i] + 1 count += ggg[i] return count def c(b, i): return e(b[i + 1:], 0) + f(b[:i], 0) ...
return 0
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000984
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
def f(b, i): return e(b[::-1], i) def e(b, i): if b == []: return 0 count = 0 ggg = [0] * len(b) for i in range(len(b)): {{completion}} return count def c(b, i): return e(b[i + 1:], 0) + f(b[:i], 0) a = int(input()) b = input().split() for i in range(a): ...
ggg[i] = (b[i - 1] * ggg[i - 1]) // b[i] + 1 count += ggg[i]
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000985
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
n=int(input()) a=list(map(int,input().split())) b=[int(0) for _ in range(n)] m=1e18 for i in range(n): c=0 p=0 for j in range(i+1,len(b)): {{completion}} p=0 for j in range(i-1,-1,-1): p+=a[j]-p%a[j] c+=p//a[j] m=min(m,c) print(m)
p+=a[j]-p%a[j] c+=p//a[j]
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000986
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, and an array $$$b$$$, with length $$$n$$$. Initially $$$b_i=0$$$ for each $$$1 \leq i \leq n$$$.In one move you can choose an integer $$$i$$$ ($$$1 \leq i \leq n$$$), and ...
n=int(input()) a=list(map(int,input().split())) b=[int(0) for _ in range(n)] m=1e18 for i in range(n): c=0 p=0 for j in range(i+1,len(b)): p+=a[j]-p%a[j] c+=p//a[j] p=0 for j in range(i-1,-1,-1): {{completion}} m=min(m,c) print(m)
p+=a[j]-p%a[j] c+=p//a[j]
[{"input": "5\n1 2 3 4 5", "output": ["4"]}, {"input": "7\n1 2 1 2 1 2 1", "output": ["10"]}, {"input": "8\n1 8 2 7 3 6 4 5", "output": ["16"]}]
block_completion_000987
block
python
Complete the code in python to solve this programming problem: Description: $$$m$$$ chairs are arranged in a circle sequentially. The chairs are numbered from $$$0$$$ to $$$m-1$$$. $$$n$$$ people want to sit in these chairs. The $$$i$$$-th of them wants at least $$$a[i]$$$ empty chairs both on his right and left side....
t=lambda:map(int,input().split()) for _ in range(int(input())):{{completion}}
n,m=t();a=[*t()];print("YNEOS"[sum(a)+max(a)-min(a)+n>m::2])
[{"input": "6\n3 2\n1 1 1\n2 4\n1 1\n2 5\n2 1\n3 8\n1 2 1\n4 12\n1 2 1 3\n4 19\n1 2 1 3", "output": ["NO\nYES\nNO\nYES\nNO\nYES"]}]
block_completion_001016
block
python
Complete the code in python to solve this programming problem: Description: $$$m$$$ chairs are arranged in a circle sequentially. The chairs are numbered from $$$0$$$ to $$$m-1$$$. $$$n$$$ people want to sit in these chairs. The $$$i$$$-th of them wants at least $$$a[i]$$$ empty chairs both on his right and left side....
for _t in range(int(input())): n,m = map(int, input().split(' ')) # numbers w/ ws a = sorted(map(int, input().split(' '))) tot = 0 dis = 0 p_i = a[-1] for i in a: tot += 2*i+1 if p_i < i: dis += p_i else: {{completion}} p_i = i if tot-dis <= m: print("YES") else: print("NO"...
dis += i
[{"input": "6\n3 2\n1 1 1\n2 4\n1 1\n2 5\n2 1\n3 8\n1 2 1\n4 12\n1 2 1 3\n4 19\n1 2 1 3", "output": ["NO\nYES\nNO\nYES\nNO\nYES"]}]
block_completion_001017
block
python
Complete the code in python to solve this programming problem: Description: $$$m$$$ chairs are arranged in a circle sequentially. The chairs are numbered from $$$0$$$ to $$$m-1$$$. $$$n$$$ people want to sit in these chairs. The $$$i$$$-th of them wants at least $$$a[i]$$$ empty chairs both on his right and left side....
import sys def solve(): {{completion}} for _ in range(int(input())): solve()
n, m = map(int, input().split()) num = list(map(int , input().split())) num.sort() s = sum(num[1:]) + num[-1] + n print("YES" if s <= m else "NO")
[{"input": "6\n3 2\n1 1 1\n2 4\n1 1\n2 5\n2 1\n3 8\n1 2 1\n4 12\n1 2 1 3\n4 19\n1 2 1 3", "output": ["NO\nYES\nNO\nYES\nNO\nYES"]}]
block_completion_001018
block
python
Complete the code in python to solve this programming problem: Description: $$$m$$$ chairs are arranged in a circle sequentially. The chairs are numbered from $$$0$$$ to $$$m-1$$$. $$$n$$$ people want to sit in these chairs. The $$$i$$$-th of them wants at least $$$a[i]$$$ empty chairs both on his right and left side....
import sys def solve(): n, m = map(int, input().split()) num = list(map(int , input().split())) num.sort() s = sum(num[1:]) + num[-1] + n print("YES" if s <= m else "NO") for _ in range(int(input())): {{completion}}
solve()
[{"input": "6\n3 2\n1 1 1\n2 4\n1 1\n2 5\n2 1\n3 8\n1 2 1\n4 12\n1 2 1 3\n4 19\n1 2 1 3", "output": ["NO\nYES\nNO\nYES\nNO\nYES"]}]
block_completion_001019
block
python
Complete the code in python to solve this programming problem: Description: $$$m$$$ chairs are arranged in a circle sequentially. The chairs are numbered from $$$0$$$ to $$$m-1$$$. $$$n$$$ people want to sit in these chairs. The $$$i$$$-th of them wants at least $$$a[i]$$$ empty chairs both on his right and left side....
import sys for t in range(int(sys.stdin.readline())): n,m = map(int, sys.stdin.readline().strip().split()) a = list(map(int, sys.stdin.readline().strip().split())) if sum(a)-min(a)+max(a) + n <= m:print('yes') else:{{completion}}
print('no')
[{"input": "6\n3 2\n1 1 1\n2 4\n1 1\n2 5\n2 1\n3 8\n1 2 1\n4 12\n1 2 1 3\n4 19\n1 2 1 3", "output": ["NO\nYES\nNO\nYES\nNO\nYES"]}]
block_completion_001020
block
python
Complete the code in python to solve this programming problem: Description: $$$m$$$ chairs are arranged in a circle sequentially. The chairs are numbered from $$$0$$$ to $$$m-1$$$. $$$n$$$ people want to sit in these chairs. The $$$i$$$-th of them wants at least $$$a[i]$$$ empty chairs both on his right and left side....
x = lambda: map(int,input().split()) t,= x() for _ in [1]*t: {{completion}}
p,n = x() a = [*x()] s = sum(a) + (p-1) - min(a) print("YNEOS"[n-1-s<max(a)::2])
[{"input": "6\n3 2\n1 1 1\n2 4\n1 1\n2 5\n2 1\n3 8\n1 2 1\n4 12\n1 2 1 3\n4 19\n1 2 1 3", "output": ["NO\nYES\nNO\nYES\nNO\nYES"]}]
block_completion_001021
block
python
Complete the code in python to solve this programming problem: Description: $$$m$$$ chairs are arranged in a circle sequentially. The chairs are numbered from $$$0$$$ to $$$m-1$$$. $$$n$$$ people want to sit in these chairs. The $$$i$$$-th of them wants at least $$$a[i]$$$ empty chairs both on his right and left side....
def Dist(): {{completion}} num_iter = int(input()) for _ in range(num_iter): Dist()
num_nm = input().split() m = int(num_nm[1]) n = int(num_nm[0]) a = input().split() a = list(map(int, a)) wish = n + sum(a) - min(a) + max(a) print("NO" if wish >m else "YES")
[{"input": "6\n3 2\n1 1 1\n2 4\n1 1\n2 5\n2 1\n3 8\n1 2 1\n4 12\n1 2 1 3\n4 19\n1 2 1 3", "output": ["NO\nYES\nNO\nYES\nNO\nYES"]}]
block_completion_001022
block
python
Complete the code in python to solve this programming problem: Description: $$$m$$$ chairs are arranged in a circle sequentially. The chairs are numbered from $$$0$$$ to $$$m-1$$$. $$$n$$$ people want to sit in these chairs. The $$$i$$$-th of them wants at least $$$a[i]$$$ empty chairs both on his right and left side....
def Dist(): num_nm = input().split() m = int(num_nm[1]) n = int(num_nm[0]) a = input().split() a = list(map(int, a)) wish = n + sum(a) - min(a) + max(a) print("NO" if wish >m else "YES") num_iter = int(input()) for _ in range(num_iter): {{completion}} ...
Dist()
[{"input": "6\n3 2\n1 1 1\n2 4\n1 1\n2 5\n2 1\n3 8\n1 2 1\n4 12\n1 2 1 3\n4 19\n1 2 1 3", "output": ["NO\nYES\nNO\nYES\nNO\nYES"]}]
block_completion_001023
block
python
Complete the code in python to solve this programming problem: Description: $$$m$$$ chairs are arranged in a circle sequentially. The chairs are numbered from $$$0$$$ to $$$m-1$$$. $$$n$$$ people want to sit in these chairs. The $$$i$$$-th of them wants at least $$$a[i]$$$ empty chairs both on his right and left side....
for T in range (int(input())) : n,m = map(int, input().strip().split()) a = sorted(list(map(int,input().strip().split())),reverse=True) m -= 2*a[0] + 1 cont = 0 for i in range(1,n) : if m <= 0 : {{completion}} m -= a[i] + 1 cont +=1 if cont == n-1 : print('YES'...
break
[{"input": "6\n3 2\n1 1 1\n2 4\n1 1\n2 5\n2 1\n3 8\n1 2 1\n4 12\n1 2 1 3\n4 19\n1 2 1 3", "output": ["NO\nYES\nNO\nYES\nNO\nYES"]}]
block_completion_001024
block
python
Complete the code in python to solve this programming problem: Description: $$$m$$$ chairs are arranged in a circle sequentially. The chairs are numbered from $$$0$$$ to $$$m-1$$$. $$$n$$$ people want to sit in these chairs. The $$$i$$$-th of them wants at least $$$a[i]$$$ empty chairs both on his right and left side....
I=lambda:[*map(int,input().split())] t,=I() while t:{{completion}}
t-=1;n,m=I();a=sorted(I());print('YNEOS'[sum(max(a[i-1],a[i])for i in range(n))+n>m::2])
[{"input": "6\n3 2\n1 1 1\n2 4\n1 1\n2 5\n2 1\n3 8\n1 2 1\n4 12\n1 2 1 3\n4 19\n1 2 1 3", "output": ["NO\nYES\nNO\nYES\nNO\nYES"]}]
block_completion_001025
block
python
Complete the code in python to solve this programming problem: Description: $$$m$$$ chairs are arranged in a circle sequentially. The chairs are numbered from $$$0$$$ to $$$m-1$$$. $$$n$$$ people want to sit in these chairs. The $$$i$$$-th of them wants at least $$$a[i]$$$ empty chairs both on his right and left side....
for i in range(int(input())): n,m=map(int,input().split()) a=list(map(int,input().split())) if n+sum(a)+max(a)-min(a)>m: print("no") else: {{completion}}
print("yes")
[{"input": "6\n3 2\n1 1 1\n2 4\n1 1\n2 5\n2 1\n3 8\n1 2 1\n4 12\n1 2 1 3\n4 19\n1 2 1 3", "output": ["NO\nYES\nNO\nYES\nNO\nYES"]}]
block_completion_001026
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ integers. You should divide $$$a$$$ into continuous non-empty subarrays (there are $$$2^{n-1}$$$ ways to do that).Let $$$s=a_l+a_{l+1}+\ldots+a_r$$$. The value of a subarray $$$a_l, a_{l+1},...
from collections import Counter, defaultdict, deque import bisect from sys import stdin, stdout from itertools import repeat import math MOD = 998244353 input = stdin.readline finp = [int(x) for x in stdin.buffer.read().split()] def inp(force_list=False): re = list(map(int, input().split())) if ...
dmx[pref[i]] = dp[i]
[{"input": "5\n\n3\n\n1 2 -3\n\n4\n\n0 -2 3 -4\n\n5\n\n-1 -2 3 -1 -1\n\n6\n\n-1 2 -3 4 -5 6\n\n7\n\n1 -1 -1 1 -1 -1 1", "output": ["1\n2\n1\n6\n-1"]}]
block_completion_001049
block
python
Complete the code in python to solve this programming problem: Description: You are given an array $$$a$$$ consisting of $$$n$$$ integers. You should divide $$$a$$$ into continuous non-empty subarrays (there are $$$2^{n-1}$$$ ways to do that).Let $$$s=a_l+a_{l+1}+\ldots+a_r$$$. The value of a subarray $$$a_l, a_{l+1},...
from collections import Counter, defaultdict, deque import bisect from sys import stdin, stdout from itertools import repeat import math MOD = 998244353 input = stdin.readline finp = [int(x) for x in stdin.buffer.read().split()] def inp(force_list=False): re = list(map(int, input().split())) if ...
self.modify(pos, x, p*2 + 1, mid, r)
[{"input": "5\n\n3\n\n1 2 -3\n\n4\n\n0 -2 3 -4\n\n5\n\n-1 -2 3 -1 -1\n\n6\n\n-1 2 -3 4 -5 6\n\n7\n\n1 -1 -1 1 -1 -1 1", "output": ["1\n2\n1\n6\n-1"]}]
block_completion_001050
block
python
Complete the code in python to solve this programming problem: Description: You are given a board with $$$n$$$ rows and $$$n$$$ columns, numbered from $$$1$$$ to $$$n$$$. The intersection of the $$$a$$$-th row and $$$b$$$-th column is denoted by $$$(a, b)$$$.A half-queen attacks cells in the same row, same column, and...
import sys input = sys.stdin.readline n = int(input()) ans = [] if n <= 2: k = 1 ans.append(" ".join(map(str, (1, 1)))) elif n == 3: k = 2 ans.append(" ".join(map(str, (1, 1)))) ans.append(" ".join(map(str, (1, 2)))) else: for i in range(100000, -1, -1): if 3 * i + 2 <= n:...
x = i break
[{"input": "1", "output": ["1\n1 1"]}, {"input": "2", "output": ["1\n1 1"]}, {"input": "3", "output": ["2\n1 1\n1 2"]}]
block_completion_001073
block
python
Complete the code in python to solve this programming problem: Description: Today, like every year at SWERC, the $$$n^2$$$ contestants have gathered outside the venue to take a drone photo. Jennifer, the social media manager for the event, has arranged them into an $$$n\times n$$$ square. Being very good at her job, s...
import sys input = sys.stdin.readline n = int(input()) o1 = [0] * (n * n) o2 = [0] * (n * n) for i in range(n): curr = (list(map(int, input().split()))) for j in range(n): {{completion}} row_count = [0] * n col_count = [0] * n ct = 0 for u in range(n * n): i = o1[u...
o1[curr[j] - 1] = i o2[curr[j] - 1] = j
[{"input": "2\n1 3\n4 2", "output": ["0"]}, {"input": "2\n3 2\n4 1", "output": ["1"]}, {"input": "3\n9 2 4\n1 5 3\n7 8 6", "output": ["6"]}]
block_completion_001094
block
python
Complete the code in python to solve this programming problem: Description: Today, like every year at SWERC, the $$$n^2$$$ contestants have gathered outside the venue to take a drone photo. Jennifer, the social media manager for the event, has arranged them into an $$$n\times n$$$ square. Being very good at her job, s...
import sys import random input = sys.stdin.buffer.readline read = sys.stdin.buffer.read N = int(input()) As = [list(map(int, input().split())) for _ in range(N)] # N = 1500 # As = list(range(1, N ** 2 + 1)) # random.shuffle(As) # As = [As[i * N:(i + 1) * N] for i in range(N)] ijs = [0] * (N ** 2) for i in range(N):...
ijs[As[i][j] - 1] = (i, j)
[{"input": "2\n1 3\n4 2", "output": ["0"]}, {"input": "2\n3 2\n4 1", "output": ["1"]}, {"input": "3\n9 2 4\n1 5 3\n7 8 6", "output": ["6"]}]
block_completion_001095
block
python
Complete the code in python to solve this programming problem: Description: The derby between Milan and Inter is happening soon, and you have been chosen as the assistant referee for the match, also known as linesman. Your task is to move along the touch-line, namely the side of the field, always looking very carefull...
import sys import bisect input = sys.stdin.buffer.readline read = sys.stdin.buffer.read N, V = map(int, input().split()) Ts = list(map(int, input().split())) As = list(map(int, input().split())) points = [] for T, A in zip(Ts, As): B = T * V x = B - A y = B + A if x < 0 or y < 0: continue ...
lis.append(w)
[{"input": "3 2\n5 10 15\n7 17 29", "output": ["2"]}, {"input": "5 1\n5 7 8 11 13\n3 3 -2 -2 4", "output": ["3"]}, {"input": "1 2\n3\n7", "output": ["0"]}]
block_completion_001104
block
python
Complete the code in python to solve this programming problem: Description: The derby between Milan and Inter is happening soon, and you have been chosen as the assistant referee for the match, also known as linesman. Your task is to move along the touch-line, namely the side of the field, always looking very carefull...
from bisect import bisect_right,bisect_left n,v = map(int,input().split()) t = [*map(int,input().split())] a = [*map(int,input().split())] res = [] for i in range(n): xi,yi = t[i]*v+a[i],t[i]*v-a[i] if(xi>=0 and yi>=0): {{completion}} res.sort() dp = [float("inf")]*(n+3) dp[0] = 0 dp[n+2] = ...
res.append((xi,yi))
[{"input": "3 2\n5 10 15\n7 17 29", "output": ["2"]}, {"input": "5 1\n5 7 8 11 13\n3 3 -2 -2 4", "output": ["3"]}, {"input": "1 2\n3\n7", "output": ["0"]}]
block_completion_001105
block
python
Complete the code in python to solve this programming problem: Description: The derby between Milan and Inter is happening soon, and you have been chosen as the assistant referee for the match, also known as linesman. Your task is to move along the touch-line, namely the side of the field, always looking very carefull...
from bisect import bisect_right,bisect_left n,v = map(int,input().split()) t = [*map(int,input().split())] a = [*map(int,input().split())] res = [] for i in range(n): xi,yi = t[i]*v+a[i],t[i]*v-a[i] if(xi>=0 and yi>=0): res.append((xi,yi)) res.sort() dp = [float("inf")]*(n+3) dp[0] = 0 dp[n+...
print(i) break
[{"input": "3 2\n5 10 15\n7 17 29", "output": ["2"]}, {"input": "5 1\n5 7 8 11 13\n3 3 -2 -2 4", "output": ["3"]}, {"input": "1 2\n3\n7", "output": ["0"]}]
block_completion_001106
block
python
Complete the code in python to solve this programming problem: Description: You are given a circular maze such as the ones shown in the figures. Determine if it can be solved, i.e., if there is a path which goes from the center to the outside of the maze which does not touch any wall. The maze is described by $$$n$...
t = int(input()) for _ in range(t): field = [[0 for _ in range(2*360)] for _ in range(42)] vis = [[False for _ in range(2*360)] for _ in range(42)] n = int(input()) for _ in range(n): line = input().split() a, b, c = map(int, line[1:]) if line[0] == "C": y = 2...
st.append((ny, nx))
[{"input": "2\n5\nC 1 180 90\nC 5 250 230\nC 10 150 140\nC 20 185 180\nS 1 20 180\n6\nC 1 180 90\nC 5 250 230\nC 10 150 140\nC 20 185 180\nS 1 20 180\nS 5 10 0", "output": ["YES\nNO"]}]
block_completion_001116
block
python
Complete the code in python to solve this programming problem: Description: You are given a circular maze such as the ones shown in the figures. Determine if it can be solved, i.e., if there is a path which goes from the center to the outside of the maze which does not touch any wall. The maze is described by $$$n$...
from collections import deque def bfs(graph, start): visited = set() queue = deque([start]) while queue: vertex = queue.popleft() if vertex not in visited: visited.add(vertex) queue.extend(graph[vertex] - visited) return visited for tc in range(int(i...
graph[(rad, th)].remove((rad, (th-1)%360)) graph[(rad, (th-1)%360)].remove((rad, th))
[{"input": "2\n5\nC 1 180 90\nC 5 250 230\nC 10 150 140\nC 20 185 180\nS 1 20 180\n6\nC 1 180 90\nC 5 250 230\nC 10 150 140\nC 20 185 180\nS 1 20 180\nS 5 10 0", "output": ["YES\nNO"]}]
block_completion_001117
block
python
Complete the code in python to solve this programming problem: Description: You are given a circular maze such as the ones shown in the figures. Determine if it can be solved, i.e., if there is a path which goes from the center to the outside of the maze which does not touch any wall. The maze is described by $$$n$...
from itertools import islice, chain from sys import stdin MAX_RADIUS = 20 lines = iter(stdin.readlines()[1:]) for line in lines: n = int(line) circular_wall, straight_wall = ([[False] * 360 for _ in range(MAX_RADIUS)] for _ in range(2)) for shape, *params in map(str.split, islice(lines, n)): para...
straight_wall[r][theta] = True
[{"input": "2\n5\nC 1 180 90\nC 5 250 230\nC 10 150 140\nC 20 185 180\nS 1 20 180\n6\nC 1 180 90\nC 5 250 230\nC 10 150 140\nC 20 185 180\nS 1 20 180\nS 5 10 0", "output": ["YES\nNO"]}]
block_completion_001118
block
python
Complete the code in python to solve this programming problem: Description: On a beach there are $$$n$$$ huts in a perfect line, hut $$$1$$$ being at the left and hut $$$i+1$$$ being $$$100$$$ meters to the right of hut $$$i$$$, for all $$$1 \le i \le n - 1$$$. In hut $$$i$$$ there are $$$p_i$$$ people.There are $$$m$...
from itertools import chain from sys import stdin (n, m), population, shops = [[int(x) for x in line.split()] for line in stdin.readlines()] shops.sort() shops = chain([float('-inf')], (v / 100 for v in shops), [float('inf')]) shop_left, shop_right = next(shops), next(shops) hut_left_idx = max_score = score = 0 for h...
shop_left, shop_right = shop_right, next(shops)
[{"input": "3 1\n2 5 6\n169", "output": ["7"]}, {"input": "4 2\n1 2 7 8\n35 157", "output": ["15"]}, {"input": "4 1\n272203905 348354708 848256926 939404176\n20", "output": ["2136015810"]}, {"input": "3 2\n1 1 1\n300 99", "output": ["2"]}]
block_completion_001149
block
python
Complete the code in python to solve this programming problem: Description: On a beach there are $$$n$$$ huts in a perfect line, hut $$$1$$$ being at the left and hut $$$i+1$$$ being $$$100$$$ meters to the right of hut $$$i$$$, for all $$$1 \le i \le n - 1$$$. In hut $$$i$$$ there are $$$p_i$$$ people.There are $$$m$...
from itertools import chain from sys import stdin (n, m), population, shops = [[int(x) for x in line.split()] for line in stdin.readlines()] shops.sort() shops = chain([float('-inf')], (v / 100 for v in shops), [float('inf')]) shop_left, shop_right = next(shops), next(shops) hut_left_idx = max_score = score = 0 for h...
score -= population[hut_left_idx] hut_left_idx += 1
[{"input": "3 1\n2 5 6\n169", "output": ["7"]}, {"input": "4 2\n1 2 7 8\n35 157", "output": ["15"]}, {"input": "4 1\n272203905 348354708 848256926 939404176\n20", "output": ["2136015810"]}, {"input": "3 2\n1 1 1\n300 99", "output": ["2"]}]
block_completion_001150
block
python
Complete the code in python to solve this programming problem: Description: On a beach there are $$$n$$$ huts in a perfect line, hut $$$1$$$ being at the left and hut $$$i+1$$$ being $$$100$$$ meters to the right of hut $$$i$$$, for all $$$1 \le i \le n - 1$$$. In hut $$$i$$$ there are $$$p_i$$$ people.There are $$$m$...
n,m=map(int,input().split()) p=list(map(int,input().split())) x=sorted(list(map(int,input().split()))) s=sum(p[:-(-(x[0])//100)]) for i in range(len(x)-1): if x[i]//100+1>=n: {{completion}} num=int(((x[i+1]-x[i])/2)//(100)+1) l=x[i]//100+1 r=-(-(x[i+1])//100) r=min(r,n) prefs=0...
break
[{"input": "3 1\n2 5 6\n169", "output": ["7"]}, {"input": "4 2\n1 2 7 8\n35 157", "output": ["15"]}, {"input": "4 1\n272203905 348354708 848256926 939404176\n20", "output": ["2136015810"]}, {"input": "3 2\n1 1 1\n300 99", "output": ["2"]}]
block_completion_001151
block
python
Complete the code in python to solve this programming problem: Description: On a beach there are $$$n$$$ huts in a perfect line, hut $$$1$$$ being at the left and hut $$$i+1$$$ being $$$100$$$ meters to the right of hut $$$i$$$, for all $$$1 \le i \le n - 1$$$. In hut $$$i$$$ there are $$$p_i$$$ people.There are $$$m$...
n,m=map(int,input().split()) p=list(map(int,input().split())) x=sorted(list(map(int,input().split()))) s=sum(p[:-(-(x[0])//100)]) for i in range(len(x)-1): if x[i]//100+1>=n: break num=int(((x[i+1]-x[i])/2)//(100)+1) l=x[i]//100+1 r=-(-(x[i+1])//100) r=min(r,n) prefs=0 if ...
prefs=sum(p[l:l+num]) s=max(s,prefs)
[{"input": "3 1\n2 5 6\n169", "output": ["7"]}, {"input": "4 2\n1 2 7 8\n35 157", "output": ["15"]}, {"input": "4 1\n272203905 348354708 848256926 939404176\n20", "output": ["2136015810"]}, {"input": "3 2\n1 1 1\n300 99", "output": ["2"]}]
block_completion_001152
block
python
Complete the code in python to solve this programming problem: Description: On a beach there are $$$n$$$ huts in a perfect line, hut $$$1$$$ being at the left and hut $$$i+1$$$ being $$$100$$$ meters to the right of hut $$$i$$$, for all $$$1 \le i \le n - 1$$$. In hut $$$i$$$ there are $$$p_i$$$ people.There are $$$m$...
N, M = [int(x) for x in input().split()] hut = [int(x) for x in input().split()] shop = [int(x) for x in input().split()] shop = sorted([-1e9] + shop + [1e9]) events = [] j = 0 for i in range(N): while shop[j] < 100*i: {{completion}} if shop[j] != 100 * i: d = min(100*i - shop[j-1], shop[j] - 100*...
j += 1
[{"input": "3 1\n2 5 6\n169", "output": ["7"]}, {"input": "4 2\n1 2 7 8\n35 157", "output": ["15"]}, {"input": "4 1\n272203905 348354708 848256926 939404176\n20", "output": ["2136015810"]}, {"input": "3 2\n1 1 1\n300 99", "output": ["2"]}]
block_completion_001153
block
python
Complete the code in python to solve this programming problem: Description: On a beach there are $$$n$$$ huts in a perfect line, hut $$$1$$$ being at the left and hut $$$i+1$$$ being $$$100$$$ meters to the right of hut $$$i$$$, for all $$$1 \le i \le n - 1$$$. In hut $$$i$$$ there are $$$p_i$$$ people.There are $$$m$...
N, M = [int(x) for x in input().split()] hut = [int(x) for x in input().split()] shop = [int(x) for x in input().split()] shop = sorted([-1e9] + shop + [1e9]) events = [] j = 0 for i in range(N): while shop[j] < 100*i: j += 1 if shop[j] != 100 * i: {{completion}} events.sort() cont = 0 max = 0 ...
d = min(100*i - shop[j-1], shop[j] - 100*i) events.append((100*i-d, hut[i])) events.append((100*i+d, -hut[i]))
[{"input": "3 1\n2 5 6\n169", "output": ["7"]}, {"input": "4 2\n1 2 7 8\n35 157", "output": ["15"]}, {"input": "4 1\n272203905 348354708 848256926 939404176\n20", "output": ["2136015810"]}, {"input": "3 2\n1 1 1\n300 99", "output": ["2"]}]
block_completion_001154
block
python
Complete the code in python to solve this programming problem: Description: Bethany would like to tile her bathroom. The bathroom has width $$$w$$$ centimeters and length $$$l$$$ centimeters. If Bethany simply used the basic tiles of size $$$1 \times 1$$$ centimeters, she would use $$$w \cdot l$$$ of them. However, sh...
from math import sqrt, floor from sys import stdin data = [int(x) for x in stdin.read().split()[1:]] res = [] for w, l in zip(data[::2], data[1::2]): half_perimeter = w + l - 2 solutions = {1, 2} for i in range(2, floor(sqrt(half_perimeter)) + 1): div, mod_i = divmod(half_perimeter, i) if m...
assert (l - 2 + mod_a) % a == 0 solutions.add(a)
[{"input": "3\n\n3 5\n\n12 12\n\n314159265 358979323", "output": ["3 1 2 3\n3 1 2 11\n2 1 2"]}]
block_completion_001164
block
python
Complete the code in python to solve this programming problem: Description: Alina has discovered a weird language, which contains only $$$4$$$ words: $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{AB}$$$, $$$\texttt{BA}$$$. It also turned out that there are no spaces in this language: a sentence is written by just con...
t = int(input()) for _ in range(t): a, b, c, d = [int(i) for i in input().split()] s = input() if s.count('A') != a+c+d: print("NO") continue ult = 'X' k = 0 z = [] for x in s: if x == ult: z.append((k, ult)) k = 1 else: ...
c -= k//2
[{"input": "8\n1 0 0 0\nB\n0 0 1 0\nAB\n1 1 0 1\nABAB\n1 0 1 1\nABAAB\n1 1 2 2\nBAABBABBAA\n1 1 2 3\nABABABBAABAB\n2 3 5 4\nAABAABBABAAABABBABBBABB\n1 3 3 10\nBBABABABABBBABABABABABABAABABA", "output": ["NO\nYES\nYES\nYES\nYES\nYES\nNO\nYES"]}]
block_completion_001208
block
python
Complete the code in python to solve this programming problem: Description: Alina has discovered a weird language, which contains only $$$4$$$ words: $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{AB}$$$, $$$\texttt{BA}$$$. It also turned out that there are no spaces in this language: a sentence is written by just con...
t = int(input()) for _ in range(t): a, b, c, d = [int(i) for i in input().split()] s = input() if s.count('A') != a+c+d: print("NO") continue ult = 'X' k = 0 z = [] for x in s: if x == ult: z.append((k, ult)) k = 1 else: ...
r += k//2 - 1
[{"input": "8\n1 0 0 0\nB\n0 0 1 0\nAB\n1 1 0 1\nABAB\n1 0 1 1\nABAAB\n1 1 2 2\nBAABBABBAA\n1 1 2 3\nABABABBAABAB\n2 3 5 4\nAABAABBABAAABABBABBBABB\n1 3 3 10\nBBABABABABBBABABABABABABAABABA", "output": ["NO\nYES\nYES\nYES\nYES\nYES\nNO\nYES"]}]
block_completion_001209
block
python
Complete the code in python to solve this programming problem: Description: Alina has discovered a weird language, which contains only $$$4$$$ words: $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{AB}$$$, $$$\texttt{BA}$$$. It also turned out that there are no spaces in this language: a sentence is written by just con...
def canmake(s,a,b,c,d): anum = s.count('A') bnum = s.count('B') cnum = s.count('AB') dnum = s.count('BA') if cnum < c or dnum < d or anum != a + c + d or bnum != b + c + d: return False n=len(s) ans=0 abls=[] bals=[] l=0 while l<n: while...
d-=i-c-1 c = 0
[{"input": "8\n1 0 0 0\nB\n0 0 1 0\nAB\n1 1 0 1\nABAB\n1 0 1 1\nABAAB\n1 1 2 2\nBAABBABBAA\n1 1 2 3\nABABABBAABAB\n2 3 5 4\nAABAABBABAAABABBABBBABB\n1 3 3 10\nBBABABABABBBABABABABABABAABABA", "output": ["NO\nYES\nYES\nYES\nYES\nYES\nNO\nYES"]}]
block_completion_001210
block
python
Complete the code in python to solve this programming problem: Description: Alina has discovered a weird language, which contains only $$$4$$$ words: $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{AB}$$$, $$$\texttt{BA}$$$. It also turned out that there are no spaces in this language: a sentence is written by just con...
def canmake(s,a,b,c,d): anum = s.count('A') bnum = s.count('B') cnum = s.count('AB') dnum = s.count('BA') if cnum < c or dnum < d or anum != a + c + d or bnum != b + c + d: return False n=len(s) ans=0 abls=[] bals=[] l=0 while l<n: while...
c-=i-d-1 d = 0
[{"input": "8\n1 0 0 0\nB\n0 0 1 0\nAB\n1 1 0 1\nABAB\n1 0 1 1\nABAAB\n1 1 2 2\nBAABBABBAA\n1 1 2 3\nABABABBAABAB\n2 3 5 4\nAABAABBABAAABABBABBBABB\n1 3 3 10\nBBABABABABBBABABABABABABAABABA", "output": ["NO\nYES\nYES\nYES\nYES\nYES\nNO\nYES"]}]
block_completion_001211
block
python
Complete the code in python to solve this programming problem: Description: Alina has discovered a weird language, which contains only $$$4$$$ words: $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{AB}$$$, $$$\texttt{BA}$$$. It also turned out that there are no spaces in this language: a sentence is written by just con...
for _ in range(int(input())): a,b,ab,ba=map(int,input().split());s=input() if s.count('A')!=a+ab+ba:print('NO');continue stack=[[1,s[0]]] for i in range(1,len(s)): if stack[-1][1]!=s[i]: x=stack.pop() stack.append([x[0]+1,s[i]]) else: stack.append([1,s[i]]...
ab-=(val//2)
[{"input": "8\n1 0 0 0\nB\n0 0 1 0\nAB\n1 1 0 1\nABAB\n1 0 1 1\nABAAB\n1 1 2 2\nBAABBABBAA\n1 1 2 3\nABABABBAABAB\n2 3 5 4\nAABAABBABAAABABBABBBABB\n1 3 3 10\nBBABABABABBBABABABABABABAABABA", "output": ["NO\nYES\nYES\nYES\nYES\nYES\nNO\nYES"]}]
block_completion_001212
block
python
Complete the code in python to solve this programming problem: Description: Alina has discovered a weird language, which contains only $$$4$$$ words: $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{AB}$$$, $$$\texttt{BA}$$$. It also turned out that there are no spaces in this language: a sentence is written by just con...
for _ in range(int(input())): a,b,ab,ba=map(int,input().split());s=input() if s.count('A')!=a+ab+ba:print('NO');continue stack=[[1,s[0]]] for i in range(1,len(s)): if stack[-1][1]!=s[i]: x=stack.pop() stack.append([x[0]+1,s[i]]) else: stack.append([1,s[i]]...
trash+=(val//2-1)
[{"input": "8\n1 0 0 0\nB\n0 0 1 0\nAB\n1 1 0 1\nABAB\n1 0 1 1\nABAAB\n1 1 2 2\nBAABBABBAA\n1 1 2 3\nABABABBAABAB\n2 3 5 4\nAABAABBABAAABABBABBBABB\n1 3 3 10\nBBABABABABBBABABABABABABAABABA", "output": ["NO\nYES\nYES\nYES\nYES\nYES\nNO\nYES"]}]
block_completion_001213
block
python
Complete the code in python to solve this programming problem: Description: Alina has discovered a weird language, which contains only $$$4$$$ words: $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{AB}$$$, $$$\texttt{BA}$$$. It also turned out that there are no spaces in this language: a sentence is written by just con...
import sys,os,io # input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline input = sys.stdin.readline for _ in range (int(input())): c = [int(i) for i in input().split()] s = list(input().strip()) if s.count('A') != c[0] + c[2] + c[3] or s.count('B') != c[1] + c[2] + c[3]: print("NO") ...
extra += cnt - 1
[{"input": "8\n1 0 0 0\nB\n0 0 1 0\nAB\n1 1 0 1\nABAB\n1 0 1 1\nABAAB\n1 1 2 2\nBAABBABBAA\n1 1 2 3\nABABABBAABAB\n2 3 5 4\nAABAABBABAAABABBABBBABB\n1 3 3 10\nBBABABABABBBABABABABABABAABABA", "output": ["NO\nYES\nYES\nYES\nYES\nYES\nNO\nYES"]}]
block_completion_001214
block
python
Complete the code in python to solve this programming problem: Description: Alina has discovered a weird language, which contains only $$$4$$$ words: $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{AB}$$$, $$$\texttt{BA}$$$. It also turned out that there are no spaces in this language: a sentence is written by just con...
import sys import math def do_test(): a,b,ab,ba = map(int, input().split()) S = input().strip() n = len(S) ac = 0 for i in S: if i == 'A': ac += 1 if (ac != a + ab + ba): return "NO" a_parts = [] b_parts = [] ab_total = ...
a_parts.append(l // 2)
[{"input": "8\n1 0 0 0\nB\n0 0 1 0\nAB\n1 1 0 1\nABAB\n1 0 1 1\nABAAB\n1 1 2 2\nBAABBABBAA\n1 1 2 3\nABABABBAABAB\n2 3 5 4\nAABAABBABAAABABBABBBABB\n1 3 3 10\nBBABABABABBBABABABABABABAABABA", "output": ["NO\nYES\nYES\nYES\nYES\nYES\nNO\nYES"]}]
block_completion_001215
block
python
Complete the code in python to solve this programming problem: Description: Alina has discovered a weird language, which contains only $$$4$$$ words: $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{AB}$$$, $$$\texttt{BA}$$$. It also turned out that there are no spaces in this language: a sentence is written by just con...
import sys import math def do_test(): a,b,ab,ba = map(int, input().split()) S = input().strip() n = len(S) ac = 0 for i in S: if i == 'A': ac += 1 if (ac != a + ab + ba): return "NO" a_parts = [] b_parts = [] ab_total = ...
b_parts.append(l // 2)
[{"input": "8\n1 0 0 0\nB\n0 0 1 0\nAB\n1 1 0 1\nABAB\n1 0 1 1\nABAAB\n1 1 2 2\nBAABBABBAA\n1 1 2 3\nABABABBAABAB\n2 3 5 4\nAABAABBABAAABABBABBBABB\n1 3 3 10\nBBABABABABBBABABABABABABAABABA", "output": ["NO\nYES\nYES\nYES\nYES\nYES\nNO\nYES"]}]
block_completion_001216
block
python
Complete the code in python to solve this programming problem: Description: Alina has discovered a weird language, which contains only $$$4$$$ words: $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{AB}$$$, $$$\texttt{BA}$$$. It also turned out that there are no spaces in this language: a sentence is written by just con...
def solve(): cnt_a, cnt_b, cnt_ab, cnt_ba = map(int, input().strip().split()) # print(cntA, cntB, cntAB, cntBA) s = input() if s.count('A') != cnt_a + cnt_ba + cnt_ab: print("NO") return stk = [[1, s[0]]] for i in range(1, len(s)): if i == 0: conti...
cnt_ab -= cnt >> 1
[{"input": "8\n1 0 0 0\nB\n0 0 1 0\nAB\n1 1 0 1\nABAB\n1 0 1 1\nABAAB\n1 1 2 2\nBAABBABBAA\n1 1 2 3\nABABABBAABAB\n2 3 5 4\nAABAABBABAAABABBABBBABB\n1 3 3 10\nBBABABABABBBABABABABABABAABABA", "output": ["NO\nYES\nYES\nYES\nYES\nYES\nNO\nYES"]}]
block_completion_001217
block
python
Complete the code in python to solve this programming problem: Description: Alina has discovered a weird language, which contains only $$$4$$$ words: $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{AB}$$$, $$$\texttt{BA}$$$. It also turned out that there are no spaces in this language: a sentence is written by just con...
def solve(): cnt_a, cnt_b, cnt_ab, cnt_ba = map(int, input().strip().split()) # print(cntA, cntB, cntAB, cntBA) s = input() if s.count('A') != cnt_a + cnt_ba + cnt_ab: print("NO") return stk = [[1, s[0]]] for i in range(1, len(s)): if i == 0: conti...
rest += (cnt >> 1) - 1
[{"input": "8\n1 0 0 0\nB\n0 0 1 0\nAB\n1 1 0 1\nABAB\n1 0 1 1\nABAAB\n1 1 2 2\nBAABBABBAA\n1 1 2 3\nABABABBAABAB\n2 3 5 4\nAABAABBABAAABABBABBBABB\n1 3 3 10\nBBABABABABBBABABABABABABAABABA", "output": ["NO\nYES\nYES\nYES\nYES\nYES\nNO\nYES"]}]
block_completion_001218
block
python
Complete the code in python to solve this programming problem: Description: You are given an array of $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$. After you watched the amazing film "Everything Everywhere All At Once", you came up with the following operation.In one operation, you choose $$$n-1$$$ elements of the arr...
import fileinput lines = [] for line in fileinput.input(): line_f = [int(x) for x in line.split()] if len(line_f) > 0: lines.append(line_f) # print ffs for i in range(1, len(lines), 2): n = lines[i][0] a = lines[i+1] b = 123 + 23 c= b + 1 sm = 0 ...
found = True break
[{"input": "4\n\n3\n\n42 42 42\n\n5\n\n1 2 3 4 5\n\n4\n\n4 3 2 1\n\n3\n\n24 2 22", "output": ["YES\nYES\nNO\nNO"]}]
block_completion_001246
block
python
Complete the code in python to solve this programming problem: Description: For an array $$$[b_1, b_2, \ldots, b_m]$$$ define its number of inversions as the number of pairs $$$(i, j)$$$ of integers such that $$$1 \le i &lt; j \le m$$$ and $$$b_i&gt;b_j$$$. Let's call array $$$b$$$ odd if its number of inversions is o...
import fileinput lines = [] for line in fileinput.input(): line_f = [int(x) for x in line.split()] if len(line_f) > 0: lines.append(line_f) # print ffs for i in range(1, len(lines), 2): n = lines[i][0] a = lines[i+1] numoddseg = 0 prev = -1 i = 0 whil...
prev = a[i]
[{"input": "5\n\n3\n\n1 2 3\n\n4\n\n4 3 2 1\n\n2\n\n1 2\n\n2\n\n2 1\n\n6\n\n4 5 6 1 2 3", "output": ["0\n2\n0\n1\n1"]}]
block_completion_001288
block
python
Complete the code in python to solve this programming problem: Description: Inflation has occurred in Berlandia, so the store needs to change the price of goods.The current price of good $$$n$$$ is given. It is allowed to increase the price of the good by $$$k$$$ times, with $$$1 \le k \le m$$$, k is an integer. Outpu...
from sys import stdin, stderr data = [int(x) for x in stdin.read().split()[1:]] ns, ms = data[::2], data[1::2] output = [] for n, m in zip(ns, ms): # n = 2 ** a * 5 ** b * c a = b = 0 c = n while c % 2 == 0: a += 1 c //= 2 while c % 5 == 0: b += 1 c //= 5 t = 1...
t *= 2 a += 1
[{"input": "10\n\n6 11\n\n5 43\n\n13 5\n\n4 16\n\n10050 12345\n\n2 6\n\n4 30\n\n25 10\n\n2 81\n\n1 7", "output": ["60\n200\n65\n60\n120600000\n10\n100\n200\n100\n7"]}]
block_completion_001335
block
python
Complete the code in python to solve this programming problem: Description: There are $$$n$$$ chests. The $$$i$$$-th chest contains $$$a_i$$$ coins. You need to open all $$$n$$$ chests in order from chest $$$1$$$ to chest $$$n$$$.There are two types of keys you can use to open a chest: a good key, which costs $$$k$$...
from __future__ import annotations import csv import datetime import string import sys import time from collections import defaultdict from contextlib import contextmanager from typing import List def solve() -> None: n = next_int() k = next_int() a = next_int_array(n) ndivs = 31 d = [[0] * ndivs for _ in ...
solve()
[{"input": "5\n\n4 5\n\n10 10 3 1\n\n1 2\n\n1\n\n3 12\n\n10 10 29\n\n12 51\n\n5 74 89 45 18 69 67 67 11 96 23 59\n\n2 57\n\n85 60", "output": ["11\n0\n13\n60\n58"]}]
block_completion_001449
block
python
Complete the code in python to solve this programming problem: Description: There are $$$n$$$ chests. The $$$i$$$-th chest contains $$$a_i$$$ coins. You need to open all $$$n$$$ chests in order from chest $$$1$$$ to chest $$$n$$$.There are two types of keys you can use to open a chest: a good key, which costs $$$k$$...
from __future__ import annotations import csv import datetime import string import sys import time from collections import defaultdict from contextlib import contextmanager from typing import List def solve() -> None: n = next_int() k = next_int() a = next_int_array(n) ndivs = 31 d = [[0] * ndivs for _ in ...
solve()
[{"input": "5\n\n4 5\n\n10 10 3 1\n\n1 2\n\n1\n\n3 12\n\n10 10 29\n\n12 51\n\n5 74 89 45 18 69 67 67 11 96 23 59\n\n2 57\n\n85 60", "output": ["11\n0\n13\n60\n58"]}]
block_completion_001450
block
python
Complete the code in python to solve this programming problem: Description: You are given a string $$$s$$$. You have to determine whether it is possible to build the string $$$s$$$ out of strings aa, aaa, bb and/or bbb by concatenating them. You can use the strings aa, aaa, bb and/or bbb any number of times and in any...
t=int(input()) while(t): i=0 s=input() if(len(s)==1): print("NO") t=t-1 continue while(i<len(s)): if(i==0): if(s[0:2]=="ab" or s[0:2]=="ba"): print("NO") t=t-1 break if(i>0 and i<len(s)-1): ...
print("YES") t=t-1 break
[{"input": "8\n\naaaabbb\n\nbbaaaaabbb\n\naaaaaa\n\nabab\n\na\n\nb\n\naaaab\n\nbbaaa", "output": ["YES\nYES\nYES\nNO\nNO\nNO\nNO\nYES"]}]
block_completion_001684
block
python
Complete the code in python to solve this programming problem: Description: You are given a rooted tree of $$$2^n - 1$$$ vertices. Every vertex of this tree has either $$$0$$$ children, or $$$2$$$ children. All leaves of this tree have the same distance from the root, and for every non-leaf vertex, one of its children...
n = int(input()) s = input() c = 1 def dfs(i): if i >= 2**(n-1)-1: {{completion}} global c l = dfs(2*i + 1) r = dfs(2*i + 2) if l != r: c *= 2 if l > r: l, r = r, l return s[i] + l + r dfs(0) print(c % 998244353)
return s[i]
[{"input": "4\nBAAAAAAAABBABAB", "output": ["16"]}, {"input": "2\nBAA", "output": ["1"]}, {"input": "2\nABA", "output": ["2"]}, {"input": "2\nAAB", "output": ["2"]}, {"input": "2\nAAA", "output": ["1"]}]
block_completion_001702
block
python
Complete the code in python to solve this programming problem: Description: You are given a rooted tree of $$$2^n - 1$$$ vertices. Every vertex of this tree has either $$$0$$$ children, or $$$2$$$ children. All leaves of this tree have the same distance from the root, and for every non-leaf vertex, one of its children...
n = int(input()) s = input() c = 1 def dfs(i): if i >= 2**(n-1)-1: return s[i] global c l = dfs(2*i + 1) r = dfs(2*i + 2) if l != r: {{completion}} if l > r: l, r = r, l return s[i] + l + r dfs(0) print(c % 998244353)
c *= 2
[{"input": "4\nBAAAAAAAABBABAB", "output": ["16"]}, {"input": "2\nBAA", "output": ["1"]}, {"input": "2\nABA", "output": ["2"]}, {"input": "2\nAAB", "output": ["2"]}, {"input": "2\nAAA", "output": ["1"]}]
block_completion_001703
block
python
Complete the code in python to solve this programming problem: Description: You are given a rooted tree of $$$2^n - 1$$$ vertices. Every vertex of this tree has either $$$0$$$ children, or $$$2$$$ children. All leaves of this tree have the same distance from the root, and for every non-leaf vertex, one of its children...
mod=998244353 cnt=0 n=int(input()) s=input() import random q=random.randint(10**9,2*10**9) p=random.randint(10**9,2*10**9) r=10**9+7 a=[-1] for i in s: if i=='A': a.append(p) else: {{completion}} for i in range(2**(n-1)-1,0,-1): if a[2*i]!=a[2*i+1]: cnt+=1 a[i]=a[i]^(2*a[2*i]+2*a[2*i+1]) a[i]%=...
a.append(q)
[{"input": "4\nBAAAAAAAABBABAB", "output": ["16"]}, {"input": "2\nBAA", "output": ["1"]}, {"input": "2\nABA", "output": ["2"]}, {"input": "2\nAAB", "output": ["2"]}, {"input": "2\nAAA", "output": ["1"]}]
block_completion_001704
block
python
Complete the code in python to solve this programming problem: Description: You are given a rooted tree of $$$2^n - 1$$$ vertices. Every vertex of this tree has either $$$0$$$ children, or $$$2$$$ children. All leaves of this tree have the same distance from the root, and for every non-leaf vertex, one of its children...
MOD = 998244353 n, s = int(input()), input() def calc(u: int) -> tuple: if u >= (1 << n): {{completion}} t1, t2 = calc(u * 2), calc(u * 2 + 1) return (t1[0] + t2[0] + (t1[1] != t2[1]), hash((min(t1[1], t2[1]), max(t1[1], t2[1]), s[u - 1]))) print(pow(2, calc(1)[0],...
return (0, 0)
[{"input": "4\nBAAAAAAAABBABAB", "output": ["16"]}, {"input": "2\nBAA", "output": ["1"]}, {"input": "2\nABA", "output": ["2"]}, {"input": "2\nAAB", "output": ["2"]}, {"input": "2\nAAA", "output": ["1"]}]
block_completion_001705
block