message
stringlengths
2
19.9k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
322
108k
cluster
float64
15
15
__index_level_0__
int64
644
217k
Provide tags and a correct Python 3 solution for this coding contest problem. Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's...
instruction
0
96,404
15
192,808
Tags: brute force, dfs and similar, dsu, graphs Correct Solution: ``` def arr_inp(n): if n == 1: return [int(x) for x in stdin.readline().split()] elif n == 2: return [float(x) for x in stdin.readline().split()] else: return [str(x) for x in stdin.readline().split()] def dfs_util(x...
output
1
96,404
15
192,809
Provide tags and a correct Python 3 solution for this coding contest problem. Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's...
instruction
0
96,405
15
192,810
Tags: brute force, dfs and similar, dsu, graphs Correct Solution: ``` n=int(input()) ans=1 xl=[] yl=[] for i in range(n): x,y=map(int,input().split()) xl.append({x}) yl.append({y}) for i in range(n-1): for j in range(i+1,n): if xl[i]&xl[j] or yl[i]&yl[j]: xl[j]|=xl[i] ...
output
1
96,405
15
192,811
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s...
instruction
0
96,408
15
192,816
Yes
output
1
96,408
15
192,817
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s...
instruction
0
96,409
15
192,818
Yes
output
1
96,409
15
192,819
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s...
instruction
0
96,413
15
192,826
No
output
1
96,413
15
192,827
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s...
instruction
0
96,415
15
192,830
No
output
1
96,415
15
192,831
Provide tags and a correct Python 3 solution for this coding contest problem. Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange the...
instruction
0
96,725
15
193,450
Tags: constructive algorithms, implementation Correct Solution: ``` #!/usr/bin/env python3 # -*- coding: utf-8 -*- import time max = 20000 def test(x1, x2, n, s): for i in range(x1+1, x2+1): if s[n][i] != 0: return False return True def lastshift(n, s, a): m = 0 for i in range(n...
output
1
96,725
15
193,451
Provide tags and a correct Python 3 solution for this coding contest problem. Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange the...
instruction
0
96,726
15
193,452
Tags: constructive algorithms, implementation Correct Solution: ``` #!/usr/bin/python3 def parknext(N, P, sq, rem): for i in range(N): if P[0][i] == P[1][i] and P[0][i] > 0: sq.append((P[0][i], 1, i + 1)) P[0][i] = P[1][i] = 0 rem[0] -= 1 if P[3][i] == P[2][i] a...
output
1
96,726
15
193,453
Provide tags and a correct Python 3 solution for this coding contest problem. Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange the...
instruction
0
96,727
15
193,454
Tags: constructive algorithms, implementation Correct Solution: ``` all_the_moves = [] parked = 0 n, k = map(int, input().split()) park = [] park += [[int(x) for x in input().split()]] park += [[int(x) for x in input().split()]] park += [[int(x) for x in input().split()]] park += [[int(x) for x in input().split()]]...
output
1
96,727
15
193,455
Provide tags and a correct Python 3 solution for this coding contest problem. Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange the...
instruction
0
96,728
15
193,456
Tags: constructive algorithms, implementation Correct Solution: ``` n, k = list(map(int, input().split())) table = [] for row in range(4): table.append(list(map(int, input().split()))) moves = [] def make_move(start,finish): moves.append((table[start[0]][start[1]], finish[0]+1, finish[1]+1)) table[finish[...
output
1
96,728
15
193,457
Provide tags and a correct Python 3 solution for this coding contest problem. Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange the...
instruction
0
96,729
15
193,458
Tags: constructive algorithms, implementation Correct Solution: ``` n, k = map(int, input().strip().split()) p = list() for _ in range(4): p.append(list(map(int, input().strip().split()))) def find(): for i in range(n): if p[1][i] != 0 and p[0][i] == p[1][i]: car = p[1][i] p[1][...
output
1
96,729
15
193,459
Provide tags and a correct Python 3 solution for this coding contest problem. Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange the...
instruction
0
96,730
15
193,460
Tags: constructive algorithms, implementation Correct Solution: ``` # -*- coding: utf-8 -*- import bisect import heapq import math import random import sys from collections import Counter, defaultdict from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal from functools import lru_cache, reduce from itertools import...
output
1
96,730
15
193,461
Provide a correct Python 3 solution for this coding contest problem. Yukiya, the owner of Aizuyama Ski Resort, has prepared a course for advanced skiers with obstacles and jumping hills. There are various ways to slide on the course, and users who can slide in all patterns during the season will be given a gift. Let'...
instruction
0
96,874
15
193,748
"Correct Solution: ``` def printF(field,w,h): for i in range(h): print(field[i]) def getp(f,p,y,x,h,w,v): if y<0 or x<0 or x>=w: return 0 if y>=h: if v==True: return 1 return 0 k = f[y][x] r = 0 if k==0: if p[y][x]>=0: return...
output
1
96,874
15
193,749
Provide a correct Python 3 solution for this coding contest problem. Yukiya, the owner of Aizuyama Ski Resort, has prepared a course for advanced skiers with obstacles and jumping hills. There are various ways to slide on the course, and users who can slide in all patterns during the season will be given a gift. Let'...
instruction
0
96,875
15
193,750
"Correct Solution: ``` # -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): BLANK, OBSTACLE, JUMP = 0, 1, 2 ans = 0 # ????????????...
output
1
96,875
15
193,751
Provide a correct Python 3 solution for this coding contest problem. Yukiya, the owner of Aizuyama Ski Resort, has prepared a course for advanced skiers with obstacles and jumping hills. There are various ways to slide on the course, and users who can slide in all patterns during the season will be given a gift. Let'...
instruction
0
96,876
15
193,752
"Correct Solution: ``` def solve(c): w, h = len(c[0]), len(c) dp = [[0] * w for _ in range(h)] #????????? for x in range(w): if c[1][x] == 0: dp[1][x] = 1 for y in range(2, h): for x in range(w): if c[y][x] == 1: continue ...
output
1
96,876
15
193,753
Provide a correct Python 3 solution for this coding contest problem. Yukiya, the owner of Aizuyama Ski Resort, has prepared a course for advanced skiers with obstacles and jumping hills. There are various ways to slide on the course, and users who can slide in all patterns during the season will be given a gift. Let'...
instruction
0
96,877
15
193,754
"Correct Solution: ``` # -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): BLANK, OBSTACLE, JUMP = 0, 1, 2 ans = 0 # ????????????...
output
1
96,877
15
193,755
Provide a correct Python 3 solution for this coding contest problem. Yukiya, the owner of Aizuyama Ski Resort, has prepared a course for advanced skiers with obstacles and jumping hills. There are various ways to slide on the course, and users who can slide in all patterns during the season will be given a gift. Let'...
instruction
0
96,878
15
193,756
"Correct Solution: ``` # -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): BLANK, OBSTACLE, JUMP = 0, 1, 2 ans = 0 # ????????????...
output
1
96,878
15
193,757
Provide a correct Python 3 solution for this coding contest problem. Yukiya, the owner of Aizuyama Ski Resort, has prepared a course for advanced skiers with obstacles and jumping hills. There are various ways to slide on the course, and users who can slide in all patterns during the season will be given a gift. Let'...
instruction
0
96,879
15
193,758
"Correct Solution: ``` while True: X, Y = map(int, input().split()) if X == 0: break a = [[1]+list(map(int, input().split()))+[1] for _ in [0]*Y] + [[0]*(X+2)] dp = [list(map(lambda x: x^1, a[0]))] + [[0]*(X+2) for _ in [0]*Y] for y in range(Y-1): for x, (square, cnt) in enumerate(z...
output
1
96,879
15
193,759
Provide a correct Python 3 solution for this coding contest problem. Yukiya, the owner of Aizuyama Ski Resort, has prepared a course for advanced skiers with obstacles and jumping hills. There are various ways to slide on the course, and users who can slide in all patterns during the season will be given a gift. Let'...
instruction
0
96,880
15
193,760
"Correct Solution: ``` while(True): X,Y = map(int, input().split()) if X==0 and Y==0: break ar = [list(map(int, input().split())) for _ in range(Y)] ar.append([0]*X) br = [[0]*X for _ in range(Y+1)] for j in range(X): if ar[-2][j] != 1: br[-2][j] = 1 br[-1][j]...
output
1
96,880
15
193,761
Provide a correct Python 3 solution for this coding contest problem. Yukiya, the owner of Aizuyama Ski Resort, has prepared a course for advanced skiers with obstacles and jumping hills. There are various ways to slide on the course, and users who can slide in all patterns during the season will be given a gift. Let'...
instruction
0
96,881
15
193,762
"Correct Solution: ``` # -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): BLANK, OBSTACLE, JUMP = 0, 1, 2 ans = 0 # ????????????...
output
1
96,881
15
193,763
Provide a correct Python 3 solution for this coding contest problem. Bob is playing a popular game called "Dungeon". The game is played on a rectangular board consisting of W × H squares. Each square is identified with its column and row number, thus the square located in the x-th column and the y-th row is represente...
instruction
0
96,890
15
193,780
"Correct Solution: ``` w, h, n = map(int, input().split()) xys = sorted([list(map(int, input().split())) for _ in range(n)]) y_max = [0] for _, y in reversed(xys): y_max.append(max(y_max[-1], y)) xs = [0] + [x for x, _ in xys] print(min([xs[i] + y_max[n - i] for i in range(n + 1)])) ```
output
1
96,890
15
193,781
Provide a correct Python 3 solution for this coding contest problem. Bob is playing a popular game called "Dungeon". The game is played on a rectangular board consisting of W × H squares. Each square is identified with its column and row number, thus the square located in the x-th column and the y-th row is represente...
instruction
0
96,891
15
193,782
"Correct Solution: ``` W, H, N = map(int, input().split()) P = [list(map(int, input().split())) for i in range(N)] P.sort() st = [] for x, y in P: while st and (st[-1][0] == x or st[-1][1] <= y): st.pop() st.append((x, y)) ans = 10**9 prv = 0 for x, y in st: ans = min(ans, prv+y) prv = x ans = ...
output
1
96,891
15
193,783
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bob is playing a popular game called "Dungeon". The game is played on a rectangular board consisting of W × H squares. Each square is identified with its column and row number, thus the square l...
instruction
0
96,892
15
193,784
No
output
1
96,892
15
193,785
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bob is playing a popular game called "Dungeon". The game is played on a rectangular board consisting of W × H squares. Each square is identified with its column and row number, thus the square l...
instruction
0
96,893
15
193,786
No
output
1
96,893
15
193,787
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bob is playing a popular game called "Dungeon". The game is played on a rectangular board consisting of W × H squares. Each square is identified with its column and row number, thus the square l...
instruction
0
96,894
15
193,788
No
output
1
96,894
15
193,789
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bob is playing a popular game called "Dungeon". The game is played on a rectangular board consisting of W × H squares. Each square is identified with its column and row number, thus the square l...
instruction
0
96,895
15
193,790
No
output
1
96,895
15
193,791
Provide tags and a correct Python 3 solution for this coding contest problem. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are whi...
instruction
0
97,409
15
194,818
Tags: combinatorics, dp, math, number theory Correct Solution: ``` fact = [1] fTQJsiXxvUFMlBVGazWH = int fTQJsiXxvUFMlBVGazWp = map fTQJsiXxvUFMlBVGazWC = input fTQJsiXxvUFMlBVGazWn = range fTQJsiXxvUFMlBVGazWg = max fTQJsiXxvUFMlBVGazWo = pow fTQJsiXxvUFMlBVGazWu = tuple fTQJsiXxvUFMlBVGazWI = print rfact = [1] MOD = ...
output
1
97,409
15
194,819
Provide tags and a correct Python 3 solution for this coding contest problem. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are whi...
instruction
0
97,410
15
194,820
Tags: combinatorics, dp, math, number theory Correct Solution: ``` MOD = 10**9+7 fact = [1]*200013 for i in range(1,200013): fact[i] = (fact[i-1]*i)%MOD inv = [1]*200013 for i in range(2,200013): inv[i] = (-(MOD//i)*inv[MOD%i])%MOD for i in range(2,200013): inv[i] = (inv[i]*inv[i-1])%MOD def combo(a,b): ...
output
1
97,410
15
194,821
Provide tags and a correct Python 3 solution for this coding contest problem. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are whi...
instruction
0
97,411
15
194,822
Tags: combinatorics, dp, math, number theory Correct Solution: ``` MOD = 10**9+7 fact = [1]*200013 for i in range(1,200013): fact[i] = (fact[i-1]*i)%MOD inv = [1]*200013 for i in range(2,200013): inv[i] = (-(MOD//i)*inv[MOD%i])%MOD for i in range(2,200013): inv[i] = (inv[i]*inv[i-1])%MOD def C(n,k): ret...
output
1
97,411
15
194,823
Provide tags and a correct Python 3 solution for this coding contest problem. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are whi...
instruction
0
97,412
15
194,824
Tags: combinatorics, dp, math, number theory Correct Solution: ``` from sys import stdin input = stdin.buffer.readline f, inv = [1], [1, 1] mod = 1000000007 def c(n, k): return f[n] * inv[k] * inv[n - k] % mod h, w, n = map(int, input().split()) for i in range(1, 200001): f.append(f[i - 1] * i % mod) for i in range(2...
output
1
97,412
15
194,825
Provide tags and a correct Python 3 solution for this coding contest problem. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are whi...
instruction
0
97,413
15
194,826
Tags: combinatorics, dp, math, number theory Correct Solution: ``` #!/usr/bin/env python # 560E_chess.py - Codeforces.com 560E Chess program # # Copyright (C) 2015 Sergey """ Input The first line of the input contains three integers: h,w,n the sides of the board and the number of black cells Next n lines contain the...
output
1
97,413
15
194,827
Provide tags and a correct Python 3 solution for this coding contest problem. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are whi...
instruction
0
97,414
15
194,828
Tags: combinatorics, dp, math, number theory Correct Solution: ``` h,w,n = map(int, input().split()) l = [tuple(map(int, input().split())) for i in range(n)] l.sort() l += [(h,w)] N,B = (h + w + 1)<<1, 10**9+7 fac,inv = [1] * N, [1] * N for i in range(2, N): fac[i] = (i * fac[i-1]) % B inv[i] = (-(B//i) * (i...
output
1
97,414
15
194,829
Provide tags and a correct Python 3 solution for this coding contest problem. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are whi...
instruction
0
97,415
15
194,830
Tags: combinatorics, dp, math, number theory Correct Solution: ``` def init_factorials(N, mod): f = 1 fac = [1] * N for i in range(1, N): f *= i f %= mod fac[i] = f return fac def init_inv(N, mod, fac): b = bin(mod-2)[2:][-1::-1] ret = 1 tmp = fac[N] if b[0] == '...
output
1
97,415
15
194,831
Provide tags and a correct Python 3 solution for this coding contest problem. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are whi...
instruction
0
97,416
15
194,832
Tags: combinatorics, dp, math, number theory Correct Solution: ``` MOD = 10**9+7 fact = [1]*200013 for i in range(1,200013): fact[i] = (fact[i-1]*i)%MOD inv = [1]*200013 for i in range(2,200013): inv[i] = (-(MOD//i)*inv[MOD%i])%MOD for i in range(2,200013): inv[i] = (inv[i]*inv[i-1])%MOD def C(n,k): ret...
output
1
97,416
15
194,833
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like ...
instruction
0
97,417
15
194,834
Yes
output
1
97,417
15
194,835
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like ...
instruction
0
97,418
15
194,836
Yes
output
1
97,418
15
194,837
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like ...
instruction
0
97,419
15
194,838
No
output
1
97,419
15
194,839
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like ...
instruction
0
97,420
15
194,840
No
output
1
97,420
15
194,841
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like ...
instruction
0
97,421
15
194,842
No
output
1
97,421
15
194,843
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like ...
instruction
0
97,422
15
194,844
No
output
1
97,422
15
194,845
Provide tags and a correct Python 3 solution for this coding contest problem. The campus has m rooms numbered from 0 to m - 1. Also the x-mouse lives in the campus. The x-mouse is not just a mouse: each second x-mouse moves from room i to the room i ⋅ x mod{m} (in fact, it teleports from one room to another since it d...
instruction
0
97,832
15
195,664
Tags: bitmasks, math, number theory Correct Solution: ``` from math import gcd def powmod(a,b,m): a%=m r=1 while b: if b&1:r=r*a%m a=a*a%m b>>=1 return r def f(n): r=[] if (n&1)==0: e=0 while (n&1)==0:n>>=1;e+=1 yield (2,e) p=3 while n>1: if p*p>n:p=n if n%p: p+=2 continue e=1;n//=p w...
output
1
97,832
15
195,665
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The campus has m rooms numbered from 0 to m - 1. Also the x-mouse lives in the campus. The x-mouse is not just a mouse: each second x-mouse moves from room i to the room i ⋅ x mod{m} (in fact, i...
instruction
0
97,833
15
195,666
No
output
1
97,833
15
195,667
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The campus has m rooms numbered from 0 to m - 1. Also the x-mouse lives in the campus. The x-mouse is not just a mouse: each second x-mouse moves from room i to the room i ⋅ x mod{m} (in fact, i...
instruction
0
97,835
15
195,670
No
output
1
97,835
15
195,671
Provide tags and a correct Python 3 solution for this coding contest problem. Bashar was practicing for the national programming contest. Because of sitting too much in front of the computer without doing physical movements and eating a lot Bashar became much fatter. Bashar is going to quit programming after the natio...
instruction
0
98,002
15
196,004
Tags: constructive algorithms, graphs, implementation Correct Solution: ``` """ This template is made by Satwik_Tiwari. python programmers can use this template :)) . """ #=============================================================================================== #importing some useful libraries. import s...
output
1
98,002
15
196,005
Provide tags and a correct Python 3 solution for this coding contest problem. Bashar was practicing for the national programming contest. Because of sitting too much in front of the computer without doing physical movements and eating a lot Bashar became much fatter. Bashar is going to quit programming after the natio...
instruction
0
98,003
15
196,006
Tags: constructive algorithms, graphs, implementation Correct Solution: ``` from __future__ import division, print_function import os import sys, math from io import BytesIO, IOBase if sys.version_info[0] < 3: from __builtin__ import xrange as range from future_builtins import ascii, filter, hex, map, oct, ...
output
1
98,003
15
196,007
Provide tags and a correct Python 3 solution for this coding contest problem. Bashar was practicing for the national programming contest. Because of sitting too much in front of the computer without doing physical movements and eating a lot Bashar became much fatter. Bashar is going to quit programming after the natio...
instruction
0
98,004
15
196,008
Tags: constructive algorithms, graphs, implementation Correct Solution: ``` n, m, k = map(int, input().split()) mx = 2 * (m - 1) * n + 2 * (n - 1) * m have = 0 res = [] if k > mx: print('NO') exit(0) def check(a, b): global k, have if not have + a * len(b) >= k: have += a * len(b) re...
output
1
98,004
15
196,009
Provide tags and a correct Python 3 solution for this coding contest problem. Bashar was practicing for the national programming contest. Because of sitting too much in front of the computer without doing physical movements and eating a lot Bashar became much fatter. Bashar is going to quit programming after the natio...
instruction
0
98,005
15
196,010
Tags: constructive algorithms, graphs, implementation Correct Solution: ``` def output_ans(ans): print('YES') print(len(ans)) for x in ans: print(x[0], x[1]) if __name__ == '__main__': n, m, k = [int(x) for x in input().split(' ')] ans_list = list() ans_list.append((m - 1, 'R')) a...
output
1
98,005
15
196,011
Provide tags and a correct Python 3 solution for this coding contest problem. Bashar was practicing for the national programming contest. Because of sitting too much in front of the computer without doing physical movements and eating a lot Bashar became much fatter. Bashar is going to quit programming after the natio...
instruction
0
98,006
15
196,012
Tags: constructive algorithms, graphs, implementation Correct Solution: ``` r = 'R' l = 'L' u = 'U' d = 'D' def EPath(n,m,k): f=[] a=min(m,k) if(a!=0): f.append((a,r)) #r if(a==k): return f k = k-a a=min(m,k) if(a!=0): f.append((a,l)) #l if(a==k): retu...
output
1
98,006
15
196,013
Provide tags and a correct Python 3 solution for this coding contest problem. Bashar was practicing for the national programming contest. Because of sitting too much in front of the computer without doing physical movements and eating a lot Bashar became much fatter. Bashar is going to quit programming after the natio...
instruction
0
98,007
15
196,014
Tags: constructive algorithms, graphs, implementation Correct Solution: ``` import sys read = lambda: list(map(int, sys.stdin.readline().strip().split())) n, m, k = read() maxx = 4*n*m-2*n-2*m if k > maxx: print("NO") else: i = 0 ans = [] while i <= n-1: #print(i) if i == n -1: ...
output
1
98,007
15
196,015
Provide tags and a correct Python 3 solution for this coding contest problem. Bashar was practicing for the national programming contest. Because of sitting too much in front of the computer without doing physical movements and eating a lot Bashar became much fatter. Bashar is going to quit programming after the natio...
instruction
0
98,008
15
196,016
Tags: constructive algorithms, graphs, implementation Correct Solution: ``` import io, os # import bisect import sys import math input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline n, m, k = map(int, input().split()) phase = 0 times = 0 if k > 4*n*m-2*m-2*n: print("NO") else: print("YES") ou...
output
1
98,008
15
196,017