uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5cee4590-8f4f-4893-9d09-7e2bc0efa0a5 | jxx-sx/BOJ_Study | solved/greedy/21313.cpp | #include <iostream>
using namespace std;
int n;
void init() {
cin >> n;
return;
}
void solve() {
for (int i = 0; i < n / 2; i++)
cout << "1\n2\n";
if (n % 2)
cout << 3;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
init();
solve();
return 0;
} | ALGO | 0.999867 | 3.698911 |
7a553b29-99eb-42ff-b36e-97446cafc1ae | ashu1461/SPOJ1 | spoj_new/length_tree.cpp | // this is the first code where i am going to use the concepts of
// vectors and queue ! :D
#include<stdio.h>
#include<string.h>
// include the libraries !
#include<vector>
#include<queue>
// the using one is only for like using import.function or simply function
using namespace std;
int visited[10002];
int color[100... | ALGO | 0.997779 | 4.245746 |
d9f22b59-8212-4cd7-a105-0065d36b30e5 | hjiang13/LLMs-in-IR | processed_data/DecompiledResuts_Human_x_164_O2/GPT35_Human_x_164_O2_decompiled/CPP_33.cpp | ```c++
#include <vector>
#include <iostream>
void sort_third(std::vector<int>& result, std::vector<int>& input) {
int* begin = &input[0];
int* end = &input[input.size()];
if (begin == end) {
return;
}
int* current = begin;
int* next = begin + 1;
while (next != end) {
if (... | ALGO | 0.99999 | 5.97257 |
fc1d414a-d3c0-4bb6-ae19-cf748e48a405 | pmdiano/Coursera | DataStructure2/Wk6Index/Retrieve.cpp | //+-----------------------------------------------------------------------------
//
// File: Retrieve.cpp
//
// Synopsis: Set operations
// https://www.coursera.org/learn/gaoji-shuju-jiegou/programming
// /JFMM4/bian-cheng-zuo-ye-suo-yin-2ti
//
// Author: Qirong Ma, 10/27/2015
... | ALGO | 0.999683 | 4.048995 |
d6265904-9c58-4277-b992-0c2f0fae7d8a | CC90/MISenumerator | mysolver/lib/clingo/clasp/libpotassco/src/string_convert.cpp | typedef _locale_t my_locale_t;
inline my_locale_t default_locale() { return _create_locale(LC_ALL, "C"); }
#if _MSC_VER < 1700
inline unsigned long long strtoull(const char* str, char** endptr, int base) { return _strtoui64(str, endptr, base); }
inline long long strtoll(const char* str, char** endptr, int base) { ret... | TOOL | 0.881334 | 5.98353 |
93e12c8f-b462-4d59-b4fb-e3e50f24015d | lars-danielis/Marlin-BIQU-B1-2.0.8 | Marlin/src/lcd/menu/menu_delta_calibrate.cpp | //
// Delta Calibrate Menu
//
#include "../../inc/MarlinConfigPre.h"
#if HAS_LCD_MENU && EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION)
#include "menu_item.h"
#include "../../module/delta.h"
#include "../../module/motion.h"
#if HAS_LEVELING
#include "../../feature/bedlevel/bedlevel.h"
#endif
#if ENABLED(... | TOOL | 0.902693 | 7.207227 |
64cee7f7-4417-43bb-8d52-361dfefb9c0d | Vasindha/stream_app_ui | 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 |
67b434ca-da62-4049-be7e-344221f48a06 | rafaelkuffner/KinectCaptureToolkit | NormalFromDepth/normalFromDepth transforms.cpp | #include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/obj_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/features/normal_3d.h>
#include <pcl/surface/gp3.h>
#include "tinyxml2.h"
#include <stdio.h>
#include <string>
#include <pcl/registration/icp.h>
#include <pcl/f... | TOOL | 0.93941 | 3.28084 |
51a2d4d6-6e82-46c1-a47d-2fd30cb267f4 | khc0907/WRD-wooridle-coin | src/qt/rpcconsole.cpp | #if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#endif
#include "rpcconsole.h"
#include "ui_debugwindow.h"
#include "bantablemodel.h"
#include "clientmodel.h"
#include "guiutil.h"
#include "platformstyle.h"
#include "chainparams.h"
#include "netbase.h"
#include "rpc/server.h"
#include "rpc/client.h"
#in... | TOOL | 0.962441 | 5.344193 |
e89cea54-24b6-4566-bcdf-00380f9bc3b7 | Meowcoin-Foundationn/Meowcoin | src/sync.cpp | #include "sync.h"
#include "util.h"
#include "utilstrencodings.h"
#include <stdio.h>
#include <boost/thread.hpp>
#ifdef DEBUG_LOCKCONTENTION
void PrintLockContention(const char* pszName, const char* pszFile, int nLine)
{
LogPrintf("LOCKCONTENTION: %s\n", pszName);
LogPrintf("Locker: %s:%d\n", pszFile, nLine... | TOOL | 0.955269 | 6.12246 |
e48fe773-b332-4a26-a49e-48a4822c770d | wangjy520/algorithms | 0x06-ds/7-ๆ ็ถๆฐ็ป/0x04.cpp | /*
** Created by Wangjy.
**
**
**
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef struct ListNode
{
int val;
ListNode* next;
ListNode() : val(0), next(nullptr) {}
ListNode(int v) : val(v), next(nullptr) {}
ListN... | ALGO | 0.999974 | 4.143681 |
81200ef6-7322-4df4-85dd-a02e7eb8087e | Yagnik007/Week-2-Assignment | Data-structures/Miscellaneous/5.cpp | #include <stdio.h>
#include <stdlib.h>
struct Node
{
int data;
struct Node *next;
};
struct Node *insertEnd(struct Node *last, int data)
{
if (last == NULL)
{
struct Node *newNode = (struct Node *)malloc(sizeof(struct Node));
newNode->data = data;
newNode->next = newNode;
... | ALGO | 0.999959 | 5.153347 |
f06d0475-b0b2-4e27-b51e-50622da23624 | brianlball/JModelica-src-2.14 | ThirdParty/CasADi/CasADi/external_packages/qpOASES/src/Matrices.cpp | /**
* \file src/Matrices.cpp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.0beta
* \date 2007-2012
*
* Implementation of the matrix classes.
*/
#include <qpOASES.hpp>
BEGIN_NAMESPACE_QPOASES
/** String for calling LAPACK/BLAS routines with transposed matrices. */
const char ... | TOOL | 0.99073 | 5.857578 |
ba093688-e9fe-4253-a2bd-0bdc0a1b23ce | HekpoMaH/Olimpiads | grupa C/olimpiada/oblasten/2012/fractions.cpp | #include<iostream>
using namespace std;
int nod(long long a,long long b)
{
long long r;
while(b!=0)
{
r=a%b;
a=b;
b=r;
}
return a;
}
void sbdr(long long &t4,long long &tz,long long v4,long long vz)
{
//nok na dvata znamenatelq
long long nok=(tz*vz)/nod(tz,vz);
//u... | ALGO | 0.999745 | 3.156475 |
0001f6dd-b4d3-4834-a75a-9b656ab95730 | LordMotas/JobPortfolio | Project Euler Solutions/C++/Problem 67/Euler67.cpp | /*
Project Euler #67
Problem STatement:
By starting at the top of the triangle below and moving to adjacent numbers on the row below,
the maximum total from top to bottom is 23.
3
7 4
2 4 6
8 5 9 3
That is, 3 + 7 + 4 + 9 = 23.
Find the maximum total from top to bottom in triangle.txt (right click and 'Sav... | ALGO | 0.999689 | 6.472352 |
c54d0c72-ce57-4408-adc8-7b943a0cb5db | hikjik/cses | solutions/increasing-array/main.cpp | #include <iostream>
#include <vector>
int main() {
int n, a;
std::cin >> n;
int prev = 0;
long long ops = 0;
for (int i = 0; i < n; ++i) {
std::cin >> a;
if (a < prev) {
ops += prev - a;
} else {
prev = a;
}
}
std::cout << ops << "\n";
return 0;
}
| ALGO | 0.999642 | 4.448962 |
af1db01b-3f17-4b36-a706-6811b8301523 | sahil-rajput/Codechef-Campus-Ambassador | XCODE02.cpp | //Tester Code
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long LL;
typedef pair<int, int> pii;
int n;
int c;
int eli;
vector<pii> cc, e;
int solve(int c, vector<pii> &v)
{
int pos = 0;
int sz = (int)v.size();
int mx = 0;
int mx2 = 0;
int ans ... | ALGO | 0.999985 | 4.368636 |
1b39ab26-3b70-432c-ab7e-82d55565a2ae | Manas111/DSA | Copy List with Random Pointer.cpp | // https://leetcode.com/problems/copy-list-with-random-pointer/
/*
// Definition for a Node.
class Node {
public:
int val;
Node* next;
Node* random;
Node(int _val) {
val = _val;
next = NULL;
random = NULL;
}
};
*/
class Solution {
public:
Node* copyRandomList(Node*... | ALGO | 0.999748 | 4.96033 |
c1e8a004-5068-4957-82e3-dbe21cd7113c | ishandutta2007/codeforces | rqgao2014/normal/878/B.cpp | #include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > >
#define pii... | ALGO | 0.999992 | 3.49203 |
cd63fd2a-0bb4-40a8-a5f7-cc59b8870194 | JahidJewel/C-exercise | Guessing game using vector.cpp | #include<iostream>
#include<vector>
#include<string>
#include<cstdlib>
#include<ctime>
using namespace std; //using directive
void print_vector(vector <int> vector)
{
for (int i = 0; i < vector.size(); i++)
{
cout << vector[i] << "\t";
}
cout << "\n";
}
void play_game()
{
vector <int> guesses;
int random ... | TOOL | 0.991871 | 3.050245 |
478ba568-a51b-44b9-91fc-acee37fbd593 | takkrish/datastructures-and-algorithms-cpp | Array Easy/Largest Local Values in a Matrix.cpp | // You are given an n x n integer matrix grid.
// Generate an integer matrix maxLocal of size (n - 2) x (n - 2) such that:
// maxLocal[i][j] is equal to the largest value of the 3 x 3 matrix in grid centered around row i + 1 and column j + 1.
// In other words, we want to find the largest value in every contiguous 3 ... | ALGO | 0.999984 | 6.595707 |
1eac0745-d530-4650-be00-16522ee19ed9 | lmwang4321/Leetcode_CPP | 1-100/35.searchInsert.cpp | //35.searchInsert
class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int len=nums.size();
int l = 0;
int r = len-1;
// if(nums[len-1] <= target) return len-1;
while(l<=r){
int mid = l +((r-l)>>1);
if (nums[mid] >= target){
... | ALGO | 0.999996 | 6.060311 |
e79d11c2-5f92-4058-9844-dd6c6b639dcf | dsud98/competitive-coding-practice | 919b.cpp | #include<bits/stdc++.h>
using namespace std;
bool val(long m)
{
int s=0;
while(m>0)
{
s+=m%10;
m/=10;
}
if(s==10)
return true;
else
return false;
}
int main()
{
long k=0,m=19,n,a[10001];
while(k<10000)
{
if(val(m))
{
a[k]=m;
k++;
}
m++;
}
cin>>n;
cout<<a[n-1]<<endl;
}
| ALGO | 0.999439 | 3.533478 |
6a782eb4-007d-4c18-9634-46e78defbb7f | shashankanand13monu/Leetcode | 583-delete-operation-for-two-strings/583-delete-operation-for-two-strings.cpp | class Solution {
public:
int minDistance(string word1, string word2) {
int m = word1.size();
int n = word2.size();
vector<vector<int>>dp(m+1,vector<int>(n+1,0));
// vector<vector<int>>dp(m+1,vector<int>(n+1,0));
for(int i=1;i<=m;i++)
{
fo... | ALGO | 0.999984 | 5.097033 |
bd44d838-3445-4bc3-a323-0dbc4fc7b422 | PaukIsUha/optimizing_formating_code | predictions/full_output_predicted_submissions/Codenet/p01920/422425601/0.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, buckets, y) for (int i = (buckets); i < (y); ++i)
#define debug(buckets) #buckets << "=" << (buckets)
#ifdef DEBUG
#define _GLIBCbucketsbuckets_DEBUG
#define print(buckets) \
std::cerr << debug(buckets... | ALGO | 0.999293 | 3.720809 |
0e669836-6382-468b-806c-7fc37bcca1d2 | Saksham2371/DSA | Arrays/MaxMin.cpp | #include "iostream"
using namespace std;
// int getMax(int arr[], int n)
// {
// int Max = INT16_MIN;
// for (int i = 0; i < n; i++)
// {
// if (arr[i] > Max)
// {
// Max = arr[i];
// }
// }
// return Max;
// }
// int getMin(int arr[], int n)
// {
// int ... | ALGO | 0.993248 | 4.543169 |
98bb6cc0-208f-4d87-9b85-86f797051e8c | wangxianghust/leetcode | 82RemoveDulFromList2.cpp | /*problem: Delete duplicate from the sorted list,ไธๆฆ้ๅค๏ผ้ๅค็ๅ
็ด ๅฐฑไธ่ฆไบใ
* Solution: just like before.่ฟๆ ท็้ข็ฎ็จๆ็ป็ป้พ่กจ๏ผๆณจๆ่่ๅผๅงๆ
ๅต(ไธ่ฌ็ดๆฅreturn)๏ผ
* ๆๅไธไธชๅ
็ด ๅณๅฏใ
* ไฝฟ็จslowๅfastๅๆ้๏ผslow็จๆฅ่กจ็คบไธไธไธชๅฏ่ฝ็ไฝ็ฝฎ๏ผfast่กจ็คบ้ๅๆ้ใ้่ฆ็ๆฏslow๏ผๆไปฌๆฏๆฌก
* slow->next = fast->next, ็ถๅ็ปง็ปญ็งปๅจfast(head)๏ผๆฃๆตslow->nextๆฏๅฆๅๆณใ
*/
#include <iostream>
using namespace std;
struct L... | ALGO | 0.999978 | 4.912919 |
988a4301-8a6a-4033-b7e4-41c1d865b47e | brownfox2k6/Codeforces-solutions | CodeForces/GNU C++17/1792C | Min Max Sort/222448088.cpp | /**
* author: brownfox2k6
* created: Fri 08 Sep 2023 18:30:32 Hanoi, Vietnam
**/
#include <bits/stdc++.h>
using namespace std;
#define mtt true
#define dbg false
void solve() {
int n;
cin >> n;
int a[n+1];
for (int i = 1; i <= n; ++i) {
int x;
cin >> x;
a[x] = i... | ALGO | 0.999794 | 4.885754 |
8de8c3e0-cbec-45cf-8b51-4b9ee0a13561 | ishandutta2007/codeforces | somethingnew/normal/1520/E.cpp | #include "list"
#include <iostream>
#include <vector>
#include <fstream>
#include <map>
#include "algorithm"
#include <iomanip>
#include "cmath"
#include "set"
#include <climits>
#include "queue"
using namespace std;
typedef long long ll;
typedef long double ld;
#define int ll
void solve() {
int n;
cin >> n;
... | ALGO | 0.99988 | 3.802159 |
fbf65c41-c8e3-4330-9eab-33c9f13f965a | fATwaer/Algorithm-and-DataStructure | src/quicksort.cpp | #include "SortAlgorithm.h"
int
SortAlgorithm::partitionArray(int p, int r)
{
int key = a[r-1];
int i = p - 1;
for (int k = p; k <= r; k++) {
if (a[k-1] < key) {
i++;
pSwap(a[i-1], a[k-1]);
}
}
pSwap(a[i+1-1], a[r-1]);
return i+1;
}
void
SortAlgorithm::q... | ALGO | 0.999941 | 4.576408 |
595c9e63-6dc1-4ebc-9980-f79a04e2cfc2 | strange8969/LeetCode_Problems | 2818-apply-operations-to-maximize-score/2818-apply-operations-to-maximize-score.cpp | class Solution {
public:
const int MOD = 1e9 + 7;
long long findPower(long long a, long long b) {
if (b == 0) return 1;
long long half = findPower(a, b / 2);
long long result = (half * half) % MOD;
if (b % 2 == 1) {
result = (result * a) % MOD;
}
... | ALGO | 0.999982 | 5.672791 |
83ea9899-b1e1-468e-aebf-0275d9ca6475 | Engineering-Excellence/Problem-Solving | BAEKJOON/src/gold/iv/cpp/boj_12851.cpp | #include <bits/stdc++.h>
using namespace std;
int n, k;
int cnt[100001];
int visited[100001];
queue<int> q;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> n >> k;
q.push(n);
visited[n] = 1;
cnt[n] = 1;
while (!q.empty()) {
int now... | ALGO | 0.999977 | 4.230029 |
9bc95bc9-9d90-47e8-a9e3-a486809052bc | SepehrGanji/LeetCode-Solutions | Solutions/3709-find-special-substring-of-length-k/solution.cpp | class Solution {
public:
bool hasSpecialSubstring(string s, int k) {
int n = s.length();
for(int i = 0 ; i <= n-k ; i++) {
if(i > 0 && s[i] == s[i-1]) continue;
char ch = s[i]; bool yay = true;
for(int j = i + 1 ; j < i + k ; j++) {
if(s[j] != ch) ... | ALGO | 0.999948 | 5.920856 |
e4f72bdb-df1f-465d-89ed-4c9d2e6e40ff | putdata/algorithm-problem-solving | NOJAM/6502.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int i = 1;
while (1) {
int r, w, l; cin >> r;
if (r == 0) break;
cin >> w >> l;
cout << "Pizza " << i++ << " ";
cout << ((2 * r) * (2 * r) >= w * w + l * l ? "fits on the table.\n" : "does not fit on the table.\n");
}
return 0;
} | ALGO | 0.999235 | 3.978436 |
6fd56f83-d02a-4031-be4e-1963eba2f459 | GaisaiYuno/OI-Record-exe-deleted | Grade 10-12/2018 autumn/NOIP/NOIP2018ๆ้ซ็ปDay1็จๅบๅ
/GD-Senior/answers/GD-0064/road/road.cpp | #include <iostream>
#include <cstdio>
#define repu(i, x, y) for (int i = x; i <= y; ++i)
using namespace std;
const int MAXN = 100011;
int n, d[MAXN][25], ans;
void init()
{
for (int j = 1; (1 << j) <= n; j++)
{
for (int i = 1; i + (1 << j) - 1 <= n; i++)
{
d[i][j] = min(d[i][j - 1], d[i + (1 << (j - 1))][j - ... | ALGO | 0.999927 | 3.535455 |
70da03aa-e65a-497c-8f9b-95e57d91a25a | Rahul-skush/leetcode-solutions | Array/825. Friends Of Appropriate Ages.cpp | class Solution {
public:
int numFriendRequests(vector<int>& ages) {
unordered_map<int, int> cnt;
for(auto x : ages)
cnt[x]++;
int ans =0;
for(auto &a : cnt)
{
for(auto &b : cnt)
{
if(request(a.first, b.first))
... | ALGO | 0.999622 | 5.302761 |
f14b9cff-15d8-4381-ad6a-b11dd7f66e99 | MehrajAkash/STL | Stack/Stack Practice/Balance Bracket.cpp | #include<bits/stdc++.h>
using namespace std;
bool isBalance(char c1, char c2){
//cout<<c1<<c2<<endl;
return ( (c1=='(' && c2==')') || (c1=='{' && c2=='}') || (c1=='[' && c2==']') );
}
int main(){
string s;
cin>>s;
int sz = s.size();
sz = sz/2;
stack<char>c;
for( auto u : s ){
... | ALGO | 0.999943 | 4.584506 |
2f90c4b6-4142-4da3-988b-9e1961bbc438 | Irhamrahmatsaleh/Solidity-Develop | test/libsolutil/DominatorFinderTest.cpp | /**
* Unit tests for the algorithm to find dominators from a graph.
*/
#include <libsolutil/DominatorFinder.h>
#include <test/libsolidity/util/SoltestErrors.h>
#include <boost/test/unit_test.hpp>
#include <fmt/format.h>
#include <range/v3/range/conversion.hpp>
#include <range/v3/view/filter.hpp>
#include <range/v... | TEST | 0.919603 | 7.672804 |
ec820f38-4345-49a9-886c-4b52f3a56da1 | kawchar85/NoteBook | Data Structure and Graph/Centroid Decomposition.cpp | vi adj[MAX]; int sz[MAX]; bool is_removed[MAX];
vector< pair<int, int> > ancestors[MAX];
int get_size(int u, int p = -1) { sz[u] = 1;
for(auto v : adj[u]) {
if(v == p || is_removed[v]) continue;
sz[u] += get_size(v, u); } return sz[u]; }
int get_centroid(int u, int n, int p = -1) {
for(auto v : adj[u]) {
... | ALGO | 0.999749 | 4.041363 |
f43621c4-0b4a-4f7d-9355-9638f544229a | KhaledHegazy222/Problem-Solving | UVA/11686/main.cpp | #include <bits/stdc++.h>
#ifndef Khaled
#define endl '\n'
#endif
#define fast cin.tie(0),ios::sync_with_stdio(0),cout.tie();
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const ll N = 1e6 + 5,M = N;
ll head[N],to[M],nxt[M],n,m,ne;
int inDeg[N],res[N]... | ALGO | 0.999963 | 4.628634 |
2bb678a2-d9b7-45fc-918d-657de9b2484f | mansisavaliya20/advance_flutter_chatapp | 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 |
c9954bd4-6994-437f-bc21-836ef816398b | uayanaksha/codeforces | 1367/b/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void){
int t;
cin >> t;
while(t--){
int n, ai{}, oddMismatchCtr{}, evenMismatchCtr{};
cin >> n;
for(int i{}; i < n; i++){
cin >> ai;
if(ai%2 != i%2){
if(ai%2){
++oddMismatchCtr;
} else {
++evenMismat... | ALGO | 0.999344 | 4.440375 |
2be4e8fa-219b-4fb8-b13f-9e4992ad5bea | alexchen817/leetcodeProblems | heapify.cpp | // bruh
#include <iostream>
using namespace std;
void heapify(int arr[], int n)
{
int nodeidx = (n - 2) / 2 ;
if (nodeidx == -1) {
return;
}
for (int i = nodeidx; i >= 0; i--) {
int largest = i;
int leftChild = (2 * i) + 1;
int rightChild = (2 * i) + 2;
if (le... | ALGO | 0.999844 | 4.414432 |
218bcab8-db4e-4a1a-b639-b4f4455cff76 | priyanshunt/CPP-Programs | Assignment 10/test74.cpp | #include<iostream>
using namespace std;
template<class T> class ll
{
public:
ll *p=NULL;
T val;
ll()
{
val=0;
}
void Insert(T a)
{
val=a;
}
T Pop()
{
return val;
}
T Next()
{
return p->val;
}
};
int main()
{
int ch;
float n;
ll<float> *ptr=NULL,*next=NULL,*first=NULL;
do
{
cout<<"Enter 1 f... | ALGO | 0.998147 | 3.605422 |
89d8cd27-2a82-4ea7-b5c8-a56c5a204610 | ishandutta2007/codeforces | kevinyang/normal/623/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n,m;
cin >> n >> m;
vector<vector<int>>adj(n+1);
vector<vector<bool>>con(n+1,vector<bool>(n+1));
for(int i = 0; i<m; i++){
int x,y;
cin >> x >> y;
adj[x].push_back(y); adj[y].push... | ALGO | 0.999996 | 4.198526 |
4aa4372c-733d-47d7-b0c4-bcace8e2eb57 | CerealAxis/LuoGu_Experience | ใ่ๆกฅๆฏใ็้ข/P9240 [่ๆกฅๆฏ 2023 ็ B] ๅถ็ผ้ๅฑ.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX_SIZE 100000
int main()
{
int n, i;
int v[MAX_SIZE], a[MAX_SIZE], b[MAX_SIZE], d[MAX_SIZE];
scanf("%d", &n);
for (i = 0; i < n; i++)
{
scanf("%d %d", &a[i], &b[i]);
v[i] = a[i] / b[i];
}
sort(v, v + n);
for (i = v[... | ALGO | 0.99994 | 3.638977 |
7dde7f40-ee33-4a4f-816b-137f80638cf4 | Ritik3003/LeetCode-Solutions | longest-palindromic-substring/longest-palindromic-substring.cpp | class Solution {
public:
bool check(string &s, int start, int end){
while(start<=end){
if(s[start]!=s[end]){
return false;
}
start++;
end--;
}
return true;
}
int solve(string &s, vector<vector<int>>&dp, int &index,int &maxi,int start,int end){
if(start>end){
... | ALGO | 0.999992 | 6.041601 |
0da0f65d-9e06-484b-bf07-b0ecbd1c753e | Ylmzezgi/Yemek-se- | 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 |
bb768d64-a79a-4b09-8f4a-ead9dc309f26 | adam-kwon/Prototypes | Swinger/Swinger/libs/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp | #include <Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h>
#include <Box2D/Common/b2BlockAllocator.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <new>
using namespace std;
b2Contact* b2EdgeAndPolygonContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
{
void* mem... | ALGO | 0.944101 | 6.861051 |
5d4fee71-edd6-44ea-b941-ce651c0f8d69 | vikashkumr/Competitive-Programming | leetcode/Array Pair Sum Divisibility Problem.cpp | // https://practice.geeksforgeeks.org/problems/array-pair-sum-divisibility-problem/0
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define digit(x) floor(log10(x))+1
#define mod 1000000007
#define endl "\n"
#define int long long
#define matrix vec... | ALGO | 0.999926 | 4.077695 |
0c979b9b-44b1-43f5-9b5a-d83b6ad9df56 | iulian0512/android_spatialite | static_libs/geos-3.12.0/src/geom/Triangle.cpp | #include <geos/geom/Triangle.h>
#include <geos/geom/Coordinate.h>
#include <geos/algorithm/CGAlgorithmsDD.h>
#include <geos/algorithm/Orientation.h>
#include <geos/algorithm/Angle.h>
using geos::algorithm::Angle;
using geos::algorithm::Orientation;
namespace geos {
namespace geom { // geos::geom
bool
Triangle::isIso... | TOOL | 0.876293 | 6.817188 |
d36135d6-81a8-4766-b267-6139648db3b6 | Harry-kp/Cp | Codeforces/Codeforces Round #744 (Div. 3)/F Array Stabilization (AND version).cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define MP make_pair
#define EB emplace_back
#define MOD 1000000007
#define int long long int
#define S second
#define F first
#define debug1 cout << "debug1" << '\n'
#define debug2 cout << "debug2" << '\n'
#define deb... | ALGO | 0.99946 | 4.201019 |
05643d6e-707a-4206-a8ed-bf2ba86d4f2b | ishandutta2007/codeforces | technite/normal/4/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define append push_back
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forl(i, n) for(long long i=0;i<n;++i)
typedef long long ll;
ll exp(ll n, ll m, ll md){
ll a = 1;
... | ALGO | 1 | 3.319118 |
d340e09d-70fa-4f74-b30b-f75d502339a5 | rapel02/competitive-programming | UVa/113.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
double n,p;
while(scanf("%lf %lf",&n,&p)!=EOF)
{
double ans = pow(p,1/n);
printf("%.0lf\n",ans);
}
}
| ALGO | 0.999408 | 3.701002 |
bdcbf3c9-3777-424e-b06a-2cb31d90a9f6 | ArseniyKholod/stce_ss24_ex12 | thirdParty/dcl6i38ngl_v381/examples/ga1s_Jacobian/main.cpp | #include <iostream>
#include <vector>
using namespace std;
#include "driver.hpp"
int main() {
cout.precision(5);
const int n = 4, m = 2;
vector<double> x(n), y(m);
vector<vector<double>> J(m, x);
for (int i = 0; i < n; i++)
x[i] = 1;
a1s_driver(x, y, J);
for (int i = 0; i < m; i++)
cout << "y[" ... | ALGO | 0.998884 | 3.304794 |
21b170be-ce4e-4cf5-9bad-ec7942b47017 | Tahircode/DSA-2 | questions/insertBeforeNode,Val DoublyLL.cpp | #include <iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
Node* back;
public:
Node(int data,Node* next,Node* back){
this-> data=data;
this->next=next;
this-> back=back;
}
public:
Node(int data){
this-> data=data;
next=nullptr;
back=nullptr;
}
};
void print(Node* hea... | ALGO | 0.999962 | 4.957842 |
df8ae042-ab04-4dc1-a683-7635b1445cc3 | michalsuwala/AlgorithmsExercises1 | Azad10.cpp | #include <iostream>
#include <vector>
struct Edge {
int to;
int time;
Edge(int to, int time) : to(to), time(time) {}
};
int main() {
int t;
for(int i = 0; i < t; i++) {
int n, m, s;
int s1, s2, time;
std::cin >> n >> m >> s;
std::vector<std::vector<Edge*>> graph;
... | ALGO | 0.999695 | 4.14646 |
5a8572ed-3ffd-43ed-acb7-c0a3cdb1d97d | github1414213562/Wordle-Solver | solver.cpp | #include "solver.h"
#include <bits/stdc++.h>
#define HARDMODE 0
int strToNo(string str) {
int x = 0;
for(int i = 0; i < 5; i++) {
if(str[i] == 'y') x += pow(3, i);
if(str[i] == 'g') x += 2 * pow(3, i);
}
return x;
}
void findword(){
vector<pair<int,string>> scores;
vector<string> possibleWords = getWordLis... | ALGO | 0.994964 | 3.289719 |
b17e43a1-1cff-47c9-a493-378270efab03 | SantiMor05/Indusmatica | Indusmรกtica/5to ciclo/Algoritmia/Recursion/Edward-P2-L2-21-2/main.cpp | /*
* File: main.cpp
* Author: 00123
*
* Created on 2 de mayo de 2025, 03:54 PM
*/
#include <iostream>
#include <cmath>
using namespace std;
#define N 6
int matriz[N][N]{
{1,2,9,1,2,3},
{5,1,7,0,2,1},
{0,7,0,3,8,1},
{1,2,6,1,2,2},
{0,6,9,5,0,5},
{0,0,4,0,9,0}
};
int buscarMax(int x,int... | ALGO | 0.99965 | 3.964826 |
1377932c-70ac-498b-aa81-3bba55ad2b21 | sommerlukas/llvm-offload-jetson | libcxx/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp | // <random>
// template<class IntType = int>
// class negative_binomial_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <numeric>
#include <vector>
#include <cassert>
#include "test_macros.h"
template <class T>
inline
T
sqr(T x)
{
retur... | TEST | 0.9708 | 5.751159 |
c4edd2e2-f1c3-48f8-98c8-f1fa4e72fbbc | Chizer77/ALGPractices | Practice02/Babelfish.cpp | //่พๅ
ฅ
//้ฆๅ
่พๅ
ฅไธไธช่ฏๅ
ธ๏ผ่ฏๅ
ธไธญๅ
ๅซไธ่ถ
่ฟ100000ไธช่ฏๆก๏ผๆฏไธช่ฏๆกๅ ๆฎไธ่กใๆฏไธไธช่ฏๆกๅ
ๆฌไธไธช่ฑๆๅ่ฏๅไธไธชๅค่ฏญๅ่ฏ๏ผๅจไธคไธชๅ่ฏไน้ด็จไธไธช็ฉบๆ ผ้ๅผใ
// ่ไธๅจ่ฏๅ
ธไธญไธไผๆๆไธชๅค่ฏญๅ่ฏๅบ็ฐ่ถ
่ฟไธคๆฌกใ
// ่ฏๅ
ธไนๅๆฏไธไธช็ฉบ่ก๏ผ็ถๅ็ปๅบไธ่ถ
่ฟ100000ไธชๅค่ฏญๅ่ฏ๏ผๆฏไธชๅ่ฏไธ่กใ่พๅ
ฅไธญๅบ็ฐๅ่ฏๅชๅ
ๆฌๅฐๅๅญๆฏ๏ผ่ไธ้ฟๅบฆไธไผ่ถ
่ฟ10ใ
//่พๅบ
//ๅจ่พๅบไธญ๏ผไฝ ้่ฆๆ่พๅ
ฅ็ๅ่ฏ็ฟป่ฏๆ่ฑๆๅ่ฏ๏ผๆฏ่ก่พๅบไธไธช่ฑๆๅ่ฏใๅฆๆๆไธชๅค่ฏญๅ่ฏไธๅจ่ฏๅ
ธไธญ๏ผๅฐฑๆ่ฟไธชๅ่ฏ็ฟป่ฏๆโehโใ
//ๆฅๆบ๏ผPOJ 2503
#include<cstdio>
#include<cstring>
using namespace std;
#define... | ALGO | 0.999789 | 3.965272 |
2a6c7d8b-a054-4e48-90a7-84a78e5ba7fb | codeaholic-shub/ALGO-ADDICT | LEETCODE/C++/bulb-switcher.cpp | // Time: O(1)
// Space: O(1)
class Solution {
public:
int bulbSwitch(int n) {
// The number of full squares.
return static_cast<int>(sqrt(n));
}
};
| ALGO | 0.999756 | 6.555437 |
bcb5d171-8106-4e1b-aadc-4afb5433cd42 | saiyam-jain-dev/Data-Structures-and-Algorithms | 11. Binary Trees/04BFSTraversal.cpp | #include <bits/stdc++.h>
using namespace std;
// Input : 1 2 4 -1 -1 5 7 -1 -1 -1 3 -1 6 -1 -1
/* Output :
1
2 3
4 5 6
7
*/
class Node
{
public:
int data;
Node *left;
Node *right;
Node()
{
data = 0;
left = NULL;
right = NULL;
}
Node(int d)
{
data = d;
... | ALGO | 0.999943 | 3.965812 |
8e77102d-33f4-432f-9c05-c630bfa3cb9e | baichen318/arch-explorer | infras/gem5-research-calipers/src/systemc/tests/systemc/misc/user_guide/chpt3.2/fsmr.cpp | /*****************************************************************************
fsmr.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | ALGO | 0.99915 | 4.847336 |
25590147-5dcd-44a1-ab10-dfd3e4a8aa36 | feifeigd/Counter-Strike-Global-Offensive | cstrike15_src/game/shared/portal/portal_placement.cpp | #if defined( GAME_DLL )
#include "func_noportal_volume.h"
#include "triggers.h"
#include "func_portal_bumper.h"
#include "physicsshadowclone.h"
#include "trigger_portal_cleanser.h"
#else
#include "c_triggers.h"
#include "c_func_noportal_volume.h"
#include "c_func_portal_bumper.h"
#include "c_trigger_portal_cleanser.h"
... | ALGO | 0.882424 | 5.405025 |
f3731f1c-6777-40b7-9e1d-1f065b42729f | natanlimaz/CompetitiveProgramming | neps-codcad/problems/botasTrocadas.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
vector<pair<int, int>> v(10004);
for(int i = 0; i < 10004; i++) {
v[i] = make_pair(0, 0);
}
cin >> n;
while(n--) {
int m;
char l;
cin >> m >> l;
if(l == 'D')
v[m].second++;
... | ALGO | 0.999767 | 4.259139 |
d9503e8d-bc99-44be-b46b-e1b17e47c5e8 | nickwang333/Leetcode | LC 2802. Find The K-th Lucky Number.cpp | class Solution {
public:
string kthLuckyNumber(int k)
{
string out{};
++k;
for( ; k!=1; k/=2)
out.push_back(k&1 ? '7' : '4');
reverse(begin(out), end(out));
return out;
}
};
| ALGO | 0.999098 | 5.775293 |
a203238c-aa17-4a26-a099-3c65241406dc | alexandraback/datacollection | solutions_5631989306621952_0/C++/math314/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i = 0 ;i < (n); i++)
#define sz(c) ((int)c.size())
#define ten(n) ((int)1e##n)
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
template<typename ...> static inline int getchar_unlocked(void) { return getchar(); }
tem... | ALGO | 0.999969 | 4.578376 |
987fd4cd-64b1-47d0-8985-94e082c4ef32 | rhmunna143/competetive-programming | Cpp/Data-Structures/week-5-assignment-4-binary-tree/Level_Nodes.cpp | /***
* Objective:
*
* Context: You will be given a binary tree as input in level order. Also you will be given a level X. You need to print all the node's values in that level from left to right. Assume that level starts from 0.
* For Example: If X = 2, then the output for the above tree will be: 40 50 60
*
* Con... | ALGO | 0.999925 | 5.430831 |
c1303de9-b819-41a7-99db-b61881823f00 | singhsuryansh12/SPOJ_List | NSTEPS.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void){
unsigned long long int t,i,x,y,num;
cin>>t;
for(i=0;i<t;i++){
cin>>x>>y;
if(x%2==0 && y%2==0){
if(y==x || (y==(x-2))){
num = x+y;
cout<<num<<endl;
}
else{
... | ALGO | 0.999911 | 4.103804 |
fcd4ba11-b7ff-4f66-b120-bfae0d289d32 | CTranLam/DSA-28tech | Binary tree/bai 8 duyet theo muc.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct node{
int data;
node* left;
node* right;
node(int x){
data=x;
left=right=NULL;
}
};
// noi node con vao node cha root
void makenode(node* root,int u,int v,char c){
if(c=='L'){
root->left=new node(v);
}
else{
root->right=new node(v... | ALGO | 0.999988 | 3.782464 |
6caac241-9745-4ad3-a759-2bdf08051912 | SEOICodeGroup/LYY | TOOLS/Ac่ชๅจๆบ/Ac.cpp | #include <cstdio>
#include <cstring>
using namespace std;
#define MAXC 26 // ๅญ็ฌฆ้็ๅ
็ด ไธชๆฐ
struct AcNode {
AcNode *fail;
AcNode *next[MAXC];
//้ๅฟ
้ๆฐๆฎ
int id; //่็น็ผๅท
int val; // ๅฝๅ็ป็นๅๅฎ็failๆ้ๆๅ็ป็น็็ปๅฐพๅ่ฏไฟกๆฏ็้ๅ
int cnt; //่ฎก็ฎๅ่ฏๅบ็ฐๆฐ้
void reset(int _id) {
id = _id;
cnt = 0;
... | ALGO | 0.99963 | 3.778808 |
80dc21b9-fd36-4e24-8ab7-1f6b7abb56f6 | KidCharlemagne4/lockpick-backup | source/KeyLocation.cpp | #include "KeyLocation.hpp"
#include "xxhash64.h"
#include <algorithm>
#include <unordered_map>
#include <switch.h>
void KeyLocation::get_from_memory(u64 tid, u8 seg_mask) {
Handle debug_handle = INVALID_HANDLE;
u64 d[8];
// if not a kernel process, get pid from pm:dmnt
if ((tid > 0x0100000000000005... | ALGO | 0.952804 | 5.704615 |
f3946c5c-192e-4614-81a2-a96760039533 | ishandutta2007/codeforces | gabrielpessoa/normal/847/D.cpp | #include <bits/stdc++.h>
using namespace std;
const int ms = 2e5+5;
int t[ms];
int existe[ms];
int qnt[ms];
main() {
cin.tie(0); ios::sync_with_stdio(0);
int n, T;
cin >> n >> T;
n = min(n, T - 1);
for(int i = 1; i <= n; i++) {
cin >> t[i];
}
for(int i = 1; i < n; i++) {
t... | ALGO | 0.999982 | 4.390856 |
ef6eb7b0-91d8-4294-af72-2c37604ef543 | 07Sushant/Data-Structures-and-Algorithms | DPP/Unit 2/Task of developing operatoes circulat header.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int data) {
this->data = data;
next = nullptr;
}
};
void insertEnd(Node*& last, int data) {
Node* newNode = new Node(data);
if (!last) {
last = newNode;
last->next = last;
... | ALGO | 0.999782 | 5.977723 |
0ac97db7-c48c-4b3a-aaed-85acd4198443 | DionysiosB/CodeForces | 0001-0099/2A-Winner.cpp | #include<cstdio>
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
int main(){
long n(0); std::cin >> n;
std::vector<std::string> winner(n + 1, "");
std::vector<long> points(n + 1, 0);
for(long k = 1; k <= n; k++){
std::string name; long addPoints;
... | ALGO | 0.999956 | 4.081086 |
b6dc6760-9160-426c-abc4-b9369845db10 | ashokabairwaideology/Leet-code-problem | solution/3000-3099/3036.Number of Subarrays That Match a Pattern II/Solution.cpp | int ps[1000001];
class Solution {
public:
int countMatchingSubarrays(vector<int>& nums, vector<int>& pattern) {
int N = size(pattern);
ps[0] = -1;
ps[1] = 0;
for (int i = 2, p = 0; i <= N; ++i) {
int x = pattern[i - 1];
while (p >= 0 && pattern[p] != x) {
... | ALGO | 0.999988 | 5.985757 |
f0969bef-9375-4913-a730-f7dc54b488a4 | 1maeth2/CCC | 2008/junior/body_mass_index.cpp | /*
*/
#include <iostream>
using namespace std;
using ll = long long;
void solve(){
float weight, height;
cin >> weight >> height;
float bmi = weight / (height * height);
if(bmi > 25){
cout << "Overweight\n";
}else if(bmi <= 25 && bmi >= 18.5){
cout << "Normal weight\n";
}else ... | ALGO | 0.999697 | 3.85651 |
241bccc8-cbaa-4b4a-aa28-1b31da8d2c62 | NJP6969/Codechef-ZCO-Prac | smart_phone.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long int arr[n];
for(int i = 0; i < n; i++){
cin >> arr[i];
}
sort(arr,arr + n);
long long int max = 0;
for(int i = 0; i < n; i++){
if(arr[i]*(n-i) > max){
max = arr[i]*(n-i);
... | ALGO | 0.999783 | 3.725238 |
ac6faed9-476c-4995-82ed-0f73394a656d | shreeyaac/1st-Year-IITB | CS 101/LAB QUIZ 2/LQ02_A_Q1.cpp | #include<iostream>
using std::cin;
using std::cout;
int main(){
int n;
double A[50][50];
cin >> n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
cin >> A[i][j];
}
}
double B[50][50];
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
B[i][j] = 0;
for(int k ... | ALGO | 0.99989 | 3.019677 |
b3a519d6-bf3a-4d79-a3aa-ec86c3cecf69 | RandomDeveloperM/UE4_Hairworks | Engine/Source/ThirdParty/PhysX/PhysX-3.3/Source/PhysXExtensions/src/ExtDistanceJointSolverPrep.cpp | #include "ExtDistanceJoint.h"
#include "PxSimpleTypes.h"
namespace physx
{
namespace Ext
{
PxU32 DistanceJointSolverPrep(Px1DConstraint* constraints,
PxVec3& body0WorldOffset,
PxU32 maxConstraints,
PxConstraintInvMassScale &invMassScale,
const void* constantBlock,
const PxTransform& bA2w,
const PxTransfor... | ALGO | 0.964233 | 6.450035 |
e19c7195-9355-43ba-9c45-7992c0620f55 | EdwardOu98/LeetCode | Daily Challenge/1235_Maximum_Profit_in_Job_Scheduling.cpp | #include <vector>
#include <algorithm>
#include <map>
using namespace std;
class Solution {
public:
int jobScheduling(vector<int>& startTime, vector<int>& endTime, vector<int>& profit) {
int n = startTime.size();
vector<vector<int>> jobs;
for(int i = 0; i < n; i++){
jobs.push_b... | ALGO | 0.999978 | 5.986066 |
c1c6b181-c397-4525-bb32-c0aa73b67174 | Superm4n97/competetive-programming | LightOJ/1176.cpp | #include<bits/stdc++.h>
#define ll long long int
#define show(x) cout << #x << " : " << x << endl
#define maxn 105
#define inf 10000000000000016
using namespace std;
ll bfs(ll R[maxn][maxn] ,ll parent[maxn] , ll st, ll fn)
{
ll visited[maxn];
memset(visited,0,sizeof visited);
queue<ll> q;
q.p... | ALGO | 0.999736 | 3.925797 |
2dea49dd-519f-4275-9bac-cf26df00b67f | Yogi1994/ds-algo-lib | GFG/shortest-common-supersequence.cpp | /*
https://practice.geeksforgeeks.org/problems/shortest-common-supersequence/0/
*/
#include <iostream>
using namespace std;
int main() {
//code
int t;
cin>>t;
while(t--){
char a[1000], b[1000];
cin>>a>>b;
int m, n;
for( int i =0; a[i]!='\0'; i++) {
m = i+1;
}
for( int i =0; ... | ALGO | 0.999913 | 5.418632 |
1880ea47-8dee-47f8-9ce3-982fb9f4739b | chiragm14/CPP-PROGRAMS | New folder/primeno.cpp | #include <iostream>
using namespace std;
bool isPrime(int n){
for(int i=2;i<n;i++){
if(n%i==0){
return 0;
}
}
return 1;
}
int main(){
int n;
cout<<"Enter a number: ";
cin>>n;
if (isPrime(n))
{
cout<<n<<" is a Prime no.";
}
else{
... | ALGO | 0.999705 | 3.76247 |
c998f730-a423-4e56-b07f-e1fe61d09746 | MTE1991/DSA-Practice | mergesort_ll.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int value) : data(value), next(nullptr) {} // Constructor to init node w/ value
};
Node* merge(Node* left, Node* right) {
Node dummy(0);
Node* tail = &dummy;
dummy.next = nullptr;
while (true) {
... | ALGO | 0.999999 | 6.142864 |
3e3a1d2f-e88b-4d84-8cee-53b8c31c7337 | IamAnkit19/Codes | C++ Programs/Recursion/CheckSmithNumber.cpp | #include<iostream>
using namespace std;
int sumOfDigits(int n) {
if (n == 0)
return 0;
return (n % 10) + sumOfDigits(n / 10);
}
bool isPrime(int num, int i = 2) {
if (num < 2) return false;
if (i * i > num) return true;
if (num % i == 0) return false;
return isPrime(num, i + 1);
}
int... | ALGO | 0.999873 | 5.720261 |
3dafef0d-9f80-44cc-849b-2fcd63a32aee | not-a-dev0/Awesome-Quant-Machine-Learning-Trading | C++/word-pattern.cpp | // Time: O(n)
// Space: O(c), c is unique count of pattern
class Solution {
public:
bool wordPattern(string pattern, string str) {
// Count the words.
int cnt = str.empty() ? 0 : 1;
for (const auto& c : str) {
if (c == ' ') {
++cnt;
}
}
... | ALGO | 0.999434 | 6.505342 |
9cadf6b1-0766-47d9-92a3-f7d275e637e0 | Hyuk-II/Algorithms-Study | 03. class2-1/05_2798_๋ธ๋์ญ.cpp | // 2024.03.20
// N์ฅ์ ์นด๋์ ์จ์ ธ ์๋ ์ซ์๊ฐ ์ฃผ์ด์ก์ ๋, M์ ๋์ง ์์ผ๋ฉด์ M์ ์ต๋ํ
// ๊ฐ๊น์ด ์นด๋ 3์ฅ์ ํฉ์ ๊ตฌํด ์ถ๋ ฅํ์์ค.
#include <iostream>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
int *arr;
arr = new int[N];
int min = M;
int save = 0;
for (int i = 0; i < N; i++) {
cin >> arr[i];
}
f... | ALGO | 0.999983 | 5.361947 |
171d7fb2-05eb-4e01-9dad-9520f3b60199 | kagaya85/CodePractice | pat/Unit6/map/A1022/A1022.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <map>
#include <string>
#include <set>
using namespace std;
map<string, set<int>> titleMap, authorMap, keyMap, pubMap, yearMap;
void query(map<string, set<int>> &m, string &key) {
if(m.find(key) != m.end()) {
for(set<int>::iterator i... | ALGO | 0.990719 | 3.785064 |
feb90086-50c6-4b94-891c-c67fefcf6a91 | DionysiosB/CodeChef | CHN15A.cpp | #include <cstdio>
int main(){
long t; scanf("%ld", &t);
while(t--){
long n, k; scanf("%ld %ld", &n, &k);
long cnt(0);
while(n--){long x; scanf("%ld", &x); cnt += ((x + k) % 7 == 0);}
printf("%ld\n", cnt);
}
return 0;
}
| ALGO | 0.999462 | 3.404104 |
d976ddba-7207-43a8-a75c-b045e1aa7e3d | SmokedDuck1591/ProblemSolved | barkingdog/0x10/2579.cpp | #include <bits/stdc++.h>
using namespace std;
int stair[300];
int arr[300][2];
int main(void)
{
ios::sync_with_stdio(0), cin.tie(0);
int n;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> stair[i];
arr[1][1] = stair[1];
arr[2][1] = stair[2];
arr[2][2] = stair[1] + stair[2];
for (int i = 3; i <= n; ... | ALGO | 0.9999 | 3.650734 |
3eca7aaa-15ae-4270-8ed4-e11e9ceff96a | thisisamanmishra/CrackYourPlacment | containerWithmostwater.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int left = 0, right = height.size() -1, ans=0;
while(left<right){
ans = max(ans, min(height[right],height[left])*(right-left));
if(height[right] > height[left]){
left++;
}else{
... | ALGO | 0.999918 | 6.505545 |
9177931f-8800-47eb-8234-0b1981f491f6 | Taha-Adeel/CP | Codeforces Round #846 (Div. 2)/B_GCD_Partition.cpp | #include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0)
template<class T> struct V: vector<T>{using vector<T>::vector;
void sort() {std::sort(this->begin(), this->end());}
void sort_dsc() {std::sort(this->begin(), this->end(), greater<T>());}
auto sum() {T sum = 0; for(... | ALGO | 0.999671 | 4.421269 |
8214269e-33e0-42f6-844c-3378036b6f4e | ymbahe/hydrangea-postprocessing | CODE/Protea/utilities_special.cpp | #include "Config.h"
#include <mpi.h>
#include <iostream>
#include <vector>
#include <sys/time.h>
#include <algorithm>
#include "/u/ybahe/cpplib/utilities.h"
#include "utilities_special.h"
#include "globals.h"
#ifdef USE_OLD_FUNCTION_SWITCH
void function_begin(std::string sFuncName)
{
g_vFunctionStartTimes.push_bac... | CONFIG | 0.968689 | 3.980584 |
a1360756-68d2-4578-b424-89fcb39078c4 | AbdullahAlAmaan/ECE-250 | 1D_Arrays/Max.cpp | #include <iostream>
using namespace std;
int main(){
int arr[5]={1,2,3,4,5};
int max=arr[0];
for(int i=1;i<5;i++){
if(arr[i]>max){
max=arr[i];
}
}
cout <<max;
} | ALGO | 0.998236 | 3.313107 |
cae94b9f-53f3-4bcb-9e56-d10899af6134 | danishzulfiqar/CodeChef | Who is Taller/taller.cpp | #include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
int main()
{
int test_cases;
cin >> test_cases;
while (test_cases--)
{
int x, y;
cin >> x >> y;
if (x > y)
cout << "A" << endl;
else
cout << "B" << endl;
}
re... | ALGO | 0.999906 | 4.220452 |
89d90b6a-353e-44a5-804a-37cf64f0a9f5 | marataya/flutter_demo_apps | newsfeed_infi_scroll_plus_switch_view/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.997652 | 6.783439 |
e984c746-a01c-402e-9829-eb7bb6a800d0 | Altu-Bitu/Altu-Bitu-MJ | 10์ 5์ผ - ๋ถํ ์ ๋ณต/17281.cpp | //
// Created by user on 2021-10-12.
// [๋ฐฑ์ค] 17281 - ์ผ๊ตฌ
// 211005 - ๋ถํ ์ ๋ณต (conquer - divide - combine)
//
#include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> innings;
vector<int> order(10, 0); //ํ์
vector<bool> check(10, false); // ์ ์์ ์์ ์ ํด์ก๋์ง
int n, ans; // n: ์ด๋ ์. ans: ์ต์ข
๋ต
//ํ์ฌ ๋ฐฐ์น์ ์ ... | ALGO | 0.999943 | 5.649795 |
277cf22b-8b3f-48c8-b30d-045f31c0ea77 | devyaniChoubey/My-Solutions-DS-Algo | Hashing/Ransom note.cpp | https://leetcode.com/problems/ransom-note/?envType=study-plan-v2&envId=top-interview-150
class Solution {
public:
bool canConstruct(string ransomNote, string magazine) {
int counter[26] = {};
for(char &c:magazine) counter[c-'a']++;
for(char &c:ransomNote){
counter[c-'a']--;
... | ALGO | 0.999891 | 6.444543 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.