uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0c4aa233-b6bd-4f37-8706-a729cc0ae62b | askarthik325/DSA | SEARCHING/search_in_rotated_array.cpp | #include<iostream>
using namespace std;
int search(int arr[],int n,int x){
int low=0,high=n-1;
while(low<=high){
int mid=(low+high)/2;
if(arr[mid]==x){
return mid;
}
else if (arr[low]<=arr[mid]){
if(x>=arr[low]&&x<arr[mid]){
high=mid-1;
... | ALGO | 0.999894 | 5.602265 |
c4b6e89c-efca-4e2e-9c21-d6bf165c97ea | tangxiangru/NOIP | 3.2/约瑟夫问题.cpp | #include <iostream>
using namespace std;
struct node
{
int data;
node* next;
};
node *link_create(int n)
{
// 创建第一个节点
node *head;
node *p = new node();
p->data = 1;
head = p;
for(int i=2;i<=n;i++)
{
node *q = new node();
q->data = i;
p->next = q;
p ... | ALGO | 0.999908 | 3.462841 |
69f9ef87-005c-47a5-a032-c0910def1561 | KuvarzinMA/lab1 | Project1/Project1/lab1.cpp | #include <iostream>
#include <cmath> // Для использования std::floor
#include <string>
#include <limits> // Для проверки ввода
// Функция для получения дробной части числа
double fraction(double x) {
return x - std::floor(x); // Вычитаем целую часть из числа
}
// Функция для преобразования символа цифры в число
i... | ALGO | 0.996926 | 4.21825 |
0124f388-63fe-462f-8f97-069ce5ce8c04 | sajjadul404/Problem_solving | 800/A_Soft_Drinking.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, l, c, d, p, nl, np;
cin >> n >> k >> l >> c >> d >> p >> nl >> np;
int total_drink = k * l;
int total_lime = c * d;
int drink_toast = total_drink / nl;
int lime_toast = total_lime;
int salt_toast = p / np;
... | ALGO | 0.999436 | 4.131201 |
620e49f3-92a9-4a8d-8cb9-5bdb2ba69328 | achrxme-1838/BOJ | basicProblems/Factors_Multiples_Decimals/5086_factor_and_multiple.cpp | #include <iostream>
#include <vector>
using namespace std;
class FactorAndMultiple
{
public:
void test(const int input_1, const int input_2)
{
if(input_1 % input_2 == 0) cout << "multiple" << endl;
else if(input_2 % input_1 == 0) cout << "factor" << endl;
else cout << "neither" << endl... | ALGO | 0.999637 | 4.720698 |
13d36fca-e896-4936-8fef-0e435800a84f | LoadGhost810/cpp | CPP_testings/struct.cpp | #include <iostream>
using namespace std;
class square{
public:
int width;
int height;
square(int width,int height){
this->width = width;
this->height = height;
}
void display(){
int prod= width * height;
cout<<"Answear: "<<prod;
}
};
int main(){
... | TOOL | 0.856775 | 3.961155 |
6e37292f-f10e-4c96-9769-aa10a4b29cef | CompuCell3D/CompuCell3D | CompuCell3D/core/CompuCell3D/steppables/PDESolvers/OpenCL/NonlinearSolver.cpp | #include "NonlinearSolver.h"
#include "ImplicitMatrix.h"
#include <sstream>
#include <CompuCell3D/CC3DExceptions.h>
#include "OpenCLKernel.h"
#include <cassert>
#include <numeric>
#include <limits>
#include "../GPUSolverParams.h"
#include <viennacl/linalg/norm_2.hpp>
#include <Logger/CC3DLogger.h>
//Theoretically, we... | ALGO | 0.999897 | 5.111386 |
29641adc-d1a5-4d50-bf06-dae0537345a8 | elenaluzzara/LSN_exercises | 10eserc/1es.cpp | #include <iostream>
#include <fstream>
#include <cmath>
#include <cstdlib>
#include <vector>
#include "lib.h"
#include "random.h"
using namespace std;
int main(int argc, char *argv[]){
int which = 0;
int nstep = 100;
int nblk = 60;
int nstep_blk = 1000; //per blk
int indice = 0;
Random *rnd = new Rand... | ALGO | 0.999882 | 3.199217 |
f7513ae1-b4d2-481f-b712-54cf92ba8311 | Renumber/algorithm | ch15.number theory and combinatorics/1010/1010.cpp | /*
재원이는 한 도시의 시장이 되었다. 이 도시에는 도시를 동쪽과 서쪽으로 나누는 큰 일직선 모양의 강이 흐르고 있다. 하지만 재원이는 다리가 없어서 시민들이 강을 건너는데 큰 불편을 겪고 있음을 알고 다리를 짓기로 결심하였다. 강 주변에서 다리를 짓기에 적합한 곳을 사이트라고 한다. 재원이는 강 주변을 면밀히 조사해 본 결과 강의 서쪽에는 N개의 사이트가 있고 동쪽에는 M개의 사이트가 있다는 것을 알았다. (N ≤ M)
재원이는 서쪽의 사이트와 동쪽의 사이트를 다리로 연결하려고 한다. (이때 한 사이트에는 최대 한 개의 다리만 연결될 수 있다.) 재원이는 다리를... | ALGO | 0.999974 | 5.211727 |
925db44f-a223-4943-b762-7a91d8a7e71e | langningchen/Etiger | 2562.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct
{
int to, nxt;
} e[N * 2];
int n, timer, sz[N], son[N], top[N], hd[N], dfn[N], id[N];
void dfs_son(int u, int fa)
{
sz[u] = 1;
son[u] = 0;
for (int i = hd[u]; i; i = e[i].nxt)
{
int v = e[i].to;
if (v == fa)
... | ALGO | 0.999993 | 4.187783 |
93f55063-d152-475c-a363-ec0ea87d38c3 | agkountis/helios | source/geometry/sphere.cpp | #include "sphere.h"
#include <math.h>
bool Sphere::intersect(const Ray &ray, HitPoint *hit_point)
{
/**
* sphere vector equation is |x - position| = radius
* can also be written as (x - position) * (x - position) = radius^2
* the ray equation is x = origin - direction * t;
* replacing x into th... | ALGO | 0.942287 | 5.403838 |
c8be9c44-532d-4ded-85fc-35769754007c | fmoeran/CP | problemsets/xour.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mn(x) const ll N = x
#define ito(n) for(int i=0; i<n; i++)
#define jto(n) for(int j=0; j<n; j++)
#define loop(n)
#define all(v) v.begin(), v.end()
#define YES cout << "YES\n"
#define NO cout << "NO\n"
mn(2e5+1);
uint32_t n, a[N], xa[N];
map<u... | ALGO | 0.999264 | 4.094092 |
01c572e9-f030-4b82-97ca-3375185fbcb4 | ljw-LAB/Algorithm | Ch10/ex10_5/MergeSort.cpp | #include <stdio.h>
#include <stdlib.h>
void MergeTwoArea(int arr[], int left, int mid, int right)
{
int fIdx = left;
int rIdx = mid+1;
int i;
int *sortArr = (int*)malloc(sizeof(int)*(right+1));
int sIdx = left;
while(fIdx <= mid && rIdx <= right)
{
if(arr[fIdx] <= arr[rIdx])
... | ALGO | 0.999987 | 4.469979 |
3fa1dbfc-c2d1-461c-9cce-7aa8f3f4dd65 | imjhaji03/LeetCode-Solutions | 3617-find-the-original-typed-string-i/3617-find-the-original-typed-string-i.cpp | class Solution {
public:
int possibleStringCount(string word) {
int count = 0;
for(int i = 0; i < word.length(); i++){
if(word[i+1] == word[i]){
count++;
}
}
return count+1;
}
}; | ALGO | 0.999738 | 5.838163 |
bbedb63b-f919-4b2f-9826-0cd88adffa86 | ZoruaSama/Solutions-4-Luogu-Problems | P1649/main.cpp | #include <iostream>
#include <queue>
using namespace std;
char mp[101][101];
bool vis[101][101];
queue<int> x;
queue<int> y;
queue<int> t;
queue<int> last;
int main() {
int n;
cin>>n;
int ox,oy;
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
cin>>mp[i][j];
if(mp[i][j]=='A'... | ALGO | 0.999243 | 3.827579 |
615e22a6-5eb7-4bda-b41a-32bdc992f6f4 | alderwhiteford/Voxeti-Slicer | CuraEngine/src/pathPlanning/SpeedDerivatives.cpp | #include "pathPlanning/SpeedDerivatives.h"
namespace cura
{
void SpeedDerivatives::smoothSpeed(const SpeedDerivatives& first_layer_config, const LayerIndex layer_nr, const LayerIndex max_speed_layer_nr)
{
const auto max_speed_layer = static_cast<double>(max_speed_layer_nr);
const auto first_layer_speed = std:... | ALGO | 0.988421 | 5.405214 |
4569d6d1-2f20-4f82-9b0f-82f928eb5265 | aryandkulkarni/CS4300-ComputerGraphics | common/thirdparty/glm/test/core/core_func_integer_find_msb.cpp | #include <glm/glm.hpp>
#include <cstdio>
#include <cstdlib> // To define "exit", req'd by XLC.
#include <ctime>
#define LE 1 // 1 for little-endian, 0 for big-endian.
int pop(unsigned x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0... | ALGO | 0.998527 | 3.60046 |
037dced3-d3af-47ca-b4ce-9c17e389a491 | perrijuan/Projetos-em-c-plusplus-ufrj | minimum-array.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int array[] = {4, -5434, 6, 7, 8, 7, 4, 2};
int min;
//pega o tamanho do array de forma manual
int tamanho = sizeof(array) / sizeof(array[0]);
// pegando o menor valor comparando de forma linear
for (int a = 0;... | ALGO | 0.999468 | 4.433239 |
3f5cd06a-68e7-40f8-9283-3aef9518dc64 | feiwofeifeixiaowo/CppPrimer5thAnswer | Cpp_Primer_5E_Learning/Chapter10/E10.13.cpp | //
// Created by Xiyun on 2016/10/18.
//
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool predict(const string &s1)
{
return s1.size() >= 5;
}
int main()
{
string s("abcdefg");
vector<string> svec{"abcd","asdad","hello","world","whate"};
auto p_r... | ALGO | 0.98767 | 3.349544 |
d81af636-060c-40cf-837a-20dd19f1e589 | Wild-Donkey/Code | Luogu/P3350-P3399/P3386 BiGrp.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
int m, n, k, ans(0), A, B, e;
bool flg(0);
inline int RD() {
char ich = getchar();
int intmp = 0, insign = 1;
while (((ich < '0') ... | ALGO | 0.999894 | 3.286898 |
58330810-196b-4312-9840-ddd089687f9a | gaganjha1608/coding_ques | HB/Strings/string_frequent_character.cpp | #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
string str;
getline(cin , str);
int f1[26] = {};
char result;
int max = 0;
int n = str.size();
for (int i = 0; i < n; i++) {
f1[str[i] - 'a']++;
}
for (int i = 0; i < 26; i++)... | ALGO | 0.99981 | 3.984706 |
e4bf724d-4a5c-41a1-a28e-ef7a14e506a2 | WAmp-Community/WAmp-CE | src/external_dependencies/openmpt-trunk/include/ancient/src/BZIP2Decompressor.cpp | #include <cstdint>
#include <cstring>
#include "BZIP2Decompressor.hpp"
#include "HuffmanDecoder.hpp"
#include "InputStream.hpp"
#include "OutputStream.hpp"
#include "common/MemoryBuffer.hpp"
#include "common/CRC32.hpp"
#include "common/Common.hpp"
namespace ancient::internal
{
bool BZIP2Decompressor::detectHeader(ui... | TOOL | 0.863782 | 4.398096 |
97bae43f-10c7-46fa-810a-74f34ada4fc7 | openucx/ODOS | mlir/lib/Interfaces/ValueBoundsOpInterface.cpp | #include "mlir/Interfaces/ValueBoundsOpInterface.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Matchers.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE "value-bounds-op-interface"
using namespace mlir;
using presburger::BoundType;
using presburger::VarKind;
namespace mlir... | ALGO | 0.91912 | 7.883183 |
24ecb548-cdb2-4cd9-a72d-c86999beebff | prakharsinghch/dsa-practice | 3788-maximum-unique-subarray-sum-after-deletion/3788-maximum-unique-subarray-sum-after-deletion.cpp | class Solution {
public:
int maxSum(vector<int>& nums) {
set<int> x;
int mx = INT_MIN;
for(auto y: nums){
if(y>=0) x.insert(y);
mx = max(mx,y);
}
int ans=0;
for(auto s: x) ans+=s;
if(ans == 0) ans = mx;
return ans;
}
}; | ALGO | 0.999968 | 5.788706 |
03d367e0-9fd6-4bff-a26c-7fdd982f915e | ibrahimhabibeg/codeforces | problems/1734/D/sol.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int TC, n, k;
cin >> TC;
while (TC--){
scanf("%d%d", &n, &k);
ll a[n+1], b[n+1], c[n+1], v[n+1];
for (int i = 1; i <= n; i++) scanf("%lld", &v[i]);
a[k] = b[k] = c[k] = 0;
for (int i = k+1; i <= n; i++){
if(... | ALGO | 0.999665 | 3.626088 |
e17936c3-51e8-4bb4-b24b-ad7de809204a | Diaias/Atividades | c++/AtvEAD7/EAD6.cpp | #include <iostream>
using namespace std;
int main()
{
int altura;
int i;
int x;
int y;
x = 0;
y = 0;
cout << "Digite a altura:";
cin >> altura;
while(i < altura){
i++;
while(x < i){
cout<<"*";
x++;
}
x = 0;
cout<<"\n";
... | ALGO | 0.999628 | 3.452111 |
d6d99cb1-1639-4092-92aa-05ad51cf9e39 | darrylys/spoj | AMR10I.cpp | #include<stdio.h>
#include<set>
#define ull unsigned long long
using namespace std;
set<int> dset;
char pn[21] = {1,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71};
void getRemain(int N, int P, int currMidVal, int startFrom) {
if (N < 0) {
return;
}
if (N == 0) {
dset.inser... | ALGO | 0.998911 | 4.118618 |
a0081af3-0bb4-470f-918e-ed6f7e082aad | JDevAman/Practice | Sheets/A2Z DSA/Pattern4.Cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i=1;
int count=1;
while(i<=n){
int j=1;
while(j<=n){
//cout<<(i-1)*n+j<<" ";
cout<<count<<" ";
count++;
j++;
}
cout<<endl;
i++;
}
return 1;
}
| ALGO | 0.999916 | 3.524906 |
859c4791-3655-4914-a77b-fa0f190bfb98 | svak/huffman | BitsAdapter.cpp | #include <algorithm>
#include <cassert>
#include <stdexcept>
#include "BitsAdapter.hpp"
namespace Helpers
{
namespace Utils
{
template <typename T>
auto RotateLeft(const T x, const unsigned int n)
{
static_assert(std::is_unsigned<T>::value, "Type must be unsigned");
... | TOOL | 0.950373 | 7.502503 |
f07ea302-43cc-46d6-a211-5dd004f3f6a7 | suzyz/LintCode | ImplementStack/implement_stack.cpp | class Stack {
public:
vector<int> st;
/*
* @param x: An integer
* @return: nothing
*/
void push(int x) {
st.push_back(x);
}
/*
* @return: nothing
*/
void pop() {
st.erase(st.end()-1);
}
/*
* @return: An integer
*/
int top() {
... | ALGO | 0.999337 | 5.653953 |
49ba65e0-b5c5-4055-b617-493956db394c | logarathansv/LeetCodez | 3657-check-if-grid-can-be-cut-into-sections/3657-check-if-grid-can-be-cut-into-sections.cpp | class Solution {
public:
bool checkValidCuts(int n, vector<vector<int>>& rectangles) {
vector<vector<int>> x;
vector<vector<int>> y;
for(auto rect : rectangles){
x.push_back({rect[0], rect[2]});
y.push_back({rect[1], rect[3]});
}
sort(x.begin(), x.en... | ALGO | 0.999843 | 5.45513 |
b4839206-6162-48e0-bbcc-ea4b66bfe365 | catarinab/KrylovMittagLeffler | utils/mtx_ops_mkl.cpp | #include <iostream>
#include <vector>
#include <mkl.h>
#include <fstream>
#include "headers/dense_vector.hpp"
#include "headers/dense_matrix.hpp"
#include "headers/io_ops.hpp"
#include "headers/csr_matrix.hpp"
#include "headers/mtx_ops_mkl.hpp"
#include "headers/utils.hpp"
using namespace std;
csr_matrix buildFullMa... | ALGO | 0.995893 | 4.277507 |
d6a19b1c-d900-4350-82ad-b2e1f6d02302 | anvigo12/msvanet | sumo/src/netbuild/NBPTLineCont.cpp | /****************************************************************************/
/****************************************************************************/
/// @file NBPTLineCont.cpp
/// @author Gregor Laemmel
/// @author Nikita Cherednychek
/// @date Tue, 20 Mar 2017
///
// Container for NBPTLine during netb... | TOOL | 0.981782 | 5.704337 |
f29fc6d1-d467-47ba-b07e-412fd384aa8b | wj0017/TIL | Baekjoon/1463.cpp | #include<iostream>
using namespace std;
int main(){
int num;
int cnt = 0;
cin >> num;
while(!(num == 1)){
if(num % 3 == 0){
num /= 3;
cnt++;
}
else if(num % 2 == 0){
num /= 2;
cnt++;
}
else{
num -= 1... | ALGO | 0.999975 | 4.245195 |
7df9a7b8-d366-48bf-b042-bbfc54ebe794 | Karmiska/Darkness | darkness-engine/src/tools/Octree.cpp | #include "tools/Octree.h"
using namespace engine;
namespace engine
{
#ifdef DEBUG_OCTREE
engine::vector<engine::BoundingBox> usedBoundingBoxes;
engine::vector<engine::BoundingBox> searchBoundingBoxes;
engine::vector<engine::BoundingBox> initialSearchBoundingBoxes;
#endif
}
| ALGO | 0.953729 | 3.457445 |
6c5bb555-1390-49d9-ad5a-93ca22568df6 | vanbeonhv/ptit-source | 28tech - DSA/gready/greedy04_sort.cpp | // gready04 but using sort.
// time complexity: O(nlog(n))
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
#ifndef ONLINE_JUDGE
freopen("../input.txt", "r", stdin);
freopen("../output.txt", "w", stdout);
#endif
int n, k;
cin >> n >> k;
ll a[n];
for (int i = 0; i < n; i++)... | ALGO | 0.999989 | 3.992479 |
67b6cc7d-ed13-4e5b-b48a-94f4bcd0172e | WOONBE/C__Algorithm | Binary Search/1780.cpp | #include <iostream>
using namespace std;
int n;
int arr[2200][2200];
int num[3];
bool check(int x, int y, int n){
for(int i=x; i<x+n; i++){
for(int j=y; j<y+n; j++){
if(arr[x][y] != arr[i][j]){
return false;
}
}
}
return true;
}
void solve(int x, in... | ALGO | 0.999836 | 3.754534 |
d375972c-6ae2-4faf-96a2-208ffcde3891 | Priyanshukeshri/leetcode-solution-cpp | 413. Arithmetic Slices.cpp | //DP
//Runtime: 212 ms, faster than 5.27% of C++ online submissions for Arithmetic Slices.
//Memory Usage: 149.1 MB, less than 6.25% of C++ online submissions for Arithmetic Slices.
class Solution {
public:
int numberOfArithmeticSlices(vector<int>& A) {
int n = A.size();
vector<vector<int>> dp(n, ve... | ALGO | 0.999561 | 5.462304 |
7d43c35f-5fc6-4eb5-90c4-d0ff4b2e3af2 | grenaud/SAFARI | src/algorithms/find_gbwtgraph.cpp | /**
* \file find_gbwtgraph.cpp
*/
#include "find_gbwtgraph.hpp"
#include "../gbzgraph.hpp"
namespace vg {
namespace algorithms {
const gbwtgraph::GBWTGraph* find_gbwtgraph(const HandleGraph* graph) {
if (!graph) {
// No graph means no translation.
return nullptr;
}
if (dynamic_cast<con... | TOOL | 0.912937 | 7.422925 |
268216d0-206c-4261-8bc6-f160441d21d0 | iamrahul25/LeetCode | 2D Array/pascals-triangle.cpp | class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> ans;
ans.push_back({{1}});
if(numRows==1){
return ans;
}
for(int n=2; n<=numRows; n++){
vector <int> vec(n,0);
vec[0] = 1;
vec[n-1] = 1;... | ALGO | 0.999985 | 5.720162 |
1321c649-f14d-479f-9179-e14ec8fa908c | srikanthnagarapu/Data-Structure-Algorithm-QAs | Strings/leetcode242.cpp | /**
You are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most k times.
Return the length of the longest substring containing the same letter you can get after performing the above operations.
Ex... | ALGO | 0.999966 | 6.495741 |
19a1349e-136e-4852-8e2d-286a94b7460a | Bidhit74/DSA-With-C- | Day 19 - Strings - 3/StringstreamClass.cpp | #include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
string str = "Bidhit is a math teacher";
stringstream ss(str);
string temp;
cout << str << endl;
while(ss>>temp){
cout << temp << endl;
}
return 0;
} | TOOL | 0.948254 | 3.614456 |
bd43f705-6f71-48bc-8300-66932a5106d1 | dafiiit/Arduino | libraries/MD_MAX72XX/examples/MD_MAX72xx_Eyes/MD_EyePair.cpp | #include "MD_EyePair.h"
// Packing and unpacking nybbles into a byte
#define PACK_RC(r, c) ((r<<4)|(c&0xf))
#define UNPACK_R(rc) (rc>>4)
#define UNPACK_C(rc) (rc&0xf)
#define SMALL_EYEBALL 0
// Class static variables
#if SMALL_EYEBALL
uint8_t MD_EyePair::_pupilData[] =
{
/* P_TL */ PACK_RC(2,5), /* P_TC */ PACK... | TOOL | 0.898622 | 5.603714 |
e5c795ff-ce78-4ae8-a981-4c44696bc9b4 | hiyouga/CPP-Learning | buaaoj/2.cpp | #include<iostream>
int main(){
int a,b;
std::cin>>a>>b;
std::cout<<a%b;
}
| ALGO | 0.999803 | 3.039157 |
fb3aaba0-7bdb-4f07-b6e0-837e4da39d67 | mitesh-200228/DS-Algo-Whole-Chapter | Binary Trees/mirror.cpp | #include<unordered_set>
#include<stack>
#include<iostream>
#include<vector>
#include<string>
#include<numeric>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<climits>
#include<cmath>
#include<math.h>
#include<limits>
#define ll long long int
const ll N... | ALGO | 0.999996 | 5.074724 |
9fd913ae-3de6-43b8-9f96-54f825513576 | PlasmaControl/FreeMHD | OpenFOAM-v2206/ThirdParty/sources/cgal/CGAL-4.14.3/examples/Polytope_distance_d/polytope_distance_d.cpp | // computes the distance between two cubes in R^3 using double
// as input type and some internal EXACT floating point type
#include <CGAL/Polytope_distance_d.h>
#include <CGAL/Polytope_distance_d_traits_3.h>
#include <CGAL/Homogeneous.h>
#include <iostream>
#include <cassert>
#ifdef CGAL_USE_GMP
#include <CGAL/Gmpzf.... | ALGO | 0.99777 | 5.754796 |
5ca8a322-5f14-4127-bfd9-897cf6ea9a4e | Prathamesh532/DSA | 01_Array[Easy]/11_Find_No_Appres_1s_Other_Twice.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int findOnce(int arr[], int n)
{
int xorr = 0;
for (int i = 0; i < n; i++)
{
xorr ^= arr[i];
}
return xorr;
}
int findOnce(int arr[], int n)
{
unordered_map<int, int> hash;
for (int i = 0; i < n; i++) ... | ALGO | 0.99993 | 5.208471 |
db3099fa-ea97-44f0-8983-27fb297c7767 | tamirgrBGU/EngineForAnimationCourse | igl/bounding_box_diagonal.cpp | IGL_INLINE double igl::bounding_box_diagonal(
const Eigen::MatrixXd & V)
{
using namespace Eigen;
VectorXd maxV,minV;
VectorXi maxVI,minVI;
mat_max(V,1,maxV,maxVI);
mat_min(V,1,minV,minVI);
return sqrt((maxV-minV).array().square().sum());
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
#en... | ALGO | 0.997598 | 6.224428 |
8708d8be-57ad-4dda-af16-2cbf58209688 | Identi91/C-Plus-Plus | strings/knuth_morris_pratt.cpp | /**
* \file
* \brief The [Knuth-Morris-Pratt
* Algorithm](https://en.wikipedia.org/wiki/Knuth–Morris–Pratt_algorithm) for
* finding a pattern within a piece of text with complexity O(n + m)
*
* 1. Preprocess pattern to identify any suffixes that are identical to
* prefixes. This tells us where to continue from i... | ALGO | 0.999925 | 6.965949 |
09bba821-44b2-470f-941a-7b03bdb2848c | chiragmajithia/gameoflife | src/life_mpi_2d.cpp | #include <mpi.h>
#include "board.cpp"
#include "partition2D.cpp"
#include <string>
#include <cstdlib>
void confgMPI();
void initMPI(int argc, char *argv[]);
void seqDispPartitions(Partition2D &p);
void seqSavePartitions(Partition2D &p);
void seqOutPartitions(Partition2D &p);
void seqDispCols(Partition2D &p);
void tran... | ALGO | 0.997493 | 3.994654 |
dd1dd6b0-fb17-43dd-a23f-359b0cdc58c3 | Armaan-Dhaliwal/Array-Problems | Ranking_queries_in_already_ranked_database/Array_Ranking_Weights_As_Queries_come.cpp | #include<iostream>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
int main(){
stack<int> s;
cout<<"Enter ranked weights: "<<endl;
vector<int> ranked;
int rankele;
cin>>rankele;
while(rankele!=-1){
ranked.push_back(rankele);
cin>>rankele;
}
for(int... | ALGO | 0.999963 | 3.575017 |
22fed368-6a0b-4128-b0a8-2f144f5b8c58 | ishandutta2007/codeforces | zoli9/normal/629/B.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int hanylany[409];
int hanyfiu[409];
int main()
{
cin>>n;
for(int i=1; i<=n; i++)
{
char c;
int ke, ve;
cin>>c;
cin>>ke>>ve;
for(int j=ke; j<=ve; j++)
{
if(c=='M') hanyfiu[j]++;
else ... | ALGO | 0.999717 | 3.563084 |
1059f42a-9b85-4eb9-9e3b-00bb8601ceb6 | deepin-community/llvm-toolchain-15 | llvm/lib/Transforms/Scalar/Sink.cpp | #include "llvm/Transforms/Scalar/Sink.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.... | ALGO | 0.993776 | 7.882111 |
4df1459e-27cb-4a1f-adad-df6f6d19e309 | hhsdev/huffman-compression | huffman-compression/src/tree_reconstruction.cpp | #include "./tree_reconstruction.hpp"
namespace TreeReconstruction {
HuffmanTree reconstructFrom(const CodeLengths& codeLengths) {
auto charsAndLengths = pairCharsWithLengths(codeLengths);
std::sort(charsAndLengths.begin(), charsAndLengths.end());
auto codesAndChars = buildCodes(charsAndLengths);
return buil... | ALGO | 0.998 | 5.264953 |
3f23f69d-13de-4d90-88b8-52332527b804 | JaspreetSingh2110/DataStructures | Algorithms/String/ShortestCommonSuperSequence.cpp | /*
* Description:
*
* Created on: 18/11/24
* @author: Jaspreet Singh, <EMAIL>.
*/
#include <string>
#include <iostream>
//Approach #1: Recursion.
int SCSSHelper(const std::string& s1, const std::string& s2, int l1, int l2)
{
//If any of string completes, hte additional characters required to form
// super se... | ALGO | 0.999481 | 6.110645 |
1e9d359d-715b-4f2d-be55-33177f84cc9a | oceanbase/oceanbase | deps/oblib/src/lib/geo/ob_geo_func_union.cpp | #define USING_LOG_PREFIX LIB
#include "ob_geo_func_union.h"
#include "lib/geo/ob_geo_func_utils.h"
using namespace oceanbase::common;
namespace oceanbase
{
namespace common
{
template <typename GeometryType1, typename GeometryType2>
static void apply_bg_union_inner(const GeometryType1 *geo1, const GeometryType2 *geo... | DATA | 0.880516 | 7.27945 |
901451c6-0849-454d-97f8-14450a3a1829 | thinhemb/Olympic-K14 | C_Primes_on_Interval.cpp | #include <iostream>
#include <math.h>
using namespace std;
bool KTSNT(int n)
{
if(n<2) return 0;
for (int i = 2; i <=sqrt(n); i++)
{
if(n%i==0) return 0;
}
return 1;
}
int main()
{
int a,b,k,count=0,x=-1;
cin>>a>>b>>k;
int r=1,l=b-a+1;
while (r<l)
{
int mid=(r+l)... | ALGO | 0.99996 | 3.78934 |
e8898113-ed49-4f1f-8376-8b9403747801 | yongkangSun/Games101 | homework/1/code/eigen/eigen3/bench/sparse_cholesky.cpp | // #define EIGEN_TAUCS_SUPPORT
// #define EIGEN_CHOLMOD_SUPPORT
#include <iostream>
#include <Eigen/Sparse>
// g++ -DSIZE=10000 -DDENSITY=0.001 sparse_cholesky.cpp -I.. -DDENSEMATRI -O3 -g0 -DNDEBUG -DNBTRIES=1 -I /home/gael/Coding/LinearAlgebra/taucs_full/src/ -I/home/gael/Coding/LinearAlgebra/taucs_full/build/lin... | ALGO | 0.993475 | 4.147974 |
13d49359-512e-4430-ad4e-1fb6b5543018 | sysadat/Software-Development | Project 005/src/speedtest.cpp | #include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>
#include <chrono>
#include <exception>
#include <vector>
#include <cmath>
#include <iomanip>
#include "MapRouter.h"
#include "StringUtils.h"
#include "CSVWriter.h"
int main(int argc, char *argv[]){
int NumRoutes = 1000;
std::string Dat... | DATA | 0.868391 | 4.472827 |
431e9b81-8c84-468a-ba8c-0a3d386583de | RahulKumar-9389/Top-150-DSA-Problems | LinkedList/DetectCycle.cpp | #include <iostream>
using namespace std;
class ListNode
{
public:
int val;
ListNode *next;
// constructor
ListNode(int val)
{
this->val = val;
this->next = nullptr;
}
};
bool hasCycle(ListNode *head)
{
ListNode *slow = head;
ListNode *fast = head;
while (fast && ... | ALGO | 0.998868 | 5.793494 |
03e807aa-ad35-4d83-a137-b3f118d28e97 | raincross7/code-similarity | codes/train_code/problem154/problem154_393.cpp | #include <iostream>
int main() {
int a,b,c;
int num=0;
std::cin >> a >> b >> c;
while(a<=b){
if(c%a==0){
num=num+1;
}
a=a+1;
}
std::cout << num << std::endl;
return 0;
}
//if(c%a==0){ num++;} | ALGO | 0.999923 | 4.347258 |
17ea1125-9e35-4ee7-b079-37c38f46aef2 | ishandutta2007/codeforces | -skyline-/normal/868/B.cpp | //Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<c... | ALGO | 0.999791 | 3.353191 |
8c9ecf55-aa50-4309-a2f9-785a05367d1a | SreeVardhanTulluri/CPP | google_tech_dev_duide/Searching/smallestGreaterThanTarget.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
char nextGreatestLetter(vector<char>& letters, char target) {
if((target >= letters.back()) || (target< letters.front()))
return letters.front();
for(int i = 0; i < letters.size(); i++)
if(t... | ALGO | 0.999137 | 4.38515 |
826285f3-4475-470f-b187-0c1d326bb043 | sarvex/leetcode-go | solution/0900-0999/0917.Reverse Only Letters/Solution.cpp | class Solution {
public:
string reverseOnlyLetters(string s) {
int i = 0, j = s.size() - 1;
while (i < j) {
while (i < j && !isalpha(s[i])) ++i;
while (i < j && !isalpha(s[j])) --j;
if (i < j) {
swap(s[i], s[j]);
++i;
... | ALGO | 0.999619 | 6.634156 |
4bcba0c0-7503-4067-a8bc-9ba55a54af81 | codereyamin/github_with_api | 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.9988 | 6.76073 |
d5f06217-9e98-4e27-8da6-3f23afc1d1fb | DroidAITech/vslam-evaluation | ORB_SLAM2/opencv/samples/cpp/tutorial_code/features2D/feature_detection/SURF_detection_Demo.cpp | #include <iostream>
#include "opencv2/core.hpp"
#ifdef HAVE_OPENCV_XFEATURES2D
#include "opencv2/highgui.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/xfeatures2d.hpp"
using namespace cv;
using namespace cv::xfeatures2d;
using std::cout;
using std::endl;
int main( int argc, char* argv[] )
{
CommandLine... | TOOL | 0.860728 | 5.251925 |
13d42ed2-1e51-45df-aef2-26dbd2f495fd | matvchukk/knu-laboratory-ooop-2-2-course | lab 3/src/matrix_algorithms/LUInverse.cpp | #include "LUInverse.h"
/// @brief Performs LU decomposition of the input matrix.
/// @param a The input matrix to be decomposed.
/// @param l The lower triangular matrix resulting from the decomposition.
/// @param u The upper triangular matrix resulting from the decomposition.
/// @return True if the LU decomposition ... | ALGO | 0.99983 | 3.841599 |
3056849c-853b-4c77-8029-0334ab2ba035 | dpotop/mlir-lus-public | mlir-prime/PrimeLinalgToAffineLoops.cpp | #include "mlir/Analysis/Utils.h"
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Pass/Pass.h"
#include "Passes.h"
#include <list>
#include <utility>
#include <iostream>
#define PASS_NAME "prime-linalg-to-affine"
usi... | ALGO | 0.960844 | 4.387121 |
95e927a9-5ec7-4b66-9ed2-501feca1ef27 | Aadarshg087/competitive-programming | CodeChef/October 2022/Starter 62/CHEFSCORE.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int t;
cin >> t;
while (t-- > 0)
{
int totalProblems, marksPerProblem, possibleMarks;
cin >> totalProblems >> marksPerProblem >> possibleMarks;
int k = 0;
for (int i = 0; i <= totalProblems; i++)
... | ALGO | 0.999619 | 3.592639 |
2d4da966-51c4-4ff4-85d2-87c94ddf4128 | TimesysGit/android_frameworks_av | media/libstagefright/codecs/amrwb/src/preemph_amrwb_dec.cpp | /*
------------------------------------------------------------------------------
Filename: preemph_amrwb_dec.cpp
Date: 12/10/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-------------------------------------------------------------------... | ALGO | 0.999932 | 5.475962 |
87dece7d-a980-4340-97a6-5d1401b212b1 | cooleyecam/cooleye_d1_linux_sdk_ros | sdk/src/cetool_cali_stereo_cal.cpp | #include "opencv2/calib3d.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
using namespace cv;
using namespace s... | TOOL | 0.953298 | 6.201598 |
505f18ec-348f-4480-b8d9-17e7116b9a5c | manikanta2901/ubuntu | .history/practice/cpp/Codechef/InterestingXor_20210312181624.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long int
string getBinary(ll n){
ll a =0,b = 0;
string binary = "\0";
while(n > 0){
b = n % 2 ;
binary += to_string(b);
n = n/2 ;
}
reverse(binary.begin(),binary.end());
cout << binary << endl;
return binary;
}
ll G... | ALGO | 0.999768 | 4.848563 |
a01114d4-081d-4c61-8884-0317aaad7dda | absolutePi/Competitive_Programming | POSN/USACO/livestock_lineup.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
freopen("lineup.in","r",stdin);
freopen("lineup.out","w",stdout);
int n;
cin >> n;
vector<pair<string,string>> conditions;
for(int i=0;i<n;i++){
string str1,str2,t;
cin >> str1;
cin >> t >> t >> t >> t;
c... | ALGO | 0.999972 | 3.588502 |
25313b77-19b6-4422-8259-aa4845ea8861 | rupav/cp | competitive_coding/contests/Google Code Jam/Round1A/pascalT.cpp | // C++ code for Pascal's Triangle
#include<bits/stdc++.h>
using namespace std;
#define int long long
// See https://www.geeksforgeeks.org/space-and-time-efficient-binomial-coefficient/
// for details of this function
int binomialCoeff(int n, int k);
// Function to print first
// n lines of Pascal's
// Triangle
void p... | ALGO | 0.999909 | 6.024191 |
47571b28-e898-45a5-be70-2030f98f304d | gyan2976/Competitive-Programming | Recursion & Backtracking/Factorial of a Number.cpp | #include <bits/stdc++.h>
#include <limits.h>
#include <stdio.h>
#include <climits>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
// Factorial of a Number
// 1. Return
int Factorial(int n)
{
// Base Case
if... | ALGO | 0.99994 | 5.758501 |
574528bc-29dc-453b-aa78-7fa0f19083b7 | YASHGUPTA-007/DSA | Arrays/Vector's/lastOccurence.cpp | #include <iostream>
#include <vector>
using namespace std;
int LastOccurance(int x, vector<int> v)
{
int lastOccur;
for (int i = 0; i < v.size(); i++)
{
if ( v[i] == x)
{
lastOccur = i;
}
};
return lastOccur;
}
int main()
{
vector<int> v;
v.push_back(5);... | ALGO | 0.999793 | 5.134577 |
4f2e2862-313c-450d-ae3a-1787f2dc5dcc | AdmiJW/CPP | LeetCode/Shortest Unsorted Continuous Subarray.cpp | #include <algorithm>
#include <vector>
using namespace std;
//https://leetcode.com/problems/shortest-unsorted-continuous-subarray/
/*
* One quick way to solve, is to actually sort the entire array, and compare both the sorted and unsorted arrays.
* The leftmost mismatch is the start of the unsorted subarray, and the... | ALGO | 0.999936 | 6.083644 |
c3223736-ebef-4dbe-8c3e-0c7514ead10c | bzz13/timus | 1209/1209.cpp | #include <iostream>
#include <math.h>
using namespace std;
int fastGetDigitAt(const unsigned long int & position)
{
unsigned long int n = sqrt(2*position);
return (n * (n + 1) / 2 == position) ? 1 : 0;
}
int main()
{
unsigned long int count, position;
cin >> count;
for (int i = 0; i < count; ++i)
{
cin >> pos... | ALGO | 0.999664 | 3.326775 |
40fde7cd-9739-4ea1-b756-d42851815bf2 | ishandutta2007/codeforces | danya.smelskiy/normal/847/C.cpp | #include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define bs ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(a) a.begin(),a.end()
#define sqr(a) ((a)*(a))
#define y1 y12312312
#define int ll
using namespace std;
const int N... | ALGO | 0.999705 | 3.947346 |
e7dc1431-a8a9-44fe-92c1-c60a0bd69913 | NathanBarquira/spellChecker | hashSet.cpp | #include "hashSet.hpp"
hashSet::hashSet()
: hashArray(new linkedList[10])
{
// print("DEBUG: inside hashSet constructor");
}
int hashSet::sizeCount()
{
// print("DEBUG: inside the sizeCount method");
return size;
}
int hashSet::capacityCount()
{
// print("DEBUG: inside the capacityCount method");... | TOOL | 0.866579 | 4.49073 |
6eea9eba-feaa-4a98-a268-73920a1876bd | Morales7nl21/Compiladores2021 | Practica3/AFN.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include "clasesAFN.hpp"
void AFN::creaAFD(string estadoActual, string calf)
{
string edLeer;
stringstream input_stringstream(estadoActual); // convierte cad en stream
vector<string> posibleNuevoEstado{};
string trans_leidas;
while (g... | ALGO | 0.99969 | 3.641776 |
eee6697d-a932-48b9-9d7c-ef97704858b0 | alexei-tchervinsky/tp_2025 | marfina.alisa/F0/main.cpp | /**
* @file main.cpp
* @brief The main module of program
*/
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include "common.hpp"
#include "shannon_fano.hpp"
#include "file_io.hpp"
namespace
{
/**
* @brief Output construction for usage
* @param programName Name of our working... | ALGO | 0.976936 | 5.085329 |
84c136be-0d24-442b-96e5-aad6ed400856 | electronero-project/archive | src/cryptonote_basic/hardfork.cpp | #include <algorithm>
#include <cstdio>
#include "cryptonote_basic/cryptonote_basic.h"
#include "blockchain_db/blockchain_db.h"
#include "hardfork.h"
#undef ELECTRONEUM_DEFAULT_LOG_CATEGORY
#define ELECTRONEUM_DEFAULT_LOG_CATEGORY "hardfork"
using namespace cryptonote;
static uint8_t get_block_vote(const cryptonote:... | ALGO | 0.986643 | 6.7855 |
f272915d-b65a-4787-ad99-43464d1ac283 | atul799/CarND-MPC-Quiz | global_kinematic_model/src/Eigen-3.3/doc/examples/tut_arithmetic_redux_basic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::Matrix2d mat;
mat << 1, 2,
3, 4;
cout << "Here is mat.sum(): " << mat.sum() << endl;
cout << "Here is mat.prod(): " << mat.prod() << endl;
cout << "Here is mat.mean(): " << mat.mean() ... | ALGO | 0.996856 | 3.870119 |
3cd756c1-d6a1-45ad-b61a-17727b7ed57b | ana-lys/geo_ctl | src/land.cpp | #include <iostream>
#include <Eigen/Dense>
#include <Eigen/Geometry>
using namespace Eigen;
Quaterniond rotationToQuaternion(const Vector3d& u, const Vector3d& v)
{
Vector3d axis = u.cross(v);
double angle = acos(u.dot(v) / (u.norm() * v.norm()));
return Quaterniond(AngleAxisd(angle, axis.normalized()));
}... | ALGO | 0.996192 | 5.284206 |
b4730638-0874-4f05-b226-7fb9ca6cf538 | ivanavd11/-Introduction_to_programming | Self-study tasks from the course/Тема 2, Циклично изпълнение. Видове циклични процеси/task_24.cpp | #include <iostream>
int counter(int n)
{
int count = 0;
while (n != 0)
{
n /= 10;
count++;
}
return count;
}
int sumOfDigit(int n)
{
int sum = 0;
int size = counter(n);
int digit = 0;
for (int i = 0; i < size; i++)
{
digit = n % 10;
n /= 10;
if (i == 0 || i == size - 1)
{
sum = sum + digit;
... | ALGO | 0.997376 | 4.247211 |
48e03c88-f59a-41a0-a161-250e85f60102 | durgeshkk/Codeforces-Contests | Practice/800/A_Anti-knapsack.cpp | #include<bits/stdc++.h>
#include<iomanip>
#include <deque>
#include <bitset>
#include <cstdint>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_updat... | ALGO | 0.999938 | 4.068844 |
71e45536-d2e8-41e5-baf6-1f5ccdfdae1d | ymatevva/FMI-UP | IS/ADPracticumsSeminars/Sem14IS/4thProb.cpp | #include<iostream>
constexpr int MAX_SIZE = 100;
bool isInIt(const int* arr, size_t length, int element)
{
if (length == 0)
return false;
return arr[0] == element || isInIt(arr + 1, length - 1, element);
}
int main()
{
unsigned int n;
std::cin >> n;
int arr[MAX_SIZE];
for (size_t i = 0; i < n; i++)
std::ci... | ALGO | 0.999764 | 5.140068 |
e2f35fc0-71c1-46c9-b864-a6b893ed84c2 | Jackarain/avpn | third_party/boost/libs/compute/example/simple_kernel.cpp | #include <iostream>
#include <boost/compute/core.hpp>
namespace compute = boost::compute;
// this example demonstrates how to use the Boost.Compute classes to
// setup and run a simple vector addition kernel on the GPU
int main()
{
// get the default device
compute::device device = compute::system::default_d... | ALGO | 0.986806 | 5.305225 |
7554d91a-6456-4658-8b70-7f46cb6306e0 | wenliangsun/LeetCode | 动态规划/博弈类dp/石子游戏II.cpp | #include <bits/stdc++.h>
using namespace std;
/**
* 石子游戏II
*/
class Solution {
public:
// 花花酱视频:https://www.youtube.com/watch?v=e_FrC5xavwI
int stoneGameII(vector<int>& piles) {
int n = piles.size();
vector<vector<int>> memo(n, vector<int>(n + 1));
int s = score(piles, 0, 1, memo... | ALGO | 0.999632 | 4.608851 |
e8060302-39b2-4812-8673-677856385f8d | TosakaUCW/CompetitiveProgramming | Old/Luogu/[Luogu P2597] [ZJOI 2012]灾难.cpp | #include <stdio.h>
#include <algorithm>
#include <queue>
int read(int x = 0, int f = 0, char ch = getchar())
{
while (ch < 48 or ch > 57) f = ch == '-', ch = getchar();
while (48 <= ch and ch <= 57) x = x * 10 + ch - 48, ch = getchar();
return f ? -x : x;
}
const int N = 2e6 + 5;
const int M = 2e6 + 5;
int n, ans... | ALGO | 0.999934 | 3.853199 |
23d1bc73-4411-4b2d-8a28-1f3823458392 | Nobel-ruettt/Poj | 1109 - False Ordering.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxi 40
ll status[maxi+10];
vector<ll>prime;
void sieve()
{
for(ll i=2;i<maxi;i++)
{
if(status[i]==0)
{
for(ll j=i*2;j<maxi;j+=i)
{
status[j]=1;
}
}
}
fo... | ALGO | 0.998651 | 4.223073 |
0073574b-5046-415d-817f-6f6c28330489 | zxq97/leetcode | math/462.cpp | class Solution {
public:
int minMoves2(vector<int>& nums) {
int n = nums.size();
if(!n)return 0;
sort(nums.begin(), nums.end());
int m = nums[n >> 1];
int ans = 0;
for(int i : nums)
ans += abs(i - m);
return ans;
}
};
| ALGO | 0.999896 | 5.690436 |
067ce050-b238-41d2-ba90-d78efd6a1477 | ishandutta2007/codeforces | sys/normal/1305/C.cpp | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 200005;
int n, m, a[Maxn];
long long ans = 1;
int main()
{
scanf("%d%d", &n, &m);
if (n > m)
{
puts("0");
return 0;
}
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (int i = 1; i <= n; i++)
for (int j = i + 1; j <= n; j++)
(ans *= ab... | ALGO | 0.999994 | 4.385869 |
94f3a09a-a2ad-4f87-a396-e5ba9ca340e0 | prady8339/problem-solving | 1034-subarrays-with-k-different-integers/subarrays-with-k-different-integers.cpp | class Solution {
public:
int subarraysWithKDistinct(vector<int>& nums, int k) {
return slidingWindowAtMost(nums, k) - slidingWindowAtMost(nums, k - 1);
}
private:
int slidingWindowAtMost(vector<int>& nums, int distinctK) {
map<int, int> freqMap;
int left = 0, totalCount = 0;
... | ALGO | 0.999959 | 6.652202 |
daeac3b0-754f-4caf-8bac-320979b80f35 | rysh25/atcoder | abc100/c.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int N;
cin >> N;
// vector<int> a(N);
int res = 1;
for (int i = 0; i < N; i++)
{
int a;
cin >> a;
if (a % 2 == 0)
{
cout << a << ": 2" << endl;
res *= 2;
}
... | ALGO | 0.996277 | 3.527622 |
7b3a93ff-ce64-4977-bbe6-d45f7f0c092c | zeusptit/Hackerrank | Advanced string/48. Số may mắn.cpp | #include<bits/stdc++.h>
using namespace std;
#define quick() ios_base::sync_with_stdio(false); cin.tie(0);
using ll = long long;
int mod=10;
void solve(string &str)
{
int s = 0;
for(int i = 0; i < str.length(); i++)
s += (str[i] - '0');
str = to_string(s);
}
int main()
{
quick();
int te... | ALGO | 0.999933 | 4.56007 |
6d662390-38b8-4bc8-9e14-5e4a891aa7d1 | pawangoyal02/SdeSheetChallenge | BinaryTree/BottomViewOfBinaryTree.cpp | vector<int> bottomView(BinaryTreeNode<int> * root){
// Write your code here.
vector<int> ans;
if(root == NULL)
{
return ans;
}
map<int, int> mpp;
queue<pair<BinaryTreeNode<int>*, int>> q;
q.push({root, 0});
while(!q.empty())
{
... | ALGO | 0.999988 | 6.192123 |
c64b1fd3-9a21-4831-9be7-f20cc45693a1 | rohankale-18/CodechefCodes | practice_pall01.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mod 1000000007
#define endl "\n"
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
int32_t main(){
fio;
int t;
cin>>t;
while(t--){
int flag=0;
string n;
cin>>n;
int m=n.size();
... | ALGO | 0.999937 | 4.00488 |
ca412366-f4cc-484f-b9e1-10a75a26c739 | Garrrruii/BOJ | Tree/BOJ2517 Fenwick.cpp | //running
#include <cstdio>
#include <algorithm>
using namespace std;
int N;
pair<int, int> v[500000];
int fen[500001];
void _upd(int idx, int num) {
while (idx <= N) fen[idx] += num, idx += (idx & -idx);
}
int _sum(int idx) {
int res = 0;
while (idx > 0) res += fen[idx], idx -= (idx & -idx);
return res;
}
bool s... | ALGO | 0.999755 | 3.695303 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.