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 tags and a correct Python 3 solution for this coding contest problem.
In this problem we assume the Earth to be a completely round ball and its surface a perfect sphere. The length of the equator and any meridian is considered to be exactly 40 000 kilometers. Thus, travelling from North Pole to South Pole or v... | instruction | 0 | 6,262 | 1 | 12,524 |
Tags: geometry, implementation
Correct Solution:
```
n=int(input())
w=0
e=0
y=0
r=0
for i in range(n):
d,v=input().split(" ")
d=int(d)
if v=='North':
y-=d
elif v=='South':
y+=d
elif (v=='West' or v=='East') and (y==0 or y==20000):
r=-1
if y<0 or y>20000:
r=-1
if r... | output | 1 | 6,262 | 1 | 12,525 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem we assume the Earth to be a completely round ball and its surface a perfect sphere. The length of the equator and any meridian is considered to be exactly 40 000 kilometers. Thus, travelling from North Pole to South Pole or v... | instruction | 0 | 6,263 | 1 | 12,526 |
Tags: geometry, implementation
Correct Solution:
```
n = int(input())
y = 0
maxlen = 20000
for i in range(n):
raw = input().split()
cur = int(raw[0])
dir = raw[1]
if y == 0 and dir != 'South':
print('NO')
quit()
if y == maxlen and dir != 'North':
print('NO')
quit()
... | output | 1 | 6,263 | 1 | 12,527 |
Provide tags and a correct Python 3 solution for this coding contest problem.
In this problem we assume the Earth to be a completely round ball and its surface a perfect sphere. The length of the equator and any meridian is considered to be exactly 40 000 kilometers. Thus, travelling from North Pole to South Pole or v... | instruction | 0 | 6,264 | 1 | 12,528 |
Tags: geometry, implementation
Correct Solution:
```
n = int(input())
ans = 'YES'
p = 0
for _ in range(n):
t, d = input().split()
if d == 'South':
p += int(t)
if p > 20000:
ans = 'NO'
break
elif d == 'North':
p -= int(t)
if p < 0:
ans = '... | output | 1 | 6,264 | 1 | 12,529 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities in Berland. Some pairs of them are connected with m directed roads. One can use only these roads to move from one city to another. There are no roads that connect a city to it... | instruction | 0 | 6,297 | 1 | 12,594 |
No | output | 1 | 6,297 | 1 | 12,595 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities in Berland. Some pairs of them are connected with m directed roads. One can use only these roads to move from one city to another. There are no roads that connect a city to it... | instruction | 0 | 6,298 | 1 | 12,596 |
No | output | 1 | 6,298 | 1 | 12,597 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities in Berland. Some pairs of them are connected with m directed roads. One can use only these roads to move from one city to another. There are no roads that connect a city to it... | instruction | 0 | 6,299 | 1 | 12,598 |
No | output | 1 | 6,299 | 1 | 12,599 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are n cities in Berland. Some pairs of them are connected with m directed roads. One can use only these roads to move from one city to another. There are no roads that connect a city to it... | instruction | 0 | 6,300 | 1 | 12,600 |
No | output | 1 | 6,300 | 1 | 12,601 |
Provide a correct Python 3 solution for this coding contest problem.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i)... | instruction | 0 | 6,445 | 1 | 12,890 |
"Correct Solution:
```
N, M, Q = map(int, input().split())
train = [[0]*(N+1) for _ in range(N+1)]
for i in range(M):
a, b = map(int, input().split())
train[a][b] += 1
for i in range(1, N+1):
for j in range(1, N+1):
train[i][j] += train[i][j-1]
for i in range(Q):
ans = 0
l, r = map(int, input().spli... | output | 1 | 6,445 | 1 | 12,891 |
Provide a correct Python 3 solution for this coding contest problem.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i)... | instruction | 0 | 6,446 | 1 | 12,892 |
"Correct Solution:
```
n,m,q=map(int,input().split())
t=[[0]*(1+n) for _ in range(1+n)]
for i in range(m):
l,r=map(int,input().split())
t[l][r]+=1
for i in range(n):
for j in range(n):
t[i+1][j+1]+=t[i+1][j]+t[i][j+1]-t[i][j]
for i in range(q):
p,q=map(int,input().split())
p-=1
print(t[... | output | 1 | 6,446 | 1 | 12,893 |
Provide a correct Python 3 solution for this coding contest problem.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i)... | instruction | 0 | 6,447 | 1 | 12,894 |
"Correct Solution:
```
from itertools import accumulate
N, M, Q, *I = map(int, open(0).read().split())
LR, PQ = I[:2 * M], I[2 * M:]
M = [[0] * (N + 1) for _ in range(N + 1)]
for l, r in zip(*[iter(LR)] * 2):
M[l][r] += 1
A = [list(accumulate(reversed(a)))[::-1] for a in zip(*[accumulate(m) for m in M])]
for p,... | output | 1 | 6,447 | 1 | 12,895 |
Provide a correct Python 3 solution for this coding contest problem.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i)... | instruction | 0 | 6,448 | 1 | 12,896 |
"Correct Solution:
```
n,m,q=map(int,input().split())
tpos=[[0]*(n+1) for _ in range(n+1)]
for _ in range(m):
l,r=map(int,input().split())
tpos[l][r]+=1
for i in range(1,n+1):
for j in range(1,n+1):
tpos[i][j]=tpos[i][j]+tpos[i-1][j]+tpos[i][j-1]-tpos[i-1][j-1]
for _ in range(q):
l,r=map(int,input().split()... | output | 1 | 6,448 | 1 | 12,897 |
Provide a correct Python 3 solution for this coding contest problem.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i)... | instruction | 0 | 6,449 | 1 | 12,898 |
"Correct Solution:
```
import bisect
N,M,Q=map(int,input().split())
LR=[[0]*(N+1) for _ in range(N)]
for i in range(M):
l,r=map(int,input().split())
LR[l-1][r]+=1
for i in range(N):
for j in range(1,N+1):
LR[i][j]+=LR[i][j-1]
for _ in range(Q):
ans=0
p,q=map(int,input().split())
for i in range(p-1,q)... | output | 1 | 6,449 | 1 | 12,899 |
Provide a correct Python 3 solution for this coding contest problem.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i)... | instruction | 0 | 6,450 | 1 | 12,900 |
"Correct Solution:
```
N, M, Q = map(int, input().split())
G = [[0]*(N+1) for _ in range(N+1)]
for _ in range(M):
L, R = map(int, input().split())
G[L][R] += 1
for i in range(N+1):
for j in range(1, N+1):
G[i][j] += G[i][j-1]
for _ in range(Q):
p, q = map(int, input().split())
ans = 0
for i in range... | output | 1 | 6,450 | 1 | 12,901 |
Provide a correct Python 3 solution for this coding contest problem.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i)... | instruction | 0 | 6,451 | 1 | 12,902 |
"Correct Solution:
```
N,M,Q = map(int,input().split())
LR = [[0 for _ in range(N)] for _ in range(N)]
for j in range(M):
l,r = map(int,input().split())
LR[l-1][r-1] += 1
for i in range(N):
for j in range(1,N):
LR[i][j] += LR[i][j-1]
for _ in range(Q):
p,q = map(int,input().split())
ans = 0
for i in ... | output | 1 | 6,451 | 1 | 12,903 |
Provide a correct Python 3 solution for this coding contest problem.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i)... | instruction | 0 | 6,452 | 1 | 12,904 |
"Correct Solution:
```
n,m,Q = map(int,input().split())
a = []
for i in range(n+1):
a.append([0]*(n+1))
s = a[:]
for i in range(m):
l,r = map(int,input().split())
a[l][r] += 1
for l in range(1,n+1):
for r in range(1,n+1):
s[l][r] = a[l][r] + s[l-1][r] + s[l][r-1] - s[l-1][r-1]
for i in range(Q):
p,q =... | output | 1 | 6,452 | 1 | 12,905 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs f... | instruction | 0 | 6,453 | 1 | 12,906 |
Yes | output | 1 | 6,453 | 1 | 12,907 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs f... | instruction | 0 | 6,454 | 1 | 12,908 |
Yes | output | 1 | 6,454 | 1 | 12,909 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs f... | instruction | 0 | 6,455 | 1 | 12,910 |
Yes | output | 1 | 6,455 | 1 | 12,911 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs f... | instruction | 0 | 6,456 | 1 | 12,912 |
Yes | output | 1 | 6,456 | 1 | 12,913 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs f... | instruction | 0 | 6,457 | 1 | 12,914 |
No | output | 1 | 6,457 | 1 | 12,915 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs f... | instruction | 0 | 6,458 | 1 | 12,916 |
No | output | 1 | 6,458 | 1 | 12,917 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs f... | instruction | 0 | 6,459 | 1 | 12,918 |
No | output | 1 | 6,459 | 1 | 12,919 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs f... | instruction | 0 | 6,460 | 1 | 12,920 |
No | output | 1 | 6,460 | 1 | 12,921 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The new pedestrian zone in Moscow city center consists of n squares connected with each other by n - 1 footpaths. We define a simple path as a sequence of squares such that no square appears in ... | instruction | 0 | 6,661 | 1 | 13,322 |
No | output | 1 | 6,661 | 1 | 13,323 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The new pedestrian zone in Moscow city center consists of n squares connected with each other by n - 1 footpaths. We define a simple path as a sequence of squares such that no square appears in ... | instruction | 0 | 6,662 | 1 | 13,324 |
No | output | 1 | 6,662 | 1 | 13,325 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider a road consisting of several rows. Each row is divided into several rectangular tiles, and all tiles in the same row are equal. The first row contains exactly one rectangular tile. Look... | instruction | 0 | 6,826 | 1 | 13,652 |
No | output | 1 | 6,826 | 1 | 13,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider a road consisting of several rows. Each row is divided into several rectangular tiles, and all tiles in the same row are equal. The first row contains exactly one rectangular tile. Look... | instruction | 0 | 6,827 | 1 | 13,654 |
No | output | 1 | 6,827 | 1 | 13,655 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider a road consisting of several rows. Each row is divided into several rectangular tiles, and all tiles in the same row are equal. The first row contains exactly one rectangular tile. Look... | instruction | 0 | 6,828 | 1 | 13,656 |
No | output | 1 | 6,828 | 1 | 13,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Consider a road consisting of several rows. Each row is divided into several rectangular tiles, and all tiles in the same row are equal. The first row contains exactly one rectangular tile. Look... | instruction | 0 | 6,829 | 1 | 13,658 |
No | output | 1 | 6,829 | 1 | 13,659 |
Provide a correct Python 3 solution for this coding contest problem.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (t... | instruction | 0 | 7,386 | 1 | 14,772 |
"Correct Solution:
```
N=int(input())
city=[0]*N
for i in range(N):
x,y=map(int,input().split())
city[i]=(i,x,y)
city.sort(key=lambda x:x[1])
data=[(city[i][0],city[i+1][0],city[i+1][1]-city[i][1]) for i in range(N-1)]
city.sort(key=lambda x:x[2])
data+=[(city[i][0],city[i+1][0],city[i+1][2]-city[i][2]) for i i... | output | 1 | 7,386 | 1 | 14,773 |
Provide a correct Python 3 solution for this coding contest problem.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (t... | instruction | 0 | 7,387 | 1 | 14,774 |
"Correct Solution:
```
# coding: utf-8
import heapq
n=int(input())
p=[]
d=[[] for i in range(n)]
for i in range(n):
p.append(tuple(map(int,input().split()))+tuple([i]))
x_sorted=sorted(p,key=lambda x:x[0])
y_sorted=sorted(p,key=lambda x:x[1])
for i in range(n-1):
d[x_sorted[i][2]].append((x_sorted[i+1][0]-x_sor... | output | 1 | 7,387 | 1 | 14,775 |
Provide a correct Python 3 solution for this coding contest problem.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (t... | instruction | 0 | 7,388 | 1 | 14,776 |
"Correct Solution:
```
#!/usr/bin python3
# -*- coding: utf-8 -*-
#最小全域木 クラスカル法
# 重み付き無向グラフで、それらの全ての頂点を結び連結するような木の最小のコストを求める
# 辺の重みの小さい順にみて、連結成分が閉路にならない辺を追加していく
# つなぐ頂点が同じ連結成分にないことをUnion Find Tree でみる
INF = float('inf')
class UnionFind():
def __init__(self, n): #初期化
self.n = n
# 親
se... | output | 1 | 7,388 | 1 | 14,777 |
Provide a correct Python 3 solution for this coding contest problem.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (t... | instruction | 0 | 7,389 | 1 | 14,778 |
"Correct Solution:
```
from heapq import heappush, heappop
# 入力
N = int(input())
x, y = (
zip(*(map(int, input().split()) for _ in range(N))) if N else
((), ())
)
# x座標およびy座標について街をソートし、ソート後に隣り合う街を辺で結んだ重み付きグラフを作成する
# 作成したグラフに対してプリム法により解を求める
ts = list(zip(range(1, N + 1), x, y))
ts_x = sorted(ts, key=lambda t:... | output | 1 | 7,389 | 1 | 14,779 |
Provide a correct Python 3 solution for this coding contest problem.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (t... | instruction | 0 | 7,390 | 1 | 14,780 |
"Correct Solution:
```
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
a = sorted(a)
gra = []
for i in range(n):
a[i].append(i)
for i in range(n-1):
gra.append([a[i][2],a[i+1][2],a[i+1][0]-a[i][0]])
a = sorted(a,key= lambda x:x[1])
for i in range(n-1):
gra.append([a[i][2],a[i+1][2],a[i+1]... | output | 1 | 7,390 | 1 | 14,781 |
Provide a correct Python 3 solution for this coding contest problem.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (t... | instruction | 0 | 7,391 | 1 | 14,782 |
"Correct Solution:
```
from heapq import heapify, heappop, heappush
n = int(input())
x_loc, y_loc = [], []
for i in range(n):
x, y = map(int, input().split())
x_loc.append((x, i))
y_loc.append((y, i))
x_loc.sort()
y_loc.sort()
links = [set() for _ in range(n)]
for (x1, i1), (x2, i2) in zip(x_loc, x_loc[1:]... | output | 1 | 7,391 | 1 | 14,783 |
Provide a correct Python 3 solution for this coding contest problem.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (t... | instruction | 0 | 7,392 | 1 | 14,784 |
"Correct Solution:
```
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import *
from bisect import *
def read():
return int(input())
def reads():
return [int(x) for x in input().split()]
setrecursionlimit(1 << 30)
class union_find:
def __i... | output | 1 | 7,392 | 1 | 14,785 |
Provide a correct Python 3 solution for this coding contest problem.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (t... | instruction | 0 | 7,393 | 1 | 14,786 |
"Correct Solution:
```
class UnionFindNode:
def __init__(self, group_id, parent=None, value=None):
self.group_id_ = group_id
self.parent_ = parent
self.value = value
self.rank_ = 1
self.member_num_ = 1
def is_root(self):
return not self.parent_
def root(self... | output | 1 | 7,393 | 1 | 14,787 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinat... | instruction | 0 | 7,394 | 1 | 14,788 |
Yes | output | 1 | 7,394 | 1 | 14,789 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinat... | instruction | 0 | 7,395 | 1 | 14,790 |
Yes | output | 1 | 7,395 | 1 | 14,791 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinat... | instruction | 0 | 7,396 | 1 | 14,792 |
Yes | output | 1 | 7,396 | 1 | 14,793 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinat... | instruction | 0 | 7,397 | 1 | 14,794 |
Yes | output | 1 | 7,397 | 1 | 14,795 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinat... | instruction | 0 | 7,398 | 1 | 14,796 |
No | output | 1 | 7,398 | 1 | 14,797 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinat... | instruction | 0 | 7,399 | 1 | 14,798 |
No | output | 1 | 7,399 | 1 | 14,799 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinat... | instruction | 0 | 7,400 | 1 | 14,800 |
No | output | 1 | 7,400 | 1 | 14,801 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates.
You can build a road between two towns at coordinat... | instruction | 0 | 7,401 | 1 | 14,802 |
No | output | 1 | 7,401 | 1 | 14,803 |
Provide a correct Python 3 solution for this coding contest problem.
The Aizu Wakamatsu city office decided to lay a hot water pipeline covering the whole area of the city to heat houses. The pipeline starts from some hot springs and connects every district in the city. The pipeline can fork at a hot spring or a distr... | instruction | 0 | 7,442 | 1 | 14,884 |
"Correct Solution:
```
while(1):
s,d=[int(x) for x in input().split()]
A=[999 for x in range(d)]
if s==0: break
for j in range(s):
l=[int(x) for x in input().split()]
for i in range(d):
if l[i]!=0:
A[i]=min(A[i], l[i])
B=[[999 for x in range(d)] for y ... | output | 1 | 7,442 | 1 | 14,885 |
Provide a correct Python 3 solution for this coding contest problem.
The Aizu Wakamatsu city office decided to lay a hot water pipeline covering the whole area of the city to heat houses. The pipeline starts from some hot springs and connects every district in the city. The pipeline can fork at a hot spring or a distr... | instruction | 0 | 7,443 | 1 | 14,886 |
"Correct Solution:
```
# AOJ 1014: Computation of Minimum Length of Pipeline
# Python3 2018.7.5 bal4u
import sys
from sys import stdin
input = stdin.readline
import heapq
while True:
s, d = map(int, input().split())
if s == 0: break
visited = [0]*100
Q = []
to = [[] for i in range(100)]
for i in range(s):
vis... | output | 1 | 7,443 | 1 | 14,887 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Aizu Wakamatsu city office decided to lay a hot water pipeline covering the whole area of the city to heat houses. The pipeline starts from some hot springs and connects every district in th... | instruction | 0 | 7,444 | 1 | 14,888 |
No | output | 1 | 7,444 | 1 | 14,889 |
Provide a correct Python 3 solution for this coding contest problem.
Despite urging requests of the townspeople, the municipal office cannot afford to improve many of the apparently deficient city amenities under this recession. The city swimming pool is one of the typical examples. It has only two swimming lanes. The... | instruction | 0 | 7,456 | 1 | 14,912 |
"Correct Solution:
```
from collections import deque
while 1:
N = int(input())
if N == 0:
break
T = [0]*N; C = [0]*N
que0 = deque()
que1 = deque()
P = [list(map(int, input().split())) for i in range(N)]
P.sort()
for i in range(N):
t, c = P[i]
que0.append((i, t))
... | output | 1 | 7,456 | 1 | 14,913 |
Provide a correct Python 3 solution for this coding contest problem.
Despite urging requests of the townspeople, the municipal office cannot afford to improve many of the apparently deficient city amenities under this recession. The city swimming pool is one of the typical examples. It has only two swimming lanes. The... | instruction | 0 | 7,457 | 1 | 14,914 |
"Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int... | output | 1 | 7,457 | 1 | 14,915 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.