uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b18a8690-9080-482b-8015-2897c9714505 | Wojtazooo/Algorithms_and_Data_structures_cpp | main.cpp | #include "Linkedlist.h"
#include "OrderedLinkedList.h"
#include "Heap.h"
#include "Beap.h"
#include "BinarySearchTree.h"
#include "Splay.h"
#include "Sorting_algorithms.h"
#include "RST.h"
#include "UnionFindArray.h"
int main()
{
// LinkedList test
{
std::cout << "==================\n";
std::cout << "Linked list... | TEST | 0.971934 | 4.507525 |
9a66fe09-0baf-4bd9-8e15-3616b678a379 | ishandutta2007/codeforces | tatyam/normal/1246/B.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ull=unsigned long long;
using uint=unsigned int;
using pcc=pair<char,char>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using pdd=pair<double,double>;
using tuplis=pair<ll,pll>;
using tuplis2=pair<pll,ll>;
template<class T... | ALGO | 0.999949 | 3.925591 |
c5c10a27-c500-49ea-bf89-c74584a7b490 | RunAtTekky/cpp | ACD/1300/1703F.cpp | /*
RunAt - grey
*/
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef int long long ll;
#define printnl(a) cout << a << "\n";
ll getPairs(vector<ll> &v, ll t) {
auto ind = upper_bound(v.begin(), v.end(), t) - v.begin();
return v.size() - ind;
}
void solve() {
ll n;... | ALGO | 0.998768 | 4.005658 |
79bed499-7517-46d9-99bc-390b1d134d12 | AbelTian/LibQQt | src/exquisite/qrcode/qrdecode/zxing/zxing/datamatrix/detector/DataMatrixDetector.cpp | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#include <map>
#include <zxing/ResultPoint.h>
#include <zxing/common/GridSampler.h>
#include <zxing/datamatrix/detector/Detector.h>
#include <zxing/common/detector/MathUtils.h>
#include <zxing/NotFoundException.h>
#include <sstream>
#include <cst... | ALGO | 0.999331 | 6.381678 |
dcd978b7-f1d2-4a0e-abee-75fd5f94f667 | AyoubEd-zz/leetcode | x-of-a-kind-in-a-deck-of-cards.cpp | /* https://leetcode.com/problems/x-of-a-kind-in-a-deck-of-cards
* Solution: calculate occurences and find GCD
*/
class Solution {
public:
int pgcd(int a, int b){
if(b==0) return a;
return pgcd(b, a%b);
}
int pgcd(vector<int>& A){
int p = pgcd(A[0], A[1]);
for(int i=2 ; i<A.... | ALGO | 0.999864 | 5.869482 |
16ed5a86-6fca-4e0a-b413-a25f51aefee8 | balajiofficial/CompetitiveProgramming | Codeforces/194A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
cout << max(0, n - (k - (n * 2))) << "\n";
}
| ALGO | 0.999365 | 3.165549 |
401249cb-6395-484f-85ca-1ecc85a55e95 | abhisheksaran/Competitive-Programming | leetCode/beforeDP/107.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.999982 | 6.132645 |
4f5a0e9e-4ec6-401c-bb74-d5430b3410de | wildflu/gemini_chat_boot | 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 |
b04cbca4-2cdb-4869-a138-90683c4a43d3 | huudat31/CTDLGT | TL_QL/11/4/bai6.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
void getInput(){
cin>> n;
}
long long solve1(int n){
if(n == 0) return 1;
if(n== 1) return 2;
else{
if(n % 2 == 0){
return solve1(n/2)*solve1(n/2);
}
else{
return solve1(... | ALGO | 0.999975 | 4.757397 |
f31b07bb-b5f0-4ed2-b1b1-ecf953286975 | tanishqmm/SOC-assignment | assignment_1/q6.cpp | //I am beginner dont hack me plzzz :-)
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<unordered_map>
using namespace std;
#define ll long long
#define rp(i,n) for(ll int i=0;i<n;i++)
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
ll int t;... | ALGO | 0.999794 | 3.422127 |
93add61a-f934-407c-a879-28e6ecf0934e | albexl/codeforces-gym-submissions | gym/102501/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define double ld
typedef complex<ll> point;
#define F first
#define S second
#define ii pair<int,int>
#define iii pair<int,ii>
typedef vector<point> polygon;
#define NEXT(i) (((i) + 1) % n)
ll cross(point a, point b) { return... | ALGO | 0.998903 | 4.362154 |
b560fc0a-f74d-457a-856e-a0e360f40370 | raincross7/code-similarity | codes/train_code/problem134/problem134_408.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAX_LENGTH = 1024;
char A[MAX_LENGTH + 1];
char B[MAX_LENGTH + 1];
int tu[MAX_LENGTH][MAX_LENGTH];
void lcs(int, int);
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; ++i)
{
cin >> A >> B;
int lA = strlen(A), lB... | ALGO | 0.999984 | 4.343598 |
4e7687e2-a598-42a1-814c-afca2347cb4b | SETHJI01/DSA | BST/ceil.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node *left, *right;
Node(int key){
data = key;
left = right = NULL;
}
};
Node* r_insert(Node* node,int key){
if(node==NULL)
return new Node(key);
if(key<node->data)
node->left = r_insert(node->lef... | ALGO | 0.999996 | 4.845302 |
c4b62ef5-3b36-4900-a66d-f7f6f9dc801e | shashwata2003/DSA | 3.DSA450/DSA Striver/DP/MatrixChainMultiplication.cpp | #include<iostream>
#include <bits/stdc++.h>
#include <array>
using namespace std;
/*
Matrix Chain Multiplication | DP-8:
Given the dimension of a sequence of matrices in an array arr[], where the dimension of the ith matrix is
(arr[i-1] * arr[i]), the task is to find the most efficient way to multiply these matrices ... | ALGO | 0.999943 | 3.927326 |
0ed1412b-a258-4f78-bbbf-419e1dd5233a | Gopal1252/CSES | Sorting_And_Searching/Subarray_Sums_I.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n,k;
cin>>n>>k;
vector<ll> v(n);
for(ll i=0;i<n;i++){
cin>>v[i];
if(i>0) v[i] += v[i-1];
}
map<ll,ll> mp;
mp[0]++;
ll ans = ... | ALGO | 0.999971 | 3.851476 |
5260e3f9-9c75-41ff-87fa-ded942506fe4 | Pentacode-IAFA/Quad-Remeshing | libs/quadwild/libs/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Eigen::MatrixXf m(2,2);
m << 1, 2,
3, 4;
//get location of maximum
MatrixXf::Index maxRow, maxCol;
float max = m.maxCoeff(&maxRow, &maxCol);
//get location of minimum
MatrixXf::Index minRow, m... | ALGO | 0.999654 | 4.010038 |
615d88e5-bc28-42cd-b516-7c4a1c42ce32 | nexus4ever/android_frameworks_av | media/libcpustats/CentralTendencyStatistics.cpp | #include <stdlib.h>
#include <cpustats/CentralTendencyStatistics.h>
void CentralTendencyStatistics::sample(double x)
{
// update min and max
if (x < mMinimum)
mMinimum = x;
if (x > mMaximum)
mMaximum = x;
// Knuth
if (mN == 0) {
mMean = 0;
}
++mN;
double delta =... | ALGO | 0.9913 | 6.21145 |
47949223-2e75-4a1b-87dd-60c7a8a43d09 | hirengarai/Salsa-Family | Forro/forroforward.cpp | /*
* REFERENCE IMPLEMENTATION OF forward bias (epsilon_d) searching programme in multi-threaded manner in cpp
*
* Filename: forroforward.cpp
*
* created: 20/2/24
* updated: 20/2/24
*
* by Hiren
* Research Scholar
* BITS Pilani, Hyderabad Campus
*
* Synopsis:
* This file contains the forward bias searching ... | ALGO | 0.999792 | 6.150329 |
580c01bf-0a3d-4699-ad7b-edacda26655d | SarpUtkuAkalin/praktikumit1 | Versuch03/reversi.cpp | /**
* Praktikum Informatik 1
*
*
* @file main.cpp
*
* Die Funktionen fuer das Spiel Reversi
*/
/**
* @mainpage Reversi
*
* Dokumentation des Spiels Reversi im Rahmen des Praktikums Informatik 1.
*
*/
#include <iostream>
#include <string>
#include "config.h"
#include "test.h"
#include "reversiKI.h"
/**
* @bri... | ALGO | 0.959904 | 4.162581 |
8e9ae78c-9f33-4dad-b0ff-8c375ebd414a | RonyCraftMc/DMOJ-UCLV | Dmoj/Problems/Salto del caballo/main.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define elif else if
#define Rony_Js signed
using namespace std;
int x, y, x2, y2;
vector<vector<bool>>graph(8, vector<bool>(8, false));
vector<int>mov_x = {1,2, 2, 1};
vector<int>mov_y = {2,1,-1,-2};
bool valid(int z, int w){
return (z<8 && z>=0 && w>=0 && w<8) ? tr... | ALGO | 0.999721 | 4.083348 |
81642134-1065-40ab-84a4-c79929f7d512 | IasonManolas/CompetitiveProgrammingCourse | Lectures/2_nextLargerElement.cpp | #include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// Function to return Next larger elements
/*
* We use a deque in which we add elements by iterating over the given array
* from end to start. For each element we iteratively pop items until we find an
* element that is greater then the current el... | ALGO | 0.999972 | 6.063135 |
69696ec3-e926-473a-9598-7fa324248bf5 | koosaga/olympiad | Library/USACO-master/Contests/Other Solutions/UCF HSPT/2016/UCF HSPT 16 - shapes.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistic... | ALGO | 0.999821 | 4.846584 |
096f058d-b650-42f9-a866-bff2fbb40484 | xjonwang/competitive-programming | usaco-guide/gold/bitmask-dp/AC-EDP-O/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ar array
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_... | ALGO | 0.999974 | 4.649942 |
2ce6d308-dc69-4480-b47f-4494567c5f14 | byte19/Leetcode | Queue Operations - GFG/queue-operations.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
// Helper class Solution to implement
// insert() and findFrequency()
class Solution{
public:
// Function to insert element into the queue
unordered_map<in... | ALGO | 0.999115 | 5.734863 |
9adf1f07-76c2-42ad-b757-71d793821f1b | guishas/MaratonaSupercomp | 2-openmp-gpu/exaustiva_openmp.cpp | #include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <algorithm>
#include <omp.h>
#include <filesystem>
using namespace std;
namespace fs = filesystem;
struct movie {
int index;
int start;
int end;
int category;
};
struct rbitset {
int size = 24;
vector<int> bs ... | ALGO | 0.997776 | 5.061459 |
73e0100c-55bc-480e-be61-cb124eec3f93 | bartosz-czekaj/cpp | crackingTheCodeInterview/bitmanipulation/5.6-conversion.cpp | #include <iostream>
#include <vector>
int conversion(int numA, int numB)
{
auto num = numA ^ numB;
auto elem = 0;
while(num)
{
if(num & 1)
{
++elem;
}
num >>= 1;
}
return elem;
}
int conversion2(int numA, int numB)
{
auto elem = 0;
for(au... | ALGO | 0.999953 | 5.80199 |
e920cf20-0bc3-460e-bacd-ced681e30a41 | justtshreyansh/Problem-Solving | Graph Series/BFS.cpp | #include<bits/stdc++.h>
using namespace std;
void bfs(int source,unordered_map<int,vector<int>>graph,int n){
queue<int> q;
//pushing the source node
q.push(source);
vector<int> visited(n+1,0);
//marking the source node visited
visited[source] = 1;
while(!q.empty()){
//extracting th... | ALGO | 0.999985 | 4.985952 |
90fe3306-106d-40c9-9694-40e711bb7d6f | minhthuan86/CTDL_GT | DSLK_vong/Bai5_DSTangDan.cpp | #include<iostream>
using namespace std;
struct Node
{
int Data;
Node *Next;
};
typedef Node * DS;
Node * Tao_Nut(int a)
{
Node * p;
p=new Node;
p->Data=a;
p->Next=p;
return p;
}
void Chen_Dau(DS &pHead,int a)
{
DS p=Tao_Nut(a);
p->Next=pHead;
pHead=p;
}
void Chen_Cuoi_Vong(DS &pHead,int a)
{
DS p=Tao_Nut(a),... | ALGO | 0.999968 | 3.778191 |
ab81958b-1f40-4491-93b3-8080e0547ade | gabrielrussoc/competitive-programming | spoj/rplniter.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const double eps = 1e-9;
const int inf = INT_MAX;
//////////////0123456789
const int N = 100004;
const int modn = 1000000... | ALGO | 0.999743 | 4.000194 |
162638b9-2e72-4262-9713-156e47961c3f | 3rw4t/codeforces | Contests/Hello 2024 contest/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int t;
void solve(){
LL n, sum = 0;
cin >> n;
while(n--)
{
char buff;
cin >> buff;
if (buff == '-'){
sum -= 1;
}else
{
sum+=1;
}
}
cout << abs(sum) << '\n';
}
int main()
{
cin >> t;
while(t--)
{
solve();
}
return 0;
}
| ALGO | 0.999772 | 4.06882 |
088b4eb8-bd75-4c58-8c95-285858f6f97c | Ak-ash9/c-programs | perfect using fuction.cpp | #include<stdio.h>
int per(int);
int main()
{
int num;
printf("Enter the number :");
scanf("%d",&num);
int b=per(num);
if(b==1)
printf("%d is a perfect number",num);
else
printf("%d is not a perfect number",num);
}
int per( int num)
{
int original=num,i,remainder,sum=0;
for(i=1;i<num;i++)
{
remainder=num%i... | ALGO | 0.999887 | 3.331474 |
99fc27c1-3b48-48e6-a750-eff22bb24e7c | bhartik021/Data-Structure-Algorithm | Linked List/Bubble Sort (Iterative) Linked List.cpp | /****************************************************************
Following is the class structure of the Node class:
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
... | ALGO | 0.999914 | 5.200859 |
91cc7cec-afca-43c3-b74c-08d762546625 | Algumithm/study | chomuG/Mar_2/BOJ_10942_팰린드롬.cpp | #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;
int n, m;
vector<int> nums;
int cache[2001][2001];
void dp() {
int s, e;
//홀수
for (int i = 1; i <= n; ++i) {
s = i - 1;
e = i + 1;
while (s >= 1 && e <= n) {
if (cache[s + 1][e... | ALGO | 0.999942 | 4.283492 |
d6516d09-2d04-4f5c-8444-820759ac512e | UTurwashi/leet-gFg_codes | 0268-missing-number/0268-missing-number.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
int sum=0;
int maxm=INT_MIN;
int n=nums.size();
for(int i=0;i<n;i++){
maxm=max(maxm,nums[i]);
sum+=nums[i];
}
int sum1 = n*(n+1)/2;
... | ALGO | 0.999897 | 5.391279 |
65e3139d-2770-45f4-bb5f-e2281d35fd27 | PalladiumOS-Temp/platform_frameworks_av | media/libstagefright/codecs/m4v_h263/dec/src/pp_semaphore_chroma_inter.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
xpred = x-axis coordinate of the block used for prediction (int)
ypred = y-axis coordinate of the block used for prediction (int)
pp_dec_u = pointer to the post processing semaphore for ... | ALGO | 0.999391 | 6.569502 |
c3c9b741-d1f1-4eed-9cff-1d4e2234a7aa | nguyenquan2003/thuc-hanh-nhap-mon-LT | Tuan 1/btvn11.cpp | #include <iostream>
using namespace std;
int main()
{
float toan, ly, hoa, van, anh, su;
cout << "nhap diem toan : ";
cin >> toan;
cout << "nhap diem ly : ";
cin >> ly;
cout << "nhap diem hoa: ";
cin >> hoa;
cout << "nhap diem van : ";
cin >> van;
cout << "nhap diem anh : ";
... | TOOL | 0.936433 | 3.157981 |
50c742da-d62f-414d-9264-8648466e385d | sakibhossain323/Competitive | Problems/Codeforces/CF1791F.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define caseout(n) cout << "Case " << n << ": "
#define nln "\n"
#define MOD 1000000007
#define MAX 1000001
int digsum(int n)
{
int sum = 0;
while(n)
{
sum+= n%10;
n/=10;
}
return sum;
}
void solve(int tcase)
{
... | ALGO | 0.999628 | 4.861084 |
21f182f4-8f2c-48e4-beaa-e7803dc987de | ellometa/null_dreams | A Problems/A_Round_Down_the_Price.cpp | #include <bits/stdc++.h>
using namespace std;
#define AKY AayushKYadav ^_^
#define IOS ios::sync_with_stdio(false); cin.tie(nullptr);
#define int long long
#define newline <<'\n'
#define all(x) (x).begin(),(x).end()
const int INF = LLONG_MAX >> 1;
void solve() {
int digit = 0;
int num; cin >> num; int x = ... | ALGO | 0.998729 | 4.175654 |
a59d5f42-28bc-4394-8846-3b0b5cf85880 | maahirai/atcoder_solver | abc094/c.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using vll=vector<ll>;
using vi=vector<int>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
//pow(llpow,modpow... | ALGO | 0.999998 | 3.306067 |
7c02b87e-a1a5-4432-97be-3ad0d4173c59 | Saleheenkhanam19/cpp_programs | Question.cpp | #include<iostream>
using namespace std;
int main(){
int m, n, sum=0, sum1=0;
cout<<"Enter two numbers: ";
cin>>n>>m;
for(int i=1; i<=n; i++){
if(i%m==0){
sum=sum+i;
} else {
sum1=sum1+i;
}
}
if(sum>sum1){
sum=sum-sum1;
cout<<sum;
} else {
sum1=sum1-sum;
cout<<sum1;
}
}
| ALGO | 0.999957 | 3.093273 |
8ab49c1a-6034-4b07-9c2a-43fba758cfb9 | shuttfubbb/CTDL-GT_D20PTIT | Bai_tap_CTDL>/DSA07027.cpp | #include <bits/stdc++.h>
using namespace std;
int a[100000];
int main()
{
int t;
cin >> t;
while(t--)
{
memset(a, 0, sizeof(a));
int n;
cin >> n;
for(int i=0; i<n; ++i)
cin >> a[i];
stack<int> myst;
vector <int> ans;
ans.push_back(-1);
for(int i=n-1; i>0; --i)
{
myst.push(a[i]);
while(!... | ALGO | 0.999989 | 4.396888 |
44eb8277-7e90-4dc5-b510-eef0cd12d14c | Mehulcoder/interviewbit | Backtracking/Permutations.cpp | void helper(vector<int> A, int start, vector<vector<int>> &ans){
if (start == A.size())
{
return;
}
vector<vector<int>> ans2;
helper(A, start+1, ans);
for (int i = 0; i < ans.size(); ++i)
{
for (int j = 0; j < ans[i].size(); ++j)
{
vector<int> temp2 = ans[i];
int val = A[start];
temp2.inser... | ALGO | 0.999989 | 5.531224 |
0efb9191-f145-4350-8924-e24285c03e71 | Nuu-maan/DSA | C++/arrays/basic/answer1.cpp | /**
* Find Minimum and Maximum Element in an Array
* Source: https://www.geeksforgeeks.org/maximum-and-minimum-in-an-array/
*
* This program finds the minimum and maximum elements in an array
* using the most efficient approach (Compare in Pairs).
*/
#include <iostream>
#include <vector>
#include <climits>
usin... | ALGO | 0.999958 | 6.722015 |
d968f11c-1b65-4186-853e-a35a588b81e3 | nka21/atcoder | abc/abc321/b/main.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
int n, x;
cin >> n >> x;
vector<int> a(n);
for (int i = 0; i < n - 1; i++)
cin >> a[i];
while (a.back() <= 100)
{
vector<int> b = a;
sort(b.begin(), b.end());
int s = 0;
for... | ALGO | 0.999944 | 3.97676 |
25dc3b32-d1c2-43de-bacf-43bf831728e7 | nishant-nimbare/cp | course/graphs/4_dijkstra.cpp | #include <iostream>
#include <vector>
#include <queue>
using std::vector;
using std::queue;
using std::pair;
using std::priority_queue;
using std::cout;
priority_queue<pair<int,int>> q;
vector<int> dist;
vector<bool> seen;
int distance(vector<vector<int> > &adj, vector<vector<int> > &cost, int s, int t) {
//write ... | ALGO | 0.999949 | 4.780874 |
616aebf8-3f03-442c-9c8d-d65354ddc8fe | Apress/learn-cocos2d-game-dev-w-ios-5 | CH05_code/ScenesAndLayers10/libs/Box2d/Collision/b2DynamicTree.cpp | #include <Box2D/Collision/b2DynamicTree.h>
#include <cstring>
#include <cfloat>
b2DynamicTree::b2DynamicTree()
{
m_root = b2_nullNode;
m_nodeCapacity = 16;
m_nodeCount = 0;
m_nodes = (b2DynamicTreeNode*)b2Alloc(m_nodeCapacity * sizeof(b2DynamicTreeNode));
memset(m_nodes, 0, m_nodeCapacity * sizeof(b2DynamicTreeN... | ALGO | 0.996849 | 7.669546 |
cc71eaf3-8490-4057-a6cf-7d8e2c2273b0 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5296_50.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
cout << (n(n+1))/2 << endl;
} | ALGO | 0.999039 | 4.676302 |
6a469c05-a85e-4bec-bfe5-d13794887340 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3382_3.cpp | #include <bits/stdc++.h>
using namespace std;
struct Event {
int when, type, info, i;
Event() { when = type = i = 0; }
Event(int iwhen, int itype, int iinfo, int ii) {
when = iwhen;
type = itype;
info = iinfo;
i = ii;
}
bool operator<(const Event &a) const {
if (when != a.when) return when... | ALGO | 0.999795 | 4.349799 |
6ec7db1f-3450-46ea-ac5b-c94a2bd373eb | princegoyal-dev/Coding-Ninja-Data-Structure-using-Cpp-Assignment | Pointers/pointersOutput6.cpp | // output : A65AAB66BBC67CCD68DD
//this is printing
#include <bits/stdc++.h>
using namespace std;
int main() {
char st[] = "ABCD";
for(int i = 0; st[i] != '\0'; i++) {
cout << st[i] << *(st) + i << *(i + st) << i[st];
}
return 0;
} | ALGO | 0.999213 | 3.355497 |
43335a57-64c0-4270-b224-016ba3f924bc | cryptodao/cryptodaocoin | src/zerocoin/SerialNumberSignatureOfKnowledge.cpp | /**
* @file SerialNumberSignatureOfKnowledge.cpp
*
* @brief SerialNumberSignatureOfKnowledge class for the Zerocoin library.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This pr... | ALGO | 0.967513 | 7.097405 |
1f51b602-a307-4860-bed2-5c0e8d18c526 | gaurharshit/CG | FILLP.CPP | #include<iostream.h>
#include<conio.h>
#include"gfunc.cpp"
#include"list.cpp"
#include<graphics.h>
#include<process.h>
#include<new.h>
#include<math.h>
int n,x_array[40],y_array[40];
int get_y_max()
{
int max=y_array[0];
for(int i=1;i<n;i++)
{
if(y_array[i]>max)
max=y_array[i];
}
return max;
}
int get_y_min()... | ALGO | 0.998008 | 3.273981 |
f5a7f4f8-69c1-4f8f-a8b3-0d19a70e0fe5 | volodymyr-savenko/Stroustrup | Temperature_file/Temperature_file/Temperature_file.cpp | // Temperature_file.cpp: .
//
#include "stdafx.h"
#include <vector>
#include <iostream>
#include <fstream>
#include <algorithm>
struct Temperature
{
int hour;
double t_value;
Temperature(int i_hour, double i_t_value) : hour(i_hour), t_value(i_t_value){}
};
using std::vector;
int _tmain(int argc, _TCHAR* arg... | TOOL | 0.99763 | 4.743475 |
f1d918da-0c54-4aa6-9f62-60c770c8ff71 | Shishank93774/LeetCode-Solutions | Smallest factorial number - GFG/smallest-factorial-number.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
vector<int> powsOf5;
bool done = false;
class Solution
{
public:
int findNum(int n)
{
//complete the function here
if(!done){
powsOf5.push_back(5);
wh... | ALGO | 0.999956 | 6.083416 |
34e556ac-fb19-4ad2-8803-b63a87c00756 | smhemel/LeetCode | 3005. Count Elements With Maximum Frequency.cpp | class Solution {
public:
int maxFrequencyElements(vector<int>& nums) {
int maxFreq=0, ans=0;
vector<int> frequency(101,0);
for(auto num: nums) frequency[num]++;
for(int i=1; i<101; i++)
maxFreq = max(maxFreq,frequency[i]);
for(int i=1; i<101; i++)
if... | ALGO | 0.99982 | 5.783186 |
f53c9e39-a6c7-4db6-aaec-11e84e15c45b | deepakmittal2003/MealsApp | 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.998859 | 6.785645 |
8b3fb621-a0be-4e5e-b9ed-d3f5d5cdc8e7 | PatricioReyes19/UserBlog | blog_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998319 | 6.76073 |
cdf4f9e3-799a-4418-a651-a2762766f3ae | sarvex/leetcode-fortran | solution/2500-2599/2537.Count the Number of Good Subarrays/Solution.cpp | class Solution {
public:
long long countGood(vector<int>& nums, int k) {
unordered_map<int, int> cnt;
long long ans = 0;
long long cur = 0;
int i = 0;
for (int& x : nums) {
cur += cnt[x]++;
while (cur - cnt[nums[i]] + 1 >= k) {
cur -= -... | ALGO | 0.999982 | 6.021013 |
433b1049-ef6e-4a09-a3f7-ddcfd35804e6 | gutaussehend-Harshal/CPP-and-DSA-practice-questions | .vs/Programiz/tut42.cpp | #include <iostream>
using namespace std;
// Example: Display Largest Element of an array
int main()
{
int size, i;
cout << "Enter the size of an array: " << endl;
cin >> size;
int arr[size];
for (i = 0; i < size; i++)
{
cin >> arr[i];
}
for (i = 0; i < size; i++)
{
... | ALGO | 0.999408 | 3.958911 |
adba1ba7-7593-49be-a648-9f24f1d9ebf3 | ppppkkkk/poj | string/1298.cpp | #include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
using namespace std;
/*
题目大意:利用移位加密算法加密字符串
poj 1298
*/
int main()
{
string s;
while (getline(cin, s),(s != "ENDOFINPUT"))
{
getline(cin, s);
int len = s.length();
for (int i = 0;i < len;i++)
{
... | ALGO | 0.998379 | 3.683411 |
0a8a8a5a-579a-4b17-94e1-be1ba7d314b2 | Shubhamsk1/cp | atcoder176/D.cpp | #include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define int long long
#define N 1001
char s[N][N];
int moves;
bool visited[N][N];
bool reached_end=false;
int move_count=0;
int nodes_left_in_layer = 1;
int nodes_in_next_layer=0;
int dr[]={-1,+1,0,0};
int dc[]={0,... | ALGO | 0.999925 | 3.875087 |
b64e6f96-2601-44d3-be03-bbd12779da89 | sanjosh/smallprogs | basic/sorting/quick.cpp | #include <vector>
#include <iostream>
#include <algorithm>
void swap(std::vector<int>& a, int p1, int p2) {
if (p1 != p2) {
std::cout << "swap " << p1 << "," << p2 << std::endl;
int x = a[p1];
a[p1] = a[p2];
a[p2] = x;
}
}
int partition(std::vector<int>& a, int left, int right) {
std::cout << "partition " ... | ALGO | 0.999933 | 5.318959 |
d8b1053d-32e2-40ab-a251-6d3f970c4772 | Imran53/Codeforces-Solve | C problems/C. Numbers on Whiteboard.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
cout<<2<<endl;
cout<<n<<" "<<n-1<<endl;
for(int i=n-2;i>=1;i--)
cout<<i+2<<" "<<i<<endl;
}
return 0;
}
| ALGO | 0.999318 | 3.665372 |
b3141522-136d-499e-83c5-e8aa55fc9527 | AKM-Mahdi/C-_Practice_2023 | ProblemSolving/find_distinct_number.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int>a;
a.resize(n);
for(int i=0; i<n; i++)
cin>>a[i];
sort(a.begin(), a.end());
int distinct_Val=0;
for(int i=0; i<n; i++){
if(a[i]!=a[i+1]){
distinct_Val++;
}
}
... | ALGO | 0.999939 | 3.821668 |
f1ca22d4-7e54-42ef-905f-89debbccc6e9 | SolveGuys/AlgorithmStudy | Problems_Archives/77week/JongWoo/BOJ_1806.cpp | #include <iostream>
using namespace std;
int n, s;
int arr[100'000];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> s;
for (int i = 0; i < n; ++i)
{
cin >> arr[i];
}
int answer = 0x7fffffff;
int en = 0;
int tot = 0;
for (int st = 0; st < n;... | ALGO | 0.999941 | 3.854506 |
388a223e-7c5b-44fc-85d5-bc7ba129c88e | fan-mingchun/hihoCode | 1232/1232.cpp | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <list>
#include <queue>
#include <cstring>
using namespace std;
#define max_node_num 1001
char adjacMatrix[max_node_num][max_node_num];
int unionFindSet[max_node_num];
void unionInit(int sum);
void union1(int fir... | ALGO | 0.999895 | 4.153828 |
cef02c22-9157-4254-af8b-a61abe86a2f4 | tajwone17/Competitive-programming | CodeForce/1933B.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
main()
{
int t;
cin >> t;
while (t--)
{
int n, sum = 0, flag = 0;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
{
cin >> v[i];
sum = sum + v[i];
}
... | ALGO | 0.999752 | 3.623186 |
410c5ed6-5d02-4271-a860-e10eb8e13052 | DeykaJ/Lab_4 | opencv2/modules/imgproc/src/undistort.cpp | #include "precomp.hpp"
cv::Mat cv::getDefaultNewCameraMatrix( InputArray _cameraMatrix, Size imgsize,
bool centerPrincipalPoint )
{
Mat cameraMatrix = _cameraMatrix.getMat();
if( !centerPrincipalPoint && cameraMatrix.type() == CV_64F )
return cameraMatrix;
Mat newCam... | ALGO | 0.912357 | 6.834787 |
0fd4ea01-8b4c-4bb9-8605-d6f17986bbe3 | vukbyk/suspiria | dep/bullet3-master081320/src/BulletCollision/CollisionShapes/btStaticPlaneShape.cpp | #include "btStaticPlaneShape.h"
#include "LinearMath/btTransformUtil.h"
btStaticPlaneShape::btStaticPlaneShape(const btVector3& planeNormal, btScalar planeConstant)
: btConcaveShape(), m_planeNormal(planeNormal.normalized()), m_planeConstant(planeConstant), m_localScaling(btScalar(1.), btScalar(1.), btScalar(1.))
{
... | ALGO | 0.880963 | 7.485794 |
58e93560-5fcc-4fd2-b7b0-160afa9d86da | amanitamuscario/StashukTasks | StashukC++_3/Main.cpp | #include <iostream>
#include <cstdlib>
#include <Windows.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
const int size = 5;
int a[size];
cout << " :\n";
for (int i = 0; i < size; i++)
cin >> a[i];
cout << ", ... | ALGO | 0.996983 | 3.041868 |
d4e0e84a-3fc8-4d5f-ada7-178306b922db | sandychn/Programming-Contest-Practice | ACM/Codeforces/Pratice/165C-CFR112-Div2-R1600.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#ifdef _LOCAL
#define show(x) cerr << "[" << #x << ": " << x << "] (" << __LINE__ << ", in `" << __FUNCTION__ << "`)\n"
struct Tester {
Tester() {
freopen("sample.in", "r", stdin);
... | ALGO | 0.999925 | 4.108949 |
5eac735b-d5c4-423b-8e2b-7e5d470e6f48 | seunghye218/problem-solving | 프로그래머스/unrated/181901. 배열 만들기 1/배열 만들기 1.cpp | #include <vector>
using namespace std;
vector<int> solution(int n, int k) {
vector<int> answer;
for (int i = k; i <= n; i+=k)
answer.push_back(i);
return answer;
} | ALGO | 0.999916 | 4.124053 |
30147077-f23c-469a-96c2-0051a06e40f4 | Ajay9330/DSA_and_CP | codechef/starters_contest_137/large_diff.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int n,k;
vector<int>v;
cin>>n>>k;
for(int i=0;i<n;i++){
int val;
cin>>val;
v.push_back(val);
}
int difsum=0;
... | ALGO | 0.999956 | 4.235525 |
cbd91b46-3dd2-44a9-8a9b-bde347989e34 | Tordina/additional_semestr2 | ACD/lab15/lab15.cpp | #include <iostream>
#include <string>
const std::string Numerals = { "1234567890" };
//заполняем бинарное дерево
struct Node
{
int value;
Node* left = nullptr, * right = nullptr;
Node(std::string& s)
{
//записываем преобразованные числа
value = getValue(s);
//удаляем корень
s.erase(0, cut(value));
if (s... | ALGO | 0.999947 | 4.365657 |
e0cc9fd0-1247-49f7-8750-709dd3394435 | Ajjadhav252525/leetcode | 0475-heaters/0475-heaters.cpp | class Solution {
bool ispossible(vector<int>&houses, vector<int>& heaters ,int radius)
{
int i=0, j=0;
int n = houses.size() ;
int m = heaters.size() ;
while(i<n)
{
if(j == m)
{
return false;
}
int l = ... | ALGO | 0.999988 | 5.571809 |
dac39f03-bdfe-4b31-9bdb-07bba54a1035 | shani-ydv/Test | rotate.cpp | #include<iostream>
#include<vector>
using namespace std;
void rotate(vector<int> &v,int key){
vector<int> temp(v.size());
for(int i=0;i<v.size();i++){
temp[(i+key)%4] = v[i];
}
v =temp;
for(int i =0;i<4;i++)
{
cout<<v[i]<<" ";
}
}
int main()
{
vector<int> v(4);
v.push_back(11);
v.push_back(2);
v.push_... | ALGO | 0.999988 | 3.63633 |
7feb3c45-e05e-47e9-887a-42bf1d5171b6 | akashsingh96/Placement-2018-2019- | Flipkart/Travelling_is_fun.cpp | /*
https://www.hackerrank.com/contests/hack-it-to-win-it-paypal/challenges/q4-traveling-is-fun
*/
#include <bits/stdc++.h>
using namespace std;
vector <int> connectedCities(int n, int g, vector <int> x, vector <int> y)
{
vector<int>parent(n+1);
for(int i=1;i<=n;i++)
parent[i]=i;
for(int i=... | ALGO | 0.999565 | 3.997856 |
6eaf80b3-a47c-49fb-87c4-1fc4970a2d59 | hulucc/algorithms | binary-search/main.cpp | /*************************************************************************
> File Name: main.cpp
> Author:
> Mail:
> Created Time: Sun 12 Mar 2017 04:39:47 PM CST
************************************************************************/
#include<iostream>
#include <array>
using namespace std;
//[a, b]
int bina... | ALGO | 0.999827 | 4.990118 |
20aaea43-d58a-48b8-9625-12c27ca5ab3d | gauravkatara53/DSA | Week 4 searching and sorting/Level 3/binarySearchOnNearlySortedArray.cpp | // binary search on nearly sorted array
#include<iostream>
using namespace std;
int searchOnNearlySortedArray(int arr[], int n, int target){
int s = 0;
int e = n-1;
int mid = s + (e-s)/2;
while(s <= e){
if(mid >= 0 && arr[mid-1] == target){
return mid-1;
}
if(arr[m... | ALGO | 0.999986 | 6.339594 |
e00cea70-e1fa-4005-97dc-451910bcd8a1 | fanqiliang/riscvn | clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp | #include "ClangTidyOptions.h"
#include "ClangTidyCheck.h"
#include "ClangTidyDiagnosticConsumer.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Testing/Annotations/Annotations.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <optional>
namespace clang {
namespa... | TEST | 0.931234 | 7.808202 |
cb5a311f-ebbe-4e95-9667-90ffca28d24a | Luxoft/iviLink | 3rd_party/cryptopp/cryptopp-5.6.1/gf2_32.cpp | // gf2_32.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "misc.h"
#include "gf2_32.h"
NAMESPACE_BEGIN(CryptoPP)
GF2_32::Element GF2_32::Multiply(Element a, Element b) const
{
word32 table[4];
table[0] = 0;
table[1] = m_modulus;
if (a & 0x80000000)
{
table[2] = m_modulus ^ (... | ALGO | 0.999432 | 5.535272 |
ddd5c3af-ac94-4897-b78a-cfcbb29cfae7 | cerredz/LeetCode-Problems | 125.ValidPalindrome.cpp | class Solution {
public:
bool isPalindrome(string s) {
/*
Approach / Psuedocode
- we will be taking a two pointer approach, and continue to check if the left pointer is equal to the right pointer at every character
- if they are an alphabetical character and not equal t... | ALGO | 0.998507 | 6.640901 |
afc801f5-5cab-4c88-a9e0-3e253cf3b004 | ms303956362/myexercise | Cpp/codeforces/cf/825/A.cpp | // IO
#include <iostream>
#include <iomanip> // std::setprecision
#include <sstream>
// ordered container
#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <string>
#include <stack>
#include <queue>
// associative-container
#include <map>
#include <set>
#include <unordered_map>
#i... | ALGO | 0.999956 | 4.692416 |
a24bd918-2464-469f-98c9-9f0a11eeb659 | ccuwxy/PAT_Basic_Level_Practice | 1029/1029.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
string a, b;
char count[200] = { 0 };
cin >> a >> b;
char ch;
for (int i = 0; i < b.length(); i++)
{
ch = b.at(i);
if (ch >= 'a' && ch <= 'z')
ch -= 32;
count[ch]++;
}
for (int i = 0; i < a.length(); i++)
{
ch = a.at(i);
if... | ALGO | 0.999972 | 3.765613 |
af02f9b7-5b15-49da-95b2-bb1968233100 | rish2311/DSA-Revision-Problems | Recursion/Fibonacci.cpp | // https://leetcode.com/problems/fibonacci-number
// Solution 1 - Recursion - TLE
// Time Complexity - O(2^n)
// Space Complexity - O(n) (Recursive Stack Space)
class Solution {
public:
int fib(int n) {
if(n <= 1) return n;
return fib(n-1) + fib(n-2);
}
};
// Solution 2 - Memoization - Top Do... | ALGO | 0.999997 | 7.009201 |
4e64f880-e54c-4d8b-9265-1feb8e33a0ca | zhangchi2004/ICS-2023 | coroutine_lab/src/binary_search.cpp | #include "common.h"
#include <assert.h>
#include <random>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
coroutine_pool *g_pool;
void lookup_coroutine(const uint32_t *table, size_t size, uint32_t value,
uint32_t *result) {
size_t low = 0;
... | ALGO | 0.994635 | 4.19746 |
2624e697-d8d2-41ad-93a3-260909472068 | IJmouri/uri | 1242.cpp | #include <iostream>
#include <stack>
#include <stdio.h>
using namespace std;
int main()
{
string s;
int t,i,k,count;
while(cin>>s)
{
stack <char> st;
count=0;
for( i = 0; i < s.length(); i++)
{
if(st.size() > 0 && (( s[i] == 'B' &&st.top() == 'S')|| (st.top() ... | ALGO | 0.999177 | 3.697779 |
465f6e12-cff8-4faa-93ca-1b0cac35ff54 | sb2356-iiitr/DSA-for-College | Data Structures/comp.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
bool exp2(ll n)
{
if (n == 1)
{
return false;
}
return (n>0 && (n&(n-1)) == 0);
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("ip.txt", "r", stdin);
freopen("op.txt", "w", stdout... | ALGO | 0.99836 | 4.6796 |
7c56fd12-3c40-4007-92ee-608b58ba1850 | TheSchoolBusDriver/cpp-self-learn-fork | Free_Code_Camp/for_loops.cpp | /*
Name: Ahmed Affaan
Title: for_loops.cpp
Folder: CPP/Free_Code_Camp
Date: 26/06/2022
Country: Republic of Maldives
Code version: -
Description: -
Credits to: Giraffe Academy
Credits to link: https://www.youtube.com/watch?v=vLnPwxZdW4Y
Note: Uncomment codes to execute and comment them when not in use.
*/
// Program s... | ALGO | 0.99961 | 4.138921 |
d3b8e505-2f01-49af-99f0-596c56001604 | hrhabib07/cpp_for_data_structure | 2025/1.January 25/Week-1/Day 1 of January25 week 1/mapInSTL.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
map<string,int> m; // map take values in sorter order
m.insert({"Yousuf",7});
m["Habib"] = 19;
for (auto it = m.begin(); it != m.end(); it++)
{
cout<<(*it).first<<" "<<(*it).second<<endl;
}
return 0;
} | ALGO | 0.982024 | 4.125799 |
2eb8ffcf-baa4-4ae5-8714-48c2b07ea819 | moinulshaon/UVa-Problems | vol 101/10190__completed/10190.cpp | #include <cstdio>
#include <vector>
using namespace std;
int main()
{
int n,m;
while (scanf("%d %d",&n,&m)==2)
{
if (m==1 || m==0 || n==0 || n==1)
printf("Boring!\n");
else
{
vector <int> v;
while (n%m==0 && n!=1)
{
v.... | ALGO | 0.999877 | 3.719734 |
275d831c-ce4b-420e-aafd-53b9cc5f003a | putdata/algorithm-problem-solving | NOJAM/4195.cpp | #include <bits/stdc++.h>
using namespace std;
map<string, string> p;
map<string, int> w;
string find(string x) {
if (p[x] == x) return x;
return p[x] = find(p[x]);
}
void merge(string x, string y) {
x = find(x);
y = find(y);
if (x == y) return;
p[y] = x;
w[x] = w[x] + w[y];
}
int main() {
ios::sync_w... | ALGO | 0.999863 | 4.720448 |
21473dba-6dda-4298-9c01-c54075775815 | Mickeyyayaya/Itsa_407410078 | MM130.cpp | #include <bits/stdc++.h>
using namespace std;
int cmp ( const void *a , const void *b )
{
return *(int *)a - *(int *)b;
}
int main()
{
int a[100];
int i = 0;
while (cin>>a[i])
i++;
qsort(a,i,sizeof(a[0]),cmp);
if(i%2!=0)
cout<<a[(i-1)/2]<<endl;
else
{
float mid =... | ALGO | 0.999874 | 3.957145 |
a78ef834-7241-4865-8b4b-f2fcedf80cf4 | MarkKim1/Leetcode | 218-the-skyline-problem/218-the-skyline-problem.cpp | class Solution {
public:
vector<vector<int>> getSkyline(vector<vector<int>>& buildings) {
// Iterate over all buildings, for each building i,
// add (position, i) to edges.
vector<vector<int>> edges;
for (int i = 0; i < buildings.size(); ++i){
edges.push_back({buildings[i... | ALGO | 0.999984 | 6.626108 |
e6370235-0f1c-4b7d-94e5-aa3d6ba55ec9 | thb1314/mmyolo_tensorrt | mmcv/mmcv/ops/csrc/pytorch/cpu/box_iou_rotated.cpp | template <typename T>
void box_iou_rotated_cpu_kernel(const Tensor boxes1, const Tensor boxes2,
Tensor ious, const int mode_flag,
const bool aligned) {
int output_size = ious.numel();
auto num_boxes1 = boxes1.size(0);
auto num_boxes2 = boxes2.size(0)... | ALGO | 0.996631 | 6.039558 |
15427bbf-bd7f-4ca6-b9dc-e9dc913e66d3 | nsh07/codeforces-solutions | 2053A.cpp | //
// Created by Nishant Mishra <https://github.com/nsh07>
//
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<i... | ALGO | 0.999759 | 5.262753 |
b59e25d1-c605-49ec-991a-5f9067d06f60 | adelyprz/cpp | Ejercicios/Ejercicio35-Funciones-con-ciclos/main.cpp | #include <iostream>
using namespace std;
void imprimirCaracteres(char caracter, int ciclos)
{
for(int i = 0; i < ciclos; i++)
{
cout << caracter;
}
cout << endl;
}
int main(int argc, char const *argv[])
{
imprimirCaracteres('@',10);
imprimirCaracteres('#', 5);
cout << "Hola ... | ALGO | 0.949681 | 3.134751 |
94c8ba9e-3a68-456a-8fc3-2f357142fd96 | lifecycles1/competitive-programming | codesignal/arcade/2.core/10.lab of transformations/6.higherVersion.cpp | // Given two version strings composed of several non-negative decimal fields separated by periods ("."),
// both strings contain equal number of numeric fields. Return true if the first version is higher than
// the second version and false otherwise.
// The syntax follows the regular semver ordering rules:
// 1.0.... | ALGO | 0.979815 | 6.341495 |
89172f08-d6bb-4f62-813d-e72b6adced5a | djamel-benamara/Algorithmic | apb/apb.cpp | #include "eleve.hpp"
#include "fac.hpp"
#define NB_ELEVES 40000 //le nombre d'élèves
#define NB_CHOIX 10 //l'élève à 10 choix
#define NB_FAC 50 //le nombre d'établissments
/*
Initialise les données des élèves
*/
void init_e(vector<eleve>& e,vector<fac>& f) {
for(int i=0;i<e.size();i++) {
e[i].init(i);
for(int j... | TOOL | 0.974142 | 3.585324 |
1c482afe-8976-4c2d-be2b-20d228f8dd9c | phlaster/nummethPoly | semester_4/Course work/modules/Sparse_funcs.cpp | #include "headers/HEADER.hpp"
#include "headers/Sparse.hpp"
#include <cmath>
void spy(const spMtr& sA){
cout << "non-zero: " << sA.valCounter << endl;
if (sA.rows>45){
cerr << "Matrix is too wide to display" << endl;
return;
}
for (size_t i = 0; i < sA.rows; i++){
for (size_t j ... | ALGO | 0.996226 | 4.053947 |
8a190084-c8f7-4112-84d5-ff3b502772e8 | sjm150/ps | baekjoon/13976/solution.cpp | #include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair<pair<ll, ll>, pair<ll, ll>> mat;
const ll mod = 1e9 + 7;
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
ll n; cin >> n;
if (n % 2) {
cout << 0 << '\n';
return 0;
}
... | ALGO | 0.999993 | 4.206245 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.