uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
98259b43-c5e6-4a48-8912-d2607206faaa | ayman-yasser/IEEE-CS-25 | Rookies/Task2/E_Burning_Midnight_Oil.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Mod 1000000007
#define p5 100007
#define pb(x) push_back(x)
#define all(v) v.begin(), v.end()
typedef vector<int> vi;
typedef pair<int,int> pi;
ty... | ALGO | 0.999983 | 4.064229 |
46a1fdc2-ea25-4d28-821b-74c1252cecba | jenishkakkad/DSA | 568.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
};
int main()
{
Node *HEAD = nullptr; // Head pointer to point to the start of the linked list
// Create the first node
HEAD = new Node();
HEAD->data = 10;
HEAD->next = nullptr;
// Pointer to traverse... | ALGO | 0.999261 | 5.26415 |
2a72b654-181e-41c0-9cf4-339643ae6020 | Asik8/Algorithms-Phitron | M-11/DSU_Cycle.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int parent[N];
int group_size[N];
void dsu_initialize(int n)
{
for (int i = 0; i < n; i++)
{
parent[i] = -1;
group_size[i] = 1;
}
}
int dsu_find(int node)
{
if (parent[node] == -1)
return node;
int leader = ... | ALGO | 0.99996 | 4.761377 |
f7a6a1b0-3d5a-4d42-ac99-0dcc90f0c976 | smmahadee/learn_c_cpp_dsa | 2.phitron_dsa/module-22(heap)/2.insert_in_min_heap.cpp | // 50 40 45 30 35 42 32 25 20 10
#include <iostream>
using namespace std;
int main() {
int arr[10] = {50, 40, 45, 30, 35, 42, 32, 25, 20, 10};
vector<int> v(arr, arr + 10);
int size;
cin >> size;
while (size--) {
int val;
cin >> val;
v.push_back(val);
size_t cur... | ALGO | 0.99998 | 4.19865 |
c8eaa018-165c-418a-b342-94a683205428 | vitthalnamdev/icpc | Kill_Monsters_Easy_Version.cpp | // Don't look the rank , if you want a good rank
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,sse,sse2,sse3,sse4,popcnt,fma")
#pragma GCC optimize("unroll-loops")
////--------- DEBUG START---------////
#define debug(x) cerr << #x <<" "; _pr... | ALGO | 0.99991 | 4.502601 |
49711d9b-915c-429b-88fc-d986d3f06b04 | grattan/covid19.model.sa2 | src/distr2status.cpp | #include "covid19model.h"
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
IntegerVector distr2status(int N,
int dead,
int healed,
int active,
int critical) {
IntegerVector Status = no_init(N);
fo... | TOOL | 0.929629 | 5.057893 |
ab615cc3-6339-482a-8689-1c7b65932336 | xxtyydsjdz/Cpp-propject | 数据结构/双向循环链表.cpp | #include <iostream>
using namespace std;
class Node
{
public:
Node* pPre;
Node* pNext;
int data;
Node()
{
this->data = -1;
this->pNext = NULL;
this->pPre = NULL;
}
};
void AddNode(Node* pHead, int idata);
int main()
{
Node* pHead = new Node;
pHead->pPre = pHead;
pHead->pNext = pHead;
AddNode(pHead, 1)... | ALGO | 0.997692 | 4.326216 |
b4ac4cc3-2711-4c2b-a2a9-35b10aca7bba | MPSLab-ASU/ccf | llvm-project/clang/lib/Format/UsingDeclarationsSorter.cpp | #include "UsingDeclarationsSorter.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Regex.h"
#include <algorithm>
#define DEBUG_TYPE "using-declarations-sorter"
namespace clang {
namespace format {
namespace {
// The order of using declaration is defined as follows:
// Split the strings by "::" and discard... | TOOL | 0.98926 | 5.745601 |
f74b4d9a-be31-452e-8f03-f6284254baaf | siva0410/atcoder | abc225/d.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int N, Q;
cin >> N >> Q;
vector<int> front(N+1,0), back(N+1,0);
deque<int> ans;
for(int i=0; i<Q; i++){
int query, x, y;
cin >> query;
if(query == 1){
cin >> x >> y;
back[x] = y;
front[y] = x;
}
if(que... | ALGO | 0.999815 | 4.114599 |
87982ed9-fcdc-4c89-897b-13b84fa2d72a | prabhjotschugh/DSA-Solutions | 0029-divide-two-integers/0029-divide-two-integers.cpp | class Solution {
public:
int divide(int dividend, int divisor) {
if( dividend == INT_MIN && divisor == -1 )
return INT_MAX;
long long int ans = dividend/divisor;
if(ans>INT_MAX)
return INT_MAX;
if(ans<INT_MIN)
return INT_MIN;
return ans;
... | ALGO | 0.998165 | 5.763463 |
00378623-82fb-4a21-9adc-d8d197bd4249 | RahulScripted/DSA | String/BulitInFunction/Reverse.cpp | // Built-in Function to reverse the string
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
string str;
cout<<"Enter a String : ";
getline(cin,str);
cout<<"Before updating String : "<<str<<endl;
reverse(str.begin(),str.end());
cout<<"After updating String... | ALGO | 0.918835 | 4.187087 |
5550c105-6a08-4b6c-a053-4438f68891a8 | kirilliliych/GUI | raytracer/ray.cpp | #include "ray.hpp"
bool ray_intersects_sphere(const Sphere &sphere,
const Ray &ray,
float dist_min,
float dist_max,
IntersectionData *data)
{
assert(data != nullptr);
Vector3d from_sphere_center_to_... | ALGO | 0.971021 | 5.406724 |
277cdcef-6797-4be0-8ad9-b0b233c11642 | tuncdeveloper/C-projects | C projects/if else/hangi basamak buyuk.cpp | #include<stdio.h>
int main(){
//rakamlar farkl 3 basamakl bir sayidan sadan okuyunca en byk sayinin kanc basamakta olduunu syle...
int x,y,z,birler,onlar,yuzler;
printf("sayi gir = ");
scanf("%d",&x);
birler=x%10;
yuzler=x/100;
y=x/10;
onlar=y%10;
if(yuzler>0){
if(birler>onlar && birler>yuzler)
{
pr... | ALGO | 0.999285 | 3.245325 |
7773ac82-a1e2-4c30-8cbf-6fbe3291d14d | ggh-png/PS | 백준/11659.cpp | #include <iostream>
#include <vector>
using namespace std;
int n, m;
int arr[100005];
int psum[100006];
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> m;
for(int i=1; i <= n; i++)
{
cin >> arr[i];
psum[i] = psum[i-1] + arr[i];
... | ALGO | 0.999985 | 4.733614 |
a23349f4-8fa0-4143-ab8f-feaf20da30e6 | TheGadri/moblers-github-trends | 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.998733 | 6.76775 |
45153f99-f5d3-445c-a5cb-2a02b386bd9d | JeaWoo-Park/Lecture | Data Sturct/스택오목.cpp | #include <iostream>
#include <fstream>
class Stack
{
private:
int x = NULL, y = NULL, color = 3;
public:
void S_Push(int x,int y,int color) {
Stack::x = x;
Stack::y = y;
Stack::color = color;
}
void U_Push(Stack& save) {
Stack::x = save.x;
Stack::y = save.y;
Stack::color = save.color;
save.Pop();
}
... | TOOL | 0.885219 | 3.75511 |
4610d588-cff8-4724-8e99-a585e5200f76 | myst-6/ukoly | public/assets/code/fractions/sol.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string input;
cin >> input;
// Find the position of the decimal point
size_t decimal_pos = input.find('.');
// Initialize numerator and denominator
long long num;
int denom = 1;
if (decimal_pos != string::npos) { // If ther... | ALGO | 0.999468 | 6.267872 |
a6dee0b1-903f-4dc7-a725-de0c17c4fce4 | tecton/Leetcode-Exercise | Insert Interval.cpp | /**
* Definition for an interval.
* struct Interval {
* int start;
* int end;
* Interval() : start(0), end(0) {}
* Interval(int s, int e) : start(s), end(e) {}
* };
*/
class Solution {
public:
vector<Interval> insert(vector<Interval> &intervals, Interval newInterval) {
vector<Interva... | ALGO | 0.99995 | 5.891372 |
a6105d38-9f15-4d59-b6f8-a082e3151d2a | Suresh-Krishna27/IPMP | Tasks/Week1/q4.cpp | //https://leetcode.com/problems/find-the-duplicate-number/solutions/1894339/C++-8-Different-solutions-to-this-problem-or-Do-you-have-another-one/
int findDuplicate(vector<int>& nums) {
vector<int> seen(nums.size()+1);
for(auto n: nums){
if(seen[n])
return n;
seen[n] = true;
}
return 0;
}
| ALGO | 0.999774 | 5.721648 |
b428af29-8e6e-4a8e-a06b-a23bc444d66c | Hs918131/Leetcode_Daily | Feb_2024/543. Diameter of Binary Tree.cpp | //T.C : O(n)
//S.C : O(depth of tree) - Recursion System Stack Space
class Solution {
public:
int diameter(TreeNode* root, int& result) {
if(!root)
return 0;
int left = diameter(root->left, result);
int right = diameter(root->right, result);
result... | ALGO | 0.999912 | 6.550066 |
57d3930c-27a3-430e-a319-5e02674a7c68 | Th3L1ch/Regisys | tess-two/jni/com_googlecode_tesseract_android/src/dict/stopper.cpp | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "stopper.h"
#include "ambigs.h"
#include "ccutil.h"
#include "const.h"
#include "danerror.h"
#include "dict.h"
#include "efio.h"
#include "helpers.h"
#include "matchdefs.h"
#include "pageres.h"
#include "params.h"
#include "ratngs.h"
... | ALGO | 0.977316 | 4.037816 |
76788e47-690e-45b0-8d00-a9031fc3a797 | AngadSingh04/DSA-Leetcode | 1832_sentence_is_Pangram.cpp | class Solution {
public:
bool checkIfPangram(string sentence) {
unordered_set<char> a(sentence.begin(),sentence.end());
if(a.size()==26){
return true;
}
return false;
}
}; | ALGO | 0.99887 | 6.061378 |
5e97d048-671b-4e5d-884a-9fe0e39a8a15 | Aloereed/llama.cpp-ohos | examples/imatrix/imatrix.cpp | #include "arg.h"
#include "common.h"
#include "log.h"
#include "llama.h"
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <thread>
#include <mutex>
#include <vector>
#include <fstream>
#include <unordered_map>
#include <algorithm>
#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267... | DATA | 0.964475 | 5.641076 |
8be31a5d-470e-475a-bbf5-245ec77d55ff | jonathanirvings/toki-open-2018 | toki-open-2018-tetris/tetris.cpp | #include "tetris.h"
#include <string>
#include <vector>
std::vector<int> arrangeTetrominoes(int N, std::string S, int Q) {
std::vector<int> ans;
return ans;
}
| ALGO | 0.999589 | 5.099092 |
fbed7648-593e-436b-8936-6c6340aee148 | greenrok/baekjoon | cpp/class1/단어_공부.cpp | #include <iostream>
using namespace std;
int alpha[26], cnt = 0;
string str;
int main()
{
cin >> str;
// 글자 수 카운트
for (int i = 0; i < str.length(); i++)
{
if (str[i] < 97)
{
alpha[str[i] - 65]++;
}
else
{
alpha[str[i] - 97]++;
}
}
// 글자 수 비교하기
... | ALGO | 0.999975 | 3.439771 |
3ca2b12b-9c4b-4195-a571-9b5425259649 | RohitPal4/DSA-USING-CPP | queue/arr.cpp | #include<iostream>
using namespace std;
class Node{
public:
vector<int> arr;
int f;
int r;
int ms;
Node(int x){
ms = x;
arr = vector<int>(x);
f = -1;
r = -1;
}
void push(int x){
if(r>=ms){
cout << "overflow condituion" << endl;
... | ALGO | 0.998519 | 3.941535 |
63bddcf8-f6e6-4d49-96af-1a9f458658ce | scnb/Cpp-Primer-Plus-Exercise | 7-2/7-2.cpp | // 7-2.cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int enter(float num[10]);
void average(float num[10], int n);
void show(float num[10], int n);
int main()
{
float val[10];
int n;
n=enter(val);
cout << "ʾ飺" << endl;
show(val,n);
average(val, n);
getchar();
getchar();
getchar... | TOOL | 0.932745 | 3.44395 |
2d217f58-48f4-4cad-af33-cd8ecea677f2 | 21Gun5/XD-jishi-zhenti | 17_b.cpp | #include <iostream>
using namespace std;
/*
findִַСд
touppertolowerдСдתַת
*/
int main()
{
string str; //Ҫַ
int flag, n, i, j;
cin >> str >> flag >> n;
for(i=0; i<n; i++)
{
string strx; //Ӵַ
cin >> strx;
// cout << str << endl <<strx << flag;
if(flag == 1) ... | ALGO | 0.999777 | 3.779944 |
2b6e4998-f9f7-4bec-82da-972b5b0b62cd | eliemichel/OpenMfxForBlender | extern/bullet2/src/BulletDynamics/MLCPSolvers/btLemkeAlgorithm.cpp | #include "btLemkeAlgorithm.h"
#undef BT_DEBUG_OSTREAM
#ifdef BT_DEBUG_OSTREAM
using namespace std;
#endif //BT_DEBUG_OSTREAM
btScalar btMachEps()
{
static bool calculated = false;
static btScalar machEps = btScalar(1.);
if (!calculated)
{
do
{
machEps /= btScalar(2.0);
// If next epsilon yields 1, then... | ALGO | 0.999995 | 3.68928 |
a856ed06-ed0e-42c8-8004-ad9eabc6f88c | shekharkrsingh/LeetcodeWithJava | 0082-remove-duplicates-from-sorted-list-ii/0082-remove-duplicates-from-sorted-list-ii.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* deleteDupli... | ALGO | 0.999961 | 5.761883 |
ca847d63-62ad-4081-b07a-7f7b3f41f543 | CyberBoyAyush/gfg | Difficulty: Medium/Rotate by 90 degree/rotate-by-90-degree.cpp | //{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
/* matrix : given input matrix, you are require
to change it in place without using extra space */
void rotate(vector<vector<int> >& mat) {
// edge case
i... | ALGO | 0.999118 | 6.123221 |
c3b3ae97-0229-413f-b322-dc70e1804551 | kedarnathpc/6Companies30Days | goldman-sachs/Map of Highest Peak.cpp | class Solution {
public:
vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {
int m = isWater.size(), n = isWater[0].size();
vector<vector<int>> heights(m, vector<int>(n, 0));
queue<pair<int ,int>> q;
for (int i=0; i<m; i++) {
for (int j=0; j<n; j++) {
... | ALGO | 0.999985 | 6.063869 |
4b39f75d-ee8b-4e04-8b6e-3dcb89227dca | Icecorn/leetcode | 树/生成二叉树.cpp | // 0代表空节点NULL,树的节点值不能为0
#include <iostream>
#include <vector>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(0), right(0) {}
};
class TreeMethod
{
public:
TreeNode *root;
public:
void CreateTree(vector<int> &val)
{
... | ALGO | 0.99996 | 4.652043 |
70b079a9-6498-4acc-8c3b-2e5234f5bd8f | Anemois/Codeforces | 916_3-F.cpp | //2023/12/21
#include <bits/stdc++.h>
#define Anemoi ios_base::sync_with_stdio(false);cin.tie(0);
#define int long long
using namespace std;
const int MAX = 2e5+10;
vector<int> sz(MAX);
int getsiz(vector<vector<int>>& graph, int p){
int sum=1;
for(auto i : graph[p])
sum += getsiz(graph, i);
return sz[p] = sum... | ALGO | 0.999668 | 4.683584 |
26f6d1f3-a31d-4373-9c50-4a377534025d | Aman345-dot/DSA | dsa lec 13/code1.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void sort01(vector<int>&v){
int n= v.size();
int noo=0;
int noz=0;
for(int i=0;i<n;i++){
if(v[i]==0) noz++;
else noo++;
}
for(int i=0; i<n; i++){
if(i<noz) v[i]=0;
else v[i] =1;
}
}
int main(){
ve... | ALGO | 0.999981 | 3.935362 |
d3d262e5-f5e2-4c4e-813d-05b96429eeeb | hank95179/fa24_ece408_yuhan23-main | Project/project/third_party/eigen/unsupported/doc/examples/MatrixSinh.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXf sinhA = A.sinh();
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
MatrixXf coshA = A.cosh();
std::cout << "cosh(A) = \n"... | ALGO | 0.979592 | 5.894121 |
2dc500c4-8850-4a07-aea8-bd9a57f6bab4 | priyanshisharma01/Solved_Leetcode_Que | 225-implement-stack-using-queues/225-implement-stack-using-queues.cpp | class MyStack {
public:
MyStack() {
}
queue<int> q1;
queue<int> q2;
void push(int x) {
q1.push(x);
}
int pop() {
int ans;
while(q1.size()!=1)
{
q2.push(q1.front());
q1.pop();
}
ans=q1.front();
... | ALGO | 0.99949 | 5.426415 |
31855fe7-93ae-4580-bf9c-44eb92d7a19d | cogotti-giulia/algorithms-and-data-structures | data_structures/trees/binary_trees/random_exercises/09-costo_max_cammino/header.cpp | /**
* @file header.cpp
* @author cogotti-giulia
* @brief implementazione metodi e funzioni
* @version 1.1
* @date 2023-11-29
*/
#include "header.hpp"
#include <algorithm>
#include <unordered_map>
int costo_max_cammino(pnode u) {
if (u == nullptr)
return 0;
else {
return std::max(costo_max_cammino(u->... | ALGO | 0.99993 | 4.353432 |
99f8c516-a750-4e9c-b773-b1bbdd18da32 | freebendy/My-Demos | my-test-codes/copy_constructor2.cpp | #include <iostream>
using namespace std;
class Person
{
public:
Person(char *pN)
{
cout <<"Constructing "<<pN<<endl;
pName=new char (strlen(pN)+1);
if (pName!=0)
{
strcpy(pName,pN);
}
}
Person(const Person& p)
{
cout <<"copying "<<p.pName<<"into its own block\n";
pName=new char [... | TOOL | 0.910685 | 3.834885 |
0738c2c8-729e-4de4-9d4a-3eb64daa8cc7 | MikeGarra/DataStructuresAndAlgorithms | Graphs/graphs.cpp | #include <iostream>
#include <unordered_set>
#include <unordered_map>
using namespace std;
class Graph {
private:
// adj = adjacencyList
unordered_map<string, unordered_set<string> > adjList;
public:
void printGraph() {
for (auto [vertex, edges] : adjList) {
... | ALGO | 0.991123 | 6.338532 |
3f4eb7fd-c758-4d22-b57d-fd6ca209646c | RemainAplomb/Basic-Cpp-Programs-for-Beginners | Basic-Cpp-Programs-for-Beginners/game.cpp | #include <iostream>
#include <cmath>
#include <string>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main ()
{
//-------------------------------------------------------------------------------------------------------------//
string y1 , y2 , n1 , n2 , reply;
y1= "Yes";
y2= "yes";
n1= "No" ;
n2=... | TOOL | 0.94298 | 3.429287 |
65b598f1-7893-4a2f-9a3c-90460547340a | ishandutta2007/codeforces | batman/normal/357/C.cpp | //////////////////////////////////////////////////////////////////
////////////////// Sa1378 Platform Vesion 1.2.7 /////////////////
////////////////////////////////////////////////////////////////
// Yesterday is history...
// Tomorrow is a mystery...
// But Today is a GIFT.
#include <bits/stdc++.h>
using namespace ... | ALGO | 0.999989 | 3.648915 |
5bbcf908-caac-4cc6-af26-cf4fb0a80b82 | silverfoxpt/CFRep | CODE_PROBLEM/MAKE_IT_ROUND.cpp | #include <algorithm>
#include <utility>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <climits>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <random>
#include <cmath>
using namespace... | ALGO | 0.999965 | 4.877572 |
a4b8b98d-1db8-46a9-8422-cd67008003b1 | fhvirus/CodeArchive | TIOJ/1664.cpp | #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma loop_opt(on)
#include<unistd.h>
const int S = 1<<16;
inline char readchar(){
static char buf[S], *p = buf, *q = buf;
return (p==q&&(q=(p=buf)+read(0,buf,S))==buf) ? ... | ALGO | 0.999612 | 3.813074 |
8ae76a32-4f47-4bd0-b8e9-09638de83368 | feanorye/leetcode | 6360.cpp | #include "listnode.h"
#include <algorithm>
#include <corecrt.h>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
using std::cout;
using std::endl;
using std::greater;
using std::map;
usin... | ALGO | 0.999889 | 4.886426 |
3a7232ea-0ec1-4199-aa26-55358504b19d | ishandutta2007/codeforces | cyand1317/normal/837/C.cpp | #include <cstdio>
#include <algorithm>
static const int MAXN = 102;
int n, a, b;
int x[MAXN], y[MAXN];
inline int calc(int r1, int c1, int r2, int c2)
{
if (r1 > a || r2 > a || c1 > b || c2 > b) return 0;
if (r1 + r2 > a && c1 + c2 > b) return 0;
return r1 * c1 + r2 * c2;
}
int main()
{
scanf("%d%d%d... | ALGO | 0.999182 | 3.939119 |
8552735c-f621-40e3-b9f5-33b39d5cdf4a | Narendra-Sivangula/DSA_CPP | PyramidUsingNumbers.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
cout<<i<<" ";
}
cout<<endl;
}
return 0;
} | ALGO | 0.999832 | 4.019327 |
faea5ec3-ec1b-4207-94e6-7f746667f0e4 | whittake/Reta | src/fe3code.cpp | //==================================================================
//// jfindimaxCR
/*
jfindimaxCR: finds node with largest degree.
See man pages for jfindimax.
*/
// [[Rcpp::export]]
SEXP jfindimaxCR( SEXP degree_ptr, SEXP Imax_ptr ) {
IntegerVector deg(degree_ptr) ; // degree
IntegerVector Imax(... | ALGO | 0.999716 | 5.717147 |
e2b564be-5d71-4cbe-9403-813be6d0fbf8 | ishaantiku29/GFG-Problems | Easy/Insert an Element at the Bottom of a Stack/insert-an-element-at-the-bottom-of-a-stack.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
stack<int> insertAtBottom(stack<int> st,int x){
vector<int>v;
while(!st.empty()){
v.push_back(st.top());
st.pop();
}
... | ALGO | 0.999938 | 5.401699 |
3790b94e-965c-4072-a24d-3829070854ad | arpitutkarsh/CPP | nth_fibonacci_recursion.cpp | #include<iostream>
using namespace std;
int fibonacci(int n){
if(n <= 1){
return n;
}
int last = fibonacci(n-1);
int second_last = fibonacci(n-2);
return last + second_last;
}
int main(){
int n;
cout<<"Enter the Number:- "<<endl;
cin >> n;
cout<<fibonacci(n);
return 0;
} | ALGO | 0.999858 | 4.137864 |
5e962d57-67e1-456a-bb4d-9c0a057d4595 | soonsoo3595/algorithm | baekjoon/2193.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
long long d[91][2];
d[1][0] = 0;
d[1][1] = 1;
//길이가 N이고 끝이 0과 1로 나뉘는 경우
for (int i = 2; i <= n; i++)
{
for (int j = 0; j < 2; j++)
{
if (j == 0)
d[i][j] = d[i - 1][0] + d[i - 1][1];
if (j == 1)
d[i][j] = d[i - 1][0];
... | ALGO | 0.999985 | 3.153923 |
5ab51cc2-85ba-45f2-969d-187c78813f80 | jaebaek/llvm-training | lib/CodeGen/StackSlotColoring.cpp | #include "llvm/CodeGen/Passes.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/LiveStackAnalysis.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#in... | ALGO | 0.972383 | 7.814451 |
3543a92e-0de7-490c-89a4-8b9e0fe46b42 | ssfc/PAT | 1111.cpp | #include<algorithm>
#include<climits>
#include<iostream>
#include<vector>
using namespace std;
struct PreviousNode
{
int key;
int next;
vector<int> previous_member;
};
struct OnePath
{
int total_time;
vector<int> path_member;
};
int num_v; // Number of vertices in the graph
vector<int> dist;
vector<bool> sptSet... | ALGO | 0.999858 | 4.263062 |
c01f940b-6894-4cea-8353-fd2d429252a0 | vamichrom/robo_cart | mecanum_drive_controller/src/mecanum_drive_controller.cpp | /**
* @file mecanum_drive_controller.cpp
* @brief Implementation of the ROS 2 controller for mecanum drive mobile robots
*
* This controller implements the kinematics of a mecanum drive robot, converting velocity
* commands into individual wheel velocities while handling different wheel radii and
* providing odom... | TOOL | 0.976031 | 7.249687 |
0f7361d8-b4bb-4c3d-845f-17bbb419945b | abhisheknaw/DS_AND_ALGO_PRACTICE | SORTING/quick_sort.cpp | #include <bits/stdc++.h>
using namespace std;
int partition(int a[],int start,int end)
{
int pivot=a[end];
int pindex=start;
for(int i=start;i<=end-1;i++)
{
if(a[i]<=pivot)
{
swap(a[i],a[pindex]);
pindex++;
}
}
swap(a[pindex],a[end]);
return pindex;
}
void quicksort(int a[],int start,int end)
{
if(s... | ALGO | 0.999955 | 4.653056 |
c6fe5215-d37c-4b74-9e26-23cf72635b5e | UtkarshDandagavhal/DSA-Questions | missing_no.cpp | #include <iostream>
using namespace std;
void getMissingNo(int arr[],int n){
// for(int i=0;i<n;i++){
// int index = abs(arr[i]);
// if(arr[index - 1]>0){
// arr[index - 1] *= -1;
// }
// else {
// ++i;
// }
// }
// // for(int i = 0;i<n;i++){
// // cout<<arr[i]<<" ";
// ... | ALGO | 0.999959 | 3.775671 |
4eb9bf69-b2e7-4173-bfa1-ca54360a5020 | Quattro-Bajeena/Learning-Graphics-Programing | olcPixelGameEngine-master/Videos/OneLoneCoder_PGE_8BitsImProc.cpp | #define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
#include "escapi.h"
int nFrameWidth = 320;
int nFrameHeight = 240;
struct frame
{
float *pixels = nullptr;
frame()
{
pixels = new float[nFrameWidth * nFrameHeight];
}
~frame()
{
delete[] pixels;
}
float get(int x, int y)
{
if (x >= 0 && x ... | TOOL | 0.881439 | 5.892994 |
22e7fdc9-41be-474a-9aa3-cc6f38532b29 | FrankenRomP/android_frameworks_av | media/libstagefright/codecs/amrwb/src/pvamrwbdecoder.cpp | /*
------------------------------------------------------------------------------
Filename: pvamrwbdecoder.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
----------------------------------------------------------------------... | ALGO | 0.998438 | 3.63844 |
b6765ffd-a8c8-4081-aee2-e1bb656f81bf | jatin-codes-sketch/dsa-cpp | Linear-Structure/Arrays/2.sorting/3.insertion_sort.cpp | #include<iostream>
using namespace std;
void insertSort(int arr[],int n){
for(int i=1;i<n;i++){
int curr=arr[i];
int prev=i-1;
while(prev>=0 && arr[prev]>curr){
arr[prev+1]=arr[prev];
prev--;
}
arr[prev+1]=curr;
}
}
void printA... | ALGO | 0.999908 | 5.517151 |
68c87ce2-0d2a-4bf8-a675-dca7eb399e1a | TAMUCrypto/ZKDT_release | ZKDT/depends/libsnark/depends/libfqfft/depends/libff/depends/ate-pairing/test/bench.cpp | #include "zm.h"
#ifndef XBYAK_NO_OP_NAMES
#define XBYAK_NO_OP_NAMES
#endif
#include <xbyak/xbyak.h>
#include <xbyak/xbyak_util.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <iostream>
#define NUM_OF_ARRAY(x) (sizeof(x) / sizeof(*x))
using namespace Xbyak;
const int innerN = 1;
struct Code ... | TEST | 0.981179 | 4.732721 |
dc02fd69-4f54-448f-a398-61fab2103933 | Birdie-Go/Birdie-Code | exkmp.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int nex[maxn],ex[maxn];
void GETNEXT(char *str)
{
int i=0,j,po,len=strlen(str);
nex[0]=len;
while(str[i]==str[i+1] && i+1<len) i++;
nex[1]=i;
po=1;
for (i=2;i<len;i++)
{
if(nex[i-po]+i<nex[po]+po) nex[i]=nex[i-po]... | ALGO | 0.999816 | 4.222586 |
7adaab89-c93b-4bdf-9b1d-1b411d191663 | mathias-meinschad/doubleTrouble | helpers/src/GeneralHelper.cpp | #include "CollisionDetection.hpp"
#include "GeneralHelper.hpp"
void renderCongrats(SDL_Renderer *ren) {
SDL_RenderClear(ren);
SDL_Texture *congratsTexture = loadTexture(ren,
"res/tiles/Other/congrats.bmp");
SDL_Rect textureBox;
SDL_QueryTexture(congratsTex... | TOOL | 0.978657 | 3.217458 |
28cf21ce-c319-421d-9915-96e834be85f9 | raincross7/code-similarity | codes/train_code/problem406/problem406_362.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typen... | ALGO | 0.999995 | 3.983167 |
67d8fe04-542b-4319-a4bc-56a869484fc1 | bhargavi290504/Leetcode | 2958-length-of-longest-subarray-with-at-most-k-frequency/2958-length-of-longest-subarray-with-at-most-k-frequency.cpp | class Solution {
public:
int maxSubarrayLength(vector<int>& nums, int k) {
unordered_map<int, int> count;
int res = 0, i = 0, n = nums.size();
for (int j = 0; j < n; ++j) {
count[nums[j]]++;
while (count[nums[j]] > k)
count[nums[i++]]--;
... | ALGO | 0.999916 | 6.086834 |
783c51c2-d7ec-4984-bfa9-56dd0ef8bb07 | elguneminov/E-Olymp-2 | 2472.cpp | /*
* Author: MURAD HAJIYEV
* Problem: https://www.e-olymp.com/en/problems/2472
* Created on April 13, 2020, 2:27 AM
*/
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, k, operation, src, dest, v;
ci... | ALGO | 0.999888 | 4.683984 |
0cba368d-78ef-4cdd-985b-fb5ed8bd6808 | Abhinavtodmal/LEETCODE | 451-sort-characters-by-frequency/sort-characters-by-frequency.cpp | class Solution {
public:
string frequencySort(string s) {
unordered_map < char ,int> mp;
for(auto letter : s )
{
mp[letter]++;
}
priority_queue<pair<int , char >> pq ;
for(auto it = mp.begin() ; it != mp.end() ; ++it)
{
pq.pus... | ALGO | 0.999968 | 5.944023 |
66f1e7ea-86b9-433d-9139-0d2c4f0b637f | JustALog/CF | Edu-R171/B.cpp | #include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
void solve() {
int X, Y, K;
std::cin >> X >> Y >> K;
int a = std::min(X, Y);
assert(a * a * 2 >= K * K);
std::cout << 0 << " " << 0 << " " << a << " " << a << ... | ALGO | 0.999785 | 4.207263 |
b625b101-bf7e-4016-b9dc-06e43fc5ac41 | pareksha/Data-Structures | data_structures_C++/stack_linked_list.cpp | #include<iostream>
using namespace std;
class LinkedListStack {
private:
struct node {
int data;
struct node* next;
};
struct node* start;
public:
LinkedListStack() {
start = NULL;
}
void push(int value) {
struct n... | ALGO | 0.975448 | 4.784779 |
3eb6a2ca-9800-4c0b-88e0-89437f9c4c11 | Aniket-a14/CPP-DSA | Dsa/stack/stack.cpp | #include<iostream>
using namespace std;
class Stack{
int *arr;
int size;
int top;
public:
bool flag=1;
Stack(int s){
size=s;
top=-1;
arr= new int[s];
}
void push(int value){
if(top==size-1){
cout<<"Stack o... | ALGO | 0.998674 | 4.367585 |
f6cf2afd-16d5-44c9-8a24-98df05439163 | yuika-sama/code-ptit-solutions | C++/Thuc hanh CPP - Buoi 1/Thu-phi-xe-oto.cpp | #include <bits/stdc++.h>
#define faster() {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define endl '\n'
#define precision(x) setprecision(x) << fixed
#define pb push_back
#define ll long long
using namespace std;
struct Vehicle{
string id, type, date, io;
int large;
};
int cost(Vehicle a){
if (a.type =... | ALGO | 0.986592 | 4.362727 |
0fb78c40-eda2-4335-b48d-8ef6d761c614 | Huyen0402/Application-Algorithm | Week 10/CheckBipartiteGraph.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
bool isBipartite(vector<vector<int> >& graph, int N) {
vector<int> colors(N+1, 0);
for (int i = 1; i <= N; i++) {
if (colors[i] == 0) {
queue<int> q;
q.push(i);
colors[i] = 1;
w... | ALGO | 0.999955 | 5.534082 |
2db45034-08f6-45b3-b5f8-244c75f8886b | girish213o5/LeetCode | 0338-counting-bits/0338-counting-bits.cpp | class Solution {
public:
vector<int> countBits(int n) {
vector<int>dp(n+1,0);
int x= 1;
for(int i=1 ; i<=n ; i++)
{
if(x * 2 == i)
x= i;
dp[i] = 1+ dp[i-x];
}
return dp;
}
}; | ALGO | 0.999995 | 6.005819 |
6316c905-d4ac-4b32-9047-54c898f6c6c3 | lwcM/leetcode_solution | 0024-swap-nodes-in-pairs.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
static const auto __=[]{
ios::sync_with_stdio(false);
cin.tie(nullptr);
return nullptr;
}();
class Solution {
public:
ListNode* swapPairs(ListNod... | ALGO | 0.999994 | 5.814275 |
9eb812be-46c2-4413-a4f9-f37d69e73300 | VenkateshBH99/InterviewBit-Solutions | Trees Data Structure/MaxDepthOfABinaryTree.cpp | // https://www.interviewbit.com/problems/max-depth-of-binary-tree/
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
int depth(TreeNode* root){
if(root == NULL){
return ... | ALGO | 0.999705 | 6.128566 |
03ad01c9-e0b5-4c75-9491-39259b8de14c | past12am/dse-quark | src/qcd/QuarkSelfEnergy.cpp | //
// Created by past12am on 04/06/24.
//
#include "../../include/qcd/QuarkSelfEnergy.hpp"
#include "../../include/Definitions.hpp"
#include <cmath>
#include <gsl/gsl_spline.h>
QuarkSelfEnergy::QuarkSelfEnergy(MomentumGrid* p2Grid) : p2Grid(p2Grid)
{
Sigma_A_val_grid = new double[p2Grid->getNumPoints()];
Sig... | ALGO | 0.90148 | 4.243539 |
0463deb1-33b8-45e8-9df4-869def868203 | kaloronahuang/KaloronaCodebase | Contests/NOIp Simultaion 2018/M.cpp | // M.cpp
#include <iostream>
#include <cstdio>
using namespace std;
const int maxn = 810;
#define ll long long
int a[maxn];
int b[maxn];
ll dp[maxn][maxn];
int n;
ll gcd(ll a, ll b)
{
if (a < b)
return gcd(b, a);
return (b == 0) ? a : gcd(b, a % b);
}
void genDP()
{
for (int i = 1; i < n; i++)
... | ALGO | 0.99995 | 3.301953 |
dfbfaaf2-aa49-4c0e-b91c-840f685fbe01 | Jlindhub/cppcourserepos | cpp-211-ISP-OOP/OOP-exercises/Polymorphism/Polymorphism.cpp | #include <algorithm>
#include <iostream>
using namespace std;
template<class Tout, class Tin>
Tout NarrowCast(Tin input)
{
Tout result = static_cast<Tout>(input);
Tin revertCheck = static_cast<Tin>(result);
if(revertCheck!=input){throw 69420;}
return result;
}
template<class T> //generic array sorter ... | ALGO | 0.98122 | 4.803614 |
529cb8c9-e5a4-46dd-b9d3-09961254aa5c | ceezyyy/leetcode | others/cpp/001.Two Sum.cpp | /**
* Source: LeetCode 001.Two Sum
* Author: ceezyyy
* Date: 03-01-2019
*/
/*
Easy
Share
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
Example:
G... | ALGO | 0.999568 | 6.095285 |
d752701a-6458-47b6-982a-30436b4451dc | Alexa1ndra1/untitled3 | 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 |
ffac61e2-bd1f-4e23-8769-18d46cba2857 | Mahbub20/UVA-Solutions | 11185 - Ternary.cpp | #include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
long long t,n,m,i;
long long int ar[1000000],c;
while(scanf("%lld",&n)==1 && n>=0)
{
if(n==0)printf("0");
c = 0;
t = n;
i = 0;
while(n>0)
{
ar[i]= n%3;
c++;
... | ALGO | 0.999973 | 3.616109 |
fe92b1bf-a5e4-4810-8a79-5036e456c887 | raghvenderjha/cpp-dsa | GENERIC TREE ALL PARTS/GENERIC TREE PART 1/GENERIC TREE PART 2/GENERIC TREE PART 3/GENERIC TREE PART 4/GENERIC TREE PART 5/GENERIC TREE PART 6/main.cpp | #include <bits/stdc++.h>
using namespace std;
struct node
{
public:
int data;
vector<node*>children;
};
node*construct(vector<int>A,int n)
{
node*root=NULL;
stack<node*>st;
for(int i=0;i<n;i++)
{
if(A[i]==-1)
{
... | ALGO | 0.999973 | 3.484752 |
72baf872-2852-4035-ac6e-9855d27d9496 | shohansk/codeforces | 160 A. Twins.cpp | #include <iostream>
using namespace std;
int main()
{
int n,a,sum=0,x=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a;
sum+=a;
x=sum/2;
}
}
| ALGO | 0.996826 | 3.023557 |
81a6eaae-0a23-448c-8f0f-1b8cb865ab44 | GaspardQin/OpenCV_3D_Object_Detection | libraries/dlib/include/dlib/test/least_squares.cpp | #include <dlib/optimization.h>
#include "optimization_test_functions.h"
#include <sstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <vector>
#include "../rand.h"
#include "tester.h"
namespace
{
using namespace test;
using namespace dlib;
using namespace std;
using namespace dl... | TEST | 0.90965 | 7.068961 |
18fbbebe-205f-4ebd-a754-8d5584630e4d | ZehuaZhang/cs-fundamentals | data-structure-and-algorithm/cpp/heaters.cpp | // 475. Heaters
// Difficulty: Easy
// Winter is coming!
// Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses.
// Now, you are given positions of houses and heaters on a horizontal line,
// find out minimum radius of heaters so that all houses could be cove... | ALGO | 0.999985 | 5.951064 |
f17f9bcf-8a33-4ae6-af00-f7ead0706889 | ishandutta2007/codeforces | shubham__36/normal/1280/A.cpp | #pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#i... | ALGO | 0.999771 | 4.154938 |
f322bef7-829e-490f-aca9-5120216a662c | yishengzhang/yishengzhang.github.io | cplusplus/SubscriptValidation.cpp | #include <iostream>
#include <stdexcept>
using namespace std;
int at(int index) {
int x[1];
if(index < 1 || index > 5)
throw out_of_range("Index is out of range");
return x[index];
}
int main()
{
int input;
int billy[5]={1,2,3,4,5};
cout<<"Please enter a subscript."<<endl;
cin>>input;
r... | ALGO | 0.958017 | 3.655622 |
2beda03d-531a-4985-968d-ca1b096628d9 | RoboJackets-Software-Training/week-2-programming-exercise-dwen3232 | exercise_2_2/main.cpp | #include <iostream>
#include <regex>
#include <random>
#include "Board.h"
using namespace std;
void generateComputerMove(Board &board, int &r_out, int &c_out) {
static random_device rand_dev;
static default_random_engine engine(rand_dev());
static uniform_int_distribution< int> uniform_dist(0,2);
do {
r_... | ALGO | 0.983039 | 5.724625 |
41f974e1-a3cc-4540-9936-2b030cd61130 | obstaclelamb/OIwiki-temp | docs/misc/code/rollback-mo-algo/rollback-mo-algo_1.cpp | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
using ll = long long;
constexpr int N = 1e5 + 5;
int n, q;
int x[N], t[N], m;
struct Query {
int l, r, id;
} Q[N];
int pos[N], L[N], R[N], sz, tot;
int cnt[N], __cnt[N];
ll ans[N];
bool cmp(const Query& A, const Query& B) {
if (pos[A.... | ALGO | 0.999941 | 4.252765 |
2b821cb6-aea6-4d10-9a11-320dcfcf4c07 | fredhamster/feisty_meow | nucleus/library/structures/checksums.cpp | #include "checksums.h"
#include <basis/definitions.h>
using namespace basis;
namespace structures {
const int HIGHEST_MOD_VALUE = 32014;
unsigned int checksums::bizarre_checksum(const abyte *data, int length)
{
int sum = 0;
for (int i = 0; i < length; i++) sum += data[i] % 23 + i % 9;
sum = (sum % (HIGHEST_M... | ALGO | 0.994729 | 6.125237 |
707da80f-fce6-49d6-a32e-acebb9b0439f | Devang-soni/100DayOfCodeChallenge | Day43.cpp | //35. Search Insert Position
class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int ans;
for(int i=0; i<nums.size(); i++){
if(nums.at(i)==target || nums.at(i)>target)
{
ans = i;
break;
}
}
... | ALGO | 0.999906 | 5.98323 |
059a3f54-0839-4719-a8d6-5613ac2e6621 | ishandutta2007/codeforces | shnirelman/normal/1008/B.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> a(n), b(n);
for(int i = 0; i < n; i++){
cin >> a[i] >> b[i];
if(a[i] < b[i])swap(a[i], b[i]);
}
int last = 1000000013;
bool ans = true;
for(int i = 0;... | ALGO | 0.999989 | 3.802585 |
9d7f27c0-be6a-45e5-8a6f-6d10a47f66e4 | linhnvhdev/Doi_tuyen_quoc_gia | TalinpaReturn/Contestants/Linhnvh/TREEGCD.cpp | #include<bits/stdc++.h>
#define For(i,a,b) for(int i = a;i <= b;i++)
#define Forr(i,a,b) for(int i = a;i >= b;i--)
#define maxn 105
#define ll long long
#define fi first
#define se second
using namespace std;
const int mod = 1e9+7;
int n,m;
vector<int> a[maxn];
int st[maxn],ed[maxn],cnt = 0,ts[maxn];
int ans = 0;
b... | ALGO | 0.999773 | 4.156322 |
a4fddfd1-3422-4506-891d-b854f2a8ea60 | bira37/problem-solving | Codeforces/Official Rounds/486/Div3F.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main(){
int a,n,m;
cin >> a >> n >> m;
int umbrella[a+1];
int w[m+1];
bool rain[a+1];
for(int i=0; i<=a; i++){
umbrella[i] = -1;
rain[i] = false;
}
int dp[a+1][m+1];
for(int i=0; i<=a; i++){
for(int j=0; j<=m;... | ALGO | 0.999803 | 3.850952 |
13f27ac0-f2ee-46f0-ab07-39ee20a7f622 | lakshaycommits/leetcode | 0645-set-mismatch/0645-set-mismatch.cpp | class Solution {
public:
vector<int> findErrorNums(vector<int>& nums) {
int n = nums.size();
vector<int> vis(n + 1, 0);
for(int i = 0; i < n; i++)
vis[nums[i]]++;
vector<int> ans(2, 0);
for(int i = 1; i < n + 1; i++) {
if(vis[i] =... | ALGO | 0.999763 | 5.91541 |
678fb739-bb26-44bd-8bed-a44d0e2bfcec | JaimeWX/Leetcode_CPP | 二叉树/后序遍历/对称二叉树_101.cpp | struct TreeNode
{
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x): val(x), left(nullptr), right(nullptr){};
};
class Solution {
private:
bool compare(TreeNode* left, TreeNode* right)
{
if(left == nullptr && right != nullptr) return false;
else if(left != nullptr && rig... | ALGO | 0.999988 | 6.184245 |
0506324e-caaf-4709-a799-bf92defefa02 | ishandutta2007/codeforces | comet_honeymoon/normal/1408/I.cpp | #include<bits/stdc++.h>
using namespace std;
const int p = 998244353;
const int maxn = 17, maxl = 66000;
struct Z {int x; Z(int x0 = 0) : x(x0) {}};
int inline check(int x) { return x >= p ? x - p : x; }
Z operator +(const Z a, const Z b) { return check(a.x + b.x); }
Z operator -(const Z a, const Z b) { return check(a... | ALGO | 0.999982 | 3.649788 |
0a545019-f9d2-4c1e-8ea6-a39222325415 | Zonezonee/TOI_zero | A1/A1-034.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, res = 1e9;
cin >> n;
while(n--){
int a; cin >> a;
res = min(res, a);
}
cout << res;
} | ALGO | 0.999854 | 4.015079 |
073eac79-a697-4cd8-89cc-efcb7c06a172 | Ivan-71-ua/Competitive-Programming | LeetCode/100292.cpp | #include <bits/stdc++.h>
class Solution {
const int MODULO = 1'000'000'007;
long long binomial_coefficient(int n, int k) {
std::vector<std::vector<long long>> C(n + 1, std::vector<long long>(k + 1, 0));
for (int i = 0; i <= n; ++i) {
for (int j = 0; j <= std::min(i, k); ++j) {
if (j == 0 || i == j) {
C[i... | ALGO | 0.999964 | 5.185348 |
ed54a3be-f027-41da-9c74-224d8273f05e | RAGHIBRIZWAN/CPP | DSA/BT_Qs.cpp | #include <iostream>
#include <queue>
#include <climits>
using namespace std;
class node
{
int data;
node *left;
node *right;
public:
node(int d) : data(d), left(nullptr), right(nullptr) {}
friend class BT;
};
class BT
{
node *root;
int countSubTrees = 0;
public:
BT() : root(nullptr) ... | ALGO | 0.999674 | 6.076612 |
66c58cc9-88c6-4691-b0a1-8ffa2b3d6bca | grimreapermanasvi/leetcode-ms | C++/minimumjumps(gfg).cpp | //THIS is using dp which took O(n^2)tc
/*class Solution {
public:
int minJumps(vector<int>& arr) {
int n=arr.size();
if(n<=1) return 0;
if(arr[0]==0) return -1;
vector<int>dp(n,INT_MAX);
dp[0]=0;
for(int i=1;i<n;i++)
{
for(int j=0;j<i;j... | ALGO | 0.99996 | 5.538777 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.