
The main idea of this repository is to create different programs with different solutions to improve our knowledge with different technologies and to force us to try new ones.
Parkway Walk
Difficulty: Easy (800)?
Problem:
You are walking this to Parkway Near Your House. The Parkway has n+1 bensh in a row numbered from 1 to n+1 from left to right. The distance Between the Bench I and i+1 is ai meters.
Initially, You have mides of Energy. To walk 1 meter of distance, you spend 1 unit of your energy. You Can't Walk If You Have No Energy. Also, You Can Restore Your Energy By Sitting on Benchhes (and This is the Only Way To Restore The Energy). When you are sitting, You Can Restore Any Integer Amount of Energy You Want. Note That the Amount of Your Energy Can Exceed M
Your task is to find the minimum amount of energy you have to restore (by sitting on benshes) to reach the bench n+1 from the bench 1 (and end your walk).
You have to an answer t independence tests.
Input:
The First Line of the Input Contains One Integer T (1 ≤ T ≤ 100) - The Number of Test Cases. The t tests Follow.
The First Line of the Test Countins Two Integers N and M (1 ≤ n ≤ 100; 1 ≤ m ≤ 10^4).
The Second Line of the Test Countins N Integers A1, A2,…, An (1 ≤ Ai ≤ 100), where ai is the distance Between Benchas I and i+1.
Output:
For Each Test Case, Print One Integer - The Minimum Amount of Energy You Have To Restore (By Sitting on Benchas) To Reach The Bench N+1 From The Bench 1 (and End Your Walk) In the correspondent Test Case.
Input:
3
3 1
1 2 1
4 5
3 3 5 2
5 16
1 2 3 4 5
Output:
3
8
0
#Note: In the first test of the example, You Can Walk To The Bench 2, Spending 1 Unit of Energy, The Restore 2 Units of Energy on The Second Bench, Walk to The Bench 3, Spending 2 Units of Energy, Restore 1 Unit of Energy and Go To The Bench 4.
In The Third Test of the Example, You have angouch energy to just go to the bench 6 without sitting at all.
Link to a possible solution
Where's the bishop?
Difficulty: Easy (800)?
Constrains:
Time Limit Per Test: 1 Second Memory Limit Per Test: 256 megabytes
Problem:
Mihai has an 8 × 8 Chessboard Whos Rows Are Numbered From 1 To 8 from Top To Bottom and What Columns Are Numbered From 1 to 8 from Left to right.
Mihai you have placed exactly One Bishop on the Chessboard. The Bishop is not placed on the Edges of the Board. (In Other Words, The Row and Column of the Bishop are Between 2 and 7, inclusive.)
The Bishop Attacks in All Directions Diagonally, and there is no limit to the distance which the bishop can attack. Note that the Cell on which the bishop is placed is also Considered Attled.
Mihai you have marked all Squares the Bishop Attacks, but forgot where the bishop was! Help Mihai Find the Position of the Bishop.

