message stringlengths 2 65.1k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 0 108k | cluster float64 14 14 | __index_level_0__ int64 0 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky days are repeating with some period. For example, ... | instruction | 0 | 51,311 | 14 | 102,622 |
Tags: math, number theory
Correct Solution:
```
import math
def gcd(a, b):
"""Returns the greatest common divisor of a and b.
Should be implemented using recursion.
>>> gcd(34, 19)
1
>>> gcd(39, 91)
13
>>> gcd(20, 30)
10
>>> gcd(40, 40)
40
"""
if b > a:
return g... | output | 1 | 51,311 | 14 | 102,623 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky day... | instruction | 0 | 51,312 | 14 | 102,624 |
Yes | output | 1 | 51,312 | 14 | 102,625 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky day... | instruction | 0 | 51,313 | 14 | 102,626 |
Yes | output | 1 | 51,313 | 14 | 102,627 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky day... | instruction | 0 | 51,314 | 14 | 102,628 |
Yes | output | 1 | 51,314 | 14 | 102,629 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky day... | instruction | 0 | 51,315 | 14 | 102,630 |
Yes | output | 1 | 51,315 | 14 | 102,631 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky day... | instruction | 0 | 51,316 | 14 | 102,632 |
No | output | 1 | 51,316 | 14 | 102,633 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky day... | instruction | 0 | 51,317 | 14 | 102,634 |
No | output | 1 | 51,317 | 14 | 102,635 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky day... | instruction | 0 | 51,318 | 14 | 102,636 |
No | output | 1 | 51,318 | 14 | 102,637 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky day... | instruction | 0 | 51,319 | 14 | 102,638 |
No | output | 1 | 51,319 | 14 | 102,639 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for her: it has n strings, and each string has (10^{... | instruction | 0 | 51,346 | 14 | 102,692 |
Tags: binary search, sortings
Correct Solution:
```
import sys
input = sys.stdin.readline
stdout = sys.stdout
rr = lambda: input().strip()
rri = lambda: int(input())
rrm = lambda: list(map(int, input().strip().split()))
from bisect import bisect
N = rri()
A = rrm()
Q = rri()
A.sort()
D = sorted(A[i+1] - A[i] for i in... | output | 1 | 51,346 | 14 | 102,693 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for her: it has n strings, and each string has (10^{... | instruction | 0 | 51,347 | 14 | 102,694 |
Tags: binary search, sortings
Correct Solution:
```
from bisect import bisect
n = int(input())
a = sorted(set(map(int, input().split())))
dd = sorted(map(lambda x, y: x-y, a[1:], a))
ddd = [0]
for v in dd:
ddd.append(ddd[-1] + v)
s = len(a)
k = int(input())
for j in range(k):
l, r = map(int, input().split())
... | output | 1 | 51,347 | 14 | 102,695 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for her: it has n strings, and each string has (10^{... | instruction | 0 | 51,348 | 14 | 102,696 |
Tags: binary search, sortings
Correct Solution:
```
#Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
BUFSIZE = 8192
class ... | output | 1 | 51,348 | 14 | 102,697 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for her: it has n strings, and each string has (10^{... | instruction | 0 | 51,349 | 14 | 102,698 |
Tags: binary search, sortings
Correct Solution:
```
from sys import stdin, stdout
import bisect
n = int(input())
a = list(map(int, stdin.readline().split()))
a = sorted(a)
if n == 1:
q = int(input())
out = []
while q > 0:
l, r = map(int, stdin.readline().split())
txt = str(r - l + 1)
out.append(txt)
q -=... | output | 1 | 51,349 | 14 | 102,699 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for her: it has n strings, and each string has (10^{... | instruction | 0 | 51,350 | 14 | 102,700 |
Tags: binary search, sortings
Correct Solution:
```
#!/usr/bin/env python3
import os, sys
from io import BytesIO
class FastI:
stream = BytesIO()
newlines = 0
def readline(self):
while self.newlines == 0:
b, ptr = os.read(0, (1 << 13) + os.fstat(0).st_size), self.stream.tell()
... | output | 1 | 51,350 | 14 | 102,701 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for her: it has n strings, and each string has (10^{... | instruction | 0 | 51,351 | 14 | 102,702 |
Tags: binary search, sortings
Correct Solution:
```
import copy
import bisect
n = int(input())
s = list(map(int, input().split()))
sCopy = copy.deepcopy(s)
AP = []
mx = -1
sCopy.sort()
miss = []
for i in range(n-1):
mx = max(mx, sCopy[i+1]-sCopy[i]-1, 0)
miss.append(max(sCopy[i+1]-sCopy[i]-1, 0))
miss.sort()... | output | 1 | 51,351 | 14 | 102,703 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for her: it has n strings, and each string has (10^{... | instruction | 0 | 51,352 | 14 | 102,704 |
Tags: binary search, sortings
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
from collections import Counter
import string
import heapq
import bisect
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
import os
self.os = os
self._fd... | output | 1 | 51,352 | 14 | 102,705 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for her: it has n strings, and each string has (10^{... | instruction | 0 | 51,353 | 14 | 102,706 |
Tags: binary search, sortings
Correct Solution:
```
n=int(input())
s=list(map(int,input().split()))
if n==1:
q=int(input())
out=[0]*q
for u in range(q):
a,b=map(int,input().split())
out[u]=str(b-a+1)
print(" ".join(out))
exit()
s.sort()
diffs=[s[i+1]-s[i] for i in range(n-1)]
diffs.s... | output | 1 | 51,353 | 14 | 102,707 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for h... | instruction | 0 | 51,354 | 14 | 102,708 |
Yes | output | 1 | 51,354 | 14 | 102,709 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for h... | instruction | 0 | 51,355 | 14 | 102,710 |
Yes | output | 1 | 51,355 | 14 | 102,711 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for h... | instruction | 0 | 51,356 | 14 | 102,712 |
Yes | output | 1 | 51,356 | 14 | 102,713 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for h... | instruction | 0 | 51,357 | 14 | 102,714 |
Yes | output | 1 | 51,357 | 14 | 102,715 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for h... | instruction | 0 | 51,358 | 14 | 102,716 |
No | output | 1 | 51,358 | 14 | 102,717 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for h... | instruction | 0 | 51,359 | 14 | 102,718 |
No | output | 1 | 51,359 | 14 | 102,719 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for h... | instruction | 0 | 51,360 | 14 | 102,720 |
No | output | 1 | 51,360 | 14 | 102,721 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.
In return, the fleas made a bigger ukulele for h... | instruction | 0 | 51,361 | 14 | 102,722 |
No | output | 1 | 51,361 | 14 | 102,723 |
Provide tags and a correct Python 3 solution for this coding contest problem.
«Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test w... | instruction | 0 | 51,625 | 14 | 103,250 |
Tags: implementation, sortings
Correct Solution:
```
#x,y = map(int, input().strip().split(' '))
n=int(input())
lst = list(map(int, input().strip().split(' ')))
lst.sort()
f=0
for i in range(n):
if i==0:
if lst[i]!=1:
print(1)
f=1
break
else:
if lst[i]!=lst[i-... | output | 1 | 51,625 | 14 | 103,251 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».
The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are nu... | instruction | 0 | 51,692 | 14 | 103,384 |
Tags: bitmasks, brute force, constructive algorithms, implementation
Correct Solution:
```
(n, m, k) = map(int, input().split(' '))
x = []
for i in range(0, m+1):
t = int(input())
x.append(t)
fedor = x[m]
count = 0
for i in range(0, m):
tmp = x[i] ^ fedor
c = bin(tmp).count('1')
if(c <= k):
... | output | 1 | 51,692 | 14 | 103,385 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».
The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are nu... | instruction | 0 | 51,693 | 14 | 103,386 |
Tags: bitmasks, brute force, constructive algorithms, implementation
Correct Solution:
```
n,m,k = map(int,input().split())
a = []
for i in range(m):
a.append(int(input()))
fedya = int(input())
fedya = str(bin(fedya)[2:])
fedya = '0'*(n-len(fedya))+fedya
ans = 0
for bb in a:
bbb = str(bin(bb)[2:])
bbb = '0'... | output | 1 | 51,693 | 14 | 103,387 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».
The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are nu... | instruction | 0 | 51,694 | 14 | 103,388 |
Tags: bitmasks, brute force, constructive algorithms, implementation
Correct Solution:
```
inp = input()
inp = inp.split(' ')
n = int(inp[0])
m = int(inp[1])
k = int(inp[2])
count = 0
bin_ints = []
for i in range(m):
bin_ints.append(int(input()))
fedor = int(input())
print(len(list(filter(lambda e: bin(e ^ f... | output | 1 | 51,694 | 14 | 103,389 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».
The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are nu... | instruction | 0 | 51,695 | 14 | 103,390 |
Tags: bitmasks, brute force, constructive algorithms, implementation
Correct Solution:
```
n, m, k = list(map(int, input().split()))
c = 0
a = []
for i in range(m): a.append(int(input()))
d = int(input())
for i in range(m):
x = a[i]
x ^= d
r = 0
while x:
r += x & 1
x = x >> 1
if r <... | output | 1 | 51,695 | 14 | 103,391 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».
The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are nu... | instruction | 0 | 51,696 | 14 | 103,392 |
Tags: bitmasks, brute force, constructive algorithms, implementation
Correct Solution:
```
n, m, k = map(int, input().split())
a = [int(input()) for __ in range(m)]
x = int(input())
ans = 0
for y in a:
if bin(x ^ y).count('1') <= k:
ans += 1
print(ans)
``` | output | 1 | 51,696 | 14 | 103,393 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».
The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are nu... | instruction | 0 | 51,697 | 14 | 103,394 |
Tags: bitmasks, brute force, constructive algorithms, implementation
Correct Solution:
```
n, m, k = input().split()
n = int (n)
m = int (m)
k = int (k)
#n = int(input())
#a = list(map(int, input().split()))
#g = list(map(int, input().split()))
#x1, y1, x2, y2 =map(int,input().split())
#n = int(input())
# = [""]*n
#f =... | output | 1 | 51,697 | 14 | 103,395 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».
The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are nu... | instruction | 0 | 51,698 | 14 | 103,396 |
Tags: bitmasks, brute force, constructive algorithms, implementation
Correct Solution:
```
n, m, k = map(int, input().split())
L = []
N = []
M = 0
for i in range(m+1):
L += [bin(int(input())).replace('0b', '')]
M = max(M, len(L[i]))
for i in range(m+1):
p = ['0'*(M-len(L[i]))+L[i]]
N += p
f = N[-1]
t = ... | output | 1 | 51,698 | 14 | 103,397 |
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».
The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are nu... | instruction | 0 | 51,699 | 14 | 103,398 |
Tags: bitmasks, brute force, constructive algorithms, implementation
Correct Solution:
```
def dec_to_bin(x):
return bin(x)[2:]
def compare(x, y):
charX = list(dec_to_bin(x))
charY = list(dec_to_bin(y))
differ = 0
while (len(charX) < len(charY)):
charX.insert(0, '0')
while (len(charY) <... | output | 1 | 51,699 | 14 | 103,399 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it periodically changes its state — sometimes it is... | instruction | 0 | 51,864 | 14 | 103,728 |
Tags: brute force, constructive algorithms
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import collections
import itertools
import bisect
import heapq
# sys.setrecursionlimit(100000)
# ^^^TAKE CARE FOR MEMORY LIMIT^^^
import random
def main():
pass
... | output | 1 | 51,864 | 14 | 103,729 |
Provide tags and a correct Python 2 solution for this coding contest problem.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon.
A performer holding the rod low i... | instruction | 0 | 51,874 | 14 | 103,748 |
Tags: dp
Correct Solution:
```
from sys import stdin, stdout
from collections import Counter, defaultdict
from itertools import permutations, combinations
raw_input = stdin.readline
pr = stdout.write
def in_num():
return int(raw_input())
def in_arr():
return map(int,raw_input().split())
def pr_num(n):
... | output | 1 | 51,874 | 14 | 103,749 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon.
A performer holding the rod low i... | instruction | 0 | 51,875 | 14 | 103,750 |
Tags: dp
Correct Solution:
```
# -*- coding: utf-8 -*-
# Watashi wa ARUGONEKO wo tsukatteru. [algoneko.github.io]
# I hate python --RedCat
from math import *
import re
n = int(input())
a = list(map(int, input().split()))
d1, d2, d3, d4 = [0]*n, [0]*n, [0]*n, [0]*n
d1[0] = d3[0] = (1 if a[0] == 1 else 0)
d2[0] = d4[0] ... | output | 1 | 51,875 | 14 | 103,751 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon.
A performer holding the rod low i... | instruction | 0 | 51,876 | 14 | 103,752 |
Tags: dp
Correct Solution:
```
import sys
def input():
return sys.stdin.buffer.readline().rstrip()
n = int(input())
a = list(map(int, input().split()))
ans = max(a.count(1), a.count(2))
#mixed case
prefix = [0]*(n + 10)
suffix = [0]*(n + 10)
for i in range(n):
if a[i] == 1:
prefix[i + 1] = 1
a.reve... | output | 1 | 51,876 | 14 | 103,753 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon.
A performer holding the rod low i... | instruction | 0 | 51,877 | 14 | 103,754 |
Tags: dp
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
pref = [0] * (n + 1)
for i in range(n):
pref[i + 1] = pref[i] + (1 if a[i] == 1 else 0)
suf = [0] * (n + 1)
for i in reversed(range(n)):
suf[i] = suf[i + 1] + (1 if a[i] == 2 else 0)
dp = [0, 0, 0, 0]
for i in range(n):
new_dp = [max... | output | 1 | 51,877 | 14 | 103,755 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon.
A performer holding the rod low i... | instruction | 0 | 51,878 | 14 | 103,756 |
Tags: dp
Correct Solution:
```
a = [0] * 4
input()
for n in map(int, input().split()):
if n == 1:
a[0] += 1
a[2] = max(a[1] + 1, a[2] + 1)
else:
a[1] = max(a[0] + 1, a[1] + 1)
a[3] = max(a[2] + 1, a[3] + 1)
print(max(a))
``` | output | 1 | 51,878 | 14 | 103,757 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon.
A performer holding the rod low i... | instruction | 0 | 51,879 | 14 | 103,758 |
Tags: dp
Correct Solution:
```
input()
a = list(map(int, input().split()))
p1,p2,p3,p4=0,0,0,0
for n in a:
if n == 1:
p1 += 1
p3 = max(p3 + 1, p2 + 1)
else:
p2 = max(p2 + 1, p1 + 1)
p4 = max(p4 + 1, p3 + 1)
print(max(p1,p2,p3,p4))
``` | output | 1 | 51,879 | 14 | 103,759 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon.
A performer holding the rod low i... | instruction | 0 | 51,880 | 14 | 103,760 |
Tags: dp
Correct Solution:
```
n=int(input())
a=list(map(int,input().split()))
d=[0]*(4)
for i in range(n):
if a[i]==1:
d[0]+=1
d[2]=max(d[1],d[2])+1
else:
d[1]=max(d[0],d[1])+1
d[3]=max(d[2],d[3])+1
print(max(d))
``` | output | 1 | 51,880 | 14 | 103,761 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon.
A performer holding the rod low i... | instruction | 0 | 51,881 | 14 | 103,762 |
Tags: dp
Correct Solution:
```
def solve(lst):
a = b = c = d = 0
for i in range(len(lst)):
if lst[i] == 1:
a += 1
c = max(b, c) + 1
else:
b = max(a, b) + 1
d = max(c, d) + 1
return max(a, b, c, d)
n = input()
lst = list(map(int, input().split(... | output | 1 | 51,881 | 14 | 103,763 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon.
A performer holding the rod low i... | instruction | 0 | 51,882 | 14 | 103,764 |
Tags: dp
Correct Solution:
```
#fek mikoni aslan lozoomi dare kasi tu in donya dustet dashtet bashe ?!
#age are chera tanhayi ?!!
#age na chera namordi ?!!!
DP = [0] * 4
input()
for x in map(int, input().split()):
if x == 1 :
DP[0] += 1
DP[2] += 1
else :
DP[1] += 1
DP[3] += 1
... | output | 1 | 51,882 | 14 | 103,765 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a fl... | instruction | 0 | 51,883 | 14 | 103,766 |
Yes | output | 1 | 51,883 | 14 | 103,767 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a fl... | instruction | 0 | 51,884 | 14 | 103,768 |
Yes | output | 1 | 51,884 | 14 | 103,769 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a fl... | instruction | 0 | 51,885 | 14 | 103,770 |
Yes | output | 1 | 51,885 | 14 | 103,771 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a fl... | instruction | 0 | 51,886 | 14 | 103,772 |
Yes | output | 1 | 51,886 | 14 | 103,773 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a fl... | instruction | 0 | 51,887 | 14 | 103,774 |
No | output | 1 | 51,887 | 14 | 103,775 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a fl... | instruction | 0 | 51,888 | 14 | 103,776 |
No | output | 1 | 51,888 | 14 | 103,777 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.