/*** https://mindcoding.ro/pb/pharmacy ***/ #include using namespace std; int main() { int M; cin >> M; int* myArray = new int[M]; for (int i = 0; i < M; i++) { myArray[i] = 0; } int currentArraySize = 0; for (int i = 0; i < M; i++) { int operationType, operationValue; cin >> operationType; switch (operationType) { case 1: { cin >> operationValue; myArray[currentArraySize] = operationValue; currentArraySize++; break; } case 2: { if (currentArraySize == 0) break; currentArraySize--; myArray[currentArraySize] = 0; break; } case 3: { cin >> operationValue; bool anyElement = false; for (int j = 0; j < currentArraySize; j++) { if (myArray[j] <= operationValue) { cout << myArray[j] << ' '; anyElement = true; } } if (anyElement) { cout << endl; } else { cout << "Empty"; } break; } default: break; } } return 0; }