uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7438e544-974c-4f77-8da8-34a2dc7c5557 | MiguelMottaVilca/AlgebraAbstracta | restoChino/main.cpp | #include <iostream>
#include <vector>
#include "tools.h"
using namespace std;
int restoChino(){
int n ,tem ;
cout <<"Numero de ecuaciones: ";cin >> n;
vector <int> vec ;
for(int i = 0 ; i < n ; i++){
cout << "x = " ;cin >> tem;
vec.push_back(tem);
cout << "mod = ";cin >> te... | ALGO | 0.999791 | 3.570812 |
5d41697f-71c4-4f68-a600-eb9e07dfdd9a | Drethek/Darkpeninsula-Wotlk | dep/g3dlite/source/Box2D.cpp | /**
@file Box.cpp
Box class
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
@created 2001-06-02
@edited 2008-12-27
*/
#include "G3D/Box2D.h"
#include "G3D/CoordinateFrame.h"
#include "G3D/Rect2D.h"
namespace G3D {
bool Box2D::overlaps1Way(const Box2D& other) const {
for (int a = 0; a < 2... | ALGO | 0.902104 | 7.251505 |
5a5487db-4a97-4618-86b4-2a236c882679 | Louyk14/gopt_experiment | duckdb/src/optimizer/in_clause_rewriter.cpp | #include "duckdb/optimizer/in_clause_rewriter.hpp"
#include "duckdb/optimizer/optimizer.hpp"
#include "duckdb/planner/binder.hpp"
#include "duckdb/planner/expression/bound_comparison_expression.hpp"
#include "duckdb/planner/expression/bound_conjunction_expression.hpp"
#include "duckdb/planner/expression/bound_operator_... | TOOL | 0.99061 | 7.820054 |
3a8a20bc-bf9e-44fc-ac9a-d7ad1437f0a5 | Minhvn98/ATBM | Hash_dich_phai.cpp | #include<iostream>
using namespace std;
main(){
string S; char H = 0, Ho;
cout << "Nhap chuoi S : "; getline(cin, S);
for(int i = 0; i < S.size(); i++){
Ho = H;
H = H >> 1;
if(Ho % 2 != 0)
H = H + 128;
H = H ^ S[i];
}
cout << "Ma hash : " << H;
}
| ALGO | 0.999918 | 4.324628 |
a1d3b9a1-0f19-4e24-b0bc-5074d628593b | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_6986_0.cpp | #include <bits/stdc++.h>
using namespace std;
namespace SPFA {
vector<int> to[2005];
vector<int> flow[2005];
vector<int> cost[2005];
vector<int> pair[2005];
int len[2005];
int cap[2005];
int from[2005];
int edge[2005];
int insd[2005];
int F, T;
int Flow, Cost;
void init(int _f, int _t) {
F = _f;
T = _t;
}
void add(... | ALGO | 0.999929 | 3.937776 |
e1294a57-60a0-41b5-bd97-0689c1a43598 | shubham-githb/LeetCode-Accepted-Solutions | product-of-array-except-self/product-of-array-except-self.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int n = nums.size();
vector<int> ans;
if(n<1){
return ans;
}
int product = 1;
for(int i=0;i<n;i++){
product = product*nums[i];
ans.push_ba... | ALGO | 0.999939 | 6.124304 |
c4c269e6-f7b9-4904-bf97-a142a0ec26ae | MeJerry215/learning_repo | leetcode/0301_remove-invalid-parentheses.cpp | #include "common.h"
class Solution {
public:
vector<string> removeInvalidParentheses(string s) {
}
}; | ALGO | 0.999544 | 5.822294 |
11eae39f-a2e5-4127-ac21-d34035aa3a75 | acgessler/blender-assimp | extern/recastnavigation/Recast/Source/RecastArea.cpp | #include <float.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "Recast.h"
#include "RecastAlloc.h"
#include "RecastAssert.h"
/// @par
///
/// Basically, any spans that are closer to a boundary or obstruction than the specified radius
/// are marked... | ALGO | 0.998409 | 4.708177 |
9182eb7f-bbca-4b3c-bd40-39b7ef8acd96 | abhinav4008/cpp | 1to100.cpp | #include <iostream>
using namespace std;
int main(){
int i=1;
while(i<=100){
cout<<i<<" ";
i++;
}
} | TOOL | 0.966187 | 3.297067 |
682a735c-ad3c-49aa-966b-d50cdc8a5181 | xmoezzz/CodeAnalyze | ReactOS-0.4.6/modules/rosapps/applications/explorer-old/utility/utility.cpp | //
// Explorer clone
//
// utility.cpp
//
// Martin Fuchs, 23.07.2003
//
#include <precomp.h>
//#include <shellapi.h>
#include <time.h>
#include <sstream>
DWORD WINAPI Thread::ThreadProc(void* para)
{
Thread* pThis = (Thread*) para;
int ret = pThis->Run();
pThis->_alive = false;
return ret;
}
void Cen... | TOOL | 0.851828 | 4.699418 |
ca55136a-d195-43b6-8f49-2530493c22c6 | salwaaliakbar/Flutter_project2 | project2/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.998352 | 6.76775 |
6b4c3b72-77f8-42e7-ba50-dfef2a7271c9 | prprprpony/oj | cf/731C.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2.28e5;
int c[maxn];
vector<int> g[maxn];
bool vis[maxn];
unordered_map<int,int> cnt;
int mx;
int dfs(int u)
{
vis[u] = true;
int sz = 1;
mx = max(mx, ++cnt[c[u]]);
for (auto v : g[u])
if (!vis[v])
sz += dfs(v);
return sz;
}
int main()
{
int n, m... | ALGO | 0.999972 | 3.746551 |
8fd08e4f-5c76-44bc-bb31-5a5b54b0220a | ruchika-singh/DataStructures | hw1/provided_files/hw1.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
//function dilates pixels at the border of a cluster
void dilation(std::vector<std::string> &grid, char value)
{
std::vector<std::string>grid_copy = grid;//creates copy of original grid
for(int i = 0; i< grid_copy.size(); i++)
{
for(in... | ALGO | 0.929977 | 4.382726 |
22cd76cc-d430-440c-97d8-9867380f6912 | spoilie/SAGA_GIS | saga-gis/src/modules/terrain_analysis/ta_lighting/Visibility_BASE.cpp | /**********************************************************
* Version $Id$
*********************************************************/
//---------------------------------------------------------
///////////////////////////////////////////////////////////
// //
//... | TOOL | 0.9509 | 6.222783 |
33dca887-548b-478f-9afc-8f18fcaf73cf | optozorax/olymp | contests/icpc/acm2014/7.cpp | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <iomanip>
using namespace std;
int result = 0;
int check_count = 0;
void process_first_cube(map<int, int>& prob, vector<int>& cube1, vector<int>& cube2, int pos);
void process_second_cube(map<int, int>& prob, vector<int>& cube1, vector... | ALGO | 0.999821 | 3.989124 |
6d4e4ea8-2466-45e7-b56a-b283db95cff2 | MakinoRuki/Codeforces | ER109/1525D.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <cmath>
#include <queue>
#include <time.h>
#define eps 1e-7
#define M 52
#define N 5002
#define SZ 200000002
using nam... | ALGO | 0.999905 | 3.612229 |
1e750b7b-ede9-40c1-95e6-e20cf019fe49 | doobee98/Algorithm | Baekjoon/b1654.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <climits>
#include <cmath>
#include <cstring>
using namespace std;
#define endl "\n"
#define ends " "
#define mk_p(x,y) make_pair((x), (y))
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ty... | ALGO | 0.999973 | 3.844969 |
f51a35f2-5698-4ef3-a699-32265d514b71 | Gian-Laager/acMandelbrotSet | deps/boost/libs/geometry/doc/src/examples/algorithms/discrete_hausdorff_distance.cpp | //[discrete_hausdorff_distance
//` Calculate Similarity between two geometries as the discrete hasdorff distance between them.
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/linestring.hpp>
int main()
{
typedef boost::geomet... | ALGO | 0.998989 | 7.173279 |
4ecda8c8-5061-4878-bcca-419b0066e3a6 | norab7/game_engine_2 | AI_Boid.cpp | #include "AI_Boid.h"
AI_Boid::AI_Boid(const std::vector<GameObject*>* boids) : BOIDS_(boids) {
glm::vec3 way(WAYPOINTS_[0]);
}
AI_Boid::AI_Boid(const std::vector<GameObject*>* boids, std::vector<glm::vec3> waypoints) : BOIDS_(boids), WAYPOINTS_(waypoints) {
glm::vec3 way(WAYPOINTS_[0]);
}
void AI_Boid::update(GameO... | ALGO | 0.960555 | 5.366417 |
7b88dfbf-7eaf-409d-ad00-5013365dfea4 | iwankoTG/udacity | p06_CarND-Kidnapped-Vehicle/src/main.cpp | #include <math.h>
#include <uWS/uWS.h>
#include <iostream>
#include <string>
#include "json.hpp"
#include "particle_filter.h"
// for convenience
using nlohmann::json;
using std::string;
using std::vector;
// Checks if the SocketIO event has JSON data.
// If there is data the JSON object in string format will be retur... | WEB | 0.863834 | 6.040919 |
302c6a35-c1ba-4ac0-ad45-a4ad9a34e28e | roatis2/Computer-Science-Data-Structures | mp7/dsets.cpp | /* Your code here! */
#include <vector>
#include "dsets.h"
/*Creates n unconnected root nodes at the end of the vector*/
void DisjointSets::addelements(int num)
{
for(int i = 0; i < num; i++)
dSets.push_back(-1);
return;
}
/*This function should compress paths and works as described in lecture*/
int DisjointSe... | ALGO | 0.998506 | 4.29692 |
d467b3d6-973b-4adb-9651-10ae55a7d344 | piyanshu/C-Implementations | OOPS 3/9_friend_func/2_program.cpp | /*
ALGORITHM
Name: Piyanshu Mangla
Reg no: 201900008
1. Start
2. A class named Twovalues is declared
a. default constructor->Twovalues is called
b. Declare class Min_Max as friend of Twovalues
3. A class named Min_Max is declared
a. Minimum and Maximum operation is done inside find(Twovalues const & t) func
4. In m... | ALGO | 0.998814 | 5.047231 |
49edc31d-d453-4ddb-882a-c8dff24bdd5a | changicho/prepare-algorithm-contest | week51~100/week54/onlyhim/2771.cpp | int n;
int go(vector<int>& v1, vector<int>& v2, vector<vector<int>>& dp, int cur, int stat) {
if (cur > n - 1) return 0;
int& ret = dp[cur][stat];
if (ret != -1) return ret;
ret = 0;
if (stat == 0) {
ret = max(ret, go(v1, v2, dp, cur + 1, 0));
ret = max(ret, go(v1, v2, dp, cur + 1,... | ALGO | 0.999993 | 5.315854 |
1b056ea5-ee50-4f33-9872-9fa518e62037 | msoni6620/-CrackYourPlacement | Linked List/cycle detection.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
ListNode *temp=head;
ListNode *fast=head;
ListNode *prev=head;
while... | ALGO | 0.999899 | 5.175465 |
ca934503-28a6-4567-9fcd-50d9427241a4 | ishandutta2007/codeforces | sd0061/normal/1578/M.cpp | fun main(args: Array<String>) {
val t = readLine()!!.toInt()
for (case in 1..t) {
var n = readLine()!!.toInt()
var a = readLine()!!.split(" ").map {x -> x.toInt()}
var found = false
for (i in 1..n-2) {
if (a[i] != a[i - 1] && a[i] != a[i + 1]) {
printl... | ALGO | 0.955721 | 3.428632 |
c2d550df-0c67-4c99-8242-1a3619dde187 | chars32/flutter_sideguide | 7.Budget tracker/budject_tracker_project/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.997878 | 6.785645 |
6b8ec23e-d070-4926-b6b9-811d355940a5 | QilongZhang/leetcode | Search_a_2D_Matrix.cpp | /*************************************************************************
> File Name: Search_a_2D_Matrix.cpp
> Author: QilongZhang
> Mail: <EMAIL>
> Created Time: 2014年11月14日 星期五 00时30分41秒
************************************************************************/
#include <iostream>
#include <vector>
using name... | ALGO | 0.999907 | 5.282588 |
7256ae6d-4b7d-4003-97da-34da83b1fb13 | ame-ba1/airflow_hw | venv/lib/python3.10/site-packages/greenlet/PyModule.cpp | #ifndef PY_MODULE_CPP
#define PY_MODULE_CPP
#include "greenlet_internal.hpp"
#include "TGreenletGlobals.cpp"
#include "TMainGreenlet.cpp"
#include "TThreadStateDestroy.cpp"
using greenlet::LockGuard;
using greenlet::ThreadState;
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored... | TOOL | 0.854624 | 7.002011 |
18ad3068-96ad-4440-a75c-4a355b85e819 | microsoft/ExeCoder | evaluation/evaluator/execution_based/transcoder_template/cpp/STRING_CONTAINING_FIRST_LETTER_EVERY_WORD_GIVEN_STRING_SPACES.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
string f_gold ( string str ) {
string result = "";
bool v = true;
for ( int i = 0;
i < str . length ( );
i ++ ) {
if ( str [ i ] == ' ' ) v = true;... | ALGO | 0.990347 | 4.792683 |
9966732a-c676-44ab-8f2f-d4c71c323cc1 | Youngerjesus/C-or-C- | Maze.cpp | // Robot Project
// 2차원 배열로 표현한다 0은 길 1은 벽을 의미한다 .
// why 2배씩 하는 걸까 왜 2배씩 해놓은걸까
// 6이면 down과 left
// 15면 up right down left 4가지 모두를 넣기위해
// 미로를 그릴때 사용하는거같다
// 미로그리기 OR연산으로 더하는것 되게 참신하네 그냥 더하는것도
// 될텐데
enum {
UP =1,
RIGHT =2,
DOWN = 4,
LEFT = 8,
};
int CMaze::GetShape(int x, int y) {
int s... | ALGO | 0.999651 | 4.263022 |
ab9ceaa8-0571-4cc3-942f-2f76b455a0e7 | hi-anusha/-CrackYourPlacement- | 1038-binary-search-tree-to-greater-sum-tree/1038-binary-search-tree-to-greater-sum-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999807 | 4.919351 |
1660c244-e83c-4c7a-ba02-29f423744d47 | Rezuanul-Islam-Fahim/Competitive-Programming-Codes | CodeForces/A/Parity.cpp | /*
******
****** https://codeforces.com/contest/1110/problem/A
******
*/
/**
** @Author: Rezuanul Islam Fahim
** Date Created: 08/02/2019
**/
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int ar[MAXN];
int main()
{
int b, k;
cin >> b >> k;
for (int i = 0; i < k; i++)
{
... | ALGO | 0.999992 | 4.137768 |
bc446ddc-049e-464d-a26a-121c3e41c365 | chungen04/NTU-DSP-2022 | hw3/hw3_b09901027/src/mydisambig.cpp | #include <stdio.h>
#include "Ngram.h"
#include <map>
#include <string.h>
#include <vector>
#include <utility>
#define maxWordsPerLine 5000
typedef struct node{
const char* ch;
double log_prob;
int prior; // prior saves which decision it chose in Viterbi
}node;
// Get P(W2 | W1) -- bigram
double getBigra... | ALGO | 0.999544 | 5.484662 |
a8cae9b6-0f67-4c07-8d93-c20e45f03f78 | arad4228/TLS_coding | Classical Symmetric Key Cipher/MonoalphabeticCipher/Mono-alphbeticCipher.cpp | #include <iostream>
#include <string>
#include<unordered_map>
using namespace std;
unordered_map<char,char> hashMap;
string Mono_Encrypt(string msg)
{
string ciphertext;
for(int i=0; i<msg.size(); i++)
{
ciphertext.push_back(hashMap[msg[i]]);
}
return ciphertext;
}
string Mono_Decrypt(string msg)
{
... | ALGO | 0.999886 | 5.035605 |
128e2e2d-18d6-429d-b785-e9faef1f4ec7 | cls1277/OnlineJudge-Codes | summer/contest/Ee.cpp | #include<cstdlib>
#include<cstdio>
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
const int maxn=300005;
struct shu
{
int x,y;
long long w;
friend bool operator <(shu a,shu b)
{
return a.y<b.y;
}
}a[maxn];
int b[maxn];
map<int,int>mp;
map<int,int>::iterator it;
lo... | ALGO | 0.999882 | 3.439645 |
30254782-3e72-477b-a05b-8a93208804f1 | Vansh-22f300/Dsa | L17_Trees/15_nodeatdistance_k.cpp | #include <bits/stdc++.h>
using namespace std;
class node
{
public:
int data;
node *left;
node *right;
node(int d)
{
data = d;
left = NULL;
right = NULL;
}
};
node *buildtree()
{
int data;
cin >> data;
if (data == -1)
return NULL;
node *root = ne... | ALGO | 0.999985 | 3.949327 |
d5b047b1-ed8e-4279-8284-a9615f8f2ed3 | ishandutta2007/codeforces | hir180/normal/381/E.cpp | //Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typede... | ALGO | 0.999915 | 3.562802 |
d558b8d1-6504-4805-827b-4aa4ffa4ed02 | fafa1899/BuildCppDependency | Source/geos-3.12.2/src/planargraph/DirectedEdge.cpp | #include <geos/planargraph/DirectedEdge.h>
#include <geos/planargraph/Node.h>
#include <geos/geom/Quadrant.h>
#include <geos/algorithm/Orientation.h>
#include <cmath>
#include <sstream>
#include <vector>
#include <typeinfo>
using namespace geos::geom;
namespace geos {
namespace planargraph {
/*public*/
void
Directe... | ALGO | 0.91471 | 6.311455 |
081775d6-1c20-4162-8f8a-4537e1b68b16 | Garyxud/Raspbian-ROS-Source | src/image_common/camera_calibration_parsers/src/parse.cpp | #include "camera_calibration_parsers/parse.h"
#include "camera_calibration_parsers/parse_ini.h"
#include "camera_calibration_parsers/parse_yml.h"
#include <boost/algorithm/string/predicate.hpp>
namespace camera_calibration_parsers {
bool writeCalibration(const std::string& file_name, const std::string& camera_name,
... | TOOL | 0.883061 | 6.946218 |
b7ba169d-f61f-41fd-95d2-cdbbcf5099d7 | LiuXiaoWen1234/.leetcode | 225.用队列实现栈.cpp | /*
* @lc app=leetcode.cn id=225 lang=cpp
*
* [225] 用队列实现栈
*/
// @lc code=start
class MyStack {
public:
queue<int> que1;
queue<int> que2;//备用队列
MyStack() {
}
void push(int x) {
que1.push(x);
}
//弹出最顶层元素
int pop() {
int size = que1.size();
int temp;
... | ALGO | 0.999615 | 6.18717 |
e6660b12-cc54-43d0-a915-301dae15f78b | JustinD85/BullCowGame | BullCowGame/main.cpp | /*
This is the console executable, that makes use of the BullCow class
This acts as the view in MVC pattern, and is responsible for all
user interaction. For game logic see FBullCowGame class.
*/
#include <iostream>
#include <string>
#include "FBullCowGame.h"
//To make code Unreal *friendly*
using FText = std::string;... | TOOL | 0.852097 | 6.380129 |
4f5a66fb-b96d-4705-abeb-c27c632cdef8 | Tamekhanh/A_Simple_Shoes_Shop_Flutter | 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 |
2f072933-132c-4877-8df7-f04f28d938f9 | prateeksharma21/Competitive-Programming | Contest/Codeforces/Codeforces Round #694/a.cpp | #ifdef Prateek
#include "Prateek.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define int ll
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + ... | ALGO | 0.999553 | 3.536695 |
8274f21f-47f6-48a2-84cf-1a507b8e1563 | xxxAnn/Snayai | src/player.cpp | #include "snayai.hpp"
std::pair<int, int> snayai::controller::Controller::poll(snayai::grid::Grid grid, sf::RenderWindow &win, std::shared_ptr<snayai::net::Net> net, snayai::snake::Snake &snake) {
return std::make_pair(0, 1);
}
std::pair<int, int> snayai::controller::Player::poll(snayai::grid::Grid _, sf::RenderW... | ALGO | 0.986891 | 5.817824 |
213db391-c527-4eb3-8c13-7c2be205af1a | alittlekitten/AlgorithmStack | Baekjoon/Cpp/Hash/B4_28074_모비스.cpp | #include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// 28074 모비스
// 해시, 문자열
string s;
map<char, int> m;
cin >> s;
for (int i = 0; i < s.size(); ++i) {
if (m[s[i]]) ++m[s[i]];
else m[s[i]] = 1;
}
if (m['M... | ALGO | 0.99958 | 3.966982 |
ca61de40-cb20-480a-9e46-cd8f5966e3bc | ishandutta2007/codeforces | zx2003/normal/901/C.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=600005;
typedef long long ll;
inline void putl(ll x){
if(x){
static int buf[30],xb;
for(xb=0;x;x/=10)buf[++xb]=x%10;
for(;xb;)putchar(buf[xb--]|48);
}else putchar('0');putchar('\n');
}
inline void read(int&x){
char c=getchar();
for(x=0;!isdigit(c);c=get... | ALGO | 0.999896 | 3.921272 |
229aaf0f-fc9e-453c-85d7-a5f18f7c9d4b | Wajahat-Ahmed-NED/DSA-Problems | DataStructures-Algorithms-master/Leetcode Top Interview Questions/solutions/Plus One.cpp | /*
Plus One
========
Given a non-empty array of digits representing a non-negative integer, increment one to the integer.
The digits are stored such that the most significant digit is at the head of the list, and each element in the array contains a single digit.
You may assume the integer does not contain any leadi... | ALGO | 0.999858 | 6.854595 |
89fbe786-ca25-41f1-9f26-b277e425f956 | Arman11217/CP-Code | codeforces/problemset/A_George_and_Accommodation.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int p,q;
int count=0;
for(int i=0;i<n;i++){
cin>>p>>q;
if(p!=q && (p+1)!=q){
count++;
}
}
cout<<count<<endl;
} | ALGO | 0.999323 | 3.326563 |
d97b70da-2a4d-485c-a28c-4dc77199060a | salmaelbarbori/Problem-Solving-with-CPP | leetcode/intersection of an array.cpp | class Solution {
public:
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
sort(nums1.begin(), nums1.end());
sort(nums2.begin(), nums2.end());
vector<int> result;
for(auto i = 0; i < nums1.size(); i++)
{
for(auto j = 0; j < nums2.size(); j++)
... | ALGO | 0.999988 | 5.492788 |
f1dfe91f-2e69-459f-8827-110d1257f0db | Subodhk305/cpp_practiced_codes | cppcodesgit3/tr.cpp | #include<iostream>
using namespace std;
struct node {
int data;
struct node*left,*right;
};
struct node*create() {
struct node*newnode;
newnode=(struct node*)malloc(sizeof(struct node));
int a;
cout << "enter data(-1 if absent):"<< endl;
cin>>a;
if(a==-1) {
return 0;
}
... | ALGO | 0.999367 | 4.166465 |
5ded9227-9633-48fa-a03f-7e0734965476 | shixuan/fucking-leetcode | Tree/0173_Binary Search Tree Iterator.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.999816 | 6.695449 |
1196b2b2-2977-4160-b6e0-39d3281f73d0 | YuChiehLiu/ParallePrograming | HW2/part2/main.cpp | #include <stdio.h>
#include <algorithm>
#include <getopt.h>
#include "CycleTimer.h"
extern void mandelbrotSerial(
float x0, float y0, float x1, float y1,
int width, int height,
int startRow, int numRows,
int maxIterations,
int output[]);
extern void mandelbrotThread(
int numThreads,
float... | ALGO | 0.990102 | 5.322778 |
968acd29-ad74-43c0-8d92-1ca25bf54571 | ishandutta2007/codeforces | skydogli/normal/1517/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
int read(){
int a=0,fh=1;char c=getchar();
while(c>'9'||c<'0'){if(c=='-')fh=-1;c=getchar();}
while('0'<=c&&c<='9'){
a=a*10+c-48;
c=getchar();
}
return a*fh;
}
#define MN 505
#define pii pair<int,int>
#define mp make_pair
#define x first
#define... | ALGO | 0.999942 | 3.276393 |
3e6e4999-af6a-4243-999a-71e6b55a7431 | YashMundankar/Leetcode | 530-minimum-absolute-difference-in-bst/530-minimum-absolute-difference-in-bst.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.99998 | 6.608488 |
45610ba1-1e06-44d3-9309-e6b40dc537c5 | eqeq1090/Unreal-Engine-4.26-Private-Version | Engine/Plugins/Experimental/ControlRig/Source/ControlRig/Private/Units/Hierarchy/RigUnit_SetSpaceTransform.cpp | #include "RigUnit_SetSpaceTransform.h"
#include "Units/RigUnitContext.h"
#include "Math/ControlRigMathLibrary.h"
FRigUnit_SetSpaceTransform_Execute()
{
DECLARE_SCOPE_HIERARCHICAL_COUNTER_RIGUNIT()
FRigSpaceHierarchy* Hierarchy = ExecuteContext.GetSpaces();
if (Hierarchy)
{
switch (Context.State)
{
case E... | TOOL | 0.922853 | 6.125813 |
6ea84c39-ed88-4c72-9904-a4d1d1ae3f7b | raincross7/code-similarity | codes/train_code/problem419/problem419_327.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
const long long INF = 1LL << 60;
int main(){
string S;
cin>>S;
int ans=10000;
for(int i=0; i<S.size(... | ALGO | 0.999547 | 3.764262 |
f2a71c1f-448d-413a-b548-2b3f9ab81306 | Jadsnparadise/hangman-game | Forca.cpp | #include "Forca.hpp"
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
//-------- Construtor --------
Forca::Forca( string palavras, string scores ){
m_arquivo_palavras = palavras;
m_arquivo_palavras = scores;
m_tentativas_restante... | TOOL | 0.915419 | 3.932643 |
b7e2fe87-2d38-477a-8038-6cc7b2f44164 | Jak57/academic-courses-cse-sust | CSE374_Computer Graphics Lab/Lab Class/dda_line_drawing_algorithm.cpp | /**
@author: jakir
Topic: DDA Algorithm
(26-10-22)
*/
#include<bits/stdc++.h>
using namespace std;
void plotLine(double x0, double y0, double x1, double y1)
{
double dx, dy, x, y, step;
int i, j;
dx = x1 - x0;
dy = y1 - y0;
if (abs(dx) >= abs(dy))
step = abs(dx);
else
step = a... | ALGO | 0.999207 | 3.325309 |
dfbbef77-91a2-400d-b422-f490779d1ed5 | Pradeep772/OWL_CODING | 2163-kth-distinct-string-in-an-array/kth-distinct-string-in-an-array.cpp | #include<bits/stdc++.h>
class Solution {
public:
string kthDistinct(vector<string>& arr, int k) {
unordered_map<string, int>mp;
for(auto it: arr){
mp[it]++;
}
for(auto it: arr){
if(mp[it]==1){
k--;
}
if(k==0){
... | ALGO | 0.999885 | 5.389197 |
86df0fc3-686c-4c79-b190-f4aff47a969a | Aledo-Jun/BOJ | MyAnswers/16903.cpp | //
// Created by june0 on 2024-03-18.
//
#include <bits/stdc++.h>
#include <bits/extc++.h>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define endl '\n'
using namespace std;
using namespace __gnu_cxx;
using ll [[maybe_unused]] = long long;
using ull [[maybe_unused]] = unsigned long long;
us... | ALGO | 0.999586 | 6.333817 |
e52ce915-b935-4c94-99ef-e1b98f458983 | RunAtTekky/cpp | ACD/1200/1736B.cpp | /*
RunAt - grey
*/
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
#define ll long long
#define printnl(a) cout << a << "\n";
ll getLCM(ll a, ll b) {
ll g = std::gcd(a,b);
return (a*b)/g;
}
void solve() {
ll n;
cin >> n;
vector<ll> a(n+2,1);
for (int i=1; i<... | ALGO | 0.999922 | 4.351312 |
4da1f102-8642-4de6-ae3a-27dbb2bf6a2d | kajiyan/artHackDay | of_v0.8.3_osx_release/examples/3d/advanced3dExample/src/Swarm.cpp | #include "Swarm.h"
// This 'swarm' object demonstrates a simple particle system
// with 'simple harmonic motion'
swarm::swarm(){
light.setAmbientColor(ofColor(0, 0, 0));
}
void swarm::init(int nParticles, float positionDispersion, float velocityDispersion){
// Check if we've already initialised
if(particles.siz... | ALGO | 0.977155 | 4.491908 |
0e03ae4a-3c67-4345-8b41-63c5ee27c268 | mir183/CodeForces | 594Perform the Combo/m.cpp | //#include<bits/stdc++.h> //Uncomment while submitting
#include <iostream>
#include <deque>
#include <algorithm>
using namespace std;
#define ll long long int
#define ld long double
#define endl '\n'
#define MIR183_Mac ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define yes cout << "YES" << endl
#... | ALGO | 0.999886 | 4.345305 |
b17ae0bc-a978-435e-bb27-bf506cea2ed5 | Sriguru95/Jeu-de-dames | Safari/testGPT.cpp | #include <iostream>
#include <vector>
#include <iomanip>
const int BOARD_SIZE = 8;
class Board {
private:
char board[BOARD_SIZE][BOARD_SIZE];
bool barriers[BOARD_SIZE - 1][BOARD_SIZE][4]; // 0: haut, 1: gauche, 2: bas, 3: droite
public:
Board() {
initializeBoard();
initializeBarriers();
... | ALGO | 0.970537 | 6.292721 |
864a7f5d-549a-4cd1-8fc8-4f3450c74178 | tuananhbk1998/expander | http/libs_ubuntu/lib_boost-1.78.0/libs/compute/example/opencl_test.cpp | // See boost/compute/detail/diagnostic.hpp
// GCC
#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
#define BOOST_COMPUTE_GCC_DIAG_STR(s) #s
#define BOOST_COMPUTE_GCC_DIAG_JOINSTR(x,y) BOOST_COMPUTE_GCC_DIAG_STR(x ## y)
# define BOOST_COMPUTE_GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
# define BOOST_COMPUTE_GCC_DIAG_PRAGMA(x) BOO... | TEST | 0.900843 | 5.650614 |
d0b11410-8a46-4d7a-a748-42fed75e66d8 | hitonanode/cplib-cpp | other_algorithms/test/permutation_tree.yuki1720.test.cpp | #define PROBLEM "https://yukicoder.me/problems/no/1720"
#include "../permutation_tree.hpp"
#include "../../modint.hpp"
#include <iostream>
using mint = ModInt<998244353>;
using namespace std;
int N, K;
permutation_tree tree;
vector<vector<mint>> dp;
void rec(int now) {
const auto &v = tree.nodes[now];
if (v.... | ALGO | 0.999902 | 4.601421 |
47137a3f-3ca5-4005-bfd1-e73d81213223 | archishmanghos/DSA-Functions | Graphs/Finding-MST-Using-Prims-Algo.cpp | /*Pick the key with the minimum value from the minimum heap, which is not in the MST
and include the node with the min key in the MST. Now, traverse through the adjacent nodes
of the node found and if the adjacent node is not in the MST, compare the key of the node
and the weight of the edge now. Take the minimum and p... | ALGO | 0.999986 | 5.378243 |
17df08d9-7197-4cd1-9926-20ebccb5ca63 | sesiria/Algs | cp4/ex4_34.cpp | /*
* Exercise 4.34
* Author: sesiria 2018
* generate random binary search tree
* time complexity O(NlogN)
*/
#include "../Lib/randomize.h"
#include <algorithm>
#include <iostream>
#include <ostream>
#include <time.h>
#include <vector>
template <typename Comparable>
struct BinaryNode
{
Comparable element;
... | ALGO | 0.99958 | 6.031108 |
14d4a53b-eb98-4314-b3c3-63b55f226d88 | debajitdeb11/cpp-code-practice | recursion/src3.cpp | // Program to find the element on the i-th index (Using Recursive Method)
#include <iostream>
using namespace std;
int factorial(int n){
if(n == 0 || n == 1)
return n;
return (factorial(n-1)+factorial(n-2));
}
int main(){
int n;
printf("Enter the value of n\n");
cin >> n;
cout << ... | ALGO | 0.999965 | 5.207585 |
1c203e6d-7dc5-454d-8b3a-2ef77eb378ce | minhhai205/DSA_23020055_NguyenMinhHai | src/Week6/priority_queue.cpp | #include "priority_queue.h"
#include <iostream>
PriorityQueue::PriorityQueue(int n) { heap = MinHeap(n); }
void PriorityQueue::push(int val) { heap.insertKey(val); }
void PriorityQueue::pop() { heap.deleteKey(heap.size() - 1); }
int PriorityQueue::top() { return heap.getMin(); }
int PriorityQueue::size() { return ... | ALGO | 0.970917 | 4.503204 |
4c24e39b-389e-430d-b615-2f362de3a589 | harshkhandelwal97/Scheduling-Simulator-app | extra/sort.cpp | #include <iostream>
#include <vector>
#include <algorithm>
int main() {
std::vector<std::pair<int, int>> vec = {{3, 4}, {2, 3}, {3, 2}, {1, 5}, {2, 2}};
// Sort the vector of pairs
std::sort(vec.begin(), vec.end());
// Print the sorted vector
for (const auto& p : vec) {
std::cout << "... | ALGO | 0.999965 | 6.117528 |
92d27de0-f960-4a8c-bce1-f8cf540b0a5f | yipu3/algorithm-practice | ST2014/9/e.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<algorithm>
#include<vector>
#include<stack>
#include<set>
#include<queue>
#include<map>
#include<cmath>
#include<sstream>
#include<string>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int c... | ALGO | 0.999706 | 3.574499 |
6b7cbfdc-3a1d-43b9-9342-0376ecb44ace | Magnetic-Gravity/Data-Structures-Algorithms-Using-C- | Number System/DecimalToHexadecimal.cpp | #include <bits/stdc++.h>
using namespace std;
string DecimalToHexadecimal(int n)
{
int x = 1;
string ans = "";
while (x <= n)
x *= 16;
x /= 16;
while(x>0)
{
int lastdigit = n/x;
n -= lastdigit * x;
x /= 16;
if(lastdigit <= 9)
... | ALGO | 0.999622 | 5.664901 |
055986c8-1106-47af-ac2c-e64e676e9281 | Azderica/Study-Algorithm | baekjoon/14502.cpp | #include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
#define MAX 8
int dx[4] = { -1, 1, 0, 0 };
int dy[4] = { 0, 0, -1, 1 };
int n, m;
int lab[MAX][MAX], tmp[MAX][MAX], result;
void bfs() {
int after_lab[MAX][MAX];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
after_lab[i... | ALGO | 0.99966 | 3.749907 |
d77bbcc8-4563-4ff8-bf8d-3a7b3ec858a6 | ishandutta2007/codeforces | wasa855/normal/1320/D.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
#define ll long long
inline int read()
{
char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
int ans=0; while(isd... | ALGO | 0.999957 | 3.613099 |
9b0a5172-8ddf-450e-b7a1-91ffcd5a397b | taskflow/taskflow | benchmarks/mnist/omp.cpp | #include "dnn.hpp"
#include <omp.h>
void run_omp(MNIST& D, unsigned num_threads) {
// Create a task flow graph
const auto iter_num = D.images.rows()/D.batch_size;
const auto num_storage = num_threads;
// number of concurrent shuffle tasks
const auto num_par_shf = std::min(num_storage, D.epoch);
std::vect... | ALGO | 0.984297 | 5.215703 |
755ec29a-c2b6-45ce-9266-17c9f06957c8 | Elinmaculado/Homeworks_MiguelRuiz | Homeworrks_MiguelRuiz.cpp | #include <iostream>
#include <windows.h>
#include <vector>
#include <algorithm>
using namespace std;
void tarea1();
void tarea2();
void tarea3();
void tarea3_5();
int main()
{
int excercise;
cout << "elija la tarea a ver: " << endl;
cout << "1. Tarea 1: ejercicios" << endl;
cout << "2. Tarea 2: pied... | ALGO | 0.986573 | 3.273442 |
ca9a8230-68d2-433b-93f8-52f31692d734 | snap-stanford/snap-dev | examples/agmfit/agmfitmain.cpp | // agmfitmain.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "agm.h"
#include "agmfit.h"
int main(int argc, char* argv[]) {
Env = TEnv(argc, argv, TNotify::StdNotify);
Env.PrepArgs(TStr::Fmt("cpm. build: %s, %s. Time: %s", __TIME__, __DATE__, TExeTm::GetCurTm()));
TExeTm... | ALGO | 0.990468 | 5.561523 |
5d81fb86-53b9-465a-ad9a-6ade0166ea14 | captaink3nway/hackerrank_problems | min-max sum/solution.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
long minSum(vector<int> arr){
long sum=0;
for(int i=0;i<arr.size()-1;i++){
sum=sum+arr[i];
}
return sum;
}
long maxSum(vector<int> arr){
long sum=0;
for(int i=1;i<arr.size();i++)
sum=sum+arr[i];
ret... | ALGO | 0.999962 | 4.5037 |
b5deeaeb-f584-41d7-8137-7ac9a5c9e408 | anveshi/Competitive-Programming | spoj/MATSUM/MATSUM-15589556.cpp | #include <bits/stdc++.h>
using namespace std;
const int Maxn = 1<<11;
int Arr[Maxn][Maxn];
int tree[Maxn][Maxn];
void updatey(int x,int y,int Val){
while(y<Maxn){
tree[x][y] += Val;
y += y&-y;
}
}
void update(int x,int y,int Val){
while(x<Maxn){
updatey(x,y,Val);
x += x&-x;
}
}
int ready(int x... | ALGO | 0.999496 | 4.29307 |
4bafba0e-4efe-4e1a-a0e2-d07da1758aec | peter9378/algorithm_study | 210515boj/15727.cpp | /**
* BOJ
* No.15727 Ϸµ
* @author peter9378
* @date 2021.05.15
*/
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <map>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <cstring>
#include <iterator>
#in... | ALGO | 0.999832 | 3.670194 |
946379f4-2ecd-4b0d-b87a-61f261a89ac5 | gofreelee/jerry_mnn_benchmark | source/geometry/GeometryComputer.cpp | #include <mutex>
#include "geometry/GeometryComputer.hpp"
#include "core/Backend.hpp"
#include "core/OpCommonUtils.hpp"
#include "shape/SizeComputer.hpp"
#include "core/TensorUtils.hpp"
namespace MNN {
GeometryComputer::Context::~Context() {
for (auto& iter : mConstTensors) {
for (auto& t : iter.second) {
... | TOOL | 0.877765 | 7.10224 |
614b444c-6c8a-4db0-9ce4-b3e1039bc0f1 | Hima0X2/codeforces | 1586A.cpp | /// BISMILLAHIR RAHMANIR RAHIM
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
const int mx = 1e6+123;
bitset<mx> is_prime;
v... | ALGO | 0.999595 | 3.446864 |
b13017d5-09af-4059-b97d-0ef153c5013e | ishandutta2007/codeforces | gary/normal/499/D.cpp | /*######################################################################
!
dfs or bfs
c[i]
long long
dp
:AABAB
>=0
double> printf("%lf")6%.16lf
dpg
n8
find if(l>=b||r<=a) return 0x3f3f3f3f; if(r<=b&&l>=a) return tree[k];
priority_queue<> q;
priority_queue<,vector<>, less<> > pq1; //... | ALGO | 0.999819 | 3.88404 |
c0745836-4ca8-42cb-8423-b30d522abc70 | rohandarandale1144/CNS-Assignments | A-4RailFence.cpp | #include <bits/stdc++.h>
using namespace std;
string encrypt(string text)
{
string str1 = "", str2 = "";
for (int i = 0; i < text.size(); i++)
{
if (text[i] == ' ')
{
continue;
}
else if (i % 2 == 0)
{
str1 += text[i];
}
else
... | ALGO | 0.999871 | 4.752886 |
700bdb59-c2a4-430a-9a8e-0366d98c86ad | lipsa22/LeetCode | 1323-maximum-69-number/1323-maximum-69-number.cpp | class Solution {
public:
int maximum69Number (int num) {
string x = to_string(num);
for(int i = 0 ; i < (int)x.size() ; i++) {
if(x[i] == '6') {
x[i] = '9';
break;
}
}
int ans = stoi(x);
return ans;
}
}; | ALGO | 0.999417 | 6.436757 |
9c053aaf-5f8b-4df5-ba2e-60bb0273953a | danial-ch/Traveling-Salesman_ant-colony | C++/communication.cpp | #include "Sources.h"
vector<vector<double>> init_pheromone(double rank) {
vector<vector<double>> pheromone;
for (size_t i = 0; i < rank; i++)
{
vector<double> p(rank);
for (size_t j = 0; j < rank; j++)
{
double value = 1 / (rank * rank);
p[j] = value;
... | ALGO | 0.999839 | 3.658466 |
b71301e5-cc5c-44d4-a040-2790d43bb8ff | bigbigpeng3/ShellListApp | 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 |
ff6de386-2c38-49bc-9211-8a59ca2e5c98 | val-arratia/UBA-AED3 | TP1/Experimentacion/Instances/create_unsorted_instances.cpp | #include <iostream>
#include <utility>
#include <math.h>
#include <vector>
#include <fstream>
using namespace std;
int main(){
vector<pair<int,int>> v;
ofstream myfile;
myfile.open ("../inputs/input_unsorted.txt");
for(int power = 5; power < 15; power++){
long long n = pow(2,power);
... | ALGO | 0.99767 | 3.370435 |
c9429897-7733-4fe1-bf6d-bfd6bf3ca919 | EndianKnight/Coding-Practice | labs/lab5/q1.cpp | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
void lcs(vector<int>arr)
{
int max_len=1;
pair<int,int>sub;
unordered_map<int,int>hash;
for(int i=0;i<arr.size();i++)
{
hash[arr[i]]=i;
}
for(auto i:hash)
{
//first element on seq
if(hash.find(i... | ALGO | 0.999992 | 3.291293 |
39565f96-a5e6-4658-9a2a-63fedcce9b88 | ivandad1/CodeForces | 16C - Monitor/Source.cpp | #include<stdio.h>
#include<algorithm>
using namespace std;
long long int gcd(long long int a, long long int b){
return b==0?a:gcd(b,a%b);
}
int main(void){
long long int a,b,x,y;
scanf("%I64d %I64d %I64d %I64d",&a,&b,&x,&y);
int g = gcd(x,y);
x/=g;
y/=g;
if(a<x || b<y){
printf("0 0");
return 0;
}
lo... | ALGO | 0.999946 | 3.168536 |
03a9a55c-74ea-4d68-84db-97d0c92599ba | doramonz/Study | dual_pivot_quick_sort.cpp | #include <iostream>
using namespace std;
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
void partition(int arr[], int start, int end, int *lp, int *rp) {
if (arr[start] > arr[end]) {
swap(&arr[start], &arr[end]);
}
int i = start + 1;
int j = end - 1;
int k = start + 1;
while ... | ALGO | 0.999903 | 4.738029 |
e53d7527-71f2-4018-afaa-8c6b19040b24 | shantanuk09/competitive-programming | LeetCode/508. Most Frequent Subtree Sum.cpp | // LeetCode 508. Most Frequent Subtree Sum
class Solution{
public:
int findSubtreeSum(TreeNode *root, unordered_map<int, int> &frequency, int &maxFreq){
if(root == NULL) return 0;
int left = findSubtreeSum(root -> left, frequency, maxFreq);
int right = findSubtreeSum(root -> right, frequency... | ALGO | 0.999978 | 6.325324 |
82547356-c154-458c-aab6-66a778bf0353 | Sneha1m/llvm2024Projects | MPIUniformParticipationPass.cpp | #include "llvm/Pass.h"
#include "llvm/IR/Constants.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
// Command-line option to enable the analysis
static llvm::cl::opt<bool> A... | TOOL | 0.892296 | 7.855159 |
e6b57476-b47a-41ea-b30b-34f748a47a24 | AdvaitPalve11/C-Plus-Plus | CPP mini code/Pattern Printing/Square-Rectangle/Number Square.cpp | //Print number square
#include <iostream>
int main (){
int n;
std::cout<<"Enter a number ";
std::cin>>n;
for (int i =1 ; i<=n ; i++){ //rows
for (int j=1 ; j <=n ; j++){ //cols
std::cout<<j<<" ";
}
std::cout<<"\n";
}
} | ALGO | 0.982269 | 3.908917 |
54dba610-7926-45e1-8cd3-fa7043fa43d0 | nitinkaplas123/SDE-SHEET | Binary_Tree/Medium/9)path_sum_3_437.cpp | Solution 1-:
Steps-:
1)Start from root. -> find all the path sum using solve
if(sum==target) count++;
2)Now your root node is change to root->left
and then root node is change to root->right.
and every time call the solve function.
3) Which means u have to use every node as a root node and find all possible s... | ALGO | 0.999989 | 6.161241 |
1b922556-6d60-4c6e-a776-76f9a9008083 | AkashRajpurohit/leetcode-september-2020-challenge | Week2/rob.cpp | class Solution {
public:
int rob(vector<int>& nums) {
int n = nums.size();
if(n == 0) return 0;
if(n == 1) return nums[0];
if(n == 2) return max(nums[0], nums[1]);
int dp[n];
dp[0] = nums[0];
dp[1] = max(nums[0], nums[1]);
fo... | ALGO | 0.999948 | 6.138203 |
fb38b3f5-f426-4bc9-8311-cf9e0dbc4f1a | YashSharma79/igraph | src/games/degree_sequence_vl/gengraph_box_list.cpp | #include "gengraph_box_list.h"
#include <cassert>
namespace gengraph {
void box_list::insert(int v) {
int d = deg[v];
if (d < 1) {
return;
}
if (d > dmax) {
dmax = d;
}
int yo = list[d - 1];
list[d - 1] = v;
prev[v] = -1;
next[v] = yo;
if (yo >= 0) {
pre... | ALGO | 0.999542 | 5.265549 |
a77f5d32-498a-4a65-952f-a0452a4ffa51 | azcy-qwq/JZOI_ | TemporaryFiles/A+B RE.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
ios::sync_with_stdio(0);
cin>>a>>b;
c=a+b;
try{
if(c>1e6) throw runtime_error("Hello World!");
cout<<c;
}catch(runtime_error){
cout<<c<<endl;
}
}
| ALGO | 0.985729 | 3.514704 |
a4faef9b-601f-428e-9965-3feb04df2f7f | Herotank1234/AdventOfCode | 2018/src/q20.cpp | #include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <memory>
#include <unordered_map>
#include <stack>
#include <queue>
#include <unordered_set>
class Room : public std::enable_shared_from_this<Room> {
public:
Room(int i, int j) : _i(i), _j(j) {
rooms.insert({'N', nullptr});... | ALGO | 0.999298 | 5.683902 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.