Skip to content

Instantly share code, notes, and snippets.

View anmolj7's full-sized avatar

Anmol Jhamb anmolj7

View GitHub Profile
from math import sqrt, floor
T = int(input())
for _ in range(T):
power = int(input())
k = -0.5+sqrt(1+2*power)/2
if k == floor(k):
k -= 1
k = floor(k)
sum_bef = (k*(4+4*k))/2
'''
Problem
Write a program that reads a string S and find the minimum number r of applications of the function replace(a,b) to form a palindrome.
'''
def main():
String = input() #Isn't displaying any string while taking input because
#if you're using an online judge to check our answers, then, it'd show wrong answer
#because of this.
count = i = 0
j = len(String)-1
#Well, The task description said that
#NOT SOOO FASSTTTT!
def shift_bits(num, n):
'''
a function written to shift the bits of the given number by n
for example,
1 -> 1
1 << n = 1......0(n zeroes!)
'''
import math
def number_of_factors(num):
count = 0
for i in range(1, int(math.sqrt(num))+1):
if num%i == 0:
if num/i == i:
count += 1
else:
count += 2
from functools import reduce
def return_factors(n):
p = 2
Factors = {}
while p * p <= n:
count = 0
while n % p == 0:
n //= p
count += 1
@anmolj7
anmolj7 / PresenceChecker.py
Created January 8, 2020 17:35
You need to pip install lxml, bs4 and requests. This is not compatible wiht python2, that is outdated anywasys XD
import requests
import re
from bs4 import BeautifulSoup
class colors:
GREEN = '\033[92m'
STOP = '\033[0m'
RED='\033[31m'
class CheckUsername:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
---
- hosts: localhost
name: play_1
tasks:
- name: Creating the Account
user:
name: test_3
password: '2cc88511a4cd61e01f8d1636a2c82470fef06c9f473cff464b61798588b284b6'
from flask import Flask, request
import telegram
import os
os.chdir('mysite')
bot_token = "API KEY"
bot_user_name = "Gotoh_Welcome_Bot"
URL = "your hosted url"
TOKEN = bot_token
bot = telegram.Bot(token=TOKEN)
<html>
<head>
<title>Task for GCI</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
input{
border: none;
background-color: lightblue;
}
body{