uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
fc6be43e-8f20-4cac-a8f1-2a86a5cdc672 | vigneshkulo/leetCode | c++/GroupAnagram.cpp | class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
unordered_map<string, vector<string>> map;
vector<vector<string>> output;
for (auto item : strs) {
string key = item;
sort(key.begin(), key.end());
map[key].pu... | ALGO | 0.999982 | 6.511439 |
71e0d2c4-149b-4aef-8a1f-ac42b5eab085 | scott-sihui-wang/LeetCode | 102_Binary_Tree_Level_Order_Traversal.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999965 | 5.890081 |
64668ebc-9479-41d9-a68c-fd0aae386b14 | AadityaShukla01/Interview-Preparation | 0386-lexicographical-numbers/0386-lexicographical-numbers.cpp |
class TrieNode{
public:
TrieNode* child[10];
bool isLast;
int num;
};
class Solution {
public:
TrieNode* root;
vector<int>ans;
void insert(int num)
{
string n = to_string(num);
TrieNode* temp = root;
for(auto c: n)
{
if(temp->child[c - '0'] == N... | ALGO | 0.999868 | 6.813415 |
b8d0ce5a-2567-49ab-bff6-6f1d78466cc1 | leagdt/Modelisation-de-surface | AppTinyMesh/Source/triangle.cpp | // Triangle
#include "mesh.h"
double Triangle::epsilon = 1.0e-7;
/*!
\class Triangle triangle.h
\brief Base minimum storage triangle class.
The data-structure of the triangle does not include the normalized normal vector.
*/
/*!
\brief Compute a point in the triangle, given uv-coordinates.
\param u,v Coordinates.
... | TOOL | 0.868678 | 7.790773 |
5c3d2adf-6f36-4e87-a5bc-67f9edd8e94a | naumazeredo/competitive-programming | codeforces/670B.cpp | #include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x) memset((x), 0, sizeof(x))
#define cli(x) memset((x), 63, sizeof(x))
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<
typedef lo... | ALGO | 0.999977 | 3.398713 |
6118ca13-2b13-463e-9d37-123ea23467d5 | Rofiqul-Umma/Chat-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.9988 | 6.76073 |
cf67ad96-9101-4966-9344-575949399dec | wylu/leetcodecn | src/cpp/p900to999/944.删列造序.cpp | /*
* @lc app=leetcode.cn id=944 lang=cpp
*
* [944] 删列造序
*
* https://leetcode.cn/problems/delete-columns-to-make-sorted/description/
*
* algorithms
* Easy (69.66%)
* Likes: 71
* Dislikes: 0
* Total Accepted: 36.4K
* Total Submissions: 52.3K
* Testcase Example: '["cba","daf","ghi"]'
*
* 给你由 n 个小写字母字... | ALGO | 0.999887 | 5.970317 |
727e5cc3-2d9a-406c-9ce2-b3892cc5efb5 | miredirex/androidapp-arcore-game | bullet3-latest/src/BulletDynamics/MLCPSolvers/btLemkeAlgorithm.cpp | #include "btLemkeAlgorithm.h"
#undef BT_DEBUG_OSTREAM
#ifdef BT_DEBUG_OSTREAM
using namespace std;
#endif //BT_DEBUG_OSTREAM
btScalar btMachEps()
{
static bool calculated = false;
static btScalar machEps = btScalar(1.);
if (!calculated)
{
do
{
machEps /= btScalar(2.0);
// If next epsilon yields 1, then... | ALGO | 0.999994 | 3.734904 |
a3873639-234c-4719-b01e-f2389810f485 | DeepRobot2020/udacity_carnd | CarNDTerm2/T2P5-CarND-MPC/src/Eigen-3.3/failtest/jacobisvd_int.cpp | #include "../Eigen/SVD"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
JacobiSVD<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| ALGO | 0.918017 | 3.327923 |
652bbb0d-c07a-449a-ac0a-ab5c14d90a0a | 071yoon/Algorithm | Daily/2022_02/2022_02_16/1325/1325.cpp | #include <vector>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
vector <int> computers[10001];
int cntr[10001] = {0};
bool visited[10001] = {0};
int M, N;
void dfs(int now, int *cnt){
for(int i = 0; i < computers[now].size(); i++){
if (!visited[computers[now][i]]){
visited[com... | ALGO | 0.999991 | 4.159125 |
28913127-adf4-46a4-9d72-22ec43f623c7 | 7ij/cptemplate | segment_tree_range_node_query.cpp | /*
ST tree;
tree.a=base_array
tree.build(1, 1, n);
tree.query(1, 1, n, l, r)
*/
struct ST
{
struct node
{
int lv, rv, lf, rf, mf;
node()
{
lv=rv=lf=rf=mf=0;
}
};
static const int N = 1e5 + 9;
node t[4 * N];
vector<int> a; //a is the base array. a must... | ALGO | 0.999817 | 4.661763 |
5fd3a42f-692e-45b1-a310-c562611076a4 | lawtonsclass/s22-code-from-class | csci40-online/lec04/ifelse.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
cout << "What day is it? ";
string day;
cin >> day;
if (day == "Wednesday") {
// this code in here gets executed when the day is equal to
// "Wednesday"
cout << "Wear pink!\n";
} else {
// this code gets run when the boo... | TOOL | 0.872049 | 4.209812 |
35b097ac-48e7-43ab-ad60-0bed2cfb94c9 | AnuragChouhanDEV/LeetCode | asteroid-collision/Accepted/6-2-2023, 10_19_13 PM/Solution.cpp | // https://leetcode.com/problems/asteroid-collision
class Solution {
public:
vector<int> asteroidCollision(vector<int>& asteroids) {
stack<int> ast;
vector<int> res;
for (int i = 0; i < asteroids.size(); ++i) {
if (ast.empty()) {ast.push(asteroids[i]); continue;}
if ... | ALGO | 0.999987 | 5.850943 |
d2dd1fbe-3e17-4e1b-ada0-1b3440f56692 | Purse123/cpp-assignment | oop/6_4.cpp | #include <iostream>
using namespace std;
template <typename T> T add(T a, T b) { return a + b; }
template <typename T> T add(T a, T b, T c) { return a + b + c; }
int main() {
int resultint = add(5, 10);
double resultdouble = add(2.5, 3.5, 1.5);
cout << "R1: " << resultint << endl;
cout << "R2: " << resultdou... | TOOL | 0.931943 | 5.474614 |
eb5854e1-f115-42f3-a674-9b4a28753b8e | huangallen2008/cppcode | code/其他/test/test4.cpp | #include<bits/stdc++.h>
using namespace std;
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,sse4,bmi2,popcnt")
#define int long long
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define RREP1(i,n) for(int i=(n);i>=1... | ALGO | 0.99995 | 4.058857 |
52f72b60-21b5-4595-b3ae-8f53802d7546 | boatinw99/CompetitiveProgramming | Codeforces/898E.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
priority_queue<ll>pq;
main()
{
ll n,i,ch=0,x,in,q;
scanf("%I64d",&n);
int w0=0,w1=0;
for(i=0;i<n;i++)
{
scanf("%I64d",&in);
q=sqrt(in);
x=min(in-q*q,(q+1)*(q+1)-in);
if(x==0)
{
if(!in)w0++;
else if(in)w1++;
ch++;
}
else pq.p... | ALGO | 0.999943 | 3.386648 |
e8bddd45-1d28-45a1-a4f3-5fedb808de77 | hackerguy2000/Coding_Journey | STL/iterator_ex.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> arr = {4, 5, 44, 1, 256};
vector<int> arr1 = {40, 11, 12, 132};
vector<int>::iterator itr;
itr = arr1.begin();
advance(itr, 3);
copy(arr.begin(), arr.end(), inserter(arr1, itr));
for (auto i = arr1.begin(); i != arr1.... | ALGO | 0.995631 | 3.377785 |
23672cb3-2613-47f2-9ad4-01c0d26c08dc | AsifWatson/codeforces | A/1269A.cpp | /*****************************************************************|
| /\ _______ ________ _________ |
| / \ /------ \ |___ ___| | _______| |
| / /\ \ || || | | |
| / / \ \ ||______ || | |... | ALGO | 0.999878 | 3.108138 |
51221e19-c115-490d-9cab-a56d01a59651 | Singhaditya3116/Data-Structures-and-Algorithms | OOPS/OOPS CN/fraction_class.cpp | #include<iostream>
using namespace std;
class Fraction{
private :
int numerator;
int denominator;
public:
Fraction(int numerator,int denominator)
{
this->numerator=numerator;
this->denominator=denominator;
//cout <<"Constructor called"<<endl;
}
void print()
{
... | TOOL | 0.902215 | 5.328591 |
c7f49e6b-2b48-4995-a4ac-c6c658aecbad | Alberto1Artoni/intersection | lib/CGAL-5.5.2/examples/Nef_S2/nef_s2_construction.cpp | #include <CGAL/Exact_integer.h>
#include <CGAL/Homogeneous.h>
#include <CGAL/Nef_polyhedron_S2.h>
#include <cassert>
typedef CGAL::Exact_integer RT;
typedef CGAL::Homogeneous<RT> Kernel;
typedef CGAL::Nef_polyhedron_S2<Kernel> Nef_polyhedron;
typedef Nef_polyhedron::Sphere_point Sphere_point;
typedef Nef_polyhedron::S... | ALGO | 0.963607 | 4.950302 |
902fb8d4-34dd-42c2-bd80-f3122a07d834 | legend507/MyLeetCodeSolutions | LeetCodeNo.280/main.cpp |
/*
GoogleTechDevGuide Q
280. Wiggle Sort
Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3]....
Example:
Input: nums = [3,5,2,1,6,4]
Output: One possible answer is [3,5,1,6,2,4]
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <qu... | ALGO | 0.999946 | 5.032126 |
ee65fab5-c043-4806-bfbb-667b9ac5c6c7 | rogalj/MolStrucClassifier | nn-fit/nn-class.cpp | #include "nn-class.h"
int main(int argc, char *argv[])
{
NNvariables NNvar; //all variables for the NN
SIMvariables SIMvar; //all simulation variables
int i;
string filename="";
//get input file name from command line input
if (argc == 2)
{
filename = string(argv[1]);
}
else{
cout<<"Programme must be cal... | ALGO | 0.944512 | 4.998542 |
696ba3af-99b1-495b-b994-f065310c8ee0 | manu05X/Leetcode | 2582-minimum-score-of-a-path-between-two-cities/2582-minimum-score-of-a-path-between-two-cities.cpp | class Solution {
public:
void dfs(int node, vector<vector<pair<int, int>>>& adj, vector<bool>& visit, int& answer) {
visit[node] = true;
for (auto& edge : adj[node]) {
answer = min(answer, edge.second);
if (!visit[edge.first]) {
dfs(edge.first, adj, visit, ans... | ALGO | 0.999937 | 5.946545 |
6bbac21b-ebc3-4a8d-9091-96fe7a0d964f | RahulKumar-007/LeetCode-150 | 452_MinNumberOfArrowsToBurstBallons.cpp | /*
There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i] = [xstart, xend] denotes a balloon whose horizontal diameter stretches between xstart and xend. You do not know the exact y-coordinates of the balloons.
A... | ALGO | 0.999928 | 6.165111 |
2fcd4b7a-43eb-4052-8a92-c53f907f1fc4 | PiekarskaM/Matura | 2021_probna_galerie_handlowe.cpp | #include <bits/stdc++.h>
using namespace std;
struct galeria{
string kod;
string miasto;
int pow[70][2];
int p[70];
};
galeria galerie[50];
struct kraj{
string kod;
int ile;
};
kraj kraje[50];
int ile_krajow=0;
void odczyt(){
ifstream in("galerie.txt");
for (int i=0;i<50;i++)
{
in >> galerie[i].k... | ALGO | 0.998652 | 3.970111 |
6c73a6bf-707b-4efa-b408-9235b611f11c | hs094/CP | Codeforces/Codeforces Round #834 (Div. 3)/Binary_Inversions.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#inc... | ALGO | 0.999782 | 5.191935 |
884b1e76-e7ae-4385-9d12-165c7c0d5c07 | Dhaval1112/dsa | 6. char array/cide1.cpp | #include <iostream>
#include <cstring>
#include <string>
using namespace std;
int getlength(char arr[])
{
int count = 0;
int index = 0;
while (arr[index] != '\0')
{
count++;
index++;
}
return count;
}
// convert upper lower conversion
void convertintolowercase(char arr[])
{
... | TOOL | 0.979214 | 3.80513 |
e3f4681f-7ab1-4226-9458-571a7a31f108 | yealuo/AlgorithmAndDataStructure | 5/binaryTree.cpp | #include <climits>
#include <iostream>
#include <queue>
#include <stack>
using namespace std;
class BinaryTree {
public:
int value;
BinaryTree* lChild;
BinaryTree* rChild;
BinaryTree() : lChild(nullptr), rChild(nullptr) {}
};
// 非递归遍历
// 先序遍历
void preOrderUnRecursion(BinaryTree* root) {
if (roo... | ALGO | 0.999942 | 5.446646 |
38fc193a-d112-4f9c-8c79-f834d35668a8 | nutansrinivas/practice | c++11/programs/merge_two_list.cpp | /**
* 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:
ListNode* mergeTwoLis... | ALGO | 0.99983 | 5.937504 |
cca3e670-9474-4ab3-ae84-2c16081d9665 | jins0704/Algorithm | C++/Programmers/Level2/방금그곡(꼭다시풀기)/방금그곡/main.cpp | //
// main.cpp
// 방금그곡
//
// Created by 홍진석 on 2021/08/25.
//
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#define FOR(i,n) for(int i=0; i<(n); i++)
using namespace std;
vector<string> split(string s, char c){
stringstream ss(s);
vector<string> v;
string temp = "";
wh... | ALGO | 0.937729 | 5.112322 |
67ccb38c-1879-49e1-921e-c2ef4246a51b | Blackmane/adventofcode | 2021/day25/day25.cpp | /**
* @file day25.cpp
* @project advent of code
*
* @author Niccolò Pieretti
* @date 25 Dec 2021
*
****************************************************************************
*
* _ _ o __ __ __ _ o _ ,_ _
* / |/ | | / / / \_|/ \_| |/ / | |/
* ... | ALGO | 0.999516 | 5.861921 |
34176e22-154c-4e36-ad5d-ae97840f7394 | yzzupgo/MFTCG | Data/abc170_b/slow_cf/ac/14425386.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void solve(){
int n , m;
cin >> n >> m ;
for(int i = 0 ; i <=n ;i++)
{
if(i*2+(n-i)*4 == m)
{
cout << "Yes";
return ;
}
}
cout << "No";
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
solve();
return 0;
}
| ALGO | 0.999985 | 3.052484 |
cac9b3bd-3330-4096-8648-a1e82479c285 | NeedAvailableName/IT3240E | week2/TSP.cpp | #include<bits/stdc++.h>
using namespace std;
int n, m;
const int N = 100, INF = 10000000;
int A[N][N];
int x[N];
bool mark[N];
int f = 0, f_min = INF;
int cm = INF;
bool check(int i, int v) {
return(!mark[v]);
}
void printSolution() {
if(f + A[x[n]][x[1]] < f_min) f_min = f + A[x[n]][x[1]];
}
void Try(int i) {... | ALGO | 0.999981 | 3.940638 |
fead815b-e67b-4bd7-960f-af52d1617858 | yuki-inaho/temporal_median_filter | src/main.cpp | #include <iostream>
#include <chrono>
#include <opencv2/opencv.hpp>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include "header.h"
#include "ParameterManager.hpp"
#include "MedianFilter.hpp"
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
using namespace std;
usi... | TOOL | 0.94648 | 3.954046 |
575db738-83c4-4aaa-8d63-3185bfb3c999 | ZainAhmad0/CPP-Programms | Practice/DSA Practice/Queue/QueueImplementation.cpp | #include <iostream>
using namespace std;
template <class T>
class Queue
{
private:
int count;
int maxQueue;
int front;
int rear;
T *items;
public:
Queue();
Queue(int max);
~Queue();
bool isEmpty() const;
bool isFull() const;
T remove();
void insert(T newItem);
};
templa... | ALGO | 0.994715 | 4.366495 |
2f079955-6312-44a1-bc23-304fe6e51c41 | Yashmenaria1/Leetcode_daily_solutions | 948. Bag of Tokens.cpp | class Solution {
public:
int bagOfTokensScore(vector<int>& tokens, int power) {
sort(tokens.begin(), tokens.end());
int res = 0, points = 0, i = 0, j = tokens.size() - 1;
while (i <= j) {
if (power >= tokens[i]) {
power -= tokens[i++];
res = max(re... | ALGO | 0.999918 | 6.30501 |
bc36c829-1b19-48b6-b13e-1b2b5d7d4d6e | S-yujin/codetree | 250511/정수 명령 처리 3/process-numeric-commands-3.cpp | #include <iostream>
#include <string>
#include <deque>
using namespace std;
int main() {
int N;
cin >> N;
string cmd;
deque<int> dq;
for (int i = 0; i < N; i++) {
cin >> cmd;
if (cmd == "push_front") {
int x;
cin >> x;
dq.push_front(x);
}... | ALGO | 0.998926 | 5.039145 |
a1dda174-9328-4f27-9209-f970f3c17819 | gdscjec/Data-Structure-Problems | Problems/Number-of-Islands/solution.cpp |
void bfs(int r, int c, vector<vector<int>> &vis, vector<vector<char>> grid)
{
int n = grid.size();
int m = grid[0].size();
vis[r][c] = 1;
queue<pair<int, int>> q;
q.push({r, c});
while (!q.empty())
{
r = q.front().first;
c = q.front().second;
q.pop();
for (in... | ALGO | 0.99997 | 6.21288 |
bfcf4ccc-cab4-4be7-ba52-860916f7376e | khaledsliti/CompetitiveProgramming | cses/Dynamic_Programming/1636.cpp | // We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;
const int N = 1000005, V = 105;
const... | ALGO | 0.999995 | 4.047718 |
0d3d56c2-7ef5-4739-9d4a-2151af217cc0 | yuifan/pexus4_frameworks_av | media/libstagefright/codecs/amrwb/src/preemph_amrwb_dec.cpp | /*
------------------------------------------------------------------------------
Filename: preemph_amrwb_dec.cpp
Date: 12/10/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-------------------------------------------------------------------... | ALGO | 0.999932 | 5.475962 |
0ef4d252-5124-45a5-b520-546a483b1975 | eaglehuntt/CS260-Data-Structures | hash_table/simple/main.cpp | #include "hash_table.cpp"
#include <string>
#include <iostream>
#include <sstream>
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::stringstream;
bool test_hash() {
HashTable ht;
string key = "test";
int hashed_value = ht.hash(key);
// Check if the hashed value is within... | TEST | 0.928067 | 6.005261 |
a345e194-a759-40e0-86fc-db89e43a9b11 | seobew/acmicpc-sols | if_statement/1110.cpp | #include <stdio.h>
int main(){
int n;
scanf("%d", &n);
int count = 1;
int prev = n;
int pre_next = n;
int next = n;
if(n<10){
pre_next = prev;
}else{
pre_next = prev/10 + prev%10;
}
next = (prev%10)*10 + pre_next%10;
prev = next;
while(1){
if(next == n){
break;
}
if(prev<10){
pre_next = prev... | ALGO | 0.99961 | 3.650248 |
33c1de2d-fd53-4990-b843-c86a8f97e9a5 | silvermete0r/problem_solving_coding_time | Competitions/Constructor University Practice Round 2025/testI.cpp | // link: https://constructor2025.contest.codeforces.com/group/8Kn6fqj9Vx/contest/571552
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define uset unordered_set
#define umap unordered_map
#define vi vector<int>
#define vii vector<int, int>
#define pii pair<int, int>
#define pll pair<long long, long long>
#defi... | ALGO | 0.99981 | 4.370909 |
00bcf459-90d9-44e5-8c46-495ea4782dd2 | lventu/prova1 | prova1/box_muller.cpp | #include "stdafx.h"
#include "box_muller.h"
/******************************************************************************/
/* randn()
*
* Normally (Gaussian) distributed random numbers, using the Box-Muller
* transformation. This transformation takes two uniformly distributed deviates
* within the unit circle... | ALGO | 0.999835 | 6.549179 |
ee4d0246-6b1f-40cd-94c5-524c1efe0985 | javagovindsharma/leetscode | solution/3300-3399/3380.Maximum Area Rectangle With Point Constraints I/Solution.cpp | class Solution {
public:
int maxRectangleArea(vector<vector<int>>& points) {
auto check = [&](int x1, int y1, int x2, int y2) -> bool {
int cnt = 0;
for (const auto& point : points) {
int x = point[0];
int y = point[1];
if (x < x1 || x ... | ALGO | 0.999978 | 6.16322 |
5c90bdac-e4cd-479d-9996-35545bc554bf | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/MixtralExpert/top0-100/find-pattern-in-infinite-stream-i-Solution.findPattern/177771_nan.cpp | int dns_read_name(unsigned char *buffer, unsigned char *bufend,
unsigned char *name, char *destination, int dest_len,
int *offset)
{
int nb_bytes = 0, n = 0;
int label_len;
unsigned char *reader = name;
char *dest = destination;
while (1) {
/* Name compression ... | TOOL | 0.914902 | 5.535635 |
0e0f1501-a4e8-4ae8-9b0b-4ec430f66d2e | hsj4436/Algorithm | 프로그래머스/2/42842. 카펫/카펫.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(int brown, int yellow) {
vector<int> answer;
int height = 1;
while (height != yellow + 1) {
if (yellow % height == 0) {
int width = yellow / height;
int requiredBrown = height * 2 + (width + ... | ALGO | 0.989033 | 5.551977 |
d6323d97-3d39-4aab-b422-e4d766e17561 | MasterIceZ/IMSO | icpc/KU_CPE_ICPC_24/Unlock_Pattern.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
double answer;
pair<int, int> pos[10];
double make_dist_2(pair<int, int> a, pair<int, int> b) {
return (a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second);
}
signed main(int argc, char *argv[]) {
cin.tie(nu... | ALGO | 0.999474 | 3.58924 |
42ec960a-63b5-4057-8666-7b814fa026c8 | sunnyboi-i/Algorithms | Ford-Fulkerson_MinCut/main.cpp | #include <algorithm>
#include <climits>
#include <cstdint>
#include <iostream>
#include <unordered_map>
#include <vector>
struct Edge {
Edge* residual;
int32_t from;
int32_t to;
int32_t capacity;
int32_t flow;
int32_t pos;
Edge(int32_t p1, int32_t p2, int32_t cap, int32_t position)
: from{p1}, to{p... | ALGO | 0.999671 | 4.366326 |
b3fa1a7e-3064-4f0a-a4ee-d8c26b22ff2f | endixk/c-playground | boj/src/0010/Q1041.cpp | // BOJ 1041 [Dice]
// Supported by GitHub Copilot
#include <iostream>
using namespace std;
int main() {
long long N;
cin >> N;
long long A, B, C, D, E, F;
cin >> A >> B >> C >> D >> E >> F;
long long ones[6] = {A, B, C, D, E, F};
long long twos[12] = {A + B, A + C, A + D, A + E, B + C, B + D,... | ALGO | 0.999698 | 4.117603 |
4d13c502-6333-4d54-9c4f-a9a13346ffcf | Not-Buddy/C-plus-plus-Brainstorming | newSumFactorial.cpp | #include <iostream>
typedef unsigned long long ll;
ll factorial_sum(ll input)
{
ll sum{0};
for(ll i{1};i<=input;i++)
{
sum+=i;
}
return sum;
}
using namespace std;
int main()
{
ll input{},sumfac{};
cin>>input;
sumfac=factorial_sum(input);
cout<<"The SumFac of "<<input<<" is :"<<sumfac<<endl;... | ALGO | 0.999956 | 5.536614 |
df017ceb-5fc8-4a83-9498-9a5a2dc8b51d | ishandutta2007/codeforces | wild_hamster/normal/1082/C.cpp | #include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <set>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <string>
#include <time.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define x3 dflgkg
#define y1 d... | ALGO | 0.999947 | 3.771454 |
74f15963-c796-4c62-af09-964d22733fa9 | Sandi2156/TLE-Eliminators-Level-2-Problems | 12-dynamic-programming/10_orac_and_models.cpp | #include <bits/stdc++.h> // This will work only for g++ compiler.
#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclu... | ALGO | 0.999861 | 4.070046 |
cd90bf41-33b2-43ff-80bf-d273712830de | madhavpaliwal02/-NAD---Numerical-Analysis-And-Design | 3_FP_Mul.cpp | #include <iostream>
using namespace std;
bool checking_exp_range(int e)
{
if (e > 99)
{
cout << "\nOverflow !!!";
return false;
}
else
{
return true;
}
}
int main()
{
// Declaration of variables
float x1, x2, x;
int e1, e2, e, ee = 0;
// Getting values ... | ALGO | 0.999598 | 3.874726 |
dbe24149-d86e-4f4d-a1e0-3609ff21f4f6 | kokosabu/atcoder | cpp/abc206_c/main.cpp | #include <iostream>
// #include <vector>
#include <map>
using namespace std;
int main()
{
unsigned long long N;
cin >> N;
map<unsigned int, unsigned long long> m;
for(int i = 0; i < N; i++) {
int A;
cin >> A;
m[A] += 1;
}
unsigned long long count = (N * (N-1)) / 2;
... | ALGO | 0.999638 | 4.037637 |
27e8bcc2-ce50-4bcd-a3e1-64654cb72bc4 | MobeenButt/PD | Week9/task6.cpp | #include <iostream>
using namespace std;
int coloringTime(string arr[], int size);
int main() {
int size, n;
cout << "Enter the size of Array: ";
cin >> size;
string arr[size];
for (int i = 0; i < size; i++) {
cout << "Enter Element "<<i+1<<" : ";
cin >> arr[i];
}
coloringTime... | ALGO | 0.994226 | 4.844817 |
01622bf3-bc72-470c-8043-e4bf7832bd28 | whaaswijk/libmajesty | lib/mlpext.cpp | #include <iostream>
#include <time.h>
#include "mlpext.h"
#include "xmg.h"
#include <queue>
#include <cassert>
#include <ctime>
#define set_prop_flag(n) n->flag |= 1
#define clear_prop_flag(n) n->flag &= (~1)
#define is_prop_set(n) (n->flag & 1)
#define set_rel_flag(n) n->flag |= 2
#define clear_rel_flag(n) n->flag &=... | ALGO | 0.998978 | 4.070827 |
0d8fe6da-3ec0-4990-939e-1fa5dc793674 | ngthanhtrung23/ProjectEuler | P1XX/138.cpp | #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
#define EACH(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define DEBUG(x) { cout << #x << " = "; cout << (x) << end... | ALGO | 0.999844 | 3.903024 |
172056ac-3bde-49bb-88e7-c04cf1f3be1d | ishandutta2007/codeforces | cheissmart/normal/520/A.cpp | #include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
const int INF = 1e9 + 7;
int m[26];
i... | ALGO | 0.999997 | 4.220018 |
04335758-4e5e-43ed-879b-15f675cbb911 | cbiello/twoloop_ppbbhLC | ampbbggH/ysubsgg2Lnf0pppn/Ygg2Lnf0pppn235.cpp | #include <iostream>
#include "listYgg2Lnf0pppn.h"
#include <complex>
#include <qd/qd_real.h>
std::complex<dd_real> Ygg2Lnf0pppn235(ExVariables ex){
std::complex<dd_real> ex1=ex.ex1;
std::complex<dd_real> ex2=ex.ex2;
std::complex<dd_real> ex3=ex.ex3;
std::complex<dd_real> ex4=ex.ex4;
std::complex<dd_real> ex5=ex.ex5;
s... | ALGO | 0.976641 | 3.657367 |
e2584c5d-77e4-46d1-bba1-1a0fd20e9f85 | Saharsh979/CP-Algorithms | Leetcode/Strings Bulb Switcher.cpp | class Solution {
public:
int minFlips(string target) {
int count=0;
int j=0;
if(target[0]=='1'){
count++;
}
while(j<target.length()-1){
if(target[j+1]=='1' && target[j]=='1'|| target[j+1]=='0' && target[j]=='0'){
j++;
... | ALGO | 0.999965 | 6.464456 |
2b3fc0c3-038c-4ae5-ad76-54a73e41c673 | DivyaSharma0894/CPP_Code | Array/InbuiltSort.cpp | #include<iostream>
#include<algorithm>
using namespace std;
bool compare(int a,int b){
return a<b;
}
int main(){
int n;
cin>>n;
int *arr=new int[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
sort(arr,arr+n,compare);
for(int i=0;i<n;i++){
cout<<arr[i];
}
return 0;
} | ALGO | 0.999663 | 4.016205 |
b6a20d55-9087-4a43-91e2-71c0f0efd308 | MohdAliJasim/C---DSA-Practice-Questions | 662-Maximum-Width-of-Binary-Tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999826 | 5.951392 |
d61b8d75-f5f0-4e94-bbf0-531ff551c109 | lozephons/Algorithm-Solving | Algorithm-Sources/Algospot/알고스팟 겨울캠프/DP World 3/A. Palindromist.cpp | #include<stdio.h>
#include<algorithm>
#include<string>
#include<string.h>
#include<memory.h>
#include<list>
#include<vector>
using namespace std;
int n, subLen[50];
char str[120];
char sub[50][120];
int p[120][120], d[120][120];
vector<int> path;
int solve(int fr, int to) {
d[fr][to] = 0;
for(int i = fr;i<to;i++)... | ALGO | 0.999932 | 3.95008 |
4a063bc0-242f-4723-8f8f-2860b5eeb45f | se-ashishgupta/LeetCode | Sliding Window/992-SubarraysWithKDifferentIntegers.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
/*
Problem Statement:
------------------
Given an integer array `nums` and an integer `k`, return the number of **good subarrays** of `nums`.
A good subarray is a subarray where the number of distinct integers... | ALGO | 0.999932 | 7.601627 |
030d77e7-647c-4257-82a8-e0f986abe18a | ITIS-mphuong169/ICPC-2024 | B7.cpp | //
// Created by Macbook on 23/07/2024.
//
// G: HOAN VI
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <string>
#include <iomanip>
#include<sstream>
#include <queue>
#include<math.h>
#include<string.h>
#include <fs... | ALGO | 0.999807 | 4.770124 |
c2a1bba1-e3e6-4010-b6f2-a5d50a48d2c7 | aashimasaxena91/Data-Structures-and-Algorithms | 1086-high-five/1086-high-five.cpp | class Solution {
public:
vector<vector<int>> highFive(vector<vector<int>>& items) {
sort(items.begin(), items.end());
vector<vector<int>> ans;
for(int i=0;i<items.size();){
priority_queue<int, vector<int>, greater<int>> pq;
pq.push(items[i][1]);
i... | ALGO | 0.999924 | 5.44399 |
7f23d8f9-b977-484a-8c92-20407bc042b1 | Sobolanu/cp-solutions | Codeforces/MAX-MEX Cut - 1566C.cpp | #include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
typedef unsigned long long ull;
int mexTable(char& a, char& b)
{
if (a != b) return 2;
else if (a == '1' && b == '1') return 0;
else return 1;
}
/*
fun little problem, just an annoying amount of case work
oh and my internet went out for like 5 mi... | ALGO | 0.999888 | 4.502539 |
9a462135-3e16-4871-a03c-cac07b9df1e0 | ishandutta2007/codeforces | yousef_salama/normal/79/C.cpp | #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <limits.h>
#include <limits>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <sstream>
using namespace std;
char s[... | ALGO | 0.999108 | 3.912437 |
81816b5c-f24b-462d-9878-5e6d3d7946b9 | Sudhanshu2306/Competitive-coding | B_Verse_For_Santa.cpp | #include <bits/stdc++.h>
using namespace std;
// Commonly used loops
#define for0(i, n) for (int i = 0; i < (n); ++i)
#define for1(i, n) for (int i = 1; i <= (n); ++i)
#define rfor0(i, n) for (int i = (n) - 1; i >= 0; --i)
#define rfor1(i, n) for (int i = (n); i >= 1; --i)
#define foreach(it, v) for (auto it = v.begin... | ALGO | 0.999914 | 5.080431 |
5dffd994-8373-4872-b0f5-b7c15dd589a5 | sumitkaushik1005/coding | uniquen.cpp | #include<bits/stdc++.h>
using namespace std;
bool fn(int x){
set<int> st;
while(x!=0){
int digit=x%10;
if(st.find(digit)!=st.end()){
return false;
}
st.insert(digit);
x=x/10;
}
return true;
}
int main(){
int l,r;
cin>>l>>r;
int max_diff=0;
int ans=0;
for(int i=(l+r)/2-1;i<=r;i++){
if(i<l){
... | ALGO | 0.999957 | 3.778965 |
8cfa4276-6876-4456-9c93-0648911650c4 | Abdulhaseebimran/CRUD-API-INTEGRATION-FLUTTER | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
e7bbb5e2-f7d9-47d0-af44-cf52b1923d38 | Madhuu-k/Leetcode-Grind | Arrays/Leetcode 84 - Largest Rectangle in Histogram.cpp | // Problem Link: https://leetcode.com/problems/largest-rectangle-in-histogram/?envType=problem-list-v2&envId=array
// Time Complexity: O(n)
class Solution {
public:
int largestRectangleArea(vector<int>& heights) {
stack<int> st;
int maxArea = 0;
heights.push_back(0);
for(int i = 0; ... | ALGO | 0.9999 | 6.902853 |
148cb30a-b6c8-424f-a3b1-75b776159acb | Jay7221/competitve-programming | codechef/starters/Starters86/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
int n;
cin >> n;
vector<vector<int> > graph(n + 1);
for(int i = 0; i < n - 1; ++i){
int u, v;
cin >> u >> v;
graph[u].push_back(v);
graph[v].push_back(u);
}
vector<int> sz(n + 1, 0);
vector<int> par(n + 1, 0);
auto dfs_sz ... | ALGO | 0.999994 | 5.519517 |
6e0fccad-3bcc-4bab-bf23-a10f3f3d4405 | aditiganvir28/CS-357---Lagrangian-Relaxation | subproblem.cpp | #include<bits/stdc++.h>
#include "variables.cpp"
using namespace std;
int subproblem1(){
double d = 0;
double sum = 0;
int size = muv1.size();
for(int i=0; i<size; i++){
sum += muv1[i];
}
if(1-sum<0){
return 0;
}
double val = INT_MAX;
for(int i=0; i... | ALGO | 0.998241 | 3.466121 |
72a5a126-faca-4b72-938a-d5010f0c23ee | ArbazKhan1645/Tjara | 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 |
7967ab80-3ae3-4b0e-84b6-76c5ad48a4c7 | roshnimishraa/My-LeetCode-Questions | Recursion/Aditya Verma Recursion/IBH Method/Josephus Problem or Find the Safe Position.cpp | >> Also known as Find the Safe Position or Josephus Problem or Game of Death in a circle or Execution in Circle
TC : O(N)
SC : O(1)
class Solution {
public:
int helper(int n,int k){
if(n == 1) {
return 0;
}
else{
return (helper(n-1,k)+k) % n;
}
}
int findTheWinner(int n, int k) {
re... | ALGO | 0.999999 | 5.546553 |
63e31238-4521-4f60-b14a-220a23d41b57 | hitonichi/codeforces | 2021_11/546A.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int k, n, w;
cin >> k >> n >> w;
int sum = k*(w*(w+1)/2);
if (sum - n <= 0) cout << 0 << endl;
else cout << (sum - n) << endl;
return 0;
} | ALGO | 0.999901 | 3.662307 |
2fb64895-fe39-46c5-bb07-47b0dd711046 | Irpacci/HSE-Stuff | tasks/sort_students/sort_students.cpp | #include <algorithm>
#include <cstdint>
#include "sort_students.h"
using RightDate = std::pair<int32_t, std::pair<int32_t, int32_t>>;
using RightName = std::pair<std::string, std::string>;
bool isLess(Student a, Student b, SortKind sortKind) {
RightName a_name = {a.last_name, a.name};
RightName b_name = {b.l... | ALGO | 0.999832 | 5.380993 |
92d54757-3c49-40a3-a1be-f6799da5fada | yzzupgo/MFTCG | Data/abc206_a/anchobi_test/ac/23593918.cpp | #include <bits/stdc++.h>
#include <iostream>
#define LL long long
using namespace std;
int main() {
int a;
cin >> a;
if(int(1.08 * a) < 206) {
cout << "Yay!" << endl;
} else if(int(1.08 * a) == 206) {
cout << "so-so" << endl;
} else {
cout << ":(" << endl;
}
}
| ALGO | 0.997851 | 3.406556 |
fd822f39-65dc-4628-87df-cd0f04c579e3 | AndreaBaretta/UCLA_CS32 | Homework2/mazestack.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
class Coord {
public:
Coord(int r, int c) : m_row(r), m_col(c) {}
int r() const { return m_row; }
int c() const { return m_col; }
private:
int m_row;
int m_col;
};
// Return true if there is a path from (sr,sc) to ... | ALGO | 0.999611 | 4.968873 |
f1e62f68-770c-40aa-a3a8-629c6e698626 | imtahirabatool/Leetcode | 179-largest-number/largest-number.cpp | class Solution {
public:
string largestNumber(vector<int>& nums) {
vector<string>numStr;
for(int num:nums){
numStr.push_back(to_string(num));
}
sort(numStr.begin(), numStr.end(), [](const string& a, const string& b){
return a+b>b+a;
});
if(numS... | ALGO | 0.999994 | 6.365019 |
98b8d225-2259-4a38-b217-c3cf3cb63116 | JpKarwa/Codes | Array/19.cpp | // Find the first non repeating element of array
#include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> v={2,1,2,3,4,4};
int n=v.size();
for(int i=0;i<n-1;i++){
bool flag=false;
for(int j=i+1;j<n;j++){
if(v[i]==v[j]){
flag=true;
... | ALGO | 0.999137 | 3.537382 |
8617e9e6-54f8-47e3-92e4-8b403ed49b99 | Biplab96Das/Codeforces_problemset | SoftDrinking.cpp | #include<iostream>
using namespace std;
/*This winter is so cold in Nvodsk! A group of n friends decided to buy k bottles of a soft drink called "Take-It-Light" to warm up a bit. Each bottle has l milliliters of the drink. Also they bought c limes and cut each of them into d slices. After that they found p grams of sal... | ALGO | 0.999575 | 3.287657 |
3496d205-c39e-4047-ab99-737829d06653 | raincross7/code-similarity | codes/train_code/problem362/problem362_286.cpp | #include<iostream>
using namespace std;
int main(){
int A1, A2, A3;
cin >> A1 >> A2 >> A3;
int A12 = (A1-A2<0 ? -(A1-A2) : A1-A2);
int A23 = (A2-A3<0 ? -(A2-A3) : A2-A3);
int A31 = (A3-A1<0 ? -(A3-A1) : A3-A1);
int min = 300;
int costs[3] = {A12, A23, A31};
for(int i=0; i<3; i++){
for(int j=0; j<3;... | ALGO | 0.99994 | 3.788221 |
f17fb212-f9a0-4079-9169-b59ee9add49b | REVANTH-2-0-0-4/dpatcoder | K_Stones.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
vector<int> moves(n);
for (int i = 0; i < n; i++)
{
cin >> moves[i];
}
vector<vector<bool>> dp(2, vector<bool>(k + 1, false));
dp[0][0] = false;
dp[1][0] = false;
// dp[i]... | ALGO | 0.999988 | 5.409051 |
23381e1b-5b41-488c-aa1f-0a48f3dcb2a3 | pquerna/nacl-cryptopp | rsa/cryptopp/emsa2.cpp | // emsa2.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "emsa2.h"
#ifndef CRYPTOPP_IMPORTS
NAMESPACE_BEGIN(CryptoPP)
void EMSA2Pad::ComputeMessageRepresentative(RandomNumberGenerator &rng,
const byte *recoverableMessage, size_t recoverableMessageLength,
HashTransformation &has... | ALGO | 0.986943 | 7.77748 |
780887b1-ce77-4689-afbb-15f427e0e9c7 | Chayakorn26082547/codeforces | Division2/CodeTon4/A.cpp | // Beautiful Sequence
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0),cin.tie(0);
int q;
cin >> q;
while(q--)
{
int n;
cin >> n;
int ch=0;
for(int i=1;i<=n;i++)
{
int num;
cin >> num;
... | ALGO | 0.999845 | 3.954837 |
568b0181-130f-45f0-b009-82c3c4e1fcb0 | ishandutta2007/codeforces | autumnkite/normal/1521/D.cpp | #include <bits/stdc++.h>
void solve() {
int n;
std::cin >> n;
std::vector<std::vector<int>> E(n);
for (int i = 0; i < n - 1; ++i) {
int u, v;
std::cin >> u >> v;
--u, --v;
E[u].push_back(v);
E[v].push_back(u);
}
std::vector<std::pair<int, int>> ans;
std::vector<std::vector<int>> G(n);
std::function... | ALGO | 0.999929 | 5.097075 |
310d165b-ceab-4c8b-a89c-5c41dd625d5d | jiyun0205/study | 백준/그리디 알고리즘/조건문/9498.cpp | #include <stdio.h>
int main()
{
int a;
scanf("%d", &a);
if(a>=0 && a < 60) printf("F");
else if(a <70) printf("D");
else if(a <80) printf("C");
else if(a <90) printf("B");
else printf("A");
return 0;
} | ALGO | 0.99952 | 3.617274 |
b502cbf4-d59c-4d35-86a3-b17618495e47 | jiraroj-wir/posn_cs-camp-1-onsite-solutions | code/green_tea.cpp | #include <stdio.h>
float smaller(float w, float s) {
return (w < s) ? w : s;
}
void green_tea(unsigned int water, unsigned int sugar) {
float w = (float)water / 250.0;
float s = (float)sugar / 15.0;
printf("%u ", (unsigned int)smaller(w, s));
if (smaller(w, s) == s && ((float)water / 250.0) != 0.0... | ALGO | 0.997223 | 3.365002 |
be55e67b-36f0-4b30-9246-ebb3e4b06dcb | IHRSI/LeetCode | 0001_Two_Sum.cpp | //Brute Force Method
class Solution {//TC=O(n^2) SC=O(1)
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int> ans;
int n=nums.size();
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(target==nums[i]+nums[j]){
ans.push_back(i)... | ALGO | 0.999917 | 6.367586 |
a3c249fa-f9d1-4e17-9536-5a2bf9439d49 | hjiang13/LLMs-in-IR | POJ-104/43/389.cpp | #include <iostream>
using namespace std;
int i,j,n;
int prime(int a)
{
for(i=2; i*i<=a; i++)
if(a%i==0) return(0);
}
int main()
{
cin>>n;
for(j=2; j<=n/2; j++)
{
if(prime(j)*prime(n-j)!=0) cout<<j<<" "<<n-j<<endl;
}
return 0;
} | ALGO | 0.999631 | 3.473017 |
0bb55a3e-aa01-4a62-a41b-ad0774dc8561 | Ishwarendra/Contests | CODEFORCES_CONTEST/Edu_151/C.cpp | #include "bits/stdc++.h"
#ifdef LOCAL
#include "F:\CPP\Debug\debug.h"
#else
#define print(...) 1;
#endif
using i64 = long long;
void solve()
{
std::string s, l, r;
int m;
std::cin >> s >> m >> l >> r;
int n = std::size(s);
if (n < m)
{
std::cout << "YES\n";
return;
}
... | ALGO | 0.999918 | 4.138157 |
ebffabcc-16a1-47d9-9fe8-0d00e2214cc6 | demilev/oop-2022-2023 | 02-higher-order-functions/solutions/task03/task03-1.cpp | #include <iostream>
/*
Напишете функция, която намира броя на четните числа в масив от цели числа
*/
int countEvens(int arr[], int size)
{
int count = 0;
for (int i = 0; i < size; i++)
{
if (arr[i] % 2 == 0)
count++;
}
return count;
}
int main()
{
int arr[] = {1, 2, 3... | ALGO | 0.99389 | 5.847946 |
b658a5bb-36b7-4f3a-9beb-af7b52825679 | minhtre2609/THCS2_Code_PTIT_Spring-2025 | C01036 - TichChuSo.cpp | #include <stdio.h>
int main()
{
int n, s = 1;
scanf("%d", &n);
while(n != 0)
{
s *= n % 10;
n /= 10;
}
printf("%d", s);
}
| ALGO | 0.999972 | 3.668037 |
6b9b7858-206f-47a0-bdad-88bb60930598 | fatemehkarimi/uvaSolutions | uva-793.cpp | //uva 793
//Network Connections
#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <queue>
using namespace std;
bool BFS(vector < vector <int> > & Graph, int start, int goal);
int main(void)
{
int T = 0;
cin >> T;
while (T--) {
int n_node = 0;
cin >> ... | ALGO | 0.999251 | 3.717395 |
69bc6d25-2a05-421b-96d7-f8e29473bff5 | pablonm3/OOP_midterm | MerkelMain.cpp | #include "MerkelMain.h"
#include <iostream>
#include <vector>
#include "OrderBookEntry.h"
#include "CSVReader.h"
#include "TimeConverter.h"
#include "LinearRegressor.h"
#include <chrono>
#include <sys/time.h>
#include <ctime>
using namespace std;
MerkelMain::MerkelMain()
{
}
void MerkelMain::init()
{
std::string... | ALGO | 0.863093 | 4.35535 |
c1d95e38-1ecf-4eed-bff7-aad4356d5072 | Daniel3886/C- | Część 3 A/zad.25.cpp | #include <iostream>
#include <windows.h>
#include <cmath>
using namespace std;
int main()
{
system("chcp 1250");
system("cls");
float a, b, c, D, x1, x2;
do{
cout << "Podaj wart wspczynnika A: ";
cin >> a;
}while(a==0);
cout << "Podaj wart wspczynnika B: ";
cin >> b;
cout << "Podaj wart wspczynnika C:... | ALGO | 0.972791 | 3.590086 |
b70e2ca1-51e1-49c2-a29e-800e8667f829 | heavenMOJANG/ICPC | .history/programmes_C_Cpp/Codeforces/CF2102/D_20250511234507.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
constexpr int N = 2e5 + 10;
int tr[N];
int lowbit(int x) { return x & -x; }
void update(int x, int n, int d) { while (x <= n) tr[... | ALGO | 0.999242 | 4.958255 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.