From 689a284a2ca3e4e8db3dfc0263860cd7de178568 Mon Sep 17 00:00:00 2001 From: Pillai Bhavana Radhakrishna <118704821+master-ginger@users.noreply.github.com> Date: Thu, 5 Oct 2023 18:59:56 +0530 Subject: [PATCH 1/8] Create When.py --- CP/Python/When.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 CP/Python/When.py diff --git a/CP/Python/When.py b/CP/Python/When.py new file mode 100644 index 0000000..d6d9701 --- /dev/null +++ b/CP/Python/When.py @@ -0,0 +1,23 @@ +#https://atcoder.jp/contests/abc258/tasks/abc258_a + +h=21 +m=0 +k=int(input()) +if k>=60: + h+=1 + m+=(k-60) +else: + m+=k +ans="" +if m<10: + ans=str(h)+":0"+str(m) +else: + ans=str(h)+":"+str(m) +print(ans) + +''' +sample input: +63 +output: +22:03 +''' From 761364a63b2af5e7cc2d748311ebaed97bd1804b Mon Sep 17 00:00:00 2001 From: Pillai Bhavana Radhakrishna <118704821+master-ginger@users.noreply.github.com> Date: Mon, 9 Oct 2023 17:42:31 +0530 Subject: [PATCH 2/8] Create Beautiful_Year --- CP/Python/Beautiful_Year | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 CP/Python/Beautiful_Year diff --git a/CP/Python/Beautiful_Year b/CP/Python/Beautiful_Year new file mode 100644 index 0000000..04230e4 --- /dev/null +++ b/CP/Python/Beautiful_Year @@ -0,0 +1,19 @@ +#https://codeforces.com/problemset/problem/271/A + +a=int(input()) + +for i in range(a+1,9999): + s=str(i) + b=set(s) + if len(b)==len(s): + print(i) + break + else: + continue + +''' +Sample input: +1987 +output: +2013 +''' From d371dc6f16736ac6bf766074685ab4140177eda1 Mon Sep 17 00:00:00 2001 From: Pillai Bhavana Radhakrishna <118704821+master-ginger@users.noreply.github.com> Date: Mon, 9 Oct 2023 17:43:35 +0530 Subject: [PATCH 3/8] Rename Beautiful_Year to Beautiful_Year.py --- CP/Python/{Beautiful_Year => Beautiful_Year.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CP/Python/{Beautiful_Year => Beautiful_Year.py} (100%) diff --git a/CP/Python/Beautiful_Year b/CP/Python/Beautiful_Year.py similarity index 100% rename from CP/Python/Beautiful_Year rename to CP/Python/Beautiful_Year.py From b7844686fbc5a9074bc2e7cb3318812f1706df6f Mon Sep 17 00:00:00 2001 From: Pillai Bhavana Radhakrishna <118704821+master-ginger@users.noreply.github.com> Date: Mon, 9 Oct 2023 17:45:29 +0530 Subject: [PATCH 4/8] Create In_search_of_an_easy_problem.py --- CP/Python/In_search_of_an_easy_problem.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 CP/Python/In_search_of_an_easy_problem.py diff --git a/CP/Python/In_search_of_an_easy_problem.py b/CP/Python/In_search_of_an_easy_problem.py new file mode 100644 index 0000000..0a68f20 --- /dev/null +++ b/CP/Python/In_search_of_an_easy_problem.py @@ -0,0 +1,16 @@ +#https://codeforces.com/problemset/problem/1030/A + +n=int(input()) +arr=list(map(int,input().split())) +if sum(arr)==0: + print("EASY") +else: + print("HARD") + +''' +sample input: +3 +0 0 1 +output: +HARD +''' From 53f651f903003478b4d8cb00ec6dd4b5e44576b5 Mon Sep 17 00:00:00 2001 From: Pillai Bhavana Radhakrishna <118704821+master-ginger@users.noreply.github.com> Date: Mon, 16 Oct 2023 19:00:34 +0530 Subject: [PATCH 5/8] Create Full_House.py --- CP/Python/Full_House.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 CP/Python/Full_House.py diff --git a/CP/Python/Full_House.py b/CP/Python/Full_House.py new file mode 100644 index 0000000..a40cf90 --- /dev/null +++ b/CP/Python/Full_House.py @@ -0,0 +1,21 @@ +#https://atcoder.jp/contests/abc263/tasks/abc263_a + +n=5 +arr=list(map(int,input().split())) +brr=set(arr) +if len(brr)==2 and (arr.count(arr[0])==2 or arr.count(arr[0])==3 ): + print("Yes") +else: + print("No") + +''' +sample input1: +1 1 1 2 2 +output: +Yes + +sample input2: +1 2 3 1 1 +ouput: +No +''' From 3f02b16695e678d0828f380135e13bf521babb8b Mon Sep 17 00:00:00 2001 From: Pillai Bhavana Radhakrishna <118704821+master-ginger@users.noreply.github.com> Date: Mon, 16 Oct 2023 19:14:00 +0530 Subject: [PATCH 6/8] Create fair_playoff.py --- CP/Python/fair_playoff.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 CP/Python/fair_playoff.py diff --git a/CP/Python/fair_playoff.py b/CP/Python/fair_playoff.py new file mode 100644 index 0000000..45b5d0d --- /dev/null +++ b/CP/Python/fair_playoff.py @@ -0,0 +1,30 @@ +#https://codeforces.com/problemset/problem/1535/A +t=int(input()) +for i in range(t): + arr=list(map(int,input().split())) + n=len(arr) + max1=max(arr[0],arr[1]) + max2=max(arr[2],arr[3]) + arr.sort() + m1=arr[n-1] + m2=arr[n-2] + if (max1==m1 or max1==m2) and (max2==m1 or max2==m2): + print("YES") + else: + print("NO") + +''' +sample input1: +4 +4 +3 7 9 5 +4 5 6 9 +5 3 8 1 +6 5 3 2 + +ouput1: +YES +NO +YES +NO +''' From e80db9163b2af749e4db82c505f34245c20f0f0d Mon Sep 17 00:00:00 2001 From: Pillai Bhavana Radhakrishna <118704821+master-ginger@users.noreply.github.com> Date: Tue, 17 Oct 2023 18:04:53 +0530 Subject: [PATCH 7/8] Create number_groups.py --- CP/Python/number_groups.py | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 CP/Python/number_groups.py diff --git a/CP/Python/number_groups.py b/CP/Python/number_groups.py new file mode 100644 index 0000000..4fe7027 --- /dev/null +++ b/CP/Python/number_groups.py @@ -0,0 +1,40 @@ +#https://www.hackerrank.com/challenges/number-groups/problem + +import math +import os +import random +import re +import sys + +def sumOfGroup(k): + # Return the sum of the elements of the k'th group. + n=k+(k-1)**2 + endval=n+(k+(k-1)) + + sumodd=0 + + for i in range(n,endval,2): + sumodd+=i + return sumodd + +if __name__ == '__main__': + fptr = open(os.environ['OUTPUT_PATH'], 'w') + + k = int(input().strip()) + + answer = sumOfGroup(k) + + fptr.write(str(answer) + '\n') + + fptr.close() +''' +sample input1: +3 +output: +27 + +sample input2: +4 +sample output: +64 +''' From 82890e03f3211ee72667f7278fd38a65c3357a47 Mon Sep 17 00:00:00 2001 From: Pillai Bhavana Radhakrishna <118704821+master-ginger@users.noreply.github.com> Date: Tue, 17 Oct 2023 18:35:22 +0530 Subject: [PATCH 8/8] Create holiday_of_equality.py --- CP/Python/holiday_of_equality.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 CP/Python/holiday_of_equality.py diff --git a/CP/Python/holiday_of_equality.py b/CP/Python/holiday_of_equality.py new file mode 100644 index 0000000..c2ca97f --- /dev/null +++ b/CP/Python/holiday_of_equality.py @@ -0,0 +1,27 @@ +#https://codeforces.com/problemset/problem/758/A + +n=int(input()) +arr=list(map(int,input().split())) +if n==1: + print(0) +else: + sumof=0 + arr.sort() + max=arr[n-1] + for i in range(n-1): + sumof+=max-arr[i] + print(sumof) + +''' +sample input1: +5 +0 1 2 3 4 +output1: +10 + +sample input2: +3 +1 3 1 +output2: +4 +'''