uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
59cdf671-5925-4483-9625-9cc716976c6c | Mayurishinde27/Leetcode | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-divfacebook-divdiv-classcompanytagscontainer-tagoccurence127-div-divdiv-classcompanytagscontainer-tag-stylebackground-color-rgb... | class Solution {
public:
vector<vector<int>> kClosest(vector<vector<int>>& points, int k)
{
priority_queue<pair<double,vector<int>>, vector<pair<double,vector<int>>>, greater<pair<double,vector<int>>>> pq;
vector<vector<int>> ans;
int n = points.size();
int m = points[0].size();
... | ALGO | 0.999997 | 6.043025 |
63d927e8-602a-49ab-9acc-dd57bc651197 | donbasta/leetcode-submissions | Hard/1092.cpp | class Solution {
public:
string shortestCommonSupersequence(string str1, string str2) {
int n1 = str1.length();
int n2 = str2.length();
vector<vector<int>> dp(n1 + 1, vector<int>(n2 + 1));
vector<vector<pair<int, int>>> pre(n1 + 1, vector<pair<int, int>>(n2 + 1));
for (int i ... | ALGO | 0.999999 | 5.894024 |
60fea5e3-2726-4cf9-a7c4-3d51bea560b8 | yuhongliang/MyLeetCode | reverseKGroup.cpp | #include <iostream>
using namespace std;
/**
* Definition for singly-linked list.
*/
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode *reverseKGroup(ListNode *head, int k)
{
ListNode ret(-1);
ret.next = head;
ListNode * cur = ... | ALGO | 0.99998 | 5.305248 |
0741aa9a-2201-4c55-a818-3f9326f9f821 | Darui99/ITMO-Algorithms-And-Data-Structures | Laboratory work 3 - Priority queues and DSU/Yet another set merging.cpp | #include <bits/stdc++.h>
using namespace std;
vector <int> p[2], sz[2];
int get(int t, int v) {
if (v != p[t][v])
p[t][v] = get(t, p[t][v]);
return p[t][v];
}
void join(int t, int v, int u) {
v = get(t, v);
u = get(t, u);
if (v == u)
return;
p[t][v] = u;
sz[t][u] += sz[t][v];
}
int main() {
ios_base::... | ALGO | 0.999928 | 4.222113 |
cf09b48e-0e17-4bf2-8769-0b8c2679cf8d | thanhdat369/MyLearning | DataStructure/max_heap.cpp | // This is max heap implemtation with array
#include <iostream>
class MaxHeap {
public:
MaxHeap(int capacity);
~MaxHeap();
void buildHeap(int [] array);
void heapify(int index);
void parent(int index);
void left(int index);
void right(int index);
void insert(int key);
void... | ALGO | 0.999182 | 5.091568 |
9b288a2c-1600-40d3-8128-c425577b98a8 | CHENYUY001/Computer-Modeling-2023 | sharedObjectFiles/CC.cpp | typedef struct
{
double w3;
double w4;
} DW;
typedef struct
{
double read1;
double read2;
} ExtU;
typedef struct
{
double write3;
double write4;
} ExtY;
int* shared1;
int* shared2;
int* shared3;
int* shared4;
unsigned int* CC_Recv_ACCEL_VALUE;
int* CC_Recv_TARGET_SPEED;
int* CC_Recv_SPEED;
int* CC_Recv_... | TOOL | 0.973252 | 4.853205 |
9a3ff18a-160d-47e2-9d52-586d93c1355a | walkccc/LeetCode | solutions/302. Smallest Rectangle Enclosing Black Pixels/302.cpp | class Solution {
public:
int minArea(vector<vector<char>>& image, int x, int y) {
constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
const int m = image.size();
const int n = image[0].size();
vector<int> topLeft{x, y};
vector<int> bottomRight{x, y};
queue<pair<int, int>> q{{{x, y... | ALGO | 0.999056 | 7.047593 |
f1748b07-175f-4b56-b884-e328f014b376 | ArtFilippov/autodiff | model.cpp | #include "model.h"
#include "optimizer.h"
#include <thread>
#include <sstream>
#include <iostream>
Model::Model(std::shared_ptr<View> view) : view_(view)
{
table.insert({"+", std::make_shared<TwoArgFunction<Plus>>()});
table.insert({"-", std::make_shared<TwoArgFunction<Sub>>()});
table.insert({"*", std::m... | ALGO | 0.990262 | 4.394879 |
805f65d1-c9e6-48bf-af5a-7c44d9c873a0 | osama-afifi/Online-Judges-Solutions | UVA Problems/UVA/UVA/Shopaholic.cpp | //#include <iostream>
//#include <stdio.h>
//#include <algorithm>
//
//using namespace std;
//
//int arr[20005];
//
//int main()
//{freopen("input.in","r",stdin);
//int n,t;
//scanf("%d",&t);
//
//while(t--)
//{
//scanf("%d",&n);
//
//for(int i = 0 ; i<n ; i++)
// scanf("%d",&arr[i]);
//
//sort(arr,arr+n);
//long long ... | ALGO | 0.99869 | 3.664035 |
8af0c0d4-dc32-4c28-9046-df0bde878a31 | martru118/2021-graphics | etc/lec/Example6a/Shaders.cpp | /*****************************************
*
* Shaders.cpp
*
* Utility routines to assist with creating
* sharders.
*
****************************************/
#include <Windows.h>
#include <GL/glew.h>
#include <stdio.h>
#include "Shaders.h"
#include <stdarg.h>
char *readShaderFile(char *filename) ... | TOOL | 0.903255 | 5.277879 |
21f80327-9fac-403e-a81d-52615e0dacd5 | ishandutta2007/codeforces | fizzydavid/normal/1142/A.cpp | //by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#ifndef LOCAL
#define cerr if(0)cout
#endif
typedef long long ll;
const int mod = 1e9+7;
//My i/o stream
struct fastio
{
char s[100000];
int it, len;
fastio() {it=len=0;}
inline char ge... | ALGO | 0.999512 | 3.281758 |
5bc0ac0c-4fd8-4e68-b845-ff461566b06b | ishandutta2007/codeforces | scott_wu/normal/167/B.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;
const int MAXN = 210;
struct tour
{
double prob;
int nprize;
};
inline bool cmp (tour left, tour right)
{
return left.nprize > right.nprize;
}
int n, l, K;
tour contest[MAXN];
double dp[MAXN][MAXN][MAXN]; /... | ALGO | 0.999936 | 3.569261 |
c247cc33-18b0-437f-a077-f4dfc1bc1e5f | ChoonHean/Kattis | src/hauntedgraveyard.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;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<double> vd;
typedef... | ALGO | 0.999721 | 4.440536 |
f7e8fdc3-5c12-4fe7-8cc4-b165b42c450a | hsia0619/2022c | week6/week6-5.cpp | #include <stdio.h>
#include <algorithm>
int a[10]={9,8,7,1,2,3,6,5,4,0};
int main()
{
std::sort(a,a+10);
for(int i=0;i<10;i++){
printf("%d ",a[i]);
}
}
| ALGO | 0.99667 | 3.182689 |
e8fd351b-a9de-4f83-a8e2-5361aa20a51d | JohnDTill/QtFEM | CFEM/eigen/doc/examples/QuickStart_example.cpp | #include <iostream>
#include <Eigen/Dense>
using Eigen::MatrixXd;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << m << std::endl;
}
| ALGO | 0.992983 | 3.474624 |
03bf1d93-a61d-49a5-9278-39113389806f | coderyogesh/DSA-CPP | Lec-04/Pattern14.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int i = 1;
char count = 'A';
while (i <= n)
{
int j = 1;
while (j <= i)
{
cout << count << "\t";
count++;
j++;
}
cout << endl;
i++;
}
} | ALGO | 0.999395 | 3.870865 |
ff234655-aaf7-4fa1-a9b7-50677dd27a30 | conradev/Box2D | Box2D/Box2D/Collision/b2BroadPhase.cpp | #include <Box2D/Collision/b2BroadPhase.h>
#include <cstring>
using namespace std;
b2BroadPhase::b2BroadPhase()
{
m_proxyCount = 0;
m_pairCapacity = 16;
m_pairCount = 0;
m_pairBuffer = (b2Pair*)b2Alloc(m_pairCapacity * sizeof(b2Pair));
m_moveCapacity = 16;
m_moveCount = 0;
m_moveBuffer = (int32*)b2Alloc(m_move... | ALGO | 0.899668 | 6.686417 |
deaa8be9-d648-48cf-8042-8e61a1425606 | IcEy-999/MyUESource | Engine/Source/ThirdParty/FreeImage/FreeImage-3.18.0/Source/FreeImage/Plugin.cpp | #ifdef _MSC_VER
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
#endif
#ifdef _WIN32
#include <windows.h>
#include <io.h>
#else
#include <ctype.h>
#endif // _WIN32
#include "FreeImage.h"
#include "Utilities.h"
#include "FreeImageIO.h"
#include "Plugin.h"
#include "../Metadata/Fre... | TOOL | 0.881339 | 5.811221 |
b4cb0ba3-2994-46c3-955b-3ab75589356c | ishandutta2007/codeforces | derekfeng/normal/873/F.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int nxt[400004][26],len[400004],fa[400004],sz[400004];
int lst=1,cnt=1;
int n;
char str[200004],border[200004];
void ins(int i){
int c=str[i]-'a';
int p=lst;int np=lst=++cnt;
if(border[i]=='0')sz[np]=1;
len[np]=len[p]+1;
for(;p&&!nxt[p][c];p=fa[p])... | ALGO | 0.99971 | 3.830845 |
ed92915e-292d-45f3-a9c3-ccda1f96a09f | GodsFavoriteDeveloper/wecheck | 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 |
c79ca3db-5aa3-42f7-b240-9bdfa21c1111 | pangbo13/Courses | CS241 问题求解与实践/project/problem4.cpp | //** coding: gbk
#include "SubGraphProcess.h"
using namespace SubGraphProcess_NS;
int main(){
string path = "./data";
SubGraphs sgs;
try{sgs.read(path);}
catch(const runtime_error& err){
cerr<<err.what();
return -1;
}
int op;
int first_node_id,second_node_id;
p... | ALGO | 0.987064 | 3.610434 |
91097cdc-e95d-4e8d-a2c1-d522572f2e19 | Ritika1533/ds-algorithms | Binary search/01_binarySearch.cpp | // https://leetcode.com/problems/binary-search/submissions/1386084254/
// ITERATIVE
class Solution
{
public:
int binarySearch(vector<int> &nums, int target)
{
int n = nums.size();
int low = 0, high = n - 1;
while (low <= high)
{
int mid = low + (high - low) / 2;
... | ALGO | 0.999957 | 6.692275 |
3c83430f-5c8b-44da-9a23-b5797475e7f7 | Pal2021/Codeforces | Codeforces/B_Good_Kid.cpp |
#include<bits/stdc++.h>
using namespace std;
void solve(int n,vector<int>arr){
int min1=INT_MAX;
for(int i=0;i<n;i++){
min1=min(min1,arr[i]);
}
bool flag=false;
int pro=1;
int val=1;
for(int i=0;i<n;i++){
if(arr[i]==min1 && flag==false){
val=arr[i];
flag=true;
conti... | ALGO | 0.999952 | 4.035386 |
27bde3c1-fd31-487b-be05-92ee861135b9 | sultancodess/leetcode- | C++/adding-spaces-to-a-string.cpp | // Time: O(n)
// Space: O(1)
// inplace solution
class Solution {
public:
string addSpaces(string s, vector<int>& spaces) {
int prev = size(s);
s.resize(size(s) + size(spaces));
for(int i = size(spaces) - 1; i >= 0; --i) {
for (int j = prev - 1; j >= spaces[i]; --j) {
... | ALGO | 0.999667 | 6.297338 |
42f6f6a0-e2dd-47a0-bca8-a877e25c440f | uwstudent123/LeetCode-Solutions | Number of Equivalent Domino Pairs.cpp | class Solution {
public:
int numEquivDominoPairs(vector<vector<int>>& dominoes) {
map<pair<int, int>, int> freq;
int ans = 0;
for (auto i : dominoes) {
if (i[0] > i[1]) swap(i[0], i[1]);
freq[make_pair(i[0], i[1])]++;
}
for (auto i : freq) ans += (i.se... | ALGO | 0.999763 | 6.671054 |
16f5810a-3e18-4ce1-8a4b-982f59681916 | deepakjoshi0909/Day-39 | Construct Binary Tree from Preorder and Postorder 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.999958 | 5.787886 |
ccdd982e-1bc6-4e11-b95d-4292b61b0080 | therajshivam/cpp_learn | cpp_quick_rev/05_pointers/01_pointers.cpp | // pointers = variable that stores a memory address of another variable
// sometimes its easier to work with an address
// & address-of operator
// * dereference operator
#include <iostream>
using namespace std;
int main () {
string name = "Bro";
int age = 21;
string freePizzas[5] = {"pizza1"... | TOOL | 0.954596 | 4.13006 |
81960315-27e4-4008-8f31-bc77ac77554c | otavioon/COLA-2022-Tools | datasets/src/optz/codenet/0/p02888_s683606061.cpp | #include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef long long ll;
typedef long long ll;
//typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const... | ALGO | 0.999235 | 3.92839 |
e3af409b-2678-40ed-837d-d01929801d52 | beadx6ggwp/LeetCode-Note | Problems/[v][M]189. Rotate Array/main.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
void rotate(vector<int>& nums, int k) {
int len = nums.size();
int no = 0, ne = k % len, t = len - 1;
while (t > 0) {
// run len-1 times
swap(nums[no], nums[ne]);
ne = (ne + k) % len... | ALGO | 0.999844 | 5.485832 |
d5b156e6-527b-47ac-8e02-2f4a9f4ffbda | redital/ConvessizzazionePoliedri | gedim/src/core/geometry/IntersectorPolygonLine.cpp | #include "IntersectorPolygonLine.hpp"
#include "Intersector1D1D.hpp"
#include "Polygon.hpp"
namespace GeDiM
{
// ***************************************************************************
IntersectorPolygonLine::IntersectorPolygonLine()
{
polygonPointer = NULL;
startPointPointer = NULL;
tangentPointer = NUL... | ALGO | 0.998502 | 5.903793 |
e93b06da-d09d-457b-8e0f-38adc342d52a | tg1kim/Week09 | QueueTag.cpp | #include "Queue.h"
int Queue::IsEmpty()
{ // ť T/F ȯѴ.
return true;
}
int Queue::IsFull()
{ // ť á T/F ȯѴ.
return true;
}
int Queue::Add(Item nItem)
{ // ť nItem ߰ϴµ п T/F ȯѴ.
return true;
}
int Queue::Delete(Item& nItem)
{ // ť Ͽ nItem ϴµ п T/F ȯѴ.
return true;
}
void Queue::Print()
{
int nCtr = (m_nRe... | TOOL | 0.963255 | 4.212035 |
feb1ced2-a73e-40d3-9c9b-1917c120302a | iprosenjitp/Online-Judge | Codeforces/567A-Lineland Mail.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, A[100005];
cin >> n;
vector<vector<int>> V(n);
for(int i = 0; i < n; i++){
cin >> A[i];
}
int mini = 10e9, maxi = 0;
for(int i = 0; i < n; i++){
if(i == 0) {
mini = abs(A[i] - A[i+1]);
... | ALGO | 0.999866 | 3.797548 |
fbf13731-8578-4ec6-afef-8edc5ce5449a | Athrun1027/pat | B/B1082.cpp | #include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
struct node{
int num;
int d;
};
int main(){
int n;
cin>>n;
vector<node> nodes;
for (int i = 0; i < n; ++i){
int x, y;
node temp;
cin>>temp.num>>x>>y;
temp.d = x*x+y*y;
nodes... | ALGO | 0.99955 | 3.872598 |
1f96f97c-4f17-4c32-bdf9-6fd95dc3b1b0 | Md-Salih/My-First-Language | Create an Empty Graph.cpp | #include <iostream>
#include <vector>
std::vector<std::vector<int>> createEmptyGraph(int numVertices) {
return std::vector<std::vector<int>>(numVertices);
}
int main() {
int numVertices = 5;
std::vector<std::vector<int>> graph = createEmptyGraph(numVertices);
for (int i = 0; i < numVertices; i++) {
... | ALGO | 0.994198 | 5.522978 |
c6543955-30a0-4ec1-8bdb-4960eeb7a22b | kasnan/codingstudy | 043.cpp | #include<iostream>
using namespace std;
long getgcd(long n1,long n2);
int main(){
long alen,blen;
cin >> alen >> blen;
long gcd=getgcd(alen,blen);
for(long i=0;i<gcd;i++){
cout << 1;
}
}
long getgcd(long n1,long n2){
if(n2==0){
return n1;
}
else{
return get... | ALGO | 0.999788 | 3.306391 |
e98f2b3b-6f05-453a-99df-b1569dae8419 | zhaoyunfuture/study | leetcode/easy/maximux_depth_Nary_tree/src/main.cpp | #include <string.h>
#include <string>
#include <iostream>
using namespace std;
/*
*// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
public:... | ALGO | 0.998322 | 5.996321 |
30f3e8c2-a67f-4974-947f-26a5a044dcc2 | kaloronahuang/KaloronaCodebase | Practices/Luogu/P3516.cpp | // P3516.cpp
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2020;
typedef pair<int, int> pii;
int n, ai[MAX_N], last_pos;
vector<pii> ansBox;
void moveAround(int pos)
{
if (pos == last_pos)
return;
ansBox.push_back(make_pair((last_pos - pos + n) % n, 0));
last_pos = pos;
}
voi... | ALGO | 0.99999 | 3.236974 |
44a31042-8ce8-4e98-ae24-d3881bc24b55 | Stephan1403/AuD-Exercises | Exersice2/gemeinsamerTeiler.cpp | #include <iostream>
int ggT(int a, int b){
int m = a, n = b, r, var;
do{
if(m<n){
var = m;
m = n;
n = var;
}
r = m - n;
}while(r != 0);
return m;
}
int main(){
std::cout << ggT(16, 28);
} | ALGO | 0.999736 | 5.235214 |
eda28a6c-00c1-47c5-9c66-d4080d70d781 | raman7073/AllAboutCPP | Contest/Atcoder/ABC312/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
bool comp(int a, int b)
{
return a > b;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin >> n >> m;
vector<int> A(n), B(m);
for (int i = 0; i < n; i++)
{
cin >> A[i];
}
for (int i ... | ALGO | 0.999986 | 3.812751 |
7b8bc7b4-8d95-43d1-8a91-74c3943aad50 | westernhiller/usbcamviewer | darkchannel.cpp | //
// Created by dongxia on 17-10-26.
//
#include "darkchannel.h"
using namespace cv;
using namespace std;
cv::Mat calcMinChannel(const cv::Mat& src)
{
CV_Assert(!src.empty());
vector<Mat> channels;
split(src,channels);
Mat minChannel = channels[0];
for(size_t i = 1;i<channels.size();i++){
... | ALGO | 0.976529 | 5.287462 |
e1729d11-39f6-4089-8d7e-8be4e25717cd | pandaive/pto_takifajnyprojekt | src/core/transformations/edge_gradient.cpp | #include "edge_gradient.h"
#include <algorithm>
EdgeGradient::EdgeGradient(PNM* img, ImageViewer* iv) :
Convolution(img, iv)
{
}
EdgeGradient::EdgeGradient(PNM* img) :
Convolution(img)
{
}
PNM* EdgeGradient::verticalDetection()
{
return convolute(g_y, RepeatEdge);
}
PNM* EdgeGradient::horizontalDetectio... | ALGO | 0.924395 | 5.046318 |
74c8a3d3-2a7e-4e6c-a859-1f8838c5842f | Samridhi412/CP | strings/epalin.cpp | #include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const ll mod=1e9+7;
const ld eps=1e-9;
const ll maxn=1e5+1;
const ll inf=5e18;
const ll minf=-inf;
#define mp make_pair
#define pb push_back
#define endl "\n"
string epalin(string& s){
int n=s.siz... | ALGO | 0.999989 | 4.627981 |
b25ac742-2c26-4d53-a2f3-bcc9c050f5fe | Nick648/C-plus-_Codes | 3_sem/Prak7/Prak7.cpp | // Prak7.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
double method(double x, float t) {
return x * x * exp((-1) * t * x);
}
double func(double a, double b, int n, float t, double h... | ALGO | 0.999825 | 4.0142 |
a1e0e7f2-d2cb-4ed6-9da3-9bec77311261 | Kenwhite23/Bulls-and-Cows-Game | BullCowGame/FBullCowGame.cpp | #include "FBullCowGame.h"
#include <map>
#include <ctype.h>
#include <time.h>
#define Tmap std::map
FBullCowGame::FBullCowGame() { Reset(); }
int32 FBullCowGame::GetHiddenWordLength() const { return MyHiddenWord.length(); }
int32 FBullCowGame::GetCurrentTry() const { return MyCurrentTry; }
bool FBullCowGame::IsGame... | TOOL | 0.912453 | 4.844148 |
7e15fa4d-7f0f-44ea-84dd-56309e0efbd4 | teodora27/Data-structures | ConsoleApplication12/ConsoleApplication12/ConsoleApplication12.cpp | //https://www.infoarena.ro/problema/kami
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;
ifstream f("kami.in");
ofstream g("kami.out");
typedef long long ll;
const int N = 100005;
int n;
int v[N];
int main() {
f >> n;
int maxi... | ALGO | 0.999955 | 4.148648 |
a3069aa9-998d-42b3-8117-8f55ee9c93af | edwardbadboy/algorithm-practice | heap_sort.cpp | #include <algorithm>
#include <cstdlib>
#include <iostream>
using namespace std;
template<typename T> //Williams
void shift_down(T* a, int i, int n)
{
for(int bc = 2*i; bc <= n; bc = 2*i){
if(bc < n && a[bc] < a[bc+1]){
bc = bc + 1;
}
if(a[i] < a[bc]){
std::swap(a[i], a[bc]);
i = bc;
}else{
break... | ALGO | 0.999823 | 4.530263 |
dd719651-29eb-4301-9438-189b0ccae2ce | heavenMOJANG/ICPC | .history/Codeforces/CF1950/G_20240331135715.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int inf=0x7fffffff;
void solve(){
int n;cin>>n;
vector<pair<string,string>>s(n);
for(int i=0;i<n;++i) cin>>s[i].first>>s[i].second;
vector... | ALGO | 0.999214 | 3.698992 |
e5c4cf85-1e5d-49f6-a643-0655cb1ff7c5 | Harshit16112000/DSA | 518-coin-change-ii/coin-change-ii.cpp | class Solution {
public:
int change(int amount, vector<int>& coins) {
vector<vector<int>> dp(coins.size(), vector<int> (amount + 1, -1));
return dpProblem(0,amount, coins, dp) == 1e4+1 ? -1 : dpProblem(0,amount, coins, dp);
}
int dpProblem(int index, int amount, vector<int>& coin... | ALGO | 0.999889 | 5.536509 |
35627f93-02e0-4282-b317-188fdbfb5e43 | Okandi/neps | ex_feitos/estrutas_avancadas/fenwick/soma_de_intervalo.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll getSum(ll i, vector<ll> &BITS) {
ll sum = 0;
for (int j = i; j>0; j -= j & -j) {
sum += BITS[j];
}
return sum;
}
void update(ll i, ll newV, vector<ll> &BITS) {
for (ll j=i; j<BITS.size(); j += j & -j) {
BITS[j] += newV;
}
}
int main() ... | ALGO | 0.999708 | 4.548435 |
886999de-ae84-4418-b722-380f06459d6d | hashixuehua/GLViewer | 04 add camera/GLViewer/src/ViewerUtils.cpp | #include "ViewerUtils.h"
Vector3f ViewerUtils::normalizeToAxis(const Vector3f& dir, const Vector3f& localX, const Vector3f& localY, const Vector3f& localZ)
{
double angleX = localX.Angle(dir);
double angleY = localY.Angle(dir);
double angleZ = localZ.Angle(dir);
double rAng90 = PI / 2.0;
bool bTX =... | TOOL | 0.956513 | 5.784084 |
a6ca2280-60c0-4df0-864f-e92a51e936ea | lwyeluo/giveMeAnOffer | nowcoder.com/ta.huawei/26.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
//freopen("input.txt", "r", stdin);
string str;
while(getline(cin, str)) {
vector<string> vec_s(26, "");
for(int i = 0; i < str.length(); i ++) {
if(str[i] <= 'Z' && str[i] >= 'A')
... | ALGO | 0.999376 | 4.299982 |
d8b68a68-79ae-4670-9bc5-51f1c8652512 | codeplaysoftware/clang-leg | lib/Tooling/JSONCompilationDatabase.cpp | #include "clang/Tooling/JSONCompilationDatabase.h"
#include "clang/Tooling/CompilationDatabase.h"
#include "clang/Tooling/CompilationDatabasePluginRegistry.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Path.h"
#include <system_error>
namespace clang {
namespace tooling ... | TOOL | 0.965452 | 7.834567 |
e4c6ccab-b07d-46cc-b2c5-9f2779b0c8f6 | riteshkushwaha7/DSA | Nov-01.cpp | // 1957. Delete Characters to Make Fancy String
class Solution {
public:
string makeFancyString(string s) {
string result;
for (char c : s) {
int n = result.size();
if (n < 2 ||
!(result[n - 1] == result[n - 2] && result[n - 1] == c)) {
resul... | ALGO | 0.999975 | 6.789381 |
95c463ec-588b-4a88-ab2e-b374b2ec3a6e | codacy-open-source-projects-scans/icu | icu4c/source/tools/toolutil/ucm.cpp | #include "unicode/utypes.h"
#include "unicode/ustring.h"
#include "cstring.h"
#include "cmemory.h"
#include "filestrm.h"
#include "uarrsort.h"
#include "ucnvmbcs.h"
#include "ucnv_bld.h"
#include "ucnv_ext.h"
#include "uparse.h"
#include "ucm.h"
#include <stdio.h>
#if !UCONFIG_NO_CONVERSION
/* -----------------------... | TOOL | 0.879509 | 7.271627 |
dc3e3089-fb41-4a85-9cd8-ffe2d3689756 | kurumishka/problems | 266/266B.cpp | #include <bits/stdc++.h>
using namespace std;
main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q; cin >> n >> q;
string ss; cin >> ss;
for (int i = 0; i < q; i++)
{
for (int j = 0; j < n-1; j++)
{
if (ss[j] == 'B' && ss[j+1] == 'G')
{
... | ALGO | 0.999951 | 4.003307 |
780ef624-09d0-4090-8b48-439182850abe | codingsanji/random-programs | C++/PrimeOrNo.cpp | #include <iostream>
using namespace std;
#CODE TO CHECK IF NUMBER IS PRIME
bool primeno (int n){
int count=0;
if (n==1){
return true;
}
for (int i=2 ; i<=n ; i++ )
{
if (n%i==0){
count=count+1;
}
}
if(count==1){
return false;
}
else{
return true;
}
}
int main () {
int n;
cout<<"Enter your... | ALGO | 0.99917 | 3.676559 |
ca34216c-d55f-4c61-bb12-95ed6c69b12d | polygraphene/android_system_core | init/interface_utils.cpp | #include "interface_utils.h"
#include <fstream>
#include <sstream>
#include <android-base/strings.h>
#include <hidl-util/FqInstance.h>
using android::FqInstance;
using android::FQName;
using android::base::Error;
namespace android {
namespace init {
namespace {
std::string FQNamesToString(const std::set<FQName>& ... | TOOL | 0.872532 | 7.580553 |
1bccf1c3-f702-4059-a411-8996eb57db05 | TecHAyusH6476/Interview-Prep-DSA-HacktoberFest-2023 | Stacks_And_Queues/StackAllOperations.cpp | // Stack operations shown using Array
#include <bits/stdc++.h>
using namespace std;
// Push Element to Stack
void push(int num, int arr[], int *top, int maxSz) {
if(*top == maxSz - 1) {
cout << "Stack Overflow!!!" << endl;
return;
}
arr[++(*top)] = num;
cout << endl;
return;
}
// P... | ALGO | 0.992878 | 5.120177 |
ddd60f79-f9d5-4da0-9659-4d20daeb416c | HannanAullyaW/Tugas-Find-Words | DEMO 1.cpp | #include <iostream>
#include <conio.h>
#include <cstring>
#include <string.h>
using namespace std;
const int cols = 16, rows = 15;
int n,temp = 0, counterV = 0, counterH = 0;
char word[16];
char words[rows][cols] = {"tgbwwinterwsesn",
"aaunttmmhfoodnb",
... | ALGO | 0.998324 | 3.227348 |
aa92f633-ab75-407e-9dee-59af6ab43855 | subhm2004/Leetcode_Solutions | 2215-finding-3-digit-even-numbers/finding-3-digit-even-numbers.cpp | class Solution {
public:
void solve(int current, int k, vector<int>& freq, vector<int>& ans) {
if (k == 0) {
if (current % 2 == 0)
ans.push_back(current);
return;
}
current = current * 10;
for (int i = 0; i <= 9; i++) {
if (current... | ALGO | 0.99994 | 6.192461 |
14767631-bd3d-48c5-a8b1-9e052779031b | Haari324007/data-structure | implement array operations.cpp | #include <stdio.h>
#define MAX_SIZE 100
void display(int arr[], int size) {
printf("Array elements: ");
for (int i = 0; i < size; i++) {
printf("%d ", arr[i]);
}
printf("\n");
}
int insert(int arr[], int size, int pos, int element) {
if (size >= MAX_SIZE || pos < 0 || pos > size) {
... | ALGO | 0.990712 | 5.857345 |
e4adf718-d033-4df3-a3e5-92b96c6aebd8 | ishandutta2007/codeforces | mango_lassi/normal/819/B.cpp | #include <iostream>
#include <algorithm>
const int N = 1e6;
long long ddx [2 * N + 5];
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
int n;
std::cin >> n;
long long init = 0;
for (int i = 1; i <= n; ++i) {
int num;
std::cin >> num;
init += std::abs(i - num);
if (num <= i) {
/... | ALGO | 0.999997 | 4.214723 |
707dec0a-34a4-43f7-9876-ca97b13f32b2 | IMD-LP1/Problema-7 | lists/list1004.cpp | #include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>
#include <iomanip>
using namespace std;
int main(int argc, char const *argv[])
{
vector<int> data{};
int i = 0;
int x{};
// Read integers one at a time.
while(i < 3){
cin >> x;
data.push_back(x);
i++;
}
// Sort the vector.
sort(d... | ALGO | 0.999624 | 3.493489 |
537ddb19-e855-4429-ac8b-9278b3137e69 | ralph-uy-aes/ICS-311-F24 | hw7/messages.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
#include <queue>
#include <string>
#include <sstream>
class Graph {
private:
std::unordered_map<std::string, std::vector<std::string>> adjList;
public:
void addUser(const std::string& user){
if (adjList.find(user) == adjList.end()){
... | ALGO | 0.999682 | 5.718334 |
3f829b04-5939-4b4a-a4cc-9f683fcd3efa | dimensenss/Cpp-OOP | Labs (1 semester)/Lab5/Lab5_b/Lab5_b.cpp |
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <conio.h>
using namespace std;
int main() {
setlocale(LC_ALL, "RUS");
int grib;
while (1) {
system("cls");
printf("\t***Склонение слова гриб в зависимости от числа***\n");
printf("Введите количество грибов >");
scanf("%d", &gr... | ALGO | 0.986431 | 3.090145 |
3bdbb6ec-5290-46db-96c5-62d0c3e3a01e | leticia-pontes/EstruturaDeDados | Ordenacao/Ordenacao.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
void inserirValorVetor(int* vetor, int tamanho) {
for (int it = 0; it < tamanho; it++) {
cout << "Digite o valor " << it + 1 << ": ";
cin >> vetor[it];
cout << endl;
}
}
void mostrarVetor(int* vetor, int tamanho) {
for (int it = 0; it < tamanho; i... | ALGO | 0.999746 | 4.96166 |
2e8f638c-a251-42da-b9b1-5288b9ec162f | BeLike-Harsh/C-Data-Structures-and-Algorithms-DSA- | Sorting/4_Counting_sort.cpp | #include<iostream>
#include<climits>
using namespace std;
void printArr(int arr[],int n){
for (int i = 0; i < n; i++)
{
cout<<arr[i]<<",";
}
}
void countingSort(int arr[],int n){
int freq[1000] = {0};
int minVal = INT32_MAX , maxVal=INT32_MIN;
for (int i = 0; i < n; i++){
... | ALGO | 0.999855 | 5.360857 |
0926fb07-c383-411e-b26c-f26186f9be1e | Farewellswind/Salted-fish-pond | dp/数位dp/poj 3252二进制前导零记忆化搜索.cpp | #include<iostream>//仯õķǵƶԶ
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a[102],dp[102][102],num;
int hs(int y)
{
return y+40;
}
int mfs(int pos,int zmo,bool lim,bool forzero)
{
if(pos==-1) return zmo>=40;
if(!lim and !forzero and dp[pos][zmo]!=-1) return dp[pos][zmo];
int up... | ALGO | 0.999555 | 3.377214 |
5368cddd-7925-4f00-a080-038de356eb5e | kxxt/my-solutions-to-exercises-in-programming-abstractions-in-cpp | 3-17-cyclicCipher/main.cpp | #include <iostream>
#include <string>
using namespace std;
string encodeCaesarCipher(string str, int shift);
char shiftCharacter(char ch, int shift);
inline char shiftCharacterWithStartCharacter(char ch, char shift, char startChar);
int main()
{
cout << encodeCaesarCipher("This is a secret message", 13) << endl;... | ALGO | 0.999124 | 5.941142 |
175c2ae2-59c5-405b-a84b-8fe547854654 | aakashdhakal/NCCS | Fourth Semester/Theory of Computation/string_starting_with_10.cpp | #include <iostream>
#include <vector>
using namespace std;
// Define the NFA as a set of states and transitions
vector<int> states = {0, 1, 2}; // States are represented by integers (0, 1, 2, 3, ...)
vector<vector<pair<char, int>>> transitions = {
{{'1', 1}},
{{'0', 2}},
{{'0', 2}, {'1', 2}},
{{}}}; /... | ALGO | 0.999776 | 7.031538 |
42314c05-fbd7-4d32-a92e-813f88400532 | kevinoconnor7/Simplified-DES | des.cpp | #include <string.h>
#include <cmath>
#include <iostream>
#include "des.h"
//Build the keys based on given key
void DES::buildKeys()
{
std::string working_key = this->key;
if(working_key.size() != 10)
{
return;
}
//Being with permutation 10 on this key
working_key = this->P10(working_key);
//Split the key a... | ALGO | 0.999497 | 6.154633 |
74a830bb-5ab5-497a-9d05-7082a6a71a6f | awishnick/sidescroller | lib/boost_1_48_0/libs/flyweight/example/fibonacci.cpp | #include <boost/flyweight.hpp>
#include <boost/flyweight/key_value.hpp>
#include <boost/flyweight/no_tracking.hpp>
#include <boost/noncopyable.hpp>
#include <iostream>
using namespace boost::flyweights;
/* Memoized calculation of Fibonacci numbers */
/* This class takes an int n and calculates F(n) at construction t... | ALGO | 0.989687 | 7.792766 |
064375e3-918b-4d39-8c18-7cbf6355f724 | ReversingID/Programming-Reference | Codes/Algorithm/searching/c++/cases/exponential-search.cpp | /*
Exponential Search
Archive of Reversing.ID
Algorithm (Searching)
Compile:
[clang]
$ clang++ exponential-search.cpp -o exponential-search
[gcc]
$ g++ exponential-search.cpp -o exponential-search
[msvc]
$ cl exponential-search.cpp
Run:
$ exponential-search
*/
/*
Imp... | ALGO | 0.999996 | 6.028686 |
10806d3d-34e3-454c-9b1a-6b07dbdc8e4f | Kevin-Seligmann/42School-Projects | c++ Modules/08CModule/ex01/src/Span.cpp | #include "Span.hpp"
Span::Span():N(0){}
Span::Span(unsigned int size):N(size){}
Span::Span(Span const & src):N(src.N)
{
_v = src._v;
}
Span::~Span(){}
unsigned int Span::getSize(void) const
{
return N;
}
std::vector<int> const & Span::getVector(void) const
{
return _v;
}
Span & Span::operator=(Span const & rh... | ALGO | 0.986505 | 4.714706 |
57f47d58-a511-4e4c-a019-987198213222 | ZhanserikKalmukhambet/ALGORITHM_DATA_STRUCTURES | Week_10/lab9/F.cpp | #include <iostream>
#include <vector>
using namespace std;
vector <int> p_f(string s){
int n = s.size();
vector <int> p(n);
p[0] = 0;
for(int i=1; i<n; i++){
int j = p[i-1];
while(j > 0 && s[i] != s[j])
j = p[j-1];
if(s[i] == s[j])
j++;
p[i] = j;
}
return p;
}
vector<int> occurences(vector <in... | ALGO | 0.999769 | 3.576902 |
2bc3080e-174b-4a00-aaac-64ec22fafad7 | GeeKY03/cppcodesolutions | unurnffirfnnfdnkfngfignfigfgmf.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int array[n];
for(int i=0;i<n;i++){
cin>>array[i];
}
sort(array, array+n);
vector <int> v;
int count=1;
for(int i=1;i<n;i++){
if((i==n-1)&&(array[i]==array[i-1])){
count++;
v.push_back(count);
}
if(array[i]==array[i-1]){
c... | ALGO | 0.999885 | 3.695887 |
9afafbf1-7a9f-4d39-9ec8-1429061eccac | werner-yin/code-public-2 | Atcoder/problems/AGC056D.cpp | #include <bits/stdc++.h>
#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)
using namespace std;
using ll = long long;
using db = double;
... | ALGO | 0.999968 | 3.275422 |
62479ece-0d75-4ea2-bf73-994d5748b499 | vivekchaurasiya12/Data-Structure-Algo | Trees/TreeTraversal/postOrderTraversal.cpp | #include <bits/stdc++.h> // Includes all standard headers in C++ (not recommended for production, use specific headers instead)
using namespace std;
// Structure definition for a tree node
struct Node {
int data; // Value of the node
Node* left; // Pointer to the left child
Node* right; // Poi... | ALGO | 0.999978 | 7.348104 |
ab389e84-98a3-4e31-8242-066c3e2e23c3 | Luthey-Schulten-Lab/Lattice_Microbes | src/cmd/lm_sbml_import.cpp | #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <sys/stat.h>
#include <sbml/SBMLTypes.h>
#include "core/Exceptions.h"
#include "ReactionModel.pb.h"
#include "io/SimulationFile.h"
#include "core/Print.h"
#include "l... | TOOL | 0.90809 | 6.174447 |
9e27d66d-f0a7-42e8-9655-0c896d72ee90 | JugalPatel01/CPPTutorial | 19-Sorting/19-Sorting06-MergeSort.cpp | /* Merge sort
input : 5 3 4 2 1
output : 1 2 3 4 5
Time complexity : Best Case, Worst Case , Average Case -> O(nlogn)
*/
#include <iostream>
using namespace std;
void merge(int arr[], int l, int mid, int r)
{
int n1 = mid - l + 1;
int n2 = r - mid;
int a[n1], b[n2];
for (int i = 0; i <... | ALGO | 0.999954 | 5.181213 |
e246efc5-8de4-44e3-ae0c-0a15689ff2bc | andyzhu23/Competitive-Programming | algorithms/Dynamic Programming/getLIS.cpp | #include <iostream>
using namespace std;
const int N =1e4+10;
int n,a[N],dp[N];
int len;
int binarySearch(int x){
int l = 1, r = len, mid;
int ans;
while(l<=r){
mid = (l + r)/2;
if(dp[mid] < x) l = mid + 1;
else {
r = mid - 1;
ans = mid;
}
}
... | ALGO | 0.999973 | 4.01824 |
f4455283-0648-4bb8-bc8d-71c4f06fb3e4 | srlabUsask/crhmcode | crhmcode/src/modules/ClassalbedoRichard.cpp | //created by Manishankar Mondal
#include <math.h>
#include <assert.h>
#include <iostream>
#include <fstream>
#include <bitset>
#include <algorithm>
#include "ClassalbedoRichard.h"
#include "../core/GlobalDll.h"
#include "../core/ClassCRHM.h"
#include "newmodules/SnobalDefines.h"
using namespace CRHM;
ClassalbedoRic... | ALGO | 0.989906 | 5.13986 |
ceeb6060-a636-4f3a-9c85-0dc641a922ef | fsmos/Marlin-AnetA8-RUMBA-Deamond | Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp | #include "../../../inc/MarlinConfig.h"
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "../bedlevel.h"
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
#include "../../../module/motion.h"
#if ENABLED(DELTA)
#include "../../../module/delta.h"
#endif
#include "../../../MarlinCore.h"
#include <m... | ALGO | 0.987403 | 7.574515 |
691e3c11-2d94-49ce-961f-f50c38943227 | yasamanshirian/triplyPeriodic-modified | tensor1.cpp | #include "tensor0.h"
#include "tensor1.h"
#include "communicator.h"
#include <mpi.h>
#include <math.h>
///////////////////////////////////////////////////////////////////////////////Class of first order tensor (vector field)////////////////////////////////////////////////////////
void tensor1::Update_Ghosts()
{
comm... | ALGO | 0.993286 | 3.939423 |
9a91f980-ba63-4ffd-811a-bcb54c2d52a3 | dnlsv/system-software-labs | MatrixProcess/Matrix/Main.cpp | #include <iostream> //подключение библиотеки iostream
using namespace std; //использования пространства имен std
int main() //создание главной функции main
{
setlocale(LC_ALL, ".UTF8"); //установка русской локали
int n; //создание переменной n
cout << "Введите размер матрицы n = "; //вывод на экран сообщ... | ALGO | 0.997521 | 4.58424 |
12b4a877-dae8-4b38-8825-b7dae312af1f | ttamx/Competitive-Programming | codeforces/2040C.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;
using ll = long long;
using db = long double;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<db>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
u... | ALGO | 0.999848 | 4.551317 |
e10a07c8-fe32-4691-8f40-8e1279478109 | CapDRAKE/Projet-annuel-3IABD-Machine-Learning | lib/eigen-3.4.0/eigen-3.4.0/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A;
A << 1, 2, 2, 3;
cout << "Here is the matrix A:\n" << A << endl;
SelfAdjointEigenSolver<Matrix2f> eigensolver(A);
if (eigensolver.info() != Success) abort();
cout << "The eigenvalues of A ... | ALGO | 0.998714 | 3.846247 |
186a0383-118f-44e3-8895-3d92459083be | ARLM-Attic/Prototypes-NConcepts | MMProjects/WFL_new/Analyze.cpp | #include "StdAfx.h"
#include "Analyze.h"
Analyze::Analyze(void)
{
Initialize();
// At first run, i only count the lines in order to correctly allocate the array data
// structure
m_iMatrixSize = LinesInWFLFile(WFL_FILE_NAME_AND_PATH);
// Now allocate the Structure
m_iMatrix = new int[m_iM... | TOOL | 0.951498 | 3.090464 |
fd2f1fed-79ce-4d6a-b6c0-a304076372c3 | vivek-30/cp-and-dsa-zone | CodeChef/Random/binaryMismatch.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define inf 2e18
#define minf -2e18
#define yes cout << "YES" << "\n";
#define no cout << "NO" << "\n";
#define pii pair<ll, l... | ALGO | 0.999973 | 3.99961 |
d18e5b9a-ec7f-4d39-a0f1-8c5f89a6ee16 | Hooollin/codeforces | div3/734/B1.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
// 每个字母最多被paint 2次(红/绿)
// 出现一次的字母只能和出现一次的字母配对
// 出现两次的字母和自己配对
int tt;
cin >> tt;
while(tt-- > 0){
string s;
cin >> s;
int cnt[26];
for(int i = 0; i < 26; i++){
... | ALGO | 0.99994 | 4.805245 |
d2b906af-13c6-44b5-9da1-f17de5c54e0f | laz2berry/PS | BOJ/11066.cpp | #include <bits/stdc++.h>
using namespace std;
int dp[502][502];
int sum[502];
int main(void)
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
int file_size;
cin >> file_size;
... | ALGO | 0.999568 | 3.85864 |
25d012e2-123f-45c8-9557-cd51241c1688 | aurastejeroiu/GA | Lab2/2.2.cpp | //
// Created by Stejeroiu Aura on 3/13/2020.
//
#include <fstream>
#include <iostream>
#include <vector>
#include <queue>
#define inf 99999
using namespace std;
ifstream f("in.txt");
ofstream g("out.txt");
vector <pair<int,int> > v[1001];
queue <int> q;
int n,m;
int L[1001];
int T[1001];
void credCaMoore(int x)
{
... | ALGO | 0.99998 | 4.194071 |
5d7cf388-29b2-4526-85b1-3da1e7f32c22 | bpfinnerty/DeepLearningLibrary | boost_1_62_0/libs/msm/doc/HTML/examples/BoostCon09Full.cpp | #include <vector>
#include <iostream>
#include <boost/mpl/vector/vector50.hpp>
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/state_machine_def.hpp>
#include <boost/msm/back/tools.hpp>
namespace msm = boost::msm;
namespace mpl = boost::mpl;
namespace // Concrete FSM implementation
{
// eve... | TOOL | 0.895593 | 7.016479 |
c094fbde-9b67-4ff5-a624-9163eaf82795 | UtkarshDhagat/new_sam | kim.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int man (int x1,int y1,int x2,int y2){
return abs (x1-x2)+ abs(y1-y2);
}
int dfs(int n,int x,int y,int home_x,int home_y,bool visited[],int custx[],int custy[],int dist,int &minn,int count){
if (co... | ALGO | 0.999735 | 4.264216 |
e6424a36-23c3-4586-8b64-3d24a80a5c9c | droy249/DSA | Aditya Verma Playlists/binary search practice/binarySearch.cpp | /* Given a sorted array arr[] of n elements,
* write a function to search a given element x in arr[].
*
* Answer: Binary Search: Search a sorted array by repeatedly
* dividing the search interval in half. Begin with an interval
* covering the whole array. If the value of the search key is
* less than the ite... | ALGO | 0.999952 | 6.424781 |
fe96e32d-55fe-4bb7-9bcf-ccd244036822 | prakharmosesOK/ChatApplication | Core/Source/Core/ExtraRes/BoostAiso/boost_1_84_0/libs/mpi/example/random_content.cpp | // An example using Boost.MPI's skeletons and content to optimize
// communication.
#include <boost/mpi.hpp>
#include <boost/serialization/list.hpp>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iostream>
#include <stdlib.h>
namespace mpi = boost::mpi;
int main(int argc, char* argv[])
{
mpi... | ALGO | 0.989712 | 4.402016 |
fd6fe910-7614-42df-93b1-31f232cea97e | aakash811/Leetcode-Solutions | 0005-longest-palindromic-substring/0005-longest-palindromic-substring.cpp | class Solution {
public:
bool isPalin(string &s){
int i=0;
int j=s.length()-1;
while(i<j){
if(s[i]!=s[j]){
return false;
}
i++;
j--;
}
return true;
}
string longestPalindrome(string s) {
int n=s.length();
string maxi="";
... | ALGO | 0.999972 | 6.176663 |
7771be43-0fe4-4814-aee4-8f594a43c5ac | yholik/clase3_programacion1 | par_o_impar.cpp | #include <iostream>
using namespace std;
int main(){
int a;
cout << "Ingrese un numero: " << endl;
cin >> a;
if( a % 2 == 0){
cout << "El numero es par";
}else {
cout << "El numero es impar";
}
return 0;
}
| ALGO | 0.990324 | 3.236037 |
d9fc9e40-5940-4fe3-ab4f-4b7c893ec3a3 | harii1227/DSA | Char&String/checkPalindrom.cpp | #include <iostream>
using namespace std;
int findlength(char ch[], int size)
{
int length = 0;
for (int i = 0; i < size; i++)
{
if (ch[i] == '\0')
{
break;
}
else
{
length++;
}
}
return length;
}
bool palindrom(... | ALGO | 0.999871 | 4.967204 |
23ba9e51-6b60-4ded-98f9-3485b55448ed | kanonir25/Algorithms-and-Data-Structures | MST/Prim/185.cpp | #include <iostream>
#include <vector>
#include <set>
#include <climits>
using namespace std;
#define vertex_t int
#define weigth_t int
struct Graph{
int numberOfVertex;
vector<vector<pair<vertex_t, weigth_t> > > listOfAdj;
};
void fillGraph(Graph& g){
int n, m;
int x, y, w;
cin >> n >> m;
g.numberOfVertex = n;... | ALGO | 0.999976 | 4.463473 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.