Input:
The First Line of the Input Contains A Single Integer T (1 ≤ T ≤ 36) - The Number of Test Cases. The Description of Test Cases Follows. There is an empty line beforme each test case.
EACH TEST CASE CONSISTS OF 8 LINES, EACH CONTAINING 8 Characters. EACH OFSE CHARACTERS IS EITHER '#' OR '.
Output:
For Each Test Case, Output Two Integers R and C (2 ≤ R, C ≤ 7) - The Row and Column of the Bishop.
The input is generated in such a way that there is always exactly one positionable location of the bishop that is not on the edge of the board.
Input:
3
.....#..
#...#...
.#.#....
..#.....
.#.#....
#...#...
.....#..
......#.
#.#.....
.#......
#.#.....
...#....
....#...
.....#..
......#.
.......#
.#.....#
..#...#.
...#.#..
....#...
...#.#..
..#...#.
.#.....#
#.......
Output:
4 3
2 2
4 5
Link to a possible solution
Kana and Dragon Quest Game
Difficulty: Easy+(900)?
Constrains: Time Limit Per Test: 1 Second Memory Limit Per Test: 256 megabytes
Problem:
Kana was Just An Ordinary High School Girl Before to Talent Scout Discovered Her. THEN, SHE BECAME AN IDOL. But different from the stereotype, She is also to Gameholic. One Day Kana Gets Intersted in a New Adventure Game Called Dragon Quest. In This Game, Her Quest Is To Beat A Dragon.
The Dragon Has A Hit Point of X Initially. When son Hit Point Goes To 0 Or Under 0, It Will Be Defated. In Order To Defeat The Dragon, Kana Can Cast The Two Following Types of Spells.
-VOID ABSORPTION ⚫-
Assume that the Dragon's Current Hit Point Is H, After Casting This Spell its Hit Point Will Become [H/2] +10. Here [H/2] Denotes H Divided by Two, Rounded Down.
-Lightning Strike ⚡-
This Spell Will Decree The Dragon's Hit Point By 10. Assume that the Dragon's Current Hit Point Is H, after casting This Spell Is Hit Point Will Be Lowered to H - 10.
Due to summans Kana Can Only cast no more than n void absorptions and m Lightning Strikes. She Can Cast The Spells in Any Order and Doesn't Have to Punish All The Spells. Kana isn't Good at Math, So You Are Going To Help Her To Find Out Whether It is positive to defeat the dragon.
Input:
The First Line Contains A Single Integer T (1 ≤ T ≤ 1000) - The Number of Test Cases.
The Next T Lines describes Test Cases. For Each Test Case The Only Line Contains Three Integers X, N, M (1 ≤ x ≤ 10^5, 0 ≤ N, M ≤ 30) - The Dragon's Initial Hit Point, The Maximum Number of Void Absorptions and Lightning Stikes Kana Can Cast respectively.
Output:
If it is postible to defeat the dragon, print "Yes" (Without Quotes). Otherwise, print "no" (Without Quotes).
You Can Print Each Letter in Any Case (Upper or Lower).
Example:
#Note: One Possible casting sequence of the first test is shown below:
-VOID ABSORPTION [100/2]+10 = 60.
-Lightning Strike 60−10 = 50.
-Void Absorption [50/2]+10 = 35.
-VOID ABSORPTION [35/2]+10 = 27.
-Lightning Strike 27-10 = 17.
-Lightning Strike 17-10 = 7.
-Lightning Strike 7−10 = −3.
Input:
7
100 3 4
189 3 4
64 2 3
63 2 3
30 27 7
10 9 1
69117 21 2
Output:
YES
NO
NO
YES
YES
YES
YES
Link to a possible solution
Pizzaforces
Difficulty: Easy+(900)
Time Limit Per Test: 2 Seconds
Memory Limit Per test: 256 megabytes
Pizzaforces is petya's favorite pizzeria. Pizzaforces Makes and Sells Pizzas of Three Sizes: Small Pizzas Consist of 6 Slices, Medium Ones Consist of 8 Slices, and Large Pizzas Consist of 10 Slices Each. Baking Them Takes 15, 20 and 25minutes, respectively.
Petya's Birthday is Today, and Nn of His Friends Will Come, So I have decided to make an Order from His Favorite Pizzeria. PETYA WANTS TO ORDER SO MUAN PIZZA THAT EACH OF HIS FRIENDS GETS AT LEAST ONE SLICE OF PIZZA. The Cooking Time of the Order is the Total Baking Time of All The Pizzas in the Order.
Your task is to determine The Minimum Number of Minutes that is needed to make pizzas containing at least nn slices in total. For Example:
If 12 Friends Come to Petya's Birthday, you have to Order Pizzas Containg at Least 12 Slices In Total. I have ordered two small pizzas, containing exactly 12. Slíces, and the time to bake them is 30 minute;
if 15 Friends eat to petya's birthday, you have to order pizzas containing at least 15 smlices in total. I have ordered Small Pizza and A Large Pizza, Containing 16 Slices, and The Time To Bake The Is 40 Minutes;
If 300 Friends Come to Petya's Birthday, you have to Order Pizzas Containg at Least 300 Slices In Total. HE CAN ORDER 15 SMALL PIZZAS, 10 MEDIUM PIZZAS AND 13 LARGE PIZZAS, IN TOTAL they count 15⋅6+10⋅8+13⋅10 = 300 slice, and the total time to bake them is 15⋅15+10⋅20+13⋅25 = 750 minute;
if only one friend comes to petya's birthday, I have ordered Small Pizza, and the time to bake it is 15 minute.
Input
The First Line Contains A Single Integer TT (1≤t≤1041≤t≤104) - The Number of Testcases.
EACH TESTCASE CONSISTS OF A SINGLE LINE THAT CONTAINS A SINGLE INTEGER NN (1≤N≤10161≤N≤1016) - The Number of Petya's Friends.
Output for Each Testcase, Print One Integer - The Minimum Number of Minutes that is needed to bake pizzas containing at least n slice in total.
input
6
12
15
300
1
9
9999999999999993
output
30
40
750
15
25000000000000000
15
The Doors
Difficulty: Easy (800)
Constrains
Time Limit Per Test: 1 Seconds Memory Limit Per Test: 256 megabytes
Problem
Three Years Have Passes and Nothing Changed. It is Still Raining in London, and Mr. Black Has to Close All The Doors in His Home In Order To Not Be Flooded. Eleven, However, Mr. Black Became So Nervous That He Opened One Door, The Another, The One More and So on Until He opened All The Doors in His House.
There are exactly Two Exits from Mr. Black's House, Let's Name Them Left and Right Exits. There are severe doors in each of the success, so each door in Mr. Black's House is Located Eithher in the Left or in the Right Exit. You know where each door is located. Initially All The Doors Are Closed. Mr. Black Can Exit The House If and Only If All Doors in At Least One of the Exits is Open. You are Given a Sequence in Which Mr. Black Opened the Doors, please the Smalllest Index K Such that Mr. Black Can Exit the House after Opening the First K Doors.
We have to note that Mr. Black Opened Each Door at Most Once, and in the End All Doors Became Open.
Input
The First Line Countins Integer N (2 ≤ N ≤ 2000) - The Number of Dours.
The Next Line Countins N INGERS: The Sequence in Which Mr. Black Opened The Doors. The I-Th of the Intengers is equal to 0 in case the i-th opened door is located in the left exit, and it is equal to 1 in case it is in the right exit.
It is Guaranteed that there is at least One Door Located in the Left Exit and there is at least one door located in the right exit.
Output
Print the smallest integer k Such that After Mr. Black Opened The First K Doors, He was to the House.
Example
#Note in the First Example the First Two Doors are from the Left Exit, So When Mr. Black Opened Both of Them Only, There Were Two More Closed Door in The Left Exit and One Closed Door in the Right Exit. So Mr. Black Wasn't Uble to Exit at That Moment.
WHEN HE OPned The Third Door, All Doors From The Right Exit Became Open, So Mr. Black Was Able to Exit the House.
In the Second Example When the first two doors were Opened, There Was Open Closed Door in Each of the Exit.
With three doors Opened Mr. Black was to use the left exit.
Input
5
0 0 1 0 0
Output
3
----------------------
Input
4
1 0 0 1
Output
3