uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
69970d7a-0fb7-4615-a216-9427a3cdac04 | lyh666888/233 | jcsf/P2234.cpp | #include<cstdio>
#include<algorithm>
#define maxn 1000001
#define inf 100000001
using namespace std;
int size[maxn],son[maxn][2],v[maxn],num[maxn],rd[maxn];
int sum=0,root=0;
void update(int p)
{
size[p]=size[son[p][0]]+size[son[p][1]]+num[p];
}
void xz(int &p,int opt)
{
int memo=son[p][opt^1];
son[p][opt^1... | ALGO | 0.999901 | 3.607074 |
fc80b6ad-6e12-4667-bfbe-267300a26e68 | HarshitS17/dsa | linkedList/insertion.cpp | // transversing the linked list
#include <iostream>
using namespace std;
class node
{
public:
int data;
node *next;
node(int val)
{
data = val;
next = NULL;
}
};
void InsertAtTail(node* & head, int val)
{
node *n = new node(val);
if (head == NULL)
{
head = n;
... | ALGO | 0.999876 | 3.162172 |
b2654702-bf43-4f89-9a73-4d039a851d5a | sapnendra/Data-Structure | BinaryTree/lecCodes/binaryTreeClass_2_codes/c2.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if(root == N... | ALGO | 0.999974 | 5.86667 |
7ae29b2a-193a-4c12-826d-203201aec20f | heavenMOJANG/ICPC | programmes_C_Cpp/2019HBCPC重现赛/K.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>PII;
typedef pair<ll,ll>PLL;
const ll inf=0x7f;
ll dx[]={-1,1,0,0};
ll dy[]={0,0,-1,1};
struct Node{
string... | ALGO | 0.999769 | 3.61802 |
6e4f4660-d967-428c-80a7-d9cd665196b4 | jnegrite/Competitive-Programming | Chapter 3/3.2/kattis/musicalchairs.cpp | #include<iostream>
#include<queue>
using namespace std;
int main(){
long nFaculty;
cin >> nFaculty;
queue<long> q {};
vector<long> values {};
values.reserve(nFaculty);
long curr;
for(int i=0;i<nFaculty;i++){
cin >> curr;
q.emplace(i);
values.push_back(curr);
}
... | ALGO | 0.999972 | 4.131 |
0c096b03-b7ce-4cf3-a00f-ac3df09ac4ff | benadler/taser_genrob | src/conversion.cpp | #include "conversion.h"
double Conversion::deg2rad(double degree)
{
return (degree * M_PI / 180);
}
double Conversion::rad2deg(double radiant)
{
return (radiant * 180 / M_PI);
}
void Conversion::curvature2wheelSpeeds(const double curvature, float &speedL, float &speedR)
{
Configuration* config = Configuration::in... | TOOL | 0.942914 | 5.703897 |
5de00520-1e68-480d-b395-30ac02ad2be2 | oliwkan091/Projekt-JA | cpp/QuickselectClient/QuickselectClient/QuickselectClient.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <thread>
#include <chrono>
#include "QuickselectLib.h"
void sortFunc(int dataLength, int tab[], int k, bool biggest)
{
std::cout << quicselect(dataLength, tab, k, biggest) << std::endl;
}
int* readTxtFile(std::string fileName, int& dataLength)
{
... | ALGO | 0.997359 | 4.394476 |
09e56196-add6-4ec2-80dc-383cf86709b8 | NickNojiri/test | workspace/lower div/cs150/hw/h06/h06.cpp | /**
* @author Put your name here
* @date Put the date here
* @file h06.cpp
*/
#include <string>
#include <cctype>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <iostream>
using namespace std;
string STUDENT = "nnojiri"; // Add your Canvas login name
// Add your function here
int sumNums(c... | ALGO | 0.963045 | 5.359738 |
1c2ad204-8df4-407e-ae4f-b2f9295ec46d | ChanHoHan/baekjoon | Binary_Search/20_12_10/pocket_money_management.cpp | //6236
#include <iostream>
int N, M;
int pocket[100002];
int ans, val;
bool cal(int mid)
{
val = 1;
int h_money = mid;
for(int i = 0 ; i < N; i++)
{
if (pocket[i] > h_money)
{
val ++;
h_money = mid;
if (pocket[i] > h_money)
return (0);
}
h_money -= pocket[i];
}
if (val <= M)
return (1);
... | ALGO | 0.999998 | 4.43242 |
42d81c3f-2e87-46bb-b7ef-5fe4f9108cf2 | Darkxde/Codeforces_Cpp_Solutions | Watermelon.cpp | #include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
int main()
{
int n;
cin >> n;
if(n%2==0 && n > 2)
printf("YES");
else
printf("NO");
}
| ALGO | 0.999816 | 3.510769 |
72ac0da5-d2b5-4e44-ab49-10dab0cf4c54 | syleemk/NDB-Algorithm | NDB_Algorithm/7_STL_sort().cpp | /*
˰ ȸ Ĺ sortԼ
sortԼ , 츮 ı
ǹ
ǹ ͵ ü Ǿ ϰ ֱ
߿ 'Ư ' ϴ
*/
#include <iostream>
#include <algorithm>
using namespace std;
bool compare(int a, int b) { // T F
return a > b; //
}
int main(void) {
int a[10] = { 3,1,4,1,5,9,2,6,9,7 };
sort(a, a + 10, compare); // ּҿ, ּ ־ָ, ۺ ϸ Ǵ±... | ALGO | 0.999897 | 4.528186 |
8aeea3c6-804c-4f05-913d-e846231fa123 | Sunny-Saurya/Cpp_Programming | basic/count_1_bit.cpp | // Count the number of 1 bit from an unsigned integer
#include<iostream>
using namespace std;
int main()
{
unsigned int n;
cout<<"Enter any number to know 1 bit: "<<endl;
cin>>n;
int count = 0;
while(n!=0)
{
int rem = n % 10;
if(rem == 1)
{
count++;
... | ALGO | 0.99833 | 4.630534 |
e8149500-d1e6-4c09-968f-feb8b06b300f | stonexjr/davinci | src/mat4.cpp | ///////////////////////////////////////////////////////////////////////////////
// Matrice.cpp
// ===========
// NxN Matrix Math classes
//
// All matrices are row major. (OpenGL uses column-major matrix)
// | 0 1 | | 0 1 2 | | 0 1 2 3 |
// | 2 3 | | 3 4 5 | | 4 5 6 7 |
// | 6 7 8 | | ... | ALGO | 0.996352 | 6.697158 |
07b5db3c-b1eb-4792-b403-c1df294e6a3d | TaRun1369/CP---forces-and-cses | Counting_Paths.cpp |
#include<bits/stdc++.h>
using namespace std;
vector<long long> tree[200001];
long long ancestor[200001][21];
long long level[200001];
long long ans[200001];
void height(long long curr,long long par){
for(long long child : tree[curr]){
if(child != par){
level[child] = level[curr] + 1;
... | ALGO | 0.999957 | 4.155218 |
d80b0e49-7620-447e-b014-83d5a87f9328 | EhardFr42996/project_flightsuite | blender-2.63a/extern/bullet2/src/BulletCollision/Gimpact/btContactProcessing.cpp | #include "btContactProcessing.h"
#define MAX_COINCIDENT 8
struct CONTACT_KEY_TOKEN
{
unsigned int m_key;
int m_value;
CONTACT_KEY_TOKEN()
{
}
CONTACT_KEY_TOKEN(unsigned int key,int token)
{
m_key = key;
m_value = token;
}
CONTACT_KEY_TOKEN(const CONTACT_KEY_TOKEN& rtoken)
{... | ALGO | 0.99811 | 4.896636 |
871babcc-29f4-4e4d-ac16-fb0428f82dbb | ShashankS04/DataStructures | sorting/selection.cpp | #include<iostream>
#include<algorithm>
void selcSort(int a[],int n)
{
for(int i=0;i<n-1;i++)
{
int min=i;
for(int j=i+1;j<n-1;j++)
{
if(a[j]<a[min])
min=j;
}
std::swap(a[i],a[min]);
}
}
int main(int argc, char const *argv[])
{
int a[]={2,4,1,3,... | ALGO | 0.999883 | 4.669781 |
ad187193-bf30-4d7c-8cb7-71796988aff1 | noviciusss/LeetCode_solutions | 1370-count-number-of-nice-subarrays/1370-count-number-of-nice-subarrays.cpp | class Solution {
public:
// int ans(vector<int>& nums, int k) {
// int left =0;
// int maxl=0;
// int total_sub=0;
// int cnt=0;
// for(int right=0;right<nums.size();right++){
// if(nums[right]%2!=0){
// cnt++;
// }
// while(cnt>k)... | ALGO | 0.999995 | 5.628902 |
4af1ef3f-1c8e-44da-8392-7fa76baba561 | Sameed516/sameed-assignment- | TASK 2.cpp | //#include<iostream>
//using namespace std;
//void num(int a[], int size)
//{
// int sum = 0;
// for (int i = 0; i < 5; i++)
// {
// sum = sum + a[i];
// }
// cout << "The sum of elements is : " <<sum<<" "<< endl;
//}
//int main()
//{
// const int size = 5;
// int arr[5], n;
// cout << "Enter elements in Array : " <<... | ALGO | 0.960538 | 3.284171 |
5ad4b899-2355-4cf3-95d0-bac773b6de1a | nducthang/Parallel-algorithms-on-graphs | src/Prim/primSeq.cpp | #include <iostream>
#include <time.h>
#include <string>
#include <fstream>
using namespace std;
typedef long long ll;
const ll MAXC = INT32_MAX;
class PrimSeq
{
private:
ll n;
ll **c;
ll *d;
bool *dd;
bool connected;
ll minWeight;
public:
PrimSeq(ll n);
~PrimSeq();
void Prim();
... | ALGO | 0.999037 | 3.794627 |
a1f39c2c-b366-4426-8f02-17ba3cd0b59e | arnishbaruah/leetcode | 0105-construct-binary-tree-from-preorder-and-inorder-traversal/0105-construct-binary-tree-from-preorder-and-inorder-traversal.cpp | class Solution {
public:
TreeNode* buildTree(vector<int>& preorder, vector<int>& inorder) {
map<int, int> inMap;
for (int i = 0; i < inorder.size(); i++) {
inMap[inorder[i]] = i;
}
return buildTree(preorder, 0, preorder.size() - 1, inorder, 0, inorder.size() - 1, inMap);
... | ALGO | 0.999973 | 6.582623 |
d57c5709-f4ff-4ee5-9315-67821d2540fd | bshaswat/cis22a | 10-arrays-and-vectors/10.18-optional-elements-in-a-range/trang-solution.cpp | #include <iostream>
#include <vector>
using namespace std;
void PopulateVector(vector<int>& numbers);
int main() {
vector<int> numbers;
string range;
int min, max;
PopulateVector(numbers);
cin >> min >> max;
for (auto e : numbers){
if (e >= min && e <= max) {
cout << e << " ";
... | ALGO | 0.999629 | 3.647419 |
3f702fd1-5ad3-4fd2-ab79-ee134bdc17f4 | wwwjn/leetcode-cpp | 2021/107/main.cpp | #include <iostream>
class Solution {
public:
vector<vector<int>> levelOrderBottom(TreeNode* root) {
vector<vector<int>> res;
if(root== NULL) return res;
stack<vector<int>> s;
queue<TreeNode*> q;
q.push(root);
while(!q.empty()){
vector<int> tmp_res;
... | ALGO | 0.999918 | 6.11617 |
894977bd-b0c2-4daf-92e5-be678381cb56 | ropas/PLDI2020_242_artifact_publication | homomorphic_evaluation/ntl-11.3.2/src/BerlekampTest.cpp |
#include <NTL/ZZ_pXFactoring.h>
NTL_CLIENT
long compare(const ZZ_pX& a, const ZZ_pX& b)
{
if (deg(a) < deg(b))
return 0;
if (deg(a) > deg(b))
return 1;
long n = a.rep.length();
long i;
for (i = 0; i < n; i++) {
if (rep(a.rep[i]) < rep(b.rep[i])) return 0;
if (rep(a.rep[i]) >... | ALGO | 0.996401 | 3.522837 |
f72acdcb-1603-40b2-bf58-937afe441a7a | seraph27/competitve-programming | codeforces/2013/b.cpp | // Problem: B. Battle for Survive
// Contest: Codeforces Round 973 (Div. 2)
// URL: https://codeforces.com/contest/2013/problem/B
// Time Limit: 1000
// Start: 2024/09/20 23:35:49
#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#define ll long long
#define ar array
#define all(x) x.begin(), x.end()
#define pii pa... | ALGO | 0.999914 | 4.914509 |
5b481a20-7b62-4bcf-8df8-4e1496ce0c8f | RyanMahutga/JBME_Remodeling1 | stripBiaxial2Failure/stripBiaxial2Failure/componentStress.cpp |
/* calc_net_stress_periodic.m calculates the volume averaged network stress for a periodic network
SUMMARY: This function calculates the volume averaged stress tensor from the boundary nodes of a
periodic network. It is dependent of the boundary node coordinates 'bnd_nodes', the actual fiber
volume fraction 'fiber_vo... | ALGO | 0.994621 | 3.99416 |
4e1183df-8d62-4c23-bd14-c083579c739f | darkshuige/codecode | c code/1753.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
if(n==0) break;
cout<<n/2<<endl;
}
return 0;
}
| ALGO | 0.999632 | 3.518387 |
96f321c8-1234-47c0-8471-3612a3b05b61 | Ayush05G/Cpp_DSA | Data Structures & Algorithms/Stack/MegaClass-11-Aug-2024/4. 224. Basic Calculator.cpp | class Solution
{
public:
int calculate(string s)
{
stack<int> st;
int result = 0;
int sign = 1;
int num = 0; // temp
for (char ch : s)
{
if (ch >= '0' && ch <= '9')
num = num * 10 + (ch - '0');
else if (ch == '+')
... | ALGO | 0.999923 | 4.910989 |
4c3d409a-2996-4164-9c5f-51a0910b1d2c | Mohamed-Hashem/CS-Route | 3.OOP/Assignment-3/Q2.cpp | /*
Q2. Create function take 2 params of any type then swap them and pass data by
parameters (Template)
*/
#include <iostream>
using namespace std;
template <class T>
void Swap(T& a, T& b)
{
T temp = a;
a = b;
b = temp;
}
int main()
{
int num1 = 5, num2 = 10;
cout << "Value of Num1 before Swap : " << num1 << ... | ALGO | 0.980576 | 4.989434 |
8fa06cfb-59a1-4c83-b869-a7e082710fb4 | trungdangtapcode/Competitive-Programming-Notebook | archived/school_laptop_02092023/ITMO_TP1_C.cpp | #include<bits/stdc++.h>
using namespace std;
int n, m;
vector<int> a, b;
long long int res;
int main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> m;
a.assign(n+1,-1e9-1);
b.assign(m+1,-1e9-1);
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= m; i++) cin >> b[i];
for (int i ... | ALGO | 0.99999 | 3.650609 |
0e6c9e6c-86af-456e-baa3-4dac2903ec4a | EbolaEmperor/AMR-FV-Elliptic | src/AMRTools/AMRMeshHierachy.cpp | #include "AMRTools/AMRMeshHierachy.h"
template <int Dim>
unsigned AMRMeshHierachy<Dim>::numBoxes(int proc_id) const {
unsigned all = 0;
for (auto &mesh : meshes_) {
if (proc_id == -1)
all += mesh.size();
else
all += mesh.numBoxes(proc_id);
}
return all;
}
template <int Dim>
void AMRMeshHie... | ALGO | 0.99681 | 6.414056 |
e280d7ef-aed6-4c09-877a-698624e7dcca | oushuai01/algorithm | lq_ex/13届C++_研究生组/铁路与公路.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
const int N = 410 , M =160010;
typedef pair<int,int> PII;
int h1[N], h2[N],e[M], ne[M], idx;
int g[N][N];
bool st[N];
int dist[N];
int n,m;
void add(int h[],int a, int b){
e[idx] = b;
ne[idx] = h[a];
h[a] = idx++... | ALGO | 0.999769 | 4.156591 |
0029aca0-1e12-47ba-a968-db7802a3640b | yogurt-shadow/z3_comp | z3_dynamic/src/api/api_arith.cpp | #include "api/z3.h"
#include "api/api_log_macros.h"
#include "api/api_context.h"
#include "api/api_util.h"
#include "ast/arith_decl_plugin.h"
#include "math/polynomial/algebraic_numbers.h"
#define MK_ARITH_OP(NAME, OP) MK_NARY(NAME, mk_c(c)->get_arith_fid(), OP, SKIP)
#define MK_BINARY_ARITH_OP(NAME, OP) MK_BINARY(NAM... | TOOL | 0.923399 | 5.954999 |
71807148-b433-4192-8f04-07a94b3fddb7 | ishandutta2007/codeforces | i_love_tanya_romanova/normal/270/C.cpp | /*
Can you hear the silence?
Can you see the dark?
Can you fix the broken?
Can you feel... can you feel my heart?
Can you help the hopeless?
While, I'm begging on my knees
Can you save my bastard soul?
Will you weep for me?
I'm sorry brothers
So sorry lover
Forgive me father
I love you, mother
Can you hear the silen... | ALGO | 0.999882 | 3.273992 |
0fc406b6-e431-4126-b443-ec676a0359f4 | Mahdi-Hira53/Codeforces | Codeforces/Football.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int len,cnt=0;
string s;
cin>>s;
len=s.size();
for (int i=0; i<len; i++)
{
if (s[i]=='0' && s[i+1]=='0' && s[i+2]=='0' && s[i+3]=='0' && s[i+4]=='0' && s[i+5]=='0' && s[i+6]=='0')
{
cnt=7;
break;
... | ALGO | 0.999686 | 3.265213 |
d11cd278-33f1-482a-898f-c0ad044a12ab | mungmnb777/algorithm-study | 26주차/조서영/7576.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct tomato{
int y, x;
};
//상 하 좌 우
int dx[4] = {0, 0, -1, 1};
int dy[4] = {-1, 1, 0, 0};
int m, n;
int box[1001][1001];
queue<tomato> q;
//상자 범위 안에 있는지 체크
bool is_inside(int ny, int nx){
return (0 <= ny && ny < n && 0 <= nx && n... | ALGO | 0.999883 | 5.021101 |
5f817e32-c8dd-456c-b8eb-f4ae262bbf9b | jitu7989/DSA | cpp/problems/codeforces/A20J Ladder/Codeforces Div2 Bs/AntonAndCurrencyYouAllKnow.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<ll,ll>;
//---- Debugger ---- //
#define debarr(a,n) cout<<#a<<" : ";for(int i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define debmat(mat,row,col) cout<<#mat<<" :\n";for(int i=0;i<row;i++) {for(int j=0;j<col;j++) cerr<<mat[i][j]<<" ";ce... | ALGO | 0.999802 | 5.277842 |
98f3f0a2-ed89-4c93-83e0-d44435f8e488 | RisshabSingla/LeetCode-C-Solutions | 1890-sum-of-beauty-of-all-substrings/sum-of-beauty-of-all-substrings.cpp | class Solution {
public:
int calcBeauty(string&str, int start, int end){
vector<int> freq(26, 0);
int mini = INT_MAX;
int maxi = 0;
for(int i = start; i<=end; i++){
freq[str[i]-'a']++;
}
for(int i = 0; i<26; i++){
if(freq[i] == 0){
... | ALGO | 0.999992 | 5.611572 |
d7c213de-899f-458a-be92-0639dbb1f4ea | Rafapeerez/IP | practicas/practica1/Ejercicio9.cpp | //Dependiendo del valor introducido correspondiente a un mes,indica los dias que tiene cada uno.
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main() {
int mes;
cout<<"Introduce un numero del 1 al 12 correspondientes a cada mes y pulse Intro:"<<endl;
cin>> mes;
if ((... | ALGO | 0.984618 | 3.397688 |
8804139e-7819-400b-b5f6-630faa5f8646 | cpadilla/Lock-Free_Internal_BST | RSTM Data Structure Implementation/rstm/mesh/mesh.cpp | /* mesh.cpp
*
* Delaunay triangularization.
*/
#include <unistd.h> // for getopt()
#include <iostream>
using std::cout;
using std::cerr;
#include <stdlib.h> // for exit, atoi
#include "common.hpp"
#include "lock.hpp"
#include "point.hpp"
#include "edge.hpp"
#include "edge_set.hpp"
#include "my_th... | ALGO | 0.991454 | 6.796784 |
77c1bd98-e783-4a18-a17c-2ee812125298 | lokesh-chand-30/DSA-Pro | Algorithms/prodeitself.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> productExceptMe(vector<int> vec, int size)
{
vector<int> ans(size, 1);
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
if (i != j)
{
ans[i] *= vec[j];
... | ALGO | 0.999989 | 5.297307 |
071af616-476c-48e8-85a1-5f56b871a85c | Injarapugc/cpcodes | A_Stones_on_the_Table.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
using namespace std;
void solve()
{
ll n;
cin>>n;
string s;
cin>>s;
int j=0;
for(int i=0;i<n-1;i++)
{
if(s[i]==s[i+1]) j++;
}
cout<<j<<... | ALGO | 0.999957 | 3.731207 |
76223180-a42e-47c8-b127-83b4fb1eabeb | Saumyajeet-Varma/DSA-cpp | LeetCode/2444. Count Subarrays With Fixed Bounds/Solution3.cpp | #include <bits/stdc++.h>
using namespace std;
// Time Limit Exceeded
class Solution
{
public:
long long countSubarrays(vector<int> &nums, int minK, int maxK)
{
int n = nums.size();
long long count = 0;
for (int i = 0; i < n; i++)
{
int minn = INT_MAX;
i... | ALGO | 0.999864 | 5.02094 |
0b86345d-bd1a-44a7-b8de-1bc288aa0c3f | jinhan814/solutions | UCPC/pre19_d.cpp | #include <bits/stdc++.h>
using namespace std;
constexpr int mod = 1e9 + 7;
constexpr int add(int a, int b) { return a + b < mod ? a + b : a + b - mod; }
constexpr int mul(int a, int b) { return 1LL * a * b % mod; }
auto sol = [](int n, string s, auto v) {
vector nxt(1, array<int, 26>{});
vector cnt(1, 0);
for (int... | ALGO | 0.999992 | 5.523128 |
7ac13397-e1b4-4609-8d4c-ac6730570cbb | ishandutta2007/codeforces | bohdanpastuschak/normal/363/B.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <set>
#include <list>
#include <map>
#include <queue>
#include <iterator>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
... | ALGO | 0.999952 | 3.750035 |
d954d7dd-e257-4f29-8193-1beb92c56110 | eae11/algorithm | zyr/algoritm/src/main/java/com/douma/_27_day_动态规划二/_474/代码实现_C++.cpp | class Solution {
public:
// 二维费用背包问题
// 物品是字符串数组中的字符串,选择每个字符串有两个代价,分别是 0 的个数和 1 的个数
// 两个代价都有最大值,0 的个数最多为 m,1 的个数最多为 n
// 求选择字符串得到的最大子集的大小
int findMaxForm(vector<string>& strs, int m, int n) {
// dp[i][j] 表示包含 i 个 0 和 j 个 1 的最大子集的大小
vector<vector<int>> dp(m + 1, vector<int>(n + 1));
... | ALGO | 0.999795 | 6.164113 |
1ee3c4f9-14f8-4127-a306-6678ea809727 | ishandutta2007/codeforces | jhin/normal/1157/A.cpp | // system.cout(translate *from glut);
#include <bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
vector<long long> p;
int ho,mi,se,ho1,mi1;
void fix_time()
{ if(se>59)mi+=se/60,se=se%60;if(se<0)se+=60,mi--;
if(mi>59)ho+=mi/60,mi=mi%60;if(mi<0)mi+=60,ho--;
if(ho<0)ho+=24;if(ho>24)ho-=24;
}
long long... | ALGO | 0.998246 | 3.115487 |
24393d88-ff5f-4980-9e60-9410388372cd | codebedo/C_Studying_projects | if2.cpp | #include <iostream>
using namespace std;
int main(){
int sayi1 , sayi2;
cout << "1.sayiyi giriniz: ";
cin >> sayi1 ;
cout << "2.sayiyi giriniz: ";
cin >> sayi2;
if(sayi1 > 0 && sayi2 > 0)
{
cout << "Her iki sayiniz da pozitif\n";
}
else if( sayi1 < 0 && sayi2 < 0)
{
cout << "Her iki sayida negatif \... | ALGO | 0.989337 | 3.360514 |
5664ce13-4d5e-4e5b-bc7d-a570bd240c03 | Loyea/PAT-Cpp | PAT/B1014.cpp | #include <cstdio>
#include <cstring>
int min(int a, int b){
if(a > b){
return b;
} else {
return a;
}
}
bool is_letter(char a) {
return (a >= 'a' && a <= 'z') || (a >= 'A' && a <= 'Z');
}
bool is_digit(char a) {
return a >= '0' && a <= '9';
}
char days[7][4] = {"MON", "TUE", "WED... | ALGO | 0.997568 | 3.205661 |
b3234736-30d1-43bf-a83a-f1d9927e29de | ShivamDhamija/leetcodeQuestions | 0015-3sum/0015-3sum.cpp | class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
sort(nums.begin(),nums.end());
vector<vector<int>>a;
for(int i=0;i<nums.size();i++){
if(i>0&&nums[i-1]==nums[i])continue;
int j=i+1,k=nums.size()-1;
while(j<k){
if(n... | ALGO | 0.99994 | 5.941592 |
7d70d018-742f-45a7-bb4c-cfe807e27f68 | thegamer1907/Code_Analysis | DP/2396.cpp | #include <stdio.h>
int a[150001], n, k;
int s[150001];
int main() {
scanf("%d %d", &n, &k);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
s[i] = s[i - 1] + a[i];
}
int res = (1 << 30), idx;
for (int i = 1; i + k - 1 <= n; i++) {
int v = s[i + k - 1] - s[i - 1];
if (v < res) {
res = v; ... | ALGO | 0.999983 | 3.76783 |
ab0abe66-26cf-49bf-ab4a-4aae672af8cd | Bipul-Harsh/Practice-GeeksForGeeks | MultiplyTwoLinkedLists.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
/* Linked list Node */
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
next = NULL;
}
};
/* Function to create a new Node with given data */
struct Node *newNode(int data)
{
struct Nod... | ALGO | 0.999869 | 5.529709 |
6ec021ee-7266-4861-80e5-e022ef7e9140 | Shridhar2602/high-precision-Pi-generator | code/karatsuba.cpp | #include "pi.hpp"
struct num KARATSUBA_PREC(struct num a, struct num b, int prec_req, int B)
{
struct num c = KARATSUBA(a, b, B);
// precision handling
c.prec = a.prec + b.prec;
if(c.prec > prec_req)
{
for(int i = 0; i < (c.prec - prec_req); i++)
c.n.pop_back();
c.prec = prec_req;
}
c = REMOVE_LEADIN... | ALGO | 0.999436 | 4.013784 |
99636a81-1c48-4284-a9cb-963585e113cd | sarvex/leetcode-typescript | solution/1700-1799/1769.Minimum Number of Operations to Move All Balls to Each Box/Solution.cpp | class Solution {
public:
vector<int> minOperations(string boxes) {
int n = boxes.size();
vector<int> ans(n);
for (int i = 1, cnt = 0; i < n; ++i) {
cnt += boxes[i - 1] == '1';
ans[i] = ans[i - 1] + cnt;
}
for (int i = n - 2, cnt = 0, s = 0; ~i; --i) {
... | ALGO | 0.999996 | 6.19047 |
579d1b3d-a353-4318-9a59-62871f293d44 | hoanxuanbach/Competitive-Programming | OI/JOISC/2022/reconstruction.cpp | // Judges with GCC >= 12 only needs Ofast
// #pragma GCC optimize("O3,no-stack-protector,fast-math,unroll-loops,tree-vectorize")
// MLE optimization
// #pragma GCC optimize("conserve-stack")
// Old judges
// #pragma GCC target("sse4.2,popcnt,lzcnt,abm,mmx,fma,bmi,bmi2")
// New judges. Test with assert(__builtin_cpu_sup... | ALGO | 0.999957 | 4.971751 |
0ecae67d-5125-424d-b8e4-7205cbad8163 | hyun7586/PS-Auto-Leet | 0226-invert-binary-tree/0226-invert-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999972 | 6.187187 |
6a54d5ac-cdcd-40ac-98af-a67e2ba8f243 | metahashorg/v8_vm | buildtools/third_party/libc++/trunk/test/std/algorithms/alg.modifying.operations/alg.transform/binary_transform.pass.cpp | // <algorithm>
// template<InputIterator InIter1, InputIterator InIter2, class OutIter,
// Callable<auto, const InIter1::value_type&, const InIter2::value_type&> BinaryOp>
// requires OutputIterator<OutIter, BinaryOp::result_type> && CopyConstructible<BinaryOp>
// constexpr OutIter // constexpr after C... | TEST | 0.957607 | 6.936614 |
c8e49e6e-9369-4523-811e-77cefe722bb9 | sarvex/leetcode-v | lcof/面试题63. 股票的最大利润/Solution.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int mi = 1 << 30, ans = 0;
for (int& x : prices) {
ans = max(ans, x - mi);
mi = min(mi, x);
}
return ans;
}
}; | ALGO | 0.999731 | 5.792612 |
e3e08f69-e187-43dc-9e1e-b15ec2155f0b | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/dpp_generated_progs_cpp/p03191/p03191_num8_parsed.cpp | #include <iostream>
#include <vector>
#include <algorithm>
const long long MOD = 1000000007;
int main() {
int N;
std::cin >> N;
std::vector<int> A(2 * N);
for (int i = 0; i < 2 * N; ++i) {
std::cin >> A[i];
}
std::vector<int> positions(N + 1, -1);
std::vector<int> unknowns;
f... | ALGO | 0.99991 | 4.582661 |
3db0dd12-d3c6-4c01-be13-6b0f42e410b9 | nitaipandit/cpp | learning/practice/Test/pointer/FindTheLengthOfString.cpp | #include <iostream>
int main() {
char name[20];
std::cout << "enter the string:";
std::cin >> name;
char *ptr = name;
int length = 0;
while (*ptr != '\0') {
length++;
ptr++;
}
std::cout << length << std::endl;
}
| TOOL | 0.919194 | 3.849015 |
8f724b76-151d-4883-8f20-83aa214bc52f | mansi05041/LeetCode | 0525-contiguous-array/0525-contiguous-array.cpp | class Solution {
public:
int findMaxLength(vector<int>& nums) {
// use hash map to store sum as key and value is the index where it occurs first time
unordered_map<int,int> mp;
int result=0;
int sum=0;
for(int i=0;i<nums.size();++i){
sum+=(nums[i... | ALGO | 0.999964 | 6.064445 |
198e9868-01e1-48d1-a6e7-65fb8092240f | ShubhamMishra1998/CodeforcesCodes | Mathematics/Matrix Exponensiation/RecursivePower.cpp | #include<bits/stdc++.h>
using namespace std;
int Pow(int a,int b){
int res=1;
while(b){
if(b%2){
res=res*a;
}
a=a*a;
b=b>>1;
}
return res;
}
int main(){
int a,b;
cin>>a>>b;
cout<<Pow(a,b);
} | ALGO | 0.999953 | 4.865901 |
b394837f-5ee8-4d04-aada-571ff4ed8484 | rustyoz/kicad | eeschema/bus-wire-junction.cpp | /**
* @file bus-wire-junction.cpp
* @brief Code for editing buses, wires, and junctions.
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <sch_edit_frame.h>
#include <lib_draw_item.h>
#include <lib_pin.h>
#include <general.h>
#include <sch_bus_entry.h>
#include <sch_junction.h>
#i... | TOOL | 0.961921 | 5.117508 |
1d82042b-313c-4660-a719-8ad8d2ff6062 | alexandraback/datacollection | solutions_5658571765186560_1/C++/MountainsDrew/2.cpp | #include <fstream>
#include <iostream>
using namespace std;
int T,X,R,C,a,b;
bool vinco;
ifstream fin("input.txt");
ofstream fout("output.txt");
void f() {
vinco = false;
if (X>=7){ vinco = true; return; }
if ((R*C)%X!=0){ vinco = true; return; }
if (X>2 && R==2 && C==2){ vinco = true; return; }
if (X>2 && C==1... | ALGO | 0.9999 | 3.75739 |
a0950a7c-c7c0-4ff6-981f-4b149f88675c | InfOmics/APPAGATO | Appagato.cpp | /**
* @author Federico Busato
* Univerity of Verona, Dept. of Computer Science
* <EMAIL>
*/
#include "XLib.hpp"
using namespace timer;
#include "Host/GraphAPP.hpp"
#include "Host/approx_subgraph_iso.hpp"
#if defined(__DEVICE__)
#include "Device/approx_subgraph_iso.cuh"
#endif
int main(int argc, char** argv) {... | ALGO | 0.968886 | 4.3385 |
0c8560a9-da40-4566-9f4d-538ef7c33319 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5465_6.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long t, s, q;
cin >> t >> s >> q;
long long c = 0;
long long k = 0;
long long ans = 0;
long long f = 0;
while (t--) {
if (c == 0) {
c++;
f--;
if (f == -1) {
ans++;
f = f + s;
}
} else {
c+... | ALGO | 0.999244 | 3.155648 |
7992d962-3c18-4744-b1ca-05a636c3b7c7 | ellilu11/FMM2D | QuEST-master/test/sr_test_arr.cpp | #include <Eigen/Dense>
#include <complex>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
//#include <omp.h>
#include "integrator/RHS/bloch_rhs.h"
#include "integrator/history.h"
#include "integrator/integrator.h"
//#include "interactions/AIM/aim_interaction.h"
// #include "interactions/AIM/... | ALGO | 0.99893 | 5.543054 |
dcd08498-5ca3-4f07-a7a0-f52620db31b1 | KevinLeeLiang/CarND-Extended-Kalman-Filter-Project | src/tools.cpp | #include <iostream>
#include "tools.h"
using Eigen::VectorXd;
using Eigen::MatrixXd;
using std::vector;
const float EPS = 0.0001;
Tools::Tools() {}
Tools::~Tools() {}
VectorXd Tools::CalculateRMSE(const vector<VectorXd> &estimations,
const vector<VectorXd> &ground_truth) {
/**
TOD... | ALGO | 0.993014 | 5.74996 |
0eff0189-db04-4130-960e-da3dea36ea33 | hxs91/LeetCode | Plus One.cpp | class Solution {
public:
vector<int> plusOne(vector<int> &digits) {
int len = digits.size(),adt,i;
digits[len-1]=(digits[len-1]+1)%10;
if(digits[len-1] == 0) adt = 1;
else return digits;
i = len-2;
while(adt && i>=0){
digits[i] = (digits[i]+adt)%10;
... | ALGO | 0.999926 | 6.355268 |
05ff0d5c-a6a8-451b-a852-995c2df71bbf | aplqo/exercises | others/2020.05/2020.05.23-Exam/A-Fence.cpp | /*Luogu team T134371: Fence*/
#ifdef APTEST
#include "debug_tools/program.h"
#endif
#include <algorithm>
#include <climits>
#include <iostream>
#include <utility>
using namespace std;
const unsigned int maxn = 100, maxs = 8;
constexpr unsigned int inf = UINT_MAX >> 2;
enum typ { Left = 0, Right = 1, Unknown = 0xff };
... | ALGO | 0.998147 | 3.74189 |
b8b43aac-99c3-4c3b-bd3e-5be0b96d83cc | RaiHammad92/Hammad-Assignment-unit-9 | 9.11.cpp | #include <iostream>
// Function declaration
void swap(int &a, int &b);
int main() {
int num1, num2;
// Input two integers from the user
std::cout << "Enter the first integer: ";
std::cin >> num1;
std::cout << "Enter the second integer: ";
std::cin >> num2;
// Display values before swapp... | ALGO | 0.999336 | 6.760364 |
4c709a82-7572-4bd0-9b86-7428d2767cc1 | slimepiki/atcoder | soundhound2018-summer-qual/a/main.cpp | using namespace std;
using ll = long long;
using ull = unsigned long long;
#include <bits/stdc++.h>
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
cerr << " " << to_string(H);
debug_out(T...);
}
#ifdef __LOCAL
#define debug(...) ... | ALGO | 0.999921 | 4.540348 |
4cdad062-d8f0-4977-9fb1-920400210c98 | zethuman/PP1 | Quiz/quiz3V4/A.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
map <string, int> mp;
int main()
{
string s;
freopen("input.txt", "r", stdin);
int n, k ,g;
cin >> n;
for(int i = 0; i < n; i++){
cin>> s >> k;
mp[s]++;
}
map<string,int>::it... | ALGO | 0.999972 | 3.92139 |
7efd3390-5e3c-4741-b58f-a2aa43cf0608 | vickyguptaa7/CrackYourPlacement | 45DaysChallenge/DP/Hard/Maximum_sum_Rectangle.cpp |
class Solution
{
public:
int maximumSumRectangle(int R, int C, vector<vector<int>> M)
{
int mxSum = -1e9;
for (int i = 0; i < C; i++)
{
vector<int> row(R, 0);
for (int j = i; j < C; j++)
{
for (int k = 0; k < R; k++)
{
... | ALGO | 0.999944 | 5.710415 |
cb457a1e-22b2-4bdb-b47c-7012f10ebfb8 | shrey-royal/Armaan_CPP | Basics/Multi_arr_Op.cpp | #include <iostream>
using namespace std;
//method to scan multi-dimensional array
void ScanArray(int arr[3][3]) {
int i, j;
cout << "Enter the elements of the array: " << endl;
for(i = 0; i < 3; i++) {
for(j = 0; j < 3; j++) {
cout << "\nEnter the element at index [" << i << "][" <... | ALGO | 0.999632 | 3.995012 |
181bed5c-af1a-47f8-b108-3e039c1de6f5 | cposture/WizNote | lib/cryptopp/base32.cpp | // base32.cpp - written and placed in the public domain by Frank Palazzolo, based on hex.cpp by Wei Dai
#include "pch.h"
#include "base32.h"
NAMESPACE_BEGIN(CryptoPP)
static const byte s_vecUpper[] = "ABCDEFGHIJKMNPQRSTUVWXYZ23456789";
static const byte s_vecLower[] = "abcdefghijkmnpqrstuvwxyz23456789";
void Base32... | TOOL | 0.947833 | 6.861529 |
d25dc992-7a35-462a-9b6d-870ba498b31c | kapilll/DSA | CPP/Arrays/maxconsecnums.cpp | #include <iostream>
#include <cmath>
using namespace std;
int maxConsecutiveOnes(int arr[],int n){
int res=0;
int curr=0;
for(int i=0;i<n;i++){
if(arr[i]==0){
curr=0;
}
else{
curr++;
res=max(res,curr);
}
}
return res;
}
int main()... | ALGO | 0.9999 | 5.399762 |
134e08e2-4939-403b-a30e-e5dc757f52b8 | cspartho/ojsolution | Timus/1688. Team.GOV.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
long long n;
int m,k;
cin>>n>>m;
n=n*3;
for(int i=0; i<m; i++) {
cin>>k;
n-=k;
if(n<0) {
cout<<"Free after "<<i+1<<" times."<<endl;
break;
... | ALGO | 0.999808 | 3.383183 |
4ba6ad62-f9e2-4f15-9035-e787164a2c0a | Yosskavo/cpp-abo-hadhoud | C4/ex14.cpp | #include <iostream>
using namespace std;
void swap_number(int &one, int &sec)
{
int tmp;
tmp = one;
one = sec;
sec = tmp;
}
int main()
{
int number_o;
int number_s;
cout << "inter a first mamber : ";
cin >> number_o;
cout << "inter a second number : ";
cin >> number_s;
cout << "before swap : " << numb... | ALGO | 0.997637 | 3.38251 |
44a62f22-6daf-4b40-9334-5ee9b0263a09 | BCLab-UNM/Swarmathon-SIPI-Public | src/sipi_controller/src/PickUpController.cpp | #include "sipi_controller/PickUpController.h"
#include <iostream>
#include "sipi_controller/GripperController.h"
// offset to center of screen in X
#define X_OFFSET 0.054
#define X_TOLERANCE 0.02
//threshold distance to be from the target block before attempting pickup
#define DIST_TOLERANCE 0.05
// how far away should... | ALGO | 0.913119 | 5.179611 |
a4357e27-ae98-49db-a0e4-0660e9753c6b | Stypox/olympiad-exercises | kattis/ridofcoins.cpp | #pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define float long double
#ifdef DEBUG
template<class A,class B>ostream&operator<<(ostream&o,const pair<A,B>&p){cerr<<"("<<p.first<<", "<<p.second<<")";return o;}
template<class T,typename=typename enable_if<!is_same<T, stri... | ALGO | 0.999472 | 3.395353 |
9636f9fc-ea28-48f7-8111-f274425bcc7f | Hafsa246/-6Companies30days | Milestone 1/Code 7.cpp | // Distributing M items in a circle of size N starting from K-th position
#include <bits/stdc++.h>
using namespace std;
int lastPosition(int n, int m, int k)
{
if (m <= n - k + 1)
return m + k - 1;
m = m - (n - k + 1);
return (m % n == 0) ? n : (m % n);
}
int main()
{
int n = 5;
i... | ALGO | 0.999981 | 4.35451 |
f7e3d399-b106-4d38-97d0-b26f3d2a69a8 | Dhanush0369/CP_Practice | B_Foreign_Exchange.cpp | #include<bits/stdc++.h>
#define int long long
using namespace std;
void solve(){
int n;
cin>>n;
int a[n+1];
for(int i=1;i<=n;i++){
cin>>a[i];
}
int x=1;
while(x<n){
int s,t;
cin>>s>>t;
int m=a[x]/s;
if(m>0){
a[x]-=m*s;
a[x+1]+... | ALGO | 0.99975 | 3.235717 |
7f26e32d-12b3-4b7b-8754-a961ae52298e | YoungJooYoo/For_Coding_Test | leetcode/868. Binary Gap.cpp | class Solution {
public:
int binaryGap(int n)
{
int last = -1;
int maxGap = 0;
int currentPosition = 0;
while (n > 0) {
if (n & 1) { // 현재 비트가 1인 경우
if (last != -1) {
maxGap = std::max(maxGap, currentPosition - last);
... | ALGO | 0.999936 | 6.678326 |
d0d37ea0-f739-4f53-a342-735f5a594ce4 | kanumola37/CPPAssignments | mySort.cpp | #include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
void Selection_Sort(double numbers[], int nano1)
{
sort(numbers, numbers + nano1);
cout << "\nHere is table after selection sort :\n"<<endl;
cout << setprecision(2) << fixed;
for (int i = 0; i < nano1; ++i)
{
... | ALGO | 0.999163 | 4.235065 |
8f5a1c3b-f9a1-451d-a9c3-c6757e34a755 | Soquer070/LiftingLoops | libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_range.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2000000
// template<container-compatible-range<T> R>
// constexpr iterator insert_range(const_iterator position, R&& rg); // C++23
#include <vector>
#include "../../insert_range_sequence_container... | TEST | 0.895532 | 7.430234 |
c4f1101d-2147-45f6-9e53-fce550329585 | mooner92/2022algo | 5426-비밀편지/5426-비밀편지.cpp | #include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
string s;
char c[101][101]{""};
cin >> s;
int pvt = 0;
int p = sqrt(s.size());
for (int j = 0; j < p; j++)
{
... | ALGO | 0.999989 | 4.028766 |
f06ac3d8-998a-4f04-9a4d-ff290312b47d | fuad021/CSE-2206-Finite-Automata-Theory-Lab | Lab 4/dfaToRe.cpp | #include <iostream>
#include <sstream>
#include <string>
using namespace std;
#define PHI "\u03C6"
#define EPSILON "\u03B5"
int states;
int symbols;
int table[100][100];
string findRE(int n, int state1, int state2, string re = "")
{
if(n == 0)
{
ostringstream str1;
if(state2 == table[state1... | ALGO | 0.99918 | 3.954891 |
f51ce7c7-0763-4d27-966c-9c32d4053eaf | jakubcovam/JKMNet | src/Data.cpp | #include "Data.hpp"
#include <fstream>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <numeric>
#include <stdexcept>
#include <limits>
/**
* Trim helper function
*/
static inline std::string trim(const std::string& s) {
size_t a = 0, b = s.size();
whi... | DATA | 0.856482 | 6.022069 |
f5df55f8-7891-45aa-9f30-e4cdc35523be | heoboseong7/algorithm | baekjoon/15721-번데기.cpp | #include <bits/stdc++.h>
using namespace std;
#define INF 987654321
#define FOR(var, start, to) for(int var = start; var < to; var++)
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
int a, t, input, ans;
int p[202000];
int cnt;
in... | ALGO | 0.999927 | 3.455761 |
6a9b7cf9-512c-433e-b928-35583f13fa3b | manavtore/Leethub | 1925-count-nice-pairs-in-an-array/count-nice-pairs-in-an-array.cpp | class Solution {
public:
int countNicePairs(vector<int>& nums) {
int pairs=0;
const int MOD = 1e9+7;
unordered_map<int ,int > freq;
for(auto el:nums){
int val = el - rev(el);
pairs=(pairs+freq[val])%MOD;
freq[val]++;
}
return pairs;... | ALGO | 0.999966 | 6.143452 |
2a636d2a-f22e-48fa-9786-3e98e4510d44 | Sreeharij/Learning-Space | DSA/graph/kruskals_algorithm.cpp | #include <bits/stdc++.h>
#define I INT_MAX
using namespace std;
static bool sort_by_weight(const vector<int>& x,const vector<int>& y){
return x[2] < y[2];
}
int find(int u,vector<int>& set){
if(set[u] < 0)return u;
else{
set[u] = find(set[u],set);
return set[u];
}
}
void get_union(int... | ALGO | 0.999985 | 4.051057 |
cc9ed1a0-836a-4a61-a650-32179077e4b7 | redligot2009/SPOJ-Solutions | HS12MBR.cpp | // CompetitiveProgramming.cpp : Defines the entry point for the console application.
//
#include <bits/stdc++.h>
using namespace std;
struct Point
{
int x, y;
Point(int x, int y);
};
Point::Point(int x = 0, int y = 0)
{
this->x = x;
this->y = y;
}
struct Rectangle
{
Point bottomLeft;
Point topRight;
Rectangle... | ALGO | 0.99891 | 4.057456 |
0f4f1b70-53c4-4a15-96ce-2c5aad38b3a2 | linkeLi0421/llvm-project15-IRDumperPass | clang-tools-extra/clangd/PathMapping.cpp | namespace clang {
namespace clangd {
llvm::Optional<std::string> doPathMapping(llvm::StringRef S,
PathMapping::Direction Dir,
const PathMappings &Mappings) {
// Return early to optimize for the common case, wherein S is not a file URI... | TOOL | 0.983994 | 7.763438 |
a066f192-3955-42a1-9cfd-8765701e0e7c | siwkacper/prog_cpp | lab5/zad2.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <cctype>
#include <iomanip>
const std::string fp = "dna2.txt";
bool val(const std::string& s) {
std::size_t colon_pos = s.find(':');
if (colon_pos == std::string::npos) {
return false;
}
std::size_t start = colon_pos + 1;
... | DATA | 0.916875 | 5.438025 |
1fe935c7-e66f-414b-9be5-388a8403be71 | elli0t-yash/Colab-DSA-Practice | mihir/competitive_programming_basics_luv/EP31-40/EP34_Comparator_Function.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool compare(int a, int b)
{
if (a < b)
return true;
return false;
}
bool compare_pair(pair<int, int> a, pair<int, int> b)
{
if (a > b)
return true;
return false;
}
int main()
{
vector<int> v = {4, 5,... | ALGO | 0.999957 | 4.070356 |
5ce7e86b-40ba-4adf-8499-f06b1ca9c64e | RutvikMori18/c-basic-program | C++ Program/passing marks.cpp | #include <iostream>
using namespace std;
int main(){
// your code goes here
int T;
cin>>T;
if(T>=1&& T<=100)
{
while(T--)
{
int a,b,c,t,A,B,C;
cin>>a>>b>>c>>t>>A>>B>>C;
int sum=a+b+c;
int sum1=A+B+C;
if(a<=A && b<=B && c<=C )
{
i... | ALGO | 0.9988 | 3.396119 |
b0fb2818-9164-4561-b819-0fc1da2e9896 | lexisbr/MiniMarket | Clases/ComprasListaCircular.cpp | #include <iostream>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include <string>
#include "ComprasListaCircular.h"
#include "ComprasNodo.h"
#include "Cliente.h"
using namespace std;
ComprasListaCircular::ComprasListaCircular()
{
}
void ComprasListaCircular::addCliente(ComprasNodo *&frente, ComprasNodo *... | TOOL | 0.972767 | 4.29431 |
2ef2fdae-a170-49a9-9bee-72e6cf73aec0 | Dai0526/Algorithm | Algorithm/OnlineAssessment/LeetCode/Easy/278_FirstBadVersion.cpp | // The API isBadVersion is defined for you.
// bool isBadVersion(int version);
/*
https://leetcode.com/problems/first-bad-version/
*/
class Solution {
public:
int firstBadVersion(int n) {
// binary search
int head = 1;
int tail = n;
while(head < tail - 1){
... | ALGO | 0.999795 | 6.802354 |
d3c10768-7966-4ed0-baf8-0a1d909869c7 | shapefx/OpenDCC | src/lib/opendcc/app/core/settings.cpp | #include "opendcc/opendcc.h"
#include "opendcc/app/core/settings.h"
#include <pxr/base/tf/getenv.h>
#include <pxr/base/tf/fileUtils.h>
#include <pxr/base/tf/error.h>
#include <fstream>
#include "opendcc/app/core/application.h"
OPENDCC_NAMESPACE_OPEN
namespace
{
static const std::string session_prefix = "session... | TOOL | 0.956719 | 4.140673 |
06611b76-ada6-4695-9e4d-47cbce94b767 | FennelDumplings/leetcode-maxed_out | algorithm/cpp/prob1-500/prob316_hard_Remove-Duplicate-Letters.cpp | // prob316: Remove Duplicate Letters
/*
* Given a string which contains only lowercase letters, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.
*/
/*
* Example 1:
* Input: "bcabc"
* Outpu... | ALGO | 0.999954 | 6.71276 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.