uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2bd00e01-bbaa-46eb-b715-5ea922ef23fb | ishandutta2007/codeforces | yfzcsc/normal/925/A.cpp | #include<bits/stdc++.h>
using namespace std;
int n,m,q,cl,ce,v;
set<int>E,S;
int main(){
scanf("%d%d%d%d%d",&n,&m,&cl,&ce,&v);
for(int i=1,x;i<=cl;++i)scanf("%d",&x),S.insert(x);
for(int i=1,x;i<=ce;++i)scanf("%d",&x),E.insert(x);
scanf("%d",&q);
while(q--){
int x1,y1,x2,y2;
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
... | ALGO | 0.99993 | 3.761545 |
b59ae0fb-7ce9-4121-9510-dbd08880133d | ishandutta2007/codeforces | atreus/normal/115/A.cpp | #include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
using namespace std;
const int maxn = 2e3 + 500;
int a[maxn], dp[maxn];
bool mark[maxn];
int dfs(int x){
if (mark[x])
return dp[x];
if (a[x] == -1){
dp[x] = 1;
mark[x] = true;
... | ALGO | 0.999762 | 3.747648 |
8c41b3c5-5609-4248-a537-120584bbecc9 | zkEloHub/LC-SourceCode | lc230_3.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
// 定义额外的结点结构
class CNode
{
public:
int count; // 以该结点为根节点的子树的总结点数
CNode *left;
CNode *right;
int val;
CNode(in... | ALGO | 0.999993 | 6.003499 |
97a46771-07c8-41c1-acbe-55c7fdede3b1 | RajatRathore123-github/LowLevelDesign | All_patterns/Strategy.cpp | #include<iostream>
#include<memory>
#include<algorithm>
#include<string>
#include<string_view>
using namespace std;
class Strategy{
public:
virtual ~Strategy() = default;
virtual std::string doAlgorithm(std::string_view data) const = 0;
};
class Context{
private:
std::unique_ptr<Strategy> s... | ALGO | 0.993358 | 7.736648 |
715484dd-85ec-4737-8913-11160690fe8e | Next-Gen-UI/Hacktober | LoveBabbar/06_binary_trees/03_height_of_tree.cpp | /*
link: https://practice.geeksforgeeks.org/problems/height-of-binary-tree/1
sol: https://www.geeksforgeeks.org/write-a-c-program-to-find-the-maximum-depth-or-height-of-a-tree/
**note**: maximum depth of tree === height of the tree.
*/
// ------------------------------------------------------------------... | ALGO | 0.999919 | 6.172952 |
bcbd93eb-a5db-4468-98e4-aff28960718e | heemang2001/Sorting | Sorting/등수 매기기.cpp | #include <algorithm>
#include <vector>
#include <iostream>
#include <string>
using namespace std;
int N;
long long Answer;
int main()
{
cin >> N;
vector<long long> vecTemp;
for (int i = 0; i < N; i++)
{
long long nTemp;
cin >> nTemp;
vecTemp.push_back(nTemp);
}
sort(vecTemp.begin(), vecTemp.end());
... | ALGO | 0.999562 | 3.879914 |
aaf94928-d64e-4670-8a5f-f9f8bf265bdd | openvinotoolkit/openvino | src/plugins/intel_gpu/src/kernel_selector/kernels/cum_sum/cum_sum_kernel_partial_sum.cpp | #include "cum_sum_kernel_partial_sum.h"
#include "kernel_selector_utils.h"
#include <string>
#include <vector>
#include <iostream>
namespace kernel_selector {
static constexpr size_t simd = 16;
static constexpr size_t BLOCK_SIZE = 16;
ParamsKey CumSumKernelPartialSum::GetSupportedKey() const {
ParamsKey k;
k... | ALGO | 0.986717 | 7.139043 |
e8297ada-9ac0-43b3-95c9-4cd33469e73b | bmfatiur/Computer-Graphics | CODE/main.cpp | #include <GL/glut.h>
#include <iostream>
using namespace std;
// Define the clipping window (20, 80, 20, 80)
double xmin = 20, ymin = 20, xmax = 80, ymax = 80;
// Define region codes
const int INSIDE = 0; // 0000
const int LEFT = 1; // 0001
const int RIGHT = 2; // 0010
const int BOTTOM = 4; // 0100
const int ... | ALGO | 0.999786 | 5.988945 |
3027a36b-5961-49b2-8028-64e035fdad3e | lyh983012/seg-tracking-anything-demo | detectron2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cpu.cpp | namespace detectron2 {
template <typename T>
void box_iou_rotated_cpu_kernel(
const at::Tensor& boxes1,
const at::Tensor& boxes2,
at::Tensor& ious) {
auto num_boxes1 = boxes1.size(0);
auto num_boxes2 = boxes2.size(0);
for (int i = 0; i < num_boxes1; i++) {
for (int j = 0; j < num_boxes2; j++) {
... | ALGO | 0.992723 | 7.187095 |
b2c2929e-1d92-4f57-a384-653cefc8b127 | ShelpAm/competitive_programming | luogu/problem/P2669/main.cpp | #include <array>
#include <cmath>
#include <cstddef>
#include <iostream>
#include <ranges>
#include <vector>
using ::std::size_t;
// constexpr bool debug{false};
template<typename T> T read()
{
T tmp;
std::cin >> tmp;
return tmp;
}
template<typename value_t> class input_value {
public:
input_value(): value_(... | ALGO | 0.999672 | 4.220242 |
609ab7ff-853c-41a0-8a22-09fdaa174cd1 | Saurabhmishra1909/DSA | prime.cpp | #include <iostream>
using namespace std;
int main(){
cout<<"Enter a number"<<endl;
int n;
cin>>n;
int i;
for(i=2;i<n;i++){
if(n%i==0){
cout<<"Not Prime"<<endl;
break;
}
}
if(i==n){
cout<<"Prime"<<endl;
return 0;
}
}
| ALGO | 0.999616 | 3.522782 |
c203af7e-c6c6-4895-ab9f-4a73be14a3fc | eleusKUET/online-judge-solutions | UVa Online Judge/UVa 10453 - Make Palindrome.cpp | #include "bits/stdc++.h"
using namespace std;
const int N = 1005;
int dp[N][N];
string a;
int odd;
string path;
int solve(int u, int v)
{
if (u >= v) return 0;
int &ret = dp[u][v];
if (ret != -1) return ret;
if (a[u] == a[v]) ret = solve(u + 1, v - 1);
else ret = min(solve(u + 1, v) + 1, solve(u, ... | ALGO | 0.999994 | 4.85479 |
48b896a4-929e-4f3f-8460-4a68ce60f365 | PedroAngeli/Competitive-Programming | Solutions/Codeforces/CF-B/469.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int p,q,l,r;
cin >> p >> q >> l >> r;
vector <pair <int,int> > z(p);
for(int i=0;i<p;i++)
cin >> z[i].first >> z[i].second;
vector <pair <int,int> > x(q);
for(int i=... | ALGO | 0.999746 | 3.237988 |
4a336ba4-6b40-49ce-9a76-f0f34346a71a | Dantovisk/Programacao-Competitiva | GEMA/Tecnicas Avançadas/Sqrt decomposition/MinQueries.cpp | #include <bits/stdc++.h> // CSES - Dynamic Range Minimum Queries
//#define int long long
#define MAXN 200010
using namespace std;
int v[MAXN];
int buckets[1000];
const int inf = 1e9 + 3;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin>>n>>q;
// Tamanho d... | ALGO | 0.999888 | 4.485975 |
54781bec-5f25-464f-a0ba-ee9388576a42 | praveensonare/DesignProblems | VisitorPattern_AreaAndShape/source/MyUtils.cpp | #include "../include/MyUtils.h"
double CUtils::GetDistance(const Point& p_From, const Point& p_To)
{
int x = p_From.first - p_To.first;
int y = p_From.second - p_To.second;
double distance = sqrt(x*x + y*y);
return distance;
}
double CUtils::GetArea(const vector<Point>& p_Vertex)
{
if (p_Vertex.s... | TOOL | 0.973755 | 5.000115 |
97895536-1f45-4a61-8091-473895f6ffbe | iftikhoq/Phitron | cp/Week5/Day5/A_Min_Or_Sum.cpp | #include <bits/stdc++.h>
#define ll long long
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define f1(n) for(int i=0;i<n;i++)
#define f2(a,n) for(int i=a;i<n;i++)
#define vi vector <long long>
#define pb push_back
#define sp ... | ALGO | 0.999642 | 4.616426 |
e93ebf55-7bd6-4240-8684-8cf1bdc555a4 | Priyanshu4650/Daily-Problems-LeetCode | 1761-count-sorted-vowel-strings/count-sorted-vowel-strings.cpp | class Solution {
public:
int countVowelStrings(int n) {
vector<int> dp(5, 1);
while(n > 1) {
dp[3] += dp[4];
dp[2] += dp[3];
dp[1] += dp[2];
dp[0] += dp[1];
n -= 1;
}
int res = 0;
for(int i=0;i<5;i++) {
... | ALGO | 0.999937 | 6.581889 |
06b7d921-22c5-4d1b-86de-ebeaf60de641 | codetang-2417/LeetCode-with-Cpp | duplication/15. 3Sum/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using std::vector;
/*
* 15. 三数之和
*/
class Solution {
public:
vector<vector<int>> threeSum(vector<int> &nums) {
vector<vector<int>> ret;
std::sort(nums.begin(), nums.end());//排序,便于去除重复,以及寻找
int leftIndex, rightIndex;
for (... | ALGO | 0.999795 | 5.286734 |
946bf1ef-8ac4-4e9e-96e4-e53c724ce30b | NoobSolver/Contests | Other Problems/div3_2.cpp | #include<bits/stdc++.h>
typedef long long ll;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
const ll mod = (ll) 1e9+7;
using namespace std;
int main() {
IOS
#ifdef gm
freopen("int.txt", "r", stdin);
#endif
ll t;
cin >> t;
while (t--) {
ll ... | ALGO | 0.999978 | 3.534328 |
20a9df48-44d3-4b06-a127-82b16aa59955 | CRUSCAYA/Flutter_Clases | app_my_card/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.998483 | 6.76073 |
a2c5e581-01ee-48e3-8cf7-e8f564c0b0aa | VishalKumar8/100-Days-Of-Code | 2. C++ with DSA/D031/2. Reverse a Sentence using Stacks/1.cpp | #include <iostream>
#include <stack>
using namespace std;
// Hey, how are you doing?
// doing? you are how Hey,
// STL Full Form in C++ : Standard Template Library
void reverseSentence(string s)
{
stack<string> st;
for (int i = 0; i < s.length(); i++)
{
string word = "";
while (s[i] != '... | ALGO | 0.981764 | 4.849049 |
22a126eb-1e0b-4f03-baa4-8ca506cbc481 | heavenMOJANG/ICPC | programmes_C_Cpp/.history/test_20250724141234.cpp | #include <iostream>
#include <vector>
#include <cmath>
// 一个辅助函数,用于计算表示一个正整数所需的位数。
// 对于 N > 0,它等价于 floor(log2(N)) + 1。
int get_bit_length(int n) {
if (n == 0) return 0;
int count = 0;
long long temp = n;
while (temp > 0) {
temp >>= 1;
count++;
}
return count;
}
int main() {
... | ALGO | 0.999976 | 6.481139 |
6d5d7d0f-9eb1-4499-8b40-8de6f4039e94 | a3828162/LeetCode | 0021.MergedTwoSortedList.cpp | /**
* Definition for singly-linked list.
* 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) {}
* };
*/
class Solution {
public:
ListNode* mergeTwoLis... | ALGO | 0.99996 | 6.05722 |
58736543-be2d-4ff2-b098-146a738b8c92 | longhubk/Codefores-20192 | ThucHanh/ADD_FIN_2.cpp | #include <iostream>
using namespace std;
int main(){
unsigned long long a, b, c, a1, b1, c1, a0, b0, c0;
cin >> a >> b;
a1 = a / 10;
a0 = a % 10;
b1 = b / 10;
b0 = b % 10;
c1 = a0 + b0;
c0 = c1 % 10;
c = c1 / 10;
cout << (a1 + b1 + c)*10 + c0;
return 0;
} | ALGO | 0.99994 | 3.813512 |
5328c801-d277-4a15-a68e-0ace526fe863 | Harveen19/HackerRank-Solutions | C++/Virtual Functions.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Person {
public:
string name;
int age;
virtual void getdata() {
cin >> this->name >> this->age;
}
virtual void putdata() {
cout << this->name << " " << this->age ... | ALGO | 0.977853 | 3.388743 |
e23c4101-2d0d-47bf-a199-b1c1dc64c3df | yonyu/algorithms_cpp | LinkList/InsertionSort.cpp | #include "stdafx.h"
#include <cstdlib>
#include <vector>
#include <iostream>
#include "InsertionSort.h"
#include "CircularList.h"
namespace LinkList{
InsertionSort::InsertionSort()
{
}
InsertionSort::~InsertionSort()
{
}
// To accomplish the sort, it maintains two lists, an input (unsorted) list and an outp... | ALGO | 0.999966 | 4.616937 |
0488b532-95e2-4d1f-922d-802fa07e0272 | julianscheel/vlc-omx | modules/video_filter/atmo/AtmoOutputFilter.cpp | #ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include "AtmoOutputFilter.h"
CAtmoOutputFilter::CAtmoOutputFilter(CAtmoConfig *atmoConfig )
{
this->m_pAtmoConfig = atmoConfig;
this->m_percent_filter_output_old = NULL;
this->m_mean_filter_output_old = NULL;
this->m_mean_values = NULL;... | TOOL | 0.965889 | 5.490454 |
6ba5bab2-7fb4-4d91-84dc-5c375003acf9 | SunjidaAkter/assignments | algo/final/Make_Palindrome.cpp | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>pii;
#define ll long long
int main(){
int q;cin>>q;
while(q--){
string a,b;
cin>>a;b=a;
reverse(b.begin(),b.end());
int n=a.size(),m=b.size();
int dp[n+1][m+1];
for(int i=0;i<=n;i++){
fo... | ALGO | 0.999972 | 4.356387 |
3d972426-d923-4663-a579-d1b9ce8b12b3 | ReciHub/FunnyAlgorithms | Patterns/floyed's_triangle.cpp | #include <iostream>
#include <iomanip>
using namespace std;
// **************floyd's triangle************
int main()
{
int n, k = 1, j = 0, i = 0;
cout << "enter n" << endl;
cin >> n;
for (i = 1; i <= n; i++)
{
for (j = 1; j <= i; j++)
{
cout << k << " ";
k++;
}
... | ALGO | 0.999815 | 3.840976 |
b6b060e6-cd6c-4aef-a275-03cdc616bbe9 | ishandutta2007/codeforces | haj_lemon/normal/1017/A.cpp | #include<bits/stdc++.h>
using namespace std;
int a[100010],x,y,z,p,ans=1,n;
int main(){
cin>>n;
for (int i=1;i<=n;i++){cin>>x>>y>>z>>p;a[i]=x+y+z+p;}
for (int i=1;i<=n;i++) if (a[i]>a[1]) ans++;
cout<<ans<<endl;
return 0;
} | ALGO | 0.999637 | 3.161617 |
cf072a2b-cd69-405c-b32d-99fd57821755 | elishashami/bsc-ele-25-21 | lab6tasks/lab6task2.cpp | #include <iostream>
using namespace std;
int main() {
int rows, cols;
cout << "Enter the number of rows (max 3): ";
cin >> rows;
if (rows > 3) {
cout << "Number of rows cannot exceed 3. Exiting the program." << endl;
return 1;
}
cout << "Enter the number of columns (max 3): ";... | ALGO | 0.860526 | 4.275966 |
18c1ae5b-e27c-493f-9b23-12a743329e88 | codewith-Arif/Programming-with-C-plus-plus | CollegeWallahC++10Hours/Chapter_2_If__Elese/absoluteValue.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"enter n : ";
cin>>n;
// if(n>=0){
// cout<<n;
// }
// else{ // n<0
// cout<<-n;
// }
//if you want you change n into its absolut value.
if(n<0) n = -n;
cout<<n;
} | ALGO | 0.997704 | 3.013682 |
fef893ab-334b-492c-8ddd-3f1f2c05fdd9 | strongtiger-dev/Vairous_Strategies_HFT | strategies/kalman_filter/kalman_filter.cpp | /**
* Taken from https://github.com/hmartiro/kalman-cpp/blob/master/kalman.cpp
* Implementation of KalmanFilter class.
*
* @author: Hayk Martirosyan
* @date: 2014.11.15
*/
#include <iostream>
#include <stdexcept>
#include "kalman_filter.h"
KalmanFilter::KalmanFilter(
double dt,
const Eigen::MatrixXd& A,
... | ALGO | 0.929088 | 7.325542 |
f5411681-7ead-42ab-8787-4831c2310dbd | ishandutta2007/codeforces | hydro-bot1/normal/1714/E.cpp | // Hydro submission #62fe364e3731a6f56a42c9c5@1661004829787
#include<bits/stdc++.h>
using namespace std;
int a[200001];
int main(){
int t; cin>>t;
while(t--){
int n; cin>>n;
vector<int> b;
set<int> s;
for(int i=1;i<=n;i++){
cin>>a[i];
if(a[i]%10==5)b.push_... | ALGO | 0.9998 | 4.847545 |
2352bf41-a349-46c9-bf79-46872961faa4 | mcresap/ND | Classwork/AFS_Archive/volume_user.mcresap/cse20311/classnotes/array2.cpp | #include <iostream>
using namespace std;
int main() {
int a[5], sum=0;
cout << "enter 5 numbers: ";
for (int i=0; i<5; i++){
cin >> a[i];
sum+=a[i];
}
cout << "the sum is: " << sum << endl;
return 0;
}
| ALGO | 0.980038 | 3.060085 |
7ef68170-5700-4600-9f45-827e049a42af | JoSunJoo/BaekJoon | 별 찍기-14.cpp | #include<stdio.h>
/*
이 문제는 입력을 받은 수 만큼
ㅁ모양으로 출력하는 문제이다
*/
int main() {
int N; scanf("%d", &N);
for (int i = 1; i <= N; i++) {
for(int i=1; i<=N; i++) printf("*");
printf("\n");
}
return 0;
}
| ALGO | 0.999856 | 3.356428 |
18d7c52d-deda-4a27-aff6-4d1c0f8452a4 | sanjeevWeb/latest_gfg | Difficulty: Easy/Count Pairs whose sum is less than target/count-pairs-whose-sum-is-less-than-target.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int countPairs(vector<int> &arr, int target) {
// Your code here
std::sort(arr.begin(), arr.end());
// Step 2: Initialize pointers and the cou... | ALGO | 0.999506 | 6.728521 |
bd490486-4f37-4b85-ab7a-a1f24f85dd0e | ishandutta2007/codeforces | swistakk/normal/1368/A.cpp | #include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define int long long
#define st first
#define nd second
#define rd third
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define RE(i, n) FOR(i, 1, n)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, n) for(int i = 0;i <(n); ++i)... | ALGO | 0.999611 | 3.406165 |
f793e256-7773-4b76-a595-304f12a21643 | ishandutta2007/codeforces | kotamanegi/normal/1324/E.cpp | #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment (linker, "/STACK:526000000")
#include "bits/stdc++.h"
using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144
#defin... | ALGO | 0.999942 | 3.803334 |
4026cedf-d7c3-4013-a2f2-c6d47b21e6fa | biquando/p4c | midend/eliminateSwitch.cpp | #include "eliminateSwitch.h"
#include "frontends/p4/coreLibrary.h"
namespace P4 {
const IR::Node *DoEliminateSwitch::postorder(IR::P4Program *program) {
if (!exactNeeded) return program;
for (auto *obj : program->objects) {
if (auto *match_kind = obj->to<IR::Declaration_MatchKind>()) {
if... | TOOL | 0.946121 | 7.679572 |
cf53a81f-d3e4-4384-9c7d-80a671151136 | piaoyao424/vs2013 | opencv2.4.13/sources/samples/cpp/contours2.cpp | #include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <math.h>
#include <iostream>
using namespace cv;
using namespace std;
static void help()
{
cout
<< "\nThis program illustrates the use of findContours and drawContours\n"
<< "The original image is put up along with the ... | TOOL | 0.989935 | 4.539429 |
c32a5236-4863-4cb0-9325-9afa2d792c90 | wisdompeak/LeetCode | Others/1878.Get-Biggest-Three-Rhombus-Sums-in-a-Grid/1878.Get-Biggest-Three-Rhombus-Sums-in-a-Grid_v2.cpp | class Solution {
int presum1[100][100]; // "\"
int presum2[100][100]; // "/"
public:
vector<int> getBiggestThree(vector<vector<int>>& grid)
{
int m = grid.size(), n = grid[0].size();
for (int i=0; i<m; i++)
for (int j=0; j<n; j++)
pr... | ALGO | 0.999916 | 4.827808 |
c03af76b-3c57-4795-98db-041674c3f9d6 | archeos/micmac-archeos | src/photogram/phgr_epipole.cpp | #include "StdAfx.h"
/*************************************************/
/* */
/* EpipolaireCoordinate */
/* */
/*************************************************/
void EpipolaireCoordinate::HeriteChSca... | ALGO | 0.960548 | 5.295297 |
f011e67d-eba2-406f-bf47-b737c0dc4b53 | keijak/comp-pub | cf/contest/1559/E/ac.cpp | #include <bits/stdc++.h>
#define REP_(i, a_, b_, a, b, ...) \
for (int i = (a), END_##i = (b); i < END_##i; ++i)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(x) std::begin(x), std::end(x)
using i64 = long long;
#include <atcoder/convolution>
#include <atcoder/modint>
using Mint =... | ALGO | 0.999573 | 4.143487 |
6f36031e-fc48-4555-a614-8a083a252477 | chamow97/Interview-Prep | leetcode/134. Gas Station.cpp | class Solution {
public:
int canCompleteCircuit(vector<int>& gas, vector<int>& cost) {
// if sum of gas < sum of cost then not at all possible
if(accumulate(gas.begin(), gas.end(), 0) < accumulate(cost.begin(), cost.end(), 0)) {
return -1;
}
int currSum = 0, start = 0, to... | ALGO | 0.999984 | 5.942976 |
5273afec-213f-453f-b746-7a5d5417eacc | codenuri/CPPBASIC_V2 | SECTION1/lambda_expression1.cpp | #include <algorithm>
#include <print>
bool cmp(int a, int b) { return a > b; }
int main()
{
int x[5] = {1, 3, 5, 2, 4};
// std::sort(x, x + 5); // 1, 2, 3, 4, 5
// std::sort(x, x + 5, cmp); // 5, 4, 3, 2, 1
std::sort(x, x + 5,
[](int a, int b) { return a > b; } );
for(int i = 0; i < 5; i++)
std::println("... | ALGO | 0.999806 | 4.895484 |
efcfb3a7-ff69-4aa8-bd3a-89a31e3ddb64 | Tarushi-jain/Comet-Tracker | detector/HoughLinespDetector.cpp | #include <opencv2/core.hpp>
#include <opencv2/videoio.hpp> // videoio
#include <opencv2/highgui.hpp> // highgui
#include <opencv2/imgproc/imgproc.hpp>
#include "detector/HoughLinespDetector.h"
namespace uzanka {
namespace meteordetector {
/////////////////////////////////////////////////////////////////////////////... | ALGO | 0.944485 | 6.48845 |
b08bcfb4-e5ff-4f68-984d-58f9afcc8048 | dgcnz/competitive-programming | codeforces/1342A-road-to-zero.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll x, y, a, b;
ll solve(void)
{
ll ans = 0;
if (x < y)
swap(x, y);
if (y == 0 and x == 0)
return 0;
if (y == 0)
return a * x;
// 1. both equal
ans += a * (x - y);
x = y;
// 2. chose a or b... | ALGO | 0.999778 | 3.846514 |
f4eef75d-5967-4d87-b018-377d1cc27902 | gdgf/Data-Structure-Project | project8_池塘夜降彩虹雨/main.cpp | #include "graphics.h" //ͼο
#include <time.h> //
#include <conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<process.h> //߳
POINT point; //windowsԶĽṹ
HWND hwnd; //ھ
int sleeptime; //ʱ
//ڵṹ
typedef struct Rain
{
int x0, y0;//εʼλ
int x, y;//εֹλ
double step;//
CO... | TOOL | 0.942119 | 3.162041 |
79cf5507-3897-406b-a2d3-c75e54eda78b | Shlok2/DSA | Graphs/checkCycleUndirectedGraphBFS.cpp | #include <iostream>
#include <string.h>
#include <vector>
#include <queue>
using namespace std;
const int N = 1e5 + 2;
bool checkForCycle(int s, int n, vector<int> adj[], vector<int> &vis)
{
queue<pair<int, int>> q;
vis[s] = true;
q.push({s, -1});
while (!q.empty())
{
int node = q.front()... | ALGO | 0.999984 | 5.254195 |
1e954e06-31df-4108-b5cb-9f1c673154de | otherjlo/CS106B-Stanford-Solutions | Assignment3/0a-BinaryEncodingSolution/lib/StanfordCPPLib/lexicon.cpp | /*
* File: lexicon.cpp
* -----------------
* A Lexicon is a word list. This Lexicon is backed by a data
* structure called a prefix tree or trie ("try").
*
* This is a re-implementation of Lexicon. Its previous implementation used
* a pair of structures: a directed acyclic word graph (DAWG) and an STL set.
* T... | TOOL | 0.968254 | 7.100753 |
2ec5a88c-807c-40c7-9257-7533575b4e0f | tanaylab/metacells | metacells/correlate.cpp | #include "metacells/extensions.h"
#ifdef USE_AVX2
# include <immintrin.h>
#endif
namespace metacells {
struct Sums {
float64_t values;
float64_t squared;
};
template<typename F>
static Sums
sum_row_values(ConstArraySlice<F> input_row) {
const F* const input_data = input_row.begin();
const size_t ... | ALGO | 0.958932 | 6.958694 |
b38b6a72-a8ae-4c8d-b652-162815aaadcd | tuket/challenges | codejam/08/1C/a.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
int nn;
cin >> nn;
for(int kk=1; kk<=nn; kk++)
{
int P, K, L;
cin >> P >> K >> L;
vector<int> v(L);
for(int i=0; i<L; i++)
cin >> v[i];
... | ALGO | 0.999731 | 3.474822 |
dd7df5c0-f41e-4a17-b59b-7e2dcdcf7021 | malte0811/ProgPraktikum-TSP | HauptAufgabe/src/tests/two_matching_sim.cpp | #include <fstream>
#include <tsp_instance.hpp>
#include <two_matching_cut_gen.hpp>
#include <tsp_lp_data.hpp>
#include <linear_program.hpp>
int main() {
std::ifstream in("../instances/pcb442.tsp");
TSPInstance inst(in);
std::vector<double> sol(inst.getEdgeCount());
std::ifstream data("broken2matching.txt");
std::... | ALGO | 0.973007 | 5.054064 |
26de4833-6bb7-4431-ada5-2482102093a7 | LuxRender/Lux | shapes/cone.cpp | // cone.cpp*
#include "cone.h"
#include "paramset.h"
#include "dynload.h"
using namespace luxrays;
using namespace lux;
// Cone Method Definitions
Cone::Cone(const Transform &o2w, bool ro, const string &name,
float ht, float rad, float rad2, float tm)
: Shape(o2w, ro, name) {
if (rad2 > rad)
swap(rad,... | ALGO | 0.954067 | 7.493103 |
9a0fec78-5646-451a-9870-2237c6d35372 | wjex09/cpstuff | Math./POLYNOMIALS/stirling2ndkind.cpp | //ref - https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
//ref - https://codeforces.com/blog/entry/48603?#comment-326879
// Verification - https://codeforces.com/contest/961/submission/90281862
template<unsigned P> struct ModInt {
using M = ModInt;
unsigned v;
constexpr ModInt() : v(0) {}
cons... | ALGO | 0.999759 | 4.4665 |
b165c8f3-565a-457e-bad4-3a773dec243f | RiteshSahany/device_xiaomi_miatoll | libinit/libinit_utils.cpp | #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
#include <vector>
#include <libinit_utils.h>
void property_override(std::string prop, std::string value, bool add) {
auto pi = (prop_info *) __system_property_find(prop.c_str());
if (pi != nullptr) {
__system_propert... | TOOL | 0.883009 | 6.030682 |
167e7e29-8b6b-4d32-94c6-d40a97475c45 | watchpoints/weekly_book | 2023/leetcode/code/466.统计重复个数.cpp | /*
* @lc app=leetcode.cn id=466 lang=cpp
*
* [466] 统计重复个数
*/
// @lc code=start
class Solution {
public:
int getMaxRepetitions(string s1, int n1, string s2, int n2) {
}
};
// @lc code=end
| ALGO | 0.999742 | 5.865814 |
939ac9bf-904e-49e8-a436-09bc4736f6a5 | Vimarsh-Koul/Leet_Code | trains.cpp |
#include<bits/stdc++.h>
using namespace std;
bool train(pair<int,int> a, pair<int,int> b){
return a.second < b.second;
}
int main(){
int m,n;cin>>n>>m;
vector<pair<int,int>> trains[n+1];
for(int i=0;i<m;i++){
int platform;cin>>platform;
int arrival, dep; cin>>arrival>>dep;
trains[platform].push_back({arr... | ALGO | 0.999968 | 3.594185 |
9a800e85-54f4-4d80-aab1-d1cde8d9cadd | ivalkshfoeif/Acwing_CPP_Basic | lecture3/711.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
for (int i = 1; i <= 10; i++){
printf("%d x %d = %d\n", i, n, i * n);
}
return 0;
} | ALGO | 0.999012 | 3.664674 |
546be887-ce90-4ed5-9975-b5840ec4bd8a | Wanger-SJTU/leetcode-solutions | cpp/46.全排列.cpp | /*
* @lc app=leetcode.cn id=46 lang=cpp
*
* [46] 全排列
*/
#include "leetcode.h"
// @lc code=start
class Solution
{
public:
vector<vector<int>> permute(vector<int> &nums)
{
vector<vector<int>> res;
vector<int> cur;
permute_helper(nums, cur, res);
return res;
}
private:
void permute_helper(vect... | ALGO | 0.999921 | 6.656172 |
260a9f01-19ac-443c-a25a-1b6e6a4ea688 | Cherrytree56567/RTEngine | src/Sphere/Sphere.cpp | #include "Sphere.h"
sphere::sphere(const point3& static_center, double radius, shared_ptr<material> mat) : center(static_center, vec3(0,0,0)), radius(std::fmax(0,radius)), mat(mat) {
auto rvec = vec3(radius, radius, radius);
bbox = aabb(static_center - rvec, static_center + rvec);
}
sphere::sphere(const point... | ALGO | 0.944906 | 6.910781 |
507aa2c3-b442-4bc1-9dac-96800afce9ce | USECAP/dream-ida | IntermediateRepresentation/SSA/BackTranslation/SSABackTranslator.cpp | ables->end() ; ++phiVar_iter){
// unresolvedNeighborMap[*phiVar_iter].clear();
// }
//}
//
//
//std::set<Variable>* SSABackTranslator::getLiveInSetAtDefiningBlocks(Phi_Function* phiFunction, Variable* phiVariable){
// std::set<Variable>* liveIn = new std::set<Variable>();
// std::set<int> definingBlocksId = phiFunctio... | ALGO | 0.896095 | 3.605908 |
5523bb37-4904-4998-bc4a-23d73d248264 | has2/Problem-Solving | boj-solved.ac/Gold2/1561.cpp | #include <cstdio>
using ll = long long;
ll mxT = 2e11;
int N,M,a[10000],ans;
int check(ll t){
int ret = -1;
ll lo = 0,hi;
if(t>0){
for(int i=0;i<M;i++){
lo += (t-1)/a[i]+1;
}
}
hi = lo;
for(int i=0;i<M;i++){
hi += t%a[i]==0;
if(hi==N){
ret... | ALGO | 0.999995 | 3.839107 |
5cb9efdd-993a-4e81-b583-754c235648cf | C0ldSmi1e/CompetitiveProgramming | Files/算法竞赛入门经典代码/ch9/UVa1626slow.cpp | // LA2451 Brackets Sequence
// Rujia Liu
// 算法:形如(S)或者[S],转移到d(S),然后分成AB,转移到d(A)+d(B)。注意(S, [S, )S之类全部属于第二种转移。
// 注意输入有空行。
// 本程序是记忆化解法,速度较慢,处于超时的边缘
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 100 + 5;
char S[maxn];
int n, d[maxn][maxn];
bool match(char a, char b) {
... | ALGO | 0.999395 | 4.097048 |
5f2d36d7-de7c-45ea-9eb5-9af5a1882643 | wanghyu/leetcode | editor/cn/637-AverageOfLevelsInBinaryTree.cpp | //Given the root of a binary tree, return the average value of the nodes on
//each level in the form of an array. Answers within 10⁻⁵ of the actual answer will
//be accepted.
//
//
// Example 1:
//
//
//Input: root = [3,9,20,null,null,15,7]
//Output: [3.00000,14.50000,11.00000]
//Explanation: The average value of... | ALGO | 0.999858 | 7.027325 |
cf606408-1f7d-4d6d-ac3f-3d70f6e4e6d4 | GitHub-LYY/interestingresources | datastructure/stackandqueue/mst59-2.cpp | /*
** Author: Yangyang Liu
** Date: 2022-09-22
** Description: 面试题59 - II. 队列的最大值
** link: https://leetcode.cn/problems/dui-lie-de-zui-da-zhi-lcof/
** reference:
*/
#include <iostream>
using namespace std;
class MaxQueue {
private:
queue<int> que;
deque<int> dque; // 单调队列
public:
MaxQueue() {
}
... | ALGO | 0.999794 | 5.388311 |
56b2f1af-fb6c-414f-9c06-99e268979ed2 | gifhuppp/winget-cli-2 | src/cpprestsdk/cpprestsdk/Release/src/utilities/asyncrt_utils.cpp | #include "stdafx.h"
#include <algorithm>
#include <cpprest/asyncrt_utils.h>
#include <stdexcept>
#include <string>
#include <time.h>
using namespace web;
using namespace utility;
using namespace utility::conversions;
namespace
{
struct to_lower_ch_impl
{
char operator()(char c) const CPPREST_NOEXCEPT
{
... | TOOL | 0.85565 | 6.704083 |
4924cf7f-8fb2-475d-8490-c789cf35308d | uthman-khan/Class_work | multiplication.cpp | #include<iostream>
using namespace std;
int main()
{
for(int i=1;i<6;i++)
{
for(int j=1;j<11;j++){
cout<<i<<" * "<<j<<" = "<<i*j<<endl;
}
cout<<endl;
}
} | ALGO | 0.975641 | 3.85958 |
75cc956d-f555-489c-8ed1-a96b36374f95 | RUND0WN75/CSCI176-Parallel-Processing-FRESNO-STATE | Term Project/svd_house_db_sequential.cpp |
/////////////////////////////////////////////////////////////////////////////////////////////
//
// Description: This program performs a Singular Value Decomposition of an n x m matrix.
// these matrices have the added condition that the n >= m at the moment.
// To perform this decomp, it... | ALGO | 0.999937 | 5.244717 |
6fa9148b-8ae4-4af1-b6af-a01c767500c7 | b-jatin/Leetcode | 416-partition-equal-subset-sum/partition-equal-subset-sum.cpp | class Solution {
public:
bool subset(int T, vector<int>& nums){
int n=nums.size();
vector<vector<bool>> dp(n+1,vector<bool>(T+1,false));
for(int i=0;i<=n;i++){
dp[i][0]=true;
}
for(int i=1;i<=n;i++)
for(int j=1;j<=T;j++){
if(nums[i-1]<=j){
... | ALGO | 0.999961 | 6.022756 |
f098e774-4d8b-4665-92c7-10af63f75fbf | MAZHARMIK/Interview_DS_Algo | DP/DP on Grids/Count Square Submatrices with All Ones.cpp | /* Scroll below to see JAVA code also */
/*
MY YOUTUBE VIDEO ON THIS Qn : https://www.youtube.com/watch?v=y3kdowdyNMM
Company Tags : Flipkart
Leetcode Link : https://leetcode.com/problems/count-square-submatrices-with-all-ones
*/
/****************************************... | ALGO | 0.999745 | 4.026833 |
67ae39c6-10e6-41e6-a1b3-81b207a563e3 | mohitbabani/CP-Probelm-Solutions | Contests/cf 760/omg.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long
#define pii pair<ll,ll>
#define ld long double
#define pb push_back
#define ull unsigned long long
const ll inf = LLONG_MAX;
#define all(vec) vec.begin(),vec.end()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fr(i,b,a) for(ll i=b;i>=0;i--)
#define IOS ios_ba... | ALGO | 0.999993 | 3.375403 |
cddac2bc-02a5-4e48-85cc-748cb9d7e071 | ChromesDuzez/GameOfFifteen | GameOfFifteen/libraries/boost_1_81_0/libs/graph/example/dfs.cpp | #include <vector>
#include <algorithm>
#include <utility>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/depth_first_search.hpp>
#include <boost/graph/visitors.hpp>
/*
This calculates the discover finishing time.
Sample Output
Tree edge: 0 --> 2
Tree edge: 2 --> 1
Back edge: 1 --> 1
Fin... | ALGO | 0.999698 | 5.209993 |
f39bc7ea-0ebc-41e8-b795-03d2f00f983e | BartekGortat/competitive-programming | uva/00230_borrowers.cpp | // https://onlinejudge.org/external/2/230.pdf
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
struct book_t
{
string author;
string title;
bool lent;
};
bool compare(const book_t &left, const book_t &right)
{
auto result = left.author... | ALGO | 0.998745 | 4.473938 |
a0244a0e-7c8d-4030-a819-de07e8e9238e | yymin1022/Algorithm_Study | BOJ/25496.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(NULL);
cout.tie(NULL);
ios_base::sync_with_stdio(false);
int P, N;
cin >> P >> N;
vector<int> arr;
for(int i = 0; i < N; i++){
int input;
cin >> input;
arr.push_back(input);
}
sort(arr.beg... | ALGO | 0.999919 | 3.643835 |
01842b21-9103-4a77-867e-439f3975d6eb | novostary/codes | LeetCode/Linked List/remove-duplicates-from-sorted-list-ii.cpp | #include <iostream>
// Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
// Runtime: 8 ms
// 1 1 2
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
if (head == NULL || head->next == NULL) {
return head;
}
ListNode ... | ALGO | 0.999932 | 5.628546 |
7e7fd9bd-283b-4de0-ac47-65957053597b | annadanylevych/CPP | module09/ex02/main.cpp | #include "PmergeMe.hpp"
int main(int argc, char **argv)
{
if (argc == 1)
{
std::cerr << "Error: no parameters given" << std::endl;
return (1);
}
try
{
std::list<int> myList = convert<std::list<int> >(argc, argv);
std::cout << "LIST Before: ";
printArr(myList)... | ALGO | 0.908608 | 5.093694 |
8a089afd-f7bd-4045-9d74-e2c587eaccbe | NabeelA-Cyber/programming-projects | New folder (14)/Alkhatib_HW30.cpp | #include <iostream>
using namespace std;
int stringLength(char *str);
int stringWord(char *str);
const int SIZE = 80;
int main()
{
int lstr,wstr;
char line[SIZE];
cout << "Input a string 80 characters or less: ";
cin.getline(line,SIZE);
lstr = stringLength(line);
cout << "The length of the string is:" << lstr... | ALGO | 0.98129 | 4.161709 |
e4b5e25f-a97a-490a-8e39-e3b4a6f532c8 | huangallen2008/cppcode | code/AAhomework/Level4/SPOJ_ONEZERO.cpp | #include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#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;i--)
#define f first
#define s second
#define pb push_back
#define... | ALGO | 0.999943 | 5.019293 |
aa4ef853-9c88-473d-b6f0-0adc04b41cc7 | DrSwad/CP | Submissions/Varsity/2021/Dept Individual Contest/1/brute.cpp | #include <bits/stdc++.h>
using namespace std;
int count_palindrome_substrings(string s) {
int n = s.length();
int ret = 0;
for (int i = 0; i < n; i++) {
ret++;
for (int l = i - 1, r = i + 1; l >= 0 and r < n and s[l] == s[r]; l--, r++) {
ret++;
}
for (int l = i, r = i + 1; l >= 0 and r < n... | ALGO | 0.999966 | 4.944849 |
d4bd59ae-6638-4778-b4ca-fa00db7390b1 | moonwarnishan/CodeForces1 | 1542A.cpp | #include<iostream>
using namespace std;
int main()
{
int i,j,k,l,one,two;
cin>>j;
for(i=0;i<j;i++){
cin>>k;
int even=0, odd=0;
for(l=0;l<k;l++){
cin>>one>>two;
if(one%2==0){
even++;
}
else{
odd++;
... | ALGO | 0.999846 | 3.306423 |
3d57673d-355b-4a6c-af74-43c763a172fd | NaVIn69/AlgoZenith_DSA | dp1/Knapsack.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
int n,w;
int weight[10001];
int value[10001];
int taken[10001];
int check(int level){
int sum_wt=0;
for(int i=0;i<level;i++){
if(taken[i]){
sum_wt+=weight[i];
}
}
sum_wt+=weight[level];
if(sum_wt<=w) return 1;
... | ALGO | 0.999998 | 4.501154 |
3e5fec10-a579-459b-b0e0-ea1d4dcc5ff2 | nisan24/XPSC_Batch_04 | Problems/Week_06/Day - 02/D_Scuza.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define yes cout << "YES" \
<< "\n"
#define no cout << "NO" \
<< "\n"
#define pi pair<int, int>
#define vi vector<ll>
#define nl "\n"
#define nnl cout << "\n"
int main(int argc, char const *argv[])
{
ios::sync_w... | ALGO | 0.99995 | 3.992686 |
345c0336-9b28-4f88-a8a6-60c5256048fe | blacksea3/leetcode | cpp/leetcode/1035. uncrossed-lines.cpp | #include "public.h"
//16ms, 92.07%
//dp
//dp[i][j]: A[0]A[i-1], B[0][j-1]
//dp[0][?] = 0, dp[?][0] = 0
class Solution {
public:
int maxUncrossedLines(vector<int>& A, vector<int>& B) {
//vector<vector<int>> dp(A.size() + 1, vector<int>(B.size() + 1, 0));
int** dp = new int* [A.size()+1];
for (int i = 0; i <= A... | ALGO | 0.99997 | 5.962423 |
b07a1169-6c7c-43b0-a050-8d41dc4209d4 | tushar54594/LeetcodeQuestions | 0373-find-k-pairs-with-smallest-sums/0373-find-k-pairs-with-smallest-sums.cpp | class Solution {
public:
vector<vector<int>> kSmallestPairs(vector<int>& nums1, vector<int>& nums2, int k) {
vector<vector<int>> ans;
priority_queue<pair<int, pair<int,int>>> pq;
for(int i=0; i<nums1.size(); i++){
for(int j=0; j<nums2.size(); j++){
... | ALGO | 0.999992 | 5.959749 |
15b5b504-70a8-460a-9007-9003347264db | mshirbini/problem-solving-cpp | src/codeforces/d2/a/pangram.cpp | /// https://codeforces.com/contest/520/problem/A
#include <iostream>
#include <unordered_set>
#include <cctype>
using namespace std;
int main(){
int n;
char c;
unordered_set<char> s;
cin >> n;
if (n < 26) cout << "NO";
else {
for (int i = 0; i < n; i++) {
cin>>c;
... | ALGO | 0.999542 | 4.370578 |
d82448ac-9720-4795-be43-1cda4c4b68d1 | Nwon2464/cpp | math-1200/e.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#... | ALGO | 0.999762 | 5.508318 |
cc9e1381-bc36-4ff6-80c1-dd244846530f | nikita-1910/DSA-450 | find_maximum_sum_possible_equal_sum_of_three_stacks.cpp | #include <bits/stdc++.h>
using namespace std;
int maxSum(int stack1[], int stack2[], int stack3[], int n1, int n2, int n3){
int sum1=0, sum2=0, sum3=0;
for (int i=0; i<n1; i++)
sum1+=stack1[i];
for (int i=0; i<n2; i++)
sum2+=stack2[i];
for (int i=0; i<n3; i++)
sum3+=stack3[i];
int top1=0, top2=0, top3=0;
wh... | ALGO | 0.999922 | 3.669032 |
c68bb011-e953-4ab6-a620-1d8449ec5d5c | wm-kim/Problem_Solving | PS/Project1/Jongman/완전탐색/6.7.cpp | // 여행하는 외판원 완전탐색
// 한 도시에서 출발해 다른 도시를 모두 방문 후 돌아올 때 가장 짧은 경로
#include <vector>
using namespace std;
const int MAX = 100;
const int INF = 987654321;
int n;
double dist[MAX][MAX];
double shortestPath(vector<int>& path, vector<bool>& visited, double currentLength) {
if (path.size() == n)
return currentLength + dist[pa... | ALGO | 0.99976 | 3.608254 |
c79ef8aa-4e38-4d6e-9987-2af9ccae5377 | sarvex/leetcode-skip | solution/1500-1599/1503.Last Moment Before All Ants Fall Out of a Plank/Solution.cpp | class Solution {
public:
int getLastMoment(int n, vector<int>& left, vector<int>& right) {
int ans = 0;
for (int& x : left) {
ans = max(ans, x);
}
for (int& x : right) {
ans = max(ans, n - x);
}
return ans;
}
}; | ALGO | 0.999962 | 5.858149 |
9b6784e7-e416-4e7f-a17c-beae8eefda9b | JeanDiable/SLAM14 | ch7/triangulation.cpp | #include <iostream>
#include <opencv2/opencv.hpp>
// #include "extra.h" // used in opencv2
using namespace std;
using namespace cv;
void find_feature_matches(
const Mat &img_1, const Mat &img_2,
std::vector<KeyPoint> &keypoints_1,
std::vector<KeyPoint> &keypoints_2,
std::vector<DMatch> &matches);
void pose_es... | ALGO | 0.997445 | 5.576034 |
304ea48c-f32e-49cf-ade1-b05642738b40 | xiewende/CPlusPlus_Algorithm | array/Offer-0107.cpp | // 面试题 01.07. 旋转矩阵
// 解题思路 找规律
// 1、起点【i,j】 旋转90°在【j,n-i-1】再旋转90°在【n-i-1,n-j-1】再旋转90°在【n-j-1,i】
// 这四个点,若旋转90°,需要互相取代其位置
// 2、上下镜像交换值 再 对角线交换值 得到最终结果
#include<iostream>
#include<vector>
using namespace std;
void rotate(vector<vector<int>>& matrix) {
int n = matrix.size();
//遍历左上角的值,依次替换四个位置即可
for (i... | ALGO | 0.999967 | 5.843006 |
f8c84bab-05b8-45d5-8899-454301785177 | sarvex/leetcode-chicken | solution/2500-2599/2580.Count Ways to Group Overlapping Ranges/Solution.cpp | class Solution {
public:
int countWays(vector<vector<int>>& ranges) {
sort(ranges.begin(), ranges.end());
int cnt = 0, mx = -1;
for (auto& e : ranges) {
cnt += e[0] > mx;
mx = max(mx, e[1]);
}
return qmi(2, cnt, 1e9 + 7);
}
int qmi(long a, lon... | ALGO | 0.999926 | 6.019855 |
afaa854f-4682-4d57-bff9-db26aa6ef031 | SWEG-2015EC-Batch/Felix | ETS1065_15_Natnael_Samson/Bmi_calculator/BMI_calculator.cpp | //This Program Is used To Calculate A persons Body Mass Index
#include <iostream>
using namespace std;
int main () {
cout << " BMI Calculator " << endl;
cout << "===========================" << endl;
cout << "Please enter your weight in kilograms: ";
double body_weight {0};
cin >> body_wei... | TOOL | 0.96752 | 3.890631 |
26735cde-7627-42c5-b62e-7c1acd9705c8 | x772104/PTA_Exercises | L1_039.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
string str;
cin >> N;
cin.ignore(100, '\n');
getline(cin, str);
int l = str.length();
int j, i = (N - (l % N)) % N;
for (; i > 0; i--)//补空格
str[l++] = ' ';
str[l] = '\0';
for (j = 0; j < N; j++)
{
... | ALGO | 0.999913 | 3.159544 |
2b1d19f9-a00f-444e-8a5d-d778d9238b54 | VinayRana5674/MyProrammingWrok | cout.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
getline(cin,s);
int l=s.length();
if(toupper(s[0])!=s[0])
s[0]=toupper(s[0]);
for(int i=0;i<l;i++)
{
if(s[i]==' ')
{
s[i+1]=toupper(s[i+1]);
}
cout<<s[i];
}
}
| ALGO | 0.999879 | 3.932542 |
091479c0-4244-4134-825e-f24247138857 | linkon63/programming_DSA_problem_solving | 1 Data Structure/Week 6/Module 22/2.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
//Stack
stack<int> st;
//push O(1)
st.push(10);
st.push(20);
st.push(30);
//size O(1)
cout<<"Stack size : "<<st.size()<<"\n";
//top O(1)
cout<<st.top()<<"\n";
//pop O(1)
st.pop();
cout<<st.top()<<"\n";
... | ALGO | 0.952555 | 4.76665 |
c4719014-17eb-46bf-8a34-a6c4601d187f | Gnaroshi/practice-algorithm-solvedac | With_Levels/Bronze/Bronze_2/4118.cpp | // problem: Fred’s Lotto Tickets
// id: 4118
// time taken:
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, t;
while (true)
{
cin >> n;
if (!n)
break;
bool chk = true;
bool cnt[49] = {fa... | ALGO | 0.99975 | 4.324425 |
d1e46ba7-d257-44c1-914b-765c00cfd5f1 | Tphuong612/Cplusplus_ptit | danh sach doanh nghiep nhan thuc tap sinh 2.cpp | #include <bits/stdc++.h>
using namespace std;
class DoanhNghiep {
public:
string ma, ten;
int sluong;
friend istream &operator >> (istream &is, DoanhNghiep &a) {
scanf("\n");
getline(cin, a.ma);
getline(cin, a.ten);
cin >> a.sluong;
return is;
}
friend ostr... | ALGO | 0.99989 | 4.193316 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.