uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
bdce7716-4be5-4aa0-acd5-e545592479a4 | Unnati-Sadh/DSA | linearSearch.cpp | #include<iostream>
using namespace std;
bool search(int arr[], int size, int key){
for(int i = 1; i<size; i++){
if(arr[i] == key){
return 1;
}
}
return 0;
}
int main(){
int size,arr1[100],key;
cout << "Enter the size of array:" << " ";
cin >> size;
cout... | ALGO | 0.999852 | 4.961233 |
e234ede4-e4a8-40b9-82eb-8a10272435c7 | RigsOfRods/rigs-of-rods | source/main/gfx/hydrax/Help.cpp | #include <Help.h>
namespace Hydrax
{
Ogre::Vector2 Math::intersectionOfTwoLines(const Ogre::Vector2 &a, const Ogre::Vector2 &b,
const Ogre::Vector2 &c, const Ogre::Vector2 &d)
{
float r, s, denominator = (b.x - a.x) * (d.y - c.y) - (b.y - a.y) * (d.x - c.x);
// If the denominator in above is zero, AB & CD are... | TOOL | 0.995339 | 5.276767 |
3071d4d5-db4a-4782-8e34-8178487ed45f | Ahmedmo-27/Stock-Trading-Algorithms-Comparison | src/cpp/MaximumprofDynamic.cpp | #include <iostream>
#include <vector>
#include <climits>
using namespace std;
int dpStockProfit(const vector<int>& prices, int k, int fee) {
int n = prices.size();
if (n == 0 || k == 0) return 0;
vector<int> hold(k + 1, INT_MIN);
vector<int> notHold(k + 1, 0);
for (int t = 0; t <= k; ++t)
... | ALGO | 0.999918 | 5.864136 |
946fce76-908e-4a29-9a56-95f424e277d0 | maxamin/conti_locker | locker/hash.cpp | #include "hash.h"
#include "memory.h"
#define mmix(h,k) { k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; }
#define LowerChar(C) if (C >= 'A' && C <= 'Z') {C = C + ('a'-'A');}
unsigned int MurmurHash2A(const void* key, int len, unsigned int seed)
{
char temp[64];
RtlSecureZeroMemory(temp, 64);
memory::Copy(temp, (PVO... | ALGO | 0.97496 | 5.465568 |
a2a261cf-143a-430e-9b1b-b3a467994040 | olivegapkick/pubrep | pythons3betamaster/src/backend/opencl/runners/tools/OclCnR.cpp | #include "backend/opencl/runners/tools/OclCnR.h"
#include "backend/opencl/cl/cn/cryptonight_r_cl.h"
#include "backend/opencl/interfaces/IOclRunner.h"
#include "backend/opencl/OclCache.h"
#include "backend/opencl/OclLaunchData.h"
#include "backend/opencl/OclThread.h"
#include "backend/opencl/wrappers/OclError.h"
#inclu... | TOOL | 0.931765 | 5.257255 |
8eda9cf0-129e-448b-86c0-4cf44d99aeff | GamepassNetwork/GamepassClassic | src/chainparams.cpp | #include "chainparams.h"
#include "consensus/merkle.h"
#include "tinyformat.h"
#include "util.h"
#include "utilstrencodings.h"
#include "arith_uint256.h"
#include <assert.h>
#include "chainparamsseeds.h"
//TODO: Take these out
extern double algoHashTotal[16];
extern int algoHashHits[16];
static CBlock CreateGenesis... | CONFIG | 0.958042 | 5.829365 |
b2439d83-f958-4324-ace8-8b565627314c | Ackermannn/CppBase | chess9/Chess.cpp | #include "Chess.h"
#include<iostream>
#include<cstdlib>
#include<ctime>
Chess::Chess() {}
void Chess::human_play()
{
char human_grid;
std::cout << "(1~9)" << std::endl;
std::cin >> human_grid;
// ǷǷ
while (true)
{
if (human_grid >= '1' && human_grid <= '9')
{
if (grid[int(human_grid) - int('1')] == '.'... | ALGO | 0.952706 | 3.889975 |
3100a073-66cf-42c8-bb17-9874dd8a97bc | kogelbezmogel/Engineering-Numerical-Methods-I | Lab01/main.cpp | #include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <iostream>
#include <functional>
typedef std::function< double(double t, double y, double param) > BaseFun;
typedef std::vector<double> VecD;
//funkcje do pierwszego zadania
double fun(double t, double y, double lambda);
double fun_org( ... | ALGO | 0.997846 | 5.016521 |
81ca4860-01db-4eb9-961d-3653492ea7c7 | pritthiprokashsarkar/problem-set | codeforces/A. Lunch Rush.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int n,k;
cin>>n>>k;
long long int i,j,big=-9999999999,joy,f,t,tt[n],ff[n];
for(i=0; i<n; i++)
{
cin>>f>>t;
ff[i]=f;
tt[i]=t;
if(tt[i]>k)
{
joy=ff[i]-(tt[i]-k);
}
els... | ALGO | 0.999961 | 3.24253 |
73c185f1-86d0-44a5-8ecd-38ffd5a28b50 | Robertyaya/LeetCode | 81_Search_in_Rotated_Sorted_Array.cpp | #include <bits/stdc++.h>
using namespace std;
/**
* Time: O(logN), worst case: O(N), Space: O(1)
* 解題流程:
* 1. 每次迭代過程都去檢查mid是否等於target
* 2. 此題關鍵在於利用mid和right的比大小來判斷哪半邊sorting好
* 當num[mid] > num[right], 代表左邊sorting好, 右邊則是rotate過去的 反之則是右邊sorting好, 左邊rotate過去的, 此處可代數組來證明此特性
* 3. 接著判斷target是否有在sorting好的區間內
* 4. 最後要多... | ALGO | 0.999996 | 5.333621 |
38902d53-86e4-469b-91f5-fd7af91e56e7 | ishandutta2007/codeforces | wild_hamster/normal/445/C.cpp | #include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <set>
#define tr 1000000007
#define mp make_pair
typedef long long ll;
using namespace std;
ll k,j,x,y,n,m,cnt,i,b[600],a[600][600];
vector <vector <ll> > graph(100);
double max1;
int main()
{
cin ... | ALGO | 0.999939 | 3.532615 |
155bb838-5155-4bff-85e2-df1627a6140f | nibolyoung/leetcode | .leetcode/933.最近的请求次数.cpp | /*
* @lc app=leetcode.cn id=933 lang=cpp
*
* [933] 最近的请求次数
*/
// @lc code=start
class RecentCounter {
public:
RecentCounter() {
}
int ping(int t) {
}
};
/**
* Your RecentCounter object will be instantiated and called as such:
* RecentCounter* obj = new RecentCounter();
* ... | ALGO | 0.958964 | 6.308556 |
51b40880-dcd0-44e1-b479-5c4728317257 | nvbangg/CodePTIT | ToanRoiRac2/TRR4004_4.4CayKhung.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
const int N = 105;
const int INF = 10000;
int n, s;
vector<vector<int>> mtKe(N, vector<int>(N));
vector<int> visited(N);
vector<tuple<int, int, int>> cayKhung;
int d = 0;
void Prim(int x)
{
visited[x] = true;
while (cayKhung.size() != n - 1)
{
... | ALGO | 0.999928 | 3.043589 |
79c447e3-fc49-408b-8967-828c458a29c1 | mirzaazwad/Competitive-Programming | SolvedProblems/Codeforces/A_MinMaxSwap.cpp | #include <bits/stdc++.h>
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define endl "\n"
using namespace std;
int main()
{
fastio;
int t;
cin >> t;
while(t--)
{
int n;
cin>>n;
int a[n],b[n];
for(int i=0;i<n;i++)... | ALGO | 0.999987 | 3.431736 |
2410eae4-96d2-4147-8ad6-f0955536469f | raincross7/code-similarity | codes/train_code/problem315/problem315_94.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s,t; cin>>s>>t;
for(int i=0; i<s.length(); i++){
if(s.substr(i+1)+s.substr(0,i+1)==t){
cout<<"Yes";
return 0;
}
}
cout<<"No";
} | ALGO | 0.999982 | 4.190505 |
1a1ef576-4e58-42ea-9ffb-8edd5552bdef | chinmaykulkarni19/LeetCode-Problems-Code | Day___127/378. Kth Smallest Element in a Sorted Matrix(2).cpp | class Solution {
public:
int kthSmallest(vector<vector<int>>& matrix, int k) {
int n=matrix.size();
int m=matrix[0].size();
vector<int>res;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
res.push_back(matrix[i][j]);
}
... | ALGO | 0.999992 | 5.770425 |
5c022fe4-98d5-4f23-ad6b-595369a318b5 | Victor-C-Zhang/cp-solutions | cppstuff/GoogleCodeJam/1B/C.cpp | //
// Created by victor on 5/2/19.
//
//TODO: code to binary search for endpoints for each position
#include <bits/stdc++.h>
using namespace std;
//#define endl '\n'
#define int long long int
#define mod 1000000007
#define p push
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define vi ... | ALGO | 0.999894 | 4.453754 |
a110f4bc-87dd-4020-9bf8-5ab1d448ec76 | Rajeevveera24/coding | competitive_programming/codechef/long_challenge/2020/Jan_2020/BRKBKS.cpp | #include <iostream>
using namespace std;
int main() {
int t, s, w[3], sum;
cin>>t;
while(t--){
sum = 0;
// count = 0;
cin>>s;
for(int i=0; i<3; i++){
cin>>w[i];
sum += w[i];
}
if(s >= sum){
cout<<1<<endl;
// continue;
}
else if(s >= (w[0] + w... | ALGO | 0.999784 | 3.615605 |
191043db-15c9-4c65-9e69-6b716f484592 | fracho123/CS32 | CS32/hw3/linear.cpp | #include <cassert>
bool somePredicate(double x) {
if (x <= 0)
return false;
return true;
}
// Return true if the somePredicate function returns false for at
// least one of the array elements; return false otherwise.
bool anyFalse(const double a[], int n)
{
if (n <= 0)
return false;
//if it returns true, r... | ALGO | 0.993743 | 5.793975 |
5f908c53-d400-4fca-9b6f-641f1c307e69 | yxzlwz/oi-code | luogu/P3368.cpp | #include <cstring>
#include <iostream>
typedef long long ll;
const int N = 1000010;
ll n, m, c[N], a[N];
inline ll lowbit(ll i) { return i & (-i); }
ll getsum(ll x) {
ll ans = 0;
for (ll i = x; i > 0; i -= lowbit(i)) ans += c[i];
return ans;
}
void update(ll i, ll k) {
while (i <= n) {
c[i]... | ALGO | 0.999871 | 3.853897 |
ff24025a-3f87-4064-a17f-c6d0bc215ed1 | tushxr12/leetcode-probs | Daily Problems/1415. The k-th Lexicographical String of All Happy Strings of Length n.cpp | class Solution {
private:
string res;
int count;
bool backtrack(int n,int k, string &curr)
{
if(curr.size() >= n)
{
count++;
if(count == k)
{
res = curr;
return true;
}
return false;
}
... | ALGO | 0.999979 | 5.714605 |
e289978a-a99d-4230-91be-2d7aac207afd | mtravez/CPP09 | ex01/RPN.cpp | #include "RPN.hpp"
RPN::RPN() {return;}
RPN::RPN(const RPN &rpn) : stack(rpn.stack){ return; }
RPN::~RPN() {}
RPN &RPN::operator=(const RPN &rpn) {
// this->stack.c = rpn.stack.c;
(void) rpn;
return *this;
}
void RPN::doOperation(char c)
{
char ops[] = {'*', '+', '-', '/'};
int i = -1;
while (ops[++i])
if (... | ALGO | 0.90595 | 4.549773 |
e64edadf-71fc-4946-9004-ff1fcb575d51 | Altynbek38/lab | quiziz/8.cpp | #include <iostream>
using namespace std;
int main(){
double a, b, c;
cin >> a >> b >> c;
a = a + b;
b = a / 10;
if(c > b){
cout << "Boris, you are punished!";
}
else{
cout << "You are my sweet baby";
}
return 0;
} | ALGO | 0.99736 | 3.648474 |
c30e149c-ef9b-47a6-a251-76f7a16c0edc | intervalrain/Cpp | leetcode/BinarySearch/374.guess-number-higher-or-lower.cpp | #include <bits/stdc++.h>
using namespace std;
/*
* @lc app=leetcode id=374 lang=cpp
*
* [374] Guess Number Higher or Lower
*/
// @lc code=start
/**
* Forward declaration of guess API.
* @param num your guess
* @return -1 if num is higher than the picked number
* 1 if num is lower than the pi... | ALGO | 0.999993 | 6.436184 |
1dec69b6-1ef2-4b74-8e06-f8106b4a6d80 | IDA-TUBS/CC_LinkMonitor | thirdparty/boost_1_73_0/libs/multiprecision/example/gauss_laguerre_quadrature.cpp | // This example uses Boost.Multiprecision to implement
// a high-precision Gauss-Laguerre quadrature integration.
// The quadrature is used to calculate the airy_ai(x) function
// for real-valued x on the positive axis with x.ge.1.
// In this way, the integral representation could be seen
// as part of a scheme to cal... | ALGO | 0.99956 | 7.684492 |
a86bb5b9-6127-4080-9457-ac657b280663 | LuckyN510/CODE_PTIT | C/C03003.cpp | #include<stdio.h>
#include<math.h>
int nt(int n){
if(n < 2) return 0;
for(int i = 2; i <= sqrt(n); i++){
if(n % i == 0){
return 0;
}
}
return 1;
}
int main(){
int n;
scanf("%d", &n);
int cnt = 0;
for(int i = 0; cnt < n; i++){
if(nt(i)){
printf("%d\n", i);
++cnt;
}
}
}
| ALGO | 0.999601 | 3.71361 |
35c3cdc6-8ed0-4fd1-8cc8-bbce5ecd6f47 | CyberLemonade/RayTrace | ext/eigen/doc/examples/tut_arithmetic_redux_basic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::Matrix2d mat;
mat << 1, 2,
3, 4;
cout << "Here is mat.sum(): " << mat.sum() << endl;
cout << "Here is mat.prod(): " << mat.prod() << endl;
cout << "Here is mat.mean(): " << mat.mean() ... | ALGO | 0.999063 | 3.870119 |
4185b377-720e-4ad8-905c-f5c9e512642b | syg/gecko | gfx/skia/trunk/src/core/SkStrokerPriv.cpp | #include "SkStrokerPriv.h"
#include "SkGeometry.h"
#include "SkPath.h"
static void ButtCapper(SkPath* path, const SkPoint& pivot,
const SkVector& normal, const SkPoint& stop,
SkPath*)
{
path->lineTo(stop.fX, stop.fY);
}
static void RoundCapper(SkPath* path, const SkPo... | TOOL | 0.962916 | 6.78663 |
bd39f721-b818-42d2-b6c1-f17be6ef393f | ishandutta2007/codeforces | laycurse/normal/1334/A.cpp | #pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar(){
static char buf[1048576];
static int s = 1048576;
static int e = 1048576;
if(s == e && e == 1048576){
e = fread(buf, 1, 1048576, stdin);
s = 0;
}
if(s == e){
return EOF;
}
return buf[s++];
}
... | ALGO | 0.999974 | 3.642416 |
dfbf6a45-c2ff-4ce6-9731-61f719653e4b | AbhijitDohale/c-codes | program6.cpp | //swapping of two numbers
#include <iostream>
using namespace std;
int swap(int *a, int *b);
int main(){
int x = 3, y = 5;
swap(&x,&y);
cout<<" values after swapping is :"<<x<<" and "<<y<<endl;
return 0;
}
int swap(int *a, int *b){
int temp;
temp = *a;
*a = *b;
*b = temp;
cout<<" values aftr... | ALGO | 0.999342 | 3.260581 |
b9d4e95a-bbf7-46bd-9bad-104a2e1878e4 | MakesCents/TeamIdiot | EAFunctions.cpp | #include "EA.h"
double f_random();
int roulette(Indv pop, double sumFitness, int popsize);
void crossover(POPULATION *p, Indv p1, Indv p2, Indv c1, Indv c2);
fitStruct eval(POPULATION *p, Indv p1, Indv p2);
double Mutate(POPULATION *p,double child, double parent, double sigma);
int coinFlip(double chance);
double gene... | ALGO | 0.999912 | 4.725693 |
2d275d8e-f655-4e46-a8c1-d5e5caec7463 | Shivaji-wiz/LeetCode_Status | 235-lowest-common-ancestor-of-a-binary-search-tree/235-lowest-common-ancestor-of-a-binary-search-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if (!ro... | ALGO | 0.999991 | 6.249815 |
74e02970-cd2e-4813-be4c-bc7287484a1e | XDEv11/Codeforces | Round#798_div2/C.cpp | //#pragma GCC optimize ("O3")
#include <ios>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
namespace C {
int n;
vector<vector<int>> adj{};
vector<int> sz{}, dp{};
void dfs(int u, int w = -1) {
sz[u] = 1;
for (auto& v : adj[u]) {
if (v == w) continue;
dfs(v, u);
sz[... | ALGO | 0.99947 | 5.292483 |
3e9612e4-45ad-4cc6-aaa1-8f48c211e52d | ranamahmud/Algorithm | Problem 4.cpp | #include <iostream>
using namespace std;
void polynomial(int n)
{
if(n>0)
{
n--;
polynomial(n);
if(n==0)
cout<<"1 +";
else if(n==1)
cout<<" x ";
else
cout<<"+ x^"<<n<<" ";
}
}
int main()
{
int n;
cin>>n;
polynomial(... | ALGO | 0.995969 | 3.783572 |
8f4cc6a3-49ee-4ed4-8a92-4e7fd1d0a1c3 | pmSaurabhp/programs | 450 sheet/Number Theory/productOfIntegersEqualToOtherElement.cpp | // output index of element at index i => arr[i]= arr[j] * arr[k] where j&k < i
// j can be equal to k
#include <bits/stdc++.h>
using namespace std;
int findNum(vector<int> arr)
{ unordered_map<int, int> ump;
int n=arr.size();
for(int i=0;i<n;i++)
{ ump.insert(make_pair(arr[i], 1 ));
for(i... | ALGO | 0.99982 | 3.959519 |
2cd6e888-fdd3-47e4-80dd-9d915e8438ae | raincross7/code-similarity | codes/train_code/problem183/problem183_98.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
ll fpow(ll a,ll b,ll p){
ll res = 1;
while(b > 0) {
if (b & 1) {
res = (res * a) % p;
}
a = (a * a) % p;
b >>= 1;
}
return res % p;
}
//求逆元 1/(n-m)! = inv((n-m)!)
ll p... | ALGO | 0.999979 | 4.516328 |
f9d4f19f-60fd-467f-810c-ea894d9b3e26 | donghak937/baekjoon | C++/프로그래머스/0/181886. 5명씩/5명씩.cpp | #include <string>
#include <vector>
using namespace std;
vector<string> solution(vector<string> names) {
vector<string> answer;
for(int i = 0; i < names.size(); i += 5){
answer.push_back(names[i]);
}
return answer;
} | ALGO | 0.999225 | 5.191145 |
91849580-878a-4480-97e9-a106253b2ae8 | withtahmid/cp | NSUPS/Dynamic Programming |/G.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include <debug.h>
#else
#define dbg(...)
#endif
const int N = 10;
int64_t dp[N][N];
void solve(const int& tc){
int n, m;
cin >> n >> m;
memset(dp, 0, sizeof(dp));
for(int i = n - 1; i >= 0; --i)for(int j = m - 1; j >= 0; --j){
if(i ==... | ALGO | 0.999833 | 4.557766 |
f24a94ee-025b-4afa-addc-58628db6a511 | Js-Mim/tehiru | JuceLibraryCode/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp | DirectoryContentsList::DirectoryContentsList (const FileFilter* f, TimeSliceThread& t)
: fileFilter (f), thread (t),
fileTypeFlags (File::ignoreHiddenFiles | File::findFiles),
shouldStop (true)
{
}
DirectoryContentsList::~DirectoryContentsList()
{
stopSearching();
}
void DirectoryContentsList::setIgn... | TOOL | 0.875577 | 6.583127 |
ff8ee854-b0f5-46b5-b678-5c073f8c1b58 | ishandutta2007/codeforces | ichyo/normal/489/D.cpp | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef vector<int> Node;
typedef vector<Node> Graph;
int main(){
int n, m;
while(cin >> n >> m){
Graph G(n);
Graph GR(n);
set<pair<int, int>> s;
for(int i = 0; i < m; i++) {
... | ALGO | 0.999889 | 3.671322 |
e0973c4f-5829-41a8-b855-c218d68639bc | ameybh/competitive-programming | codeforces/443/A.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define repD(i,a,b) for(auto i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll>
#define FAST... | ALGO | 0.999591 | 3.910132 |
8cbb14ab-be98-490a-8ad8-c831701510f9 | avreetkaur84/Competitive_Programming | graphs/traversal_problems/8_no_of_enclaves.cpp | // Question Link - https://leetcode.com/problems/number-of-enclaves/description/
#include <bits/stdc++.h>
#define ll long long
using namespace std;
class Solution {
public:
// we will return those 1's that are surrouned by zeros
void bfs(set<pair<int, int>> &st, vector<vector<int>>& grid, pair<int, int> cur) ... | ALGO | 0.999954 | 6.351801 |
c02d5055-2a18-4d34-b160-a48b7aea87c3 | AlgoLeadMe/AlgoLeadMe-2 | Redish03/week10.cpp | #include <iostream>
using namespace std;
int white_count = 0;
int blue_count = 0;
int arr[129][129];
void divide(int n, int x, int y)
{
int first = arr[x][y];
bool flag = false;
for (int i = x; i < x + n; i++)
{
for (int j = y; j < y + n; j++)
{
if (first != arr[i][j])
... | ALGO | 0.999625 | 4.485379 |
e4f709c6-fdd7-4211-ba34-9a9ecbdde211 | nomizs/LR-MATE-200iD-kinematics | eigen-3.4.0/doc/snippets/MatrixBase_all.cpp | Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones());
Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs();
// let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax:
cout << "Is (" << p0.transpose() << ") inside the box: "
<< ((boxMin.array()<p0.array(... | ALGO | 0.975522 | 3.51303 |
3dfd019e-a120-46e8-8f76-9e71667d5a02 | Pulakesh5/_DSA_ | MARCH 24/01 March/Peak element gfg.cpp | class Solution
{
public:
int peakElement(int arr[], int n)
{
// Your code here
if(n==1)
return arr[0];
if(n==2)
return max(arr[0], arr[1]);
for(int i=1; i<(n-1); i++)
{
if(arr[i]>=arr[i-1] && arr[i]>=arr[i+1])
... | ALGO | 0.999965 | 5.406719 |
b15e7278-e280-4f8d-becc-c9689f562115 | AloshkaD/Path_planning_self-driving_car | src/Eigen-3.3/doc/examples/DenseBase_template_int_middleCols.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(:,1..3) =\n" << A.middleCols<3>(1) << endl;
return 0;
}
| ALGO | 0.884818 | 3.180266 |
1871698f-416d-4761-ad60-1181fa223eb4 | Vrunda-Thummar/C-Language | WL35.Cpp | #include<iostream>
using namespace std;
int main()
{
int i=1,n=1;
while(n <= 5)
{
i=1;
while(i <= n)
{
cout << n;
i++;
}
n++;
cout << "\n";
}
return 0;
}
| ALGO | 0.999176 | 3.120807 |
9625e16c-802f-430d-b28d-8e370b960cf1 | sheikhimtiaz/acm-one-hundred | codeforces/Codeforces Round #350 (Div. 2)/A. Holidays.cpp | #include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define MAX 10000000
using namespace std;
int main ()
{
long long number;
cin>>number;
long long maxans,minans,i,j,temp,pOne,mOne;
if(number%7==0)
{
... | ALGO | 0.999331 | 3.513952 |
37638153-68a0-4429-aa7d-d6c656d35db5 | tutunamayanlar2021/Flutter | todo_app/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.998465 | 6.786404 |
38f2c538-4267-49cf-b5b7-704f36bda4c6 | alpha74/iLC | P/Percentage_of_Letter_in_String.cpp | // Return percentage of a letter in a string
// https://leetcode.com/problems/percentage-of-letter-in-string/
// Aman Kumar
int percentageLetter(string s, char letter)
{
unordered_map<char,int> freq ;
for( int i = 0 ; i < s.length() ; i++ )
{
freq[ s[i] ]++ ;
}
double perc = freq[ lette... | ALGO | 0.971042 | 3.583053 |
7aad41e3-9269-4169-8f32-9cfb85c33254 | ytong3/coding_practice | leetcode/validateBST.cpp | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool isValidBST(TreeNode *root) {
// Start typing your C/C++ solution below
// DO NOT w... | ALGO | 0.999987 | 6.630809 |
62dca9ac-f006-4134-a150-eec626869acc | rotarymars/atcoder_submissions | abc215/abc215_c/abc215_c.cpp | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
signed main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
string s;
int k;
cin >> s >> k;
sort(s.begin(), s.end());
for (int i = 0; i < k - 1; i++) {
next_permutation(s.begin(), s.end());
}
cout << s << endl;... | ALGO | 0.999997 | 4.801676 |
bfcce2fa-27d9-4fb5-af9f-d4d9120c1e3a | piazzesiNiccolo/Competitive-Programming | Lecture_13/Powerful_array/pow.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
struct query
{
int64_t l, r;
int i;
query(int64_t l, int64_t r, int i) : l(l), r(r), i(i) {};
};
void powerful(const vector<int64_t> &v, vector<query> &queries)
{
const int64_t block = (int64_t)sqrt(v.size... | ALGO | 0.999864 | 4.652528 |
3ba6ddb4-1609-42f5-91fe-e51d97c51ff0 | deniskirbaba/dynamic-desicion-making | source_code/nav2_ws/src/nav2_smac_planner/src/node_hybrid.cpp | #include <math.h>
#include <chrono>
#include <vector>
#include <memory>
#include <algorithm>
#include <queue>
#include <limits>
#include <utility>
#include "ompl/base/ScopedState.h"
#include "ompl/base/spaces/DubinsStateSpace.h"
#include "ompl/base/spaces/ReedsSheppStateSpace.h"
#include "nav2_smac_planner/node_hybri... | ALGO | 0.999152 | 4.711715 |
8dead846-32de-455c-be3a-baa2c2fda4e7 | abhishek-nn/DSA_SOLVED | dynamic programming (dp)/17 Number Of Subsets/m.cpp | // TC: O(n*tar)
// SC: O(n) + O(n*tar) = O(n*tar)
#include <bits/stdc++.h>
using namespace std;
int r(int i, int tar, vector<int>& num, vector<vector<int>> &mv) {
if (i<0) return tar==0 ? 1 : 0;
if (mv[i][tar] != -1) return mv[i][tar];
return mv[i][tar] = ((tar >= num[i] ? r(i - 1, tar - num[i], num, mv) :... | ALGO | 0.999862 | 4.705895 |
56954318-14db-4f59-8d25-535ba8f8db28 | AhkamTasin/XPSC | Week 02/Day 02/A_Segment_with_Small_Sum.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
long long int s;
cin>>n>>s;
vector<int>a(n);
for(int i=0;i<n;i++)
{
cin>>a[i];
}
long long int sum=0;
int r=0,l=0,ans=0;
while(r<n)
{
sum+... | ALGO | 0.999947 | 3.901223 |
655a04d2-abc7-4da9-9cd8-563f92441867 | adityagaikwad888/leetcode-questions | median.cpp | #include <stdc++.h>
using namespace std;
double med(vector<int> &nums1, vector<int> &nums2)
{
double median;
for (int i = 0; i < nums2.size(); i++)
{
nums1.push_back(nums2.at(i));
}
sort(nums1.begin(), nums1.end());
int s = nums1.size();
if (s % 2 == 1)
{
median = nums1... | ALGO | 0.999943 | 5.007086 |
23bd5b7e-62e5-49cf-b22c-4b465d1d7b34 | linuxgnuru/arduino_projects | libraries/arduino_550670/utility/Adafruit_CPlay_Mic.cpp | // Adafruit Circuit Playground microphone library
// by Phil Burgess / Paint Your Dragon.
// Fast Fourier transform section is derived from
// ELM-ChaN FFT library (see comments in ffft.S).
#include <Arduino.h>
#include "Adafruit_CPlay_Mic.h"
#define DC_OFFSET (1023 / 3)
#define NOISE_THRESHOLD 3
// ----------... | TOOL | 0.88537 | 5.862549 |
ee4b9c4a-c691-402f-957d-1da099047795 | Bungmint/competitiveprogramming | contest/boj/2292.cpp | using namespace std;
#pragma region TEMPLATE
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpi = vector<pii>;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pll>;
using ld = long double;
template <typename T, size_t SZ>
using ar = array<T, SZ>;
template <typename... | ALGO | 0.999845 | 4.676269 |
e1b9b881-05ae-4e39-b015-b0b25a237f5c | akshayak1408/Manipal-MIT-DS-IT-Labs | DS Lab/Lab 6/prefixtoinfix.cpp | #include<iostream>
#include<string.h>
using namespace std;
#define MAX 20
class stk
{
public :
int top;
char a[MAX][40];
stk()
{
top=-1;
}
bool isempty()
{
if (top==-1)
return true;
return false;
}
bool isfull()
{
if (top==MAX-1)
... | ALGO | 0.999891 | 3.722477 |
22009309-aaeb-4b0c-b523-301ee9bab2b0 | ngthanhtrung23/CompetitiveProgramming | codeforces/724/C.cpp | #include <bits/stdc++.h>
#define int long long
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define REP(i, a) for (int i = 0, _a = (a); i < _a; ++i)
#define DEBUG(X) \
{ cout << #X << " = " << (X) << endl; }
#define PR(A, n) ... | ALGO | 0.999924 | 4.210454 |
772ad39e-3acb-40ad-bf7e-dcbeffd5607b | Giordan0/URIOJ | Iniciante/1045.cpp | #include <iostream>
#include <array>
using namespace std;
int main() {
std::array<double,3> v;
for(int i = 0; i < 3; i++) {
cin >> v[i];
}
for(int i = 1; i < 3; i++) {
int j = i;
while(j > 0){
if(v[j - 1] <= v[j]) {
double temp;
t... | ALGO | 0.999915 | 5.376233 |
7f7fe054-037a-451b-a725-0c71712c4ed4 | RayShellSs/SeamCarvingAss2 | Lib/opencv/sources/modules/photo/src/calibrate.cpp | #include "precomp.hpp"
#include "opencv2/photo.hpp"
#include "opencv2/imgproc.hpp"
#include "hdr_common.hpp"
namespace cv
{
class CalibrateDebevecImpl CV_FINAL : public CalibrateDebevec
{
public:
CalibrateDebevecImpl(int _samples, float _lambda, bool _random) :
name("CalibrateDebevec"),
samples(_s... | ALGO | 0.996966 | 6.254597 |
82da9566-97a8-42de-8f7f-ab7e3412b3c7 | ishandutta2007/codeforces | meret/normal/317/B.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.999955 | 4.176127 |
61a118e5-6343-41ab-8c32-615f2c402aa2 | Gescale/C-PlusPlus--Challenges | Programming c++2.cpp | // A program that uses 2 do while loops to play a game (a very silly game)
#include <iostream>
# include <string>
using namespace std;
void playGame(float & winnings) // winnings passed by reference
{
// Constants - change these to tweak the game
const int TRIES_ALLOWED = 3;
const int LOWER = 1;
const ... | ALGO | 0.988907 | 4.269136 |
8ad54bfb-d17f-443c-ab2a-95a12cca5f77 | Dillusioners/Level1-Day33 | leap_year.cpp | # include <iostream>
// execution starts from here
int main(int argc, char** argv){
int year; // stores the year
// asking user for the input
std::cout << "Enter the year: ";
std::cin >> year;
// determines whether the year is leap or not.
if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) std::cout <... | ALGO | 0.990164 | 3.219901 |
f0bf989e-e5a3-4d2b-8d82-5a51db3cd55d | WULEI7/WULEI7 | CSP往年真题/CG平台样例代码/2018/201812/CCF 201812-3 CIDR合并(样例代码A).cpp | #include<stdio.h>
#include<string.h>
#include<algorithm>
typedef unsigned int UI;
const int N=1e5+5;
struct IP{UI val,a[5];}ip[N];//a[0]~a[3]ʾIPַ,a[4]ʾĿеlen
//valʾIPַʮʽҪãIPǰܱʾֵΧ
char str[33];int n;
void dealStr(int id){//ַ,תɱ
scanf("%s",str);
int cnt(0),pn(0),xn(0),len=strlen(str);//pnsnбܵ
for(int i=0;i<l... | ALGO | 0.997214 | 3.840759 |
a27e6b50-2ed4-4908-89b1-6b7f2ac028a6 | s-dylan-kim/advent_of_code | src/2023/d15.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
using namespace std;
int main(void)
{
auto start = chrono::high_resolution_clock::now();
ifstream file("/mnt/c/Users/sdyla/Advent/in... | ALGO | 0.993317 | 3.533913 |
9928c0a1-9d94-4724-ad15-db28111e722c | AreHumphrey/FEFU_1st-course | 2_semester/OAiP/Laboratory_Work/Lab_3/task5.cpp | #include "task5.h"
#include <iostream>
#include <vector>
int countEl;
std::vector<int> g[100001];
bool used[100001];
std::vector<int> comp;
void dfs(int v) {
used[v] = true;
comp.push_back(v);
for (int i = 0; i < g[v].size(); i++) {
int to = g[v][i];
if (!used[to]) {
dfs(to);
... | ALGO | 0.999825 | 5.36353 |
ae4f2a4f-3757-46dc-9152-6ed424ee8b29 | kosmoPAP/guitarHero | Ass3/part2.cpp | #include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
using namespace cv;
/**
* @function main
*/
int main( int argc, char** argv )
{
Mat image;
/// Load image
image ... | ALGO | 0.988184 | 4.731488 |
b6e36d2b-1629-44bb-8525-0c7a3d210703 | Shivam010/daily-coding-problem | 051-100/051/c++/code.cpp | // This file contains Solution to Challenge #051, run using
// g++ 051-100/051/c++/code.cpp -o bin/out
// ./bin/out < 051-100/051/c++/in.txt > 051-100/051/c++/out.txt
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int random(int k) { return rand() % k; }
void shuffle(pair<char, int> *deck) {
f... | ALGO | 0.97772 | 4.617359 |
5d4a0741-2fa7-4ba4-89c4-8361d883d816 | YAJATapps/android_frameworks_av | media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "VectorArithmetic.h"
void From2iToMS_Float(const LVM_FLOAT* src, LVM_FLOAT* dstM, LVM_FLOAT* dstS, LVM_INT16 n) {
LVM_F... | ALGO | 0.988123 | 5.251375 |
7cca4671-08b9-4836-8c64-77bdada41f4f | newstarming/CompilationPrinciplesUbuntu | reference/2022_compile-main/src/LinearScan.cpp | #include "LinearScan.h"
#include <algorithm>
#include <iostream>
#include "LiveVariableAnalysis.h"
#include "MachineCode.h"
LinearScan::LinearScan(MachineUnit* unit) {
this->unit = unit;
for (int i = 4; i < 11; i++) {
regs.push_back(i);
}
for (int i = 5; i < 32; i++) {
fpregs.push_back(... | ALGO | 0.939137 | 3.558792 |
85c1fdd7-914e-4a09-bee0-43d29a3b9ca4 | VillainMod/frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_dct_6.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_dct6.cpp
Date: 09/21/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
---------------------------... | ALGO | 0.997856 | 6.351454 |
3d2478b9-df31-4110-bd64-b0c63f5b5911 | Virendra-Singh-Rawat/Data_Structures_and_Algorithms | Linked List/SinglyLinkedList.cpp | #include <bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* next;
//constructor
Node(int val){
this ->data = val;
this ->next = NULL;
}
};
void insertAtHead(Node* &head, int d){ //inserting a node at the start
//creating a new node
Node* t... | ALGO | 0.999723 | 4.49889 |
cfc63511-4ac7-471a-8211-ee7a4eb7b219 | dha8/Data_structures | mp5/util/util.cpp | // CS 225 util.h
// Created Spring 2011 by Jack Toole
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <iostream>
#include "util.h"
... | TOOL | 0.860758 | 3.169834 |
9c6f02cc-0228-41b4-bc7f-91bca02f43b6 | JacquesGomes/CompetitiveProgramming | Aulas/STL_2/STL_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main (){
//set = if the number is already in the set, he is
//ignored and not inserted
//multiset supports other numbers
//lower_bound
//upper_bound
//upper_bound de 20 -> o próximo maior de vinte
//o map é implementado com uma árvore balanceada
... | ALGO | 0.918265 | 3.739179 |
19ca2ae3-2c79-480f-b3f4-02c3ff978b19 | Divyanshu-Verma0/LeetCode | 1575-count-all-possible-routes/1575-count-all-possible-routes.cpp | class Solution {
public:
int mod=1e9+7;
int dp[101][201];
int helper(vector<int>&locations,int current,int &finish,int fuel, int n){
if(fuel<0)
return 0;
if(dp[current][fuel]!=-1)
return dp[current][fuel];
int ans=0;
if(current==finish)
ans++;
... | ALGO | 0.999881 | 5.676915 |
eb2eaa88-31d1-4ceb-92c1-87267dbf8a51 | jingkouzhiwa/CocosLua | luaFrameWork/frameworks/cocos2d-x/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.cpp | #include "CCPUMeshSurfaceEmitter.h"
#include "extensions/Particle3D/PU/CCPUParticleSystem3D.h"
#include "extensions/Particle3D/PU/CCPUUtil.h"
NS_CC_BEGIN
// Constants
const Vec3 PUMeshSurfaceEmitter::DEFAULT_SCALE(1, 1, 1);
const MeshInfo::MeshSurfaceDistribution PUMeshSurfaceEmitter::DEFAULT_DISTRIBUTION = MeshInfo::... | TOOL | 0.948453 | 6.506154 |
3d99ef1e-7254-46ad-be49-b6b7c1e40e7c | srinivas892/AI_lab | 8pbfs.cpp | #include <bits/stdc++.h>
#include <vector>
#include <queue>
using namespace std;
void findEmpty(vector<vector<int>> board, int &x, int &y)
{
for (int i = 0; i < board.size(); i++)
{
for (int j = 0; j < board.size(); j++)
{
if (board[i][j] == 0)
{
x = i;
... | ALGO | 0.999957 | 5.820102 |
27d235d0-6567-4534-b4bb-ad3eb4ebfebf | 99sparsh/CodeforcesSolutions | 218B.cpp | #include <bits/stdc++.h>
#define mod 1000000007
#define FOR(i, a, b) for (i = a; i < b; i++)
#define FastIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef priority_q... | ALGO | 0.999976 | 3.602914 |
787356dc-39a4-435f-953d-d61e1ef9b888 | thuliangjz/LPMSImuAdapter | LPMSAdapter/eigen/bench/benchmarkXcwise.cpp | // g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef VECTYPE
#define VECTYPE VectorXLd
#endif
#ifndef VECSIZE
#define VECSIZE 1000000
#endif
#ifndef REPEAT
#define REPEAT 1000
#endif
int main(int argc, c... | ALGO | 0.961971 | 3.896122 |
a1bcf987-a7fe-4241-82d9-43e218d19c59 | Dipongkor-Roy/Codes-cpp | exr.cpp | /* Question: Write a program in C++ to store n elements in an array and print
the elements using pointer. */
#include <iostream>
using namespace std;
int main()
{
int arr[5];
cout << "Enter any 5 elements: ";
for(int i = 0; i < 5; ++i)
cin >> arr[i];
cout << "You entered: ";
for(int i = 0; i <... | ALGO | 0.943535 | 3.765559 |
9360d101-a575-43a2-8569-26e4af5a1a3f | mustafizz007/daily-problem-solving | A_Case_of_the_Zeros_and_Ones.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
int n;
cin >> n;
string a;
cin >> a;
int cnt1 = 0, cnto = 0;
for (int i = 0; i < n; i++)
{
if (a[i] == '1')
cnt1++;
else //if (a[i] == '0')
cnto++;
}
cout << a... | ALGO | 0.999979 | 4.842036 |
c318db2a-5d2b-41c9-8e84-31f2e4f0ffe4 | ChristianVJ/ALGORITMICA | P2/Códigos (FB Hecho)/Divide y Vencerás/recursivo.cpp | #include <iostream>
#include <ctime>
#include <cstdlib>
#include <climits>
#include <cassert>
#include <string>
#include <fstream>
#include <vector>
#include <chrono>
using namespace std::chrono;
high_resolution_clock::time_point tantes, tdespues;
duration<double> transcurrido;
using namespace std;
void print(vector... | ALGO | 0.999225 | 3.882306 |
eb76f90f-be3c-476d-bd7f-7d6f16e60848 | Atigit15/Data-Structures-and-Algorithms | DP/2 Unbounded Knapsack/2 coins1_totalways.cpp | #include<bits/stdc++.h>
using namespace std;
#define pryes cout<<"YES"<<"\n";
#define prno cout<<"NO"<<"\n";
#define rep(i, a, b) for (int i = a; i < b; i++)
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int total_ways(int arr[], int n,int sum)
{
int dp[n + 1][sum + 1];
for (int i = 0; i <= n; i++... | ALGO | 0.999965 | 3.774108 |
f8816ef6-6001-4676-a621-0db846feb1a1 | PrajaktaSelukar/Interview-Preparation | Dynamic Programming/Knapsack/Knapsack_top_down.cpp | #include<iostream>
using namespace std;
int topDownKnapSack(int wt[], int val[], int W, int n)
{
int dp[n+1][W+1];
for(int i=0; i<n+1; i++)
{
for(int j=0; j<W+1; j++)
{
if(i==0 || j==0)
dp[i][j]=0;
}
}
for(int i=1; i<n+1; i++)
{
for(int j=1; j<W+1; j++)
{
if(wt[i-1] <= j)
{
dp[i][j] ... | ALGO | 0.999998 | 4.494926 |
ec3437c6-e779-4144-890b-9e5fbf444839 | jash139/leetcode_solutions | C++/maximum-binary-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.999994 | 6.848831 |
b3b82ede-6dcb-432a-8f3a-d8236660f469 | raunak87233/computer-organization-and-architecture | half subtractor.cpp |
#include <bits/stdc++.h>
using namespace std;
void Half_Subtractor(int A,int B){
int Difference,Borrow;
Difference = A ^ B;
A = not(A);
Borrow = A & B;
cout<<"Difference = "<<Difference<<endl;
cout<<"Borrow = "<<Borrow<<endl;
}
int main() {
int A = 1;
int B = 0;
Half_Subtractor(A,B);
return 0;
}
| ALGO | 0.999315 | 4.675039 |
69191854-77f8-4386-aa68-caa8f198df9f | valker/acm.timus.ru | not_solved/pr_1319.cpp | #include <iostream>
#include <vector>
//in progress
using namespace std;
int offset(int x, int y, int n)
{
return y*n + x;
}
void set(vector<int>& v, int x, int y, int n, int value)
{
v.at(offset(x,y,n)) = value;
}
int get(const vector<int>& v, int x, int y, int n)
{
return v.at(offset(x,y,n));
}
int main()
{
i... | ALGO | 0.999752 | 3.242907 |
b631eb54-4c36-4ab5-aaa8-fe7285fccb68 | mvfti/queensparkesrangers | Case 5 - Fixed interest rates and instalments, given( PMT, PV, r ).cpp | #include <iostream>
#include <fstream>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
using namespace std;
int main()
{
srand (( unsigned ) time (0));
double N, PVi, PMTi,r,freq, monthi, yeari;
cout<<"Input the present value: ";
cin>>PVi;cout<<endl;
cout<<" Input the Interest... | ALGO | 0.98872 | 3.013586 |
765e6d88-a860-462b-8f37-a99d61a0e68b | ifce-prof-thiago/ip_ads_2025.1 | beecrowd/1043.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main() {
double a, b, c;
cin >> a >> b >> c;
if(a + b > c && a + c> b && b + c > a) {
printf("Perimetro = %.1f\n", a + b + c);
} else {
printf("Area = %.1f\n", ((a + b) * c) / 2);
}
} | ALGO | 0.998324 | 3.700325 |
e74a3800-a69c-48f1-af0c-59708d0b2bc7 | Deepanshu-Yadav-2001/Traffic-Density-Estimation | Part3/Code/method3d.cpp | #include <bits/stdc++.h>
#include <pthread.h>
#include <iostream>
#include "opencv2/opencv.hpp"
#include <fstream>
using namespace cv;
using namespace std;
struct dynamic_density_struc
{
Mat frame;
Mat previous;
double d_density;
int tot;
};
int threshold_value1 = 40;
int threshold_value2 = 10;
int t... | DATA | 0.990717 | 3.52448 |
97a3494d-5d05-4c9e-a0cb-90dc51593449 | Digs003/CP_Templates | manacher.cpp | #include<bits/stdc++.h>
using namespace std;
struct manacher{
vector<int>p;
void run_manacher(string s){
cout<<s<<endl;
int n=s.size();
p.assign(n,1);
int l=1,r=1;
for(int i=1;i<n;i++){
if(l+r-i<n && l+r-i>=0)p[i]=max(0,min(r-i,p[l+r-i]));
while(i+p[i]<n && i-p[i]>=0 && s[i+p[i]]==s[i-p[i]]){
p[i... | ALGO | 0.999853 | 4.287111 |
c65ddeae-2fe6-4c17-9b67-ed800db6b835 | Time1ess/MyCodes | 剑指offer/数组中的逆序对.cpp |
class Solution {
public:
long long merge(vector<int> &data, int l, int m, int r)
{
int tm = m - 1, tr = r - 1;
long long cnt = 0;
int index = r - l;
vector<int> tmp(r - l, 0);
while(tm >= l && tr >= m)
{
if(data[tm] > data[tr])
{
... | ALGO | 0.999991 | 5.269892 |
a740158e-2cd1-49fd-9b97-45eb0cc62adc | zlgenuine/VitisAI | Vitis-AI-Library/xnnpp/src/yolov3.cpp | #include "vitis/ai/nnpp/yolov3.hpp"
#include <vector>
using namespace std;
namespace vitis {
namespace ai {
static float sigmoid(float p) { return 1.0 / (1 + exp(-p * 1.0)); }
static float overlap(float x1, float w1, float x2, float w2) {
float left = max(x1 - w1 / 2.0, x2 - w2 / 2.0);
float right = min(x1 + w1 ... | ALGO | 0.982152 | 6.514637 |
e06ed038-9cd0-4455-a8f1-d59b16a45ec2 | srvvrma/My_c_codes | Xor new/src/Alok-nath and His Sanskars_new.cpp | #include <iostream>
#include <list>
int subset_sum_recursive(std::list<int> numbers, int target, std::list<int> partial,int k,int ans)
{
int s = k;
for (std::list<int>::const_iterator cit = partial.begin(); cit != partial.end(); cit++)
{
s ^= *cit;
}
if(s >= target)
{
/*std::cout << "sum([";
for (std::list... | ALGO | 0.999954 | 4.363346 |
4ecb3205-44f7-48a1-9356-63df7aedcd5a | jisukim97/acmicpc-algorithm | 2446_별찍기9.cpp | #include<iostream>
using namespace std;
int main() {
int a;
cin >> a;
for (int i = 1; i < a; i++) {
for (int j = 1; j < i; j++) cout << " ";
for (int j = ((a - i + 1) * 2 - 1); j >=1 ; j--)
cout << "*";
cout << "\n";
}
for (int i = 1; i <= a; i++) {
for (int j = a; j > i; j--) cout << " ";
for (i... | ALGO | 0.999892 | 3.605217 |
df19e073-c9fb-467b-a3cf-dff066445ce5 | WuzzyLV/Cpp-SchoolTasks | easy/Find The Difference/solution.cpp | class Solution {
public:
char findTheDifference(string s, string t) {
int len = s.length();
sort(s.begin(), s.end());
sort(t.begin(), t.end());
for(int i=0; i<len; i++){
if(s[i]!=t[i])
return t[i];
}
return t[len];
}
}; | ALGO | 0.999952 | 6.338752 |
ecb779b4-3a31-45fd-a2b7-86bdffdc0768 | Mahendra5495/Cpp-Learnings | 02_Pointers/03_str.cpp | // Write a program that takes a string input and replaces all occurrences of a
// given character with another character.
#include <bits/stdc++.h>
using namespace std;
void replaceAll(string &s, char a, char t) {
for (int i = 0; i < s.size(); i++) {
if (s[i] == a) s[i] = t;
}
}
int main() {
string ... | ALGO | 0.951925 | 5.214237 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.