uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
443c45bc-af4c-4467-a340-81e722cbaec5 | KAYTERDOESTHINGS/Cpp-Practice | NMLT-Baitap/Level9/Bai9Level9.cpp | #include<iostream>
void nhap(int &n, int A[]);
int demPTchiXH1trong2Mang(int A[], int nA, int B[], int nB);
int demPTchiXHtrongA(int B[], int nB, int A[], int nA);
bool timThay(int A[], int n, int x);
void xuat(int n);
using namespace std;
#define SIZE 1000
int main()
{
int A[SIZE], B[SIZE];
int nA,nB;
nhap(nA,A);
... | ALGO | 0.999753 | 3.204469 |
334d8b0a-d536-4284-a6d4-e5eaee13bac8 | toufiq-dev/leetcode-practices | 0645-set-mismatch/0645-set-mismatch.cpp | class Solution {
public:
vector<int> findErrorNums(vector<int>& nums) {
unordered_map<int, int> seen;
int duplicate = -1;
for (int i = 0; i < nums.size(); i++) {
if (seen.count(nums[i]))
duplicate = nums[i];
seen[nums[i]] = i;
... | ALGO | 0.999483 | 6.157457 |
115bfda5-9210-4fff-8d0d-b01e1584fb05 | C0HERENCE/PAT | B1033.cpp | #include<set>
#include<iostream>
#include<cctype>
using namespace std;
int main()
{
string brokenKey;
getline(cin,brokenKey);
set<char> s;
for (int i = 0; i < brokenKey.length(); i++)
{
if (isupper(brokenKey[i]))
{
s.insert(brokenKey[i]);
s.insert(tolower(brokenKey[i]));
}
else
{
s.ins... | ALGO | 0.999908 | 3.880544 |
63272709-c1f3-4927-bfb4-46bd3aca9672 | wjshuibing/PCL_Demo | doc/tutorials/content/sources/extract_indices/extract_indices.cpp | #include <iostream>
#include <pcl/ModelCoefficients.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h>
#include <pcl/sample_consensus/model_types.h>
#include <pcl/segmentation/sac_segmentation.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/filters/extract_ind... | ALGO | 0.951671 | 5.456703 |
93722813-287a-4a4d-8e9c-5a8d75c45644 | RahulChakravarthy/LateNightCoding | Assignment 1/floatPtNum.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout << setprecision(20) << fixed;
double A;
double B;
double C;
cout << "Please enter 2 intergers (seperated by a space): ";
cin >> A >> B;
C = A / B;
cout << "A divided B = " << C << endl;
return 0;
}
| ALGO | 0.960921 | 4.381542 |
a1748012-674f-4fbf-995f-15dfebc38b14 | vinayak-7/DSA | Difficulty: Basic/Sums of i-th row and i-th column/sums-of-ith-row-and-ith-column.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:
int sumOfRowCol(int n, int m, vector<vector<int>> mat) {
// code here
int x = min(n,m);
for(int i = ... | ALGO | 0.99997 | 5.927982 |
75a83c9a-a5fa-4864-9704-159b58d9560c | scanof/Competitive-Programming-Notebook | code/data-structures/link_cut_tree.cpp | struct Node { // Splay tree. Root's pp contains tree's parent.
Node *p = 0, *pp = 0, *c[2] = {0, 0};
bool flip = 0;
Node(){}
void fix() { forn(i, 2) if(c[i]) c[i]->p = this; }
inline int up() { return p ? p->c[1] == this : -1; }
void push() {
if (!flip) return;
flip = 0, swap(c[0], c[1]);
forn(... | ALGO | 0.99975 | 4.147229 |
a6339907-700b-4932-af8d-604c3ca13860 | raincross7/code-similarity | codes/train_code/problem055/problem055_454.cpp | #include <iostream>
using namespace std;
int main(){
int N; cin >> N;
int res = 0;
int cnt = 0;
int prev = -1;
for(int i=0;i<N;i++){
int a; cin >> a;
if(a != prev){
res += cnt/2;
cnt = 1;
} else {
++cnt;
}
prev = a;
}
... | ALGO | 0.999739 | 3.812114 |
7fde745a-20e4-4b61-87ba-9580326bd1ff | qwerasdfzxcvtyuibnm/isgopaid | isgopaid/isgopaid/PaperCodes/searchcode_backtrack_restart/main.cpp | #include <iostream>
#include <cstdint>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <utility>
#include <stdlib.h> /* atoi */
#include "BCData.hpp"
#include "configBC.hpp"
#include<ctime>
using namespace std;
clock_t start, end1;
typedef unsigned ... | ALGO | 0.999516 | 4.73998 |
96f2514f-418f-4c33-b05b-78cd0b2383b8 | DhruvDave12/DSA-Practice | LB/LinkedList/checkCircular.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
next = NULL;
}
};
bool isCircular(Node *head)
{
// Your code here
if(!head) return true;
map<Node*,int> mp;
Node* temp = head;
while(temp){
... | ALGO | 0.999667 | 4.283289 |
ad643a8a-2efa-4329-a68c-52a73e1b36b5 | fbacchus/MaxHS | cadical/src/ema.cpp | #include "internal.hpp"
namespace CaDiCaL {
// Updating an exponential moving average is placed here since we want to
// log both updates and phases of initialization, thus need 'LOG'.
void EMA::update (Internal * internal, double y, const char * name) {
#ifndef LOGGING
(void) internal, (void) name;
#endif
// Th... | ALGO | 0.982906 | 7.313944 |
ba5d5f13-9b81-4860-b33d-c087be7179fb | vvxxzzyy/TLX | 06. Perulangan/H. Pola I.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n, m;
scanf("%d %d", &n, &m);
for (int i=1; i<=n; i++) {
if (i%m == 0) {
printf("* ");
continue;
}
printf("%d", i);
if (i <= n-1) {
printf(" ");
} else {
printf("\n");
}
}... | ALGO | 0.999991 | 3.482768 |
6e4cc79f-ddc0-48ca-8c88-3f5bd7c3f42a | MMSS9402/algorithm | class/25class/insert,erase.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
string str = "ABCDEFG";
//문자열에 3번 인덱스부터 BTS 문자열을 집어넣음
str.insert(3,"BTS");
//3번 인덱스부터 4글자를 지워라!
str.erase(3,4);
return 0;
} | TOOL | 0.928558 | 3.684424 |
dbc98e7d-efaa-434f-bc15-614a75011f77 | evga7/Practice_Algorithm_01 | BOJ_1389.cpp | #include <iostream>
#include <queue>
#include <string.h>
using namespace std;
int arr[101][101];
int visited[101];
int depth[101];
int N,M;
int result[101];
queue <int> q;
void BFS(int x)
{
q.push(x);
visited[x] = 1;
while (!q.empty())
{
int cur_x;
cur_x = q.front();
q.pop();
int i;
for (i = 1;i <= N; i++... | ALGO | 0.999936 | 3.990701 |
7fb14433-627c-4d5b-b55b-cbd6dc0807d5 | serbantasss/Competitive-Programming | OTHER/Dn Kisch/Cursuri/31.10.2016/vocale/main.cpp | #include <cstdio>
#include <cstring>
#include <cctype>
using namespace std;
const int NMAX=255;
int nrvocale(char *s)
{
char *p;
p=s;
int nr=0;
for(;*p;p++)
if(strchr("aeiou",*p))
nr++;
return nr;
}
int main()
{
freopen("vocale.in","r",stdin);
freopen("vocale.out","w",std... | ALGO | 0.999731 | 3.584165 |
220b7ad2-9038-4a1e-a359-58ad5e2d915b | Ming-J/LeetCode | CodeForces/0488A_Rewards.cpp | #include <iostream>
using namespace std;
int main(){
int shelf, c1,c2,c3, m1, m2, m3;
cin>>c1>>c2>>c3;
int ct = c1 + c2 + c3;
cin>>m1>>m2>>m3;
int mt = m1 + m2 + m3;
cin>>shelf;
for(int i = shelf; i > 0; --i){
if(ct > 0){
ct -= 5;
}else{
mt -= 10;
}
}
if(ct <= 0 && mt <= 0){
... | ALGO | 0.999293 | 3.522937 |
6d629ada-a0a6-4749-b2c2-e1395d7fe6fa | Bxiaoyu/CPlusPlusLearn | c++学习/引用/引用/引用基本语法.cpp | #include <iostream>
#include <string>
using namespace std;
// ûʹ
void test1()
{
int a = 10;
int& b = a;
cout << "a = " << a << endl;
cout << "b = " << b << endl;
b = 100;
cout << "a = " << a << endl;
cout << "b = " << b << endl;
}
// ע
void test2()
{
// 1.ñʼ
int a = 10;
int... | ALGO | 0.951145 | 3.104614 |
438b3514-738f-43fa-82c7-5fb6e8921335 | liamsmyt/Sequencer | src/LowpassHighpassFilter.cpp | // LowpassHighpassFilter.cpp
#include "LowpassHighpassFilter.h"
#include "Clamp.h"
void LowpassHighpassFilter::setHighpass(bool highpass) {
highpass = highpass;
}
void LowpassHighpassFilter::setCutoffFrequency(float cutoffFrequency) {
this->cutoffFrequency = cutoffFrequency;
}
void LowpassHighpassFilter::setSamp... | ALGO | 0.996721 | 4.980978 |
f8e109b8-41d0-46f3-8998-79f12846103e | moof2k/golf | code/lib/bullet/Demos/MultiThreadedDemo/MultiThreadedDemo.cpp | //#define USE_PARALLEL_SOLVER 1 //experimental parallel solver
#define USE_PARALLEL_DISPATCHER 1
#include "btBulletDynamicsCommon.h"
#include "BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h"
#ifdef USE_PARALLEL_DIS... | ALGO | 0.854763 | 4.901032 |
d4e85c3d-bad5-4022-8c80-ccc5978f1e83 | ghaithsaidani/Coding_Challenges | CodeForces/c++/1300 problems/IQTest.cpp | #include "iostream"
using namespace std;
int main()
{
int n,even=0,odd=0, lastEven=0, lastOdd=0;
cin >> n;
for (int i=0;i<n;i++)
{
int x;
cin >> x;
if(x % 2 ==0)
{
even++;
lastEven=i+1;
}
else
{
odd++;
... | ALGO | 0.999492 | 3.903939 |
1194c135-d947-4fe1-b52c-646de989be0f | vascolleitao/las | examples/kmeans/src/kmeans.cpp | #include "kmeans.hpp"
#include <iostream>
#include <las/las.hpp>
auto point_assignment = [](const std::tuple<point, cluster_id, size_t>& ite) {
return std::make_tuple(std::get<1>(ite), std::get<0>(ite));
};
static size_t k_centroid;
struct hashmap_sum_and_count
{
std::vector<sum_and_count> acc;
hashmap_sum_an... | ALGO | 0.999723 | 5.13854 |
99ced514-5d6f-4281-bb67-180749803007 | ryotgm0417/AtCoder | contests/ABC/ABC163/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using P = pair<ll, ll>;
// chmin, chmax関数
template<typename T, typename U, typename Com... | ALGO | 0.999987 | 4.169733 |
b6fada35-63b4-4789-9909-950ed518855f | tiger0132/code-backup | Luogu/P4000~P4999/P4245 【模板】任意模数NTT/1.cpp | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstring>
using ll = long long;
using comp = std::complex<long double>;
const int N = 6e5 + 56, P = 32767;
const long double PI = acosl(-1);
int l, lim = 1, r[N];
void fft(comp* a, int op) {
for (int i = 0; i < lim; i++)
if (i < r[i]) std::swap(a[i... | ALGO | 0.999991 | 3.718897 |
a763b7c6-47d3-437d-a794-848668da78dd | AnukulPr1me/Leet-Code-answers | Leet Code Answers/#2971 Find Polygon With the Largest Perimeter.cpp | class Solution {
public:
long long largestPerimeter(vector<int>& nums) {
int n = nums.size();
long long sum = accumulate(nums.begin(), nums.end(), 0LL); // Calculate sum of elements
sort(nums.begin(), nums.end()); // Sort the array
for (int i = n - 1; i >= 2; i--) {
sum ... | ALGO | 0.999865 | 5.670204 |
fa89d042-4104-4c58-bbe4-984083d7295a | miaowh/ICPC | BZOJ/2560.cpp | // ybmj
#include <bits/stdc++.h>
using namespace std;
#define lson (rt << 1)
#define rson (rt << 1 | 1)
#define lson_len (len - (len >> 1))
#define rson_len (len >> 1)
#define pb(x) push_back(x)
#define clr(a, x) memset(a, x, sizeof(a))
#define mp(x, y) make_pair(x, y)
typedef long long ll;
typedef pair<int, int> pii;
... | ALGO | 0.999988 | 3.847669 |
4e13b69d-d197-4635-a9cf-75f76f592c95 | adityaparmar9813/daily-leetcode | count_number_of_bad_pairs.cpp | class Solution {
public:
long long countBadPairs(vector<int>& nums) {
unordered_map<int, int> mp;
int n = nums.size();
long long good = 0;
for (int i = 0; i < nums.size(); i++) {
mp[i - nums[i]]++;
}
for (const auto& [num, count] : mp) {
good += (count * 1ll * (count - 1)) / 2;
}
return (n ... | ALGO | 0.999965 | 5.19462 |
52963b81-32cf-4ca3-b4bc-2a4edc04afa2 | nhatanh2709/Crypto3_4 | Task4/Verify/main/main/dllmain.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <iostream>
using std::cout;
using std::endl;
#include <string>
using std::string;
#include "cryptoPP/osrng.h"
#include "cryptopp/pem.h"
#include "cryptopp/pem_common.h"
#include "cryptopp/filters.h"
// using CryptoPP::AutoSeededX917RNG;
using CryptoPP... | TOOL | 0.891798 | 5.004068 |
e148841d-4f2a-4192-9a09-ae78fc8f811e | Pranay-Prasad2/DSA | que/numberof1.cpp | #include<bits/stdc++.h>
using namespace std;
int ones(int n)
{
int num = n;
int once = 0;
while (num != 0)
{
int ret = (num & num-1);
num = ret;
once++;
}
return once;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout<<ones(19)<<endl;
re... | ALGO | 0.999828 | 4.128499 |
b9b4db28-d4e6-4238-84cc-1aa69d16cee3 | shashwata2003/DSA | 1.DSA Course/37subsetrecursion/a.cpp | #include<iostream>
#include <bits/stdc++.h>
#include <array>
using namespace std;
/*
Given an integer array nums of unique elements, return all possible
subsets
(the power set).
The solution set must not contain duplicate subsets. Return the solution in any order.
Power set is the set of all subset.
eg: {1,2} ans {... | ALGO | 0.999616 | 5.465618 |
655ed7e6-96b2-4488-a094-78911ac38dec | raincross7/code-similarity | codes/train_code/problem057/problem057_388.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
string a; cin >> a;
string ans = "";
int i = 0;
while (i < a.size()){
ans += a[i];
i += 2;
}
cout << ans << endl;
} | ALGO | 0.999773 | 3.852759 |
7396f053-70c4-45f9-9ad2-0919b67f6c63 | Dania-Abuhijleh/Try2 | z3-z3-4.8.12/src/ast/recfun_decl_plugin.cpp | #include <functional>
#include <sstream>
#include "ast/expr_functors.h"
#include "ast/recfun_decl_plugin.h"
#include "ast/ast_pp.h"
#include "ast/for_each_expr.h"
#include "util/scoped_ptr_vector.h"
#define TRACEFN(x) TRACE("recfun", tout << x << '\n';)
#define VALIDATE_PARAM(m, _pred_) if (!(_pred_)) m.raise_exceptio... | ALGO | 0.996319 | 7.687951 |
58920b10-7ad4-4edf-9c6e-2df1895441ab | ishandutta2007/codeforces | mjhun/normal/450/D.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
#define fore(i,a,b) for(int i=a,to=b;i<to;++i)
using namespace std;
typedef long long ll;
vector<pair<int,int> > g[100005];
priority_queue<pair<ll,pair<int,int> > > q;
int n,m,k;
ll d[100005];
int main(){
scanf("... | ALGO | 0.99997 | 3.638173 |
358598a3-5ed2-4bc8-ac37-ab02db8ad780 | victorKM/CodeForces | Exam 1/F.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
int array[26] = {};
int n, k, num, temp, count = 0;
char letter;
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> letter;
num = (int)letter;
array[num-65]++;
}
sort(array, array + 26);
for (int i ... | ALGO | 0.999974 | 3.858429 |
e8ad9195-1095-49ee-8db1-bb774391d1bf | MrNanfu/robcup2D_CSU_Yunlu_2020 | Yunlu2020_a/src/chain_action/bhv_normal_dribble.cpp | // -*-c++-*-
/*!
\file bhv_normal_dribble.cpp
\brief normal dribble action that uses DribbleTable
*/
/////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "bhv_normal_dribble.h"
#include "action_chain_holder.h"
#include "action_chain_grap... | TOOL | 0.897406 | 5.541526 |
85aa6926-f4bf-4112-a90f-5c78288a0e9f | alexandraback/datacollection | solutions_5753053697277952_0/C++/x4rkz/senate.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int maxi(vector<int> v)
{
int i = 0;
for(int j = 0; j < v.size(); ++j) {
if(v[j] > v[i]) {
i = j;
}
}
return i;
}
int main()
{
int T;
cin >> T;
for(int i = 1; i <= T; ++i) {
string s = "";
int N;
... | ALGO | 0.999407 | 4.570587 |
afda69a3-a7aa-4c1c-b9f6-e70473ccf8d0 | Jorin24/OSS2025 | 250503/두 배열의 곱/multiple-of-two-arrays.cpp | #include <iostream>
using namespace std;
int main() {
int arr1[3][3], arr2[3][3];
for(int i=0;i<3;i++) {
for(int j=0;j<3;j++) {
cin >> arr1[i][j];
}
}
for(int i=0;i<3;i++) {
for(int j=0;j<3;j++) {
cin >> arr2[i][j];
}
}
for(int i=0;i<3;i... | ALGO | 0.999882 | 3.268783 |
569de119-e263-4cc2-8665-37211c54d087 | yulinxx/AlgorithmBasic | basicAlgorithm/快速排序.cpp |
// 交换排序—快速排序(Quick Sort)
// 快速排序的基本思想是
// 1、先从数列中取出一个数作为基准数
// 2、分区过程,将比这个数大的数全放到它的右边,小于或等于它的数全放到它的左边
// 3、再对左右区间重复第二步,直到各区间只有一个数
#include<stdio.h>
void quickSort(int* a, int nLeft, int nRight)
{
if (nLeft >= nRight)
return;
int i = nLeft;
int j = nRight;
int temp = a[nLeft];
while (i != j)
{
while (i <... | ALGO | 0.999996 | 4.386405 |
a954adf5-116b-453b-9d22-aa6d554f1c82 | zaxhutchinson/project_radius | src/sim.cpp | #include"sim.hpp"
void UpdateNetwork(
i64 time,
Writer * writer,
Network * network,
vec<double> & inputs,
vec<double> & outputs,
double error
) {
// Set the raw input for neurons in the input layer.
// network->SetInputs(inputs);
// // Update the network
// network->Update(... | ALGO | 0.9928 | 4.358222 |
dab99121-5271-4f93-9306-a63a0c65f763 | rahul17081998/Data-Structure | code_cpp/self pased DSA/Greedy/LEETCODE/Non-overlapping-Intervals.cpp | /*Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.
Example 1:
Input: intervals = [[1,2],[2,3],[3,4],[1,3]]
Output: 1
Explanation: [1,3] can be removed and the rest of the intervals ar... | ALGO | 0.999977 | 6.053339 |
b7f3418a-527d-4ce7-a8a4-1388b48208f4 | amansingh-gh/CPP-DSA | 0Refreshment/checkPrimeOrNot.cpp | #include<iostream>
#include <math.h>
using namespace std;
bool findPrime(int n){
// for(int i=2; i<n; i++){
for(int i=2; i<sqrt(n); i++){
if(n%2==0){
return false;
}
}
return true;
}
int main(){
int n;
cout << "Enter the number: ";
cin >> n;
bool isPrime = fin... | ALGO | 0.999414 | 3.782444 |
cd0cb45f-0ccb-446e-b903-59b7cda00a75 | zhangruichang/InterviewProblems | Matrix/main.cpp | #include <bits/stdc++.h>
#define foreach(it,v) for(__typeof((v).begin()) it = (v).begin(); it != (v).end(); ++it)
using namespace std;
typedef long long ll;
const int mod = 9973;
const int maxn = 5000000 + 4;
template<typename T>
struct Matrix
{
int row,colunm;
T **a;
Matrix(int n = 1,int m = 1):row(n),colunm(m) {
... | ALGO | 0.999945 | 3.742489 |
8aef14aa-386e-4416-9344-f4e81dadedf8 | MyLeetCodeRecord/cpp-leetcode | workspace/18.四数之和.cpp | /*
* @lc app=leetcode.cn id=18 lang=cpp
*
* [18] 四数之和
*/
// @lc code=start
class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target) {
sort(nums.begin(), nums.end());
vector<vector<int> > ans;
int n = nums.size();
for(int i=0; i+3<n; i++){
f... | ALGO | 0.999964 | 6.203973 |
d0ad836c-8d8e-4e4c-a598-3309e8105697 | pratikkumar399/Data-Structures-And-Algorithm | searching/binarysearchagain.cpp | #include <bits/stdc++.h>
using namespace std;
int binarySearch(int k, int high, int arr[])
{
int low = 0;
while (low <= high)
{
int mid = low + (high - low) / 2;
if (arr[mid] == k)
{
return mid;
}
if (arr[mid] < k)
{
low = mid + 1;
... | ALGO | 0.999727 | 5.909043 |
24711ea7-c546-4f6e-90b1-c5b4aa028992 | nsomani/constraint-controller-library | src/solver/SolverUtils.cpp | #include "SolverUtils.h"
SolverUtils::SolverUtils(rl::mdl::Kinematic* &kin):
kinematic(kin)
{
}
SolverUtils::SolverUtils(rl::mdl::Kinematic* &kin1, rl::mdl::Kinematic* &kin2):
kin1(kin1), kin2(kin2)
{
}
Eigen::VectorXd SolverUtils::getTransformVectorFromQ(Eigen::VectorXd &q, Eigen::Matrix4d &T_current_, int ... | ALGO | 0.999178 | 5.604113 |
4a7378a2-3633-4867-8e8c-1f293e89a8e6 | thebigcorporation/libeigen | bench/product_threshold.cpp |
#include <iostream>
#include <Eigen/Core>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
#define END 9
template <int S>
struct map_size {
enum { ret = S };
};
template <>
struct map_size<10> {
enum { ret = 20 };
};
template <>
struct map_size<11> {
enum { ret = 50 };
};
template <>
... | ALGO | 0.990353 | 5.281579 |
0c835f67-2dae-4e98-9f24-678aac268606 | borgestassio/KMeans_cpp | kmeans.cpp | #include "kmeans.h"
//The constructor initializes some variables
KMeans::KMeans(int n_clusters, int data_size_in)
{
num_clusters = n_clusters;
data_size = data_size_in;
vector<vector<float>> R (data_size, vector<float>(num_clusters));
static vector<vector<int>> indices (num_clusters, vector<int> (data_... | ALGO | 0.998987 | 5.102476 |
85dcd236-0fb3-41bf-9618-31eaefa7669a | cakuang1/codeforces | codeforces/dp/2200part2/substring.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
#ifdef _DEBUG
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
int tt = clock();
string s;
cin >> s;
vector<int> dp(1 << 20);
vector<int> masks;
for (int i = 0; i < int(s.size()); ++i) {
vector<bool> used(20);
in... | ALGO | 0.999947 | 4.123502 |
760db13e-ba31-4e17-ac32-35ab41fac931 | ZouJiu1/PAT | PAT(Basic_Level)Practice/1088.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<bits/stdc++.h>
using namespace std;
template<typename T>
void printres(int my, T a){
if(a>my) cout<<"Cong";
else if(a==my) cout<<"Ping";
else cout<<"Gai";
}
int main(void){
int my, x, y, n, m... | ALGO | 0.999984 | 3.211565 |
728e428e-86d8-47e3-9f2b-aec399fc005c | KRASILNIKOV30/combinatoric-math | lab2/QAP/QAP/PermutationsGenerator.cpp | #include "PermutationsGenerator.h"
PermutationsGenerator::PermutationsGenerator(int elementsAmount)
: m_n(elementsAmount)
{
InitVectors();
}
void PermutationsGenerator::InitVectors()
{
m_curPerm.resize(m_n + 2);
m_reversePerm.resize(m_n + 2);
m_direction.resize(m_n + 2);
for (int i = 1; i <= m_n; i++)
{
m_cu... | ALGO | 0.993743 | 5.21291 |
41a9d459-46fd-488d-a678-a7374e212f5d | KoreaFriedChips/Competitive-Programming | CCC/CCC Senior/CCC '07/Friends.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <iomanip>
#include <queue>
#include <climits>
using namespace std;
#define ll long long
#define pb push_back
#define ull unsigned long long
#define pii pair<int, int>
#define mp make_pair
#define vi vector<int>
#defi... | ALGO | 0.999992 | 3.992049 |
4ad5406b-e78f-4861-bf46-e17e2661ee6e | ishandutta2007/codeforces | krk/normal/7/B.cpp | #include <iostream>
#include <string>
using namespace std;
const int Maxm = 105;
int t, m, n;
int mem[Maxm];
int cur = 1;
void Alloc(int n)
{
for (int i = 0; i + n <= m; i++) {
int j;
for (j = 0; j < n; j++)
if (mem[i + j]) break;
if (j < n) continue;
for (j = 0; j < n;... | ALGO | 0.99824 | 3.343073 |
21d1ab44-89b3-465c-961b-58e50ca17ffa | mozilla/spiderweb | modules/fdlibm/src/e_log.cpp | /* @(#)e_log.c 1.3 95/01/18 */
/* __ieee754_log(x)
* Return the logrithm of x
*
* Method :
* 1. Argument Reduction: find k and f such that
* x = 2^k * (1+f),
* where sqrt(2)/2 < 1+f < sqrt(2) .
*
* 2. Approximation of log(1+f).
* Let s = f/(2+f) ; based on log(1+f) = log(1+s) - l... | ALGO | 0.9999 | 5.725077 |
fc7a5746-5616-48d7-b6e0-6d2e01e47f26 | ShubhamGoswami-1/My_Journey | String_Longest_Substring_with_Distinct_Characters_GFG.cpp | #include<bits/stdc++.h>
using namespace std;
int Solve(string &s){ // Time : O(n)
vector<int>prev(256,-1);
int res=0,start=0;
for(int end=0;end<s.length();end++){
start=max(start,prev[s[end]]+1);
res=max(res,end-start+1);
prev[s[end]]=end;
}
return res;
}
int Solve(string &s)... | ALGO | 0.999737 | 4.497803 |
97596c6c-917d-4538-952a-7c582db2fbb4 | pinzonluisa/20250304_MTEC-OF-S25_w6-GravitationalForce | 20250304_w6_GravitationalForces/src/ofApp.cpp | #include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofBackground(0);
ofSetBackgroundAuto(false);
movers.resize(100);
}
//--------------------------------------------------------------
void ofApp::update(){
ofSetColor(0,10);
ofDrawRectangle(... | TOOL | 0.944094 | 4.899261 |
6da1d00e-3624-469c-b18f-9ecf936f5c55 | StevenMaMei/Competitive-Programming | Contest/Topcoder/DIV1_easy/768_MeanMedian/main.cpp | #include <bits/stdc++.h>
#define ff first
#define ss second
#define fore(i,a,b) for(int i=a,colchin=b;i<colchin;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define sz(s) int(s.size())
using namespace std;
class MeanMedian{
public: int ... | ALGO | 0.999928 | 4.494248 |
84a98eb7-c856-4461-bf93-c68701845f3f | dingningpei/LLM_Semantics | serene-python-client-stp/stp/minizinc/chuffed-rel2onto_20170728/boost_1_87_0/libs/intrusive/example/doc_avltree_algorithms.cpp | struct my_node
{
my_node(int i = 0)
: int_(i)
{}
my_node *parent_, *left_, *right_;
int balance_;
//other members
int int_;
};
//Define our own avltree_node_traits
struct my_avltree_node_traits
{
typedef my_node node;
typedef my_node * ... | ALGO | 0.999432 | 6.389619 |
44e420d7-e8c2-4552-b9d0-89343229b4f5 | Pks-12/LeetCode-75-question | Distribute Candies.cpp | class Solution {
public:
int distributeCandies(vector<int>& candyType) {
int n = candyType.size();// check the size of array
sort(candyType.begin(),candyType.end());// sort the array because it easy to count it makes counting unique items simple.
int m = n/2;// Alice allow to eat half ... | ALGO | 0.999847 | 6.081851 |
87df37d4-181f-4e68-83b6-120f16f9b1c2 | nishkarsh-shastri/Networks_lab_assigments | assignment6/nishkarsh/centralServer.cpp | #include <stdio.h>
#include <iostream>
#include <cerrno>
#include <stdlib.h>
//#include <bits/stdc++.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include "myheader.hxx"
#include <iterator>
... | WEB | 0.972993 | 3.616475 |
9f40fa5c-f401-4a2b-9b66-8b0ce4f7171b | axelu/leetcode | cpp/01000-01499/singlerowkeyboard.cpp |
// 1165. Single-Row Keyboard
// https://leetcode.com/problems/single-row-keyboard/
class Solution {
public:
int calculateTime(string keyboard, string word) {
unordered_map<char,int> um;
for(int i = 0; i < 26; ++i)
um.insert({keyboard[i],i});
int ans = 0;
int currIdx = ... | ALGO | 0.999856 | 6.06233 |
daecd1bd-2c0f-4235-a47f-50fc2169189b | imkhateeb/Problem-Solving | Contests/codeforces/LIVE/Ethflow_Round_1_Div1_2/A.cpp | #include <bits/stdc++.h>
#define let long long
#define MOD 1000000007
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define endl "\n"
#define vi vector<let>
#define vvi vector<vector<let>>
#define vs vector<string>
#define vpii vector... | ALGO | 0.999932 | 4.888556 |
e9718994-5932-4f49-b1a8-b2e60182fcb8 | imvkie/CandCPPSnippets | FiboRecursion.cpp | #include<iostream>
using namespace std;
int fibo(int N);
int main() {
//int N;
//cin>>N;
fibo(4);
}
int fibo(int N) {
int result;
if(N==1 || N==2) {
return 1;
}else {
result = fibo(N-1) + fibo(N-2);
}
cout<<result<<" ";
return result;
}
| ALGO | 0.999983 | 4.017853 |
4d3e4257-00d5-4e52-8c91-5941acbfb709 | winstondcosta/Data-Structures-and-Algorithms | 3.2D_Arrays/4-Straicase_Search.cpp | #include<iostream>
using namespace std;
void staircaseSearch(int a[3][20], int m, int n, int key){
int i=0, j=(n-1);
while(i<m && j>0){
if(a[i][j]==key){
cout<<"Element found at position "<<i<<" and "<<j<<endl;
return;
}
else if(key<a[i][j]){
j--;
}
else{
i++;
}
}
}
int main(){
int a[3][20];
int m, n, key;
cin>>m>>n;
c... | ALGO | 0.999519 | 4.12663 |
eef32f0d-6ea7-49c8-b31b-52814ec7992a | UestcXiye/C-Primer-Plus-exercise | chapter11/11.6.cpp | #include <stdio.h>
#include <stdlib.h>
#define STRLEN 100
int is_within(char *, char);
int main(void)
{
char str[STRLEN];
char ch;
while (true)
{
printf("Enter the string: ");
gets(str);
printf("Enter the character: ");
scanf("%c", &ch);
if (is_within(str, ch))
... | ALGO | 0.994239 | 3.822612 |
834edc61-d740-4a38-8932-fe4b14b775ae | righthand0521/LeetCode | src/2551.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
// https://leetcode.com/problems/put-marbles-in-bags/solutions/3111736/java-c-python-3-approachs-best-o-n/
// https://leetcode.cn/problems/put-marbles-in-bags/solutions/2080577/by-wan-shi-liang-de-mang-... | ALGO | 0.999757 | 5.682724 |
c8513155-568f-4c2d-a34e-341469cb934f | Mohamedboukerche22/WEOI-2025-TRY | mirroraqueducts/1.cpp | // 0 points
#include<bits/stdc++.h>
using namespace std;
const int MAX = 10e9+1;
vector<int> count(int N, vector<int> S, vector<int> P) {
vector<tuple<int,int,int>>C;
for(int i=0;i<P.size();i++)
{
C.push_back({i,S[i],P[i]});
}
sort(C.begin(),C.end(),[](const auto &a,const auto &b){
... | ALGO | 0.999857 | 3.611426 |
e6d3f367-5a46-4285-a2f0-2223a2c36650 | stephengold/Libbulletjme | src/main/native/bullet3/BulletCollision/CollisionDispatch/btUnionFind.cpp | #include "btUnionFind.h"
btUnionFind::~btUnionFind()
{
Free();
}
btUnionFind::btUnionFind()
{
}
void btUnionFind::allocate(int N)
{
m_elements.resize(N);
}
void btUnionFind::Free()
{
m_elements.clear();
}
void btUnionFind::reset(int N)
{
allocate(N);
for (int i = 0; i < N; i++)
{
m_elements[i].m_id = i;
... | ALGO | 0.979688 | 5.122151 |
248e649c-33ba-4a6e-941f-742ee2a97213 | yyurodd/kursach | pr4/pr4.cpp | #include <Windows.h>
#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
#include "course.h"
using namespace std;
string text;
void SpaceDeleter() {
for (int i = 0; i < text.size(); i++) {
if (text[i] == ' ' && text[i + 1] == ' ')
while (text[i + 1] == ' ')
text.erase((i + 1), 1);
}... | ALGO | 0.997083 | 3.444038 |
8f6e4ee2-d0c1-4163-b61a-0fe11ffd5ac4 | Sookmyung-Algos/2021algos | algos_semina/3rd_seminar/D_20208/dlwl1213_20208.cpp | #include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
int n,m,h;
vector<pair<int,int>> vMilk;
pair<int,int> house;
int result=0;
int addMilk(const int & bit, int idx){
return bit | (1<<idx);
}
int countMilk(const int&bit) {
int ret=... | ALGO | 0.999832 | 4.169559 |
d5540400-1baf-48b5-8b2e-cde5cde1d2b1 | Rafid-Ahmed313/OpenGLandCPP | cses/equalSumSubset1.cpp | #include <iostream>
#include <numeric>
#include <cmath>
#include <vector>
using namespace std;
bool isInteger(double x) {
return floor(x) == x;
}
int main(){
int n ;
cin>>n;
int arg[n];
vector<int> s1;
vector<int> s2;
for(int i =1;i<=n;i++){
arg[i-1] =i;
}
cout<<"The f... | ALGO | 0.999981 | 3.626944 |
d775aed6-71c4-4cf2-84c8-355c33313cc2 | snichols/boost_1_61_0 | libs/spirit/example/qi/key_value_sequence_ordered.cpp | // The purpose of this example is to show how to parse arbitrary key/value
// pairs delimited by some separator into a std::vector. The difference to
// the example 'key_value_sequence.cpp' is that we preserve the order of the
// elements in the parsed seqeunce as well as possibly existing duplicates.
//
// For a mor... | TEST | 0.93481 | 5.962598 |
b1f2dfcd-1084-4660-ba1a-84e742d861b2 | Pocobeer/Course-2 | Выч Мат/9лаба/ConsoleApplication1/ConsoleApplication1.cpp | #include <iostream>
using namespace std;
double func(double x) {
return x*x;
//return cos(3 * x) / (x * x + 1);
}
int main()
{
int n = 10;//n = 10
double a = 0, b = 1,eps = 1e-4;// a=1, b=2
double h = (b - a) / n;
//f(x) = x^2;
double sum = 0;
double sum1 = 0;
double Str=0, Spr=0, Si... | ALGO | 0.999888 | 3.645982 |
0071d482-1a28-49ee-92b2-e1bc89196a1d | sunkoshi/cns1 | src4/s.cpp | #include "myutils.h"
#include "crypto.h"
using namespace std;
int main()
{
int nsfd;
int sfd = CreateServer(8080);
if ((nsfd = accept(sfd, NULL, NULL)) < 0)
{
perror("accept");
exit(EXIT_FAILURE);
}
cout << "Client connected... " << endl;
int q;
cout << "Enter q:";
... | WEB | 0.98347 | 3.981042 |
f0a28adb-8c7d-4842-ac17-972de7e1006d | vayer2005/acm | edround178/C.cpp | #include <bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef long long ll;
void solve() {
int n; string s;
cin >> n >> s;
int bLeft[n];
if (s[n-1] == 'B') {
bLeft[n-1] = 1;
} else {
bLeft[n-1] = 0;
}
for (int i = n-2; i >= 0; i--) {
bLeft[i] = bLeft... | ALGO | 0.999952 | 4.894605 |
d9cb3a1f-ccd7-44b9-a185-4dca729755cb | RahulAwasthi314/problem-solving | leetcode/recursion/powerOfFour.cpp | /**
* @file powerOfFour.cpp
* @author Rahul Awasthi (<EMAIL>)
*
* @brief
* try out the problem here:
* https://leetcode.com/problems/power-of-four/
*
*/
class Solution {
// time: O(1) space: O(1)
bool isPowerOfTwo(int n) {
if (n < 1) return false;
return !(n & (n-1));
}
// ti... | ALGO | 0.99939 | 6.237517 |
26126b08-1e54-4d7a-a7a3-84efe89daed0 | buhman/dreamcast | gauss.cpp | #include <stdint.h>
#include "math/vec3.hpp"
using vec3 = vec<3, float>;
constexpr int dim = 5;
constexpr int dim2 = dim / 2;
constexpr int width = 128;
constexpr int height = 96;
constexpr float mat[dim][dim] = {
{0.014218, 0.027920, 0.034963, 0.027920, 0.014218},
{0.027920, 0.054827, 0.068657, 0.054827, 0.027... | ALGO | 0.965524 | 6.328069 |
9ca6717b-da3d-4b06-81c0-9dede27728ab | hoangkhoi2k4/C-PLUS-PLUS-PTIT | DanhSachDoiTuongSinhVien-3.cpp | #include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstring>
using namespace std;
int maCount = 1;
struct SinhVien {
string maSV, name, lop, date;
char name_x[100];
float GPA;
friend istream& operator>>(istream& is, SinhVien& a) {
if (maCount == 1) is.ignore();
... | ALGO | 0.945687 | 3.942522 |
1016ac55-0932-4b99-bcda-0e9c31e87942 | orlandoisay/Competitive-Programming | COJ/2231.cpp | #include <bits/stdc++.h>
using namespace std;
int N,balance,x,y;
string a,b;
// Rock - 0
// Paper - 1
// Scissors - 2
int id(string s) {
if(s[0] == 'r')
return 0;
if(s[0] == 'p')
return 1;
return 2;
}
int battle(int a,int b) {
if(a == b)
return 0;
if(a - 1 == b || a + 2 ... | ALGO | 0.999973 | 5.014403 |
c857e712-5ff4-4d45-aba3-b719175bf1bd | andyli029/mysql-server-mysql-8.0.30 | extra/icu/icu-release-69-1/source/i18n/collationweights.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "cmemory.h"
#include "collation.h"
#include "collationweights.h"
#include "uarrsort.h"
#include "uassert.h"
#ifdef UCOL_DEBUG
# include <stdio.h>
#endif
U_NAMESPACE_BEGIN
/* collation element weight allocation -------------------------------------- *... | TOOL | 0.991131 | 3.529455 |
4b9e1da1-d52f-4919-b337-7b2502a6f072 | sarvex/leetcode-j | solution/2200-2299/2265.Count Nodes Equal to Average of Subtree/Solution.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999807 | 7.080738 |
3750fb7b-8bdd-47b8-8cc7-32082df35f70 | Fusica/Leetcode | Alex/DIDI_0928/DIDI_0928_02.cpp | //
// Created by Max on 9/28/23.
//
#include <iostream>
using namespace std;
int main() {
int n, a, b, c;
cin >> n >> a >> b >> c;
int count = 0;
for (int i = 1; i <= n; i++) {
if (a >= i && b >= i && c >= i) {
count++;
}
}
cout << count << endl;
return 0;
}... | ALGO | 0.999628 | 4.437214 |
f8799e3f-7956-4a35-ad40-400d2de303b8 | morris821028/UVa | volume014/1441 - Accountant notes[Aho–Corasick-opt].cpp | #include <bits/stdc++.h>
using namespace std;
const int NUMPOS = 20000000;
const int INFPOS = 10000000;
const int MAXS = 1000000;
const int MAXN = 50005;
struct Stmt {
int v[3]; // a = b+c, or a = b
bool operator<(const Stmt &x) const {
if (v[0] != x.v[0]) return v[0] < x.v[0];
if (v[1] != x.v[1]) return v[1] ... | ALGO | 0.99963 | 3.802787 |
0bb555bc-7945-411a-8e2b-6b4a53b458cf | kokilaphd/IoTSimulation | crypto/Botan-2.0.1/src/lib/math/numbertheory/numthry.cpp | #include <botan/numthry.h>
#include <botan/reducer.h>
#include <botan/internal/bit_ops.h>
#include <botan/internal/mp_core.h>
#include <botan/internal/ct_utils.h>
#include <algorithm>
namespace Botan {
/*
* Return the number of 0 bits at the end of n
*/
size_t low_zero_bits(const BigInt& n)
{
size_t low_zero = ... | ALGO | 0.999548 | 6.850709 |
ede60f2c-fc90-4b9c-80f3-20f5e908c689 | ishandutta2007/codeforces | weakesttopology/normal/1282/C.cpp | #include "bits/stdc++.h"
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define mp(x, y) make_pair(x, y)
#define ALL(X) X.begin(), X.end()
#define READ(X) for (int i =... | ALGO | 0.999934 | 3.602421 |
170cb229-0d14-4c20-b572-ad6bb95fac1f | anujsoni1228/LeetCode-Questions | 1662-check-if-two-string-arrays-are-equivalent/1662-check-if-two-string-arrays-are-equivalent.cpp | class Solution {
public:
bool arrayStringsAreEqual(vector<string>& a, vector<string>& b) {
string x,y;
for(auto i:a)x+=i;
for(auto i:b)y+=i;
return x==y;
}
}; | ALGO | 0.99487 | 6.045989 |
7bb1a126-7fd3-4a54-ac0e-fe0e98add5af | santawar13/programs | program2.cpp | #include <bits/stdc++.h>
using namespace std;
bool isProperly(string);
//task 4
int main() {
string N;
cin>>N;
isProperly(N);
return 0;
}
bool isProperly(string sequence){
int m=0;
for(int k=0;k<sequence.size();k++){
if(sequence[k]=='(')
m++;
if(sequence[k]==')')
m--;
... | ALGO | 0.999914 | 4.794245 |
c0b9631a-33ee-415d-adf9-cdb7754f72c3 | bsinghvt/CPlusPlus | AVLandBinarytrees/AVL.cpp | /*
* AVL.cpp
*
* Created on: Nov 14, 2015
* Author: Baljot Singh
*/
#include <iostream>
#include<string>
#include<assert.h>
#include"AVL.h"
template <class T>
AVL<T>::AVL():trees<T>::trees()
{
}
template <class T>
int AVL<T>::getHeight(node* nod)
{
if (nod == NULL)
{
return -1;
}
return nod->height;
}
t... | ALGO | 0.994019 | 4.249398 |
998eb66b-0e86-460f-8144-15fc7a24e994 | thahemp/osg-android | 3rdparty/gdal/ogr/ogrsf_frmts/s57/ddfrecordindex.cpp | #include "s57.h"
#include "cpl_conv.h"
CPL_CVSID("$Id: ddfrecordindex.cpp 10645 2007-01-18 02:22:39Z warmerdam $");
/************************************************************************/
/* DDFRecordIndex() */
/***************************************************... | TOOL | 0.991664 | 6.503666 |
85312a9a-bc01-4487-b62e-bf91d37b6c9f | TD2106/Competitive-Programming | Hacker Earth/New World.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
int tc,n,k,temp,hi,lo,mid;
vector<int> arr;
int check (int dis){
int index=0;
vector<int>::iterator itr;
int ti=k;
while(ti--){
itr=upper_bound(arr.begin(),arr.end(),arr[index]+dis);
itr--;
if(itr==arr.end()-1&&... | ALGO | 0.999905 | 3.769468 |
c98324de-4902-414f-8da0-f4c5eedaf5c6 | VuTanPhat/Buoi2 | CTDL>_Selection_Sort_2.cpp | ERROR: type should be string, got "https://www.geeksforgeeks.org/selection-sort/?ref=lbp\n#include <stdio.h>\n \nvoid swap(int *xp, int *yp)\n{\n int temp = *xp;\n *xp = *yp;\n *yp = temp;\n}\n \nvoid selectionSort(int arr[], int n)\n{\n int i, j, min_idx;\n \n // One by one move boundary of unsorted subarray\n for (i = 0; i < n-1; i++)\n {\n // Find the minimum element in unsorted array\n min_idx = i;\n for (j = i+1; j < n; j++)\n if (arr[j] < arr[min_idx])\n min_idx = j;\n \n // Swap the found minimum element with the first element\n if(min_idx != i)\n swap(&arr[min_idx], &arr[i]);\n }\n}\n \n/* Function to print an array */\nvoid printArray(int arr[], int size)\n{\n int i;\n for (i=0; i < size; i++)\n printf(\"%d \", arr[i]);\n printf(\"\\n\");\n}\n \n// Driver program to test above functions\nint main()\n{\n int arr[] = {64, 25, 12, 22, 11};\n int n = sizeof(arr)/sizeof(arr[0]);\n selectionSort(arr, n);\n printf(\"Sorted array: \\n\");\n printArray(arr, n);\n return 0;\n}\n" | ALGO | 0.999971 | 5.49838 |
18c39021-1da8-4f40-9bbf-68eee6b9bd2a | matsumoto2004/competitive_programming | archive/archive_practice/ARC070D.cpp | #include<bits/stdc++.h>
#include<cassert>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<ext/pb_ds/tag_and_trait.hpp>
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(i, n) for (ll i = 0; i < ll(n); ++i)
#define rep2(i, s, n) for (ll i = ll(s); i < ll(n); ++i)
#... | ALGO | 0.999988 | 3.853073 |
bebfe2ff-2759-46ac-b160-1d7a491feea2 | alanjg/ClothSimulator | ClothMesh.cpp | #include "ClothMesh.h"
#include <iostream>
#include <algorithm>
#include <functional>
#include "Particle.h"
#include "Constraints.h"
#include "Mesh.h"
#include "ConvexMesh.h"
#include <gl/glut.h>
#include <exception>
namespace
{
using ajg::physics::Vector3;
void AddTriangle(std::vector<unsigned int>& v,int a,int b,... | ALGO | 0.993317 | 3.773833 |
b28609d4-2e06-4aa4-9a51-0da447d6850f | Den1er/LeetCode_first_time | LeetCode164.cpp | 606. Construct String from Binary tree
//本题不能构建一个辅助函数,否则会超时,思路是左孩子若为空,那么要考虑右孩子是否存在,不存在就直接返回,存在则需要加括号
/**
* 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... | ALGO | 0.998978 | 6.678979 |
df63b361-d314-4bf2-ab82-e1d10fd047ec | partylikeits1983/ballistic_calculator | src/drag/cpp/util.cpp | #include <cmath>
#include <limits>
#include <cctype>
#include "util.h"
const double PI = std::acos(-1.0);
const double INF_VAL = std::numeric_limits<double>::max();
string format(string q, int SZ)
{
int z = q.size();
if ( z < SZ ) q += string(SZ - z, ' ');
return q;
}
string format(double x, int SZ)
{
... | TOOL | 0.931532 | 3.64727 |
9788e19c-fe5f-4e04-b1ee-7c662663825d | monkcoders/striver_a2z | c++ basics/gradeelseif.cpp | #include<bits/stdc++.h>
using namespace std;
/*
A school has following rules for grading system:
a. Below 25 - F
b. 25 to 44 - E
C. 45 to 49 - D
d. 50 to 59 - C
e. 60 to 79 - 8
f. 80 to 100 - A
Ask user to enter marks and print the corresponding grade.
*/
int main(){
int marks;
cin>>marks;
if(marks<25){
... | ALGO | 0.999822 | 3.848359 |
580a2148-0fe1-41d1-bdcc-456c92599775 | devanshrautela/OOP | Practical-17/task17d.cpp | #include <bits/stdc++.h>
using namespace std;
void printvector(vector<int> v)
{
vector<int>::iterator it;
for (it = v.begin(); it != v.end(); ++it)
cout << *it << " ";
cout << '\n';
}
void printArray(int a[], int n)
{
for (int i = 0; i < n; i++)
cout << a[i] << " ";
cout << '\n';
}
... | ALGO | 0.99969 | 4.072748 |
08e36dcc-2490-4c7c-8997-a39050d369b1 | chunhouliu/algorithms | codeforces/1335a.cpp | #include <cstdio>
using namespace std;
int main() {
int t,n;
scanf("%d", &t);
while(t>0) {
--t;
scanf("%d", &n);
printf("%d\n", n/2-(1-(n&1)));
}
} | ALGO | 0.999627 | 4.113136 |
a36015bf-4274-4bfa-b16c-098e1984ef7c | Soma53/atcoder | CPLUS/abc300/308/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> s(9);
for(int i=0; i<8; i++) cin >> s[i+1];
bool flag = true;
for(int i=0; i<8; i++){
if(s[i] > s[i+1] || (s[i+1]<100 || s[i+1]>675) || s[i+1]%25!=0){
flag = false;
break;
}
}
cou... | ALGO | 0.999208 | 3.524733 |
b8d3c597-0cce-4e39-86ed-dbd7cbd3e2a5 | WadeHT/AI_class | HW4/HC.cpp | #include<stdio.h>
#include<iostream>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#define NSIZE 8
#define RunTimes 30
/********data*********/
typedef struct
{
int Hor,SlopePlus,SlopeMinus;
} Board;
/********data*********/
/********function********/
void Initialize(int state[]);
int HC(int state[]);
int Ge... | ALGO | 0.999851 | 3.482028 |
acb830d3-14aa-407f-8a6f-a44e2fe0798a | Ankitlenka26/IP2021 | Recursion and Backtracking/WordMatching.cpp | #include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
void solution(string str, string pattern, unordered_map<char, string> &m, string op)
{
// base case
if (pattern.size() == 0)
{
if (str.size() == 0)
... | ALGO | 0.999853 | 4.500612 |
942c04a0-db0d-43cb-aa0d-f2c4f8a36cd9 | ishandutta2007/codeforces | ashishgup/normal/801/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#defi... | ALGO | 0.999919 | 4.198946 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.