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
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,889
14
103,778
No
output
1
51,889
14
103,779
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,890
14
103,780
No
output
1
51,890
14
103,781
Evaluate the correctness of the submitted Python 2 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,891
14
103,782
No
output
1
51,891
14
103,783
Provide a correct Python 3 solution for this coding contest problem. Problem Uniqlo Uzuki and Rin Meguro are coming to SEARIGHT LIVE FES for sale. As shown in the figure below, the product sales line consists of two lines, with W people in the horizontal direction and H people in the vertical direction, forming a U-s...
instruction
0
52,130
14
104,260
"Correct Solution: ``` pos = [[0,0], [1,0]] way = [[0,1], [0,1]] ans = 0 w, h = map(int, input().split()) n = int(input()) li = list(map(int, input().split())) for p in li: ni = pos[p][0]+way[p][0] nj = pos[p][1]+way[p][1] if p == 0: if nj >= w or ni >= h: way[p][0],way[p][1]=way[p][1],-...
output
1
52,130
14
104,261
Provide a correct Python 3 solution for this coding contest problem. Problem Uniqlo Uzuki and Rin Meguro are coming to SEARIGHT LIVE FES for sale. As shown in the figure below, the product sales line consists of two lines, with W people in the horizontal direction and H people in the vertical direction, forming a U-s...
instruction
0
52,131
14
104,262
"Correct Solution: ``` w,h = map(int, input().split()) n = int(input()) p = list(map(int, input().split())) u = m = cnt = 0 for i in range(n): if p[i] == 0: u += 1 else: m += 1 if u <= w-2: if u == m: cnt += 1 elif w <= u <= w+h-3: if u == m+2: cnt...
output
1
52,131
14
104,263
Provide a correct Python 3 solution for this coding contest problem. Problem Uniqlo Uzuki and Rin Meguro are coming to SEARIGHT LIVE FES for sale. As shown in the figure below, the product sales line consists of two lines, with W people in the horizontal direction and H people in the vertical direction, forming a U-s...
instruction
0
52,132
14
104,264
"Correct Solution: ``` # AOJ 1575: Product Sale Lines # Python3 2018.7.13 bal4u W, H = map(int, input().split()) N = int(input()) P = list(map(int, input().split())) ans = x = y = 0 for p in P: if p == 0: x += 1 else: y += 1 if x < W-1: if x == y: ans += 1 elif x == W-1: pass elif x < W+H-2: if x == y+2: ans ...
output
1
52,132
14
104,265
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Problem Uniqlo Uzuki and Rin Meguro are coming to SEARIGHT LIVE FES for sale. As shown in the figure below, the product sales line consists of two lines, with W people in the horizontal directi...
instruction
0
52,133
14
104,266
No
output
1
52,133
14
104,267
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Problem Uniqlo Uzuki and Rin Meguro are coming to SEARIGHT LIVE FES for sale. As shown in the figure below, the product sales line consists of two lines, with W people in the horizontal directi...
instruction
0
52,134
14
104,268
No
output
1
52,134
14
104,269
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Problem Uniqlo Uzuki and Rin Meguro are coming to SEARIGHT LIVE FES for sale. As shown in the figure below, the product sales line consists of two lines, with W people in the horizontal directi...
instruction
0
52,135
14
104,270
No
output
1
52,135
14
104,271
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Problem Uniqlo Uzuki and Rin Meguro are coming to SEARIGHT LIVE FES for sale. As shown in the figure below, the product sales line consists of two lines, with W people in the horizontal directi...
instruction
0
52,136
14
104,272
No
output
1
52,136
14
104,273
Provide tags and a correct Python 3 solution for this coding contest problem. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, they invited all their friends. Now n cats are ...
instruction
0
52,266
14
104,532
Tags: greedy, math Correct Solution: ``` n,m=map(int,input().split()) print(min(max(m,1),n-m)) ```
output
1
52,266
14
104,533
Provide tags and a correct Python 3 solution for this coding contest problem. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, they invited all their friends. Now n cats are ...
instruction
0
52,267
14
104,534
Tags: greedy, math Correct Solution: ``` K=list(map(int, input().strip().split())) n=K[0] m=K[1] if m>=n/2: print(n-m) elif m==0: print(1) else: print(m) ```
output
1
52,267
14
104,535
Provide tags and a correct Python 3 solution for this coding contest problem. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, they invited all their friends. Now n cats are ...
instruction
0
52,268
14
104,536
Tags: greedy, math Correct Solution: ``` n, m = map(int, input().split()) k = n//2 if m == 0: print(1) elif m <= k: print(m) else: print(n-m) ```
output
1
52,268
14
104,537
Provide tags and a correct Python 3 solution for this coding contest problem. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, they invited all their friends. Now n cats are ...
instruction
0
52,269
14
104,538
Tags: greedy, math Correct Solution: ``` from sys import stdin n,m=map(int,stdin.readline().split()) if m==0: print(1) elif n==m: print(0) else: if m>n//2: print(n-m) else: print(m) ```
output
1
52,269
14
104,539
Provide tags and a correct Python 3 solution for this coding contest problem. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, they invited all their friends. Now n cats are ...
instruction
0
52,270
14
104,540
Tags: greedy, math Correct Solution: ``` import sys def res(n, m): if m == 0: print("1") return if m <= n/2: print(m) else: print(n-m) n, m = map(int, input().split()) res(n, m) ```
output
1
52,270
14
104,541
Provide tags and a correct Python 3 solution for this coding contest problem. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, they invited all their friends. Now n cats are ...
instruction
0
52,271
14
104,542
Tags: greedy, math Correct Solution: ``` n, m = map(int, input().split(' ')) pairs = n // 2 if n == m: print(0) elif m == 0 or m == 1: print(1) elif m <= pairs: print(m) elif n % 2 and m == pairs + 1: print(pairs) else: print(n - m) ```
output
1
52,271
14
104,543
Provide tags and a correct Python 3 solution for this coding contest problem. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, they invited all their friends. Now n cats are ...
instruction
0
52,272
14
104,544
Tags: greedy, math Correct Solution: ``` a = [int(i) for i in input().split()] n =a[0] m=a[1] if(m==0): print(1) elif(n%2==0): if(m==1): print(1) elif(m <= n//2): print(m) else: print(n-m) else: if(m==1): print(1) elif(m <= n//2): print(m) else: print(n-m) ```
output
1
52,272
14
104,545
Provide tags and a correct Python 3 solution for this coding contest problem. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, they invited all their friends. Now n cats are ...
instruction
0
52,273
14
104,546
Tags: greedy, math Correct Solution: ``` n,m = map(int, input().strip().split(' ')) if n==m: print('0') elif m==0 or m==n-1: print('1') #n is even elif n%2==0: p=n//2 if p==m: print(p) elif m<p: print(m) else: print(2*p-m) #n is odd elif n%2!=0: p=(n//2)...
output
1
52,273
14
104,547
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, ...
instruction
0
52,274
14
104,548
Yes
output
1
52,274
14
104,549
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, ...
instruction
0
52,275
14
104,550
Yes
output
1
52,275
14
104,551
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, ...
instruction
0
52,276
14
104,552
Yes
output
1
52,276
14
104,553
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, ...
instruction
0
52,277
14
104,554
Yes
output
1
52,277
14
104,555
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, ...
instruction
0
52,278
14
104,556
No
output
1
52,278
14
104,557
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, ...
instruction
0
52,279
14
104,558
No
output
1
52,279
14
104,559
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, ...
instruction
0
52,280
14
104,560
No
output
1
52,280
14
104,561
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party... What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, ...
instruction
0
52,281
14
104,562
No
output
1
52,281
14
104,563
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Fox Ciel is in the Amusement Park. And now she is in a queue in front of the Ferris wheel. There are n people (or foxes more precisely) in the queue: we use first people to refer one at the head...
instruction
0
52,540
14
105,080
No
output
1
52,540
14
105,081
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Fox Ciel is in the Amusement Park. And now she is in a queue in front of the Ferris wheel. There are n people (or foxes more precisely) in the queue: we use first people to refer one at the head...
instruction
0
52,541
14
105,082
No
output
1
52,541
14
105,083
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Fox Ciel is in the Amusement Park. And now she is in a queue in front of the Ferris wheel. There are n people (or foxes more precisely) in the queue: we use first people to refer one at the head...
instruction
0
52,542
14
105,084
No
output
1
52,542
14
105,085
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Fox Ciel is in the Amusement Park. And now she is in a queue in front of the Ferris wheel. There are n people (or foxes more precisely) in the queue: we use first people to refer one at the head...
instruction
0
52,543
14
105,086
No
output
1
52,543
14
105,087
Provide tags and a correct Python 3 solution for this coding contest problem. A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You shou...
instruction
0
52,603
14
105,206
Tags: implementation, math Correct Solution: ``` n = int(input()) if n & n-1: print("NO") else: print("YES") ```
output
1
52,603
14
105,207
Provide tags and a correct Python 3 solution for this coding contest problem. A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You shou...
instruction
0
52,604
14
105,208
Tags: implementation, math Correct Solution: ``` n=int(input()) tri=[] for i in range(2,2009): tri.append(i*(i+1)//2) if n==1: print('YES') exit() check=[0]*n for i in range(2*n+5): check[tri[i]%n]=1 if n&(n-1)==0: print('YES') else: print('NO') ```
output
1
52,604
14
105,209
Provide tags and a correct Python 3 solution for this coding contest problem. A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You shou...
instruction
0
52,605
14
105,210
Tags: implementation, math Correct Solution: ``` n, c, k = int(input()), 0, 0 v = [[False] * n for i in range(n)] while not v[c][k]: v[c][k] = True k = (k + 1) % n c = (c + k) % n print('YES' if all(any(x) for x in v) else 'NO') ```
output
1
52,605
14
105,211
Provide tags and a correct Python 3 solution for this coding contest problem. A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You shou...
instruction
0
52,606
14
105,212
Tags: implementation, math Correct Solution: ``` from sys import stdin, stdout from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log from collections import defaultdict as dd, deque from heapq import merge, heapify, heappop, heappush, nsmallest from bisect import bisect_left as bl, bisect_right as br, bise...
output
1
52,606
14
105,213
Provide tags and a correct Python 3 solution for this coding contest problem. A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You shou...
instruction
0
52,607
14
105,214
Tags: implementation, math Correct Solution: ``` class CodeforcesTask55ASolution: def __init__(self): self.result = '' self.n = 0 def read_input(self): self.n = int(input()) def process_task(self): hassocks = [x + 1 for x in range(self.n)] visits = set() vis...
output
1
52,607
14
105,215
Provide tags and a correct Python 3 solution for this coding contest problem. A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You shou...
instruction
0
52,608
14
105,216
Tags: implementation, math Correct Solution: ``` i = int(input()) mods = [0] * i k = 0 for j in range(i): k += j mods[k % i] = 1 if all(m == 1 for m in mods): print("YES") else: print("NO") ```
output
1
52,608
14
105,217
Provide tags and a correct Python 3 solution for this coding contest problem. A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You shou...
instruction
0
52,609
14
105,218
Tags: implementation, math Correct Solution: ``` n = int(input()) visited = [False] * n k = 0 for i in range(n ** 2 + 1): k += i + 1 visited[k % n] = True for i in visited: if not i: print("NO") exit() print("YES") ```
output
1
52,609
14
105,219
Provide tags and a correct Python 3 solution for this coding contest problem. A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You shou...
instruction
0
52,610
14
105,220
Tags: implementation, math Correct Solution: ``` n = int(input()) if n & (n-1) > 0: print('NO') else: print('YES') ```
output
1
52,610
14
105,221
Provide a correct Python 3 solution for this coding contest problem. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming for a snack someday, started an investigation to find th...
instruction
0
52,937
14
105,874
"Correct Solution: ``` visited = [] def dfs(v): for i in edges[v]: if i not in visited: dfs(i) visited.append(v) if __name__ == '__main__': m = int(input()) n = int(input()) evidences = [] edges = [[] for i in range(m)] for i in range(n): x, y = map(int, input()...
output
1
52,937
14
105,875
Provide a correct Python 3 solution for this coding contest problem. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming for a snack someday, started an investigation to find th...
instruction
0
52,938
14
105,876
"Correct Solution: ``` #トポロジカルソート m = int(input()) n = int(input()) edges = [[] for _ in range(m)] for _ in range(n): x, y = map(int, input().split()) edges[x - 1].append(y - 1) visited = [False for _ in range(m)] sorted_lst = [] def visit(i): if not visited[i]: visited[i] = True for to in edges[i]: ...
output
1
52,938
14
105,877
Provide a correct Python 3 solution for this coding contest problem. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming for a snack someday, started an investigation to find th...
instruction
0
52,939
14
105,878
"Correct Solution: ``` from collections import deque def solve(): M = int(input()) G = [[] for i in range(M)] deg = [0]*M N = int(input()) for i in range(N): x, y = map(int, input().split()) G[x-1].append(y-1) deg[y-1] += 1 que = deque() ans = [] for i in range(M)...
output
1
52,939
14
105,879
Provide a correct Python 3 solution for this coding contest problem. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming for a snack someday, started an investigation to find th...
instruction
0
52,940
14
105,880
"Correct Solution: ``` # -*- coding: utf-8 -*- import sys import os import math m = int(input()) n = int(input()) # Manage people who entered earlier than me in a list G = [[] for i in range(m)] for i in range(n): x, y = map(int, input().split()) x -= 1 y -= 1 G[y].append(x) printed = [False] * m ...
output
1
52,940
14
105,881
Provide a correct Python 3 solution for this coding contest problem. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming for a snack someday, started an investigation to find th...
instruction
0
52,941
14
105,882
"Correct Solution: ``` m = int(input()) n = int(input()) X = [0 for i in range(n)] Y = [0 for i in range(n)] for l in range(n): X[l],Y[l] = [int(i) for i in input().split()] ans = [] while True: flag = True for i in range(1, m+1): if not (i in Y) and not (i in ans): ans.append(i) ...
output
1
52,941
14
105,883
Provide a correct Python 3 solution for this coding contest problem. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming for a snack someday, started an investigation to find th...
instruction
0
52,942
14
105,884
"Correct Solution: ``` visited = [] def dfs(v): for i in edges[v]: if i not in visited: dfs(i) visited.append(v) if __name__ == '__main__': m = int(input()) n = int(input()) edges = [[] for i in range(m)] for i in range(n): x, y = map(int, input().split()) e...
output
1
52,942
14
105,885
Provide a correct Python 3 solution for this coding contest problem. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming for a snack someday, started an investigation to find th...
instruction
0
52,943
14
105,886
"Correct Solution: ``` m = int(input()) n = int(input()) edges = [[] for _ in range(m)] for _ in range(n): x,y = map(int,input().split()) edges[x-1].append(y-1) L = [] visited = [False]*m def visit(node): if not visited[node]: visited[node] = True for nn in edges[node]: visit(nn)...
output
1
52,943
14
105,887
Provide a correct Python 3 solution for this coding contest problem. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming for a snack someday, started an investigation to find th...
instruction
0
52,944
14
105,888
"Correct Solution: ``` # Aizu Problem 00119: Taro's Obsession # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") class DirectedGraph(): def __init__(self): self.edges = {} def AddNode(self, node): if node not i...
output
1
52,944
14
105,889
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming ...
instruction
0
52,945
14
105,890
Yes
output
1
52,945
14
105,891
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming ...
instruction
0
52,946
14
105,892
Yes
output
1
52,946
14
105,893
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming ...
instruction
0
52,947
14
105,894
No
output
1
52,947
14
105,895
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A serious incident happened at Taro's house, which loves steamed buns. One of the three steamed buns offered at the Buddhist altar in the Japanese-style room was gone. When Taro, who was aiming ...
instruction
0
52,948
14
105,896
No
output
1
52,948
14
105,897