message
stringlengths
2
45.8k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
254
108k
cluster
float64
3
3
__index_level_0__
int64
508
217k
Provide tags and a correct Python 3 solution for this coding contest problem. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave pioneers set off, consists of three sections. Th...
instruction
0
254
3
508
Tags: math Correct Solution: ``` n, m = map(int, input().split()) print(( pow(3,n,m) - 1 + m) % m) ```
output
1
254
3
509
Provide tags and a correct Python 3 solution for this coding contest problem. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave pioneers set off, consists of three sections. Th...
instruction
0
255
3
510
Tags: math Correct Solution: ``` a = list(map(int, input().split())) aliens = a[0] modulo = a[1] print((pow(3, aliens, modulo)-1) % modulo) ```
output
1
255
3
511
Provide tags and a correct Python 3 solution for this coding contest problem. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave pioneers set off, consists of three sections. Th...
instruction
0
256
3
512
Tags: math Correct Solution: ``` n,m=map(int,input().split()) print((3*pow(3,n-1,m)-1)%m) ```
output
1
256
3
513
Provide tags and a correct Python 3 solution for this coding contest problem. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave pioneers set off, consists of three sections. Th...
instruction
0
257
3
514
Tags: math Correct Solution: ``` import sys import string import math import heapq from collections import defaultdict from functools import lru_cache from collections import Counter from fractions import Fraction def mi(s): return map(int, s.strip().split()) def lmi(s): return list(mi(s)) def tmi(s): re...
output
1
257
3
515
Provide tags and a correct Python 3 solution for this coding contest problem. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave pioneers set off, consists of three sections. Th...
instruction
0
258
3
516
Tags: math Correct Solution: ``` n, m = map(int, input().strip().split()) print((pow(3, n, m) - 1) % m) ```
output
1
258
3
517
Provide tags and a correct Python 3 solution for this coding contest problem. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave pioneers set off, consists of three sections. Th...
instruction
0
259
3
518
Tags: math Correct Solution: ``` n, m = map(int, input().split()) def fast_pow(a, b): res, ret = a, 1 while b > 0: if b % 2 == 1: ret = (ret * res) % m res = (res * res) % m b //= 2 return ret % m print((fast_pow(3, n) - 1) % m) ```
output
1
259
3
519
Provide tags and a correct Python 3 solution for this coding contest problem. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave pioneers set off, consists of three sections. Th...
instruction
0
260
3
520
Tags: math Correct Solution: ``` n,m=map(int,input().split()) x=pow(3,n-1,m) ans=(x*2+x-1)%m print(ans) ```
output
1
260
3
521
Provide tags and a correct Python 3 solution for this coding contest problem. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave pioneers set off, consists of three sections. Th...
instruction
0
261
3
522
Tags: math Correct Solution: ``` def pow(a, b, m): res = 1 while(b): if b & 1: res = res*a % m b = b>>1 a = a*a%m return res n, m = map(int, input().split()) print((pow(3, n, m)-1)%m) ```
output
1
261
3
523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave p...
instruction
0
262
3
524
Yes
output
1
262
3
525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave p...
instruction
0
263
3
526
Yes
output
1
263
3
527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave p...
instruction
0
264
3
528
Yes
output
1
264
3
529
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave p...
instruction
0
265
3
530
Yes
output
1
265
3
531
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave p...
instruction
0
266
3
532
No
output
1
266
3
533
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave p...
instruction
0
267
3
534
No
output
1
267
3
535
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave p...
instruction
0
268
3
536
No
output
1
268
3
537
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!). The flying saucer, on which the brave p...
instruction
0
269
3
538
No
output
1
269
3
539
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distanc...
instruction
0
278
3
556
Yes
output
1
278
3
557
Provide a correct Python 3 solution for this coding contest problem. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he has to go home in the near dawn. Fortunately, there are ...
instruction
0
737
3
1,474
"Correct Solution: ``` import math def ri(): return int(input()) def rli(): return list(map(int, input().split())) r, n = rli() while(r != 0): shade = [0 for i in range(41)] shade[40] = 1145148101919 t = [1145148101919 for i in range(41)] for i in range(n): xl, xr, h = rli() for j in r...
output
1
737
3
1,475
Provide a correct Python 3 solution for this coding contest problem. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he has to go home in the near dawn. Fortunately, there are ...
instruction
0
738
3
1,476
"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**10 mod = 998244353 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [i...
output
1
738
3
1,477
Provide a correct Python 3 solution for this coding contest problem. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he has to go home in the near dawn. Fortunately, there are ...
instruction
0
739
3
1,478
"Correct Solution: ``` while True: R, N = map(int, input().split()) if not (R | N): break geta = 20 buildings = [0] * (geta * 2) for _ in range(N): xl, xr, h = map(int, input().split()) for i in range(xl + geta, xr + geta): buildings[i] = max(buildings[i], h) ...
output
1
739
3
1,479
Provide a correct Python 3 solution for this coding contest problem. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he has to go home in the near dawn. Fortunately, there are ...
instruction
0
740
3
1,480
"Correct Solution: ``` while True: R, N = map(int, input().split()) if not (R | N): break geta = 20 buildings = [0] * (geta * 2) for _ in range(N): xl, xr, h = map(int, input().split()) for i in range(xl + geta, xr + geta): buildings[i] = max(buildings[i], h) ...
output
1
740
3
1,481
Provide a correct Python 3 solution for this coding contest problem. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he has to go home in the near dawn. Fortunately, there are ...
instruction
0
741
3
1,482
"Correct Solution: ``` import math while True: r, n = map(int, input().split()) if r == 0 and n == 0: break sun_place = [-10000000000000000000 for _ in range(r)] for i in range(r): sun_place[i] = 0 - r + math.sqrt(r * r - i * i) ans = 10000000000000000 bilding1 = [0 for i in ra...
output
1
741
3
1,483
Provide a correct Python 3 solution for this coding contest problem. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he has to go home in the near dawn. Fortunately, there are ...
instruction
0
742
3
1,484
"Correct Solution: ``` # -*- coding: utf-8 -*- from math import sqrt def inpl(): return list(map(int, input().split())) R, N = inpl() while R: H = [0] * 41 r0 = 0 l0 = 0 for _ in range(N): l, r, h = inpl() if l < 0 and r >= 0: l0 = max(l0, h) if l <= 0 and r > 0: ...
output
1
742
3
1,485
Provide a correct Python 3 solution for this coding contest problem. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he has to go home in the near dawn. Fortunately, there are ...
instruction
0
743
3
1,486
"Correct Solution: ``` #!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random import itertools sys.setrecursionlimit(10**5) stdin = sys.stdin bisect_left = bisect.bisect_left bisect_right = bisect.bis...
output
1
743
3
1,487
Provide a correct Python 3 solution for this coding contest problem. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he has to go home in the near dawn. Fortunately, there are ...
instruction
0
744
3
1,488
"Correct Solution: ``` while 1: co=[0 for i in range(40)] r,n=map(int,input().split()) if r==n==0: break for i in range(n): a,b,h=map(int,input().split()) a+=20 b+=20 for j in range(a,b): co[j]=max(co[j],h) r_list=[] for i in range(r): ...
output
1
744
3
1,489
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he ...
instruction
0
745
3
1,490
Yes
output
1
745
3
1,491
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he ...
instruction
0
746
3
1,492
Yes
output
1
746
3
1,493
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he ...
instruction
0
747
3
1,494
Yes
output
1
747
3
1,495
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he ...
instruction
0
748
3
1,496
Yes
output
1
748
3
1,497
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Vampire Mr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he ...
instruction
0
749
3
1,498
No
output
1
749
3
1,499
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a one-dimensional cellular automaton consisting of N cells. Cells are numbered from 0 to N βˆ’ 1. Each cell has a state represented as a non-negative integer less than M. The states of c...
instruction
0
753
3
1,506
No
output
1
753
3
1,507
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a one-dimensional cellular automaton consisting of N cells. Cells are numbered from 0 to N βˆ’ 1. Each cell has a state represented as a non-negative integer less than M. The states of c...
instruction
0
754
3
1,508
No
output
1
754
3
1,509
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a one-dimensional cellular automaton consisting of N cells. Cells are numbered from 0 to N βˆ’ 1. Each cell has a state represented as a non-negative integer less than M. The states of c...
instruction
0
755
3
1,510
No
output
1
755
3
1,511
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a one-dimensional cellular automaton consisting of N cells. Cells are numbered from 0 to N βˆ’ 1. Each cell has a state represented as a non-negative integer less than M. The states of c...
instruction
0
756
3
1,512
No
output
1
756
3
1,513
Provide tags and a correct Python 3 solution for this coding contest problem. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and start...
instruction
0
1,164
3
2,328
Tags: data structures, greedy, implementation Correct Solution: ``` s = input() a = [] for i in s: if len(a) > 0: if a[-1] == i: a.pop() else: a.append(i) else: a.append(i) if len(a) > 0: print('No') else: print('Yes') ```
output
1
1,164
3
2,329
Provide tags and a correct Python 3 solution for this coding contest problem. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and start...
instruction
0
1,165
3
2,330
Tags: data structures, greedy, implementation Correct Solution: ``` s = input() if len(s)%2:print('No');exit(0) if s[::2].count('+')-s[1::2].count('+')==0:print('Yes');exit(0) print('No') ```
output
1
1,165
3
2,331
Provide tags and a correct Python 3 solution for this coding contest problem. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and start...
instruction
0
1,166
3
2,332
Tags: data structures, greedy, implementation Correct Solution: ``` i=input() s=[] for k in i: l=len(s) if l==0 : s+=k elif k==s[l-1] : del(s[l-1]) else : s+=k l=len(s) if l==0 : print("Yes") else : print("No") ```
output
1
1,166
3
2,333
Provide tags and a correct Python 3 solution for this coding contest problem. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and start...
instruction
0
1,167
3
2,334
Tags: data structures, greedy, implementation Correct Solution: ``` a=input() if len(a)%2==1: print('No') else: l=[] for i in a: if l==[]: l.append(i) elif i!=l[-1]: l.append(i) else: l.pop() if l==[]: print('Yes') else: pri...
output
1
1,167
3
2,335
Provide tags and a correct Python 3 solution for this coding contest problem. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and start...
instruction
0
1,168
3
2,336
Tags: data structures, greedy, implementation Correct Solution: ``` s=input() stk=[] for c in s: if len(stk) and stk[-1]==c: stk.pop() else: stk.append(c) if len(stk): print('No') else: print('Yes') ```
output
1
1,168
3
2,337
Provide tags and a correct Python 3 solution for this coding contest problem. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and start...
instruction
0
1,169
3
2,338
Tags: data structures, greedy, implementation Correct Solution: ``` a=input() if len(a)%2==1: print('No') else: odd=0 even=0 for i in range(len(a)): if a[i]=='-': if i%2==0: even+=1 else: odd+=1 if even==odd: print('Yes') el...
output
1
1,169
3
2,339
Provide tags and a correct Python 3 solution for this coding contest problem. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and start...
instruction
0
1,170
3
2,340
Tags: data structures, greedy, implementation Correct Solution: ``` input = input() stack = [] for wire in input: if len(stack) == 0 or wire != stack[-1]: stack.append(wire) else: stack.pop() print("YES" if len(stack) == 0 else "NO") ```
output
1
1,170
3
2,341
Provide tags and a correct Python 3 solution for this coding contest problem. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and start...
instruction
0
1,171
3
2,342
Tags: data structures, greedy, implementation Correct Solution: ``` __author__ = 'Utena' import collections s=input() if len(s)%2==1: print('No') exit(0) t1=t2=0 for i in range(len(s)): if s[i]=='-': if i%2==0:t1+=1 else:t2+=1 if t1==t2:print('Yes') else:print('No') ```
output
1
1,171
3
2,343
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wi...
instruction
0
1,172
3
2,344
Yes
output
1
1,172
3
2,345
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wi...
instruction
0
1,173
3
2,346
Yes
output
1
1,173
3
2,347
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wi...
instruction
0
1,174
3
2,348
Yes
output
1
1,174
3
2,349
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wi...
instruction
0
1,175
3
2,350
Yes
output
1
1,175
3
2,351
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wi...
instruction
0
1,176
3
2,352
No
output
1
1,176
3
2,353
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wi...
instruction
0
1,177
3
2,354
No
output
1
1,177
3
2,355
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wi...
instruction
0
1,178
3
2,356
No
output
1
1,178
3
2,357
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wi...
instruction
0
1,179
3
2,358
No
output
1
1,179
3
2,359