uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
6d76d715-9e82-4f62-ab53-2f5e10132643 | savagecarol/c- | div3 739/four.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int a , b , c;
cin >> a >> b >> c ;
if(b<c)
{
cout << -1 <<endl; continue;
}
int val = a*c;
if(val%b==0)
cout << val/b;
else c... | ALGO | 0.999833 | 3.978481 |
0cbc90d0-a1c2-4a50-8fb5-32b59e1599c5 | crystax/android-vendor-boost | libs/numeric/ublas/doc/samples/mapped_vector.cpp | #include <boost/numeric/ublas/vector_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
mapped_vector<double> v (3, 3);
for (unsigned i = 0; i < v.size (); ++ i)
v (i) = i;
std::cout << v << std::endl;
}
| TOOL | 0.911058 | 3.081418 |
262edad6-054b-405f-97e7-9b69c7f54e5f | MamdouhHisham/ICPC-Assiut-University-Training-Juniors-Phase-1-Sheets-2022 | Prefix sum , Frequency Array #1 /M. Nikita and string.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
string s; cin >> s;
vector<int> a(s.size() + 20), b(s.size() + 20);
for (int i = 0; i < s.size(); i++)
{
a[i + 1] = a[i] + (s[i] == 'a');
b[i + 1] = b[i] + (s[i] == 'b');
}
ll mx = 0;
for (int i... | ALGO | 0.999693 | 3.800925 |
8a4c27dc-7298-48d1-be9e-b9730dd7a218 | vishalamin200/Data-Structures-And-Algorithms | 13 Binary Search Tree/7_Validate-BST.cpp | // Check whether the given binary Tree is BST or not
#include<iostream>
#include "myTree.h"
using namespace std;
bool solve(Node* &root, long long int lb , long long int ub){
if(root == NULL) return true;
if(root->data > lb && root->data <ub){
bool leftAns = solve(root->left,lb,root-... | ALGO | 0.999989 | 5.433505 |
7d2cebec-e8f4-460a-84d6-4335627c2ce6 | karan-pawar-09/codeforces | F_Interesting_Function.cpp | /*
author:Karan
created:10.06.2021 20:58:16
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(ar) ar.begin(),ar.end()
#define endl '\n'
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
... | ALGO | 0.998559 | 3.922885 |
31953395-92d7-4d8d-aa12-41f1c15d25ec | ranak8811/Codeforces | SoftDrinking.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n, k, l, c, d, p, nl, np;
cin >> n >> k >> l >> c >> d >> p >> nl >> np;
int drink = k * l;
int tToast = drink / nl;
int tLimes = c * d;
int salt = p / np;
int maximum_toast_possible = min({tToast, tLimes, sal... | ALGO | 0.999 | 3.961561 |
5ccb959d-6111-4cf0-b87d-dc94a8234a73 | NanGong-WenYa/Algorithm_Courses | DataStructure_Course/092601.cpp | #include <iostream>
using namespace std;
//交替融合链表
class Node {
public:
int data;
Node* next;
Node(int val) : data(val), next(nullptr) {}
Node():data(-1),next(nullptr){}
};
Node* melt(Node* head1, Node* head2) {
if (!head1) return head2;
if (!head2) return head1;
Node* mergedHead = head1... | ALGO | 0.999882 | 3.962368 |
5ed8dfe6-1832-4b4b-b067-970448b85f04 | MeeLn/C-Programming | Lab Assignment 1_Cprogram/program to calculate the mass of air in automobile fire.cpp | /* Name: Milan Raut
Roll no.: 201420
Faculty:BEIT(morning)
*/
#include<stdio.h>
#include<conio.h>
int main()
{
float P,T,V,m;
printf("Enter the value of pressure, temperature and volume :");
scanf("%f %f %f",&P,&T,&V);
m=(P*V)/(0.37*(T+460));
printf("The mass of air is: %f",m);
getch();
... | ALGO | 0.989394 | 3.342529 |
ffe106eb-0da6-4f52-8779-0ddb0b8ea3c9 | IsaacAU/knowledge | Expression-Evaluation/ExprEval.cpp | #include "ExprEval.h"
#include <iostream>
void ExprEval::setName(const string &name, double x){
table[name]=x;
}
double ExprEval::getName(const string &name) const{
auto it=table.find(name);
if(it!=table.end())
return it->second;
else
cerr<<name<<" doesn't exist!"<<endl;
return 0;
... | TOOL | 0.996033 | 4.091887 |
5fe87bf1-b01a-43c2-a161-313d69c7714b | gabriel-candeia/Competitive-Programming-Solutions | Codeforces/Round #665 (Div. 2)/C.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t, n;
cin >> t;
while(t--){
cin >> n;
vector<int> arr(n,0), cpy(n,0);
int mn = 1e9;
for(int i=0;i<n;i++){
cin >> arr[i];
cpy[i] = arr[i];
mn = min(arr[i],mn);
}
... | ALGO | 0.999622 | 4.018901 |
733b886e-9f73-4927-ab5a-55d62a176032 | Mritunjay4442/Cpp | butterflypattern.cpp | #include<iostream>
using namespace std;
int main (){
int n;
cin>>n;
for (int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
cout<<"*";
}
int space= 2*n - 2*i;
for(int j=1;j<=space;j++){
cout<<" ";
}
for(int j=1;j<=i;j++){
co... | ALGO | 0.999967 | 3.696067 |
6e55d431-0b3c-4256-8b34-65c12c9e2efb | ishandutta2007/codeforces | dmitrygrigorev/normal/1142/B.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
vector<vector<int> > data;
vector<int> tet;
int n, m, q;
vector<bool> used;
void dfs(int vertex, deque<int> &d){
used[vertex] = true;
d.push_back(vertex);
int T = -1;
if (d.size() > n){
T = d.front();
d.pop_front();
... | ALGO | 0.999974 | 4.10095 |
e074d162-996f-4637-ab6d-22ecd8a61d35 | rizkiramadhana1/OSP2020 | lampuHias.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
int N;
cin >> N;
string S;
cin >> S;
vector <int> W (26,0);
for(int i = 0; i < S.length(); i++){
W[ S[i] -'A' ]++;
}
sort(W.begin(), W.end(), greater<int>() );
int a = W[0], b = W[1], c = W[2];
int hasil;
i... | ALGO | 0.999952 | 3.665323 |
eebd1ffa-217a-40d7-8ec6-9dbcb2740452 | raincross7/code-similarity | codes/train_code/problem343/problem343_105.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
int a,b,c;
cin>>a>>b>>c;
if(pow(a,2)+pow(b,2)==pow(c,2)){
cout<<"YES"<<endl;
}else if(pow(b,2)+pow(c,2)==pow(a,2)){
cout<<"YES"<<endl;
}else if(pow(a,2)+pow(c,2)==pow(b,2)){
cout<<"YES"<<endl... | ALGO | 0.999869 | 4.058203 |
e366615e-e2bf-431c-97c3-ae79d40985c2 | BrandonDu/Secret-Hitler-AI | src/Search.cpp | #include "Search.hpp"
#include "ProgressBar.hpp"
namespace secret_hitler
{
void initBeliefs(const GameState &gs, BeliefState &bs, int me)
{
auto roles = gs.getRoles();
Role myRole = roles[me];
double totalWeight = 0.0;
for (int k = 0; k < (int)BeliefState::assignments.size(); ++k)
{
const auto &A = Bel... | ALGO | 0.999571 | 4.465372 |
4d0ba984-7c88-4a22-bcc8-6c69e14df806 | hauvietnam/TH-KyThuatLapTrinh | BaiThucHanhSo2/bai13.cpp | // Nguyen Huu Hau 20215573
#include <iostream>
using namespace std;
struct bigNum
{
char sign;
char num[101];
};
// Hàm nhập và tiền xử lý dữ liệu
void input(bigNum &num1, bigNum &num2)
{
string tmp;
cin >> tmp;
num1.sign = tmp[0];
int lens1 = tmp.length() - 1;
for (int i = 0; i < lens1; i... | ALGO | 0.999952 | 4.277157 |
5abeea13-892a-4c6f-a397-832f1e7f93ae | BOLTB0X/DataStructure-Algorithm | Algorithm/MST/BOJ_1647.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int N, M;
vector<pair<int, pair<int,int>>> edges;
vector<int> parents;
void input(void) {
cin >> N >> M;
for (int i = 0; i < M; ++i) {
int a, b, c;
cin >> a >> b >> c;
edges.push_back({c, {a, b}});
}
... | ALGO | 0.999938 | 4.818104 |
1b433013-2e5b-417b-829f-34a6dbab6a26 | Fisher87/leetcode | cplus/word-abbreviation.cpp | // Time: O(n * l) ~ O(n^2 * l^2)
// Space: O(n * l)
class Solution {
public:
vector<string> wordsAbbreviation(vector<string>& dict) {
unordered_map<string, unordered_set<string>> abbr_to_word;
unordered_map<string, string> word_to_abbr;
for (const auto& word : dict) {
const au... | ALGO | 0.999705 | 6.795095 |
487a44f6-478a-4014-845e-281e2cf4c136 | Paras-Pandey/Competitive-Programming | cp/Separate_Them_All.cpp | #include "bits/stdc++.h"
using namespace std;
#define go(i, s, n) for (int i = s; i < n; i++)
#define rgo(i, s, n) for (int i = s; i >= n; i--)
#define getstr getline(cin, str)
#define vi vector<int>
#define vs vector<string>
#define pii pair<int, int>
#define mii map<int, int>
#define pb push_back
#define all(x) (x).... | ALGO | 0.999714 | 4.684903 |
84542471-7cb5-4bed-82c8-cacf175f6106 | Gyanthakur/GFG_POTD | october_2024/potd_06_10_2024.cpp | /*
GFG POTD 6 Oct 2024
Problem Descrption:
Given a grid of size n*m (n is the number of rows and m is the number of columns in the grid)
consisting of '0's (Water) and '1's(Land). Find the number of islands.
Note: An island is either surrounded by water or the boundary of a grid and is formed by
connecting adjacen... | ALGO | 0.99997 | 6.709696 |
8e313df7-3e38-445f-b624-8cba838f7b05 | Seddvwy/Celebrity-Image-Classification | opencv-master/modules/core/src/conjugate_gradient.cpp | #include "precomp.hpp"
#define dprintf(x)
#define print_matrix(x)
namespace cv
{
double MinProblemSolver::Function::getGradientEps() const { return 1e-3; }
void MinProblemSolver::Function::getGradient(const double* x, double* grad)
{
double eps = getGradientEps();
int i, n = getDims();
... | ALGO | 0.999992 | 6.233156 |
c46115bc-d5fe-4a00-aa73-8d05a654f604 | manishtomarr1/Data-Structures-and-Algorithms | linked_list/create_linked_list_insert_at_last/create_linked_list_insert_at_last.cpp | #include<iostream>
using namespace std;
class node {
public :
int data;
node* next;
};
node* head = nullptr;
node* last = nullptr;
void insertlast(int val) {
node* temp = new node;
temp->data = val;
temp->next = nullptr;
if (head == nullptr) { // jb linkedlist khaali ho.
head = temp; // head or last t... | ALGO | 0.998976 | 4.056479 |
3ccdadc3-ae55-405b-bb0d-80e9ee39fef6 | shresth87/DSA-by-c- | vector/rearrange string.cpp | #include<iostream>
#include<string>
using namespace std;
string rearrangeString(string s){
// freq count karo
int count[26]={0};
int n=s.length();
for (char ch : s) {
count[ch - 'a']++;
}
// max freq nikalo
int maxi=0;
int mostfreq=0;
for(int i=0;i<26;i++)... | ALGO | 0.999954 | 5.656443 |
4b173957-99e2-40bc-bdef-ddeb8c061485 | okcar-os/android_bootable_recovery | volume_manager/Utils.cpp | #include "Utils.h"
#include <volume_manager/VolumeManager.h>
#include "Process.h"
#include "sehandle.h"
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <cutils/fs.h>
#include <private/android_filesystem_config.h>
#i... | TOOL | 0.955638 | 7.494914 |
6d6bd55d-139a-450d-8d98-1953eb39df65 | yerlandana/my_c_solutions | contest_2/a.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int a;cin>>a;
int b[a];
for(int i = 0; i<a; i++)cin>>b[i];
int u = b[0];
int k = b[0];
for(int i = 1; i < a; i++){
if(b[i] > u){
u = b[i]; //min
}
}
for(int i = 1; i < a; i++){
... | ALGO | 0.999758 | 3.606736 |
3c0abbf3-83ad-42fd-9105-05197ceb1b73 | lawtonsclass/s25-code-from-class | csci40-in-person/lec06/guess.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
srand(time(0)); // seed the random # gen
int n = rand() % 100 + 1;
int guess = -1;
while (guess != n) {
// ask the user for a guess and see if it was correct
cout << "Enter your guess: ";
cin >> guess;
... | TOOL | 0.934147 | 4.342012 |
d2e51479-9655-401e-aab7-3b567a8f7a05 | UsefHussein/CP | Gym/104882K/55662258_AC_77ms_100kB.cpp | #include <bits/stdc++.h>
using namespace std;
#define enl '\n'
#define ll long long
void $olve()
{
int n,k;
cin>>n>>k;
vector<int>ans(26);
string s;
cin>>s;
for(int i=0;i<k;i++)ans[s[i]-'a']++;
vector<int>mn=ans;
int l=0,r=k;
while(r<n)
{
mn[s[r++]-'a']++;
mn[s[l... | ALGO | 0.999993 | 4.031992 |
8f316a1c-4513-4b27-8ad6-493b327900fb | rahuljindal1803/DSA-Practice-Question | BST/BST.cpp | #include <iostream>
#include <bits/stdc++.h>
#include "BinarySearchTree.h"
#include "NODE.cpp"
using namespace std;
BinaryTreeNode<int> *takeInput()
{
int rootData;
cin >> rootData;
if (rootData == -1)
{
return NULL;
}
BinaryTreeNode<int> *root = new BinaryTreeNode<int>(rootData);
... | ALGO | 0.999954 | 4.503652 |
59117664-af62-4052-a54a-3a0341d5117b | dtjldamien/StartIoT | src/LiteOS_Lab/iot_link/upgrade_patch/HDiffPatch/hdiffz.cpp | //hdiffz.cpp
// diff tool
//
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm> //find search
#include "libHDiffPatch/HDiff/diff.h"
#include "libHDiffPatch/HPatch/patch.h"
#include "_clock_for_demo.h"
#include "_at... | TOOL | 0.896231 | 4.050307 |
fe557fe0-050f-493e-abfb-7b5cd26d4a3e | Yawn-Sean/Daily_CF_Problems | daily_problems/2025/06/0610/personal_submission/cf251b_yawn_sean.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3,Ofast,unroll-loops")
// #include "atcoder/all"
using namespace std;
auto rng = mt19937(random_device()());
auto rngl = mt19937_64(random_device()());
// Let's set a bit and flow!
// I came, I divided, I conquered!
// using namespace __gnu_cxx;
// using namespace __gnu... | ALGO | 0.999999 | 4.421193 |
2e112f0a-68ad-4a1a-9e83-3fa4cae0922a | NegiBaba/CodeChef_ | April CookOff 2021 div3/passing_marks.cpp | #include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define PI 3.141
#define MOD 1000000007
typedef long long int lli;
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
... | ALGO | 0.999205 | 3.834641 |
cf398069-5228-4e28-972e-d822b4897f29 | Cassel-College/fast_pipeline_ui | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
c418f51a-dc17-4063-8946-e56d326e2721 | yongyucode/imx6-dual-core-frameworks | base/libs/utils/StringArray.cpp | //
// Sortable array of strings. STL-ish, but STL-free.
//
#include <stdlib.h>
#include <string.h>
#include <utils/StringArray.h>
namespace android {
//
// An expanding array of strings. Add, get, sort, delete.
//
StringArray::StringArray()
: mMax(0), mCurrent(0), mArray(NULL)
{
}
StringArray:: ~StringArra... | TOOL | 0.976988 | 6.106208 |
0702dd70-93d4-43fc-b651-59bcf8ed12db | advayaggarwal/Data-Structures-Algorithms | Game Theory/alice_and_bob_silly_game.cpp | /*
AUTHOR: ADVAY AGGARWAL
*/
/* Impatient with actions, patient with results. */
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007 //1e9+7 ans%mod
#define int long long int
#define vi vector<int>
#define vvi vector<vi>
#define setbits(x) __builtin_popcountll(x)
#define endl "\n"
#define pi... | ALGO | 0.999946 | 4.91178 |
41aeaca0-87f4-4996-8343-39bc10a4c782 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12311_13.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll t;
t = 1;
cin >> t;
while (t--) {
ll a, b, c;
cin >> a >> b >> c;
if (a >= c)
cout << "-1 ";
else
cout << "1 ";
if (c >= a * b)
c... | ALGO | 0.999757 | 4.023759 |
3a11261d-c900-48f6-9da0-b623fcf11067 | denis-gubar/Leetcode | Binary Search/1201. Ugly Number III.cpp | class Solution {
public:
int nthUglyNumber(int N, int a, int b, int c) {
if (a == 1 || b == 1 || c == 1)
return N;
auto calc = [A = 1LL * a, B = 1LL * b, C = 1LL * c](long long m) -> long long
{
return m / A + m / B + m / C - m / lcm(A, B) - m / lcm(B, C) - m ... | ALGO | 0.999943 | 5.898231 |
7e87f937-8b89-4cf3-90f2-efe2cd1243a1 | anus05/Snow_Hub | strong number.cpp | //strong of a number
#include<iostream>
using namespace std;
int main(){
int n,fact,rem,temp;
int sum=0;
cout<<"Enter a number:";
cin>>n;
temp=n;
while(n){
int i=1;
fact=1;
rem=n%10;
while(i<=rem){
fact=fact*i;
i++;
}
sum+=fact;
n=n/10;
}
if (sum==temp){
cout<<temp<<"is a strong number";
}
e... | ALGO | 0.999933 | 3.669076 |
97cd80fa-0e4b-46a9-9540-aa88bf447108 | efrenaguilar95/Connect_K_AI | GameTree/main.cpp | #include "gametree.h"
#include <iostream>
void print_board(int** board, int colCount, int rowCount)
{
int row = rowCount-1;
while(row >= 0)
{
for(int col = 0; col<colCount; col++)
{
std::cout<<board[col][row];
}
std::cout<<std::endl;
row -= 1;
}
}
int check_winner(int ** gameState, int numCols, int n... | ALGO | 0.923878 | 3.885062 |
747c242e-d887-4b93-8765-308d5fe011ec | ishandutta2007/codeforces | yancouto/normal/666/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
const ll modn = 1000000007;
inline ll mod(ll x) { return x % modn; }
#ifdef ONLINEJUDGE
# define LLD "%I64d"
# define debug(...) fprin... | ALGO | 0.999852 | 4.077742 |
a3558d63-fc0d-4145-8275-7afd83344983 | hma40/Cpp-Competitive-Programming | Codeforces/1954/E.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define add push_back
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define f first
#define s second
#define trav(a,x) for (auto& a: x)
... | ALGO | 0.999952 | 3.660187 |
0481e6cf-af77-4b8f-bd4d-508fe65ac2bb | robyang1/cp | closinggold.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 69;
using ll = long long;
using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
using p... | ALGO | 0.999944 | 4.171345 |
7f122dac-c07c-412f-bb54-ef6932e796b9 | viviayi/ThinkingInCPP_1 | C12/IntegerTest.cpp | #include "Integer.h"
#include <fstream>
using namespace std;
ofstream out("IntegerTest.out");
void h(Integer& c1, Integer& c2){
// A complex expression:
c1 += c1 * c2 + c2 % c1;
#define TRY(OP) \
out << "c1 = "; c1.print(out); \
out << ", c2 = "; c2.print(out); \
out << "; c1 " #OP ... | ALGO | 0.943078 | 3.976633 |
b297a01c-a747-4f29-bd3f-eac4e25ffa4b | ZakariaeMoutaouakil/Optimization-based-frequentist-confidence-intervals-for-functionals-cpp | main.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include <fstream>
#include "distribution/final_filter/final_filter.h"
#include "distribution/find_closest_indices/find_closest_indices.h"
#include "distribution/quantile_1_minus_alpha/quantile_1_minus_alpha.h"
#include "distribution/bin_second_largest_values/bin... | ALGO | 0.99988 | 7.16086 |
fe1609d7-c947-452d-b13b-1776e13b28d4 | Ghada-Emad1/Problem_Solving | NeetCode/C++/stack/0739. Daily Temperatures.cpp | class Solution {
public:
vector<int> dailyTemperatures(vector<int>& temp) {
vector<int>ans(temp.size(),0);
stack<int>stk;
for(int i=0;i<temp.size();++i){
while(!stk.empty()&&temp[stk.top()]<temp[i]){
const int prev=stk.top();
stk.pop();
ans[prev]=i-p... | ALGO | 0.999933 | 6.048392 |
5a955ac4-3505-42f6-869b-c394b62fa356 | raincross7/code-similarity | codes/train_code/problem220/problem220_413.cpp | /*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#inclu... | ALGO | 0.999955 | 3.395831 |
acf85894-4b19-46c6-b5a0-4b3682922c2f | huythedev/Code_archive | SUMMER_CAMP/MTTN_2025/2025-07-05/SMEX2.cpp | // Author: huythedev
// Problem Link:
#include <bits/stdc++.h>
using namespace std;
#define NAME "SMEX2"
#define ln "\n"
#define sz size()
typedef long long ll;
typedef long double ld;
void fastio() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
void docfile() {
if (ifstream(N... | ALGO | 0.999988 | 4.313632 |
7aff60f2-a7a9-471c-873c-501195a71dad | ridhu-web/LeetCode | target-sum/Accepted/11-22-2022, 11_49_19 PM/Solution.cpp | // https://leetcode.com/problems/target-sum
class Solution {
public:
int findTargetSumWays(vector<int>& nums, int target) {
int total = 0;
for(int x: nums)
total += x;
if (abs(target) > total || (total + target) % 2 != 0){
return 0;
}
int avg = (tota... | ALGO | 0.999994 | 6.131738 |
507f182a-b49e-4c8e-8c05-fada279aaeb2 | somesh018/DSA | fibonacci.cpp | #include<iostream>
using namespace std;
int fibo(int n){
int a=0;
int b=1;
int
int c;
for (int j=2; j<=n; j++){
c=a+b;
a=b;
b=c;
}
return c;
}
int main(){
int n ;
cin>>n;
int ans = fibo(n);
cout<<ans<<endl;
}
| ALGO | 0.999983 | 4.483498 |
49554bd7-3d76-4e99-a5b7-2b889221f7b7 | solARisOP/Data-Structures-and-Algorithms | DSA_problems/95_147_add_1_to_linked_list.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *next;
};
Node *addOne(Node *head)
{
Node *prev = NULL;
Node *c = head;
Node *trial = head;
int cnt = 0;
while (trial != NULL)
{
cnt++;
trial = trial->next;
}
if (cnt ... | ALGO | 0.999495 | 4.839374 |
b72f6658-502d-4877-8a43-58c29c669bbc | Nimish-Dureja-10/DSA | LinkedList/backtracking/ratInAMaze.cpp | // Rat in a maze problem using backtracking.
#include <iostream>
#include <vector>
using namespace std;
bool canWeGo(int a,int b,vector<vector<int> > &grid) {
return (a < grid.size() && b < grid.size() && a >= 0 && b >= 0) && grid[a][b] == 1;
}
int f(int i,int j,vector<vector<int> > grid) {
int n = grid.size(... | ALGO | 0.999834 | 5.262512 |
57851743-1a3d-4295-94c0-a8191e1e32b9 | cagastian/MPSCode | libs/boost_1_88_0/libs/graph/test/transitive_closure_test2.cpp | using namespace std;
using namespace boost;
typedef adjacency_list<> graph_t;
int main(int argc, char* argv[])
{
graph_t g(5), g_TC;
add_edge(0, 2, g);
add_edge(1, 0, g);
add_edge(1, 2, g);
add_edge(1, 4, g);
add_edge(3, 0, g);
add_edge(3, 2, g);
add_edge(4, 2, g);
add_edge(4, 3, ... | ALGO | 0.993951 | 5.448232 |
f62efb2a-dfc5-423a-86b4-1edf190e7e3f | anonymous-secure-marl/PrivacyPreservingSupplyGame | EzPC/SCI/extern/eigen/doc/special_examples/Tutorial_sparse_example.cpp | #include <Eigen/Sparse>
#include <vector>
#include <iostream>
typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double
typedef Eigen::Triplet<double> T;
void buildProblem(std::vector<T>& coefficients, Eigen::VectorXd& b, int n);
void saveAsBitmap(const Eigen::VectorXd& x, int... | ALGO | 0.997266 | 5.514443 |
3f9f56f6-7f4b-4061-8866-3866b74385c5 | GedeonTS/flutterstore | 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.998784 | 6.761023 |
7ad4c3b1-7cb3-4da4-a486-ea784069efff | raincross7/code-similarity | codes/train_code/problem252/problem252_402.cpp | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using pll = pair<long long, long long>;
const long long INF = 1<<29;
const int MOD = 1000000007;
long long ruizyou(long long m,long long n){
if(m == 0)return 0;
if(m == 1)return 1;
long long ans = 1;
long long tmp = m;
for(int i=0;i<=30... | ALGO | 0.999826 | 3.427414 |
53cbaf92-039d-43d1-9acd-030aab279dcd | skystone1000/Coding-Problems | Hacker Earth/Code Monk/02 Arrays & Strings/02 Monk Teaches Palindrome.cpp | // 02 Monk Teaches Palindrome
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int testCases;
cin>>testCases;
for(int t=0;t<testCases;t++){
string a;
cin>>a;
int len = a.length();
string a... | ALGO | 0.998718 | 5.168132 |
2f2b544d-015f-44d6-901f-98afefe2e748 | babayaga-13/Competitive-Programming | CODEFORCES/div.3/D_Divisible_Pairs.cpp | #include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define ln cout << endl
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define count_one(x) __builtin_popcount(x)
#define trailing_zero(x) __builtin_ctz(x)
#define le... | ALGO | 0.999785 | 3.948954 |
00fe7c50-f02e-4b17-a136-dc542b69ee95 | pratikraj108/PROGRAMS | C++Lab/LAB5/check.cpp | // To compute transpose of a martix using matrix class.
#include <iostream>
using namespace std;
class matrix
{
int r, c;
int **mat;
public:
void allocate();
void input();
void output();
void deallocation();
void trans(matrix m1);
};
void matrix::allocate()
{
mat = new int *[r];
fo... | ALGO | 0.999429 | 4.547743 |
ff542854-9edf-4bfd-b339-46f11d8776a2 | RojasVSantiago/CMasMas | cap 5/Punto 1.cpp | #include <iostream>
using namespace std;
int main(){
bool p, q, r ;
cout<<"introducir un valor de 0 o 1 para p: "; cin>>p;
cout<<"introducir un valor de 0 o 1 para q: "; cin>>q;
cout<<"introducir un valor de 0 o 1 para r: "; cin>>r;
if(p==1&&q==1&&r==1){
cout<<"El valor de verdad para la expresion p||q&&... | ALGO | 0.999535 | 3.362127 |
1b39afe5-ec8e-4efd-8ce4-334b7006cd18 | Nihil8492/CIS17ACopy | Book/Midterm/RomanNumeralConversionToArabic/main.cpp | /*
* File: main.cpp
* Author: Dr. Mark E. Lehr
* Purpose: Arabic Number to Roman Numerals
*/
//System Libraries
#include <iostream>
using namespace std;
//User Libraries
//Global Constants - No Global Variables
//Only Universal Constants, Math, Physics, Conversions, Higher Dimensions
//Function Prototypes
... | ALGO | 0.995209 | 4.074514 |
fe2274b8-d969-469d-9187-925eb12d24de | MAXFAD04/pks1 | 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 |
8674d9f7-679a-4985-a8e5-b61bd7295d51 | raoprer/cpp-programs | LLDoubleImplementation.cpp | #include<iostream>
using namespace std;
class dnode
{
int info;
dnode* next;
dnode* prev;
public:
void insertBeg();
void insertEnd();
void insertPos();
void deleteBeg();
void deleteEnd();
void deleteData();
void printA();
void printD();
}*head;
void dnode::insertBeg()
{
... | ALGO | 0.965499 | 3.620549 |
e34ab4b6-3206-4e14-9121-2a2633de4ffe | by-Bajrang/DSA-in-Cpp | Arayy/cheqForshoting/findnoappar.cpp | #include<bits/stdc++.h>
using namespace std;
int main ()
{
int arr[]={1,1,2,3,3,4,4};
int n=7;
map<int,int>mpp;
for(int i=0;i<n;i++)
{
mpp[arr[i]]++;
}
for(auto it:mpp)
{
if(it.second==1)
{
cout<<it.first;
}
}
return 0;
} | ALGO | 0.999914 | 3.6212 |
716dd75a-ba07-4e92-add0-b5e568d84325 | AsifWatson/codeforces | B/1277B.cpp | /*****************************************************************|
| /\ _______ ________ _________ |
| / \ /------ \ |___ ___| | _______| |
| / /\ \ || || | | |
| / / \ \ ||______ || | |... | ALGO | 0.999639 | 4.599715 |
5213a608-ad83-4f89-8aca-c9abd7feec24 | MuhammadUmerHussain/DSA | zohabst2.cpp | #include<iostream>
using namespace std;
#include<queue>
class node
{
public:
int data;
node *left;
node *right;
node()
{
data=0;
left=NULL;
right=NULL;
}
node(int x)
{
data=x;
left=NULL;
right=NULL;
}
};
void search(node *root,int d)
{
cout<<root->data<<" ";
if(root==NULL)
{
... | ALGO | 0.999823 | 3.901815 |
f703ec48-f3d1-40d4-9964-a05d47a3dbd9 | ishandutta2007/codeforces | bigbag/normal/1178/G.cpp | #include <bits/stdc++.h>
using namespace std;
const int max_n = 200222;
const long long inf = 2000111222000111222LL;
struct line {
int k;
long long b;
line() {
}
line(int k, long long b): k(k), b(b) {
}
long long get(int x) const {
return 1LL * k * x + b;
}
bool operat... | ALGO | 0.999932 | 4.147114 |
d36517bf-163a-4754-bdb5-823dc74ffe28 | bzz13/timus | 1079/1079.cpp | #include <iostream>
#include <cmath>
using namespace std;
const int count = 100000;
int NS[count];
int mNS[count];
int a(int i)
{
if (i < 2)
return i;
if (i % 2 == 0)
return NS[i/2];
else
return NS[i/2] + NS[i/2 + 1];
}
int ma(int i)
{
if (i < 2)
return i;
else
return max(mNS[i-1], NS[i]);
}
int main(... | ALGO | 0.999894 | 3.622311 |
6d08e62f-985c-4a00-afc1-ac488e7383e5 | andreaswanninger/conservative_levelset-contact_line-curvature | kratos/tests/cpp_tests/spaces/test_kratos_space.cpp | // System includes
// External includes
// Project includes
#include "includes/define.h"
#include "testing/testing.h"
#include "spaces/kratos_space.h"
namespace Kratos {
namespace Testing {
namespace SparseSpaceTestingInternals {
typedef std::size_t IndexType;
typedef KratosSpace<double, CsrMatrix<double,In... | TEST | 0.940759 | 6.996966 |
bb4414c7-1c6f-4076-b317-df0d1cd77d9a | Ashis1811/LeetCode | 2220-find-all-possible-recipes-from-given-supplies/2220-find-all-possible-recipes-from-given-supplies.cpp | class Solution {
public:
vector<string> findAllRecipes(vector<string>& recipes, vector<vector<string>>& ingredients, vector<string>& supplies) {
unordered_map<string, vector<string>> graph;
unordered_map<string, int> indegree;
for(int i = 0; i < recipes.size(); i++)
{
for... | ALGO | 0.999945 | 5.615949 |
233f1a99-510e-486e-a63d-4953040b85cb | Sunidhi-Tiwari/Leetcode | 1049-last-stone-weight-ii/1049-last-stone-weight-ii.cpp | class Solution {
public:
int lastStoneWeightII(vector<int>& A) {
unordered_set<int> s1 = { 0 };
for (auto i : A) {
unordered_set<int> s2;
for (auto j : s1)
s2.insert({ j - i, j + i });
swap(s1, s2);
}
return abs(*min_element(begin(s1), end(s1), [](int i, int j) { return abs(i) <... | ALGO | 0.999834 | 5.713032 |
9eea396b-4a90-4fa5-8709-ce6aa8920f45 | srk008/COnstructor-Question | Smallest_missing_element_array.cpp | #include<iostream>
using namespace std;
#include<stdlib.h>
class Smallest_Missing
{
int *ptr,len;
public:
void setData(int *a,int size)
{
ptr=a;
len=size;
}
void performoperation()
{
for(int i=0;i<len;i++)
{
for(int j=i+1;j<len;j++)
{
if(ptr[i]>ptr[j])
{
int temp=ptr[i];
... | ALGO | 0.999668 | 3.026296 |
17177c35-3a20-4b43-a8dc-dab92d8078a1 | vansh-codes/Complete-Interview-Preparation-GFG | 4_Data-Structures-(Advanced)/17_Greedy/Problems/6_JobSequencingProblem.cpp | /*
struct Job
{
int id; // Job Id
int dead; // Deadline of job
int profit; // Profit if job is over before or on deadline
};
*/
class Solution
{
private :
static bool cmp(Job a, Job b){
return (a.profit > b.profit);
}
public:
//Function to find the maximum profit an... | ALGO | 0.999824 | 6.005114 |
928e6109-7348-4735-8056-fee57dc74614 | shivsingh98/180-HARD | Day 3/Home_Work/Question_2.cpp | // Two numbers are given a and b, print a-b
#include<iostream>
using namespace std;
int main(){
int a=5, b=8;
cout<<"a - b = "<<a-b<<endl;
return 0;
} | ALGO | 0.99949 | 3.162053 |
0e078dca-bb1d-4657-9872-2442d074a436 | belsanku/OS | lab9/PetersonLec.cpp | #include <windows.h>
#include <stdio.h>
#include <process.h>
bool flag[3];
int turn = 0;
int sh = 0;
void EnterCriticalRegion(int threadId)
{
flag[threadId] = true; // Флаг текущего потока
turn = 1 - threadId; // Флаг очереди исполнения
while (turn == 1 - threadId && flag[1 - threadId])
;
}
void... | ALGO | 0.998249 | 3.308594 |
66cf1085-3080-429f-91f7-d1d9a2e8ef60 | c3016229/ddpg-quant | src/gbm.cpp | #include <cstdlib>
#include <vector>
#include <random>
#include <cmath>
#include "../lib/gbm.hpp"
double mean(std::vector<double> &dat) {
double sum = 0.00;
for(double &x: dat)
sum += x;
return sum / dat.size();
}
double stdev(std::vector<double> &dat) {
double mu = mean(dat);
double rss ... | ALGO | 0.99855 | 5.283128 |
3ef6246e-71f7-4a60-92a4-5dd2b809921c | thgus/Algorithm | cpp/etc/7576.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
int dx[] = { 1,-1,0,0 };
int dy[] = { 0,0,1,-1 };
int box[1000][1000];
int check[1000][1000] = { 0 };
int N, M;
int MAX() {
int maxnum = -1;
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
if (box[j][i] =... | ALGO | 0.99995 | 4.090876 |
a6d3f62c-193d-4537-8807-1576d7d63d28 | miejejaw/competitive-programming | codeforces-solutions/B_Chip_and_Ribbon.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
ll N, prev = 0, ans = 0;
cin >> N;
while (N--){
int num;
cin >> num;
ans += (num-prev > 0)? num-prev : 0;
prev = num;
}
cout << ans-1 << endl;
}
int main(){
ios::sync_with_stdi... | ALGO | 0.9994 | 4.097054 |
09169a3a-cd15-4f4b-9ae7-36ccb2649782 | ishandutta2007/codeforces | tempura0224/normal/919/C.cpp | #include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef pair<long long,long long> pll;
typedef long long ll;
const int inf = 1<<30-1;... | ALGO | 0.999895 | 3.427916 |
abd359f8-4fab-4ba9-ace3-79f8764674fb | Sebastar637/Tarea3 | hashing.cpp | #include <iostream>
#include <string>
#define CO_PRIME 127
using namespace std;
struct Palabra
{
string termino = "";
string significado = "";
int consultas = 0;
};
class CacheDiccionario
{
private:
int total, conocidos, desconocidos, accesses;
int hits, misses, cleanups, inserciones;
Palabr... | TOOL | 0.974272 | 4.566185 |
ae0666aa-e0c0-4573-a885-47dd46137c89 | salihgueler/hamilton_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998693 | 6.797273 |
f57b3ced-c616-4d68-a31b-d0e14828462e | rladmschd235/codetree-TILs | 240205/9-1 정사각형/9-1-square.cpp | #include <iostream>
using namespace std;
int main() {
int n, cnt = 10;
cin >> n;
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
--cnt;
cout << cnt;
if(cnt == 1)
{
cnt = 10;
}
}
cout <... | ALGO | 0.999513 | 3.691899 |
dad7fcb8-7cfe-4f5f-a34f-30de83651d91 | AlaminPu1007/leet-code | Leet-Code/565. Minimum Deletions to Make String Balanced/1653_Minimum_Deletions_to_Make_String_Balanced_optimal_solution.cpp | /*
The appraoch behind of this soltuion is, we will treat any character as a middle, then we will count how many 'b' on it's left portion
and how many are left 'a' on it right protion.
Now optimize the approach, we will take a extra precount approach, that will tell us from current item (treat as a middle),
how... | ALGO | 0.999973 | 5.621621 |
c7e5ddca-3078-4091-82c0-c89cc6c62198 | Sanketkatkade/LeetCode | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tag-stylebackground-color-rgba0-10-32-005-darkreader-inline-bgcolor-rgba0-8-26-005-data-darkreader-inline-bgcolordivvirtu-financial-divdiv-classcompanytagscontainer-tago... | class Solution {
public:
int countHomogenous(string s) {
int left = 0;
long long res = 0;
for(int right = 0; right < s.length(); right++){
if(s[left] == s[right]){
res += right - left + 1;
}
else{
res += 1;
l... | ALGO | 0.999942 | 6.005508 |
91cf4dd7-1ff8-49da-b080-33ecc1ec589f | waseemnabi08/FOP-Lab-CEME-NUST- | FOP_Lab/quiz3.cpp | #include<iostream>
using namespace std;
void sum(int &, int &, int &, int &);
int main()
{
int a = 3;
int b = 5;
int s = 0;
int d;
sum(a, b, s, d);
cout << s << endl;
cout << d << endl;
}
void sum(int &a, int &b, int &c, int &d)
{
c = a + b;
d = a - b;
} | ALGO | 0.999239 | 3.997689 |
014a4718-df04-4afa-8842-e823cc5427aa | XRFoundation/three-physx | physx-js/PhysX/physx/samples/samplenorthpole/SampleNorthPoleBuilder.cpp | #include "PxPhysicsAPI.h"
#include "PxTkStream.h"
#include "SampleNorthPole.h"
using namespace PxToolkit;
#define USE_MESH_LANDSCAPE // PT: define this to use a triangle mesh for the landscape, instead of a heightfield
static PxReal randomScaled(PxReal value)
{
PxReal val = value*(getSampleRandom().randomFloat());
... | ALGO | 0.867788 | 4.997599 |
3b5326ff-45a2-44c4-8c46-10119dadf5dc | sandeshkhadase/Leetcode-Solutions | Leetcode Solutions/solution/0700-0799/0789.Escape The Ghosts/Solution.cpp | class Solution {
public:
bool escapeGhosts(vector<vector<int>>& ghosts, vector<int>& target) {
int tx = target[0], ty = target[1];
for (auto& g : ghosts) {
int x = g[0], y = g[1];
if (abs(tx - x) + abs(ty - y) <= abs(tx) + abs(ty)) {
return false;
... | ALGO | 0.999843 | 6.192601 |
60b1598e-aad2-4a9a-8afe-35f9009220f0 | praditus343/Struktur_Data | Pertemuan6/coba4.cpp | #include <iostream>
#include <conio.h>
using namespace std;
int data[10], data2[10];
int n;
int tukar(int a, int b){
int t;
t = data[b];
data[b]=data[a];
data[a] = t;
return 0;
}
int input(){
cout << "Masukkan jumlah data = ";
cin >> n;
cout << endl;
for(int i=0; i<n; i++){
cout << "Masukkan data ke-"... | ALGO | 0.999016 | 4.165289 |
276faf76-550b-45c8-80c0-2b589e667614 | fobydn/Study-Cpp | cpp_11/003_stl_std_forward_list.cpp | #include <forward_list>
#include <iostream>
int main()
{
std::forward_list<int> numbers;
std::cout << "Initially, numbers.empty(): " << numbers.empty() << '\n';
numbers.push_front(42);
numbers.push_front(13317);
std::cout << "After adding elements, numbers.empty(): " << numbers.empty() << '\n';... | TOOL | 0.85248 | 4.05804 |
f04e7045-7ece-4dda-8214-2ef306246064 | syedyasar/CPP_Edabit | Very_Easy/134_Remove_the_First_and_Last_Characters.cpp | /*
Source: Edabit
Link : https://edabit.com/challenge/Men549aAXNHN2AjXB
Date: 07/02/2021
Remove the First and Last Characters
======================================
Create a function that removes the first and last characters from a string.
Examples
removeFirstLast("hello") ? "ell"
removeFirstLast("maybe") ? "ayb"
... | ALGO | 0.994729 | 6.032393 |
a6472e03-550e-4b40-8f03-00001b52e331 | Ankur8789/LC-my-solutions | 1569-number-of-ways-to-reorder-array-to-get-same-bst/1569-number-of-ways-to-reorder-array-to-get-same-bst.cpp | class Solution
{
public:
typedef long long ll;
vector<vector<ll>> ncr;
ll mod = 1e9 + 7;
ll ways(vector<int> &v, int n)
{
if (n <= 2)
return 1;
vector<int> left, right;
for (int i = 1; i < n; i++)
{
if (v[0] > v[i])
left.push_ba... | ALGO | 0.999993 | 4.62768 |
97799be3-a1ee-4d81-9471-deb7fd77aec6 | quanganh208/Cpp-CodePTIT | NNLTC_001 - THỐNG KÊ PHẦN TỬ.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
map<int, int> mp;
vector<int> a;
int x;
while (cin >> x)
{
mp[x]++;
a.push_back(x);
}
for (int i = 0; i < a.size(); i++)
if (mp[a[i]])
{
cout << a[i] << " " << mp[a[i]] << endl;
... | ALGO | 0.999668 | 3.956053 |
73e94c2a-82c4-4617-a42a-63f742609b32 | Mulab11/cntt2016-hw1 | TC-SRM-599-div1-950/grq.cpp | #include<bits/stdc++.h>
#define sqr(x) (x)*(x)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define vi vector<int>
#define pb push_back
#define ld long double
#define mp make_pair
#define pii pair<int,int>
#define pq priority_queue
#define rf random_shuffle
#define np next_permutation
#de... | ALGO | 0.999928 | 3.876835 |
0ad7f91a-79fb-4844-af7c-384e8fa721dc | ChenXingLing/OI-Algorithm-Template | 【DP动态规划】/背包/【模板】完全背包 (货币系统).cpp | #include<bits/stdc++.h>
using namespace std;
int T,n,ans,a[105],dp[30005];
int main(){
scanf("%d",&T);
while(T--){
memset(dp,-127,sizeof(dp));
scanf("%d",&n);dp[0]=ans=0;
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
for(int i=1;i<=n;i++)
for(int j=a[i];j<=25000;j++)
dp[j]=max(dp[j],dp[j... | ALGO | 0.99979 | 3.62306 |
aaf5f3ae-ab48-4647-9d46-da6ce8bf5357 | lykhonis/XWindows-Dock-2.0 | XWD/XWDPublicAPI.cpp | #include <afxwin.h>
#include "XWDPublicAPI.h"
static CList<XWDPluginInfo*> pluginsList;
static XWDId *menuCount;
static XWDPMenu **menu;
void XWDPublicAPISendAnswer(XWDPluginInfo *plugin, XWDPFunction function, ...)
{
COPYDATASTRUCT cds = {0};
cds.dwData = WM_XWDPUBLICAPICALL;
va_list args;
va_start(args, funct... | TOOL | 0.885372 | 4.664607 |
e781e113-d80a-4cd7-8c46-73093b29849a | saraanbih/NeetCode-Problems | .history/Arrays & Hashing/Top K Frequent Elements_20250305124623.cpp | class Solution
{
public:
vector<int> topKFrequent(vector<int> &nums, int k)
{
map<int, int> mp;
vector<int> ans;
for (auto &num : nums)
mp[num]++;
vector<pair<int, int>> vec(mp.begin(), mp.end());
sort(vec.begin(), vec.end(), [](const pair<int, int> &a, const ... | ALGO | 0.99999 | 5.660717 |
806a4de4-684d-419b-a155-33e83ffe0452 | 4gunkbgs/Kalkulator-Sederhana | kalkulator.cpp | #include <iostream>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
void help(){
cout << "Penggunaan: " << "kalkulator" << " [Operasi] [Bilangan 1] [Bilangan 2] atau " << endl;
cout << " : " << "kalkulator" << " [Operasi] [Bilangan 1] " << endl;
cout << "Ketik \"kalkulator operasi\" U... | TOOL | 0.960746 | 3.723838 |
f6c66357-c02a-4bd8-9cfc-87617c748f81 | UtkarshMishra12/LeetCode_Solutions | LeetCode/Array/Merge Intervals.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
vector<vector<int>> merge(vector<vector<int>>& intervals) {
sort(intervals.begin(), intervals.end());
vector<vector<int>> merged;
for (auto interval : intervals) {
// if the list of merged intervals is empty or i... | ALGO | 0.999932 | 5.142648 |
5b7fe825-1ea8-4d24-9fc8-040932d6aab6 | petuniya/flutter_rentApp | 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.998784 | 6.761023 |
a205194c-c4b0-48af-abfb-f18e6fb6a29f | remotemcu/adin-llvm | lib/Support/SpecialCaseList.cpp | #include "llvm/Support/SpecialCaseList.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Regex.h"
#include <string>
#include <system_error>
#include <utility>
#include <stdio.h>
namespace llvm {
bool SpecialCaseList::Matcher::insert(s... | TOOL | 0.905768 | 7.385926 |
77077a88-9e63-47bf-b4e8-df2a3c546e9c | inusedname/PROPTIT | algo/quaylui/a.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef double db;
#define endl "\n"
int n;
int a[100];
void IN(int n)
{
cout << "[";
for (int i = 0; i < n - 1; i++)
cout << a[i] << " ";
cout << a[n - 1] << "]\n... | ALGO | 0.997375 | 3.481453 |
87b87c09-f065-4098-980c-10fe824f7c79 | PaukIsUha/optimizing_formating_code | predictions/supersonic_predicted_submissions/Codenet/p01564/614200666/8.cpp | #define NDEBUG
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
struct LCNode {
typedef LCNode *NP;
typedef int D;
static const int INF = 1LL << 25;
static c... | ALGO | 0.99999 | 4.476034 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.