uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
034c1cd1-7a33-4036-920e-0f1c86b552a7 | bytedance/terark-zip | 3rdparty/boost-include/libs/iterator/example/transform_iterator_example.cpp | #include <functional>
#include <algorithm>
#include <iostream>
#include <boost/iterator/transform_iterator.hpp>
// What a bummer. We can't use std::binder1st with transform iterator
// because it does not have a default constructor. Here's a version
// that does.
namespace boost {
template <class Operation>
cla... | ALGO | 0.997112 | 6.590609 |
87c04a38-c815-4be6-9450-57ee5f5ed6c1 | Avdhesh-Varshney/CPMasterLog | CodeChef/Practice-Problem/JCOINS.cpp | // Janmansh and Coins
// Problem Code - JCOINS
// https://www.codechef.com/problems/JCOINS
// Solution:
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin >> t;
for(int i = 0; i < t; i++) {
int x, y;
cin >> x >> y;
cout << (10*x) + (5*y) << endl;
}
return 0;
} | ALGO | 0.999799 | 5.28818 |
6e6656b3-bc57-47da-b062-a807eba83815 | ItsLucas/acm | 101008.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct coinp {
bool vis = false;
ll val1, val2;
inline bool operator<(const coinp &c) const { return val1 < c.val1; }
} coins[100010];
int main() {
int t;
scanf("%d", &t);
while (t-- > 0) {
int n;
ll x, y;
... | ALGO | 0.998643 | 3.552 |
bcb4a22f-a879-41ab-accb-2a7954865bd8 | raincross7/code-similarity | codes/train_code/problem363/problem363_266.cpp | #include<stdio.h>
int main()
{
int tc, i, sum =0;
scanf("%d", &tc);
for(i=1; i<=tc; i++)
sum+=i;
printf("%d\n", sum);
}
| ALGO | 0.99521 | 3.651619 |
681a397d-3838-481b-8b8c-19d118cad411 | colinhli/MachineLearning_scratch | third_party/eigen-323c052e1731/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.914514 | 3.370773 |
f667f5be-6e30-40c7-9bd9-e0d12e5590a8 | paavanshetty23/Leetcode_Solutions | 1-two-sum/two-sum.cpp | class Solution {
public:
std::vector<int> twoSum(const std::vector<int>& nums, int target) {
std::unordered_map<int, int> numMap;
for (int i = 0; i < nums.size(); ++i) {
int complement = target - nums[i];
if (numMap.find(complement) != numMap.end()) {
... | ALGO | 0.999652 | 6.921139 |
5c3e10a6-5c42-47d4-96fa-1f81871cbaad | deepanshuoct12/cpp-practise-codes | graphdijkestra.cpp | #include<bits/stdc++.h>
using namespace std;
template <typename T>
class graph{
unordered_map<T,list<pair<T,int> > > m;
public:
void addedge(T u ,T v,int dist,bool bidir=true)
{
m[u].push_back(make_pair(v,dist));
if(bidir)
{
m[v].push_back(make_pair(u,dist));
}
... | ALGO | 0.999891 | 4.022111 |
95fda8cc-eaf6-448f-aff7-ac5a5f3434e9 | mk-isos/Algorithms_Cpp | coding_test/0x0D - 시뮬레이션/0x0D - BOJ/17140.cpp | #include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
int A[105][105];
int n = 3, m = 3;
int r, c, k;
int freq_sort(int arr[], int size)
{
vector<pair<int, int>> v;
int freq[101] = {};
for (int i = 1; i <= size; i++)
{
if (arr[i] == 0)
... | ALGO | 0.999959 | 3.967379 |
fc0aca58-1c58-4d59-b10b-051ebce82df7 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_4224_14.cpp | #include <bits/stdc++.h>
using namespace std;
long long n, p[10005], c[10005], cc;
long long f[2][10005], t;
int main() {
cin >> n >> cc;
for (int i = 1; i <= n; i++) {
cin >> p[i];
}
for (int i = 1; i <= n; i++) {
cin >> c[i];
}
for (long long i = 1; i <= n; i++) {
for (long long j = 1; j < i; ... | ALGO | 0.999968 | 3.230937 |
4aafac81-9d34-4fee-b4e4-d123e40d22e2 | aryandelwadia/Coding-Questions | Leetcode/27. Remove Element.cpp | //link
//https://leetcode.com/problems/remove-element/description/
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int index = 0;
for(int i = 0; i< nums.size(); i++){
if(nums[i] != val){
nums[index] = nums[i];
index++;
... | ALGO | 0.999966 | 5.967639 |
8634ec40-0caa-4d7c-a8b7-cb36ddc343fd | ishandutta2007/codeforces | torisasami/normal/1450/C2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define lscan(x) scanf("%I64d", &x)
#define lprint(x) printf("%I64d", x)
#define rep(i, n) for (ll i = 0; i < (n); i++)
#... | ALGO | 0.999933 | 4.216274 |
42dd72e2-788a-4e25-8b11-bbd9a2c95edf | ashokabairwaideology/Leet-code-problem | solution/2000-2099/2093.Minimum Cost to Reach City With Discounts/Solution.cpp | class Solution {
public:
int minimumCost(int n, vector<vector<int>>& highways, int discounts) {
vector<vector<pair<int, int>>> g(n);
for (auto& e : highways) {
int a = e[0], b = e[1], c = e[2];
g[a].push_back({b, c});
g[b].push_back({a, c});
}
prio... | ALGO | 0.999611 | 5.449436 |
7f71e426-64b5-4658-ab4c-745cb7836013 | raincross7/code-similarity | codes/train_code/problem263/problem263_112.cpp | #include <bits/stdc++.h>
// #undef DEBUG // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
std::cerr << value << ", ";
debug(args...);
}
#define dbg(...) ... | ALGO | 0.999818 | 4.532968 |
8df8b356-c4f4-4d12-9f52-8f4866d51137 | ishandutta2007/codeforces | takio/normal/653/B.cpp | #include <bits/stdc++.h>
#define LL long long
#define pii pair <int, int>
#define piii pair <int, pii>
#define xx first
#define yy second
#define ls rt << 1
#define rs rt << 1 | 1
#define lson ls, l, m
#define rson rs, m + 1, r
#define pis pair <int, string>
using namespace std;
const int N = 200100, M = 1000010, mod ... | ALGO | 0.999848 | 4.214542 |
67a1424d-a093-4277-9f80-19e47fd8e56c | ORNL/Ipopt | src/contrib/CGPenalty/IpCGPerturbationHandler.cpp | #include "IpCGPerturbationHandler.hpp"
#include "IpCGPenaltyData.hpp"
#include "IpCGPenaltyCq.hpp"
#include <cmath>
#include <limits>
namespace Ipopt
{
#if IPOPT_VERBOSITY > 0
static const Index dbg_verbosity = 0;
#endif
CGPerturbationHandler::CGPerturbationHandler()
: PDPerturbationHandler()
{ }
void CGPerturba... | ALGO | 0.993489 | 6.963932 |
7296b39d-d334-4e01-94d4-920eac08acf3 | Shell-Wataru/AtCoder | kakomon/abc127_f.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <numeric>
using namespace std;
using ll = long long;
int solve()
{
ll q;
scanf("%lld", &q);
priority_queue<ll> smaller_half;
priority_queue<ll,vector<ll... | ALGO | 0.999456 | 3.357175 |
cc453404-57c4-44de-abfc-eadba61d624c | wenchaozheng/WRF-GSplus | submodules/diff-gaussian-rasterization/third_party/glm/test/gtx/gtx_fast_trigonometry.cpp | #include <glm/ext/scalar_ulp.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_trigonometry.hpp>
#include <glm/gtx/integer.hpp>
#include <glm/gtx/common.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/trigonometric.hpp>
#include <cmath>
#i... | TEST | 0.956015 | 6.277224 |
5d4e3567-35e0-4d67-a00e-6efccb3ca896 | thanhhai0311/C_CODE_PTIT | tonguocso2.cpp | #include<stdio.h>
#include<math.h>
int main(){
int t;
scanf("%d", &t);
long long sum=0;
while(t--){
int n, i;
scanf("%d", &n);
int tong=0;
for(i=2; i<=sqrt(n); i++){
//if(n%i==0){
while(n%i==0){
tong+=i;
n/=i;
}
//}
}
if(n!=1) tong+=n;
sum+=tong;
}
printf("%lld", sum);
}
| ALGO | 0.999955 | 4.306501 |
396954a2-85a1-496f-b99a-ff214ccb5df5 | arjo31/Personal-DSA-Problems | Strings/valid_parenthesis_string.cpp | /*Given a string s containing only three types of characters: '(', ')' and '*', return true if s is valid.
The following rules define a valid string:
Any left parenthesis '(' must have a corresponding right parenthesis ')'.
Any right parenthesis ')' must have a corresponding left parenthesis '('.
Left parenthesis '('... | ALGO | 0.999825 | 4.749278 |
fa793060-88fa-42ea-98bc-3b78c4f50d53 | ishandutta2007/codeforces | lyc_music/normal/1444/A.cpp | //QwQcOrZ yyds!!!
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include... | ALGO | 0.999809 | 4.004985 |
70e659ac-15f7-417e-8cf8-b17d3e08174c | kmjp/procon | leetcode/201-250/238/1839.cpp | 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 ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) me... | ALGO | 0.999047 | 3.98947 |
39dffa9d-2f92-40fe-ac73-0ef2e00ddb97 | TranQuangDuy-51006/C-ss9-TranDuy | ss9b3.cpp | #include<stdio.h>
int main(){
int arr[100];
int size, phanTuXoa, viTri;
printf("nhap so phan tu cua mang: ");
scanf("%d", &size);
if(size < 0||size > 100){
printf("loi!");
return 1;
}
for(int i =0; i < size;i++){
printf("nhap phan tu thu %d: ", i+1);
scanf("%d", &arr[i]);
}
printf("nhap vi tri muon... | ALGO | 0.999515 | 3.105921 |
d3de6262-791d-48df-bc1a-99c77c78d762 | Topface/hhvm-lzf | lzf.cpp | #ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_lzf.h"
#include "lzf.h"
#ifndef PHP_LZF_ULTRA_FAST
#define PHP_LZF_ULTRA_FAST 1
#endif
/* {{{ lzf_functions[]
*
* Every user visible function must have an entry in lzf_functions[].
*/
z... | TOOL | 0.93631 | 7.162966 |
9bcef626-b8c1-4bcf-835b-d389e618edfa | LeongHouHeng/ProgrammingOJ | UVa/10819 - Trouble of 13-Dots.cpp | #include <iostream>
#include "memory.h"
using namespace std;
int p[4001], f[4001];
int dp[110][11000];
int n, m;
int sf(int i, int w){
if(w > m && m <= 1800)
return -1000;
if(w > m+200)
return -1000;
if(i == n){
if(w > m && w <= 2000)
return -1000;
... | ALGO | 0.999427 | 3.52912 |
76eeb6c9-5ee4-4d1a-838e-9d8eca270fda | C0HERENCE/PAT | B1020.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class store
{
public:
int id;
float sum;
float total_price;
float price;
};
bool cmp(store a,store b)
{
return a.price>b.price;
}
vector<store> stores;
int main()
{
float profit=0;
int N,D;
cin>>N>>D;
for(int i=0;i<N;i++)
{
... | ALGO | 0.999929 | 3.902286 |
01166c24-61fe-4c6c-9492-7ceb091cd324 | odiador/competences | olimpiadas II - 20232/RedProgramacion2/cpp/Happy.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int cant;
cin >> cant;
int index, service, arrival, patience, finalTime;
string result;
for (int i = 0; i < cant; i++) {
cin >> index >> arrival >> service >> patience;
if (index == 1) {
finalTime =... | ALGO | 0.999108 | 3.623179 |
b93d0e5b-52c0-46f6-a743-ec5d24188035 | NVIDIAGameWorks/Displacement-MicroMap-Toolkit | meshops_core/src/umesh_util.cpp | #include <meshops_internal/umesh_util.hpp>
#include "micromesh/micromesh_utils.h"
#include "nvmath/nvmath.h"
#include "nvmath/nvmath_types.h"
#include <glm/matrix.hpp>
#include <micromesh/micromesh_format_types.h>
#include <nvh/nvprint.hpp>
#include <algorithm>
#include <cinttypes>
#include <glm/gtc/type_ptr.hpp>
#incl... | ALGO | 0.996366 | 7.5341 |
6ada0fdb-6e42-435d-88f5-a7bbbafd3a23 | artak7/Bachelor-projects | Algos and DataStructures/2 семестр/4.cpp | // Artak 4
#include <bits/stdc++.h>
using namespace std;
vector <vector <int> > g;
vector <bool> u, c;
vector <int> time_in, fup; // time_out;
int dfs_timer = 0;
void dfs(int v, int p = -1)
{
time_in[v] = fup[v] = dfs_timer++;
u[v] = true;
int children = 0;
for (int i = 0; i < g[v].size(); i++)
{
int to = g[v]... | ALGO | 0.999843 | 4.33121 |
2beec137-a2d6-4c4a-ba3a-392c9d0a0379 | anyatamax/MIPT_Algorithms_and_Data_strustures | 2_semester/3_contest/K.cpp | // Уже долгое время в Институте Мутантов, Фич Технологических и Иностранных языков разводят милых разноцветных зверюшек. Для удобства каждый цвет обозначен своим номером, всего цветов не более 109.
// В один из прекрасных дней в питомнике случилось чудо: все зверюшки выстроились в ряд в порядке возрастания цветов. Поль... | ALGO | 0.999841 | 5.362231 |
cc22dd63-d10a-47b3-acd9-dda5c291b76f | gg-12580/QG-Web-camp | second-week/栈/SqStack/SqStack.cpp | #include "../head/SqStack.h"
using namespace std;
//ʼ
int initStack(SqStack *s)
{
int si;
s->top=-1;
cout<<"\nջijȣ ";
if(!(cin>>si))
{
cin.clear();
while(cin.get()!='\n')
continue;
cout<<"\n\n\n";
}
else
{
see=1;
s->size=si;
cout<<"\nʼɹ\n\n";
}
return 0;
}
//... | ALGO | 0.905869 | 3.155421 |
996a33de-3475-4a8f-a03b-26e1d86c417b | VisionerTech/ORB_SLAM2_Unity | RenderingPlugin/ORB_SLAM2/eigen-eigen-07105f7124f9/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp | MatrixXd A = MatrixXd::Random(6,6);
cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
EigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
complex<double> l... | ALGO | 0.999558 | 3.093769 |
a2ba6fde-33dc-4137-8961-c275e9cabf83 | mohit282/DSA | interview/infosys-q2.cpp | #include <bits/stdc++.h>
using namespace std;
int FindSubArrays(vector<int> &arr, int start, int end)
{
int count = 0;
for (int i = start; i <= end; ++i)
{
int j = i;
while (j <= end && (j == i || arr[j] >= arr[j - 1]))
{
count = (count + 1) % 1000000007;
j++... | ALGO | 0.99993 | 5.042166 |
6ef055f6-b6c9-4ca6-912c-d89e4351b53c | shoujiaxin/leetcode-solutions-cpp | [501] Find Mode in Binary Search Tree/solution2.cpp | /*
* @lc app=leetcode id=501 lang=cpp
*
* [501] Find Mode in Binary Search Tree
*
* https://leetcode.com/problems/find-mode-in-binary-search-tree/description/
*
* algorithms
* Easy (42.03%)
* Likes: 991
* Dislikes: 366
* Total Accepted: 91.7K
* Total Submissions: 215K
* Testcase Example: '[1,null,2,... | ALGO | 0.999991 | 6.612376 |
170f9fdb-c9b7-49a6-81a6-098e08d13cf1 | CipherGirl/Competitive-Programming | Important Algorithm Code/Graph/DFS Using STL & START Node.cpp | #include <bits/stdc++.h>
#define MAX 100
using namespace std;
vector<int> adj_list[MAX];
void addEdge(int u,int v)
{
adj_list[u].push_back(v);
}
void DFS(int n,int s)
{
vector<bool> printed(n,false);
vector<bool> visited(n, false);
vector<int> edge_id(n, 0);
stack<int> dfs_stack;
dfs_stack.p... | ALGO | 0.999979 | 4.636308 |
131bd593-517d-496b-9da1-be51098fceba | thiagotps/linear-algebra | eigen-3.4-rc1/doc/examples/Tutorial_BlockOperations_print_block.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::MatrixXf m(4,4);
m << 1, 2, 3, 4,
5, 6, 7, 8,
9,10,11,12,
13,14,15,16;
cout << "Block in the middle" << endl;
cout << m.block<2,2>(1,1) << endl << endl;
for (int i = 1; i <= 3; ++i)
{
cout << "B... | ALGO | 0.990651 | 3.6853 |
45567d0a-246f-4b0f-813c-36f31f8e8e96 | Jeshika311/DSA-CPP | multidimensional_array/pascals_triangle.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> pascalTriangle(int n)
{
vector<vector<int>> pascal(n);
for (int i = 0; i < n; i++)
{
pascal[i].resize(i + 1);
for (int j = 0; j < i + 1; j++)
{
if (j == 0 || j == i)
{
... | ALGO | 0.99935 | 5.428675 |
652fb037-74c6-4280-9af9-bad856d2b41c | ishandutta2007/codeforces | eecs/normal/480/C.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 5010, P = 1000000007;
int n, K, a, b, ans, f[maxn], g[maxn];
void red(int &x) {
x += x >> 31 & P;
}
int main() {
scanf("%d %d %d %d", &n, &a, &b, &K);
f[a] = 1;
while (K--) {
memset(g, 0, sizeof(g));
for (int i = 1; i <= n... | ALGO | 0.999903 | 3.751678 |
95e41e38-3bac-4a76-b9f0-6d8f316af4e8 | ishandutta2007/codeforces | lonefox/normal/414/D.cpp | #define DEBUG 0
#include <algorithm>
#include <functional>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <list>
#include <map>
#includ... | ALGO | 0.999906 | 3.644929 |
ecd5f3cc-f6f8-4a1f-8292-ecc7af7e7e06 | LukasKnd/middleVector | demo.cpp | #include <iostream>
#include "middleVector.h"
using namespace std;
int main()
{
middleVector<int> v;
v.addLast(5);
v.addLast(7);
v.addLast(8);
v.addLast(9);
v.add(2, 20); // add number 20 to index 2
v.remove(0); // remove number at index 0
//Print all the numbers in vector
for(i... | ALGO | 0.910599 | 4.093602 |
71b9351b-9823-4684-8764-4451364e2ad3 | TimKingNF/leetcode | test/cn/744.find-smallest-letter-greater-than-target.cpp | //
// Created by <EMAIL> on 2020/7/31.
//
#include "gtest/gtest.h"
#include "header.h"
#include "744.find-smallest-letter-greater-than-target.h"
namespace LeetCode744 {
typedef tuple<vector<char>, char> ArgumentType;
typedef char ResultType;
typedef tuple<ArgumentType, ResultType> ParamType;
class LeetCode744Test :... | TEST | 0.993521 | 5.858441 |
d102be5f-1456-4911-b421-73b61dac47d2 | Yixuan-Lee/LeetCode | algorithms/src/Ex_55/Jump_game_@_solution_greedy.cpp | // references:
// https://leetcode.com/articles/jump-game/ (great article)
// greedy:
// time complexity: O(n)
// space complexity: O(1)
#include <iostream>
#include <vector>
using std::vector;
class Solution {
public:
bool canJump(vector<int> &nums) {
if (nums.empty()) {
r... | ALGO | 0.999972 | 6.391589 |
a40ec85f-5efe-4c98-ae41-e992a1dddd97 | Vladimir-Lin/ICPT | CA/Linear/Vector4.cpp | #include "Linear.hpp"
#include <math.h>
CA::Vector4:: Vector4 ( void )
: Vector ( 4 )
{
}
CA::Vector4:: Vector4 ( double * address )
: Vector ( address )
{
}
CA::Vector4:: Vector4 ( Vector3 & v )
: Vector ( 4 )
{
double * U ;
U = v... | TOOL | 0.861719 | 4.362794 |
d4381df5-8980-49a9-939c-9e58d7076767 | doomsday861/Allofit | LUNCHTIM.cpp | /**
* LUNCHTIM
**/
#include<bits/stdc++.h>
#define ll long long
#define testcase ll t;cin>>t;while(t--)
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define run ios_base::sync_with... | ALGO | 0.999787 | 3.652471 |
7bd60f7a-dc05-4b27-9f90-78aa9db6e10c | kfaracik/cpp | struct/5.3.cpp | /* 3. Na szachownicy o wymiarach 100x100 umieszczamy N hetmanów (N<100). Położenie hetmanów
jest opisywane przez strukturę dane:
struct hetman {
int w; // wiersz 0..99
int k; // kolumna 0..99
};
struct dane {
hetman t[100]; // położenie hetmanów
int N; // liczba hetmanów
};
Proszę napisać funkcję, która odpowiada n... | ALGO | 0.998956 | 4.062258 |
a63d188f-51a1-4110-8064-17282dc723ee | loveiscomplicated/longliveprince | beakjoon/C++/implementation/data_str/stack_by_using_array.cpp | #include <iostream>
using namespace std;
class stack {
public:
int* head;
stack(int size) {
arr = new int(size);
head = &arr[0];
arrHead = &arr[0];
arrTail = &arr[size - 1];
}
bool isEmpty() {
if (head == arrHead) {
return true;
} else {
return f... | ALGO | 0.969298 | 5.25756 |
27f81944-04d6-4a63-ab0a-47e0af167102 | rashedcs/Data-Structure-and-Algorithm | Programming Paradigms/Complete Search/3.cpp | //leetcode : https://leetcode.com/problems/subsets/description/
//https://leetcode.com/submissions/detail/137322339/
#include<bits/stdc++.h>
using namespace std;
void backtrack(const vector<int>& nums, int len, vector<vector<int>>& res, vector<int>& sub, int begin)
{
if (sub.size() == len)
{
... | ALGO | 0.999736 | 6.090724 |
4b3ffec8-a3c7-4a37-afa9-a461db68a5e0 | iamsaquib2508/Competitive-Programminng | Codeforces/CF 1140 A.cpp | #include<bits/stdc++.h>
#define ffr(i,a,b) for(i=a;i<b;i++)
#define ffrr(i,a,b) for(i=a;i<=b;i++)
#define pb push_back
#define mm(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define mp make_pair
using namespace std;
int main()
{
int n, i;
while(cin >> n)
{
int a[10004];
ffrr(i,1,n)... | ALGO | 0.999775 | 3.702526 |
932f2881-c65a-4090-bc93-8529e70f6237 | kapoorz/cpptopics | dynamic/mincoinchange.cpp | #include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#define INF INT_MAX
using namespace std;
int memo[100] = {0};
int mincoin(int n, vector<int> arr)
{
// base
if (n < 0)
{
return -1;
}
if (n == 0)
{
return memo[0];
}
// rec
int mini =... | ALGO | 0.999982 | 4.82373 |
f86c7df8-0542-49fc-aafc-9c814a465fae | zlxljj/carAndroid | tess-two/jni/com_googlecode_tesseract_android/src/ccstruct/detlinefit.cpp | #include "detlinefit.h"
#include "statistc.h"
#include "ndminx.h"
#include "tprintf.h"
namespace tesseract {
// The number of points to consider at each end.
const int kNumEndPoints = 3;
// The minimum number of points at which to switch to number of points
// for badly fitted lines.
// To ensure a sensible error met... | ALGO | 0.999233 | 6.934222 |
ec4f48f1-7356-4961-9034-9185f3dd6761 | Taplaton/test_cpp_-project | 227/227.cpp | #include "stdafx.h"
#include <iostream>
#include <iostream>
#include <math.h>
#include <stdlib.h>
using namespace std;
//y = 0, 7(1 / x + ln(x))
//x nach = -4
//x conech =14
//dx =2.5
float f(float x)
{
return
0.7*(1 / x + log(x));
}
int main()
{
system("color 0A");
float y, n1, n2, dx;
cout << " BBODi... | ALGO | 0.994408 | 3.518368 |
b1f4b137-83ad-48b5-b762-9caa52ac1285 | Sumanth-NR/CompetitiveProgramming | Platforms/Practice/2023_12_10/D_Trees_and_Segments.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n, maxK;
cin >> n >> maxK;
string s;
cin >> s;
vector<int> p(n);
for (int i = 0; i < n; ++i) {
p[i] = (i ? p[i - 1] : 0) + (s[i] == '1');
}
/**
* pref[i+1][k] := Max number of 1s in th... | ALGO | 0.999968 | 4.69459 |
4b1dcaea-200b-43ef-9888-cc885ab67c83 | sidharth04-git/DSA_CPP | 6_FUNCTION/MaximumFunction.cpp | #include<iostream>
using namespace std;
int maxi(int a, int b);
int main()
{
int a,b;
cout<<"Enter First Number ";
cin>>a;
cout<<"Enter Second Number ";
cin>>b;
cout<<maxi(a,b);
}
int maxi(int a, int b)
{
int x;
if(a>b)
x = a;
else
x = b;
return x;
} | ALGO | 0.99611 | 3.844896 |
48c94912-cf33-4731-8186-f3c101e1be1f | ITSJKS/CP_Submissions | CP Problems/B_LuoTianyi_and_the_Table.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,l... | ALGO | 0.999885 | 4.069202 |
7940883a-dbe9-43de-b403-9c6ea8aaf8bc | hfutcgncas/mpl_cpp | Thirdparty/eigen/doc/examples/Tutorial_BlockOperations_colrow.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::MatrixXf m(3,3);
m << 1,2,3,
4,5,6,
7,8,9;
cout << "Here is the matrix m:" << endl << m << endl;
cout << "2nd Row: " << m.row(1) << endl;
m.col(2) += 3 * m.col(0);
cout << "After adding 3 times the first colu... | ALGO | 0.993737 | 3.576145 |
4b635052-621b-4be3-bcd5-b24855b5d85e | ishandutta2007/codeforces | krijgertje/normal/765/C.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <cassert>
#include <ctime>
#include... | ALGO | 0.999827 | 3.267972 |
28afd0d5-7402-4492-9666-48a18891b6a0 | shubniggurath/Timus | 1146_MaximumSum.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int Kadane(int **matriz, int tam){
int left = 0, right = 0, maximo = 0, ultimoDato = 0, array[tam], res = INT_MIN;
for(int iter = 0;iter < tam; iter++){
memset(array,0,sizeof(array));
for(int x = iter;x < tam; x++... | ALGO | 0.999969 | 3.64161 |
9805fbb5-6b9d-469a-b066-77d898c255c7 | cueltschey/5G_dynamic_compression | tests/benchmarks/ofh/ofh_compression_benchmark.cpp | #include "srsran/ofh/compression/compression_factory.h"
#include "srsran/ofh/compression/compression_properties.h"
#include "srsran/ran/bs_channel_bandwidth.h"
#include "srsran/ran/cyclic_prefix.h"
#include "srsran/ran/resource_block.h"
#include "srsran/ran/slot_point.h"
#include "srsran/srslog/srslog.h"
#include "srsr... | TOOL | 0.954229 | 7.17933 |
f53798b6-a55d-4f72-b044-ca1648f06f5f | MichalSzymacha/jiip | lab8/ConsoleApplication1.cpp | #include <iostream>
#include <vector>
#include "Triple.h"
using namespace std;
template<typename T>
T minx(T a, T b) {
if (a < b)
return a;
return b;
}
template<typename X>
X maxx(X a, X b) {
if (a > b)
return a;
return b;
}
template<typename A>
A printArray(A arr[], A i) {
return arr[i];
}
template<type... | TOOL | 0.889961 | 4.083489 |
2976d1a4-8d11-4e7d-80fb-f69eba9cc0d0 | LarryChi2000/WM | src/unconstrained/newton.cpp | /*
* Newton's method for non-linear optimization
*/
#include "optim.hpp"
// [OPTIM_BEGIN]
optimlib_inline
bool
optim::internal::newton_impl(
ColVec_t& init_out_vals,
std::function<fp_t (const ColVec_t& vals_inp, ColVec_t* grad_out, Mat_t* hess_out, void* opt_data)> opt_objfn,
void* opt_data,
algo... | ALGO | 0.999978 | 6.397418 |
97cdce60-2a45-4552-b1bc-a35ead310bd5 | piyush121728/leetcode-potd2024 | April/13.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<int> leftSmaller(int n, vector<int> &v)
{
// code here
vector<int> nsl(n, 0);
stack<pair<int, int>> st;
for (int i = 0; i < n; i++)
{
while (st.size() != 0 && st.top().first >= v[i]... | ALGO | 0.999971 | 6.524106 |
cd8f71b1-1e52-45ae-b33c-3075e12981c8 | Sangwanji/DSA | Array/Medium/maxsubarraysum.cpp | #include<bits/stdc++.h>
using namespace std;
// Brute -> make 3 loop and make all subarray
// Better -> iterating at each subarray using two loop
int mxsum(int arr[],int n){
int maxsum = INT_MIN,sum;
for(int i = 0; i < n; i++){
sum = 0;
for(int j=i;j<n;j++){
sum+=arr[j];
... | ALGO | 0.999984 | 4.397794 |
9af2d728-b7ff-4d87-93ee-7d1c6d725918 | iamRishant/Leetcode | 3373-maximum-prime-difference/maximum-prime-difference.cpp | class Solution {
public:
bool check(int number){
// one is not a prime number
if(number==1) return true;
if(number==2) return false;
for(int i=2;i*i<=number;i++){
if(number%i==0) return true;
}
return false;
}
int maximumPrimeDifference(vector<int>... | ALGO | 0.999962 | 5.279264 |
845fc96f-1714-436d-be28-c7feb1428034 | ishandutta2007/codeforces | fastmath/normal/901/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 3e5 + 7;
struct Edge {
int v, num;
Edge(int v_, int num_) {
v = v_; num = num_;
}
Edge(){}
};
int n, m;
vector <Edge> g[MAXN];
pair <int, int> ed[MAXN];
void read() {
cin >> n >> m;
for (int i = 0; ... | ALGO | 0.999939 | 4.298653 |
e9a25618-37c6-44c0-9975-727b00a503ba | sourcegraph/lsif-clang | lldb/examples/synthetic/bitfield/program.cpp | typedef unsigned int uint32_t;
enum MaskingOperator {
eMaskingOperatorDefault = 0,
eMaskingOperatorAnd = 1,
eMaskingOperatorOr = 2,
eMaskingOperatorXor = 3,
eMaskingOperatorNand = 4,
eMaskingOperatorNor = 5
};
class MaskedData {
private:
uint32_t value;
uint32_t mask;
MaskingOperator oper;
public:
... | TOOL | 0.994106 | 6.231884 |
15f4cb24-9531-4917-ab22-2028f0f4eec0 | ayushptk/Data-Structure-Algorithim | Selection sort.cpp | #include <stdio.h>
void selectionSort(int a[], int n) //main codee
{
int min, temp;
// a[5]={27,16,44,10,7}
for (int i = 0; i < n - 1; i++) // 0<=3 true
{
min = i; // min=0;
for (int j = i + 1; j < n; j++) //j=0+1=1 ; 1<=4 true
{
if ( a[min]> a[j] ) //a[0]>a[1] 27>... | ALGO | 0.999922 | 3.445802 |
504a512d-4229-4fae-8e7c-bf68d4eb5e09 | zjkmxy/algo-problems | 平成26年/博弈论/HDU3032.cpp | /*
HDU3032 Nim or not Nim?
SG
0 -> 0
1 -> 1
2 -> 2
3 -> 4(1+2=3)
4 -> 3(֮ǰ34)
5 -> 5
6 -> 6
7 -> 8(2+5=7)
8 -> 7(ͬ)
...
*/
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int calc_sg(int x)
{
if((x & 3) == 3)
return (x + 1);
if((x & 3... | ALGO | 0.999988 | 3.911429 |
93aa6d5e-3158-4b22-8ba4-8f3a5a25c3a7 | raincross7/code-similarity | codes/train_code/problem413/problem413_61.cpp | #define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include... | ALGO | 0.999861 | 3.504351 |
0919c0fd-aeb0-484a-a2fc-3003c0b5644c | DIMPLESINGHVI/Leetcode_questions | reverse_String_inplace.cpp | // Write a function that reverses a string. The input string is given as an array of characters s.
// You must do this by modifying the input array in-place with O(1) extra memory.
class Solution {
public:
void reverseString(vector<char>& s) {
int i=0, j = s.size()-1;
while(i<j)
{
... | ALGO | 0.997578 | 5.478458 |
922dc7f1-45e2-4684-9655-108cef653f8e | code-shayne/ENGR_116 | a5_p1.cpp | // Made By Shayne Lada
// 10/1/24
// I pledge my honor that I have abided by the Stevens Honor System
#include <iostream>
using namespace std;
int main () {
int num = 0;
int nums[10];
int total=0;
//fills an array with ten numbers that the user inputs
for(int i = 0; i < 10; i++) {
cout <<"... | ALGO | 0.858371 | 3.810771 |
6ed1e3ee-d21d-4be4-9616-95ba1eb88b8e | alibaba/sionnx | llvm/lib/CodeGen/LatencyPriorityQueue.cpp | #include "llvm/CodeGen/LatencyPriorityQueue.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
#define DEBUG_TYPE "scheduler"
bool latency_sort::operator()(const SUnit *LHS, const SUnit *RHS) const {
// The isScheduleHigh flag allows n... | ALGO | 0.978218 | 7.545676 |
291b5972-a7f9-465d-ac75-2c4c09002883 | bhavy3103/Competitive-Programming | Codeforces/363B.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff(i, a, b) for (ll i = a; i < b; i++)
#define fb(i, a, b) for (ll i = a; i >= b; i--)
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(a, min(b, min(c, d)))
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d... | ALGO | 0.999982 | 4.267511 |
f9ead4d8-f9cb-4313-858f-4367e6b0c470 | Aadi1909/Leetcode | 78-subsets/subsets.cpp | class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
vector<vector<int>> answer;
for(int i = 0; i < (1 << nums.size()); ++i){
vector<int> temp;
for(int j = 0; j < nums.size(); ++j){
if(i & (1 << j)){
temp.push_back(nums... | ALGO | 0.999862 | 6.296463 |
964acddd-4ff3-4727-b946-09d62305d104 | Safayet19/Data-Structure | Binary Tree/sum_without_leaf.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node* left;
Node* right;
Node(int val)
{
data = val;
left = NULL;
right = NULL;
}
};
Node* input_tree()
{
int n;
cin>>n;
Node* root;
if(n == -1)
root == NULL;
el... | ALGO | 0.999832 | 3.726814 |
bd1945a2-b98c-488b-a825-9e87b201c1d0 | tony-coder/PAT | C++/Advanced Level/1122 Hamiltonian Cycle (25分).cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 200 + 10;
int g[maxn][maxn];
bool vis[maxn];
void addEdge(int u, int v) {
g[u][v] = 1;
}
int main(int argc, char const *argv[])
{
int N, M;
scanf("%d%d", &N, &M);
for (int i = 0; i < M; ++i) {
int u, v;
scanf("%d%d", &u, &v);
addEdge(u, v);
a... | ALGO | 0.999957 | 4.397726 |
0b01a436-05fe-41f7-9aeb-4acf361e337f | soadkhan/My-Code | C++/sec.cpp | #include<bits/stdc++.h>
using namespace std ;
typedef long long int ll ;
int main(){
//freopen("uva.txt","rt",stdin);
//freopen("uva_out.txt","wt",stdout);
ll h1 , m1 , s1 , h2 , m2 , s2 ;
ll n ;
cin>>n ;
while(n--){
scanf("%lld:%lld:%lld %lld:%lld:%lld" , &h1 , &m1 , &s1 , &h2 , &m2... | ALGO | 0.999931 | 3.037458 |
ce5a03d5-c20a-48f7-a524-4424e4ec321e | Final-Combat-Source/finalcombat-src | src/game/shared/gamemovement.cpp | #if defined(HL2_DLL) || defined(HL2_CLIENT_DLL)
#include "hl_movedata.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define STOP_EPSILON 0.1
#define MAX_CLIP_PLANES 5
#include "filesystem.h"
#include <stdarg.h>
extern IFileSystem *filesystem;
#ifndef CLIENT_DL... | TOOL | 0.865449 | 3.318662 |
159c1325-0abc-41da-9a4a-924887eb7805 | okaryo/CompetitiveProgramming | VirtualContest/2019/20190814/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
int main() {
int n; cin >> n;
string s; cin >> s;
string x = "", y = "";
int cnt = 0;
rep(i, n) {
if (s[i] == '(') cnt ++;
else if (s[i] == ')'... | ALGO | 0.999884 | 4.168255 |
4d6caae5-7918-4566-a5a4-24af4ecc15fd | parasguglani1/competitive_coding | Codeforces/797 Div3/D_Black_and_White_Stripe.cpp | #include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#define ff first
#define ss second
#define int long long
using ll = long long;
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define PI 3.1415926535897932384626
#define ps(x,... | ALGO | 0.999766 | 4.299987 |
87b2b273-4fc5-4072-a77d-95074454d572 | suyundukov/LIFAP1 | TP/TP4/Code/2.cpp | /* Trier un tableau de 10 entiers en utilisant le tri par comptage */
#include <iostream>
const int SIZE = 10;
/* Proc?ure */
void compter(int tab[SIZE], int tab1[SIZE])
{
int indice; // Utiliser dans le tableau r?ultat
int nmbr;
int tabComptage[SIZE] = {};
indice = 0;
// Tableau de comptage
for (int i... | ALGO | 0.999992 | 5.301639 |
160b2c15-e59e-4661-a2c9-313dfa7566d0 | Ayusohm432/Coding | ProblemOfTheDay/Geeksforgeeks/18.11.2024_Rotate Array.cpp | /*
Problem link: https://www.geeksforgeeks.org/problems/rotate-array-by-n-elements-1587115621/1
*/
/*Rotate Array
Given an unsorted array arr[]. Rotate the array to the left (counter-clockwise direction) by d steps, where d is a positive integer. Do the mentioned change in the array in place.
Note: Consider the arra... | ALGO | 0.999955 | 6.189513 |
a214f69d-cfb7-46d7-b1a8-7443b5445c8b | VisualPi/ESGI_COURS_VISUALPI | OPENGL/utilities/libs/glm/test/core/core_func_matrix.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentatio... | TEST | 0.90572 | 6.525883 |
36c45c5a-3c61-4dad-8c41-2a3dc0f1592b | pratapshingane18/Array-ADT | Linearsearh.cpp |
// Creating array in Heap
#include<iostream>
using namespace std;
struct Array
{
int A[20];
int size;
int Length;
};
void Display(struct Array arr){
cout<<"Elements of the array are:"<<endl;
for(int i=0; i < arr.Length; i++){
cout<<arr.A[i]<<" ";
}
}
void Append(struct Array *ar... | ALGO | 0.997915 | 3.357374 |
e6bf72b4-aec9-4c91-a5ff-1569412dc933 | ishandutta2007/codeforces | posij118/normal/1146/B.cpp |
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int cnt = 0;
for(int i = 0; i<s.size(); i++){
if(s[i] != 'a') cnt++;
}
if(cnt % 2){
cout << ":(";
return 0;
}
int chars[cnt/2];
int used = 0;
int last = 0;
for(int i = ... | ALGO | 0.999033 | 3.24114 |
fc1b24bb-fcf1-4061-8ec9-1e7fe5a5da10 | sarvex/leetcode-matlab | solution/2600-2699/2653.Sliding Subarray Beauty/Solution.cpp | class Solution {
public:
vector<int> getSubarrayBeauty(vector<int>& nums, int k, int x) {
int n = nums.size();
int cnt[101]{};
for (int i = 0; i < k; ++i) {
++cnt[nums[i] + 50];
}
vector<int> ans(n - k + 1);
auto f = [&](int x) {
int s = 0;
... | ALGO | 0.999989 | 5.382412 |
9482b53b-d4d3-4931-af47-29f8c6dc0a0e | ishandutta2007/codeforces | disangan233/normal/1174/F.cpp | #include<bits/stdc++.h>
using namespace std;
#define db double
#define re register int
#define ll long long
int ndep,n,h[200005],cnt,dep[200005],fa[200005],size[200005],son[200005],top[200005],edp[200005],ans=-1;
struct did{
int next,to;
}e[400005];
#define ak *
char qwq;
inline int read()
{
int zxy=0,ioi=1;qwq=getch... | ALGO | 0.99976 | 3.705235 |
adb2af63-1659-443e-8296-408a3c6b8c66 | zzu-yaaa/Algorithm_CPP | WEEK02/BOJ_7576.cpp | // 7576 토마토
#include <iostream>
#include <queue>
using namespace std;
int tomato[1001][1001];
int vis[1001][1001];
int main() {
int m, n;
cin >> m >> n;
int ans = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> tomato[i][j];
}
}
for (int i ... | ALGO | 0.99994 | 5.672443 |
b4d2a92c-d6fb-4aaf-943c-6110019db405 | ishandutta2007/codeforces | satashun/normal/1667/B.cpp | #pragma region satashun
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV =... | ALGO | 0.999961 | 5.026966 |
371f458f-5ca6-405f-a88e-8780100e4dce | Qhzy1411/ACM | CPP/2025summer/dingpa/8.1/1004.cpp | // Author: QHZY
// Create_Time: 2025/08/01 13:12:49
#include <bits/stdc++.h>
using namespace std;
using i32 = int;
using i64 = long long;
using i128 = __int128;
using u32 = unsigned;
using u64 = unsigned long long;
using u128 = unsigned __int128;
using f32 = float;
using f64 = double;
using f128 = long double;
using ... | ALGO | 0.999987 | 4.335926 |
3454f0a8-0846-47ca-a9f8-50b52b5fe947 | mkimhi/Binary-Code-Optimization-C- | src/proj_branch_optimizer.cpp | #ifndef BRANCH_OPTIMIZER
#define BRANCH_OPTIMIZER
#include "proj_globals.h"
#include "proj_dumps.cpp"
/* ============================================================= */
/* Translation routines */
/* ============================================================= */
/**********... | ALGO | 0.987925 | 3.425533 |
afb018a6-5788-46b9-bf9a-0ea64843fa85 | opencollab/scilab | scilab/modules/optimization/sci_gateway/cpp/sci_optim.cpp | /*--------------------------------------------------------------------------*/
#include "optimization_gw.hxx"
#include "function.hxx"
#include "double.hxx"
#include "string.hxx"
#include "polynom.hxx"
#include "list.hxx"
#include "optimizationfunctions.hxx"
#include "numericconstants.hxx"
#include <limits>
extern "C"
... | ALGO | 0.998331 | 5.548477 |
313a72db-551c-46fd-8709-64435de45228 | ico12319/Data-structures-and-algorithms | Tasks/task-preparation/gen_bool_vectors/generation.cpp | #include <iostream>
#include <queue>
// Генерирайте всички възможни троични вектори с дължина n
std::vector<std::string> generate_triplets(size_t n){
std::vector<std::string> result;
std::queue<std::string> q;
q.push("");
while(!q.empty()){
auto curr = q.front();
q.pop();
if(cur... | ALGO | 0.997865 | 4.255701 |
cfd146cf-e8f7-4c33-8314-2cfe7e5e4f6f | camil0palacios/Competitive-programming | solutions/codeforce/Codeforces Round #701 (Div. 2)/a.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define fori(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define fore(i,a,b) for(int i = a; i <= b; i++)
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define sz(v) (int) v.size()
#define pb push... | ALGO | 0.999585 | 4.299117 |
084bf222-09c9-4e28-9759-2174a40d66a2 | traclabs/ros2_planning_system_examples | src/simple_bt_example/simple_bt_example_controller_node.cpp | #include <plansys2_pddl_parser/Utils.h>
#include <memory>
#include <plansys2_msgs/ActionExecutionInfo.h>
#include <plansys2_msgs/Plan.h>
#include <plansys2_domain_expert/DomainExpertClient.hpp>
#include <plansys2_executor/ExecutorClient.hpp>
#include <plansys2_planner/PlannerClient.hpp>
#include <plansys2_problem_ex... | TOOL | 0.866192 | 4.238977 |
37a74c29-571e-48d3-bb83-bf1fc1e19303 | Srinivas-rdj/leetcode-solutions | 3508-number-of-bit-changes-to-make-two-integers-equal/number-of-bit-changes-to-make-two-integers-equal.cpp | class Solution {
public:
int minChanges(int n, int k) {
int cnt=0;
for(int i=0;i<32;i++){
if(((n>>i)&1)){
if(((k>>i)&1)==0) cnt++;
}
else{
if((k>>i)&1) return -1;
}
}
return cnt;
}
}; | ALGO | 0.999973 | 5.584068 |
c81128a4-08af-437e-8155-708793de4519 | Zqzqsb/LeetCodeHot100 | cpp/0560.subarray-sum-equals-k/solution.cpp | // Created by ZQ at 2025/03/07 17:14
// leetgo: 1.4.8
// https://leetcode.cn/problems/subarray-sum-equals-k/
/*
560. 和为 K 的子数组 (Medium)
给你一个整数数组 `nums` 和一个整数 `k` ,请你统计并返回 该数组中和为 `k` 的子数组的个数 。
子数组是数组中元素的连续非空序列。
**示例 1:**
```
输入:nums = [1,1,1], k = 2
输出:2
```
**示例 2:**
```
输入:nums = [1,2,3], k = 3
输出:2
```
**提示:**... | ALGO | 0.999981 | 6.444774 |
c6ca5af2-af7b-459f-9549-644050bb9a78 | Nosewall/Leetcode-Hobby-Dream-Machine | 605. Can Place Flowers/main.cpp | class Solution {
public:
bool canPlaceFlowers(vector<int>& flowerbed, int n) {
for(int i = 0; i < flowerbed.size(); i++){
if (n == 0) break;
if(( i == 0 || flowerbed[i-1] == 0) && flowerbed[i] != 1){
if(i == flowerbed.size() - 1 || flowerbed[i+1] == 0){
... | ALGO | 0.999989 | 6.859431 |
91a5f67e-f9e3-4698-a6fa-b9052bfe388b | Nawaz972/Solutions_Arrays | Remove all characters other than alphabets - GFG/remove-all-characters-other-than-alphabets.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
string removeSpecialCharacter(string s) {
// code here
string str;
int cnt = 0;
for(int i = 0; i < s.lengt... | ALGO | 0.997709 | 5.666955 |
4d18a12b-f4c7-4da8-a66c-e59b6876996c | tajbidtousif/Codeforces-Solution | Problems/IlyaandBankAccount.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int a,l,bl,ans;
cin >> a;
if(a>0)
{
cout << a << endl;
}
else
{
a = abs(a);
l = a % 10;
a /= 10;
bl = a % 10;
if(l<bl)
{
ans = (a / 10) * 10 + l;
... | ALGO | 0.999688 | 3.585015 |
e7e67eec-66a2-49c8-8e93-61f97681c219 | forked-llvm/Polaris-Obfuscator | clang/lib/Tooling/CommonOptionsParser.cpp | #include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/CommandLine.h"
using namespace clang::tooling;
using namespace llvm;
const char *const CommonOptionsParser::HelpMessage =
"\n"
"-p <build-path> is used to read a compile command database.\n"
"\n"
"... | TOOL | 0.958888 | 7.914087 |
77386c4b-277e-4f23-bc24-46566fcc00f1 | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/10/1001/personal_submission/cf363d_WanderOvO.cpp | /*
显然有便宜的车肯定先租便宜的车更好,最后租的车是前 r 便宜的肯定是一种最优解
假如一个自带钱多的人最后都租不到车,那么自带钱少的人更租不到车了,所以可以断定一定是租金前 r 多的人租到了车
升序排序车子,降序排序人,二分 r
对于某个确定的 r,如何检查?
分类讨论画画线段,发现钱多的买贵的,钱少的买便宜的最好
这样可以求出最大的 r,进一步如何求最小的 s?
由于买这 r 个车总钱数确定,所以要多花公共的钱才能让 s 变小,其实就是最极限把 a 都花光
所以直接总代价 - a,和 0 取最大值就是最少花费的个人财产
*/
int n, m, a, b[N], p[N];
bool check(int ans) {
... | ALGO | 0.999896 | 3.837143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.