Problem: CodeChef: Practical coding for everyone
Solution: CodeChef: Practical coding for everyone
Code:
import re
T = int(input())
for x in range(T):
activity = []
activities, origin = map(str, input().split())
for i in range(int(activities)):
score = 0
activity.append(input())
for item in activity:
pattern = re.compile("CONTEST_WON[ \s]\d{1,9}")
if pattern.match(item):
_, rank = item.split()
if int(rank)<=5000 and int(rank)<20:
score += 300 + 20 - int(rank)
elif int(rank)<=5000:
score += 300
elif item == "TOP_CONTRIBUTOR":
score += 300
elif item == "CONTEST_HOSTED":
score += 50
else:
_, severity = item.split()
score += int(severity)
if origin == “INDIAN”:
print(score//200)
else:
print(score//400)
