uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9b3c0022-9e4e-41ee-afab-446b0b2e3a92 | gouravsinghal/faangcourse | asworddistance2.cpp | #include<iostream>
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
int minDist(vector<string> words, string word1, string word2)
{
int minm=words.size();
int n=minm;
if(word1==word2)
{
int p=-1;
for(int i=0;i<n;i++)
{
if(words[i]==word1){
if(p==-1) p=i;
else{
minm=min(minm, abs(... | ALGO | 0.999992 | 4.793025 |
7c4cc305-1e6c-42ab-adac-b7eb88f0beb1 | TMGA-C/TMGA | TMGA-BC/TMGA_BC-time/CGA.cpp | #include "common.h"
#include "tools.hpp"
#include "config.h"
#include "GenerateAChrom.h"
#include "GenOperator.h"
using namespace std;
double runCGA(string XmlFile, string RscAlcFile, double& SchTime, int& iteration) {
clock_t start = clock();
ReadFile(XmlFile, RscAlcFile); //read model information
Confi... | ALGO | 0.999754 | 4.026248 |
06a18591-d769-477b-921f-5811a9800061 | Kaustubh73/DSA-from-scratch | Algorithms/Sorting Algorithms/merge_sort.cpp | #include <bits/stdc++.h>
using namespace std;
int swap(int & a, int & b)
{
int c = a;
a = b;
b = c;
return 1;
}
int merge(vector<int>& arr, int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
vector<int> L(n1), R(n2);
for (i = 0 ; i < n1; i++)
L[i] = a... | ALGO | 0.99985 | 4.217892 |
65665dd4-76c9-48b4-bdbb-a1abc9d932ae | externalxdpro/CCCSolutions | Senior/2021/program1.cpp | // 15/15 marks
#include <iostream>
#include <vector>
using namespace std;
vector<int> split(string s, char delimiter = ' ')
{
int current;
int next = -1;
vector<string> temp;
do
{
current = next + 1;
next = s.find_first_of(delimiter, current);
temp.push_back(s.substr(curre... | ALGO | 0.99969 | 4.221584 |
33ae31a2-05bf-41d8-90f4-b26495720d99 | KylannUwU/VEXAI_3303X | src/pathcontrol.cpp | #include "pathcontrol.h"
#include "robot-config.h"
#include <sstream>
#include "field.h"
template<typename T>
T clamp(T val, T min_val, T max_val) {
return std::max(min_val, std::min(val, max_val));
}
struct PathPoint {
Point position;
double heading_deg;
PathPoint(double x, double y, double h = -1);... | ALGO | 0.998975 | 4.458967 |
3e9c88b5-99c1-46d1-a2b4-6e4cabf0e709 | ishandutta2007/codeforces | mr_eight/normal/1515/D.cpp | //#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <functional>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <dequ... | ALGO | 0.999819 | 3.15998 |
e9af8fb4-06e6-4c13-9ad4-1b8c4ad2a283 | daidai411411/AtCoder | ABC355/D.cpp | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
class Endpoint {
... | ALGO | 0.999584 | 4.695632 |
591798dc-38a4-4654-a78d-7103de6a20ef | ishandutta2007/codeforces | rainair/normal/1380/D.cpp | #include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define fi first
#define se second
#define db double
#define U unsign... | ALGO | 0.999814 | 3.230644 |
01a98c4e-62b4-4890-82da-b1b9fb1988a0 | devos50/programmingchallenges | SPOJ/tricount/main.cpp | #include <iostream>
using namespace std;
void solve()
{
long long num; cin >> num;
if(num % 2 == 0) cout << num * (num + 2) * (2 * num + 1) / 8 << endl;
else cout << (num * (num + 2) * (2 * num + 1) - 1) / 8 << endl;
}
int main(int argc, char *argv[])
{
int t; cin >> t;
while(t--) solve();
} | ALGO | 0.99936 | 4.517731 |
3388e825-b432-4add-9759-fdc3a142242b | i-manish-3/DSA-SUPREME | Graph/creation_usin_adj_list.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
// TC = O(N)
// SC = O(2E) where E = no of edges
vector<int> adj[n+1]; // a list of array of size n+1
for(int i = 0; i < m; i++)
{
int u,v;
cin>>u>>v;
adj[u].push_back(v);
adj[... | ALGO | 0.999967 | 4.402604 |
78598a2f-ef65-4288-980f-1e3e34132c62 | gergalerg/cpp-clang | compstr1.1.cpp | #include <iostream>
#include <cstring>
int main()
{
using namespace std;
char word[5] = "mate";
char word2[5] = "mAsf";
cout << strcmp(word, word2) << endl;
return 0;
} | ALGO | 0.998051 | 3.452882 |
3fceb3df-872e-4dea-9168-df74e3c61f26 | ishandutta2007/codeforces | heart_blue/normal/238/C.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bi... | ALGO | 0.99903 | 3.797653 |
acf53fa5-b1e3-4ff6-9492-2090155e2420 | NMLT-NTTMK-K18/6-290-recursion | Bai051/Source.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int S(int);
int main()
{
int n;
cout << "Nhap n: ";
cin >> n;
cout << "\nKet qua cua S(" << n << ") la: " << setw(5) << S(n) << endl;
return 0;
}
int S(int n)
{
if (n == 0)
return 0;
if (n == 1)
return 1;
return (1 + n) * S(n - 1) - n * S(n - 2)... | ALGO | 0.999753 | 3.654359 |
ba4c6141-b1da-4e01-ae9f-de12d34f8860 | joaoriverd/IGen | benchmarks/FFNN_mnist/libraries/fil_ffnn.cpp | #include "math.h"
#include "filib_common.h"
#define MAX_LAYER_SIZE 1024
/* Auxiliary arrays */
static fil_I _y1[MAX_LAYER_SIZE];
static fil_I _y2[MAX_LAYER_SIZE];
static void WeightedSum_opt(fil_I* W, fil_I* b, fil_I* x, fil_I* y, int n_in, int num_n) {
/* Handle remaining */
for (int i = 0; i < num_n; i+=2)... | ALGO | 0.999929 | 4.123229 |
f5a8cce7-d67e-4c16-ac27-e68ed085b71c | dipsarkersoft/XPSC | week--13/12-07-24/J_Maximums.cpp | /**
author: dip_sarker
12July2024 23:34:00
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
template <typename T>
using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statisti... | ALGO | 0.999955 | 4.452299 |
9cca9b24-e53f-4da6-aa35-44bd83d31e3d | sa-y-an/leetAction | solutions/problems/is_graph_bipartite?/solution.cpp | class Solution {
vector <bool> visited;
vector <int> depth;
public:
bool ifOddLenCycle(vector<vector<int>>& adjList, int ver,int par){
visited[ver] = true;
bool ans = false;
for( int child : adjList[ver]){
if( child == par ) continue;
el... | ALGO | 0.999962 | 5.751139 |
9e3328d4-68a5-4eae-a179-74388bbd7638 | HH-LFY/HH | CPP/XTU 1236.CPP | #include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <sstream>
#define PI acos(-1.0)
#define eps 1e-9
const int inf = (1<<30) - 10;
using namespace std;
const int max... | ALGO | 0.9995 | 3.473802 |
cf991548-0c63-4417-b219-06aa8074a2f5 | kazi-nayeem/Programming-Problems-Solutions | csacademy/round-37/D.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.999889 | 4.139038 |
e30448db-2ac1-4684-8a20-6df324bcf0fb | dngur6344/baekjoon-online-judge | 2156.cpp | #include<stdio.h>
#include<stdlib.h>
int main(void)
{
int num, i,max=0;
int arr[10000];
int res[10000];
scanf("%d", &num);
for (i = 0;i < num;i++)
{
scanf("%d", &arr[i]);
}
if (num == 1)
{
printf("%d\n", arr[0]);
return 0;
}
else if (num == 2)
{
printf("%d\n", arr[0] + arr[1]);
return 0;
}
res[0... | ALGO | 0.999947 | 3.070069 |
50ac91a2-a04c-4f5e-af58-e8b862b94eff | ishandutta2007/codeforces | nikarabika/normal/630/G.cpp | //sobskdrbhvk
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
#define PB push_back
#define MP make_pair
#define L first
#define R second
#define sz(x) ((int)(x).size())
#define smax(x, y) ((x) = max((x), (y)))
#defi... | ALGO | 0.999942 | 3.752017 |
872f99a8-1eb2-4ea7-abee-361d74c058a6 | anbello/t265_mavconn | pose_apriltag.cpp | #include "pose_apriltag.hpp"
//
// Re-compute homography between ideal standard tag image and undistorted tag corners for estimage_tag_pose().
//
// @param[in] c is 4 pairs of tag corners on ideal image and undistorted input image.
// @param[out] H is the output homography between ideal and undistorted input image.
/... | ALGO | 0.999538 | 5.739258 |
c0dfd28d-8c3c-4871-9a68-d4d4c9d8f087 | AgentM12/aoc_2021 | AdventOfCode2021/src/Days/Day4.cpp | #include <iostream>
#include <vector>
#include <iterator>
#include "../AdventOfCode2021.hpp"
namespace Day4 {
constexpr bool TEST = false;
constexpr int32_t BOARD_SZ = 5;
constexpr auto INPUT_FILE_PATH = "data/day4_input.txt";
constexpr auto TEST_INPUT_FILE_PATH = "data/day4_test_input.txt";
int32_t score(const... | ALGO | 0.997403 | 6.255739 |
adc69518-4e91-4bc5-91d8-bcc718347bbf | Mohit2352002/LeetCode_Solved | 0232-implement-queue-using-stacks/0232-implement-queue-using-stacks.cpp | static auto _ = [](){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return nullptr;
}();
/*
class MyQueue {
stack<int>input,output;
public:
MyQueue() {
}
void push(int x) {
input.push(x);
}
int pop() {
if(!output.empty()){
... | ALGO | 0.995281 | 5.104145 |
caf52e37-2942-4cb7-bb0e-627d33e9c626 | kakinumakoki/M2 | 50item_tests/testcase1/drone6/solve6_3.cpp | /*ドローンがトラックに戻らず次の停止ポイントに行くのもOK問題
やること
・2地点間の距離をユークリッド距離にする、往復はかける2する
・ドローンのスケジューリングの際一番飛行時間かかるものを各ドローンごとに最後に配達するようにする
・次の停止ポイントに移動した際にドローンが使えるか判定する変数追加
・pythonの表示方法考える
出発地点からもドローン飛ばせるようにしたもの
焼きなまし法
*/
#include<iostream>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#in... | ALGO | 0.999462 | 3.909111 |
e38d4052-f2a2-40b1-b731-fd170a5629b3 | AlessioGFerraioli/InteractiveParticles | particle.cpp | #include "particle.h"
particle::particle()
{
}
void particle::setup()
{
// initialize with random position
pos.x = ofRandomWidth();
pos.y = ofRandomHeight();
// and random velocity
vel.x = ofRandom(-4, 4);
vel.y = ofRandom(-4, 4);
//initialize the force to zero (will update the force in update())
frc = ofVec... | ALGO | 0.925462 | 5.932246 |
24d1b2b1-1e6a-42bc-b9dd-eb6d77945e3c | DoctorLai/ACM | leetcode/415. Add Strings/415.cpp | // https://helloacm.com/how-to-add-two-strings-numerically/
// https://leetcode.com/problems/add-strings/
// EASY, MATH
class Solution {
public:
string addStrings(string num1, string num2) {
string r = "";
int sz1 = num1.size();
int sz2 = num2.size();
int i = 0, j = 0, c = 0;
... | ALGO | 0.999931 | 7.040056 |
86e4996d-1147-4b2b-bfa3-d2c8ced7d8ed | yagyaraj234/gfg_cp_problems | 1114-binary-search-tree-to-greater-sum-tree/1114-binary-search-tree-to-greater-sum-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999849 | 5.164998 |
1a981872-6738-42ab-9ce5-92d87feabdb7 | Gourav1695/Python100days | Python100days/gfg_practice.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution{
public:
//Function to reverse every sub-array group of size k.
void reverseInGroups(vector<long long>& arr, int n, int k){
for(int i=0;i<n;i=i+k){
int start=i;
int end=min(i+k-1,n-1);
while(start<=end){
int t... | ALGO | 0.999942 | 4.438687 |
3d0c1aa6-c526-4b5e-ae70-da688f2c05c4 | gsscsd/Code_Training | leetcode/Easy/349. 两个数组的交集.cpp | /**
给定两个数组,编写一个函数来计算它们的交集。
示例 1:
输入: nums1 = [1,2,2,1], nums2 = [2,2]
输出: [2]
示例 2:
输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
输出: [9,4]
说明:
输出结果中的每个元素一定是唯一的。
我们可以不考虑输出结果的顺序。
*/
/**
解题思路:
1.map映射
2.双指针遍历
*/
#include <iostream>
#include <vector>
#include <map>
using namespace std;
// 空间为n,时间为n
class Solution {
... | ALGO | 0.999939 | 5.743759 |
7b30447f-1899-4c8c-ae48-9d8ee06c549c | raincross7/code-similarity | codes/train_code/problem341/problem341_28.cpp | #include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
string S; int w; cin >> S >> w;
for (int i = 0; i < S.length(); i += w) printf("%c", S[i]);
printf("\n");
}
| ALGO | 0.998947 | 3.023978 |
90f08886-0ffb-42ff-916e-9922fbcd7bc9 | Caknoooo/About-Struktur-Data | FINAL PRAKTIKUM 2022/Bepi and His Library Servers.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef WIN32
inline int getchar_unlocked()
{return _getchar_nolock(); }
#endif
using namespace std;
using namespace __gnu_pbds;
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define pii... | ALGO | 0.999659 | 3.405582 |
bed3eb44-08f2-48e4-9027-c9693f4eae38 | 9ikchen/-2306- | 二4.cpp | #include <iostream>
using namespace std;
int main()
{
int a,b,c,d,z; //ж㷽ʽķ
double x, y, v; //
cout << "֣" << endl;
cin >> x >> y;
cout << "㷽ʽ1234" << endl;
cin >> z;
switch (z)
{
case 1:
v= (x + y);
cout << "ǣ" << v << endl;
break;
case 2:
v = (x - y);
co... | ALGO | 0.999237 | 3.256256 |
a13eeac9-313d-4822-b73a-551b5c533a0b | gt-shara/gt-shara.github.io | SHARA/src/tactic/core/der_tactic.cpp | #include"der.h"
#include"tactical.h"
class der_tactic : public tactic {
struct imp {
ast_manager & m_manager;
der_rewriter m_r;
imp(ast_manager & m):
m_manager(m),
m_r(m) {
}
ast_manager & m() const { return m_manager; }
... | ALGO | 0.945065 | 5.343381 |
dc121846-e228-47c1-9dc3-5c4183c68396 | laxmikant4644/cPlusPlus | amsgame1.cpp | #include<stdio.h>
#define gc() getchar()
inline long int fastIO()
{
long int val=0;
char ch;
ch=gc();
while(ch==' '||ch=='\n'||ch=='\r')
ch=gc();
while(ch!=' '&&ch!='\n'&&ch!='\r')
{
val=val*10+ch-48;
ch=gc();
}
return val;
}
long int gcd(long int a,long int b)
{
return b?gcd(b,a%b):a;
}
int main()
{
... | ALGO | 0.999781 | 3.080175 |
bbe439ef-df71-4e55-8ac7-8995c6ae559d | raincross7/code-similarity | codes/train_code/problem419/problem419_275.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef double db;
const double pi = 3.141592654;
#define pb push_back
#define forab(i,a,b) for(int i=(a);i<=(b);i++)
#define CIN ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x) printf("Case %ld: %lld\n",z,x)
#define nw ... | ALGO | 0.999293 | 3.162709 |
e74de819-2d14-46da-8e07-17681c476938 | refatulfahad/Algorithm-Implementation | GRAPH THEORY/Heavy_Light_Decomposition.cpp | /*************************BIT implementation*****************/
#include<bits/stdc++.h>
using namespace std;
const int N=3e4+5;
int ar[N],n,par[N][18],sz[N],level[N],num,chain_id[N],ar_index[N];
vector<int>vertex[N],chain[N],bit[N];
void dfs(int node,int p) {
sz[node]=1;
for(int i=1; i<=15; i++) {
par[... | ALGO | 0.99988 | 4.350457 |
a6a9eac2-7de8-4dce-bd73-06c7c249baa4 | Dogbone0714/C-_Database | A27.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main(void){
int a;
cin>>a;
int b=1;
for(int i=a;i>=1;i--){
b=b*i;
}
cout<<b<<endl;
}
| ALGO | 0.999922 | 3.757004 |
e8b53013-b0cb-489c-8f74-6f94905ce3c5 | rohithakanta07/Leet_code | 80-remove-duplicates-from-sorted-array-ii/remove-duplicates-from-sorted-array-ii.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int i = 0 , j = 0;
if(nums.size()==1) return nums.size();
vector<int>v;
while(j < nums.size()){
if(i == j ) j++;
if(j-i <=1 && nums[i] == nums[j] ){
j++;
}
... | ALGO | 0.999901 | 6.128733 |
872153aa-855e-49e1-a70a-9546cc70bdc4 | ishandutta2007/codeforces | jklepec/normal/578/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b;
cin >> a >> b;
double sol1, sol2;
long long x1 = (a-b)/b - 1*( (a-b)/b % 2 != 0 );
long long x2 = (a+b)/b - 1*( (a+b)/b % 2 != 0 );
sol1 = double( a-b ) / x1, sol2 = double( a+b ) / x2;
cout << fixed << setprecis... | ALGO | 0.999762 | 3.429327 |
0c92687b-71bb-4020-918e-01554cf48136 | yoursandeshshrestha/Logic-Mastery | Q10/Q10.cpp | /*Array sort in ascending order*/
#include <iostream>
using namespace std;
int main()
{
int n, i, j, temp;
cout << "Enter the size of an array: " << endl;
cin >> n;
int arr[n];
cout << "Enter the elements of the array: " << endl;
for (i = 0; i < n; i++)
{
cin >> arr[i];
}
... | ALGO | 0.999622 | 4.947353 |
3e495ab7-e59e-4244-83b8-832e16d46e38 | moletop/leetcode_record | code/5.stack and queue/ heap/347.Top_K_Frequent_Elements.cpp | #include<bits/stdc++.h>
using namespace std;
/*
最小堆
*/
vector<int> topKFrequent(vector<int> &nums, int k) {
vector<int> res;
int n = nums.size();
map<int, int> map;
for (auto i : nums) map[i]++;
using pi = pair<int, int>;
priority_queue<pi, vector<pi>, greater<pi>> minheap;
for (auto i :... | ALGO | 0.999995 | 5.185918 |
01552f23-be18-4415-ae5a-07f91c006956 | keithhearne/VSTPlugins | CrossStereoDelayLine/JuceLibraryCode/modules/juce_graphics/geometry/juce_EdgeTable.cpp | const int juce_edgeTableDefaultEdgesPerLine = 32;
//==============================================================================
EdgeTable::EdgeTable (const Rectangle<int>& area,
const Path& path, const AffineTransform& transform)
: bounds (area),
maxEdgesPerLine (juce_edgeTableDefaultE... | TOOL | 0.960237 | 5.744978 |
517a7924-c7fc-440e-9d38-0f0b65293632 | Erlinguss/Bug_C | Crawler.cpp | //
// Created by User on 19/03/2023.
//
#include "Crawler.h"
#include <random>
#include <string>
const int BOARD_WIDTH = 10;
const int BOARD_HEIGHT = 10;
Crawler::Crawler(int id, pair<int, int> position, Direction direction, int size, bool alive, list<pair<int, int>> path)
: Bug(id, position.first, position.s... | ALGO | 0.893489 | 3.185744 |
646dc59a-3fb7-43f2-bbf6-21c508e7a640 | raincross7/code-similarity | codes/train_code/problem103/problem103_294.cpp | #include <iostream>
#include <map>
int main(void){
std::string S, ans="yes";
std::cin >> S;
std::map<char, int> mp;
for (char c: S){
if (mp.find(c) == mp.end()){
mp[c] = 0;
} else {
ans = "no";
break;
}
}
std::cout << ans << std::endl... | ALGO | 0.999905 | 4.152406 |
4eb8b165-32e6-45a2-a8c2-0f3b9f643878 | rgwang/cpp_course | t1/addArray/main.cpp | #include <iostream>
#include <stdio.h>
using namespace std;
int addArray(int array1[], int n);
int main()
{
//cout << "Hello world!" << endl;
int data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int size1 = sizeof(data) / sizeof(data[0]);
printf("sizeof(data):%d\n", sizeof(data));
printf(":%d\n", addArray(data, size1... | ALGO | 0.935261 | 3.792496 |
2c4439bb-9e72-4177-b086-196c40d661e0 | Jordanatha/PROGRAM-CHALLENGE2 | PRGCHALL 11.cpp | #include <iostream>
using namespace std;
int main(){
int automobile, loan, insurance, gas, oil, tires, maintenance;
cout << "Your payment for automobile : ";
cin >> automobile;
cout << "Your payment for loan : ";
cin >> loan;
cout << "Your payment for insurance : ";
cin >> insurance;
cout << "Your paym... | TOOL | 0.914377 | 3.240319 |
b40944a8-1a90-4807-b48e-4a1bcfac75ac | agabgim/ctf_tpls | boost/1.49.0/libs/geometry/doc/doxy/doxygen_input/sourcecode/doxygen_1.cpp | OBSOLETE
#include <boost/tuple/tuple.hpp>
#if defined(_MSC_VER)
// We deliberately mix float/double's here so turn off warning
#pragma warning( disable : 4244 )
#endif // defined(_MSC_VER)
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometri... | TOOL | 0.942675 | 7.397203 |
c77c9578-6864-461d-9582-df045eeaa73b | krishna-raj007/BodhiTree-Annotation | CS101_Autumn2020-21/Fibonacci/465_fibonacci.cpp | #include<simplecpp>
main_program{
int n,k,x1=0,x2=1,x3;
cin>>n;
cin>>k;
for(int i=0;i<n;i++){
if(x1%k>=0)
{cout<<x1%k<<endl;}
x3=x2%k+x1%k;
x1=x2%k;
x2=x3%k;
}
}
| ALGO | 0.99995 | 3.021626 |
112642e2-0137-4dfa-bf70-dc3c55dd9331 | abylikhsanov/model-predictive-control | src/Eigen-3.3/unsupported/doc/examples/MatrixSquareRoot.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(2,2);
A << cos(pi/3), -sin(pi/3),
sin(pi/3), cos(pi/3);
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix square root of A is:... | ALGO | 0.998915 | 3.9114 |
3aec25fd-ffc6-4d37-be0b-3b60a3b2f568 | nikhilsharma-github/DSA-Solved-Problems | Matrix/RotateMatrixBy90DegCounterClockwise.cpp | #include <bits/stdc++.h>
using namespace std;
#define deb(x) cout << #x << "=" << x << endl
void parray(int a[], int n)
{
for (int i = 0; i < n; i++)
{
cout << a[i] << " ";
}
cout << endl;
}
void pmatrix(vector<vector<int>> a, int r, int c)
{
for (int i = 0; i < r; i++)
{
for (... | ALGO | 0.999855 | 5.104826 |
8006dd64-c21e-46ee-9ec3-b8091c3dfd4a | TFS-here/problemSolving | Ciron's Perfect Bitmasks Classroom.cpp | #include<iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int x;
cin>>x;
int y;
for(int i=0;;i++)
{
if((x&i)>0&&(x^i)>0)
y=i;
break;
}
cout<<y<<endl;
}
return 0;
}
| ALGO | 0.999947 | 4.125982 |
f9fd5d0e-c040-48b5-8cea-800e3f98413d | pafin10/CompetitiveProgrammingExercises | year_2_contests/codechef_162/1.cpp | #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <bitset>
#include <numeric>
#include <set>
#include <queue>
#include <unordered_map>
#include <cassert>
#include <array>
using namespace std;
#d... | ALGO | 0.999676 | 3.698498 |
16ec3f95-fc16-415b-941a-05b859353ede | listedlinked/crave | src/script/sign.cpp | #include "script/sign.h"
#include "primitives/transaction.h"
#include "key.h"
#include "keystore.h"
#include "script/standard.h"
#include "uint256.h"
#include "util.h"
#include <boost/foreach.hpp>
using namespace std;
typedef vector<unsigned char> valtype;
bool Sign1(const CKeyID& address, const CKeyStore& keystor... | ALGO | 0.914247 | 6.511937 |
5490fa91-bd17-49ee-bc41-7c4fc394a9f0 | elrudrakssh/Dynamic-Programming | code-force-vault/1165D-AlmostAllDivisors.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
typedef long long ll;
int main(){
ll t; scanf("%lld", &t);
while(t--){
ll n; scanf("%lld", &n);
std::vector<ll> d(n); for(ll p = 0; p < n; p++){scanf("%lld", &d[p]);}
sort(d.begin(), d.end());
ll x = d[0] * d.back();
... | ALGO | 0.999665 | 3.742003 |
3da911e3-2de4-426a-89f5-a2812bc2acab | karoljanic/preferential-colouring-of-random-graphs | implementation/random_graph_factory.cpp | #include "random_graph_factory.hpp"
#include <stdexcept> // std::invalid_argument
namespace graph::random {
BAGraph RandomGraphFactory::createBarabasiAlbertWithPreferentialAttachmentRepeatedNodes(size_t initial_nodes_number,
size... | ALGO | 0.955525 | 6.993038 |
b64669ec-fe29-4665-bb6e-50f64edbf8e2 | Taejin1221/Problem-Solving | Baekjoon/Baekjoon23248.cpp | // Baekjoon23248.cpp
// https://www.acmicpc.net/problem/23248
#include <iostream>
#include <set>
#define SIZE 100'001
using namespace std;
struct Treasure {
int row, col;
Treasure(): row(0), col(0) { }
Treasure(int r, int c): row(r), col(c) { }
bool operator<(const Treasure& t2) const {
return (row != t2.row)... | ALGO | 0.999915 | 4.171648 |
43b8050f-051c-4152-92ec-c566603ff91f | reswitched/switch-oss | webkit_0.27.6/WebCore/platform/audio/Biquad.cpp | #include "config.h"
#if ENABLE(WEB_AUDIO)
#include "Biquad.h"
#include "DenormalDisabler.h"
#include <algorithm>
#include <stdio.h>
#include <wtf/MathExtras.h>
#if OS(DARWIN)
// Work around a bug where VForce.h forward declares std::complex in a way that's incompatible with libc++ complex.
#define __VFORCE_H
#inclu... | ALGO | 0.970985 | 6.775703 |
9cbf2419-0f00-4a0c-adab-99f6f6741861 | sultancodess/leetcode- | C++/search-suggestions-system.cpp | // Time: ctor: O(n * l), n is the number of products
// , l is the average length of product name
// suggest: O(l^2)
// Space: O(t), t is the number of nodes in trie
class Solution {
public:
vector<vector<string>> suggestedProducts(vector<string>& products, string searchWord) {
... | ALGO | 0.999943 | 6.839048 |
8f87c253-a690-448c-843a-45e137683464 | SaiCharmika/LeetCode | 41-first-missing-positive/first-missing-positive.cpp | class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
int n = nums.size();
// Step 1: Place each number in its correct position
for (int i = 0; i < n; ++i) {
while (nums[i] > 0 && nums[i] <= n && nums[nums[i] - 1] != nums[i]) {
swap(nums[... | ALGO | 0.999969 | 6.186675 |
3187707c-fa50-40a6-9c84-075727b48184 | puzcoin/puzcoin | src/pow.cpp | #include <math.h>
unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const Consensus::Params& params) {
const CBlockIndex *BlockLastSolved = pindexLast;
const CBlockIndex *BlockReading = pindexLast;
uint64_t PastBlocksMass = 0;
int64_t PastRateActualSeconds = 0;
int64_t PastRateTa... | ALGO | 0.999633 | 6.573234 |
9ace3898-19a3-47c2-89f0-7777553275bb | ishandutta2007/codeforces | oipotato/normal/1223/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define data dataa
#define rep(i,n) for(int i=1;i<=n;i++)
typedef long long LL;
int a[200010];
int main()
{
int T;
for(scanf("%d",&T);T--;)
{
int n;scanf("%d",&n);
printf("%d\n",max(n+(n&1),4)-n);
}
... | ALGO | 0.999773 | 3.772528 |
1b14b39e-ab7c-44ac-abf3-a8e651ed030c | ChuanqiXu9/clang-modules-converter | llvm/lib/Transforms/Scalar/GuardWidening.cpp | #include "llvm/Transforms/Scalar/GuardWidening.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/GuardUtils.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/MemorySSAUpdater.h"
#incl... | TOOL | 0.996005 | 7.970395 |
98e5bef1-d921-470f-8281-269568a36b27 | ishandutta2007/codeforces | mip182/normal/1562/D1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set... | ALGO | 0.99998 | 4.11482 |
ab286f49-ea3c-4278-9b92-0f95fa70f05b | Pushkar012345/Cpp-Complete-Course | tut19hb.cpp | //second example of function overloading:
#include<iostream>
using namespace std;
//volume of cube
int volume(int a){
return (a*a*a);
}
//now we will calculate colume of cylinder
int volume(double r,int h){
return (3.14*r*r*h);
}
//now we will calculate volume of rectangular
int volume(int l,int b,int h){
... | ALGO | 0.930217 | 4.694235 |
0a2a6fce-bc92-4ad5-9f92-8eec686ada3f | kingmacrobo/leetcode | C_plus_plus/Add_Binary.cpp | class Solution {
public:
string addBinary(string a, string b) {
int la = a.size() , lb = b.size();
int lenth = la > lb ? lb : la;
int carry = 0;
string result;
for(int i = 1 ; i <= lenth ; ++i){
result.insert(result.begin(),(a[la-i]-'0'+b[lb-i]-'0'+carry)%2+'0');
... | ALGO | 0.999978 | 6.370378 |
c469832a-fea3-452c-b23c-31ccdd81c898 | aashishpnt/cppassignmentsBEI076 | challenging/challenging_exercise_pointer_and_array.cpp | #include<iostream>
#include<string>
using namespace std;
void print_element(int element[], int c){ //prints element
if (c==0){
cout<<"No elements"<<endl;
}else{
for(int i=1;i<c;i++){
cout<<element[i-1]<<",";
}
cout<<element[c-1]<<endl;
}
}
void add_element(int element[], int &c){ //a... | TOOL | 0.8849 | 3.311776 |
dda28c0d-45e2-4560-88ef-50889ae03dc2 | bmnielsen/Locutus | Steamhammer/Source/BuildingManager.cpp | #include "Common.h"
#include "BuildingManager.h"
#include "Micro.h"
#include "ProductionManager.h"
#include "CombatCommander.h"
#include "ScoutManager.h"
#include "UnitUtil.h"
#include "PathFinding.h"
namespace { auto & bwemMap = BWEM::Map::Instance(); }
using namespace UAlbertaBot;
BuildingManager::BuildingManager(... | ALGO | 0.963059 | 4.060634 |
6fe2fb94-6e9a-465f-992d-91eb07c95877 | beeplovsharma/DSA-Reboot | DP/DP on Subsequences/16.Partition in two , Difference is Min/3_tabular.cpp | // Ques : Array ko do bhaag me baato, s1 & s2 --> sum of elements in first & second array's elements
// (s1-s2) must be minimum.
// Soln : Saare Subsequences me kisi ek ka bhi sum "K" yahan [K = totSum of array elem] ke barabar aajaye to "True" return krdo
// Chuki 2D Grid me last row me alag alag target ke T/F value s... | ALGO | 0.999954 | 5.134023 |
9269854f-cb8d-47b0-88f3-e4e6854d5cad | MorbanZarate/ZarateMorban_48102 | Hmwk/Assignment_4/Gaddis_7thEd_Chap5_Prob6_DistanceTraveled/main.cpp | /*
File: main
Author: Morban Zarate
Created on October 16, 2016, 11:47 PM
Purpose: making a program that will calculate distance traveled
*/
//System Libraries
#include <iostream> //Input/Output objects
using namespace std; //Name-space used in the System Library
//User Libraries
//Global Consta... | ALGO | 0.965442 | 4.267815 |
d3653467-6600-4add-9a59-d530fbfe38d9 | huangallen2008/cppcode | code/contest/AtCoder/ABC397/A.cpp | #include<bits/stdc++.h>
using namespace std;
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,sse4,bmi2,popcnt")
#define int long long
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define RREP1(i,n) for(int i=(n);i>=1... | ALGO | 0.999601 | 3.463785 |
5d9a7942-37d1-47e3-9f21-4f3af1d61122 | ishandutta2007/codeforces | sunset/normal/1392/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
int tt;
cin >> tt;
while (tt--) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
if (*max... | ALGO | 0.999265 | 4.313954 |
ff0ff7f2-b5c7-4304-9262-c8081db79d14 | iamrohit1/pcl | tools/train_linemod_template.cpp | #include <cmath>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/console/print.h>
#include <pcl/console/parse.h>
#include <pcl/console/time.h>
#include <pcl/PointIndices.h>
#include <pcl/ModelCoefficients.h>
#include <pcl/sample_consensus/method_types.h>
#include <pc... | DATA | 0.956348 | 6.838151 |
a926ebf2-be2f-486c-9807-c06124d071bc | florjete/Leetcode-problems | leetcode 1/String/findWordContainingChar.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> findWordsContaining(vector<string>& words, char x) {
vector<int> res;
for(int i =0; i< words.size(); ++i){
for(int j =0; j<words[i].length();++j){
if(x==words... | ALGO | 0.999746 | 6.152274 |
1f646327-9c9a-4d37-b10c-b2039979dde0 | wi11y71/code | CF-ABBC_or_BACB.cpp | //2023-09-23 20:37:35
//https://codeforces.com/contest/1873/problem/G
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T; cin>>T;
while(T--){
string s; cin>>s;
int tmp=0; vector<int> p;
for(aut... | ALGO | 0.999808 | 5.599084 |
1a60d1dd-7424-4cfe-96ef-82792ed33a42 | ssk4988/Coding | CSES/additionalproblems/stringremovals.cpp | #include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<ld, ld>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<ld>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using v... | ALGO | 0.999917 | 4.342389 |
26e2800d-ef07-46e5-9569-d5018abff613 | outsidecontext/openFrameworksPlayground | addonsOther/ofxBox2d/lib/Box2D/Dynamics/Contacts/b2TOISolver.cpp | #include "b2TOISolver.h"
#include "b2Contact.h"
#include "b2Body.h"
#include "b2Fixture.h"
#include "b2StackAllocator.h"
struct b2TOIConstraint
{
b2Vec2 localPoints[b2_maxManifoldPoints];
b2Vec2 localNormal;
b2Vec2 localPoint;
b2Manifold::Type type;
float32 radius;
int32 pointCount;
b2Body* bodyA;
b2Body* body... | ALGO | 0.999524 | 6.442758 |
ff6db20d-82fb-4c43-8b6e-8033a6d50dd9 | ACM-TOMS/CALGO | 1027/Original-Submission/Src/src/Algos/PSDMads/PSDMads.cpp | /*---------------------------------------------------------------------------------*/
/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct Search - */
/* */
/* NOMAD - Version 4 has been created by ... | ALGO | 0.999939 | 6.121659 |
cbfe9480-0fca-4594-9b7a-b83956ec48f4 | abhiatgithub/shogun-toolbox | src/shogun/lib/slep/overlapping/overlapping.cpp | #include <shogun/lib/slep/overlapping/overlapping.h>
#include <shogun/mathematics/Math.h>
#include <stdlib.h>
#include <string.h>
void identifySomeZeroEntries(double * u, int * zeroGroupFlag, int *entrySignFlag,
int *pp, int *gg,
double *v, double lambda1, double lambda2,
int p, int g, double * w, double *G){
... | ALGO | 0.999453 | 4.699389 |
add4cb11-979d-4ff6-ba2b-044416a7a88a | kazimahafuz/32647732-kazimahafuz-users.noreply.github.com | src/qt/guiutil.cpp | #include <QApplication>
#include "guiutil.h"
#include "bitcoinaddressvalidator.h"
#include "walletmodel.h"
#include "bitcoinunits.h"
#include "util.h"
#include "init.h"
#include <QDateTime>
#include <QDoubleValidator>
#include <QFont>
#include <QLineEdit>
#if QT_VERSION >= 0x050000
#include <QUrlQuery>
#else
#inclu... | TOOL | 0.873881 | 7.020602 |
05804c47-b7f0-4ceb-b286-d6964c314661 | Cole-Resetco/schoolWork-C9 | CS10/cs010_practice/labs/lab08/mathematics.cpp | // =============== BEGIN ASSESSMENT HEADER ================
/// @file mathematics.cpp
/// @brief assignment06/Mathematics
///
/// @author Cole Resetco [<EMAIL>]
/// @date March 1, 2015
///
/// @par Plagiarism Section
/// I hereby certify that I have not received assistance on this assignment,
/// or used code, from AN... | TOOL | 0.882494 | 4.024907 |
5abe5ab9-980d-48b9-92fd-7036fcc2b76c | rishikesh-03/lp5 | min_max.cpp | // g++ -fopenmp <name>.cpp -o output
// ./output
#include<iostream>
#include<omp.h>
#include<chrono>
using namespace std;
using namespace std :: chrono;
// ---------------------------sequential operations----------------------------
int seq_max_val(int arr[],int n){
int maxi = arr[0];
for (int i = 0; i < n;... | ALGO | 0.997715 | 5.72475 |
ff5dd43d-f81e-43a7-beaa-073ee9a780a7 | abdallahyassein-dev/ci_cd_example | 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 |
50e45f3e-e5f9-4f2a-9774-d7ee28336ec6 | PikaDinelia/LogikadanAlgoritma | Latihan2/3A.cpp | #include <conio.h>
#include <iostream>
using namespace std;
main() {
int p, l, r;
float hasil;
float LuasPersegiPanjang;
float LuasLingkaran;
cout <<"===program menentukan luas daerah diarsir===";
cout<<"\n\n";
cout <<"Masukan Panjang persegi panjang = "; cin>>p;
cout <<"Masukan Lebar persegi panjang = "; ci... | TOOL | 0.973787 | 3.091611 |
666e4250-f451-46f9-962f-ff0f0e3d9ef5 | Shubha012/DSA | LinkedList/Sum.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node *next;
}*first;
void create(int A[], int n){
Node *p,*q;
p = new Node;
first = p;
p->data = A[0];
p->next = NULL;
for(int i=1; i<n; i++){
q = new Node;
q ->data=A[i];
q->next=NULL;
... | ALGO | 0.99984 | 4.234686 |
290ca51b-4bb4-4509-be1c-b1ff7d9816d1 | xxzezeroxx/library | others/BinarySearch.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void use_bs(vector<int> &vec){
for (int key = 0; key <= 10; ++key) {
if (binary_search(vec.begin(), vec.end(), key)) {
cout << key << ": " << "found" << std::endl;
} else {
cout << key << ": " <<... | ALGO | 0.997103 | 4.358033 |
627b0c18-361c-4a6b-be55-a1e040e2dcfc | randbatch-md/lammps-rbe | src/REPLICA/temper_grem.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: David Stelter (BU)
------------------------------------------------------------------------- */
#include "temper_grem.h"
#include "compute.h"
#include "domain.h"
#include "error.h"
#include "finish.h... | ALGO | 0.969598 | 6.221704 |
9e69bb9f-8762-4835-93a3-4fcffe0bbd1a | RodneyBaker/opentoonz-code | toonz/sources/stdfx/igs_radial_blur.cpp | #include <vector> // std::vector
#include <cmath> // cos(),sin(),sqrt()
#include <limits> // std::numeric_limits<T>
#include <stdexcept> // std::domain_error()
#include "igs_ifx_common.h"
#include "igs_radial_blur.h"
namespace {
//------------------------------------------------------------------
template... | ALGO | 0.997259 | 5.125787 |
0b37afb3-4e4f-4587-969c-78bb3467445f | smyousuf14/C-_review | binarySearchTree.cpp | #include<iostream>
#include<string>
using namespace std;
class TreeNode{
public:
int value;
TreeNode* left;
TreeNode* right;
TreeNode(int v): value(v), left(nullptr), right(nullptr) {}
};
class BinarySearchTree{
public:
TreeNode* root;
... | ALGO | 0.99988 | 6.912711 |
430c3c53-c7a3-4276-b315-51159a06443a | jarvisye01/algorithm | leetcode_practice/20220811_454/solution.cpp | #include <stdio.h>
#include <map>
#include <vector>
using namespace std;
class Solution
{
public:
int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4)
{
int iRet = 0;
map<int, int> oMap;
for (int i = 0; i < nums1.size(); i++)
{
... | ALGO | 0.999821 | 5.86729 |
89226e0e-8bf8-430e-b257-c483610db1de | lidianxiang/learn_CPP | C++提升篇/STL/常用算法/常用查找算法/adjacent_find.cpp | #include<iostream>
using namespace std;
#include<algorithm>
#include<vector>
/*
功能:查找相邻重复的元素
函数原型:
adjacent_find(iterator_beg, iterator_end);
用以查找相邻重复的元素,返回相邻元素的第一个位置的迭代器
*/
void test01(){
vector<int> v;
v.push_back(0);
v.push_back(1);
v.push_back(2);
v.push_back(1);
v.push_back(3);
... | ALGO | 0.997741 | 4.104364 |
729fa79d-68f7-4132-ba4f-07d233cf7c39 | hebgehog/task1UP | task1UPCpp/task1UPCpp.cpp | #include <stdio.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <assert.h>
#include <algorithm>
using namespace std;
const int INF = 1e9;
struct edge
{
int x, y, cost;
bool prox;
};
int main()
{
int n;
cin >> n;
vector<int> sf(n);
for (int i = 0; i < n; i++)
{
scanf("%d", &sf[i]);
}
sor... | ALGO | 0.99986 | 3.67224 |
226ce28b-7250-45e6-a3b1-12a69bac34b3 | Philldomd/Advent_of_code_2019 | Adventure_of_code/dec_4.cpp | #include "dec_4.h"
SecureContainer::SecureContainer() {
char delim = '-';
ifstream InputFile;
InputFile.open("dec_4_input.txt");
getline(InputFile, rangeLow, delim);
getline(InputFile, rangeHigh, delim);
//rangeLow = "111122";
//rangeHigh = "111145";
}
bool SecureContainer::CheckDouble(string &test) {
constex... | ALGO | 0.996681 | 4.475318 |
3fe361d1-213d-46f4-9e83-db6fdb3f56d0 | algoboy101/note_blog_leetcode | delete/source/cpp/[1267]统计参与通信的服务器.cpp | //这里有一幅服务器分布图,服务器的位置标识在 m * n 的整数矩阵网格 grid 中,1 表示单元格上有服务器,0 表示没有。
//
// 如果两台服务器位于同一行或者同一列,我们就认为它们之间可以进行通信。
//
// 请你统计并返回能够与至少一台其他服务器进行通信的服务器的数量。
//
//
//
// 示例 1:
//
//
//
// 输入:grid = [[1,0],[0,1]]
//输出:0
//解释:没有一台服务器能与其他服务器进行通信。
//
// 示例 2:
//
//
//
// 输入:grid = [[1,0],[1,1]]
//输出:3
//解释:所有这些服务器都至少可以与一台别的服务器... | ALGO | 0.999964 | 6.712273 |
48e30657-6bb4-4aaa-842b-ffcf5a4f2eed | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/09/0913/personal_submission/cf336d_retyrn.cpp | Z cal(int n, int m, int u) {
if (n + m == 1) {
if (n == 1) return u == 0;
return u == 1;
}
// 计算为1的方案数
if (u == 0) return comb.binom(n + m, n) - cal(n, m, 1);
if (n == 0) return m == 1;
Z res = 0;
if (n - 1 >= 0) res += cal(n - 1, m, 0);
return res;
}
void solve() {
... | ALGO | 0.999902 | 5.071056 |
51b7988a-db37-4a28-9523-2bdd5254db72 | Nano1337/LeetCodePractice | 904-fruit-into-baskets/904-fruit-into-baskets.cpp | class Solution {
public:
int totalFruit(vector<int>& fruits) {
// make unordered map of <int, int> representing type: amount
std::unordered_map<int, int> m;
// make int totalLen for storing global max length
int totalLen = 0;
int l = 0, r = 0;
// while righ... | ALGO | 0.999912 | 6.313265 |
2c6f3505-f4b8-4e4a-9c37-79462ca2bea2 | rafid-mirza/hash-table | hashTable.cpp | /*
Rafid Mirza
rm2jgk
10/19/21
hashTable.cpp
*/
#include "hashTable.h"
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <math.h>
#include <string>
using namespace std;
unsigned int hashTable::newHash(string s){
int sum = 0;
for (int i = 0; i < s.length(); i++){
... | ALGO | 0.982184 | 4.316914 |
83229317-0f18-4f32-8dff-57fc34dd0dc5 | rsnemmen/Chombo | lib/src/EBAMRElliptic/DirichletViscousTensorDomainBC.cpp | #ifdef CH_LANG_CC
#endif
#include "BoxIterator.H"
#include "EBArith.H"
#include "DirichletViscousTensorDomainBC.H"
#include "TensorCFInterp.H"
#include "ViscousTensorOpF_F.H"
#include "EBViscousTensorOp.H"
#include "EBViscousTensorOpF_F.H"
#include "NamespaceHeader.H"
DirichletViscousTensorDomainBC::
DirichletVisco... | ALGO | 0.977109 | 6.341486 |
18421ac9-75d2-4981-9f47-15a0a99871c4 | jaigupta04/Leetcode | 73.cpp | #include <iostream>
#include <vector>
using namespace std;
void setZeros(vector<vector<int>>& matrix) {
int sizeRow = matrix.size();
int sizeCol = matrix[0].size();
vector<int> row(sizeRow, -1);
vector<int> col(sizeCol, -1);
for (int i = 0; i < sizeRow; i++) {
int count = 0;
for ... | ALGO | 0.999417 | 7.275113 |
c44ea7db-7ca8-4921-b03b-3c4cfaa2ab92 | dev-raj-kumar/CSES-Problem-Set-Solution | Graph Algorithms/21-Planets Cycles-(1751).cpp | //Problem Link :- https://cses.fi/problemset/task/1751
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base :: sync_with_stdio(0);
cin.tie(NULL);
int n,i,j,count,x;
cin >> n;
int arr[n+1];
bool used[n+1]={false};
long int succ[n+1]={0};
for(i=1;i<=n;i++){
cin >>... | ALGO | 0.999982 | 3.696688 |
103f3b15-3b23-4ce3-a9c1-0aaffb827b32 | Mulab11/cntt2016-hw1 | TC-SRM-557-div1-1000/xhk.cpp | // BEGIN CUT HERE
// END CUT HERE
#line 5 "XorAndSum.cpp"
#include<bits/stdc++.h>
using namespace std;
int n;
long long ans;
long long a[110],b[110];
class XorAndSum
{ public:
long long maxSum(vector<long long> number)
{ int i,j,k,flag;
long long s;
n=number.size();
for(i=1;i<=n;i++) a[i]=number[i-1];
m... | ALGO | 0.999911 | 4.771613 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.