Skip to content

Instantly share code, notes, and snippets.

View TechacademyCode's full-sized avatar

Techacademy Code TechacademyCode

View GitHub Profile
n = int(input())
nums = list(map(int, input().split()))
h = [0 for _ in range(2005)]
for i in nums:
h[i] += 1
cnt = 0
for i in range(2005):
if h[i] >= 3:
n = int(input())
nums = list(map(int, input().split()))
h = [0 for _ in range(10)]
for num in nums:
for j in str(num): #123 "1" "2" "3"
h[int(j)] += 1
print(*h)
n = int(input())
nums = list(map(int, input().split()))
h = [0 for _ in range(n+5)]
for i in nums:
h[i] += 1
q = int(input())
for _ in range(q):
x = int(input())
#include <iostream>
using namespace std;
int main()
{
string s;
cin >> s;
int sum = 0;
for(int i = 0; i < s.length(); i++)
{
#include <iostream>
using namespace std;
int main()
{
string s;
cin >> s;
for(int i = 0; i < s.length(); i++)
{
if(islower(s[i]))
n = int(input())
list1 = list(map(int, input().split()))
list1.sort();
cnt = 0
for i in range(1, n):
if i == n-1:
if list1[i] == list1[i-1]:
cnt += 1
else:
if list1[i] == list1[i-1] and list1[i] != list1[i+1]:
n = int(input())
list1 = list(map(int, input().split()))
sumList = 0
for i in list1:
sumList += i
print(sumList)
import math
n, k = map(int, input().split())
nums = list(map(int, input().split()))
x = abs(sum(nums))
print(math.ceil(x / k))
n = int(input())
# 1 3 2 3
list1 = list(map(int, input().split()))
x = int(input())
cnt = 0
for i in range(n):
for j in range(i + 1, n):
if list1[i] + list1[j] == x:
cnt += 1
# print("Found:", list1[i], list1[j])
n = int(input())
# 1 3 2 3
list1 = list(map(int, input().split()))
x = int(input())
cnt = 0
for i in range(n):
for j in range(i + 1, n):
if list1[i] + list1[j] == x:
cnt += 1
# print("Found:", list1[i], list1[j])