uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
da8f99cf-c82f-4c08-9a48-8362261e13ba | Jason-fy-wang/base_c | c++/Base-Cpp/StdLib/src/reverse_demo.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
/*
ԭ:
reverse(beg, end)
תָΧԪ
beg: ʼ
end:
*/
void test_reverse() {
vector<int> v;
v.push_back(10);
v.push_back(50);
v.push_back(40);
v.push_back(30);
v.push_back(20);
cout << " תǰ : " << endl;
for (vector<int>:... | ALGO | 0.993793 | 4.716304 |
67de42ae-eb50-4598-870a-74726191e947 | Haritha-E/Leetcode-Problem-Solving | 4-median-of-two-sorted-arrays/median-of-two-sorted-arrays.cpp | class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
vector<int> res;
for(int i=0;i<nums1.size();i++)
res.push_back(nums1[i]);
for(int i=0;i<nums2.size();i++)
res.push_back(nums2[i]);
sort(res.begin(),res.end());
... | ALGO | 0.999966 | 6.322372 |
0c903c5e-4c12-4d63-a2b8-57daa3ad9310 | eesss34690/RWG_Server | BrstShrd.cpp | #include <iostream>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <vector>
#include "typedef.hpp"
#include <algorithm>
#include <stdio.h>
int errexit(const char *format, ...);
int sem_create(key_t, int);
void sem_wait(int);
void sem_signal(int);
using namespace std;
BrstShrd::BrstShrd()
{
users.res... | WEB | 0.921249 | 3.20551 |
8b3e5cbc-ef22-419f-80e4-89d0e349cd1a | Bayyys/Algorithm | Leetcode/practice/637.average-of-levels-in-binary-tree.cpp | /*
* @lc app=leetcode.cn id=637 lang=cpp
* @lcpr version=30110
*
* [637] 二叉树的层平均值
*/
// @lcpr-template-start
using namespace std;
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
... | ALGO | 0.999982 | 7.411994 |
42bba9cd-17dd-49ae-a875-d069b184c979 | Hansimov/cs-notes | 剑指offer_1st/022 从上往下打印二叉树 - bfs queue.cpp | /*
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};*/
class Solution {
public:
vector<int> PrintFromTopToBottom(TreeNode* root) {
if (root==NULL) return {};
vector<int> v;
queu... | ALGO | 0.999986 | 5.86344 |
7ae7f939-57cf-452c-94bf-b8b1d095c683 | yzzupgo/MFTCG | Data/abc137_a/legendary_queen/wa/6837915.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,c,d,e;
cin>>a>>b;
c=a+b;
d=a-b;
e=a*b;
if(c>d && c>e)
cout<<c<<endl;
else if(d>c && d>e)
cout<<d<<endl;
else
cout<<e<<endl;
}
| ALGO | 0.999938 | 3.427341 |
208677f1-a11a-4840-a266-e6b6bac5312c | chishaung/My-LeetCode-Easy-Level | 2016.11.03 Arranging Coins.cpp | class Solution {
public:
int arrangeCoins(int n) {
long low = 1, high = n;
while (low < high) {
long mid = low + (high - low + 1) / 2;
if ((mid + 1) * mid / 2.0 <= n) low = mid;
else high = mid - 1;
}
return high;
}
};
| ALGO | 0.999959 | 6.535761 |
da59dad9-9c7c-4ba7-9ec2-0e0191416420 | nhannguyen95/algorithms | practices/interview-bit/arrays/first-missing-integer.cpp | int Solution::firstMissingPositive(vector<int> &A) {
int n = (int) A.size();
/* Change negative elements to 0 */
bool allNegative = true;
for(int i = 0; i < n; i++) {
if (A[i] < 0) A[i] = 0;
else allNegative = false;
}
if (allNegative) return 1;
for(int i = 0; i < n; i++) ... | ALGO | 0.999927 | 4.970676 |
0fe7a7b8-d03b-4782-91fd-47a4e33c7862 | kai336/atcoder | practice/bootcampforbeginners/easy100/10.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int a[n];
for(int i = 0; i < n; i++){
cin >> a[i];
}
sort(a, a + n, greater<int>());
int al, bo;
al = 0;
bo = 0;
for(int i = 0; i < n; i++){
if(i % 2 == 0) al += a[i];
else bo += a... | ALGO | 0.999992 | 4.343558 |
363873b4-1940-4b26-b74e-7b233325e931 | lishaizhe/knowledge | 工程/csv/cocos2d/cocos/math/CCAffineTransform.cpp | #include "math/CCAffineTransform.h"
#include <algorithm>
#include <math.h>
using namespace std;
NS_CC_BEGIN
AffineTransform __CCAffineTransformMake(float a, float b, float c, float d, float tx, float ty)
{
AffineTransform t;
t.a = a; t.b = b; t.c = c; t.d = d; t.tx = tx; t.ty = ty;
return t;
}
Vec2 __CCPoint... | TOOL | 0.873194 | 6.36373 |
be8c27a2-0dd7-44db-8146-57cdcca48c11 | vivekbiragoni/Leetcode | LinkedList/Linked List Insertion/linked-list-insertion.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
next = NULL;
}
};
void printList(Node* node)
{
while (node != NULL) {
cout << node->data <<" ";
node = node->next;
} ... | ALGO | 0.999821 | 5.905947 |
810ae27f-5a3c-4ae4-b989-659ac6ed01b8 | Mohit-Pandey1/DSA-Using-CPP | BINARY SEARCH/BINARY SEARCH QUESTIONS/search2.cpp | //Search a number in sorted rotated array [for unique numbers]
#include <iostream>
using namespace std;
int binarySearch(int arr[], int n, int target){
int start = 0;
int end = n-1;
while(start <= end){
int mid = start + (end-start)/2;
if(arr[mid] == target){
return mid;
}
else if(arr[mi... | ALGO | 0.999943 | 5.85411 |
66cf4813-2714-46c4-bf6f-4106a4c0b8cc | Yaro2709/AlgoProblems | 1/723A.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int x[3];
cin >> x[0];
cin >> x[1];
cin >> x[2];
int min = 101;
int max = 0;
int min_i = 0;
int max_i = 0;
for (int i = 0; i < 3; i++) {
if (max < x[i]) {
max = x[i];
m... | ALGO | 0.999961 | 4.403509 |
1c6ab2d0-3f65-421e-9eff-c8f7bad5b90c | miaomiaozhi/dailystudy | Template/Algorithm/Prim.cpp | /*
prim算法 求最小生成树
S:当前已经在联通块中的所有点的集合
prim 算法中的 dist[]下标代表点a 值存的是a到连通块的最小距离
1. dist[i] = inf //
2. for n 次
t<-S外离S最近的点
利用t更新S外点到S的距离
st[t] = true
n次迭代之后所有点都已加入到S中
联系:Dijkstra算法是更新到 起始点 的距离,Prim是更新到 集合S 的距离
*/
int prim() {
int res = 0; //最小生成树的边权
memset (dist, 0x3f, sizeof dist);
dis... | ALGO | 0.999969 | 4.122668 |
556c774c-1d76-4a95-a115-b92c4efd5ba4 | afd57/cpp_works | Sources/sablon_fonksiyonlar.cpp | // Bilgisayar biliminde -swap -search -sort -insert gibi bir ok ilem hertr veri tipi iin
// ayn program mantna sahiptir sablon fonksiyon tanmlama yntemi
// ile sablon c++ derleyici otomatik olarak fonksiyon arld veri tipine bal olarak
// fonksiyon retir
//SABLON fomksiyonu nasl tanmlanacak???
#include <iostream>
te... | ALGO | 0.910626 | 4.09517 |
2a99c7f9-fb8d-4868-acd1-60030b17fffb | Helmy-JR/Leetcode-soulutions | Problems/21 - 491. Non-decreasing Subsequences .cpp | // Author: Abdelrahman Helmy
class Solution {
public:
vector<vector<int>> findSubsequences(vector<int>& nums) {
vector < vector < int > > inc_sub;
int n = nums.size();
for(int mask = 0; mask < (1 << n); mask++){
bool is_valid = true;
vector < int > curr;
... | ALGO | 0.99999 | 6.055396 |
1fdac4ea-905c-4d35-8187-a540458ecd4f | krithikagoyal/Just-Leet-It | 1340-jump-game-v/1340-jump-game-v.cpp | class Solution {
public:
int maxJumps(vector<int>& arr, int d) {
int n = arr.size();
stack<int> s1, s2;
vector<int> dp(n, 1);
for (int i = 0; i < n; i++) {
while (s1.size() && arr[s1.top()] < arr[i]) {
int ini = arr[s1.top()];
while (s1.siz... | ALGO | 0.999953 | 5.761669 |
d7e04227-b826-460b-9ca1-beb08db8982c | rherdez/ejercicios_C | 18_algo/II_unidad/lista.cpp | #include <iostream>
#include <fstream>
#include <stdlib.h>
#include <ctime>
#include "nodo.h"
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
nodo *I,*T,*F,*A,*T2;
void llenar();
void ordenar();
void agregar(int x, string y);
void agregar(char[]... | TOOL | 0.888334 | 3.691424 |
1336ba6b-b88d-45eb-80a4-09b54ee3ee07 | allwinner-ics/platform_external_stlport | test/eh/test.cpp | #include <iostream>
#include <set>
#include <vector>
template<class T>
inline void printElements(const T& coll, const char* msg = "")
{
typename T::const_iterator it;
std::cout << msg;
for(it = coll.begin(); it != coll.e... | TOOL | 0.923319 | 3.981747 |
15dcbbe3-1b1e-404e-ab4d-fff3feef4d59 | ngctnnnn/Competitive-Programming | Codeforces/SET6/B.cpp | #include <bits/stdc++.h>
#define ll long long
#define each(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define sqr(x) ((x) * (x))
#define ff first
#define ss second
typedef std::pair<int, int> pii;
typedef std::pair<long long, long long> pll;
typedef std::vector<std::pair<int, int>> vii;
typede... | ALGO | 0.999963 | 3.884837 |
f13fe972-41c0-4a08-86f7-93bed8c342b7 | ahmed19897/CPlusPlus-How-To-Program-Ninth-Edition | Control_statment_part2/5.20folder/5.20.cpp | #include <iostream>
#include<iomanip>
#include <cmath>
using namespace std;
int main()
{
for(int i=1;i<=500;i++)
{
for(int j=1;j<=500;j++)
{
for(int k=1;k<=500;k++)
{
if((sqrt(pow(i,2)+pow(j,2)))==k)
{
cout<<i<<' '<<j<... | ALGO | 0.99989 | 3.099441 |
cb7cb874-212a-4f8a-9b13-0e92011e78a5 | thegamer1907/Code_Analysis | contest/1542594799.cpp | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <set>
#include <map>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
typedef long long ll;
int mod... | ALGO | 0.999946 | 3.344939 |
859900a9-704b-464a-b969-fddd584891f3 | Khushi-Kumari947/CPP_DSA | q_s.cpp | // // CPP program to implement Queue using
// // two stacks with costly enQueue()
// #include <bits/stdc++.h>
// using namespace std;
// struct Queue {
// stack<int> s1, s2;
// void enQueue(int x)
// {
// // Move all elements from s1 to s2
// while (!s1.empty()) {
// s2.push(... | ALGO | 0.999514 | 5.050607 |
48bf1155-6854-4ae3-b6a6-599c870b97f5 | FHead/fheadhelpercode | Program/ProjectEuler/Problem0031/CoinCount.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> IncludeNewCoins(vector<int> UpToNow, int Value);
int main();
vector<int> IncludeNewCoins(vector<int> UpToNow, int Value)
{
vector<int> Result(UpToNow.size());
for(int i = 0; i < UpToNow.size(); i++)
{
for(int j = i; j >= 0; j = j -... | ALGO | 0.999184 | 3.868129 |
7478b4b1-8f40-4031-ab58-83e65c7d206d | HassanChowdhry/competitive-programming | CSES/Dynamic_Programming/Book-Shop/main.cpp | #include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main() {
int n, price; cin >> n >> price;
vector<int> prices(n), pages(n);
vector<vector<int>> dp(n+1, vector<int>(price+1, 0));
for (int i = 0; i < n; ++i)
{ cin >> prices[i]; }
for (int i = 0; i < n; ++i)
{ cin >> pages[... | ALGO | 0.999894 | 3.860395 |
de38ae44-78dc-4a99-99dd-2f9fdd78b935 | Candreoni/C- | C++/PowLoop.cpp | // Program that caulculates the value of (2^1+2^2+2^3+...+2^n)
#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
int main(){
int n1, r = 0;
cout<<"Enter a number "; cin>>n1;
for(int i=1; i<=n1; i++){
r += pow (2,i);
}
cout<<"\nThe sum of (2^1+2^2+2^3+...+2^n) is: "<<r<<endl;
... | ALGO | 0.99842 | 4.058597 |
d2d4c988-e460-450f-bc04-8effcd2d71cd | kayarre/reconbench | pbrt/src/cameras/orthographic.cpp | // cameras/orthographic.cpp*
#include "stdafx.h"
#include "cameras/orthographic.h"
#include "paramset.h"
#include "sampler.h"
#include "montecarlo.h"
// OrthographicCamera Definitions
OrthoCamera::OrthoCamera(const AnimatedTransform &cam2world,
const float screenWindow[4], float sopen, float sclose,
fl... | ALGO | 0.912899 | 7.414236 |
3d20881b-4142-4791-ad64-0d1620593fb5 | jonathandarryl/UVa-Code | 10789.cpp | #include<iostream>
#include<map>
#include<string.h>
using namespace std;
bool prime[2100];
void sieve(){
memset(prime,true,sizeof prime);
prime[0]=prime[1]=false;
for(int i=2;i<=2100;i++)
if(prime[i])
for(int j=i+i;j<=2100;j+=i)
prime[j]=false;
}
int main(void){
sie... | ALGO | 0.99948 | 3.931768 |
33067654-6ea0-4f16-a6e9-75ac3f62b9d5 | mahadi097/Competitive-Programming | Leetcode/DP/72. Edit Distance.cpp | class Solution {
public:
int n1, n2, dp[505][505];
string s1, s2;
int minDistance(string word1, string word2) {
s1 = word1, s2 = word2;
n1 = word1.size(), n2 = word2.size();
memset(dp, -1, sizeof dp);
return solve(0, 0);
}
int solve(int p1, int p2) {
if(p1... | ALGO | 0.999998 | 5.389121 |
0589da15-2a49-4763-b588-d7db3291fee2 | tanht-lavamyth/Algorithm | Competitive Programming Exercises/Codeforces/In Search of an Easy Problem.cpp | /*
* @Author: tanht
* @Date: 2020-09-21 05:33:48
* @Last Modified by: tanht
* @Last Modified time: 2020-09-21 05:34:07
* @Email: <EMAIL>
*/
#include <iostream>
#include <array>
using namespace std;
const int AMAX = 100;
array<int, AMAX> a = {0};
int main() {
int n; cin >> n;
for (int i = 0; i < n; ++i) {
ci... | ALGO | 0.996998 | 3.837054 |
3cacb4ec-ca08-4a2a-891f-cc12deec4c89 | BIT-zhangxin/AlogrithmLearning | 做题/3. 括号匹配.cpp | //#include <stdio.h>
//#include "LINKLIST.h"
//
//int main()
//{
// LINKLIST<char>q;
// char tmp;
// bool ans = true;
// while (scanf("%c", &tmp) != EOF&&tmp != '\n')
// {
// if (tmp == '(')
// {
// q.push_front(tmp);
// }
// else if (tmp == '[')
// {
// q.push_front(tmp);
// }
// else if (tmp == ')')
// {
... | ALGO | 0.998886 | 3.685298 |
ff60987f-1589-421a-8a7b-cbf383e0f957 | habanero-rice/hclib | test/performance-regression/full-apps/qmcpack/src/QMCDrivers/Experimental/OPT/QMCFixedSampleLinearOptimize.cpp | /*#include "Message/Communicate.h"*/
namespace qmcplusplus
{
QMCFixedSampleLinearOptimize::QMCFixedSampleLinearOptimize(MCWalkerConfiguration& w,
TrialWaveFunction& psi, QMCHamiltonian& h, HamiltonianPool& hpool, WaveFunctionPool& ppool): QMCLinearOptimize(w,psi,h,hpool,ppool),
Max_iterations(1), exp0(-16), exp... | ALGO | 0.970383 | 5.892147 |
d7411c00-bb56-41b8-b68e-630e1cf9d68c | ghoshsaikat2024/C-Program-Files | Numerical Methods Codes/Bisection_method1.cpp | //BISECTION METHOD TO FIND SOLUTION OF x^3+3*x-5=0 correct upto 5 decimal places.
#include<stdio.h>
#include<math.h>
// define the function.
float f(float x)
{
float y;
y= pow(x,3)+3*x-5;
return y;
}
int main()
{
float a,b,x,error=1e-6;
printf("Enter the interval:\n");
scanf("%f%f",&a,&b);
if (f(a)*f(b)>0)... | ALGO | 0.999989 | 4.344263 |
19d8d0c2-d26d-4f6a-91b2-0626ee6fff4e | junhee-k/coding-problems | baekjoon/dp/9251.cpp | #include <iostream>
using namespace std;
int main() {
string a,b;
cin >> a >> b;
int n1 = a.size();
int n2 = b.size();
int dp[n1+1][n2+1];
for(int i = 0; i <= n1; i++) dp[i][0] = 0;
for(int j = 0; j <= n2; j++) dp[0][j] = 0;
for (int i = 1; i <= n1; i++) {
for (int j = 1; ... | ALGO | 0.999974 | 4.092677 |
d4f21432-7089-48f6-b52d-a026ce45a2da | ayush-1560/DSA | 2316-count-hills-and-valleys-in-an-array/count-hills-and-valleys-in-an-array.cpp | class Solution {
public:
int countHillValley(vector<int>& nums) {
int n = nums.size();
int i=0,j=1;
int cnt=0;
while(j+1<n){
if((nums[j]>nums[i] && nums[j]>nums[j+1])
|| (nums[j]<nums[i] && nums[j]<nums[j+1])){
cnt++;
i=j;
... | ALGO | 0.999976 | 5.632359 |
af0ec709-5ec0-4806-b3e1-5f552a014ab0 | redreadergirl/Math4610 | hw1/quadpoly.cpp | #include <math.h>
#include "mylib.h"
#include <complex>
using namespace std;
complex<double>* quadpoly(double a, double b, double c) {
complex<double> *roots = new complex<double>[2];
if ((b * b) - (4 * a * c) < 0.0) {
complex<double> temp1(-b / (2 * a), sqrt(abs((b * b) - (4 * a * c))) / (2 * a));
complex<doub... | ALGO | 0.997596 | 3.151368 |
59f401f7-5cec-4a7c-a33a-56f632a2a8c3 | KRISHANU1920/POTD | day39.2_swapNodes.cpp | // Question Link : https://leetcode.com/problems/swap-nodes-in-pairs/
ListNode* swapPairs(ListNode* head)
{
ListNode *curr = head;
// base case
if(curr == NULL || curr -> next == NULL)
return curr;
ListNode *rest = swapPairs(curr -> next -> next);
ListNode *ans = curr -> next;
ans... | ALGO | 0.999959 | 5.77775 |
feea3ea0-4850-4a90-bdaa-37a7343b3311 | Rustem1809/test2024 | L209240632baiwenyan/shiyan2.6.cpp | #include<iostream>
using namespace std;
int gcd(int a,int b)
{
while(b!=0)
{
int temp = b;
b=a%b;
a = temp;
}
return a;
}
int lcm(int a,int b)
{
return (a*b)/gcd(a,b);
}
int main()
{
int a,b;
cout<<"Enter the numbers:";
cin>>a>>b;
if(a<=0 || b<=0)
{
cout<<"Please enter positive numbers:"<<endl;
retu... | ALGO | 0.999868 | 3.442435 |
9e7295b2-edba-4df8-80c3-f10441302a5e | paulot/uva2 | 10285.cpp | #include <iostream>
#include <string>
using namespace std;
int veryBest, grid[102][102], dp[102][102], n, m, tc;
string name;
int best(int row, int col) {
if (dp[row][col] != -1) return dp[row][col];
// Try up, down, left and right
int bestSoFar = 0;
if (grid[row - 1][col] < grid[row][col]) bestSoFar = max(... | ALGO | 0.998917 | 4.379591 |
dabdfca7-dfb8-451a-9de0-71995d97b9f1 | Alrash/Practice | other/6th/1.cpp | #include <iostream>
using namespace std;
bool isContainFour(int n)
{
do
{
if (n % 10 == 4)
return true;
n /= 10;
}while(n);
return false;
}
int main()
{
int count = 0;
for (int i = 10000; i < 100000; i++)
if (!isContainFour(i))
count++;
cout << count << endl;
return 0;
}
| ALGO | 0.999126 | 4.249475 |
62bce656-b434-44c8-82ec-4abf96b5bec5 | sstefan1/llvm-local | llvm/lib/CodeGen/PostRASchedulerList.cpp | #include "AggressiveAntiDepBreaker.h"
#include "AntiDepBreaker.h"
#include "CriticalAntiDepBreaker.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/LatencyPriorityQueue.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include... | ALGO | 0.988234 | 7.188899 |
585c26af-69ea-43ca-976b-6feda23649d6 | franklee1/testcoin | src/scrypt.cpp | #include <stdlib.h>
#include <stdint.h>
#include "scrypt.h"
#include "pbkdf2.h"
#include "util.h"
#include "net.h"
#define SCRYPT_BUFFER_SIZE (131072 + 63)
#if defined (OPTIMIZED_SALSA) && ( defined (__x86_64__) || defined (__i386__) || defined(__arm__) )
extern "C" void scrypt_core(unsigned int *X, unsigned int *V... | ALGO | 0.989365 | 5.510696 |
7ad85bad-5e46-40fc-b5df-6f216d81868c | hjiang13/LLMs-in-IR | POJ-104/101/845.cpp | #include <iostream>
using namespace std;
int main()
{
int a,b,c;
for(a=1; a<=3; a++)
for(b=1; b<=3; b++)
for(c=1; c<=3; c++)
{
if(a!=b&&b!=c)
{
if((a+(c==a)+(b>a))==3&&(b+(a>b)+(a>c))==3&&(c+(c>b)+(b>a)==3))//??????????
{
if(a==3&&b==2&&c==1)//????????
cout<<"CBA";
else if(a==3&&b==1&&c==2)
cout<<"BCA";
else if(a==2&&b... | ALGO | 0.999933 | 3.866549 |
96709437-3668-4218-927f-5b0edfd94bbb | NirodhaThisum/Data-Structures-and-Algorithms | Week 6/StackArray.cpp | #include <iostream>
#include<cstdlib>
#include<ctime>
#include<chrono>
using namespace std;
using namespace std::chrono;
class Stack { // Creating the Stack
private:
int* arr; // pointer to the array used for the stack
int top; // index of the top element of the stack
int size; // size of the stack... | ALGO | 0.994306 | 6.575366 |
c780646e-ce69-4669-8e94-b6801b9b2a69 | imsangamesh/DSA-Mac | 000_DSA/011_WEEK_7_ASS/13_number_of_dice_roll_with_target_sum.cpp | //* 1155. Number of Dice Rolls With Target Sum
//* ◉ ● ⇒
//* -------------------------------------------
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
//* -------------------------------------------
int numRollsToTarget(int n, int k, int target) {
// base conditions
if (target... | ALGO | 0.999986 | 5.97446 |
31a5d7f4-1d8c-48e3-9027-8a1bc52a0453 | nicholaskarlsen/lammps-scale-vashishta | src/npair_half_size_bin_newton.cpp | // clang-format off
#include "npair_half_size_bin_newton.h"
#include "atom.h"
#include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfSizeBinNewton::NPairHalfSizeBinNewton(LAMMPS *lmp) : NPair(l... | ALGO | 0.998284 | 6.003726 |
08a2e334-131a-476e-8aaa-c20df4eeff9c | reyalo/Project_Synapse | lib/merge_sort.cpp | #include <bits/stdc++.h>
using namespace std;
int temp[100];
int arr[] = {7, 5, 4, 1, 2, 3, 8, 9};
// int arr[] = {4,3,2,1};
void mergesort(int arr[], int low, int high)
{
if (low == high)
return;
int mid = (low + high) / 2;
mergesort(arr, low, mid);
mergesort(arr, mid + 1, high);
// for (int i = low, j... | ALGO | 0.999906 | 4.424611 |
9aa89406-372a-4d5f-95c9-7e60a6f16191 | KushwahaPraveen1/CrackYourPlacement | Day12/Longest-Repeating-Character-Replacement.cpp | class Solution {
public:
int characterReplacement(string s, int k) {
int left = 0;
int maxLength = 0;
int maxCount = 0;
vector<int> count(26, 0);
for (int right = 0; right < s.length(); ++right) {
maxCount = max(maxCount, ++count[s[right] - 'A']);
i... | ALGO | 0.999985 | 6.482804 |
af120611-b0b8-4146-aeec-073f3693199d | ArtiGaund/Leetcode | 0688-knight-probability-in-chessboard/0688-knight-probability-in-chessboard.cpp | class Solution {
public:
double knightProbability(int n, int k, int row, int col) {
vector<pair<int,int>> dir={{1,2},{1,-2},{-1,2},{-1,-2},{2,1},{2,-1},{-2,1},{-2,-1}};
vector<vector<double>> prevDp(n,vector<double>(n,0));
vector curDp(n,vector<double>(n,0));
prevDp[row][col]=1;
... | ALGO | 0.999889 | 4.676049 |
50360823-2746-42ed-b2ec-e5e05d137179 | Shivanshi583/Leetcode | PlacementQuestions/Graphs/Numberofprovinces.cpp | /*
Given an undirected graph with V vertices. We say two vertices u and v belong to a single province if there is a path from u to v or v to u. Your task is to find the number of provinces.
Note: A province is a group of directly or indirectly connected cities and no other cities outside of the group.
Example 1:
In... | ALGO | 0.99999 | 6.397217 |
aea9cce1-14d4-4c17-8ae2-f36a3a2c1003 | minhvpham/codeblock | VNOI/256d.cpp | #include<bits/stdc++.h>
using namespace std;
#define task "select"
#define ll long long
#define SZ(c) c.size()
#define getbit(x,i) (((x) >> (i)) & 1)
#define turnoff(x,i) (x)&(~(1<<(i)))
#define mu2(x) (1<<x)
#define __builtin_popcount __builtin_popcountll
typedef pair<int,int> ii;
typedef vector<ll> vll;
typedef vecto... | ALGO | 0.999475 | 3.575115 |
88c2abfb-09d6-4e9c-8bc9-d8ae933be655 | pkmxier/OOP-Labs | 4lab/octagon.cpp | #include "octagon.h"
Octagon::Octagon() {
for (int i = 0; i < NUM_OF_POINTS; ++i) {
set[i].x = set[i].y = 0;
}
}
Octagon::Octagon(std::istream &is) {
for (int i = 0; i < NUM_OF_POINTS; ++i) {
is >> set[i].x >> set[i].y;
}
}
Octagon::Octagon(point *data) {
for (int i = 0; i < NUM_O... | ALGO | 0.951069 | 5.457621 |
0d3d5792-030d-47a0-b69a-7df7c1959c25 | apollopower/interview-prep | cpp/practice_questions/palindrome_permutation.cpp | #include <iostream>
#include <string>
#include <unordered_set>
bool hasPalindromePermutation(const string& str)
{
unordered_set<char> noPairs;
for (size_t i = 0; i < str.length(); i++)
{
char currentChar = str[i];
if (noPairs.find(currentChar) == noPairs.end())
{
noPai... | ALGO | 0.998765 | 6.485567 |
a3d92670-31b3-4059-94c7-f6cf0f6f103e | Nick-Heo/ArUcoTest | 3rdparty/Eigen3.3.7/unsupported/doc/examples/MatrixSinh.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXf sinhA = A.sinh();
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
MatrixXf coshA = A.cosh();
std::cout << "cosh(A) = \n"... | ALGO | 0.9945 | 5.914005 |
a64bff5b-cda5-4c97-9981-7e598a1fa4ee | welderc/exercicios-em-c | funções/OperacoesMatematicas.cpp | #include <stdio.h>
// Soma
double Soma (double num1,double num2){
return num1 + num2;
}
// Subtrao
double Subtracao (double num1,double num2){
return num1 - num2;
}
// Multiplicao
double Multiplicacao (double num1,double num2){
return num1 * num2;
}
// Potenciao
double Potencia(double num1, double num2) {
if... | ALGO | 0.947699 | 4.117193 |
415614c3-708d-43f0-8786-ef858265eec2 | cedongne/Algorithm_Practice | Baekjoon_Solution/Dijkstra/1238_Party_Dijkstra.cpp | #include <iostream>
#include <queue>
#include <vector>
#define MAX_SIZE 1001
#define INF 1000000000
int n, m, x;
std::vector<std::pair<int, int>> goGraph[MAX_SIZE];
std::vector<std::pair<int, int>> backGraph[MAX_SIZE];
std::priority_queue<std::pair<int, int>> q;
int goDistance[MAX_SIZE];
int backDistance[MAX_SIZE];
... | ALGO | 0.999928 | 4.741037 |
8a2069ab-939f-49ac-9447-a5626155b9d0 | SeeleVolle/cann-ops-clean | src/matmul/weight_quant_batch_matmul_v2/op_host/weight_quant_batch_matmul_v2_compute_matmul_tiling.cpp | /*!
* \file weight_quant_batch_matmul_v2_compute_matmul_tiling.cpp
* \brief
*/
#include "weight_quant_batch_matmul_v2_compute_matmul_tiling.h"
namespace optiling {
constexpr uint64_t DOUBLE_BUFFER_FACTOR = 2UL; // 1: off, 2: on
constexpr uint64_t MAX_SHAPE_DIM = 65535UL;
constexpr uint64_t INT4_BLK_SIZE = 64UL;
... | ALGO | 0.97901 | 5.87423 |
afe27222-56aa-459a-98dc-d12370146e3a | Keddnyo/miyolla | 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 |
93b3cef6-51ef-4207-9de0-f4e0f8a9da65 | rohan8789/Data-Structures-and-Algorithms | CodingNinjasTut/Level_02/01_LinkedList/07_InsertElementAt_itPosition.cpp |
// Sample Input 1 :
// 3 4 5 2 6 1 9 -1
// 3
// Sample Output 1 :
// 2
// Sample Input 2 :
// 3 4 5 2 6 1 9 -1
// 0
// Sample Output 2 :
// 3
#include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *next;
};
Node* createNode()
{
int n;
cin>>n;
Node *head = NULL;
... | ALGO | 0.999884 | 3.974089 |
9766ebde-aa58-4cad-86b7-1c059223eadc | varuns23/CMSPhase2GCT | phiStitch/hls/vivado_hls/src/algo_top.cpp | #include "algo_top_parameters.h"
#include "algo_top.h"
#include <algorithm>
#include <utility>
#include "stitchPhi.h"
using namespace std;
using namespace algo;
TowersInEta unpackInputLink(hls::stream<algo::axiword576> &link) {
#pragma HLS PIPELINE II=N_WORDS_PER_FRAME
#pragma HLS INTERFACE axis port=link
#pragma HL... | ALGO | 0.999012 | 4.258296 |
60613fdb-f45f-498b-8d28-25a424498102 | tips367/Data-Structures | Stack/SpecialStack that returns minimum element/SpecialStack that returns minimum element.cpp | /* Design a Data Structure SpecialStack that supports all the stack operations like push(), pop(), isEmpty(), isFull()
and an additional operation getMin() which should return minimum element from the SpecialStack. All these operations of
SpecialStack must be O(1). To implement SpecialStack, you should only use stand... | ALGO | 0.999061 | 6.284788 |
afae2668-b561-4646-a5e5-168545b0a779 | Fahimefto/Solved-problem | Codeforces/B. Honest Coach.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++)
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
int min=a[1]-a[0];
for(int j=2;j<n;j++)
{
if(a[j]-a[j-1]<min)
min=a[j]-a[j-1];
}
cout<<min<<endl;
}
}
| ALGO | 0.999742 | 3.31703 |
0655ec3d-1a47-45ef-bf87-77b03589b52d | gokulraktate/ADS_ASSIGNMENT | ADS_ASSIGNMENT/ADS5.cpp | #include <iostream>
#include <stdlib.h>
#include <string.h>
using namespace std;
struct node
{
string vertex;
int time;
node *next;
};
class adjmatlist
{
int m[10][10], n, i, j;
char ch;
string v[20];
node *head[20];
node *temp = NULL;
public:
adjmatlist()
{
for (i = 0;... | ALGO | 0.996634 | 3.358389 |
7170bfcf-eee8-4920-aaa5-cc7bcbfe5996 | joshuajenner/jjdev-leetcode | 206. Reverse Linked List.cpp | //Given the head of a singly linked list, reverse the list, and return the reversed list.
// 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(... | ALGO | 0.996735 | 5.672548 |
d73af846-8171-40cf-bb40-7329436d3dd5 | ishandutta2007/codeforces | gabrielwu/normal/1452/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i=0; i<(n); i++)
#define readVec(v) forn(i, v.size()){cin >> v[i];}
#define printArr(arr, n) forn(i, n){if (i) cout << " "; cout << arr[i];} cout << endl;
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define f first
#define s ... | ALGO | 0.999222 | 4.278108 |
8a0fa8a3-5ad2-4cd0-8b01-fa4be552f8d0 | hushuaiouc/yolov5-deepsort-TensorRT | deepsort/src/deepsort.cpp | #include "deepsort.h"
DeepSort::DeepSort(std::string modelPath, int batchSize, int featureDim, int gpuID, ILogger* gLogger) {
this->gpuID = gpuID;
this->enginePath = modelPath;
this->batchSize = batchSize;
this->featureDim = featureDim;
this->imgShape = cv::Size(64, 128);
this->maxBudget = 100;... | ALGO | 0.959466 | 6.358506 |
c63189bd-dc5b-4269-9e74-9b68bbd53968 | akshatshah21/Data-Structures-and-Algorithms | C++/Stack/Infix.cpp | #include<stdio.h>
using namespace std;
class Stack
{
private:
char arr[1000];
int size, top;
public:
Stack()
{
top = -1;
size = 0;
}
void push(char elem)
{
if(size == 1000)
{
printf("Stack FULL!\n");
}
else
{
top++;
arr[top] = elem;
size++;
}
}
char pop()
{
if(size == 0) retur... | ALGO | 0.999854 | 3.742688 |
1d3835db-1bc5-4aff-9828-46b9326721b3 | zzctommy/public-source-code | 码库/P6851 onu.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define pb(x) push_back(x)
#define mkp(x,y) make_pair(x,y)
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
char buf[1<<21],*p1=buf,*p2=buf;
#define int long long
inline int read() {
int x=0,f=1;cha... | ALGO | 0.999998 | 3.591591 |
374eccd2-af16-4049-af99-8f8a0f4ef85a | yingling-group/lammps-mspin | src/nstencil_half_multi_old_3d.cpp | #include "nstencil_half_multi_old_3d.h"
#include "atom.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NStencilHalfMultiOld3d::NStencilHalfMultiOld3d(LAMMPS *lmp) : NStencil(lmp) {}
/* ----------------------------------------------------------------------
... | ALGO | 0.873982 | 4.384547 |
521abc33-481a-4fc4-a74b-d50c332b81dc | the-fall-of-icarus/dsacpp | recursion/recursiveInsertion.cpp | #include<iostream>
#include<vector>
using namespace std;
void insert(vector<int> &arr, int i) {
int key = arr[i];
int j = i - 1;
// Move elements of arr[0..i-1], that are greater than key,
// to one position ahead of their current position
while(j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j... | ALGO | 0.999998 | 6.403615 |
4bee5608-a814-43ab-b477-346a9cf30958 | cp-geeks-adgitm/Hacktoberfest | atcoder-dp-contest-solutions/D-knapsack-1.cpp | #include <bits/stdc++.h>
using namespace std;
long long int dp[105][100005];
long long int rec(vector<int>& W, vector<int>& V, int n, int w){
if(n == 0 or w == 0){
return 0;
}
if (dp[n][w] != -1) return dp[n][w];
else if(w >= W[n-1] ){
return dp[n][w] = max(V[n-1]+rec(W, V, n-1, w-W[n-1]), rec(W, V, n-1, w));
... | ALGO | 0.999997 | 4.800241 |
e344a1e2-dbf4-446d-b238-2b114224cc08 | sicaolong163/-offer | 048数组中重复的数字.cpp | class Solution {
public:
// Parameters:
// numbers: an array of integers
// length: the length of array numbers
// duplication: (Output) the duplicated number in the array number
// Return value: true if the input is valid, and there are some duplications in the a... | ALGO | 0.999504 | 4.899894 |
ca3339bf-cd36-4a33-95a6-43d7adbabc1d | tecton/Leetcode-Exercise | Roman to Integer.cpp | class Solution {
public:
int romanToInt(string s) {
int Roman[256];
Roman['I'] = 1;
Roman['V'] = 5;
Roman['X'] = 10;
Roman['L'] = 50;
Roman['C'] = 100;
Roman['D'] = 500;
Roman['M'] = 1000;
int *number = new int[s.size()];
for (... | ALGO | 0.999117 | 6.194376 |
f6434a4b-26d9-42eb-baa5-1609f52304f4 | suezosin/jianZhiOffer2 | 068_searchInsert.cpp | class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int left=0,right=nums.size()-1;
while(left<=right){
int mid = left + (right-left)/2;
if(nums[mid]>=target){
if(mid==0||nums[mid-1]<target) {
return mid;
... | ALGO | 0.999977 | 6.373333 |
10bcb251-20f7-448d-bd67-eed226b4052e | AABNassim/Distributed-PPML | BENCHS/BENCHBuildingBlocks.cpp | // Created by nassimaab on 1/10/19.
//
#include "BENCHBuildingBlocks.h"
#include <chrono>
#include <gmp.h>
#include <string.h>
using namespace std;
using namespace std::chrono;
BENCHBuildingBlocks::BENCHBuildingBlocks() {
gmp_randinit_default(randstate);
gmp_randseed_ui(randstate,time(NULL));
dtpkc.keyge... | TOOL | 0.974941 | 5.063871 |
cae00edd-cdc4-423b-94f2-24e219b03871 | yancouto/competitive-programming | ojs/cf/538D.cpp | #include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++)
template<typename T> inline T ... | ALGO | 0.999973 | 3.697696 |
cddec6dd-16d5-4a9f-a940-cb1aa71a8fad | akashghadge/competitive-programming | Company Test/IISc Rohit/BNew.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n, x, y;
cin >> n;
int mr = 0, mw = 0, cnt = 0, j = 0;
vector<vector<int>> arr;
while (j < n)
{
cin >> x >> y;
... | ALGO | 0.999906 | 4.913144 |
ae5ab77f-436d-49c0-a6b0-856f956f6e1e | ohmingi/data-structure | 13week/13week_4.cpp | #include <iostream>
#include <vector>
using namespace std;
const int MAX_SIZE = 501;
int graph[MAX_SIZE][MAX_SIZE];
int b[MAX_SIZE];
void swap(int& a, int& b) {
int temp = a;
a = b;
b = temp;
}
void bubbleSort(vector<int>& vec) {
int n = vec.size();
for (int i = 0; i < n - 1; i++) {
for (... | ALGO | 0.999953 | 5.141039 |
c2e674ba-6ca9-4ae9-bdd4-cedd08a073f4 | virajgudhetwar/CPP-DSA-Code-Library | 17.BinaryTrees/01BinaryTrees.cpp | #include <iostream>
#include <queue>
#include <stack>
using namespace std;
// Implementing Binary tree
class node
{
public:
int data;
node *left;
node *right;
node(int data)
{
this->data = data;
right = NULL;
left = NULL;
}
};
// function to create binary tree
node *b... | ALGO | 0.999925 | 5.322421 |
e25f767f-716d-4769-ba34-457dd005ed39 | yashica-patodia/CODE_FORCES1 | 1339b.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main()
{
cin>>t,n;
while(t--)
{
lli num;
vector<lli>vec1;
vector<lli>vec2;
cin>>n;
int f=1;
for(i=0;i<n;i++)
{
cin>>num;
if(num<0)
{
f=0;
vec2.push(num);
}
else
vec1.push(num);
}
if(vec2.empty(... | ALGO | 0.999436 | 3.697705 |
7b95c8fb-e304-4721-b9b0-5a4e6fae6548 | BKYashraj/DSA | Linked List/2095. Delete the Middle Node of a Linked List.cpp | class Solution {
public:
ListNode* deleteMiddle(ListNode* head) {
ListNode* temp = head;
int len = 0;
while(temp!=NULL){
len++;
temp=temp->next;
}
if(len <= 1){
head = head->next;
return head;
}
int ans = len/2;
... | ALGO | 0.999946 | 5.935995 |
41aeac60-7f67-4264-85a1-04b0dd5b350f | komorra/CraftSaga | Mesher/Mesher/mesher_src.cpp | #include "mesher.h"
#ifdef _BENCHMARK
#include <iostream>
#include <ctime>
#endif
int vtab(int x, int y, int z)
{
return x + CS*y + CS*CS*z;
}
int vtab(int* crd)
{
return crd[0] + CS*crd[1] + CS*CS*crd[2];
}
int vtab_safe(int x, int y, int z)
{
if (x < 0)return CS*CS*CS;
if (y < 0)return CS*CS*CS;
if (z < 0)ret... | ALGO | 0.961046 | 4.34622 |
8d8f41fc-9e1b-43ba-8085-e77732c744f9 | hanm/llvm | lib/CodeGen/EarlyIfConversion.cpp | #include "llvm/ADT/BitVector.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SparseSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/Code... | ALGO | 0.967041 | 8.086118 |
9c86cded-9d2a-4e90-8fb7-c334eb363bf9 | peterzheng98/gpu-memory | src/base/pytorch/third_party/kineto/libkineto/third_party/dynolog/third_party/pfs/src/parsers/uptime.cpp | #include "pfs/parsers.hpp"
#include "pfs/utils.hpp"
namespace pfs {
namespace impl {
namespace parsers {
uptime parse_uptime_line(const std::string& line)
{
// Some examples:
// clang-format off
// 522823.22 2059843.84
// clang-format on
enum token
{
SYSTEM_TIME = 0,
I... | TOOL | 0.872256 | 7.398142 |
badcb0a4-5201-492b-84be-1d57141864ed | ThienTheCreator/Programing | 1337c0d3/1021_RemoveOutermostParentheses.cpp | /* 1021. Remove Outermost Parentheses
A valid parentheses string is either empty "", "(" + A + ")", or A + B, where A and B are valid
parentheses strings, and + represents string concatenation.
For example, "", "()", "(())()", and "(()(()))" are all valid parentheses strings.
A valid parentheses string s is primitive... | ALGO | 0.999832 | 6.044921 |
567a594d-25c0-4878-84a4-bb38f6256960 | ImranMir32/leetCode-solutions | C++ solutions/202. Happy Number.cpp | #include<bits/stdc++.h>
using namespace std;
// solution
class Solution
{
public:
int next(int n)
{
int sum = 0;
while (n != 0)
{
sum += pow(n % 10, 2);
n = n / 10;
}
return sum;
}
public:
... | ALGO | 0.999944 | 5.730244 |
54c3deee-8b51-4e25-86cc-f6d9a2f5fad6 | Anhuaqiao/autoR2C | .history/src/main_20211108165833.cpp | # include "calib_pic.h"
# include "click_pic.h"
# include "get_rd.hpp"
# include "calib_verification.hpp"
# include "ba.hpp"
# include <eigen3/Eigen/Core>
# include <eigen3/Eigen/Geometry>
# include <opencv2/core/eigen.hpp>
#define DegreeToRadians 0.017453293
using namespace std;
using namespace cv;
int main(int arg... | TOOL | 0.930305 | 3.477688 |
3e98e873-f390-4739-8410-dd272f0ebbd3 | ribhar/cppCodes | cppIntro/whileLoop.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i = 1;
while(i<=n){
cout<<i<<endl;
i++;
}
return 0;
} | ALGO | 0.997986 | 3.806947 |
3013e0af-664c-4c36-ae23-12dd7a0a2fb4 | hiranoo/atcoder | contests/abc205/c.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <bitset>
#include <stack>
#include <queue>
#include <bits/stdc++.h>
#include <atcoder/segtree>
#define rep(i, s, t) for(int i = (s); i <= (t); i++)
#define repd(i, s, t) for(int ... | ALGO | 0.999982 | 3.842691 |
97f9728e-022b-4431-a9ef-80701a06242a | raghavaggarwal99/Competitive | Codeforces/988A.cpp | #include <iostream>
#include<unordered_map>
using namespace std;
int main()
{
int n,k;
cin>>n>>k;
int q=k;
unordered_map<int,int> x;
int *a=new int[n];
int *b=new int[k];
for(int i=0; i<n; i++){
cin>>a[i];
x[a[i]]++;
}
int j=0;
for(int i=0; i<n; i++){
... | ALGO | 0.999997 | 3.584489 |
20495a82-3570-4989-b406-22ba6d062a91 | cpuggal/Study | Prateek_course/03_String_Problems/subset_string.cpp | #include<iostream>
#include<string>
using namespace std;
/*
input:
chandan
cdn
o/p
Yes
input:
chandan
chnn
o/p
Yes
input:
chandan
cdnn
o/p
No
*/
string isSubset(string s1, string s2) {
int j = 0;
for (int i = 0 ; i < s1.length(); i++) {
if (s1[i] == s2[j])
j++;
if (j == s2.length())
return "... | ALGO | 0.999866 | 3.995899 |
750a8329-0a4a-4f72-b39b-b97d8dc4a175 | firewood/topcoder | atcoder/arc_058/d.cpp | // D.
#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
static const LL MOD = 1000000007;
static const size_t MAX_N = 200050;
struct modll {
long long x;
modll() { }
modll(long long _x) : x(_x) { }
operator int() const { return (int)x; }
mo... | ALGO | 0.999579 | 3.704102 |
12247635-d8e0-4a33-acb4-0e10cb3b706f | ninad-moree/DataStructuresAlgorithms | Backtracking/0040-CombinationSum2.cpp | /*
Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate
numbers sum to target. Each number in candidates may only be used once in the combination. Note: The solution set must not contain duplicate
combinations.
... | ALGO | 0.999875 | 6.3225 |
f34e0d00-4ff8-487c-b53d-ac87fc2d3270 | MZhikoV/03_CPlusPlus_Advanced_SoftUni | 99_Test_Practice/Map_and_Set_Exercise/02. Odd Occurrences.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
map<string,int> words;
vector<string> order;
string input;
getline(cin,input);
for (size_t c=0;c<input.size();c++){
input[c]=tolo... | ALGO | 0.999753 | 4.346282 |
27143517-d8d6-4c7b-bc27-bc3567772cb6 | Labonno120/code_part1 | Array Rearrangment.cpp | #include<iostream>
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int n,x,i,mx=1,mn=1000,mx1=1,mn1=1000;
cin>>n>>x;
int a[n],b[n];
for(i=0;i<n;i++)
{
cin>>a[i];
cin>>b[i];
mx=max(mx,a[i]);
mn=... | ALGO | 0.999969 | 3.75787 |
8dfa110b-a082-4aba-b2f4-215954e51af0 | CongJyu/Pitaya | HNU-CG/HW6-Q09/HW6-Q09/main.cpp | //
// main.cpp
// HW6-Q09 判断回文数
//
// Created by cyrain on 2021/11/15.
//
#include <iostream>
using namespace std;
bool isCycle(int);
int main() {
using namespace std;
int n = 0;
cin >> n;
isCycle(n);
return 0;
}
bool isCycle(int x) {
int temp = 0;
int number = x;
while (number) {
... | ALGO | 0.999754 | 4.77392 |
92ad6265-9149-4691-aa53-41adc398669e | okinp/synapCity | src/clusterSystem.cpp | #include "clusterSystem.h"
#include "cinder/app/AppBasic.h"
extern int totalNumberClusters;
int clusterSystem::binPower = 2;
clusterSystem::clusterSystem()
{
mouseOn = false;
showInfo = false;
increasing = false;
firstTime = true;
repForce = 1;
repForce2 = 91;
attForce = 1;
neighbor = 41;
//rep 1rep2 91 att 1... | ALGO | 0.954295 | 4.109141 |
51c5e673-6cf9-474c-8995-f26b2e430b35 | hh2048/XCPC | 01 - 常用在线模板汇总/02 - 图、树、网络流/10 - VDCC (Tarjan).cpp | struct V_DCC {
int n;
vector<vector<int>> ver, col;
vector<int> dfn, low, S;
int now, cnt;
vector<bool> point; // 记录是否为割点
V_DCC(int n) : n(n) {
ver.resize(n + 1);
dfn.resize(n + 1);
low.resize(n + 1);
col.resize(2 * n + 1);
point.resize(n + 1);
S.... | ALGO | 0.99967 | 4.996246 |
b4e08267-eb41-4f55-9591-a57f09a82546 | Truonghdhdjsjs/khoahocs | 365dha/b8.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main()
{
double n , tong =0.0;
cout<<" nhap gia tri n ";
cin>> n;
for( double i=1.0; i<=n;i++)
{
tong+= (2*i+1)/(2*i+2);
cout<<" gia tri la "<<tong<<endl;
}
return 0;
} | ALGO | 0.998769 | 3.302151 |
723b6f85-4d9d-4e25-9621-9b920cff9768 | Prajjwal-5432/Leetcode-Solutions | DP/Hard/92.String Compression II(vip).cpp | //Link: https://leetcode.com/problems/string-compression-ii/
class Solution {
public:
int dp[111][111];
int len(int val) {
return val == 1 ? 0 : val < 10 ? 1 : val < 100 ? 2 : 3;
}
int dfs(string &s, int ind, int k) {
if(k < 0) return INT_MAX / 2;
if(ind >= s.length() or s.lengt... | ALGO | 0.999983 | 5.536342 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.