uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
70634571-d2ae-4a79-87ef-d6b7e9726e5a | ehnryx/acm | codeforces/997/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<ld> pt;
typedef vector<pt> pol;
const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1... | ALGO | 0.999935 | 4.303735 |
dc83e873-3215-42c3-9cce-c1a34516a772 | arogya01/DSA-Problems | search-insert/main.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int searchInsert(vector<int> &nums, int target)
{
int low = 0, high = nums.size() - 1;
while (low <= high)
{
int mid = low + (high - low) / 2;
if (nums[mid] < target)
{
low = mid + 1;
... | ALGO | 0.999841 | 6.111991 |
fc2f3d2b-e923-44bb-8fa9-7c7eb6465504 | crazy-JiangDongHua/algorithm | leetcode/offer25.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
ListNode dummy(0), *cur=&dummy;
while(l1!=nullptr && l2!=nullp... | ALGO | 0.99996 | 5.972884 |
eb36a8a7-fa30-4fa7-9b44-f6b2e2697900 | lselbeck/DijkstraLab | graphl.cpp | //-----------------------------------------------------------------------//
// GRAPHL.CPP //
// Author: Luke Selbeck //
// Date: April 30th, 2014 //
// Class: CSS 34... | ALGO | 0.99554 | 5.453945 |
613b4158-c0ad-4393-a7c8-4551a44fd77d | simplydesigner/parallel_quick_sort | parallel_quick_sort/main.cpp | #include <iostream>
#include <list>
#include <future>
#include <chrono>
template <typename T>
auto sequential_quick_sort(std::list<T> input) -> std::list<T>
{
if ( input.empty() ) {
return input;
}
std::list<T> result;
result.splice(result.begin(), input, input.begin());
T const &... | ALGO | 0.998984 | 5.728862 |
f9c587e2-2c7a-49bb-b6e5-cb0acf98cd8c | xizhonghua/zoj | vol_28/3798.cpp | // 3829483 2014-11-27 12:46:27 Accepted 3798 C++0x 110 272 xxfflower
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
int compute_min_score(int n) {
if (((n+1)>>1) & 0x01) return 1;
return 0;
}
void solve(int n) {
int min_score = c... | ALGO | 0.999856 | 3.55201 |
b159f551-ed31-47b8-a3cd-b8fff12a47f9 | rajeshwar-nirmal/C-STL | templates.cpp | #include<iostream>
using namespace std;
// int add(int a,int b)
// {
// return a+b;
// }
// float add(float a,float b)
// {
// return a+b;
// }
template <typename T> //just replace the datatype with T
T add(T a,T b)
{
return a+b;
}
int main()
{
int x=10,y=20;
float a=10.2,b=2.1;
cout<<add... | ALGO | 0.989911 | 5.938667 |
acb38e26-f5e2-4510-b096-1497d752801e | kate-ly-zhao/Eckel_ThinkingInCPP | Chp11/PointerToMemberFunction.cpp | //: C11:PointerToMemberFunction.cpp
#include <iostream>
using namespace std;
class Widget {
public:
void f(int) const { cout << "Widget::f()\n"; }
void g(int) const { cout << "Widget::g()\n"; }
void h(int) const { cout << "Widget::h()\n"; }
void i(int) const { cout << "Widget::i()\n"; }
};
int main() {
Widget w... | TOOL | 0.89821 | 5.945463 |
c85fd7ea-50a3-4bf8-aafc-86fbd5220e1d | ishandutta2007/codeforces | wrong/normal/26/B.cpp | #include<cstdio>
char S[1<<20];
int main()
{
int i, cnt = 0, rm = 0;
scanf("%s", S);
for(i=0; S[i]; ++i) {
if(S[i]=='(') cnt++;
else if(cnt==0) rm++;
else cnt--;
}
printf("%d\n", i-rm-cnt);
return 0;
} | ALGO | 0.996836 | 3.584361 |
1063a407-7bb9-424d-b47e-23a39d4aef12 | THU-DSP-LAB/llvm-project | libcxx/test/std/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp | // bitset<N>& operator|=(const bitset<N>& rhs); // constexpr since C++23
#include <bitset>
#include <cassert>
#include <cstddef>
#include <vector>
#include "../bitset_test_cases.h"
#include "test_macros.h"
template <std::size_t N>
TEST_CONSTEXPR_CXX23 void test_op_or_eq() {
std::vector<std::bitset<N> > const cas... | TEST | 0.98724 | 7.76639 |
90eec21c-9fd9-4db2-b804-b7509548ac5b | ishandutta2007/codeforces | koosha_mv/normal/1238/A.cpp | #include<iostream>
using namespace std;
string t( long long x)
{
if(x==1)
return "NO";
return "YES";
}
int main()
{
long long l,x,y;
cin>>l;
for( long long i=0;i<l;i++)
{
cin>>x>>y;
cout<<t(x-y)<<endl;
}
} | ALGO | 0.999929 | 3.59074 |
3300dd43-f3f0-40d2-9c61-f4eed4b68d37 | lattice0/juce_audio_graph_tutorial_android | juce-6.0.8-linux/JUCE/modules/juce_gui_basics/positioning/juce_RelativeParallelogram.cpp | namespace juce
{
RelativeParallelogram::RelativeParallelogram()
{
}
RelativeParallelogram::RelativeParallelogram (const Rectangle<float>& r)
: topLeft (r.getTopLeft()), topRight (r.getTopRight()), bottomLeft (r.getBottomLeft())
{
}
RelativeParallelogram::RelativeParallelogram (const RelativePoint& topLeft_, cons... | TOOL | 0.857404 | 5.924403 |
d35e8b86-86da-408f-abaf-575e6a4a4767 | lyyiangang/leetcode | 55.跳跃游戏.cpp | /*
* @lc app=leetcode.cn id=55 lang=cpp
*
* [55] 跳跃游戏
*
* https://leetcode-cn.com/problems/jump-game/description/
*
* algorithms
* Medium (37.94%)
* Likes: 481
* Dislikes: 0
* Total Accepted: 64K
* Total Submissions: 167.7K
* Testcase Example: '[2,3,1,1,4]'
*
* 给定一个非负整数数组,你最初位于数组的第一个位置。
*
* 数组中... | ALGO | 0.999875 | 6.026225 |
5911d5d9-b223-4945-be0e-d229248426ea | Beannn/bitcoinStudy | src/crypto/hmac_sha512.cpp | #include <crypto/hmac_sha512.h>
#include <string.h>
CHMAC_SHA512::CHMAC_SHA512(const unsigned char* key, size_t keylen)
{
unsigned char rkey[128];
if (keylen <= 128) {
memcpy(rkey, key, keylen);
memset(rkey + keylen, 0, 128 - keylen);
} else {
CSHA512().Write(key, keylen).Finalize(... | ALGO | 0.93776 | 5.726457 |
cd2d404b-fc7d-48b5-a6de-63417a4b4959 | Manmohit11/dsa_notes | Recursion/Sum.cpp | //Sum of an array using recusrion
#include<bits/stdc++.h>
using namespace std;
int rec(int arr[], int size){
int sum = 0;
if (size==0){
return 0;
}
else{
int ans = arr[0]+rec(arr+1,size-1);
return ans;
}
}
int main(){
int size = 5;
int arr[size]={3,2,1,6,4};
i... | ALGO | 0.999904 | 5.240187 |
d9d35262-8bfb-4c69-8709-44f4ca3a0944 | asubramanian08/USACO | Silver/2012-2013/MAR2013/q3.cpp | // Start: 8:54
// Think: 9:08
// Write: 9:42
// Debug: 9:46
#include <iostream>
#include <algorithm>
using namespace std;
#define MAX_COWS 1'000
int cost[MAX_COWS][MAX_COWS][2];
#define INF 1'000'000'000
int main(void)
{
//read
#ifndef HOME
freopen("cowrun.in", "r", stdin);
freopen("cowrun.out", "w", stdo... | ALGO | 0.999969 | 3.940564 |
107a289a-ef7a-48b6-8b2a-3bc582f4cd91 | ishandutta2007/codeforces | isonan/normal/793/F.cpp | #include <cstdio>
#include <vector>
int n,m,q,l[100001],r[100001],x[100001],y[100001],ans[100001];
std::vector<int>line[100001],que[100001];
int se[1000001],lazy[1000001];
void pushdown(int x,int y){
se[x]=std::max(se[x],y);
lazy[x]=std::max(lazy[x],y);
}
void spread(int x){
if(lazy[x]){
pushdown(x<<1,lazy[x]);
... | ALGO | 0.999996 | 3.935778 |
cb383e92-4112-46b9-9dc9-0a1968c6a623 | jude2333/Leetcode-Solutions | cpp/0621-task-scheduler.cpp | /*
Given array of tasks & cooldown b/w same tasks, return least # of units of time
Ex. tasks = ["A","A","A","B","B","B"] n = 2 -> 8 (A->B->idle->A->B->idle->A->B)
Key is to determine # of idles, greedy: always arrange task w/ most freq first
3A, 2B, 1C -> A??A??A -> AB?AB?A -> ABCAB#A, since A most fre... | ALGO | 0.999908 | 7.141819 |
56ffa32b-6286-4c22-bbd5-9463b91bfbc5 | hs094/CP | Codeforces/Codeforces Round #374 (Div. 2)/B_Passwords.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#inc... | ALGO | 0.999905 | 4.721174 |
3696994e-01c4-4ebd-bc7c-c8b910997e8b | rokibulrft/Week-8 | Day-5/B_Keep_it_Beautiful.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
string result;
int last_in = -1;
bool choto_ashc... | ALGO | 0.999985 | 4.368481 |
85605eb7-0fe4-44b2-923a-1637487f72bd | AmadeoDelgado/Bullet-Catapult | libraries/bullet-2.84/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp | #if defined (_WIN32) || defined (__i386__)
#define BT_USE_SSE_IN_API
#endif
#include "btMultiSphereShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
#include "LinearMath/btSerializer.h"
btMultiSphereShape::btMultiSphereShape (const btVector3* positions,const ... | ALGO | 0.920096 | 6.891391 |
f31e8b2c-93ad-410a-83c4-9b0fdc5f25be | TURX/Algorithm-CodeLib | Luogu/SP2713.cpp | #include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAXN 100001
#define lson(x) x << 1
#define rson(x) x << 1 | 1
long long globRes[MAXN << 2], tag[MAXN << 2], input[MAXN];
inline void preProcess(const int& id, const int& l, const int& r) {
if(l == r) {
... | ALGO | 0.99995 | 4.216208 |
979de6e9-d99b-4038-ba2e-b77bf64d1e22 | ParBLiSS/parconnect | ext/CombBLAS/FullyDistSpVec.cpp | /****************************************************************/
/* Parallel Combinatorial BLAS Library (for Graph Computations) */
/* version 1.5 -------------------------------------------------*/
/* date: 10/09/2015 ---------------------------------------------*/
/* authors: Ariful Azad, Aydin Buluc, Adam Lugowski... | ALGO | 0.994408 | 4.774415 |
c5d03821-329d-413d-8064-9da75af01f3c | Shantanu9799/LeetCode-Problems | SmallestEvenMultiple.cpp | class Solution {
public:
int smallestEvenMultiple(int n) {
return ((n & 1) == 1) ? n*2 : n;
}
}; | ALGO | 0.998736 | 6.3413 |
3e0e23c4-1505-4439-bb27-1cef88d2bd85 | jJayyyyyyy/OJ | LeetCode/_1301_1400/P1351_Count_Negative_Numbers_in_a_Sorted_Matrix.cpp | /*
https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/description/?goto=old
同类题目 P1351
一个矩阵,每行和每列的数都是非增的,找出矩阵中负数的个数
思路
二分查找
https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/discuss/510217/C++-Three-Methods
http://www.cplusplus.com/reference/algorithm/upper_bound/
*/
#in... | ALGO | 0.999931 | 6.064637 |
513d64bf-e1ba-425e-ac60-8aeb1fc3390b | ZeEzTw/RootCalib | src/EliadeMathFunctions.cpp | #include "../include/EliadeMathFunctions.h"
#include <cmath>
#include <algorithm>
std::vector<std::vector<double>> EliadeMathFunctions::multiplyTransposeMatrix(const std::vector<std::vector<double>> &X) {
int rows = X.size();
int cols = X[0].size();
std::vector<std::vector<double>> XtX(cols, std::vector<do... | ALGO | 0.999832 | 6.086883 |
63f6d349-cefd-41ca-93ed-fb3c4baf0dfd | d4nc3w/CPP-Course-Tasks | RemovingNbiggestElements.cpp | /* Create a function called eraseNBiggest(), which will accept a vector of real numbers and an integer n as arguments.
It should remove n biggest values from the passed vector. */
#include <iostream>
#include <vector>
#include <algorithm>
auto eraseNBiggest(std::vector<double> vec, int n) -> std::vector<double> {
... | ALGO | 0.999935 | 7.054868 |
4b1f00b5-857c-448c-bcd0-36b282f7feca | upamasharmin/Codeforce-Submissions | Codeforce submission/priority.cpp | #include<iostream>
#include<stdio.h>
#include<queue>
using namespace std;
int main(){
priority_queue<int>q;
q.push(300):
q.push(290);
q.push(187);
q.push(97):
q.push(28);
q.push(8);
while(!q.empty()){
int x;
x=q.top();
cout<<x<<endl;
q.pop();
}
return 0;
}
| ALGO | 0.999256 | 3.143981 |
972fcc8d-3ef3-4f1e-898b-84806e2d6c94 | boatinw99/CompetitiveProgramming | GoforCU/Bomb.cpp | #include<bits/stdc++.h>
using namespace std;
vector<pair<int,int> >v;
vector<pair<int,int> >::iterator it;
main()
{
int i,m,x,y ;
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d %d",&x,&y);
v.push_back({x,y});
}
sort(v.begin(),v.end());
int max1=0,max2=0;
for(it=v.end()-1;it>=v.begin();it--)
{
if(it->second... | ALGO | 0.999944 | 3.649747 |
d5ab48ff-dbd3-478b-a8f7-94b38146b916 | arronelab/CarbonARA | src/experimentalData.cpp | #include "experimentalData.h"
experimentalData::experimentalData(const char* scatterFile){
noDistBins =10000;
/************************************************
read in the scattering
***********************************************/
std::ifstream scatterdat;
scatterdat.open(scatterFile);
std::string s... | ALGO | 0.991203 | 4.186388 |
4794ad23-ab1d-4a3f-8c8b-bbeefb023589 | Sungijnwoo/Coding-Test | 7579/7579.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct app
{
int mem;
int cost;
};
int main()
{
int N, M;
cin >> N >> M;
// :
vector<vector<int>> dp(N, vector<int>(10001));
vector<app> apps(N);
for (int i = 0; i < N; ++i)
{
int memIn;
cin >> memIn;
apps[i].mem = memIn;... | ALGO | 0.999987 | 3.899338 |
74d65c3e-301e-447b-9c6d-b642521e290f | diya-burman/Daily-DSA | Stacks and Queues/Prefix, Infix, PostFix Conversion Problems/prefixToPostfix.cpp | #include <iostream>
#include <stack>
using namespace std;
class Solution
{
public:
string preToPost(string pre_exp)
{
int n = pre_exp.size();
int i = n - 1;
stack<string> st;
while (i >= 0)
{
if ((pre_exp[i] >= 'A' && pre_exp[i] <= 'Z') || (pre_exp[i] >= 'a'... | ALGO | 0.99992 | 4.878969 |
a9f4d872-760b-4011-aeac-8d8ac1561561 | M4573R/competitive-programming-archive | codeforces/round-275/div-2/counterexample.cpp | #include <iostream>
using namespace std;
inline
void use_io_optimizations()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main()
{
use_io_optimizations();
unsigned long long lower;
unsigned long long upper;
cin >> lower >> upper;
if (lower % 2)
{
++lower;
... | ALGO | 0.999741 | 4.423526 |
9e458570-6969-4398-a0f6-6e73382a11c9 | rosjdr/programacao_competitiva | c++/beeCrowd1253/beeCrowd1253.cpp | #include "bits/stdc++.h"
using namespace std;
int main(){
string letras = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int n;
cin >> n;
for(int i=0;i<n;i++){
string frase;
string traducao = "";
int chave;
cin >> frase;
cin >> chave;
for(int i=0;i<frase.length();i++){
... | ALGO | 0.999907 | 4.444186 |
d5a12bd2-d30d-4945-bc16-1da1981e9998 | Haoson/algorithm-hodgepodge | algorithm_problems/dp/barcode.cpp | /*************************************************************************
> File Name: barcode.cpp
> Author:Haoson
> Created Time: Fri 14 Nov 2014 05:57:22 AM PST
> Description:Codeforces 225C-Barcode(http://codeforces.com/problemset/problem/225/C)
************************************************************... | ALGO | 0.999782 | 3.760966 |
931a2e1d-f044-47b3-8b8f-4820e4a7994f | mayanjain/Codeforces | Round #826/D_Masha_and_a_Beautiful_Tree.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define ull unsigned long long
#define mod 1000000007
#define mod1 998244353
#define ordered_set tree<ll, null_type,less<ll>... | ALGO | 0.998533 | 4.141881 |
e50f87ac-ffdf-40e5-950e-21065b6f3d3b | blueskyson/leethub | 0513-find-bottom-left-tree-value/0513-find-bottom-left-tree-value.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.99999 | 6.428229 |
85988e42-da03-4437-82a0-f20ce11200d0 | nguyen-ngocduong/KTLT-PTIT | KTDAYSO005 - Số cô đơn.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t; cin >> t;
while(t--){
int n; cin >> n;
map<int,int> mp;
for(int i = 0; i < n; i++){
int x; cin >> x;
mp[x]++;
}
int cnt = 0;
for(auto x : mp){
if(x.second == 1) cn... | ALGO | 0.999809 | 4.312955 |
7f820c2c-d007-486f-b355-44745f74a4d1 | jex23/radom_code | handle_item.cpp | // Random C++ function generated on 2025-07-29
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
struct Item {
int id;
std::string name;
double value;
Item(int id, const std::string& name, double value)
: id(id), name(name), value(value) {}
};
std::vector<Item>... | TOOL | 0.878403 | 6.89405 |
ed858bc6-68ce-4c43-8a49-7385a1b35dac | naringcode/algorithm-training | BaekjoonOnlineJudge/dynamic_programming/17626.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
int dp[50004];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> n;
ranges::fill(dp, 999'999'999);
for (int i = 1; i * i <= n; i++)
{
dp[i * i] = 1;
}
f... | ALGO | 0.999869 | 4.735479 |
868f9868-204b-4c4c-9af1-013a46b4d742 | asimihsan/Diceware | Diceware/Diceware/cryptopp561/luc.cpp | // luc.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "luc.h"
#include "asn.h"
#include "nbtheory.h"
#include "sha.h"
#include "algparam.h"
NAMESPACE_BEGIN(CryptoPP)
void LUC_TestInstantiations()
{
LUC_HMP<SHA>::Signer t1;
LUCFunction t2;
InvertibleLUCFunction t3;
}
void DL_Al... | ALGO | 0.854569 | 5.458501 |
75484235-e228-4eb0-9956-5be38c386a56 | drwalton/ray-tracer-lab | 3rdParty/eigen-3.4.0/bench/benchmarkX.cpp | // g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef MATTYPE
#define MATTYPE MatrixXLd
#endif
#ifndef MATSIZE
#define MATSIZE 400
#endif
#ifndef REPEAT
#define REPEAT 100
#endif
int mai... | ALGO | 0.937494 | 3.370773 |
a8ba3928-eea1-468e-9a4a-b1fe21ce7002 | fwsGonzo/routeperf | smp_ship.cpp | /**
* Routing with
* Symmetric MultiProcessing
*
**/
#include <smp>
#include <net/inet4>
#include <kernel/irq_manager.hpp>
#include <vector>
using namespace net;
struct alignas(128) packet_handoff
{
int current_queue = 0;
Inet<IP4>* inet_stack;
uint8_t bcast_irq;
spinlock_t qlock;
alignas(64) s... | TOOL | 0.956435 | 5.895243 |
77ae0bc6-baa8-4b8c-a54b-009713023437 | codemonkeyricky/lc | 1237.cpp | #include <iostream>
#include <vector>
#include <cassert>
#include <stack>
#include <queue>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <cmath>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
... | ALGO | 0.999887 | 4.497415 |
d60ae285-23aa-4a37-9172-b68ab8181f7b | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5131_16.cpp | #include <bits/stdc++.h>
using namespace std;
long long dmg, heal, coef, d;
long long f(long long cnt) {
long long sm = dmg * cnt;
long long mx = coef / d;
if (mx > cnt - 1) {
mx = cnt - 1;
}
sm -= (mx * (mx + 1) / 2) * d * heal;
sm -= (cnt - 1 - mx) * coef * heal;
return sm;
}
void input() { cin >> d... | ALGO | 0.99972 | 3.702729 |
e294c18b-7380-472f-a0e7-471bb4635c8d | Alfeim/njuee_LeetCode_Solutions | Cpp/Submit Records/665. Non-decreasing Array.cpp | /********************************************
作者:Alfeim
题目:非递减序列
时间消耗:32ms
解题思路:没啥好说的..
********************************************/
class Solution {
public:
bool checkPossibility(vector<int>& nums) {
int n = nums.size();
int tmp = 0;
for(int i = 1 ; i < n ; ++i){
if(n... | ALGO | 0.999999 | 5.697518 |
11eeb1d1-5f78-480a-b619-04971022ddfe | uniqss/leetcodecpp | 1926/1926_NearestExitfromEntranceinMaze1.cpp | #include "../inc.h"
class Solution {
public:
int nearestExit(vector<vector<char>>& maze, vector<int>& entrance) {
int m = maze.size(), n = maze[0].size();
maze[entrance[0]][entrance[1]] = '+';
for (int i = 0; i < m; ++i) {
if (maze[i][0] == '.') maze[i][0] = 'o';
... | ALGO | 0.999843 | 5.687192 |
c43bd15b-06a9-4bad-bc70-47f5c2a5d3cf | Thirisha304/hangoverspace | 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 |
1058006f-487a-4eb1-84e8-e9889340b520 | raymondyfei/libwetcloth | include/igl/gaussian_curvature.cpp | template <typename DerivedV, typename DerivedF, typename DerivedK>
IGL_INLINE void igl::gaussian_curvature(
const Eigen::PlainObjectBase<DerivedV>& V,
const Eigen::PlainObjectBase<DerivedF>& F,
Eigen::PlainObjectBase<DerivedK> & K)
{
using namespace Eigen;
using namespace std;
// internal corner angles
Ma... | ALGO | 0.996877 | 5.808574 |
0b4ecbdc-4a33-4ef6-bd9f-0ba25550fe90 | accseal/Accseal_zprize | gpu-groth16-prover-3x/depends/libfqfft/tutorials/polynomial_evaluation_example.cpp | #include <cstdio>
#include <memory>
#include <vector>
#include <libff/common/double.hpp>
#include <libfqfft/evaluation_domain/get_evaluation_domain.hpp>
using namespace libfqfft;
/* Polynomial Evaluation */
template <typename FieldT>
void polynomial_evaluation_example ()
{
/* Domain size */
size_t m = 4;
/* E... | ALGO | 0.994966 | 5.416157 |
f54e14a6-6a7e-4ace-bd61-e031e55b64b7 | mdarafat1819/Code-Library | Data Structure/Linked List/Doubly Linked List/1. append a node in doubly linked list.cpp | #include <bits/stdc++.h>
using namespace std;
typedef struct node Node;
struct node
{
int data;
Node *prev;
Node *next;
};
void append(Node *head, int data)
{
Node *new_node = (Node*)malloc(sizeof(Node));
new_node -> data = data;
new_node -> prev = NULL;
new_node -> next = NULL;
whil... | ALGO | 0.999829 | 4.735784 |
06bf2add-763a-4f7b-a61f-f306c06de87f | Varshini11113/TechDose_Training | 2519-find-the-original-array-of-prefix-xor/find-the-original-array-of-prefix-xor.cpp | class Solution {
public:
vector<int> findArray(vector<int>& pref) {
int n = pref.size();
// vector<int>arr(n);
for(int i = n-1; i>0; i--){
pref[i] ^= pref[i-1];
}
return pref;
}
}; | ALGO | 0.999988 | 5.270436 |
c70e42b0-f01f-4218-96ee-51754a418753 | mdaarif04/Code | C++/Old Code/findArray.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin>>arr[i];
}
for (int i = 0; i < n; i++)
{
cout<<"The Array is "<<arr[i]<<" "<<endl;
}
int index;
cin>>index;
cout<<"The array is "<<arr[index]... | ALGO | 0.99667 | 3.559622 |
29eeb22d-8c85-435b-8835-e536e7774701 | umarfaruk2/code_forces | basic_problem/twins.cpp | #include <bits/stdc++.h>
using namespace std;
int calculate_coin(vector<int> arr)
{
int sum = 0;
for (int i = 0; i < arr.size(); i++)
{
sum += arr[i];
}
int half = sum/2;
int my_sum = 0;
int ans = 0;
for(int i = 0; i < arr.size(); i++) {
if(my_sum > half) {
... | ALGO | 0.999792 | 4.701107 |
499c5dac-5004-4560-9a23-537397c651cd | Esperanzalukas/my-abacus-develop-fork | tools/SIAB/SimulatedAnnealing/backup_old_version/1_Source/src_pw/bessel_basis.cpp | #include "bessel_basis.h"
#include "../src_parallel/parallel_common.h"
Bessel_Basis::Bessel_Basis()
{
Dk = 0.0;
}
Bessel_Basis::~Bessel_Basis()
{
}
// the function is called in numerical_basis.
void Bessel_Basis::init(
const double &dk,
const double &dr)
{
TITLE("Bessel_Basis", "init");
this->Dk = dk;
// to ... | ALGO | 0.9964 | 4.294991 |
4eeaf3bf-5e93-442d-89bb-ca2d5eb0176f | Moonhoro/Algorithm-learning-daily | day03/前缀和.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, m;
cout << "输入整数的个数:" << endl;
cin >> n;
cout << "输入求和次数" << endl;
cin >> m;
vector<int> v;
int t;
cout << "输入整数" << endl;
for (int i = 0; i < n; i++)
{
cin >> t;
v.push_back(t);
... | ALGO | 0.999948 | 4.047932 |
2f8d0828-8397-431f-9f3a-8366c9b55b61 | ishandutta2007/codeforces | rns_cus/normal/809/B.cpp | #include<bits/stdc++.h>
using namespace std;
char s[100];
int n, k, ans1, ans2;
bool OK(int x, int y) {
printf("1 %d %d\n", x, y);
fflush(stdout);
scanf("%s", s);
if(s[0] == 'T') return true;
return false;
}
int solve(int st, int en) {
while(st < en){
int mid = (st + en) >> 1;
if(OK(mid, mid + 1)) en = mi... | ALGO | 0.999939 | 3.073408 |
1f37b135-78a2-4e89-a2b3-4042d5236896 | dush1729/cp | submission/leetcode/biweekly/33/03-minimum-numbers-of-function-calls-to-make-target-array.cpp | #include "bits/stdc++.h"
using namespace std;
class Solution
{
public:
int minOperations(vector<int> &a, int steps = 0)
{
int mx = *max_element(a.begin(), a.end());
if(mx == 0) return steps;
for(auto &i : a)
if(i % 2) i--, steps++;
mx = *max_element(a.begin(), a.en... | ALGO | 0.999798 | 5.167243 |
853eb1e7-79a2-4852-99a1-ebfabb57216f | gaetanocolella/visp_yaskawa | src/clik.cpp | #include "ros/ros.h"
#include "Robots/MotomanSIA5F.h"
#include <std_msgs/Float64MultiArray.h>
#include <sensor_msgs/JointState.h>
#include "geometry_msgs/PoseStamped.h"
#include "geometry_msgs/TwistStamped.h"
#include <std_msgs/Bool.h>
#define dim_T 4
bool joint_ok_init;
using namespace TooN;
using namespace std;
V... | TOOL | 0.858647 | 5.047616 |
48425408-3360-46ed-bd86-4d6c90932c96 | JJH-Log/BaekjoonOnlineJudgeSolvedList | 202108/8M2W/B14722.cpp | #include <iostream>
#include <vector>
#include <string> //substr
#include <map>
#include <queue>
#include <stack>
#include <utility> //pair
#include <algorithm> //sort, reverse
#include <math.h> // sqrt
#include <set>
#include <cassert>
#define MOD 1000000007
#define MININT -2147483647
#define MAXINT 2147483647
using ... | ALGO | 0.999716 | 4.287154 |
21735b39-efed-4148-8af4-1cd1f57bfdf3 | yeye921/Algorithm-cpp | SWEA/2007.cpp | // 각 문자열의 길이는 30, 마디의 최대 길이는 10
// 패턴에서 반복되는 부분을 마디라고 함. 마디의 길이를 출력하는 문제
// 규칙: 반복되는 마디 중 가장 짧은 것 & 바로 뒤에 반복되는 마디가 또 나와야 함
#include <iostream>
using namespace std;
int T, test_case;
string str;
int ret;
int main(){
cin >> T;
for(int test_case = 1; test_case <= T; test_case++){
cin >> str;
// 문자열... | ALGO | 0.999133 | 4.355955 |
454a3d31-8830-4efb-96e6-496265284e60 | yvvzh/flavor_poc | 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 |
e6274ccd-33b9-4818-9732-640267456fbc | jelmerbe/Financial-Computing-C- | CppCourse/Libraries/Utils/Src/MyRand.cpp | #include "Utils/UtilityFunctions.hpp"
#include <random>
#include <functional>
#include <algorithm>
typedef std::mt19937 base_generator_type;//!< generator engine
typedef std::mt19937::result_type result_type;
typedef std::normal_distribution<> normal_distribution;
namespace utils {
template<class bvector>
clas... | TOOL | 0.942718 | 4.184931 |
c29f3f66-4a4f-418f-91c6-aa95695e8ac1 | Sumanth-NR/CompetitiveProgramming | Platforms/CodeForces/Rounds_0801-0850/Round812_Div2/C_Build_Permutation.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> dp;
void updateDP(int n) {
if (n < 0) return;
if (n == 0) { dp[0] = 0; return; }
if (n == 1) { dp[0] = 1; dp[1] = 0; return; }
int k = (int)ceil(sqrt(n));
int req = k * k;
for (int i = req-n; i <= n; i++) dp[i] = req-i;
updateDP(req... | ALGO | 0.999699 | 4.443933 |
8f5d87d0-23a5-4858-9cf9-22ef8d62ce6c | bioyoshoo/atcoder | Boot-camp/Medium-lap2/75.cpp | #include <bits/stdc++.h>
using namespace std;
int score(char hand, int R, int S, int P) {
if (hand == 'r') return P;
else if (hand == 's') return R;
else return S;
}
int main() {
int N, K, R, S, P;
cin >> N >> K >> R >> S >> P;
string T;
cin >> T;
int64_t ans = 0;
for (int k = 0; ... | ALGO | 0.999245 | 4.030463 |
8b6ae4b0-70c1-4da8-85b0-dc00a8e9a087 | Sunil-1508/Problem-Solving | Maximum sum leaf to root path - GFG/maximum-sum-leaf-to-root-path.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val) {
Node* temp = new Node;
temp->data = val... | ALGO | 0.999845 | 6.748278 |
d86a0657-727f-4a5c-97fb-19ae9d0663e8 | raincross7/code-similarity | codes/train_code/problem394/problem394_319.cpp | #include <stdio.h>
#include <ctype.h>
char c[1200];
int cnt[27];
int main()
{
char ch;
int n;
while(scanf("%s", c) != EOF) {
for (int i = 0; c[i] != '\0'; ++i) {
ch = tolower(c[i]);
n = ch - '0';
if (n < 49 || n > 74) continue;
++cnt[n-49];
}
... | ALGO | 0.998537 | 3.241633 |
19881073-c485-4da5-95f4-303c0667915d | conradsoon/competitive_programming | kickstart/roundh/Transform_the_String.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
using vvi = vector<vi>;
using vvl =... | ALGO | 0.999851 | 5.273858 |
e279c618-8119-4841-8a07-51a3a3817534 | masterboy376/dsa_tutorial | real-problems/prob17.cpp | #include <iostream>
using namespace std;
// BIT manipulation problems basic
int isPowerOfTwo(int n){
return (n && !(n & (n-1)));
}
void printSubArrays(int a[], int n){
for(int i = 0; i<(1<<n); i++){
for(int j = 0; j<n;j++){
if(i & (1<<j)){
cout<<a[j]<<" ";
}
... | ALGO | 0.983103 | 4.816607 |
d7a016fc-cbf7-4344-ad09-87d0f422f8d2 | julioCROS/Programacao-Competitiva | 1262.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
string entrada;
while(cin >> entrada) {
int qntde;
cin >> qntde;
int cont = 0;
int contR = 0;
for(int i = 0; i < entrada.length(); i++){
if(entrada[i] == 'W'){
contR = 0;
cont+... | ALGO | 0.999409 | 3.625956 |
3a34b765-5e3f-4fae-a970-b3d6087ed421 | unstoppableayush/CPP-Codes | addtion.cpp | /*Program to print sum of two number*/
#include<iostream>
using namespace std;
int main()
{
int num1;
int num2;
int sum;
cout<<"Enter two numbers separated by space:"<<endl;
cin>>num1>>num2;
sum=num1+num2;
cout<<num1<<" + "<<num2<<" = "<<sum<<endl;
return 0;
}
| TOOL | 0.944117 | 4.111396 |
022a6931-dd7b-4f3e-94d8-3b9d8666cd23 | chauhansatyam3112/DSA-problems | 0459-repeated-substring-pattern/0459-repeated-substring-pattern.cpp | class Solution {
public:
bool repeatedSubstringPattern(string s) {
// string res="",ans="";
// unordered_map<char,int>mp;
// int n=s.length();
// for(int i=0;i<s.length();i++)
// {
// mp[s[i]]++;
// }
// for(auto it:mp)
// {
//... | ALGO | 0.999945 | 5.631526 |
bd61a019-5029-4166-adb4-f96a9331ea4a | The-Obsidian-Eyes/codeforces.com | A-Tram.cpp | //A. Tram
//https://codeforces.com/problemset/problem/116/A
#include<iostream>
using namespace std;
int main()
{
int n,a,b,c=0,max=0;
cin >> n;
for(int i=1;i<=n;i++)
{
cin >> a >> b;
c = c-a+b;
if(c>max)
{
max=c;
}
}
cout <<max;
return 0... | ALGO | 0.999929 | 3.830034 |
bd449500-a4e4-48eb-bfd0-4e8e10fe7270 | kritika0598/codes | lcm.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
lli cnt=0;
void printDivisors(lli n)
{
// Note that this loop runs till square root
for (lli i=1; i<=sqrt(n); i++)
{
if (n%i == 0)
{
// If divisors are equal, print only one
... | ALGO | 0.999695 | 5.120956 |
1c554885-8ccd-444e-849f-c05c2f61f4f9 | noob-nilarghya/Striver-SDE-Sheet | Day-12/KmaxSubCombination.cpp | // [ IMPORTANT ]
#include <bits/stdc++.h>
vector<int> kMaxSumCombination(vector<int> &a, vector<int> &b, int n, int k){
vector<int> ans;
sort(a.begin(), a.end(), greater<int>()); sort(b.begin(), b.end(), greater<int>());
priority_queue< pair<int, pair<int,int>>, vector<pair<int, pair<int,int>>> > maxPQ;
... | ALGO | 0.999977 | 3.648923 |
6b38fc9c-7e21-49f8-b3ac-bc930bb4eed4 | sirparashar/Dsa_Solutions | 45-jump-game-ii/jump-game-ii.cpp | class Solution {
public:
int jump(vector<int>& nums) {
int n = nums.size();
int i = 0;
int jump=0;
while (i < n-1) {
if(i+nums[i]>=n-1){
jump++;
break;
}
int maxind=i+1;
int maxval=0;
for(int j=... | ALGO | 0.999983 | 5.800998 |
5b35e60c-3c8d-46a1-a562-4eeb3f6961a6 | Adityaa77/Striver_A2Z_Dsa_Sheet | Learn LinkedList [Single LL,Double LL,Medium,Hard Problems]/Learn Doubly Linked List/DLL All in one.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
void setupIO() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
}
class Node {
public:
int data;
Node* next;
Node* prev;
Node(int data1, Node* next1 = nullptr, Node* prev1 = nullptr) {
data = data1... | ALGO | 0.999925 | 4.570506 |
f0cfaaf1-f152-4ade-b822-428cfd71ddfc | AvanishShukla20/Leetcode-problems | 794-swim-in-rising-water/swim-in-rising-water.cpp | class Solution {
public:
bool check(int i, int j, int limit, vector<vector<int>>& grid, vector<vector<int>>& vis)
{
int m=grid.size(), n=grid[0].size();
if(grid[i][j] > limit) return false;
if(i == m-1 && j == n-1) return true;
vis[i][j] = 1;
vector<vector<int>>... | ALGO | 0.999997 | 6.066664 |
37a861ee-4da0-4aed-86a7-1c32db583bf8 | shidahe/semidense-lines | Thirdparty/g2o/g2o/core/optimization_algorithm_with_hessian.cpp | #include "optimization_algorithm_with_hessian.h"
#include "solver.h"
#include "optimizable_graph.h"
#include "sparse_optimizer.h"
#include <iostream>
using namespace std;
namespace g2o {
OptimizationAlgorithmWithHessian::OptimizationAlgorithmWithHessian(Solver* solver) :
OptimizationAlgorithm(),
_solver(s... | ALGO | 0.991705 | 6.811634 |
ddf603c7-2487-4fc0-a325-f4f8612af440 | ashnove/cp-submissions | codeforces/1521/B.cpp | /*
* @author : ashnove
*/
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define Th third
#define nl cout << endl;
#define pb push_back
#define f(i, a, b) for (ll i = a; i < b; i++)
#define what_is(x) cerr << #x << " is " << x <<... | ALGO | 0.999901 | 3.593035 |
434017c4-bae8-4e98-ad6e-b4ba601e0952 | ailab-hanyang/Radar4VoxMap | thrid_party_library/g2o/g2o/apps/g2o_hierarchical/backbone_tree_action.cpp | #include <limits>
#include "g2o/core/factory.h"
#include "backbone_tree_action.h"
#include "edge_types_cost_function.h"
namespace g2o {
using namespace std;
BackBoneTreeAction::BackBoneTreeAction(SparseOptimizer* optimizer, std::string vertexTag, int level, int step):
_optimizer(optimizer),
_vertexTag(ver... | ALGO | 0.980325 | 5.023257 |
e49be6f3-8a63-4205-a37b-72194a5a1587 | Dim4x4777/day2 | mp/src/cryptopp/serpent.cpp | // serpent.cpp - originally written and placed in the public domain by Wei Dai
#include "pch.h"
#include "serpent.h"
#include "secblock.h"
#include "misc.h"
#include "serpentp.h"
NAMESPACE_BEGIN(CryptoPP)
void Serpent_KeySchedule(word32 *k, unsigned int rounds, const byte *userKey, size_t keylen)
{
FixedSizeSecBl... | ALGO | 0.999747 | 7.557911 |
eb2ff038-deaf-4a4d-a501-051d5c45ac6b | hoang1007/CodeSpace | CC++/Courses/Loop/24matrixnumber.cpp | #include <iostream>
using namespace std;
int main()
{
int n; cin >> n;
for (int i = 1; i <= n; i++)
{
for (int j = i; j <= n; j++)
cout << j << " ";
for (int j = 1; j < i; j++)
cout << j << " ";
cout << endl;
}
} | ALGO | 0.99987 | 3.938164 |
2eb6f22c-9159-4555-a6e6-5c11aa80172b | s0urav6529/Codeforces-Solutions | 1283A CF.cpp | #include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int tc,hr,min;
cin>>tc;
while(tc--)
{
cin>>hr>>min;
hr=23-hr;
min=60-min;
cout<<(hr*60)+min<<endl;
}
return 0;
}
| ALGO | 0.993322 | 3.599907 |
13cf0b8c-ad1d-4362-bb8a-9c6c4df789db | PF94/Bluff3D | source/G3Dcpp/MeshAlgWeld.cpp | #include "G3D/MeshAlg.h"
#include "G3D/Table.h"
#include "G3D/Set.h"
namespace G3D {
namespace _internal {
class Welder {
private:
// Intentionally illegal
Welder &operator=(const Welder &w);
public:
/** Indices of newVertexArray elements in <B>or nea... | ALGO | 0.999065 | 7.007676 |
876ed6e8-54ba-44ac-ad70-f4afbf54bb42 | Nehavaghela1221/C-and-C- | C++/Untitled1.cpp | #include <iostrem>
using namespace std;
class Myclass{
public:
myclass() //constructor it call starting site
{
cout<<"Hello Neha Welcome"<<endl;
}
prime() //method
{
int n,i,prime=0;
cout<<"Enter number:";
cin>>n;
for(i=1;i<=n;i++){
if(n%1==0){
prime++;
}
if(prime==2){
cout"numvre i... | ALGO | 0.975055 | 3.597411 |
29992a38-f991-4e74-9ddc-8e27ad10e08a | H3kapoo/hkui_lib | src/treeHelpers/FastTreeSort.cpp | #include "../../include/hkui/treeHelpers/FastTreeSort.hpp"
#include "../../include/hkui/treeHelpers/RectNodeABC.hpp"
namespace treeHelpers
{
void FastTreeSort::sortBuffer(RectNodeABC* root,
const std::function<bool(const RectNodeABC* x, const RectNodeABC* y)> sortFunc)
{
gBuffer.clear();
recPushChildren(r... | ALGO | 0.997378 | 6.190316 |
3774dd20-f3c4-4273-a276-10d48e21bc60 | N3X15/Luna-Viewer | indra/llvfs/lldir_linux.cpp | /**
* @file lldir_linux.cpp
* @brief Implementation of directory utilities for linux
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you und... | TOOL | 0.912093 | 5.742858 |
438b3fd3-97dd-4b7b-999a-353e25a32089 | sandhyashiwakoti/learn-cpp | 3-conditional-statement/11-short-hand-if.cpp | #include <iostream>
using namespace std;
int main() {
int a=2;
int b=4;
int c=6;
cout<<"Max number is: ";
(a>b && a>c) ? cout<<a:(b>c) ? cout<<b:cout<<c;
cout<<endl<<"Min number is: ";
(a<b && a<c) ? cout<<a:(b<c) ? cout<<b : cout<<c;
return 0;
} | ALGO | 0.993075 | 3.205751 |
00a71729-dcde-44c8-acea-9da2b996e3c2 | wassimalharaki/Codeforces | 1800/Mikasa.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define nl '\n'
#define v vector
#ifdef WASSIM
#include "debug.h"
#else
#define dbg(...)
#endif
void solve() {
int n, m; cin >> n >> m;
int x = ((1 << 31) - 1) ^ n;
auto exists = [&](int y) -> bool {
return (n ^ y) <= m;
};
... | ALGO | 0.999951 | 5.26211 |
990b6116-abda-4980-9a0d-38d7eee90e8a | Abdullah-Bin-Hasan01/phitron-course | week 6 day 03/C_Maximum_Median.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0;i < n;i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
auto ok = [&](long long mid) {
long long cnt = 0;
for (int i = (n / 2);i < n;i++) {
... | ALGO | 0.999997 | 4.741211 |
853b2fd9-0ea6-490e-a49b-53752eba007c | Uspud/Weird | BOJ/C++/Dynamic_Programming/12865.cpp | #include <iostream>
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); // ϱ
using namespace std;
int mem[101][100001];
int main(void) {
fastio;
int n, k; cin >> n >> k;
int w[n+1], v[n+1];
for(int i = 1; i <= n; i++) {
cin >> w[i] >> v[i];
}
for(int i = 1;... | ALGO | 0.999997 | 3.881002 |
c7c51863-4dab-4fec-940c-cf2dad5403ec | Uxna/quadtree | quadtree_class.cpp | #include "node_class.cpp"
#include <string>
using namespace std;
class Quadtree{
public:
Quadtree(int childrenNum, double Xmin, double Ymin, double Xmax, double Ymax);
~Quadtree();
bool search(double x, double y, double distance); //return true if there is a point within distance of (x,y... | ALGO | 0.999668 | 4.976088 |
53da5cb2-29f6-4b8b-92e0-e189be4aaaad | Setooooo/Algorithm-Tracker | LuoGu/Medium/Beautiful_numbers.cpp | //
// Created by Seto on 2025-04-16
//
#include <bits/stdc++.h>
//There used to be a lot of header files here...
using namespace std;
using ll = long long;
using ull = unsigned long long;
void solve() {
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
ifstream file(R"(D:\Proj... | ALGO | 0.991342 | 3.925092 |
1338b0bf-206f-495e-8a72-58c0df609417 | Mr-Phoebe/ACM-ICPC | 比赛源码/2016 Multi-University Training Contest 04/1009_force.cpp | #include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <climits>
#define MAXN 100050
#define INF 1000000000
using namespace std;
const int N = 1 << 20;
const int M = 1 << 20;
int n;
int edge_cnt, first_edge[N], next_edge[M], to[M], capacity[M], curr_edge[N];
int source, ... | ALGO | 0.999901 | 3.852783 |
fa65cab9-ce01-485a-ba38-94028cccf614 | FennelDumplings/leetcode-maxed_out | algorithm/cpp/prob1-500/prob227_medium_Basic-Calculator-2.cpp | // prob227: Basic Calculator II
/*
* Implement a basic calculator to evaluate a simple expression string.
* The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should truncate toward zero.
*/
/*
* Example 1:
* Input: "3+2*2"
* Output: 7
* Exam... | ALGO | 0.999694 | 5.881127 |
99f6503c-6bc1-4760-b9b1-410f92496cd1 | BhomikTomar/CP-DSA | 900/balanced_round.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
vector<int> arr(n);
for (int i = 0; i < n; i++)
{
cin>>arr[i];
/* code */
}
sort(arr.begin(),arr.end());
int l=1;
... | ALGO | 0.999892 | 3.675897 |
c668f1c0-6c39-4823-a222-ee512507b8ee | Dev-Rayyan-Ahmed/Codes | C++_Codes/Splitter.cpp | #include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
string input = "apple,banana,grape,orange";
char delimiter = ',';
vector<string> result;
stringstream ss(input);
string item;
while (getline(ss, item, delimiter)) {
result.push_back(item);
... | TOOL | 0.977414 | 5.818204 |
87ae9d9a-f38b-4f8b-95d0-54e2cd2955cd | Keshav0907/Data-Structure-and-Algorithms | 0704-binary-search/0704-binary-search.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int low = 0;
int high = nums.size()-1;
while(low <= high) {
int mid = low + (high - low)/2;
if(nums[mid]==target) {
return mid;
... | ALGO | 0.99993 | 6.267745 |
a975b541-9358-4230-8854-8ba9185e32ae | Khoury-srg/Viper | resources/z3/src/sat/smt/bv_invariant.cpp | #include "sat/smt/bv_solver.h"
#include "sat/smt/euf_solver.h"
namespace bv {
void solver::validate_atoms() const {
sat::bool_var v = 0;
for (auto* a : m_bool_var2atom) {
if (a) {
for (auto vp : *a) {
SASSERT(m_bits[vp.first][vp.second].var() == v);
... | ALGO | 0.986832 | 6.38897 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.