uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
4db02ec1-dd90-4007-ac03-d24f1ed4f750 | raincross7/code-similarity | codes/train_code/problem236/problem236_12.cpp | #include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a),... | ALGO | 0.999969 | 3.830947 |
33c200c6-c949-4b4a-b583-7aab23e181a1 | marcoag-ros2gbp/mrpt_path_planning-release | mrpt_path_planning/src/algos/bestTrajectory.cpp | #include <mpp/algos/bestTrajectory.h>
#include <mpp/ptgs/SpeedTrimmablePTG.h>
#include <mrpt/core/get_env.h>
using namespace mpp;
bool mpp::bestTrajectory(
MoveEdgeSE2_TPS& npa, const TrajectoriesAndRobotShape& trs,
std::optional<mrpt::system::COutputLogger*> logger)
{
MRPT_START
const double HEADING... | ALGO | 0.999583 | 6.581324 |
115f5c8d-f8dd-4df4-8606-0a807c951a8f | SametAhmetSahin/dokuwiki-kou-prolab-1-1 | main.cpp | #include <string>
#include <iostream>
#include <filesystem>
#include <vector>
#include <fstream>
#include <cstring>
#include <map>
namespace fs = std::filesystem;
using namespace std;
vector<string> files;
vector<string> directories;
vector<string> tags;
int isRunning = 1;
string menuPage_MainMenu = "DokuWiki Kocae... | TOOL | 0.898593 | 3.555584 |
c98a9913-28ad-4c4a-8c7f-63dfbd897ab9 | flexsloth/LeetCode_solutions | 2490-circular-sentence/2490-circular-sentence.cpp | class Solution {
public:
bool isCircularSentence(string s) {
//stringstream ss(s);
vector<string>ans;
char ch;
if(s[0] != s[s.size() -1]) return false;
for(int i = 0 ; i < s.size()-1 ; i++){
if(s[i] == ' '){
if(s[i-1] == s[i+1]) continue;
... | ALGO | 0.999835 | 5.585487 |
21b19ebd-0516-4b2a-a46f-09eac1bd1ea3 | JiteshGupta17/LeetCode-Solutions | Medium/1222. Queens That Can Attack the King.cpp | class Solution {
public:
vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) {
bool board[8][8] = {};
for (auto vec : queens)
{
board[vec[0]][vec[1]] = 1;
}
vector<vector<int>> ans;
for (int i = -1; i <= 1; i++)
... | ALGO | 0.999947 | 5.177806 |
07ceac60-2bfa-49ba-8ed5-e4220fdcb9cc | wyd520520/3588_nanotrack | nanotrack.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include "nanotrack.hpp"
#include <malloc.h>
#include <cmath>
//eigen
#include <Eigen/Dense>
#include <Eigen/Core>
void transpose_nchw_to_nhwc(float* input, float* output, int n, int c, int h, int w) {
// 将输入数组转换为 Eigen 矩阵
Eigen::Map<Eigen::Matrix<float,... | DATA | 0.923762 | 4.315242 |
d4cd5756-5a65-4bf4-b6a4-81c286d29835 | ishandutta2007/codeforces | waterfalls/normal/819/B.cpp | #include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;
int ft[1000013];
void update(int x, int v) { x+=1; while (x<1000013) ft[x]+=v, x+=x&-x; }
int query(int x) { x+=1; return x>0 ? ft[x]+query((x-(x&-x)-1)) : 0; }
int n;
int p[1000013];
int main() {
scanf("%d", &n);
ll cur = 0;
for ... | ALGO | 0.999991 | 3.754466 |
1c9c947c-df20-42b8-b5aa-3d665f8dd3ef | FaisalMahi/CPP_Codeforces_Solutions | A_Two_Friends.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> ar(n + 1); // Array for storing the values; note the size n + 1 to use 1-based indexing
// Read the input array
for (int i = 1; i <= n; i++) {
cin >> ar[i];
}
// Initialize the f... | ALGO | 0.999953 | 4.386811 |
71b8d169-cc64-4df8-915a-22fecbcf8cb3 | Simon-Ghiwot/Dp | Iva_and_pav.cpp | // https://codeforces.com/contest/1878/problem/E
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const char ln = '\n';
ll n, m, k, q, d;
string s, t;
void run_test_case(){
cin >> n;
vector<int> v(n);
vector<vector<int>> zeros(31);
for(int i = 0; i < n; i++) cin >> v[i];
for(int bit = 3... | ALGO | 0.999951 | 4.284667 |
37092ea6-67b2-41b6-b55a-d0fdc4f350c1 | ishandutta2007/codeforces | cherrym/normal/1456/C.cpp | #include <bits/stdc++.h>
template <class T>
inline void read(T &res)
{
res = 0; bool bo = 0; char c;
while (((c = getchar()) < '0' || c > '9') && c != '-');
if (c == '-') bo = 1; else res = c - 48;
while ((c = getchar()) >= '0' && c <= '9')
res = (res << 3) + (res << 1) + (c - 48);
if (bo) res = ~res + 1;
}
ty... | ALGO | 0.999978 | 3.672938 |
1ab89655-82fd-421b-8cbe-7fa3cd719fb3 | LIUHUANUCAS/next_journey | leetcode/binary_search_tree/98-validate-binary-search-tree.cpp | #include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "../header/data_type.h"
using namespace std;
/**
* Definition for a binary tree node.
* struct Tr... | ALGO | 0.999947 | 6.742543 |
6c6ad7f7-f35b-4156-b47b-10d094747718 | hellojarvish61/backchodiiiiiiiii | C++/recursion/arr5.cpp | // print digit
#include<iostream>
using namespace std;
void printDigit(int n){
// base case
if(n==0){
return;
}
// baaki recursion sabhal lega
int newValueofN = n/10;
printDigit(newValueofN);
// 1 case mai solve karunga
int digit = n%10;
cout<< digit << " ";
}
int main... | ALGO | 0.999894 | 5.097456 |
d8bb32c0-8e6e-4274-a757-49028509cafc | Zimse12345/Code | pyyz_Contest/20230325省选模拟赛/set.cpp | /********************
*FileName:
*Author: Zimse
*Data: 2023-03-
*Description:
********************/
#include <bits/stdc++.h>
#define gc getchar
#define pc putchar
#define pb push_back
#define inv fpow
#define int long long
#define M ((L+R)/2)
#define Lid ch[id][0]
#define Rid ch[id][1]
namespace Zimse{
const int INF=... | ALGO | 0.99983 | 4.367027 |
b02a30a7-51f4-41e4-868e-d9d76f8e79c6 | nehcoah/algorithm-template | atcoder/abc/375/c.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
using u32 = unsigned;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<string> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
auto ans = ... | ALGO | 0.999999 | 4.382626 |
f2b6cf4d-a99a-4e4a-aae0-6ecd827bbfa4 | partho-das/CompetitiveProgrmming | CP_CODE/Codeforces/Codeforces Round #693 (Div. 3)/e.cpp | #include <bits/stdc++.h>
using namespace std;
//____________________________________________________________________________________________________________________________________
#define PI 2*acos(0.0)
#define pf printf
#define sc scanf
#define ff first
#define ss second
#define pb push_back
typedef long long... | ALGO | 0.999988 | 4.057256 |
a2691930-ea40-41ef-9999-1355339cace5 | sssemil/INF_EX1 | INF_EX1/c++/5/n5.03.cpp | #include <iostream>
int main() {
std::cout << "Enter array length (x and y): ";
int length;
std::cin >> length;
int arr[length][length];
for (int i = 0; i < length; i++) {
for (int j = 0; j < length; j++) {
arr[i][j] = rand() % 10;
}
}
for (int j = 0; j < leng... | ALGO | 0.989107 | 3.622092 |
6dbeca66-b759-4733-b0f1-7292d8663dd9 | mcolula/CaribbeanOnlineJudge-Solutions | frankzappa-p1839-Accepted-s588353.cpp | #include <iostream>
using namespace std;
int calcularNaranjas(int naranjas)
{
cout << 8 * naranjas + 42 << endl;
return 0;
}
int main()
{
int a, b;
cin >> a;
for(int i = 0; i < a; i++)
{
cin >> b;
calcularNaranjas(b);
}
return 0;
}
| ALGO | 0.998843 | 4.546452 |
7861e733-2a00-4f58-a4e3-bf70c67b6d81 | Langstielig/NumberTrieTree | 2YaMP2/main.cpp | #include "TrieTree.h"
int main() {
setlocale(LC_ALL, "rus");
int countOfTests = 0;
TrieTree phoneBook;
cout << " " << endl;
cin >> countOfTests;
for (int i = 0; i < countOfTests; i++) {
int countOfTelephoneNumbers = 0;
cout << " " << endl;
cin >> countOfTelephoneNumbers;
bool isJoint = true;
int j =... | ALGO | 0.992132 | 4.71714 |
aa6eb1f9-f7ec-4c7a-85db-1b9d500604b5 | sarvex/leetcode-idris | solution/0100-0199/0120.Triangle/Solution.cpp | class Solution {
public:
int minimumTotal(vector<vector<int>>& triangle) {
int n = triangle.size();
vector<int> dp(n + 1);
for (int i = n - 1; i >= 0; --i)
for (int j = 0; j <= i; ++j)
dp[j] = min(dp[j], dp[j + 1]) + triangle[i][j];
return dp[0];
}
}; | ALGO | 0.999989 | 6.18191 |
475cf4fc-ddd3-4af6-a7b1-27cdcf74a06b | shubhamm-06/DSA-learning | STL-library/algoritham.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
v.push_back(4);
v.push_back(5);
v.push_back(6);
v.push_back(7);
v.push_back(8);
v.push_back(9);
cout << "Vector after i... | ALGO | 0.997683 | 3.687253 |
c89a3ff7-119c-4f81-890d-522a38ad8b99 | raincross7/code-similarity | codes/train_code/problem272/problem272_182.cpp | /**Bismillahir Rahmanir Rahim.**/
#include<bits/stdc++.h>
#define ln '\n'
#define sf scanf
#define pf printf
#define D(x) cout<< #x " = "<<x<<endl
#define cout(case) cout << "Case " << ++cs << ": " ;
#define foreach(i,c) for(__typeof(c.begin())i=c.begin();i!=c.end();i++)
#define f0(i,b) for(int i=0;i<(b);i++)
#defi... | ALGO | 0.999941 | 4.085043 |
f89df3c4-bed4-4fa6-ae83-226d5e7baf80 | jsyeh/2023aaib2 | week17/week17-ba.cpp | #include <stdio.h>
#include <string.h>
int main()
{
char s[20];
scanf("%s", s);
///int N = strlen(s);
//for(int i=0; i<N; i++){
for(int i=0; s[i]!=0; i++){ // 0 is '\0'
char c = s[i];
if(c>='A'&&c<='Z') c = c - 'A' + 'a';
else if(c>='a'&&c<='z') c = c - 'a' + 'A';
printf("%c", c);
}
printf("\n");
} | ALGO | 0.999119 | 4.117307 |
d4eca58c-49d8-44c0-ab88-5fa941faecc3 | mr-jestin-roy/LeetCode-TaskList | Z_CPH Dump/A_Balanced_Substring.cpp | #include "bits/stdc++.h"
using namespace std;
#define int long long
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(), (x).end()
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define sz(x) (int)((x).size())
#define fr first
#define sc second
#define ... | ALGO | 0.999892 | 4.128614 |
509b3a8c-c82f-4cf6-8199-5f56c617988d | thegamer1907/Code_Analysis | Implementation/373.cpp | #include <iostream>
#define MAX_ARRAY 50
using namespace std;
int main() {
int i;
int n, k, count = 0;
int array[MAX_ARRAY] = {0};
cin >> n >> k;
for (i = 0; i < n; i++)
cin >> array[i];
for (i = 0; i < n; i++)
{
if (array[i]>0 && array[i]>=array[k-1])
... | ALGO | 0.999969 | 3.706203 |
e878bbf5-9f41-424e-87d3-58fb977b2c5b | Gedanke/CppNotes | practicalExercises/day5/codes/zjjljjjl.cpp | #include <iostream>
using namespace std;
// 当同时存在直接基类和间接基类时,每个派生类只负责其直接基类的构造
class A
{
private:
int x;
public:
A(int a)
{
this->x = a;
cout << "A" << endl;
}
~A()
{
cout << "~A" << endl;
}
};
class B : public A
{
public:
B(int x) : A(x)
{
cout << ... | TOOL | 0.879338 | 5.506889 |
eae5d86a-7de5-47eb-98ea-4e12e39bfc32 | Wool5443/Matrix-functions | src/MatrixFunctions.cpp | #include <stdio.h>
#include "utils.hpp"
#include "MatrixFunctions.hpp"
double* GetElementPtr(const Matrix* matrix, size_t i, size_t j);
void PrintMatrix(const Matrix* matrix, FILE* file)
{
MyAssertHard(matrix, ERROR_NULLPTR, );
fprintf(file, "%14lu ", 0lu);
for (size_t j = 1; j < matrix->cols; j++)
... | ALGO | 0.920608 | 4.210422 |
8fe1d096-f26e-4ff8-b731-12c7caf267eb | FennelDumplings/leetcode-maxed_out | interview/剑指offer2/interview41_hard_数据流中的中位数.cpp | // interview41: 数据流中的中位数
/*
* https://leetcode-cn.com/problems/shu-ju-liu-zhong-de-zhong-wei-shu-lcof/
*/
#include <queue>
using namespace std;
class MedianFinder {
public:
/** initialize your data structure here. */
MedianFinder() {
pq_left = priority_queue<int>();
pq_right = priority_que... | ALGO | 0.999971 | 6.454926 |
efd19ebd-bf3d-461e-af2a-11c6e68645af | myashok/LeetCode | predict-the-winner/solution.cpp | class Solution {
public:
int solve(vector<int> &nums, int i, int j, vector<vector<int> > &dp) {
if(i == j) {
return nums[i];
}
if(i + 1 == j) {
return max(nums[i], nums[i+1]);
}
int &res = dp[i][j];
if (res != -1) return res;
return re... | ALGO | 0.999998 | 5.724691 |
04efe0e3-d181-4eee-b836-b2b706968462 | Shubhee01/dsa_in_cpp | 1418-fair-distribution-of-cookies/1418-fair-distribution-of-cookies.cpp | class Solution {
public:
int ans=1e9;
void f(int i, vector<int>& nums, vector<int>& m, int k){
if(i==nums.size()){
ans=min(ans,*max_element(m.begin(),m.end()));
return;
}
for(int j=0;j<k;j++){
m[j]+=nums[i];
f(i+1,nums,m,k);
m[j... | ALGO | 0.999945 | 5.136199 |
e7342f58-8a17-417d-beb5-8dc4fddcfb41 | Old-MvM-Events/Rafmod | mvm-reversed/server/tf/bot/behavior/spy/tf_bot_spy_hide.cpp | /* reverse engineering by sigsegv
* based on TF2 version 20151007a
* server/tf/bot/behavior/spy/tf_bot_spy_hide.cpp
* used in MvM: TODO
*/
CTFBotSpyHide::CTFBotSpyHide(CTFPlayer *victim)
{
this->m_hVictim = victim;
}
CTFBotSpyHide::~CTFBotSpyHide()
{
}
const char *CTFBotSpyHide::GetName() const
{
return "SpyHi... | ALGO | 0.929587 | 5.422991 |
ec395b23-6e09-4f1f-9f75-6d8b4b3ff2b1 | jychstar/NanoDegreeProject | CarND2/p5_mpc/src/Eigen-3.3/doc/examples/QuickStart_example2_fixed.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
Matrix3d m = Matrix3d::Random();
m = (m + Matrix3d::Constant(1.2)) * 50;
cout << "m =" << endl << m << endl;
Vector3d v(1,2,3);
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.973305 | 3.375595 |
7ca73dc1-64a4-43ee-bde4-f4d2c007e1e8 | MsDrashtiSharma/leetcode | Strongly Connected Components (Kosaraju's Algo) - GFG/strongly-connected-components-kosarajus-algo.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{ private:
void dfs(int node,vector<int>&vis,vector<int>adj[],stack<int>&st)
{
vis[node]=1;
for(auto it:adj[node])
{
if(!vis[it])
{
... | ALGO | 0.999398 | 6.134015 |
b9ae23dd-5d5b-4072-979c-97b1d49de575 | saumyaranjan1111/Strivers-SDE-Sheet-Challenge | 643-maximum-average-subarray-i/maximum-average-subarray-i.cpp | class Solution {
public:
double findMaxAverage(vector<int>& nums, int k) {
int n = nums.size();
int maxsum = INT_MIN;
int curr = 0;
for(int i = 0; i<k; i++){
curr+=nums[i];
}
maxsum = max(maxsum , curr);
int l = 0, r = k;
for(; r<n; r++, l+... | ALGO | 0.999928 | 6.363617 |
833589a6-2b69-46cc-8f48-770179c2b6ca | we-are-kicking-lhx/xinxinalgorithm | T121. Best Time to Buy and Sell Stock.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int n = prices.size();
if(!n)return 0;
vector<int>dp = vector<int>(n);
dp[0] = prices[0];
int res = 0;
for (int i = 1; i < n; i++) {
dp[i] = min(dp[i - 1],prices[i]);
res = max(res,p... | ALGO | 0.999901 | 6.28842 |
3d088968-d2d7-4653-97e1-35e4864fc390 | Domain-Cmap/assignments-day-1-to-day-9-Nidhi-Malik06 | Day 2/Hard/1.cpp | #include <bits/stdc++.h>
using namespace std;
int maxHappyGroups(int batchSize, vector<int>& groups) {
vector<int> count(batchSize, 0);
for (int group : groups) {
count[group % batchSize]++;
}
int result = count[0];
for (int i = 1, j = batchSize - 1; i <= j; ++i) {
if (i == j) {
... | ALGO | 0.999964 | 6.366728 |
fba50168-d593-4b14-94e2-f7336dd06a61 | plumonito/dtslam | 3rdparty/opencv-git/modules/features2d/src/fast_score.cpp | /*
The references are:
* Machine learning for high-speed corner detection,
E. Rosten and T. Drummond, ECCV 2006
* Faster and better: A machine learning approach to corner detection
E. Rosten, R. Porter and T. Drummond, PAMI, 2009
*/
#include "fast_score.hpp"
#define VERIFY_CORNERS 0
namespace cv {
void make... | ALGO | 0.999432 | 6.023438 |
99fd65e9-94ca-4c14-ad47-5617e4928f22 | hmakino8/Cpp_Practice | operatorOverload4.cpp | #include <iostream>
class Point {
public:
int x;
int y;
Point(int a, int b);
bool operator>(Point obj);
};
Point::Point(int a, int b) {
x = a;
y = b;
}
bool Point::operator>(Point obj) {
return obj.x < x && obj.y < y;
}
int main() {
Point p(10, 10);
Point p2(100, 30);
if (p2 > p) {
st... | ALGO | 0.935131 | 4.075837 |
3148f852-b4b8-4548-a8b5-df1f9b5ee1a8 | mikymaione/MAMEStreamingPlatform | 3rdparty/bgfx/3rdparty/meshoptimizer/src/spatialorder.cpp | #include <assert.h>
#include <float.h>
#include <string.h>
// This work is based on:
// Fabian Giesen. Decoding Morton codes. 2009
namespace meshopt
{
// "Insert" two 0 bits after each of the 10 low bits of x
inline unsigned int part1By2(unsigned int x)
{
x &= 0x000003ff; // x = ---- ---- ---- ---- ... | ALGO | 0.999933 | 6.282986 |
9dc7740a-b785-4134-8208-52f4948336b5 | Coalery/algorithm-study-s2 | week2/devMS/Problems/LT141.cpp | //https://leetcode.com/problems/linked-list-cycle
//O(n)
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
//Floyd's cycle-finding algorithm
bool hasCycle(ListNode* head) {
... | ALGO | 0.999832 | 5.368888 |
50d84a28-0583-4910-a522-e5c8513f6b90 | Satendra124/dsa_solutions | E_Color_the_Fence.cpp | #include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
typedef long long int ll;
bool sortfn(vector<int> a, vector<int> b)
{
if (a[0] < b[0])
return true;
else if (a[0] ... | ALGO | 0.999397 | 4.933119 |
8008a476-ecdf-4dd8-ae4d-1aa46d9afbb7 | MnSakibOvi/competitive-programming | light OJ/How Cow.cpp |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
for(int k=1; k<=t; k++)
{
int x1,y1,x2,y2,n;
cin>>x1>>y1>>x2>>y2>>n;
cout<<"Case "<<k<<":"<<endl;
while(n--)
{
int a,b;
cin>>a>>b;
if(a>=x1 && a<=x2 && b>=y1 &&b<=y... | ALGO | 0.999695 | 3.47267 |
6e9f6d73-1552-43c9-b6df-d109fd0f9c61 | Kr-Shanu/codeChef | Staters 47/first.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
// vector<int> store;
int t;
cin>>t;
while(t-->0){
int n;
}
return 0;
} | ALGO | 0.997211 | 4.371608 |
a2794e8f-0bc9-463e-a5b0-1fdcc88984b9 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_798_2.cpp | #include <bits/stdc++.h>
using namespace std;
int k, n, d, a[500005], psum[500005], dp[500005];
vector<int> vec;
int main() {
cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
cin >> n >> k >> d;
for (int i = 1; i <= n; i++) {
cin >> a[i];
vec.push_back(a[i]);
}
vec.push_back(-1);
sort(a + 1, a + 1 ... | ALGO | 0.999995 | 4.266652 |
ad89b8f0-27f9-4dc8-b096-88895df398ac | surendhar-code/OOPS-practice | Tower_of_hanoi.cpp | #include<iostream>
#include<iomanip>
using namespace std;
void tower_of_hanoi(int n,char f,char d,char a)
{
if(n==1)
{
cout<<"Disk "<<n<<" moves from "<<f<<" to "<<d<<endl;
return;
}
tower_of_hanoi(n-1,f,a,d);
cout<<"Disk "<<n<<" moves from "<<f<<" to "<<d<<endl;
tower_of_hano... | ALGO | 0.999898 | 5.363458 |
0d89c23c-5c9d-44d5-9989-d27fcbc8bb2e | kazi-nayeem/Programming-Problems-Solutions | hackerrank/gs-codesprint/trader-profit.cpp | //#include <bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
using namespace std;
typedef long long ll;
typedef uns... | ALGO | 0.999769 | 3.592177 |
f7a19ad6-18ec-4e99-aa62-cb994ec28f14 | raincross7/code-similarity | codes/train_code/problem183/problem183_104.cpp | #include <bits/stdc++.h>
using namespace std;
const long MOD = 1e9+7;
template <typename T>
T modPow(T base, T e, T mod) {
if(e==0) return 1;
if(e==1) return base%mod;
if(e%(T)2==1) return (base * modPow(base, e-(T)1, mod)) %mod;
T tmp = modPow(base, e/(T)2, mod);
return (tmp * tmp) % mod;
}
template <ty... | ALGO | 0.999985 | 4.269638 |
4b9d4caf-a6e8-4e08-bdbf-a82ff156b728 | NgNhatThanh/SPOJ-Tournament | P171PROF.cpp | #include <stdio.h>
#include <stdlib.h>
int cmp(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int main() {
int n, cnt=1;
scanf("%d",&n);
int arr[n];
int pre[n];
for(int i=0; i<n; i++) scanf("%d",&arr[i]);
qsort(arr,n,4,cmp);
pre[0]=arr[0];
for(int i=1; i<n; i++) {
if(pre[i-1]>arr[i]) {
ar... | ALGO | 0.999958 | 3.420991 |
7ceb04b3-a275-41ac-81f7-02abc91870a5 | edoquendo1314/AlgorithmProjects | Project3/RadixSortString.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <string.h>
using namespace std;
//global variables
ifstream in_File;
ofstream outFile1;
ofstream outFile2;
class ListNode
{
private:
friend class LLStack;
friend class LLQ;
friend class RadixSort;
public:
string d... | ALGO | 0.999825 | 4.51583 |
916a2f3a-4a74-41ba-988b-28f3b32dc9cd | LaranjoTomas/Third_Year | SO/02-2-shm+sem/code/question2/delays.cpp | /*
* \brief Generation of delays
*
* \author (2016) Artur Pereira <artur at ua.pt>
*/
#include "delays.h"
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <unistd.h>
/*
* A fixed, busy waiting delay
*/
static double b, c;
void bwDelay(uint32_t n)
{
b = c = 0.0;
/* generate time delay ... | TOOL | 0.857232 | 4.171474 |
a6d8264f-33bb-4962-a82a-ccf1cc039a6d | flowtoolz/flutter-bootcamp-projects | quizzler/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.998345 | 6.785645 |
5ab8865a-5e71-4bb1-b608-b35c2779251e | FranciscoThiesen/CompetitiveProgramming | CodeForces/CF1056-D12-B.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define buff() ios::sync_with_stdio(0);cin.tie(0)
#define sz(x) ( (int) (x).size() )
#define debug(x) i... | ALGO | 0.999954 | 5.10765 |
e0c78fb5-e7ec-4685-a7fa-33a708da8a24 | zv-proger/ol_programms | acmp/0819.cpp | /*
: (<EMAIL>)
0819 acmp.ru
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(), x.end()
const int inf = 1e9;
using ll = long long;
using pii = pair<int, int>;
template <class A> void print(A a) { cout << a << ' '; }
template <class A, class... O> void print(A a, O... o) { print... | ALGO | 0.999761 | 4.037458 |
e67692c8-1eea-4814-9898-7465fdc2c125 | gopoma/competitive-programming | edu/misc/CustomComparator.cpp | // sometimes pragmas don't work, if so, just comment it!
#pragma GCC optimize(3,"Ofast","inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#include <bits/stdc++.h>
using namespace std;
// building blocks
using ll = long long;
using db = long double; // or double, if TL is tight
using st... | ALGO | 0.999979 | 4.306164 |
1d170be6-2ceb-42aa-bf15-a35bc568230c | PesanTiketAja/tiketapp | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
51355caa-aa47-4d09-92e6-d125b60e87cb | PrashantChoudhary13579/Data-Structure- | all sorting/insertion.cpp | // Here is the code of insertion code written by the Prashant Choudhary while learning DSA.
/*
Algorithm:
1. Start with the second element (index 1).
2. Compare it with elements in the sorted portion to its left.
3. Shift larger elements one position to the right and insert the current element in the correct position.... | ALGO | 0.999997 | 6.057536 |
675db142-9c00-49cd-989c-2ec0ec79c9ca | raincross7/code-similarity | codes/train_code/problem376/problem376_186.cpp | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define PI 3.14159265
using namespace std;
using ll = long long;
void self_max(int &a,int b){
a = max(a,b);
}
void self_min(ll &a,ll b){
a = min(a,b);
}
int main(){
int n; cin >> n;
int ans = 0;
if(n&1){
cout << n/2 << endl;
}else{
cout << ... | ALGO | 0.999785 | 4.211665 |
36c40b4e-376b-41f1-b1de-ee07b465494c | nishitasinghhh/gfg | Difficulty: Hard/Matrix Chain Multiplication/matrix-chain-multiplication.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int matrixMultiplication(vector<int> &arr) {
// code here
int n=arr.size();
vector<vector<int>>dp(n,vector<int>(n,0));
for(int i... | ALGO | 0.999853 | 5.853567 |
0eb5b255-2e4e-4421-813b-4ddaba622c2e | feelpp/rte-mc | src/cpp/rte-mc.cpp | #include <iostream>
#include <random>
#include <vector>
#include <feel/feelalg/matrixpetsc.hpp>
#include <feel/feelalg/topetsc.hpp>
#include <feel/feelcore/environment.hpp>
#include <feel/feelcore/json.hpp>
#include <feel/feelcore/ptreetools.hpp>
#include <feel/feelcore/utility.hpp>
#include <feel/feeldiscr/minmax.hpp... | ALGO | 0.997961 | 4.244847 |
da674455-8323-4b70-853c-1c7787b24da8 | aman02022003/Data-Structures-and-Algorithms | Reverse-Only-Letters.cpp | class Solution {
public:
string reverseOnlyLetters(string s) {
//take two pointer approach
int i=0; int j=s.size()-1;
while(i<j){
if(isalpha(s[i])&& isalpha(s[j])){
swap(s[i],s[j]);
i++,j--;
}
else if(!isalpha(s[i])){
... | ALGO | 0.999464 | 6.335291 |
2974faf4-2932-44c7-a1e4-4e8b76fd5d43 | sooorajjj/android_frameworks_av | media/libstagefright/codecs/amrnb/common/src/vad1.cpp | /*
Pathname: ./audio/gsm-amr/c/src/vad1.c
Functions:
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template.
Changed to accept the pOverflow flag for EPOC compatibility.
Description: Made changes per review commen... | ALGO | 0.999326 | 5.667239 |
1fbce275-3bbe-4f6c-b8ef-1d792336149d | varxtikaa/Code-Practise | cpp/matrices/sum_border.cpp | #include<iostream>
using namespace std;
int main(){
int row,col,m,n,sum=0;
cout<<"Enter rows and columns: ";
cin>>row;
cin>>col;
int arr[row][col];
for(int i=0;i<row*col;i++){
m=i/col;
n=i%col;
cout<<"arr["<<m<<"]["<<n<<"]= ";
cin>>arr[m][n];
}
for(int i=0... | ALGO | 0.999649 | 3.845919 |
5c81b53a-f16d-4bbf-b943-3a9a1ed92aa4 | sheyua/LAMMPS-QTB | src/compute_pair_local.cpp | #include "math.h"
#include "string.h"
#include "stdlib.h"
#include "compute_pair_local.h"
#include "atom.h"
#include "update.h"
#include "force.h"
#include "pair.h"
#include "neighbor.h"
#include "neigh_request.h"
#include "neigh_list.h"
#include "group.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_... | ALGO | 0.997541 | 5.863625 |
0163cbd7-fa2a-4c0f-b260-98d03db0e9a6 | NitinMadhukar/competitive-programming | CF_694_Div2/C.cpp | /* Nitin Madhukar */
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define big(x) ... | ALGO | 0.999981 | 3.214206 |
1d444b1c-af37-41c3-84c0-0f0531376b04 | takumi152/atcoder | abc147e.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;
typedef pair<int, int> Pii;
const ll mod = 1000000007;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int h, w;
cin >> h >>... | ALGO | 0.99997 | 4.083674 |
9866addc-8ac4-4d72-b985-9fa935a73942 | ishandutta2007/codeforces | zemen/normal/1693/A.cpp | #pragma GCC optimize("Ofast,no-stack-protector")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
signed main() {
#ifdef LOCAL
assert(freopen("a.in", "r", stdin));
#endif
ios::sync_with_stdio(false);
cin.tie(0);
int tn;
cin >> tn;
for (int i = 0; i < tn; ++i) {
... | ALGO | 0.999804 | 5.264483 |
8c4b10a9-b003-425d-ab45-3a6770c5cf54 | lchacon16/ejercicios2 | todos/presentar los numeros de10 al1/main.cpp | #include <iostream>
// presentar los numeros de 10 al 1 //
using namespace std;
int main()
{
int i;
for(i=10; i>=1; i-- ){
cout<<i<<endl;
}
return 0;
}
| TOOL | 0.948644 | 3.063953 |
a462538b-5b85-4283-8f82-0d1872824d78 | thevuong8000/Competitive-Programming | LinkedList/tortoise_hare.cpp | #include<bits/stdc++.h>
using namespace std;
struct ListNode {
int val;
ListNode* next;
ListNode(): val(0), next(nullptr) {}
ListNode(int x): val(x), next(nullptr) {}
ListNode(int x, ListNode* next): val(x), next(next) {}
};
/**
* return NULL if lst is NULL or there is no circle
*/
ListNode* get... | ALGO | 0.999926 | 4.585509 |
c21a41f7-4f6c-4784-9ab0-4e28c58b9cab | jencymaryjoseph/learned-cardinality-duckdb | duckdb/extension/icu/third_party/icu/i18n/collationrootelements.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "collation.h"
#include "collationrootelements.h"
#include "uassert.h"
U_NAMESPACE_BEGIN
int64_t
CollationRootElements::lastCEWithPrimaryBefore(uint32_t p) const {
if(p == 0) { return 0; }
U_ASSERT(p > elements[elements[IX_FIRST_PRIMARY_INDEX]]);... | ALGO | 0.981425 | 7.259431 |
5b455bb9-c19c-402a-bbda-1c29e0eda08f | TanmayKJha/Data-Structures-Algorithm | String/Integer to Roman.cpp | class Solution {
public:
string intToRoman(int num) {
static vector<int> values{1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
static vector<string> symbol{"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
string result = "";
for(int i =0; i<values.size()... | ALGO | 0.999763 | 6.516956 |
749b958d-48b6-418f-8dc7-9a4f0cee74b9 | hianantk/Competitive-Programming | CodeForces/Practice/337B.cpp | /*coderanant*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define f1(i,a,b) for(int i=a;i<b;i++)
#define f2(i,a,b) for(int i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
const int mod=1000000007;... | ALGO | 0.999834 | 4.962745 |
03bdba72-e0f1-4c63-9c37-e7491859a1a2 | brrrka/gopay-ui | 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.998733 | 6.76775 |
47e91e4a-daa3-40d8-9bdb-b75e9e36b255 | ttamx/Competitive-Programming | codechef/Append_Array.cpp | #include<bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;
using db = long double;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<db>;
using pii = pair<int,int>;
using pll = pair<ll,ll>... | ALGO | 0.999938 | 4.158806 |
e1f3f013-5691-4b12-b683-caeb40de2a13 | cbFelix/codeCollection | cpp/algorithms/search/binarySearch/src/binarySearch.cpp | #include <iostream>
using namespace std;
#include "binarySearch.hpp"
int binarySearch(int* array, const int arrSize, int target) {
int firstIdx = 0;
int lastIdx = arrSize - 1;
while (firstIdx <= lastIdx) {
int middleIdx = firstIdx + (lastIdx - firstIdx) / 2;
if... | ALGO | 0.99964 | 5.418489 |
a7406573-eb7b-4f93-834c-b7f17825f820 | ntrntr/leetcode | leetcode_cpp/leetcode/abc.cpp | #include <vector>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <string>
#include <map>
#include <stack>
#include <unordered_map>
#include <limits.h>
using namespace std;
void getRes(long long int a, long long int b, long long int c)
{
//cout << a + b << endl;
if (a > 0 && b > 0 && (a + b) <= ... | ALGO | 0.999506 | 4.690915 |
35b490e1-8164-4325-aac5-6490c58b3e39 | hclown9804/interview | 算法提高课/275.传纸条.cpp | #include <iostream>
using namespace std;
const int N = 55;
int n, m;
int w[N][N], f[N * 2][N][N];
int main() {
cin >> n >> m;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
cin >> w[i][j];
}
}
for (int k = 2; k <= n + m; ++k) {
for (int x1 = max(... | ALGO | 0.999978 | 3.976065 |
06070298-3fe1-487d-881e-cf8f625cb497 | floresloyd/Undergraduate_CUNY_Queens | CSCI_313-323_Data_Structures_And_Algorithms/CSCI_323_Design_And_Analysis_Of_Algorithms/Algorithms/13-DynamicProgramming/LeetCode/LeetCode-0070-1.cpp | class Solution {
public:
/// Naive recursive implementation
/// Notice that this is nothing but the Fibonacci sequence
int climbStairs(int n) {
if (n <= 1) return 1;
return climbStairs(n-1) + climbStairs(n-2);
} //end-climbStairs
}; | ALGO | 0.99998 | 6.219862 |
09fc9e2b-ae12-4f52-afbe-04ae7ac57132 | morishita8256/AtCoder | ABC/201-220/ABC213/A-Bitwise_Exclusive Or.cpp | #pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; ... | ALGO | 0.999953 | 4.454838 |
a62a6ee3-7aad-46cd-8b93-a2f5d71991d3 | Stobertonf/provider_dio | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
2dc6910f-99f8-44c5-86c0-b7f63d96a954 | PawanKhairnar497/C-plus-plus | Basics/increment.cpp | #include<iostream>
using namespace std;
int main(){
int x = 5;
cout<<x<<endl;
++x;
cout<<x<<endl;
x++;
cout<<x<<endl;
--x;
cout<<x<<endl;
x--;
cout<<x;
return 0;
} | TOOL | 0.994201 | 3.028046 |
f164e920-f204-49f2-87da-6de210760df4 | byam/algorithms | fb-hackercup/2021/q-round/A2.cpp | #include <bits/stdc++.h>
//#include <atcoder/all>
// using namespace atcoder;
using namespace std;
// debug
#define printv(v) \
for (auto x : v) { \
cerr << x << " "; \
} \
cerr << endl;
#define print2d(v, n, m) \
for (int i = 0; i < (n); i++) { ... | ALGO | 0.999803 | 4.772047 |
0af8370d-f550-42f6-8a6d-97fc5307ed52 | sarvex/leetcode-free-basic | solution/2400-2499/2448.Minimum Cost to Make Array Equal/Solution.cpp | using ll = long long;
class Solution {
public:
long long minCost(vector<int>& nums, vector<int>& cost) {
int n = nums.size();
vector<pair<int, int>> arr(n);
for (int i = 0; i < n; ++i) arr[i] = {nums[i], cost[i]};
sort(arr.begin(), arr.end());
vector<ll> f(n + 1), g(n + 1);
... | ALGO | 0.999989 | 4.918252 |
7f335150-e126-454e-aafb-076c5d8849ec | trdtnguyen/mysql-pmem | extra/yassl/taocrypt/src/des.cpp | /* C++ part based on Wei Dai's des.cpp from CryptoPP */
/* x86 asm is original */
#if defined(TAOCRYPT_KERNEL_MODE)
#define DO_TAOCRYPT_KERNEL_MODE
#endif // only some modules now support this
#include "runtime.hpp"
#include "des.hpp"
#ifdef USE_SYS_STL
#include <algorithm>
#e... | ALGO | 0.999333 | 7.25026 |
f72b43a2-8b7e-4889-ba6f-ef085f2417ac | Meeperbunny/CompetitiveProgramming | archive/CF1038/_D.cpp | #include <bits/stdc++.h>
using namespace std;
#define HEADER ios::sync_with_stdio(0);cin.tie(0);if (fopen("file.in", "r")) {freopen("file.in", "r+", stdin);};
#define all(v) v.begin(), v.end()
using ll = long long;
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T... | ALGO | 0.999897 | 4.443624 |
c9afcb0e-797d-4367-b21c-2fe7eb25dcc5 | i-am-chitti/Coding-Hour | CPP Practice/Hackerearth/Algorithms/Greedy Algorithm/coprimes.cpp | #include<bits/stdc++.h>
using namespace std;
int findGcd(int a, int b) {
if(b==0) return a;
return findGcd(b, a%b);
}
int main() {
int N;
cin>>N;
for(int i=N-2;i>0;i--) {
if(i%2!=0 && findGcd(N,i)==1) {
cout<<i;
break;
}
}
} | ALGO | 0.999991 | 4.308087 |
00287ae2-7b05-4dd0-a4a3-6c64e6d11986 | Shankar-Balajee/Foundational_Algorithmic_Implementations | Techniques/slider.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n,k;
cin >>n>>k;
int a[n];
int init=0;
for(int i=0;i<n;i++)
{
cin >>a[i];
init+=a[i];
}
int ans=0;
int s=0;
int e=k-1;
if(k>=n)... | ALGO | 0.999994 | 3.873047 |
b0632fda-7b42-4eda-8efe-4c2645499171 | KuangRD/Autonomous-Driving | Self-DrivingCarND/Projects/Term2/CarND-MPC-Project/src/Eigen-3.3/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)
{
return v.sta... | TEST | 0.97091 | 6.666052 |
7abf8fb4-8fb0-4db5-ab0c-a9f3bc8be259 | Tahsin005/Problem-Solving | Week 26+/F_ucyhf.cpp | #include <bits/stdc++.h>
using namespace std;
bool p(int n) {
if (n < 2)
return 0;
for (int i = 2, m = sqrt(n); i <= m; i++)
if (!(n % i))
return 1;
return 0;
}
main() {
int n, a = 9, b;
string s;
cin >> n;
while (n--) {
do {
while (p(++a))
... | ALGO | 0.999893 | 4.437751 |
fa276165-44d8-4cfe-bfea-167c0a86f080 | PratyushJaiswal999/Mission-DSA | LEETCODE/257. binary-tree-paths.cpp | class Solution {
void generatePaths(TreeNode* root, vector<string>& ans, string temp) {
if (!root)
return;
if (!root->left && !root->right) {
temp += to_string(root->val);
ans.push_back(temp);
return;
}
temp += to_string(root->val) + ... | ALGO | 0.999895 | 6.318476 |
7387b040-3db8-4655-a748-59f0264c90fe | Vishesh1110/dsa_cpp | DP/uniquePaths.cpp | #include <bits/stdc++.h>
using namespace std;
// TC : O(2^(row*column))
// SC : O(Path_length) (recursive stack space)
int findPathsR(int row, int column)
{
if(row == 0 && column == 0) return 1;
if(row < 0 || column < 0) return 0;
int up = findPathsR(row - 1, column);
int left = findPathsR(row, column... | ALGO | 0.999955 | 5.746391 |
67a853fd-9d54-4875-8d43-89269422cc88 | 1303575952/Data-Structure-And-Algorithms | Think-In-Algorithms/06-Union-Find/Course Code (C++)/05-Optimize-by-Rank/main.cpp | #include <iostream>
#include "UnionFindTestHelper.h"
using namespace std;
// 对比UF1, UF2, UF3和UF4的时间性能
int main() {
// 使用1000000的数据规模
int n = 1000000;
// 虽然isConnected只需要O(1)的时间, 但由于union操作需要O(n)的时间
// 总体测试过程的算法复杂度是O(n^2)的
// 100万数据对于UF1来说太慢了, 不再测试
//UnionFindTestHelper::testUF1(n);
// ... | TEST | 0.989913 | 4.264034 |
06f665b2-3baa-4ee9-9e3f-adc26a7c89cf | raincross7/code-similarity | codes/train_code/problem271/problem271_483.cpp | #include <complex>
#include <iostream>
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b){ return (conj(a) * b).imag(); }
int main(){
xy_t V[3],P;
double x,y,cp[3];
while(cin >> x >> y){
... | ALGO | 0.999748 | 4.03223 |
cb1d880a-53ba-4746-923d-9581a1086629 | skyto0927/Programming-Contest | AtCoder_PastProblems/ABC_024/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;
#include <bits/stdc++.h>
using n... | ALGO | 0.999878 | 4.299957 |
7dc3358e-4d43-428b-8619-6f2bed1e5e69 | FrontISTR/REVOCAP_Refiner | Geometry/kmbLine.cpp | /*----------------------------------------------------------------------
# #
# Software Name : REVOCAP_PrePost version 1.6 #
# Class Name : Line #
# ... | TOOL | 0.963399 | 5.299495 |
b51014c8-2711-48b1-ac3f-840750cea7da | miguelsndc/competitive-programming-lib | code/Number Theory/Utilities.cpp | // O(sqrt(n))
bool prime(ll a)
{
if (a == 1)
return 0;
for (int i = 2; i <= round(sqrt(a)); ++i)
if (a % i == 0)
return 0;
return 1;
}
// O(log(min(a, b)))
ll gcd(ll a, ll b)
{
if (!b)
return a;
return gcd(b, a % b);
}
// O(log(min(a, b)));
ll lcm(ll a, ll b) {
... | ALGO | 0.999596 | 3.789437 |
f4fb8e12-0577-4669-bd1e-dca6ba1798a6 | syberia-project/platform_external_skqp | src/pathops/SkOpEdgeBuilder.cpp | #include "SkGeometry.h"
#include "SkOpEdgeBuilder.h"
#include "SkReduceOrder.h"
void SkOpEdgeBuilder::init() {
fOperand = false;
fXorMask[0] = fXorMask[1] = (fPath->getFillType() & 1) ? kEvenOdd_PathOpsMask
: kWinding_PathOpsMask;
fUnparseable = false;
fSecondHalf = preFetch();
}
// very t... | ALGO | 0.981726 | 7.289123 |
ca5b66ed-947c-4f99-84e0-7a18738ebf6d | sooobee/CodingTest | 프로그래머스/0/250128. [PCCE 기출문제] 6번 / 가채점/[PCCE 기출문제] 6번 / 가채점.cpp | #include <string>
#include <vector>
using namespace std;
vector<string> solution(vector<int> numbers, vector<int> our_score, vector<int> score_list) {
int num_student = numbers.size();
vector<string> answer(num_student);
for (int i = 0; i < num_student; i++) {
if (our_score[i] == score_list[n... | ALGO | 0.999605 | 4.911461 |
188f243e-965a-4fd4-8b88-237b9b22e22d | iankit31/6Companies30days | Microsoft/Q13.cpp | #include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find if the given edge is a bridge in graph.
void dfs(int src,vector<bool>&visited,vector<int> adj_list[],int c,int d)
{
visited[src] = true;
for(auto i:adj_list[src])
{
if((src==c && i==d)|... | ALGO | 0.999803 | 5.90003 |
3b9a7a89-766c-4b84-817b-6f2e87b8efef | adamhasselwander/cf | 977/977/E/E.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define sd(n) scanf("%d",&n) == 0
#define sl(n) scanf("%I64d",&n) == 0
#define ss(n) scanf("%s",n) == 0
#define sc(n) scanf(" %c",&n) == 0
#define pd(x) printf("%d", x)
#define ps(x) printf("%s", x)
#define pl(x) printf("%I64d", x)
#define rep(i, begin, end) f... | ALGO | 0.999721 | 4.81327 |
7aa64e6b-df71-4a0a-9a26-b2db9d7a2bd8 | saadsrabon/C-Revision-Journey | Sort_It_2.cpp | #include<bits/stdc++.h>
using namespace std;
int sort_it(int A[],int N)
{
sort(A,A+N,greater<int>());
for(int i=0;i<N;i++)
{
cout<<A[i]<<" ";
}
};
int main()
{
int N;
cin>>N;
int A[N];
for(int i=0;i<N;i++)
{
cin>>A[i];
}
sort_it (A,N);
return 0;
} | ALGO | 0.99959 | 4.807278 |
1e39e786-525c-4160-b1fb-e730c1e27593 | westernLoser/cpp-primer-5th | chapter 5/5.10.cpp | /*
author : szz
date : 2019/06/17
*/
#include<iostream>
#include<string>
using std::string;
int main() {
string s;
std::cin >> s;
int aCnt = 0, eCnt = 0, iCnt = 0, oCnt = 0, uCnt = 0;
for (auto &c : s) {
auto ch = tolower(c);
if (ch == 'a') ++aCnt;
else if (ch == 'e') ++eCn... | ALGO | 0.997587 | 5.022167 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.