uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
1075ae75-f08a-45d0-95de-a126f415bdbc | tauhrick/Competitive-Programming | Upsolves/Codeforces/1495A.cpp | #ifndef LOCAL
#include <bits/stdc++.h>
using namespace std;
#define debug(...) 42
#else
#include "Debug.hpp"
#endif
class Task {
public:
void Perform() {
Read();
Solve();
}
private:
int n;
vector<int64_t> x, y;
void Read() {
cin >> n;
for (int i = 0; i < 2 * n; ++i) {
int xx, yy;
... | ALGO | 0.99875 | 4.618637 |
5a324879-c13b-4ca3-906f-f4c6e55fdf29 | ImMasterSam/SCIST-Solutions | 二章前半:資料結構與演算法/第五節:基本資料結構/Broken Keyboard (a.k.a. Beiju Text)/Broken Keyboard (a.k.a. Beiju Text).cpp | #include<iostream>
using namespace std;
struct Linked_list{
const int N = 100005;
const int END = -1;
const int HEAD = 0;
char elem[100005];
int nxt[100005];
int pt = 1; // 儲存下一個沒有使用過的編號為何
int ptr = HEAD;
void init(){
pt = 1;
nxt[HEAD] = END;
ptr = HEAD;
}
void Home(){
p... | ALGO | 0.997595 | 3.764271 |
de157a67-c97b-40c0-89d6-802ad75986bf | JaekwonHa/problem_solving | BOJ contest/P3015 오아시스 재결합.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <deque>
using namespace std;
#define INF 987654321
#define mod 1000000007
#define... | ALGO | 0.999834 | 3.838301 |
f0e4d10c-74d2-4ace-9a98-d8c03473fa20 | geekygirl8/Hacktoberfest_2022_DSA | C++/C++/max-difference-you-can-get-from-changing-an-integer.cpp | // Time: O(logn)
// Space: O(logn)
class Solution {
public:
int maxDiff(int num) {
const auto& digits = to_string(num);
char b;
for (const auto& c : digits) {
if (c < '9') {
b = c;
break;
}
}
char a;
if (digits... | ALGO | 0.999895 | 6.105446 |
58206081-f7e0-4bd7-839f-ca649756f9af | IshratMim/Coodeforces | gifts_fixing.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int n,x,y;
cin>>n;
long long a[n+1],b[n+1];
x=10000000007, y=10000000007;
for(int i=0;i<n;i++){
cin>>a[i];
if(x>a[i]){
x=a[i];
}
... | ALGO | 0.999982 | 3.79546 |
5035b604-8b61-440e-b93e-63680c690c0f | phantom1996/CBLPEDEC-19 | lecture 22/minstep.cpp | // minstep
#include <iostream>
#include <climits>
using namespace std;
int MIN_Step(int n){
if(n==1){
return 0;
}
int op1,op2,op3;
op1=op2=op3=INT_MAX;
op1=MIN_Step(n-1)+1;
if(n%2==0){
op2=MIN_Step(n/2)+1;
}
if(n%3==0){
op3=MIN_Step(n/3)+1;
}
return min(op1,min(op2,op3));
}
int Topdown(int n,int... | ALGO | 0.999966 | 4.268244 |
d0e92831-57c6-4410-aafb-a99ae8bcfe0d | vain0x/openhsp-fork | trunk/package/win32/android/extlib/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp | #include "btSphereSphereCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h"
btSphere... | ALGO | 0.997077 | 6.552449 |
ee740bfd-6877-4445-a193-a7cadcc2a757 | adurie/code-base-realistic-tight-binding | Gigantic/slab_DOS/CH_PDOS.cpp | #include <cmath>
#define EIGEN_USE_MKL_ALL
#include <iostream>
#include <eigen3/Eigen/Dense>
#include <vector>
#include <iomanip>
#include <fstream>
// Orthogonal matrix: inverse is equal to it's conjugate transpose. The eigenvectors of a Hermitian matrix are orthogonal
// we will be exploiting this fact
using namespa... | ALGO | 0.999547 | 4.107283 |
cb29d9c3-cc99-4036-ad4a-027c1719edf1 | pingchungchang/CP | tioj1299.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s;
while(cin>>s){
int ans =0;
for(int i =0;i<s.size();i++){
if(s[i]>='a'){
ans += s[i]-'a'+1;
}
else ans += s[i]-'A'... | ALGO | 0.999816 | 3.779921 |
89b0a91c-9fce-4c95-ad38-58d664ee58a1 | KailasMahavarkar/interview-prep | Practice/Sorting/day12.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <utility>
#include <vector>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
void printVector(vector<int> nums) {
for (auto x : nums) {
cout << x << " ";
}
cout << endl;
}
int partition(int s, int e, vector<int> &nums... | ALGO | 0.999965 | 5.783104 |
de6b9438-5417-4c78-99d7-ade1a4bf6209 | artiam99/GeeksforGeeks | 15 Advanced Data Structures/5 Self Balancing Binary Trees/3 B Trees/2 B Trees Delete.cpp | #include<bits/stdc++.h>
using namespace std;
class BTreeNode
{
int *keys;
int t;
BTreeNode **C;
int n;
bool leaf;
public:
BTreeNode(int _t, bool _leaf);
void traverse();
BTreeNode *search(int k);
int findKey(int k);
void insertNonFull(int k);
void splitChild(int i, BTreeNode *y);
voi... | ALGO | 0.999945 | 4.316922 |
a7390760-961a-4b83-a8de-b82917083b95 | souravsaha51/Leetcode-and-GFG-Problems | 2160-minimum-sum-of-four-digit-number-after-splitting-digits/2160-minimum-sum-of-four-digit-number-after-splitting-digits.cpp | class Solution {
public:
int minimumSum(int num)
{
// vector
vector<int> vec;
// extract the digit
while (num !=0)
{
int d = num % 10;
if(d!=0)
vec.push_back(d);
num = num / 10;
}
// sorting the numbers
sort(vec.begin(),vec.end());
/... | ALGO | 0.999984 | 5.972743 |
d2bbcbeb-f325-4f48-aa64-f2bd4ee33d11 | developers8085/leetcode-solutions | Anagram - GFG/anagram.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function is to check whether two strings are anagram of each other or not.
bool isAnagram(string a, string b){
/*
int hs[26]={0};
if(a.size() != b.size())
... | ALGO | 0.999911 | 6.524815 |
04e84327-7bd3-4f6b-a825-d45911fd3e25 | bliscosque/CPPProblemsVSCode | CourseUdemy/Backtracking/targetSum.cpp | #include <bits/stdc++.h>
using namespace std;
int cnt = 0;
void findTargetSumWaysRec(vector<int> nums, int target, int pos, int sum) {
if (pos==nums.size()) {
if (sum==target) {
cnt++;
}
return;
}
findTargetSumWaysRec(nums,target,pos+1,sum+nums[pos]);
findTargetSum... | ALGO | 0.999876 | 5.779668 |
9aa48be6-3cc6-429c-86df-877bba181b32 | JakariyaHossain/get_api | 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.99887 | 6.783439 |
aa8b89e3-1dc3-4d4d-ac37-e8f65b46e655 | santr4/DSA-2.0 | striver/Dynammic Programming/tut11.cpp | // 120. Triangle
class Solution
{
public:
int minPathSum(int i, int j, vector<vector<int>> &triangle, int n, vector<vector<int>> &dp)
{
if (dp[i][j] != -1)
{
return dp[i][j];
}
if (i == n - 1)
{
return triangle[i][j];
}
int down = ... | ALGO | 0.99998 | 6.071839 |
0e2c2654-2e79-4cde-a0bd-4579ab46ca54 | seminsim/study | hackerrank/johnland/floyd.cpp | #include <cmath>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <iostream>
#include <string>
#include <limits>
#include <algorithm>
using namespace std;
int N, M;
vector< vector< set<int> > > d;
void input()
{
cin >> N >> M;
d.resize(N, vector< set<int> >(N));
int f, t, w;
for (int... | ALGO | 0.999977 | 3.78106 |
95734538-1710-4212-8a3c-fac9255eebdf | ljkgpxs/onscripter-GBK-2015 | conv_shared.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern "C"{
#include <jpeglib.h>
};
#include <bzlib.h>
#include "resize_image.h"
int scale_ratio_upper;
int scale_ratio_lower;
unsigned char *rescaled_tmp2_buffer = NULL;
size_t rescaled_tmp2_length = 0;
unsigned char *rescaled_tmp_buffer = NULL;
size_t resca... | TOOL | 0.903825 | 4.885741 |
f243b6cb-6f85-4e30-95c1-21c3c59bd197 | Vanshika35/-CrackYourPlacement | day4/4Sum.cpp | // class Solution {
// public:
// vector<vector<int>> fourSum(vector<int>& nums, int target) {
// int n = nums.size();
// set<vector<int>> st;
// for(int i = 0; i < n; i++){
// for(int j = i+1; j< n; j++){
// for(int k = j+1; k<n; k++){
// for... | ALGO | 0.999979 | 5.86338 |
f2ecf2ea-7e52-4a8f-9ead-b9a15d498c58 | Jackent2B/My-DSA | Bit Manipulation/Minimum XOR Pairs.cpp | #include <bits/stdc++.h>
using namespace std;
// Note: you vae to do it in O(nlogn)
int minimumXOROfPair(vector<int>& arr) {
int minans = INT_MAX;
// sort the array
sort(arr.begin(),arr.end());
for (int i = 0; i < arr.size()-1; ++i)
minans = min(minans,arr[i]^arr[i+1]);
return minans;
... | ALGO | 0.999951 | 4.90398 |
2dff158f-c296-488e-8389-2f5fc5c00484 | Srijanakash/Coding | LeetCode/Practice/FindKPairsWithSmallestSum.cpp | /*
You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k.
Define a pair (u,v) which consists of one element from the first array and one element from the second array.
Find the k pairs (u1,v1),(u2,v2) ...(uk,vk) with the smallest sums.
Example 1:
Input: nums1 = [1,7,11], nums2 = ... | ALGO | 0.999995 | 5.987156 |
27e7849e-ca5d-4d8d-ad7a-8b3855955070 | ishandutta2007/codeforces | yuu/normal/1276/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define next Rin
string s;
int f[150001][6];
int trace[150001][6];
int next[6][256];
int n;
void solve(){
cin>>s;
n=s.size();
s='0'+s;
for(int i=1; i<=n; i++) for(int j=0; j<6; j++) f[i][j]=1e9;
for(int i=0; i<n; i++) for(int j=0; j<5; j++){
if(f[i+1][next[j][... | ALGO | 0.999978 | 4.544207 |
7468ca6d-d0b9-4fb2-abdc-96473789f521 | SCR01/-CrackYourPlacement | Trees/PopulatingP.cpp |
class Solution {
public:
Node* connect(Node* root) {
if(root==NULL)return root;
queue<Node *> q;
q.push(root);
while(!q.empty()){
int n=q.size();
for(int i=0;i<n;i++){
Node *t=q.front();
q.pop();
if(t->left!=NU... | ALGO | 0.999911 | 5.145104 |
4f8f739f-2927-402f-9a78-c30989cb2d05 | shayans66/Leetcode-work | two-sum/two-sum.cpp | #include <bits/stdc++.h>
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int, int> map;
vector<int> ans;
for(int i=0; i < nums.size(); i++){
int comp = target - nums[i];
if( map.count(comp) ){
... | ALGO | 0.999761 | 6.063067 |
3a2dceee-6db1-4bbc-8fea-a96ac85ca0d6 | dotOS-FE/android_system_core | libprocessgroup/setup/cgroup_map_write.cpp | //#define LOG_NDEBUG 0
#define LOG_TAG "libprocessgroup"
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <pwd.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <regex>
#include <android-base/... | TOOL | 0.870511 | 4.317592 |
889f72e7-9a13-414f-8a80-0ad613768bb6 | mistysamia/Algorithm_Data_Structure | DP/DP_LCS.cpp | ///print the Length and the String
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define SIZE 1000
ll save_datarec[SIZE][SIZE];
ll save_datait[SIZE][SIZE];
string s1,s2;
ll length;
///recursive way
ll length_recursive(ll len1,ll len2)
{
if(len1==s1.size()||len2==s2.size())
return 0;
... | ALGO | 0.999999 | 3.897044 |
96041fb4-774d-45c1-8883-ab628cdc2711 | rohan270/DSA-course-practice- | pattern15.cpp | #include <iostream>
using namespace std;
int main (){
int n ;
cin >> n;
int i = 1;
while (i<=n){
int j = 1;
while(j<=n-i){
cout<< " ";
j++;
}
int k = 1;
while (k<=i){
cout<<"*";
k++;
}
i++;
c... | ALGO | 0.999951 | 3.745125 |
7d00d0ef-0873-40b0-9595-0971564efb97 | Sayemahamed/cpp | B_Watering_System.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long pipes, water, need, first, total = 0, i = 0;
cin >> pipes >> water >> need >> first;
vector<long long> dat(pipes - 1);
for (auto &it : dat)
cin >> it, total += it;
total+=first;
sort(dat.begin(), dat.end());
lon... | ALGO | 0.999943 | 3.315159 |
cd35ba8e-5510-4642-8834-fd92aaeb0666 | Seann0425/LeetCode | finished/1971. Find if Path Exists in Graph.cpp | #include <bits/stdc++.h>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {
}
ListNode(int x) : val(x), next(nullptr) {
}
ListNode(int x, ListNode *next) : val(x), next(next) {
}
};
struct TreeNode {
int val;
TreeNode *left;
... | ALGO | 0.999997 | 5.761318 |
517a3e62-d9e4-48b3-baa2-8bd26ced9e6d | ishandutta2007/codeforces | huangxiaohua/normal/1151/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define M 1000000007
ll l,r,res,i,a=1,b=1;
ll j1=1,o1=2,inv2=500000004;
bool sb;
ll chk(ll l,ll r,ll sb){
l-=a;r-=a;
ll sb1,sb2;
sb1=sb+2*l;
sb2=sb+2*r;
//printf("%lld %lld %lld %lld %lld\n",l,r,sb1,sb2,r-l+1);
return (sb1%M+sb2%M)%M*((r-l+1)%M... | ALGO | 0.999957 | 3.881795 |
4f2cb343-6fef-41c4-bc1c-910b8403d308 | LoppA/Problem-Solutions | LeetCode/Leetcode_2577.cpp | class Solution {
typedef pair<int, int> ii;
static const int INF = 1e9+9;
int n;
int m;
bool inside(int i, int j) {
if (i < 0 or j < 0 or i >= n or j >= m) {
return false;
}
return true;
}
public:
int minimumTime(vector<vector<int>>& grid) {
if (min(grid[0][1], grid[1][0]) > 1) {
return -1;... | ALGO | 0.999991 | 5.951589 |
4a1b83a1-611d-4012-b484-6c51c653d9f7 | kirollosatef/problem-solving | others/pst-coach/week#4.2/D_Assigning_to_Classes.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
int a[2 * n];
for (int i = 0; i < 2 * n; i++)
cin >> a[i];
sort(a, a + 2 * n);
cout << (a[n] - a[n - 1]) << e... | ALGO | 0.999445 | 3.83233 |
7fa53dcd-2e50-4b68-a759-c7c6670d6286 | ishandutta2007/codeforces | bluediamond/normal/869/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937 rng((long long) (new char));
ll get2() {
return (ll) rng() * rng();
}
ll get() {
return get2() ^ get2();
}
const int N = 2500 + 7;
const int Q = 100000 + 7;
int n, m, q;
ll t[N][N];
map<vector<int>, ll> tr;
ll get(int r, int c) {
... | ALGO | 0.999689 | 5.537404 |
f5069e8f-73f6-4ac5-bcca-fa9003347532 | keithhenning/technical-interviews | data structures and algorithms/cpp/08_070.cpp | #include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
// Find maximum joy from holiday cards
int maxHolidayJoy(vector<int>& joyRatings,
int minCards, int maxCards) {
int n = joyRatings.size();
// Check if we have enough cards
if (n < minCards)... | ALGO | 0.99995 | 6.167086 |
cea8e277-2f43-44e4-b3d4-06a35f38407e | patpro28/maketest | math/matrix_det/sol/correct.cpp | #include <iostream>
#include <vector>
#include <cassert>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <uin... | ALGO | 0.99996 | 4.130668 |
657afa48-434b-4e38-9bd2-e8470706cdad | yougatup/yougatup.github.io | POSCAT/upload/code/acmicpc/1789.cpp | #include <iostream>
using namespace std;
int main()
{
long long int i,n,s=0;
cin>>n;
for(i=1;i<=n;i++)
{
s+=i;
if(s>n)
break;
}
cout<<i-1<<endl;
return 0;
}
| ALGO | 0.999816 | 3.428607 |
b2e2a1e5-74c0-4816-9203-a2f80e9c7587 | sajalprajapati/Take-you-forward | Linked List/Easy Level Questions/Doubly Linked List/deletion of the doubly linked list/at any position you want to delete the doubly linked list/deletion.cpp | #include <bits/stdc++.h>
using namespace std;
class node {
public:
int data;
node* next;
node* prev;
node(int data) {
this->data = data;
this->next = nullptr;
this->prev = nullptr;
}
};
node* createDoublyLinkedList() {
int numberOfNodes;
cout << "\nEnter the number... | ALGO | 0.999925 | 6.535453 |
79c8f086-9f3b-4bcd-95f9-942abb101550 | SongRb/OnlineJudge | SJTU/SJTU 1379.cpp | #include<iostream>
#include <cstdio>
using namespace std;
int N;
int preLength[3000] = { 0 };
int main()
{
scanf("%d", &N);
int sum = 0;
long long int result = 0;
int cnt = 0;
for (int i = 1; i <= N; ++i)
{
int x;
scanf("%d", &x);
preLength[i] = preLength[i - 1] + x;
sum += x;
}
for (int i = 0; i <= N... | ALGO | 0.999457 | 3.36781 |
6e80a898-adcd-45c5-9c67-39c95140bc36 | parthjadav29/Assignment | module_4_3/2_sort_array_templates.cpp | #include<iostream>
using namespace std;
template<class S>
void sort(S a[],S n){
for (int i = 0; i < n-1; i++)
{
for (int j = i+1; j<n; j++)
{
if (a[i]>a[j])
{
S temp;
temp=a[i];
a[i]=a[j];
a[j]=temp;
... | ALGO | 0.999546 | 4.271834 |
c1bec0e2-db6a-4bf1-9028-ffb3a155c9fe | hajimeIppo-cmd/cp-codes | Baekjoon OJ/02000-02999/2065.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <cassert>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fr first
#define sc second
#define vt vector
#define all(c) (c).begin(), (c).end()
#define sz... | ALGO | 0.999906 | 3.361632 |
3ac08860-8a51-4ea5-9795-a7d47809bd3f | pierre-x/kicad_better_bmp2comp | common/filename_resolver.cpp | #include <fstream>
#include <mutex>
#include <sstream>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/msgdlg.h>
#include <pgm_base.h>
#include <trace_helpers.h>
#include "common.h"
#include "filename_resolver.h"
// configuration file version
#define CFGFILE_VERSION 1
#define RESOLVER_CONFIG wxT( "3Dresolv... | TOOL | 0.949961 | 6.249657 |
b5f88ac8-f842-4341-9106-6c32de16f49c | pvs-hd-tea/TCrules | c2c-translator/data/geeks_for_geeks_dataset/cpp/SMALLEST_POWER_OF_2_GREATER_THAN_OR_EQUAL_TO_N.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
unsigned int f_gold ( unsigned int n ) {
unsigned count = 0;
if ( n && ! ( n & ( n - 1 ) ) ) return n;
while ( n != 0 ) {
n >>= 1;
count += 1;
}
... | ALGO | 0.987507 | 6.277437 |
f87bbb71-3cf7-4895-8f5b-f3a70dc8daea | ishandutta2007/codeforces | shmilyty/normal/1194/G.cpp | #pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define elif else if
#define ALL(x) x.begin(),x.end()
using namespace std;
void fileio(const string &s)
{
freopen((s+".in").c_str(),"r",stdin);
freopen((s+".out").c_str(),"w",stdout);
}
const int INF=4e18;
inline int read()
{
int x=0;
bool ... | ALGO | 0.999945 | 4.918938 |
532075e7-e0e9-4073-9143-adb24a012ae5 | preetisoni123/Tree | inOrder.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node* left;
Node* right;
Node(int data):data(data), left(NULL), right(NULL)
{}
};
void preOrder(Node* node)
{
if(!node)
return;
cout << node->data << " ";
preOrder(node->left);
preOrder(node->right);
... | ALGO | 0.999427 | 5.857813 |
18f005f2-dd73-4fd5-a10f-6ad938dd0605 | Shorya7/CrackYourPlacement | Day 3/bestTimeToBuyAndSellStock.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int b=prices[0],ans=0;
for(int i:prices){
if(b>i)b=i;
else if(i-b>ans)
ans=i-b;
}
return ans;
}
}; | ALGO | 0.999711 | 6.056229 |
da23988b-1543-4632-9781-b8c08924b327 | iamslash/learntocode | leetcode/ShortestCommonSupersequence/a.cpp | #include <cstdio>
#include <string>
#include <vector>
// 312ms 23.74% 301.7MB 100.00%
// dynamic programming
// O(MN) O(MN)
class Solution {
private:
std::string lcs(std::string& a, std::string& b) {
int m = a.size(), n = b.size();
std::vector<std::vector<std::string>> C(
m + 1,
std::vector... | ALGO | 0.999984 | 5.386653 |
6fe2055b-59de-4f59-933c-0837ee0be717 | pmares/decs | src/dance/dance.cpp | #include <iostream>
#include <fstream>
#include <string>
#include "dlx.h"
#include "dfileio.h"
#include "sbmatrix.h"
#include "decs.pb.h"
const char* VERSION = "0.3.0";
using namespace std;
/**
* Prints command line options.
*/
void print_usage() {
cout <<
"Usage: dance [options] [file]\n"
"\n"
"Options:\... | TOOL | 0.993442 | 6.082687 |
51ddfdce-4302-45e3-9e33-6855a408aec5 | Delicate314/CCF | ccf/202312-2.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;
int main()
{
int q;
int n,k;
int i,j,h;
int count=0;
int temp;
int rest=1;
int vis[100001]={};
int pri[100001]={};
int nn=100000,m=0,cnt=0;
vector<int>p,t;
//ҳ1-10^5ڵ
for ( i = 2; i <= nn; i ++ )//ŷɸ ʱ临ӶȻΪOn
... | ALGO | 0.999956 | 3.301416 |
eb357d71-0f87-4252-8ca2-41a6d330bb4f | garimasingh128/CP-DSA-Cpp-C | linkedlistrepresentationofstack.cpp | #include <bits/stdc++.h>
using namespace std;
/* List Structure */
typedef struct Node
{
int data;
struct Node *link;
}node;
node *head=NULL; // Head node to keep track of list
/* Driver Functions */
void Push(int data);
int Top();
void Pop();
/* Main Method */
int main()
{
Push(0);
Push(1);
Push(2);
Push(3)... | ALGO | 0.999579 | 4.391313 |
023c2dea-f876-4aa0-8962-e5c486a17dcd | Aryan-Rajput/EthiScan-AI-Powered-Dark-Pattern-Detection-in-E-Commerce | EthiScan_Mobile_App-main/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.998651 | 6.761023 |
9220845c-9096-4d65-985f-3c7f3fcfa6ed | imrangit07/LEARNING-CPP | array/pallindrom.cpp | #include <iostream>
using namespace std;
int main()
{
int arr[] = {1, 2, 3, 2, 5};
int i=0;
int j=4;
while (arr[i]!=arr[j])
{
if(arr[i]!=arr[j]){
cout<<"This is not pallindrom";
return 0;
}
i++;
j--;
}
cout<<"This is pallindrom";
... | ALGO | 0.999316 | 3.515055 |
13b3194c-758f-4d27-9f77-340bf2ee7a5e | Haroon300/C-LAB | C++ Code/directed_graph.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int val){
data = val;
next = NULL;
}
};
class Stack{
private:
Node* top ;
public:
Stack(){
top = NULL;
}
void push(int val){
Node* sNode = new Node(val);
... | ALGO | 0.999073 | 3.856862 |
f8c9df45-1c37-409a-aa99-eae1b2d3acae | Randowlh/Project_ACM_2021 | code/competition/nodecoder_2_19/2.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=310000;
#define inf 0x7FFFFFFF
struct LCF
{
struct Edge
{
int from;
int to;
int flow;
int cost;
Edge(int fr, int t, int f, int cc) : from(fr), to(t), flow(f), cost(cc) {}
};
int book... | ALGO | 0.999961 | 3.268254 |
7aabd8b2-b3dc-4b2e-b280-fa6ea4132b7e | ishandutta2007/codeforces | tfg/normal/498/C.cpp | #include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <utility>
typedef std::pair<int, int> ii;
template <class T = int>
class Dinic {
public:
struct Edge {
Edge(int a, T b){to = a;cap = b;}
int to;
T cap;
};
Dinic(int n) {
edges.resize(n);
this->n = n;
}
T maxFlow(int src, i... | ALGO | 0.999889 | 3.771406 |
bc45eb01-95af-48da-b14e-c886f4504934 | Vedantjn/Striver-s-SDE-Sheet | Heaps_Merge_k_Sorted_Arrays.cpp | class node{
public:
node data;
int i;
int j;
node(int data, int row, int col){
this->data = data;
i = row;
j = col;
}
};
class compare{
public:
bool operator()(node* a, node* b){
return a->data < b->data;
}... | ALGO | 0.999983 | 5.27424 |
06973c39-13b2-41c1-bca1-c03dd7029c13 | wooseokCho/ps_study | 정선/c++/programmers/최대공약수와최소공배수.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
vector<int> divisor(int n) {
int d = 2;
vector<int> divisors;
divisors.push_back(1);
while (n != 1) {
if ((n % d) == 0) {
n = n / d;
divisors.push_back(d);
... | ALGO | 0.999967 | 4.524622 |
e972118c-3907-43d9-8177-f0470041c88f | leok7v/zipeg | zipeg-mac/p7z/p7z/CPP/Common/MyMap.cpp | // MyMap.cpp
#include "StdAfx.h"
#include "MyMap.h"
static const unsigned kNumBitsMax = sizeof(UInt32) * 8;
static UInt32 GetSubBits(UInt32 value, unsigned startPos, unsigned numBits)
{
if (startPos == sizeof(value) * 8)
return 0;
value >>= startPos;
if (numBits == sizeof(value) * 8)
return value;
r... | ALGO | 0.999493 | 5.714339 |
b76c64b8-7a18-4fcb-b4d0-b5dd6acfeea0 | PriDhingra/Tree | diameterOfBinaryTreeUsingNComplexity.cpp | #include<iostream>
#include<queue>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
Node(int data) {
this -> data = data;
this -> left = NULL;
this -> right = NULL;
}
};
Node* buildTree(Node* &root) {
cout<<"Enter data to be... | ALGO | 0.999982 | 4.829269 |
d207e3ed-469c-4c91-8f9d-504a2e988384 | GuacheSuede/MSSubmission1234567890 | submission/macd/boost_1_69_0/libs/compute/perf/perf_prev_permutation.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/next_permutation.hpp>
#include <boost/compute/algorithm/prev_permutation.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
retu... | ALGO | 0.997476 | 5.289071 |
cf9619e0-2ef1-4430-9a68-4c907a7e975e | ishandutta2007/codeforces | origenes/normal/1332/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#de... | ALGO | 0.998828 | 3.680772 |
7cae3d96-8aec-490d-be58-4265dc32aaf3 | mathiramilo/programming-2 | tarea3/src/iterador.cpp | /*5665788*/
#include "../include/iterador.h"
#include "../include/utils.h"
#include <assert.h>
#include <stdlib.h>
typedef struct nodoIt *PNodoIt;
struct nodoIt {
nat elem;
PNodoIt sig;
};
struct repIterador {
PNodoIt inicio, fin, actual;
bool bloqueado;
};
TIterador crearIterador {
TIterador res = new rep... | ALGO | 0.878984 | 4.111012 |
eab6ce34-0686-4e7f-ab12-822b88bfdae1 | AkKsenia/computer_graphics | lab4/кг_lab4/convexity_and_orientation.cpp | #include "library.h"
#include "convexity_and_orientation.h"
// checking the intersection of segments
bool doIntersect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
double denom = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
if (denom == 0) {
return false;
... | ALGO | 0.999813 | 5.439222 |
1fe1f595-cf4b-40cf-b079-bc15ae95831c | AshishKhatkar/Codechef | PRCNSR14/HTLPLM.cpp | /*
ID: ashish1610
PROG: Helping Sugam
LANG: C++
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,q;
scanf("%d %d",&n,&q);
pair<ll,ll> p[n];
for(int i=0;i<n;++i)
scanf("%lld %lld",&p[i].first,&p[i].second);
while(q--)
{
... | ALGO | 0.999905 | 3.876571 |
225d91d6-f88c-4baa-9b6b-070f842dad89 | DoHoangAnh2007/codeforces_master | D-set/1506D. Epic Transformation.cpp | /***from dust i have come, dust i will be***/
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define dbg printf("in\n")
#define nl printf("\n")
#define N 1010
#define inf 1e9
#define sf(n) scanf("%d", &n)
#define sff(n,m) scanf("%d%d",&n,&m)
#define sfl(n) scanf("%I64d", &n)
#... | ALGO | 0.99966 | 3.712671 |
cc272311-6412-4ec4-9557-a2dcdb6efe31 | soyyuz/opencv-contrib-ARM64 | opencv/opencv_contrib-master/modules/ximgproc/samples/seeds.cpp | #include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/ximgproc.hpp>
#include <ctype.h>
#include <stdio.h>
#include <iostream>
using namespace cv;
using namespace cv::ximgproc;
using namespace std;
void trackbarChanged(int... | TOOL | 0.937836 | 5.982054 |
7b2c2028-b73d-46e4-b250-1026d17dbea2 | faridhimawann/Aplikasi-Menu-Makanan | 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 |
dcd4e6f2-09e0-4e7a-ae65-e262eb76a6f7 | zakaria-kabir/CSE203-Data-Structure-Codes | bottle7uP/Source.cpp | #include<iostream>
using namespace std;
int up(int a);
int sevenup(int n) {
if (n < 3) {
return 0;
}
else if (n %3 == 0){
return 1 + sevenup(n - 1);
}
else if (n==2) {
return 1;
}
else {
return up(n);
}
}
int up(int x) {
if (sevenup(x) / 3 >= 0) {
return sevenup(x) / 3;
}
return up(x) + seven... | ALGO | 0.999829 | 3.694817 |
ea5281eb-c2e0-42e5-b96c-3b913d26ff58 | SelfishOlex/LYBook_1.27 | dev/Gems/CryLegacy/Code/Source/CryAISystem/AIRadialOcclusion.cpp | #include "CryLegacy_precompiled.h"
#include "AIRadialOcclusion.h"
#include "Cry_Vector3.h"
#include "DebugDrawContext.h"
#include <math.h>
// Comment this out to do immediate raycasts.
#define USE_ASYNC_RAYCASTS 1
//====================================================================
// CAIRadialOcclusion
//=========... | ALGO | 0.975588 | 4.953329 |
5ed270f3-8528-431b-b861-fef6e43b95b2 | taatzz/LeetCode | 124_doble.cpp | #include <vector>
#include <unordered_map>
#include <algorithm>
#include <cstring>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_set>
using namespace std;
// T1
// class Solution {
// public:
// int maxOperations(vector<int>& nums) {
// ... | ALGO | 0.999863 | 5.64293 |
953730b0-11af-420a-b996-dc5f31cb2f49 | sohancms/Program1 | Programming contest/A_Regular_Bracket_Sequence.cpp | #include <iostream>
using namespace std;
void solve()
{
int t;
cin >> t;
while (t--)
{
string s;
cin >> s;
int n = s.size();
if (n % 2 == 1 || s[n - 1] == '(' || s[0] == ')')
{
cout << "NO" << endl;
}
else
{
cout << ... | ALGO | 0.999254 | 4.501116 |
4cb3a20a-eb09-4228-9679-6481d0d73739 | nerzhul/MangosFX | src/bindings/ScriptDev2/scripts/eastern_kingdoms/westfall.cpp | /* ScriptData
SDName: Westfall
SD%Complete: 90
SDComment: Quest support: 155, 1651
SDCategory: Westfall
EndScriptData */
/* ContentData
npc_daphne_stilwell
npc_defias_traitor
EndContentData */
#include "precompiled.h"
#include "escort_ai.h"
/*######
## npc_daphne_stilwell
######*/
enum
{
SAY_DS_START = -... | TOOL | 0.929176 | 6.700528 |
0ffb6ed9-9c58-4d14-8d26-a75d6072c0e2 | alcidesmig/maratona | contest_ferias_IFSULDEMINAS_2/a.cpp | #include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int fat(int x) {
if (x == 1 || x == 0) return 1;
return x * fat(x - 1);
}
long long calc(long long len) {
return (len - 1) * pow(10, len - 2);
}
int char2int(char x) {
return (int) x - 48;
}
long long f(string x, int value) {
... | ALGO | 0.997507 | 3.779093 |
f9a9d57a-2fde-4062-94a0-8f7733c39570 | Saboyaa/cpp_h0 | G.cpp | #include <iostream>
using namespace std;
int main(){
int a=0;
string s;
cin>>s;
for(int i = 0;i<s.length();i++){
a += int(s[i])-int('0');
}
if(a%9 == 0){
cout<<"Yes";
}
else{
cout<<"No";
}
return 0;
} | ALGO | 0.99989 | 3.624157 |
4be5bf6f-9895-4478-b15d-11e740d20e42 | BadshahYadav/stiversSheetPratice | mergeSort.cpp | #include <iostream>
#include <vector>
using namespace std;
void merge(int arr[], int low, int mid, int high)
{
vector<int> temp;
int left = low;
int right = mid + 1;
while (left <= mid && right <= high)
{
if (arr[left] <= arr[right])
{
temp.push_back(arr[left]);
... | ALGO | 0.999984 | 5.071395 |
8c7fbf9a-f232-4b64-9f13-5eb636b6520b | IlyaMolochko/BSU | Algorithms on strings/cyclic_shift.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int get_shift(string &s, int n) {
vector<int> p(s.size());
int k = 0;
int answ = -1;
for (int i = 1; i < s.size(); ++i) {
while (k > 0 and s[i] != s[k]) {
k = p[k - 1];
}
if (s[i] == s[k... | ALGO | 0.999943 | 4.9185 |
58ce8217-fbc1-45d5-b37c-797b845ce764 | AKC23/Programming-problems-solutions | AtCoder/AtCoder Beginner Contest 169/B - Multiplication 2.cpp | /**
B - Multiplication 2
Link : https://atcoder.jp/contests/abc169/tasks/abc169_b
*/
#include <bits/stdc++.h>
#define int long long
#define inf 1000000000000000000 /** inf = 10^18 */
using namespace std;
signed main()
{
int n,sum;
n = sum = 1;
cin>>n;
int a[n];
for (int i=0; i<n; i+... | ALGO | 0.99989 | 3.667113 |
99e65c2c-d12b-4711-a089-1140b1c6d7bc | Igor1208gabriel/Exercicios-Programacao-Competitiva | AtCoder/2023/AtCoder 10.07/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
bool tf = true;
string s; cin >> s;
for(int i = 1; i <= 16; i +=2){
if (s[i]=='1'){
cout << "No\n";
tf = false;
break;
}
}
if(tf){
cout << "Yes\n";
}
}
| ALGO | 0.999935 | 3.536297 |
90f0db39-6cbb-4009-9cf6-1802ae008893 | ishandutta2007/codeforces | user202729_/normal/1292/C.cpp | // >.<
#ifndef LOCAL
#define NDEBUG 1
#endif
#include<bits/stdc++.h>
int nnode;
std::vector<std::vector<int>> ad;
std::vector<int> sts,par;
int dd(int node,int par_node=-1){
par[node]=par_node;
sts[node]=1;
for(int child:ad[node])if(child!=par_node){
sts[node]+=dd(child,node);
}
return sts[node];
}
std::vecto... | ALGO | 0.999338 | 4.383373 |
2362a14b-bab0-4835-9e7f-da128a068ddd | scslab/cowl | content/media/android/AndroidMediaReader.cpp | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
#include "AndroidMediaReader.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/TimeRanges.h"
#include "mozilla/gfx/Point.h"
#include "MediaResource.h"
#include "VideoUtils.h"
#include "Androi... | TOOL | 0.875896 | 7.332325 |
51500703-8ed2-4fd0-bdcf-be30227ad77e | Naveen31Sekar/CRYPTOGRAPHYNAVEENAS | EXPERIMENT8_nAVEENas.cpp | #include<stdio.h>
#include<conio.h>
long long int power(int a, int b, int mod)
{
long long int t;
if(b==1)
return a;
t=power(a,b/2,mod);
if(b%2==0)
return (t*t)%mod;
else
return (((t*t)%mod)*a)%mod;
}
long int calculateKey(int a, int x, int n)
{
return power(a,x,n);
}
int main()
{
int n,g,x,a,y,b;
printf("Enter the val... | ALGO | 0.999986 | 3.396595 |
2307612c-3a6d-4a4f-bc45-e87c6175b6f4 | koogk7/Algorithm | 1726_로봇.cpp | // ConsoleApplication1.cpp : 이 파일에는 'main' 함수가 포함됩니다. 거기서 프로그램 실행이 시작되고 종료됩니다.
//
#include <iostream>
#include <queue>
#include <vector>
#include <string.h>
#include <algorithm>
#include <map>
#include <math.h>
#include <stack>
/*
* 1726 로봇 - 회고, 2시간
* 1. 모듈 테스트를 진행 할 때, 잘 못된 데이터를 넣어줌으로서 계속 시간을 뺏기고 있었다.
* 2. 구조체... | ALGO | 0.999971 | 5.398081 |
1750496e-de22-4267-8262-d4c0656f7498 | leikang123/LLVM-NMX | llvm/unittests/Transforms/Utils/SSAUpdaterBulkTest.cpp | #include "llvm/Transforms/Utils/SSAUpdaterBulk.h"
#include "llvm/AsmParser/Parser.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "gtest/gtest.h"
using namespace llv... | TEST | 0.900771 | 7.954065 |
361b492e-6eb7-4672-965f-8e140a856b49 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4127_5.cpp | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
const long long MOD = 1e9 + 7;
const double err = 1e-10;
const int N = 1e5 + 5;
int xs, ys, n, mx;
vector<pair<int, int> > V;
vector<bool> used(25, 0);
vector<int> dp(2... | ALGO | 0.999965 | 4.565715 |
9960bd1e-09c8-4870-89e7-496c15fa558d | raushan291/classifier-cpp | classifier-cpp/opencv/opencv/samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp | /**
* @function cornerSubPix_Demo.cpp
* @brief Demo code for refining corner locations
* @author OpenCV team
*/
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace std;
/// Global variables
Mat src, src_gray;
int maxCorners = 10;
int maxTrackbar ... | ALGO | 0.999573 | 7.014394 |
e7257cb0-ce34-4e09-8ef7-ae3e60fc55ad | Anup0099/450DSA_Question | src/stringcpp/longestIncreasingSubsequence.cpp | #include <bits/stdc++.h>
using namespace std;
// longest increasing subsequence
// int solve(vector<int> &nums, int n, int index, int prevIndex, vector<vector<int>> &dp)
// {
// if (index == nums.size())
// {
// return 0;
// }
// if (dp[index][prevIndex] != -1)
// {
// return dp[ind... | ALGO | 0.999875 | 5.177539 |
ce088595-956c-4785-8fa9-0b460c72758a | TimidLion/baekjoon | 1463_makeTo1.cpp | #include<stdio.h>
#include<algorithm>
int nums[1000001];
using namespace std;
int main()
{
int N;
scanf("%d",&N);
nums[1] = 0;
nums[2] = 1;
nums[3] = 1;
for(int i=4; i <= N; i++)
{
if(i%2 == 0 && i%3 == 0)
nums[i] = min(min(nums[i/2]+1,nums[i/3]+1),nums[i-1]+1);
e... | ALGO | 0.99996 | 3.993145 |
b3300771-4673-4f9f-a276-45d4188332df | DeepeshnotCool/LeetCode-Submissions | my-folder/problems/longest_valid_parentheses/solution.cpp | class Solution {
public:
int longestValidParentheses(string s) {
stack<int> index;
stack<char> par;
index.push(-1);
int maxi = 0;
for(int i = 0; i < s.size(); i++){
if(s[i] == '('){
par.push(s[i]);
index.push(i);
} else{... | ALGO | 0.999844 | 5.818405 |
f586511c-df6c-4843-8bc1-f840df923d94 | SasankJajam/StriverA2Z | programs c++/week 1/pattern_2.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
for(int j=0;j<n-i;j++)
{
cout<<"*";
}
cout<<endl;
}
}
| ALGO | 0.999866 | 3.556736 |
a0e906c7-00a2-498e-91d7-afa6679ac446 | sureyeaah/Competitive | timus/1934.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define FOR0(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define FOR(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define FORD(i,l,r) for(int i=(r), _##i=(l); --i>=_##i; )
#define repi(i,a)... | ALGO | 0.999961 | 3.710832 |
d07379ff-b88f-439e-a7c6-850f99c9a8f2 | dicabreras/Coding-Problems-CP- | CodeForces/Contests/Div 3/22.12.2024.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ln '\n'
#define yes "YES"
#define no "NO"
const int M = 1e9+7;
int main(){
ios::sync_with_stdio(false);... | ALGO | 0.999909 | 3.837103 |
c0f3c60a-7e45-4337-817e-ad20e46442f8 | rishi058/CP-DSA | OS/2. Synchronization/05_counting_semaphore.cpp | #include<bits/stdc++.h>
using namespace std;
// Shared buffer and constraints
vector<int> buffer;
const int BUFFER_SIZE = 5;
void randomDelay(){
int x = rand() % 11;
this_thread::sleep_for(chrono::milliseconds(x*100));
}
// Semaphores for synchronization
counting_semaphore<BUFFER_SIZE> empty_slots(BUFFER_SIZ... | ALGO | 0.995261 | 6.296889 |
4bfb90de-ae44-4357-b966-a24541a9eae9 | hztttt/Synergistic_Optimization | lammps_DeepSPIN/src/KOKKOS/neighbor_kokkos.cpp | // clang-format off
#include "neighbor_kokkos.h"
#include "angle.h"
#include "atom_kokkos.h"
#include "atom_masks.h"
#include "bond.h"
#include "comm.h"
#include "dihedral.h"
#include "error.h"
#include "fix.h"
#include "force.h"
#include "improper.h"
#include "kokkos.h"
#include "memory_kokkos.h"
#include "neigh_req... | TOOL | 0.908898 | 7.326913 |
39910a40-4abc-4662-ae27-4e1c7d4a5731 | mistysamia/Leet-Code---Solutions | Medium/930. Binary Subarrays With Sum.cpp | int numSubarraysWithSum(vector<int> &nums, int goal)
{
map<int, int> mp;
int sum = 0, ans = 0;
for (int i = 0; i < nums.size(); i++)
{
sum += nums[i];
if (sum == goal)
ans++;
cout << sum << " " << ans << " " << mp[sum - goal] << endl;
if (mp.find(sum - goa... | ALGO | 0.999959 | 5.600825 |
cf685e8b-04fc-409b-8fbe-d87fb0cb62e7 | santosH7321/CompetetiveProgrammingInCpp | Array2.cpp/findMinNumInArray.cpp | #include<iostream>
#include<climits>
using namespace std;
int main(){
int arr[] = {2,3,4,5,6,7,8,9,10};
int size = 10;
int mini = INT_MAX;
for(int i = 0; i < size; i++)
{
if(arr[i] < mini)
{
mini = arr[i];
}
}
cout<<"Minimum number is: "<<mini<<endl;
} | ALGO | 0.999761 | 3.74641 |
1b2d329c-a0af-4076-aa09-9ed9ea348464 | Abdullah-Builds/Data_Structures_And_Algorithms | Linked_List/Singly_Linked_List.cpp | #include<iostream>
using namespace std;
class Node{
public:
int value;
Node *next;
Node(int val){
value = val;
next = nullptr;
}
};
void Insert_Head(Node *&head ,int val){
Node *temp = new Node (val);
temp->next = head;
head = temp; ;
}
... | ALGO | 0.999602 | 4.548841 |
48d588e4-f512-4e2f-9955-6d055f489bd3 | nuk6/gfg_ibit_leet_soln | leet_next_permutation.cpp | // P : https://leetcode.com/problems/next-permutation/
class Solution {
public:
void swap(int& a, int& b) {
int c = a;
a = b;
b = c;
}
void nextPermutation(vector<int>& a) {
int n = a.size();
int i = n-2;
while((i != -1) && a[i] >= a[i+1]) {
i--;
}
int j = n-1;
while((i != -1) && (j != -1) && a[j] <=... | ALGO | 0.999906 | 5.129052 |
8c0bd463-9ba2-441f-bc27-5edaa7072977 | DSKYA/algorithm | C_language/10.cpp | //ISBN号码
// Created by cxj on 17-3-16.
//
#include "stdio.h"
#include "string.h"
int num(char c)
{
if(c == 'X')return 10;
int answer = c - '0';
//printf("%d ",answer);
return answer;
}
char lett(int i)
{
if(i == 10)return 'X';
else return i + '0';
}
int main()
{
char isn[15];
scanf("... | ALGO | 0.999758 | 3.135036 |
c0ac0040-de4a-4c66-b8af-3fe86dcead45 | pedro-tiso/CONTEUDO-PROGRAMACAO-ESTRUTURADA | TRABALHO 1/EX3/main.cpp | #include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <stdio.h>
#include <locale.h>
//3. Faa um Programa que solicite dois nmeros e imprima na tela a soma dos nmeros.
using namespace std;
int main()
{
setlocale(LC_ALL,"Portuguese");
double n1, n2, soma;
cout << "Digite o pri... | TOOL | 0.892194 | 3.792357 |
ce8b0a3b-c9cf-45fa-9de9-f5581b49a985 | pushkarNath007/DSA_GFG_1 | FUNCTIONS/func_series_22.cpp | /*
Write a C++ program to print all alphabets from a to z.
- using while loop
*/
#include<bits/stdc++.h>
using namespace std;
void solve(){
char bc ='a';
while(bc<='z'){
cout<<bc<<" ";
++bc;
}
}
int main(){
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
| ALGO | 0.990817 | 4.08199 |
588d5edf-cc34-4589-bdd6-9fbf0a3a271e | gauravkr7992/MyLCquestions | 37.Sudoku Solver.cpp |
class Solution {
public:
void solveSudoku(vector<vector<char>>& board) {
solve(board);
}
bool solve(vector < vector < char >> & board) {
for (int i = 0; i < board.size(); i++) {
for (int j = 0; j < board[0].size(); j++) {
if (board[i][j] == '.') {
for (char c = '1'; c <= '9'; c++) {... | ALGO | 0.999556 | 7.022988 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.