Skip to content

Commit

Permalink
Update files with �lack formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Haleshot committed Aug 16, 2024
1 parent e82d8da commit baa482a
Show file tree
Hide file tree
Showing 375 changed files with 867 additions and 826 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ def findClosestNumber(self, nums):
diff1, diff2 = min_pos, 0 - max_neg
if diff1 < diff2:
return min_pos
return max_neg
return max_neg
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ def mergeAlternately(self, word1, word2):
if len(word1) < len(word2):
for i in range(len(word1)):
mergedword += word1[i] + word2[i]
mergedword += word2[len(word1):len(word2)]
mergedword += word2[len(word1) : len(word2)]
return mergedword
elif len(word1) > len(word2):
for i in range(len(word2)):
mergedword += word1[i] + word2[i]
mergedword += word1[len(word2):len(word1)]
mergedword += word1[len(word2) : len(word1)]
return mergedword
else:
for i in range(len(word2)):
Expand All @@ -31,4 +31,4 @@ def mergeAlternately(self, word1, word2):
# if i < len(word2):
# result.append(word2[i])
# i += 1
# return ''.join(result)
# return ''.join(result)
11 changes: 1 addition & 10 deletions Algomap/roman_to_integer/roman_to_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ def romanToInt(self, s):
:type s: str
:rtype: int
"""
d = {
"I" : 1,
"V" : 5,
"X" : 10,
'L' : 50,
"C" : 100,
'D' : 500,
"M": 1000
}
d = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000}
# print(d.keys(), "\n", d.values())
summ = 0
i = 0
Expand All @@ -24,4 +16,3 @@ def romanToInt(self, s):
summ += d[s[i]]
i += 1
return summ

5 changes: 3 additions & 2 deletions Codechef/ABSTRING/ABSTRING.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import collections
T = int(input())

T = int(input())
while T:
T -= 1
N = int(input())
Expand All @@ -12,4 +13,4 @@
if c > 0:
print("NO")
else:
print("YES")
print("YES")
2 changes: 1 addition & 1 deletion Codechef/AB_Diff/AB_Diff.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
A, B = map(int, input().split())
print(abs((A * B) - (A + B)))
print(abs((A * B) - (A + B)))
4 changes: 2 additions & 2 deletions Codechef/AC_Temp/AC_Temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
while T:
T -= 1
A, B, C = map(int, input().split())
if (A > B or C > B):
if A > B or C > B:
print("NO")
else:
print("YES")
print("YES")
6 changes: 3 additions & 3 deletions Codechef/ADJSUMPAR/ADJSUMPAR.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
T -= 1
N = int(input())
B = input()
c = B.count('1')
if(c % 2 == 0):
c = B.count("1")
if c % 2 == 0:
print("YES")
else:
print("NO")
print("NO")
4 changes: 2 additions & 2 deletions Codechef/AIRM/AIRM.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
d[i] = 1
else:
d[i] += 1

c = 0
for i in d:
if d[i] > c:
c = d[i]
print(c)
print(c)
4 changes: 2 additions & 2 deletions Codechef/ALTSTR/ALTSTR.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
S = list(input())
z_c = S.count("0")
o_c = S.count("1")

if o_c == z_c:
print(N)
else:
res = min(o_c, z_c) * 2 + 1
print(res)
print(res)
4 changes: 2 additions & 2 deletions Codechef/AMMEAT/AMMEAT.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
P = list(map(int, input().split()))
P.sort()
c = 0
for i in range(-1 , -len(P) - 1 , -1):
for i in range(-1, -len(P) - 1, -1):
M -= P[i]
c = c + 1
if M <= 0:
print(c)
break
else:
print(-1)
print(-1)
2 changes: 1 addition & 1 deletion Codechef/ARRINT/ARRINT.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
C1 = set(map(int, input().split()))
A1 = A1.intersection(B1)
A1 = A1.intersection(C1)
print(len(A1))
print(len(A1))
6 changes: 3 additions & 3 deletions Codechef/ASTHIT/ASTHIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
T -= 1
n = int(input())
dir = []
pow = []
pow = []
for i in range(n):
ele1, ele2 = list(map(int, input().split()))
dir.append(ele1)
Expand All @@ -23,11 +23,11 @@
else:
pow[stack[-1]] += pow[i]
else:
a.append(i)
a.append(i)
while stack:
a.append(stack.pop())
a.sort()
print(len(a))
if len(a) > 0:
for i in a:
print(i + 1, end = " ")
print(i + 1, end=" ")
2 changes: 1 addition & 1 deletion Codechef/ATM/ATM.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
else:
l_2.append(0)
for i in l_2:
print(i, end = "")
print(i, end="")
print()
2 changes: 1 addition & 1 deletion Codechef/ATM2/ATM2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
tid.append(1)
else:
tid.append(0)
print(*tid, sep="")
print(*tid, sep="")
5 changes: 3 additions & 2 deletions Codechef/Accuracy/Accuracy.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import math

T = int(input())
while T:
T -= 1
X = int(input())
temp = math.ceil(X/3)
temp = math.ceil(X / 3)
temp *= 3
print(temp - X)
print(temp - X)
2 changes: 1 addition & 1 deletion Codechef/Acs/Acs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
if ((P % 100) + (P // 100)) <= 10:
print((P % 100) + (P // 100))
else:
print(-1)
print(-1)
4 changes: 2 additions & 2 deletions Codechef/Advance/Advance.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
T = int(input())
while T:
T -= 1
T -= 1
X, Y = map(int, input().split())
if Y >= X and Y <= (X + 200):
print("YES")
else:
print("NO")
print("NO")
4 changes: 2 additions & 2 deletions Codechef/Age_Limit/Age_Limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
while T:
T -= 1
X, Y, A = map(int, input().split())
if (A >= X and A < Y):
if A >= X and A < Y:
print("YES")
else:
print("NO")
print("NO")
2 changes: 1 addition & 1 deletion Codechef/Ageing/Ageing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
while T:
T -= 1
X = int(input())
print(X - 10)
print(X - 10)
2 changes: 1 addition & 1 deletion Codechef/Air_Hockey/Air_Hockey.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
A, B = map(int, input().split())
A = 7 - A
B = 7 - B
print(min(A, B))
print(min(A, B))
4 changes: 2 additions & 2 deletions Codechef/Airline/Airline.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

elif (B + C) <= D and A <= E:
print("YES")

else:
print("NO")
print("NO")
4 changes: 2 additions & 2 deletions Codechef/Airlines/Airlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
T -= 1
X, Y, Z = map(int, input().split())
limit = 10 * X
if (limit < Y):
if limit < Y:
print(limit * Z)
else:
print(Y * Z)
print(Y * Z)
10 changes: 5 additions & 5 deletions Codechef/Alta_Ray/Alta_Ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
T -= 1
N = int(input())
A = list(map(int, input().split()))

res = [1 for i in range(N)]
for i in range(N-2, -1, -1):
for i in range(N - 2, -1, -1):
if A[i + 1] * A[i] < 0:
res[i] = res[i + 1] + 1
res[i] = res[i + 1] + 1
for i in res[:-1]:
print(i, end = " ")
print(res[-1])
print(i, end=" ")
print(res[-1])
5 changes: 3 additions & 2 deletions Codechef/Apple_Orange/Apple_Orange.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
def hcf(a, b):
if (b == 0):
if b == 0:
return abs(a)
else:
return hcf(b, a % b)


T = int(input())
while T:
T -= 1
N, M = map(int, input().split())
result = hcf(N, M)
print(result)
print(result)
4 changes: 2 additions & 2 deletions Codechef/Attendu/Attendu.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
if i == "1":
c1 += 1
remain = 120 - N + c1
atten_perc = (remain/120) * 100
atten_perc = (remain / 120) * 100
if atten_perc >= 75:
print("YES")
else:
print("NO")
print("NO")
6 changes: 3 additions & 3 deletions Codechef/Auction/Auction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
while T:
T -= 1
A, B, C = map(int, input().split())
if (A > B and A > C):
if A > B and A > C:
print("Alice")
elif (B > A and B > C):
elif B > A and B > C:
print("Bob")
else:
print("Charlie")
print("Charlie")
4 changes: 2 additions & 2 deletions Codechef/Audible/Audible.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
while T:
T -= 1
X = int(input())
if (X >= 67 and X <= 45000):
if X >= 67 and X <= 45000:
print("YES")
else:
print("NO")
print("NO")
4 changes: 2 additions & 2 deletions Codechef/Avg/Avg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
T -= 1
N, K, V = map(int, input().split())
A = list(map(int, input().split()))
result = ((V * (N + K)) - sum(A))/K
result = ((V * (N + K)) - sum(A)) / K
if result.is_integer() and result > 0:
print(int(result))
else:
print(-1)
print(-1)
4 changes: 2 additions & 2 deletions Codechef/Avg_Problem/Avg_Problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
while T:
T -= 1
A, B, C = map(int, input().split())
if (A + B)/2 > C:
if (A + B) / 2 > C:
print("YES")
else:
print("NO")
print("NO")
10 changes: 5 additions & 5 deletions Codechef/BLOBBYVOLLEY/BLOBBYVOLLEY.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
T = int(input())
T = int(input())
while T:
T -= 1
N = int(input())
Expand All @@ -7,12 +7,12 @@
alice = 0
bob = 0
for j in range(N):
if((server == 0) and (S[j] == 'A')):
if (server == 0) and (S[j] == "A"):
alice += 1
elif((server == 0) and (S[j] == 'B')):
elif (server == 0) and (S[j] == "B"):
server = 1
elif((server == 1) and (S[j] == 'B')):
elif (server == 1) and (S[j] == "B"):
bob += 1
else:
server = 0
print(alice, "", bob)
print(alice, "", bob)
4 changes: 2 additions & 2 deletions Codechef/BMI/BMI.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
while T:
T -= 1
M, H = map(int, input().split())
result = M/H**2
result = M / H**2
if result <= 18:
print(1)
elif result >= 19 and result <= 24:
print(2)
elif result >= 25 and result <= 29:
print(3)
else:
print(4)
print(4)
Loading

0 comments on commit baa482a

Please sign in to comment.