message stringlengths 2 22.8k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 16 109k | cluster float64 1 1 | __index_level_0__ int64 32 217k |
|---|---|---|---|---|---|
Provide a correct Python 3 solution for this coding contest problem.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is arbitrary. The conductor patrols the train. The conductor ... | instruction | 0 | 39,522 | 1 | 79,044 |
"Correct Solution:
```
# AOJ 0130 Train
# Python3 2018.6.19 bal4u
for _ in range(int(input())):
s = list(input())
ans = []
dir = '>'
for i in range(len(s)):
if s[i].isalpha():
if dir == '>':
if s[i] not in ans: ans.append(s[i])
else:
if s[i] not in ans: ans.insert(0, s[i])
elif s[i] == '>' or s[i... | output | 1 | 39,522 | 1 | 79,045 |
Provide a correct Python 3 solution for this coding contest problem.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is arbitrary. The conductor patrols the train. The conductor ... | instruction | 0 | 39,523 | 1 | 79,046 |
"Correct Solution:
```
n=int(input())
for _ in range(n):
s=input()
s=s.replace("-","")
train=["" for i in range(60)]
pointer=30
for i in s:
if i=="<":
pointer-=1
elif i==">":
pointer+=1
else:
train[pointer]=i
print("".join(train))
``` | output | 1 | 39,523 | 1 | 79,047 |
Provide a correct Python 3 solution for this coding contest problem.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is arbitrary. The conductor patrols the train. The conductor ... | instruction | 0 | 39,524 | 1 | 79,048 |
"Correct Solution:
```
n = int(input())
for i in range(0,n):
datas = input()
dic = dict()
sIndex = inIndex = isMove = 0
while sIndex < len(datas):
if not isMove:
dic[datas[sIndex]] = inIndex
sIndex += 2
else:
if datas[sIndex] == '>':
... | output | 1 | 39,524 | 1 | 79,049 |
Provide a correct Python 3 solution for this coding contest problem.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is arbitrary. The conductor patrols the train. The conductor ... | instruction | 0 | 39,525 | 1 | 79,050 |
"Correct Solution:
```
# AOJ 0130 Train
# Python3 2018.6.19 bal4u
for _ in range(int(input())):
s = list(input())
ans, dir = [], '>'
for x in s:
if x.isalpha():
if dir == '>':
if x not in ans: ans.append(x)
else:
if x not in ans: ans.insert(0, x)
elif x == '>' or x == '<': dir = x
print(*ans, sep... | output | 1 | 39,525 | 1 | 79,051 |
Provide a correct Python 3 solution for this coding contest problem.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is arbitrary. The conductor patrols the train. The conductor ... | instruction | 0 | 39,526 | 1 | 79,052 |
"Correct Solution:
```
I=input
for _ in [0]*int(I()):
t=I()
ans=[t[0]]
for x in range(1,len(t),3):
if t[x+2] in ans:continue
if t[x]=='-':ans+=[t[x+2]]
else:ans=[t[x+2]]+ans
print(*ans,sep='')
``` | output | 1 | 39,526 | 1 | 79,053 |
Provide a correct Python 3 solution for this coding contest problem.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is arbitrary. The conductor patrols the train. The conductor ... | instruction | 0 | 39,527 | 1 | 79,054 |
"Correct Solution:
```
def proc(i):
l = len(i)
o = [ i[0] ]
io = 1
ii = 1
while ii < l:
# print(o)
# print("io={0} d={1} c={2} o={3}".format(io,i[ii:ii+2],i[ii+2],o))
if i[ii:ii+2] == "<-":
io -= 1
else:
io += 1
if (io == 0):
... | output | 1 | 39,527 | 1 | 79,055 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is ar... | instruction | 0 | 39,528 | 1 | 79,056 |
Yes | output | 1 | 39,528 | 1 | 79,057 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is ar... | instruction | 0 | 39,529 | 1 | 79,058 |
Yes | output | 1 | 39,529 | 1 | 79,059 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is ar... | instruction | 0 | 39,530 | 1 | 79,060 |
Yes | output | 1 | 39,530 | 1 | 79,061 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is ar... | instruction | 0 | 39,531 | 1 | 79,062 |
Yes | output | 1 | 39,531 | 1 | 79,063 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is ar... | instruction | 0 | 39,532 | 1 | 79,064 |
No | output | 1 | 39,532 | 1 | 79,065 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is ar... | instruction | 0 | 39,533 | 1 | 79,066 |
No | output | 1 | 39,533 | 1 | 79,067 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is ar... | instruction | 0 | 39,534 | 1 | 79,068 |
No | output | 1 | 39,534 | 1 | 79,069 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are trains with 26 cars or less. Each vehicle has an identification code from lowercase a to z. No vehicle has the same symbol. However, the order in which the vehicles are connected is ar... | instruction | 0 | 39,535 | 1 | 79,070 |
No | output | 1 | 39,535 | 1 | 79,071 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's topology is an undirected tree.
There are som... | instruction | 0 | 39,640 | 1 | 79,280 |
Tags: binary search, constructive algorithms, dfs and similar, graphs, greedy, trees
Correct Solution:
```
import sys
input = sys.stdin.readline
n,k=map(int,input().split())
R=[list(map(int,input().split())) for i in range(n-1)]
RDICT={tuple(sorted([R[i][0],R[i][1]])):i for i in range(n-1)}
C=[[] for i in range(n+1)... | output | 1 | 39,640 | 1 | 79,281 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's topology is an undirected tree.
There are som... | instruction | 0 | 39,641 | 1 | 79,282 |
Tags: binary search, constructive algorithms, dfs and similar, graphs, greedy, trees
Correct Solution:
```
from collections import defaultdict
from math import log2
from bisect import bisect_left
import os
import sys
from io import BytesIO, IOBase
from types import GeneratorType
BUFSIZE = 8192
class FastIO(IOBase):... | output | 1 | 39,641 | 1 | 79,283 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's topology is an undirected tree.
There are som... | instruction | 0 | 39,642 | 1 | 79,284 |
Tags: binary search, constructive algorithms, dfs and similar, graphs, greedy, trees
Correct Solution:
```
"""
#If FastIO not needed, used this and don't forget to strip
#import sys, math
#input = sys.stdin.readline
"""
import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_le... | output | 1 | 39,642 | 1 | 79,285 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's topology is an undirected tree.
There are som... | instruction | 0 | 39,643 | 1 | 79,286 |
Tags: binary search, constructive algorithms, dfs and similar, graphs, greedy, trees
Correct Solution:
```
import sys
input=sys.stdin.buffer.readline
from collections import deque
def dfs():
visited=[0 for i in range(n+1)]
queue=deque()
queue.append([1,0])
add=0
while(queue):
par=queue.pop... | output | 1 | 39,643 | 1 | 79,287 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's topology is an undirected tree.
There are som... | instruction | 0 | 39,644 | 1 | 79,288 |
Tags: binary search, constructive algorithms, dfs and similar, graphs, greedy, trees
Correct Solution:
```
# import time
def set_color(edge, colors, color):
colors[edge] = color
colors[(edge[1], edge[0])] = color
def set_node_color(node, parent, parent_color, index, bad_nodes, colors):
color = 1
for c... | output | 1 | 39,644 | 1 | 79,289 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's topology is an undirected tree.
There are som... | instruction | 0 | 39,645 | 1 | 79,290 |
Tags: binary search, constructive algorithms, dfs and similar, graphs, greedy, trees
Correct Solution:
```
n, k = map(int, input().split(' '))
deg = [0] * n
neighbors = [[] for i in range(n)]
edges = []
for i in range(n - 1):
a, b = map(int, input().split(' '))
neighbors[a - 1].append(b - 1)
neighbors[b - 1... | output | 1 | 39,645 | 1 | 79,291 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's topology is an undirected tree.
There are som... | instruction | 0 | 39,646 | 1 | 79,292 |
Tags: binary search, constructive algorithms, dfs and similar, graphs, greedy, trees
Correct Solution:
```
import sys
from collections import deque
def norm_edge(i, j):
return (i, j) if i < j else (j, i)
inpt = sys.stdin.read().split('\n')
n, k = map(int, inpt[0].split())
edges = []
for edge_str in inpt[1:n]:
... | output | 1 | 39,646 | 1 | 79,293 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's topology is an undirected tree.
There are som... | instruction | 0 | 39,647 | 1 | 79,294 |
Tags: binary search, constructive algorithms, dfs and similar, graphs, greedy, trees
Correct Solution:
```
from __future__ import print_function
import os,sys,atexit
if sys.version_info[0] < 3:
range = xrange
from cStringIO import StringIO as BytesIO
sys.stdout = BytesIO()
else:
from io import BytesIO
... | output | 1 | 39,647 | 1 | 79,295 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's... | instruction | 0 | 39,648 | 1 | 79,296 |
Yes | output | 1 | 39,648 | 1 | 79,297 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's... | instruction | 0 | 39,649 | 1 | 79,298 |
Yes | output | 1 | 39,649 | 1 | 79,299 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's... | instruction | 0 | 39,650 | 1 | 79,300 |
Yes | output | 1 | 39,650 | 1 | 79,301 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's... | instruction | 0 | 39,651 | 1 | 79,302 |
Yes | output | 1 | 39,651 | 1 | 79,303 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's... | instruction | 0 | 39,652 | 1 | 79,304 |
No | output | 1 | 39,652 | 1 | 79,305 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's... | instruction | 0 | 39,653 | 1 | 79,306 |
No | output | 1 | 39,653 | 1 | 79,307 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's... | instruction | 0 | 39,654 | 1 | 79,308 |
No | output | 1 | 39,654 | 1 | 79,309 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right — the country's... | instruction | 0 | 39,655 | 1 | 79,310 |
No | output | 1 | 39,655 | 1 | 79,311 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The intersections are numbered from 1 to n, and for eve... | instruction | 0 | 39,818 | 1 | 79,636 |
Tags: binary search, dfs and similar, dp, greedy, trees
Correct Solution:
```
from collections import deque
import sys
input = sys.stdin.buffer.readline
T = int(input())
for _ in range(T):
n = int(input())
e = [ [] for _ in range(n+1) ]
for _ in range(n-1):
a, b = map(int, input().split())
... | output | 1 | 39,818 | 1 | 79,637 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The intersections are numbered from 1 to n, and for eve... | instruction | 0 | 39,819 | 1 | 79,638 |
Tags: binary search, dfs and similar, dp, greedy, trees
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable =... | output | 1 | 39,819 | 1 | 79,639 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The intersections are numbered from 1 to n, and for eve... | instruction | 0 | 39,820 | 1 | 79,640 |
Tags: binary search, dfs and similar, dp, greedy, trees
Correct Solution:
```
def RL(): return map(int, input().split())
def RLL(): return list(map(int, input().split()))
def N(): return int(input())
def print_list(l):
print(' '.join(map(str,l)))
# sys.setrecursionlimit(100000)
# import random
# from functools... | output | 1 | 39,820 | 1 | 79,641 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The intersections are numbered from 1 to n, and for eve... | instruction | 0 | 39,821 | 1 | 79,642 |
Tags: binary search, dfs and similar, dp, greedy, trees
Correct Solution:
```
for _ in range(int(input())):
n = int(input());dic = [[] for _ in range(n + 1)];gress = [0] * (n + 1);gress[1] += 1;father = [0] * (n + 1);now = [1];s = [[] for _ in range(n + 1)];leaf = []
for _ in range(n - 1):u, v = map(int,input()... | output | 1 | 39,821 | 1 | 79,643 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The intersections are numbered from 1 to n, and for eve... | instruction | 0 | 39,822 | 1 | 79,644 |
Tags: binary search, dfs and similar, dp, greedy, trees
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
dic = [[] for _ in range(n + 1)]
gress = [0] * (n + 1)
gress[1] += 1
father = [0] * (n + 1)
for _ in range(n - 1):
u, v = map(int,input().split())
dic[u].a... | output | 1 | 39,822 | 1 | 79,645 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The intersections are numbered from 1 to n, and for eve... | instruction | 0 | 39,823 | 1 | 79,646 |
Tags: binary search, dfs and similar, dp, greedy, trees
Correct Solution:
```
from sys import stdin, stdout
from types import GeneratorType
def bootstrap(f, stack=[]):
def wrappedfunc(*args, **kwargs):
if stack:
return f(*args, **kwargs)
else:
to = f(*args, **kwargs)
... | output | 1 | 39,823 | 1 | 79,647 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The intersections are numbered from 1 to n, and for eve... | instruction | 0 | 39,824 | 1 | 79,648 |
Tags: binary search, dfs and similar, dp, greedy, trees
Correct Solution:
```
from bisect import *
from collections import *
from math import gcd,ceil,sqrt,floor,inf
from heapq import *
from itertools import *
from operator import add,mul,sub,xor,truediv,floordiv
from functools import *
#-----------------------------... | output | 1 | 39,824 | 1 | 79,649 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The intersections are numbered from 1 to n, and for eve... | instruction | 0 | 39,825 | 1 | 79,650 |
Tags: binary search, dfs and similar, dp, greedy, trees
Correct Solution:
```
import sys
# region fastio
input = lambda: sys.stdin.readline()
# ------------------------------
def RL(): return map(int, sys.stdin.readline().split())
def RLL(): return list(map(int, sys.stdin.readline().split()))
def N(): return int(in... | output | 1 | 39,825 | 1 | 79,651 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The inte... | instruction | 0 | 39,826 | 1 | 79,652 |
Yes | output | 1 | 39,826 | 1 | 79,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The inte... | instruction | 0 | 39,827 | 1 | 79,654 |
Yes | output | 1 | 39,827 | 1 | 79,655 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The inte... | instruction | 0 | 39,828 | 1 | 79,656 |
No | output | 1 | 39,828 | 1 | 79,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The inte... | instruction | 0 | 39,829 | 1 | 79,658 |
No | output | 1 | 39,829 | 1 | 79,659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The inte... | instruction | 0 | 39,830 | 1 | 79,660 |
No | output | 1 | 39,830 | 1 | 79,661 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gildong is playing with his dog, Badugi. They're at a park that has n intersections and n-1 bidirectional roads, each 1 meter in length and connecting two intersections with each other. The inte... | instruction | 0 | 39,831 | 1 | 79,662 |
No | output | 1 | 39,831 | 1 | 79,663 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The territory of Berland is represented by a rectangular field n × m in size. The king of Berland lives in the capital, located on the upper left square (1, 1). The lower right square has coordinates (n, m). One day the king decided to trave... | instruction | 0 | 39,955 | 1 | 79,910 |
Tags: brute force, constructive algorithms, implementation
Correct Solution:
```
def inRows():
print(0)
row = 1
column = 1
print(row, column)
while row <= n:
if row % 2 == 1:
column = 2
while column <= m:
print(row, column)
column += 1
... | output | 1 | 39,955 | 1 | 79,911 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The territory of Berland is represented by a rectangular field n × m in size. The king of Berland lives in the capital, located on the upper left square (1, 1). The lower right square has coordinates (n, m). One day the king decided to trave... | instruction | 0 | 39,956 | 1 | 79,912 |
Tags: brute force, constructive algorithms, implementation
Correct Solution:
```
def d(a, b):
print(a+1, b)
return (a+1, b)
def u(a, b):
print(a-1, b)
return (a-1, b)
def l(a, b):
print(a, b-1)
return (a, b-1)
def r(a, b):
print(a, b+1)
return (a, b+1)
a, b = map(int, input().split... | output | 1 | 39,956 | 1 | 79,913 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The territory of Berland is represented by a rectangular field n × m in size. The king of Berland lives in the capital, located on the upper left square (1, 1). The lower right square has coordinates (n, m). One day the king decided to trave... | instruction | 0 | 39,957 | 1 | 79,914 |
Tags: brute force, constructive algorithms, implementation
Correct Solution:
```
#!/usr/bin/env python3
from sys import stdin
input_tokens = stdin.readline()
tokens = [int(x) for x in input_tokens.split()]
assert len(tokens) == 2
n, m = tokens[0], tokens[1]
if n == 1 and m > 2:
print(1)
print(n,m,1,1)
... | output | 1 | 39,957 | 1 | 79,915 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The territory of Berland is represented by a rectangular field n × m in size. The king of Berland lives in the capital, located on the upper left square (1, 1). The lower right square has coordinates (n, m). One day the king decided to trave... | instruction | 0 | 39,958 | 1 | 79,916 |
Tags: brute force, constructive algorithms, implementation
Correct Solution:
```
import sys
from array import array # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
n, m = map(int, input().split())
ans = ['1 1']
warp = [-1] * 4
if n == 1 and m == 2:
ans.append('1 2')
elif n == ... | output | 1 | 39,958 | 1 | 79,917 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The territory of Berland is represented by a rectangular field n × m in size. The king of Berland lives in the capital, located on the upper left square (1, 1). The lower right square has coordinates (n, m). One day the king decided to trave... | instruction | 0 | 39,959 | 1 | 79,918 |
Tags: brute force, constructive algorithms, implementation
Correct Solution:
```
def d(a, b):
print(a+1, b)
return (a+1, b)
def u(a, b):
print(a-1, b)
return (a-1, b)
def l(a, b):
print(a, b-1)
return (a, b-1)
def r(a, b):
print(a, b+1)
return (a, b+1)
a, b = map(... | output | 1 | 39,959 | 1 | 79,919 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The territory of Berland is represented by a rectangular field n × m in size. The king of Berland lives in the capital, located on the upper left square (1, 1). The lower right square has coordinates (n, m). One day the king decided to trave... | instruction | 0 | 39,960 | 1 | 79,920 |
Tags: brute force, constructive algorithms, implementation
Correct Solution:
```
def p(a, b, swap):
if swap:
a, b = b, a
print(a, b)
n, m = [int(x) for x in input().split()]
if (n == 1 or m == 1) and n * m > 2:
print(1)
print(n, m, 1, 1)
for r in range(n):
for c in range(m):
... | output | 1 | 39,960 | 1 | 79,921 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.