Skip to content

HETFADIA/CompetitveProgrammingHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

238 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Click below to use Competitive Programming Helper

https://hetfadia.github.io/CompetitveProgrammingHelper/

Explore the docs »
Report Bug



Table of Contents
  1. About
  2. Instructions on How to Run
  3. Input features
  4. Algorithms Used
  5. Features
  6. Warnings
  7. ScreenShots

About The Project

You can create Random Arrays, Random Permutations, Primes, PrimesCount, NextPrimes, PreviousPrimes, Prime Factors of Numbers in a Given Range, Random Trees of N nodes, Approx Time for a program, Memory used by a Program etc using this project.

The Generated output can be used to test a code, hack a code, debug a code easily and in no time.

The output can also determine the time the code would take when submitted so that we can determine whether it is TLE or not.

Using the above functionalities we can also simple test cases, worst test cases etc

Instructions on How to Run

Go to the github pages link

Enter the numbers or array size in the input boxes

The input boxes automatically evaluates the input.

You can see the output by pressing enter

Click on Generate button to generate the output(arrays or permutations or prime factors).

Click on clear button to reset the generated output.

Input Features

The program automatically evaluates the input.

  • 10**5 Evaluated as pow(10,5)
  • 1e7 Evaluated as 10000000
  • 2*(10*3)/2 Evaluated as its value ie. 30
  • logstar(a,b) Evaluated as iterative logarithm of a to the base b
  • iterlog(a,b) Evaluated as iterative logarithm of a to the base b
  • exp(3) Evaluated as e raised to 3= 20.08
  • pi Evaluated as pi(pi, Pi, PI, pI all works here)
  • e Evaluated as e ie 2.73
  • sin(1) Evaluated as sin of 1 radian
  • cos(1) Evaluated as cos of 1 radian
  • tan(1) Evaluated as tan of 1 radian
  • pow(10,5) Evaluated as 10**5
  • sqrt(100) Evaluated as 10
  • cbrt(1000) Evaluated as 10
  • log(1000) Evaluated as Math.log(1000)=6.9
  • log2(1000) Evaluated as Math.log2(1000)=9.96
  • log10(1000) Evaluated as Math.log10(1000)=3
  • mex(a) Evaluated to the mex of the array a

The Program also evaluates these python features

  • pow(a,b,c) Evaluated as (a**b)%c
  • chr(a) Evaluated as the character having ascii value a
  • ord(a) Evaluated as the ascii value of a
  • bin(a) Evaluated as string of binary representation of a
  • oct(a) Evaluated as string of octal representation of a
  • hex(a) Evaluated as string of hexadecimal representation of a
  • float(a) Evaluated as the float form of a
  • int(a) Evaluated as the integral form of a
  • int(a,0) Evaluated to integer form of a by automatically detecting base of a
  • int(a,b) Evaluated to the value of a in base b (eg int("100",2)=4)
  • len(a) Evaluated to the length of the object
  • factorial(a) Evaluated to the factorial of the number
  • sort(a,key=itself,reverse=True) sorts the array according to key in the reverse arg. Here key and reverse are optional
  • sorted(a,key=itself,reverse=True) Returns the sorted form of array according to key in the reverse arg. Here key and reverse are optional
  • keys(a) Returns the keys of the dictionary object
  • values(a) Returns the values of the dictionary object
  • bit_length(a) Returns the number of significant bits in the binary representation of the number a
  • Counter(a) Returns the key value pair of the array a
  • count(a,b) Returns the number of occurences of b in the array a
  • range Returns the list of python range function
  • list(a) Returns list of the object a
  • reversed(a) Returns the reversed list of the object a
  • join(a,b) Returns the "b".join(a) ie joins b within each consequitive items of a
  • combinations(arr,len) Returns all the combinations of arr of size len
  • combinations_with_replacement(arr,len) Returns all the combinations of arr of size len
  • permutations(arr,len) Returns all the permutations of arr of size len
  • product(arr,len) Returns all the products of arr with the repeat r
  • binBits(n,len=64) Returns the binary representation of n in len bits

The program also evaluates these c++ features

  • setb(a) Returns the count of 1 in the 64 bit binary representation of the number a
  • msb(a) Returns the most significant bits in the 64 bit binary representation of the number a
  • rb(a) Returns the decimal value of rightmost bit in the 64 bit binary representation of the number a
  • rbm(a) Returns the rightmost bit in the 64 bit binary representation of the number a
  • sorta(a,key) Sorts the array a ascending according to key. Here key(default=ascending) is optional
  • sortd(a) Sorts the array a in descending order according to key. Here key(default=descending) is optional
  • __gcd(a,b) Returns the gcd of a and b
  • __builtin_popcountll(a) Returns the count of 1 in the 64 bit binary representation of the number a
  • __builtin_parityll(a) Returns the parity of count of 1 in the 64 bit binary representation of the number a
  • __builtin_clzll(a) Returns the number of leading zeros in the 64 bit binary representation of the number a
  • __builtin_ctzll(a) Returns the number of trailing zeros in the 64 bit binary representation of the number a
  • is_sorted(a) Returns true if a is ascending sorted else false
  • next_permutation(a) a is next permutated and 1 is returned if a becomes sorted else 0
  • prev_permutation(a) a is prev permutated and 1 is returned if a becomes reverse sorted else 0
  • count_if(a,func,start,end) return the count of elements of a where func(element) satisfies. Start(default=0) and end(def=n) are optional

Many other expressions are also evaluated by writing Math.atan, Math.acos etc.

Thus any integer expression in any of the input boxes can be replaced by 1e7, log2(3) and the program will work fine.

Algorithms used

Sieve Of Erantosthenes: Sieve is used to find whether Integers in a large interval are prime or not.

Sieve Prime Factorization(spf): SPF is used in the prime factorization of integers in a large interval.

Prufer Sequence is used to generate random tree.

The Program automatically detects whether SPF and Sieve can fasten the code. If they can save time using them then Sieve or SPF are used respectively.

Features

The program input accepts integers as well as scientific notations.

The Test cases generator also gives a colored output.

Warning

The program input currently only generates array of integers in random integers.

For using string and characters in sort, you have to input manually like 'a' 'abc' 'str' 't'

Screen Shots

Here are the few Screenshots

Logo

Logo

Logo

Logo

Logo

Logo

Logo

Logo

Logo

Logo