uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5cf1d546-f59e-4bbc-8f2c-92ea9714309c | alexandraback/datacollection | solutions_5765824346324992_1/C++/unguguy/B.cpp | #include <functional>
#include <algorithm>
#include <iostream>
#include <climits>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#... | ALGO | 0.999976 | 3.600425 |
aec63650-7052-4558-b69d-b1ece61d2da1 | ishandutta2007/codeforces | autumnkite/normal/1031/D.cpp | #include <bits/stdc++.h>
const int N = 2005;
int n, k;
char a[N][N];
char ans[N * 2];
struct State {
int x, y;
int cnt;
};
int mn[N][N];
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
std::cin >> n >> k;
for (int i = 0; i < n; ++i) {
std::cin >> a[i];
}
std::vector<State> pos;
if ... | ALGO | 0.999984 | 3.023594 |
246bec41-e8fe-4afd-9913-5d9bb5a814dd | Ananda-01/Basic-Data-Structure | Module8_15_06/reverse_and_original.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node* next;
Node(int val)
{
this->val=val;
this->next=NULL;
}
};
void insert_tail(Node*&head,Node*&tail,int val)
{
Node*newnode=new Node(val);
if(head==NULL)
{
head=newnode;
ta... | ALGO | 0.999774 | 5.136576 |
1b7d808b-1b4f-4eda-8fa8-f1175e6f9e16 | kSagiri998/BSOJ-answers | 1418.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
struct f {
int s,e,c;
} a[30005];
int cmp(f a,f b) {
return a.s<b.s;
}
int t[30005];
int main() {
int n,i,j,Max=0;
scanf("%d",&n);
for(i=1; i<=n; i++) {
scanf("%d%d%d",&a[i].s,&a[i].e,&a[i].c);
}
sort(a+1,a+n+1,cmp);
for(i=n;i>0;i--){
t[i]=a[i].c;
... | ALGO | 0.99981 | 3.721196 |
0af9c273-6e12-40a2-9fbb-f420e73ea31c | ishandutta2007/codeforces | burnoutag7/normal/1542/B.cpp | #include<bits/stdc++.h>
using namespace std;
void mian(){
int n,a,b;
cin>>n>>a>>b;
if(a==1){
cout<<(n%b==1%b?"Yes\n":"No\n");
}else{
for(long long x=1;x<=n;x*=a)if((n-x)%b==0){
cout<<"Yes\n";
return;
}
cout<<"No\n";
}
}
int main(){
ios::... | ALGO | 0.999676 | 3.839158 |
8313a763-f527-40d4-877b-e447cd5bac3d | lisbao1303/Marlin-2.0.x | Marlin/src/lcd/fontutils.cpp | /**
* @file fontutils.cpp
* @brief help functions for font and char
* @author Yunhui Fu (<EMAIL>)
* @version 1.0
* @date 2016-08-19
* @copyright GPL/BSD
*/
#include "../inc/MarlinConfig.h"
#define MAX_UTF8_CHAR_SIZE 4
#if HAS_WIRED_LCD
#include "marlinui.h"
#include "../MarlinCore.h"
#endif
#inc... | TOOL | 0.905583 | 5.797014 |
9b747068-c094-4766-bb3e-87efb1fb2cff | ShtOneg/OOPDZ | HM/HM.cpp | #include <iostream>
using namespace std;
int* bubbleSort(int* list, int length);
int* selectionSort(int* list, int length);
int* insertionSort(int* list, int length);
int main()
{
setlocale(LC_ALL, " ");
int* nums = new int[5] {1, 8, 9, 6, 7};
int* b = bubbleSort(nums, 5);
int* c = selectionSort(num... | ALGO | 0.99996 | 4.476139 |
b040a172-93d4-4375-9edb-f192ecebf325 | ajay-1134/Concepts | DP/LCS/lcs_recursive.cpp | #include<bits/stdc++.h>
using namespace std;
int lcs(string s1, string s2, int n, int m){
if(n == 0 || m == 0){
return 0;
}
if(s1[n-1] == s2[m-1]) return 1 + lcs(s1,s2,n-1,m-1);
return max(lcs(s1,s2,n-1,m),lcs(s1,s2,n,m-1) );
}
int main(){
string s1,s2;
cin>>s1>>s2;
int n = s1.leng... | ALGO | 0.999994 | 4.814268 |
eaa62435-294f-4017-866f-8cf8296825ff | tech-saurabh382/Dsa-Suprem-1.0 | Arrays, Time Complexity & Space Complexity/Array - class 1/Minimum_no_in_an_array.cpp | #include <iostream>
#include <limits.h>
using namespace std;
int main()
{
int arr[] = {2, 4, 6, 1, 3, 7, 9, 12, 56, 42, 21};
int size = 11;
// initaize the mini variable with the maximum possible integer value
int mini = INT_MAX;
for (int i = 0; i < size; i++)
{
if (arr[i] < mini)
... | ALGO | 0.999968 | 4.187384 |
e8a24158-ff18-41ff-825f-aceceb94b0bc | ishandutta2007/codeforces | lichenkoh/normal/663/B.cpp | #include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
const ll UNDEF = -1;
template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<ty... | ALGO | 0.999486 | 4.324929 |
3977be16-7e23-49c4-a19b-70f79b717b07 | Pankhuri-R/DSA_Cpp | BinaryTree/heightNDiameter.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
Node(int val)
{
data = val;
left = NULL;
right = NULL;
}
};
int calcHeight(Node *root)
{
if (root == NULL)
{
return 0;
}
int lHeight =... | ALGO | 0.999908 | 5.645824 |
b539b924-a991-4b55-9fe8-57daa4a4dbd0 | RyanL123/Competitive-Programming | CCC C++/2010/J5.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define srt(x) sort(x.begin(), x.end())
#d... | ALGO | 0.999764 | 3.723845 |
83884c42-52d7-4814-b769-1eca418c6f03 | OpenDigitalTwin-Dev/Particles | lammps/src/CORESHELL/pair_buck_coul_long_cs.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Hendrik Heenen (<EMAIL>)
------------------------------------------------------------------------- */
#include "pair_buck_coul_long_cs.h"
#include <cmath>
#include "atom.h"
#include "force.h"
#include... | ALGO | 0.991914 | 5.235634 |
4c824e74-1373-42cd-834f-eadcb13f6fbd | JohnLimb2112/CudaVortexShredding | boundary.cpp | #include "data.h"
#include "boundary.h"
/**
* @brief Given the boundary conditions defined by the flag matrix, update
* the u and v velocities. Also enforce the boundary conditions at the
* edges of the matrix.
*/
void apply_boundary_conditions() {
for (int j = 0; j < jmax+2; j++) {
/* Fluid freely flo... | ALGO | 0.999956 | 6.863096 |
793a7e10-4a0f-43de-8f5a-30889760c8d9 | nittratan/DSA | Stack/LLstack.cpp | #include<iostream>
using namespace std;
struct node
{
int data;
node* next;
};
class Stack
{
private:
node* top;
public:
Stack()
{
top = NULL;
}
void Push(int n)
{
node* temp = new node();
temp->data = n;
temp->next = NULL;
if (top == NULL)
{
top = temp;
}
else
{
temp->next = top;
top... | ALGO | 0.966648 | 3.779559 |
7876925b-57ed-4ce6-90a2-833a1fa92cca | NguyenMinhThuan24112001/Data_structures_and_Algorithms_PTIT | hinh chu nhat lon nhat.cpp | #include<iostream>
#include<stack>
#define ll long long
using namespace std;
const int oo = 111111;
ll A[oo];
ll R[oo], L[oo], D[oo], P[oo], top = 0;
int main(){
int test; cin >> test;
while(test--){
int n; cin >> n;
top = 0;
for(int i=0; i<n; i++) cin >> A[i];
D[0] = -1;
stack<int> st1, st2;
st1.push(-1)... | ALGO | 0.999822 | 3.958926 |
88570bee-cb0f-4af7-8580-01771ff9c055 | NgocThao0412/C-s-l-p-tr-nh | Tính ngày từ 1-1-1 đến d-m-y.cpp | #include <iostream>
#include <cmath>
using namespace std;
int KTNnhuan(int y) //Kt năm nhuận
{
return(y % 4 ==0 && y % 100!=0) ||( y %400==0);
}
int TVdays(int y, int m)// Trả về số ngày trong tháng
{
int days[]={31,28,31,30,31,30,31,31,30,31,30,31};
if(m==2 && KTNnhuan(y))
... | ALGO | 0.999796 | 3.98451 |
5100e938-3bed-4762-b4ed-44de2644d958 | ermine27/competitive-programming | src/atcoder/abc/196/196-c.cpp | #include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = (int)(s); i < (int)(n); ++i)
#define rep(i,n) reps(i,0,n)
int main(){
string n;
cin >> n;
int ns = n.length();
if(ns == 1){
cout << 0;
return 0;
}
if(ns % 2 == 1) {
n = to_string(pow(10, ns -... | ALGO | 0.999419 | 4.352163 |
938a9df9-8c8f-4102-a4a8-460645bdb165 | nguyencatdinh/TestCaseGeneration | TestCaseGeneration/INPUT/Solvable/Solvable 3.cpp | int foo(int n) {
int x = 3;
int i = 0;
while (i < n) {
if (i % 2 == 1) {
x = 5;
}
else {
x = 7;
}
i++;
}
return x;
}
| ALGO | 0.999092 | 3.953102 |
132b746a-6410-4b8a-9115-65a436643825 | Kristiyan93/Cpp-Fundamentals | 01. Introduction to C++ and Basic Syntax/homework/06GreatestCommonDivisor.cpp | #include <iostream>
int main() {
int a, b;
std::cin >> a >> b;
int smallDigit = (a < b) ? a : b;
int bigDigit = (a > b) ? a : b;
while (a != b && smallDigit != 0) {
unsigned r = bigDigit % smallDigit;
bigDigit = smallDigit;
smallDigit = r;
}
std::cout << bigDigit... | ALGO | 0.999887 | 4.874338 |
01593c48-680f-4a36-9023-e6e12fee5180 | bhumitmehta/csesfiproblemset | grayCode.cpp | #include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <numeric> // Include this header for std::accumulate
#include <stdexcept> // Include this header for std::out_of_range
#include <cmath>
using vecint = std::vector<int>;
using str = std::string;
using lli = long long int;
#define RE... | ALGO | 0.999989 | 4.615158 |
2ba742c6-83d0-4103-bd43-ce0761b2a3d3 | ashikurrahmanbhuiyan/codeforces | 825-div2/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define el "\n"
#define in(a) int a; cin >> a;
#define int long long int
#define vi vector<int>
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/__gcd(a,b)
#define lb(arr,n,t) lower_bound(ar... | ALGO | 0.99906 | 4.543715 |
ff93518e-f461-443b-a370-4558951fd450 | juniors719/preparatorio-OBI2023 | beecrowd/1175_trocavetor.cpp | #include <iostream>
using namespace std;
int main() {
int v[20];
for(int i = 0; i < 20; i++){
cin >> v[i];
}
int p = 19;
for(int i = 0; i < 10; i++){
swap(v[i], v[p]);
p--;
}
for(int i = 0; i < 20; i++){
cout << "N[" << i << "] = " << v[i] << endl;
}
} | ALGO | 0.999181 | 3.037608 |
05569f4c-d7c8-4b7a-9684-2ea9f46e26cc | GreenCrowDev/hoodie | thirdparty/pmp-library-3.0.0/src/pmp/algorithms/distance_point_triangle.cpp | #include "pmp/algorithms/distance_point_triangle.h"
#include <cmath>
#include <limits>
namespace pmp {
Scalar dist_point_line_segment(const Point& p, const Point& v0, const Point& v1,
Point& nearest_point)
{
Point d1(p - v0);
Point d2(v1 - v0);
Point min_v(v0);
Scalar ... | ALGO | 0.999418 | 7.136938 |
753dfbed-897b-469e-aed3-6fba775ef125 | atomickashyap/Problem-Set-DSA | 1318-minimum-flips-to-make-a-or-b-equal-to-c/1318-minimum-flips-to-make-a-or-b-equal-to-c.cpp | class Solution {
private:
public:
int minFlips(int a, int b, int c) {
int ans=0;
for(long i=0;i<=30;i++){
long d1=a&1;
long d2=b&1;
long d3=c&1;
if(d3==0) {
ans += d1+d2;
}
else {
if(d1==... | ALGO | 0.999808 | 5.599833 |
8d13ce53-23eb-4517-adb1-4915c605e5dc | tang415a/algorithms | strings/strSearch.cpp | // Implement a sub-string search algorithm using Boyer Moore algorithm.
// e.g. given a string "aabbccdd" and search for "bcc", then the output is:
// "found at 3".
#include <iostream>
#include <string>
using namespace std;
int badShift(char c, const string &pattern, int (&badShiftTable)[256]) {
if (badShiftTable[c... | ALGO | 0.999987 | 6.777112 |
13ef7df9-bb01-4b28-a6e1-ae4611f964b7 | azpeteryang/leetcode | Dynamic_Programming/727.Minimum-Window-Subsequence/727.Minimum-Window-Subsequence.cpp | class Solution {
public:
string minWindow(string S, string T)
{
int m = S.size();
int n = T.size();
S = "#"+S;
T = "#"+T;
auto dp = vector<vector<int>>(m+1,vector<int>(n+1,0));
for (int j=1; j<=n; j++)
dp[0][j] = INT_MAX/2;
for (int i... | ALGO | 0.999994 | 6.263941 |
40e17420-ba85-4c29-8b7e-2d907d0aa038 | sarathgalimelu/XML_Clustering | FinalProject-Code/structure.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
using namespace std;
int main( )
{
int i=0,z=0,v=0,s=0;
float content_si=0.0,structure_si=0.0;
int lvl[100],lvl1[100][100],h[100];
char line[50];//node length < 50
char node[50][100],parent[50][100],node1[50][100][100],parent1[5... | ALGO | 0.997313 | 3.039392 |
313912da-5211-432f-935e-0e52140bac63 | ohdodin/kai-world.io | 자료구조/기말prob1.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_WORD_LEN 20
#pragma warning (disable: 4996)
struct node {
char* data;
struct node* prev, * next;
};
typedef struct node Node;
void ordered_insert(char* item);
void remove_dup();
void print_list_twice();
Node* head = NULL, * tail = NULL;
int ma... | ALGO | 0.999784 | 4.234648 |
687b3cf0-e1ad-4ca0-bada-65bb38f76f10 | egormkn/ifmo-kt | course1/discrete_math/probability/D_absmarkchain.cpp | #include <cstdio>
#include <vector>
#include <cmath>
using namespace std;
FILE *fin = fopen("absmarkchain.in", "r");
FILE *fout = fopen("absmarkchain.out", "w");
int main(int argc, char **argv) {
const double eps = 1e-8;
int n, m, nonabs, abs = 0;
fscanf(fin, "%d %d", &n, &m);
vector<int> a, b;
v... | ALGO | 0.999691 | 3.732993 |
34cb7554-75ca-4bab-8dfb-8ba8190d4c2f | sarvex/leetcode-object-pascal | solution/2400-2499/2483.Minimum Penalty for a Shop/Solution.cpp | class Solution {
public:
int bestClosingTime(string customers) {
int n = customers.size();
vector<int> s(n + 1);
for (int i = 0; i < n; ++i) {
s[i + 1] = s[i] + (customers[i] == 'Y');
}
int ans = 0, cost = 1 << 30;
for (int j = 0; j <= n; ++j) {
... | ALGO | 0.999964 | 6.006382 |
fac9a46c-096d-4844-8d73-b14a12d2907e | mattwatts/ZC_CP | cplan/160402__sf__spattool_validation_files/sf_validation/cluster1.cpp | #include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <string.h>
#define PI 3.141592654
struct bNode {
int nIndex;
float fDist;
};
struct binLookup {
int nIndex;
int nOffset;
int nI... | DATA | 0.997591 | 3.776081 |
c4e1b8fb-6900-423c-8dc8-40941a52e4ee | PRANAVJARANDE/CodeForces | C_Trip_to_the_Olympiad.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<ll, ll> pl;
typedef vector<int... | ALGO | 0.99987 | 3.218394 |
b5a150af-e39a-4a09-a2e0-c729d0cc35fc | yuvraj0028/leetcode-submissions | 2292-counting-words-with-a-given-prefix/counting-words-with-a-given-prefix.cpp | class Solution {
private:
bool isValid(string &prefix, string &word){
int n = prefix.size();
int m = word.size();
if(n > m) return false;
int i = 0, j = 0;
while(i<n){
if(prefix[i] != word[j]){
return false;
}
i++;
... | ALGO | 0.999969 | 6.331562 |
a817b628-6383-4b03-b3f6-428a65909510 | dolphin-li/SewingEditor | algorithm/arcsim/adaptiveCloth/transformation.cpp | #include "transformation.hpp"
using namespace std;
namespace arcsim
{
Transformation identity()
{
return Transformation();
}
Transformation inverse(const Transformation &tr)
{
Transformation in;
in.scale = 1.f / tr.scale;
in.rotation = inverse(tr.rotation);
in.translation = Vec3(0.) -
in.rotation.... | ALGO | 0.962969 | 5.300366 |
7b409dde-5266-41a6-b59e-6c0823d61d5f | wangzy0327/Leetcode-Practice | leetcode_0020/cpp/leetcode_0020.cpp | //
// Created by wzy on 2022/3/17.
//
#include<iostream>
#include<queue>
#include<vector>
#include <algorithm>
#include <unordered_map>
#include <list>
#include <deque>
#include <stack>
#include <sstream>
#include <typeinfo>
#include <climits>
using namespace std;
class Solution {
public:
bool isValid(string s) ... | ALGO | 0.996903 | 5.450109 |
765def51-e15f-4da8-9e7a-a214d2169336 | tamim1715/Algorithm | bellman ford/uva 10449 - Traffic.cpp | #include <iostream>
#include <cstdio>
using namespace std;
#define inf 100000007
#define mx 4007
#define pow(x) ((x) * (x) * (x))
int r, q, edge_cost, x, y, u, v;
int busyness[mx], edge_u[mx], edge_v[mx], costs_uv[mx];
int d[mx];
void bellman_ford(int n)
{
for(int i = 1; i <= n; i++) {
d[i] = inf;
scanf("%d", &... | ALGO | 0.999947 | 3.649054 |
05dea53c-18f4-488e-a9cf-85e8020d3854 | iamfahim/LightOJ | 1009.cpp | #include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
using namespace std;
#define Max_size 20010
vector<int>adj[Max_size];
int color[Max_size];
int graphcoloring(int s)
{
int countone=0,countzero=0;
queue<int>Q;
Q.push(s);
color[s]=1;
countone+... | ALGO | 0.999883 | 4.630089 |
cab93315-a7a5-444a-9f29-6ca1178f8403 | Lonestar827/SeattleUCode | c3500/3500_E_3_2/pthread-data-sharing-mutex-os-call.cpp | #include <iostream>
#include <pthread.h>
#include <stdlib.h>
#define TOTAL_THREADS 4
int count;
pthread_mutex_t the_mutex; // phread mutex variable - initialize here if using the initializer macro
void* myFunction(void* arg)
{
int actual_arg = *((int*) arg);
for(unsigned int i = 0; i < 10; ++i) {
... | ALGO | 0.951017 | 4.901306 |
7ebe2985-ce41-484c-a3bb-c104f8f51593 | emmanuel-byke/arduino-water-management-project | Normalize.cpp | #include "Normalize.h"
Normalize::Normalize(int repeate) {
Normalize::repeate = repeate;
}
int Normalize::getValue() {
return int(value);
}
void Normalize::addValue(int val) {
if (counter < repeate) {
counter++;
value += val;
value /= counter;
} else {
counter = 0;
value = val;
}
}
| TOOL | 0.965468 | 3.780149 |
fab18ff8-98ea-4d0c-8c25-d933f578d9d2 | tiqwab/atcoder | abc133/e/main.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
template<class T>
inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
template<class T>
inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
... | ALGO | 0.999931 | 4.60761 |
ab45aa9b-6793-40e5-9127-98c0f3e0bfdd | HLRJ/Cpu0_For_LLVM17 | llvm-project-llvmorg-17.0.6/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp | #include "Parser.h"
#include "Utils.h"
#include "mlir/Analysis/Presburger/IntegerRelation.h"
#include "mlir/Analysis/Presburger/PWMAFunction.h"
#include "mlir/Analysis/Presburger/Simplex.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <numeric>
#include <optional>
using namespace mlir;
using namespace ... | TEST | 0.855653 | 4.228248 |
2c475e61-7da2-43ba-88f4-c3124e3ad1c3 | hisenyiu2015/android_frameworks_av | media/libstagefright/codecs/amrnb/dec/src/d4_17pf.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/d4_17pf.c
Functions: decode_4i40_17bits
Date: 01/28/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Modified to place file in t... | ALGO | 0.999565 | 5.510615 |
9e2b4113-2d94-4482-9464-21ca5200e4c8 | Evgeny999/ya-pract-mid-Cpp-module-5 | src/main.cpp | #include "convex_hull.hpp"
#include "geometry.hpp"
#include "intersections.hpp"
#include "queries.hpp"
#include "shape_utils.hpp"
#include "triangulation.hpp"
#include "visualization.hpp"
#include <algorithm>
#include <print>
#include <ranges>
using namespace geometry;
namespace rng = std::ranges;
namespace views = ... | ALGO | 0.988927 | 7.277136 |
318754ac-0f0f-4a19-a215-a5a3b6744b16 | ishandutta2007/codeforces | princebelkovetz/normal/334/A.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#define endl "\n"
#define int long long
#define debug(x) cout << #x << " is " << x << endl;
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);... | ALGO | 0.996659 | 3.41512 |
427fedf9-1f1d-4562-9708-5e3ff12c38e2 | Apress/learn-cocos2d-game-dev-w-ios-5 | CH15_code/CocosWithCocoa05/CocosWithCocoa/libs/Box2d/Dynamics/Contacts/b2ContactSolver.cpp | #include <Box2D/Dynamics/Contacts/b2ContactSolver.h>
#include <Box2D/Dynamics/Contacts/b2Contact.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Dynamics/b2World.h>
#include <Box2D/Common/b2StackAllocator.h>
#define B2_DEBUG_SOLVER 0
b2ContactSolver::b2ContactSolver(b2Conta... | ALGO | 0.999559 | 6.633346 |
4af52e84-f9b1-4c7c-ac55-a29c88ff36f4 | naixt1478/Brickjoon | Brickjoon_Src/1149.cpp | #include <bits/stdc++.h>
#define _FASTIOS ios::sync_with_stdio(0),cin.tie(nullptr),cout.tie(nullptr)
using namespace std;
namespace rng = ranges;
int main()
{
_FASTIOS;
int N;
cin >> N;
vector<vector<int>> vvi1(N, vector<int>(3));
for(auto& vi1 : vvi1)
for(auto& i1 : vi1)
{
cin >> i1;
}
for(int i = 1; i < N... | ALGO | 0.999849 | 4.020407 |
f6b417ad-e995-4ec4-a328-ea35be9fc4b2 | denis-gubar/Leetcode | Segment Tree/2213. Longest Substring of One Repeating Character.cpp | class Solution {
public:
vector<int> longestRepeating(string s, string queryCharacters, vector<int>& queryIndices) {
int N = queryCharacters.size(), M = s.size();
vector<int> result(N);
set<pair<int, int>> S, B;
int i = 0;
while (i < M)
{
int j = i;
... | ALGO | 0.99978 | 5.758248 |
364befa7-f2b1-4abf-9d63-92145f39ff61 | raincross7/code-similarity | codes/train_code/problem495/problem495_486.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
ll solve(vector<int>arr,int i,int a,int b,int c,ll sa,ll sb,ll sc)
{
if(i==arr.size())
{
if(!sa||!sb||!sc)
return INT_MAX;
return abs(a-sa)+abs(b-sb)+abs(c-sc);
}
ll op1=solve(arr,i+1,a,b,c,sa,sb,sc);
ll op2=solve(arr,i+1,a,b,c,sa+arr[i],sb... | ALGO | 0.999932 | 4.51277 |
0ce116b0-fdd0-4241-8b7b-5ec0e794bde8 | azartheen/leetcode | 30days-challenge/202006/day4.cpp | /*
Reverse String
Write a function that reverses a string. The input string is given as an array of characters char[].
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
You may assume all the characters consist of printable ascii characters.... | ALGO | 0.999831 | 6.138278 |
17cfee7d-6267-4f90-b5c8-9b3b904eb5b2 | 0x4E65726F/mtsac-algorithm | part_2/pa6/extra_credit.cpp | /* Program: PA_6_extra_credit
Author: Nero Li
Class: CSCI 230
Date: 04/12/2022
Description:
Implement the find/union partition structure as a tree-based
approach. Use Partition.java and Position.java from Java
textbook as a guide to create your own code, add a dr... | ALGO | 0.999507 | 5.817251 |
0350db9d-b9ba-48c9-b59e-2792f7f28bcf | tysik/figure_fitter_2D | examples/dummy.cpp | #include <iostream>
#include "../figures/vec.h"
using namespace std;
using namespace figfit;
int main() {
Vec v1(1.0, -1.0);
Vec v2(1.0, 1.0);
Vec normal(0.0, 1.0);
cout << "v1: " << v1 << endl;
cout << "v2: " << v2 << endl;
cout << "normal: " << normal << endl;
cout << endl;
cout << "dot(v1, v2) ... | ALGO | 0.974648 | 5.055892 |
f9b77828-8062-44f0-b1d2-f69a718af8d0 | DushyantBhardwaj07/CodeForces-DSA | C_George_and_Job.cpp | #include<bits/stdc++.h>
using namespace std;
#define yes "YES"
#define no "NO"
#define ll long long
#define mod 1000000007
ll dp[5005][5005];
ll sum[5005];
int main() {
// your code goes here
ll n,m,k,i,j,size,ki;
cin>>n>>m>>ki;
size=m;
ll a[n+2];
if(m==1)
{
for(i=0;i<n;i++)... | ALGO | 0.999973 | 3.682549 |
7eaa1505-04a5-4b3a-9524-adcb7d3b21a9 | YamaguchiKoki/rasen | section10/stl_priority_queue/example.cpp | include<bits/stdc++.h>
using namespace std;
int main() {
char com[20];
//デフォルトでは値の大きいものから優先度付けされている
priority_queue<int> PQ;
while(1) {
scanf("%s", com);
if(com[0] == 'i') {
int key; scanf("%d", &key);
PQ.push(key);
} else if(com[1] == 'x') {
... | ALGO | 0.991897 | 3.48015 |
62da4332-b22a-48f8-b1eb-795a9b54e0c8 | gourikasoni/100-days-challenge | day 3/FINDK3.cpp | #include <iostream>
using namespace std;
int main()
{
int t,x,y,z,p,q,r;
cin>>t;
while(t--)
{
cin>>x>>y>>z;
p=x*y;
q=y*z;
r=x*z;
if(p%z==0)
{
cout<<p<<" " << z<<endl;
}
else if(q%x==0)
{
cout<<q<< " "<<x<<endl;
}
else if(r%y==0)
{
... | ALGO | 0.999708 | 3.632334 |
7c3682fc-7451-47ea-990c-e9a232d70949 | subhamengine/Leetcode | 1689-partitioning-into-minimum-number-of-deci-binary-numbers/1689-partitioning-into-minimum-number-of-deci-binary-numbers.cpp | class Solution {
public:
int minPartitions(string n) {
return *max_element(begin(n), end(n)) - '0';
}
}; | ALGO | 0.999787 | 6.167188 |
d2f31115-5ac6-4528-8302-aadb0ce59d68 | immmdev/verbose-spoon | set_matrix_0/set_matrix_zero_optimal.cpp | #include<bits/stdc++.h>
using namespace std;
// Time complexity: O(2 * n * m)
// Space complexity: O(1); in-place matrix manipulation without extra space
int main(){
int n, m;
cin >> n >> m;
// Taking a 2D matrix as input
vector<vector<int>> nums(n, vector<int>(m));
// Input the elements of the m... | ALGO | 0.999977 | 6.732549 |
3278aeb3-7b4f-4627-8511-a6cc8b617799 | WANDOKING/BOJ | C++/10811 바구니 뒤집기.cpp | #include <iostream>
#include <algorithm>
#define MAX_N 100
#define MAX_M 100
int g_basket[MAX_N + 1];
int main(void)
{
std::cin.tie(nullptr);
std::ios_base::sync_with_stdio(false);
int N;
int M;
std::cin >> N >> M;
for (int i = 1; i <= N; ++i)
{
g_basket[i] = i;
}
for (int i = 0; i < M; ++i)
{
int a... | ALGO | 0.999992 | 4.170447 |
aaec3828-341e-4ce1-b865-daa9f7a76fbb | paolo-torres/interview-prep | leetcode/all/categories/arrays/find_first_and_last_position_of_element_in_sorted_array.cpp | /*
Given sorted int array, find start & end of a given target
Ex. nums = [5,7,7,8,8,10], target = 8 -> [3,4]
2 binary searches, slightly diff (biased towards left/right)
Time: O(log n)
Space: O(1)
*/
class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
vec... | ALGO | 0.999958 | 6.855711 |
fadbb515-a3ed-4c22-b18d-6a0b7f473842 | ishandutta2007/codeforces | .tx/normal/371/C.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <memory.h>
#define scid(a) int a; scanf("%d", &a)
#define sciid(a, b) int a, b; scanf("%d%d", &a, &b)
#define sciiid(a, b, c) int a, b, c; scanf("%d%d... | ALGO | 0.999583 | 3.433685 |
b2bc70e9-ceef-4254-bfac-20f519408397 | hehe520/Data-structure-and-algorithm | 数组_矩阵_位运算/块状数组.cpp | #include <stdio.h>
#include <stdlib.h>
// ״ - +
typedef int elemtype;
typedef int status;
#define ERROR 0
#define OK 1
#define SIZE 5 // ÿ 5 Ԫ
// ܶ = (SIZE * sizeof(elemtype)) / (sizeof(node));
typedef struct node
{
elemtype data[SIZE];
node *next;
}node, array;
void create(array **a, int size) //
{
int n =... | ALGO | 0.999595 | 3.62105 |
569090ec-3adb-4d30-8b8e-ef29c5aee387 | shakibshalim2/week1 | tempCodeRunnerFile.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n), b(m);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
for (int i = 0; i < m; ++i) {
cin >> b[i];
}
int count = 0;
int i = 0, j = 0;
while (i < n &&... | ALGO | 0.999936 | 4.29077 |
d05bb926-601d-455b-b19d-0ece8c85c37c | tanvi14001/Codes | 1406-subtract-the-product-and-sum-of-digits-of-an-integer/subtract-the-product-and-sum-of-digits-of-an-integer.cpp | class Solution {
public:
int subtractProductAndSum(int n) {
vector<int>ans;
while(n>0)
{
ans.push_back(n%10);
n=n/10;
}
int sum=0, prod=1;
for(int i=0;i<ans.size();i++)
{
sum+=ans[i];
prod*=ans[i];
}
... | ALGO | 0.999974 | 6.316417 |
783fe97c-f429-40d6-b5f4-d5ae46c78c90 | farhad-fbm/codes | DSA/DSA(phitron)/00_sort/5_marge_sort.cpp | /*
//merged[x]=arr[i1];
// x++; i1++;
merged[x++]=arr[i1++];
*/
#include<bits/stdc++.h>
using namespace std;
void conquer(int arr[], int s, int m, int e){
int merged[e-s+1];
int i1=s;
int i2=m+1;
int x=0;
while(i1<=m && i2<=e){
if(arr[i1] <= arr[i2]){
merged[x++]=arr[i1++];
... | ALGO | 0.999998 | 4.547388 |
c09458e8-8d73-4489-9d9a-126f26e36a88 | phamngoctuan1995/Visual | Codeforces/ROADS/main.cpp | #include <stdio.h>
#include <queue>
#include <vector>
using namespace std;
#include <memory.h>
typedef pair<int, int> pii;
struct Node {
int v, l, t;
Node(int a, int b, int c)
{
v = a;
l = b;
t = c;
}
};
int cost[101][10001];
bool fr[101][10001];
int main()
{
int t;
scanf("%d", &t);
for (int tt = 0; t... | ALGO | 0.999921 | 3.54881 |
c768ea64-813d-4aa8-a4ae-f641bd73d43a | GerardoHuHer/Curso-Estructuras-Datos-UP | Grafos/Grafos.cpp | #include "Grafos.h"
MatrizAdy::MatrizAdy(int tam) {
max_nodos = tam;
ocupados = 0;
pos_destino = pos_origen = -1;
nodos = new char[tam]; // Arreglo de nodos
arcos = new int *[tam]; // Renglones del arreglo de arcos
for (int i = 0; i < tam; i++) {
arcos[i] = new int[tam]; // Columnas de cada renglón de ... | ALGO | 0.973723 | 4.273841 |
4e8d7af5-5828-4c4c-af75-16139018bc76 | reo0105/atcoder | contest/2023_10_21_beginner/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define INF 2e18+5
int main()
{
int n;
cin >> n;
priority_queue<pll, vector<pll>, greater<pll>> que;
for (int i = 0; i < n; i++) {
ll t, d;
cin >> t >> d;
que.push(make_pair(t, t+d)... | ALGO | 0.999892 | 4.00495 |
49b506bc-bbc1-4562-a0f3-0af536eb6524 | JinyuChata/leetcode_cpp | leetcode/editor/cn/844_backspace-string-compare.cpp | //给定 S 和 T 两个字符串,当它们分别被输入到空白的文本编辑器后,判断二者是否相等,并返回结果。 # 代表退格字符。
//
// 注意:如果对空文本输入退格字符,文本继续为空。
//
//
//
// 示例 1:
//
//
//输入:S = "ab#c", T = "ad#c"
//输出:true
//解释:S 和 T 都会变成 “ac”。
//
//
// 示例 2:
//
//
//输入:S = "ab##", T = "c#d#"
//输出:true
//解释:S 和 T 都会变成 “”。
//
//
// 示例 3:
//
//
//输入:S = "a##c", T = "#a#c"
//输出:... | ALGO | 0.999431 | 5.867381 |
cbb6044d-4556-4b97-a68c-d5ad04451b7b | Johniel/contests | atcoder/abc076/A/main.cpp | #include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
using namespace std;
typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;
template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
os << "(" << p.first <<... | ALGO | 0.998349 | 3.587986 |
6b833ac4-46c2-43b8-8a69-90389c6df31b | AlphaAnas/OOP_hw_updated | butterfly.cpp |
#include "butterfly.hpp"
#include <vector>
#include "unit.hpp"
#include <iostream>
const int SCREEN_WIDTH = 1000; // default value of window size
const int SCREEN_HEIGHT = 600;
// fly() is overrided from the superclass
void Butterfly::fly(){
// std::cout << "Fly function of Butterfly called \n";
... | TOOL | 0.945715 | 4.36035 |
a86d6d23-fea9-4033-9cb6-7ad9a577fd36 | HideOnCodec/Algorithm | 7562.cpp | /*
백준 7562번 나이트의 이동
BFS를 이용하여 해결한다.
체스가 이동할 수 있는 경우를 dx, dy 배열에 각각 받아 구현한다.
현재 위치와 목표 위치를 각각 cur, dest로 받아 BFS에 넘긴다(pair 이용)
테스트 케이스마다 BFS를 호출하며 visit 배열 대신 board로 2차원 벡터를 구현한다.
큐에 처음 위치를 넣고 큐가 빌때까지 차례대로 갈 수 있는 위치를 넣으며 BFS를 실행한다.(단 갈 수 있는 위치가 범위 안에 있고, 방문하지 않아야한다)
어차피 BFS는 '동일선상에서 출발한다'라는 걸 기억하고, 경로의 횟수 비교를 해줄 필요가 없다... | ALGO | 0.999806 | 5.249043 |
eb2dfca9-ffa1-4cae-994c-a3f13192e840 | ishandutta2007/codeforces | dreamoon_love_aa/normal/1729/A.cpp | #include<iostream>
#include<algorithm>
using namespace std;
void solve() {
int a, b, c;
cin >> a >> b >> c;
if(a < abs(b - c) + c) {
cout << "1\n";
} else if(a > abs(b - c) + c) {
cout << "2\n";
} else {
cout << "3\n";
}
}
int main() {
int t;
cin >> t;
while(t... | ALGO | 0.999908 | 4.465826 |
61ec434c-b854-4dc0-bcb8-994cd680eca6 | Youngermaster/FAT-MANGO-Preparation | CodeForces/Gym/104015/F.cpp | #include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define fora(i, x, n) for (int i = (int)x; i < (int)n; ++i)
#define el '\n'
#define pb push_back
#define d(x) cout << #x << " " << x << el
#define all(v... | ALGO | 0.999913 | 4.431679 |
fc005460-e43b-41c9-9f23-7513af77e8d9 | Ebony0wl/EWCS20A | Project 3/test ass5/test ass5/main.cpp | #include <iostream>
int fibonacci(int n) {
if (n == 0) return 0;
if (n == 1) return 1;
if (n == 1) return 1;
return (fibonacci(n - 1) + fibonacci(n - 2));
}
int main() {
std::cout << fibonacci(12);
}
| ALGO | 0.999421 | 5.589055 |
c974f8aa-1805-4096-9a10-f35690619445 | markf7319/pytorch | aten/src/ATen/native/cpu/ReduceOpsKernel.cpp | #include <numeric>
#include <iterator>
#include <algorithm>
#include <ATen/Dispatch.h>
#include <ATen/cpu/vec256/vec256.h>
#include <ATen/native/ReduceOps.h>
#include <ATen/native/ReduceOpsUtils.h>
#include <ATen/native/TensorIterator.h>
#include <ATen/native/SharedReduceOps.h>
#include <ATen/native/ReduceOpsUtils.h>
... | ALGO | 0.99549 | 7.143134 |
ad735c5b-02ed-4156-ac3e-385fd4138a07 | sbrus1213/Problem-Solving | BOJ_code/10800/A10814_S.cpp | // BOJ 10814 ̼
// sort
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
struct man {
int id, age;
string name;
};
int main() {
cin.tie(NULL); cout.tie(NULL);
ios_base::sync_with_stdio(false);
int n; cin >> n;
vector<man> V(n);
for (int i = 0; i < n; ++i) {
... | ALGO | 0.999402 | 5.000673 |
7d06b311-9ea8-4413-b29e-3ed5cf49f845 | andrew-chen/csis352 | examples/arrayIterator.cpp | #include <iostream>
using namespace std;
template <class T>
class arrayIterator
{
public:
arrayIterator();
arrayIterator(T*);
const arrayIterator& operator=(T*);
T& operator*();
const T& operator*() const;
const arrayIterator operator++(int);
private:
T* iterator;
};
te... | TOOL | 0.993437 | 4.106631 |
26fe52ae-90c5-4ac5-9cfa-9292427397ba | urban-jungle/Code_Sprint | 프로그래머스/2/12909. 올바른 괄호/올바른 괄호.cpp | #include <string>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool solution(string s)
{
int cnt=0;
bool answer = true;
for(auto& c : s){
if(c == '('){
cnt++;
}
else if(c == ')'){
cnt--;
if(cnt<0){
... | ALGO | 0.997925 | 5.388956 |
9b6f6613-e98c-456a-885f-c7be897964e6 | Wbahoque09/Reserva-app-flutter | 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.998733 | 6.76775 |
e8c8dd21-ac8c-4cda-a2ab-6b90813c9eb8 | doocs/leetcode | solution/0200-0299/0291.Word Pattern II/Solution.cpp | class Solution {
public:
bool wordPatternMatch(string pattern, string s) {
unordered_set<string> vis;
unordered_map<char, string> d;
return dfs(0, 0, pattern, s, vis, d);
}
bool dfs(int i, int j, string& p, string& s, unordered_set<string>& vis, unordered_map<char, string>& d) {
... | ALGO | 0.999939 | 6.607552 |
ade9c43d-c008-4f00-aa07-c2c463a2059d | trinhminhtriet/leetcode | solutions/3500-3599/3515.shortest-path-in-a-weighted-tree/Solution.cpp | struct Fenwick
{
int n;
vector<long long> BIT;
Fenwick(int n) : n(n), BIT(n + 1, 0) {}
void update(int i, long long delta)
{
for (; i <= n; i += i & -i)
BIT[i] += delta;
}
long long query(int i)
{
long long sum = 0;
for (; i; i -= i & -i)
s... | ALGO | 0.999989 | 5.484429 |
ac7ca572-4e91-4a88-9ede-0ebde4b8e962 | morishita8256/AtCoder | ABC/001-020/ABC007/A - 植木算.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
cons... | ALGO | 0.999917 | 3.592224 |
e76b9079-8c79-4803-9deb-e9a8851dcc5d | KevinIsYi/100-Days-Of-Code | CP/AtCoder/ABC/C/175C.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
template <typename T>
T ceil(T a, T b) {
return (a + b - 1) / b;
}
template <typename T>
T gcd(T a, T b) {
return b ? gcd(b, a % b) : a;
... | ALGO | 0.999935 | 3.862367 |
f7858521-724b-4ede-b820-e676045f146e | reiros123/Bai-tap-LTNC- | Bai tap tuan 3/TimLap.cpp | #include<iostream>
using namespace std;
int main(){
int n,i,j;
cout << "Nhap so nguyen duong N = ";
cin >> n;
int a[n];
for(int i=0;i<n;i++){
cout << "Nhap vao so thu " << i+1 << ": ";
cin >> a[i];
}
int dem=0;
for(i=0;i<n;i++){
for(j=0;j<i;j++){
if(a[... | ALGO | 0.99966 | 3.586109 |
7ebe1ad5-06a0-4c32-904a-3187dc330572 | gnahtcouq/cpp | Linh Tinh/SOURCE/C-plus-plus-main/CPP0720 - DÃY SỐ BITONIC.cpp | // Created by Nguyễn Mạnh Quân
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz size()
#define ll long long
#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 faster() ios_base:... | ALGO | 0.999721 | 4.356245 |
a72e3aa8-a80d-45f2-b357-0e228d560feb | Yawn-Sean/Daily_CF_Problems | daily_problems/2025/06/0621/personal_submission/cf690a3_tsreaper.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n, K; scanf("%d%d", &n, &K); K--;
int sm = 0;
for (int i = 1; i < n; i++) {
int x; scanf("%d", &x);
sm += x - 1;
}
printf("%d\n", (K - sm % n + n) % n + 1);
}
int main() {
int tcase; scanf("%d", &tcase);
while... | ALGO | 0.999543 | 3.910971 |
40183e49-cb95-420e-a48b-5ccd31da11a7 | spickartz/poncos-old | src/poncos.cpp | #include <cassert>
#include <chrono>
#include <condition_variable>
#include <iostream>
#include <string>
#include <thread>
#include <vector>
#include "poncos/poncos.hpp"
#include "poncos/time_measure.hpp"
#include <fast-lib/message/agent/mmbwmon/ack.hpp>
#include <fast-lib/message/agent/mmbwmon/reply.hpp>
#include <f... | TOOL | 0.91934 | 5.729976 |
f8736c78-e027-4b43-b157-a812d7d16aa4 | VuDucAnhNguyen/ExersiceLTNC | PracticeLTNC/Test_1/Excercise2.cpp | Node* deleteBottom(Node* head){
Node* current = head;
Node* bottom = NULL;
Node* prevbottom = NULL;
if (current->value*2<(current->next->value)){
head=current->next;
delete current;
return head;
}
while (current->next!=NULL&&bottom==NULL){
if (current->next->next... | ALGO | 0.999672 | 3.773465 |
00364341-3d04-4604-ae02-1ecabc94d760 | hhy5277/algorithm-4 | code125.cpp | /*
题目描述
从上往下打印出二叉树的每个节点,同层节点从左至右打印。
*/
/*
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};*/
class Solution {
public:
vector<int> PrintFromTopToBottom(TreeNode* root) {
std::vector<int> v;
if (NULL == root) {
... | ALGO | 0.999961 | 5.306997 |
869dc648-19d3-47c4-ae23-f9fda565f80b | Anirudh-N-15/LeetCode-Solutions | 2526-find-consecutive-integers-from-a-data-stream/2526-find-consecutive-integers-from-a-data-stream.cpp | class DataStream {
public:
unordered_map<int,int> umap ;
int count = 0;
int key = 0;
DataStream(int value, int k) {
count = k;
key = value ;
umap[value] = 0;
}
bool consec(int num) {
umap[num]++ ;
if(num == key) {
cout << umap[num] << " "... | ALGO | 0.99964 | 5.326976 |
7273de53-3e25-4d5f-8faf-fdb14f3a0895 | ParasAnxi/LeetCode-CPP | Q1501-1600/1575. Count All Possible Routes.cpp | class Solution {
public:
int mod=1000000007;
long long int dp[101][201];
long long int getAns(vector<int>& locations, int start, int finish, int fuel){
long long currans=0;
if(start==finish){
currans++;
}
if(fuel <= 0)
return dp[start][fuel]=currans;
if(dp[start][... | ALGO | 0.999905 | 5.554642 |
bf40228a-b25a-4f18-bcbc-9565318b2c2d | sahil-kumar-yadav/DSA | 04_Recursion and Backtracking/Basic Recursion/minimum-in-array.cpp | #include <iostream>
using namespace std;
int findMin(int arr[], int n, int i)
{
if (i == n)
return INT_MAX;
// 1 case hum solve kar lete hai hai baki recursion sambhal lega
int aagekaSolution = findMin(arr, n, i + 1);
int mini = min(arr[i], aagekaSolution);
return mini;
}
int main()
{
... | ALGO | 0.99998 | 4.976669 |
97aa5566-7026-4ef0-bfc5-faaa38d0eaf9 | JangYeHoon/Algorithm | backup/Greedy/c++/14_곱하기혹은더하기.cpp | // 이것이 취업을 위한 코딩테스트다 312p
// 2
#include <iostream>
using namespace std;
int main()
{
string s;
cin >> s;
long long result = s[0] - '0';
for (int i = 1; i < s.size(); i++) {
int num = s[i] - '0';
if (num <= 1 || result <= 1)
result += num;
else
result *= num;
}
cout << result;
} | ALGO | 0.999953 | 4.638718 |
3c467759-fd23-49a3-9207-659d26faa593 | mo-sahil/study | CPP/gcd.cpp | #include<iostream>
using namespace std;
int main()
{
int num1, num2, gcd=1;
cout << "Enter num1 and num2: ";
cin >> num1 >> num2;
for (int i=2; i<=num1; i++)
{
if ((num1%i==0) && (num2%i==0))
{
gcd = i;
}
}
cout << "GCD of " << num1 << " and " << num2 ... | ALGO | 0.990966 | 4.721249 |
2e152349-82ae-41b1-830b-705a3ba482e6 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/july/dr_20200708203021.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<unordered_map>
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ... | ALGO | 0.999972 | 3.813854 |
af81df6e-f6ff-42db-844f-7342bb9a710b | ark-compiler/monorepo | toolchain/llvm-project/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp | #include "MakeMemberFunctionConstCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ParentMapContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace re... | ALGO | 0.860494 | 7.767029 |
785be2e6-a0f4-4c61-b4c7-c96fb24d8665 | yasinenis/programiz-examples-c | example-43/main.cpp | // example-43
#include <stdio.h>
void reverseSentence();
int main()
{
printf("Enter a sentence: ");
reverseSentence();
return 0;
}
void reverseSentence()
{
char c;
scanf_s("%c", &c, sizeof(c));
if (c != '\n')
{
reverseSentence();
printf("%c", c);
}
} | ALGO | 0.990448 | 3.280056 |
9a6c23c8-167f-442d-97a0-9419a81af77e | RejwankabirHamim/Algorithm-practice | DS/Wavelet tree/Unusual Entertainment.cpp | //https://codeforces.com/contest/1899/problem/G
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define dbg(x)... | ALGO | 0.999955 | 4.56918 |
4d1dff1f-55ab-4e40-88ce-a638f7d5dd3b | Samir221/News_Pulse | src/clients/customer/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.997231 | 6.786404 |
4aeca9ba-dec8-4fae-a347-bfb6beda19ce | s2mLab/ViolinOptimalControl | Old/optimal_control_acado/includes/dynamics.cpp | #include "dynamics.h"
#include <rbdl/Dynamics.h>
#include "BiorbdModel.h"
#include "RigidBody/GeneralizedCoordinates.h"
#include "RigidBody/GeneralizedTorque.h"
#include "Muscles/StateDynamics.h"
void forwardDynamics_noContact(
double *x,
double *rhs,
void *){
dispatchQandQdot(x);
if (... | ALGO | 0.999597 | 4.93352 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.