├── Level 800 ├── Anton_and_Danik.py ├── Bear_and_Big_Brother.py ├── Beautiful_Matrix.py ├── Beautiful_Year.py ├── Bit_plus_plus.py ├── Boy_or_Girl.py ├── Calculating_Function.py ├── Domino_piling.java ├── Domino_piling.py ├── Drinks.py ├── Elephant.py ├── George_and_Accommodation.py ├── Helpful_Maths.py ├── Hulk.py ├── In_Search_of_an_Easy_Problem.py ├── Nearly_Lucky_Number.py ├── Petya_and_Strings.py ├── Presents.py ├── Soldier_and_Bananas.py ├── Team.java ├── Tram.py ├── Translation.py ├── Ultra-Fast_Mathematician.py ├── Vanya_and_Fence.py ├── Watermelon.java ├── Watermelon.py ├── Way_Too_Long_Words.java ├── Word.py ├── Word_Capitalization.py └── Wrong_Subtraction.py └── README.md /Level 800/Anton_and_Danik.py: -------------------------------------------------------------------------------- 1 | n = input() 2 | inp = input() 3 | 4 | no_a = no_d = 0 5 | for ch in list(inp): 6 | if ch == 'A': 7 | no_a += 1 8 | else: 9 | no_d += 1 10 | 11 | if no_a > no_d: 12 | print("Anton") 13 | elif no_a == no_d: 14 | print("Friendship") 15 | else: 16 | print("Danik") 17 | -------------------------------------------------------------------------------- /Level 800/Bear_and_Big_Brother.py: -------------------------------------------------------------------------------- 1 | a,b = list(map(int, input().split())) 2 | 3 | i = 0 4 | while True: 5 | if a > b: 6 | print(i) 7 | break 8 | a *= 3 9 | b *= 2 10 | i += 1 11 | -------------------------------------------------------------------------------- /Level 800/Beautiful_Matrix.py: -------------------------------------------------------------------------------- 1 | for i in range(5): 2 | inp = input() 3 | if '1' in inp: 4 | print(abs(inp.split(' ').index('1') - 2) + abs(i - 2)) 5 | -------------------------------------------------------------------------------- /Level 800/Beautiful_Year.py: -------------------------------------------------------------------------------- 1 | inp = int(input()) 2 | 3 | for i in range(inp + 1, 10000): 4 | if len(set(list(str(i)))) == 4: 5 | print(i) 6 | break 7 | -------------------------------------------------------------------------------- /Level 800/Bit_plus_plus.py: -------------------------------------------------------------------------------- 1 | no_of_lines = int(input()) 2 | 3 | result = 0 4 | for i in range(no_of_lines): 5 | result += 1 if '+' in input() else result - 1 6 | 7 | print(result) 8 | -------------------------------------------------------------------------------- /Level 800/Boy_or_Girl.py: -------------------------------------------------------------------------------- 1 | inp = input() 2 | 3 | print("CHAT WITH HER!") if len(set(list(inp))) % 2 == 0 else print("IGNORE HIM!") 4 | -------------------------------------------------------------------------------- /Level 800/Calculating_Function.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | print(int(n/2)) if n % 2 == 0 else print(int(-1 * (n + 1)/2)) 4 | -------------------------------------------------------------------------------- /Level 800/Domino_piling.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Main { 4 | static Scanner scanner = new Scanner(System.in); 5 | 6 | public static void main(String[] args) { 7 | 8 | int n = scanner.nextInt(); 9 | int m = scanner.nextInt(); 10 | 11 | System.out.println((int) Math.floor((n * m) / 2)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Level 800/Domino_piling.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | print(math.floor((int(input()) * int(input())) / 2)) 4 | -------------------------------------------------------------------------------- /Level 800/Drinks.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | per = list(map(int, input().split())) 3 | 4 | sum = 0 5 | for p in per: 6 | sum += p/100 7 | 8 | print(sum/n * 100) 9 | -------------------------------------------------------------------------------- /Level 800/Elephant.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | print(math.ceil(int(input()) / 5)) 4 | -------------------------------------------------------------------------------- /Level 800/George_and_Accommodation.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | no_room = 0 4 | for i in range(n): 5 | p,q = list(map(int, input().split())) 6 | if q - p > 1 : no_room += 1 7 | 8 | print(no_room) 9 | -------------------------------------------------------------------------------- /Level 800/Helpful_Maths.py: -------------------------------------------------------------------------------- 1 | inp = input() 2 | sort_inp = inp.split("+") 3 | sort_inp.sort() 4 | res = "" 5 | for i in sort_inp: 6 | res += i + "+" 7 | 8 | print(res.strip("+")) 9 | -------------------------------------------------------------------------------- /Level 800/Hulk.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | res = "" 4 | for i in range(n): 5 | res += "I hate " if i % 2 == 0 else "I love " 6 | res += "that " if i != n-1 else "it" 7 | 8 | print(res) 9 | -------------------------------------------------------------------------------- /Level 800/In_Search_of_an_Easy_Problem.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | print("HARD") if 1 in set(list(map(int, input().split()))) else print("EASY") 4 | -------------------------------------------------------------------------------- /Level 800/Nearly_Lucky_Number.py: -------------------------------------------------------------------------------- 1 | inp = input() 2 | 3 | no_lucky = 0 4 | for ch in list(inp): 5 | if ch == '7' or ch == '4': 6 | no_lucky += 1 7 | print("YES") if no_lucky == 7 or no_lucky == 4 else print("NO") 8 | -------------------------------------------------------------------------------- /Level 800/Petya_and_Strings.py: -------------------------------------------------------------------------------- 1 | lex1 = input().lower() 2 | lex2 = input().lower() 3 | 4 | flag = False 5 | for i in range(len(lex1)): 6 | if ord(lex1[i]) > ord(lex2[i]): 7 | print(1) 8 | flag = True 9 | break 10 | if ord(lex1[i]) < ord(lex2[i]): 11 | print(-1) 12 | flag = True 13 | break 14 | 15 | if not flag: 16 | print(0) 17 | -------------------------------------------------------------------------------- /Level 800/Presents.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | inp = list(map(int, input().split())) 3 | 4 | res = "" 5 | for i in range(1, n+1): 6 | res += f"{inp.index(i) + 1} " 7 | 8 | print(res) 9 | -------------------------------------------------------------------------------- /Level 800/Soldier_and_Bananas.py: -------------------------------------------------------------------------------- 1 | k, n, w = list(map(int, input().split())) 2 | 3 | borrow = int(k * (w * (w + 1) / 2) - n) 4 | print(0) if borrow < 0 else print(borrow) 5 | -------------------------------------------------------------------------------- /Level 800/Team.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | try (Scanner scanner = new Scanner(System.in)) { 7 | int n = scanner.nextInt(); 8 | String[] data = new String[n]; 9 | 10 | int count = 0; 11 | for (String item: data) { 12 | int con = 0; 13 | int a1 = scanner.nextInt(); 14 | int a2 = scanner.nextInt(); 15 | int a3 = scanner.nextInt(); 16 | 17 | if (a1 == 1) con++; 18 | if (a2 == 1) con++; 19 | if (a3 == 1) con++; 20 | 21 | if (con > 1) count++; 22 | } 23 | System.out.print(count); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Level 800/Tram.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | cap = current = 0 4 | for i in range(n): 5 | a,b = list(map(int, input().split())) 6 | current += b - a 7 | cap = current if current > cap else cap 8 | 9 | print(cap) 10 | -------------------------------------------------------------------------------- /Level 800/Translation.py: -------------------------------------------------------------------------------- 1 | print("YES") if input()[::-1] == input() else print("NO") 2 | -------------------------------------------------------------------------------- /Level 800/Ultra-Fast_Mathematician.py: -------------------------------------------------------------------------------- 1 | a_bi = input() 2 | b_bi = input() 3 | 4 | print(bin(int(a_bi, 2) ^ int(b_bi, 2))[2:].zfill(len(a_bi))) 5 | -------------------------------------------------------------------------------- /Level 800/Vanya_and_Fence.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | n, h = list(map(int, input().split())) 4 | arr = list(map(int, input().split())) 5 | 6 | sum = 0 7 | for i in arr: 8 | sum += math.ceil(i / h) 9 | 10 | print(sum) 11 | -------------------------------------------------------------------------------- /Level 800/Watermelon.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | try (Scanner scanner = new Scanner(System.in)) { 7 | int n = scanner.nextInt(); 8 | 9 | if (n % 2 == 0 && n > 2) System.out.println("YES"); 10 | else System.out.println("NO"); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Level 800/Watermelon.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | print("YES") if n % 2 == 0 and n > 2 else print("NO") 4 | -------------------------------------------------------------------------------- /Level 800/Way_Too_Long_Words.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | try (Scanner scanner = new Scanner(System.in)) { 7 | int n = scanner.nextInt(); 8 | 9 | String[] data = new String[n]; 10 | 11 | for (int i = 0; i < n; i++) { 12 | data[i] = scanner.next(); 13 | if (data[i].length() > 10) 14 | data[i] = String.valueOf(data[i].charAt(0) + "" + (data[i].length() - 2) + "" + data[i].charAt(data[i].length() - 1)); 15 | } 16 | 17 | for (String item : data) 18 | System.out.println(item); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Level 800/Word.py: -------------------------------------------------------------------------------- 1 | inp = input() 2 | 3 | no_lower_ch = 0 4 | lower_inp = inp.lower() 5 | for i in range(len(inp)): 6 | if inp[i] == lower_inp[i]: 7 | no_lower_ch += 1 8 | 9 | print(inp.lower()) if no_lower_ch >= len(inp)/2 else print(inp.upper()) 10 | -------------------------------------------------------------------------------- /Level 800/Word_Capitalization.py: -------------------------------------------------------------------------------- 1 | inp = input() 2 | 3 | print(inp[0].capitalize() + inp[1::]) 4 | -------------------------------------------------------------------------------- /Level 800/Wrong_Subtraction.py: -------------------------------------------------------------------------------- 1 | n, k = list(map(int, input().split())) 2 | 3 | for i in range(k): 4 | n = n / 10 if n % 10 == 0 else n - 1 5 | print(int(n)) 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![codeforce](https://assets.codeforces.com/users/kguseva/comments/cf.png) 2 | 3 | 4 | # CodeForces-Problem-Solutions 5 | 6 | ### CodeForces Problem Solutions. over +28 problems solved... 7 | 8 | ## THIS REPOSITORY :white_check_mark:USEFUL:white_check_mark: FOR WHO: 9 | has solved the questions and wants to see other solutions and practice Or for someone who could not solve the question after several attempts and wants to see the solution. 10 | 11 | ## THIS REPOSITORY :warning:HARMFUL:warning: FOR WHO: 12 | has just started solving the questions and the algorithm and at the very beginning wants to copy and paste the solutions from here without understanding the code. 13 | 14 | ## AND FINALLY: 15 | You can also share your solutions in this repository! 16 | - email me your solution 17 | - fork this repo & add your solution 18 | 19 | write your name at the end of your code if you like. 20 | 21 | ## My Email 22 | ehsan.shahbazipc@gmail.com 23 | 24 | ## solved with 25 | - Java 26 | - Python 27 | 28 | ## Problem Lists 29 | 30 | | No. | Problem Name & Link | Problem ID | Level | 31 | | --- | ------------ | ---------- | ----- | 32 | |1| [Watermelon](https://codeforces.com/problemset/problem/4/A) | 4A | 800 | 33 | |2| [Way Too Long Words](https://codeforces.com/problemset/problem/71/A) | 71A | 800 | 34 | |3| [Team](https://codeforces.com/problemset/problem/231/A) | 231A | 800 | 35 | |4| [Domino piling](https://codeforces.com/problemset/problem/50/A) | 50A | 800 | 36 | |5| [Bit++](https://codeforces.com/problemset/problem/282/A) | 282A | 800 | 37 | |6| [Beautiful Matrix](https://codeforces.com/problemset/problem/263/A) | 263A | 800 | 38 | |7| [Petya and Strings](https://codeforces.com/problemset/problem/112/A) | 112A | 800 | 39 | |8| [Helpful Maths](https://codeforces.com/problemset/problem/339/A) | 339A | 800 | 40 | |9| [Word Capitalization](https://codeforces.com/problemset/problem/281/A) | 281A | 800 | 41 | |10| [Boy or Girl](https://codeforces.com/problemset/problem/236/A) | 236A | 800 | 42 | |11| [Bear and Big Brother](https://codeforces.com/problemset/problem/791/A) | 791A | 800 | 43 | |12| [Elephant](https://codeforces.com/problemset/problem/617/A) | 617A | 800 | 44 | |13| [Soldier and Bananas](https://codeforces.com/problemset/problem/546/A) | 546A | 800 | 45 | |14| [Word](https://codeforces.com/problemset/problem/59/A) | 59A | 800 | 46 | |15| [Wrong Subtraction](https://codeforces.com/problemset/problem/977/A) | 977A | 800 | 47 | |16| [Nearly Lucky Number](https://codeforces.com/problemset/problem/110/A) | 110A | 800 | 48 | |17| [Anton and Danik](https://codeforces.com/problemset/problem/734/A) | 734A | 800 | 49 | |18| [Translation](https://codeforces.com/problemset/problem/41/A) | 41A | 800 | 50 | |19| [Tram](https://codeforces.com/problemset/problem/116/A) | 116A | 800 | 51 | |20| [Vanya and Fence](https://codeforces.com/problemset/problem/677/A) | 677A | 800 | 52 | |21| [Beautiful Year](https://codeforces.com/problemset/problem/271/A) | 271A | 800 | 53 | |22| [In Search of an Easy Problem](https://codeforces.com/problemset/problem/1030/A) | 1030A | 800 | 54 | |23| [George and Accommodation](https://codeforces.com/problemset/problem/467/A) | 467A | 800 | 55 | |24| [Presents](https://codeforces.com/problemset/problem/136/A) | 136A | 800 | 56 | |25| [Calculating Function](https://codeforces.com/problemset/problem/486/A) | 486A | 800 | 57 | |26| [Drinks](https://codeforces.com/problemset/problem/200/B) | 200B | 800 | 58 | |27| [Ultra-Fast Mathematician](https://codeforces.com/problemset/problem/61/A) | 61A | 800 | 59 | |28| [Hulk](https://codeforces.com/problemset/problem/705/A) | 705A | 800 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | --------------------------------------------------------------------------------