uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
aac554f8-60c8-4f65-b810-4bccae3045e6 | aboeuf/AdventOfCode | 2021/puzzle_2021_12.cpp | #include <2021/puzzle_2021_12.h>
#include <common.h>
#include <QSet>
#include <QMap>
bool isSmall(const QString& label)
{
return std::all_of(std::begin(label),
std::end(label),
[](const auto& chr) { return chr.isLower(); });
}
struct Node
{
Node(const QString& label) : m_... | ALGO | 0.998226 | 5.586579 |
b5080f4a-5676-416c-9b5c-4541204a2009 | MrMiner-org/TheMinerzCoin-Pool-Source | src/wallet/crypter.cpp | #include "crypter.h"
#include "crypto/aes.h"
#include "crypto/sha512.h"
#include "script/script.h"
#include "script/standard.h"
#include "util.h"
#include <string>
#include <vector>
#include <boost/foreach.hpp>
int CCrypter::BytesToKeySHA512AES(const std::vector<unsigned char>& chSalt, const SecureString& strKeyData... | TOOL | 0.90652 | 7.568019 |
f2a1952f-1d1d-474d-b58a-479e7043130b | CandiceAriel/kohi_bloc | 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 |
44b1b0e6-4940-46d6-a2e5-bb6bbfbff1f1 | KratosMultiphysics/KratosLegacyApplications | RadiationApplication/custom_elements/radiation_2d.cpp | // Project includes
#include "includes/define.h"
#include "custom_elements/radiation_2d.h"
#include "radiation_application.h"
#include "includes/radiation_settings.h"
#include "utilities/math_utils.h"
#include "utilities/geometry_utilities.h"
#define P1
namespace Kratos
{
//***************************************... | ALGO | 0.999774 | 5.374972 |
e2c06b20-bb18-4bc1-ba62-9f8af6892e96 | suseyang/TreeTraversalNoRecursion | TreeTraversalNoRecursion/TreeTraversalNoRecursion.cpp | #include <iostream>
#include <stack>
#include "TreeTraversalNoRecursion.h"
using namespace std;
// Iterative function for inorder tree traversal
void inOrder(TreeNode* root)
{
// Set current to root of binary tree.
TreeNode* current = root;
std::stack<TreeNode*> nodeStack;
//StackNode* stack = null;
bool done =... | ALGO | 0.999927 | 4.797705 |
68d762af-606b-44bc-97d6-e5e86965ae7e | cielavenir/procon | tyama_icpc2010rpA(HNU12242-aizu2242).cpp | #include <vector>
#include <string>
#include <iostream>
using namespace std;
main(){int N,Q,i,x,y;string s;for(;cin>>N>>Q,N;){
vector<pair<int,pair<int,string> > >v;
for(i=0;i<N;i++)cin>>s>>x>>y,v.push_back(make_pair(y-x,make_pair(y,s)));
for(i=0;i<Q;y<N?cout<<v[y].second.second<<' '<<x-v[y].first<<endl:cout<<"Unkno... | ALGO | 0.997146 | 3.239511 |
ecfaf09d-615a-4c20-a15a-fd157ea844b4 | pratishtha-gupta/leetcode | 2249-count-the-hidden-sequences/2249-count-the-hidden-sequences.cpp | class Solution {
public:
int numberOfArrays(vector<int>& differences, int lower, int upper) {
int x = 0, y = 0, cur = 0;
for (int d : differences) {
cur += d;
x = min(x, cur);
y = max(y, cur);
if (y - x > upper - lower) {
return 0;
... | ALGO | 0.999849 | 5.656824 |
cb43b9cc-cab0-4462-856a-a39040e3ba48 | ZephyrZhng/code_win | data structure/3 栈和队列/括号匹配的检验(三种括号).cpp | #include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <string>
#include <stack>
#include <numeric>
#include <iterator>
#include <algorithm>
using namespace std;
#define left true
#define right false
bool direction(char c)
{
if(c == '(' || c == '[' || c == '{') return left;
if(c == ')'... | ALGO | 0.943656 | 3.853637 |
d63d656b-0ec3-4892-8b61-c91d722761c4 | watashi/AlgoSolution | zoj/30/3080.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
const int inf = 123456789;
bool mark[1024];
int n, d[1024], mp[1024][1024];
int m, v[128], e[128][128];
void floyd(int m)
{
for (int k = 0; k < m; k++) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
e[... | ALGO | 0.999973 | 3.704591 |
8f6b938e-ecf0-4923-8ed6-d4aee510c274 | thejackle/Smart-AC | packages/framework-arduinoteensy@1.155.0/libraries/FastLED/noise.cpp | #define FASTLED_INTERNAL
#include "FastLED.h"
#include <string.h>
FASTLED_NAMESPACE_BEGIN
#define P(x) FL_PGM_READ_BYTE_NEAR(p + x)
FL_PROGMEM static uint8_t const p[] = { 151,160,137,91,90,15,
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
190, 6,148,247,120,234,75,0,26,197,62,94... | ALGO | 0.975097 | 6.316689 |
43379d60-d925-4a1f-96dd-c30cedafdbf5 | iNiKe/clipper | cpp/cpp_console/File1.cpp | //---------------------------------------------------------------------------
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include "clipper.hpp"
//-------------------------------... | TOOL | 0.978019 | 5.204399 |
4bc05b0f-a6cb-4440-a37e-1746db34de10 | bfdyoy/CodeForces | 1300Dif/821B/main.cpp | #include <iostream>
using namespace std;
int main()
{
long long int m,b,s=0,x;
cin>>m>>b;
for(int i=0; i<=b; i++)
{
x=(b-i)*m;
s=max(s,((i+1)*(x+1)*(i+x))/2);
}
cout<<s;
return 0;
}
| ALGO | 0.999785 | 3.601756 |
5c05b1a1-5797-445b-a254-3512de0a1f76 | ishandutta2007/codeforces | -skyline-/normal/264/C.cpp | //Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<c... | ALGO | 0.999683 | 4.019767 |
f4f48665-328d-469f-adab-21e89b3c3446 | swathiramesh24/Hackerrank_GeeksforGeeks_2025_cpp | g_vowel.cpp | /*
Input:
c = 'a'
Output:
YES
Explanation:
'a' is a vowel.
*/
//solution 1
class Solution {
public:
string isVowel(char c) {
char l = tolower(c);
if(l=='a'||l=='e'||l=='i'||l=='o'||l=='u')
{
return "YES";
}
return "NO";
}
};
//so... | ALGO | 0.999655 | 5.792567 |
9fdd9bce-b820-499c-8ae4-b99251f7f2b9 | VincentXWD/algorithm | HIHO/hiho1249.cpp | #include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cma... | ALGO | 0.999785 | 3.281573 |
e75abdfc-8bcb-4e50-9e1c-cd00e4bbc4e4 | knuu/competitive-programming | codeforces/cdf343_2c.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x... | ALGO | 0.999979 | 4.086866 |
33f73188-8819-4729-a3d4-0648e456c3b2 | zstuACM22/ICPC-useful-template | 字符串/SA.cpp | // Jamhus Tao / GreatLiangpi
// Start at 2022/10/6
// Please using int32_t and int64_t to replace the int and long long.
#include <bits/stdc++.h>
#define int int64_t
#define endl '\n'
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
// 后缀数组 (SA, SuffixArray)
// 时间: O(nlogn) (基数排序)
const int MAX = 100005... | ALGO | 0.999912 | 4.715627 |
f2ac21ad-f5be-48af-91f2-841c6551df3e | Victoriurki/PostPlusApp | postplus_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998684 | 6.797273 |
b90f8ddb-c9f9-4387-bc1d-ca7b7f14bb8d | danialchoo79/C---Beginner_to_Advanced | Section 11 - Functions/05-function-parameters.cpp | /*
==========================================================
Description:Basic usage of function parameters.
Compiler: gcc
Author: Danial Choo
==========================================================
*/
/*
Note:
Main idea - Call by Value creates local copies of variable.
Anything in the main will not ... | TOOL | 0.974969 | 5.855225 |
51326fdd-6aaf-4241-8bc1-2f32a71da0ff | gab-borges/codeforces | problems/2009B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vi A(n);
for (int i = 0; i < n; i++) {
string s;
cin >> s;
for (int j = 0; j < 4; j++) {
... | ALGO | 0.999522 | 4.101241 |
fb42b29e-86fd-4a83-81e8-aae2be1246a7 | yindaz/pbrs | mitsuba-af602c6fd98a/src/libcore/random.cpp | #include <mitsuba/core/random.h>
#include <mitsuba/core/fstream.h>
#if MTS_SSE
# define MTS_SFMT_SSE 1
#else
# define MTS_SFMT_SSE 0
#endif
#if MTS_SFMT_SSE
# include <mitsuba/core/sse.h>
#endif
#include <limits>
/************************ SFMT-19937 Parameters *******************************/
/* Mersenne Exponent.... | TOOL | 0.966444 | 6.659428 |
b8b396ab-c71d-47ee-a3e9-910ed16e1322 | nitesh098suthar/code | stack.cpp | #include<iostream>
#include<stack>
using namespace std;
int main()
{
stack<int> v1;
v1.push(23);
v1.push(24);
v1.push(25);
while(!v1.empty())
{
int top =v1.top();
cout<<top<<endl;
v1.pop();
}
return 0;
} | ALGO | 0.999093 | 3.842888 |
0a27ead0-4949-4ffb-be79-f3798d62ab2d | anthonybazelle/OBJLoader_OpenGL | OpenGL/ObjetBasique3D/Math.cpp | #include "Math.h"
bool Math::isPointVisible(maths::Point polPoint, maths::Point winPoint, maths::Point n)
{
return ((n.x*(polPoint.x - winPoint.x) + n.y*(polPoint.y - winPoint.y))>=-0.001);
}
maths::Point Math::getIntersection(maths::Point p1, maths::Point p2, maths::Point p3, maths::Point p4)
{
maths::Point p;
f... | ALGO | 0.996007 | 4.482565 |
af87f79e-068d-4d9e-8ce4-00044f05519d | Nishant-Bhosale/Competitive-Programming-CPP | CodeForces_Problems/EasyMathProblems/MagicStick.cpp | #include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vii vector<int,int>
#define rep(a,b) for(int i = a;i<b;i++)
#define pi pair<int,int>
typedef long long ll;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int t;
cin>>t;
while(t--){
ll x, y;
... | ALGO | 0.999684 | 3.911788 |
e11abdd6-5d9c-4c98-bdc2-e508729ed9c9 | rohitpoks/competitive-programming | CP Problems/cf1931f.cpp | #include <stdio.h>
#include <iostream>
#include <list>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <climits>
using ll = long long;
using namespace std;
bool dfs(vector<set<int> >& graph, int cur, vector<int>& color) {
// cycle dete... | ALGO | 0.999967 | 4.267879 |
d7908206-3153-42be-bba7-25b56ff1cd25 | KhoiBui16/Fullhouse_Code_Online | C++/Source code/Buoi_13/Bai03_MangSo012.cpp | /*
C++ Buổi 13_Bài 03.Mảng số 012
Cho dãy số A[] gồm có N phần tử, các phần tử trong mảng chỉ là 0 1 hoặc 2. Hãy sắp xếp các phần tử trong mảng theo thứ tự tăng dần.
Dữ liệu vào:
Dòng đầu tiên là số nguyên N. Dòng tiếp theo gồm N số nguyên A[i].(1≤ N ≤ 10^7; 0 ≤ A[i] ≤ 2)
Dữ liệu ra:
In ra mản... | ALGO | 0.999985 | 5.178209 |
1799bb75-d19c-45d9-8985-ad8e5e49ee2e | asad14053/Algorithm-and-Data-Structure-for-Contest | Minimum Window Characters.cpp | #include<bits/stdc++.h>
#define DIST(x1,x2, y1, y2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)))
#define DIST3D(x1,x2, y1, y2, z1, z2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)) + ((z1-z2)*(z1-z2)))
#define CLR(a) a.clear()
#define VCLR(a, n) for(int i=0; i<=n+3; i++) a[i].clear()
#define SIZE(a) a.size()
#define ERASE(a, b) memset... | ALGO | 0.999976 | 3.829646 |
423e6dff-ffd3-4361-8259-9fe8f457f2c1 | jnkUHaFnir/human-vs-ai | 5-1_specific-119/specific-119_292.cpp | // main.c
#include <pthread.h>
#include <iostream>
#include "matmul.h"
using namespace std;
int main(int argc, char* argv[])
{
pthread_t* thread;
int i;
if (argc != 2)
{
cout << "Usage: " << argv[0] << " number_of_threads" << endl;
exit(-1);
}
num_thrd = atoi(argv[1]);
init_... | ALGO | 0.971353 | 3.942633 |
db20f75a-ce48-4883-ba24-c947737d1be6 | alexandraback/datacollection | solutions_5639104758808576_0/C++/AK93/test.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <hash_map>
using namespace std;
typedef long long ll;
int ... | ALGO | 0.999053 | 3.767501 |
f9ce15b1-25bb-43d6-88b8-73d0727fa877 | AryanTapre/DSA | 01_Arrays/19_move_negatives_left.cpp | // move all Negatives values towards left, Order does not matter!.
#include<vector>
#include<iostream>
using namespace std;
void move_negatives_left(vector<int>& arr) {
int start = 0;
int end = arr.size() - 1;
while(start < end) {
while(arr[start] < 0) {
start++;
}
whi... | ALGO | 0.99997 | 4.70209 |
4cbe68da-9c52-4d19-b5dc-8754a7d34f83 | prrateekk/SPOJ | ADSPROP.cpp | #include <bits/stdc++.h>
#define MAX 1000001
#define M 1000000007
#define ll long long
#define ld long double
#define ESP 0.0001
using namespace std;
int main() {
int t;
int cs = 1;
scanf("%d",&t);
while(t--) {
printf("Case #%d: \n", cs++);
ll n, m, q;
scanf("%lld%lld%lld", &n, &m, &q);
vector< pair<ll,ll ... | ALGO | 0.999801 | 3.68443 |
b82619ad-e91a-4409-8ffc-dfdf85fae0df | DelioCoder/My-first-Flutter-app | first_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998491 | 6.763549 |
48446eb8-af44-4c59-addc-20f2d1e38d48 | miish12324008/cpp_patterns_basic_to_advance | pattern3.cpp | // 1 2 3
// 4 5 6
// 7 8 9
#include<iostream>
using namespace std;
void pattern(int n){
int i = 1;
int count = 1;
while(i <= n){
int j = 1;
while(j <= n){
cout<<count<<" ";
count+=1;
j+=1;
}
cout<<endl;
i+=1;
}
}
int main(... | ALGO | 0.99996 | 3.915555 |
30e31246-4921-46a5-a96a-71ba0fa9934e | kavyasantha22/DP-progress | knapsack/topDown/7bv2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, k;
vector<pair<int, int>> batus;
vector<vector<int>> memo;
int solve(int i, int c){
if (i == 0 || c == 0) return 0;
else if (memo[i][c] != -1) return memo[i][c];
int best = solve(i-1, c);
if (c >= batus[i].first){
best ... | ALGO | 0.999981 | 3.389914 |
e7b74190-c9ec-4bd7-a971-84d66fdc35a4 | samratde/Bunch-of-Algos | lca_code.cpp | # include <vector>
using namespace std;
const int N = 100001;
const int H = 14;
vector<int> child[N];
int dp[N][H];
int depth[N];
void dfs(int u) {
for (int v : child[u]) {
dp[v][0] = u;
depth[v] = depth[u] + 1;
for (int j = 1; j < H; j++) {
dp[v][j] = dp[dp[v][j - 1]][j - 1];
}
dfs(v);
... | ALGO | 0.999877 | 4.18858 |
8a4ddd7c-9aeb-449a-86a5-caa534d5bbfc | Sandeep-Varma/CS6004-A4 | metrics/openj9-openjdk-jdk8/omr/compiler/x/codegen/SubtractAnalyser.cpp | #include "x/codegen/SubtractAnalyser.hpp"
#include <stdint.h>
#include "codegen/Analyser.hpp"
#include "codegen/CodeGenerator.hpp"
#include "codegen/MemoryReference.hpp"
#include "codegen/Register.hpp"
#include "codegen/RegisterConstants.hpp"
#include "codegen/RegisterPair.hpp"
#include "codegen/TreeEvaluator.hpp"
#in... | TOOL | 0.915468 | 7.489056 |
ae8948be-b962-4796-af49-3e86175bfd86 | Wogwan/CCTA2022_SafeRL | DDPG-TF2/toolbox/gpml/util/lbfgsb/program.cpp | #include "program.h"
#include <string.h>
// Function definitions.
// -----------------------------------------------------------------
// Copy a C-style string (a null-terminated character array) to a
// non-C-style string (a simple character array). The length of the
// destination character array is given by "ndest"... | ALGO | 0.982689 | 6.337531 |
1a97992f-067a-4ad6-950b-19d838825b8a | rubayet-ashib/XPSC | Week 1/Day 3/A_Biscuit_Generator.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b, t;
cin >> a >> b >> t;
float x = (t + 0.5) / a;
cout << floor(x) * b;
return 0;
} | ALGO | 0.99972 | 3.594318 |
776e2e11-3d5b-4c28-a427-9c424220e3eb | cantansweratthemoment/contest-solutions | DP/backpack.cpp | /**
* Дано n предметов массой m1, ..., mn и стоимостью c1, ..., cn соответственно.
* Ими наполняют рюкзак, который выдерживает вес не более m. Определите набор предметов, который можно унести в рюкзаке, имеющий наибольшую стоимость.
*/
#include <bits/stdc++.h>
using namespace std;
#define meow ios::sync_with_stdi... | ALGO | 0.999998 | 3.624336 |
746f69c4-c46b-4304-9a0e-fd8db7cffaf7 | ucoruh/cryptopp-test-application | cryptopp850/rng.cpp | // rng.cpp - originally written and placed in the public domain by Wei Dai
#include "pch.h"
#include "rng.h"
#include "fips140.h"
#include <time.h>
#include <math.h>
NAMESPACE_BEGIN(CryptoPP)
// linear congruential generator
// originally by William S. England
// do not use for cryptographic purposes
/*
** Origi... | TOOL | 0.988038 | 6.926679 |
f3e14181-cb49-4ded-81dd-c9ebf7cdb03f | Jashimjnn/CppProject | phitron1.cpp/Algorithm/Week1day1/K_Word_Game.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Y cout << "YES" << endl;
#define N cout << "NO" << endl;
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
string str[3][n];
map<string,ll>mp;
for(int i=0;i<3;i++)
... | ALGO | 0.999806 | 3.626071 |
9fe3b5cb-d9c9-4a2b-b174-5efb89186d10 | namnguyen16082008/VNOJ | hspc14j.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
const ll N=1005;
ll n,k,x,i,a[N];
void Solve(){
x=0;i=2;
for (ll j=1;j<=n;j++) a[j]=1;
while (i<=n){
while (a[i]==0) i++;
for (ll j=i;j<=n;j+=i)
if (a[j]==1){
x++;
if (x==k){
... | ALGO | 0.999966 | 3.574357 |
86a52436-48e8-40ad-b0f1-febdc49be10f | wangxy2180/languageLearn | CPP/passByRef.cpp | #include <iostream>
#include<iosfwd>
using namespace std;
class MyBase
{
private:
public:
MyBase() {}
~MyBase() {}
virtual void print_info() const
{
cout << "MyBase" << endl;
;
}
};
class Derived : public MyBase
{
public:
Derived() {}
~Derived() {}
void print_info()... | TOOL | 0.906936 | 5.592304 |
0da66793-a45c-4f22-ade5-35d2594a4aaf | zhy2on/practice-algorithm | BaaarkingDog/1st/0x08/9012.cpp | #include <iostream>
#include <stack>
using namespace std;
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
while (n--) {
string str;
stack<char> s;
bool flag = true;
cin >> str;
for (auto c : str) {
if (c == '(') s.push(c);
else if (c == ')') {
if (s.empty()) flag =... | ALGO | 0.999932 | 5.040325 |
e641735d-a5f7-43d6-84d1-003763c10203 | samuel21119/Cpp | CodeForces/contest/1312/a.cpp | /*************************************************************************
> File Name: a.cpp
> Author: Samuel
> Mail: <EMAIL>
> Created Time: Tue Mar 10 14:22:54 2020
*************************************************************************/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios:... | ALGO | 0.999509 | 5.657561 |
fab7cef0-f5b1-4efd-bf19-10929e1e24d5 | harsh70568/Daily_Problems_Solution | 0236-lowest-common-ancestor-of-a-binary-tree/0236-lowest-common-ancestor-of-a-binary-tree.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:
TreeNode* solve(TreeNode* root, TreeNode* p, TreeNode* q)
{
if(root == NULL) return... | ALGO | 0.999987 | 6.19907 |
8b8a2b9e-e7fc-4520-9aff-a78e52d01eec | shoulderhu/onlinejudge | categories/uva/UVa 280 - Vertex.cpp | #include <cstring>
#include <iostream>
#include <vector>
using namespace std;
int n, i, j, integer, vertex, counter;
bool accessible[101];
vector<int> edge[101];
void DFS(int v) {
int size = edge[v].size(), end;
for (int k = 0; k < size; ++k) {
end = edge[v][k];
if (accessible[end] == false) {
accessib... | ALGO | 0.999892 | 4.509607 |
63fadc98-77a4-4066-8cd3-f374ba3f28a3 | abhishekkargeti1/C- | factorial.cpp | #include <iostream>
using namespace std;
int main()
{
int n,f=1;
cin>>n;
for(int i=1; i<=n; i++)
{
f = f*i;
}
cout<<f<<endl;
} | ALGO | 0.999984 | 4.384986 |
669c92be-bb9c-44e2-87ed-0c2199f0f2e9 | rijulsharma7/problemsolving | atcoder/atCoderCondominium.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using mi = map<int, int>;
using ml = map<ll, ll>;
using umi = unordered_map<int, int>;
using uml = unordered_map<ll, ll>;
using pi = pair<int, int>;
using... | ALGO | 0.998969 | 3.465198 |
c950c98c-e2dd-4959-abcf-1fde3abcecfc | kirito6518/Stardew-Valley | StardewValley/cocos2d/cocos/math/CCVertex.cpp | #include "math/CCVertex.h"
#include "base/ccMacros.h"
NS_CC_BEGIN
void ccVertexLineToPolygon(Vec2 *points, float stroke, Vec2 *vertices, unsigned int offset, unsigned int nuPoints)
{
nuPoints += offset;
if(nuPoints<=1) return;
stroke *= 0.5f;
unsigned int idx;
unsigned int nuPointsMinus = nuPoin... | ALGO | 0.989828 | 5.843 |
13dd48cf-01cf-4480-bcb6-f67d7b74f0c7 | atharvabhide/DSA | 09-Linked List/04_insert_in_middle_of_linked_list.cpp | Node* insertInMiddle(Node* head, int x)
{
int mid;
int length = 0;
Node* temp = head;
while (temp != NULL)
{
length++;
temp = temp->next;
}
if (length % 2 == 0)
{
mid = (length/2)-1;
}
else
{
mid = length/2;
}
int count = 0;
temp = head;
while (count != mid)
{
temp = temp->next;... | ALGO | 0.999983 | 4.425644 |
0bb36c56-321c-46db-8a7e-1dc2656761d7 | diohabara/competitive_programming | ac/prev/abc142_d.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;
const ll len = 1e6 + 10;
bool is_prime[len];
ll ans = 0;
ll A, B;
int Er... | ALGO | 0.999949 | 4.795305 |
5a5aeb1a-4e25-49cf-a2bb-ead216aff96b | istvans/sandbox | cpp/sandbox.cpp | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#define TEST_CASE() 4
#if TEST_CASE() == 1
template <class T>
void bar(T&& x)
{
std::cou... | ALGO | 0.988151 | 5.687889 |
42fced2b-760c-41d7-bf02-a5340338e10e | anzaika/guidance | libs/phylogeny/pairwiseGammaDistance.cpp | // $Id: pairwiseGammaDistance.cpp 962 2006-11-07 15:13:34Z privmane $
#include "pairwiseGammaDistance.h"
#include "numRec.h"
#include "countTableComponent.h"
#include "likeDist.h"
#include "uniDistribution.h"
#include <cmath>
// Local utility functions
MDOUBLE pairwiseGammaDistance::giveInitialGuessOfDistance(
co... | ALGO | 0.999797 | 6.575669 |
64c8e310-dcee-4d36-ab25-c13da69f4817 | ishandutta2007/codeforces | yhchang3/normal/372/A.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
int a[5000001];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
int l=0,r=n/2;
int ans=n;
while(l<n/2&&r<n){
if(a[r]<2*a[l])
r++;
else{
ans--;
... | ALGO | 0.999811 | 3.655892 |
372142f6-234f-4ef5-ab5c-ed3d9c44d80e | ishandutta2007/codeforces | latte0119/normal/631/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define pb push_back
#define fi first
#define se second;
#define all(v) (v).begin(),(v).end()
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>v... | ALGO | 0.999979 | 3.250573 |
61df9f5a-7745-4cd9-b903-577a4afcdad1 | pawanbamne/compiler-design-2021 | symbol table.cpp | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct table
{
char var[10];
int value;
};
struct table tbl[20];
int i,j,n;
void create();
void modify();
int search(char variable[],int n);
void insert();
void display();
int main()
{
int ch,result=0;
char v[10];
do
{
printf("Enter ur choice:\n... | ALGO | 0.992705 | 3.083179 |
19b72636-7ad2-4452-a73b-1c5af7a779ed | ParianshMahajan/DSA | Recursions/5_LinearSearch.cpp | #include<bits/stdc++.h>
using namespace std;
int srch(int *arr,int n,int key){
if(n<=0){
return -1;
}
if(arr[n-1]==key){
return n;
}
return srch(arr,n-1,key);
}
int main(){
int key;
cin>>key;
int arr[5]={0,1,3,4,5};
int ans=srch(arr,5,key);
if(a... | ALGO | 0.999961 | 4.612207 |
967b6e5c-28ff-41ce-af08-c88e983ebec8 | artvit/practice | find_duplicates.cpp | #include <unistd.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <semaphore.h>
#include "synchronizing.h"
#include "compare_files.h"
int FindFileDuplicates(char* file, char* dirpath)
{
DIR *dir;
struct diren... | TOOL | 0.962213 | 3.695214 |
3c066076-f89a-48e6-9d3b-7e7fb5de48ea | Abdullah-Asif/Codeforces | CodeForces/CF-1471C.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
typedef long long ll;
int main() {
IOS
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;
vector<... | ALGO | 0.999957 | 3.335979 |
a1b68b05-1166-4a2a-a71b-88fc91b51801 | icgrp/ese532_code | vitis_tutorials/streaming_k2k_mm/krnl_stream_vmult.cpp | #include "ap_axi_sdata.h"
#include "ap_int.h"
#include "hls_stream.h"
#define DWIDTH 32
typedef ap_axiu<DWIDTH, 0, 0, 0> pkt;
extern "C" {
void krnl_stream_vmult(int *in1, // Read-Only Vector 1
hls::stream<pkt> &in2, // Internal Stream
int *out, // Output Result
int size ... | TOOL | 0.995371 | 4.465894 |
bc5fb652-80e9-4fea-adf5-5485c2506250 | Skywt2003/hnu-homework | summerTraining/hw3/6.cpp | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<map>
using namespace std;
// #define int long long
inline int read(){
int ret=0,f=1; char ch=getchar();
while (ch<'0'||ch>'9') {if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9... | ALGO | 0.996077 | 3.300985 |
8007880c-62da-41f4-b019-37484e5e58db | Apurba94/10-Years-of_Competitive-Programming-Resources-Collection | Codechef/May Long Contest/DIGFORST.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
struct node{
int pos,rem,mask,dist;
node(){}
node(int _pos, int _rem, int _mask, int _dist) :
pos(_pos), rem(_rem), mask(_mask), dist(_dist){}
bool operator < (node X)const{
r... | ALGO | 0.999938 | 3.951795 |
344ddf7b-8bff-4f8d-a05f-3c80ed3f9807 | emiliantabara/info-level-2 | lesson_17/tema_02/main.cpp | #include <iostream>
#include <fstream>
// https://www.nerdarena.ro/problema/monsters
using namespace std;
int main() {
ifstream fin("monsters.in");
ofstream fout("monsters.out");
unsigned long long c;
fin >> c;
int nr_final = 0; // 2^18 = 262,144
int exp = 1;
short cifra;
while (c ... | ALGO | 0.999712 | 4.377279 |
7f539b22-5877-4cd5-b3b5-3fb2e9eb27f6 | Kay-Rick/Algorithm | 二分查找/33.搜索旋转排序数组.cpp | /*
* @Author: <EMAIL>
* @Date: 2020-05-24 10:01:47
* @LastEditors: <EMAIL>
* @LastEditTime: 2020-05-24 16:00:52
* @Description: 二分查找
*/
/*
* @lc app=leetcode.cn id=33 lang=cpp
*
* [33] 搜索旋转排序数组
*
* https://leetcode-cn.com/problems/search-in-rotated-sorted-array/description/
*
* algorithms
* Medium (37.9... | ALGO | 0.999974 | 6.123102 |
600637f1-1167-44a1-a293-f0cbe2963287 | BlerimShabani/CplusplusLC | reverseInteger.cpp | /*Given a signed 32-bit integer x, return x with its digits reversed. If
reversing x causes the value to go outside the signed 32-bit integer range
[-231, 231 - 1], then return 0.
Assume the environment does not allow you to store 64-bit integers (signed or
unsigned).
Example 1:
Input: x = 123
Output: 321
Example 2:... | ALGO | 0.999953 | 7.005422 |
63723df2-89c8-428c-8af0-f719f37fad51 | anqixxx/robotsummer | src/Encoders.cpp | #include <Arduino.h>
#include "Encoders.h"
#include "hardware_def.h"
volatile byte aFlagLeft = 0; //pinA signal that the encoder has arrived at a detent
volatile byte bFlagLeft = 0; //pinB signal that the encoder has arrived at a detent (opposite direction to when aFlag is set)
volatile int encoderPosLeft = 0; //curr... | TOOL | 0.94631 | 5.337811 |
2a477e1c-2bdf-4fc8-bca2-20f7b0aa633d | fandan-nyc/leetcode | cpp/231PowerOfTwo.cpp | /*
File Name: 231PowerOfTwo.cpp
Xiaolong Zhang
Question:
Given an integer, write a function to
determine if it is a power of two.
++++++++++++++++++++++++++++++++++
Solution:
Only the highest bit will be 1 if a number
is power of two. So, check if only the highest
bit of targe... | ALGO | 0.997927 | 6.664899 |
c6a7c085-1972-49aa-ae42-86939ea7a1c5 | AndySomogyi/chombo | versions/3.0/example/AMRPoisson/src/LevelCCProjector.cpp | #ifdef CH_LANG_CC
#endif
#include "LevelCCProjector.H"
#include "QuadCFInterp.H"
#include "CCProjectorF_F.H"
/***/
void
LevelCCProjector::
divergence(LevelData<FArrayBox>& a_divergence,
LevelData<FArrayBox>& a_velocity,
LevelData<FArrayBox>* a_velCoarse)
{
if(m_lbase > 0)
... | ALGO | 0.998479 | 5.433867 |
8fb84659-4b65-4f44-ac4d-675364c2a889 | wpn-zju/LeetCode-Dump | dump-cn/1182.shortest-distance-to-target-color.cpp | static auto _ = []() { ios_base::sync_with_stdio(false); cin.tie(nullptr); return 0; }();
class Solution {
public:
vector<int> shortestDistanceColor(vector<int>& colors, vector<vector<int>>& queries) {
vector<int> result(queries.size(), -1);
vector<vector<int>> searchMap(3, vector<int>());
for (int i = 0; i < co... | ALGO | 0.999955 | 5.837805 |
5028ebb8-5d27-4ec2-9e9a-296c19f162c7 | ishandutta2007/codeforces | marcina007/normal/283/B.cpp | #include<algorithm>
#include<cassert>
#include<complex>
#include<map>
#include<iomanip>
#include<sstream>
#include<queue>
#include<set>
#include<string>
#include<vector>
#include<iostream>
#include<cstring>
#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 ... | ALGO | 0.999948 | 3.344177 |
ebc892bb-653b-47b1-af89-63aaf777c3cd | ayur-budaev/lek_tasks | lek7/lek7_4.cpp | #include <iostream>
#include <fstream>
#include <locale.h>
#include <string.h>
using namespace std;
const int STR_LENGTH = 80;
bool readLine(ifstream& in, char* buffer)
{
buffer[0] = 0;
in.getline(buffer, STR_LENGTH+1, '\n');
if (in.fail())
{
if (buffer[0]>0)
cout<<"Слишком длинная стр... | TOOL | 0.879739 | 3.26335 |
90e96c51-1de6-499d-b505-70e34c3afe5c | Melodiz/dailycode | leetcode/May 2024/740-Delete_and_Earn.cpp | class Solution
{
public:
int deleteAndEarn(vector<int>& nums)
{
int n = nums.size();
if(n == 0) return 0;
vector<int> dp(10001, 0);
for(int i = 0; i < n; i++)
{
dp[nums[i]] += nums[i];
}
for(int i = 2; i < 10001; i++)
{
dp[i... | ALGO | 0.999568 | 5.678045 |
44da1c31-a27f-4dc9-a2e0-83096a10d061 | mamchain/mamio | src/minemon/schedule.cpp | #include "schedule.h"
using namespace std;
using namespace xengine;
namespace minemon
{
///////////////////////////////
// COrphan
size_t COrphan::GetSize()
{
return mapOrphanByPrev.size();
}
void COrphan::AddNew(const uint256& prev, const uint256& hash)
{
mapOrphanByPrev.insert(make_pair(prev, hash));
}
... | ALGO | 0.971943 | 4.829229 |
dd36aef0-eecf-41d6-8b63-27b255b3f671 | RoadsUntravelled/codes | usaco/runround.cpp | /*
ID:wangxuf1
PROG:runround
LANG:C++
*/
#include<iostream>
#include<functional>
#include<iterator>
#include<algorithm>
#include<sstream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
freopen("runround.out","w",stdout);
freopen("runround.in","r",stdin);
unsigned long long m;
cin>>m;
... | ALGO | 0.999912 | 3.487355 |
9ad96fd9-e850-47f8-88c5-7093d94e32b5 | afrojaarupa/XPSC | Week 2/Day 3/C_Cypher.cpp | // Problem Link: https://codeforces.com/problemset/problem/1703/C
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
int a[n];
vector<string> s(n);
for (int i = 0; i < n; i++) cin >> a[i];
for (int i ... | ALGO | 0.999682 | 5.279401 |
d5dcb0e6-84ca-489d-9051-ca4c590d3217 | lantimilan/topcoder | tc/SRM604div2/p250.cpp | #include <vector>
#include <string>
using namespace std;
class FoxAndWord
{
public:
bool isInteresting(string s1, string s2)
{
if (s1.length() != s2.length()) return false;
for (int l = 1; l < s1.size(); ++l) {
string tmp = s1.substr(l) + s1.substr(0, l);
if (tmp == s2) return true;
}
return false;
}
int how... | ALGO | 0.999845 | 5.00162 |
c5a8e39b-a526-4b4d-a4d3-cd12be16faa3 | sontungexpt/UIT-Workspaces | C_C++/HocKi2_Nam1/UIT-Together/SapXep/02_BubbleSort/BubbleSort.cpp | #include <iostream>
#include <fstream>
#include<iomanip>
#include <string>
#include <algorithm>
using namespace std;
int Nhap(int[], int&, string);
int Xuat(int[], int, string);
void BubbleSort(int[], int);
int main()
{
int b[100000];
int k;
for (int i = 1; i <= 13; i++)
{
string filename = "intdata";
if ... | ALGO | 0.996123 | 3.707484 |
c63e37da-8568-4490-8962-ae68292b7c1a | raincross7/code-similarity | codes/train_code/problem284/problem284_364.cpp | #include<algorithm>
#include<cmath>
#include<iostream>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0;i<ll(n); i++)
int main(){
int K;
string S;
cin >> K;
cin >> S;
int i;
if(S.length() <= K){cout << S << endl; return 0;}
else{
... | ALGO | 0.999541 | 3.141758 |
bc40d9a8-3667-490e-affd-599d946d09bf | IvanTicona/Competitive-Programming | Nacional/I.cpp | #include<bits/stdc++.h>
using namespace std;
#define MAXN 100100
#define MAXV 1000100
#define lli long long int
#define MOD 1000000007
int n;
int counter[MAXV];
int pow2[MAXN];
bool isPrime[MAXV];
int factor[MAXV];
vector<int> lista, answer;
void generateMultiples(int pos, int mult){
if(pos == lista.size()){
... | ALGO | 0.999468 | 3.682887 |
faff581d-23f2-41b2-9e36-e0981928d60e | jnyfah/LeetCode | 116. Populating Next Right Pointers in Each Node.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(int _val, Node* _left, Node* _right, Node* _next)
: val(_... | ALGO | 0.999907 | 5.908208 |
3e7edc7a-d970-4110-8d04-5f72f7670e1b | hcl24/FacegramMessenger | submodules/rlottie/rlottie/src/vector/vmatrix.cpp | #include "vmatrix.h"
#include <vglobal.h>
#include <cassert>
#include <cmath>
V_BEGIN_NAMESPACE
/* m11 m21 mtx
* m12 m22 mty
* m13 m23 m33
*/
inline float VMatrix::determinant() const
{
return m11 * (m33 * m22 - mty * m23) - m21 * (m33 * m12 - mty * m13) +
mtx * (m23 * m12 - m22 * m13);
}
... | TOOL | 0.988145 | 7.055368 |
926a8dbb-d0fd-4b9a-9538-1acace49aa38 | SMUG201911188CYS/Programmers-Baekjoon | 프로그래머스/2/12952. N-Queen/N-Queen.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
int ListX[8] = {0, 0, -1, 1, 1, 1, -1, -1};
int ListY[8] = {1, -1, 0, 0, 1, -1, 1, -1};
int answer;
void UpdateVec(vector<vector<bool>>& IsCanPutQueen, int PosX, int PosY, int UpdateX, int UpdateY, int n)
{
while(true)
{
if(... | ALGO | 0.999718 | 4.258116 |
598bc104-6baa-4bf9-9cd8-6f9109847477 | meritlabs/libmeritminer | src/stratum/stratum.cpp | #include "merit/stratum/stratum.hpp"
#include "merit/termcolor/termcolor.hpp"
#include <chrono>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>
#include <sstream>
#include <iterator>
#include <deque>
#if defined _WIN32 || ... | WEB | 0.927469 | 7.184962 |
9300bc10-b7d5-4e5c-aa48-3b6b0d9f0ccf | saarang123/Competitive-Programming | APIO/2020/swap/grader.cpp | #include "swap.h"
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
int main() {
#ifdef saarang
freopen("/home/saarang/Documents/cp/input.txt", "r", stdin);
#endif
int N, M;
assert(2 == scanf("%d %d", &N, &M));
std::vector<int> U(M), V(M), W(M);
for (int i = 0; i < M; ++i) {
... | ALGO | 0.999651 | 4.575123 |
1ccdcecf-f8ac-4d1f-84a3-4fa798b98331 | manishsaini6421/leetcode-solutions | 2342-max-sum-of-a-pair-with-equal-sum-of-digits/2342-max-sum-of-a-pair-with-equal-sum-of-digits-by_storing_only_two_max_elements_with_same_sumOfDigits.cpp | class Solution {
public:
int sumOfDigits(int n){
int sum=0;
while(n){
sum+=n%10;
n/=10;
}
return sum;
}
int maximumSum(vector<int>& nums) {
unordered_map<int,pair<int,int>> map;
int n=nums.size();
for(int i=0; i<n; i... | ALGO | 0.999992 | 6.049047 |
a8670359-22b0-4493-81bb-9e27fd500b99 | FenixC4/btt-marlin-ender3-firmware | Marlin/src/gcode/bedlevel/G35.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(ASSISTED_TRAMMING)
#include "../gcode.h"
#include "../../module/planner.h"
#include "../../module/probe.h"
#include "../../feature/bedlevel/bedlevel.h"
#if HAS_MULTI_HOTEND
#include "../../module/tool_change.h"
#endif
#if ENABLED(BLTOUCH)
#include "../../feature/b... | TOOL | 0.964047 | 6.165435 |
ebb2b954-64c3-4c1e-9262-d42067ea48d7 | mozilla/integration-mozilla-inbound | gfx/skia/src/gpu/GrRectanizer.cpp | #include "GrRectanizer.h"
#include "GrTBSearch.h"
#define MIN_HEIGHT_POW2 2
class GrRectanizerPow2 : public GrRectanizer {
public:
GrRectanizerPow2(int w, int h) : GrRectanizer(w, h) {
fNextStripY = 0;
fAreaSoFar = 0;
Gr_bzero(fRows, sizeof(fRows));
}
virtual ~GrRectanizerPow2... | TOOL | 0.864351 | 5.784253 |
ab0fa6ec-a114-41c7-a19a-12e6d2632d20 | wise-toddler/emptyqwerty | Codeforces/A_Little_Pony_and_Expected_Maximum.cpp | // https://codeforces.com/contest/453/problem/A
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define endl '\n'
#define nl cout << endl;
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define v vector
#define vi v<int>
#define vvi v<v<int>>
#... | ALGO | 0.999751 | 3.510211 |
1a1f0572-bba2-45ce-bdab-4b5a66fa69ec | HusainCyclewala/DSA | QUEUE/queueMenu.cpp | // Menu-driven program to implement queue using array
#include <stdio.h>
#include <conio.h>
#define SIZE 5
int queue[SIZE];
int front = -1, rear = -1;
void enqueue(int val)
{
if (rear == SIZE - 1)
{
printf("Queue is full\n");
}
else
{
if (front == -1)
{
front = ... | ALGO | 0.999359 | 4.492583 |
77a9e146-b9d0-4e35-955c-32f126d57b7d | jsrv07/Applied-problem-solving-in-CP | KRISHNA_24b2129/week8/soc_week8_q9.cpp | #include <bits/stdc++.h>
using namespace std;
int countRec(int n, int sum) {
if (n==0){
return sum==0;
}
if (sum==0) {
return 1;
}
int ans = 0;
for (int i=0;i<=9;i++) {
if (sum-i>=0) {
ans +=countRec(n-1,sum-i);
}
}
return ans;
}
int countWays(... | ALGO | 0.999775 | 4.203516 |
90df64b6-457e-49e7-b87d-22a3bbc24e7f | Gaurav-singh101/Strivers-A2Z-DSA-Course | BinarySearch/FindPeakElement.cpp/BruteForce.cpp | #include <bits/stdc++.h>
using namespace std;
int Result(vector<int> arr) {
int n = arr.size();
int count = 0;
if (n == 1) return 1; // A single element is always a peak
for (int i = 0; i < n; i++) {
if (i == 0 && arr[i] > arr[i + 1]) { // Check for the first element
count++;
... | ALGO | 0.999937 | 5.557729 |
75bf16ca-db19-41ff-88b2-41c28e60964c | breadcoffee/basic-cpp-2024 | day02/day02/test18_swap2.cpp | #include <iostream>
using namespace std;
void swap(int& a, int& b) { // 참조 변수를 매개 변수로 사용
int temp = 0;
temp = a;
a = b;
b = temp;
} // call-by-reference
int main() {
int a = 10;
int b = 20;
cout << "바꾸기 전" << endl;
cout << "a: " << a << endl;
cout << "b: " << b << endl;
swap(a, b); // 변수의 주소를 전달
cout <... | ALGO | 0.994426 | 5.598796 |
37cc7344-ae39-4afa-8d2b-de963c09f1a9 | Anup-Nayak/dsa | Lecture054 Stack & its Implementation/stackIntro.cpp | #include<iostream>
#include<stack>
using namespace std;
class Stack {
//properties
public:
int *arr;
int top;
int size;
// behaviour
Stack(int size) {
this -> size = size;
arr = new int[size];
top = -1;
}
void push( int element) {
if(siz... | ALGO | 0.997073 | 4.387317 |
3fab457f-857b-484c-9203-8aa0d55fc7ff | pullamsettymaanasa/analytical-session | max and min m-13.cpp | #include <stdio.h>
int main() {
int arr[] = { 5, 10, 2, 8, 1 };
int n = sizeof(arr) / sizeof(arr[0]);
int min = arr[0];
int max = arr[0];
for (int i = 1; i < n; i++) {
if (arr[i] < min) {
min = arr[i];
}
if (arr[i] > max) {
max = arr[i];
}
... | ALGO | 0.999531 | 4.171883 |
cb448bd8-19eb-4cc7-8a3f-fafeb2276c41 | smowton/llpe | llvm-3.2.src/lib/Transforms/Utils/LoopSimplify.cpp | #define DEBUG_TYPE "loop-simplify"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Constants.h"
#include "llvm/Instructions.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/Function.h"
#include "llvm/LLVMContext.h"
#include "llvm/Type.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/DependenceAna... | ALGO | 0.990262 | 6.779491 |
41180ba5-5649-432b-bc22-01b34c12d9ff | AnirudhAgnihotri2902/LeetCode-Problems | Maximum sum increasing subsequence - GFG/maximum-sum-increasing-subsequence.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int solve(vector<int>& arr, int prev, int i, vector<vector<int>>&dp ){
if(i==arr.size()){
return 0;
}
if(dp[i][prev+1]!=-1){
return dp[i][prev+1];
}
int firs... | ALGO | 0.999877 | 6.127126 |
d253ee6c-fe14-42a6-9d51-261b536fa9a8 | TzashiNorpu/Algorithm | Clion/ZeroTrac/1600_1800/bestCoordinate_1620.cpp | //
// Created by TzashiNorpu on 10/10/2022.
//
#include "../header/1600_1800.h"
using namespace ZeroTrac;
vector<int> Solution::bestCoordinate(vector<vector<int>> &towers, int radius) {
int sum;
int ans = 0;
pair<int, int> ansCoor;
for (int x = 0; x <= 50; ++x) {
for (int y = 0; y <= 50; ++y) {
sum ... | ALGO | 0.99997 | 5.861274 |
a92aa8cc-1804-42ed-b265-87bb1aa7be91 | valeria-ivasheva/homework | Homework 1/4/4/Hm4.cpp | #include <iostream>
using namespace std;
int main()
{
int count[28]{};
int j, i, k, sum;
for (i = 0; i < 10; ++i)
{
for (j = 0; j < 10; ++j)
{
for (k = 0; k < 10; ++k)
{
sum = i + j + k;
++count[sum];
}
}
}
sum = 0;
for (i = 0; i < 28; ++i)
{
sum = sum + count[i] * count[i];
}
cout ... | ALGO | 0.995885 | 3.735878 |
d05707ce-2440-4c0d-b1d6-163a62694cd5 | GilgameshxZero/ScienceFair2016 | DetMidpointSim/DetMidpointSim.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <cstdlib>
using namespace std;
/*
Equations
L+R<->B
L+D<->C
L+X->X
*/
const double MAXTIME = 25, //end time for simulation
OUTROW = 5000; //rows of data in output for each sim... | ALGO | 0.999222 | 4.351243 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.