├── readme.md ├── node_js ├── readme.md └── cf.js └── python ├── readme.md └── cf.py /readme.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | It is a program that seprates and provide you with the link of differents Educationals Round and Div. 3. 3 | There is a python and a node implementation of the code. 4 | The details are provided in their respective folders. -------------------------------------------------------------------------------- /node_js/readme.md: -------------------------------------------------------------------------------- 1 | It is a node program that finds the contest by there tag. 2 | Right now I'm filtering only Educational Rounds and Div. 3. 3 | 4 | ## Installation 5 | 6 | Use the npm package manager to install request. 7 | 8 | ```bash 9 | npm i request 10 | ``` 11 | 12 | ## Usage 13 | 14 | Just run with node as node cf.js and there will be two file created.(div3 and education's with the details.) -------------------------------------------------------------------------------- /python/readme.md: -------------------------------------------------------------------------------- 1 | It is a python program that finds the contest by there tag. 2 | Right now I'm filtering only Educational Rounds and Div. 3. 3 | 4 | ## Installation 5 | 6 | Use the package manager pip to install request. 7 | 8 | ```bash 9 | pip install request 10 | ``` 11 | 12 | ## Usage 13 | 14 | Just run with python3 as python cf.py and there will be two file created.(div3 and education's with the details.) -------------------------------------------------------------------------------- /python/cf.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://codeforces.com/api" 4 | options = '/contest.list' 5 | link = 'http://codeforces.com/contest/' 6 | 7 | data = requests.get(url+options) 8 | data = data.json() 9 | 10 | div3 = [] 11 | edu = [] 12 | if data['status'] == 'OK': 13 | data = data['result'] 14 | for i in data: 15 | if 'Educational' in i['name']: 16 | edu.append(int(i['id'])) 17 | 18 | if 'Div. 3' in i['name']: 19 | div3.append(int(i['id'])) 20 | 21 | div3.sort() 22 | edu.sort() 23 | 24 | f = open("div3.txt","w+") 25 | cnt = 1 26 | for i in div3: 27 | temp = 'Div3 ' 28 | temp += str(cnt) 29 | temp += ': ' 30 | temp += link+str(i) 31 | temp += '\n' 32 | f.write(temp) 33 | cnt+=1 34 | f.close() 35 | 36 | 37 | f = open("educational.txt","w+") 38 | cnt = 1 39 | for i in edu: 40 | temp = 'Educational Round ' 41 | temp += str(cnt) 42 | temp += ': ' 43 | temp += link+str(i) 44 | temp += '\n' 45 | f.write(temp) 46 | cnt+=1 47 | f.close() 48 | else: 49 | print('There may be some issues on Codeforces or the servers or not responding'); 50 | print('Please Wait and try it after few minutes'); -------------------------------------------------------------------------------- /node_js/cf.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | 3 | const request = require("request"); 4 | const fs = require("fs"); 5 | const url = "http://codeforces.com/api"; 6 | const options = '/contest.list'; 7 | const link = 'http://codeforces.com/contest/'; 8 | 9 | 10 | let contest = async () => { 11 | let edu = []; 12 | let div3 = []; 13 | request(url + options, (err, res, body) => { 14 | if (res.statusCode == 200) { 15 | let data = JSON.parse(res.body); 16 | for (let i in data.result) { 17 | let fct = data.result[i]; 18 | if (fct["name"].includes("Educational")) { 19 | edu.push(fct.id); 20 | } 21 | if (fct["name"].includes("Div. 3")) { 22 | div3.push(fct.id); 23 | } 24 | } 25 | } 26 | else if(err){ 27 | console.log("There may be some issues on Codeforces or the servers or not responding"); 28 | console.log("Please Wait and try it after few minutes"); 29 | return; 30 | } 31 | div3.sort((a, b) => (a - b)); 32 | edu.sort((a, b) => (a - b)); 33 | 34 | for (let i in div3) { 35 | fs.appendFile("Div3.txt", `Div3 Rounds ${Number(i) + 1} : ${link + div3[i]}\n`, (err) => { 36 | if (err) 37 | console.log(err); 38 | else 39 | return; 40 | }); 41 | } 42 | 43 | for (let i in edu) { 44 | fs.appendFile("Educational.txt", `Educational Round ${Number(i) + 1} : ${link + edu[i]}\n`, (err) => { 45 | if (err) 46 | console.log(err); 47 | else 48 | return; 49 | }); 50 | } 51 | }); 52 | 53 | } 54 | contest(); --------------------------------------------------------------------------------