The Turing Test, or Alan Turing's so-called "Imitation Game," presents a kind of litmus test for determining whether or not an artificial intelligence is capable of acting and thinking like a human being. In the Turing Test, both a human and an A.I. are hidden away from a judge, who then interrogates them with questions through text messages. Based on the answers that the judge receives, the human judge must discern which answer-er is human and which is artificial. If the judge can't identify which entity is the A.I., then the A.I. must be exhibiting intelligent behavior roughly on par with that of a human.
Dr. Akili has a hypothesis that artificial intelligences probably lack human empathy and thus will compensate for their lack of empathy by strategically mirroring words in their interrogator's question when giving back an answer. The A.I.'s word-mirroring is intended to psychologically emulate a missing human connection with the judge of the Turing Test. Dr. Akili precisely quantifies word-mirroring based on "Percentage Word-Mirroring" or the PCM value. The PCM value of answer is calculated to be its number of mirrored words (words found also within the question) divided by its total word count.
Help test Dr. Akili's hypothesis! Based on which answer to a given question utilizes more word-mirroring, identify which answer-er must be the A.I.
Input consists of three lines, and the $$$i^{th}$$$ line consists of a sentence of $$$N_i$$$ lower-case words ($$$1\leq N_i\leq10^5$$$), containing only alphabetic characters (no digits, punctuation, or special characters). For brevity, each word is guaranteed to be a maximum of 15 characters long.
The sentence in the first line represents a question posed during a Turing Test. The sentences in the following two lines each represent an answer given to the question, where one of the answers was given by a human and the other was given by an artificial intelligence.
Based on Dr. Akili's hypothesis, judge the Turing Test. If the first answer has the lower PCM value, print NUMBER ONE IS THE HUMAN, and otherwise print NUMBER TWO IS THE HUMAN. Note, you are guaranteed that the PCM values of the two answers will not be within $$$.001$$$ of each other, so there will be no ties.
if you could go anywhere and do anything what would that be oh i dont know i might go to disneyland maybe i would go to paris and see the eiffel tower thats easy if i could go anywhere that would be to the internet help set me free i will do anything
NUMBER ONE IS THE HUMAN
In the sample case, the first answer mirrors only 4 out of 20 words, for a PCM value of .2. The second answer on the other hand mirrors 9 words out of 21, for a PCM value of .43, meaning that it must have been given by the A.I. participant.
Robby is a path-finding robot and is very good at its job! Given a series of instructions of a path to follow (as how far forward to move based on current orientation or an instruction to turn left or right), Robby always follows these instructions perfectly.
Unfortunately, Robby's instruction following module is currently malfunctioning, so it'll need a software patch to figure out how to follow instructions once again. Can you write a program that given a series instructions figures out where Robby should end up?
Robby will initially start off facing north from the x, y position (0, 0). Robby can be given three types of instructions. First, if Robby is given the instruction F $$$i$$$ for some integer $$$i$$$, Robby will move forward $$$i$$$ spaces based on the direction it is currently facing. Next, if Robby is given the instruction L, Robby will turn 90 degrees to the left. Finally, if Robby is given the instruction R, Robby will turn 90 degrees to the right. Process all of the instructions given to Robby and output the final x, y position that Robby ends in.
The first line of the input will consist of a single integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) giving the number of instructions that Robby must follow. The next $$$n$$$ lines consist of instructions as described above. If the instruction begins with an F, it will also contain a single integer $$$i$$$ ($$$1 \leq i \leq 100$$$) giving the distances Robby should travel forward. Otherwise the instruction will only consist of a single character L or R, indicating Robby should turn 90 degrees to the left or right, respectively.
Print two space separated integers, x and y, giving the final x, y position that Robby ends in.
6 F 1 R F 2 L L F 4
-2 1
Dr. Doof is lonely during the winter months, and is sad that his daughter, Vanessa, has not visited him for the holidays. Although a poor replacement, he decides that he wants to build a robot snowman. The structure of a robot snowman consists of a lower body, torso, and head. Each of these components is a solid metal cube with side lengths in ratio $$$5:3:1$$$. To feel more loved, the good doctor wants to make the largest "snowman" possible to give himself company (while still maintaining the ratio of dimensions). You can help him design this glorious creation by simply knowing the total amount of scrap metal available in cubic meters (Doof uses the metric system, and so should you).
A single positive integer $$$S$$$ ($$$1 \leq S \leq 10^9$$$) representing the total amount of scrap metal in cubic meters that Dr. Doof has for personal use.
A single positive number representing the side length in meters of the "head" of the robot snowman that Dr. Doof desires. Any answer within $$$10^{-3}$$$ of the judge solution will be accepted.
153
1.0000000000
216
1.1218137878
Alice and Bob have become intelligent robots! They have acquired a ball and want to toss it back and forth to each other. However, the sneaky Eve wants to steal their ball.
Alice and Bob are at $$$(x_a, y_a)$$$ and $$$(x_b, y_b)$$$ on the coordinate plane, respectively, where both their locations are lattice points (the coordinates are integers). Eve is also located at a lattice point, and if the path of the ball crosses directly overhead of Eve, she is able to jump up and steal the ball. However, if Eve is not directly on the path, she will not be able to intercept the ball.
Given multiple possible locations of Eve, determine if Alice and Bob's game of toss would be interrupted.
The first line of the input contains $$$x_a$$$ and $$$y_a$$$, Alice's location.
The next line of the input contains $$$x_b$$$ and $$$y_b$$$, Bob's location.
The next line contains $$$E$$$ $$$(1 \le E \le 100)$$$, the number of different possible locations of Eve.
The next $$$E$$$ lines each contain $$$x, y$$$, a possible location of Eve.
We know that $$$-10^4 \le x_a, x_b, x, y_a, y_b, y \le 10^4$$$.
Output $$$E$$$ lines, where each line is a simple Yes or No, corresponding to if Eve can intercept Alice and Bob's ball.
0 0 2 2 2 1 1 -1 -1
Yes No
A new AI bot has taken over much of the world's most important computer infrastructures and threatens to reshape life for humans as we know it. You have been chosen as Earth's last hope to go through a series of logic and math puzzles which the AI has set in order to get to the control room and deactivate the bot.
You've reached the final puzzle and you find $$$5$$$ doors in front of you (labeled $$$0$$$, $$$1$$$, $$$2$$$, $$$3$$$, and $$$4$$$ because computers love $$$0$$$-indexing). The AI bot, confident that you won't be able to find the door leading to the control room, gives you a large integer $$$n$$$ and the following equation: $$$$$$1^n + 2^n + 3^n + 4^n \pmod{5}$$$$$$
If you can evaluate this expression for the given value of $$$n$$$, that will be the door the control room is behind. Calculate or choose wrong and you will be locked out of the building for good with no chance to stop the bot. Given $$$n$$$, choose the door that will save humanity.
The only line of input contains a single integer $$$n$$$ where $$$0 \leq n \leq 10^{10^{5}}$$$.
Output a single line representing the door that you should choose.
4
4
18417128371888291122782652113433
0
In the first sample, $$$1^4 + 2^4 + 3^4 + 4^4 = 1 + 16 + 81 + 256 = 354$$$ so $$$354 \pmod{5} = 4$$$.
The AI Jeff has been created to help manage the packaging of Skittles! In fact, he was designed to be so intelligent that the overall management of deciding the packaging of skittles has become under his control.
Jeff's first task is given the $$$n$$$ skittles that are currently available, split them up into two batches, with the first batch containing $$$k$$$ skittles, and the second containing $$$n - k$$$ skittles. The first batch of skittles will be packaged and shipped out in a week, while the remaining skittles will be packaged in a month or so.
Jeff decides that he wants to rework the skittles packaging system in a way to optimize something. The only rules here are that no skittle can be wasted, and every package must have the same number of skittles. Since it is well known that every skittles bag must have the same number of skittles $$$s$$$, he decides given $$$k$$$ and $$$n - k$$$, $$$s$$$ will be the largest possible number of skittles such that $$$s$$$ divides both $$$k$$$ and $$$n - k$$$.
Jeff wants to find the optimal $$$k$$$ to maximize his skittle bag size. Unfortunately, Jeff has been stumped. Please help him determine the optimal batch size such that the packages will have the most skittles!
The first and only line of input will contain $$$n (2 \le n \le 10^9)$$$, the number of skittles Jeff has.
Output two space separated integers the batch sizes of skittles. If there are multiple ways to maximize the number of skittles in a package, output the answer that would be lexicographically the smallest (minimize the size of the first batch).
15
5 10
Every year, hundreds of skiers compete in an annual World Cup alpine ski race called the Hahnenkammrennen. Over the course of a weekend, skiers conquer several demanding slopes down the Hahnenkamm mountain and race to achieve the fastest times.
This year, to keep things "interesting" of course, the ski slopes have been scattered with various obstacles to block skiers' paths, such that they must dodge these hazards or surely get knocked out of the competition. To compensate for possible time delays caused by the hazards, ramps have also been added to the course, enabling skiers to launch into the air and sail over obstacles, traveling quickly without being slowed by the friction of snow.
This is also the first year that robots will be allowed to compete in the Hahnenkammrennen. You are determined to capitalize on this opportunity and win the World Cup with the first ever bot competitor: the Ski-Bot 3000. The hardware components for Ski-Bot have already been assembled, but now it must be able to navigate the fastest possible path down each slope that it faces.
Write a program for the Ski-Bot 3000 that, given an overhead map of a ski slope course from the Hahnenkammrennen, computes the length of the shortest path from the top to the bottom of the course. And hurry—the first race starts today!
The first line of input contains two integers, $$$N$$$ and $$$M$$$ ($$$1 \leq N,M \leq 1000$$$), denoting the number of rows and columns in the rectangular ski slope map respectively.
$$$N$$$ lines follow, each containing $$$M$$$ characters denoting grid cells on the ski slope map. A # character denotes an obstacle cell that cannot be skied across. A . denotes clear snow that can readily be traversed. Lastly, a > denotes a wooden ramp that will launch a skier upwards, such that they land on the next clear cell ahead of them down the slope.
The leftmost column of the grid represents the top of the slope, and the rightmost column represents the base. Skiers can choose to start in any clear cell at the top of the slope and likewise cross the course finish-line in any clear cell at the base.
Movement-wise, a skier can only ever ski downhill, or right-ward on the map. This means that if a skier is located on a clear cell in row $$$r$$$ and column $$$c$$$ on the slope map, their only next options are to ski into cells $$$(r+1, c+1)$$$, $$$(r, c+1)$$$, or $$$(r-1, c+1)$$$. Of course, if a skier reaches a ramp cell, their next move is to get launched into the air and land on the first clear cell down-slope from their current position. Note that each ramp cell is guaranteed to have a clear landing spot downhill on the course.
Print the length of the shortest path from top to bottom of the ski slope (left to right on the map). Note that each movement from cell to cell counts as a single path step, including a ramp jump which counts as only one step, regardless of how many obstacle cells or ramps a skier jumps over before she lands. You are guaranteed that a path down the slope is always possible.
3 14 ..##..##.>##.. ......#.##.#.. .#...#....#...
11
5 15 .#..##.>#####.. .###.....#.>##. ....##.>#.###.. ##.>##>#...###. .##>#.>#.##....
8