uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b078b58b-04af-43fb-905c-50ad6cbe4833 | vartika2302/Crack-Your-Placement | morris-traversal.cpp | // Time complexity - O(N) - O(N)+O(N) for all nodes traversing, moving to last node of left subtree.
// Space complexity - O(1)
// Morris traversal uses the concept of 'Threaded Binary Tree'.
// In recursive implementation, backtracking takes care of the returning.
// From the last node of the left subtree , we go ba... | ALGO | 0.999952 | 6.495112 |
000bec32-36bf-4d84-8dc4-9ffff274852d | cdlwhm1217096231/DataStruct_and_Algorithms | 剑指offer练习代码/42.二叉树_之字形打印二叉树.cpp | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
struct BinaryTreeNode{
int m_pVal;
BinaryTreeNode *m_pLeft;
BinaryTreeNode *m_pRight;
};
class Solution{
public:
vector<vector<int> > Print(BinaryTreeNode *pRoot){
vector<vector<int> > result;
if(pRoot == null... | ALGO | 0.999953 | 5.271967 |
fef943ef-6cb7-476f-bc42-cdf0d6b2f14a | szefany/acm-icpc | poj/p3348.cpp | // POJ 3348, Cows
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
const double EPS = 1E-8;
const int N = 10005;
struct Point {
int x, y;
Point () {}
Point (int x0, int y0): x (x0), y (y0) {}
Point operator - (const Point &other) {
return Point (... | ALGO | 0.999691 | 4.347244 |
56bf3abd-e3bb-414b-85b5-7f223b4f7d71 | Aniket-debug/learningGit | left_right_smaller.cpp | #include <bits/stdc++.h>
using namespace std;
void left_right_smaller(vector<int> &a)
{
int n = a.size();
stack<int> s;
s.push(-1);
vector<int> left_smaller(n, -1), right_smaller(n, n);
for (int i = 0; i < n; i++)
{
while (s.top() != -1 && a[s.top()] > a[i])
{
right_... | ALGO | 0.999997 | 4.544792 |
79c48fb9-e802-42c7-8140-0d01f0cd6260 | matchamatcho/atcoder_mizuiro | 57.cpp | #include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
// using mint = modint998244353;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll,ll>;
using vstr = vector<string>;
using vint = vector<int>;
u... | ALGO | 0.999769 | 4.627563 |
9c7f8b47-79f9-4665-88bc-dc65db93b272 | llvm-pic/llvm-pic | libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp | // <algorithm>
// template <class InputIterator, class Predicate>
// constexpr bool // constexpr after C++17
// is_partitioned(InputIterator first, InputIterator last, Predicate pred);
#include <algorithm>
#include <functional>
#include <cstddef>
#include <cassert>
#include "test_macros.h"
#include "te... | TEST | 0.948092 | 7.258035 |
ca1df828-e6ca-4c62-9353-25c244cd1a6d | papaver/tiktok-ios | ThirdParty/Box2D/Collision/Shapes/b2EdgeShape.cpp | #include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <new>
using namespace std;
void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2)
{
m_vertex1 = v1;
m_vertex2 = v2;
m_hasVertex0 = false;
m_hasVertex3 = false;
}
b2Shape* b2EdgeShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->All... | ALGO | 0.964303 | 7.599598 |
a64b164a-7382-4724-9659-91af2e283fa8 | muskankapoor/daily_coding | array/2darray.cpp | #include <iostreamm>
#include <vector>
using namespace std;
int findJudge(int N, vector<vector<int>>& trusts){
vector<int> degrees(N+1);
for (const auto& trusts : trusts){
--degrees[trusts[0]];
++degrees[trusts[1]];
}
`
for (int i = 1; i <=N; ++i) {
if (degrees[i] == N - 1){
return i;... | ALGO | 0.999862 | 5.165561 |
a46d6d4f-ed35-4536-864c-632af27f6340 | aanu2021/Leetcode-Solutions | 1234-replace-the-substring-for-balanced-string/1234-replace-the-substring-for-balanced-string.cpp | class Solution {
public:
unordered_map<char,int>count;
bool isValid(int k){
if(count['Q']<=k && count['W']<=k && count['E']<=k && count['R']<=k) return true;
return false;
}
int balancedString(string s) {
int n=s.length();
... | ALGO | 0.999974 | 5.184627 |
bebfe42a-250d-4c8c-b7a1-3b1ce9ff8756 | wirepecion/competitive.cpp | betaprog/0038_ToppyKung.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
string s[n];
for (int i = 0; i < n; i++)
{
cin>>s[i];
}
//cout<<"\n";
sort(s,s+n);
for (int i = 0; i < n; i++)
{
if(s[i]==s[i+1]){
continue;
}else cout<<s[i]<<"\n";
}
} | ALGO | 0.999782 | 3.713107 |
769dda6f-2de5-4340-8fb9-3b7c360b690d | Tabing010102/oj-solution | LeetCode/面试经典 150 题/图的广度优先搜索/909. 蛇梯棋/909.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 20 + 5;
int n;
int d[MAXN * MAXN + 10];
class Solution {
public:
int getG(vector<vector<int>>& G, int idx) {
int x = (n - 1) - ((idx - 1) / n);
int y = (idx - 1) % n;
if ((n - 1 - x) % 2 == 1) { y = (n - 1) - y; }
ret... | ALGO | 0.999572 | 5.188168 |
b632efed-cfe8-4897-bedc-20ff704daf7b | ganeshmittal223/Cpp | recursion 1/Last index of number.cpp | /*
Last Index of Number
Given an array of length N and an integer x, you need to find and return the last index of integer x present in the array. Return -1 if it is not present in the array.
Last index means - if x is present multiple times in the array, return the index at which x comes last in the array.
You should... | ALGO | 0.99985 | 5.800877 |
a1c2445f-b9a4-4a3c-b183-14a932581b30 | caosong/minimal_scene | lib/Eigen/bench/sparse_randomsetter.cpp |
#define NOGMM
#define NOMTL
#include <map>
#include <ext/hash_map>
#include <google/dense_hash_map>
#include <google/sparse_hash_map>
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef DENSITY
#define DENSITY 0.01
#endif
#ifndef REPEAT
#define REPEAT 1
#endif
#include "BenchSparseUtil.h"
#ifndef MINDENSITY
#define M... | TOOL | 0.904549 | 4.487392 |
b9c66a59-ddff-4f45-832f-5fa3779dd250 | rahul30des/myc | missingPostive/missingPositive.cpp | /*Given an unsorted integer array, find the first missing positive integer.
*
* For example,
* Given [1,2,0] return 3,
* and [3,4,-1,1] return 2.
*
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// Time Complexity O(nlogn)
int firstMissingPositive(vector<int>& nums) { ... | ALGO | 0.999967 | 4.817634 |
4d4e171a-e419-4769-8921-04b7bc614b39 | adoptium/jdk8u_hg | hotspot/src/share/vm/opto/phaseX.cpp | #include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
#include "opto/block.hpp"
#include "opto/callnode.hpp"
#include "opto/cfgnode.hpp"
#include "opto/connode.hpp"
#include "opto/idealGraphPrinter.hpp"
#include "opto/loopnode.hpp"
#include "opto/machnode.hpp"
#include "opto/opcodes.hpp"
#include "opto/pha... | ALGO | 0.950983 | 5.881773 |
5850ddaf-227d-43a4-a1cb-f7f41ffc218b | ishandutta2007/codeforces | jtnydv25/normal/776/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld double
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii >
#define vll vector<ll >
#define cps CLOCKS_PER_SEC
#define eb ... | ALGO | 0.999984 | 4.284397 |
08ff2ad3-b8e4-442d-82ae-011a99a07604 | MagmaDNN/magmadnn | src/math/matmul.cpp | /**
* @file matmul.cpp
* @author Daniel Nichols
* @author Florent Lopez
* @version 0.1
* @date 2019-06-06
*
* @copyright Copyright (c) 2019
*/
#include "math/matmul.h"
#if defined(MAGMADNN_CMAKE_BUILD)
#include "magmadnn/config.h"
#endif
#include "math/wrappers.h"
#if defined(MAGMADNN_HAVE_CUDA)
#include "cub... | ALGO | 0.93963 | 6.999793 |
f6245d22-60c1-49f2-9b39-612d309f5122 | rtJuan22/App_Movil2 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
33f959bd-248b-41f3-b31e-e3a29008313f | prakHr/CSES-CPBeginnerJourney | Introductory Problems/Increasing Array.cpp | #include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define int long long
#define double long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define PI acos(-1)
#define sqr(a) ((a)*(a))
#define ff first
#define ss second
#de... | ALGO | 0.999879 | 3.77846 |
fe88f79f-c393-4063-a9ea-9eece2757f45 | cjr03/Cpp-Algorithms | AddTwoNumbers.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.999894 | 6.47719 |
293a8f46-09ea-4ed9-a7cf-f3425c6282c6 | AnkitXGandhi/GFG_POTD | Medium/Largest subsquare surrounded by X/largest-subsquare-surrounded-by-x.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int largestSubsquare(int n, vector<vector<char>> a) {
// code here
vector<vector<int>> v(n,vector<int>(n,0));
... | ALGO | 0.999691 | 6.659591 |
a7f65d24-43a4-43fc-8a7d-2ffc22c92536 | nguyentuss/Competitive-Programming | CP/OnlineJudge/yosupo/2044E.cpp | //#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma,popcnt")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define le(x) (x << 1ll)
#define ri(x) ((x << 1ll) + 1)
typede... | ALGO | 0.99937 | 3.891668 |
1051283d-8ac6-44f8-84a4-e424d921260c | Rudrakshyadav1/c-DSA | graph-kruskals-algorithm.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n,e;
class graph {
public:
vector<vector<int>> adj;
void addadj(int f, int s, int w){
adj.push_back({f, s, w});
}
int findparent(int a, vector<int>& p){
if (p[a] == a) {
return a;
}
... | ALGO | 0.999998 | 4.294066 |
e0dcccfd-9bd0-4d3d-9890-7dbda9921b31 | sweatpotato13/ps | Codeforces/1560/1560A.cpp | #pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef tuple<ll, ll, ll> tl3;
#define FOR(a, b, c) for (i... | ALGO | 0.999863 | 3.985836 |
3e101f1c-abad-4ef0-bb05-29d790fcab66 | jainapal/Data_Structures_Algorithms | Binary Trees/FAQs/PrintAllNodesAtDistanceOfKinBT.cpp | class Solution {
public:
unordered_map<TreeNode*, TreeNode*> parent;
void inorder(TreeNode* root){
if(!root) return;
if(root->left){
parent[root->left] = root;
inorder(root->left);
}
if(root->right){
parent[root->right] = root;
ino... | ALGO | 0.999998 | 6.236288 |
964d849e-3090-4933-8191-5c8b1fdaee9e | 1297656202/algorithm | 图论/最短路、最长路、次短路和k短路/dij+pair.cpp | #include<bits/stdc++.h>
#define ll long long
#define inf 1e18
#define mn 100005
using namespace std;
ll cnt=0,h[mn],bj[mn],n,m,d[mn];
struct w{ll next,to,z;}a[mn];
typedef pair<ll,ll>heap;
priority_queue<heap,vector<heap>,greater<heap> >q;
//priority_queue<ll>Q;//
//priority_queue<ll,vector<ll>,greater<ll> >p;//С
/*str... | ALGO | 0.999929 | 3.892607 |
100a3c98-a1a1-400d-a9b9-66896f342e20 | bsnxsourav/IP-Notes | essential cpp/mapx.cpp | #include<bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
map<int, int> m;
unordered_map <int, int> um;
m.insert(pair<int, int>(1, 40));
m.insert(pair<int, int>(2, 30));
m.insert(pair<int, int>(3, 60));
m.insert(pair<int, int>(4, 20));
m.insert(pair<int, int>(5... | ALGO | 0.95851 | 3.362268 |
cc81c182-d0f2-44cf-9c9c-ddbf471c631e | ishandutta2007/codeforces | nigus/normal/1214/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define hash dhsjakhd
typedef long long ll;
typedef pair<int, int> pii... | ALGO | 0.999829 | 3.598871 |
9204c0e0-2a77-40d4-aeef-280c2f068fa0 | SneakyElfff/PA-CUDA | LP1/main.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include <iomanip>
#include <random>
using namespace std;
const int BLOCK_SIZE_L1 = 222;
const int BLOCK_SIZE_L2 = 576;
// const int BLOCK_SIZE_L3 = ;
vector<vector<int> > fillMatrix(int rows, int cols) {
vector<vector<int> > matrix(rows, vector<int>(cols))... | ALGO | 0.996798 | 4.384986 |
e2f7fda9-8499-446a-aeda-ae3830e15130 | kvm2116/vmtorrent | p2pfs/boost/libs/coroutine2/example/same_fringe.cpp | #include <cstddef>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <string>
#include <utility>
#include <boost/coroutine2/all.hpp>
struct node {
typedef std::shared_ptr< node > ptr_t;
// Each tree node has an optional left subtree, an optional right subtree
// and a value of its ow... | ALGO | 0.982803 | 6.629704 |
fd227fa0-2a5a-415f-9477-d01a17d07154 | t0rr3sp3dr0/t0rr3sp3dr0.github.io | files/Codepit (Maratonando)/579e5c3e90279d180007b8ba/B.cpp | #include <bits/stdc++.h>
using namespace std;
int bs[1000000];
void crivo() {
memset(bs, 1, sizeof bs);
bs[0] = bs[1] = 0;
for (long long int i = 2; i < 1000000; i++)
if (bs[i])
for (long long int j = i * i; j < 1000000; j += i)
bs[j] = 0;
}
int main() {
crivo();
... | ALGO | 0.999882 | 3.789351 |
4dbfa23c-6605-429e-bad0-0def1761ff04 | LJNing2610/AcWing- | 774. 最长单词.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string str,maxstr;
int maxm=0,last=0;
while(cin>>str){
int a=str.size();
if(str[a-1]=='.'){
a--;
str.erase(a,1);
last=1;
}
if(a>maxm){
maxstr=str;
maxm=a;
}
if(last)
break;
}
cout<<maxstr;
return 0;
}
| ALGO | 0.971858 | 3.201224 |
e01a6af2-803e-4496-886e-38f6801dd014 | theoden42/code-store | codeforces/Codeforces Round 878 (Div. 3)/G2.cpp |
/* author: (g)theoden42 */
#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;
#define all(a) a.begin(), a.end()
#ifdef ON_PC
#include <debug.h>
#else
#define debug(x...)
#endif
template<typename T>
using o... | ALGO | 0.999616 | 3.511448 |
d1de5468-40bd-4ad4-92ff-4f0f3fcdc576 | YYQ0713/my_megahit_core | src/idba/hash_graph.cpp | /**
* @file hash_graph.cpp
* @brief
* @author Yu Peng (<EMAIL>)
* @version 1.0.0
* @date 2011-08-05
*/
#include "idba/hash_graph.h"
#include <algorithm>
#include <deque>
#include <stdexcept>
#include "bit_operation.h"
#include "idba/contig_builder.h"
#include "idba/contig_info.h"
#include "idba/hash_graph_vert... | ALGO | 0.985188 | 5.660905 |
d20d30be-3df8-4619-b7d7-4323d60dd478 | Apelsssin/6.1 | 6.1.2/6.1.2.cpp | #include <iostream>
#include <vector>
#include <thread>
#include <chrono>
#include <algorithm>
#include <random>
#include <future>
#include <string>
#include <exception>
void clear_vectors(std::vector<int>& vector12, std::vector<int>& vector34, std::vector<int>& vector56, std::vector<int>& vector78) {
vector12.cle... | TOOL | 0.98659 | 5.273916 |
0395d888-1d8b-49f2-bc52-8887da5b08d9 | Devansh968/LEET-CODE-SOLUTIONS | Reverse a string using Stack - GFG/reverse-a-string-using-stack.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
char* reverse(char *str, int len);
int main()
{
long long int t;
cin>>t;
while(t--)
{
char str[10000];
cin>>str;
long long int len=strlen(str);
char *ch=reverse(str,len);
for(int i=0;i<len;i++)
... | ALGO | 0.999771 | 5.279236 |
96a06071-b470-43a5-8c3a-f9b1fb584c91 | atharvausturge/school | array2d.cpp | // Atharva Usturge
// 12/18/24
// array 2lab
// extra extra subject
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
// number 1
int rows, columns;
cout << "Enter number of rows (1-5): ";
cin >> rows;
cout << "Enter number of columns (1-5): ";
cin >> columns;
if (row... | ALGO | 0.905128 | 4.123039 |
089cd95b-b3a5-47e5-ae6d-96e292b86867 | HarudaySharma/DSA | Trees/CodeQuotient/isBST.cpp | #include <algorithm>
#include <bits/stdc++.h>
#include <climits>
using namespace std;
class Node {
public:
int data;
Node *left, *right;
Node(int val) {
data = val;
left = NULL;
right = NULL;
}
};
class BST {
Node *root;
public:
BST() { root = NULL; }
void buildTree(int arr[], int n);
int ... | ALGO | 0.999972 | 5.05238 |
6d594663-1633-43da-9ad0-240fbda7f3d7 | DyogoBendo/cp | cf/975-div2/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll zero = 0;
void solve(){
ll n, k, x;
cin >> n >> k;
ll s = 0, mx = -1;
for (int i = 0; i < n; i++)
{
cin >> x;
s += x;
mx = max(mx, x);
}
for (int i = n; i >= 1; i--)
{ ... | ALGO | 0.999939 | 3.689745 |
9f0f6030-4b12-48e3-82a9-c65dd5181a2f | tempredirect/zxing | symbian/ZXingBarcodeReader/group/zxing/datamatrix/Version.cpp | #include <zxing/datamatrix/Version.h>
#include <limits>
#include <iostream>
namespace zxing {
namespace datamatrix {
using namespace std;
ECB::ECB(int count, int dataCodewords) :
count_(count), dataCodewords_(dataCodewords) {
}
int ECB::getCount() {
return count_;
}
int ECB::getDataCodewords() {
return data... | CONFIG | 0.880847 | 5.709468 |
89eae725-39fb-403e-bd71-d6d4a1fbc1b3 | faheem-Chaudhry/DSA | dsa masroor project/dsa masroor project/stack.cpp | #include "stack.h"
//#include"Stack.h"
template<class T>
bool LinkedList<T>::isEmpty()
{
return head == NULL;
}
template<class T>
T LinkedList<T>::getHead()
{
return head->data;
}
template<class T>
T LinkedList<T>::getTail()
{
return tail->data;
}
template<class T>
void LinkedList<T>::insertAtTail(T value)
{
Node... | ALGO | 0.981837 | 3.527832 |
24dbb9b1-783c-4547-b1d8-fe4dc3611427 | Gurban-Alimirzoev/cpp-search-server | search-server/string_processing.cpp | #include "string_processing.h"
using namespace std;
using namespace std::literals;
vector<string> SplitIntoWords(const string &text)
{
vector<string> words;
string word;
for (const char c : text)
{
if (c == ' ')
{
if (!word.empty())
{
words.push_back(word);
word.clear();
}
}
else
{
w... | TOOL | 0.951749 | 6.164695 |
8bcf943c-a777-4373-9ec4-0f9f17f7d45b | mariosantos-05/Competitive-Programming | beecrowd/2450.cpp | #include<iostream>
using namespace std;
/*string triangular(int n, int m){
//identificar uma matriz triangular!
//receber a matriz por meio da linha!
int matriz[n][m];
for(int i= 0; i<n; i++){
for (int j = 0; j < m; j++){
cin >> matriz[i][j];
}
}
string ans;
f... | ALGO | 0.999956 | 4.688149 |
17345be6-b847-4469-9a98-c19c93534658 | boriskrisanov/chess_engine | src/search.cpp | #include "search.hpp"
#include "Board.hpp"
#include "Piece.hpp"
#include "eval.hpp"
#include <algorithm>
#include <iostream>
#include <thread>
#include <vector>
using std::vector;
// +1 and -1 to avoid overflow when multiplying by -1
constexpr int POSITIVE_INFINITY = std::numeric_limits<int>::max() - 1;
constexpr int... | ALGO | 0.999541 | 7.300963 |
dce99a24-4497-4fbd-8191-42724ca17531 | Theblubunny/Virus-Fridge | vdetect.cpp | #include "vdetect.h"
VDetect::VDetect(int size, hash_fn hash, prob_t probing = DEFPOLCY){
if(size > MAXPRIME) m_currentCap = MAXPRIME;//Initializing size to be prime
else if(size < MINPRIME) m_currentCap = MINPRIME;
else if (!isPrime(size)) m_currentCap = findNextPrime(size);
else m_currentCap = size;
... | ALGO | 0.978097 | 5.034239 |
7ae9e470-cc04-4085-8582-8879bfb5a714 | kun8904/Thuat-Toan-ATTT | cau15.cpp | #include <iostream>
#include <math.h>
using namespace std;
bool check_snt(int a){
if(a<=1) return false;
if(a<=3) return true;
if(a%2 == 0 || a%3 == 0) return false;
for(int i=5;i*i<=a;i++){
if(a % i == 0 ) return false;
}
return true;
}
int main(){
int n;
cout << "Nhap n:";
cin >> n;
for... | ALGO | 0.999889 | 3.686589 |
ec126066-37ea-42a2-88ee-9edc38bffcaa | EddieMC-Dev/Estudos-CPP | funções e introdução à recursão/exercises/6_30.cpp | // Exercise 6.30: 6_30.cpp
// Obtendo números primos
// Autor: Edgard Mac Fadden
// Data: 22/03/2023
#include <iostream>
using std::cout;
using std::endl;
#include <cmath>
using std::sqrt;
bool checkPrimeNumber(int);
int main()
{
cout << "Números primos:" << endl;
for (int number = 2; number <= 10000; numbe... | ALGO | 0.999519 | 5.264202 |
9ce98755-3879-486d-804c-e2b32f2b9032 | NeoAnomaly/xray | 3rd party/MagicSoftware/FreeMagic/Source/Intersection3D/MgcIntr3DLinCap.cpp | #include "MgcDist3DLinLin.h"
#include "MgcIntr3DLinCap.h"
using namespace Mgc;
//----------------------------------------------------------------------------
bool Mgc::TestIntersection (const Segment3& rkSegment,
const Capsule& rkCapsule)
{
Real fSqrDist = SqrDistance(rkSegment,rkCapsule.Segment());
return... | ALGO | 0.983443 | 4.531229 |
140a053a-df1e-4f43-bffe-63a5f481609a | QWERx29/My-Codes-and-Docs_OLD | Study/15/01.cpp | #include<bits/stdc++.h>
using namespace std;
int n,m,a[10086];
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++) cin>>a[i];
a[0]=-1;
for(int i=1;i<=m;i++)
{
int x,mid,l=1,r=n;
cin>>x;
while(l<=r)
{
mid=(l+r)/2;
if(x<a[mid]) r=mid-1;
else l=mid+1;
}
cout<<a[r]<<endl;
}
return 0;
}
| ALGO | 0.999985 | 3.567782 |
0ff50ccd-8bc1-40b4-8994-dd83e644f4e7 | Mervhope144k/Cpp_Programming | Code_Examples/ch06/fig06_19/fig06_19.cpp | // Fig. 6.19: fig06_19.cpp
// inline function that calculates the volume of a cube.
#include <iostream>
using namespace std;
// Definition of inline function cube. Definition of function appears
// before function is called, so a function prototype is not required.
// First line of function definition acts as the pr... | ALGO | 0.862367 | 6.806444 |
9b0b318a-8a75-4569-9880-649e6d03bedc | Check-HazratALi/Contest-1- | Lucky Numbers.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin >> n ;
int a=n/10;
int b = n % 10;
if (b==0)
{
cout<<"YES";
}
else if (a%b==0 || b%a==0)
{
cout<<"YES";
}
else
{
cout<<"NO";
}
return 0;
} | ALGO | 0.999915 | 3.856318 |
60f5e393-03b0-4f02-b08e-70b453fdb212 | krishnashah122/DSA-Practice | 16. Sliding Window & Two Pointers/2. Medium Problems/Minimum-Size-Subarray-Sum.cpp | // Minimum Size Subarray Sum (Leetcode)
// Leetcode Link : https://leetcode.com/problems/minimum-size-subarray-sum/description/
// Time Complexity : O(n)
// Space Complexity : O(1)
class Solution {
public:
int minSubArrayLen(int target, vector<int>& nums) {
int minLen = INT_MAX;
int sum = 0;
... | ALGO | 0.999991 | 6.904533 |
cb11500e-c50c-44ff-a05a-8065a5805eab | muziing/CPP_Learning | Chapter_04_STL_容器/27_stack_基本概念与常用接口.cpp | #include <iostream>
#include <stack>
using namespace std;
// stack 基本概念
/*
stack先进后出(First In Last Out, FILO)的数据结构,只有一个出/入口
栈中只有顶端的元素才可以被外界使用,因此栈不允许有遍历行为
栈中进入数据 - 入栈 push
栈中弹出数据 - 出栈 pop
*/
// stack 常用接口
/*
构造函数
- stack<T> stk; //stack采用模板类实现,stack对象的默认构造形式
- stack(const stack &stk); // 拷贝构造函数
赋值操作
-... | ALGO | 0.969206 | 4.912908 |
4dbeb706-30c9-4c59-9193-2b968400da74 | Varun2851/DSA | Dynamic Programming/FrogJump2.cpp | #include<bits/stdc++.h>
using namespace std;
int frogJump2(vector<int>&stones , int i, int k){
//base case
if(i == 0){
return 0;
}
int cost = INT_MAX;
//Recursive case
for(int j = 1; j<=k; j++){
if(i-j >= 0){
cost = min(cost , abs(stones[i] - stones[i-j]) + frogJump2(stones , i-j , k));
}
}
retur... | ALGO | 0.999902 | 4.456062 |
0ac723b6-4e88-4b0b-b0a4-47df31fb5256 | FHead/PhysicsJetEnergyCorrection | MCTruthStudies/21512_StephanieCheck/CheckJEC.cpp | #include <iostream>
using namespace std;
#include "TH1D.h"
#include "TH2D.h"
#include "TLegend.h"
#include "CommandLine.h"
#include "PlotHelper3.h"
#include "SetStyle.h"
#include "JetCorrector.h"
int main(int argc, char *argv[]);
int main(int argc, char *argv[])
{
SetThesisStyle();
CommandLine CL(argc, argv... | DATA | 0.952456 | 4.981807 |
c986a22e-18b9-4886-a831-cb50b0b035e4 | ngthanhtrung23/CompetitiveProgramming | codeforces/100633/H.cpp |
#include <bits/stdc++.h>
#define int long long
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; ++i)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; --i)
#define REP(i,a) for(int i=0,_a=(a); i < _a; ++i)
#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR(A,n) { cout << #A << " = "; FOR(_,1,n) cout <... | ALGO | 0.999073 | 3.559701 |
66e50177-2586-4948-907d-b3f6a21aceb3 | RMohit927/Competitive_Coding | CodeForces/Cheap Travel.cpp |
/*
Solution by Rahul Surana
***********************************************************
Ann has recently started commuting by subway. We know that a one ride subway ticket costs a rubles. Besides, Ann found out that she can buy a special ticket for m rides (she can buy it several times). It costs b rub... | ALGO | 0.999792 | 3.79353 |
30d5ecb7-7950-4c7b-a313-0326f73ecc1f | qq82850696/Learning-Note | code/leetcode/top-interview-questions-easy_sorting_and_searching_52.cpp | /*
data-time 2019-10-02 19:58:56
题目描述:
合并两个有序数组
给定两个有序整数数组 nums1 和 nums2,将 nums2 合并到 nums1 中,使得 num1 成为一个有序数组。
说明:
初始化 nums1 和 nums2 的元素数量分别为 m 和 n。
你可以假设 nums1 有足够的空间(空间大小大于或等于 m + n)来保存 nums2 中的元素。
示例:
输入:
nums1 = [1,2,3,0,0,0], m = 3
nums2 = [2,5,6], n = 3
输出: [1,2,2,3,5,6]
链接:https://leetcode-cn.com/e... | ALGO | 0.999986 | 5.690132 |
c384e75c-7e28-41b1-a5b3-e04da6fb0a99 | Manik-Aggarwal/Codestudio | Merge Sort/merge-sort.cpp | void merge(vector<int> &arr, int s, int e){
int mid = s + (e-s)/2;
int len1 = mid - s + 1;
int len2 = e - mid;
int *first = new int[len1];
int *second = new int[len2];
int k = s;
for(int i=0; i<len1; i++) first[i] = arr[k++];
k = mid+1;
for(int i=0; i<len2; i++) second[i] = arr[k++... | ALGO | 0.999983 | 5.376983 |
62c96bea-c34c-4609-a75d-b1dcca73e399 | neko-deprecated/neko_frameworks_av | media/codecs/amrnb/dec/src/lsp_avg.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/lsp_avg.c
Functions:
Date: 04/14/2000
------------------------------------------------------------------------------
REVISION HISTORY
Description: Removed the functions lsp_avg_init and lsp_avg... | ALGO | 0.973928 | 6.647949 |
213b5962-c921-42ec-a3f1-b8084f987f71 | Krispy2009/learning_cpp | Chapter4/4.19.cpp | #include <iostream>
#include <vector>
int main()
{
int ival = 2;
int *ptr = &ival;
std::vector<int> vec = {0,1,2,3,4,5,6,7};
//(a) ptr != 0 && *ptr++)
//Checks if ptr is a null pointer, if not, it increments the pointer
// but dereferences the initial (unincremented) value.
// will print... | TOOL | 0.941361 | 3.836318 |
40ce4db4-d632-46ec-9b0a-cc484fba5db0 | raincross7/code-similarity | codes/train_code/problem028/problem028_194.cpp | #include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
const int MN = 200010;
int N;
int A[MN];
set<pii> st;
bool check(int x) {
st.clear();
for(int i = 1; i < N; i++) {
if(A[i - 1] < A[i]) {
continue;
}
else {
int pos = A[i];
whi... | ALGO | 0.999984 | 3.947014 |
41034bd6-7e32-45f6-b8e5-1891f2720123 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2466_23.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, a;
vector<int> v;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a;
v.push_back(a);
}
sort(v.begin(), v.end());
cout << v[n / 2];
return 0;
}
| ALGO | 0.999829 | 4.385767 |
c07a4b5c-a255-46b6-92bd-85be0b9fbad1 | kiraware/Learn-C-and-CPP | cpnp/exercise3.8.cpp | #include "help.h"
int main(){
int a;
string b;
cin >> a;
b = (a % 2 == 0) ? "Even" : "Odd";
cout << "The value " << a << " is an " << b << " number";
return 0;
} | ALGO | 0.997134 | 4.655209 |
768dd30f-3880-444e-95dc-3c4b917ea704 | wvu-navLab/Enabling-Robust-State-Estimation-through-Measurement-Error-Covariance-Adaptation | 3rdparty/RobustGNSS/gtsam/gtsam/slam/EssentialMatrixConstraint.cpp | /**
* @file EssentialMatrixConstraint.cpp
* @author Frank Dellaert
* @author Pablo Alcantarilla
* @date Jan 5, 2014
**/
#include <gtsam/slam/EssentialMatrixConstraint.h>
//#include <gtsam/linear/GaussianFactor.h>
//#include <gtsam/base/Testable.h>
#include <ostream>
namespace gtsam {
/* ***************... | ALGO | 0.995246 | 7.283412 |
07d82135-04ad-4ad9-a0d7-e7fd6ad95f13 | KUIxd/frameworks-av | media/codecs/amrnb/dec/src/d_gain_c.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/d_gain_c.c
Functions: d_gain_c
Date: 01/29/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated include files and intput/out... | ALGO | 0.998603 | 6.079532 |
83efb5e6-764f-4b27-88ef-2aa388b689cb | ishandutta2007/codeforces | fuppy/normal/1450/E.cpp | //*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//*/
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<"... | ALGO | 0.999949 | 4.099868 |
b1b17822-c391-42c8-a7ab-b8b696c1a826 | yxhuangCH/AndroidSourceCode | 6.1.0/frameworks/av/media/libstagefright/codecs/amrnb/enc/src/enc_lag3.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/enc_lag3.c
Functions:
Date: 01/28/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Replaced "int" and/or "char" with OSCL defin... | ALGO | 0.999674 | 7.262383 |
4c397be8-87d8-4ad6-91cb-5b9120bbf23e | heavenMOJANG/ICPC | programmes_C_Cpp/.history/Codeforces/CF2131/E_20250810232740.cpp | #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
void solve() {
int n; cin >> n;
vector<int> a(n), b(n);
for (auto && x : a) cin >> x;
for (auto && x : b) cin >> x;
if (a[n - 1] != b[n - 1]) { cout << "NO\n... | ALGO | 0.999986 | 4.336246 |
c450a860-82a5-4ea0-b4ea-87364186c035 | JJH-Log/BaekjoonOnlineJudgeSolvedList | 202109/9M1W/B6603.cpp | #include <iostream>
#include <vector>
#include <string> //substr
#include <map>
#include <queue>
#include <stack>
#include <utility> //pair
#include <algorithm> //sort, reverse
#include <math.h> // sqrt
#include <set>
#include <cassert>
#define MOD 1000000007
#define BOUND 1000000000000
#define MININT -2147483647
#def... | ALGO | 0.999869 | 4.670148 |
ee0f7d91-b0f1-4a53-92b6-b1e9c837b42a | lom360/AlgoTools | week2_algorithmic_warmup/5_fibonacci_number_again/fibonacci_huge1.cpp | #include <iostream>
const int MAXN = 2;
struct matrix {
long long mat[MAXN][MAXN];
matrix() { memset(mat, 0, sizeof mat); }
}
long long get_fibonacci_huge_naive(long long n, long long m) {
if (n <= 1)
return n;
long long previous = 0;
long long current = 1;
for (long long i = 0; i <... | ALGO | 0.99999 | 4.850599 |
3a1d831a-eaa8-414c-b051-c9f4f57f1153 | vss2sn/advent_of_code | 2022/cpp/day_24b.cpp | #include <algorithm>
#include <array>
#include <fstream>
#include <iostream>
#include <limits>
#include <queue>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <vector>
struct Storm {
Storm(const int period, const int offset) : period(period), offset(offset) {}
int period;
int... | ALGO | 0.999942 | 5.462784 |
a1fc674a-b4d9-46d2-9373-198ee5c3b804 | SHrEE-7/DSA_practice | Recursion/print_ascending_order.cpp | #include <iostream>
using namespace std;
// printing ascending order of given number
void dece(int n)
{
if (n == 0)
{
return;
}
dece(n - 1);
cout << n << " ";
}
int main()
{
int n;
cin >> n;
dece(n);
} | ALGO | 0.999761 | 4.920833 |
7ed3daa1-1293-45bc-a19d-308afb1ff804 | phitronio/Conceptual-Sessions-Code | Batch 7/C++/Week 1-2/Practice_problem_1_Advance.cpp | #include <iostream>
using namespace std;
class Student
{
public:
string name;
int roll;
char section;
int math_marks;
int cls;
};
int main()
{
int n;
cin >> n;
Student topper;
for (int i = 1; i <= n; i++)
{
Student tem;
cin >> tem.roll >> tem.name >> tem.section... | ALGO | 0.999584 | 3.748019 |
4c298867-57b0-4551-b2f6-a692cd6a3b17 | STARFALL088/CP | CodeForces/766A/56934060_AC_62ms_100kB.cpp | #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#include <bits/stdc++.h>
using namespace std;
// Type definitions
typedef long long ll;
typedef long long lli;
typedef long double lld;
typedef pair<int, int> pii;
typedef pair<lli, lli> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef... | ALGO | 0.999758 | 5.129491 |
1c437c53-000b-46fc-9ff1-3d6faaecf329 | Finn-HPI/ChargingParkPlacement | src/main.cpp | #include <bits/stdc++.h>
#include <routingkit/contraction_hierarchy.h>
#include <routingkit/inverse_vector.h>
#include <routingkit/osm_simple.h>
#include <routingkit/timer.h>
#include "../include/stringutil.h"
// thread pool library: https://github.com/bshoshany/thread-pool
#include "../include/thread_pool.hpp"
#includ... | ALGO | 0.993347 | 5.384787 |
93b92c99-034f-4cb0-8fb3-aca7fb1fb987 | Lucky-766/C-Codes | linked_list_1.cpp | #include<iostream>
using namespace std;
class node{
public:
int data;
node* next;
node(int val){
data=val;
next=NULL;
}
};
void insertAthead(node* &head,int val){
node* n=new node(val);
n->next=head;
head=n;
}
void insertAtTail(node* &head,int val){
node* n=new node(... | ALGO | 0.999857 | 4.417623 |
9c191b58-8d20-42dd-ba77-e63f6787a952 | Tahsin005/Leetcode | Leetcode daily challanges/183_number_of_recemt_calls.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
/*
https://leetcode.com/problems/number-of-recent-calls/description/?envType=study-plan-v2&envId=leetcode-75
*/
#include <vector>
class RecentCounter {
private:
std::vector<int> records;
int start;
public:
RecentCounter() : start(0) {}
... | ALGO | 0.993096 | 5.928326 |
09913d45-4fc8-46c1-a368-234f5ba93be8 | nicholasm112/cs135 | new C++/recursion.cpp | /*
Author: Nicholas Morgan
Course: CSCI-135
Instructor: Genady Maryash
Assignment: LAB 13
//part d
//
//
Write a program recursion.cpp, defining a function
void printRange(int left, int right);
that prints all numbers in range left ≤ x ≤ right, separated by spaces.
(Don’t use loops, global or static variables.)
*... | ALGO | 0.981109 | 4.570059 |
0a7702cb-c09e-42aa-9f33-59c905c1b21a | MuratBahadirEminoglu/Cpp-temel-seviye | 009.soru if else ile farklı rakamlar.cpp | /* Klavyeden girilen 4 basamaklı bir tamsayının ka farklı rakamdan oluştuğunu bulan C++ programı yazınız */
#include <iostream>
using namespace std;
int main()
{
int sayi,a,b,c,d;
cout << "sayiyi giriniz: ";
cin >> sayi;
a = sayi/1000;
b = (sayi/100)%10;
c= (sayi%100)/10;
d = sayi%10;
c... | ALGO | 0.997549 | 3.57952 |
7ca15d41-329c-423b-9c1f-2cfc8b39acf0 | fabiancrx/bricks | app_theme/__brick__/{{#createPlayground}}{{package_name.snakeCase()}}_playground{{/createPlayground}}/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.998847 | 6.785645 |
9a6bf1cd-8045-430a-bdcd-871405ed0525 | Sy0307/Self_Practice_For_Algorithm | NOJ/NOJ 组队11/F.cpp | #include <bits/stdc++.h>
using namespace std;
using ui = unsigned int;
using ull = unsigned long long;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int maxn = 1e5 + 10;
const int mod = 1000000007;
#define fr(i, a, b) for (int i = a; i <= b; i++)
#define ford(i, a, b) for (int i = a;... | ALGO | 0.999669 | 4.177374 |
eb32d129-4b80-4893-b4d1-8377b9beef3c | vedhkreddy/CompetitiveProgramming | Silver/Binary Search/a.cpp | /*
first, find all of the ones that already match and then add the n(n+1)/2 to the left and right of it
then go into the operations
only process the ones to the left of it, reverse, and then do it again
for the ones that are to the left of it, create a map, map stores the type
for each type in the map there is a vect... | ALGO | 0.999806 | 3.58727 |
121ec06c-785b-4fd3-b026-7f7e5e9b6cdd | overlast/private | programming_challenge/euler/level0/03-01.cpp | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include... | ALGO | 0.999924 | 4.427062 |
2a3fe27b-b296-48a8-93ab-6dd32fb50574 | YinXinLION/Cpp | practice/69.cpp | /*************************************************************************
> File Name: 69.cpp
> Author:YinXin
> Mail:<EMAIL>
> Created Time: 2016年03月25日 星期五 22时01分59秒
************************************************************************/
#include<iostream>
#include<string>
#include<vector>
using namespace s... | TOOL | 0.949941 | 4.297463 |
dbd68744-7c43-4602-a316-3174d48fa179 | YashwantXDX/DSA | Backtracking/Sudoku_Solver.cpp | #include<bits/stdc++.h>
using namespace std;
/*
Problem Link :- https://leetcode.com/problems/sudoku-solver/
Refer Video :- https://www.youtube.com/watch?v=EYM_lIVYJak&t=6953s
*/
bool check(int num, vector<vector<char>> &board, int &row, int &col){
char c = '0' + num;
// check row
// If the c... | ALGO | 0.999658 | 7.028709 |
d5e079e5-5b15-473d-bc9b-78f4d1d0d449 | C-2023-1-3/8209230214dy | 二、实验9.cpp | #include <iostream>
using namespace std;
int main()
{
float a = 2,day=1,money=0;
while (a <= 100) {
day++;
money += a * 0.8;
a *= 2;
}
cout << money / day << endl;
return 0;
}
| ALGO | 0.99933 | 3.260058 |
7251f43e-7961-4c81-abe1-dde5ee870d6c | Ashish-29/DSA-CP | Topic/Graph Theory/07BipartitegraphDFS.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mp make_pair
#define F fir... | ALGO | 0.999977 | 5.137635 |
e2e2149a-f1ea-4103-a052-ecd8e8de9520 | flvieyro/radproc | JetAGN/JetAGN/SSC.cpp | #include "SSC.h"
#include "processes.h"
#include <fluminosities\luminositySynchrotron.h>
#include <fluminosities\luminosityIC.h>
#include <fparameters\Dimension.h>
#include <fparameters\SpaceIterator.h>
#include <fparameters/parameters.h>
#include <fmath\physics.h>
#include <boost/property_tree/ptree.hpp>
double... | ALGO | 0.924916 | 3.911783 |
ff7dbb32-c2db-4296-ba98-b626e23a7284 | guduzhe777/Code-cpp | ACM/Acwing/PrefixAnd-Mid.cpp/Mid/789Mid.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int f[N];
int q, k;
int n;
bool checksl(int mid)
{
if (f[mid] >= k)
return true;
else
return false;
}
bool checksr(int mid)
{
if (f[mid] <= k)
return true;
else
return false;
}
int main()
{
scanf("%d ... | ALGO | 0.999992 | 3.774066 |
8ba9e8c9-ac54-49d6-8a26-d0ec932dfa26 | ishandutta2007/codeforces | wangziji/normal/1705/B.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
int a[200005];
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while(T--)
{
int n;
cin >> n;
for(int i=1;i<=n;i++)
cin >> a[i];
int ans=0,cnt=0;
for(int i=1;i<n;i++)
{
if(a[i]>1) cnt+=a[i]-1,a[i]=1;
... | ALGO | 0.999908 | 4.111826 |
d504a840-0f79-4c06-a271-f9d4e068bc17 | sdong2020/Predator-Game | Predator Game/Library/PackageCache/com.unity.ide.visualstudio@2.0.18/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.945182 | 6.933211 |
e17c7d80-2db0-4ad8-8206-0586dd6ec344 | Razdeep/Codeforces-Solutions | contests/Codeforces Round #567 Div 2/Split_a_number.cpp | // https://codeforces.com/contest/1181/problem/B
#include <bits/stdc++.h>
#define For(i, n) for (__typeof(i) i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define fatafat \
do \
{ ... | ALGO | 0.99999 | 5.258651 |
a359d09b-cdf2-4a4b-bcce-eec2972bcf9d | au-rimon/Problem-Solving | 3/S.cpp | #include<iostream>
using namespace std;
int main()
{
int T;
long long X,Y,i,j,sum;
cin>>T;
for(i=1;i<=T;i++)
{
cin>>X>>Y;
sum=0;
if(X>Y)
{
swap(X,Y);
}
for(j=X+1;j<Y;j++)
{
if(j%2!=0)
{
sum =... | ALGO | 0.999674 | 3.787649 |
9ea309e5-974d-432a-abb2-d834da8c6339 | nadimnesar/Online-Judges-Accepted-Solutions | UVA/10474/26479550_AC_400ms_0kB.cpp | /*BISMILLAHIR RAHMANIR RAHIM*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ins insert
#define all(x) x.begin(), x.end()
#define dot(x) fixed << setprecision(x)
#define fastIO ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)... | ALGO | 0.999504 | 4.184323 |
5681065f-559d-4f79-9609-8a49e7c08cff | arrozet/Primero | 1cuatri/F_programacion/practicas/tema4/P1T4/p1t4-2-media_altos_bajos.cpp | #include <iostream>
#include <array>
using namespace std;
const int MAX = 50;
typedef array<int, MAX> TArray;
struct TEstaturas{
TArray estaturas;
int tam;
};
void leer(TEstaturas& a){
cout << "Cuantas estaturas va a introducir (maximo " << MAX << "): ";
cin >> a.tam;
cout << "Introduzca las " << ... | TOOL | 0.98307 | 3.917129 |
09673fd6-f6fa-4c96-9235-f6def71fe80f | PikaGu/ICPC_So_Funny | SPOJ_DQUERY.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#define LL long long
#define INF 0x3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl;
using namespace std;
const int mx = 2e6+7;
int a[mx];
int vis[mx], num[mx];
int n, sz, ans = 0;
struct node{
... | ALGO | 0.999843 | 4.024372 |
2eef3004-b1a6-4c8f-a7c2-107795ee1cd3 | DinhHellcat/C | C++/Algorithm/80-matrix odd row sum.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int x,y,sum=0;
cin>>x>>y;
int a[x][y];
for(int i=0;i<x;i++)
for(int j=0;j<y;j++)
cin>>a[i][j];
for(int i=1;i<x;i+=2)
for(int j=0;j<y;j++)
sum+=a[i][j];
cout<<sum;
}
| ALGO | 0.999913 | 3.30207 |
8dd68f9d-5fc6-42e1-a2c6-1f7f1c2d3257 | Quynh181226/Ctdl-gt_Ptit | DSA_PTIT/Ptit/traoDoi/Danhsodaungoac.cpp | #include<bits/stdc++.h>
using namespace std;
main(){
int t; cin >> t;
cin.ignore();
while(t--){
string s; getline(cin,s);
int dem = 1;
stack<int> st;
for(int i=0;i<s.length();i++){
if(s[i]=='('){
st.push(dem);
cout << st.top() << " ";
dem++;
}
else if(s[i]==')'){
cout << st.top() << ... | ALGO | 0.999713 | 3.796034 |
57eaa610-f6f6-41f1-a3bf-f5ad25b80391 | PhillipDiCarlo/The-Corruptor | ASRC Systems Simulation Driver/boost_1_74_0/libs/spirit/classic/phoenix/example/fundamental/sample4.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include <boost/spirit/include/phoenix1_operators.hpp>
#include <boost/spirit/include/phoenix1_primitives.hpp>
#include <boost/spirit/include/phoenix1_statements.hpp>
#include <boost/spirit/include/phoenix1_special_ops.hpp>
using namespace std;
using namespace... | TOOL | 0.914094 | 4.742697 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.