uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
504cd05e-0780-4843-9655-b4cef70cd2ad | camil0palacios/Competitive-programming | solutions/codeforce/Codeforces Round #436 (Div. 2)/E. Fire/solution.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define fori(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define fore(i,a,b) for(int i = a; i <= b; i++)
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define sz(v) (int) v.size()
#define mp make... | ALGO | 0.999968 | 3.761278 |
572b81e1-db77-4e4e-b1ab-883803930558 | SinhaAmrit/DSA-practice | _007_pattern.cpp | /* Sample Output 👇
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
*/
#include <iostream>
using namespace std;
int main()
{
int n, i, j, count;
i = 1;
cout << "Enter size: ";
cin >> n;
while (i <= n)
{
j = count = 1;
while (j <= i)
{
cout << coun... | ALGO | 0.999707 | 4.722417 |
e45398e4-5cd9-4e75-b07c-7c8359848ee3 | AbdelrahmanSobhy20/Animated-Tasks | 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 |
a7829ab0-d503-47ad-aa45-3e345db2212d | Qianhongbo/LeetCode | problems/402.remove-k-digits.cpp | /*
* @lc app=leetcode id=402 lang=cpp
*
* [402] Remove K Digits
*/
#include <string>
#include <stack>
using namespace std;
/*
The digit of the smallest number must be in ascending order
Two steps:
1. use stack to change the order to ascending order
2. if there are still some digit need to be removed, remove ... | ALGO | 0.999922 | 7.186086 |
70325bee-00fb-4b14-93bc-9127400d9574 | Musab89/C-Codes | Square root.cpp | #include<iostream>
#include <cmath>
using namespace std;
int main()
{
int a;
float s;
cout<<"enter any number"<<endl;
cin>>a;
s=sqrt(a);
cout<<" The square root of "<<a<< " is " <<s<<endl;
} | ALGO | 0.988828 | 3.017007 |
19a622ef-4c0e-490f-a2e5-6124fbbf9d07 | chenhuanguang/testCode | key-value搜索树/key-value搜索树/test.cpp | #include <iostream>
#include <time.h>
using namespace std;
template <class K, class V>
struct BNode
{
typedef BNode<K, V> Node;
K _key; //
V _value;
Node* _left;//
Node* _right;//Һ
BNode(const K& key, const V& value)
:_key(key)
,_value(value)
, _left(nullptr)
, _right(nullptr)
{}
};
template <class K,... | ALGO | 0.999577 | 4.24673 |
8b6e530d-5ea8-4cbc-978a-7937c9561829 | GaneshBhutekar/DSA | linked_list/14_delete_duplicate_map.cpp | // sort using map
#include<iostream>
#include<map>
using namespace std;
class Node{
public:
int data;
Node *next;
Node(int data){
this-> data=data;
this-> next=NULL;
}
~Node(){
}
};
void insertatHead(Node * &head,int data){
Node *temp = new Node(data);
temp->next=hea... | ALGO | 0.99993 | 4.832197 |
942fd548-b842-4b59-a539-e320a59ddc5e | CoderDream/java-architect-util | hello-algo/hello-algo-main/en/codes/cpp/chapter_backtracking/permutations_i.cpp | /**
* File: permutations_i.cpp
* Created Time: 2023-04-24
* Author: krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Backtracking algorithm: Permutation I */
void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &selected, vector<vector<int>> &res) {
// When the state length equals... | ALGO | 0.999987 | 6.205715 |
76abcd9e-0982-4a24-8ec0-03adf139440c | sagpant/nheqminer | nheqminer/zcash/Note.cpp | #include "Note.hpp"
#include "prf.h"
#include "crypto/sha256.h"
#include "version.h"
#include "streams.h"
#include "zcash/util.h"
namespace libzcash {
Note::Note() {
a_pk = random_uint256();
rho = random_uint256();
r = random_uint256();
value = 0;
}
uint256 Note::cm() const {
unsigned char disc... | TOOL | 0.933479 | 6.654643 |
bf0b1142-0451-4ced-a2b4-0d730ddfac0a | AllenAndrew01123/Competitve-Programming | Codeforces/Team.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
int count=0;
while(t--)
{
int a,b,c;
cin>>a>>b>>c;
if(a+b+c>=2)
count++;
}
cout<<count;
return 0;
} | ALGO | 0.999297 | 4.352734 |
9a8bd3ed-3f12-4b81-b1c2-ddd94e4d6847 | justinccu/Object-Oriented_Programming | OOP_HW3_409510089.cpp | #include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <climits>
#include <functional>
#include <iomanip>
#include <stack>
#include <algorithm>
using namespace std;
#define SET(func_name, type, var_name, _var_name) \
void func_name(type _var_name) { var_name = _var_name; }
#define GET(fun... | TOOL | 0.856778 | 3.796582 |
3f09b7e6-0a23-43d8-ba11-07119b53f350 | knh4735/Algorithm | Baekjoon/DisjointSet_1717_setExpression.cpp | // 1717 집합의표현 그래프1(disjoint-set)
#include <stdio.h>
int find(int set[], int q){
if(set[q] == q) return q;
return find(set, set[q]);
}
void u(int set[], int q, int w){
q = find(set, q);
w = find(set, w);
if(q > w) set[q] = w;
else set[w] = q;
}
int main(){
int set[1000001];
int n, m;
scanf("%d %d", &n, &m);... | ALGO | 0.999993 | 4.807202 |
3bc18a2d-81fa-4f76-b728-c8bff6e20a8b | apiscoding/ApnaGuidee | StudentGradeTracker.cpp | #include <iostream> // Include iostream for input/output
#include <vector> // Include vector for dynamic array management
#include <algorithm> // Include algorithm for sorting
#include <iomanip> // Include iomanip for formatting output
using namespace std;
// Define a structure to store student information ... | TOOL | 0.986874 | 5.113627 |
332e1747-1bcb-4d85-bf5d-893324f13bb4 | j-a-h-i-r/Online-Judge-Solutions | Uva/11507 - Bender B Rodriguez Problem.cpp | #include<iostream>
using namespace std;
struct node{
int a, b;
node(int _a, int _b)
{
}
};
int main()
{
string inputString;
int n;
while(cin>>n)
{
string inp;
if(n==0) break;
for(int i=0; i<n; i++)
{
cin>>inp;
if(inp=="+y")
... | ALGO | 0.993016 | 3.388159 |
9546e968-993d-4035-8ce1-15aa9b3ff217 | seqan/seqan | demos/tutorial/pattern_matching/find_index_multiple.cpp | //![includes]
#include <iostream>
#include <seqan/index.h>
using namespace seqan2;
//![includes]
//![initialization]
int main()
{
typedef StringSet<CharString> THaystacks;
THaystacks haystacks;
appendValue(haystacks, "tobeornottobe");
appendValue(haystacks, "thebeeonthecomb");
appendValue(haystack... | ALGO | 0.98291 | 6.308478 |
337a2aba-2d7e-4e44-af28-036d36299d99 | GaoGuangyong/LC | 牛客 华为/HJ8 合并表记录.cpp |
#include <iostream>
#include <map>
using namespace std;
int main() {
// 读入键值对个数 n
int n;
cin >> n;
// 定义一个有序哈希表,存索引及其数值的和
map<int, int> hash;
// 读入 n 对键值对
for (int i = 0; i < n; i ++ ) {
pair<int, int> x;
int index = x.first;
int value = x.second;
... | ALGO | 0.999785 | 4.373737 |
a5207cce-fbd8-4a8b-b651-890d1c93372e | Chandan18122/CPP | day8/exception_handling/try_catch.cpp | #include<iostream>
using namespace std;
int main(){
int a,b;
cout<<"Enter a ";
cin>>a;
cout<<"Enter b ";
cin>>b;
try{
if(b==0) throw 10;
int ans = a/b;
cout<<"division is "<<ans<<endl;
}
catch(int a){
cout<<"b should not be zero"<<endl;
}
cout<<"Have A nice day!!"<<endl;
}
| TOOL | 0.932165 | 3.609432 |
bee0f8a2-2c31-4d88-93a9-85a1fbec2ea3 | jsmile/getx_v463 | 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.998809 | 6.763549 |
cc0f1dc4-1069-4375-87e0-a7374e57fdd0 | MohamedHasnaoui/CSES-Problems-Solutions | GraphAlgorithms/13_FlightRoutes.cpp | /**
* بسم الله الرحمن الرحيم *
﴾ رَبِّ اشْرَحْ لِي صَدْرِي * وَيَسِّرْ لِي أَمْرِي * وَاحْلُلْ عُقْدَةً مِّن لِّسَانِي * يَفْقَهُوا قَوْلِي ﴿
**/
#include <bits/stdc++.h>
#define ll long long
#define fi(l, r) for(ll i=l;i<r;i++)
#define fj(l, r) for(ll j=l;j<r;j++)
#define fir(r, l) f... | ALGO | 0.999904 | 3.94422 |
7f3b39af-c990-4e74-84a7-5e944c0060a0 | abperez/Proxecto | GSEA/src/include/statistics.cpp | #include <vector>
template <class enrch_t, class index_t>
index_t pos_tail_count(const enrch_t * data,
const index_t length,
const enrch_t value) {
index_t counter = 0;
for (auto entry_ptr = data; entry_ptr != data+length; entry_ptr++)
if (*entry_ptr >= va... | ALGO | 0.997995 | 6.365996 |
c390d3ac-9027-411b-b6fb-7cd65ab2f3d0 | Beatrix-0/Competitive-Programming | Online Judge/UVA Problem/11388 - GCD LCM.cpp | #include<bits/stdc++.h>
using namespace std ;
#define int long long
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t ; cin>> t;
while ( t-- )
{
int x ,y ;
cin>> x >> y ;
if ( y % x == 0 )
{
cout << x << " " << y << '\n';
}
... | ALGO | 0.999472 | 4.766816 |
7ecd71fd-2dc5-4f59-ad8d-8b0cf0585bc5 | DorseyChen/Dorsey_Chen | OOP/Course01/1.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int max(char *[],int);
int min(char *[],int);
int main(int argc, char *argv[])
{
int ans;
if(strcmp(argv[1],"M")== 0)
ans=max(argv,argc);
if(strcmp(argv[1],"m")== 0)
ans=min(argv,argc);
printf("Result = %d\n",ans);
return 0;
}
int max(char *num[],int le... | ALGO | 0.992258 | 3.346919 |
61dc3075-6b20-4942-999e-42e81835a091 | Riteshk07/Data-structures-and-Algorithms | bitwise/H.cpp | #include <iostream>
using namespace std;
bool compMAX(&a, &b){
return a<b;
}
bool compMIN(&a, &b){
return a>b;
}
int main (){
int len =10;
int arr[10];
for (int k=0; k<len; k++){
cin>>arr[k];
}
int min;
int indes;
for(int i=0; i<len; i++){
min =INT_MAX;
for (int j=i; j<len; j++){
if(min>arr[j]){
... | ALGO | 0.999889 | 3.187854 |
42cd16d8-184a-4e69-9edc-3079e3c13161 | ishandutta2007/codeforces | tzxydby/normal/613/D.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=100005;
int n,m,q,fa[N][18],dep[N],dfn[N],c,a[N],st[N],t,fl[N],b[N],ans,xzh;
vector<int>e[N],g[N];
void dfs(int u,int f)
{
fa[u][0]=f,dep[u]=dep[f]+1,dfn[u]=++c;
for(auto v:e[u])
if(v!=f)
dfs(v,u);
}
int lca(int u,int v)
{
if(dep[u]<dep[v])
swap(u,v);
... | ALGO | 0.99984 | 4.238929 |
791ab493-f5ba-4430-9ca1-579829e5d469 | Akshay1810/PracticeCP | Codeforces/A/priority queue minimum.cpp | #include <bits/stdc++.h>
typedef long long ll;
#define F first
#define S second
#define pb push_back
#define pi pair<long long, long long>
#define vi vector<long long>
#define mp make_pair
#define endl "\n"
#define mod 1000000007b
#define loop(s, e) for (long long i = s; i < e; i++)
#define looprev(s, e) for (long long... | ALGO | 0.999411 | 4.273549 |
ae81582b-9d06-4bbd-a2df-a796de7b9e80 | Prathamesh-Patil-GitHub/practice-programs | PRO Leetcode/rotate-list/Accepted/4-26-2023, 11_07_41 AM/Solution.cpp | // https://leetcode.com/problems/rotate-list
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
clas... | ALGO | 0.999984 | 6.042014 |
109b7e44-a20e-49b3-a429-174f4afe2eb6 | SaMan-I/flutter_course | bmi_aaplication/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.998441 | 6.76073 |
f1a16749-c566-4ba2-9d75-92a4480da4f2 | jungh150/PS | baekjoon/15666.cpp | #include <iostream>
#include <vector>
#include <set>
using namespace std;
int n, m, as;
set<int> s;
vector<int> a;
vector<int> ans;
void dfs(int idx) {
if (idx == m) {
for (int x: ans) cout << x << ' ';
cout << '\n';
return;
}
for (int i = 0; i < as; i++) {
if (idx > 0 && a... | ALGO | 0.999951 | 4.31591 |
66282e49-ae2b-4a60-90f0-018bc53d41d7 | Charmve/CppMaster | 算法库/DataStructure/RedBlackTree.cpp | #define BLACK 1
#define RED 0
#include <iostream>
using namespace std;
class bst {
private:
struct Node {
int value;
bool color;
Node *leftTree, *rightTree, *parent;
Node() : value(0), color(RED), leftTree(NULL), rightTree(NULL), parent(NULL) { }
Node* grandparent() {
if (parent == NULL) {
return... | ALGO | 0.999353 | 4.620694 |
1910bcce-4619-48c9-82fd-ef73fa172c8d | MrSlavika/openfhe-development | src/binfhe/examples/boolean-multi-input.cpp | /*
Example for the FHEW scheme using the default bootstrapping method (GINX)
*/
#include "binfhecontext.h"
using namespace lbcrypto;
int main() {
// Sample Program: Step 1: Set CryptoContext
auto cc = BinFHEContext();
cc.GenerateBinFHEContext(STD128_4, GINX);
// Sample Program: Step 2: Key Gene... | ALGO | 0.981021 | 4.549478 |
18adbde2-07fe-47e3-a2c4-7f8dd2d0d56f | hhjeee/Baekjoon | 프로그래머스/2/42747. H-Index/H-Index.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> citations) {
sort(citations.begin(), citations.end());
int hindex=0;
for(int i=0; i<citations.size(); i++) {
if(citations[i] >= citations.size()-i){
hindex = citations.size()-i;
... | ALGO | 0.999886 | 5.966259 |
7120958a-196c-4896-9c28-61e9d31a5d6e | eecrazy/ACM | 模板/数学/上交数论.cpp | //上交数论算法
//1. Greatest Common Divisor最大公约数
int GCD(int x, int y)
{
int t;
while(y > 0)
{
t = x % y;
x = y;
y = t;
}
return x;
}
//2. Prime素数判断
bool is_prime(int u)
{
if(u == 0 || u == 1) return false;
if(u == 2) return true;
if(u%2 == 0) return fal... | ALGO | 0.999656 | 3.84669 |
b3e9bc8f-50ba-4573-92f0-1cc198a525c7 | sagaian/barcodeDecoder | code39.cpp | #include "code39.h"
const char Code39::Characters[CHARACTERS] = {'0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F',
'G','H','I','J','K','L','M','N',
'O','P','Q','R','S',... | ALGO | 0.995776 | 4.921659 |
9fc98cba-8833-427f-a4b9-56c4c4024c2d | Dd0-s/Courses | CS_Center_C++(continuation)/3.5.14.cpp | #include <algorithm>
#include <vector>
template<class Iterator>
size_t count_permutations(Iterator p, Iterator q)
{
using T = typename std::iterator_traits<Iterator>::value_type;
if (p == q)
return 1;
std::vector<T> v(p,q);
std::sort(v.begin(), v.end());
size_t count = 0;
do{
if... | ALGO | 0.99652 | 4.917273 |
8ffa36c3-4eb6-42a6-b2da-4391d4338957 | Adwait47s/SE-LABS | DSAL/circularQueue.cpp | /*
Problem Statement
Implement Circular Queue using Array. Perform following operations on it.
a) Insertion (Enqueue)
b) Deletion (Dequeue)
c) Display
*/
#include <iostream>
using namespace std;
const int maxx=10;
class queuee{ // creating a class queue
private:
... | ALGO | 0.997665 | 5.408457 |
e39842f7-d7f9-451b-a313-1974b1878b7b | LeeChanHyuk/Algorithm | C++/0x04_Linked_list/linked_list.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
// 야매 링크드 리스트 ㅎㅎ
const int MX=1000005;
int dat[MX], pre[MX], nxt[MX];
int unused = 1;
void insert(int addr, int num)
{
int cur=nxt[0];
int prev=nxt[0];
while(cur!=-1)
{
prev = cur;
cur ... | ALGO | 0.999518 | 4.062978 |
f599574e-3d69-4368-b056-34bacdaa0fb2 | rafsan99/Problem-Solving | Sale.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,i,sum=0;
cin>>n>>m;
int a[n];
for(i=0;i<n;i++){
cin>>a[i];
}
sort(a, a+n);
for(i=0;i<m;i++){
if(a[i]<=0){
sum=sum+(a[i]*(-1));}
else{break;}
}
cout<<sum;
}
| ALGO | 0.999981 | 3.603535 |
da2874fc-263f-4fdf-a2a8-c48a111cff54 | YashKumarYK/LeetCode | 1559-detect-cycles-in-2d-grid/1559-detect-cycles-in-2d-grid.cpp | class Solution {
public:
int nx[4] = {0,0,-1,1};
int ny[4] = {-1,1,0,0};
bool dfs(int i,int j, vector<vector<int>> &vis, vector<vector<char>> &grid, int x, int y, int r,int c, char element){
if( i<0||j<0||i>=r||j>=c || grid[i][j]!=element) return false;
if( vis[i][j]==1) r... | ALGO | 0.999973 | 6.080432 |
d5ac0155-a035-4b0e-a544-88130aa0f6f8 | Saleh7127/CPP-solution-by-Fellow_junior | Codeforces/cf1353A.cpp | #include <bits/stdc++.h>
using namespace std;
#define test int t; cin>>t; while (t--)
#define ll long long int
#define sc(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)
int main()
{
ll a,c,d,e,f,i,j,k,l,n,m;
test
{
cin>>n>>m;
if(n==1) cout<<0<<endl;
else if(n==2) cout<<m<<en... | ALGO | 0.999845 | 3.008154 |
6b4ab8e0-8ca5-4444-8140-80d18a6697d6 | Bungmint/competitiveprogramming | contest/codeforces/653/653A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0), cin.tie(0);
int n;
cin >> n;
vector<int> balls(n);
unordered_set<int> b;
b.reserve(1024);
b.max_load_factor(0.25);
for (int i = 0; i < n; i++)
{
cin >> balls[i];
b.insert(balls[... | ALGO | 0.999967 | 3.991904 |
4034f9f3-8373-44b4-90cf-8fead3772026 | sachin-raghuwanshi/Codeforces1872 | 18720.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int mod = 1000000007;
int main()
{
int t; cin >> t;
while(t --) {
int a, b, c; cin >> a >> b >> c;
int req = (abs(a - b) + 1) / 2;
int ans = (req + c - 1) / c;
cout << ans << endl;
}
} | ALGO | 0.999651 | 4.125242 |
30f24ff9-5a6f-4b22-99b1-10bc03354c58 | ViktorMaksimoski/competitive | cses/graph algorithms/Building_Teams.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using ll = long long;
using ull = unsigned long long;
const int mod = 1e9 + 7;
const int LOG = 20;
using namespace std;
using namespace __gnu_pbds;
template <class T>
using Tree =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_updat... | ALGO | 0.999985 | 4.387383 |
7677b750-6cba-4733-b06d-d85f6f79b27b | kyonRay/Coding | personal_collection/writing_test/tencent_1.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <map>
#include <algorithm>
#include <string>
#include <limits.h>
using namespace std;
int main(int argc, char const *argv[])
{
int t;
cin >> t;
int n;
string s;
... | ALGO | 0.999041 | 4.472025 |
83627088-fbd2-4b26-93c9-33ac8c316bcd | luhsra/melf-linker | src/llvm/lib/CodeGen/MachineCSE.cpp | #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/ScopedHashTable.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#inc... | ALGO | 0.998809 | 6.532465 |
5884274a-3e2a-4163-98b2-78bc78b180b3 | MiChuan/Leetcode | LCCI/lcci0412 求和路径(递归)/res.cpp | class Solution {
public:
int res=0;
int pathSum(TreeNode* root, int sum) {
if(!root)return 0;
dfs(root,sum);
pathSum(root->left,sum);
pathSum(root->right,sum);
return res;
}
void dfs(TreeNode* root,int sum)
{
if(!root)return;
if(root->val==sum... | ALGO | 0.999977 | 5.948515 |
c0ef6837-8c8a-453e-adab-aa7a77891a2a | ghugesachin0806/Data_Structure_n_Algorithm | 01_STL/14_vectors_01.cpp | #include <bits/stdc++.h>
using namespace std;
// vectors can be globally defined upto 10^7 and locally upto 10^5
void print_vector(vector<int> m) // here datatype given in vector '<>' brackets for vectors
{
cout << "size of vector - " << m.size() << endl;
for (int i = 0; i < m.size(); i++)
{
cout <... | ALGO | 0.903382 | 4.124956 |
f584b8c7-7039-48c6-af87-b5edfb63aca0 | Yuki-Inoue/programming_contest | POJ/1200_Crazy_Search.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
string found;
long char_to_int(char c){
string::size_type pos = found.find(c);
if (pos == string::npos) {
found.push_back(c);
return found.size() - 1;
}
return pos;
}
int main(){
int N,NC;
cin >> N >... | ALGO | 0.99929 | 3.369913 |
1ce8efdb-c78e-44f5-9502-a511841dc7ae | Masud-Abdullah/Online-Judges | Problem_Solving_on_Codeforces_OLD/617A.Elephant.cpp | #include<iostream>
using namespace std;
int main()
{
int x;
scanf("%d",&x);
if(x%5==0)cout<<x/5<<endl;
else cout<<(x/5)+1<<endl;
return 0;
}
| ALGO | 0.999698 | 3.267851 |
8a2f6653-57c1-4381-8e4b-c7063ea68035 | ishandutta2007/codeforces | avinashkartik/normal/1562/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define GODSPEED ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define f first
#define s second
#define newl cout<<"\n";
#define pb push_back
#define mset(a,x) memset(a,x... | ALGO | 0.999625 | 3.069479 |
82c3fabb-7a54-4ac8-ae52-ee7096ed8ff0 | abelxmendoza/FibonacciProblem-and-LargestSumSubArrayProblem | fib_exhaustive.cpp | #include <iostream>
// Recursive function to calculate the nth Fibonacci number (exhaustive pattern)
int fibonacci(int n) {
if (n <= 1)
return n;
else
return fibonacci(n-1) + fibonacci(n-2);
}
int main() {
// Using the Exhaustive Pattern
int fib_15 = fibonacci(15);
std::cout << "15... | ALGO | 0.999765 | 7.67428 |
1a0b05e7-06f1-4e4a-b795-61861174d368 | HongYD/DataStructureAndAlgorithms | DepthFisrtSearchExample3/Source.cpp | #include<stdio.h>
int n, m, p, q, min = 9999999;
int a[51][51], book[51][51];
void dfs(int x, int y, int step)
{
int next[4][2] = { {0,1},{1,0},{0,-1},{-1,0} };
int tx, ty, k;
if (x == p&&y == q)
{
if (step < min)
min = step;
return;
}
for (k = 0; k <= 3; k++) {
tx = x + next[k][0];
ty = y + next[k][1]... | ALGO | 0.999774 | 3.53237 |
561bc6a8-5a41-4511-9e46-6bd3e58132f7 | acc-cosc-1337-spring-2021/acc-cosc-1337-spring-2021-Mark-Walsh-School-1 | src/classwork/05_assign/main.cpp | //write include statements
#include<string>
#include<iostream>
#include "sequence.h"
//write using statements for cin cout
/*
Write code to create a vector of string names, add the values "John", "Mary", "Patty",
"Sam" to the vector, call the function display_vector and pass the names vector as
an argument, prompt us... | ALGO | 0.92095 | 4.941926 |
090aca7f-2af1-4609-8b21-19c087a8c12a | OmkarBhostekar/leetcode | 1008-construct-binary-search-tree-from-preorder-traversal/1008-construct-binary-search-tree-from-preorder-traversal.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.999993 | 6.192433 |
b7dd4576-3476-4a4f-b20a-c8bb7dfb181d | qsnake/trilinos | packages/Sundance/src-core/InternalExprs/SundanceEvaluatableExpr.cpp | /* @HEADER@ */
/* @HEADER@ */
#include "SundanceEvaluatableExpr.hpp"
#include "SundanceEvaluatorFactory.hpp"
#include "SundanceEvaluator.hpp"
#include "SundanceNullEvaluator.hpp"
#include "SundanceEvalManager.hpp"
#include "SundanceSymbolicFuncElement.hpp"
#include "SundanceExpr.hpp"
#include "SundanceTabs.hpp"
#inclu... | ALGO | 0.868396 | 7.755505 |
54fc7358-d6c5-40c3-9622-6489dbdce1bb | raincross7/code-similarity | codes/train_code/problem038/problem038_65.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i... | ALGO | 0.999932 | 3.75017 |
fb815ef8-5130-43d4-9d04-cfa18dc203a5 | RameshtaVishwakarma/Data-Structures-and-Algorithms | Bit Manipulation/Find First Set Bit.cpp | /*Given an integer an N. The task is to return the position of first set bit found from the right side in the binary representation of the number.
Note: If there is no set bit in the integer N, then return 0 from the function.
Example 1:
Input: N = 18
Output: 2
Explanation: Binary representation of
18 is 010010,the f... | ALGO | 0.999945 | 5.751482 |
4b8aef1a-1001-4e05-b558-c0bc4521794f | Prem-Ray/GFG160 | Array/14_Implement_Atoi.cpp | #include<bits\stdc++.h>
using namespace std ;
class Solution {
public:
int myAtoi(char *s) {
// Your code here
int i=0 ;
while(s[i] == ' ') {
i++ ;
}
int sign = 1 ;
if(s[i] == '+' || s[i] == '-'){
... | ALGO | 0.991881 | 4.655384 |
0d2f7763-b4eb-4cd6-a70a-8817c54692bc | 23f2002007/leetcode | solution/0200-0299/0297.Serialize and Deserialize Binary Tree/Solution.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 Codec {
public:
// Encodes a tree to a single string.
string serialize(TreeNode* root) {
if (!root) {
... | ALGO | 0.999789 | 6.693848 |
3ad6e31f-725b-4ee7-a885-489c7e26cc4e | ishandutta2007/codeforces | gs18115/normal/1434/D.cpp | #include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
co... | ALGO | 0.999979 | 4.778423 |
5cf66e6e-479e-426e-8191-b2ebc832d0a1 | mizzpika/mizzpika_library-WIP- | graph/bellman_ford.cpp | //bellman_ford
struct bellman_ford{
vector<ll> dist;
vector<ll> prev;
ll start;
ll size;
bool cl = false;
//bellman_fordを構築
bellman_ford(Graph &g, ll s){
start = s;
ll n = g.size();
size = n;
dist.assign(n, 1LL << 60);
prev.assign(n, -1);
vect... | ALGO | 0.99907 | 4.478799 |
8f4469ec-16a9-4f94-bda5-3f54ef21aae4 | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/sate/bfs_lee/test/e779c15a-40ac-11ec-939b-dc7196033e92.cpp | #include <iostream>
#include <fstream>
using namespace std;
ifstream in ("sate.in");
ofstream out ("sate.out");
const int N=30000;
const int M=100024;
int lst[N+1],nr,urm[2*M+1],dist[2*M+1],vf[2*M+1],d[N+1],q[N+1],fin,n;
bool viz[N+1];
void adauga (int a, int b, int l)
{
vf[++nr]=b;
urm[nr]=lst[a];
... | ALGO | 0.999703 | 3.801826 |
15a162cc-1397-4e1f-bb89-82740901b628 | salilab/imp | modules/isd/src/AtomicCrossLinkMSRestraint.cpp | #include <IMP/isd/AtomicCrossLinkMSRestraint.h>
#include <IMP/algebra/VectorD.h>
#include <IMP/core/XYZ.h>
#include <IMP/isd/Scale.h>
#include <boost/math/special_functions/erf.hpp>
#include <cmath>
IMPISD_BEGIN_NAMESPACE
namespace {
const Float sq2=1.4142135623730951;
const Float sqPi=1.7724538509055159;
const... | ALGO | 0.992262 | 5.954744 |
cb1df524-c3b6-4a86-ad0c-bb21d60874b9 | ayushD123/LeetCode | Introduction to Linked List - GFG/introduction-to-linked-list.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* next;
// Default constructor
Node()
{
data = 0;
next = NULL;
}
// Parameterised Constructor
Node(int data)
{
this->dat... | ALGO | 0.999838 | 6.304493 |
e6c59a1c-e342-4af6-baff-ec80fb51c382 | smv1796/C-Programs-for-practice | TRAI codechef.cpp | #include<iostream>
#include<vector>
#include<set>
using namespace std;
bool checkValidity(int a, int b, int c)
{
if (a + b <= c || a + c <= b || b + c <= a)
return false;
else
return true;
}
int threeSum(vector<int>& A) {
vector<vector<int>> ans;
int n=A.size();
if(n<... | ALGO | 0.998619 | 4.438542 |
925e5243-2eb7-40e4-b579-3467d0011877 | Sid200026/Misc-Programs | Competitive/May Challenge 2019 Division 2 » Reduce to One.cpp | #include<iostream>
using namespace std;
int main()
{
int num_of_cases;
cin>>num_of_cases;
long int new_max_value;
long int copy;
for(int i=0;i<num_of_cases;i++)
{
cin>>new_max_value;
copy=new_max_value;
for(int j=1;j<=new_max_value;j++)
{
if(j==copy)
... | ALGO | 0.999891 | 3.7196 |
3809c7b1-abf3-47db-b8a6-f4057de42ace | shobhitjawa/dsAlgos | searchalgorithms/countones.cpp | #include<stdio.h>
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int countone(int arr[],int low,int high)
{
int mid;
if(high>low)
{
mid=low+(high-low)/2;
if((mid==high||arr[mid+1]==0)&&(arr[mid]==1))
return mid+1;
if(arr[mid]==0)
return countone(arr,(low),(mid-1));
return countone(ar... | ALGO | 0.999927 | 4.544202 |
89e4efac-7b4a-4f4d-b8e7-8cb101832d89 | lutzthies/HCPtoSAT | pblib/encoder/SWC.cpp | #include "SWC.h"
using namespace PBLib;
using namespace std;
void SWC_Encoder::encode(const SimplePBConstraint& pbconstraint, ClauseDatabase& formula, AuxVarManager& auxvars)
{
if (config->print_used_encodings)
cout << "c encode with SWC" << endl;
encode_intern(pbconstraint, formula, auxvars);
}
void SWC_... | ALGO | 0.999102 | 5.867244 |
0c3db133-706d-43dc-a9c4-1e87d25bea3d | Doubletake27/CSCI1320 | CSCI 2270/Datastructure Lecture Notes/bstRangeTemplate.cpp | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdbool.h>
#include <iostream>
using namespace std;
struct TreeNode{
char key;
TreeNode *left;
TreeNode *right;
TreeNode *parent;
};
//SLL node Struct
struct Node{
char key;
Node *next;
};
Node *head = NULL;
void ra... | ALGO | 0.999761 | 4.145624 |
674627dc-3ee2-4cc5-a496-ef0a5352ed9a | LuJianBuPing/LeetCode | LeetCode/P005.cpp | #include<string>
#include<iostream>
using namespace std;
class Solution {
public:
string longestPalindrome(string s) {
int maxLen = 0, maxStart = 0;
for (int i = 0; i < s.length(); ++i)
{
int left = i, right = i;
while (left >= 0 && right < s.length() && s[left] == s[right])
{
if (right - left + 1... | ALGO | 0.998973 | 3.98441 |
a4e621da-5c12-43a9-a0ce-4cf06e55ed1b | ebrahimgamdiwala/DataStructuresandAlgortihms | DSA problems/Leetcode/503. Next Greater Element II/code.cpp | // Required for input/output operations, like printing to the console.
#include <iostream>
// Required for using the stack data structure.
#include <stack>
// Required for using the vector (dynamic array) data structure.
#include <vector>
using namespace std;
/**
* @brief Finds the next greater element for each elem... | ALGO | 0.99999 | 7.344923 |
d2403e7f-5a55-4e89-a71b-21a6464179de | mew177/cpp-practice | leetcode/055 - Jump Game/055 - Jump Game/main.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
class Solution {
public:
bool canJump(vector<int>& nums) {
int furthest = 0;
for (int i = 0; i < nums.size(); i++) {
if (i <= furthest) {
furthest = max(furthest, i+nums[i]);
... | ALGO | 0.999979 | 6.36586 |
e23f75c5-2ee1-491d-8017-d0826536d480 | ValveSoftware/eigen | bench/geometry.cpp |
#include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace std;
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 8
#endif
typedef SCALAR Scalar;
typedef NumTraits<Scalar>::Real RealScalar;
typedef Matrix<RealScalar,Dynamic,Dynamic> A;
type... | ALGO | 0.977165 | 5.941781 |
dc9ca152-4f5d-452b-b800-7b06bb958fae | sangyx/algorithm | leetcode/Dynamic Programming/Coin Change.cpp | class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
if(amount == 0) return 0;
vector<int> dp(amount+1, amount+1);
dp[0] = 0;
for(int i = 1; i <= amount; ++i)
for(int j = 0; j < coins.size(); ++j)
if(coins[j] <= i)
... | ALGO | 0.999939 | 5.869983 |
58da70e3-41bd-43ea-98f7-c41875b0e95a | RajdeepRao/ParallelComputing | Assignment5/dynamic_sched.cpp | #include <iostream>
#include <mpi.h>
#include <stdlib.h>
#include <chrono>
#include <math.h>
#include <limits>
using namespace std;
#ifdef __cplusplus
extern "C" {
#endif
float f1(float x, int intensity);
float f2(float x, int intensity);
float f3(float x, int intensity);
float f4(float x, int intensity);
#ifdef __... | ALGO | 0.999764 | 3.968329 |
11bfc97f-9ec1-4a98-94fd-128b8c2c0ed7 | NikhilRaj-25/Owl-Coder | Merge 2 sorted linked list in reverse order.cpp | //GFG
Node *n=NULL,*p=NULL,*t1=node1,*t2=node2,*ans=NULL,*temp=NULL;
if(t1==NULL && t2==NULL) return NULL;
else if(t1==NULL) ans=t2;
else if(t2==NULL) ans=t1;
else{
while(t1!=NULL && t2!=NULL){
temp=t1;
if(t1->data <=t2->data){
p=t1;
t1=t1->next;
}
else{
... | ALGO | 0.99999 | 3.828085 |
483f395a-e0a1-4411-8a5a-e5165fbe70e3 | Danendra10/ThesisPrototype | src/main.cpp | #include <simple_example/main.hpp>
int main()
{
namedWindow("Parameters", WINDOW_AUTOSIZE);
createTrackbar("Step Size", "Parameters", &stepSize, 100, OnUpdate);
createTrackbar("Max Velocity", "Parameters", &maxVel, 200, OnUpdate);
createTrackbar("Kattr", "Parameters", &Kattr, 1000, OnUpdate);
creat... | TOOL | 0.956865 | 5.047765 |
959ef841-ecd1-4995-8671-a55312dde8af | sleeg00/algorithm | 2941/main.cpp | /*
#include <algorithm>
#include <iostream>
#include <unordered_map>
using namespace std;
// 1초, 128MB
// 크로아티아 알파벳
// 몇 개의 크로아티아 알파벳으로 이루어져 있는지 출력
// 100글자의 단아
unordered_map<string, int> m;
int main(void) {
cin.tie(NULL);
cout.tie(NULL);
ios_base::sync_with_stdio(false);
m.insert({"c=", 1});
m.i... | ALGO | 0.998949 | 3.835436 |
0688333f-e927-465e-9d3b-c18f158fe303 | Anvesh-Chennupati/DsAlgo | Misc/sortedMatrixTwoSum.cpp | #include<iostream>
#include<vector>
#include<unordered_map>
using namespace std;
vector<vector<int>> searchMatrixModified(vector<vector<int>> matrix, int target) {
if(matrix.size() == 0 || matrix[0].size() == 0) return matrix;
//Start at top right and bottom left
int row = matrix.size()-1, col = matr... | ALGO | 0.999943 | 4.89347 |
c11f4620-35d6-422d-992e-5705477011fe | rakibulhasan-swe/mastering-DSA | LinkedList/doubly_linkedList.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* nxt;
Node* prv;
};
class DoublyLinkedList{
public:
Node* head;
int sz;
DoublyLinkedList(){
head = NULL;
sz = 0;
}
// create Node
Node* createNode(int value){
sz++;
Nod... | ALGO | 0.995355 | 4.308725 |
e90b559a-9135-424c-ad56-20d4c1b5be98 | lijiaxin-dut/leetcode | leetcode_train/Solution_440.cpp | //Given integers n and k, find the lexicographically k - th smallest integer in the range from 1 to n.
//
//Note: 1 k n 109.
//
// Example :
//
// Input :
// n : 13 k : 2
//
// Output :
// 10
//
// Explanation :
// The lexicographical order is[1, 10, 11, 12, 13, 2, 3, 4, 5, 6, 7, 8, 9], so the second smallest numb... | ALGO | 0.999911 | 5.158391 |
526df73b-f39d-4d13-9798-97bddf611050 | Mantraraj8472/StriverSdeSheetCodes | Greedy_Algorithm/Fractional_Knapsack.cpp | // problem link:
// https://www.codingninjas.com/codestudio/problems/fractional-knapsack_975286?topList=striver-sde-sheet-problems&leftPanelTab=0
#include <bits/stdc++.h>
double maximumValue (vector<pair<int, int>>& items, int n, int w)
{
vector<pair<double, int>> fractions(n, {0.0, 0});
for(int i = 0; i < n;... | ALGO | 0.999984 | 5.279373 |
e5409461-61f8-4c19-a34c-bb5c446d2c44 | koparasy/openmp-rr | libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp | // <random>
// template<class RealType = double>
// class student_t_distribution
// template<class _URNG> result_type operator()(_URNG& g);
#include <random>
#include <cassert>
#include <vector>
#include <numeric>
#include "test_macros.h"
template <class T>
inline
T
sqr(T x)
{
return x * x;
}
int main(int, ch... | TEST | 0.865384 | 4.546034 |
2ef19412-385d-45de-af42-a74c20b5c3b7 | Anup050/DSA | 2876-number-of-employees-who-met-the-target/2876-number-of-employees-who-met-the-target.cpp | class Solution {
public:
int numberOfEmployeesWhoMetTarget(vector<int>& hours, int target) {
int count = 0;
for(int i : hours){
if(i>=target){
count++;
}
}
return count;
}
}; | ALGO | 0.999934 | 6.170866 |
cdb63bcd-9bb3-42e6-a99e-86c070fed748 | ChetanThorat18/LeetCode | Leetcode_Problems/0153-find-minimum-in-rotated-sorted-array/0153-find-minimum-in-rotated-sorted-array.cpp | class Solution {
public:
int findMin(vector<int>& nums) {
int left = 0,right = nums.size()-1;
// condition is not left <= right beacuse it will remain in loop since right is updated to right=mid
while(left < right){
int mid = left + (right-left)/2 ;
// If value at m... | ALGO | 0.999993 | 5.913693 |
a98f7157-9acc-4e7a-96e3-e54dedf5451e | swapnil159/My-CP-Submissions | Educational_Rounds/68/A.cpp | /* winners never quit and quitters never win.
#swap */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#pragma GCC optimize ("-O3")
#define mod 1000000007
#define inf 1000000000000000000
#define rk 256
#define pb push_back
#define mp ... | ALGO | 0.997869 | 3.600434 |
21b33f0e-ff93-4f74-bded-bfd628c3cb65 | ashokbob9989/Summer_Learnings2k23 | word_break.cpp | #include<bits/stdc++.h>
using namespace std;
/*The most basic approach to solve this problem is to simply use recursion and backtracking. The key idea is to check every possible prefix of the given string in the dictionary of words. If the prefix is found in the dictionary of words, run the recursive function for the ... | ALGO | 0.999934 | 5.506951 |
601a04bd-4426-44d3-b514-d922746e38bb | dennisfInf/test_repo | src/crypto/bookkeeping_proofs/u_reg/prover.cpp |
#include "crypto/proofs/prelude.hpp"
#include "crypto/schemes/tots/scheme.h"
#include "crypto/bookkeeping_proofs/u_reg/prover.h"
namespace GS
{
using namespace std;
using namespace BilinearGroup;
namespace u_reg
{
bool consistency_check_e01(GS_Input const &input)
{
auto lhs =
input.pk... | ALGO | 0.997497 | 5.467054 |
8cc0df0d-de92-4444-8309-537e719a5d4d | raghavjajodia/Competitive-programming | spoj/scpc11d.cpp | #include<stdio.h>
int main()
{long long a,b,c,temp;
scanf("%lld %lld %lld",&a,&b,&c);
while(true)
{
if(a==0 && b==0 && c==0)
break;
if(b<a)
{
temp=a;
a=b;
b=temp;
}
if(c<b)
{
temp=b;
b=c;
c=temp;
}
if(c*c==a*a+b*b)
printf(... | ALGO | 0.999853 | 3.354414 |
3b207b80-3666-442f-8fc8-4ca46ced4185 | TingHui-Luo/Pat | 并查集/1107.cpp | #include <iostream>
#include <map>
#include <set>
#include <vector>
#include <math.h>
#include <queue>
#include <algorithm>
using namespace std;
inline int read(){
int x = 0,y = 1;char c = getchar();
while(c>'9'||c<'0') {if(c == '-') y = -1; c= getchar();}
while(c>='0'&&c<='9') {x = x*10 + c-'0'; c= getcha... | ALGO | 0.999759 | 3.544085 |
fb800935-8f48-4579-9ed3-947aec303aa9 | mdfaisal001/MasterDSA | 2707-merge-two-2d-arrays-by-summing-values/2707-merge-two-2d-arrays-by-summing-values.cpp | class Solution {
public:
vector<vector<int>> mergeArrays(vector<vector<int>>& nums1, vector<vector<int>>& nums2) {
map<int,int> map;
for(auto val : nums1){
int key = val[0];
int value = val[1];
map[key] = value;
}
for(auto id : nums2){
... | ALGO | 0.999945 | 5.657386 |
dd112382-46c7-4035-ba2c-cca13c75ef1f | Kartik-153/Solutions | LeetCode/ReorganizeString.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
string reorganizeString(string s) {
unordered_map<char, int> count_map;
for(char c : s) {
count_map[c]+=1;
}
priority_queue<pair<int, char>> maxHeap;
for(const auto& entry: count_map) {
... | ALGO | 0.999995 | 5.855253 |
6e478757-fe04-4a50-9699-621b6a80edf4 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/july/lis_20200710165403.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> d;
int ans, n;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int x;
scanf("%d", &x);
vector<int>::iterator it = upper_bound(d.begin(), d.end(), x);
if (it == d.end()) d.push_back(x);
else *it = x;
... | ALGO | 0.999959 | 4.187728 |
edc20707-c7ec-426b-9234-d37b3efe2cdd | Ragdha-Elgaidi/Algorithms-Problem-Solving-Level-1-Solutions | #39#IsPrimeNumber.cpp | #include <iostream>
#include <string>
using namespace std;
enum enPrimeNumber { Prime=1,NotPrime=2};
float ReadPositiveNumber(string message)
{
float Number = 0;
do
{
cout << message<<"\n";
cin >> Number;
} while (Number<=0);
return Number;
}
enPrimeNumber CheckPrimeNumber(int Number)
{
int M = round(Numb... | ALGO | 0.997204 | 3.588725 |
2c036587-62ca-496d-aade-08347c378eb7 | raincross7/code-similarity | codes/train_code/problem092/problem092_495.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using P = pair <int, int>;
int main() {
int a, b, c; cin >> a >> b >> c;
if (a == b) cout << c << endl;
else if (b == c) cout << a << endl;
else cout << b << endl;
} | ALGO | 0.999948 | 4.210173 |
6c7b51a8-a054-4f4b-984b-bebd06cfe09a | ranjeetkumarmrj2005/LeetCode | math/sum-of-square-numbers.cpp | class Solution {
public:
bool isperfectsquare(int n){
int root=sqrt(n);
if(root*root==n) return true;
else return false;
}
bool judgeSquareSum(int c) {
int x=0;
int y=c;
while(x<=y){
if(isperfectsquare(x)&&isperfectsquare(y)) return true;
else if(!isperfec... | ALGO | 0.999959 | 5.504158 |
5541be8c-a0ef-4020-af93-dc96310c3468 | Lydxn/Competitive-Programming | COCI/2006/C1/P5.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 20;
int bond[MAXN][MAXN];
double dp[1 << MAXN];
int main()
{
cin.sync_with_stdio(0);
cin.tie(0);
int N;
cin >> N;
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
... | ALGO | 0.999909 | 4.124335 |
7c418d14-ac4e-4467-ba19-4a8a78ecae17 | simonmandlik/Competitive-programming-solutions | Uva/11718.cpp | #include <bits/stdc++.h>
using namespace std;
#define EPS (1e-10)
#define DEBUG(x) cout << "> " << #x << ": " << x << endl;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define BE(c) c.begin(), c.end()
#define... | ALGO | 0.999649 | 3.948796 |
2732ba91-f960-492f-b802-0e6e4fc0a945 | Gaolious/algorithm | Baekjoon/002000_002999/2974/main.cpp | #include <bits/stdc++.h>
#define fastio do {ios_base::sync_with_stdio(false); cin.tie(NULL);} while (false);
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
#define CEIL(a, b) ( ( (a)+(b)-1)/(b) )
#define FLOOR(a, b) ( (a)/(b) )
ll D[18][31][31][31][31];
int primes[][4] = {
... | ALGO | 0.999729 | 4.850885 |
e2b90937-edb2-4bae-aedf-b3cbede88eef | ishandutta2007/codeforces | ae04071/normal/786/A.cpp | #include <stdio.h>
#include <algorithm>
#include <queue>
#include <cstring>
#include <utility>
typedef std::pair<int, int> ip;
int n, k[2], arr[2][7000];
int deg[2][7000], cache[2][7000];
int main() {
scanf("%d",&n);
for(int i=0;i<2;i++) {
scanf("%d",k+i);
for(int j=0;j<k[i];j++)
scanf("%d",&arr[i][j]);
}
... | ALGO | 0.999933 | 3.072221 |
01efad35-1700-4072-a752-52071ec0e73a | ashutoshshandilya7973/CAP770 | factorialrecursion.cpp | //factorial using recursion
#include<iostream>
using namespace std;
int factorial(long n){
if (n==1){
return 1;
}
return n*factorial(n-1);
}
int main(){
long n;
cin>>n;
long x=factorial(n);
cout<<"Factorial of given number is:"<<x;
} | ALGO | 0.999909 | 4.522327 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.