Skip to content

Instantly share code, notes, and snippets.

View TechacademyCode's full-sized avatar

Techacademy Code TechacademyCode

View GitHub Profile
import math
n, k = map(int, input().split())
i = 2
cnt = 0
while n > 1:
if n % i == 0:
cnt += 1
if cnt == k:
print(i)
import math
n = int(input())
flag = True
while n > 0:
m = n % 10
if m != 0 and m != 6 and m != 8:
flag = False
break
import math
n = int(input())
cnt = 0
for i in range(1, int(math.sqrt(n)+1)):
if n % i == 0:
cnt += 1
if n // i != i:
cnt += 1
import math
n = int(input())
cnt = 0
for i in range(1, int(math.sqrt(n)+1)):
if n % i == 0:
cnt += 1
if n // i != i:
cnt += 1
#include <bits/stdc++.h>
using namespace std;
int main() {
int t; cin >> t;
if (t <= 50)
{
cout << 25000 + 600 * t << endl;
}
else if (t <= 200)
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b > c && b + c > a && c + a > b)
{
// không được phép viết a == b == c
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
string s;
cin >> s;
int n = s.length();
int left = 0, right = n-1;
n, mod = map(int, input().split())
a = list(map(int, input().split()))
dem = {}
for x in a:
du = x % mod
dem[du] = dem.get(du, 0) + 1
ans = 0
for f in dem.values():
ans += f * (f - 1) // 2
print(ans)
n = int(input())
a = list(map(int, input().split()))
freq = {}
count = 0
for i in range(n):
key = a[i] - (i+1)
freq[key] = freq.get(key, 0) + 1
n, k = map(int, input().split())
arr = list()
h = [0] * 10000
cnt = 0
for i in range(n):
x = int(input())
y = x - k
cnt += h[y]
h[x] += 1