uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a0419b8e-5433-49fd-b5a1-6c1c46ef7b43 | jekrami/wc-2.5.0 | src/Zcash/Signer.cpp | #include "Signer.h"
#include "Bitcoin/TransactionSigner.h"
#include "Hash.h"
#include "HexCoding.h"
#include "Transaction.h"
#include "TransactionBuilder.h"
using namespace TW;
using namespace TW::Zcash;
TransactionPlan Signer::plan(const SigningInput& input) noexcept {
auto signer = Bitcoin::TransactionSigner<Tr... | TOOL | 0.851608 | 6.86159 |
8ab7b0bd-2e9f-42a3-9a1a-10d12d0e07cf | cecilianor/Qt-thesis | lib/Rendering_Math.cpp | #include "Rendering.h"
/*!
* \brief Bach::lonLatToWorldNormCoord converts longitude and latitude to world-normalized coordinates.
*
* Takes radians, not degrees.
* The math formula employed is described by the figure in the report with the caption
* "Converting longitude and latitude to world-normalized coordinat... | TOOL | 0.958719 | 7.013462 |
326dba06-9fd6-4934-950f-9aa4fce894cb | Vinniellf/Competitive-Programming | LCA/k.cpp | #include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define cases ll T=0;cin>>T;while(T--)
#define rep(i,n) for (int i = 0; i < n; ++i)
#define pb push_back
#define fill(x,v) memset(x,v,sizeof(x))
#define all(v) (v).begin(),(v).end()
#define PI 3.14159265359
... | ALGO | 0.998458 | 4.124622 |
87c47f33-61ef-4e1d-a0c4-975109d0571c | alecstem/project_euler | solutions/010.cpp | #include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
const int MAX_PR = 2'999'999;
bitset<MAX_PR> isprime;
vector<int> eratosthenesSieve(int lim) {
isprime.set(); isprime[0] = isprime[1] = 0;
for (int i = 4; i < lim; i += 2) isprime[i] = 0;
for (int i = 3; i*i < lim; i ... | ALGO | 0.999465 | 4.299624 |
8c5b57ec-3300-45a7-a004-6f063948a09d | adembix/Programming-With-CPP | Algorithms-Problem-Solving-With-CPP/ProgrammingAdvices/Algorithms & Problem-Solving Level 4/DaysHoursMinutesOfYear.cpp | #include<iostream>
using namespace std;
short ReadNum()
{
short N = 0;
cout << "Enter a Year: ";
cin >> N;
return N;
}
bool IsLeapYear(short N)
{
return (N % 4 == 0 && N % 100 != 0) || (N % 400 == 0);
}
short DaysInYear(short N)
{
return IsLeapYear(N) ? 366 : 365;
}
short HoursInYear(short N)
{
return Days... | ALGO | 0.886858 | 3.267751 |
0b909a3e-37e7-433d-90dd-2b9803052afe | AjaySingh470/LeetCode-Questions | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlin... | class Solution {
public:
int check(int mid,int n,vector<int> &temp)
{
for(auto it : temp)
{
n -= it/mid;
if(it%mid)
{
n--;
}
}
return n >= 0;
}
int minimizedMaximum(int n, vector<int>& quant... | ALGO | 0.999982 | 5.802353 |
e02d986e-c4dd-430e-9667-8110c574e608 | goldmidas/goldmidas | src/hash.cpp | #include "hash.h"
inline uint32_t ROTL32 ( uint32_t x, int8_t r )
{
return (x << r) | (x >> (32 - r));
}
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char>& vDataToHash)
{
// The following is MurmurHash3 (x86_32), see http://code.google.com/p/smhasher/source/browse/trunk/MurmurH... | ALGO | 0.987614 | 6.221465 |
a81b16c6-9bed-4759-9d5c-af36177f616d | vrangr1/competitive-programming | contests/codeforces/edu_rounds/edu_round_1--/edu_round_159_div2/c.cpp | /***************************************************
* Author : Anav Prasad
* Nick : vrangr
* Created : Sun Dec 3 20:16:49 IST 2023
****************************************************/
#include <iostream>
#include <vector>
#include <string.h>
#include <ctype.h>
#include <set>
#include <stdlib.h>
#include <map>
#i... | ALGO | 0.99995 | 3.881627 |
87432ae6-a93b-4b4b-9322-6383c02eb180 | ShowravKormokar/CPP-Program-Practice | loopProgram/countingNumber.cpp | #include <iostream>
#include <cmath>
using namespace std;
main()
{
int num, count = 0;
cout << "Enter any integer: ";
cin >> num;
while (num != 0)
{
num /= 10;
count++;
}
cout << "Total number of digits " << count << endl;
} | ALGO | 0.997697 | 4.04733 |
9ca70c58-6c8b-46af-abc2-46909bfcee0a | TheVinaySagar/Leetcode | 0207-course-schedule/0207-course-schedule.cpp | class Solution {
public:
bool canFinish(int n, vector<vector<int>>& p) {
vector<vector<int>> adj(n,vector<int> ());
for(auto it:p)
adj[it[0]].push_back(it[1]);
vector<int> indgr(n,0);
for(int i=0;i<n;i++)
{
for(auto it:adj[i])
{
... | ALGO | 0.999915 | 6.192287 |
8b46a2cd-7141-476c-9fb2-e980eb7dbf3d | RedaElmahdy/problem-Solving | C++_Problems/level_two/110 - Sub-array_elements_sum.cpp | /*
Given an array (or list or vector) of arrays (or, guess what, lists or vectors) of integers, your goal is to return the sum of a specific set of numbers, starting with elements whose position is equal to the main array length and going down by one at each step.
Say for example the parent array (etc, etc) has 3 sub-... | ALGO | 0.998651 | 6.696613 |
9146c587-4ccc-4ff4-bbbd-df0c0845f588 | nikhilesh-03/Data_Structures_and_Algorithms_Codes | fifo.cpp | #include <iostream>
using namespace std;
#define Max 6
class circular_queue
{
int front, rear;
public:
int count = 0;
int queue[Max];
circular_queue() { front = -1, rear = -1; }
bool queueisempty();
void enqueue(int x);
void dequeue();
bool isqueuefull();
void front_of_queue();
... | ALGO | 0.996888 | 4.281292 |
c0d4411e-272f-4374-8683-a8882971677f | FengISU/DEM_project | src/random_mars.cpp | // Marsaglia random number generator
// see RANMAR in F James, Comp Phys Comm, 60, 329 (1990)
#include "math.h"
#include "random_mars.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
RanMars::RanMars(LAMMPS *lmp, int seed) : Pointers(lmp)
... | ALGO | 0.998307 | 6.520583 |
42d9dc00-25b0-449f-9463-065fb20e3496 | siukwan/algorithm | leetcode/22. Generate Parentheses(Medium).cpp | class Solution {
public:
vector<string> generateParenthesis(int n) {
vector<string> result;
dfs(result, "", n, 0);
return result;
}
void dfs(vector<string>&result, string str, int n, int right)
{
if (n == 0)//括号已经用完了
{
while (right>0)//右括号还有
{
str += ')';
right--;
}
result.push_back(s... | ALGO | 0.999906 | 5.945147 |
eee17064-c980-464b-9968-00140d382669 | Sharonno/Swore2Offer | 019_2.cpp | struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};
//使用遍历+队列的方法
//step1:将根节点入队;
//step2:队列为非空时获取当前层的节点总数(即队列的长度);
//step3:按照当前层的节点总数,出队进行遍历节点,在遍历时交换左右结点,
// 如果左右结点存在,则入队;当遍历完当前层所有结点时,遍历下一层,执行第二部;
void M... | ALGO | 0.999997 | 4.176999 |
f8abf856-7cc3-42f5-8d85-ff05a5c0ed93 | Mikelunch/ACWING_Project | ACWING算法基础课/第四部分:数学知识/数学知识10:博弈论/NIM游戏/ACWING981.cpp | #include<iostream>
using namespace std;
int main() {
int n;
cin >> n;
int res = 0; //0ʼΪκ0ʱγʼɵһ
while (n--) {
int m;
scanf("%d", &m);
res ^= m;
}
if (res) puts("Yes");
else puts("No");
return 0;
} | ALGO | 0.999984 | 3.649492 |
a7a5c208-5e05-4765-a839-b64374d2a041 | grifondopala/graphics_2lab | SecondLab.cpp | #include "kmean.h"
using namespace std;
using namespace cv;
void saveImage(Mat* image, string name) {
imwrite("D:/MEPHI/KG/SecondLab/SecondLab/result/" + name, *image);
}
Mat loadImage(string name) {
Mat image = imread("D:/MEPHI/KG/SecondLab/SecondLab/img/" + name);
if (image.empty()) {
cout << ... | ALGO | 0.997122 | 4.567485 |
5d60cd16-04ad-4672-8da3-19e1d627da8f | riscv-android-src/platform-system-core | liblog/event_tag_map.cpp | #include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <functional>
#include <string>
#include <string_view>
#include <unordered_map>
#include <log/event_tag_map.h>... | TOOL | 0.886833 | 7.605174 |
0f9e0e55-f60e-4de6-aa6e-ceaf6894f26e | f117-sercet/ProjectC | dataStruct/dataStruct/sorting/binary_insertion_sort.cpp | // 二分法
#include <cstdio>
#include "cstdlib"
using namespace std;
void display(int *arr, int n)
{
int i;
for (i = 0; i < n; i++)
{
printf("%d ", arr[i]);
}
printf("\n");
}
int binarySearch(int *arr, int key, int low, int high)
{
if (low >= high)
return (key > arr[low]) ? (low +... | ALGO | 0.999981 | 4.54686 |
e5809a78-9118-499c-82a0-9143fd0e2c5f | hjsjhn/BZOJ_solutions | [BZOJ4448]情报传递/链剖/a.cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#define MAX_N 2000007
struct ques {
int u, v, id;
};
int N, Q;
int head[MAX_N], to[MAX_N * 2], nxt[MAX_N * 2], cap;
int fa[MAX_N], dep[MAX_N], sz[MAX_N], top[MAX_N], idx[MAX_N], cnt;
int col[MAX_N];
i... | ALGO | 0.999793 | 4.229244 |
7898c737-141a-48df-9744-e3963116666a | sky8c9/Prac | AtCoder/ABC/362/D.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
using ll = long long;
const ll MAX = 1e18;
void task() {
int n, m;
cin >> n >> m;
vector<ll> a(n);
for(ll&val : a) cin >> val;
vector<vector<pair<int, int>>> adjL(n);
for(int i = 0; i < m; i++) {
int u, v, b... | ALGO | 0.999958 | 4.274226 |
78adc928-5825-41ed-902b-e61f3eabe2e5 | nwubni/LeetCode-C-Plus-Plus-Solutions | Final Value of Variable After Performing Operations.cpp | #include <bits/stdc++.h>
using namespace std;
// SOLUTION
int finalValueAfterOperations(vector<string> &operations)
{
int x{0};
for (string &op : operations)
x += (op[0] == '-' || op.back() == '-') ? -1 : 1;
return x;
} | ALGO | 0.999969 | 5.761188 |
42e46440-0eb1-42f1-ba2e-6a8e1bb0a8ca | dihanrh/Competitive-Programming | TokitsukazeandGood01String.cpp | //https://codeforces.com/contest/1678/problem/B1
#include <bits/stdc++.h>
using namespace std ;
void dihan()
{
}
int main ()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tc ;
cin >> tc ;
while ( tc -- )
{
... | ALGO | 0.999314 | 4.468857 |
3bf21895-4476-4a2e-b526-1fda745272b8 | GIT-heyok/PS | BOJ/Solutions/Graph Theory/DFS & BFS/1012.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <sstream>
#include <string>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <set>
#include <map>
#include <cmath>
#include <memory.h>
#define FAST \
ios::sync_with_stdio(false); \
cin.tie(nu... | ALGO | 0.999901 | 4.010005 |
1087d883-43e5-45ab-bd69-1d015805a547 | seokhyunpark/algorithm-practice | AP.3/3.2.cpp | #include <iostream>
#include <vector>
using namespace std;
int cnt = 0;
void mergesort(int n, vector<int> &S);
void merge(int h, int m, vector<int> &U, vector<int> &V, vector<int> &S);
int main() {
int n, input; cin >> n;
vector<int> S(n + 1);
for (int i = 1; i <= n; i++) {
cin >> input;
... | ALGO | 0.999951 | 4.220965 |
06397724-41b0-4bce-94b1-b9d498add264 | Agustangel/2Q-cache-algorithm | src/ideal_cache.cpp | #include <cassert>
#include <iostream>
#include <vector>
#include "ideal_cache.hpp"
int main() {
std::size_t n{}, cache_size{};
std::cin >> n >> cache_size;
assert(std::cin.good());
std::vector<int> vec{};
vec.reserve(n);
for (size_t i = 0; i < n; i++) {
int temp{};
std::cin >> temp;
assert... | ALGO | 0.952258 | 5.821896 |
cd1e2e52-e077-4fe0-8bcd-4218cfa1a68f | ungeskriptet/android_kernel_samsung_sm8650-modules | qcom/opensource/dataipa/kernel-tests/IPAFilteringTable.cpp | #include "IPAFilteringTable.h"
#include <cstring>
#include "TestsUtils.h"
IPAFilteringTable::IPAFilteringTable () : // C'tor
m_pFilteringTable(NULL),
nextRuleIndex(0) {}
bool IPAFilteringTable::Init(ipa_ip_type ipFamily, ipa_client_type pipeNo, uint8_t isGlobal, uint8_t numOfRulesInTable, uint8_t commit)
{
if... | TOOL | 0.867057 | 5.413086 |
424de57b-0949-4d1c-81cc-9d0fb8dfd6c8 | KMORaza/Data_Structures | Stack/Stack_using_Array.cpp | #include <iostream>
class Stack {
private:
static const int MAX_SIZE = 100;
int arr[MAX_SIZE];
int top;
public:
Stack() : top(-1) {}
bool isEmpty() {
return top == -1;
}
bool isFull() {
return top == MAX_SIZE - 1;
}
void push(int value) {
if (isFull()) {
... | ALGO | 0.974138 | 5.500149 |
54f1360e-a55d-4131-9c80-f1fb61073c01 | SaiTp/LeetCode-Codes | 27. LRU Cache - GFG/27.-lru-cache.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// design the class in the most optimal way
class Node{
public:
int key,value;
Node *next,*prev;
Node(int k,int v){
key = k;
value = v;
}
};
class LRUCache
{
private:
unordered_map<int... | ALGO | 0.998788 | 5.420594 |
c0aeaa10-c548-41fa-aec1-446c3b1aecb7 | thanhnambun/ss3c | c/b6.cpp | #include <stdio.h>
int main (){
int old, yearofbirth;
printf("nhap nam sinh \n");
scanf("%d",&yearofbirth);
old = 2023 - yearofbirth;
if (old%2==0) {printf("old is even");}
else{printf("old is odd");}
}
| ALGO | 0.999549 | 3.387094 |
0e218c31-8c7f-4105-8399-7568fb4b7f89 | Dijkstravou/macacario | src/algtn/fft_2d.cpp | const int B = 12; // nesse problema os pols envolvidos tinham no max x^800 y^800
const int N = 1 << B;
cd roots[N];
int inv[N];
cd get_root(int k, int n) { return roots[k * (N / n)]; }
void precalc() {
for (int i = 0; i < N; i++) {
double ang = 2 * PI * i / N;
roots[i] = cd(cos(ang), sin(ang));
... | ALGO | 0.998621 | 3.462415 |
54bcd7ef-9468-40cb-a9d5-b2dc948ea41c | Asad-Bin/cf-ac-problems | codeforces/448/A..cpp | //...Bismillahir Rahmanir Rahim...
// Code by Asad Bin Saber
// 20 04 2020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pi acos(-1.0)
void task()
{
int a1, a2, a3, b1, b2, b3, n;
cin >> a1 >> a2 >> a3 >> b1 >> b2 >> b3 >> n;
a1 += (a2+a3);
b1 += (b2+b3);
... | ALGO | 0.999855 | 3.87648 |
dfbeac84-25ce-4e1e-aa18-af6abff14736 | clsteimle94/CSC5-48101_SteimleCody_2623045 | Lab/Savitch_9thEd_Chap1_ProgProject4_Freefall/main.cpp | /*
* File: main.cpp
* Author: Cody Steimle
* Created on September 12, 2016, 10:27 AM
* Purpose: Calculate the distance dropped in free fall.
*/
//System Libraries Here
#include <iostream>
#include <cmath> //Math Library
using namespace std;
//User Libraries Here
//Global Constants Only, No Global Variables
... | ALGO | 0.99749 | 4.299933 |
ef4cb39f-3aa4-41d5-80b5-9e30f1103448 | basilmannekudi/project-viewer | uploads/ea8660a4b08d968948cce803393f7bcf.cpp | #include <iostream>
using namespace std;
int main() {
int a;
cout << "Enter the number: ";
cin >> a;
// Clear input buffer
cin.ignore(1000, '\n'); // Ignore up to 1000 characters until '\n' is found
if (a % 2 == 0) {
cout << "The given number is EVEN" << endl;
} else {
co... | ALGO | 0.959735 | 4.892304 |
e4efbaa4-9252-47f5-8676-c033509708b5 | alexandraback/datacollection | solutions_1483488_1/C++/iscsi/cookoff.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <cstring>
#include <ctime>
#include <cassert>
using namespace std;
typedef unsigned long long L... | ALGO | 0.999456 | 3.955071 |
262c024a-c137-4c8e-b328-49a28fba0786 | 123pk/100DaysofCompetitiveProgramming | Day78/B - I hate 1111.cpp | /*
Platform :- Codeforces
Contest :- Codeforces Round 723 Div 2
Problem :- B-I hate 1111
Approach :- There is easy solution of this one liner you can check out in editorial
My approach was to check all combination of values using recursion which add up to n as no of values are not more than 8
so... | ALGO | 0.999252 | 4.573951 |
1fe834e0-4c06-4a60-a7e7-ac39510e5e1c | staeen/CPP-programs | search2dMatrix.cpp | /*
Searching element in a 2D matrix that is sorted in row order
*/
#include <iostream>
#include <vector>
using namespace std;
bool searchMatrix(vector<vector<int>> &matrix, int target)
{
int row = matrix.size();
int col = matrix[0].size();
int rowIndex = 0;
int colIndex = col - 1;
while (rowIndex ... | ALGO | 0.999954 | 6.012073 |
40043ef7-5342-475c-8a46-1ce32fb5f218 | shubhamnegi9/MyLeetCodeSolutions | 1360-maximum-length-of-a-concatenated-string-with-unique-characters/maximum-length-of-a-concatenated-string-with-unique-characters.cpp | class Solution {
public:
bool hasDuplicate(string s1, string s2) {
// Checking if s2 is having any duplicate character as s1
vector<int> hash(26, 0);
for(char ch: s1) {
// In case if characters in s1 are itself repeating like "aa", "bb", ...
if(hash[ch-'a'] > 0)
... | ALGO | 0.999873 | 6.180816 |
fe5f019a-fe5d-49a1-b5ad-12bfcdffbf89 | MohanManjhi/collegelife | DSA with c++/CodeForces/WordCapitalization.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
if(s[0]>='a'){
s[0] = s[0]-32;
}
cout<<s;
return 0;
} | ALGO | 0.987822 | 3.847517 |
789e5d71-b498-403d-b2a5-07d63f7b5af6 | mr2rm/solutions | legacy/SPOJ/GNY07C.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
vector <string> v ( 27 , "00000" );
char arr[21][21];
int mark[21][21];
void precomputing ()
{
int x;
for ( int i = 0 ; i < 27 ; i++ )
{
x = i;
for ( int j = 0 ; x != 0 ; j++ )
{
if ( x % 2 == 1 )
v[i][4-j] = '1';
x /= 2;... | ALGO | 0.999463 | 3.409722 |
4bbf092b-2513-45dc-b2b9-331db1444612 | andrew-yt-wong/leetcode | Easy/PlusOne.cpp | class Solution {
public:
int helper(vector<int>& digits, int index)
{
if (index == -1) return 1;
if (digits[index] == 9)
{
digits[index] = 0;
return helper(digits, index - 1);
}
else
++digits[index];
return 0;
}
vec... | ALGO | 0.999905 | 7.07852 |
c9298a7c-3664-449c-9c28-0dd842e63ac7 | iQliPsE-22/MyLeetCode | LinkedList/ReturnMid.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int value)
{
data = value;
next = nullptr;
}
};
class LinkedList
{
private:
Node *head;
public:
LinkedList()
{
head = nullptr;
}
LinkedList&... | ALGO | 0.996806 | 4.877866 |
49527131-54d0-4798-8ee5-e308374cc062 | AKarunakaran/CodeForces | ECF21/E.cpp | #include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
#define DEBUG(x) cout << '>'... | ALGO | 0.999941 | 3.863132 |
30182bea-4d20-4444-a80f-91c4062a3930 | nefrttPrabhu/leetstore | 1477-product-of-the-last-k-numbers/product-of-the-last-k-numbers.cpp | class ProductOfNumbers {
private:
vector<int> prefixProducts;
public:
ProductOfNumbers() {
prefixProducts = {1};
}
void add(int num) {
if (num == 0) {
prefixProducts = {1};
} else {
prefixProducts.push_back(prefixProducts.back() * num);
}
... | ALGO | 0.999969 | 6.003079 |
9c65320f-7cde-4f31-90dd-e50ad349a76e | akriticode09/cpp | pattern12.cpp | #include<iostream>
using namespace std;
int main()
{
int n=4,i,j;
for(i=0;i<n;i++)
{
for(j=i+1;j>0;j--)
{
cout<<j<<" ";
}
cout<<endl;
}
} | ALGO | 0.999935 | 3.608542 |
bca43c91-559d-4fa1-94da-647ed82b2b5d | tangramcompression/tangram_compression | thirdparty/matplotplusplus/examples/geography/geoplot/geoplot_3.cpp | #include <cmath>
#include <matplot/matplot.h>
int main() {
using namespace matplot;
auto [lon, lat, names] = world_cities(6, 8);
auto [lon_star, lat_star] = greedy_tsp(lon, lat);
geoplot(lat_star, lon_star)
->marker("o")
.marker_colors(iota(1., static_cast<double>(names.size())));
... | ALGO | 0.9743 | 4.500988 |
62a4e0e3-a581-4ab5-b982-f701d2fbd7b6 | luxroot/baekjoon | old/10814/main.cpp | #include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <vector>
using namespace std;
bool cmp(pair<int,string> a, pair<int,string> b){
return a.first < b.first;
}
int main()
{
int n,i,age;
string name;
vector< pair<int, string> > arr;
cin >> n;
for(i=0;i<n;i++)... | ALGO | 0.999084 | 4.167457 |
82c62a8f-7712-484c-b5d5-0ca161a82eb0 | kennent/for_scsc_code_save2 | atcoder/ARC179/b.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int m, n, x[10], invx[10];
modint998244353 dp[(1 << 10)][10001]; // st: 1이면 가능한 상태임, i
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.ti... | ALGO | 0.999996 | 4.806876 |
75707be7-b08b-4190-8b6e-66e3039aaef5 | thegamer1907/Code_Analysis | contest/1542578539.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
string p;
std::cin >> p;
int n ;
std::cin >> n;
int tn = 2*n;
vector<string> bs(tn);
for (int i = 0; i < tn;) {
string a;
std::cin >> a;
if (a == p) {
cout << "YES";... | ALGO | 0.999966 | 4.157102 |
8c16313d-74ee-4b27-9d79-d377619c5503 | saptarshisarkar20/LeetCode2025 | 0036-valid-sudoku/0036-valid-sudoku.cpp | class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
// check row wise
for (int i = 0; i < 9; i++) {
vector<int> v(10, 0);
for (int j = 0; j < 9; j++) {
if (board[i][j] != '.')
v[board[i][j] - '0']++;
}
... | ALGO | 0.998713 | 6.484057 |
ce141a63-b5ac-48f8-8bce-ff5f285c3d6d | fupengfei058/algorithm | 剑指offer/14.cpp | /*输入一个链表,输出该链表中倒数第k个结点。*/
/*
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};*/
class Solution {
public:
ListNode* FindKthToTail(ListNode* pListHead, unsigned int k) {
int len = 0;
ListNode* p = pListHead;
while(p != NULL)
{
... | ALGO | 0.999833 | 4.535168 |
eee7076a-ade0-49d1-8fc6-549261527a49 | coin-or/CppAD | example/utility/rosen_34.cpp | /*
{xrst_begin rosen_34.cpp}
{xrst_spell
rclr
}
rosen_34: Example and Test
##########################
Define
:math:`X : \B{R} \rightarrow \B{R}^n` by
.. math::
X_i (t) = t^{i+1}
for :math:`i = 1 , \ldots , n-1`.
It follows that
.. math::
\begin{array}{rclr}
X_i(0) & = & 0 ... | TEST | 0.997135 | 7.280988 |
5373f0c0-4a10-450f-923d-3b63e2523518 | swetika23/OATCP | Smallest_Integer_#8/minimum_Integer_#8.cpp | #include <bits/stdc++.h>
using namespace std;
string removeKDigits(string num, int k) {
stack<char> st;
for(char c : num){
while(!st.empty() && k > 0 && st.top() > c){
k--;
st.pop();
}
if(!st.empty() || c != '0') st.push(c);
}
... | ALGO | 0.999985 | 5.911233 |
5ead65b4-ab3c-4fe7-b330-92b7b0c79b53 | HyIsNoob/NMLT_UIT | Siu/Dates/Dates.cpp | #include <iostream>
#include <iomanip>
using namespace std;
void Nhap(int[], int[], int[]);
void MangToInt(int[], int&, int&, int&);
bool KiemTraNgay(int, int, int);
void HoanVi(int&, int&);
void SapXep(int[]);
void NgayHopLe(int[], int[], int[], int&, int&, int&);
int isThang(int, int);
bool isNhuan(int);
bool nextPe... | ALGO | 0.999732 | 3.909751 |
67002e47-727d-40fc-8ee7-f5bbeeeea078 | tanaychaturvedi/-6Companies30days | Milestone 2 - Amazon/maximum profit.cpp | typedef long long ll;
ll dp[2][501][201];
ll recur(int arr[], int k, int n, int idx = 0, bool ok = false)
{
if (idx >= n || k == 0)
return 0;
if (dp[ok][idx][k] != -1)
return dp[ok][idx][k];
ll sum = recur(arr, k, n, idx + 1, ok);
if (ok)
{
sum = max(sum, recur(arr, k - 1... | ALGO | 0.999906 | 4.248294 |
5cccf900-c72a-47d7-8adc-83261aae0606 | YangHyperData/HardAlgorithms | 1983A.cpp |
/* YangStone Come To Play */
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
#include <conio.h>
#include <algorithm>
using namespace std;
#define RFOR(i, a, b) for (int(i) = (a) - 1; (i) >= (b); --(i))
#define nl << '\n'
#define vti vector<int>
#define vtll vector<long long>
#define yep cout << "YES" nl
... | ALGO | 0.999893 | 4.675295 |
c44d5afb-5163-4a0d-9844-143f0ffbdcd3 | SpurSlicer/University-Coursework | Intro-To-Cpp/Arrays/charCount.cpp | #include <iostream>
#include <string>
using namespace std;
/* Algorithm
* this starts by getting a just-before ascii character and two ints which we will use later
* it then starts a loop and iterates 53 times (not including the 53rd)
this checks every possible alphabetical letter
* it then works through some conditio... | ALGO | 0.993766 | 4.469517 |
80c04fbb-7b34-4628-8770-7caf39498751 | durgeshkk/Codeforces-Contests | Contest #893(DIV 2)/D_Trees_and_Segments.cpp | /*
Once in a LifeTime,
Will never let you Down!!
*/
#include<bits/stdc++.h>
#include<iomanip>
#include <deque>
#include <bitset>
#include <cstdint>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,les... | ALGO | 0.999867 | 4.080144 |
cfb5a655-e08b-4c0d-b74e-447a3abf1c30 | MakinoRuki/TopCoder | SRM511Div1Easy.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <deque>
#include <map>
#define N 52
using namespace std;
typedef long long ll;
class Zoo {
public:
ll theCount(vector<int> ans) {
map<int, int> cnt;
int n = ans.size();
for (int i = 0; i < n; ++i) {
... | ALGO | 0.999542 | 3.529128 |
e31ddcd4-d84d-4c75-98d1-a8b25620db67 | CFOP2357/competitive_programing | codeforces/Grakn Forces 2020/C.cpp | #include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<ull,null_type,less<ull>,rb_tree_tag, tree_order_statis... | ALGO | 0.999506 | 3.482653 |
a227104e-f117-40ac-a6fc-e5ef521fc74a | barakadewise/water_vanding_updates_app | 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 |
1c4321e9-cf77-46ab-99a8-066821614ff7 | jaeseoko/research | src/metaball/meta3.cpp | #include <vector>
#include <stdio.h>
#include "fssimplewindow.h"
#include <ysclass.h>
#include <iostream>
#include <math.h>
#include "glutil.h"
// #include "util.h"
#include <unordered_map>
#include <unordered_set>
#include "fileHandle.h"
#define PI 3.141592
const float tol = 1e-6;
int uniqueNum = 1;
class Applicat... | TOOL | 0.90703 | 3.163126 |
f4e7ce32-dbf6-47b8-b11b-179a9ff3172e | mr-d-self-driving/iLQR_barrier_function | include/eigen/doc/examples/QuickStart_example2_dynamic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXd m = MatrixXd::Random(3,3);
m = (m + MatrixXd::Constant(3,3,1.2)) * 50;
cout << "m =" << endl << m << endl;
VectorXd v(3);
v << 1, 2, 3;
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.999567 | 3.513991 |
e62b57f5-c8ae-47d9-b881-2a7cca4d2c95 | qokelate/swift-demangle | llvm/llvm/lib/Support/SpecialCaseList.cpp | #include "llvm/Support/SpecialCaseList.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/VirtualFileSystem.h"
#include <string>
#include <system_error>
#include <utility>
#include <stdio.h>
namespace llv... | TOOL | 0.945275 | 7.364283 |
abcdfb15-5644-4ed7-8bda-9f853942686c | usaidhahamed1011/Leetcode-Problems | 3702-maximum-subarray-with-equal-products/3702-maximum-subarray-with-equal-products.cpp | class Solution {
public:
int maxLength(vector<int>& nums) {
int n = nums.size();
int result = 0;
for(int i=0;i<n;i++){
long long gcdval = nums[i], lcmval = nums[i],maxlcm = 100000000000,prod=1;
for(int j=i;j<n;j++){
prod*=(long long)nums[j];
... | ALGO | 0.999939 | 5.249481 |
0225b521-8c83-4528-b01d-19c457d02cac | juruo-c/ACM | 22.07/22.7.16/CF807div2D.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int N = 200005;
int n;
char s[N], t[N];
int a[N], b[N];
int ac, bc;
int main()
{
int T;scanf("%d", &T);
while (T -- )
{
ac = bc = 0;
scanf("%d", &n);
scanf("%s%s", s + 1, t + 1);
if (s[1] != t[1] || s[n] != t[n])
{
... | ALGO | 0.999845 | 3.872369 |
80a246c5-b513-4b8e-9eac-d84846644f8d | chiragdev1/DSA | Week_3/15_FEB/Row_sum.cpp | #include<iostream>
using namespace std;
int main(){
int rows,cols;
cin>>rows;
cin>>cols;
int arr[100][100];
for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++){
cin>>arr[i][j];
}
}
for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++){
cout<<arr[i][... | ALGO | 0.999573 | 3.06372 |
65b37e76-9401-4e8b-89ea-b09a0f40acd9 | lissue/ekf | src/kalman_filter.cpp | #include "kalman_filter.h"
#include <iostream>
using namespace std;
using Eigen::MatrixXd;
using Eigen::VectorXd;
// Please note that the Eigen library does not initialize
// VectorXd or MatrixXd objects with zeros upon creation.
KalmanFilter::KalmanFilter() {}
KalmanFilter::~KalmanFilter() {}
void KalmanFilter::I... | ALGO | 0.988766 | 6.108277 |
9d320401-4d1c-458a-89d6-4a6d680d73a9 | Tr4shP4ndu/tp_cpp_journey | courses_applications/The-C-20-Masterclass-Source-Code/47.BuildingIteratorsForCustomContainers/40.05CustomOutputIterator/main.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include "boxcontainer.h"
template <typename T>
std::ostream& operator<<( std::ostream& out,const std::vector<T>& vec){
out << " [ ";
for(auto i : vec){
out << i << " ";
}
out << "]";
return out;
}
int main(){
//std::vector<... | TOOL | 0.956599 | 4.331664 |
e4f03adb-e5ea-46f0-903b-14c41abb9ce9 | Arghya0802/LeetCode-GFG-Daily-Challenges | Most Asked Algorithms/Sort an Array.cpp | // Link: https://leetcode.com/problems/sort-an-array/description/
class Solution {
private:
vector<int> merge(vector<int> &A , vector<int> &B)
{
int m = A.size() ;
int n = B.size() ;
vector<int> ans ;
int i = 0 ;
int j = 0 ;
while(i < m && j < n)
{
if(A[i] < B[j])
an... | ALGO | 1 | 6.260266 |
5c73507f-e5b8-43be-9ce9-cf510dbb20e1 | prakashsingh46/CodeForces_Questions | C_Classy_Numbers.cpp | #include<bits/stdc++.h>
#define ll long long
#define sort2D(arr,cmp) sort(arr.begin() , arr.end(),cmp)
#define sort(arr) sort(arr.begin() , arr.end())
#define vi vector<int>
#define vll vector<long long>
#define fori(n) for(int i=0;i<n;i++)
#define forl(n) for(long long i=0;i<n;i++)
using namespace std;
int dp[20][2][4... | ALGO | 0.999773 | 4.480098 |
5cf10c89-8f13-45f3-9ed4-44aa7d8af649 | abishek-ctrl/100-days-of-code | CodeChef Contests/Starter-95/Donation Rewards.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
int t,x;
cin>>t;
while(t--){
cin>>x;
if(x<=3) cout<<"BRONZE"<<'\n';
else if(x>3 and x<=6) cout<<"SILVER"<<'\n';
else cout<<"GOLD"<<'\n';
}
return 0;
}
| ALGO | 0.988513 | 4.467028 |
1c3d1018-ec53-4e44-94e4-a43ddec4116a | asubramanian08/CSES | IntroductoryProblems/1624-ChessboardAndQueens_1.cpp | // 3:30 - 3:59
#include <iostream>
using namespace std;
char board[8][8];
int ans = 0;
bool inRange(int x) { return 0 <= x && x < 8; }
void mini_updt(int x, int y, bool add, int queenNum)
{
if (inRange(x) && inRange(y) &&
(board[x][y] == '.' || board[x][y] == '0' + queenNum))
board[x][y] = add ? '... | ALGO | 0.999739 | 4.838831 |
fd2f6666-1d6d-486e-8b95-0726a0cc3506 | 1105Lakshya/DSA-TOPIC-WISE | 10_recursion/print_number_digits.cpp | #include<iostream>
using namespace std;
void print_num(int n){
if(n==0)
return;
int last_digit=n%10;
n=n/10;
print_num(n);
switch(last_digit){
case 0:
cout<<"zero ";
break;
case 1:
cout<<"one ";
break;
case 2:
cout<<"two ";
... | ALGO | 0.999778 | 4.863834 |
93746213-0890-427a-a098-4ad9a83bc37a | mhaddaou/CPP-Module-09 | ex02/src/PmergeMe.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* PmergeMe.cpp :+: :+: :+: ... | ALGO | 0.991949 | 5.182702 |
168f4af0-5ff4-4fd3-8999-ded4d06cfe4a | AkshathKamath/Data-Structures-Algorithms | Basics/Basic Maths/count_digits.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int ct = 0;
while (n != 0) // O(log10(N))
{
ct++;
n = n / 10; // OR (int)(log10(n)+1)
}
cout << ct;
return 0;
} | ALGO | 0.999825 | 4.278816 |
f0fabbed-5940-4305-878b-08a5c0989289 | Thyme0113/astnn_with_semi-supervised_learning | ssl_125/data/src/factorial/recursive75.cpp | long long factorial( long long n )
{
if( n == 1 )
return 1;
else
return n * factorial( n - 1 );
}
int main()
{
long long n;
cin >> n;
cout << factorial(n) << endl;
return 0;
}
| ALGO | 0.999894 | 4.314388 |
f228029b-bc57-4422-a86d-4a69ecfeb2c7 | RajdevKapoor/Leetcode-Practice | 1092-shortest-common-supersequence/1092-shortest-common-supersequence.cpp | class Solution {
public:
string shortestCommonSupersequence(string str1, string str2) {
int n=str1.length(),m=str2.length();
vector<vector<int>> dp(n+1,vector<int>(m+1,0));
for (int i=1;i<n+1;i++) {
for (int j=1;j<m+1;j++) {
if (str1[i-1]==str2[j-1]) dp[i][j]=1+dp... | ALGO | 0.999991 | 5.760456 |
132c0715-8738-401d-9df1-dce42cc50057 | morris821028/UVa | my-problem/等高線/rect.cpp | #include <stdio.h>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
struct Rectangle {
int lx, ly, rx, ry;
void read() {
scanf("%d %d %d %d", &lx, &ly, &rx, &ry);
}
int contain(Rectangle &a) {
return lx <= a.lx && ly <= a.ly && rx >= a.rx && ry >= a.ry;
}
int contain(i... | ALGO | 0.999903 | 3.206632 |
bfe135d6-d2d3-4283-aa5c-c28ed3017f05 | nakatamaho/mplapack | mplapack/reference/Ctprfb.cpp | #include <mpblas.h>
#include <mplapack.h>
void Ctprfb(const char *side, const char *trans, const char *direct, const char *storev, INTEGER const m, INTEGER const n, INTEGER const k, INTEGER const l, COMPLEX *v, INTEGER const ldv, COMPLEX *t, INTEGER const ldt, COMPLEX *a, INTEGER const lda, COMPLEX *b, INTEGER const l... | ALGO | 0.99943 | 3.297556 |
341acdde-bad4-41ae-ba8c-9763ff6c0b6d | nguyenhongduc2411/Nostalgia | CTDL>/2024-2025/HK2-K24/24CNTN/CuoiKy/Cau5.cpp | #include <iostream>
#include <cfloat>
using namespace std;
double divide(double x, double y)
{
if (y == 0)
return -1;
// Cứ tìm tích m * y
// => Tìm thằng m mà có m * y gần nhất với thằng x
static const double EPS = 0.0001;
double l = 0, r = DBL_MAX;
while (r - l > EPS) {
doubl... | ALGO | 0.999858 | 3.64938 |
2bdb2a32-91f7-4fc9-b64f-9ab302c8205f | ANkurNagila/Striver_SDE_Sheet | DAY_39/Search_in_rotated_sorted_array.cpp | int search(int* arr, int n, int key) {
// Write your code here.
int x;
int first=0,last=n-1;
while(first<last){
int mid=(first+last)/2;
if(arr[mid]<arr[mid-1] && arr[mid]<arr[mid+1])
{
x=mid;
break;
}
else
{
if(... | ALGO | 0.999994 | 5.547928 |
83f36763-43ad-4cc9-b857-70edf6ddfb5e | Mohammad-Mohid18/Cpp-OOP- | star.cpp | #include <iostream>
using namespace std;
int main()
{
int size = 7;
for(int row = 1; row <= size ; row++)
{
for(int col = 1; col <= size; col++)
{
if((row == 4) or (col == 4) or (row == col || col == (size - row + 1)))
{
cout << "* ";
}
... | ALGO | 0.999737 | 3.777923 |
276d462e-cf97-44eb-a127-199e3ed943e6 | Ankit253/Data-Structures | Arrays/Noble Integer.cpp | /*vector<int> removeDuplicates(int arr[], int n)
{
int i;
// Initialise a set
// to store the array values
set<int> s;
// Insert the array elements
// into the set
for (i = 0; i < n; i++) {
// insert into set
s.insert(arr[i]);
}
vector<int> v;
v.a... | ALGO | 0.999983 | 4.923992 |
a72864fb-e7ec-49fe-8da0-a2b3fb57ab08 | tony23545/bulldog_ws | src/gpd/src/gpd/sequential_importance_sampling.cpp | #include <gpd/sequential_importance_sampling.h>
// methods for sampling from a set of Gaussians
const int SUM_OF_GAUSSIANS = 0;
const int MAX_OF_GAUSSIANS = 1;
// standard parameters
const int SequentialImportanceSampling::NUM_ITERATIONS = 5;
const int SequentialImportanceSampling::NUM_SAMPLES = 50;
const int Sequent... | ALGO | 0.999314 | 6.550645 |
b5346414-8433-4f67-a84e-ff3a4112c809 | VikasKanwar101/DSA | 42-trapping-rain-water/trapping-rain-water.cpp | class Solution {
public:
int trap(vector<int>& height) {
int n = height.size();
if (n == 0) return 0;
int left = 0, right = n - 1;
int left_max = 0, right_max = 0;
int total = 0;
while (left < right)
{
if (height[left] < height[right])
... | ALGO | 0.999978 | 6.923071 |
c73595e5-1afb-42d7-980c-399b4b5f1020 | sarvex/leetcode-carbon | solution/2400-2499/2426.Number of Pairs Satisfying Inequality/Solution.cpp | class BinaryIndexedTree {
public:
int n;
vector<int> c;
BinaryIndexedTree(int _n)
: n(_n)
, c(_n + 1) {}
void update(int x, int delta) {
while (x <= n) {
c[x] += delta;
x += lowbit(x);
}
}
int query(int x) {
int s = 0;
wh... | ALGO | 0.999997 | 6.077 |
454cb591-f747-4928-9703-7df179652a83 | airballking/openrave_ompl_bridge | openrave_ompl_bridge/src/FeatureConstraints.cpp | #include <openrave_ompl_bridge/FeatureConstraints.h>
#include <openrave_ompl_bridge/Conversions.h>
using namespace Eigen;
namespace openrave_ompl_bridge
{
// transform an interaction matrix
Matrix<double, 6, 6> inverse_twist_proj(KDL::Frame f)
{
// (transposed) Rotation matrix of f
Matrix3d Rt = Map<Matrix3d>(f.... | ALGO | 0.981912 | 7.256278 |
25f3996d-fa29-4cd1-977b-65f37ff0eec2 | Surpreem/book_code | The Modern C++ Challenge/book_src/libs/cryptopp/gf256.cpp | // gf256.cpp - originally written and placed in the public domain by Wei Dai
#include "pch.h"
#include "gf256.h"
NAMESPACE_BEGIN(CryptoPP)
GF256::Element GF256::Multiply(Element a, Element b) const
{
word result = 0, t = b;
for (unsigned int i=0; i<8; i++)
{
result <<= 1;
if (result & 0x100)
result ^= m_m... | ALGO | 0.997933 | 5.182868 |
2ec28a8c-a6cc-4adc-8a14-8e03d4f8759f | AndreKorSw/MIREA_2_COURSE | ДЗ_1_СЕМЕСТР/дз4/синусоида.cpp |
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
int size = 100; // ширина графика
int height = 21; // высота
vector<string> sinGraph(height, string(size, ' ')); // пустое поле
sinGraph[height/2] = string(size, '-'); // ось
for(int i = 0; i < size;... | ALGO | 0.999189 | 3.658706 |
66fce937-8fad-4ace-8fa1-8fc8c5cabd02 | joker-eph/llvm-project-with-mlir | libcxx/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp | // <algorithm>
// template<ForwardIterator Iter>
// requires OutputIterator<Iter, Iter::reference>
// && EqualityComparable<Iter::value_type>
// constexpr Iter // constexpr after C++17
// unique(Iter first, Iter last);
#include <algorithm>
#include <cassert>
#include <memory>
#include "test_macr... | TEST | 0.962227 | 6.683553 |
15bdd6f2-cfa0-4db6-8edf-d75de2d2dbde | jayeshshaw/Leetcode | 33-search-in-rotated-sorted-array/33-search-in-rotated-sorted-array.cpp | class Solution {
public:
int search(vector<int>& nums, int t) {
int l=0,r=nums.size()-1,m;
while(l<=r){
m=(l+r)/2;
if(nums[m]==t)return m;
else if(nums[m]>nums[r]){
if(t<nums[m] && t>=nums[l])r=m-1;
else l=m+1;
}
... | ALGO | 0.999979 | 6.280121 |
3a2e81a1-20ee-4b89-b319-e4607b9e4603 | ishandutta2007/codeforces | arterm/normal/360/B.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
#define M 2013
#define long long long
long n,k,a[M],d[M];
void read(void){
cin>>n>>k;
for (int i=0; i<n; ++i)
cin>>a[i];
}
long abss(long x){
return x<0 ? -x:x;
}
int din(long m){
d[0]=0;
for (long i=1; i<n; ++i){
d[i]=i;
for (int j=0; j<i; ++... | ALGO | 0.999969 | 3.866525 |
243e10f4-bb7e-4fa2-964a-88f6257a6926 | Spirit599/algorithm | leetcode/cpp/72_2.cpp | class Solution {
public:
int minDistance(string word1, string word2) {
int m = word1.size();
int n = word2.size();
int dp[m + 1][n + 1];
memset(dp, 0x3f, sizeof(dp));
dp[0][0] = 0;
for(int i = 0; i < m; ++i)
{
dp[i + 1][0] = i + 1;
}
... | ALGO | 0.999984 | 5.379377 |
292bf202-0b6f-4fde-83db-ed75a57bae07 | ghodges413/OpenGLTutorials | Tutorial40_fluids/Fluids/code/Math/SignedVolumes.cpp | //
// SignedVolumes.cpp
//
#include <string>
#include <stdio.h>
#include <math.h>
#include <malloc.h>
#include <algorithm>
#include "Vector.h"
#include <vector>
#include "SignedVolumes.h"
/*
========================================================================================================
SignedVolumes
This i... | ALGO | 0.999119 | 6.27716 |
4b4b884b-d866-4c76-82e3-7167549da341 | kifah-s/Problem_Solving | Programming_Advices_Academy/Cou_03_Pro_Using_C++_Lev_1/Problem_75_Average_Pass_Fail/Solution_Problem_11_Average_Pass_Fail.cpp | #include <iostream>
using namespace std;
//* Functions
void welcomeMessage()
{
cout << "\n\nWelcome to the Problem Solving ..\n"
<< endl;
}
//* End Functions
int main()
{
welcomeMessage();
float mark_1 = 0, mark_2 = 0, mark_3 = 0, average = 0;
cout << "Please, enter a mark 1: ";
cin ... | TOOL | 0.989297 | 3.394614 |
87ef6ed6-44e6-4722-b5df-b5c011c6fc62 | andeplane/AtomifyVisionPro | LAMMPS/src/DPD-MESO/pair_mdpd.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Zhen Li (Clemson University)
Email: <EMAIL>
------------------------------------------------------------------------- */
#include "pair_mdpd.h"
#include "atom.h"
#include "citeme.h"
#include "comm... | ALGO | 0.998379 | 6.245312 |
906a7793-5f94-4e90-8317-0741351350ec | hakan-gecili/sort_algorithms | cpp/quick_sort.cpp | #include <iostream>
#include <vector>
#include <random>
using namespace std;
class Sorter_{
std::vector<int> A;
int Size, Min, Max;
public:
Sorter_(int Size_,int Min_, int Max_):Size(Size_), Min(Min_), Max(Max_){
A.resize(Size);
GenerateRandomIntegers();
}
int partition(int p, int r){
int x =... | ALGO | 0.999863 | 5.248613 |
f60246ae-857d-44d5-aa1e-10e74e24c953 | Adriana-HS/Practice-3 | Exercise14.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int num;
cout << "Ingrese el número :" << endl;
cin >> num;
string c_num = to_string(num);
bool palindromo = true;
for (int i = 0; i < c_num.size(); i++){
if (c_num[i] != c_num[c_num.size()- (i + 1)]){
pa... | ALGO | 0.999473 | 4.417756 |
20122c20-ad7a-4d9a-b986-e3f09154a495 | AIvaylov02/Artificial-Intelligence | 05. Games - Tic-Tac-Toe/src/board.cpp | #include "../headers/board.h"
Board::Board(char humanMarking, char machineMarking, bool humanIsFirst)
{
board.resize(BOARD_SIZE);
for (size_t row = 0; row < BOARD_SIZE; row++)
{
board[row].resize(BOARD_SIZE);
for (size_t col = 0; col < BOARD_SIZE; col++)
board[row][col] = EMPTY;
}
humanSymbol = humanMarki... | TOOL | 0.937872 | 5.503374 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.