{"kind":"task","effective_mode":"full","benchmark":{"kind":"benchmark","effective_mode":"full","slug":"hlce","formal_name":"Humanity's Last Code Exam","introduction":"Humanity's Last Code Exam evaluates problem solving and code generation using ICPC World Finals and IOI problems. The project describes 235 problems; this import selects its public ICPC dataset of 146 problems.","introduction_ja":"","introduction_en":"","category":"Category not supplied","task_count":null,"acquisition_status":"Acquisition status not supplied","official_url":"https://humanity-s-last-code-exam.github.io/website/","indexing_mode":"noindex","profile":{"resources":[],"task_format":"","scoring":"","metric":"","size":"","answer_access":"","license":"","citation":"","maintainer":"","released":"","why_hard":"","related":[]}},"task_id":"7118efa1-7efa-5341-8f4a-e0ed899e9adf","task_key":"ICPC~2dWorld~2dFinals--examples--2017~5fD","task_revision_id":"2","upstream_id":"2017_D","short_description":"Money for Nothing","config":"ICPC-World-Finals","split":"examples","body":"{\"platform\":\"atcoder\",\"question_content\":\"## Problem Statement\\n\\nIn this problem, you will be solving one of the most profound challenges of humans across the world since the beginning of time – how to make lots of money.\\n\\nYou are a middleman in the widget market. Your job is to buy widgets from widget producer companies and sell them to widget consumer companies. Each widget consumer company has an open request for one widget per day, until some end date, and a price at which it is willing to buy the widgets. On the other hand, each widget producer company has a start date at which it can start delivering widgets and a price at which it will deliver each widget.\\n\\nDue to fair competition laws, you can sign a contract with only one producer company and only one consumer company. You will buy widgets from the producer company, one per day, starting on the day it can start delivering, and ending on the date specified by the consumer company. On each of those days, you earn the difference between the producer’s selling price and the consumer’s buying price.\\n\\nYour goal is to choose the consumer company and the producer company that will maximize your profits.\\n\\n### Input\\n\\nThe first line of input contains two integers \\\\( m \\\\) and \\\\( n \\\\) (\\\\(1 \\\\leq m, n \\\\leq 500,000\\\\)) denoting the number of producer and consumer companies in the market, respectively. It is followed by \\\\( m \\\\) lines, the \\\\( i \\\\)-th of which contains two integers \\\\( p_i \\\\) and \\\\( d_i \\\\) (\\\\(1 \\\\leq p_i, d_i \\\\leq 10^9\\\\)), the price (in dollars) at which the \\\\( i \\\\)-th producer sells one widget and the day on which the first widget will be available from this company. Then follow \\\\( n \\\\) lines, the \\\\( j \\\\)-th of which contains two integers \\\\( q_j \\\\) and \\\\( e_j \\\\) (\\\\(1 \\\\leq q_j, e_j \\\\leq 10^9\\\\)), the price (in dollars) at which the \\\\( j \\\\)-th consumer is willing to buy widgets and the day immediately after the day on which the last widget has to be delivered to this company.\\n\\n### Output\\n\\nDisplay the maximum total number of dollars you can earn. If there is no way to sign contracts that gives you any profit, display 0.\\n\\n### Sample Input 1\\n\\n```\\n2 2\\n1 3\\n2 1\\n3 5\\n7 2\\n```\\n\\n### Sample Output 1\\n\\n```\\n5\\n```\\n\\n### Sample Input 2\\n\\n```\\n1 2\\n10 10\\n9 11\\n11 9\\n```\\n\\n### Sample Output 2\\n\\n```\\n0\\n```\",\"question_title\":\"Money for Nothing\"}","display_format":"text","language":"","answer_status":"published","assets":[],"source_url":"https://humanity-s-last-code-exam.github.io/website/","history":"initial import","indexing_mode":"noindex","subproblems":[],"grids":[]}