uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
8989f476-6ce8-4430-99c3-4b0871aa7e94 | aditya-mad/leetcode-solutions | Solutions/2778. Sum of Squares of Special Elements.cpp | class Solution
{
public:
int sumOfSquares(vector<int> &nums)
{
int ans = 0, size = nums.size();
for (int i = 1; i <= size; i++)
{
if (size % i == 0)
{
ans += (nums[i - 1] * nums[i - 1]);
}
}
return ans;
}
}; | ALGO | 0.99993 | 6.046925 |
ac0573d1-bc44-4ebd-ba13-7f424f75b0ab | Huyneef/DSA_as6_province_as8_singleLL | 6_province_pr1.cpp | #include <bits/stdc++.h>
using namespace std;
struct tinh {
int id;
string name;
long pop;
float area;
};
typedef tinh pro;
struct node {
pro info;
node *next;
};
struct List {
node *head;
node *tail;
};
void Init(List &l) {
l.head = NULL;
l.tail = NULL;
}
node* getNode(pro x) {
... | ALGO | 0.995041 | 3.787611 |
5b9f447e-7b2c-48c8-89ab-f5120fa551d1 | RichardPalme/fasm | src/cross_validation.cpp | #include "cross_validation.h"
std::pair<double, double> cross_validate(
std::vector<sample_type> &samples,
std::vector<double> &labels,
size_t folds,
size_t num_repetitions) {
dlib::svm_c_linear_dcd_trainer<kernel_type> trainer;
std::vector<double> C{1};
for (auto i : {1, ... | DATA | 0.979367 | 6.554244 |
3c86677f-8138-4498-97c1-113d4e797caa | Backslash-Computing-Society/Hacktoberfest_2024 | busort.cpp | #include <iostream>
using namespace std;
int main()
{
int len;
cout << "Input length : ";
cin >> len;
int arr[len];
for(int i=0;i<len;i++)
{
cin>>arr[i];
}
int num=1;
while(num<len)
{
for(int i=0;i<len-num;i++)
{
if(arr[i]>arr[i+1])
... | ALGO | 0.999911 | 3.438699 |
73796485-8ee6-42bc-9990-c4058f10d2f5 | parthgoyal123/GeeksForGeeks | Arrays/9. Maximize_the_array.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define md 1000000007
#define loop(i,a,b) for(int i=a; i<b; i++)
#define lloop(i,a,b) for (long long i=a; i<b; i++)
#define loopr(i,a,b) for(int i = a; i>=b; i--)
#define iterate(it, v) for (auto it = v.begin(); it!= v.end(); it++)
#define mk make_pai... | ALGO | 0.999975 | 3.455679 |
b3d55484-a79b-40ac-b50b-6e3831a92900 | floresloyd/Undergraduate_CUNY_Queens | CSCI_211_OOP_Cpp/1HW5_1D_OKFUNC.cpp | /*
Loyd Flores
CSCI 111 22A
Homework 4 - 1D 8 Queens without Go-To Statements
Prof. Waxman & Prof. Abraham
*/
/**
* @brief no go to statements
*/
#include <iostream>
#include <cmath>
using namespace std;
/*
* ok function returns a boolean function to determine if we can place a queen or not
* int q[] -> an a... | ALGO | 0.999392 | 4.609449 |
da5d03a6-b100-416c-950d-a188c18a75c9 | shubham-deshmukh/CP-Contests | CSES Problem Set/Sorting and Searching/Tasks and Deadlines.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(), x.end()
#define endl "\n"
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int mod = 1e9+7;
struct Task {
int duration, deadline;
};
void solve() {
int n;
cin >> n;
... | ALGO | 0.999978 | 5.495807 |
2afd7fa9-759d-4590-ac97-d5ebe3a257e3 | am-aakash/dsa | striver-sde-sheet-challenge/day 1-4/my_pow.cpp | class Solution
{
public:
double myPow(double x, int n)
{
long long nn = n;
if (nn < 0)
x = 1 / x, nn = -nn;
double ans = 1;
while (nn > 0)
{
if (nn % 2 == 0)
x = x * x, nn /= 2;
else
ans = ans * x, nn--;
... | ALGO | 0.999949 | 5.961471 |
fe3829ed-6b86-4302-a759-e11688b2bd73 | ArsalanRashid-K/meals_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998762 | 6.786404 |
64d5b929-c5e3-470f-977b-309f89b85ee4 | stark1024/Mark1 | pro22.cpp | #include <iostream>
using namespace std;
int main(){
int x, c, i, j;
cout<<"Enter no. of rows: ";
cin>>x;
for(int i=0; i<=x; i++){
c=1;
for(int j=0; j<x-i; j++){
cout<<" ";
}
for(int j=0; j<=i; j++){
cout<<c<<" ";
c = c * (i-j)/(j+1);
}
cout<<endl;
}
return 0;
... | ALGO | 0.999595 | 3.972287 |
4e406202-a9ee-4cde-b406-804ffad9fe33 | Adham-amr-1/FEHU-CPC | S - Codeforces Checking.cpp | #include <iostream>
using namespace std;
int main()
{
int n, i, count;
string s = "codeforces";
char st;
cin >> n;
while (n--) {
cin >> st;
count = 0;
for (i = 0; i < s.length(); i++) {
if (s[i] == st) {
count++;
}
}
if (count) {
cout << "YES" << endl;
}
else {
cout << "NO" << endl;
... | ALGO | 0.999888 | 3.958199 |
9fa173f6-e6db-481f-a1eb-79e46ae23131 | pranavsindura/CompetitiveProgramming | codeforces/E/1081e.cpp | #include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define dbg(x) cou... | ALGO | 0.999907 | 3.586028 |
d8c03f7e-676f-44cc-9125-5f2624d008cf | VenkataAnilKumar/LeetCode | C++/find-median-from-data-stream.cpp | // Time: O(nlogn) for total n addNums, O(logn) per addNum, O(1) per findMedian.
// Space: O(n), total space
// Heap solution.
class MedianFinder {
public:
// Adds a number into the data structure.
void addNum(int num) {
// Balance smaller half and larger half.
if (max_heap_.empty() || num > m... | ALGO | 0.999996 | 7.077167 |
c0ee1912-5480-4b3d-b53f-0d7b1a49567b | 2019331043-Zakaria/Codes | CB/Lowest_Common_Ancester.cpp | /*
* @Author: Zakaria
* @Date: 2022-04-01 01:08:32
* @Last Modified time: 2022-07-17 11:54:03
*/
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define pi acos(-1.0)
#define LCM(a,b) a*b/__gcd(a,b)
#define GCD(a,b) __gcd(a,b)
#define ... | ALGO | 0.999961 | 4.457058 |
efde7d6c-71e7-4aed-8129-adcec203bff5 | teseoch/CG-Summer-2024 | Assignment_4/src/main.cpp | ////////////////////////////////////////////////////////////////////////////////
// C++ include
#include <iostream>
#include <string>
#include <vector>
#include <limits>
#include <fstream>
#include <algorithm>
#include <numeric>
// Utilities for the Assignment
#include "utils.h"
// Image writing library
#define STB_I... | ALGO | 0.999568 | 7.63847 |
39ad8ea9-5aae-4f7b-914e-316478d108e9 | Gabriel-Spinola/C-CPP-Studies | C++/Games/Visual Studio/SimpleSnakeGame/SimpleSnakeGame/Source.cpp | #include <iostream>
#include <Windows.h>
#include <conio.h> // input lib
using namespace std;
// 20x20 blocks map
const int WIDTH = 25;
const int HEIGHT = 25;
bool gameOver;
// tail max width and height
int tailX[100], tailY[100];
int nTail;
int x, y, fruitX, fruitY;
int score;
enum eDirection {
STOP = 0,
L... | ALGO | 0.984615 | 4.520596 |
245819a2-606a-44d1-b896-551742c5fee5 | dheerajabhi/DSA-stack | Postfix_Evalution.cpp | #include <iostream>
#include<math.h>
using namespace std;
#define MAX 100
char stack[MAX]; // for taking input algebric expession
int top = -1;
char stackarr[MAX]; // pop push operation
int pop()
{
int temp;
if (top == -1)
{
cout << "STACK UNDERFLOW" << endl;
}
temp = stackarr[top];
top... | ALGO | 0.999944 | 3.75861 |
ce68afc7-f250-423a-8b4c-02b0c9ef7f78 | meixiangzhang/xuexi | C++/lesson/lesson7.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
class A{
public:
virtual void print(){//虚函数表指针
cout << "A::print" << endl;
}
};
class B : public A{//B类也有自己的虚函数表
public:
int _b;
public:
void print() override{
cout << "B::print" << this << endl;
}
};
class... | TOOL | 0.91567 | 3.746989 |
74234f50-32fa-43ec-b6ef-ed72fc9ea208 | SeongHo5356/Algomate | algorithm-mate/src/main/resources/solutions/16144/cpp/solution_12.cpp | #include<bits/stdc++.h>
//#define double long double
//T.erase(unique(T.begin(),T.end()),T.end());
//written by djs100201
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using PP = pair<ll, P>;
const ll n_ = 2020 + 100, inf = (ll)2e9 * (ll)1e9 + 7, mod = 1e9 + 7, sqrt... | ALGO | 0.99978 | 3.757434 |
841912fa-e793-4538-adae-15327273bf28 | haservi/udemy-flutter | 07_favorite_places/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998594 | 6.761023 |
39a87f38-5d72-46f7-950c-89b923778173 | Sefayet-Alam/New-CP-submissions_vol_3 | D_Birthday_Gift.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
// VVI
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define SZ(a)... | ALGO | 0.999828 | 4.942034 |
a58c0b92-8586-4839-bd84-02db99779f37 | cryfs/cryfs | src/cryfs-cli/program_options/utils.cpp | #include "utils.h"
#include <algorithm>
#include <string>
#include <iterator>
using std::pair;
using std::make_pair;
using std::vector;
using std::string;
namespace cryfs_cli {
namespace program_options {
pair<vector<string>, vector<string>> splitAtDoubleDash(const vector<string> &options) {
a... | TOOL | 0.964885 | 5.842029 |
a861a187-2cd1-41af-92cf-4fadb62283f9 | SparshJain2000/Leetcode-solutions | String/group-anagrams.cpp | //Problem Statement
/*
Given an array of strings, group anagrams together.
*/
#include <bits/stdc++.h>
class Solution
{
public:
vector<vector<string>> groupAnagrams(vector<string> &strs)
{
vector<vector<string>> ans;
vector<vector<int>> alps;
for (int i = 0; i < strs.size(); i++)
... | ALGO | 0.999999 | 6.491401 |
b0380365-8c51-447c-b0aa-bcabe6361dca | sarvex/leetcode-clojure | solution/0800-0899/0854.K-Similar Strings/Solution.cpp | class Solution {
public:
int kSimilarity(string s1, string s2) {
queue<string> q{{s1}};
unordered_set<string> vis{{s1}};
int ans = 0;
while (1) {
for (int i = q.size(); i; --i) {
auto s = q.front();
q.pop();
if (s == s2) {
... | ALGO | 0.99999 | 5.843672 |
b58b6119-b3ee-4018-8d1e-0b196d01cbe7 | sumonmd/Algorithm | longlength_fibonacci.cpp | #include<bits/stdc++.h>
using namespace std;
string Adjust(string str,int ln)
{
for(int i=0;i<ln;i++){
str = "0"+str;
}
return str;
}
string Add(string num1,string num2)
{
int ln1 = num1.size();
int ln2 = num2.size();
if(ln1<ln2){
num1 = Adjust(num1,ln2-ln1);
}
else{
... | ALGO | 0.999983 | 4.041627 |
c547a4fb-2806-420b-ab8a-894ca1770c76 | PaymanBehnam/Advanced_Programming | Lab3/Lab3_Problem2.cpp | /*
Author: Payman Behnam Class: ECE 6122-A, 903154319
Last Date Modified: OCT 13, 2020!!
Description:
Another ant on the move problem (https://brilliant.org/practice/monte-carlo/)
We define 2D array <gxg> with all values zero and four moves: up=>1,down=>2,left=>3,right=>4. Each time that we got o new cell, that cell ... | ALGO | 0.999969 | 3.282042 |
a71b2e84-0600-47eb-8d9f-5c3f8bd10aec | raunakdwivedi03/DSA | 0102-binary-tree-level-order-traversal/0102-binary-tree-level-order-traversal.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999946 | 6.521003 |
3c7f3142-2923-40dd-8d71-e2a6e5e5a926 | brandonviaje/LeetCode | 206-reverse-linked-list/reverse-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseList... | ALGO | 0.999731 | 5.98254 |
2e0b3188-3459-4c8e-891d-9c8e252c9d9a | M-E-U-E/Current | D. Divide and Equalize.cpp | #include<bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
bool cmp(pair<int,int>a,pair<int,int> b)
{
if(a.first > b.first)
return true;
else if(a.first == b.first and a.second<b.second)
return true;
return false;
}
bool check(const string& x, const string& s)
{
... | ALGO | 0.999641 | 4.75903 |
876932bb-0724-4f8e-ba10-eedc88f9d6ff | ravi122004/DsaWithCpp | filter_non_negative_prices.cpp | // Problem: Filter out negative prices from a list.
// Input:
// n - number of product prices (1 ≤ n ≤ 20)
// n space-separated double values (range: -100.0 to 100.0)
// Output:
// Space-separated non-negative prices
// Sample:
// Input: 5\n10.5 -5.2 8.7 -3.9 12.3
// Output: 10.5 8.7 12.3
// You are using GC... | ALGO | 0.999085 | 4.872756 |
8939cee2-2f66-4cf6-b652-b1427535f6be | Rajesh-Gundu/Leetcode-DSA | 260-single-number-iii/single-number-iii.cpp | class Solution {
public:
int getSetBitPos(long num) {
for(int i=0;i<32;i++) {
if((num>>i)&1)
return i;
}
return 0;
}
vector<int> singleNumber(vector<int>& nums) {
long x = 0;
for(int& i : nums) {
x ^= i;
}
int ze... | ALGO | 0.999988 | 5.228519 |
df857973-69e0-4f27-825f-738f08995234 | ishandutta2007/codeforces | maooooam/normal/1303/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, s, t) for (int i = s; i < int(t); ++i)
#define sc scanf
#define pr printf
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define range(c) c.begin(), c.end()
#define lowbit(x) ((x) & -(x))
#define pop_cou... | ALGO | 0.999989 | 4.148979 |
96c8ba8b-e8b5-45c0-9af0-e88b8d9bdeb9 | osushkov/fractals | src/fractals/FractalEscapeGenerator.cpp | /*
* FractalEscapeGenerator.cpp
*
* Created on: 19 Nov 2015
* Author: osushkov
*/
#include "FractalEscapeGenerator.hpp"
#include <cassert>
double FractalEscapeGenerator::calculatePixelWidth(
const Vector2 ®ionMin, const Vector2 ®ionMax, unsigned samplesX) {
assert(regionMin.x <= regionMax.x && ... | ALGO | 0.982174 | 5.390971 |
1fe11fce-f191-46f0-b453-ea01c74b235d | iulian0512/android_spatialite | static_libs/proj-9.2.1/src/projections/isea.cpp | /*
* This code was entirely written by Nathan Wagner
* and is in the public domain.
*/
#include <errno.h>
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits>
#define PJ_LIB_
#include "proj.h"
#include "proj_internal.h"
#include <math.h>
#define DEG36 ... | ALGO | 0.998984 | 5.986321 |
ae6073c0-9a49-4ea2-9db8-8df29fb45521 | bharat0042/Three-Body-Simulation | src/Main.cpp | #include "Body.h"
#include <memory>
#include <SFML/Graphics.hpp>
int main()
{
int width = 1200;
int height = 900;
float dt = 1 / 60.0f;
std::shared_ptr<Body> firstBody = std::make_shared<Body>(std::complex<float>{-300.0f, -160.0f}, std::complex<float>{-300.0f, -160.0f}, std::complex<float>{0.0f, 0.0f}... | ALGO | 0.95548 | 3.827161 |
b2875389-e3a8-4542-84c1-058c69cd5693 | ishandutta2007/codeforces | shik/normal/776/A.cpp | // {{{ by shik
#include <stdio.h>
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define M... | ALGO | 0.999928 | 3.258443 |
ebbf686f-9b0a-4b51-88ec-77d0a17c85cb | TinkerBoard-Android/rockchip-android-frameworks-av | media/libheadtracking/PoseDriftCompensator.cpp | #include "PoseDriftCompensator.h"
#include <cmath>
#include "QuaternionUtil.h"
namespace android {
namespace media {
using Eigen::Quaternionf;
using Eigen::Vector3f;
PoseDriftCompensator::PoseDriftCompensator(const Options& options) : mOptions(options) {}
void PoseDriftCompensator::setInput(int64_t timestamp, con... | ALGO | 0.970896 | 6.963371 |
89457678-60c4-434e-8e0a-8dd10b98d4d4 | TosakaUCW/CompetitiveProgramming | Codeforces/Contest/EPIC Summer 2024 1987/B - K-Sort.cpp | #include <bits/stdc++.h>
using i64 = long long;
using pii = std::pair<int, int>;
using tuu = std::tuple<int, int, int>;
#define pb push_back
using std::cin, std::cout, std::string, std::vector;
int read(int x = 0, int f = 0, char ch = getchar())
{
while (ch < 48 or 57 < ch) f = ch == 45, ch = getchar();
while(4... | ALGO | 0.999448 | 4.723861 |
ac4e2067-a503-44fe-bcb6-23d84f575f8e | KrabbyKrabby/cpp_tester_codebench | tasks/304016/alternate_responses/model7.cpp | #include <iostream>
#include <vector>
#include <thread>
#include <mutex>
using namespace std;
const int N = 9; // Size of the Sudoku grid
// Function to check if it's safe to place num at board[row][col]
bool isSafe(const vector<vector<int>>& board, int row, int col, int num) {
for (int i = 0; i < N; i++) {
... | ALGO | 0.999499 | 6.883403 |
f395c67b-9142-48e9-a090-e36c2633fb7f | zxq97/leetcode | array/697.cpp | class Solution {
public:
int f(const vector<int>& nums, int sum)
{
int l = 0, r = nums.size() - 1;
for(; l < r && nums[l] != sum; ++l);
for(; l < r && nums[r] != sum; --r);
return r - l + 1;
}
int findShortestSubArray(vector<int>& nums) {
unordered_map<int, i... | ALGO | 0.999961 | 5.403617 |
021ace1a-809c-4807-ab61-991fff76b359 | RAJA-2004/DSA-Cpp | Trees/Binary Tree/class-2/sumTree.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;
class Node{
public:
int data;
Node* left;
Node* right;
Node(int data){
this->data=data;
left = NULL;
right = NULL;
}
};
Node* createTree(){
... | ALGO | 0.999945 | 4.582115 |
b4b9c9c8-7788-465f-a862-6c4ae24001a9 | Gaurav-20/LeetCode-Solutions | 2068-check-whether-two-strings-are-almost-equivalent/2068-check-whether-two-strings-are-almost-equivalent.cpp | class Solution {
public:
bool checkAlmostEquivalent(string word1, string word2) {
vector<int> freq1(26, 0);
vector<int> freq2(26, 0);
for (char c : word1) {
freq1[c - 'a']++;
}
for (char c : word2) {
freq2[c - 'a']++;
}
bool equivalent ... | ALGO | 0.999769 | 5.999045 |
223e090c-d8d6-4e3f-8e8d-ad320f4260d7 | shangguandanyi/base_c_cpp | base/CPP/funcobj/test6.cpp | /**
* @file test6.cpp
* @author your name (<EMAIL>)
* @brief
* @version 0.1
* @date 2022-07-11
*
* @copyright Copyright (c) 2022
*
* 逻辑仿函数
* logical_and logical_or logical_not
*/
#include<functional>
#include<vector>
#include<algorithm>
#include<iostream>
using namespace std;
void test01()
{
vector<... | TOOL | 0.939695 | 5.231231 |
82152bd0-0bf2-4bd3-9aed-8a0f2782ee27 | yhqiu16/FDRA | cgra-compiler/src/mapper/mapper.cpp |
#include "mapper/mapper.h"
Mapper::Mapper(ADG* adg): _adg(adg) {
initializeAdg();
_sched = new IOScheduler(adg);
}
Mapper::Mapper(ADG* adg, DFG* dfg): _adg(adg), _dfg(dfg) {
initializeAdg();
initializeDfg();
_mapping = new Mapping(adg, dfg);
// initializeCandidates();
_isDfgModified = fal... | ALGO | 0.992014 | 4.487701 |
14076916-06c8-42d4-ad60-79a444ae5a8c | gabrielrbernardi/UberHub-Code-Club | 2022-1/Manha/URI/1001_2.cpp | #include <bits/stdc++.h>
using namespace std;
int soma(int x, int y){
return x + y;
}
string retornaMensagem(){
return "X = ";
}
int leInteiro(){
int x;
cin >> x;
return x;
}
int main(){
int a = leInteiro(), b = leInteiro();
cout << retornaMensagem() << soma(a,b) << endl;
} | ALGO | 0.963676 | 4.035532 |
f0d269aa-d019-455f-ab03-8956f8cb64b5 | wolfvoid/HNU-resourses | 专业核心-算法设计与分析(89)/算法设计-作业(部分代码)/4-1 会场安排问题.cpp | // -*- coding:utf-8 -*-
// File : 4-1 会场安排问题.cpp
// Time : 2023/12/29
// Author : wolf
#include <algorithm>
#include <iostream>
using namespace std;
struct activity
{
int start;
int end;
bool if_arrange;
} a[10001];
bool cmp(struct activity a, struct activity b)
{
if (a.start < b.start)... | ALGO | 0.999948 | 5.114581 |
1fc4002e-9258-44ae-9be0-314b6159d671 | aqfaridi/Competitve-Programming-Codes | SPOJ/HAMSTER1.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
int main()
{
int t,n;
double u,k1,k2,R,H,theta;
cin>>t;
while(t--)
{
... | ALGO | 0.995902 | 3.042389 |
08d1a81d-1491-4459-a8f9-0b9042f21742 | ishandutta2007/codeforces | thjchph4trjnh/normal/1209/B.cpp | #include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
#define... | ALGO | 0.999887 | 3.669929 |
6be12eb5-1236-459d-a998-d145fd262c4e | BodhiDog/OJCode | Luogu/P9373.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int T;
ll n, k, x, y;
bool flag;
cin >> T;
while (T--)
{
cin >> n >> k;
/*
x>=0,y>0
x+y=n => x=n-y,y=n-x
x%y=k => (n-y)%y=k => n%y=k
λy+k=n => y=(n-k)/... | ALGO | 0.999903 | 4.915483 |
4022fae5-71b6-4d39-9964-97eb22285fe4 | swoogles/Physics | src/Parallelization/Quadrant.cpp | #include "Quadrant.h"
bool withinBoundaries(PhysicalVector & insertPos, PhysicalVector & minBoundaries, PhysicalVector & maxBoundaries) {
bool withinBoundaries = true;
withinBoundaries &= (insertPos.x() > minBoundaries.x() && insertPos.x() < maxBoundaries.x());
withinBoundaries &= (insertPos.y() > minBoundaries.... | ALGO | 0.998825 | 6.206994 |
3bda2573-1382-40a4-acd8-9d958b117dc7 | NearlyTRex/Boost | libs/compute/example/opencv_sobel_filter.cpp | //---------------------------------------------------------------------------//
// About Sobel Filter:
// * Edge Filter - distinguishes the differrent color region
// * Finds the gradient in x and y-axes
// * Three step process
// -> Find x-axis gradient with kernel/matrix
// Gx = [-1 0 +1]
// ... | ALGO | 0.997511 | 6.980558 |
93ede997-d9fd-405d-aa16-5689a566ab9f | zilixie/kinematics | libigl/include/igl/copyleft/cgal/projected_delaunay.cpp | #if CGAL_VERSION_NR < 1040611000
# warning "CGAL Version < 4.6.1 may result in crashes. Please upgrade CGAL"
#endif
template <typename Kernel>
IGL_INLINE void igl::copyleft::cgal::projected_delaunay(
const CGAL::Triangle_3<Kernel> & A,
const std::vector<CGAL::Object> & A_objects_3,
CGAL::Constrained_triangulati... | ALGO | 0.941075 | 6.796049 |
d130239e-10ce-4d45-8c95-f667a272a2a5 | Arseny-Dernovich/Hash_Table | Hash_Table.cpp | #include "My_features.h"
#include <cstddef>
#include <cstdint>
#include <time.h>
const int LOAD_FACTOR = 15;
struct ListNode {
char* key;
ListNode* next;
};
struct HashTable {
ListNode** buckets;
size_t size;
size_t count;
};
uint64_t Hash_djb2(const char* str)
{
uint64_t hash = 53... | ALGO | 0.991413 | 4.531526 |
efd4f93e-124b-45b6-ab52-432402e401db | laloolea/PortafolioEstructuras | EstructuraDatos/AVL/main.cpp | #include <iostream>
#include <iomanip>
#include <cstdlib>
#include "AVL.h"
using namespace std;
int main () {
srand (time (NULL));
try{
cout<<boolalpha;
AVL <int> arbol;
cout<<"Creaci\xA2n del arbol\n\n";
for ( int i = 0 , n = 1 + rand () % 10 ; i < n ; ++i ) {
int ... | ALGO | 0.969515 | 4.661269 |
f09f28b5-194e-4e40-b6ae-7af454081fc4 | 14mohamad/Ex2CPP---Advanced-Graph-Processing | Demo.cpp | #include "Graph.hpp"
#include "Algorithms.hpp"
using ariel::Algorithms;
#include <iostream>
#include <stdexcept>
#include <vector>
using namespace std;
int main()
{
ariel::Graph g1;
// 3x3 matrix that represents a connected graph.
vector<vector<int>> graph = {
{0, 1, 0},
{1, 0, 1},
... | ALGO | 0.917819 | 4.501411 |
5eb37295-63c6-427f-ab81-10decb6f99bc | Anjana-sankar-k/OOP_S1 | compile.cpp | #include<iostream>
using namespace std;
//Creating parent class
class RBI{
public:
float loanrule(float loan){
float repay=loan+loan*(0.05);
return repay;
}
};
class SBI:public RBI{
public:
float sbirule(float loan)
{
if(loan>1000000)
{
float repay1= loan*(0.0... | TOOL | 0.951423 | 3.662407 |
b49a1478-9b61-4b28-a610-4828bffb80ff | jaimemin/programmers | 이진수 더하기.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
string solution(string bin1, string bin2) {
string answer = "";
int carry = 0;
reverse(bin1.begin(), bin1.end());
reverse(bin2.begin(), bin2.end());
for (int i = 0; i < min(bin1.length(), bin2.length()); i++)
{
... | ALGO | 0.999995 | 5.736628 |
b8c2b993-fe88-4b59-b522-9ed088e2b27b | Mayanklakhina/Leetcode-Practice-Problems | 367-valid-perfect-square/367-valid-perfect-square.cpp | class Solution {
public:
bool isPerfectSquare(int num) {
long low=1;
long high=num;
while(low<=high){
long long int mid = (high-low)/2+low;
if(mid*mid==num)
return true;
else if(mid*mid>num)
high=mid-1;
else
lo... | ALGO | 0.999883 | 5.58121 |
bd49b237-2220-487c-93b5-d8ad7fb1a248 | Ming-J/LeetCode | 60_Permutation_Sequence.cpp | #include <iostream>
#include <algorithm>
using namespace std;
class Solution{
private:
int calfactorial(int k){
int n=1;
for(int i=0;i<k;i++){
n*=i+1;
}
return n;
}
public:
string getPermutation(int n, int k){
string s="";
string ans="";
for(int i=0;i<n;i++){
s+=to_string(... | ALGO | 0.999994 | 4.809125 |
d7b07b1f-c196-48a8-acd1-2105e2eaa997 | Diksha7320/college_code | CGL/cgl_a2_cohenSutherlandcliping.cpp | #include <iostream>
#include <math.h>
#include <graphics.h>
#include <string>
using namespace std;
// Defining region codes
const int INSIDE = 0; // 0000
const int LEFT = 1; // 0001
const int RIGHT = 2; // 0010
const int BOTTOM = 4; // 0100
const int TOP = 8; // 1000
// Window coordinates of two diagonal points... | ALGO | 0.999525 | 3.967604 |
66940b60-cfbc-456c-8eb1-473046252284 | hma40/Cpp-Competitive-Programming | Codeforces/1370/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define add push_back
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define f first
#define s second
#define trav(a,x) for (auto& a: x)
... | ALGO | 0.999745 | 5.081317 |
2b7d448f-c9a1-4125-bda6-ace8f9678e83 | manikanta2901/ubuntu | .history/random/trees/minEle_20200729182640.cpp | #include<bits/stdc++.h>
using namespace std;
#define m 10000
int tree[4 * m];
void build(int arr[],int index,int low,int high){
if(low == high){
tree[index] = arr[low];
}else{
int mid = (low + high) / 2;
build(arr,2 * index,low ,mid);
build(arr,2 * index + 1,mid + 1,high);
... | ALGO | 0.999985 | 4.83816 |
a67d6c28-4645-4a15-ad71-36afaf4daf30 | bkorecic/competitive-programming-solutions | codeforces/1117A - Best Subsegment.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
#define mp make_pair
#define pb push_back
#define f first
#define s second
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;... | ALGO | 0.999858 | 4.158791 |
d50f562c-36cd-4a18-899a-c9e87520c50a | donguyenphu/Coding_Solution | CodingFolder/VNOI/coci1920_r6_trener.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=5e1+3;
const ll K=15e2+2;
const ll MOD=1e9+7;
const int BASE=311;
ll has[N][N][K];
ll pw[N],n,k;
string g;
ll dp[N][K];
string mat[N][K];
bool can[N][K];
void pre() {
pw[0]=1;
for (int i=1;i<=52;i++) {
pw[i]=BASE*pw[i-1]%MOD;
... | ALGO | 0.999941 | 4.460338 |
bca771e3-6684-433d-8114-e24e67a038ab | JuanCarlosPrieto/GTCP | Geometry/PointLocationTest.cpp | #include <bits/stdc++.h>
using namespace std;
class vec;
class vec {
public:
long long x;
long long y;
vec(long long x, long long y) {
this->x = x;
this->y = y;
}
long long operator * (vec vec1) {
return this->x * vec1.y - this->y * vec1.x;
}
};
int main() {
int ... | ALGO | 0.999847 | 3.490326 |
58c656ac-6bea-439f-be26-d7d795bfcf97 | VIRAT9358/Arrays | Variations/8_minimize_max_diff_hts(2).cpp | // Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
// it is for +ve heights if we hts can be neg also then remove if and continue case
class Solution {
public:
int getMinDiff(int arr[], int n, int k) {
// code here
... | ALGO | 0.99993 | 5.239839 |
9459d3d8-13e7-461e-afc3-23e0edbc49c0 | myunbin/PS | BOJ/7045.cpp | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
#define fileio() freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define fio() ios_base::sync_with_std... | ALGO | 0.999967 | 4.652406 |
e1977996-6481-40bd-9f80-dac4066445d1 | luqmanarifin/cp | 0-unclassified/kina.cpp | #include <bits/stdc++.h>
/**
* Competitive Programming Final CP Mahasiswa
* Problem : C | Amar dan Kina
* Gajah Wangi (ITB)
**/
typedef long long LL;
typedef double db;
#define sf scanf
#define pf printf
#define mp make_pair
#define nl printf("\n")
#define FOR(i, a, b) for(i = a; i <= b; i++)
#define FORD(i, a, ... | ALGO | 0.999865 | 3.633858 |
22e6c565-7a4c-4e5b-a993-3a751333edb8 | epiitom/DSA | basics/pattern.cpp | #include<iostream>
using namespace std;
int main() {
int rows;
cout << "Enter the no. of rows :";
cin >> rows;
for ( int i = 1; i <= rows; i++)
{
for(int j = 1; j<=i; j++){
cout<< " * ";
}
cout <<"\n";
}
return 0;
} | ALGO | 0.999105 | 3.723365 |
baa0b1bd-995e-4644-a727-b5e5110ed5cd | UserUnauthorized/OI-Codes | Luogu/P6329.cpp | //Luogu - P6329
#include <bits/stdc++.h>
namespace DEBUG {
template<typename T>
inline void _debug(const char *format, T t) {
std::cerr << format << '=' << t << std::endl;
}
template<class First, class... Rest>
inline void _debug(const char *format, First first, Rest... rest) {
whi... | ALGO | 0.999996 | 4.795856 |
6594c12e-9ce0-4c8d-bff6-6c3590969fef | zhzh2001/Learning-public | c++实用代码/DynamicTree/bounce/src/best_test/bounce/bounce1.cpp | #include<stdio.h>
#define maxn 200017
int n,x,y,T;
struct DynamicTree{
struct node{
int size;
node *l,*r,*p;
};
node *a,*null;
int isroot(node *p){return p->p->l!=p&&p->p->r!=p;}
void clear(){
null=new node;null->l=null->r=null;
null->size=... | ALGO | 0.999789 | 3.458447 |
6308ad3d-2603-4b99-8fed-db4d507cfcbe | crystax/android-vendor-boost-1-62-0 | libs/spirit/example/x3/num_list/num_list3.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// This sample demontrates a parser for a comma separated list of numbers.
//
// [ JDG May 10, 2002 ] spirit1
// [ JDG March 24, 2007 ] spirit2
// [ JDG May 12, 2015 ] spirit X3
//
/////////////////////////////////////////////... | TOOL | 0.958218 | 6.811265 |
cc32a3b6-857b-46be-8927-7e12bbe152cd | Soroar-Mia/xpsc-code | week 12/day 2/C. Flower City Fence.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
vector < ll > v(n+1), rotated(n+1);
for(ll i = 1 ; i <= n ; i++)
{
cin>>v[i];
}
if(v[1] != n)
{
... | ALGO | 0.999962 | 3.744871 |
30e14009-f8af-4e0f-9750-f98290ae168a | rbacon4/coh-original-server-vs2010 | 3rdparty/Qt/4.7.1/src/gui/painting/qpolygon.cpp | #include "qpolygon.h"
#include "qrect.h"
#include "qdatastream.h"
#include "qmatrix.h"
#include "qdebug.h"
#include "qpainterpath.h"
#include "qvariant.h"
#include "qpainterpath_p.h"
#include "qbezier_p.h"
#include <stdarg.h>
QT_BEGIN_NAMESPACE
//same as qt_painterpath_isect_line in qpainterpath.cpp
static void qt_p... | TOOL | 0.984641 | 6.35375 |
f3ab013c-f60f-4fc4-bb72-ecd33c316715 | mdbergmann/ObjCSword | dependencies/icu/source/i18n/collationcompare.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "unicode/ucol.h"
#include "cmemory.h"
#include "collation.h"
#include "collationcompare.h"
#include "collationiterator.h"
#include "collationsettings.h"
#include "uassert.h"
U_NAMESPACE_BEGIN
UCollationResult
CollationCompare::compareUpToQuaternary(Coll... | ALGO | 0.997037 | 7.349652 |
ff74bc27-470c-4d63-840e-4350b29ae1e3 | ASHISH-GITHUB2495/Algos-coded-by-me | RecursionPractice/2.print n to 1 by recursion.cpp | #include<bits/stdc++.h>
using namespace std;
/* We have to print n to 1 with recursion ... */
void print(int n){
if(n==1)
{
cout<<"1";
return;
}
cout<<n<<" ";
print(n-1);
}
int main()
{
#ifndef ONLINE_JUDGE
clock_t tStart = clock();
freopen("input.txt", "r", stdin);
freopen("output... | ALGO | 0.999859 | 3.660572 |
1d24102e-f504-4501-ade0-3105810f05ff | vgteam/vg | src/zip_code.cpp | #include "zip_code.hpp"
//#define DEBUG_ZIPCODE
namespace vg{
using namespace std;
void ZipCode::fill_in_zipcode (const SnarlDistanceIndex& distance_index, const pos_t& pos, bool fill_in_decoder) {
std::vector<net_handle_t> ancestors;
net_handle_t current_handle = distance_index.get_node_net_handle(id(pos))... | ALGO | 0.960511 | 4.773127 |
d932cb92-d869-4422-b6cd-c8538ab8512d | Lima001/BCC-Estrutura-Dados-I | Algoritmos de Ordenação/C++/ExternalMergeSort/teste_external.cpp | #include "definicao_memoria.h"
#include "pagina.h"
#include "quick_sort.h"
#include "insertion_sort.h"
#include "funcoes_extras.h"
#include "external_merge_sort.h"
int main(){
// Variável para armazenar o tempo de execução de um procedimento
clock_t tempo;
// Quantidade de elementos na pagina
int tam... | ALGO | 0.999056 | 4.17821 |
25c5d99a-20fd-4598-bc7e-7295f3938fa7 | acashgirii/codeManifest | archive1/switchcase/p1.cpp | #include<iostream>
using namespace std;
int update(int a)
{
a=a*a;
cout<<a<<endl;
return a;
}
int main()
{
int a=14;
update(a);
cout<<a<<endl;
} | TOOL | 0.998779 | 3.228585 |
28b94e93-02ab-4b6f-a849-ed1f2cf4e0ec | xanhduongbavuong/itptit-club | 18_Prime11.cpp | #include <sstream>
#include <iomanip>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <deque>
#include <complex>
#define FOR(i,a,b) for(int i=(a... | ALGO | 0.999848 | 4.059087 |
dd2a524e-f14e-41ae-9f87-db9cc3f3b802 | CESARO23/Programacion_Competitiva | UVAJudge/Geometry/Trigonometry/p11854.cpp | #include<bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
long long a, b, c, sum, mayor;
while(cin>>a >>b >> c){
if(a+b+c == 0) break;
a*=a, b*=b, c*=c;
mayor = max(a, max(b, c));
sum = a+b+c;
if(sum-mayor == mayor)
cout<<"right\n";
else
cout<<"wrong\n";
}
return 0;
} | ALGO | 0.999852 | 3.508173 |
b095d501-c0e1-4e91-9b07-81ae927aec00 | sangwookShin/AlgorithmStudy | BOJ/practice1/BOJ 10819.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int result = 0;
int arr[8];
bool visit[8] = { false, };
int N;
vector<int> v;
void c() {
int sum = 0;
for (int i = 0; i < v.size() - 1; i++) {
sum += abs(v[i] - v[i + 1]);
}
result = max(result, sum);
}
void DFS(... | ALGO | 0.999866 | 4.294649 |
34ede54c-8a3a-4e07-bf69-aaecb4767aef | orcun-gokbulut/ze-externals-sources | Source/libClang/Source/lib/Transforms/IPO/ConstantMerge.cpp | #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h... | TOOL | 0.968488 | 7.801316 |
e20fc22a-de9d-44f3-bbca-1bf9f7d77ee4 | me-oniichan/AKUMA | K21MR Sem 3/CSE205 DATA_STRUCTURES_AND_ALGORITHMS/CSE205_26699_Day41/Binarytraversal1_26699.cpp | #include <iostream>
using namespace std;
template <class T>
class Node
{
public:
Node *left = NULL;
Node *right = NULL;
Node *parent = NULL;
T val;
Node(T val)
{
this->val = val;
}
};
template <class T>
class BST
{
public:
Node<T> *root = NULL;
BST(Node<T> *root = NULL)
... | ALGO | 0.999809 | 4.945414 |
603f7db8-792f-4e05-b7f8-20c3a18babf8 | vladmaryna/laborat | lab_10_6.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
int A[n];
int B[n];
srand(time(NULL));
for(int i=0;i<n;i++) {
A[i]=rand()%20-10;
cout<<A[i]<<" ";
}
cout<<endl;
int k=0;
for(int i=0;i<n;i++) {
if(A[i]>0) {
B[k]=A[i];
... | ALGO | 0.999941 | 3.544153 |
48ca4ded-23c0-4e01-8daf-33876f2620b6 | prathamverma42/Daily-Coding | 110-balanced-binary-tree/110-balanced-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999964 | 6.532754 |
1f078b8e-773f-4441-bf50-7df74e3d0dd9 | mfkiwl/Real-XTDrone | sensing/VINS-Fusion-gpu/global_fusion/ThirdParty/GeographicLib/src/Geocentric.cpp | #include "Geocentric.hpp"
namespace GeographicLib {
using namespace std;
Geocentric::Geocentric(real a, real f)
: _a(a)
, _f(f)
, _e2(_f * (2 - _f))
, _e2m(Math::sq(1 - _f)) // 1 - _e2
, _e2a(abs(_e2))
, _e4a(Math::sq(_e2))
, _maxrad(2 * _a / numeric_limits<real>::epsilon())
{
... | ALGO | 0.991411 | 6.041432 |
6b5e33d7-2ca1-4ad1-8c1f-65d9795d40b1 | sdj3701/BaekJoon | CodingTest/CodingTestExample/9461.cpp | #include <iostream>
using namespace std;
// int longlong
// : Ǻġ ϱ ũⰡ ʹ Ŀ ݺ
long long arr[101] = { 0,1,1 };
long long func(int n)
{
if (n < 3)
return arr[n];
else if (arr[n] == 0)
arr[n] = func(n - 2) + func(n - 3);
return arr[n];
}
int main()
{
int T;
cin >> T;
for (int i = 0; i < T; i++)
{
... | ALGO | 0.999903 | 4.121593 |
9bb85e9e-e7e9-468a-911e-0e11e849d7a8 | ganghe74/algo | atcoder/ABC159/d.cpp | #include <bits/stdc++.h>
using namespace std;
int N, x, a[200001], cnt[200001];
long long ways;
int main() {
scanf("%d", &N);
for (int i=0;i<N;++i) {
scanf("%d", &a[i]);
ways += cnt[a[i]];
cnt[a[i]]++;
}
for (int i=0;i<N;++i) {
ways -= cnt[a[i]] - 1;
printf("%l... | ALGO | 0.999953 | 3.633797 |
f09501cc-a9aa-49a9-9c66-d99d530ae93d | DenMur725/MyCryptoDefense | BigInt.cpp | #include "BigInt.h"
BigInt::BigInt(int _sizeMem) {
size = 1;
sizeMem = _sizeMem;
sign = 1;
mem = new int[sizeMem];
for (int i = 0; i < sizeMem; i++)
mem[i] = 0;
}
BigInt::BigInt(const BigInt & b) {
size = b.size;
sizeMem = b.sizeMem;
sign = b.sign;
mem = new int[sizeMem];
for (int i = 0; i < sizeMem; i++)
... | ALGO | 0.996303 | 3.693899 |
b1657374-641d-46fe-af81-63a21809b8c4 | morrischen890717/Leetcode | C++/1636.cpp | class Solution {
public:
vector<int> frequencySort(vector<int>& nums) {
vector<int> cnt(201, 0);
for(int num: nums){
cnt[num + 100]++;
}
sort(nums.begin(), nums.end(), [&](int a, int b){
return cnt[a + 100] == cnt[b + 100] ? a > b : cnt[a + 100] < cnt[b + 100]... | ALGO | 0.999982 | 5.956468 |
a426e464-0f5a-407d-b64e-663897d71c57 | billycheung/HackerRank | competition/week-of-code-32/deplication.cpp | #include <iostream>
using namespace std;
int x[1001];
/* https://www.hackerrank.com/contests/w32/challenges/duplication */
bool IsPowerOfTwo(int x)
{
return (x & (x - 1)) == 0;
}
int main() {
x[0] = 0;
x[1] = 1;
int powerTotal = 1;
for (int i=2;i<1001;i++){
if (IsPowerOfTwo(i)){
... | ALGO | 0.999966 | 4.121185 |
8927d295-c949-403a-8c31-0430111d20b5 | PoisWu/coding | lc/0062. Unique Paths/solution.cpp | #include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using lli = long long int;
template... | ALGO | 0.999978 | 5.728101 |
9fdc7a87-da37-4138-bd83-b5c9a690955c | civinx/ACM_Code | Summber Camp/ZUCC Summer Camp 2017/Contest5/Rikka with Subset.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
typedef long long LL;
const int maxm = 20000 + 100;
LL sum[maxm];
LL b[maxm];
int main() {
int T; scanf("%d",&T);
while (T--) {
memset... | ALGO | 0.999944 | 3.092308 |
76fd9447-c594-46a9-94ca-fac9e5e4f51b | morris821028/UVa | volume104/10407 - Simple division.cpp | #include <stdio.h>
#include <stdlib.h>
int gcd(int x, int y) {
if(!x) return y;
if(!y) return x;
int t;
while(x%y) {
t = x, x = y, y = t%y;
}
return y;
}
int main() {
int a[1000];
while(scanf("%d", a) == 1) {
if(a[0] == 0)
break;
int n = 1, i;
... | ALGO | 0.999851 | 3.066514 |
49a3522c-aa91-4d15-8e68-352d4395b00f | pramodryo/CPP | template/template_class.cpp | /*WAP to take array of differant data type and reverse it and sort it using class tamplate.
syntax:
template<class type>
class class_name
{
type x;
type x,y;
}
*/
#include<iostream>
using namespace std;
template<class type>
#define SIZE 5
class ARRAY
{
type a[SIZE];
public:
void set_data() // function defina... | ALGO | 0.995003 | 4.344654 |
e2b7965a-234b-4a16-89e2-9b5648b7ac57 | sabiramhaida/Competitive_programming | Google Code Jam/2012/Qualification Round/B - Dancing With the Googlers/dancing.cpp | // Andrés Mejía
using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
... | ALGO | 0.999924 | 3.434777 |
3b8bfa64-6610-42ec-b4aa-953f8be0b02f | jsrv07/Applied-problem-solving-in-CP | Sanskar_24B0642/Week 7/Climbing_Stairs.cpp | #include <iostream>
using namespace std;
int climbStairs(int n) {
if (n == 0 || n == 1) return 1;
int a = 1, b = 1;
for (int i = 2; i <= n; ++i) {
int temp = a + b;
a = b;
b = temp;
}
return b;
}
int main() {
int n;
cin >> n;
cout << climbStairs(n) << endl;
... | ALGO | 0.999963 | 5.30013 |
24f0dd7a-1e1b-4a0d-b068-18a7bb03f2c7 | brunoNevess/LeetCode | Algorithms/92.ReverseLinkedListII.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* reverseBetween(ListNode* head, int m, int n) {
ListNode* p = head;
ListNode* q ;
for(int i=0;i<m-1... | ALGO | 0.999997 | 5.782131 |
c3cd0033-572e-43e5-91cd-5dfbc6a5fc03 | wavelet-and-multiscale-library/Marburg_Software_Library | WaveletTL/general_domain/domain_frame_support.cpp |
#include "domain_frame.h"
// implementation for domain_frame_support.h
namespace WaveletTL
{
template <class IFRAME, int NPATCHES>
inline
void support(const DomainFrame<IFRAME, NPATCHES>& frame,
const typename DomainFrame<IFRAME, NPATCHES>::Index& lambda,
typename DomainFrame<IFRAME, NPATCHES>:... | ALGO | 0.98243 | 5.958164 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.