uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
010f21f6-fda7-43d0-824b-d63cf0de33b4 | ikjot-2605/Competitive-Programming | CodeForces/1379C.cpp |
/*COMPETITIVE PROGRAMMING C++ TEMPLATE */
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>
#include <iterator>
#define a... | ALGO | 0.999957 | 5.188616 |
cafd680f-4bd7-42ca-944e-356eaeb08ccc | kmailalcem/3BLDExecutionTrainer | Cube.cpp | #include "Cube.h"
//bunch of errors
class InvalidDirectionException {};
class SamePieceException {};
class InvalidMoveException {};
class CornerRepresentationException {};
//------------------------------Letters---------------------------
std::string eLetter::conversion_chart = "ABCDEFGHIJKLMNOPQRSTWXYU";
int eLetter:... | ALGO | 0.998437 | 7.090519 |
ed29b0c0-f74c-482b-871f-00ef9fd05637 | Gal2o/Algo_Study | AlgoStudy/프로그래머스 Lv3 모두 0으로 만들기.cpp | //#include <bits/stdc++.h>
//
//#define mx 300000
//using namespace std;
//typedef long long ll;
//
//vector<int> a = {-5, 0, 2, 1, 2};
//vector<vector<int>> edges = {{0, 1},
// {3, 4},
// {2, 3},
// {0, 3}};
//
//vector<int> ed[mx];
//... | ALGO | 0.999947 | 4.391028 |
4726add4-9e15-42e2-9a59-c060a69036b6 | ishandutta2007/codeforces | mustang98/normal/1305/D.cpp | #include <bits/stdc++.h>
#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long ll;
typedef long double ld;
const int max_n = 1022, inf = 1000111222;
bool m[max_n][max_n];
int cnt[max_n];
int qr(int a, int b) {
cout << "? " << a + 1 ... | ALGO | 0.999936 | 3.662187 |
6f4047d9-4f55-4138-a8cd-0c22cedf8841 | Ashish-242/leetcode-errors | 2409-count-days-spent-together/2409-count-days-spent-together.cpp | class Solution {
public:
int countDaysTogether(string a, string b, string c, string d) {
map<int,int> mp{{1,31},{2,28},{3,31},{4,30},{5,31},{6,30},{7,31},{8,31},{9,30},{10,31},{11,30},{12,31}};
int ans = 0;
set<pair<int,int>> vp;
int alice_a_month = stoi(a... | ALGO | 0.999923 | 5.070523 |
8b62dd96-4ebc-4f25-a293-ff7a2be30bbf | CodderPrince/PythonProject | 2-1/Previous Year Qn Solve/stack-queue.cpp | #include <iostream>
#include <stack>
#include <queue>
using namespace std;
// Stack Implementation
void stackExample()
{
stack<int> myStack;
// Push elements into the stack
myStack.push(5);
myStack.push(10);
myStack.push(15);
// Print the top element of the stack
cout << "Top element of ... | ALGO | 0.956677 | 6.689791 |
61ecaeca-6c52-485d-a0df-07529d109d7f | tridibsamanta/CodeChef_Solutions | Practice/STRFLIP.cpp | /*
~ Author : @tridib_2003
*/
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_... | ALGO | 0.999909 | 4.220337 |
63177b44-090c-48b9-8f5f-0e05648f4cc3 | MoonOS-Project/frameworks_av | media/libstagefright/codecs/amrnb/enc/src/l_negate.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
Local Stores/Buffers/Pointers Needed:
None
Global Stores/... | TOOL | 0.987783 | 5.666788 |
dd47d822-c1b4-4bdf-b4da-cd7460c0376d | GerMorini/Programacion1 | GTP1/gtp9.cpp | #include<iostream>
#include<cmath>
using namespace std;
int reverse(int n) {
int rtn = 0;
while(n != 0) {
rtn *= 10;
rtn += n%10;
n /= 10;
}
return rtn;
}
bool isPal(int n) {
return n == reverse(n);
}
int main() {
int ... | ALGO | 0.999651 | 4.778035 |
4b04d859-0ebe-47ff-bd46-ccf231dafc8c | PriyanshK09/Leetcode-Discord-Bot | solutions/bulb-switcher-iv.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
int minFlips(string target) {
int result = 0;
char curr = '0';
for (const auto& c : target) {
if (c == curr) {
continue;
}
curr = c;
++result;
}
return resu... | ALGO | 0.999888 | 6.470672 |
9ef6a77d-9cca-460b-882a-0934bad2b574 | tad315/DSA-code.ptit | DSA03019 - PHÂN SỐ ĐƠN VỊ.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl '\n'
ll gcd(ll a, ll b)
{
if (b == 0) return a;
return gcd(b, a % b);
}
int main()
{
boost;
int t;
ll p, q;
cin >> t;
while (t--)
{
... | ALGO | 0.999022 | 5.057447 |
5a1ac9a7-5361-4a5a-910d-b9402f25d9eb | karandixit10/Interview_DS_Algo | 3018-make-string-a-subsequence-using-cyclic-increments/3018-make-string-a-subsequence-using-cyclic-increments.cpp | class Solution {
public:
bool canMakeSubsequence(string str1, string str2) {
int str2Index = 0;
int lengthStr1 = str1.size(), lengthStr2 = str2.size();
for (int str1Index = 0;
str1Index < lengthStr1 && str2Index < lengthStr2; ++str1Index) {
if (str1[str1Index] == st... | ALGO | 0.999957 | 6.676223 |
58f6cc55-69bd-4bde-8667-91a1c3b61ecb | toufu-24/AtCoder | Practice/2024_03_05/19:30/G.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define all(v) v.begin(), v.end()
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort(v.rbegin(), v.rend())
#define REVERSE(v) reverse(v.begin(), v.end())
#define ll int64_t
#define ld long double
#define int ll
... | ALGO | 0.999906 | 4.166991 |
ffaa3eb8-f6c7-4166-b005-6ed7473e28d5 | pingchungchang/CP | ytp2022-4.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ld long double
const int mxn = 1e5+10;
struct edge{
int s,e;
int id;
edge(){
}
edge(int x,int ... | ALGO | 0.999994 | 3.804633 |
07d19cb1-262f-46d8-80c8-cbc7c035fcf3 | shubham-1903/Algorithm | Dynamic_Programming/Bellman_Ford.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
// const int V=6;
class Edge
{
public:
int src,dest,weight;
};
class Graph
{
public:
int V,E;
Edge* edge;
};
Graph* create_graph(int V,int E)
{
Graph* graph= new Graph;
graph->V=V;
graph->E=E;
graph->edge = new Edge[E];
return graph;
}
bo... | ALGO | 0.999615 | 4.346139 |
d94284bb-e2f3-499e-a566-554f5e23f103 | AbhishekChauhan9036/Graviton-Batch | DSA Assignment/Segment Tree - In Class/Segment-Tree-An-Introductory-Problem.cpp | #include <bits/stdc++.h>
using namespace std;
int getMid(int s, int e) { return s + (e -s)/2; }
int getSumUtil(int *st, int ss, int se, int qs, int qe, int si)
{
if (qs <= ss && qe >= se)
return st[si];
if (se < qs || ss > qe)
return 0;
int mid = getMid(ss, se);
return (getSumUtil(st,... | ALGO | 0.999931 | 4.708611 |
84421194-f3e0-4d64-91ff-45b1ca99b333 | manjumanjunathnaidu/csa0488---os | Untitled6.cpp | #include<stdio.h>
struct priority_scheduling {
char process_name;
int burst_time;
int waiting_time;
int turn_around_time;
int priority;
};
int main() {
int number_of_process;
int total = 0;
struct priority_scheduling temp_process;
int ASCII_number = 65;
int position;
float average_waiting_time;
... | ALGO | 0.999856 | 3.048193 |
7bee96e1-3127-4f2f-9aea-54fcaa99f58e | infotraining/cpp-thd-2023-06-14 | spin-lock/main.cpp | #include <atomic>
#include <iostream>
#include <mutex>
#include <thread>
#include <vector>
using namespace std;
class SpinLockMutex
{
std::atomic_flag flag_;
public:
SpinLockMutex()
: flag_{ATOMIC_FLAG_INIT}
{
}
void lock()
{
while (flag_.test_and_set(std::memory_order_acquir... | TOOL | 0.895057 | 5.209846 |
27937fee-3642-4b24-9f38-484692048859 | jaeyun1723/Algorithm | SWEA/D3/1244. [S/W 문제해결 응용] 2일차 - 최대 상금/[S/W 문제해결 응용] 2일차 - 최대 상금.cpp | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
string num;
int ans, chg;
int maxNum(int idx) {
int max_num = 0;
for (int i = idx; i < num.size(); i++)
if (num[i] > max_num) max_num = num[i];
return max_num;
}
void dfs(int idx, int cnt) {
if (cnt == chg)
{
ans ... | ALGO | 0.999791 | 4.10247 |
b46d07ea-4abd-4de0-90e9-2bb142c506f7 | zVihugo/Linguagem-C | Praticando em C/struct.cpp | #include <stdio.h>
#include <iostream>
#include <locale.h>
//Aluno: Victor Moreira RA: 2503581
typedef struct{
float base, altura;
}triangulo;
void imTriangulo(triangulo p){
printf("Base: %.2f\n", p.base);
printf("Altura: %.2f\n", p.altura);
}
float area(float base, float altura){
float areaT = (base... | ALGO | 0.969718 | 4.573449 |
ad803b08-9d19-445a-8612-5479987246fc | sdpkjc/training | luogu/(done)simple/ac/P1422.cpp | #include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
double a, ans = 0;
cin >> a;
if (a > 0) {
ans += (0.4463 * (min(a, 150.0)));
a -= (min(a, 150.0));
}
if (a > 0) {
ans += (0.4663 * (min(a, 250.0)));
a -= (min(a, 250.0));
}
if (a > 0) {
ans += (0.... | ALGO | 0.999675 | 3.260787 |
06267970-4788-4cd2-8a4d-166aa99b582a | CodeBySushant/My-Library | C++ DSA/Arrays/UniqueElement.cpp | #include<iostream>
using namespace std;
int uniqueElement(int arr[], int size){
int ans = 0;
for(int i=0; i<size; i++){
ans = ans ^ arr[i]; //XOR which is cancelling same elements with its properties
}
return ans;
}
int main(){
int size;
cout<<"Enter the size of the array... | ALGO | 0.999714 | 5.114778 |
e7024883-d9d2-4f53-87bf-ccbe9188eefc | Anakvyas/LeetCode-Solution | 0394-decode-string/0394-decode-string.cpp | class Solution {
public:
string decodeString(string s) {
stack<int> num_stack ;
stack<string> char_stack;
int num = 0;
for(char c : s){
if(isdigit(c)){
num = num*10+(c-'0');
}else if(c != ']'){
if(num!=0){
nu... | ALGO | 0.999759 | 6.264379 |
e60eb55d-de1a-4a4c-a6c1-a3a322c60a1c | ishandutta2007/codeforces | yp155136/normal/851/C.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1006;
const int K = 106;
struct _
{
int a,b,c,d,e;
_(){}
_(int _a,int _b,int _c,int _d,int _e):a(_a),b(_b),c(_c),d(_d),e(_e){}
};
_ operator-(const _ &_1,const _ &_2)
{
return _(_1.a-_2.a,_1.b-_2.b,_1.c-_2.c,_1.d-_2.d,_1.e-_2.e);
}
int dott... | ALGO | 0.999984 | 3.391507 |
2cea0c93-d7f8-4159-936e-01ccd0d060b1 | smtcrms/buck | test/com/facebook/buck/crosscell/testdata/inter-cell/multi-cell/ternary/diff.cpp | #include "diff.hpp"
int diff(int a, int b) {
return a - b;
}
| TOOL | 0.927369 | 4.989047 |
01a4a4c4-261e-4c68-98ba-cf6b0d6c3884 | qingjiesjtu/ATTA | MultiTaskTrain/utils_RL/lane_evaluation/CULane/src_origin/spline.cpp | #include <vector>
#include <iostream>
#include "spline.hpp"
using namespace std;
using namespace cv;
vector<Point2f> Spline::splineInterpTimes(const vector<Point2f>& tmp_line, int times) {
vector<Point2f> res;
if(tmp_line.size() == 2) {
double x1 = tmp_line[0].x;
double y1 = tmp_line[0].y;
... | ALGO | 0.999517 | 3.721438 |
06967da2-8b38-4037-acf1-d8ccb3567153 | Darjana13/KTMiAD | KTMiAD/cgm.cpp | #include "cgm.h"
// ind_from_zero - , ig jg 0
cgm_solver::cgm_solver(const std::string& path, const bool& ind_from_zero)
{
// n, max_iter eps
std::ifstream in(path + "kuslau.txt");
in >> n >> max_iter >> eps;
s.resize(n);
az.resize(n);
rr_vec.resize(n);
z.resize(n);
r.resize(n... | ALGO | 0.999818 | 4.401568 |
f9a54009-1d2a-48dd-a66f-727b27c02e56 | LenzNathan/SPL-Pixelboard | libraries/FastLED/src/noise.cpp | /// @file noise.cpp
/// Functions to generate and fill arrays with noise.
#include <string.h>
#include "fl/array.h"
/// Disables pragma messages and warnings
#define FASTLED_INTERNAL
#include "FastLED.h"
// Compiler throws a warning about stack usage possibly being unbounded even
// though bounds are checked, silenc... | ALGO | 0.992353 | 5.972548 |
9046e23e-4fb7-4f80-a3fe-d71cdb3ac2f9 | wdzeng/cp-solutions | kattis/a4p8nf/k.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define ms(v) memset(v, 0, sizeof(v))
#define mss(v) memset(v, -1, sizeof(v))
#define len(v) int(v.size())
#ifdef hy
#define fastio()
#define debug(a) cerr <... | ALGO | 0.99973 | 3.901541 |
31143f59-7c78-43b2-af46-424d95a26908 | mingsjtu/OJ_exercise | 北大18软件考/F.cpp | #include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<list>
#include<stack>
using namespace std;
int main()
{
int k=0;//ʵ
while(1)
{
int my[1000],m,n,win=0;
k++;
cin>>m>>n;//mˣn
//cout<<"ok"<<endl;
if(m==0&&n==0)break;
for(int i=0;i<n;i+... | ALGO | 0.999587 | 3.079875 |
b50afdaf-4656-485f-ac3f-9af1acd293b9 | zhaoyiping0622/oceanbase-competition-2023 | src/sql/optimizer/ob_log_topk.cpp | #define USING_LOG_PREFIX SQL_OPT
#include "ob_log_topk.h"
#include "ob_log_group_by.h"
#include "ob_log_operator_factory.h"
#include "ob_log_sort.h"
#include "ob_log_table_scan.h"
#include "ob_optimizer_util.h"
#include "ob_opt_est_cost.h"
#include "sql/rewrite/ob_transform_utils.h"
using namespace oceanbase::sql;
usin... | ALGO | 0.963582 | 5.794643 |
a17ba31d-0ca8-446b-ba38-7ec18456945f | ishandutta2007/codeforces | lily/normal/759/B.cpp | /* Never Say Die. */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <ctime>
#include <cstdlib>
using namespace std;
int _c = 0;
template <class _T> inline void read(_T &_a) {
_a = 0; bool _f = 0;
while (_c < '0' || _c > '9') _f |= _c == '-', _c... | ALGO | 0.999875 | 3.024447 |
ba418b40-4392-4c79-bf71-af0db15b1207 | hanlu8774/algorithm_homework | week6/45-jump-game-ii.cpp | //给你一个非负整数数组 nums ,你最初位于数组的第一个位置。
//
// 数组中的每个元素代表你在该位置可以跳跃的最大长度。
//
// 你的目标是使用最少的跳跃次数到达数组的最后一个位置。
//
// 假设你总是可以到达数组的最后一个位置。
//
//
//
// 示例 1:
//
//
//输入: nums = [2,3,1,1,4]
//输出: 2
//解释: 跳到最后一个位置的最小跳跃数是 2。
// 从下标为 0 跳到下标为 1 的位置,跳 1 步,然后跳 3 步到达数组的最后一个位置。
//
//
// 示例 2:
//
//
//输入: nums = [2,3,0,1,4]
//输出:... | ALGO | 0.999961 | 5.965735 |
6436becf-1143-4243-a789-cb00d8150cc1 | abdur-rafi/Codeforces-practice | 620 C.cpp | #include <cstdio>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
struct cust {
ll ti, li, hi;
};
vector<cust> inp;
int main() {
ll t; scanf("%lld", &t);
while (--t >= 0) {
inp.clear();
ll n, m; scanf("%lld %lld", &n, &m);
bool pos = 1;
for (int i = 0; i < n; ++i) {
ll ti, ... | ALGO | 0.999671 | 3.186136 |
56393596-c600-42fa-a505-26e6e96ce66f | singhashish-26/Leetcode | Algorithms/Linked List/intersection-of-two-linked-lists.cpp | #https://leetcode.com/problems/intersection-of-two-linked-lists/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
... | ALGO | 0.999823 | 5.291366 |
8b43b74a-8b3b-4947-a22c-93eeb1389d46 | Gj0705/RELOCALIZATION | 第九章 基于优化的建图方法/shenlan_ws/three_party/g2o-20200410_git/g2o/apps/g2o_simulator/convertSegmentLine.cpp | #include <signal.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <cassert>
#include "g2o/core/estimate_propagator.h"
#include "g2o/core/sparse_optimizer.h"
#include "g2o/core/factory.h"
#include "g2o/core/optimization_algorithm_factory.h"
... | ALGO | 0.903031 | 5.368217 |
cdbd6e93-fddd-44d9-9974-8cab64cfd51d | ishandutta2007/codeforces | kort0n/normal/986/B.cpp | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
template<class T>
inline bool chmin(T &a, T b) {
... | ALGO | 0.999985 | 4.241719 |
35664a65-eaeb-483c-8083-723fdd858861 | mirinta/leet_code | priority_queue/1057_campus_bikes..cpp | #include <queue>
#include <unordered_set>
#include <vector>
/**
* On a campus represented on the X-Y plane, there are n workers and m bikes, with n <= m.
*
* You are given an array workers of length n where workers[i] = [xi, yi] is the position of the ith
* worker. You are also given an array bikes of length m whe... | ALGO | 0.999985 | 6.2899 |
56a64d31-5c4d-4617-9dfc-7c47e0b89d0a | Anubhav-Raj/QuestionOfCPP | RotateArray.cpp | #include <bits/stdc++.h>
using namespace std;
//approch 1
void rotate(int arr[], int size, int k){
int temp= arr[0];
for(int i=0; i<size; i++){
arr[i]=arr[i+1];
}
arr[size-1]=temp;
}
// approch2
void rotate2(int arr[], int size, int k){
int temp[k];
/... | ALGO | 0.999946 | 4.010024 |
1e87ae05-f814-4121-8a70-f20e96cf6864 | 0owangjingo0/WZUOJ_Answer | 程序设计基础(2022-2023-1)/实验三 分支结构基础/1909-判断能否构成三角形.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a + b > c && a + c > b && b + c > a) {
cout << "YES" << endl;
}else {
cout << "NO" <<endl;
}
return 0;
}
| ALGO | 0.999979 | 4.37531 |
d6c32b74-1bad-46ce-9fa9-ebdc2c5f2ae8 | VanirAOSP/external_skia | src/utils/SkParse.cpp | #include "SkParse.h"
static inline bool is_between(int c, int min, int max)
{
return (unsigned)(c - min) <= (unsigned)(max - min);
}
static inline bool is_ws(int c)
{
return is_between(c, 1, 32);
}
static inline bool is_digit(int c)
{
return is_between(c, '0', '9');
}
static inline bool is_sep(int c)
{
... | TOOL | 0.869478 | 5.845361 |
99a67a31-e657-4419-bfc7-ef01268df252 | bhavana-shegokar/LogicBuilding | Cprogram51.cpp | #include<iostream>
using namespace std;
#define ERR_NOTFOUND -1
class Array
{
private:
int iSize;
int *Arr;
int iSearch;
public:
Array(int X)
{
cout<<"Inside Constructor"<<"\n";
iSize = X;
Arr = new int[iSize... | ALGO | 0.995484 | 4.061219 |
dc1c40eb-e539-41af-8324-33e90c52b2b4 | alan1898/snowman | policy_resolution/policy_resolution.cpp | //
// Created by alan on 19-4-26.
//
#include "policy_resolution.h"
vector<string>* policy_resolution::infixToPostfix(string infix) {
vector<string>* res = new vector<string>;
signed long int len = infix.length();
stack<char> st;
string s = "";
char oc;
string os = "";
for (signed lon... | ALGO | 0.999362 | 4.397368 |
ec506e06-3ecc-483c-8ab9-171c6a53dc27 | ishandutta2007/codeforces | siberian/normal/1374/C.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(x) x.begin(), x.end()
template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 & y) {if (x > y) x = y;}
template <typename T1, typename T2> inline void chkmax(T1 &x, co... | ALGO | 0.999825 | 4.709017 |
0c7565d8-4558-44e9-a856-cbcbc97e17b5 | AdityaRaj212/AZ_practice_codes | dp/Form1_KnapsackForm/6_sum_to_T.cpp | #include<bits/stdc++.h>
using namespace std;
int n, T, q;
vector<int> arr;
int dp[1001][1001];
int rec(int level, int left){
//pruning
if(left<0){
return 0;
}
// base case
if(level==n){
if(left==0){
return 1;
}else{
return 0;
}
}
//... | ALGO | 0.999896 | 4.10673 |
da1fe5b8-1183-44fc-b14c-e554a10bef7f | ishandutta2007/codeforces | yuu/normal/1684/A.cpp | #include <bits/stdc++.h>
using namespace std;
// clang-format off
namespace { // forbidden c++
// must be an operator that execute from left to right to make sense.
// need concept to use <<, >>, so we use | for now
#define PREFERED_OPERATOR operator|
enum general_operation_t {REVERSE, };
enum comparable_operation_t {... | ALGO | 0.999933 | 5.951576 |
3712a4c2-97df-4ed7-a2d9-978622bea11b | cxlove/ACM_ICPC | Online_judge/HDU/hdoj_2700.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define eps 1e-10
#define N (1<<7)+5
#define inf 1<<20
#define zero(a) (fabs(a)<eps)
#define lson (step<<1)
#define rson (step<<1|1)
using namespace std;
char str[100];
int main(){
while(scanf("%s",str)!=EOF&&str... | ALGO | 0.999419 | 3.121564 |
e02a0446-2d17-4d2a-a8e9-49314f3fd903 | ishandutta2007/codeforces | purplecrayon/normal/1436/C.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define sz(v) (int)v.size()
#define ar array
// #define f fi... | ALGO | 0.999974 | 4.163242 |
ce09ce79-a539-469d-92b6-b4a01f71c103 | ishandutta2007/codeforces | maspy/normal/1165/A.cpp | #line 1 "main.cpp"
#include <bits/stdc++.h>
#line 3 "/home/maspy/library/my_template.hpp"
using namespace std;
using ll = long long;
using ld = long double;
#define int ll
using pi = pair<int, int>;
using vi = vector<int>;
#define FOR(i, n) for (int i = 0; (i) < (int)(n); ++(i))
#define FOR3(i, m, n) for (int i = (m... | ALGO | 0.999952 | 4.668232 |
5fae7cfa-3f70-459e-ad04-396e36f3991e | eriktur/Nettverksprogrammering-IDATT2104 | oving2/main.cpp | #include <iostream>
#include <vector>
#include <thread>
#include <queue>
class Workers {
public:
Workers(size_t threadCount) : stopAll(false), started(false) {
// Reserver plass for trådene for å unngå reallokeringer senere.
workers.reserve(threadCount);
}
~Workers() {
stop(); // N... | TOOL | 0.982354 | 6.88121 |
649b555b-9252-4c66-b9a3-e9b9dbd9e5db | ishandutta2007/codeforces | smax/normal/1491/E.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__)
#else
#define DEBUG(...) 6
#endif
template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typen... | ALGO | 0.999916 | 4.7553 |
5600ec33-ea02-42b1-bcbe-fc1ea055ac90 | Kris153/GuessTheNumber | Task 3 obuchenie.cpp | #include <iostream>
using namespace std;
int main(){
long long kolkoETaziGodina,sKolkoProcentaNarastva,kolkoGodiniShteUcha,sledKolkoGodiniShteZapochnaDaUcha,kolkoShteMiStruva=0;
cout<<"vuvedete kolko struva obuchenieto tazi godina \n";
cin>>kolkoETaziGodina;
cout<<"vuvedete s kolko procenta narastva obuchenieto vsqka g... | ALGO | 0.999496 | 3.178303 |
9c1f6f1c-b369-4721-9791-0cd95c153e6c | RicardoJavierH/FirstSoftware | neopz/Topology/tpzquadrilateral.cpp | /**
* @file
* @brief Contains the implementation of the TPZQuadrilateral methods.
*/
#include "tpzquadrilateral.h"
#include "pzmanvector.h"
#include "pzerror.h"
#include "pzreal.h"
#include "pzquad.h"
#include "pzeltype.h"
//#include "pzshapequad.h"
#include "pznumeric.h"
#ifdef _AUTODIFF
#include "fad.h"
#end... | ALGO | 0.995615 | 5.330905 |
4a5f62a1-4288-4505-ad81-9a3871ef0fe0 | georgbasler/Controllability | glpkmex/glpkcc.cpp | #include <cfloat>
#include <csetjmp>
#include <ctime>
#include <cstring>
// From Matlab
#include "mex.h"
extern "C" {
#include <glpk.h>
}
#define NIntP 21
#define NRealP 11
// control parameters not defined in glpk.h
#define LPX_K_PREPROCESS 401 /* preprocessing */
#define LPX_K_RATIO_TEST 402 /* rati... | ALGO | 0.999926 | 5.531769 |
15ab860d-a2c3-4df2-9dd5-36941592b2cd | federicaferrari/onedof_testbench | esmacat_core/src/esmacat_utility.cpp | #include "esmacat_utility.h"
/** @brief Generates a sigmoid curve using the input parameter
*
* Sigmoid f(x) = 1/(1+ exp(-x))
* @param x used in f(x) for sigmoid function
* @return f(x) computed output of the sigmoid function
*/
float sigmoid(float x)
{
float one = static_cast<float>(1);
float exponent = ... | TOOL | 0.880361 | 5.700419 |
5cb4ea77-6e8b-4fb2-a533-06d002f8b4b6 | arindal1/Leetcode-Problems | Easy/2236. Root Equals Sum of Children.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.999874 | 6.390182 |
97a120b3-6352-492c-9b17-238587b492e5 | thebird-/ts-stream-server-client | boost_1_61_0/libs/numeric/ublas/doc/samples/coordinate_matrix.cpp | #include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
coordinate_matrix<double> m (3, 3, 3 * 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = 3 * i +... | TOOL | 0.89373 | 3.236453 |
6ecc1dd5-0de2-4c40-ba33-6cdcdbca8f0c | sumeshnb/progPuzzles | itoa.cpp | #include<iostream>
#include<string>
using namespace std;
string myItoa(int);
int main(){
cout<<"enter the number"<<endl;
int number;
cin>>number;
cout<<myItoa(number)<<endl;
return 0;
}
string myItoa(int number){
string str;
bool isNegative = number<0?number=-number,true:false;
whil... | ALGO | 0.999835 | 4.724291 |
95585fc6-f5ce-41a6-a157-b11ed49faf29 | awesomemin/baekjoon | 1914/main.cpp | #include <iostream>
#include <vector>
using namespace std;
void HanoiPrint(int n, int from, int drop, int to) {
if(n == 1) {
cout<<from<<" "<<to<<"\n";
return;
}
HanoiPrint(n - 1, from, to, drop);
cout<<from<<" "<<to<<"\n";
HanoiPrint(n - 1, drop, from, to);
}
void mul2plus1(vector<int> &count) {
int carr... | ALGO | 0.999975 | 4.275006 |
73862bda-b262-4a0b-81f4-6d90d4f6b7f1 | tanuchaurasiya/GeeksforGeeks | Medium/Spirally traversing a matrix/spirally-traversing-a-matrix.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
vector<int> spirallyTraverse(vector<vector<int> > matrix, int r, int c)
{
int top = 0;
int bottom = r-1;
int left = 0;
int right = c-1;
... | ALGO | 0.999957 | 5.064271 |
bdc9464e-0241-4bc1-acf0-0eef4e337445 | Pioooooo/aoc | 2021/14-1.cpp | #include <bits/stdc++.h>
using namespace std;
char rule[26][26] = {0};
int main() {
ifstream fin("in");
string line;
fin >> line;
list<char> p{line.begin(), line.end()};
while (fin >> line) {
string res;
fin >> res >> res;
rule[line[0] - 'A'][line[1] - 'A'] = res[0];
}
... | ALGO | 0.999872 | 4.107144 |
431eddb1-fc8a-49ad-81e9-306cfc9c73da | parkjungeun/Algorithm-Problem-Code | BOJ/[BOJ]1316_그룹 단어 체커.cpp | #include<iostream>
#include<string>
#include<cstring>
using namespace std;
int main() {
int ans = 0, N, visit[26];
cin >> N;
string str;
for (int i = 0; i < N; ++i) {
cin >> str;
memset(visit, 0, sizeof(visit));
visit[str[0] - 'a'] = 1;
bool flag = 0;
for (int j = 1; j < str.size(); ++j) {
if (st... | ALGO | 0.99994 | 4.031147 |
90802f2c-e231-449b-a918-547122ffcc83 | vidh2000/MSci_Schwarzschild_Causets | scripts_cpp/tests/test_parallel_and_software/test_our_root_finder.cpp | #include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdexcept>
#include <string>
#include <vector>
#include <chrono>
#include <unordered_set>
#include <random>
#include "../scripts_cpp/causets_cp... | ALGO | 0.99907 | 4.284769 |
1e4b5c80-56ff-4edb-8bc4-adf0738548ac | date3k2/Programming | C++/sort_zero.cpp | #include <bits/stdc++.h>
#define fo(i,l,h) for(int i=l;i<=h;++i)
#define ll long long
using namespace std;
int t;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>t;
int dem=0;
while (t--)
{
++dem;
int n;
cin>>n;
int a[n+3];
map<int,int> m,mt;
fo(i,1,n)
{
cin>>a[i];... | ALGO | 0.999886 | 3.729898 |
9253aa94-fd4c-423e-a321-18874668af41 | Cgfyufsygsm/OI-Codes | Luogu/P7071.cpp | #include <cstdio>
#include <cctype>
#define il inline
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define DEC(i, a, b) for (int i = (a); i >= (b); --i)
namespace fastIO {
const int maxc = 1 << 23;
char ibuf[maxc], *__p1 = ibuf, *__p2 = ibuf;
il char getchar() {return __p1 == __p2 && (__p2 = (__p1 = ibuf) + f... | ALGO | 0.999861 | 4.445747 |
9212a42a-8230-447f-b98e-eb74cdaded1c | actium/codeforces | 0800/10/814c.cpp | #include <iostream>
#include <string>
#include <vector>
template <typename T, typename U>
std::istream& operator >>(std::istream& input, std::pair<T, U>& v)
{
return input >> v.first >> v.second;
}
template <typename T>
std::istream& operator >>(std::istream& input, std::vector<T>& v)
{
for (T& a : v)
... | ALGO | 0.999639 | 4.845546 |
4542c0ad-edbc-4cb0-8045-b1cc239e5ad9 | AtomicNibble/PulpEngine | 3rdparty/source/PhysX-3.3/Source/GeomUtils/src/distance/GuDistanceSegmentBox.cpp | #include "GuDistanceSegmentBox.h"
#include "GuDistancePointBox.h"
#include "GuDistanceSegmentSegment.h"
#include "GuDistancePointSegment.h"
#include "GuIntersectionRayBox.h"
using namespace physx;
static void face(unsigned int i0, unsigned int i1, unsigned int i2, PxVec3& rkPnt, const PxVec3& rkDir, const PxVec3& ext... | ALGO | 0.999527 | 6.101848 |
1c3a613f-45bc-447c-a1f9-7a35f5ccfb48 | satinder01/SDC-CarND-Term3-CarND-Path-Planning-Project | src/Eigen-3.3/doc/examples/TutorialLinAlgSetThreshold.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2d A;
A << 2, 1,
2, 0.9999999999;
FullPivLU<Matrix2d> lu(A);
cout << "By default, the rank of A is found to be " << lu.rank() << endl;
lu.setThreshold(1e-5);
cout << "With threshold 1e-5... | ALGO | 0.999677 | 4.090376 |
9653c04b-0854-4593-937a-fafa2240ba4f | stavros11/NetKet-Machines | tests/mps.cpp | #include <C:/cygwin64/home/Stavros/eigen/Eigen/Dense>
#include <complex>
//#include <fstream>
#include <vector>
#include <random>
#include <iostream> // temporarily for tests
#include "lookup.hpp"
#include "all_utils.hpp"
/**
Abstract class for Machines.
This class prototypes the methods needed
by a class satisf... | ALGO | 0.996809 | 5.041165 |
1e4851e7-8a63-4ab7-90d1-cf6ebf8b327a | Bobur-93/Sudoku | mashing.cpp | # include "sudoku.h"
//
//
int mashing_sudoku (int* matr_sud, int diff)
{
//
int i, j, n;
int buff[81];
srand(time(NULL));
// ..
switch (diff)
{
case 0:
n=43;
break;
case 1:
n=37;
break;
case 2:
n=30;
break;
}
for (i = 0; i<9; i++)
{
for (j = 0; j<9; j++)
... | ALGO | 0.991232 | 3.011092 |
007ae9b9-ddf4-47d8-a356-50355db448c9 | JianboYu/libskia | trunk/src/pathops/SkDQuadLineIntersection.cpp | #include "SkIntersections.h"
#include "SkPathOpsLine.h"
#include "SkPathOpsQuad.h"
/*
Find the interection of a line and quadratic by solving for valid t values.
From http://stackoverflow.com/questions/1853637/how-to-find-the-mathematical-function-defining-a-bezier-curve
"A Bezier curve is a parametric function. A q... | ALGO | 0.999494 | 5.109473 |
e9872725-3bd0-427c-a10c-e0c05e3c793a | abhijeet-rawat/Hackerrank-Submissions | submissions/Binary Search Tree : Insertion.cpp | /*-----------------------------------------------------------------------
Problem Title: Binary Search Tree : Insertion
Problem Link: https://www.hackerrank.com/challenges/binary-search-tree-insertion
Author: abhijeet_rawat
Language : C++
-----------------------------------------------------------------------*/
/*
N... | ALGO | 0.999986 | 5.442324 |
9bc1d270-f9c5-4098-83b3-5936a4e0f9bc | GiBitS/Bitcoin-Core-tree | src/addrman.cpp | #include <addrman.h>
#include <hash.h>
#include <logging.h>
#include <serialize.h>
int CAddrInfo::GetTriedBucket(const uint256& nKey, const std::vector<bool> &asmap) const
{
uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetCheapHash();
uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey... | TOOL | 0.916115 | 6.701082 |
5989ce05-bfb9-418a-98fe-7c6d01a86cb0 | TMGA-C/TMGA | TMGA-BC/TMGA_BC-Example/Exhaustive.cpp | //
// Created by Administrator on 2020/10/9.
//
#include "common.h"
#include "tools.hpp"
#include "config.h"
#include "GenerateAChrom.h"
#include "GenOperator.h"
chromosome runExhaustive(string XmlFile, string RscAlcFile, double& SchTime) {
clock_t start = clock();
ReadFile(XmlFile, RscAlcFile);
Calculate... | ALGO | 0.998971 | 3.497335 |
72e7fd2a-12ea-46a8-86e3-42cfc0783c87 | OhJuhun/PS | BOJ/DisjointSet/4195.cpp | #include <iostream>
#include <string>
#include <map>
using namespace std;
#define MAX 987654321
#define PREPROCESS ios_base::sync_with_stdio, cin.tie(0), cout.tie(0)
map<string, string> parent; //부모관계 확인
map<string, int> friends;
int T, F;
string Find(string n) {
if (parent[n] == "") {
friends[n]++;
return pare... | ALGO | 0.999382 | 4.728176 |
387afe0e-32f6-427f-bb61-c04ea81c71e2 | KaranGulve4342/DSA | Maps and Sets/Find words that can be formed by characters.cpp | // LEETCODE 1160
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int countCharacters(vector<string>& words, string chars) {
int ans = 0;
unordered_map<char, int> umap;
for(int i = 0;i < chars.length();i++){
umap[chars[i]]++;
}
for(int i = ... | ALGO | 0.999901 | 5.890029 |
f2b783ad-8a1f-4f53-88f4-2de1db12bed7 | ZcRaaTch/Leetcode-solutions | 0594-longest-harmonious-subsequence/0594-longest-harmonious-subsequence.cpp | class Solution {
public:
int findLHS(vector<int>& nums) {
sort(nums.begin(), nums.end());
int j = 0, maxLength = 0;
for (int i = 0; i < nums.size(); ++i) {
while (nums[i] - nums[j] > 1) {
++j;
}
if (nums[i] - nums[j] == 1) {
... | ALGO | 0.99988 | 5.898491 |
0cb9796f-3077-430f-a4a4-da8ea0d9ef34 | Shreekar11/DSA_Repo | Recursion/recursionConcept.cpp | #include<bits/stdc++.h>
using namespace std;
// Q. Factorial using recursion.
int factorial(int n){
// base case -
// base case is used to stop the recursive term.
if(n==1){
return 1;
}
// the bigger problem i.e factorial(n) is sub divided into smaller problems
// i.e factorial(n-1) b... | ALGO | 0.999537 | 5.106689 |
52b76c73-6754-45f7-b407-5112d1c8e63d | CodderPrince/DSA-2-1 | CODEFORCES/PRACTICE/A_Elephant.cpp | #include<bits\stdc++.h>
using namespace std;
int main()
{
int x;
cin >> x;
int steps = (x + 4) / 5;
cout << steps << endl;
return 0;
}
| ALGO | 0.999853 | 3.365728 |
4851acc7-2674-4fe3-850d-00ae4b62f7a7 | jeremyrios/ComSci-210 | Labs/Lab8/PreProcessor.cpp | #include <fstream>
#include <iostream>
#include <string>
#include <stack>
using namespace std;
#include <cstring>
int main()
{
int error=0;
stack<char> brackets;
string filename;
cout << "please enter input file name: ";
getline( cin, filename );
char* inputFile = (char*)malloc(sizeof(char)*(filename.le... | ALGO | 0.898356 | 3.998569 |
8f7d1ab0-b1c3-4db2-8f85-ffe409976e6b | mashimarokumo/practices | practice/luogu/p1551.cpp | #include<cstdio>
using namespace std;
int fa[10000];
int find(int x){
if(fa[x]==x)
return x;
return fa[x]=find(fa[x]);
}
void uni(int x,int y){
fa[find(x)]=find(y);
}
int main(){
int n,m,p,mi,mj;
scanf("%d%d%d",&n,&m,&p);
for(int i=1;i<=n;i++)
fa[i]=i;
for(int i=1;i<=m;i++){
scanf("%d%d",&mi,&mj);
uni(... | ALGO | 0.999992 | 3.670715 |
b7fea590-9e05-467a-bc10-3efe3c9dcc1c | Mackenzie-98/Solutions | Codeforces/Div3/697/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define ft first
#define sd second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#def... | ALGO | 0.999991 | 4.128738 |
aff2d347-6344-40dd-bad3-08e02bfe73d0 | Wizcorp/byuu-web | higan/component/processor/tlcs900h/algorithms.cpp | template<> auto TLCS900H::parity< uint8>( uint8 data) const -> bool {
data ^= data >> 4;
data ^= data >> 2;
data ^= data >> 1;
return !(data & 1);
}
template<> auto TLCS900H::parity<uint16>(uint16 data) const -> bool {
data ^= data >> 8;
data ^= data >> 4;
data ^= data >> 2;
data ^= data >> 1;
return... | ALGO | 0.999165 | 6.004287 |
102a8d9c-13f4-4596-8042-ae7cd3941ac7 | nhdhieuu2/Chuyen_De_De_Quy | Bai_051/Bai_051.cpp | #include <iostream>
using namespace std;
float Tinh(int);
int main()
{
int n;
cout << "Nhap n: ";
cin >> n;
cout << "S(" << n << ")= " << Tinh(n);
return 0;
}
float Tinh(int n)
{
if (n == 0)
return 0;
if (n == 1)
return 1;
float a = Tinh(n - 1);
float b = Tinh(n - 2);
return (1 + n) * a - n * b;
} | ALGO | 0.999794 | 3.696398 |
379fca34-aa8a-4c7d-8774-0fdb35214f94 | kamyu104/LeetCode-Solutions | C++/find-the-lexicographically-largest-string-from-the-box-ii.cpp | // Time: O(n)
// Space: O(1)
// greedy
class Solution {
public:
string answerString(string word, int numFriends) {
if (numFriends == 1) {
return word;
}
int idx = 0;
for (int i = 1, l = 0; i < size(word); ++i) {
if (word[i] == word[idx + l]) {
... | ALGO | 0.999991 | 5.882514 |
eb4e1552-1e36-4670-8114-26893f462903 | pogery-foggy/BOJ_study | code/2023/easy_after_0913/2455.cpp | #include <iostream>
using namespace std;
int x, y,maxi = -1,total;
void init() {}
void solve() {
while (1) {
cin >> x >> y;
if (y == 0)
break;
total += y-x;
maxi = maxi>total?maxi:total;
}
cout << maxi;
}
int main() {
ios_base::sync_with_stdio(fal... | ALGO | 0.999788 | 3.998348 |
df639960-2266-4882-be56-689b2590f6f1 | karunroyal94/demo | packages/rythmos/test/VanderPol/VanderPolModel.cpp | //@HEADER
#include "VanderPolModel.hpp"
#ifdef Rythmos_ENABLE_Sacado
#include "Teuchos_StandardParameterEntryValidators.hpp"
#include "Sacado.hpp"
#include "Thyra_DefaultSpmdVectorSpace.hpp"
#include "Thyra_DetachedVectorView.hpp"
#include "Thyra_DetachedMultiVectorView.hpp"
#include "Thyra_DefaultSerialDenseLinea... | ALGO | 0.945455 | 5.930536 |
2600ba50-64d7-4590-894e-4d1cdf3d79a4 | yash-1104github/DSA-Leetcode | Kadane's Algorithm.cpp | class Solution {
public:
// Function to find the sum of contiguous subarray with maximum sum.
int maxSubarraySum(vector<int> &arr) {
// code here...
int n = arr.size(), sum = 0 , i = 0,ans = INT_MIN;
while(i < n){
sum += arr[i];
ans = max... | ALGO | 0.999806 | 5.949239 |
097a16c9-4a89-4d7f-8cec-b699dddc5234 | tobme/AdventOfCode2023 | AdventOfCode2023/18.cpp | #include "18.h"
#include <iostream>
#include<sstream>
#include<unordered_set>
#include"Helpers/Point.h"
#include<unordered_map>
#include<queue>
#include"Helpers/PairHash.h"
#include<set>
#include <numeric>
DayEighteen::DayEighteen(const std::shared_ptr<InputManager> getInput) : ICodeChallange(getInput) {}
std::strin... | ALGO | 0.998197 | 5.396005 |
29039e05-ed97-4c64-b6aa-a5cb959fca23 | JerJohn15/blender | intern/moto/intern/MT_random.cpp | /** \file moto/intern/MT_random.cpp
* \ingroup moto
*/
/* A C-program for MT19937: Real number version */
/* genrand() generates one pseudorandom real number (double) */
/* which is uniformly distributed on [0,1]-interval, for each */
/* call. sgenrand(seed) set initial values to the working area... | ALGO | 0.998644 | 6.146486 |
043e9b40-f9c9-4379-a0c4-35d83cbf2b7d | sarvex/leetcode-f-sharp | solution/2300-2399/2387.Median of a Row Wise Sorted Matrix/Solution.cpp | class Solution {
public:
int matrixMedian(vector<vector<int>>& grid) {
int m = grid.size(), n = grid[0].size();
int left = 0, right = 1e6 + 1;
int target = (m * n + 1) >> 1;
auto count = [&](int x) {
int cnt = 0;
for (auto& row : grid) {
cnt +=... | ALGO | 0.999994 | 6.107885 |
8206196c-bb86-4ca2-84af-9d78958dc0ab | harshul21/6Companies30days-Challenge | Amazon(6 Jan - 10 Jan)/Maximum of all subarrays of size k.cpp | //Problem Link:-https://leetcode.com/problems/sliding-window-maximum/
class Solution {
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
//using heap
/*priority_queue<pair<int,int>> pq;
vector<int> ans;
for(int i=0;i<nums.size();i++)
{
while(!pq.emp... | ALGO | 0.999969 | 6.147467 |
bb5fd2e6-9b52-496a-bfc7-0a481ef3f4a5 | TraceMachina/Telegram-iOS-NativeLink | Tests/LottieMetalTest/LottieSwift/Sources/Public/Primitives/CGPath.cpp | #include "CGPath.hpp"
#include <cassert>
namespace lottie {
namespace {
void addPointToBoundingRect(bool *isFirst, CGRect *rect, Vector2D const *point) {
if (*isFirst) {
*isFirst = false;
rect->x = point->x;
rect->y = point->y;
rect->width = 0.0;
rect->height = 0... | TOOL | 0.862391 | 7.002507 |
5e41ed98-1015-4b04-9ad3-db50aa89cc0a | CTSRD-CHERI/icu4c | source/i18n/csdetect.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_CONVERSION
#include "unicode/ucsdet.h"
#include "csdetect.h"
#include "csmatch.h"
#include "uenumimp.h"
#include "cmemory.h"
#include "cstring.h"
#include "umutex.h"
#include "ucln_in.h"
#include "uarrsort.h"
#include "inputext.h"
#include "csrsbcs.h"
#include "csrmbcs.h"... | TOOL | 0.854525 | 6.917303 |
5a8df4a1-328e-435a-afd5-10048ae0f1cb | kmjp/procon | codeforce/401-420/417/b2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999212 | 3.710234 |
c171c89e-c621-4fa3-a666-13c790d996a1 | safinghoghabori/data-structures | recursion/print_matrix_using_recursion.cpp | #include<iostream>
#include<vector>
using namespace std;
int printMatrix(vector<vector<int>> &vec, int n, int m, int i, int j)
{
// If the entire column is traversed
if(j >= m) return 0;
// If the entire row is traversed
if(i >= n) return 1;
// Print the value of the current
// cell of the ... | ALGO | 0.999874 | 3.811109 |
4ae6c8a9-85c3-4c1f-89ae-861d2717a441 | raincross7/code-similarity | codes/train_code/problem406/problem406_201.cpp | #include<iostream>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }
uint64_t getZ() {
uint64_t v = 0; int c;
while((c = getchar_unlocked()) >= '0') v=v*10+c-'0';
return v;
}
int const MAXN = 2e5;
int64_t A[MAXN];
int N;
in... | ALGO | 0.999993 | 4.227476 |
8729de2c-4fe1-43fc-a7d8-a7cd986d295a | rishavranjandtu/DSA_Leetcode | 0106-construct-binary-tree-from-inorder-and-postorder-traversal/0106-construct-binary-tree-from-inorder-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.999974 | 6.130738 |
9c5e4300-4f6d-4542-bd0e-69d8470a7271 | xnmng/LeetCode | 1289-minimum-falling-path-sum-ii/1289-minimum-falling-path-sum-ii.cpp | // class Solution {
// public:
// // optimal space solution: only store indexes
// int minFallingPathSum(vector<vector<int>>& grid) {
// int n = grid.size();
// int minIndex = -1;
// int secondMinIndex = -1;
// for (int i = 0; i < n; ++i) {
// if (minIndex == -1 || gr... | ALGO | 0.999992 | 6.378569 |
77571e97-d15b-4bda-950c-c6be37076f85 | Avinash192211117/Data-structure | array operation.cpp | #include<stdio.h>
int main()
{
int arr[]={1,5,2,3,7,4,9,2},i,pos,val,choice,n;
n=sizeof(arr)/sizeof(arr[0]);
printf("1.Insert \n2.Delete\n");
scanf("%d",&choice);
if(choice==1)
{
printf("Enter the value :");
scanf("%d",&val);
printf("Enter the Position :");
scanf("%d",&pos);
pos--;
n++;
for(i=n;i>=pos;i--)... | ALGO | 0.999873 | 3.116059 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.