Kattis Problems’ Solutions: Kattis Problem Archive contains hundreds of interesting competitive programming questions. Solving these problems can be fun and challenging at times. Here in my college, students use this platform to improve their programming skills and prepare for programming contests.

Here are some of the solutions to these problems I have tried solving. All the solutions shared here are accepted solutions. I hope these solutions would give you tips to solve these questions.

Note: The solutions here are the solutions for question Difficulty level TRIVIAL and EASY only.

# Kattis Problems’ Solutions

## Problem: ABC

Sample Solution:

```.wp-block-code {
border: 0;
}

.wp-block-code > div {
overflow: auto;
}

.shcb-language {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
position: absolute;
width: 1px;
word-wrap: normal;
word-break: normal;
}

.hljs {
box-sizing: border-box;
}

.hljs.shcb-code-table {
display: table;
width: 100%;
}

.hljs.shcb-code-table > .shcb-loc {
color: inherit;
display: table-row;
width: 100%;
}

.hljs.shcb-code-table .shcb-loc > span {
display: table-cell;
}

.wp-block-code code.hljs:not(.shcb-wrap-lines) {
white-space: pre;
}

.wp-block-code code.hljs.shcb-wrap-lines {
white-space: pre-wrap;
}

.hljs.shcb-line-numbers {
border-spacing: 0;
counter-reset: line;
}

.hljs.shcb-line-numbers > .shcb-loc {
counter-increment: line;
}

.hljs.shcb-line-numbers .shcb-loc > span {
}

.hljs.shcb-line-numbers .shcb-loc::before {
border-right: 1px solid #ddd;
content: counter(line);
display: table-cell;
text-align: right;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 1%;
}
```array=list(map(int,input().split()))
ar_sorted =  sorted(array, key=int)
string = input()
if string == 'ABC':
print(ar_sorted)```Code language: PHP (php)```

## Problem: Apaxiaaaaaaaaaaaans

Sample Solution:

``````oldstring = input()
newstring = oldstring
for char in oldstring[1:]:
if char != newstring[-1]:
newstring += char
print(newstring)```Code language: PHP (php)```

## Problem: Bijele

Sample SOlution:

``````needed = [1,1,2,2,2,8]
have   = [int(x) for x in input().split()]

difference = []
for i in range(len(needed)):
difference.append(needed[i] - have[i])

print(" ".join([str(x) for x in difference]))```Code language: PHP (php)```

## Problem: Datum

Sample Solution:

``````import calendar
import datetime
a = [int(x) for x in input().split()]
d = a
m = a
def findDay(date):
born = datetime.datetime.strptime(date, '%d %m %Y').weekday()
return (calendar.day_name[born])
date = "{} {} 2009".format(d, m)
print(findDay(date))```Code language: JavaScript (javascript)```

## Problem: Modulo

Sample Solution:

``````a = []
b = 0
for i in range(10):
mod = a[i] % 42
if mod != a[i+1] % 42:
b+=1
print(b)```Code language: PHP (php)```

## Problem: Number Fun

Sample Solution:

``````def arith(a, b, c):
if a+b==c or a*b==c or a-b==c or b-a==c or a/b==c or b/a == c:
print("possible")
else:
print("impossible")
a = []
n = int(input())
for i in range(n):
a.append([int(j) for j in input().split()])

for i in range(n):
print(a[i], a[i], a[i])```Code language: PHP (php)```

## Problem: Sibice

Sample Solution:

``````import math

n, w, h = [int(q) for q in input().split()]
hyp = math.sqrt(w*w + h*h) + 0.01

for _ in range(n):
if int(input()) < hyp:
print('DA')
else:
print('NE')```Code language: PHP (php)```

## Problem: Detailed Differences

Sample Code:

``````num = int(input())
a = []
for i in range(num):
str1 = input()
str2 = input()
for j in range(len(str1)):
if str1[j]==str2[j]:
a.append(".")
else:
a.append("*")
print(str1)
print(str2)
print("".join(a))```Code language: PHP (php)```

## Problem: Nasty Hacks

Sample Code:

``````n = int(input())
for i in range(n):
x = [int(y) for y in input().split()]
r = x
e = x
c = x
if r == e-c:
print("does not matter")
elif r < e - c:
else:
print("do not advertise")```Code language: PHP (php)```

## Problem: Cryptographer’s Conundrum

``````cypher = input()