Application of Various C++ Standard Library Facilities
string name1, name2;
pt >> name1 >> name2;
ifstream f1(name1);
vector<Data> V((istream_iterator<Data>(f1)), istream_iterator<Data>());
f1.close();
ShowLine(V.begin(), V.end(), "V: ");
ofstream f2(name2);
f2.close();
Processing Single Sequences
STL7Mix1°. The initial sequence contains information about clients of the fitness center. Each element of the sequence includes the following integer fields: <Client code> <Year> <Month number> <Session length (in hours)> Find the sequence element with the minimum session length. Output this length and its corresponding year and month number (in the specified order on the same line). If there are several elements with the minimum length, output the data of the element that is the last in the initial sequence. Note. Use the min_element algorithm with a predicate.
STL7Mix2°. The initial sequence contains information about clients of the fitness center. Each element of the sequence includes the following integer fields: <Month number> <Year> <Client code> <Session length (in hours)> Find the sequence element with the maximum session length. Output this length and its corresponding year and month number (in the specified order on the same line). If there are several elements with the maximum length, output the data corresponding to the latest date. Note. Compare with STL7Mix1. To find the required element, use a predicate analyzing the fields "len", "year", "month".
STL7Mix3°. The initial sequence contains information about clients of the fitness center. Each element of the sequence includes the following integer fields: <Year> <Month number> <Session length (in hours)> <Client code> Determine the year in which the total session length of all clients was the longest, and output that year and the longest total length. If there were several such years, output the minimal one. Note. Compare with STL7Mix1. For grouping by the "year" field, use an auxiliary mapping.
STL7Mix4°. The initial sequence contains information about clients of the fitness center. Each element of the sequence includes the following integer fields: <Year> <Month number> <Session length (in hours)> <Client code> For each client present in the source data, determine the total session length for all years (output the total length first, then the client code). The information about each client should be displayed on a new line and ordered by descending total length, and if they are equal — by ascending client code. Note. For grouping by the "code" field, use an auxiliary mapping.
STL7Mix5°. The initial sequence contains information about clients of the fitness center. Each element of the sequence includes the following integer fields: <Client code> <Session length (in hours)> <Year> <Month number> For each client present in the source data, determine the total number of months during which he/she attended classes (first output the number of months, then the client code). The information about each client should be displayed on a new line and ordered by ascending number of months, and if they are equal — by ascending client code. Note. Compare with STL7Mix4.
STL7Mix6°. The initial sequence contains information about clients of the fitness center. Each element of the sequence includes the following integer fields: <Client code> <Session length (in hours)> <Year> <Month number> For each month, determine the total session length of all clients for all years (output the total length first, then the month number). If there is no data about some month, output 0 for this month. Information about each month should be output on a new line and ordered by descending total length, and in case of equal length — by ascending month number. Note. Compare with STL7Mix4. In this case, instead of an auxiliary mapping, you can use a vector with 12 elements corresponding to the month numbers (in this case, the vector elements should be pairs "len, month").
STL7Mix7°. An integer K is the code of one of the clients of the fitness center. The initial sequence contains information about clients of this fitness center. Each element of the sequence includes the following integer fields: <Session length (in hours)> <Year> <Month number> <Client code> For each year, in which the client with the code K visited the center, determine the month in which the session length of this client was the longest for this year (if there are several such months, select the month with the lowest number). The information about each year should be displayed on a new line in the following order: year, month number, session length in this month. Arrange the information in descending order of the year number. If there is no data about the client with code K, write the line "No data" to the resulting file. Note. For selecting data related to client K and simultaneously grouping them by the "year" field, use an auxiliary mapping M of type map<int, Data*, greater<int>> (in this case, the functional object greater will provide the required sorting of data by descending year number). Using the for_each algorithm or a loop over the elements of the container, iterate through the elements of the source data set, adding (or changing) elements of the mapping M according to the task conditions.
STL7Mix8°. An integer K is the code of one of the clients of the fitness center. The initial sequence contains information about clients of this fitness center. Each element of the sequence includes the following integer fields: <Session length (in hours)> <Client code> <Year> <Month number> For each year in which the client with the code K visited the center, determine the month in which the session length of this client was the shortest for this year (if there are several such months, select the first of these months in the initial sequence; months with zero session length are not considered). The information about each year should be displayed on a new line in the following order: the shortest session length, year, month number. Arrange the information in ascending order of the session length, and in case of equal length — in ascending order of the year number. If there is no data about the client with code K, write the line "No data" to the resulting file. Note. Compare with STL7Mix7. In this case, after building the mapping M, it should be copied to an auxiliary vector and this vector should be sorted in the required order. If the mapping M uses the default order (i.e., by ascending key "year"), then for sorting the auxiliary vector it is sufficient to apply the stable sorting algorithm by ascending "len" field.
STL7Mix9°. An integer K is the code of one of the clients of the fitness center. The initial sequence contains information about clients of this fitness center. Each element of the sequence includes the following integer fields: <Client code> <Session length (in hours)> <Month number> <Year> For each year in which the client with the code K visited the center, determine the number of months for which the session length of this client exceeded 15 hours (first output the number of months, then the year). If the required months are missing for some year, output 0 for it. Output information about each year on a new line; the data should be ordered by descending number of months, and in case of equal number of months — by ascending of the year number. If there is no data about the specified client, write the line "No data" to the resulting file. Note. Compare with STL7Mix8. In this case, it is sufficient to use a mapping M of type map<int, int>.
STL7Mix10°. The initial sequence contains information about clients of the fitness center. Each element of the sequence includes the following integer fields: <Year> <Month number> <Client code> <Session length (in hours)> For each "year–month" pair present in the source data, determine the number of clients who visited the center at the specified time (the year is displayed first, then the month, then the number of clients). The information about each "year–month" pair should be displayed on a new line and ordered by descending year number, and for the same year number — by ascending month number. Note. For grouping by the composite key "year, month number", use an auxiliary mapping M of type map<pair<int, int>, int, greater_less>, having previously described the functional object greater_less to implement the key pair comparison variant described in the task. Thanks to this object, the obtained mapping will contain data in the required order.
STL7Mix11°. The initial sequence contains information about clients of the fitness center. Each element of the sequence includes the following integer fields: <Client code> <Year> <Month number> <Session length (in hours)> For each "year–month" pair present in the source data, determine the total session length of all clients at the specified time (the total length is displayed first, then the year, then the month). The information about each "year–month" pair should be displayed on a new line and ordered by ascending total length, for the same length — by descending year number, and for the same year number — by ascending month number. Note. Compare with STL7Mix10. In this case, additional sorting of the obtained data by ascending total training duration is required. It is necessary to use the stable sorting algorithm, which will ensure the required order of pairs with equal total duration (provided that a mapping with the functional object greater_less described in the note for STL7Mix10 is used).
STL7Mix12°. An integer P (10 < P < 50) is given. The initial sequence contains information about clients of the fitness center. Each element of the sequence includes the following integer fields: <Session length (in hours)> <Client code> <Month number> <Year> For each year present in the source data, determine the number of months in which the total session length of all clients was more than P percent of the total length for that year (output the number of months first, then the year). If for a some year, the required condition is not fulfilled for any month, then output 0 for this year. Information about each year should be displayed on a new line and ordered by descending number of months, and for the same number of months — by ascending the year number. Note. For grouping data by the "year" field, use a mapping M of type map<int, vector<int>>, including in the value vector (length 13) not only data about each month (saving them in vector elements with indices from 1 to 12), but also total data for the whole year (saving them in the vector element with index 0). After forming the mapping M, build an auxiliary vector of type vector<pair<int, int>> based on the obtained data and sort the vector elements in the required manner, using the stable_sort algorithm.
STL7Mix13°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <School number> <Year of enrollment> <Family name> For each year present in the source data, find the school with the highest number among the schools graduated from by the entrants enrolled in that year and output the year and the found school number. Output the information about each year on a new line and arrange it in ascending order of the year number. Note. Use grouping by the "year" field.
STL7Mix14°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <Year of enrollment> <School number> <Family name> Determine in which years the total number of entrants for all schools was the highest and output this number and the number of such years. Output both numbers on the same line. Note. Perform grouping by the "year" field, saving the obtained sequence in an auxiliary mapping. Using the max_element algorithm, find the greatest number of entrants, then use the count_if algorithm to determine the number of years for which the number of entrants was maximal.
STL7Mix15°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <School number> <Year of enrollment> <Family name> Determine in which years the total number of entrants for all schools was the highest, and output this number, as well as the years in which it was reached (arrange the years in ascending order, output the highest number of entrants and the year on each line). Note. Compare with STL7Mix14.
STL7Mix16°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <Year of enrollment> <School number> <Family name> For each year present in the source data, output the total number of entrants enrolled in that year (first output the number of entrants, then the year). The information about each year should be displayed on a new line and ordered by descending number of entrants, and for the same number of entrants — by ascending the year number. Note. Compare with STL7Mix14. For ordering the obtained grouped data by descending number of entrants, use an auxiliary vector and the stable_sort algorithm.
STL7Mix17°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <School number> <Year of enrollment> <Family name> For each year present in the source data, output the number of different schools graduated from by the entrants enrolled in that year (first output the number of schools, then the year). The information about each year should be displayed on a new line and arranged in ascending order of the number of schools, and for the same number of schools — in ascending order of the year number. Note. In this case, for grouping by the "year" field, it is convenient to use a mapping of type map<int, set<int>>.
STL7Mix18°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <Year of enrollment> <School number> <Family name> Find the years for which the number of entrants was not less than the average of all years (first output the number of entrants for the given year, then the year). Output the information about each year on a new line and order it by descending number of entrants, and for the same number of entrants — by ascending the year number. Note. Compare with STL7Mix16.
STL7Mix19°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <Family name> <Year of enrollment> <School number> For each school, output the total number of entrants for all years and the family name of the first entrant of this school contained in the initial sequence (first output the school number, then the number of entrants, then the family name). Output the information about each school on a new line and arrange it in ascending order of school numbers. Note. In this case, for grouping by the "school number" field, you can use a mapping of type map<int, pair<int, string>>.
STL7Mix20°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <Family name> <School number> <Year of enrollment> Determine for which schools the total number of entrants for all years was the highest, and output data on entrants from these schools (first output the school number, then the family name of the entrant). The information about each entrant should be displayed on a new line and arranged in ascending order of school numbers, and for the same school number — in the order of entrants in the initial sequence. Note. Compare with STL7Mix14. After determining the maximum number of entrants using the first auxiliary mapping (of type map<int, int>), form a second mapping (of type map<int, vector<string>>) containing data only about those schools for which the number of entrants was maximum.
STL7Mix21°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <Family name> <Year of enrollment> <School number> Determine for which schools the total number of entrants for all years was the highest, and output for each of these schools the data about the first entrant in alphabetical order (first output the entrant's family name, then the school number). Output the information about each entrant on a new line and arrange it in alphabetical order of family names, and for the same family name — in ascending order of school numbers. Note. Compare with STL7Mix20. In this case, you can use a second auxiliary mapping of type map<int, string>, and also (for sorting in the required order) an auxiliary vector of type vector<pair<int, string>>.
STL7Mix22°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <Family name> <School number> <Year of enrollment> For each school, find the years of enrollment of entrants from this school and output the school number and the years found for it (the years are located on the same line as the school number and are arranged in ascending order). Output the information about each school on a new line and arrange the school numbers in ascending order. Note. Here, as in task STL7Mix17, it is convenient to use an auxiliary mapping map<int, set<int>>, which allows immediately obtaining the resulting data in the required order.
STL7Mix23°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <Family name> <Year of enrollment> <School number> For each "year–school" pair present in the initial data, find the number of entrants belonging to that year and school and output the year, school number and the number of entrants found. Output the information about each "year–school" pair on a new line and order it by descending year number, and for the same year — by ascending school number. Note. Compare with STL7Mix10.
STL7Mix24°. The initial sequence contains information about the university entrants. Each element of the sequence includes the following fields: <Family name> <School number> <Year of enrollment> For each "school–year" pair present in the initial data, find the first three entrants belonging to that school and year, and output the school number, year and the found family names (in the order they appear in the initial sequence). If there are less than three entrants for some "school–year" pair, output information about all entrants belonging to this pair. Output information about each "school–year" pair on a new line and arrange the school number in ascending order, and for the same school number — in descending order of the year numbers. Note. Compare with STL7Mix10. In this case, it is advisable to name the auxiliary functional object less_greater, and use the type map<pair<int, int>, vector<string>, less_greater> as the type of the auxiliary mapping.
STL7Mix25°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Family name> <Debt> <Apartment number> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. Find the entrance, whose residents have the largest total debt, and output this entrance number together with the size of the total debt (output with two fractional digits). It should be assumed that the total debts for all entrances have different values. Note. Perform grouping by the entrance number, using the following formula to find the entrance number entrance by the apartment number num: entrance = (num - 1) / 36 + 1 (the operation "/" denotes integer division). Apply the max_element algorithm to the mapping obtained as a result of grouping. Output real results with two decimal places.
STL7Mix26°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Apartment number> <Family name> <Debt> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. For each of the 4 entrances of the building, output information about the debtors living in this entrance: the entrance number, number of debtors, average debt for the residents of this entrance (output with two fractional digits). Residents who have no debt are not taken into account when calculating the average debt. Information about each entrance should be displayed on a new line and ordered by ascending entrance number. If there are no debtors in any of the entrances, the data about this entrance is not output. Note. Compare with STL7Mix25. When performing grouping, use a mapping of type map<int, pair<int, double>>.
STL7Mix27°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Family name> <Apartment number> <Debt> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. For each of the 9 floors of the building, output information about the debtors living on this floor: the number of debtors, floor number, total debt for the residents of this floor (output with two fractional digits). Information about each floor should be displayed on a new line and ordered by ascending number of debtors, and for the same number of debtors — by ascending floor number. If there are no debtors on any floor, the data about this floor should not be output. Note. Compare with STL7Mix26. Use the formula for finding the floor number floor by the apartment number num: floor = (num - 1) % 36 / 4 + 1 (the operation "/" denotes integer division, the operation "%" denotes taking the remainder of integer division).
STL7Mix28°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Debt> <Family name> <Apartment number> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. For each of the 9 floors of the building, output information about the debtors living on this floor: floor number, total debt for the residents of this floor (displayed with two fractional digits), number of debtors. Information about each floor should be displayed on a new line and ordered by descending floor number. If there are no debtors on any floor, then output zero data for this floor. Note. Compare with STL7Mix27. In this case, the mapping obtained as a result of grouping by floors should include elements corresponding to all floors of the building (while some elements may contain zero values).
STL7Mix29°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Apartment number> <Family name> <Debt> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. For each of the 4 entrances of the building, find the resident with the highest debt and output information about him: entrance number, apartment number, family name of the resident, debt (output with two fractional digits). It should be assumed that in the initial sequence all debts have different values. The information about each debtor should be displayed on a new line and ordered by ascending entrance number. If there are no debtors in any of the entrances, then the data about this entrance should not be output. Note. Compare with STL7Mix25. When grouping, you can use a mapping of type map<int, vector<Data*>>, where Data is the type of the element from the source data set.
STL7Mix30°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Family name> <Debt> <Apartment number> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. For each of the 9 floors of the building, find the resident with the lowest debt and output information about him: apartment number, floor number, family name of the resident, debt (output with two fractional digits). It should be assumed that all debts in the initial sequence have different values. The information about each debtor should be displayed on a new line and ordered by ascending apartment number. If there are no debtors on any floor, do not output data about this floor. Note. Compare with STL7Mix27 and STL7Mix29.
STL7Mix31°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Debt> <Family name> <Apartment number> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. For each of the 4 entrances of the building, find three residents with the highest debt and output information about them: debt (displayed with two fractional digits), entrance number, apartment number, family name of the resident. It should be assumed that all debts in the initial sequence have different values. The information about each debtor should be displayed on a new line and sorted in descending order by the size of the debt (do not take into account the entrance number when sorting). If the number of debtors in any entrance is less than three, then include all debtors of this entrance in the obtained set. Note. Compare with STL7Mix29. For selecting three debtors, use the partial_sort algorithm.
STL7Mix32°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Family name> <Apartment number> <Debt> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. For each of the 9 floors of the building, find the resident with the lowest debt and output information about him: floor number, debt (output with two fractional digits). It should be assumed that all debts in the initial sequence have different values. The information about each floor should be output on a new line and ordered by ascending floor number. If there are no debtors on any floor, output the debt equal to 0.00 for that floor. Note. Compare with STL7Mix28. In this case, it is sufficient to use an auxiliary array of real numbers with 9 elements (corresponding to all floors of the building).
STL7Mix33°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Apartment number> <Debt> <Family name> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. Find the residents whose debt is not less than the average debt for the building and output information about them: apartment number, family name, debt (output with two fractional digits). Residents who have no debt are not taken into account when calculating the average debt. Information about each debtor should be displayed on a new line and arranged in ascending order of apartment numbers. Note. Use the remove_copy_if algorithm to copy the required elements into an auxiliary array. To avoid repeatedly calculating the average debt for the building, preliminarily save its value (found, for example, using the accumulate algorithm) in an auxiliary variable.
STL7Mix34°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Debt> <Apartment number> <Family name> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. Find the residents whose debt is not greater than the average debt for the building and output information about them: floor number, apartment number, family name, debt (output with two fractional digits). Residents who have no debt are not taken into account when calculating the average debt. Information about each debtor should be displayed on a new line and ordered by descending floor number, and for the same floor number — by ascending apartment number. Note. Compare with STL7Mix33.
STL7Mix35°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Debt> <Family name> <Apartment number> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. For each of the 4 entrances of the building, find the debtors whose debt is not less than the average debt for this entrance, and output information about them: entrance number, debt (displayed with two fractional digits), family name, apartment number. Residents who have no debt are not taken into account when calculating the average debt. Information about each debtor should be displayed on a new line and ordered by ascending entrance number, and for the same entrance — by descending debt size. It should be assumed that all debts in the initial sequence have different values. Note. See notes for STL7Mix25 and STL7Mix33. In this case, it is convenient to use an auxiliary vector of size 4 to store the average values.
STL7Mix36°. The initial sequence contains information about utility debtors living in a 144-apartment 9-storey building. Each element of the sequence includes the following fields: <Apartment number> <Family name> <Debt> The debt is indicated as a fractional number. There are 4 apartments on each floor in each of four entrances. For each of the 9 floors of the building, find the debtors whose debt is not more than the average debt for this floor, and output information about them: floor number, debt (displayed with two fractional digits), family name, apartment number. Residents who have no debt are not taken into account when calculating the average debt. Information about each debtor should be displayed on a new line and ordered by ascending floor number, and for the same floor — by ascending debt size. It should be assumed that all debts in the initial sequence have different values. Note. Compare with STL7Mix35; see also the note for STL7Mix27.
STL7Mix37°. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Company> <Gasoline brand> <Price> <Street> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. For each brand of gasoline present in the source sequence, determine the minimum and maximum price of a liter of gasoline of this brand (first output the brand, then the prices in the specified order). The information about each brand should be displayed on a new line and ordered by the descending brand number.
STL7Mix38°. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Price> <Gasoline brand> <Company> <Street> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. For each brand of gasoline present in the source sequence, determine the number of stations offering this brand (first output the number of stations, then the brand number). The information about each brand should be displayed on a new line and ordered by ascending number of gas stations, and for the same number of gas stations — by ascending brand number.
STL7Mix39°. Given an integer M is the value of one of the brands of gasoline. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Street> <Company> <Gasoline brand> <Price> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. For each street, determine the number of gas stations that offered gasoline brand M (first output the number of gas stations on this street, then the street name; the number of gas stations can be equal to 0). The information about each street should be displayed on a new line and ordered by ascending number of gas stations, and for the same number of gas stations — by street names in alphabetical order. Note. When performing grouping by the "street" field, use a mapping of type map<string, int>.
STL7Mix40°. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Company> <Street> <Gasoline brand> <Price> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. For each street, determine the number of gas stations offering a certain brand of gasoline (first output the street name, then three numbers — the number of gas stations for 92, 95 and 98 brand; some of these numbers may be equal to 0). The information about each street should be displayed on a new line and organized alphabetically by street name. Note. When performing grouping by the "street" field, use a mapping of type map<string, vector<int>> (the vector should have length 3 and store information about the number of gas stations that offered a certain gasoline brand). Note that the index of the vector element can be determined by the brand value m as follows: (m - 92)/3.
STL7Mix41°. Given an integer M is the value of one of the brands of gasoline. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Gasoline brand> <Street> <Company> <Price> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. For each street, where there are gas stations with brand M, determine the maximum price of gasoline of this brand (first output the maximum price, then street name). The information about each street should be displayed on a new line and ordered by ascending maximum price, and for the same price — by street names in alphabetical order. If no gas stations with brand M are found, write the line "No" to the resulting file.
STL7Mix42°. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Gasoline brand> <Company> <Street> <Price> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. For each street, determine the minimum price of each brand of gasoline (first output street name, then three numbers — the minimum price for 92, 95 and 98 brand). If there is no gasoline of the required brand, output the number 0. Information about each street should be output on a new line and ordered alphabetically by street names. Note. Compare with STL7Mix40.
STL7Mix43°. Given an integer M is the value of one of the brands of gasoline. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Price> <Gasoline brand> <Street> <Company> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. For each company, determine the price spread for gasoline of the specified brand M (first output the difference between the maximum and minimum price of gasoline of brand M for the gas station of the company, then company name). If gasoline of brand M was not offered by this company, then the spread should be equal to −1. Information about each company should be displayed on a new line, the data should be ordered by descending values of the spread, and for equal values of the spread — by company names in alphabetical order. Note. Compare with STL7Mix41. The difference from STL7Mix41 is that in this case the resulting set must contain information about all companies (not only those that have gas stations offering gasoline brand M). One can, for example, use for grouping by the "company" field a mapping of type map<string, vector<int>>, in which for each company all its prices for gasoline brand M are stored, and then based on this mapping form a vector of pairs pair<string, int>, containing the price range for each company, and traverse it in the required order. To find the price range, one can use the algorithms max_element and min_element.
STL7Mix44°. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Gasoline brand> <Price> <Company> <Street> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. For each company, determine the price spread for all brands of gasoline (first output the company name, then three numbers — the price spread for gasoline brands 92, 95 and 98). If there is no gasoline of the required brand, output the number −1. Information about each company should be displayed on a new line and ordered alphabetically by company names. Note. Compare with STL7Mix43. In this case, when grouping by the "company" field, one can use a mapping of type map<string, multimap<int, int>>, in which for each company all its prices are stored, grouped by gasoline brands.
STL7Mix45°. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Company> <Price> <Gasoline brand> <Street> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. For each street, determine the number of gas stations (first output the street name, then the number of gas stations). The information about each street should be displayed on a new line and ordered alphabetically by street names. Note. When grouping by the "street" field, use a mapping of type map<string, set<string>>, in which for each street the set of companies having gas stations on that street is stored.
STL7Mix46°. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Street> <Gasoline brand> <Price> <Company> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. For each company, determine the number of gas stations that offered all three brands of gasoline (first output the number of gas stations, then the company name; the number can be equal to 0). The information about each company should be displayed on a new line and ordered by descending number of gas stations, and in case of equal numbers — by company names in alphabetical order. Note. Compare with STL7Mix45. In this case, when grouping by the "company" field, one can use a mapping of type map<string, map<string, int>>, in which each company is associated with an auxiliary mapping containing street names as keys and the number of gasoline brands offered at the gas station of this company located on that street as values.
STL7Mix47°. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Price> <Company> <Street> <Gasoline brand> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. Output information about all the gas stations that offered at least two brands of gasoline (first output the company name, then the street name, then the number of brands of gasoline offered). Information about each gas station should be displayed on a new line and ordered alphabetically by company names, and for the same company — by street names (also in alphabetical order). If no required gas station is found, then write the line "No" to the resulting file. Note. Perform grouping by a key obtained by concatenating the "company" and "street" fields (with a space between them).
STL7Mix48°. The initial sequence contains information about gas stations. Each element of the sequence includes the following fields: <Price> <Street> <Gasoline brand> <Company> Company and street names do not contain spaces. The numbers 92, 95 or 98 are indicated as gasoline brand. Each company has no more than one gas station on each street; prices at different gas stations of the same company may differ. Search all possible combinations of streets and companies contained in the initial sequence, and for each "street–company" pair output the street name, company name, and the number of gasoline brands offered by the gas station of the given company located on the given street (if there is no gas station, the number is assumed to be 0). The information about each pair should be displayed on a new line and ordered alphabetically by street names, and for the same street — by company names (also in alphabetical order). Note. First, form an auxiliary mapping M of type map<string, int>, containing the names of all companies included in the initial data set as keys (leave the values as zero). Then perform grouping by the "street" field, using a mapping of type map<string, map<string, int>>. When adding a new street to the mapping, immediately associate with it the previously built auxiliary mapping M and use its values as the counter of gasoline brands offered at the gas station of this company located on that street.
STL7Mix49°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <Family name> <Initials> <School number> <Scores> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. Determine the lowest total score and output information about all students who received this score (for each student, output the family name, initials, school number, and total score). The information about each student should be displayed on a new line and arranged in the order of their succession in the initial sequence. Note. To find the minimum total score, use the min_element algorithm.
STL7Mix50°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <Family name> <Initials> <Scores> <School number> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. Determine the two highest total scores and output information about all students who received one of the two highest total scores (for each student, output the family name, initials and total score). The information about each student should be displayed on a new line and arranged in the order of their succession in the initial sequence. It should be assumed that the initial sequence always contains students with different total scores. Note. Compare with STL7Mix49. To find the two largest total scores, it is sufficient to form an auxiliary set of total scores of type set<int, greater<int>> and extract the first two elements from it.
STL7Mix51°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <Scores> <Family name> <Initials> <School number> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. For each school, output the information about the student who got the highest score in chemistry among the students of this school (first output the school number, then the student's family name, initials and score in chemistry). If there are several such students, output information about the first student in the order of their succession in the initial sequence. The information about each student should be displayed on a new line and arranged in ascending order of the school number. Note. Use an auxiliary mapping of type map<int, Data*>.
STL7Mix52°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <School number> <Family name> <Initials> <Scores> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. For each school, output the student with the lowest total score among the students of that school (first output the school number, then the total score, family name and initials of the student). If there are several such students, output information about the first student in alphabetical order of their family names and initials. The information about each student should be displayed on a new line and arranged in descending order of the school number. Note. Compare with STL7Mix51.
STL7Mix53°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <Family name> <Initials> <School number> <Scores> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. For each school, determine the number of students whose total score exceeds 150 points (first output the number of students with a total score greater than 150 points, then the school number; the number of students can be 0). Information about each school should be displayed on a new line and ordered by descending number of students, and for the same number of students — by ascending school number. Note. Use an auxiliary mapping of type map<int, int> for grouping the initial data and a vector of type vector<pair<int, int>> together with the stable_sort algorithm for ordering the obtained results.
STL7Mix54°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <Scores> <School number> <Family name> <Initials> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. For each school, find the average value of the total score obtained by the students of this school (the average value is the result of integer dividing the sum of all students' scores by the number of students). Information about each school should be displayed on a new line, indicating the average total score and school number. The data should be ordered by descending average score, and in case of equal values of the average score — by ascending school number. Note. Compare with STL7Mix53. In this case, as the mapping type for grouping, one can use map<int, pair<int, int>>.
STL7Mix55°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <Scores> <Family name> <Initials> <School number> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. Output information about students who scored at least 50 points in each subject (first output the family name and initials, then the school number and the total score for all subjects). Information about each student should be displayed on a new line in alphabetical order of family names and initials, and if they coincide — in the order of students in the initial sequence. If none of the students meet the specified conditions, then write the text "Students not found" to the resulting file. Note. Use the remove_if algorithm.
STL7Mix56°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <Family name> <Initials> <Scores> <School number> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. Output information about students who scored more than 90 points in at least one of the subjects (first output the family name and initials, then the school number). Information about each student should be displayed on a new line and arranged in alphabetical order of family names and initials, and if they coincide — in ascending order of school number. If none of the students meet the specified conditions, then write the text "Students not found" to the resulting file. Note. Compare with STL7Mix55.
STL7Mix57°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <School number> <Family name> <Initials> <Scores> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. For each school, output the family names and initials of the first three students (in alphabetical order) who scored less than 50 points in each subject (first output school number, then family name and initials). Information about each student should be displayed on a new line and arranged in ascending order of school numbers, and for the same school number — in alphabetical order of family names and initials. If for some school there are less than three students meeting the specified conditions, output information about all such students. If there are no students in the initial sequence that meet the specified conditions, then write the text "Students not found" to the resulting file. Note. Use an auxiliary mapping of type map<int, multiset<string>> for grouping the initial data.
STL7Mix58°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <Family name> <Initials> <School number> <Scores> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. For each school, find the first three students (in alphabetical order) who scored less than 50 points in at least one subject and output their family name, initials and school number. Information about each student should be displayed on a new line and arranged in alphabetical order of family names and initials, and if they coincide — in ascending order of school number. If for some school there are less than three students meeting the specified conditions, output information about all such students. If there are no students in the initial sequence that meet the specified conditions, then write the text "Students not found" to the resulting file. Note. Compare with STL7Mix57.
STL7Mix59°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <School number> <Scores> <Family name> <Initials> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. For each school and each subject, determine the number of students who scored at least 50 points in that subject (the school number is displayed first, followed by three numbers — the number of students in that school who scored the required number of points in mathematics, physics and chemistry; some of the numbers may be equal to 0). The information about each school should be displayed on a new line and ordered by ascending school number. Note. For grouping the initial data, use an auxiliary mapping of type map<int, vector<int>>.
STL7Mix60°. The initial sequence contains information about the results of exams passed by students in mathematics, physics and chemistry (in the specified order). Each element of the sequence includes the following fields: <Family name> <Initials> <Scores> <School number> Scores are three integers ranging from 0 to 100, which are separated from each other by one space. For each school and each subject, find the average value of the score obtained by the students of this school (the average value is the result of integer dividing the sum of all students' scores by the number of students). Information about each school should be displayed on a new line, indicating the school number and average scores in mathematics, physics and chemistry. The data should be ordered by descending school number. Note. Compare with STL7Mix59.
STL7Mix61°. The initial sequence contains information about students' grades in three subjects: algebra, geometry and physics. Each element of the sequence contains data about one grade and includes the following fields: <Family name> <Initials> <Class number> <Course name> <Grade> There are no full namesakes (with matching last name and initials) among the students. Class number is specified as an integer, grade is an integer in the range of 2–5. The name of the subject is given with a capital letter. For each student, determine the average grade for each subject and output it with two fractional digits (if a student has not received any grade in any subject, output 0.00 for that subject). Output information about each student on a new line, indicating family name, initials and average grades in algebra, geometry and physics. Arrange the data in alphabetical order of family names and initials. Note. For grouping the initial data, use an auxiliary mapping of type map<string, map<string, pair<double, int>>>. In the pair pair<double, int> accumulate the total grade (in the first element) and the number of grades (in the second element); after processing all initial data, it is sufficient to divide the first element by the second and save the obtained average value in the first element of the pair (if the second element is 0, then division should not be performed).
STL7Mix62°. The initial sequence contains information about students' grades in three subjects: algebra, geometry and physics. Each element of the sequence contains data about one grade and includes the following fields: <Class number> <Family name> <Initials> <Grade> <Subject name> There are no full namesakes (with matching last name and initials) among the students. Class number is specified as an integer, grade is an integer in the range of 2–5. The name of the subject is given with a capital letter. For each student, determine the number of grades for each subject (if a student has not received any grade in any subject, then output the number 0 for that subject). Output information about each student on a new line, indicating class, family name, initials and number of grades in algebra, geometry and physics. The data should be arranged in ascending order of class numbers, and for the same class — in alphabetical order of family names and initials. Note. For grouping the initial data, use an auxiliary mapping of type map<int, map<string, map<string, int>>>.
STL7Mix63°. The initial sequence contains information about students' grades in three subjects: algebra, geometry and physics. Each element of the sequence contains data about one grade and includes the following fields: <Subject name> <Family name> <Initials> <Class number> <Grade> There are no full namesakes (with matching last name and initials) among the students. Class number is specified as an integer, grade is an integer in the range of 2–5. The name of the subject is given with a capital letter. Output information about students with an average grade of 4 or less in algebra: family name, initials, class number and average grade in algebra (output with two fractional digits). For students who do not have any algebra grade, consider the average grade to be 0.00. Information about each student should be displayed on a new line and arranged in alphabetical order of their family names and initials. If none of the students satisfies the specified conditions, write the text "Students not found" to the resulting file. Note. For grouping the initial data, use an auxiliary mapping of type map<pair<string, int>, pair<double, int>>. Regarding the pair pair<double, int> see the note for STL7Mix61.
STL7Mix64°. The initial sequence contains information about students' grades in three subjects: algebra, geometry and physics. Each element of the sequence contains data about one grade and includes the following fields: <Class number> <Family name> <Initials> <Subject name> <Grade> There are no full namesakes (with matching last name and initials) among the students. Class number is specified as an integer, grade is an integer in the range of 2–5. The name of the subject is given with a capital letter. Output information about students who have an average grade of at least 4 in physics: class number, family name, initials and average grade in physics (output with two fractional digits). Information about each student should be displayed on a new line and arranged in ascending order of class numbers, and for the same class — in alphabetical order of family names and initials. If none of the students meets the specified conditions, then write the text "Students not found" to the resulting file. Note. Compare with STL7Mix63. In this case, for grouping the initial data, one can use an auxiliary mapping of type map<pair<int, string>, pair<double, int>>.
STL7Mix65°. The string S is the name of one of three subjects: algebra, geometry or physics. The initial sequence contains information about students' grades in three subjects: algebra, geometry and physics. Each element of the sequence contains data about one grade and includes the following fields: <Family name> <Initials> <Subject name> <Grade> <Class number> There are no full namesakes (with matching last name and initials) among the students. Class number is specified as an integer, grade is an integer in the range of 2–5. The name of the subject is given with a capital letter. For each class present in the initial sequence, determine the number of students who have an average grade of 3.5 or less in subject S or who have no grades in this subject. Output each class on a new line, indicating the number of students found (the number can be 0) and the class number. The data should be ordered by ascending number of students, and for the same number — by descending class number. Note. For grouping the initial data, use an auxiliary mapping of type map<int, map<string, pair<double, int>>, greater<int>>, then build a vector of type vector<pair<int, int>> based on it and sort it in the required manner. Regarding the pair pair<double, int>> see the note for STL7Mix61.
STL7Mix66°. The string S is the name of one of three subjects: algebra, geometry or physics. The initial sequence contains information about students' grades in three subjects: algebra, geometry and physics. Each element of the sequence contains data about one grade and includes the following fields: <Subject name> <Family name> <Initials> <Grade> <Class number> There are no full namesakes (with matching last name and initials) among the students. Class number is specified as an integer, grade is an integer in the range of 2–5. The name of the subject is given with a capital letter. For each class present in the initial sequence, determine the number of students who have an average grade of at least 3.5 in subject S and who have not received a grade 2 in this subject. Output the information about each class on a new line, indicating the class number and the number of students found (the number can be equal to 0). The data should be ordered by ascending class number. Note. Compare with STL7Mix65. If the auxiliary mapping is described as map<int, map<string, pair<double, int>>>, then for the auxiliary vector built on its basis, no additional sorting will be required.
STL7Mix67°. The initial sequence contains information about students' grades in three subjects: algebra, geometry and physics. Each element of the sequence contains data about one grade and includes the following fields: <Class number> <Subject name> <Family name> <Initials> <Grade> There are no full namesakes (with matching last name and initials) among the students. Class number is specified as an integer, grade is an integer in the range of 2–5. The name of the subject is given with a capital letter. Find all the students who received at least one grade 2 in a subject. Output information about each of these students: class number, family name, initials and the number of grades 2 received. The information about each student should be displayed on a new line and arrange it in descending order of classes, and for the same class — in alphabetical order of family names and initials. If there are no students in the initial sequence that meet the specified conditions, then write the text "Students not found" to the resulting file. Note. Organize the storage of data about the required students in an auxiliary mapping of type map<pair<int, string>, int, greater_less>, having previously described the functional object greater_less to implement the key pair comparison variant described in the task (class numbers should be ordered in descending order, and student names within a class — in alphabetical order).
STL7Mix68°. The initial sequence contains information about students' grades in three subjects: algebra, geometry and physics. Each element of the sequence contains data about one grade and includes the following fields: <Class number> <Grade> <Family name> <Initials> <Subject name> There are no full namesakes (with matching last name and initials) among the students. Class number is specified as an integer, grade is an integer in the range of 2–5. The name of the subject is given with a capital letter. Find all students who have not received any grades 2 or 3, but have at least one grade 4 in any subject. Output information about each found student: the number of grades 4 received, family name, initials and class number. The information about each student should be displayed on a new line and arranged in ascending order of the number of grades 4, and for the same number — in alphabetical order of family names and initials. If there are no students in the initial sequence that meet the specified conditions, then write the text "Students not found" to the resulting file. Note. Organize the storage of data about the required students in an auxiliary mapping of type map<pair<string, int>, pair<int, int>>, saving in the first component of the key pair the student name, and in the second — the class number, and accumulating in the first component of the value pair the number of grades of 4 received by the student, and in the second — the number of grades of 2 and 3. After completing the processing of the initial data, it remains to transform the obtained mapping into a vector of type vector<pair<pair<string, int>, pair<int, int>>>, remove from it the information about students who have a non-zero number of grades of 2 and 3, and traverse it with the stable_sort algorithm by increasing number of grades of 4 received.
STL7Mix69°. The initial sequence contains information about students' grades in three subjects: algebra, geometry and physics. Each element of the sequence contains data about one grade and includes the following fields: <Class number> <Family name> <Initials> <Subject name> <Grade> There are no full namesakes (with matching last name and initials) among the students. Class number is specified as an integer, grade is an integer in the range of 2–5. The name of the subject is given with a capital letter. For each class, find students who received the maximum total number of grades 2 in this class for all subjects (the number should not be zero). Output information about each of the found students: family name, initials, class number and the number of grades 2 received. The information about each student should be displayed on a new line and arranged in alphabetical order of their family names and initials (no sorting by class). If there are no grades 2 in the initial sequence, write the text "Students not found" to the resulting file. Note. For data grouping, use a mapping of type map<int, map<string, int>> (data is grouped by classes, only the students with grades of 2 are added to each class, and for them the number of their grades of 2 is saved). Then, using the max_element algorithm for each class, build a mapping in which for each class the maximum number of grades of 2 received by its students is stored, and using this mapping build the final mapping containing data about all students who received in each class the maximum number of grades of 2 (if the keys in this mapping are student names, then the data will be automatically sorted in the manner required by the task).
STL7Mix70°. The initial sequence contains information about students' grades in three subjects: algebra, geometry and physics. Each element of the sequence contains data about one grade and includes the following fields: <Grade> <Class number> <Family name> <Initials> <Subject name> There are no full namesakes (with matching last name and initials) among the students. Class number is specified as an integer, grade is an integer in the range of 2–5. The name of the subject is given with a capital letter. For each class, find the top-performing students, that is, students who received the maximum total number of grades 5 in the given class in all subjects (the number should not be zero). When searching for these students (in particular, when determining the maximum total number of grades 5), students with at least one grade 2 or 3 should be excluded. Output information about each of the top-performing students: class number, family name, initials and the number of grades 5 received. The information about each student should be displayed on a new line and arrange in ascending order of classes, and for the same classes — in alphabetical order of family names and initials. If there are no students in the initial sequence that meet the specified conditions, then write the text "Students not found" to the resulting file. Note. Compare with STL7Mix69. In this case, during the initial grouping, it is necessary to save not only the number of grades of 5, but also the number of grades of 2 and 3 received. Then it is necessary to remove students who received grades of 2 and 3, after which act as when solving STL7Mix69, taking into account that the final data needs to be sorted in a different order.
Processing Multiple Related Sequences
STL7Mix71°. Sequences A and C are given, including the following fields: A: <Consumer code> <Year of birth> <Street of residence> C: <Consumer code> <Discount (percentage)> <Shop name> The properties of the sequences are described in the subgroup preamble. For each shop, determine the consumers who have the maximum discount in this shop (the shop name is displayed first, followed by the consumer code, his/her year of birth and the value of the maximum discount). If for some shop there are several consumers with the maximum discount, then output the data about the consumer with the minimum code. The information about each shop should be displayed on a new line and ordered alphabetically by shop name.
STL7Mix72°. Sequences A and C are given, including the following fields: A: <Consumer code> <Street of residence> <Year of birth> C: <Discount (percentage)> <Consumer code> <Shop name> The properties of the sequences are described in the subgroup preamble. For each consumer specified in A, determine the number of shops in which he/she gets a discount (first output the number of shops, then the consumer code, then his/her street of residence). If some consumer does not have a discount in any shop, then the number of shops for him/her is output as zero. Information about each consumer should be displayed on a new line and ordered by ascending number of shops, and for the same number — by ascending consumer code.
STL7Mix73°. Sequences A and C are given, including the following fields: A: <Year of birth> <Consumer code> <Street of residence> C: <Consumer code> <Shop> <Discount (percentage)> The properties of the sequences are described in the subgroup preamble. For each shop and each street, determine the number of consumers who live on that street and have a discount at that shop (first output the shop name, then the street name, then the number of consumers with a discount). If for some "shop–street" pair consumers with a discount are not found, the data about this pair are not output. Information about each "shop–street" should be displayed on a new line and ordered by shop names in alphabetical order, and for the same shop — by street names (also in alphabetical order).
STL7Mix74°. Sequences A and C are given, including the following fields: A: <Street of residence> <Consumer code> <Year of birth> C: <Shop name> <Discount (percentage)> <Consumer code> The properties of the sequences are described in the subgroup preamble. For each shop and each year of birth from A, determine the average discount in this shop (in percent) for consumers with this year of birth (first output the shop name, then the year of birth, then the value of the average discount in percent). The fractional part of the found average value is discarded, the discount is displayed as an integer. When calculating the average discount, only consumers of the given year of birth who have a discount in the given shop are taken into account. If there are no such consumers for a given shop, then for this "shop–year" pair the zero value is output as the average discount. Information about each "shop–year" pair should be displayed on a new line and ordered by shop names in alphabetical order, and for the same shop — in ascending order of year numbers.
STL7Mix75°. Sequences B and D are given, including the following fields: B: <Product article> <Product type> <Country of manufacture> D: <Shop name> <Product article> <Price> The properties of the sequences are described in the subgroup preamble. For each shop and each type of products, determine the number of different articles of product of this type available in this shop (first output the shop name, then the product type, then the number of different product articles). If for some shop there are no products of this type, the information about the corresponding "shop–type" pair is not output. Information about each "shop–type" pair should be displayed on a new line and ordered by shop names in alphabetical order, and for the same shop — by type names (also in alphabetical order).
STL7Mix76°. Sequences B and D are given, including the following fields: B: <Country of manufacture> <Product type> <Product article> D: <Product article> <Shop name> <Price> The properties of the sequences are described in the subgroup preamble. For each country of manufacture, determine the number of shops offering products produced in this country, as well as the minimum price for products from this country for all shops (first output the number of shops, then the country name, then the minimum price). If for some country no products are found in any shop, then the number of shops and the minimum price are assumed to be 0. The information about each country should be displayed on a new line and ordered by the ascending number of shops, and for the same number of shops — by the names of countries in alphabetical order.
STL7Mix77°. Sequences B and D are given, including the following fields: B: <Product type> <Product article> <Country of manufacture> D: <Product article> <Price> <Shop name> The properties of the sequences are described in the subgroup preamble. For each type of products, determine the number of shops that offer products of this type, as well as the number of countries in which the products of this type, presented in shops, are produced (the number of shops is displayed first, then the type name, then the number of countries). If for some type there are no products presented in any shop, then the information about this type is not output. Information about each type should be displayed on a new line and ordered by descending number of shops, and for the same number of shops — by type names in alphabetical order.
STL7Mix78°. Sequences D and E are given, including the following fields: D: <Price> <Product article> <Shop name> E: <Consumer code> <Shop name> <Product article> The properties of the sequences are described in the subgroup preamble. For each product, determine the number of purchases of this product and the maximum purchase price (the number of purchases is displayed first, then the product article, then the maximum purchase price). If some product has never been sold, the information about this product is not output. Information about each product should be displayed on a new line and ordered by ascending number of purchases, and for the same number of purchases — by product articles in alphabetical order.
STL7Mix79°. Sequences D and E are given, including the following fields: D: <Shop name> <Price> <Product article> E: <Consumer code> <Product article> <Shop name> The properties of the sequences are described in the subgroup preamble. For each shop and each consumer, determine the total value of purchases made by this consumer in this shop (first output the shop name, then the consumer code, then the total value of purchases). If the consumer has not purchased any products in a certain shop, the information about the corresponding "shop–consumer" pair is not output. Information about each "shop–consumer" pair should be displayed on a new line and ordered by shop names in alphabetical order, and for the same shop — in ascending order of consumer codes.
STL7Mix80°. Sequences D and E are given, including the following fields: D: <Price> <Shop name> <Product article> E: <Product article> <Shop name> <Consumer code> The properties of the sequences are described in the subgroup preamble. For each "shop–product" pair specified in D, determine the total value of sales of this product in this shop (first output the shop name, then the product article, then the total value of its sales). If the product has never been sold in a certain shop, then for the corresponding "shop–product" pair the zero value is output as the total value. Information about each "shop–product" pair should be displayed on a new line and arranged by shop names in alphabetical order, and for the same shop — by product articles (also in alphabetical order).
STL7Mix81°. Sequences B, D and E are given, including the following fields: B: <Product article> <Country of manufacture> <Product type> D: <Shop name> <Product article> <Price (in rubles)> E: <Shop name> <Consumer code> <Product article> The properties of the sequences are described in the subgroup preamble. For each country of manufacture, determine the number of purchased products from this country and the total cost of purchased products (first output the country name, then the number of products, then the total cost). If there is no information about the sold products for some country, the information about this country is not output. Information about each country should be displayed on a new line and ordered alphabetically by country names.
STL7Mix82°. Sequences B, D and E are given, including the following fields: B: <Product type> <Country of manufacture> <Product article> D: <Price> <Product article> <Shop name> E: <Product article> <Consumer code> <Shop name> The properties of the sequences are described in the subgroup preamble. For each consumer, determine the number of types of products purchased by him/her and the maximum price of one of his/her purchases (the number of product types is displayed first, then the consumer code, then the maximum purchase price). Information about each consumer should be displayed on a new line and ordered by descending number of types, and for the same number of types — by ascending consumer code.
STL7Mix83°. Sequences B, D and E are given, including the following fields: B: <Country of manufacture> <Product article> <Product type> D: <Price (in rubles)> <Shop name> <Product article> E: <Shop name> <Product article> <Consumer code> The properties of the sequences are described in the subgroup preamble. For each shop specified in E and each country of manufacture, determine the total value of products from this country sold in this shop (first output the shop name, then the country name, then the total value). If for some "shop–country" pair there is no information about the sold products, then 0 is output as the total value. Information about each "shop–country" pair should be displayed on a new line and ordered by shop names in alphabetical order, and for the same shop — by country names (also in alphabetical order).
STL7Mix84°. Sequences C, D and E are given, including the following fields: C: <Discount (percentage)> <Shop name> <Consumer code> D: <Product article> <Shop name> <Price> E: <Product article> <Shop name> <Consumer code> The properties of the sequences are described in the subgroup preamble. For each shop and each product, determine the number of discounted purchases of this product in this shop and the total cost of these purchases with the discount (the shop name is displayed first, then the product article, then the number of discounted purchases and their total cost). When calculating the discount amount for a product, the fractional part is discarded. If no discounted purchases are found for some "shop–product" pair, the information about this pair is not output. If no matching "shop–product" pair is found, then write the text "Data not found" to the resulting file. Information about each "shop–product" pair should be displayed on a new line and ordered by shop names in alphabetical order, and for the same shop — by product articles (also in alphabetical order).
STL7Mix85°. Sequences C, D and E are given, including the following fields: C: <Shop name> <Consumer code> <Discount (percentage)> D: <Product article> <Price> <Shop name> E: <Product article> <Consumer code> <Shop name> The properties of the sequences are described in the subgroup preamble. For each "consumer–shop" pair specified in E, determine the total amount of discounts for all products purchased by this consumer in this shop (the consumer code is displayed first, then the shop name, then the total amount of discount). When calculating the discount amount for each purchased product, the fractional part is discarded. If the consumer has purchased products from some shop without a discount, no information about the matching "consumer–shop" pair is output. If no matching "consumer–shop" pair is found, then write the text "Data not found" to the resulting file. Information about each "consumer–shop" pair should be displayed on a new line and ordered by ascending consumer code, and for the same code — by shop names in alphabetical order.
STL7Mix86°. Sequences C, D and E are given, including the following fields: C: <Discount (percentage)> <Consumer code> <Shop name> D: <Shop name> <Price> <Product article> E: <Consumer code> <Shop name> <Product article> The properties of the sequences are described in the subgroup preamble. For each "product–shop" pair specified in E, determine the maximum discount for this product when it is purchased in this shop (the product article is displayed first, then the shop name, then the maximum discount). When calculating the size of the discount for a product, the fractional part is discarded. If all sales of a product in a certain shop were conducted without a discount, then 0 is output as the maximum size of the discount for this pair. Information about each "product–shop" pair should be displayed on a new line and ordered by product articles in alphabetical order, and for the same article — by the names of shops (also in alphabetical order).
STL7Mix87°. Sequences A, D and E are given, including the following fields: A: <Year of birth> <Street of residence> <Consumer code> D: <Product article> <Shop name> <Price> E: <Shop name> <Consumer code> <Product article> The properties of the sequences are described in the subgroup preamble. For each street of residence and each shop specified in E, determine the total cost of purchases in this shop made by all consumers living on this street (first output the name of the street, then the name of the shop, then the total cost of purchases). If for some "street–shop" pair there is no information about the sold products, then 0 is output as the total cost. Information about each "street–shop" pair should be displayed on a new line and ordered by street names in alphabetical order, and for the same street — by shop names (also in alphabetical order).
STL7Mix88°. Sequences A, D and E are given, including the following fields: A: <Street of residence> <Year of birth> <Consumer code> D: <Product article> <Price> <Shop name> E: <Shop name> <Product article> <Consumer code> The properties of the sequences are described in the subgroup preamble. For each year of birth specified in A and each product specified in E, determine the total value of purchases of this product made by all consumers with this year of birth (first output the year of birth, then the product article, then the total value of purchases). If for some "year–product" pair there is no information about the sold products, the information about this pair is not output. Information about each "year–product" pair should be displayed on a new line and ordered by descending year number, and for the same year — by product articles in alphabetical order.
STL7Mix89°. Sequences A, D and E are given, including the following fields: A: <Consumer code> <Year of birth> <Street of residence> D: <Shop name> <Price> <Product article> E: <Consumer code> <Product article> <Shop name> The properties of the sequences are described in the subgroup preamble. For each shop specified in E, find the consumer with the lowest year of birth, who bought one or more products in this shop (first output the shop name, then the consumer code, year of birth and the total cost of products purchased by the consumer in this shop). If for some shop there are several consumers with the lowest year of birth, the data on all such consumers are output. Information about each "shop–consumer" pair should be displayed on a new line and ordered by shop names in alphabetical order, and for the same shop — in ascending order of consumer codes.
STL7Mix90°. Sequences A, B and E are given, including the following fields: A: <Street of residence> <Consumer code> <Year of birth> B: <Country of manufacture> <Product type> <Product article> E: <Product article> <Consumer code> <Shop name> The properties of the sequences are described in the subgroup preamble. For each year of birth from A, determine the country in which the maximum number of products purchased by consumers of this year of birth was produced (first output the year of birth, then the country name, then the maximum number of purchases). If for some "year–country" pair there is no information about products sold, then this pair is not processed (in particular, if consumers of some birth year did not make any purchases, then information about this year is not output). If for any year of birth there are several countries with the largest number of purchased products, then data on the first of such countries (in alphabetical order) are output. Information about each year should be displayed on a new line and ordered by descending year number.
STL7Mix91°. Sequences A, B and E are given, including the following fields: A: <Street of residence> <Year of birth> <Consumer code> B: <Product article> <Country of manufacture> <Product type> E: <Shop name> <Product article> <Consumer code> The properties of the sequences are described in the subgroup preamble. For each street and each product type, determine the number of countries in which the products of this type purchased by consumers living on this street were produced (first output the street name, then the type name, then the number of countries). If for some type there is no information about products purchased by the residents of some street, then information about the corresponding "street–type" pair is not output. Information about each "street–type" pair should be displayed on a new line and ordered by street names in alphabetical order, and for the same street — by type names (also in alphabetical order).
STL7Mix92°. Sequences A, B and E are given, including the following fields: A: <Year of birth> <Street of residence> <Consumer code> B: <Country of manufacture> <Product article> <Product type> E: <Product article> <Shop name> <Consumer code> The properties of the sequences are described in the subgroup preamble. For each product type, determine the street with the maximum total number of products of this type purchased by the residents of this street (first output the type name, then the street name, then the maximum total number of purchases). If for some type there is no information about the products purchased by the residents of some street, then the total number of purchases for the corresponding "type–street" pair is considered to be equal to 0 (therefore, it is possible that the largest number of purchases for some product type is equal to 0). If for some type there are several streets with the largest number of purchases, the data on all such streets are displayed. The information about each "type–street" pair should be displayed on a new line and ordered alphabetically by type names, and for the same type — by street names (also in alphabetical order).
STL7Mix93°. Sequences A, B, C and E are given, including the following fields: A: <Consumer code> <Street of residence> <Year of birth> B: <Product type> <Country of manufacture> <Product article> C: <Shop name> <Consumer code> <Discount (percentage)> E: <Consumer code> <Product article> <Shop name> The properties of the sequences are described in the subgroup preamble. For each country of manufacture and street of residence, determine the maximum discount (in percent) for products manufactured in this country and purchased by consumers living on this street (first output the name of the country, then the name of the street, then the maximum discount). If, for some "country–street" pair, all products were purchased without a discount, then 0 is output as the maximum discount value. If for some "country–street" pair there is no information about purchased products, then information about this pair is not output. Information about each "country–street" pair should be displayed on a new line and ordered by country names in alphabetical order, and for the same country — by street names (also in alphabetical order).
STL7Mix94°. Sequences A, B, C and E are given, including the following fields: A: <Year of birth> <Consumer code> <Street of residence> B: <Product article> <Product type> <Country of manufacture> C: <Consumer code> <Shop name> <Discount (percentage)> E: <Shop name> <Consumer code> <Product article> The properties of the sequences are described in the subgroup preamble. For each shop specified in E and each product type, determine the minimum value of the year of birth of those consumers who purchased one or more products of this type in this shop, and the number of products of this type purchased at a discount in this shop by consumers of this year of birth (the shop name is displayed first, then the type name, then the minimal year of birth and the number of products purchased at a discount). If for some "shop–type" pair there is no information about the purchased products, the data about this pair is not output. If for some "shop–type" pair consumers with the minimum year of birth purchased all products without discount, then 0 is output as the number of products purchased with discount. Information about each "shop–type" pair should be displayed on a new line and arranged by shop names in alphabetical order, and for the same shop — by type names (also in alphabetical order).
STL7Mix95°. Sequences A, C, D, and E are given, including the following fields: A: <Consumer code> <Street of residence> <Year of birth> C: <Shop name> <Discount (percentage)> <Consumer code> D: <Shop name> <Product article> <Price> E: <Consumer code> <Shop name> <Product article> The properties of the sequences are described in the subgroup preamble. For each product article specified in E and each street of residence, determine the total amount of discount for products of this article purchased by consumers living on this street (first the product article is displayed, then the street name, then the total amount of discount). When calculating the discount amount for a product, the fractional part is discarded. If there is no discount on the sold products, the discount value is assumed to be 0. If for some "product–street" pair there is no information about the purchased products, the data about this pair is not output. If for some "product–street" pair all products were purchased without discounts, then 0 is output as the total discount for this pair. Information about each "product–street" pair should be output on a new line and ordered by product articles in alphabetical order, and for the same product article — by street names (also in alphabetical order).
STL7Mix96°. Sequences A, C, D and E are given, including the following fields: A: <Street of residence> <Year of birth> <Consumer code> C: <Consumer code> <Discount (percentage)> <Shop name> D: <Price> <Product article> <Shop name> E: <Shop name> <Product article> <Consumer code> The properties of the sequences are described in the subgroup preamble. For each year of birth specified in A and each shop specified in E, determine the total cost of all products (with discount) sold in this shop to consumers of the given year of birth (the year number is displayed first, then the shop name, then the total cost of products sold including discount). When calculating the discount amount for products, the fractional part is discarded. If there is no discount on the sold products, its size is assumed to be 0. If for some "year–shop" pair there is no information about the sold products, the information about this pair is not output. Information about each "year–shop" pair should be displayed on a new line and ordered by ascending year number, and for the same year — by the names of shops in alphabetical order.
STL7Mix97°. Sequences B, C, D and E are given, including the following fields: B: <Product type> <Product article> <Country of manufacture> C: <Discount (percentage)> <Shop name> <Consumer code> D: <Price> <Shop name> <Product article> E: <Shop name> <Consumer code> <Product article> The properties of the sequences are described in the subgroup preamble. For each country of manufacture and each consumer, determine the total cost (with discount) of all products produced in this country and purchased by this consumer (first output the name of the country, then the consumer code, then the total cost including the discount). When calculating the discount amount for a product, the fractional part is discarded. If there is no discount on the sold product, its size is assumed to be 0. If for some "country–consumer" pair there is no data on purchases, the information about this pair is not output. Information about each "country–consumer" pair should be displayed on a new line and ordered by country names in alphabetical order, and for the same country — in ascending order of consumer codes.
STL7Mix98°. Sequences B, C, D, and E are given, including the following fields: B: <Country of manufacture> <Product article> <Product type> C: <Discount (percentage)> <Consumer code> <Shop name> D: <Product article> <Price> <Shop name> E: <Consumer code> <Product article> <Shop name> The properties of the sequences are described in the subgroup preamble. For each product type and each shop specified in E, determine the total discount for all products of this type sold in this shop (the type name is displayed first, then the shop name, then the total discount). When calculating the size of the discount for a product, the fractional part is discarded. If there is no discount on the sold products, its size is assumed to be 0. If there were no sales for some type of products in some shop, then the total discount for this "type–shop" pair is assumed to be equal to −1. Information about each "type–shop" pair should be displayed on a new line and ordered by type names in alphabetical order, and for the same type — by shop names (also in alphabetical order).
STL7Mix99°. Sequences A, B, D and E are given, including the following fields: A: <Consumer code> <Street of residence> <Year of birth> B: <Product type> <Country of manufacture> <Product article> D: <Product article> <Shop name> <Price> E: <Product article> <Shop name> <Consumer code> The properties of the sequences are described in the subgroup preamble. For each type of products and each street of residence, determine the shop that sold the products of this type at the minimum price to the consumer living on this street (first output the name of the product type, then the name of the street, then the name of the shop and the minimum price of the products). If for some "type–street" pair there is no information about the sold products, the information about this pair is not output. If for some "type–street" pair there are several shops that sold products at the minimum price, then data about all such shops are output. Information about each "type–street–shop" triple should be displayed on a new line and ordered by product type names in alphabetical order, for the same type — by street names, and for the same street — by shop names (also in alphabetical order).
STL7Mix100°. Sequences A, B, D and E are given, including the following fields: A: <Street of residence> <Consumer code> <Year of birth> B: <Product article> <Country of manufacture> <Product type> D: <Shop name> <Price> <Product article> E: <Product article> <Consumer code> <Shop name> The properties of the sequences are described in the subgroup preamble. For each country of manufacture and each shop, determine the consumer with the highest year of birth who bought one or more products produced in this country in this shop (first output the name of the country, then the name of the shop, then the consumer's year of birth, his/her code, and the total cost of products from this country bought in this shop). If for some "country–shop" pair there is no information about the sold products, the information about this pair is not output. If for some "country–shop" pair there are several consumers with the highest year of birth, then information about all such consumers is output. Information about each "country–shop–consumer" triple should be displayed on a new line and ordered by country names in alphabetical order, for the same country — by shop names (also in alphabetical order), and for the same shop — in ascending order of consumer codes.
|