uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f792f089-f6d5-4d3f-b061-a612644a61c4 | Icay12/LeetCode | Cpp/726_NumberofAtoms.cpp | class Solution {
public:
string countOfAtoms(string formula) {
int i = 0;
map<string, int> m = count(formula, i);
string res = "";
map<string,int>::iterator it;
for(it = m.begin(); it != m.end(); ++it) {
res += it->first;
if(it->second > 1)
... | ALGO | 0.99984 | 4.669063 |
6f4c1eeb-a7b3-4726-b17f-3d560626f5ec | igortakeo/Competitive-Programing | Codeforces/div3#634/A.cpp | #include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define fastcin ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int main(){
fastcin
int t;
cin >> t;
while(t--){
int n;
cin >> n;
if(n == 1 or n == 2) cout << 0 << endl;
else{
if(n%2 == 0) cout <<... | ALGO | 0.999915 | 5.19598 |
8b614ceb-0ecd-4292-8a73-a912e5f30e32 | evva002/exercicios-c-faculdade | exercicios-de-aula/condicionais-lacos-repeticao/calculo-qual-numero-maior.cpp | #include <stdio.h>
int main (void){
int numero1, numero2;
printf("Digite o primeiro numero: ");
scanf("%d", &numero1);
printf("Digite o segundo numero: ");
scanf("%d", &numero2);
if (numero1 > numero2){
printf("O primeiro numero e maior %d", numero1);
}
else{
printf("O segundo numero e maior %d", num... | ALGO | 0.996902 | 3.38172 |
7d68d7ef-3a93-4670-99d6-3f2558d4393d | arshitcc/LeetCode | 2434-design-a-number-container-system/2434-design-a-number-container-system.cpp | class NumberContainers {
public:
unordered_map<int,int> m;
unordered_map<int, set<int>> m1;
NumberContainers() {
}
void change(int index, int number) {
if(m.count(index)) {
int n = m[index];
m1[n].erase(index);
}
m[index] = number;
... | ALGO | 0.999877 | 5.732769 |
d374b854-ea60-4bcb-9fea-76c30456b9be | mryaomink/yaonews | 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 |
68fa9532-13ee-442c-bb2c-8ce33f94def8 | inkitori/cp-solutions | codeforces/1958D.cpp | #include <bits/stdc++.h>
using namespace std;
double height(int x, int r)
{
return sqrt((double)r * r - (double)x * x);
}
void solve()
{
int R;
cin >> R;
int ans = 0;
for (int i = 0; i <= R; i++)
{
for (int j = ceil(height(i, R)); j <= floor(height(i, R + 1)) && j < ceil(height(i, R + 1)); j++)
ans++;
}
... | ALGO | 0.998896 | 4.05858 |
559446b0-69cd-40d7-8a34-32abb9cc9434 | dilevin/CSC417-a6-rigid-body-contact | extern/libigl/include/igl/copyleft/cgal/point_solid_signed_squared_distance.cpp | template <
typename DerivedQ,
typename DerivedVB,
typename DerivedFB,
typename DerivedD>
IGL_INLINE void igl::copyleft::cgal::point_solid_signed_squared_distance(
const Eigen::PlainObjectBase<DerivedQ> & Q,
const Eigen::PlainObjectBase<DerivedVB> & VB,
const Eigen::PlainObjectBase<DerivedFB> & FB,
Eigen... | ALGO | 0.999354 | 6.639913 |
73e132ac-7a18-4a9f-9365-7f276c8ae234 | RayLikesAnime/Coding-2 | B_Arranging_Cats.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long int
int mod=1e9+7;
int32_t main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s,f;
cin>>s>>f;
int c1=0,c2=0,c3=0,c4=0;
for(int i=0;i<n;i++){
if(s[i]=='1')
c1++;
... | ALGO | 0.999956 | 4.354269 |
9815ae06-c3a8-4e48-be33-0ba5bb01772d | kuangtu/cplusplus | chap6/exec6_12.cpp | #include <iostream>
using std::cin;
using std::cout;
using std::endl;
void
exchg(int &a, int &b)
{
int c;
c = a;
a = b;
b = c;
}
int
main(int argc, char *argv[])
{
int a = 10;
int b = 15;
cout << "before exchange a:"<< a << "and b:" << b << endl;
exchg(a , b);
cout << "after exchange a:"<< a << "and b:" <... | ALGO | 0.994099 | 3.855175 |
cfc61340-0b8c-4910-b428-9b0c369c90b2 | teodorogit/senior-from-scratch | SOpt_learning/CPP/Template/IfSameType.cpp | #include <iostream>
#include <string>
#include <vector>
#include <string.h>
#include <type_traits>
using namespace std;
template<typename T>
int len(T args) {
if constexpr (is_same_v<T, const char*>) return strlen(args);
else return args.size();
}
int main() {
string a = "Ola Mundo!";
const char *b ... | ALGO | 0.958702 | 4.307863 |
4d8ed75c-9ab9-4270-b018-c861e941ae99 | thejoebaldwin/ios-sandbox | FluidDemo/RecipeCollection02_/libs/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp | #include <Box2D/Dynamics/Joints/b2RevoluteJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Point-to-point constraint
// C = p2 - p1
// Cdot = v2 - v1
// = v2 + cross(w2, r2) - v1 - cross(w1, r1)
// J = [-I -r1_skew I r2_skew ]
// Identity used:
// w k % (rx i + ry j) = w * (-r... | ALGO | 0.984319 | 7.663429 |
90929313-7b74-4253-b3fe-c6d5a3ed5f6b | whuPR/oceanbase-2025 | src/sql/engine/dml/ob_conflict_checker.cpp | #define USING_LOG_PREFIX SQL_ENG
#include "sql/engine/dml/ob_conflict_checker.h"
#include "sql/das/ob_das_utils.h"
namespace oceanbase
{
using namespace common;
using namespace share;
using namespace storage;
using namespace share::schema;
namespace sql
{
int ObTabletSnapshotMaping::assign(const ObTabletSnapshotMapin... | TOOL | 0.862667 | 6.762818 |
a62da6fd-0108-4510-ad0f-2d1ba8ae8777 | datracker/InterviewPrep | linkedList.cpp | #include <iostream>
using namespace std;
struct Node
{
int data;
Node* next;
};
class linkedList
{
private:
Node *head, *tail;
public:
linkedList()
{
head = NULL;
tail = NULL;
}
void createNode(int value)
{
Node *temp = new Node;
temp->data = value;
temp->next = NULL;
if(head == NULL)
{
head... | ALGO | 0.99847 | 4.449851 |
e6f74cda-313a-4478-a236-c4cf09b48afc | nimendoza/noi-2023 | training/week-4/hackables/E/jlallas384/206886018.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int tt;
cin >> tt;
while(tt--){
int n,k;
cin >> n >> k;
vector<ll> a(n), b(n);
for(ll &x: a){
cin >> x;
}
for(ll &x: b){
cin >> x;
}
vector<vector<ll>> f(n + 1, vector<ll>... | ALGO | 0.999986 | 3.558795 |
25130eef-81c1-48b3-95a8-29a57dd5e644 | VaishnavMankar/C-Plus--Pogramming | LeetCode 75 (ISSC)/69_problem_547_1.cpp | //547. Number of Provinces
//Graph
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
class Solution {
public:
void dfs(vector<vector<int>>& isConnected, vector<bool>& visited, int city) {
visited[city] = true;
for (int j = 0; j < isConnected.size(); j++) {
if... | ALGO | 0.999862 | 6.936189 |
2fbb5fde-fa24-418f-b795-37bd7007177e | AFpine/Problem-Solving | BOJ/1000-4999/3977.cpp | #include <bits/stdc++.h>
// 3977 축구 전술
// update 220513
using namespace std;
const int INF = 1e9+5;
const long long llINF = 1e18;
const int minINF = -2e9-1;
const int MAX = 100005;
int T;
int N,M,A,B;
int cnt,sccnum;
int sccidx[MAX];
int dfsn[MAX];
int indegree[MAX];
bool finished[MAX];
vector<int> adj[MAX];
stack... | ALGO | 0.999856 | 4.642337 |
0d0a3223-0fd4-4fb7-ba19-0e660db9fe11 | tahaeg1k/tahaeg1k | options-pricing/base/OptionsPricingModel.cpp | #include "OptionsPricingModel.h"
#include <limits>
#include <cstdlib>
#include <iostream>
#include <cfloat>
OptionsPricingModel::OptionsPricingModel() = default;
OptionsPricingModel::~OptionsPricingModel() = default;
double OptionsPricingModel::callOptionDelta(double spotPrice, double strike, double yearsToExpiry, ... | ALGO | 0.998152 | 7.360404 |
07cd64fc-ca2e-48ac-847e-dc5ca268d0f8 | neel0976/code365 | combinationSum.cpp |
class Solution {
public:
vector<vector<int> > combinationSum(vector<int> &candidates, int target) {
sort(candidates.begin(), candidates.end());
vector<vector<int> > ans;
vector<int> v;
dfs(candidates, target, 0, v, ans);
return ans;
}
... | ALGO | 0.999991 | 6.263092 |
cc42cae5-3f8d-4e1d-816c-f6e9369cd0f5 | Mickai55/FMI-Unibuc-Homework | Year 1 Sem 2/AG kruskal/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
using namespace std;
struct muchie
{
int a, b, cost;
};
void DFS(int node, vector<int> &viz, vector<vector<int>> &adj)
{
viz[node] = 1;
for (auto v : adj[node])
if (viz[v] == 0)
DFS(v, viz, adj);
}
bool verifica(int a, int b, int n... | ALGO | 0.999889 | 4.467969 |
3d74222e-0286-43d0-9441-e28123cb47b4 | sripriyaagarwal16/DSA-Basic_to_hard_level | linkedlist/merge.cpp | #include<iostream>
using namespace std;
class node{
public:
int data;
node*next;
//Constructor
node(int data){
this->data=data;
next=nullptr;
}
};
node *takeinput_better(){
int data;
cin>>data;
node*head=nullptr;
node*tail=nullptr;
while(data!=-1){
node *newnode=new... | ALGO | 0.999938 | 5.150156 |
c6a1b6ac-1570-4b53-9019-22b6104e9121 | Pratham27Dwivedi/Boku-wa-Kira-da | CHEFAPPS.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--) {
int s, x, y, z;
cin>>s>>x>>y>>z;
if (s < x+y+z) {
if (s>=y+z || s>=x+z) cout<<1;
else cout<<2;
}
else cout<<0;
cout<<endl;
}
return 0;
}
| ALGO | 0.999402 | 3.547002 |
e34ce089-d5fc-4569-8213-679e60858b92 | Salikha003/leetcode-algorithms | 34-find-first-and-last-position-of-element-in-sorted-array/2024-02-21 11.30.45 - Accepted - runtime 3ms - memory 16MB.cpp | class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
for (int i = 0; i < nums.size(); i++){
if (nums[i] == target){
int j = i;
while(i < nums.size() && nums[i] == target)i++;
return {j, i - 1};
}
}
... | ALGO | 0.999962 | 6.587092 |
95c21d75-06e6-4eaa-a5a2-8db09ccf4147 | DubaiCoinDev/DubaiCoin | src/qt/guiutil.cpp | #include "guiutil.h"
#include "bitcoinaddressvalidator.h"
#include "walletmodel.h"
#include "bitcoinunits.h"
#include "util.h"
#include "init.h"
#include <QString>
#include <QDateTime>
#include <QDoubleValidator>
#include <QFont>
#include <QLineEdit>
#include <QUrl>
#include <QTextDocument> // For Qt::escape
#include ... | TOOL | 0.922678 | 7.195526 |
6d3329e6-fb2a-48d3-8f98-6910e291f6a8 | Uzer447/Data-Structures-Leetcode | 3621-minimum-operations-to-make-array-values-equal-to-k/3621-minimum-operations-to-make-array-values-equal-to-k.cpp | class Solution {
public:
int minOperations(vector<int>& nums, int k) {
bool seen[105] = {0};
int cnt = 0;
for (int x : nums) {
if (x < k) return -1;
if (x > k && !seen[x]) {
seen[x] = true;
cnt++;
}
}
return ... | ALGO | 0.999955 | 5.518737 |
ad44429e-d642-435c-875f-9057e94aeff9 | ishandutta2007/codeforces | kotatsugame/normal/1666/E.cpp | #include<iostream>
using namespace std;
int L,N,A[1<<17];
int S[1<<17],F[1<<17];
int lp[1<<17],rp[1<<17];
main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>L>>N;
for(int i=0;i<N;i++)cin>>A[i];
int MN;
{
int l=1,r=L+1;
while(r-l>1)
{
int mid=(l+r)/2;
int pre=0;
bool ok=true;
for(int i=... | ALGO | 0.999989 | 3.144482 |
16de4279-30fa-4c9b-80af-c34293f57914 | armanelgtron/Cycles3D | cycles3d/gfx/math3d.cpp | #include "../cycles3d.h"
#include <math.h>
// The world matrix is used for moving objects in
// space to different places in space, regardless of
// where the viewer is.
Matrix4x4 g_WorldMatrix;
// This function creates the camera matrix given:
//
// The position of the camera in 3D (eye)
// The point that the camera... | ALGO | 0.98334 | 3.685579 |
8859dd42-e697-44ed-9bd1-21c002865582 | nitin-maharana/SPOJ | HANGOVER.cpp | /*
* Written by Nitin Kumar Maharana
* <EMAIL>
*/
#include <iostream>
using namespace std;
int main(void)
{
float input, memory[300];
memory[0] = memory[1] = 0.0f;
for(int i = 2; i < 300; i++)
memory[i] = memory[i-1] + (1.0f/i);
cin >> input;
while(input != 0)
{
int i;
for(i = 2; i < 300; i++)
... | ALGO | 0.999486 | 3.195088 |
50746d22-cbbb-479f-a51f-fd8abb22b733 | Mohammedelsisi21/problem-Assiut | Newcomers/Sheet 1 (Data type)/contest/G/main/main.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
long long n, m, k ,res = 0, test1, test2, test3;
cin>>n>>m>>k;
test1 = min(n, min(m, k));
res += test1;
n -=test1;
m -=test1;
k -=test1;
test2 = min(n / 2 , min(m , k));
res += test2;
n -=test2;
m -=test... | ALGO | 0.999968 | 3.78826 |
3ec9ef5d-fceb-4c9d-b2fa-dfe6fd15af4f | Chifiwang/problems | cf_1999B/main.cpp | #include <iostream>
void solve() {
int a[2];
int b[2];
std::cin >> a[0] >> a[1] >> b[0] >> b[1];
int res = 0;
int score = 0;
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) {
if (a[i] > b[j]) {
score++;
} else if (a[i] < b[j]) {
... | ALGO | 0.999974 | 4.860415 |
10697dc5-e1a7-4fc3-a650-5362efa34ec2 | yilinguo121/cp | abc371a.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
char q, w, e;
cin >> q >> w >> e;
if ((q == '<' and w == '<' and e == '<') or (q == '>' and w == '>' and e == '>')) cout << 'B';
if ((q == '<' and w == '<' and e == '>') or (q == '>' and w == '>' and e == '<')) cout << 'C';
if ((q == '<' and w == '>' and e ... | ALGO | 0.999963 | 3.624176 |
7e21ee14-7064-4933-a543-9d9bf94cb7de | VenkataDurgareddy/owl-progs | 713-subarray-product-less-than-k/subarray-product-less-than-k.cpp | class Solution {
public:
int numSubarrayProductLessThanK(vector<int>& nums, int k) {
int pro=1;
int right=0;
int left=0;
int ans=0;
while(right<nums.size())
{
pro=pro*nums[right];
while(pro>=k && left <= right)
{
pro=pro/nums[left];
left++... | ALGO | 0.999932 | 5.416474 |
97439029-9bcd-41de-9701-e29892567636 | santoshn/softboundcets-3.5.0 | softboundcets-llvm-3.5.0/tools/clang/lib/Tooling/CompilationDatabase.cpp | #include "clang/Tooling/CompilationDatabase.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Driver/Action.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Job.h"
#include "clang/F... | TOOL | 0.897628 | 7.910009 |
d17c22dd-8edc-4190-a445-3a2a01793082 | caweinshenker/CS303 | Proj 2/main.cpp | #include <iostream>
#include <random>
using std::cout;
using std::endl;
using std::ios_base;
#include "array.hpp"
int main (int argc, char **argv)
{
cs303::array<double> v(8);
// Explicit initialization of v.
std::cout << "v: (size = " << v.size() << ")\n";
for (long i = 0; i < v.size(); i++) {
v[i] = (... | ALGO | 0.995677 | 4.423838 |
d0a5a285-8298-4a62-be9f-6dd42d6f596f | better-call-vee/Cpp-programming | Graph-BFS-problem-Romeo&Juliet.cpp | /*
Romeo and Juliet are a newly married couple. They went to Switzerland for their honeymoon.
They had a plan in mind: they would test their fortune by staying in different cities and seeing if
they could reunite in at most K steps. Switzerland has N cities numbered from 0 to N-1, with E
two-way roads connecting them.
... | ALGO | 0.999997 | 5.135113 |
df029909-47f2-41c2-a929-9dafc0e71a4b | anubhav-bhard/Competitive-Programming-June-Course- | Jeevika Wadhwa/LinkedList, Stack & Queue/42_Odd_Even_Linkedlist.cpp | class Solution {
public:
ListNode* oddEvenList(ListNode* head) {
if(head == NULL)return head;
ListNode *odd = head, *even = head->next;
ListNode *evenhead = even;
while(even != NULL && even->next != NULL){
odd->next = odd->next->next;
odd = odd->next;... | ALGO | 0.999907 | 5.716097 |
bd03c91e-01f8-41b6-84fd-35074a289629 | zxok365/mandrake | contest/2015-09-13/L.cpp | #include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int modulo(1000000007);
int inv2((1000000007 + 1) / 2);
int getInt() {
int x(0);
char c;
c = getchar();
while(c < '0' || c > '9') {
c = getchar();
}
while(c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = getchar();
}
return x;
}
... | ALGO | 0.999707 | 3.728532 |
6282ccbb-e462-4cb7-934e-f726626194c0 | opnsense/src | contrib/llvm-project/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp | #include "llvm/DebugInfo/CodeView/TypeDumpVisitor.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
#include "llvm/DebugInfo/CodeView/TypeCollection.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/Cod... | TOOL | 0.88771 | 5.543896 |
5af8cfec-9900-43dd-98b8-7828e3f87756 | rovinbhandari/Programming_Scripting | ProgrammingCompetitions/ACM-ICPC/ACM-ICPC_12/Amritapuri/online contest/ACM-ICPC Amritapuri 2012 Online Competition Accepted Solutions/B/cpp/00006173_B_STICKS_amicpc120424.cpp | #include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long int n,m;
//cin>>n>>m;
scanf("%lld%lld",&n,&m);
long long int arr[n];
for(int i=... | ALGO | 0.999849 | 3.409327 |
61959499-9f48-4cb3-a590-f16772450226 | AnupamAkib/UVA-and-LA-Problem-Solution | UVa 10193.cpp | /*BISMILLAHIR RAHMANIR RAHIM*/
#include<bits/stdc++.h>
#define lli long long int
#define yes cout << "Yes\n"
#define no cout << "No\n"
#define ALL(x) x.begin(), x.end()
#define print(x) cout<<x<<endl;
#define PI acos(-1.0)
#define nl cout<<"\n"
#define mem(ar, val) memset(ar, val, sizeof(ar))
#define point(x) fixed<<se... | ALGO | 0.999539 | 4.83888 |
48b6ee32-7a33-4662-a330-20df0f3356c1 | mutharibayub/Competitive_Programming | LeetCode/Weekly72/p4.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector<int> kthSmallestPrimeFraction(vector<int>& arr, int k) {
priority_queue<pair<double,pair<int,int>>, vector<pair<double,pair<int,int>>>, greater<pair<double,pair<int,int>>>> q;
for(int i=0;i<arr.size();i++)
{
for... | ALGO | 0.999778 | 4.331046 |
c3377877-be82-4be4-acb6-e3f984454620 | Aranch422/Algorithm_Study | 2022/TwoPointer/1644_primeSum.cpp | #include <iostream>
#include <vector>
using namespace std;
long long n;
vector<long long> prime;
vector<long long> primeSum;
bool isPrime[4000001];
long long biSearch(long long left, long long right, long long target){
long long mid = (left + right)/2;
if(left == right){
if(primeSum[mid]==target){
return mid... | ALGO | 0.999931 | 4.134948 |
1fb435da-5f12-40a3-a9e7-8c721dc900d3 | randbatch-md/lammps-rbe | src/EXTRA-FIX/fix_electron_stopping_fit.cpp | // clang-format off
/* ---------------------------------------------------------------------
Contributing authors: Stephen M. Foiles (SNL)
James A. Stewart (SNL)
------------------------------------------------------------------ */
#include "fix_electron_stopping_fit.h"
#include "atom.... | ALGO | 0.998375 | 5.867354 |
2b3796c7-f79b-438c-a92e-20b9238b3afb | SameerVerma07/Coding_Ninja_Problems_solution | Learn the Basic/Switch cases/area_switch_case.cpp | // using Switch case senario
#include<bits/stdc++.h>
using namespace std;
double areaSwitchCase(int ch, vector<double> a) {
// Write your code here
switch(ch){
case 1:
return a[0]*a[0]*3.14159265359;
case 2:
return a[0]*a[1];
default:
return 0;
}
}
int main(){
int x;
cin>>x;
if (... | ALGO | 0.995662 | 3.789922 |
853c9f02-27c7-405a-b50c-2712bbee50d1 | Charul2304/Leetcode_DSA | 56-merge-intervals/merge-intervals.cpp | class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
int n=intervals.size();
vector<vector<int>> merged;
sort(intervals.begin(),intervals.end());
for(int i=0;i<n;i++){
if(merged.empty() || merged.back()[1]<intervals[i][0]){
... | ALGO | 0.999999 | 6.214873 |
3344dd4c-ee59-483d-8143-610007706b73 | yosupo06/library-checker-problems | data_structure/point_set_range_sort_range_composite/gen/many_0_query.cpp | #include "random.h"
#include "../params.h"
#include <iostream>
using namespace std;
int main(int, char* argv[]) {
long long seed = atoll(argv[1]);
auto gen = Random(seed);
auto generate_t = [&]() -> int {
int t = gen.uniform<int>(0, 1000);
if (t > 3) t = 0;
return t;
};
int n = N_MAX;
int q ... | TOOL | 0.952181 | 3.729095 |
42ea4675-ede3-4bfa-986f-90707dde068f | PKT2004/luogu | p2089烧鸡.cpp | #include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=20;
int n=0;
int arr[N];
int res=0;
int mem[35095][N]={0};
void dfs(int x,int sum) //dfs:使用for往下遍历,遵循从小到大的原则,设置的参数一般代表位置
{
if(sum>n) return; //剪枝,遍历的时候会遍历到不符合的情况,然后进行剪枝
if(x==11)
{
if(sum==n) //将sum!=n情况区分 ... | ALGO | 0.999656 | 4.627576 |
1cfa9a3a-777f-4705-a5cd-0075a9dab16d | JC3P0/Education | MiraCosta College SoftwareDev/CS 151 C++ II/Module 8/Demos/Addition.cpp | /* Addition.cpp - Create functors that allow addition of numbers and strings
* Author: Chris Merrill
* Module: 8
* Project: Demonstration
* Problem statement: Create a class named "Addition" which has two
* functions which overload the () operator. One takes two ints
* and returns another int, ... | TOOL | 0.874917 | 6.764159 |
a5a88a14-0a3a-4f26-8fb4-a01fe1e7994b | MohamedShahed/problem-solving | codeforces/A/Free_Ice_Cream_2.cpp | #include<iostream>
using namespace std;
int main(void){
int n; long long x,d;cin>>n>>x;
char sign;
int distressChild=0;
while(n){
cin>>sign>>d;
if(sign=='+'){
x+=d;
}
else if(sign=='-' && d<=x){
x-=d;
}
else {
distres... | ALGO | 0.999863 | 3.65225 |
6e2eb2af-3114-4d88-93e4-b56d8d98bf97 | raincross7/code-similarity | codes/train_code/problem367/problem367_226.cpp | #include <bits/stdc++.h>
using namespace std;
//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS... | ALGO | 0.999674 | 4.534688 |
7631cd9c-a4ea-4654-aac0-39300e1f2b24 | WhenitStarted/SpaceGameFinalProject | Code/LinkedList.cpp | //
// Created by Nat on 5/30/2021.
//
#ifndef STACKANDQUE_LINKEDLIST_CPP
#define STACKANDQUE_LINKEDLIST_CPP
#include "LinkedList.h"
template<class t>
void LinkedList<t>::insertBefore(t item, t before)
{
Node<t>* target =search(before);
insertBefore(item, target);
}
template<class t>
void LinkedList<t>::inser... | TOOL | 0.885736 | 3.932966 |
f8f5340a-f0f5-40bf-a477-eb115e0d907e | raincross7/code-similarity | codes/train_code/problem091/problem091_230.cpp | #include <bits/stdc++.h>
#define ll long long
#define mp make_pair
using namespace std;
inline int read()
{
int x=0,fl=1;char st=getchar();
while(st<'0'||st>'9'){ if(st=='-')fl=-1; st=getchar();}
while(st>='0'&&st<='9') x=x*10+st-'0',st=getchar();
return x*fl;
}
const int N=1e5+10;
int d[N],v[N],n;
struct skr
{
i... | ALGO | 0.999889 | 3.022132 |
84f25db1-49c6-4392-93eb-7728328e7608 | Dyryamo/algorithm | 牛客/copy.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
#include <vector>
using namespace std;
#define inf 1000010
struct ST{
int to, val;
ST( int t, int v ) {
to = t;
val = v;
}
};
vector<ST> vec[100];
int cost[110];
int vis[110];
int c, n, m;
void dijkstra( int d ) {
fill(cos... | ALGO | 0.999986 | 3.886503 |
f8bfa2cf-d2a7-4889-9397-1f0acb4fff32 | ZouJiu1/PAT | PAT(Advanced_Level)Practice/1143 Lowest Common Ancestor.cpp | #include<iostream>
#include<vector>
#include<unordered_set>
using namespace std;
int main(void) { //inorder从middle找,preorder从前找,postorder从后找
int i, j, k, m, n, x1, x2;
cin>>m>>n;
vector<int> vtr(n);
unordered_set<int> st;
for(i = 0; i < n; i++) {
scanf("%d", &vtr[i]);
st.insert(vtr[i... | ALGO | 0.99997 | 3.71449 |
56b6c4a4-13ae-4df5-849a-1d8bed7e03fb | ishandutta2007/codeforces | kmjp/normal/464/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<to;x++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-----... | ALGO | 0.999935 | 4.052692 |
53f317bd-2fb4-40de-a529-89a7a7a4f162 | Chaaany/SSafy_15_BESTTEAM | 20221202/백준/오석호_G5_2589_보물섬.cpp | #include <iostream>
#include <string>
#include <queue>
using namespace std;
char arr[50][50];
int chk[50][50];
int dr[4] = { 1, 0, -1, 0 };
int dc[4] = { 0, 1, 0 ,-1 };
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(NULL);
// 2589 보물섬
// BFS
int n, m;
string tmp;
... | ALGO | 0.999749 | 4.303013 |
7e74ab34-e8be-4741-b744-6e81a04ea1d9 | dabaier/code | 可视化/数据处理相关文件/Dataset/train/29_KMP/KMP-15.cpp | int KMPindex(Sqstring s, Sqstring t)
{
int next[Maxsize], i = 0, j = 0;
Getnext(t, next);
while (i < s.length&&j < t.length)
{
if (j == -1 || s.data[i] == t.data[j])
{
i++;
j++;
}
else
j = next[j];
}
if (j >= t.length)
return (i - t.length);
else
return (-1);
}
| ALGO | 0.999718 | 3.902618 |
328d4d98-dfe6-480d-a6a4-15376e16d7b1 | Lancelof2019/WlgOpenMP_CovFunction | functionspace/erosion.cpp | #include "../headerspace/WatershedAlg.h"
using namespace cv;
Mat WatershedAlg::erosion(Mat &image, vector< vector <int> > &kernel) {
int morph_size = 2;
Mat element = getStructuringElement(cv::MORPH_RECT, Size(2 * morph_size + 1,2 * morph_size + 1),
Point(morph_size, morph_size));
Mat dill(image.... | ALGO | 0.999722 | 4.810441 |
c97317b0-f31e-40a5-a232-4be4a6bbe392 | ryandeleon1/DeLeonRyan_CSC5_41202 | Homework/Assignment 1/Savitch_9thEd_Chap1_Prob1_proj/main.cpp | /*
* Author: Ryan DeLeon
* Created on January 9, 2016, 12:57 pm
* Purpose: Adding and multiplying integers
*/
//System Libraries
#include <iostream> //I/O library
using namespace std;
//User Libraries
//Global Constant
//Function Prototypes
//Execution Begins Here
int main(int argc, char** argv) {
... | TOOL | 0.974973 | 4.9445 |
8b1aab7e-ff6a-4878-9150-82f7d25b040c | junstat/CppLearning | LeetCode/Q0199/Q0149/Solution.cpp | #include <vector>
#include <string>
#include <unordered_map>
using namespace std;
class Solution {
public:
int maxPoints(vector<vector<int>> &points) {
size_t n = points.size();
int ans = 1;
for (size_t i = 0; i < n; ++i) {
unordered_map<string, int> cnt;
int maxCnt... | ALGO | 0.999457 | 5.488122 |
27134b3c-e229-43a8-ba7b-40488b4300e3 | trungnguyenth/C-Programming | Sach_Xanh/Chương 3/Bai21.cpp | #include <stdio.h>
#include <conio.h>
void main()
{
for (int i = 1; i <= 9; i++)
{
printf("=============BANG CUU CHUONG %d================\n", i);
for (int j = 1; j <= 10; j++)
printf("%d * %d = %d\n", i, j, i * j);
}
getch();
} | ALGO | 0.930288 | 3.130854 |
51b949a9-b188-401a-b3d9-3ed10f8c0bd6 | gauravk268/Competitive_Coding | CP/Recursion/Kth_Symbol_in_Grammar.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define MOD 1e9+7
#define deb(x) cout<<#x<<"="<<x<<endl
#define f first
#define s second
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef deque<int> di;
typedef stack<int> si;
typedef priority_qu... | ALGO | 0.999945 | 4.819493 |
419b7eac-4ae2-4604-aa4d-cd96399a5fd3 | ujju20/DSA-Practice | Heap/Smallest-range-in-K-Lists.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
#define N 1000
// } Driver Code Ends
// you are required to complete this function
// function should print the required range
class Solution{
public:
pair<int,int> findSmallestRange(int arr[][N], int n, int k)
{
//code here
... | ALGO | 0.999916 | 4.381092 |
416ee707-a332-4f32-8fe5-65c5165bf0ad | lxc-xx/CudaSample | NVIDIA_CUDA-5.5_Samples/6_Advanced/FDTD3d/src/FDTD3dReference.cpp | #include "FDTD3dReference.h"
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <stdio.h>
void generateRandomData(float *data, const int dimx, const int dimy, const int dimz, const float lowerBound, const float upperBound)
{
srand(0);
for (int iz = 0 ; iz < dimz ; iz++)
{... | ALGO | 0.987738 | 4.753658 |
47052b2f-8410-4c90-b9cb-7fa47fb3d11f | tomlankhorst/advent-of-code-2020-cpp | day23/crab-cups.cpp | #include <algorithm>
#include <iostream>
#include <list>
#include <ranges>
namespace ranges = std::ranges;
/* I use two data-structures for this problem.
* a) a list for quick insertion, removal (and splice)
* b) a map to track the relation between value and list iterator for quick lookup
* To make this work, I ha... | ALGO | 0.999933 | 5.430634 |
0a6b21bf-a533-46ed-9f0a-4d4cd80482cc | Aaronhdez/Grado-Ingenieria-Informatica | Segundo Ingenieria Informatica (Plan 40)/Metodos Numericos para la Computacion/Ejercicios Alumno/Prueba 6/RelajacionEscasas_hacer_alumno/RelajacionEscasas/main.cpp | /* Procedimiento de prueba para el uso del mtodo de Gauss-Seidel */
#include <stdio.h>
#include "../mn_relajacion.h"
#include "../mn_lapack.h"
#include <stdlib.h>
int main()
{
Array2D< real > A;
Array1D< real > b, b2;
Array1D < Array1D< real > > Ae;
Array1D < Array1D< int > > J;
int i,N,iter,nMax=100000;
... | ALGO | 0.999892 | 3.301602 |
e6f86d4c-bc9b-4d22-a0a1-4164e3846464 | maryskar/spbspu-labs-2022-aap-904-a | shelkovnikov.dmitrii/I3/removeextraspaces.cpp | #include "removeextraspaces.h"
#include <cctype>
char *remove_extra_spaces(char *destination, const char *source)
{
size_t size = 0;
size_t d = 0;
while (std::isspace(source[d]))
{
d++;
}
while (source[d])
{
if (std::isspace(source[d]))
{
char space_char = source[d];
while (std::is... | TOOL | 0.920152 | 4.338055 |
0e1d09fe-ae4f-4d59-819a-4aa0e1f78af2 | Mulab11/cntt2016-hw1 | TC-SRM-579-div1-450/qiaoranliqu.cpp | #include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define N 55
#define M 16
#define seed 233... | ALGO | 0.999404 | 3.738404 |
ccda0557-7ad5-4ce2-996b-c5d8a890e35c | dEmON407/Semester1-Lab | MCA_136_B/Week_05/Second_Largest.cpp | #include<iostream>
using namespace std;
int main()
{
int num,num1,temp,largest=0, second;
cout<<"Enter no of elements you want to enter :";
cin>>num;
int arr[num-1];
//Input elements in array
for(int i=0; i<num; i++)
{
cout<<"Enter the element "<<i+1<<" :";
cin>>temp;
arr[i]=temp;
}
//Second Gr... | ALGO | 0.999843 | 3.090426 |
9293750e-bf35-4353-bdc2-6dfc825d1d0a | joshualass/CP | Solutions/Contests/Special/CollegeComps/UTPC/Open24/I.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD = 1e9 + 7;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n, m; cin >> n >> m;
map<ll,ll> ma;
for(ll i = 0; i < n; i++) {
string s; cin >> s;
ll num; ci... | ALGO | 0.99994 | 4.751252 |
c9a0fd1e-cb36-407c-81e0-4ade5d28855a | aizsfgk/leetcode-cn | editor/cn/[剑指 Offer II 058]日程表.cpp | //请实现一个 MyCalendar 类来存放你的日程安排。如果要添加的时间内没有其他安排,则可以存储这个新的日程安排。
//
// MyCalendar 有一个 book(int start, int end)方法。它意味着在 start 到 end 时间内增加一个日程安排,注意,这里
//的时间是半开区间,即 [start, end), 实数 x 的范围为, start <= x < end。
//
// 当两个日程安排有一些时间上的交叉时(例如两个日程安排都在同一时间内),就会产生重复预订。
//
// 每次调用 MyCalendar.book方法时,如果可以将日程安排成功添加到日历中而不会导致重复预订,返回 true。... | ALGO | 0.999846 | 5.864998 |
53af7d99-931d-44e4-940f-477186bfddfc | ravynsoft/ravynos | contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp | #include "llvm/Transforms/Scalar/LoopDataPrefetch.h"
#include "llvm/InitializePasses.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/CodeMetrics.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/OptimizationRema... | ALGO | 0.994061 | 7.824398 |
33ac86c0-0a96-41a1-baff-2b77d1c9ee6c | jaredjxyz/SDCNanodegree | CarND-Capstone/ros/src/waypoint_follower/src/pure_pursuit.cpp | #include "pure_pursuit_core.h"
constexpr int LOOP_RATE = 30; //processing frequency
int main(int argc, char **argv)
{
// set up ros
ros::init(argc, argv, "pure_pursuit");
ros::NodeHandle nh;
ros::NodeHandle private_nh("~");
bool linear_interpolate_mode;
private_nh.param("linear_interpolate_mode", linea... | ALGO | 0.934198 | 4.91943 |
6662048b-3e9f-43ea-8513-03d76178d25b | ManasviGaur/Competitive-Programming-Solutions | atcoder/abc172/B.cpp | #include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define fo(i,a) for(ll i=0;i<a;i++)
#define Fo(i,a,n) for(ll i=a; i<n; i++)
#define u_m unordered_map
#define u_s unordered_set
#define ff first
#define ss second
#define mp make_pa... | ALGO | 0.999909 | 4.450619 |
3b196320-9e41-418d-97a7-634793336bf4 | hirakuuuu/kyopro | ABC/194/abc194_e.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for(int i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i >= n; i--)
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
// constexpr ll MOD = 1000000007;
constexpr ll MOD = 998244353;
constexpr int IINF = 1001001001;
conste... | ALGO | 0.999991 | 4.286871 |
4f70fbd5-7616-4acd-a0ae-6cb21df8c3f0 | luizcdc/trying-new-things | coding_exercises/quadrante.cpp | #include <iostream>
using namespace std;
int main()
{
int abss, orde;
while (cin>>abss && cin>>orde && abss != 0 && orde != 0)
{
if (abss > 0 && orde > 0)
{
cout<<"primeiro"<<endl;
} else if (abss < 0 && orde > 0)
{
cout<<"segundo"<< endl;
} els... | ALGO | 0.999978 | 3.354114 |
24db33f3-e21a-46d0-b521-5fe1132afb31 | DigvijayChavan6/GeeksForGeeks | WaveArray.cpp | // Given a sorted array arr[] of distinct integers. Sort the array into a wave-like array(In Place).
// In other words, arrange the elements into a sequence such that arr[1] >= arr[2] <= arr[3] >= arr[4] <= arr[5].....
// If there are multiple solutions, find the lexicographically smallest one.
// Note:The given arra... | ALGO | 0.999995 | 5.352595 |
952ca161-060b-4b76-a310-26a836f7a1e3 | MingzhenY/code-warehouse | CodingWebsites/LeetCode/CPP/Volume2/127.cpp | #include <cstdlib>
#include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <list>
#include <cmath>
#include <queue>
using namespace std;
class Solution {
private:
struct ArcNode{
int to;
ArcNode *next;
ArcNode(... | ALGO | 0.999951 | 4.525903 |
a44a529a-fdfa-413d-bca3-fdd7838e76a4 | JorgeMm3/IR2117---Programaci-n-y-simulaci-n-de-Robots | tb3_ws/src/robot_trajectory/src/wandering.cpp |
#include <chrono>
#include "rclcpp/rclcpp.hpp"
#include "sensor_msgs/msg/laser_scan.hpp"
#include "geometry_msgs/msg/twist.hpp"
using namespace std::chrono_literals;
rclcpp::Publisher<geometry_msgs::msg::Twist>::SharedPtr publisher;
float min_esquerra;
float min_dreta;
bool turn_left = false;
bool turn_... | TOOL | 0.964841 | 4.075363 |
e4952a49-91ba-44b7-b99d-358a0e9635c4 | stdstring/leetcode | Algorithms/Tasks.1001.1500/1432.MaxDiffFromChangingInteger/solution.cpp | #include <algorithm>
#include <vector>
#include "gtest/gtest.h"
namespace
{
class Solution
{
public:
[[nodiscard]] int maxDiff(int num) const
{
const std::vector<int> sourceDigits(getDigits(num));
int maxNumber = num;
size_t firstSmallDigitIndex = 0;
for (; (firstSmallDigitInd... | TEST | 0.996614 | 6.664497 |
fc64f614-9d7b-48d7-a040-75ca7bf9150d | cybergeekgyan/365-Days-of-Learning | Programming Languages/C++/STL/Deque.cpp | //Deque
// faster than vector in terms of insetion and deletion
#include<iostream>
#include<deque>
using namespace std;
int main()
{
// deque<int> dq{32 ,32 , 34 ,1 ,24};
deque<int> dq , dq2;
int n , key;
cin >> n;
for(int i = 0; i< n; i++){
cin>>key;
dq.push_back(key);
//... | ALGO | 0.995857 | 3.884788 |
ad52aa5d-e9c5-46dd-8a8e-e5adfe64de90 | troysung/Xlab-k8s-gpu | Non-iterative-Methods/svd-solver/test.cpp | #define BOUNDS_CHECK
#include <iostream>
#include <iomanip>
#include <svd.h>
using namespace std;
using namespace splab;
typedef double Type;
int main()
{
// Matrix<Type> A(4,4);
// A(1,1) = 16; A(1,2) = 2; A(1,3) = 3; A(1,4) = 13;
// A(2,1) = 5; A(2,2) = 11; A(2,3) = 10; A(2,4) = 8;
// A(3... | ALGO | 0.999372 | 3.965186 |
e3eb55db-9ab3-4e86-9b66-0e94204df5d9 | nuran-nahadi/code | eldorado.cpp | #include <stdio.h>
#include <math.h>
int key, n, x, y;
int array[10000070], smaller[10000070], bigger[10000070];
void sieve()
{
array[0] = 1;
array[1] = 1;
for (int i = 2; i*i <= 10000070; i++)
{
if (!array[i])
for (int j = i * 2; j < 10000070; j += i)
{
a... | ALGO | 0.999937 | 3.066636 |
c37bdd05-0dec-46e6-9740-bb3d08dc4d33 | drunkwater/leetcode | easy/cpp/c0005_20_valid-parentheses/00_leetcode_0005.cpp | // DRUNKWATER TEMPLATE(add description and prototypes)
// Question Title and Description on leetcode.com
// Function Declaration and Function Prototypes on leetcode.com
//20. Valid Parentheses
//Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
//An i... | ALGO | 0.997536 | 5.865827 |
3b9bd969-aa27-4b56-a89e-3cc08acfa580 | rio137/Codeforces_solve | round_835_div4_Atilia's_favorite_problem.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int test,cnt=0,result;
cin>>test;
for(int i=0;i<test;i++)
{
int n;
cin>>n;
char arr[n];
for(int j=0;j<n;j++)
{
cin>>arr[j];
arr[j]=tolower(arr[j]);
if(int(arr[j])>=97 && ... | ALGO | 0.99984 | 3.895407 |
ab9cdd02-4f03-4154-82db-f9fd0d4d459b | ishandutta2007/codeforces | mango_lassi/normal/1733/E.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 120;
ll arr[N][N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int q;
cin >> q;
for (int qi = 0; qi < q; ++qi) {
ll t;
int ty, tx;
cin >> t >> ty >> tx;
t -= ty + tx;
if (t < 0) cout << "NO\n";
else {
... | ALGO | 0.999788 | 4.345164 |
711e4de0-7e04-4053-9119-a73993341c12 | Lizhmq/Introduction2Computing-Hw | 2018年期中考试题/2-phote.cpp | #include <algorithm>
#include <iostream>
#include <functional>
#include <vector>
#include <cmath>
#include <cstdio>
using namespace std;
int main()
{
int n;
int nums[100];
while (cin >> n && n != 0) {
for (int i = 0; i < n; ++i)
cin >> nums[i];
sort(nums, nums + n);
cout << nums[n / 2] << endl;
}
return ... | ALGO | 0.999878 | 4.319627 |
9b131833-f20a-40b6-a808-13f13a808224 | eatingfood142434/USACO-Guide | Silver/Greedy Algorithms with Sorting/USBvsPS2.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int a, b, c, m;
cin >> a >> b >> c >> m;
vector<int> usb, ps2;
string temp;
for (int i = 0, t; i < m; i++) {
cin >> t >> temp;
if (temp == "USB") usb.push_back(t);
... | ALGO | 0.969912 | 3.929458 |
2e254250-c631-48a0-b395-9a4180e21a15 | Deep-023/LeetCode-questions | 2966-divide-array-into-arrays-with-max-difference/2966-divide-array-into-arrays-with-max-difference.cpp | class Solution {
public:
vector<vector<int>> divideArray(vector<int>& nums, int k) {
sort(nums.begin(),nums.end());
vector<vector<int>> ans;
vector<int> temp;
temp.push_back(nums[0]);
temp.push_back(nums[1]);
int n = nums.size();
if(n%3 != 0)... | ALGO | 0.999951 | 5.57324 |
e1618a52-ef13-4305-bb5a-460700d17426 | h-waldschmidt/competitive-programming | leetcode/src/2Sum.cpp | #include <unordered_map>
#include <vector>
using namespace std;
// solution in O(n)
class Solution
{
public:
vector<int> twoSum(vector<int> &nums, int target)
{
vector<int> answer;
unordered_map<int, int> lookUp;
for (int i = 0; i < nums.size(); i++)
{
int comple... | ALGO | 0.99963 | 6.211366 |
4c313d82-ebe0-4b8e-8675-69caea5cfe59 | umaidansari12/CP | 9_maths_and_number_theory/triangular_numbers.cpp | // Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int isTriangular(int N) {
//code here
int sum = 0, i = 1;
while (sum < N) {
sum += i;
i++;
}
r... | ALGO | 0.999778 | 5.438313 |
6259df4d-1388-4f61-997e-221ce6abaf6b | r4pidstart/problems | by_category/sweeping/14595.cpp | // https://www.acmicpc.net/problem/14595
// 2024-03-22 21:36:08
#include"bits/stdc++.h"
using namespace std;
int main(void)
{
int n,m; scanf("%d%d", &n, &m);
vector<pair<int, int> > arr(m);
for(int i=0; i<m; i++)
scanf("%d%d", &arr[i].first, &arr[i].second);
sort(arr.begin(), arr.end());
int ans=n, idx=0;
... | ALGO | 0.999983 | 3.755211 |
943f98f1-c50b-4802-9d0e-6747e4f35109 | Nowshin1077/Competitive_Programming | URI OJ,sem-2/1006-Average 2.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
double A,B,C, MEDIA=0;
cin >> A >> B >> C;
A = A * 2;
B = B * 3;
C = C * 5;
MEDIA = (A + B + C)/ 10; // 2 + 3 + 5
cout << fixed;
cout << setprecision(1)<< "MEDIA = " << MEDIA << endl;
return 0;
} | ALGO | 0.999859 | 4.004241 |
d5a1a7f0-1235-4dd2-8a98-a5bf17111038 | zulpukarov02/step_3 | 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.99887 | 6.783439 |
a040781a-bab3-45d0-b62c-317cdd56f9c3 | opcoinx/OPCoinX | src/opcx-tx.cpp | #include "base58.h"
#include "clientversion.h"
#include "coins.h"
#include "core_io.h"
#include "keystore.h"
#include "primitives/block.h" // for MAX_BLOCK_SIZE
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sign.h"
#include "guiinterface.h" // for _(...)
#include <univalue.h>
#include ... | TOOL | 0.908237 | 5.998035 |
05d0398b-b495-49eb-93a7-9e9bb384b89b | BeaverWIthKnife/CD_Freelance | DC-project2/compressorworker.cpp | #include "CompressorWorker.h"
#include "Compressor.h"
#include <filesystem>
#include <fstream>
#include <atomic>
#include <fstream>
#include <iostream>
#include <thread>
CompressorWorker::CompressorWorker(QString folderPath, bool makeOutput)
: _folderPath(std::move(folderPath)), _makeOutput(makeOutput) {}
size_t ... | TOOL | 0.855452 | 5.819648 |
4dec6501-914b-4efb-b535-0a1e98b25ce0 | ngthanhtrung23/CompetitiveProgramming | leetcode/livestream7/329_longest_increasing_path.cpp | template<typename T>
using Matrix = vector<vector<T>>;
class Solution {
private:
Matrix<int> f;
int nRow, nCol;
public:
int longestIncreasingPath(Matrix<int>& matrix) {
if (matrix.empty()) return 0;
nRow = matrix.size();
nCol = matrix[0].size();
f = Matrix<int> (nRow, vect... | ALGO | 0.999994 | 5.997679 |
9b7f10e4-60e5-4102-967e-4ab71fac8753 | SujayVivek/Ok-lets-CP | CSES/A_Koxia_and_Whiteboards.cpp | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ff first
#define ss second
typedef vector<vector<long long>> vvi;
typedef vector<long long> vi;
#define int long long
#define endl "\n"
void Solve() {
int n, m; cin>>n>>m;
vi a(n,0), b(m,0), d; int S = 0;
for(auto &x: a)cin>>x;
... | ALGO | 0.999963 | 3.730604 |
1943d296-31b5-43fe-94c8-34ff553e56ba | newtonkamimura/pca_2024 | general/merge_sort_enhanced.cpp | /* Universidade de Brasília
* Departamento de Ciência da Computação
* CIC0169 - Programação Competitiva
* Prof. Dr. Vinicius R. P. Borges
*
* Tópico: Divisão e conquista
* Esse código-fonte está associado à implementação do algoritmo de ordenação Merge Sort, com contagem de inversoes.
*
* Compilar no termina... | ALGO | 0.999988 | 4.21488 |
7e2e404f-c5b4-4ba4-abc5-a8d7153ed211 | ishandutta2007/codeforces | neko_nyaaaaaaaaaaaaaaaaa/normal/1218/E.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("unroll-loops")
#define shandom_ruffle(a, b) shuffle(a, b, rng)
#define vi vector<int>
#define vl vector<ll>
#define popcnt __bui... | ALGO | 0.999893 | 4.163559 |
453aaadc-f487-4212-8dff-ee4d348d8368 | Husainbw786/GeeksForGeeks | Easy/Leaders in an array/leaders-in-an-array.cpp | //{ Driver Code Starts
// C++ program to remove recurring digits from
// a given number
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
//Function to find the leaders in the array.
public:
vector<int> leaders(int a[], int n){
// Code here
vector<int>v;
... | ALGO | 0.999937 | 6.032838 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.