uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
43d62046-45f0-4e8f-bff8-de4bf3d88553 | prabhjeet13/eatsleepcode | server/Controllers/codes/553ba904-5d47-4a70-9166-5e3717ee40e0.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n , target;
cin >> n >> target;
vector<int> vec(n,0);
for(int i =0 ; i < n; i++)
{
cin>>vec[i];
}
map<int,int> mp;
bool found = false;
for(int i = 0 ; i < n; i++)
{
if(mp.find(target - vec... | ALGO | 0.999908 | 5.046624 |
de8b3331-f9d6-4e3e-8f22-80b35eacd442 | techaakritisha/LeetCode | 0002-add-two-numbers/0002-add-two-numbers.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbe... | ALGO | 0.999943 | 6.254046 |
fc36bcd9-0838-44dd-acc1-54f7b75b6089 | ishandutta2007/codeforces | maxwellzen/normal/1615/D.cpp | #include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> iset;
typedef long long ll;
typedef long double db;
typedef string str;
typedef vector<int> vi;
typedef vector... | ALGO | 0.999936 | 4.601368 |
3a632204-2438-4a73-a0a3-eced94b647f0 | ishandutta2007/codeforces | dfgzm/normal/1725/L.cpp | #include<bits/stdc++.h>
#define int long long
#define ll long long
using namespace std;
const int maxn=100010,mod=998244353;
int i,j,k,n,m,a[maxn],b[maxn],c[maxn],tree[maxn];
int lowbit(int x){return x&(-x);};
void add(int x,int s){if(x)for(;x<=n;x+=lowbit(x))tree[x]+=s;}
int find(int x){int s=0;for(;x;x-=lowbit(x))s+=... | ALGO | 0.999902 | 3.503774 |
b9fc0b09-1646-4f2c-9878-f07841c5c0dc | nico-ig/Poligonos | src/polygon.cpp | #include <iostream>
#include <cmath>
#include "polygon.h"
Polygon read_polygon() {
int v;
std::cin >> v;
std::vector<Point> vertices;
while ( v-- ) { vertices.push_back(read_point()); }
return Polygon(vertices);
}
void print_polygon(int i, Polygon p) {
std::cout << i;
if ( !p.is_simple() ) { std::cou... | ALGO | 0.998438 | 5.123054 |
97911b26-ffe5-4111-b43b-b546f632cdfb | kelvincer/Dijkstra-s-Algorithm | main.cpp | /*
* File: main.cpp
* Author: kelvinc
*
* Created on 23 de mayo de 2024, 14:48
*/
#include <iostream>
#include <cstdlib>
#include <random>
#include <algorithm>
#include <set>
#include "Graph.h"
#include "PriorityQueue.h"
#include "ShortestPathAlgo.h"
using namespace std;
// Maximum number of nodes
const int ma... | ALGO | 0.997873 | 4.089187 |
7b7d3f74-51b9-4a8c-becd-2bf84b59a31b | guider/Snorlax | leetcode/bit-manipulation/421-Maximum-XOR-of-Two-Numbers-in-an-Array.cpp |
#include <vector>
using namespace std;
/*
* 在 nums 数组中找到 nums[i]、nums[j],使得 nums[i] ^ nums[j] 最大
*
* 我们知道,^ 表示 XOR,即异或,只有当两个 bit 不相等时,操作结果才为 1。
* 那么为了使得 XOR 的结果尽可能的大,我们就需要让 nums[i] 和 nums[j] 的 bit 位尽可能地不同
*
* 例如 :
* a = 0101 0101
* b = 1010 1010
*
* 此时 a ^ b = 255,达到 8bit 的最大值。
*
* 也就是说,我们需要剖析 nums 中... | ALGO | 0.999987 | 5.714797 |
616d8053-9a60-4f01-adc6-a3dabcffacad | radenk21/belajar-array | latihan-array.cpp | #include <iostream>
#include <array>
using namespace std;
int main()
{
array <int, 11> nilaiMhs;
for (int i = 0; i < nilaiMhs.size(); i++)
{
cout << "Mahasiswa dengan nilai ";
if(i == 0){
cout << "0-9: ";
}
else if(i == 10){
cout << "100: ";
... | ALGO | 0.961079 | 3.65686 |
56f351ee-5269-4f32-bcbe-e63c29e90027 | frcepeda/Contest-Archive | Code Jam/2018/Round 2 2018/A.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
const int maxc = 110;
int C;
int B[maxc], to[maxc];
char g[maxc][maxc];
int works(){
int last = 0, curr = 0;
if (B[0] == 0 || B[C-1] == 0) return -1;
for (int i = 0; i < C; i++){
for (; i - last >= B[curr]; curr++)
last = i;
to[i] = curr;
}
... | ALGO | 0.999842 | 4.18889 |
d8049247-7e34-4b03-8635-278427f9b0d8 | gukazma/OSGEditor | src/Vendors/glm/test/gtx/gtx_simd_mat4.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentatio... | TEST | 0.985561 | 6.517536 |
eaefb975-7e82-455b-9bcf-b7bcabe1157c | alexhansen1234/orbital_sim | lib/network/ex.cpp | #include <boost/graph/adjacency_list.hpp>
#include <boost/graph/depth_first_search.hpp>
#include <iostream>
#include <vector>
using namespace std;
typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS> MyGraph;
typedef boost::graph_traits<MyGraph>::vertex_descriptor MyVertex;
typedef boost::graph... | ALGO | 0.99958 | 4.7916 |
aebcd0b2-7d74-4b1b-a434-acc2ec444755 | anoobzg/qi | src/blender/src/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp | /** \file
* \ingroup freestyle
* \brief Class to build view edges and the underlying chains of feature edges...
*/
#include <list>
#include "SilhouetteGeomEngine.h"
#include "ViewEdgeXBuilder.h"
#include "ViewMap.h"
#include "../winged_edge/WXEdge.h"
using namespace std;
namespace Freestyle {
void ViewEdgeXBui... | ALGO | 0.96745 | 3.445041 |
d778b849-ab2b-4a07-a5ed-0e2205ec3ab2 | samfubuki/leetcode-questions-solutions | containerwithmostwaterleetcode.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int n = height.size();
int maxarea = INT_MIN;
int i=0;
int j= n-1;
while(i<j)
{
int minele = min(height[i],height[j]);
maxarea = max(maxarea,minele*(j-i));
if(height[i]<height[j])
... | ALGO | 0.999955 | 6.612514 |
c81e32a4-5d10-49de-ae8c-8dcac4bab3e1 | jw0293/BOJ | boj_#1351.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <climits>
#include <set>
#include <map>
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long lon... | ALGO | 0.999962 | 4.237806 |
a1e8b690-dd5c-487a-92b8-1d0dfd7802cc | demercurizer/Algorithms-mipt-tasks | algorithms_sem_2_3/X.cpp | #include <algorithm>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <utility>
#include <vector>
template <typename T>
void Print(T& container);
struct VectorHasher {
template <typename T>
int operator()(const std::vector<T>& v) const {
int hash = v.s... | ALGO | 0.999969 | 4.833066 |
82819c3c-e437-46b4-8307-7625be767347 | vslutov/cmc-archieve | FourthSemester/PracticalCourse/2015-05-07/ps08-1.cpp | #include <iostream>
#include <string>
using namespace std;
auto
count(string::const_iterator &iter,
const string::const_iterator &end,
char ch)
{
ssize_t result = 0;
while (iter != end && *iter == ch) {
++ result;
++ iter;
}
return result;
}
auto
is_str(const string &test... | ALGO | 0.991692 | 4.512746 |
d60aba62-2ad6-49c2-8750-d2b906470000 | ishandutta2007/codeforces | lul____sepled1305/normal/1389/D.cpp | /**Nephren is the best girl**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
using pii = pair<int,int>;
using pll = pair<ll,ll>;
const int MOD = 1e9+7;
const int chtholly = 0;
int T;
int main()
{
/**ios_base::sync_with_stdio(false);
cin.tie(NULL);**/
... | ALGO | 0.999951 | 3.382223 |
d0db3c31-9ea0-4cd3-a964-f0c37b4e3d9b | heavenMOJANG/ICPC | .history/luogu/【图论2-1】树/P3038 [USACO11DEC] Grass Planting G_20240809102929.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
constexpr int N = 1e5 + 10;
int n, m, dep[N], siz[N], son[N], top[N], fa[N], idx, a[N], newA[N];
vector<int> g[N];
struct segmentTre... | ALGO | 0.999973 | 4.560816 |
5137cdc4-649d-4e63-855c-95d4d6e20744 | freakFlow/codetree-TILs | 241010/특정 문자의 유무/specific-character-presence.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cin >> str;
cout << (str.find("ee") != string::npos ? "Yes" : "No");
cout << ' ' << (str.find("ab") != string::npos ? "Yes" : "No");
return 0;
} | ALGO | 0.999796 | 3.853779 |
53661667-2c78-4e61-a6f6-46e42e9fd1e1 | civinx/ACM_Code | Practice/HDU/5884 Sort (K叉哈夫曼树)/5884 Sort (K叉哈夫曼树)/main.cpp | #include <queue>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 100000 + 100;
const int inf = 0x7fffffff;
int a[maxn], n, T;
bool check(int k) {
int cnt = 0;
queue<int> q1, q2;
int mod = (n-1) % (k-1);
if (mod) {
for (int i =... | ALGO | 0.999972 | 4.186087 |
a8a09bf7-7ae4-49e6-82fd-640dd6206984 | Itsrajsk/DSA-In-Cpp-From-Scratch | Queue/First-Negative-Integer-In-K-Window-Size.cpp | // First Negative Integer In Every Window Of Size K
#include <bits/stdc++.h>
using namespace std;
void printFirstNegative(long long int A[], long long int N, long long int K)
{
deque<long long int> dq;
vector<long long int> ans;
for (int i = 0; i < K; i++)
{
if (A[i] < 0)
{
... | ALGO | 0.999996 | 4.914975 |
60cddab2-3cc2-4049-b93c-2d3c1ec61bb5 | Ziklon/algorithms | tc/testprograms/AppleWord.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.999892 | 4.453526 |
151a3af3-a31a-4b5f-bef1-2b66b74830b7 | zack-huangzihan/AEtherSx2-ARMLinux | 3rdparty/wxwidgets3.0/src/common/datetimefmt.cpp | // ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// -------------------------------------------------... | TOOL | 0.94417 | 5.663819 |
a172b01f-c6c8-45cb-8188-30a3890f4ddb | margnul/Non-integers | drob_satu.cpp | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "drob_satu.h"
void drob_satu::checker() {
satu = false;
if (c > 9999) {
satu = true;
c = 9999;
}
if (c < -9999) {
satu = true;
c = -9999;
}
}
drob_satu::drob_satu(double a) : drob(a) {
checker();
}
drob_satu::drob_satu(int a, int b) : dr... | TOOL | 0.98919 | 4.032392 |
d29c146c-9fca-4b38-8994-552839b16968 | Mocknbrd/Codeforces_solutions | Code/740.cpp | // You are given an integer array nums. You want to maximize the number of points you get by performing the following operation any number of times:
// Pick any nums[i] and delete it to earn nums[i] points. Afterwards, you must delete every element equal to nums[i] - 1 and every element equal to nums[i] + 1.
// Return... | ALGO | 0.999976 | 4.34993 |
856d0747-2138-48a6-8487-7c9c4cda5c45 | ishandutta2007/codeforces | leaf1415/normal/1473/D.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#include <complex>
... | ALGO | 0.999952 | 3.802261 |
5d7edefc-ed24-419f-b926-c22e3042834e | harukaeru/CompetitiveProgramming | apg4b/EX20/main.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
#include <algorithm>
#define FMT_HEADER_ONLY
#include <fmt/ranges.h>
#include <iterator>
#include <vector>
int count_report_num(vector<vector<int>> &children_list, int x) {
vector<int> children = children_list.at(x)... | ALGO | 0.99982 | 4.347478 |
673c6b3e-ac95-46db-add2-073e83840310 | kalvincui/LeetCode | 790. Domino and Tromino Tiling.cpp | class Solution {
public:
int numTilings(int n) {
vector <long long> ans (n+3, 0);
ans[1] = 1;
ans[2] = 2;
ans[3] = 5;
for (int i = 4; i<=n; i++){
ans[i] = 2*ans[i-1] + ans[i-3];
ans[i] = ans[i] % 1000000007;
}
return ans[n];
}
};
| ALGO | 0.999959 | 5.732435 |
6cd9b77b-7e9e-473f-b74f-a30739ae9a09 | Hinski2/CP | codeforces/problems/WeirdSort/cpp1832.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& v){
for(const auto &u: v){
os << u << ' ';
}
return os;
}
te... | ALGO | 0.99987 | 4.456841 |
427a3326-c81f-42c5-8a44-c27c3edddc80 | Nestor1509/nosNerfearon | Primos/Es_Primo_Criba.cpp | vector<int> getPrimes(int n){
vector<bool> is(n+1, true);
vector<int> primes = {2}; // introducimos el 2 a mano, pues solo procesamos los primos impares por la optimización
is[0] = is[1] = false;
for(int i = 4; i <= n; i += 2){
is[i] = false;
}
for(int i = 3; i <= n; i += 2){
if(... | ALGO | 0.999927 | 5.101364 |
4958140a-5838-4718-984a-dec03e1c73e4 | ishandutta2007/codeforces | merkurev/normal/763/B.cpp | #include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#end... | ALGO | 0.998492 | 3.116337 |
2010b27a-8a26-4ba3-a87b-77019b7f641b | r3kste/cp | progC/PS/graph/C_Ehab_and_Path_etic_MEXs.cpp | #include "bits/stdc++.h"
using namespace std;
#define integer int
#define int long long
#define endl '\n'
#define MOD (int)(1e9 + 7)
#define fastio \
ios_base::sync_with_stdio(false); \
cin... | ALGO | 0.999989 | 5.173447 |
152a53c7-ea35-436a-8353-ac6ec8980b90 | Imraan002/My-c-programs | pattern.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int T;
cin>>T;
while(T--)
{
int n;
cin>>n;
int j;
for(int i=1;i<=n;i++)
{
for( j=1;j<=i;j++)
{
cout<<j;
if(i>1 and i<=n )
{
for(int k=1;k<=j... | ALGO | 0.999801 | 3.871348 |
41ecac1a-86e4-49da-810e-5a8d3775793f | SONGS4RI/42 | codingtest_study/barrrking/0x0D_dp/boj12852.cpp | /* 1로 만들기 2 */
/* 13:05 ~ 13:25 */
#include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n, dp[1000001]={0,};
cin >> n;
for(int i=2;i<=n;i++)
{
if (i%6==0) dp[i] = min(min(dp[i/3],dp[i/2]),dp[i-1])+1; // 6으로 나누어지면
else if(i%3==0) dp[i] = min(dp[i/3], dp[i-... | ALGO | 0.999992 | 3.920141 |
8ce64cc0-611b-4cec-ba77-11b144fc49b2 | qitianchen/QLib | eigen3/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.999726 | 4.009594 |
004aabf5-ac87-415e-a5b7-8fd6b56a3cc0 | RavenColEvol/competitive-journey | Contest/Codeforces/C.cpp | #include<bits/stdc++.h>
#define test(t) for(cin>>t;t;--t)
#define rep(i,n) for(ll i=0;i<n;i++)
#define repr(i,k,n) for(ll i=k;i<n;i++)
#define repr_r(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define pb push_back
#define f first
#define sec second
#define in cin>>
#define out cout<<
#define endl '\n'
#define opt... | ALGO | 0.999797 | 4.202735 |
a42b23d6-e8ee-4c73-9cf0-49438e41b3f9 | scnb/Cpp-learning_Chapter5 | 5-9/5-9.cpp | // Chapter5.cpp : ̨Ӧóڵ㡣
//ʹһstringзת
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "Enter a word: ";
string word;
cin >> word;
char temp;
int i, j;
for (j = 0, i = word.size() - 1;j < i;--i, ++j)
{
temp = word[i];
word[i] = word[j];
word[j] = temp;
}
... | ALGO | 0.977395 | 3.28619 |
c0ece905-72f6-4a89-aaab-4c5087e02f43 | jeeveat/Codeforces | 670_B.cpp | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
int t; cin >> t;
while (t--)
{
ll n; cin >> n;
ll a[n];
for (auto& i : a)
cin >> i;
sort(a, a + n);
cout << max({ a[0] * a[1] * a[n - 1] * a[n - 2] * a[n - 3],a[0] * a[1] * a[2] * a[3] * a[n - 1],a[n - 5] * a[n - 4] * a[n... | ALGO | 0.999951 | 3.698754 |
b4175627-2d1a-47aa-bdb0-86d9962a8a19 | saketh-pallempati/data-structures-sastra | singleLinkedList.cpp | #include <iostream>
using namespace std;
class node
{
public:
int data;
node *next;
node(int val)
{
data = val;
next = NULL;
}
};
node *head = NULL;
int count = 0;
void insertBeggining(int val)
{
node *n = new node(val);
n->next = head;
head = n;
count++;
}
void inser... | ALGO | 0.999489 | 4.144107 |
18a715da-e098-479a-b147-6b83fcae2a44 | iyuvrajsha/competitive-programming-codes | codes/sorting_parts2.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
long long a[n],mi=0 , ma=0,mii=0,mai=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
if(a[i]>ma)
{
ma=a[i];
... | ALGO | 0.999962 | 3.919967 |
950a4921-5b35-47b2-9134-b0d37dd812c0 | harshdigi/Data-Structure-and-Algorithm | Array/MajorityElement.cpp | #include<bits/stdc++.h>
using namespace std;
int solve(vector<int> nums){
int winner = nums[0], majority_count = 0;
for(int i:nums) {
if(i == winner)
majority_count++;
else
majority_count--;
if(majority_count < 0) {
majorit... | ALGO | 0.999857 | 4.834989 |
4c518aed-227a-4af4-8aaf-3c0cf045e0d2 | HasnathJami/Problem-Solving | CODEFORCES/Problems/BitPlusPlus.cpp | #include <iostream>
using namespace std;
int main()
{
int X,n,counter=0;
string s;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>s;
if(s.find("++")!= string::npos)
{
counter++;
}
else if(s.find("--")!= string::npos)
{
counter--;
}
}
cout<<c... | ALGO | 0.999432 | 3.771886 |
bdb953ab-0153-4ca5-8115-d6fde7f78339 | jjiny0716/Algorithm | Codewars/c++/5kyu_Perimeter_of_squares_in_a_rectangle.cpp | #include <iostream>
typedef unsigned long long ull;
class SumFct
{
public:
static ull perimeter(int n);
};
ull SumFct::perimeter(int n) {
ull sum = 1;
ull a = 0, b = 1, c = 1;
for (int i = 0; i < n; i++) {
sum += c;
a = b;
b = c;
c = a + b;
}
return sum * 4;
}
int main()
{
std::cout << SumFct::perime... | ALGO | 0.999744 | 4.344907 |
1ab74b1d-a0e0-4e2a-95f5-6758c361bbf1 | berli/SuperLPR | Prj-Linux/lpr/src/PlateSegmentation.cpp | //
// Created by Jack Yu on 16/10/2017.
//
#include "../include/PlateSegmentation.h"
#include "../include/niBlackThreshold.h"
//#define DEBUG
namespace pr{
PlateSegmentation::PlateSegmentation(std::string prototxt,std::string caffemodel) {
net = cv::dnn::readNetFromCaffe(prototxt, caffemodel);
}
... | ALGO | 0.983142 | 4.078229 |
5f7c096f-67dc-44c0-8495-2b4e01ffd284 | mwashief/step | UVa/10600.cpp | /*
Washief Hossain Mugdho
25 August 2020
UVa 10600
*/
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define fastio ios_base::sync_with_stdio(0)
#define untie cin.tie(0)
#de... | ALGO | 0.99988 | 4.218814 |
a57062ce-5437-4e31-8a63-8c2ec64b2783 | cbkpar/BOJ | boj_9842.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool ArrPrime[200001] = { false, };
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
for (int i = 2; i * i <= 200000; i++) {
for (int j = i * i; j <= 200000; j += i) {
ArrPrime[j] = true;
}
}
ve... | ALGO | 0.999864 | 4.492444 |
d2fdb6a8-d57c-45e9-baf9-f9c34ee6359d | Anurag1008/DATA_STRUCTURES_AND_ALGORITHMS | Daily_Leetcode/32.cpp | //1125. Smallest Sufficient Team
/*
class Solution {
public:
vector<int>res;
void helper(int i,vector<int>&people_skill,int m,int mask,vector<int>&ans,vector<vector<int>>&dp)
{
if(i == people_skill.size()) //Base Case
{
if(mask == ((1<<m)-1)) //Check for all req_skills included
{
if(res.size() == 0... | ALGO | 0.999802 | 5.83789 |
47462d91-c73b-4a4e-8735-384634c5feca | anubhvshrma18/Top-100-Liked-Leetcode | LinkedLists/141. Linked List Cycle/solution.cpp | class ListNode {
public:
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
bool hasCycle(ListNode *head) {
if (!head) return false;
ListNode *slow = head;
ListNode *fast = head;
while (fast && fast->next) {
... | ALGO | 0.999954 | 5.716596 |
91ce0562-7b9f-47c1-a163-05782de8cf3d | raymondyfei/libWetHair | libWetHair/DER/Forces/StretchingForce.cpp | #include "StretchingForce.h"
#include "ViscousOrNotViscous.h"
namespace libwethair {
template <typename ViscousT>
scalar StretchingForce<ViscousT>::localEnergy(const StrandForce& strand,
const IndexType vtx) {
const scalar ks = ViscousT::ks(strand, vtx);
const scalar... | ALGO | 0.996002 | 6.158465 |
6341ad02-4106-43e7-baf7-2773bf75a9ee | shaikhikram04/DSA-with-Cpp | String/Maximum occurrence character.cpp | #include <iostream>
#include <string>
using namespace std;
char maxOccChar(string str)
{
char arr[26] = {0};
//create an array of count of character
for (int i = 0; i < str.size(); i++)
{
int ch = str[i];
int number = ch - 'a';
arr[number]++;
}
//find maximum occ character
int ans, maxi = -1;
for (int ... | ALGO | 0.999112 | 5.1472 |
4b9d5045-9c6a-4d0e-8533-9f9f79541693 | osamamajid/chat-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.999011 | 6.735465 |
1b2760e0-bb1a-43ed-8a3c-6ef64e38f735 | TJUSsr/leetcodesolution | 103-binary-tree-zigzag-level-order-traversal/binary-tree-zigzag-level-order-traversal.cpp | // Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
//
//
// For example:
// Given binary tree [3,9,20,null,null,15,7],
//
// 3
// / \
// 9 20
// / \
// 15 7
//
//
//
// return it... | ALGO | 0.999994 | 6.345414 |
33b5b9fd-7ffc-4794-9d10-612f9fb93b4f | udaykiran4383/SOC-2024 | iqtest.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
vector<int> arr(n);
int e=0;
int o=0;
for(int i=0;i<n;i++){
cin>>arr[i];
if(arr[i]%2==0){
e++;
}
else{
o++;
}
}
if(e==1 && o==n-1){
for(int ... | ALGO | 0.999957 | 3.844155 |
9b364a21-371a-4058-bba7-8f70438241c5 | Astitva0809/Leetcode | 0051-n-queens/0051-n-queens.cpp | class Solution {
public:
void solve(int col, vector < string > & board, vector < vector < string >> & ans, vector < int > & leftrow, vector < int > & upperDiagonal, vector < int > & lowerDiagonal, int n) {
if (col == n) {
ans.push_back(board);
return;
}
for (int row = 0; row < n; row+... | ALGO | 0.999797 | 5.188078 |
13742858-4bd2-439c-a02a-6dfbb8a3cee9 | albertotezza/embedded-systems-programming-aa-2019-20 | final-project/homework-albertotezza/library/bookings_management.cpp | // bookings_management.cpp
#include "BookingsManagement.h"
#include "GlobalVariables.h"
#include "Booking.h"
#include <fstream>
using std::ifstream;
#include <vector>
using std::vector;
#include <mutex>
using std::mutex;
#include <condition_variable>
using std::condition_variable;
using std::unique_lock;
// constant... | TOOL | 0.998003 | 5.245965 |
56ac4c16-3978-4b08-86cf-8c3b6664e484 | SMostafa1/CarND-MPC-Project | src/Eigen-3.3/doc/examples/class_Block.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::Block<Derived>
topLeftCorner(MatrixBase<Derived>& m, int rows, int cols)
{
return Eigen::Block<Derived>(m.derived(), 0, 0, rows, cols);
}
template<typename Derived>
const Eigen::Block<const Derive... | TOOL | 0.876438 | 5.901438 |
aec73dfe-87af-4313-98f9-40717c94704f | press0/cpp-proximity-search | Search.cpp | #include <iostream>
#include "Search.h"
Search::Search(int argc, char **argv, bool debug) {
parameters = new Parameters(argc, argv, debug);
fileReader = new SearchFileReader(*parameters);
queue = new ForwardSearchFifoQueue(*parameters);
}
void Search::run() {
for (int i=0; i < fileReader->get_words().... | TOOL | 0.942427 | 4.107838 |
149f63ea-e6d5-4d33-8754-0a8058b79402 | pratikkumar399/Data-Structures-And-Algorithm | stack/classarraystack.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX 10000
class Stack
{
int top;
public:
int arr[MAX];
bool push(int x);
int pop();
bool isempty();
};
bool Stack ::push(int x)
{
if (top > MAX)
{
cout << "Stack overflow" << endl;
return false;
}
else
{
... | ALGO | 0.997647 | 4.195014 |
027bd601-5ab1-4e0a-8665-969fdcb7c326 | Adam27X/cpp-reference-material | accelerated-cpp-exercises/Chapter_03/04/name.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
int main()
{
std::cout << "Please enter a list of words: ";
std::string x;
typedef std::string::size_type sz;
std::vector<sz> data;
while(std::cin >> x)
{
data.push_back(x.size());
}
if(data.size() == 0)
{
std::cout << "Error, ... | ALGO | 0.997465 | 4.006747 |
58fa8da1-6590-472b-b681-1fe37f97cf48 | Symforian/University | Numeric Methods/Lista1/Zadanie3.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int n;
cin>>n;
double sum=0;
for(int i =0; i<n; i++)
{
if(i%2==0)
sum+=(1/(2.0*i+1));
else
sum-=(1/(2.0*i+1));
cout<<setprecision(16)<<sum<<endl;
//if(sum*4<0.0000001)
// {cout<<i<<endl;
// return 0;}
}
sum*=4... | ALGO | 0.999786 | 3.609569 |
3be6da1a-50db-4151-8e2d-43182f192817 | utkarsh-27-sharma/DSA | LeetCode/237_delete_a_node_in_linkedlist.cpp | class Solution {
public:
void deleteNode(ListNode* node) {
ListNode* nodeNext = node->next;
int savedNextData = node->next->val;
nodeNext->val = node->val;
node->val = savedNextData;
node->next = nodeNext->next;
delete nodeNext;
}
};
// https://leetcode.com/proble... | ALGO | 0.999827 | 6.510677 |
e087d8d2-37e5-4c70-befe-5e5f450318ac | nanshan-high-school/2021_pro_winter | Level2/snorlaxallan_code11_lv.2 _3.0.cpp | #include <iostream>
#include <vector>
using namespace std;
int h, n, K, C, num;
int count = 0;
int sum = 0;
vector<int>zero_and_one, code, decode_;
vector<vector<int>>type_in, decode;
vector<vector<int>>code11 = {{1, 0, 0, 0, 0}, {1, 0, 0, 1, 0}, {0, 0, 0, 1, 1},
{1, 0, 1, 0, 0}, {0, 1... | ALGO | 0.995452 | 3.583683 |
dadf2b22-f21e-48e2-8cb0-b4f879ffe3bb | fciapsa/Competitive-Programming | AceptaElReto/668Restanacci.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
std::ios::sync_with_stdio(false);
int a, b, n, act, prev, aux;
cin >> a >> b >> n;
while (a || b || n) {
n %= 6;
if (n == 0) cout << a;
else if (n == 1)cout << b;
else if (n == 2) cout << b ... | ALGO | 0.999745 | 3.635011 |
2b80000a-ea6e-483d-813c-996a12400aa2 | TINY-KE/active_object_slam | src/line_detect/libs/LSDDetector.cpp | #include "precomp.hpp"
//using namespace cv;
namespace cv
{
namespace line_descriptor
{
Ptr<LSDDetector> LSDDetector::createLSDDetector()
{
return Ptr<LSDDetector>( new LSDDetector() );
}
/* compute Gaussian pyramid of input image */
void LSDDetector::computeGaussianPyramid( const Mat& image, int numOctaves, int sc... | ALGO | 0.993774 | 5.45046 |
d449a622-5405-44c1-9d02-6bc4891b130d | saktheeswaranswan/leetcode-monk-version-data-structure | 09 Binary Tree/vertical_print.cpp | #include<iostream>
#include<queue>
#include<vector>
#include<map>
using namespace std;
class node{
public:
int data;
node*left;
node*right;
node(int d){
data = d;
left = NULL;
right = NULL;
}
};
//Input : 1 2 4 -1 -1 5 7 -1 -1 -1 3 -1 6 -1 -1
node* buildTree(){
int d;
cin>>d;
if(d==-1){
return NU... | ALGO | 0.999978 | 4.912833 |
47c4b8bd-26d4-4a54-ac12-ed4891cfaa26 | Shravanthi98/ncrwork | Windows_programs/prog17/prog17.cpp | #include<stdio.h>
#include<Windows.h>
#include<tchar.h>
#include<shellapi.h>
long global_var;
DWORD WINAPI thread_func1(LPVOID lparam)
{
global_var++;
global_var++;
global_var++;
global_var++;
//printf("Final value1 = %d\n ", global_var);
return 0;
}
DWORD WINAPI thread_func2(LPVOID lparam)
{
global_var++;
glob... | TOOL | 0.974763 | 3.800227 |
2cc982b8-ba70-47d6-a2bb-9e988018a5c2 | Pterosaur/algorithm_practice | leetcode/174. Dungeon Game/174. Dungeon Game/174. Dungeon Game.cpp | // 174. Dungeon Game.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
//174. Dungeon Game
//
//The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was ini... | ALGO | 0.999906 | 5.284322 |
cd853e93-600f-44ba-a3c9-c80797f5c856 | 51kfa/mangos-classic | src/scriptdev2/scripts/kalimdor/stonetalon_mountains.cpp | /* ScriptData
SDName: Stonetalon_Mountains
SD%Complete: 100
SDComment: Quest support: 6523.
SDCategory: Stonetalon Mountains
EndScriptData */
#include "precompiled.h"
#include "escort_ai.h"
/*######
## npc_kaya
######*/
enum
{
NPC_GRIMTOTEM_RUFFIAN = 11910,
NPC_GRIMTOTEM_BRUTE = 11912,
NPC_... | TOOL | 0.900922 | 7.281882 |
929d1989-de30-4609-9971-f526f59edda9 | AbhijeetKrishnan/codebook | CodeChef/practice/PERMSUFF.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(pair<int, int> &a, pair<int, int> &b)
{
return a.first < b.first || (a.first == b.first && a.second > b.second);
}
int main()
{
int t;
cin >> t;
while (t--)
{
int n, m;
cin >> n >> m;
... | ALGO | 0.999988 | 4.296026 |
45108429-9972-4128-9aca-e7dcb799adc0 | parisots/SpectralParcellation | Dependencies/toolbox_fast_marching/mex/perform_front_propagation_3d_mex.cpp | #include "perform_front_propagation_3d.h"
#include "mex.h"
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray*prhs[] )
{
/* retrive arguments */
if( nrhs<4 )
mexErrMsgTxt("4 - 7 input arguments are required.");
if( nlhs<1 )
mexErrMsgTxt("1, 2 or 3 output arguments are required.");
... | ALGO | 0.999903 | 4.697744 |
d60bc43f-bad8-4d01-a523-2406edcdc7c3 | nawngs/CompetitiveProgramming | Codeforces/1574a.cpp | #include <bits/stdc++.h>
using namespace std;
int t, n;
void sol() {
cin >> n;
for (int i = 1; i <= n; i++) {
string ans = "";
for (int j = 1; j <= i; j++) {
ans = ans + '(';
}
for (int j = 1; j <= i; j++) {
ans = ans + ')';
}
for (int j = 1; j <= n - i; j++) ans += "()";
cout << ans << '\n';
... | ALGO | 0.999405 | 4.740493 |
82c7dd10-2708-461c-ab98-9eb6390e7382 | gabdourado/Beecrowd | Iniciante/C++/Beecrowd1016.cpp | #include <iostream>
using namespace std;
int main (void) {
int dist, time;
cin >> dist;
time = 2*dist;
cout << time << " minutos" << endl;
return 0;
} | ALGO | 0.994378 | 3.388645 |
7118b8bc-bca2-4a4e-9b15-7eb88aed5928 | sayandip20/GeeksForGeeks | Easy/Max Sum Subarray of size K/max-sum-subarray-of-size-k.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
long maximumSumSubarray(int K, vector<int> &Arr , int N){
// code here
int a=0;
int b =a+K;
long sum=0;
long p=INT_MIN;
for(int i=a;i<b;i++){
... | ALGO | 0.999926 | 5.940435 |
7d74ab11-e33c-4fb1-a61b-5c16f3b30a45 | SquallATF/virtualbox | src/VBox/Runtime/common/math/frexpl.cpp | /* $Id$ */
/** @file
* IPRT - No-CRT - frexpl().
*/
/*********************************************************************************************************************************
* Header Files *
***... | ALGO | 0.993467 | 5.208675 |
37502933-dbdf-4cdd-91cd-e47f1f80d1f6 | TosakaUCW/CompetitiveProgramming | Old/Codeforces/Contests/[Codeforces 1457D] XOR-gun.cpp | #include <stdio.h>
#include <algorithm>
#include <memory.h>
const int N = 1e5 + 5;
const int INF = 2147483647;
int n, ans = INF;
int a[N], b[N], c[N], sum[N];
int read(int x = 0, int f = 0, char ch = getchar())
{
while ('0' > ch or ch > '9')
f = ch == '-', ch = getchar();
while ('0' <= ch and ch <= '... | ALGO | 0.999901 | 3.655038 |
94a20271-1fac-4f07-92cc-1bf96fdc423f | Susenjayswal/Flutter_Location | 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.998756 | 6.772262 |
b2d9468e-8c05-4e9c-9268-5a03c80f66a7 | AdityaBhanwadiya/lc-s | 100-same-tree/same-tree.cpp | class Solution {
private:
void check(TreeNode* root, vector<int>& ans) {
if (!root) {
ans.push_back(INT_MIN);
return;
}
ans.push_back(root->val);
check(root->left, ans);
check(root->right, ans);
}
public:
bool isSameTree(TreeNode* p, TreeNod... | ALGO | 0.99997 | 6.872028 |
68ddca50-9c3a-4643-bd49-638459bb6484 | AlexGrandbell/DiskScheduling | DiskSSTF.cpp | //
// Created by AlexGrandbell on 24-11-27.
//
#include "DiskSSTF.h"
//最短寻道时间优先算法
void DiskSSTF::run() {
cout << "最短寻道时间优先算法" << endl;
showBaseInfo();
cout << "移动磁道序列: "<<current<< " ";
// int min = 0x7fffffff;
// int index = 0;
// while (!requests.empty()) {
// for (int i = 0; i < request... | ALGO | 0.998675 | 3.441794 |
6a2cc181-f9f0-487e-b8e1-b5fb6443b427 | XavierFox12/CodingPortfolio | Hocking College C++/Xavier_Fox_Chp_16_Exercise_1/Xavier_Fox_Chp_16_Exercise_1/Xavier_Fox_Chp_16_Exercise_1.cpp | /* Program: Xavier_Fox_Chp_16_Exercise_1.cpp
Programmer: Xavier Fox
Date: 6 Apr. 2015
Purpose: Using sequential search to find the number entered
and using the bubble sort to sort the array before searching.
*/
#include "stdafx.h"
#include <iostream>
using namespace std;
const int listLength = 10;
void ... | ALGO | 0.999942 | 5.354855 |
751f9902-e5ad-47f8-af1d-2dec8eb11ef8 | aslanbekasylbekov/algorithms-and-data-structures | lab3/f.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int p; cin>>p;
int b[p];
for(int i=0;i<p;i++){
cin>>b[i];
}
for(int i=0;i<p;i++){
int sum=0,cnt=0;
for(int j=0;j<n;j++){
i... | ALGO | 0.99954 | 3.296884 |
ae07b2c1-f05d-4797-8502-257c969f1b6f | BlindWiz-1/parallel_tree_tensor_network | src/Circuits/SingleStateToTrees/SingleStateToTrees.cpp | #include "SingleStateToTrees.h"
#include "../../TTNCircuitSim/TNode/TNode.h"
#include "../../TTNCircuitSim/PseudoTNode/PseudoTNode.h"
#include "../../Structure/SNode/SNode.h"
#include <unsupported/Eigen/CXX11/Tensor>
#include <Eigen/Dense>
// Helper function: Converts Eigen::MatrixXcd to Eigen::Tensor
Eigen::Tensor<st... | ALGO | 0.984351 | 5.219876 |
60d34bcf-5e04-4355-a4a8-1d314534dbb8 | NoamLeshem/CPP_EX1_24 | Graph.cpp | #include "Graph.hpp"
namespace ariel {
Graph::Graph() { }
void Graph::cleanGraph(){
this->adjacencyMatrix.clear();
this->cycle.erase();
this->isDirected = false;
this->hasNegativeEdges = false;
this->hasNegativeCycle = false;
this->edges = 0;
this->c... | ALGO | 0.963377 | 5.387504 |
e50e935b-e7df-4967-b6a6-b179030fce3b | seo-bo/ProblemSolving | 백준/Platinum/32650. 익웜 바이러스/익웜 바이러스.cpp | #include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main(void)
{
cin.tie(0)->sync_with_stdio(0);
int n = 0, m = 0, k = 0;
cin >> n >> m >> k;
vector<int>parent(n + 1, 0), rank(n + 1, 0);
iota(parent.begin(), parent.end(), 0);
function<int(i... | ALGO | 0.999957 | 4.03933 |
33adae95-7c12-4d37-9492-4528231baec1 | ekamjit105/cpp_codes | factorial.cpp | #include<iostream>
using namespace std;
class factorial
{
int num,res;
public:
void input()
{
do
{cout<<"\nEnter a Number for factorial to be calculated: ";
cin>>num;
if(num<0)
cout<<"\nPlease enter a positive number";
}while(num<0);
int op;
do
{
cout<<"\nChoose method to calculate fact... | ALGO | 0.999003 | 4.322852 |
8e470459-1432-4ad7-a5e6-052e1d7ccddf | Pres1dent-01/Competitivecoding | CPP/CCISLAND.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int t;
cin >> t;
for (int i=0; i<t; i++){
int x, y, xr, yr, d;
float xf, yf, amin;
cin >> x >> y >> xr >> yr >> d;
xf = x/xr;
yf = y/yr;
amin = std::min(xf, yf);
if (ami... | ALGO | 0.999157 | 3.762862 |
497bf1e2-b5ad-40c0-8ae1-d8ec820e161b | fwdzh/cp_code | XCPC/Henan-Summer-2025/6/G.cpp | // #define YUANSHEN
#if defined(YUANSHEN)
#include "/home/skadi/codes/cp_code/template/debug.hpp"
#else
#include <bits/stdc++.h>
using namespace std;
#define dbg(...) 42
#endif
template <typename T1, typename T2>
void cmin(T1& x, const T2& y)
{
x = x < y ? x : y;
}
template <typename T1, typename T2>
void cmax(T1& ... | ALGO | 0.999942 | 5.185827 |
d77916e4-954d-4beb-9eee-69275a049a3c | dgcnz/competitive-programming | codeforces/1189A-keanu-reeves.cpp | #ifdef DBG_MACRO_NO_WARNING
#include <dbg.h>
#else
#define dbg(...) ((void)0)
#endif
#include <bits/stdc++.h>
#include <cplib/utils/io>
#define all(c) begin(c), end(c)
#define isz(c) (int)(c).size()
using namespace std;
using namespace cplib;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
in... | ALGO | 0.99985 | 3.711698 |
62960922-84c5-481f-b3e7-71b3a983b50c | Jonathan-Uy/CSES-Solutions | Geometry/Line Segment Intersection.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Point {
int x, y;
void read(){ scanf("%d %d", &x, &y); }
Point operator +(const Point& b) const { return Point{x+b.x, y+b.y}; }
Point operator -(const Point& b) const { return Point{x-b.x, y-b.y}; }
ll operator *(const Poin... | ALGO | 0.999857 | 4.039033 |
c5dfbac4-c2fe-4b60-ab9f-b6433327be63 | vadz/extrema | src/Functions/FCN_poica.cpp | #include "FCN_poica.h"
#include "UsefulFunctions.h"
#include "EExpressionError.h"
FCN_poica *FCN_poica::fcn_poica_ = 0;
void FCN_poica::ScalarEval( int j, std::vector<double> &rStack ) const
{
rStack[j] = UsefulFunctions::PoissonCharlierPolynomial( rStack[j],
... | TOOL | 0.981101 | 5.170618 |
0fe0097d-7652-4e18-a803-f4b0eae259b7 | ishandutta2007/codeforces | autumnkite/normal/1285/E.cpp | #include <bits/stdc++.h>
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
int T;
std::cin >> T;
while (T--) {
int n;
std::cin >> n;
std::vector<std::pair<int, int>> a(n);
for (int i = 0; i < n; ++i) {
std::cin >> a[i].first >> a[i].second;
}
std::sort(a.begin(), a.end());
st... | ALGO | 0.999976 | 5.00459 |
f4da9b66-e51b-43b0-9a21-4e2e5a77cb8d | tienit150198/ACM | Contest/ContestO8_Advance2/OL01_P04/main.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
string s, t;
void tinhLPS(string t, ll m, ll lps[]){
ll len = 0;
lps[len] = 0;
ll i = 1;
while(i < m){
if(t[len] == t[i]){
len++;
lps[i] = len;
i++;
}
else{
i... | ALGO | 0.999931 | 4.982339 |
1be03e9e-46a6-4c05-838d-ea7b639cceea | SkyHuBs/skyhub | src/swifttx.cpp |
#include "swifttx.h"
#include "activemasternode.h"
#include "base58.h"
#include "key.h"
#include "masternodeman.h"
#include "net.h"
#include "obfuscation.h"
#include "protocol.h"
#include "spork.h"
#include "sync.h"
#include "util.h"
#include <boost/lexical_cast.hpp>
using namespace std;
using namespace boost;
std:... | TOOL | 0.988586 | 6.056698 |
31bde69a-be4e-4624-abc1-5f58e402b0e0 | leo115129/AP1400-2_self | AP1400-2-HW2/src/crypto.cpp | #include "crypto.h"
RSA* crypto::createPrivateRSA(std::string key) {
RSA *rsa = NULL;
const char* c_string = key.c_str();
BIO * keybio = BIO_new_mem_buf((void*)c_string, -1);
if (keybio==NULL) {
return 0;
}
rsa = PEM_read_bio_RSAPrivateKey(keybio, &rsa,NULL, NULL);
return rsa;
}
RSA* crypto::creat... | TOOL | 0.974766 | 6.342701 |
233930cb-5c61-4bd5-ba19-36c89a8013c1 | onapte/algo-trails | easy/min-abs-diff-bst.cpp | #include <bits/stdc++.h>
using namespace std;
// T: O(n), S: O(1) + O(h) -> call stack
void solve(TreeNode *node, int &prev, int &ans)
{
if (node == nullptr)
return;
solve(node->left, prev, ans);
if (prev == -1)
prev = node->val;
else
{
ans = min(ans, abs(prev - node->val)... | ALGO | 0.999968 | 6.337042 |
330da5cc-c939-42fd-907d-70fb077dfcd6 | JoveH-H/VSLAM_note | 058/feature_training.cpp | #include "DBoW3/DBoW3.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <iostream>
#include <vector>
#include <string>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
// 读取图像
cout << "reading images... " ... | ALGO | 0.899372 | 4.544886 |
148e06e2-4f57-48e4-9c07-d131e2b63800 | ProjectMilk-AOSP/frameworks_av | media/module/codecs/amrwb/dec/src/highpass_400hz_at_12k8.cpp | /*
------------------------------------------------------------------------------
Filename: highpass_400Hz_at_12k8.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------------------------------------------------... | ALGO | 0.999957 | 6.016694 |
e047f008-e3a1-4ed7-b1f3-ce588918f6fb | sarvex/leetcode-zig | solution/1300-1399/1335.Minimum Difficulty of a Job Schedule/Solution.cpp | class Solution {
public:
int minDifficulty(vector<int>& jobDifficulty, int d) {
int n = jobDifficulty.size();
int f[n + 1][d + 1];
memset(f, 0x3f, sizeof(f));
f[0][0] = 0;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= d; ++j) {
int mx = 0;
... | ALGO | 0.999729 | 6.370376 |
f882d7f0-5ea4-48b1-a2b4-277181e7ed06 | euclio/llvm-gbz80 | lib/Transforms/Scalar/CorrelatedValuePropagation.cpp | #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LazyValueInfo.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Pass.h"
#include "llvm/Suppor... | TOOL | 0.942101 | 7.937078 |
4a23151c-2c08-43a0-bb46-60f41973a0bd | ishandutta2007/codeforces | iloveshokupanman/normal/1088/E.cpp | #ifndef ATCODER_INTERNAL_BITOP_HPP
#define ATCODER_INTERNAL_BITOP_HPP 1
#ifdef _MSC_VER
#include <intrin.h>
#include<cassert>
#endif
namespace atcoder {
namespace internal {
int ceil_pow2(int n) {
int x = 0;
while ((1U << x) < (unsigned int)(n)) x++;
return x;
}
... | ALGO | 0.996 | 3.079026 |
f6321d4f-2f98-4302-bdb3-3d55854dcf7f | thanhcong2k7/Code-DTTin-23-24 | adu/CP/Code/hsg9vp.contest.codeforces.com/Thi thử HSG lớp 9 năm học 2020 - 2021/a.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,a[200002];
cin >> n;
for (int i=1; i<=n; i++)
cin >> a[i];
sort(a+1,a+n+1);
int i=1,k=a[1],cnt=0;
while(i<=n)
{
i++;
if (k!=a[i]){
cnt++;
k=a[i];
}
}
cout << cnt;
... | ALGO | 0.999842 | 3.730317 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.