uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
71345d26-dcfa-4d20-8313-98fa1e1bd68b | henrique-artur/questoes-URI | URI-INICIANTE/uri2168.cpp | #include <iostream>
using namespace std;
int main(void){
int num;
int quadra[105][105];
cin >> num;
for(int i = 0; i < num + 1; i++){
for(int j = 0; j < num + 1; j++){
cin >> quadra[i][j];
}
}
for(int i = 0; i < num; i++){
for(int j = 0; j < num; j++){
... | ALGO | 0.999908 | 3.019827 |
fba4c7d9-9574-49ac-bdd5-934ba6b5c54c | tomilov-dev/DSA | leetcode_problems/cpp/lc1588_sum_of_odd_lenght_subarrays.cpp | #include <vector>
#include <iostream>
using std::vector;
class Solution
{
public:
int sumOddLengthSubarrays(vector<int> &arr)
{
int n = arr.size();
int sum = 0;
for (int i = 0; i < n; i++)
{
for (int len = 1; i + len <= n; len += 2)
{
for ... | ALGO | 0.999561 | 5.742713 |
d198bcbd-b0ce-49aa-8fe2-e73c61a83c85 | Betelgeu/CMU15-445 | src/execution/topn_executor.cpp | #include "execution/executors/topn_executor.h"
#include <queue>
namespace bustub {
TopNExecutor::TopNExecutor(ExecutorContext *exec_ctx, const TopNPlanNode *plan,
std::unique_ptr<AbstractExecutor> &&child_executor)
: AbstractExecutor(exec_ctx), plan_(plan), child_executor_(std::move(chi... | ALGO | 0.931498 | 6.473182 |
2eae3900-2d7f-42de-bd2d-60cfb705c71e | yipu3/algorithm-practice | leetcode/1669/cpp/main.cpp | #include <vector>
using namespace std;
/**
* Definition for singly-linked list.
*/
struct ListNode {
int val;
ListNode* next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode* next) : val(x), next(next) {}
};
class Solution {
public:
... | ALGO | 0.999946 | 5.096166 |
b6f610ec-cc76-4037-aec7-c9da466cb3f8 | Ritax2003/GeeksForGeeks-POTD | Easy/Height of Binary Tree/height-of-binary-tree.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node* buildTree(string str)
{
// ... | ALGO | 0.99945 | 6.779489 |
d7338ca2-c86c-48aa-b6eb-9e37c00c82d6 | MightyBhargava/DAA- | DAY-3/pascal.cpp | #include <stdio.h>
void printPascal(int n) {
for (int line = 1; line <= n; line++) {
int C = 1;
for (int i = 1; i <= line; i++) {
printf("%d ", C);
C = C * (line - i) / i;
}
printf("\n");
}
}
int main() {
int n = 5;
printPascal(n);
return 0;
... | ALGO | 0.998676 | 5.605476 |
9299ab7d-6e02-4e72-adc7-4650923aadde | lunacae/Estrutura.Dados.C | ListasEncadeadas/ListasEncadeadas/ListInt.cpp | #include "ListInt.h"
#include <stdio.h>
#include <stdlib.h>
Node* Add(int num, Node *lista)
{
if (lista == NULL)
{
Node* newNode = (Node*)malloc(sizeof(Node));
lista = newNode;
lista->num = num;
lista->next = NULL;
}
else
{
Node* newNode = (Node*)malloc(sizeof(Node));
newNode->num = num;
newNode->ne... | ALGO | 0.989091 | 4.119478 |
0026ffe5-93c8-4ad7-af82-b21b541124c7 | MaxElgart/CSCI-360 | Markov_Decision_Processes/MDP_Game.cpp | //Max Elgart
//Student ID: 9624143167
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
int main()
{
std::string action[6][40][40];
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 40; j++)
{
for (int m = 0; m < 40; m++)
{
... | ALGO | 0.997835 | 3.571051 |
617c5bd1-3eda-408d-b8ae-d3ef541571b8 | slemsvamp/adventofcode2021 | day08.cpp | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "common.h"
struct wire_information
{
char *Clues;
char *Digits;
};
// wires are linked to segment, they can individually be on
struct parse_result
{
wire_information *Information;
u32 Count;
};
internal parse_result
Parse(file_data... | ALGO | 0.99799 | 3.634385 |
d627473a-1f8c-4f86-846a-684ad47d8081 | Xie-Minghui/ACM | 数位DP-B-number-NET.cpp | #include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int bit[15];
int dp[15][15][3];
//dp[i][j][k]
//i:λ
//j:
//k:3ֲ״0ĩβ1,1ĩβ1,213
int dfs(int pos,int mod,int have,int lim)//lim¼
{
int num,i,ans,mod_x,have_x;
if(pos<=0)
return mod == 0 && have == 2;
if(!lim && dp[pos][m... | ALGO | 0.999925 | 3.790497 |
9671c640-8438-42f3-bc8b-56132751585b | hjiang13/LLMs-in-IR | POJ-104/85/1070.cpp | #include <iostream>
using namespace std;
int main (){
int n, x, i, b,j ;
char a[21];
cin >> "%d", &n);
for (i=0; i<n+1; i++){
gets (a);
x=0;
if (a[0]==95||(a[0]>=65&&a[0]<=90)||(a[0]>=97&&a[0]<=122))
{
}
else {
x=1; }
b=strlen(a);
for (j=1; j<b; j++){
if((a[j]>='0'&&a[j]<='9')||a[j]==95||(a[j]>=65&&a[j]<=90)||(a[j]... | ALGO | 0.999668 | 3.565553 |
a1f4b46e-f6e0-4ae1-a84b-f14eea5fe285 | insertinterestingnamehere/bench_parsers | antlr/runtime/runtime/src/atn/PredictionMode.cpp | #include "atn/RuleStopState.h"
#include "atn/ATNConfigSet.h"
#include "atn/ATNConfig.h"
#include "misc/MurmurHash.h"
#include "SemanticContext.h"
#include "PredictionMode.h"
using namespace antlr4;
using namespace antlr4::atn;
using namespace antlrcpp;
struct AltAndContextConfigHasher
{
/**
* The hash code is o... | ALGO | 0.990082 | 4.109624 |
eb4ad7e0-7d3b-443e-a74a-aed42d6e043c | abusomani/Leetcode | Practice/maximum-number-of-non-overlapping-subarrays-with-sum-equals-target(brute to optimized).cpp | class Solution {
public:
static bool comp(const pair<int,int> &a, const pair<int,int> &b) {
return (a.second == b.second) ? a.first > b.first : a.second < b.second;
}
int maxOverlappingIntervals(vector<pair<int,int>> &V) {
sort(V.begin(), V.end(), comp);
int start = INT_MIN, end = IN... | ALGO | 0.999993 | 5.782963 |
822782ca-e272-4bf8-8a72-eb445dbbb538 | raincross7/code-similarity | codes/train_code/problem332/problem332_57.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int n, a[MAXN];
vector<int> con[MAXN];
void dfs(int x, int pre) {
if (con[x].size() == 1) return;
long long sum = 0, max_val = 0;
for (int _i = 0; _i < con[x].size(); ++_i) {
int y = con[x][_i];
if (y != pre) {
dfs(y, x);
sum += a[... | ALGO | 0.999956 | 4.252235 |
a7888e0e-467a-4e8b-86b8-8216daa4e66e | ishandutta2007/codeforces | mango_lassi/normal/963/B.cpp | #include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const int N = 2 * (int)1e5;
vector<int> conns[N];
int siz[N];
int dfs(int i, int p) {
siz[i] = 1;
for (auto t : conns[i]) {
if (t != p) siz[i] += dfs(t, i);
}
return siz[i];
}
// Since number of nodes in tr... | ALGO | 0.999992 | 4.403674 |
ecc9b8f5-058c-4dbb-8c77-f3b4b4613bdb | raincross7/code-similarity | codes/train_code/problem194/problem194_333.cpp | #include <iostream>
#include <vector>
using namespace std;
#define INF 2000000001
int main() {
int n; cin >> n;
// ???i/2??????2??i???2??i+1
vector<int> heaps(n+1);
for(int i=1;i<n+1;i++) {
cin >> heaps[i];
}
for(int i=1;i<n+1;i++) {
// node i: key = k, parent key = pk, left key = lk, right key = ... | ALGO | 0.999181 | 3.649137 |
5c9fd761-4e7f-442d-8521-67ca1c949750 | septiapriliawulandari/Jobsheet-MPL-8 | 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 |
c5fbea6e-76f1-4dca-9cfc-6e82ba6f7111 | Asha021/Cpp-lang | C++/Vector.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> v = {2,3,4,7};
v.push_back(234);
v.push_back(234);
v.push_back(234);
v.push_back(234);
v.push_back(234);
v.push_back(234);
for(int i=0; i<v.size(); i++)
{
cout<<v[i]<<"-";
}
cout<<"\n";
cout<<v.size()<<endl;
cout<<v.capacity... | ALGO | 0.908203 | 3.412219 |
a75fba2a-9b6a-49c9-af69-35168791fa4a | riteshkantule/DSA | Questions/Q3_contest06062023.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool func(long long x, vector<long long>& arr) {
long long count = 1, maxm = arr[0], minm = arr[0];
for (long long i = 1; i < arr.size(); i++) {
maxm = arr[i];
if (((maxm - minm + 1) / 2) > x) {
count++;... | ALGO | 0.999773 | 3.857724 |
0ce053d0-4035-4250-ac49-f097a2e0176e | prashobkt/blender | extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp | #include "btSphereSphereCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h"
btSphere... | ALGO | 0.999262 | 6.552449 |
c8a17063-a71c-4eb6-8af5-51e7a008edcd | monhime/atcoder_charter | C++_old/beginner/090/B.cpp | #include<iostream>
using namespace std;
int A,B,cunt,num;
int main(){
cin>>A>>B;
for(num=A;num<=B;num++){
int reverse = 0;
int remaind;
int tmp;
tmp = num;
while(tmp!=0)
{
remaind = tmp % 10;
reverse = reverse * 10 + remaind;
t... | ALGO | 0.999954 | 3.931988 |
9fcd8883-8984-475c-b38e-e02ded12e466 | leoxP/leetcode | strings/reverseprefixofword.cpp | #include <iostream>
#include <string>
using namespace std;
class Solution {
public:
string reversePrefix(string word, char ch) {
for(char i:word){
if(i==ch){
int p=word.find(i)+1;
reverse(word.begin(),word.begin()+p);
return word;
}
... | ALGO | 0.999992 | 5.824384 |
84097b07-f30b-41f8-9ea2-a7b5dc9cf652 | patriicke/C-DSA | SECOND HOMEWORK/Q19/main.cpp | #include<iostream>
using namespace std;
int main(){
int arr[3], temp;
cout << "Enter first number: ";
cin >> arr[0];
cout << "Enter second number: ";
cin >> arr[1];
cout << "Enter third number: ";
cin >> arr[2];
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++)
{... | ALGO | 0.999618 | 3.672907 |
8f7c7c67-0fbb-450b-84e8-8a00c51d278a | ishandutta2007/codeforces | tempura0224/normal/1096/C.cpp | #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#... | ALGO | 0.99964 | 3.566976 |
a507ccb2-debe-4a24-807c-e2b8117b85cf | Alimurrazi/Programming | beginner_level_and_uva/buble sort.cpp | #include<stdio.h>
int main()
{
int ara[100];
int i,j,k,l,m,n,temp;
scanf("%d",&n);
for(i=0; i<n; i++)
scanf("%d",&ara[i]);
for(i=0; i<n; i++)
{
for(j=i+1; j<n; j++)
{
if(ara[i]>ara[j])
{
temp=ara[i];
ara[i]=ara[j];
... | ALGO | 0.999965 | 3.143921 |
06c843e5-a208-41c6-88d5-de22f7d706dc | milindmadhukar/university | OOP/sum_pattern_using_template.cpp | // Create the C++ Function Template named multiples so that it has
// three parameters sum, x, and n. The first two parameters will have
// the type represented by the function template type parameter. n will
// always be int. The return type is void. All parameters are
// passed by value except for sum which is passed... | ALGO | 0.990726 | 5.830886 |
7792f86e-a357-474d-b61a-4a1c94468c44 | leokim0405/gardening | algorithm/백준문제c++/백준문제c++/11651.cpp | #include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
class spot
{
public:
spot(int x, int y) : xpos(x), ypos(y) { }
void print()
{
cout << xpos << " " << ypos << "\n";
}
int get_x()
{
return xpos;
}
int get_y()
{
return ypos;
}
private:
int xpos;
int ypos;
};
spot make(... | ALGO | 0.999729 | 4.649341 |
33b22003-762e-453b-a5cf-2efa7507ddd4 | svk-123/SU2_solver_custom | SU2_CFD/src/solver_adjoint_levelset.cpp | #include "../include/solver_structure.hpp"
CAdjLevelSetSolver::CAdjLevelSetSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) : CSolver() {
unsigned short iVar, iDim, nLineLets;
unsigned long iPoint, index;
double dull_val;
ifstream restart_file;
string text_line, mesh_filename, filename, AdjExt;
... | ALGO | 0.998981 | 4.318055 |
ee7da5ef-17b6-4b01-bef8-ab9396358cb7 | RealAnishSharma/Spoj_Interesting_Questions | P1/main.cpp | #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int arr[20000];
int main()
{
int k,N,j,i;
while(scanf(" %d",&N)!=0)
{
for(int i=0;i<N;i++)
scanf(" %d",&arr[i]);
sort(arr,arr+N);
int sol=0;
for(i=N-1;i>1;i--)
{
k=0;j=i-1;
... | ALGO | 0.999 | 3.704533 |
acdeb4be-62aa-44c9-81f4-e6a689e557d6 | Saransh-Basu-01/DSA-with-cpp | binary_tree.cpp | #include<iostream>
using namespace std;
struct node{
char info;
struct node *lchild,*rchild;
};
struct node *root=NULL,*pnew,*pthis,*ppthis,*ptemp;
void preorder(struct node *P){
if(P!=NULL){
cout<<P->info;
preorder(P->lchild);
preorder(P->rchild);
}
}
void inorder(struct node ... | ALGO | 0.999604 | 3.576789 |
ef79aaf7-100d-46ad-acfa-61a86cb22e12 | shohzod3112/cplusplus | consol/Nazariya/Funksiyalarga oid sodda masalalar (FunSimple)/36/36/main.cpp | // Muallif: Ro'ziyev Shohzod
// Sana: 19.01.2015
// Maqsad: Butun qiymat qaytaruvchi Fib(N) funksiyasini hosil qiling.(N > 0)
// Fibonachchi sonlarining N-elementini qaytarsin.
#include <iostream>
using namespace std;
int Fib (int *);
int main()
{
int n;
cout << "n = "; cin >> n;
cout << Fib (&n) << e... | ALGO | 0.999855 | 4.874226 |
08c52f13-855a-4e3d-a60d-6ee363e46e0e | conankun/Dovelet | relation/358238_AC_0.06SEC.cpp | #include<iostream>
#include<queue>
using namespace std;
struct aaa{
int pos;
int cnt;
};
int main() {
int n,m,a,b;
queue<aaa> qu;
int data[101][101]={0};
int vis[101]={0};
cin>>n>>a>>b>>m;
for(int i=0;i<m;i++) {
int c,d;
cin>>c>>d;
data[c][d]=1;
... | ALGO | 0.999906 | 3.706174 |
e1c4a21d-7e3a-414e-8321-bbe98a55da48 | 0owangjingo0/WZUOJ_Answer | 程序设计基础(2022-2023-1)/实验十五 位运算/0336-位操作(Ⅲ).cpp | #include <bits/stdc++.h>
using namespace std;
int getbits(int x, int p, int n) {
return (x>>(p-n+1))%2;
}
int main() {
int x, p, n;
while((scanf("%d%d%d", &x, &p, &n) != EOF)){
int sum = 0;
for(int i = 1; i <= n ;++ i){
sum = sum *2+getbits(x,p,i);
}
cout << sum <<endl;
}
return 0;
}... | ALGO | 0.999796 | 3.541152 |
7667fbfd-2889-4ef4-8280-6ccb04d2ad24 | marwanjs-dev/Flutter_Authentication_Task | appname/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.998566 | 6.785645 |
8b9de46d-a96e-4993-84c3-47325a20add4 | sglre6355/atcoder | abc/353/b.cpp | #include <iostream>
int main() {
int N, K, seats_left, A, count = 0;
std::cin >> N >> K;
seats_left = K;
for (int i = 0; i < N; ++i) {
std::cin >> A;
if (seats_left >= A) {
seats_left -= A;
} else {
count += 1;
seats_left = K;
... | ALGO | 0.999904 | 4.554077 |
e056ca9e-fda0-4b39-acd0-17830cf252b5 | alexgrigoras/parallel_algorithms | Lab 7/Lab7_p2_mpi/Hello_parallel_mpi/main.cpp | #include <stdio.h>
#include <stdlib.h>
#include "mpi.h"
#define N 8
#define ROOT 0
void afisareVector(int *v, int n)
{
int i;
printf("[ ");
for (i = 0; i < n - 1; i++)
{
printf("%d | ", v[i]);
}
printf("%d ]\n", v[n - 1]);
}
int main(int argc, char **argv)
{
int count;
int my_rank;
int tag = 99;
MPI_Stat... | ALGO | 0.999934 | 3.789789 |
483a768c-e68b-4c4b-8217-745d2cf2df10 | YuriyRusinov/segm3d | Segment3D.cpp | #include <iostream>
#include <limits>
#include <math.h>
#include "Matrix.h"
#include "Segment3D.h"
#include "Vector3D.h"
using std::cout;
using std::endl;
using std::max;
using std::min;
double clamp(double value, double minVal, double maxVal) {
return max(minVal, min(value, maxVal));
}
Segment3D::Segment3D(con... | ALGO | 0.998946 | 6.132054 |
98f53c32-b0f6-47e8-a3ce-764757c828df | WendellReis/Competitive-Programming | Junior Training Sheet V7/A/CF677-D2-A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,h; cin >> n >> h;
int a, count = n;
for(int i = 0; i < n; i++){
cin >> a;
if(a > h) count++;
}
cout << count << "\n";
return 0;
} | ALGO | 0.999946 | 3.808746 |
47239065-c384-4650-b5cf-f0c254a271be | Shitaibin/leetcode-2016 | 260.SingleNumberIII.cpp | /* X^X = 0
* X^0 = X
* 对整个数组进行异或得到的是 X^Y,X,Y分别是出现一次的数字。
* 找到X^Y为1的某个位,那么X和Y必然在此位一个为0,一个为1,
* 根据此位可以将所有的数字分成两个不同的组,分别进行异或就
* 可以得到X和Y。
*/
class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
int allxor = 0;
for (int e : nums) {
allxor ^= e;
}
int mas... | ALGO | 0.999966 | 5.222813 |
73d14c93-0f32-4f27-9823-e28bbfcfa406 | Chan531/BaekJoon_Online_Judge | 공약수열.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int n, ans, arr[55];
void input()
{
cin >> n;
for (int i = 0; i < n; i++)
cin >> arr[i];
}
int gcd(int a, int b)
{
if (!b)
return a;
return gcd(b, a % b);
}
void solution()
{
sort(arr, arr + n);
for (int i = 0; i < n - 1; i++)
{
if (gcd(... | ALGO | 0.999954 | 4.264465 |
0a68e5d0-0cb3-4bb1-8d9e-101738ebdfd1 | rasheeq123/DSA | POTD/Exit_Point_in_a_Matrix.cpp |
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> FindExitPoint(int n, int m, vector<vector<int>>& matrix) {
vector<vector<int>>directions={{0,1},{1,0},{0,-1},{-1,0}}; //4 directions
int i=0,j=0,direction_ptr=0;
vector<int>res;
while(i>=0 an... | ALGO | 0.999948 | 5.282332 |
9fe1bb1c-e598-44e2-ba13-a43cd65e38f7 | Zowlyfon/AoC-2021 | day_14.cpp | //
// Created by Zowlyfon on 15/12/2021.
//
#include <iostream>
#include <fstream>
#include <utility>
#include <vector>
#include <string>
#include <regex>
#include <map>
int main() {
std::map<std::string, char> rules;
std::string polymer;
std::ifstream polymerFile("input_14");
std::string line;
st... | ALGO | 0.999603 | 5.323214 |
810ef6ef-b93a-44d5-813e-3a8dcac8f144 | shehab-as/LeetCodeCPP | Easy/1078_Occurrences_After_Bigram.cpp | class Solution {
public:
vector<string> findOcurrences(string text, string first, string second) {
vector<string> result;
string query = first + " " + second + " ";
for(int pos = 0; ; pos++) {
pos = text.find(query, pos);
if(pos == string::npos) break;
aut... | ALGO | 0.99983 | 5.710091 |
07f7f823-88f2-4229-a658-82fe17792e17 | Srini227/DSA-LAB | lab11/lab11q3.cpp | #include <iostream>
#include <list>
#include <vector>
class HashTable {
private:
std::vector<std::list<int>> table; // Hash table using separate chaining
int capacity;
int hashFunction(int key) {
return key % capacity; // Simple hash function
}
public:
HashTable(int cap) : capacity(cap) {... | ALGO | 0.999354 | 6.33945 |
97d59ee3-a0f8-41db-8823-0bacc1152f7e | stl122/stl122 | LeetCodeSolutions/2020/04BestTimetoBuyAndSellStockII.cpp | using namespace std;
class Solution {
public:
int maxProfit(vector<int>& prices) {
int sum = 0;
for(int i = 1; i < prices.size(); i++){
if(prices[i-1] < prices[i])
sum += prices[i] - prices[i-1];
else
continue;
}
return sum;
... | ALGO | 0.999807 | 5.783053 |
9bc2c4e4-d6f2-44da-9586-f536485a09c1 | themattchan/hackerrank | ctci/detectcycle.cpp | /*
Detect a cycle in a linked list. Note that the head pointer may be 'NULL' if the list is empty.
A Node is defined as:
*/
struct Node {
int data;
struct Node* next;
};
bool has_cycle(Node* head) {
if (head == nullptr) return false;
if (head->next == nullptr) return false;
if (head->next->next == null... | ALGO | 0.998681 | 4.486126 |
3eeaf992-38d1-4b92-9921-d182d01c4924 | NguyenLabJHU/Tahoe-FEM | toolbox/src/misc/Rotate2DT.cpp | /* $Id: Rotate2DT.cpp,v 1.6 2011-12-01 20:25:17 bcyansfn Exp $ */
/* created: paklein (07/21/1996) */
/* This class provides the functionality to do 2D coordinate */
/* transformations. */
#include "Rotate2DT.h"... | ALGO | 0.915985 | 7.160598 |
31346685-88cd-49ef-9efd-e5e56e5b4d51 | szabiyako/five_queens_task | FiveQueensToFile/FiveQueens/Main.cpp | #include <iostream>
#include <vector>
#include <conio.h>
#include <fstream>
using namespace std;
ofstream fout("output.txt");
int main()
{
setlocale(LC_ALL, "Russian");
class Field
{
private:
vector <vector <char> > field;
public:
Field()
{
for (int i = 0; i < 8; i++)
field.push_back(vector <char>(... | ALGO | 0.995649 | 3.257381 |
2b98b352-a76c-4950-a9dd-e322b2e7d33d | ImperialCollegeLondon/coli-whole-cell-coarse-grained-model | model-code/stochastic-dynamics/cpp-simulator-cm-rates/source/libs/common.cpp | // François Bertaux, Inria Paris-Rocquencourt, 2015 //
#include "common.h"
string
toFullString(int a, int digitNumber)
{
ostringstream out;
for(int i = digitNumber; i > 0; --i ) { if(a < pow(10., i) ) {out << "0";} }
out << a;
return out.str();
}
void
writeMatrixInTextFile(string folder , string file... | TOOL | 0.939165 | 3.721832 |
71316adb-11ad-46eb-84eb-2cd6a9346458 | Janji03/All-Im-Doing | 4Fun/coding/c++/DEVC++ program/laboratorio_es/unione_liste_e_ordinamento_liste.cpp | #include <iostream>
#include <cstring>
#define DIM 10
using namespace std;
//come unire due liste e in una terza lista ordinata
p_lista unisci_liste(p_lista a,p_lista b)
{
p_lista f=NULL;
while(a!=NULL & b!=NULL)
{
if(strcmp(a->autore,b->autore)==-1)
{
f=insert(f,a->autore,a->t... | ALGO | 0.997977 | 3.964017 |
f068dc45-b666-4c7e-968d-8c034e9c5259 | Systeriax/myCpp | prime_pair.cpp | #include <iostream>
using namespace std;
bool prime(int n)
{
for(int i=2; i<=n-1; i++)
{
if(n%i==0) return 0;
}
return 1;
}
int main()
{
int v, m, b;
cin >> v;
int k=0;
for(int i=2; i<=v-2; i++)
{
b=i;
m=i+2;
if(prime(b)&&prime(m))
{
... | ALGO | 0.999665 | 3.662911 |
728b5b0d-e5fc-4092-b3fa-3babb3c8c8f6 | vishalku03/Mix_Dsa | TRAPING RAIN WATER.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution
{
public:
int trap(vector<int> &height)
{
int l = 0;
int r = height.size() - 1;
int lmax = INT_MIN;
int rmax = INT_MIN;
int ans = 0;
while (l < r)
{
lmax = max(lmax... | ALGO | 0.999975 | 6.570354 |
89af316e-2b93-4792-9554-06013b9e7dcb | RaviRathoreCode/Codeforces | shortest path in DAG.cpp | /*
***********************
Coder :: sirravirathore
***********************
*/
/* Problem: shortest path in DAG
given a graph, find the shortest from first
vertex to last vertex
objective function
f[i] is the shortest path from i to last vertex
f[i]=min(weight+f[ngbr]);
f[n]=0;
... | ALGO | 0.999925 | 4.523567 |
844030b4-c427-4ebd-98da-67309fa80714 | loredp02/opengl-physics | codici/include/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp | ///btDbvtBroadphase implementation by Nathanael Presson
#include "btDbvtBroadphase.h"
#include "LinearMath/btThreads.h"
btScalar gDbvtMargin = btScalar(0.05);
//
// Profiling
//
#if DBVT_BP_PROFILE || DBVT_BP_ENABLE_BENCHMARK
#include <stdio.h>
#endif
#if DBVT_BP_PROFILE
struct ProfileScope
{
__forceinline ProfileS... | ALGO | 0.983128 | 7.308707 |
4113961d-b122-45f7-8c7b-d96fdbc48ed7 | XanaDevelops/MachineLearningLab | MachineLearningLab/src/Clustering/KMeans.cpp | #include "KMeans.h"
#include "../DataUtils/DataLoader.h"
#include "../Utils/SimilarityFunctions.h"
#include "../Evaluation/Metrics.h"
#include "../DataUtils/DataPreprocessor.h"
#include "../Utils/PCADimensionalityReduction.h"
#include <string>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#... | ALGO | 0.995742 | 6.792448 |
d4db49a9-d1cb-4259-830a-ef5bc7774c8e | hossainsmshakib/CodeForces | 266B - Queue at the School.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
int n, t;
string s;
cin>>n>>t>>s;
while(t--){
for(int i=1;i<n;++i) {
if (s[i]=='G'&&s[i-1]=='B') {
s[i]='B';
s[i-1]='G';
i++; }
}
}
cout<<s<<e... | ALGO | 0.9999 | 3.55481 |
7e7a76ab-26a2-4929-8805-d986bd6aa476 | mirajehossain/life-charger | algorithom/bubble_sort.cpp | #include<iostream>
using namespace std;
BUBBLE(int *arr, int n){
int temp, ptr,i;
for(i=1; i<n-1; i++){
ptr = 0;
while(ptr <= n-i){
if( *(arr+ptr) > *(arr+ptr+1)){
temp = *(arr+ptr);
*(arr+ptr) = *(arr+ptr+1);
*(arr+ptr+1) = temp;
... | ALGO | 0.99993 | 4.274629 |
70ea547c-bfb0-4c8e-b289-9e45b47e91f0 | srinathv/Coding-Examples | Rouson_examples/ssdSource/appendixA/gaussian_elimination.cpp | #include "gaussian_elimination.h"
#include <cmath>
crd_t gaussian_elimination (const mat_t& lhs, const crd_t& rhs)
{
const real_t pivot_tolerance=0.01;
const int n = lhs.rows();
if ( n != lhs.cols() || n != rhs.size()) {
std::cerr << "gaussian_elimination: ill-posed system"
<< std::end... | ALGO | 0.999992 | 5.818497 |
d2e5b58f-c0c6-4f77-8287-f5860791691f | imhussain31/Cplusplus-Solved-Problems | Database.cpp | #include<bits/stdc++.h>
using namespace std;
int main ()
{
int t, m,n;
cin >> t;
while (t--)
{
string s;
cin >> m >> n;
{
cin >> s;
}
while (n--)
{
for (int i = 0; i<m; i++)
{
#include<bits/stdc++.h>
us... | ALGO | 0.994218 | 3.762667 |
9e1b2df1-fef7-4c12-8124-13dd9f88352d | Windmix/LabEngineComponentSys | exts/soloud/src/core/soloud_misc.cpp | #include "soloud_misc.h"
#include <math.h>
namespace SoLoud
{
namespace Misc
{
float generateWaveform(int aWaveform, float p)
{
switch (aWaveform)
{
default:
case WAVE_SQUARE:
return p > 0.5f ? 0.5f : -0.5f;
case WAVE_SAW:
return p - 0.5f;
case WAVE_SIN:
return (float)sin(p * M_PI *... | ALGO | 0.985559 | 5.597857 |
bd5ed695-1d7c-4f74-beb2-cafd0ca30ee6 | subhamg/CLRS-DSA | Insertion sort/linear-search.cpp | #include <bits/stdc++.h>
#include <array>
using namespace std;
int linearSearch(int A[], int v)
{
for (int i = 0; i < sizeof(A); i++)
{
if (v == A[i])
{
return i;
}
}
}
int main()
{
int v = 26;
int A[6] = {31, 41, 59, 26, 41, 58};
cout << linearSearch(A, v)... | ALGO | 0.999446 | 4.599718 |
b272cdc9-0243-4a4e-9f44-7171eaae9f94 | ritikanagar09/LeetCode-Submission | 0232-implement-queue-using-stacks/0232-implement-queue-using-stacks.cpp | class MyQueue {
public:
stack<int>s1;
stack<int>s2;
MyQueue() {
}
void push(int x) {
while(!s2.empty()){
s1.push(s2.top());
s2.pop();
}
s1.push(x);
while(!s1.empty()){
s2.push(s1.top());
... | ALGO | 0.999148 | 5.515263 |
a7e5a110-68d1-46a5-bb88-f42c96e812f7 | mazen-alasas/Problem-Solving | LeetCode/Study Plans/Programming Skills/496.cpp | class Solution {
public:
vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {
unordered_map<int, int> mp;
stack<int> st;
for(int i = 0; i < nums2.size(); i++) {
while(!st.empty() && st.top() < nums2[i]) {
mp[st.top()] = nums2[i];
... | ALGO | 0.999974 | 5.757394 |
7cf2ba52-9457-4f98-a3a8-32a565ab5ffc | juhyeonkwon/algorithm | 백트래킹/15649.cpp | #include <iostream>
#include <vector>
using namespace std;
int N, M;
int arr[9];
int visited[9];
vector<int> a;
void dfs(int count) {
if (count == M) {
for (int i = 0; i < M; i++) {
printf("%d ", arr[i]);
}
cout << '\n';
return;
}
for (int i = 1; i <= N; i++) {
if (!visited[i]) {
visited[i] = tr... | ALGO | 0.999789 | 4.192242 |
7a947dfc-7b6d-4cac-9824-419b4aded3a6 | akshatjohari/Interview-Questions | 10. Dynamic Programming/3-minimum_number_of_coins.cpp | // Minimum number of Coins
// LINK:- https://practice.geeksforgeeks.org/problems/-minimum-number-of-coins4426/1
class Solution{
public:
vector<int> minPartition(int num)
{
// code here
vector<int> coins = {2000,500,200,100,50,20,10,5,2,1};
int n = coins.size();
vector<... | ALGO | 0.999922 | 5.375054 |
ad85b3d9-9b00-4f5a-b957-391b90b0202a | Cool1smylove/noobdream | C语言提高/M-YN.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main(){
int a, b, c, d;
while(cin >> a >> b >> c >> d){
int xy = (a * a - b) / 2;
if(a * b - c == a * xy && b * b == d + 2 * xy * xy){
cout << "Y" << endl;
}
else{
cout << "N" << endl;
}
}
return 0;
}
| ALGO | 0.999064 | 3.230156 |
e9d8f929-147b-4d7c-a812-fc8d1128763d | DavidSchooler/EEL4837-Programming-For-EE-2 | Lectures/Week 2.cpp | #include <iostream>
using namespace std;
/*
Lecture 3 1/17
Basic Sorting: Bubblesort, Insertion Sort
Sorting is used to permute elements in an array so that they are ordered
Bubblesort
Insertion sort
Mergesort
Quicksort
Heapsort
Radix sort
(First five are comparison based)
Bogosort - sort... | ALGO | 0.999017 | 5.023289 |
b69e05c9-d4e1-4b15-a159-39f2b9493554 | vsharma2510/Coding_Practice | Cpp/classes_example.cpp | #include <iostream>
using namespace std;
class Rectangle {
// int width,height;
public:
int width,height;
void set_values(int,int);
int area(){return width*height;}
};
void Rectangle::set_values(int x,int y){
width=x;
height=y;
}
int area(int x, int y){
return 2*(x+y);
}
int main(){
Rectangle rect;
... | TOOL | 0.873607 | 5.256524 |
f73cabd3-84a9-4535-a887-f6b6303385c2 | sailfishos-mirror/llvm-project | openmp/runtime/src/kmp_tasking.cpp | /*
* kmp_tasking.cpp -- OpenMP 3.0 tasking support.
*/
#include "kmp.h"
#include "kmp_i18n.h"
#include "kmp_itt.h"
#include "kmp_stats.h"
#include "kmp_wait_release.h"
#include "kmp_taskdeps.h"
#if OMPT_SUPPORT
#include "ompt-specific.h"
#endif
#if ENABLE_LIBOMPTARGET
static void (*tgt_target_nowait_query)(void **... | TOOL | 0.960194 | 5.247917 |
4b47fa50-dec9-452d-8a18-f41740809143 | dipu-bd/OJ-Codes | UVA Codes/Volume 009/911 - Multinomial Coefficients/911 - Multinomial Coefficients.cpp | /*==================================
Author : Sudipto Chandra (Dipu)
Email : <EMAIL>
University : SUST
===================================*/
//#include <bits/stdc++.h>
//C headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <ctype.h>
//#include <assert.... | ALGO | 0.999816 | 3.489642 |
f46c8c84-94e6-4765-be23-0e55f8f6d6b9 | Azad88101/DSA_Practice | inCppByLov/Recursion 90/HOME-WORK-Q/100PRINT_ALL_SUBARRAY.cpp | #include <iostream>
#include <vector>
using namespace std;
void printSub(vector<int> a, int start,int end)
{
if(end==a.size())return;
for (int i = start; i <= end; i++)
{
cout<<a[i]<<" ";
}
cout<<'\n';
printSub(a,start,end+1);
}
int main(int argc, char const *argv[])
{
vector<in... | ALGO | 0.999835 | 4.298434 |
9ff8aad1-8f8a-430b-a342-c578b77b32f8 | ishandutta2007/codeforces | thienu/normal/1516/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define u_map unordered_map
#define u_set unordered_set
#define u_multiset unordered_multiset
using ll = long long;
using vvi = vector<vector<int>>;
using vi = vector<int>;
using vvll = vector<vector<long long>>;
using vll = vector<long long>;
using vd = vector<double>;
... | ALGO | 0.999905 | 3.958444 |
0e5d6bcf-30ec-4a67-9b0e-dd6742c8c3fa | kmk0105-S2/OSP | filtering/laplacianRGB.cpp | #include <iostream>
#include <opencv2/opencv.hpp>
#include <math.h> /* exp */
#define IM_TYPE CV_8UC3
using namespace cv;
// Image Type
// "G" for GrayScale Image, "C" for Color Image
#if (IM_TYPE == CV_8UC3)
typedef uchar G;
typedef cv::Vec3b C;
#elif (IM_TYPE == CV_16SC3)
typedef short G;
typedef Vec3s C;
#el... | ALGO | 0.986115 | 5.067492 |
8be6f324-4f1e-46b2-a3e1-9254fd9c37b4 | Slava/competitiveProgramming | more-source/cdf/cdf_4c.cpp | #include <cstdio>
#include <string>
#include <iostream>
#include <map>
using namespace std;
map<string, int>m;
int main ()
{
int n, i, a;string s;
scanf ("%d", &n);
for (i = 0; i < n; i++)
{
cin >> s;
a = m[s];
if (a)
cout << s << a << "\n";
else puts("OK");
m[s]++;
}
return 0;
}
| ALGO | 0.999645 | 4.237797 |
a5345ac6-4ad1-4780-a46c-1f7538af45c4 | kremenevskiy/Math-staff | Diophantine_equations/Solve_equation/solve.cpp | #include "solve.h"
Solve::Solve()
{
}
QString Solve::findSolution(int a, int b, int c){
QString result = "";
int gcd = GCD(a, b);
if (gcd < 0)
gcd *= -1;
result += "GCD - " + QString::number(gcd) + ".\n";
if(c % gcd != 0){
result += "No sulution in integer numbers!";
return result;
}
else{
result +=... | ALGO | 0.999704 | 3.575171 |
186290dc-0043-41f3-a186-0b4a103e941e | deepin-community/llvm-toolchain-19 | libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class fisher_f_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <cassert>
#include <vector>
#include <algorithm>
#include <cmath>
#include "test_macros.h"
double fac(double x)
{
double ... | TEST | 0.988804 | 4.650072 |
ed4a96c9-6b9f-4d92-80b0-104d235463c6 | JJH-Log/BaekjoonOnlineJudgeSolvedList | 202105/5M3W/B2263.cpp | #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <utility> //pair 사용
#include <algorithm> //reverse 사용
#include <math.h> // sqrt 사용
#include <set>
#include <stack>
//for (const auto& i : v) cout << i << ' ';
using namespace std;
vector<vector<int>> v;
vector<vector<int>... | ALGO | 0.999983 | 3.68064 |
53c41856-7194-4ee0-9281-2faf30c20c7f | Nirob-0812/acade.studio | Codefroces/(372 C. Watching Fireworks is Fun)/(372 C. Watching Fireworks is Fun).cpp | #include<bits/stdc++.h>
using namespace std;
long long progress(int n, int m, long long d, const vector<int>& a, const vector<int>& b, const vector<int>& t) {
deque<int> q;
vector<vector<long long>> dp(2, vector<long long>(n + 1));
int tag = 0;
for (int i = 1; i <= m; ++i) {
const vector<long l... | ALGO | 0.999871 | 5.839179 |
52d67926-5c72-4ab9-bd88-b3cdcff7750c | rafid211/online-judge-solution | UVA/Bicolorin(breadth).cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;
const double EPS = 1e-11;
const double PI = 2 * acos(0.0);
int CASE=0;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
ty... | ALGO | 0.99974 | 4.824978 |
86aa5581-76bb-4849-b6d2-5da10ef96f55 | JNArrazola/Leetcode_Files | 2696_minimiumStringAfterRemoving/main.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <array>
#include <set>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <deque>
#include <bits/stdc++.... | ALGO | 0.99872 | 4.590425 |
c5d803e4-5a47-4c02-938a-03b0735b7113 | AlessandroCilardo/NaplesPU-toolchain | compiler/lib/CodeGen/AggressiveAntiDepBreaker.cpp | #include "AggressiveAntiDepBreaker.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen... | ALGO | 0.988132 | 4.120936 |
2065b7f1-4c01-44b6-bb49-18de5bbbda85 | lewis-revill/agc-llvm-project | llvm/lib/Analysis/LegacyDivergenceAnalysis.cpp | #include "llvm/Analysis/LegacyDivergenceAnalysis.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/DivergenceAnalysis.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/TargetTransform... | ALGO | 0.922501 | 7.925796 |
db286a03-fad9-4781-a6e6-229be1eda3a7 | n0IQ/Competitive-Programming | codeforces/1530/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < b; i++)
#define repR(i, a, b) for (int i = a; i >= b; --i)
#define all(x) (x).begin(), (x).end()
#define rall... | ALGO | 0.999957 | 3.78998 |
59f0c969-2c9a-44b2-9474-8594834026ea | YilK/Programming_exercise | 王道机试书/05_数据结构一/stack/括号匹配.cpp | #include <iostream>
#include <stack>
#include <string>
using namespace std;
int main()
{
string str;
cin>>str;
stack<int> s;
char n[str.size()]={' '};
for(int i=0;i<str.size();i++)
{
if(str[i]=='(')
{
s.push(i);//ѹŵ±
}
else if(str[i]==')')
{
if(!s.empty())
s.pop();
else
n[i]='?';//Ųƥ
... | ALGO | 0.999939 | 3.294887 |
c745543a-0d6c-4775-a882-c1027296ec15 | Aditi1307/CP | PrintAllDivisors.cpp | //Given a number, print all the divisors of the number. A divisor is a number that gives the remainder as zero when divided.
#include<bits/stdc++.h>
using namespace std;
void divisors(int n){
for (int i = 1; i <= sqrt(n);i++){
if(n%i == 0)
cout << i<<" ";
}
cout << n;
}
int main(){
... | ALGO | 0.999649 | 4.654208 |
80d7b93d-681b-40e2-bbba-1ff974f58476 | Ishrak-Tawsif/Accepted-Codes | Ishrakk_Tawsif-ac/UVALive/4366/12794929_AC_69ms_0kB.cpp | #include<bits/stdc++.h>
using namespace std;
int dx[8]={0,0,1,-1,1,1,-1,-1};
int dy[8]={1,-1,0,0,1,-1,1,-1};
/*#pragma comment(linker,"/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#define sf(nn) scanf ("%d", &nn)
#def... | ALGO | 0.99966 | 3.526141 |
6c336dc5-77d6-4533-96f8-79a1f2c26973 | sarvex/leetcode-umka | solution/0800-0899/0859.Buddy Strings/Solution.cpp | class Solution {
public:
bool buddyStrings(string s, string goal) {
int m = s.size(), n = goal.size();
if (m != n) return false;
int diff = 0;
vector<int> cnt1(26);
vector<int> cnt2(26);
for (int i = 0; i < n; ++i) {
++cnt1[s[i] - 'a'];
++cnt2[... | ALGO | 0.999977 | 5.562934 |
f336c6ae-2caf-4424-ac2b-e0719f28fc25 | DBorello/OpenSeesDev | SRC/element/frictionBearing/TFP_Bearing2d.cpp | // Written: Tracy Becker
//
// What: "@(#) TFP_Bearing2d.C, revA"
// we specify what header files we need
#include "TFP_Bearing2d.h"
#include <elementAPI.h>
#include <G3Globals.h>
#include <math.h>
#include <float.h>
#include <Information.h>
#include <Domain.h>
#include <Node.h>
#include <Channel.h>
#include <Message... | ALGO | 0.988472 | 4.070835 |
01f17c74-346f-4837-89b8-a1779e3295a8 | greenbeanpie/OI-training | NOIP2023-ZJ/ZJ-0163/run/run.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int INF=0x3f3f3f3f3f3f3f3f;
struct AAA{
int x,y,v;
bool operator<(const AAA& aa)const{return (x<aa.x);}
}a[100005];
int dp[1005][1005],mx[1005];
bool cmp(const AAA& aa,const AAA& bb){return (aa.y<bb.y);}
signed main(){
freopen("run.in","r",stdi... | ALGO | 0.999775 | 3.957055 |
f6691fc1-169e-490c-bd1b-63e977ba258a | AbdulMoeez060/Labwork | PF LAB 3/1 Average and Compare.cpp | #include<iostream>
using namespace std;
double Average(int arr[], int size);
void CompareAverage(int arr[], int size, double num);
int main()
{
const int size = 10;
int arr[size] = { 5,6,2,2,8,6,4,5,4,9 };
cout << "Array is ";
for (int i = 0; i < size; i++)
{
cout << arr[i] << " " ;
}
cout << endl;
double av... | ALGO | 0.999759 | 3.890564 |
7725ffbf-bd5e-45df-a2e2-f2388c33a37b | meem-5971/Cp-with-Cpp | CP Practice/CF 1.2/Extra/A_Valera_and_Antique_Items.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
}
int main(){
int n,v;
cin>>n>>v;
vector<int>ans;
for(int i=0;i<n;i++){
bool f=false;
int x;
cin>>x;
for(int j=0;j<x;j++){
int y;
cin>>y;
if(!f && v>y){
f=true;
ans.pu... | ALGO | 0.999904 | 3.325938 |
20ec5f05-e437-45af-85d6-6f3fa67412b8 | suba1210/IPMP | 10_Dynamic_programming/3_2D_Grid_3D_DPs/4-ninja-training.cpp | #include<bits/stdc++.h>
using namespace std;
// recursion tc = O(n^3) sc = O(n)
int funcRecur(int day, int last, vector<vector<int>> &points){
if(day==0){
int maxi = 0;
for(int i=0;i<3;i++){
if(i!=last)
maxi = max(maxi, points[0][i]);
}
return maxi;
}... | ALGO | 0.999867 | 4.918091 |
52234272-2afb-4299-b489-0e89f1d339d9 | Amrhany1/Programming | c++/atbash cipher.cpp | // zeyad osama hassan 20206620
#include<iostream>
#include <map>
using namespace std;
map<char, char> lookup_table = {
{ 'A', 'Z' }, { 'B', 'Y' }, { 'C', 'X' }, { 'D', 'W' },
{ 'E', 'V' }, { 'F', 'U' }, { 'G', 'T' }, { 'H', 'S' },
{ 'I', 'R' }, { 'J', 'Q' }, { 'K', 'P' }, { 'L', 'O' },
{ 'M', 'N' }, ... | ALGO | 0.999528 | 4.036547 |
f936bbd1-6ba6-4474-bc1c-9d196d55b6a3 | MiracleZeroPenguin/CourseReview | ds review/codes/network.cpp | #include<bits/stdc++.h>
using namespace std;
int read(){
char c;int x;while(c=getchar(),c<'0'||c>'9');x=c-'0';
while(c=getchar(),c>='0'&&c<='9') x=x*10+c-'0';return x;
}
const int MAXN=10005,MAXM=100005;
int n,m,st,en,x,y,c,H,T,ans,use,cnt=0;
int nxt[MAXM*2],head[MAXN],dis[MAXN],q[MAXM*6];
struct node{
i... | ALGO | 0.999865 | 3.89837 |
e540ab95-c628-4908-ad64-f9d88df85c4e | Shreyyy07/DSA-CPP | Arrays/2148-minimum-number-of-moves-to-seat-everyone/minimum-number-of-moves-to-seat-everyone.cpp | class Solution {
public:
int minMovesToSeat(vector<int>& seats, vector<int>& students) {
sort(seats.begin(),seats.end());
sort(students.begin(),students.end());
int sum=0;
for(int i=0; i<seats.size(); i++){
sum+=abs(students[i]-seats[i]);
}
retur... | ALGO | 0.999924 | 4.938826 |
c4fade80-98c7-4312-b81a-0b30b2e1f3eb | chltkdgns1/Algorithm_first | 아이돌.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
vector <int> v[2001];
int visit[2001], c = 1, cnt = 1;
int d[2001];
stack <int> st;
int dfs(int s) {
visit[s] = c++;
int deep = visit[s];
st.push(s);
for (auto a : v[s]) {
if (!visit[a]) deep = min(deep, dfs(a));
el... | ALGO | 0.999992 | 4.547929 |
4751ac9b-d044-4e0c-a018-78497db31bf0 | leslieyip02/leetcode | completed/0074.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int lo = 0;
int hi = matrix.size() - 1;
int i = (lo + hi) / 2;
while (hi > lo) {
if (matrix[i].back() < target) {
... | ALGO | 0.999971 | 6.11042 |
caf7f20c-7150-42f0-a061-68f219b9d4f1 | steeti/Dictionary-Word-Search | quesbinary.cpp | //Saad Teeti
#include "header.h"
using namespace std;
void quesbinarysearch(string wordsearch, vector<string>& myvector, int high, int low, int& comp2, vector<string>& wordsfound)
{
int middlepoint=(high+low)/2;
if (high>low){
if (wordsearch.compare(myvector[middlepoint])==0) // check if our word until the sta... | ALGO | 0.999757 | 3.877774 |
bb14b610-67e2-4e73-95f0-c724e3bd5c5c | 109Dani109/myWorkout | MyWorkoutSite/tempCodeRunnerFile.cpp | #include <iostream>
using namespace std;
int main() {
int N , celMaiMare = 0, celMaiMic = 9999;
cin>> N;
for(int i = 1; i<=N; i++) {
cin>> N;
if(N > celMaiMare) {
celMaiMare = N;
}
if(N < celMaiMic) {
celMaiMic = N;
}
}
... | ALGO | 0.999934 | 3.826028 |
83cb01a6-fe98-4576-9443-088168f70901 | Mukai01/Study-Records | C++/2.A_Search/4.constants.cpp | #include <iostream>
#include <vector>
using std::cout;
using std::vector;
// constで引数を渡すと、誤って変更されることを防ぐことが可能
int sum(const vector<int> &v) {
int sum = 0;
for (int i:v)
sum += i;
// v[0] = 100; このように変更することはできない
return sum;
}
int main() {
vector<int> v {0,1,2,3,4};
cout << sum(v) <... | ALGO | 0.988358 | 4.71488 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.