uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d019528d-0ad1-43b6-a56f-c96ccf768de4 | sunruoshi/Luogu-Codes | [OI]/P2726-[SHOI2005]-树的双中心.cpp | #include <iostream>
#include <vector>
using namespace std;
const int N = 5e4 + 1, INF = 0x3f3f3f3f;
int n, w[N], fa[N], siz[N], f[N], depth[N], son[N][2], cut, ans = INF;
vector<int> adj[N];
void dfs(int u, int pre) {
siz[u] = w[u];
fa[u] = pre;
for (int v : adj[u]) {
if (v == pre) continue;
... | ALGO | 0.999983 | 4.067511 |
52c9eaef-6bec-4f70-bc85-38ca2c40fe29 | octoml/macho-dyld | src/ImageLoader.cpp | #define __STDC_LIMIT_MACROS
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <mach/mach.h>
#include <mach-o/fat.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/sysctl.h>
#include <libkern/OSAtomic.h>
... | TOOL | 0.881756 | 6.335687 |
b02a8d17-7e4c-47df-a6b7-8038e87a1e7f | igoingdown/leetcode | 110_dfs_short_circuit_optimization.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
unordered_map<TreeNode*, int> m = {{NULL, 0}};
int get_depth(TreeNode *root) {
if (... | ALGO | 0.999964 | 6.533533 |
3662065c-3a42-4820-8a3b-ee92a63ffe79 | AlexNovoros87/doggame | src/parse_ticker/comparser.cpp | #include "comparser.h"
[[nodiscard]] std::optional<LaunchParams> ParseCommandLine(int argc, const char *const argv[])
{
namespace po = boost::program_options;
po::options_description desc{"Allowed options"s};
LaunchParams args;
std::string pth;
uint32_t save_period;
// VVVVVVV ИНСТРУКЦИЯ КА... | TOOL | 0.87856 | 4.711714 |
7fb3c85c-3537-4b40-ad31-1ae6d52527bf | EdwardShiung/LeetCode | Top_Interview/Graph_General/05_ACM_103_Water_Flow/05_ACM_103_Water_Flow_01.cpp | /**
* 103. 水流问题
题目描述
现有一个 N × M 的矩阵,每个单元格包含一个数值,这个数值代表该位置的相对高度。
矩阵的左边界和上边界被认为是第一组边界,而矩阵的右边界和下边界被视为第二组边界。
矩阵模拟了一个地形,当雨水落在上面时,水会根据地形的倾斜向低处流动,
但只能从较高或等高的地点流向较低或等高并且相邻(上下左右方向)的地点。
我们的目标是确定那些单元格,从这些单元格出发的水可以达到第一组边界和第二组边界。
输入描述
第一行包含两个整数 N 和 M,分别表示矩阵的行数和列数。
后续 N 行,每行包含 M 个整数,表示矩阵中的每个单元格的高度。
输出描述
输出共有多行,每行输出两个整数,用一个空格隔开... | ALGO | 0.99998 | 4.748895 |
40fd253f-2876-41f4-ac70-db3ab58622dd | noochila/-DSA- | Difficulty: Medium/XOR Linked List/xor-linked-list.cpp | //{ Driver Code Starts
#include <stdint.h>
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
struct Node *npx;
Node(int x) {
data = x;
npx = NULL;
}
};
struct Node *XOR(struct Node *a, struct Node *b) {
return (struct Node *)((uintptr_t)(a) ^ (uintptr_t)(b));
... | ALGO | 0.999134 | 5.898046 |
cad958ed-eea8-4561-88e2-00de9e4826fe | raincross7/code-similarity | codes/train_code/problem094/problem094_397.cpp | #include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<in... | ALGO | 0.999492 | 3.601285 |
15f28358-7bb0-49e5-8a0d-da6b4880ae2e | Aty-0/S2DE | Libs/boost_1_76_0/libs/iterator/example/shared_iterator_example1.cpp | #include "boost/shared_container_iterator.hpp"
#include "boost/shared_ptr.hpp"
#include <algorithm>
#include <iostream>
#include <vector>
typedef boost::shared_container_iterator< std::vector<int> > iterator;
void set_range(iterator& i, iterator& end) {
boost::shared_ptr< std::vector<int> > ints(new std::vector<i... | TOOL | 0.948909 | 3.427441 |
e918aa7e-f6d5-4b5d-bfc0-946e49300381 | SH7072/DSA-cpp | 5_Recursion/4_firstAndLastOccurence.cpp | // Return the index of first and last occurrence of a number in an array
#include <bits/stdc++.h>
using namespace std;
int firstOccurrence(int arr[], int n, int key, int index)
{
if (index == n)
{
return -1;
}
if (arr[index] == key)
{
return index;
}
return firstOccurre... | ALGO | 0.99997 | 4.542097 |
2c287072-10cf-45dd-95c7-a9c0c6244374 | sarvex/leetcode-csh | solution/1200-1299/1237.Find Positive Integer Solution for a Given Equation/Solution.cpp | /*
* // This is the custom function interface.
* // You should not implement it, or speculate about its implementation
* class CustomFunction {
* public:
* // Returns f(x, y) for any given positive integers x and y.
* // Note that f(x, y) is increasing with respect to both x and y.
* // i.e. f(x, y) ... | ALGO | 0.999937 | 5.955907 |
d3a204d9-a86c-416d-abc2-d1e25cc42399 | intfloat/AlgoSolutions | leetcode/ConstructBinaryTreefromPreorderandInorder.cpp | // ConstructBinaryTreefromPreorderandInorder.cpp
#include <vector>
using namespace std;
class Solution {
public:
vector<int> pre, in;
TreeNode *buildTree(vector<int> &preorder, vector<int> &inorder) {
pre = preorder; in = inorder;
int len = pre.size();
TreeNode *root = construct(0, le... | ALGO | 0.999981 | 6.42112 |
3cbf9bdf-03e4-4cf4-b66e-e9176e0251cc | divesh-netizen/Love-Babbar-450-QA | 03_String/09_permutaationofstring.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<string>find_permutation(string S)
{
vector<string>res;
// sort the string in lexicographically order
sort(S.begin(), S.end());
do
{
// keep adding... | ALGO | 0.999972 | 5.24225 |
cb64c921-9c9e-4564-850a-dd681123a59c | ishandutta2007/codeforces | vercingetorix/normal/605/E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <queue>
#include <cstring>
#include <set>
#include <bitset>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <stdio.h>
using namespace std;
typedef long long ll;
typedef long do... | ALGO | 0.999737 | 3.292167 |
acce2baf-1781-4faf-9aa8-18057c65cfa0 | sinian666/code_41_27 | cpp_副本14/chapter_array_and_linkedlist/linked_list.cpp | /**
* File: linked_list.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 在链表的节点 n0 之后插入节点 P */
void insert(ListNode *n0, ListNode *P) {
ListNode *n1 = n0->next;
P->next = n1;
n0->next = P;
}
/* 删除链表的节点 n0 之后的首个节点 */
void remove(ListNode *n0) {
if (n0... | ALGO | 0.999856 | 5.584367 |
6672ea54-af0e-45bc-9880-78f59a4f1918 | luuuyi/MyPractise | jump_game.cpp | class Solution {
public:
bool canJump(int A[], int n) {
int end = n-1;
if(end <=0) return true;
int now = 0;
while(now<end){
if(A[now]==0) return false;
now += A[now];
}
return true;
}
}; | ALGO | 0.999862 | 5.175686 |
ef96ff0f-f3b2-4d6d-be19-3e265d69727c | tomon9086/atcoder | src/apg4b/ex4.cpp | #include <iostream>
using namespace std;
int main()
{
// 一年の秒数
int seconds = 365 * 24 * 60 * 60;
// 以下のコメント/* */を消して追記する
cout << seconds * 1 << endl;
cout << seconds * 2 << endl;
cout << seconds * 5 << endl;
cout << seconds * 10 << endl;
return 0;
}
| ALGO | 0.89855 | 3.010057 |
edc58ca2-d1e5-44fc-b8cb-08fa59b0e365 | eaglehuntt/CS260-Data-Structures | binary_search_tree/bst.cpp | #include "bst.hpp"
#include <iostream>
BinarySearchTree::BinarySearchTree() {
root = nullptr;
}
BinaryNode* BinarySearchTree::locate_parent(int proposed_value) {
BinaryNode *parent = nullptr;
BinaryNode *current = root;
while (current != nullptr) {
if (proposed_value < current->value) {
... | ALGO | 0.999852 | 6.46046 |
e77ef275-0770-4d6a-af7c-b156acc59dfe | JayantGoel001/CodeChef | Attendance.cpp | #include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t=1;
cin>>t;
while(t--){
int n;
cin>>n;
map<string, int> mp;
vector<pair<string,string>> v;
fo... | ALGO | 0.999872 | 3.8982 |
8db7d453-1ca3-43ea-94b9-6d3fa4af91d3 | soul059/DSA | array/medium/sprial matirx.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> spiralMatrix(vector<vector<int>>& mat) {
int n = mat.size();
int m = mat[0].size();
int left = 0, right = m - 1;
int top = 0, bottom = n - 1;
vector<int> ans;
while (top <= bottom && left <= right) {
... | ALGO | 0.99998 | 4.872296 |
72c44f6c-65b3-477c-a3b5-c23c1e80b8e0 | vibhanshujainiiitr/Academic-Files | Semester 3/Data Structure 2/nptel/Lecture2/computeSpans1.cpp | #include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int * computeSpans(int *arr, int n){
int *new_arr = (int *)malloc(n*sizeof(int));
int c;
for(int i=0;i<n;i++){
c = 1;
for(int j=i-1;j>=0;j--){
if(arr[j] <= arr[i]){
c++;
}
else break;
}
new_arr[i] = c;
}
retu... | ALGO | 0.999956 | 3.894617 |
d89badd2-e29d-426b-98d4-4cfb100dbb26 | SadmanHafizShuvo21/codeforces | C_1_Hacking_Numbers_Easy_Version.cpp | #include <bits/stdc++.h>
using ll = long long;
void flush() {
std::cout.flush();
}
ll mul(ll n) {
std::cout << "mul " << n << "\n";
flush();
ll x;
std::cin >> x;
assert(x == 1);
return x;
}
ll add(ll n) {
std::cout << "add " << n << "\n";
flush();
ll x;
std::cin >> x;
... | ALGO | 0.997618 | 4.448039 |
bfabd422-e7aa-4a8d-b43c-4c7951bc2488 | Tharun8008/DAA-0601 | daa 39 hamiltoni.cpp | #include<stdio.h>
#define V 5
void printSolution(int path[]);
bool isSafe(int v, bool graph[V][V], int path[], int pos)
{
if (graph [ path[pos-1] ][ v ] == 0)
return false;
for (int i = 0; i < pos; i++)
if (path[i] == v)
return false;
return true;
}
bool hamCycleUtil(bool graph[V][V], int path[], int pos)
{
... | ALGO | 0.999954 | 4.444818 |
56ccd5a6-cef5-4d90-ae96-f71cb9735cbd | SeongJun08/TowerOfHanoi | TowerOfHanoi.cpp | #include <iostream>
#include "hanoi.h"
int main()
{
/* 하노이의 탑
원반의 갯수를 입력 받는다
입력받은 갯수의 원반을 만들고 이름을 붙인다(A~)
원반은 임시적으로 3개로 한다
A B C의 원반이 있고 A 원반에 3개의 원반이 매달려있다
원반은 아래에서부터 위로갈수록 작아진다
원반은 자신보다 작은 원반 위에 놓을 수 없다
한번에 하나의 원반만 옮길 수 있다
A에 쌓여있는 원반을 C로 옮기면 성공이다
재귀를 써본 뒤 제한없이 만들어보자
*/
... | ALGO | 0.999653 | 5.518106 |
89616721-99a9-49e9-ba2c-54250006000c | boyslikeguy23/dsa_Cpp | CNTT4K62/B14_15_11_22_set/bst.cpp | #include<bits/stdc++.h>
using namespace std;
struct node
{
int elem;
node*left,*right;
node(int e){elem=e; left=right=0;} //tao 1 node
};
void update(node*&H,int x)
{
if(!H) H=new node(x);
else if(H->elem==x) return ; //option
else update(x<H->elem?H->left:H->right,x);
}
node *find(node *H,int x)
{
if(!H||H->el... | ALGO | 0.999917 | 3.797657 |
ec59afaa-e685-465f-bd6e-e0afcc585c3b | thegamer1907/Code_Analysis | CodesNew/4028.cpp | #include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <cassert>
#include <cmath>
using namespace std;
class Solution {
public:
vector<int> query(vector<int>& ws, vector<long long>& as) {... | ALGO | 0.999818 | 3.97522 |
0c20a07d-9793-42d2-9e89-e5186884eb4e | senapati-deepak/Data-Structures-and-Algorithms | Algorithmic Toolbox/week1_programming_challenges/2_maximum_pairwise_product/max_pairwise_product.cpp | #include <iostream>
#include <vector>
using std::vector;
using std::cin;
using std::cout;
int MaxPairwiseProduct(const vector<int>& numbers) {
int result = 0;
int n = numbers.size();
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
if (numbers[i] * numbers[j] > result) {
result ... | ALGO | 0.999933 | 5.222191 |
042b2e84-8817-4a1a-900a-750048f9b1d4 | RickTseng/Cpp_LeetCode | 0300_Longest Increasing Subsequence.cpp | #include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <map>
#include <algorithm>
#include <stack>
#include <queue>
#include <iostream>
using namespace std;
class Solution
{
public:
int lengthOfLIS(vector<int> &nums)
{
vector<int> dp(nums.size(), 0);
for (int i = 0; ... | ALGO | 0.999975 | 4.955709 |
e2af0f2d-209b-4972-aa84-25d31606c98e | mushfiqbh/codeforces-solution | A_Candies_and_Two_Sisters.cpp | #include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
long long t, n;
cin >> t;
while(t--){
cin >> n;
if(n <= 2){
cout << 0 << endl;
}else{
if(n%2 == 0){
cout << n/2-1 << endl;
... | ALGO | 0.999714 | 5.098328 |
24397215-ac22-4bdb-94f4-ea42855699a7 | adityakaushik22/competitive-programming | C++ Problems/longest_arithmetic_subarray.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for (int i = 0; i < n; ++i)
{
cin>>arr[i];
}
// for first 2 elements in array
int ans=2;
int pd=arr[1]-arr[0]; // pd= previous common difference since array me common difference same hona chhaiye sirf usi ka len... | ALGO | 0.999842 | 3.788749 |
7a5031ff-9053-41aa-b268-730a20bfca3a | ishandutta2007/codeforces | yuto1115/normal/1321/B.cpp | #include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
vector<ll> beauty(n);
map<ll,ll> m;
rep(i,n) {
cin >> beauty[i];
... | ALGO | 0.999936 | 3.972056 |
dfda0d44-d367-439f-a3ba-78a1db74de6b | Sanketkatkade/LeetCode | 2363-merge-similar-items/2363-merge-similar-items.cpp | class Solution {
public:
vector<vector<int>> mergeSimilarItems(vector<vector<int>>& items1, vector<vector<int>>& items2) {
map<int,int>mp;
vector<vector<int>>res;
for(auto x : items1){
mp[x[0]] += x[1];
}
for(auto x : items2){
mp[x[0]] += x[1];
... | ALGO | 0.999953 | 5.472759 |
f882cec5-dd0e-443d-899b-a8c781a59355 | CLDP/UVa | 537.cpp | #include <cstdio>
#include <cstring>
#include <cctype>
const int MAXN = 1000;
char s[MAXN], q[MAXN];
double get(int &a) {
int b = 0;
double c;
a += 2;
while (isdigit(s[a]) || s[a] == '.') q[b++] = s[a++];
q[b] = '\0';
sscanf(q, "%lf", &c);
switch (s[a++]) {
case 'k' : c *= 1e3; b... | ALGO | 0.851325 | 3.338965 |
96e867d9-2118-41f5-bc23-f0b7a068290d | AarthiHonguthi/DSA_0toHero | Stack/CompilerDesign/pretopost.cpp | #include <iostream>
#include <stack>
#include <string>
using namespace std;
class Solution
{
public:
string preToPost(string prefix)
{
stack<string> st;
// Traverse right to left
for (int i = prefix.size() - 1; i >= 0; i--)
{
char ch = prefix[i];
if (is... | ALGO | 0.999929 | 6.109879 |
3c637a37-f996-4d0b-84bd-2732f922227c | mainul3195/All | 2/C_-_String_Game.cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> dp;
string a, b;
#define mod 1000000007
long long okDone(int i, int j)
{
if (j == 0)
return 1;
if (j > i)
return 0;
if (~dp[i][j])
return dp[i][j];
if (a[i - 1] == b[j - 1])
return dp[i][j] = (okDone(... | ALGO | 0.999987 | 5.194775 |
a3d1ec33-9f8e-4e28-bb28-a6c1ce993ebe | Asik8/My-Codeforces | Old Codes/C_Number_Game.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pbs insert
#define pi pair<ll,ll>
#define py cout<<"YES\n";
#define pys cout<<"Yes\n";
#define pn cout<<"NO\n";
#define pns cout<<"No\n";
#define co(x1) cout<<x1<<"\n";
#define ct(x1) cout<<x1<<" ";
#define elc cout<<"\n";
#... | ALGO | 0.999972 | 4.812654 |
367d5a2c-7783-420d-ba28-688290e73d1d | ldsc/lib_ldsc | src/AnaliseImagem/Filtro/FEspacial/FEEsqueleto/CFEEsqueletoV2.cpp | /*
----------------------------------------------------------------------------
BIBLIOTECAS
----------------------------------------------------------------------------
*/
#include "Base/COperacao.h"
#include "AnaliseImagem/Filtro/FEspacial/FEEsqueleto/CFEEsqueletoV2.h"
#include "AnaliseImagem/Filtro/FEspacial/FEM... | ALGO | 0.913851 | 3.00947 |
45a7f6f9-a26c-4a20-a3dd-53a20e1f4db5 | wol101/useful_tools | brachiation/trajectory_follower/kinetics_to_vrml/kinetics_to_vrml.cpp | // program to read in the kinetics file produced by Objective and
// output a simple VRML animation
// would like to have used the non .h versions of the iostream include files but these throw
// up all sorts of errors - I suspect they just don't work properly on SGIs
#include <iostream.h>
#include <fstream.h>
#incl... | ALGO | 0.926789 | 4.7561 |
c666a9f8-a811-4317-adca-e1da0b181549 | YashAryaWisc/AlgorithmToolbox | Algo2/A2P2_K-Clustering/k-clustering.cpp | /*
Kruskal's Algorithm.
Time: O(ElogE)
Space: O(V) other than the space to store the graph
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <fstream>
#include <string>
using namespace std;
typedef pair<int, int> iPair;
class DisjointSet {
int n;
int* rank;
int* parent;
pu... | ALGO | 0.99996 | 4.686893 |
e71141f8-4197-4f50-99d9-95104bc61c1a | KaranNasa/Placement | K distance from root - GFG/k-distance-from-root.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
... | ALGO | 0.999782 | 6.050905 |
4d112bde-bf5c-4b9b-bea3-faf1bd49e1dc | lixiang0405/ACM | 动态规划/区间dp/括号数列,噩梦难度.cpp | /*
小 w 在赛场上遇到了这样一个题:一个长度为 n 且符合规范的括号序列,其有些位置已经确定了,有些位置尚未确定,求这样的括号序列一共有多少个。
身经百战的小 w 当然一眼就秒了这题,不仅如此,他还觉得一场正式比赛出这么简单的模板题也太小儿科了,于是他把这题进行了加强之后顺手扔给了小 c。
具体而言,小 w 定义“超级括号序列”是由字符 (、)、* 组成的字符串,并且对于某个给定的常数 k,给出了“符合规范的超级括号序列”的定义如下:
()、(S) 均是符合规范的超级括号序列,其中 S 表示任意一个仅由不超过 k 个字符 * 组成的非空字符串(以下两条规则中的 S 均为此含义);
如果字符串 A 和 B 均为符合规范的超... | ALGO | 0.999981 | 3.466153 |
96cf5693-4b05-4a49-a2dd-9348a3441011 | Ab-mahin/OTHER | GCDCNT.cpp | // USER: "Ab.Mahin"
// Problem: Chef and Gcd Queries
// Contest: CodeChef - MARCH18
// URL: https://www.codechef.com/problems/GCDCNT?tab=statement
// Memory Limit: 256 MB
// Time Limit: 1500 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include ... | ALGO | 0.999884 | 4.284819 |
e62cac40-b878-43b5-872b-6ded39fe162e | xilinliang/BrightSTAR_run15_codeQA | StRoot/StarGenerator/EvtGen1_06_00/src/EvtGenBase/EvtGammaMatrix.cpp | using std::endl;
using std::ostream;
EvtGammaMatrix::EvtGammaMatrix(){
int i,j;
static EvtComplex zero(0.0,0.0);
for(i=0;i<4;i++){
for(j=0;j<4;j++){
_gamma[i][j]=zero;
}
}
}
EvtGammaMatrix operator*(const EvtGammaMatrix& g, const EvtComplex& c)
{
return c*g;
}
EvtGammaMatrix operator*(con... | TOOL | 0.943137 | 6.117033 |
96326315-c332-4080-8089-8bface8bfd7b | ritahsiao/2021c2 | week05/week05-3.cpp | ///week05-3 ֤@I
#include <stdio.h>
#include <stdlib.h>///qsort()
int comp(const void *p1,const void *p2)
{
int a=*(int*)p1,b=*(int*)p2;
if(a>b) return +1;///TتA
if(a<b) return -1;///fZ:ka-b
if(a==b) return 0;
}
int main()
{
int a[100];
for(int i=0;i<100;i++) printf("%d ",a[i]);
printf("\n");... | ALGO | 0.99934 | 3.223954 |
5b788703-0255-4fa2-af93-f503c4818113 | Cookiefan/ZigZag | Zigzag/Octomber/Oct 11/A.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+20;
const double inf = 1e20;
double e[maxn], ans[maxn];
double pn[maxn];
double p;
int n, x;
const double eps = 1e-8;
int dcmp(double x) {
if (fabs(x)<eps) return 0;
return x<0? -1:1;
}
void pre() {
pn[0] = 1.0;
for (int i ... | ALGO | 0.999609 | 3.787223 |
f4e1fadc-2bb6-4dc7-810b-96cc034a0296 | yogurt-shadow/z3_comp | z3_dynamic/src/math/lp/emonics.cpp | #include "math/lp/emonics.h"
#include "math/lp/nla_defs.h"
#include "math/lp/nla_core.h"
namespace nla {
void emonics::inc_visited() const {
++m_visited;
if (m_visited == 0) {
for (auto& svt : m_monics) {
svt.set_visited(0);
}
++m_visited;
}
}
void emonics::push() {
... | ALGO | 0.986984 | 4.92452 |
95fc0a95-e1c8-4cc6-baec-e93b4ac348e6 | syalr/cnpoker_V20150816 | Public/Poker.cpp | #include "Poker.h"
/********** 出牌算法 **********/
int Poker::Than(ePK_TYPE _my, char _myValue, char _myCount, ePK_TYPE _other, char _otherValue, char _otherCount)
{
if ( _my != _other ) {
if ( _my == PH_MAX )
return (PH_AGAIN);
if ( _my == PH_4 )
return (PH_THAN);
return (PH_INVALID);
}
if ( !(_... | ALGO | 0.998889 | 3.301573 |
05c40542-ef65-4343-af7c-450ecf90e6fb | Gaurav-88074/MCA | SEM2/ALGO/rough.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
auto sum = [&](int a,int b){
return a+b;
};
auto display = [&](vector<int> &arr){
for(int &x:arr){
cout<<x<<" ";
}
cout<<endl;
};
auto comp = [&](int &a,int &b){
... | ALGO | 0.999812 | 4.958661 |
e5d48845-f4dc-44b1-b8d2-bf54696221fb | XessX/Angry_Bird_Alike | boost/libs/hana/example/tutorial/integral.cpp | #include <boost/mpl/equal_to.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/minus.hpp>
#include <boost/mpl/multiplies.hpp>
#include <boost/mpl/pair.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/hana/assert.hpp>
#include <boost/hana/concept/constant.hpp>
#include <boost/h... | ALGO | 0.937683 | 6.37919 |
37e7b0b5-3dc6-442d-b757-02714747a4b3 | ammarGamal123/LeetCode | 1561-maximum-number-of-coins-you-can-get/1561-maximum-number-of-coins-you-can-get.cpp | class Solution {
public:
int maxCoins(vector<int>& piles) {
sort(piles.begin(), piles.end());
deque<int> queue;
for (int num : piles) {
queue.push_back(num);
}
int ans = 0;
while (!queue.empty()) {
queue.pop_back(); // alice
... | ALGO | 0.999986 | 5.418645 |
6e47acd8-6189-48a1-a4f7-219b58393253 | ishandutta2007/codeforces | tsukiko_tsutsukakushi/normal/1765/K.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++ i)
#define all(c) std::begin(c), std::end(c)
#ifdef LOCAL
#define debug(...) debug_impl(#__VA_ARGS__, __VA_ARGS__)
template<class T, class ...Args> void debug_impl(string s, T&& first, Args &&...args) {
cerr << "(" << s <... | ALGO | 0.999988 | 3.770298 |
0a6d3872-cb06-4704-a0ab-2babdf277ced | sarvex/leetcode-scala | solution/2200-2299/2221.Find Triangular Sum of an Array/Solution.cpp | class Solution {
public:
int triangularSum(vector<int>& nums) {
int n = nums.size();
for (int i = n; i >= 0; --i)
for (int j = 0; j < i - 1; ++j)
nums[j] = (nums[j] + nums[j + 1]) % 10;
return nums[0];
}
}; | ALGO | 0.999961 | 6.424844 |
caa2b07f-0332-4da4-99d7-8cd94dfce702 | Sumit1608/CodingNinjas-C-Data-Strutures-and-Algorithms-Solutions | Lecture 19- Graphs 1/4 Has Path.cpp | #include<iostream>
#include<queue>
using namespace std;
bool findPath( int **edges, int n, int v1, int v2, bool *visited){
//sv = starting vertex
queue<int> q;
q.push(v1);
visited[v1] = true;
while( !q.empty() ){
int f = q.front();
q.pop();
for(int i=0; i<n; i++){
if(i == f){
continue;
}
if(e... | ALGO | 0.999979 | 4.272365 |
5de3e488-2637-47de-844d-bdb26e99ecef | matsavx/CppFefuProjects | training/main.cpp | #include <iostream>
using namespace std;
void changeVariables(int a, int b) {
a = a + b;
b = a - b;
a = a - b;
cout << a << " " << b << endl;
}
bool intersection (int *a, int *b, int s) {
if ((a[0] <= b[0]) && (a[s-1] >= b[0]))
return true;
else return (b[0] <= a[0]) && (b[s-1] >= a[0... | ALGO | 0.999886 | 3.811811 |
102339a1-a9cc-4ed4-beaf-5263c946cb3c | sifisl/NanoMaterialsCAD | Source/DefectedNPs.cpp | #include "stdafx.h"
#include "VSystem.h"
#include "DefectedNPs.h"
Group icosahedral(float lattice_constant, int noshells)
{//Fix this
Group groupInit;
groupInit.N_atoms = 0;
if (noshells < 1)
return groupInit;
groupInit.position.push_back(jgn::vec3(0, 0, 0));
groupInit.N_atoms++;
float t = 0.5 + sqrt(5.0) / 2... | TOOL | 0.96245 | 3.531033 |
efd19e57-3176-43e4-9c9d-a97cd249e8be | nr1201/2023aaia3 | week01-3.cpp | #include <iostream>
using namespace std;///ϥΩRWŶ
int main()
{
int n;
cin >> n;
cout << n;
cout << "=50*";
cout << n / 50;
cout << "+5*";
cout << n%50 / 5;
cout << "+1*";
cout << n%5;
cout << "\n";
}
| ALGO | 0.99528 | 3.131193 |
e1bfd4c4-0f2a-482e-bd96-87c262f849ab | PRajesh999/Owl-Coder-Level-2 | power of a number.cpp | //#Power of a number
//-------------------
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int x,y,m;
cin>>x>>y>>m;
int c=pow(x,y);
cout<<(c%m);
}
| ALGO | 0.999991 | 3.923927 |
6071c771-79a1-4d6f-bf35-54c1d003cefa | shwetanknaveen/OnlineCoding | Leetcode/Contests/22_01_2022 Biweekly/Count the Hidden Sequences.cpp | //Problem link - https://leetcode.com/problems/count-the-hidden-sequences/
/*
Let the first number of array be x then next number in the array will be x+differences[0] and similarily there are other
numbers in the array. The maximum increase/decrease that can happen to x is calculated as maxIncrease and maxDecrease be... | ALGO | 0.999992 | 5.87299 |
36062f55-d712-47d6-a90c-d0b249252fd6 | zwvista/PSL | PuzzlesS/Puzzles/SnakeMaze.cpp | #include "stdafx.h"
#include "astar_solver.h"
#include "bfs_move_gen.h"
#include "bfs_solver.h"
#include "solve_puzzle.h"
/*
iOS Game: 100 Logic Games 2/Puzzle Set 7/Snake Maze
Summary
Find the snakes using the given hints.
Description
1. A Snake is a path of five tiles, numbered 1-2-3-4-5, where... | ALGO | 0.999913 | 6.075143 |
a9d7c9a1-e78a-4919-93dd-4def5597aca6 | iDroid-Project/platform_frameworks_base | media/libstagefright/codecs/mp3dec/src/pvmp3_dequantize_sample.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_dequantize_sample.cpp
Functions:
power_1_third
pvmp3_dequantize_sample
Date: 09/21/2007
--------------------------------------------------------------... | ALGO | 0.999667 | 3.889368 |
6369fe6f-85ca-4895-a50b-0c21ba07c2ea | Milan-Toliya/tictactoe | tic tac toe/tic-tac(32space).cpp | #include <iostream>
using namespace std;
int counter=1;
int mat[9]{32,32,32,32,32,32,32,32,32};
int matuse[9]{0,0,0,0,0,0,0,0,0};
char caller;
int checking(){
cout<<"\nChecking for Winner... \n";
if (((mat[0] == mat[1] && mat[1] == mat [2] && mat[2] == mat[0]) && mat[1] != 32) ||
((mat[3] == mat[4] && mat[4]... | ALGO | 0.998227 | 3.642648 |
dcaedb29-36a6-4285-bdd4-ce9748cda791 | OpenDigitalTwin-Dev/FENGSim | toolkit/Geometry/cgal/demo/Interpolation/surface_voronoi.cpp | #include <CGAL/basic.h>
#ifndef CGAL_USE_GEOMVIEW
#include <iostream>
int main()
{
std::cerr << "Geomview doesn't work on this platform" << std::endl;
return 0;
}
#else
#ifdef CGAL_STL_SGI_CC
#define STL_HASH_TABLES
#endif
#include <CGAL/basic.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#... | ALGO | 0.883817 | 6.683326 |
08c2161a-5be1-4f7f-99a3-beafae940683 | Gurupranav-tech/cp | word-capitalization.cpp | #include <stdio.h>
#include <ctype.h>
int main(void) {
char data[10*10*10];
scanf("%s", data);
data[0] = toupper(data[0]);
printf("%s\n", data);
}
| ALGO | 0.984868 | 3.79406 |
6ac780e9-9971-4509-97d5-acfb81f66392 | qcscine/kiwi | src/Kiwi/Kiwi/HartreeFock/InitialGuess/InitialGuess.cpp | #include <Kiwi/HartreeFock/HartreeFockSettings.h>
#include <Kiwi/HartreeFock/HartreeFockUtils.h>
#include <Kiwi/HartreeFock/InitialGuess/InitialGuess.h>
#include <Kiwi/HartreeFock/InitialGuess/SAD.h>
#include <Kiwi/HartreeFock/InitialGuess/SND.h>
#include <Kiwi/HartreeFock/SecondOrder.h>
#include <Kiwi/HartreeFock/Seri... | ALGO | 0.999251 | 6.138947 |
761b903c-10f2-46e8-bfca-a257cebed5a9 | cjc96/privacy | backend/privtree/prefix.cpp | #include "prefix.h"
prefixnode::prefixnode(vector<pair<int, int>> idx1, int depth1, vector<int> path1) : idx(idx1), depth(depth1), path(path1) {
score = idx.size();
}
prefixnode::~prefixnode() {
}
prefix::prefix(engine& eng1) : tree(eng1) {
}
prefix::~prefix() {
}
void prefix::load(vector<vector<int>>& data1, int... | ALGO | 0.957909 | 3.773878 |
e1887644-0f6e-4b76-9142-60467a3bb734 | seiko-iwasawa/my-library | my-library/Graph/LCA binary jumps.cpp | #include <iostream>
#include <vector>
using namespace std;
const int N = 1e5 + 7;
const int K = 20;
int n;
vector<int> g[N];
int par[N][K];
int tin[N], tout[N];
void dfs_lca(int v, int last) {
static int t = 0;
tin[v] = t++;
par[v][0] = last;
for (int k = 1; k < K; ++k) {
par[v][k] = par[par[v][k - 1]][... | ALGO | 0.999962 | 4.667241 |
2affc1d8-e245-4c91-9382-13586d273c43 | groleo/mesa | src/gallium/drivers/r600/sb/sb_liveness.cpp | #include "sb_shader.h"
#include "sb_pass.h"
#define LIV_DEBUG 0
#if LIV_DEBUG
#define LIV_DUMP(a) do { a } while (0)
#else
#define LIV_DUMP(a)
#endif
namespace r600_sb {
bool liveness::visit(container_node& n, bool enter) {
if (enter) {
n.live_after = live;
process_ins(n);
} else {
process_outs(n);
n.live... | ALGO | 0.945056 | 5.991225 |
a2649a6b-07b0-4a49-a1e3-7d3bc0a9b55a | yuliy/sport_programming | timus/1136/main.cpp | #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <list>
#include <algorithm>
using namespace std;
struct TNode {
TNode()
: Value(-1)
, Parent(0)
, Left(0)
, Right(0) {
}
explicit TNode(int val)
: Value... | ALGO | 0.999989 | 4.304017 |
3eba197e-29d2-4022-96da-b77246a0f2db | EPITECH-IT-2028/Raytracer | src/ParserConfigFile.cpp | #include "ParserConfigFile.hpp"
#include <iostream>
#include <libconfig.h++>
#include <string>
#include <tuple>
#include <vector>
#include "AmbientLight.hpp"
#include "Cone.hpp"
#include "ConeInf.hpp"
#include "Cylinder.hpp"
#include "CylinderInf.hpp"
#include "DirectionalLight.hpp"
#include "LightComposite.hpp"
#inclu... | CONFIG | 0.932968 | 6.304379 |
4c0865e6-dd52-4313-b2b7-346e3216d52b | zxyDEDIRE/ACM_CODE | 日常/ANO/0000/20220313c.cpp | #include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=1e6;
int p[maxn];
int b[maxn];
int c[maxn];
int n,len;
signed main()
{
cin>>n;
for(int i=1;i<=n;i++)cin>>b[i];
for(int i=1;i<=n;i++)cin>>c[i];
len=max(b[n],c[n]);
for(int i=1,j;i<=n;i++)
{
if(b[i]<c[i])
p[i]=2*(c[i]-b[i]);
els... | ALGO | 0.999965 | 3.371078 |
97a1cffe-6ad8-44d3-88eb-0cf3f7141c78 | Kartik-Mathur/CPP-PP-Dec-21 | Lecture-17/LinearSearch.cpp | // LinearSearch.cpp
#include <iostream>
using namespace std;
int LinearSearch(int *a, int n, int key, int i) {
// base case
if (i == n) {
return -1;
}
// recursive case
if (a[i] == key) {
return i;
}
else {
return LinearSearch(a, n, key, i + 1);
}
}
int LinearSearch1(int *a, int n, int key) {
// base c... | ALGO | 0.999885 | 4.569792 |
d64e3d00-9be6-47d7-8429-62ef0bc2fef0 | jlanga/smsk_selection | src/guidance.v2.02/libs/phylogeny/computeDownAlg.cpp | // $Id: computeDownAlg.cpp 4585 2008-08-05 15:02:58Z cohenofi $
#include "definitions.h"
#include "computeDownAlg.h"
#include "treeIt.h"
void computeDownAlg::fillComputeDown(const tree& et,
const sequenceContainer& sc,
const int pos,
const computePijHom& pi,
suffStatGlobalHomPos& ssc,
... | ALGO | 0.99951 | 4.115303 |
4e8548b5-b60c-4d4d-b6ec-21e3456def34 | ReciHub/FunnyAlgorithms | Patterns/inverted_half_pyramid.cpp | #include <iostream>
#include <iomanip>
using namespace std;
//***************inverted half pyramid **************
// method 1
int main()
{
int n;
// char c = 2;
char c = 100;
cout << "enter the value of n" << endl;
cin >> n;
for (int i = 1; i <= n; i++)
{
cout << c << " ";
if (i == n)
... | ALGO | 0.999856 | 3.250967 |
fee06da8-f9cc-4e40-95e7-7615b70acde8 | dewank07/CodeForeces- | A_Nastia_and_Nearly_Good_Numbers.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
long long int a,b;
cin >> a >> b;
if(b==1)
{
cout<<"NO"<<endl;
}
else{
cout<<"YES"<<endl;
cout << a <<" "<< b*a <<" " << a*(b+1) <<" " <<end... | ALGO | 0.998861 | 3.635603 |
93c7930e-6a69-43e1-9130-37a99e091baa | sarvex/leetcode-matlab | solution/0300-0399/0358.Rearrange String k Distance Apart/Solution.cpp | class Solution {
public:
string rearrangeString(string s, int k) {
unordered_map<char, int> cnt;
for (char c : s) ++cnt[c];
priority_queue<pair<int, char>> pq;
for (auto& [c, v] : cnt) pq.push({v, c});
queue<pair<int, char>> q;
string ans;
while (!pq.empty()) ... | ALGO | 0.999999 | 6.218411 |
ae4132e4-12d2-4f45-a8a0-ccde678fbe32 | eleusKUET/online-judge-solutions | UVa Online Judge/437 - The Tower of Babylon.cpp | // #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#in... | ALGO | 0.999748 | 4.351299 |
2c289599-e34c-4fba-9ab8-b1c4bd0b380e | Maximusbe/c-project- | equationValidation.cpp | #include "calculator.h"
// Validates the equation
std::string Validate::validateEquation(std::string equation) {
// Erases all the spaces inside the equation
for(int i = 0; i < equation.length(); i++){
if(equation.at(i) == ' ') {
equation.erase(i, 1);
i--;
}
}
... | TOOL | 0.980001 | 4.514126 |
9e811595-109c-44b7-be92-6ea2919ff8b9 | nodchip/icfpc2021 | libs/boost_1_76_0/libs/geometry/test/algorithms/distance/distance_se_geo_l_ar.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#include <iostream>
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_line... | TEST | 0.957 | 7.815142 |
4eb071e9-8ca4-48d5-a3ed-f2849e028424 | Shadow-Candle-Studio/CZUEngines | UE/Engine/Source/ThirdParty/ICU/icu4c-64_1/source/i18n/collationsettings.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "unicode/ucol.h"
#include "cmemory.h"
#include "collation.h"
#include "collationdata.h"
#include "collationsettings.h"
#include "sharedobject.h"
#include "uassert.h"
#include "umutex.h"
#include "uvectr32.h"
U_NAMESPACE_BEGIN
CollationSettings::Collatio... | TOOL | 0.890028 | 3.63362 |
ae7aa4af-b857-4546-a948-1ee883ced47c | maxrenke/gppc-2015 | gppc-2015-submission/weightedAStar_0/Entry.cpp | /**
Implementation of the Weighted A* Algorithm
Author: Maxwell Renke (<EMAIL>)
**/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <deque>
#include <vector>
#include <algorithm>
#include <map>
#include <assert.h>
#include <iostream>
#include "wAStar.h"
#include "State.h"
//#include "GenericHeap... | ALGO | 0.999504 | 4.485561 |
48deaa86-a5f2-49fe-bcfe-4240a8e95045 | kellykimx/C | 3_DataStructure/4Queue.cpp | #include <iostream>
#include <vector>
using namespace std;
class Queue {
private:
vector<int> data;
bool isEmpty() const { return data.empty(); }
public:
Queue() {}
int peek() const {
if (isEmpty()) {
cout << "Error: Queue is empty" << endl;
return -1;
}
return data.front();
}
voi... | ALGO | 0.991059 | 4.886543 |
894bf82c-c02b-4e46-813f-1b98b6a21a76 | n-popov/dasr-2023 | contest2019/i.cpp | #include <unordered_map>
#include <map>
#include <iostream>
#include <set>
std::string find_location(
std::unordered_map<std::string, std::map<int, std::string>>& objects,
const std::string& name, int t) {
auto found_iter = objects.find(name);
if (found_iter == objects.end()) {
retu... | ALGO | 0.997077 | 5.537169 |
78aa1009-976a-416e-b1a4-81cecb08a662 | asandler/mipt | code/computational_maths/etc/boundary_problem/boundary.cpp | #include <iostream>
#include <math.h>
using namespace std;
double u[1000][1000];
double h = 1e-2, tau = 1e-2;
double N = 100;
double M = 60;
double a(double x, double t) {
return exp(t);
}
double a_t(double x, double t) {
return exp(t);
}
double a_x(double x, double t) {
return 0;
}
double b(double x,... | ALGO | 0.999788 | 3.292171 |
974a813d-c01b-4aa3-9026-3169a4481908 | div0404/DSA | reference.cpp | #include<iostream>
using namespace std;
void payingTax(int &money){
float tax = 0.10;
money = money - money*tax;
}
int main(){
int income;
cin>>income;
payingTax(income);
cout<<income<<endl;
return 0;
} | ALGO | 0.994161 | 3.005698 |
a227d345-ba9b-4134-adb8-ba2f52496ab6 | danghoangnhan/leetcode | StudyPlan/ DataStructure/DataStructureI/21.merge-two-sorted-lists.cpp | /*
* @lc app=leetcode id=21 lang=cpp
*
* [21] Merge Two Sorted Lists
*/
// @lc code=start
/**
* 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, ListN... | ALGO | 0.999653 | 6.155021 |
5b2af76d-14c0-40c6-bfe0-d3d2f20f6170 | MyuB/OOP2_Files | 09_01_reference_const.cpp | /*
int name = value;
int &rName = name;
const int name = value;
int& rName = name; ȵ
int name = value;
const int& rName = name;
const int name = value;
const int& rName = name;
*/
#include <iostream>
using namespace std;
void swap(int& first, int& second) {
int temp = first;
first = second;
second = temp;
}
... | ALGO | 0.997842 | 5.241488 |
020717cf-e39b-4e2a-b6a2-f68909d5a0c6 | DuCLeK65t/LTNC_25 | Week 4/A1_CreateTest.cpp | #include <iostream>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
using namespace std;
int main()
{
srand((unsigned)time(0));
int n = rand()&100 + 1;
cout << n << endl;
int f[n];
for (int i = 0; i < n; i++)
f[i] = rand() % 100 + 1;
for (int i = 0; i < n; i++)
cout << f[i] << " ... | ALGO | 0.966335 | 3.289989 |
9c6c3d10-b5f4-417c-859e-53f55a2fee9d | creativechain/crea | libraries/chain/util/rd.cpp |
#include <crea/chain/util/rd_setup.hpp>
#include <crea/chain/util/rd_dynamics.hpp>
#include <fc/uint128.hpp>
#include <fc/exception/exception.hpp>
// Implement the resource dynamics functions
// max_decay = (uint64_t(1) << (MAX_POOL_BITS + MIN_DECAY_BITS - DECAY_DENOM_SHIFT))-1;
namespace crea { namespace chain { ... | TOOL | 0.85697 | 7.068866 |
8f90c418-a237-407e-bf77-5c0932ddd578 | nolan0801/Competitive-Programming | VNOJ/lis.cpp | /*
Author : vidut_206_CNH
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define gcd(a,b) (__gcd(a,b))
#define lcm(a,b) (a/gcd(a,b)*b)
#define sz(x) (int)(x.size())
#define fast_cin() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#... | ALGO | 0.999961 | 4.481745 |
fb683162-cab2-49b9-a198-1ff85e473d43 | eanswer/LearningToFly | Firmware/ardupilot/modules/PX4Firmware/src/lib/conversion/rotation.cpp | /**
* @file rotation.cpp
*
* Vector rotation library
*/
#include "math.h"
#include "rotation.h"
__EXPORT void
get_rot_matrix(enum Rotation rot, math::Matrix<3, 3> *rot_matrix)
{
float roll = M_DEG_TO_RAD_F * (float)rot_lookup[rot].roll;
float pitch = M_DEG_TO_RAD_F * (float)rot_lookup[rot].pitch;
float yaw ... | ALGO | 0.988979 | 7.201332 |
6794dcdd-60bb-4b72-b6ed-01f2a501e00e | hjr265/sport-programming | NSU/Internal/20120831/E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std ;
int numbers[ 2002 ] ;
int sums[ 2002 ] ;
long long dp[ 2002 ][ 30 ] ;
int n = 0 ;
long long solve( int pos , int remk ) {
if( pos == n ) {
if( remk > 0 ) return 1LL << 60LL ;
return 0 ;
}
if( remk == 0 ) return 1LL << 60LL ;
... | ALGO | 0.999797 | 3.773779 |
f40e6475-6366-4c48-a6cb-a0a10842456a | Hareesh108/TOP100CODE | 68_distinct_unique_elements.cpp | // Program to count the distinct elements , In this Program we will find out the elements which are unique in the array.
#include <iostream>
using namespace std;
int Distinct(int arr[], int n) //Function Definition
{
int i, j, count = 1;
for (i = 1; i < n; i++) //hold an array element
{
for... | ALGO | 0.999229 | 5.361094 |
895abdf0-f706-4743-a479-3aa595f3b70d | monosshi/Algorithm | A_Bear_and_Big_Brother.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,p,q,count=0;
cin>>a>>b;
do
{
a=a*3;
b=b*2;
count++;
} while (a<=b);
cout<<count<<endl;
return 0;
} | ALGO | 0.99988 | 3.914087 |
a439de6c-cba4-401f-a3c8-7602a5810c97 | slave7/Tree-Data-Structure | BFS_traversal.cpp | #include<bits/stdc++.h>
using namespace std;
struct node
{
int data;
struct node *left, *right;
};
// new node insertion
struct node* Newnode(int data){
struct node* temp = new node;
temp->data = data;
temp->left=temp->right = NULL;
return temp;
};
// height of tree
int height(node* node)
{ ... | ALGO | 0.999972 | 5.336734 |
5831b6d2-2a73-4d9e-bc86-7be8ff1a2df0 | rupambsws9/CPP-Practice | VariableAndDataType/15.cpp | //Write a program to calculate the area of a circle
#include<iostream>
#define PI 3.14
using namespace std;
int main(){
double radius;
cout << "Enter the radius of the circle: ";
cin >> radius;
double area = PI * radius * radius;
cout << "The area of the circle is: " << area << endl;
return 0;... | ALGO | 0.997211 | 4.677577 |
985a29b7-ec42-46ca-955d-e33b5ee75958 | IMRAN-5740/Programming-Contest | Graph Theory/DFS.cpp | #include<bits/stdc++.h>
#define ll long long
#define WHITE 1
#define GRAY 2
#define BLACK 3
int adj[100][100];
int color[100];
int n,e;
using namespace std;
void visitDFS(int x)
{
color[x]=GRAY;
for(int i=0;i<n;i++)
{
if(adj[x][i]==1)
{
if(color[i]==WHITE)
{
visitDFS(i);
}
}
}
color[x]=BL... | ALGO | 0.999806 | 3.752128 |
a8a3fb53-9554-49af-9e1e-f89dc20bbdaf | KazuhoSAKAOKA/leetcode | leetcode_Q1948/main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <climits>
#include <cmath>
#include "./../utility/leetcode_testcase_helper.h"
using namespace std;
class Solution {
public:
struct trie_tree {
struct node {
std::map<string, node... | ALGO | 0.998923 | 5.633023 |
fcca4f43-d4b0-4661-b643-9ed41fe67e86 | hot5667/WinApI | Win_Api_Eduction/Win_Api_Eduction/Player.cpp | #include "Player.h"
#include "Map.h"
#include "Helper.h"
bool canMove = true;
int GPlayerX = 2;
int GPlayerY = 2;
void HandleMove()
{
// Ű带 , ִ.
if (GMoveDir == MD_NONE)
{
canMove = true;
return;
}
if (canMove == false)
return;
canMove = false;
switch (GMoveDir)
{
case MD_LEFT:
MovePlayer(GP... | ALGO | 0.853942 | 3.146919 |
8934c009-7a22-483a-9bdc-ef6d3394fde7 | RioKKH/cpp_example | GameSearch/03_OnePlayerGame/01_Greedy.cpp | // ゲームで学ぶ探索アルゴリズム実践入門
// コード写経
#include <string>
#include <sstream>
#include <random>
#include <iostream>
#include <cassert>
// 座標を保持する構造体
struct Coord
{
public:
int y_;
int x_;
Coord(const int y = 0, const int x = 0) : y_(y), x_(x) {}
};
std::mt19937 mt_for_action(0); // 行動洗濯用の乱数生成器を初期化する
using ScoreTyp... | ALGO | 0.999817 | 5.459948 |
3c350a67-6d05-4c9f-86d0-5f2dd480a036 | jlcm2112/Arioch | Sets.cpp | /* Linked Lists
This program is a simple integer set problem. You need to read in two sets of integers, and display the union, intersection, and difference of the two sets. You are going to store the sets in linked lists. The definition of a set for this problem is : ordered with no duplicate values.
The List type for... | ALGO | 0.959403 | 5.026937 |
03df2ed6-3ecf-4986-9c94-7e48cbf579c6 | axandrei1234/TUCN-Projects | xcode_sem1/Exercitiul4_Lab09/Exercitiul4_Lab09/AxenteAndrei_Lab09_Ex04.cpp | /*Axente Andrei Exercitiul4 Lab09 Grupa 2115
Să se scrie un program care citeşte de la tastatură un şir de caractere, apoi elimină din şir caracterele care se repetă şi afişează în final şirul obţinut, folosind pointeri.*/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void eliminate(char*, int);
int main()
{
... | ALGO | 0.994596 | 3.845674 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.