uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
304e2b23-9c0d-4352-a4fb-0802c5c68927 | tingting0711/algorithm1 | 0_动态规划/1019.庆功会.cpp | /*
题目描述:
为了庆贺班级在校运动会上取得全校第一名成绩,班主任决定开一场庆功会,为此拨款购买奖品犒劳运动员。
期望拨款金额能购买最大价值的奖品,可以补充他们的精力和体力。
输入格式
第一行二个数n,m,其中n代表希望购买的奖品的种数,m表示拨款金额。
接下来n行,每行3个数,v、w、s,分别表示第I种奖品的价格、价值(价格与价值是不同的概念)和能购买的最大数量(买0件到s件均可)。
输出格式
一行:一个数,表示此次购买能获得的最大的价值(注意!不是价格)。
数据范围
n≤500,m≤6000,
v≤100,w≤1000,s≤10
输入样例:
5 1000
80 20 4
40 50 9
30 50 7
40 30... | ALGO | 0.999968 | 4.269719 |
32e9626c-52aa-467b-b457-a877c450aeaa | OnMyTeam/Cpp | CppBasic/Chapter19.cpp | //Chapter19 ̱ ũ帮Ʈ2 ߰,,Ž,
#include <iostream>
#include <string.h>
using namespace std;
/*
ũ Ʈ : ڷᱸ ̴. ڷᱸ ϴ .
ũ帮Ʈ Ѽ ִ Ѵ.
ũ帮Ʈ ϱ Ѵ. Ư¡
带 ְ ȴ.( ּҸ Ѵٴ ǹ)
Ʈ vs 迭 : Ʈ Ǿִ. 迭ó Ư ҿ ٷ Ұϴ.
տ ʴ Ÿ Ѵ.
... | TOOL | 0.940348 | 3.735486 |
d267971a-ed8f-455e-be7f-595917b13854 | qq734628996/ac-code | UVA/12265/14638356_AC_80ms_0kB.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,l,r) for(int i = l; i <= r; i++)
#define TR(e,x) for(auto e = x.begin(); e != x.end(); e++)
#define DEBUG(x) cout << #x << "=" << x << endl;
#define SHOW1(A,n) { REP(i,n-1) printf("%d ", A[i]); printf("%d\n", A[n-1]... | ALGO | 0.99948 | 3.00544 |
12f1d249-a3ec-4f79-8aaf-09f8a54538bb | ishandutta2007/codeforces | sooke/normal/1015/C.cpp | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#define SQR(x) ((x) * (x))
#define ABS(x) ((x) < 0 ? -(x) : (x))
#define LOWBIT(x) ((x) & -(x))
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define SWAP(x, y) ((x) ^... | ALGO | 0.999993 | 3.946742 |
b0127b32-7f92-4710-acea-977aa8f80101 | kantv-ai/kantv | core/ncnn/ncnn-src/src/layer/mips/concat_mips.cpp | #include "concat_mips.h"
namespace ncnn {
Concat_mips::Concat_mips()
{
#if __mips_msa
support_packing = true;
#endif // __mips_msa
}
int Concat_mips::forward(const std::vector<Mat>& bottom_blobs, std::vector<Mat>& top_blobs, const Option& opt) const
{
int dims = bottom_blobs[0].dims;
int positive_axis = ... | ALGO | 0.950313 | 5.601977 |
3bb6c8f6-deb7-4203-81c9-33535f1e3549 | ishandutta2007/codeforces | rainair/normal/1110/A.cpp | #include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define fi first
#define lc (x<<1)
#define se second
#define U unsigned
#define rc (x<<... | ALGO | 0.999904 | 3.724781 |
9eb40a86-dc43-4cd1-9ee9-e7ec38f9edaf | raincross7/code-similarity | codes/train_code/problem238/problem238_366.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;
vector<int> g[200005];
int d[200005];
void dfs(int x, int p) {
for (int i : g[x]) if (i != p) {
d[i] += d[x];
... | ALGO | 0.99992 | 4.318388 |
ecc465ae-cc97-4c17-acf5-1ba5903638f9 | theadeshkhanna/DSA-Practice | Insert a node in a BST - GFG/insert-a-node-in-a-bst.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
Node(int val) {
data = val;
left = right = NULL;
}
};
Node* insert(Node* node, int data);
// Function to Build Tree
Node* b... | ALGO | 0.999888 | 6.510592 |
51231b70-233d-48a7-a514-b954ed7367a8 | meilleur777/Competitive_Programming | BOJ/cpp/16198.cpp | #include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
using namespace std;
ll ans=0;
void sol(ll now, vector<int> w) {
int siz=w.size();
if (siz==2) {
ans=max(ans, now);
return;
}
for (int i=1; i<siz-1; i++) {
vector<int> tmp;
rep(j, siz) {
if (j==i) continue;
tmp.push_back(w[j]);
}
... | ALGO | 0.999948 | 3.622055 |
26737eab-f4ee-46b2-9727-f265b71d14d4 | AdhishthanAshok/C-COURSE | C++ Course/debug.cpp | #include <bits/stdc++.h>
#include <vector>
using namespace std;
int main()
{
vector<int> a{1, 2, 3, 4, 5};
for (auto &i : a)
{
cout << i << " ";
}
return 0;
} | ALGO | 0.987268 | 3.640651 |
d6e9caf5-d9ed-4c95-9d94-cc801b1d3afe | prince367/TOPIC_WISE_PRACTICE_OF_ALGO-S | BINARY_SEARCH/up_bound.cpp | //PRINCE
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define per(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define ll long long int
typedef vector<ll> vll;
typedef vector<int> vii;
#define M... | ALGO | 0.999977 | 5.207248 |
149601fb-f9dc-4c84-8d0d-49b19e7a3dde | ishandutta2007/codeforces | rivalq/normal/1209/E2.cpp | // Jai Shree Ram
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ll long long
#define int long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define endl "\n"
#define x first
#define y ... | ALGO | 0.999988 | 3.846161 |
14095976-06bd-45d7-b786-79f1cc8020fc | antep2727/CSGO-Source-Fixed-Search | studiorender/r_studiodecal.cpp | #include "studiorender.h"
#include "studiorendercontext.h"
#include "materialsystem/imaterialsystem.h"
#include "materialsystem/imaterialsystemhardwareconfig.h"
#include "materialsystem/imesh.h"
#include "materialsystem/imaterial.h"
#include "mathlib/mathlib.h"
#include "optimize.h"
#include "cmodel.h"
#include "materi... | TOOL | 0.917194 | 5.949314 |
266b24c0-93cd-4d35-a5c4-a532a7b15a2a | openjdk/jdk21 | src/hotspot/share/opto/mulnode.cpp | #include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
#include "opto/addnode.hpp"
#include "opto/connode.hpp"
#include "opto/convertnode.hpp"
#include "opto/memnode.hpp"
#include "opto/mulnode.hpp"
#include "opto/phaseX.hpp"
#include "opto/subnode.hpp"
#include "utilities/powerOfTwo.hpp"
// Portions of co... | ALGO | 0.986712 | 7.216741 |
35165165-c811-4b41-9985-e0d79f39ca54 | meghjoshii/Advanced-Algortithms-Lab | lab4a1b.cpp | #include <bits/stdc++.h>
using namespace std;
#define ROW 5
#define COL 5
int isSafe(int M[][COL], int row, int col,
bool visited[][COL])
{
return (row >= 0) && (row < ROW) && (col >= 0) && (col < COL) && (M[row][col] && !visited[row][col]);
}
void DFS(int M[][COL], int row, int col,
... | ALGO | 0.999945 | 5.922188 |
222b77c2-1837-42d4-a752-00d488b573d4 | AravJain007/DSA-CPP | BACTRACKING/RatInAMaze.cpp | #include <bits/stdc++.h>
using namespace std;
bool isSafe(int **arr, int x, int y, int n)
{
if (x < n && y < n && arr[x][y] == 1)
{
return true;
}
return false;
}
bool ratInMaze(int **arr, int x, int y, int n, int **solArr)
{
if (x == n - 1 && y == n - 1)
{
solArr[x][y] = 1;
... | ALGO | 0.999927 | 4.919739 |
8f80d10e-50bd-4719-8e22-e36834ee82fc | Prahmodh-Raj1/DSA-Solutions | Dynamic Programming/DP on strings/Extra characters in a string.cpp | //Problem link: https://leetcode.com/problems/extra-characters-in-a-string/
//TC: O(N^2) SC:O(N)
class Solution {
private:
unordered_map<string,int> mp;
int func(string& s,vector<string>& dictionary,int ind,vector<int>& dp){
if(ind>=s.size()) return 0;
if(dp[ind]!=-1) return dp[ind];
str... | ALGO | 0.999148 | 5.841627 |
7d4136da-ff4e-4937-bfec-0a4bf92fbfec | aniljoshi89/dsaassignment | DSA Assignment/Q1.cpp | #include<iostream>
using namespace std;
void Nearestgreater(int arr[], int n){
for(int i = 0; i<n; i++){
for(int j =i+1; j<n; j++){
if(arr[i]<arr[j]){
arr[i] = arr[j];
break;
}
}
}
for(int i =0; i<n; i++){
cout<<arr[i]<<" ";
}
}
int main(... | ALGO | 0.999941 | 3.778509 |
635e0788-a016-4fbe-87d7-f00be3a54c1a | danadrianmirea/matplotplusplus | examples/line_plot/stairs/stairs_2.cpp | #include <cmath>
#include <matplot/matplot.h>
int main() {
using namespace matplot;
auto X = linspace(0, 4 * pi, 40);
std::vector<std::vector<double>> Y(2);
Y[0] = transform(X, [](double x) { return 0.5 * cos(x); });
Y[1] = transform(X, [](double x) { return 2 * cos(x); });
figure();
stai... | ALGO | 0.960312 | 3.927909 |
155081c6-23a6-4b7e-b70b-704d5e25113f | piyushsachdeva/Dotnet | snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp |
// <Snippet1>
using namespace System;
using namespace System::Reflection;
ref class MyFindMembersClass
{
public:
static void Test()
{
Object^ objTest = gcnew Object;
Type^ objType = objTest->GetType();
array<MemberInfo^>^arrayMemberInfo;
try
{
//Find all static or... | TOOL | 0.945856 | 7.080605 |
8616b603-691e-4291-afb9-5d39a6c93815 | PolRecasensSarra/Box2D | Physics2_class3 - handout/Box2D/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp | #include <Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h>
#include <Box2D/Common/b2BlockAllocator.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <new>
b2Contact* b2PolygonAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
{
void* mem = allocator->All... | ALGO | 0.952435 | 7.287668 |
c8248bf0-a55b-4722-bf91-bb0e98f3b435 | hkirsman/hhvm_centos7_builds | hphp/runtime/ext/hash/hash_gost.cpp | #include "hphp/runtime/ext/hash/hash_gost.h"
#include "hphp/runtime/ext/hash/php_hash_gost_tables.h"
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
typedef struct {
unsigned int state[16];
unsigned int count[2];
unsigned char length;
unsigned char buffer[32];
... | ALGO | 0.952554 | 7.106559 |
e57d3fdb-a486-4fd0-ba05-723f2872a36b | teche74/Daily_Practise | 3235-minimum-cost-to-convert-string-i/3235-minimum-cost-to-convert-string-i.cpp | class Solution {
public:
vector<vector<pair<int, int>>> graph;
const int INF = 1000000000;
int dist[26][26];
void floydWarshall() {
for (int i = 0; i < graph.size(); i++) {
for (int j = 0; j < graph[i].size(); j++) {
dist[i][graph[i][j].first] = min(graph[i][j].second , dist[... | ALGO | 0.999984 | 5.362072 |
24e8b79e-421a-4dac-a006-e1d0005e3cae | kamyu104/LeetCode-Solutions | C++/remove-max-number-of-edges-to-keep-graph-fully-traversable.cpp | // Time: O(n + m * α(n)) ~= O(n + m)
// Space: O(n)
class Solution {
public:
int maxNumEdgesToRemove(int n, vector<vector<int>>& edges) {
int result = 0;
UnionFind union_find_a(n), union_find_b(n);
for (const auto& edge : edges) {
int t = edge[0], i = edge[1], j = edge[2];
... | ALGO | 0.999921 | 6.112973 |
536ac825-8747-4365-bffc-8a8ee7e9b3e0 | Gnaroshi/practice-algorithm-solvedac | With_Levels/Bronze/Bronze_3/22123.cpp | // problem: Экзамен
// id: 22123
// time taken:
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int tc;
cin >> tc;
while (tc--)
{
int h1, m1, s1, h2, m2, s2, k;
string ss, sf;
cin >> ss >> sf >> k;
h1 ... | TEST | 0.923616 | 4.85562 |
1d248fb0-29aa-4485-9f98-f40956c6ab26 | AbdulShabazz/Boost-MultiprecisionIntegerLibrary-CPP20BigInt | libs/compute/perf/perf_includes.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/includes.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int ... | ALGO | 0.987961 | 5.768701 |
b96ac779-2632-4565-ac87-e6ce3768f4ad | Lalucazstello/c- | bab-4/switch.cpp | /******************************************************
Nama file: switch.cpp
*******************************************************/
#include <iostream>
#include <string> // std::string
#include <cstdlib> // exit()
int main() {
int noHari;
std::string namaHari;
std::cout<<"Masukkan nomor hari: ";
... | TOOL | 0.925943 | 4.074601 |
127dcf6a-3132-4a06-ae2d-3ff02f8c7413 | Ishu-sri-001/DSA | Bit Manipulation/SingleNo3.cpp | // https://leetcode.com/problems/single-number-iii/
class Solution {
public:
vector<int> singleNumber(vector<int>& n) {
int ans=0;
for (auto i:n)
ans^=i;
int lst=1;
while((lst & ans)==0)
lst<<=1;
int g1=0,g2=0;
for (auto i:n)
{
... | ALGO | 0.999919 | 5.336783 |
1da17641-cbb2-48cf-bfe8-fc353bb728b3 | pavellevap/code_antiplagiat | final_test/19/u69675_475_C_8090034.cpp | // iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_T... | ALGO | 0.999811 | 3.637173 |
82159531-e020-4ab5-b1c9-40f77a494187 | huhkyun1275/boost_realize | libs/hana/benchmark/reverse/nomove.fusion.vector.erb.cpp | <% if input_size > 10 %>
#define FUSION_MAX_VECTOR_SIZE <%= ((input_size + 9) / 10) * 10 %>
<% end %>
#include <boost/fusion/include/as_vector.hpp>
#include <boost/fusion/include/make_vector.hpp>
#include <boost/fusion/include/reverse.hpp>
#include "measure.hpp"
#include <cstdlib>
#include <string>
#include <util... | ALGO | 0.882981 | 4.506452 |
9ecd1c33-9068-43e4-acbe-f396d8e60f09 | thepratholic/Competitive-Programming | Codeforces/practice problems/C_Copil_Copac_Draws_Trees.cpp | // Choose cpp when the time
// limit will for sure give tle in pypy
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF LLONG_MAX
#define fastio ios::sync_with_stdio(false); cin.tie(0);
#define print(arr) for (auto it : arr){cout<<it<<" ";}cout<<endl;
#define len(arr) arr.size()
#define prin... | ALGO | 0.999393 | 5.749905 |
f0b6f963-a214-4e46-b313-b089331d788b | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_11512_14.cpp | #include <bits/stdc++.h>
using namespace std;
int tem[200005];
priority_queue<int, vector<int>, greater<int> > pq;
int main() {
int n, k;
scanf("%d %d", &n, &k);
int cnt = 0;
for (int i = 1; i <= n; i++) {
scanf("%d", &tem[i]);
if (tem[i] < 0) cnt++;
}
if (cnt > k) {
puts("-1");
return 0;
... | ALGO | 0.999984 | 3.876422 |
49562761-9f2f-44e1-8247-720cd123b0ba | StefanPas/Cplusplus | Task2_exam_21082016/QuadraticEquation.cpp | //
// QuadraticEquation.cpp
// Task2_exam_21082016
#include "QuadraticEquation.hpp"
void QuadraticEquation::findRootsAndPrint(float aDeterminant)
{
float x1, x2;
if (aDeterminant > 0) {
x1 = (-_b + sqrt(aDeterminant)) / (2*_a);
x2 = (-_b - sqrt(aDeterminant)) / (2*_a);
printf("%.2f.2... | ALGO | 0.990886 | 4.564179 |
ec49c6f6-f60a-494c-84d6-7bc00080c642 | gg-fu/ncnn-arm | src/layer/argmax.cpp | #include "argmax.h"
#include <algorithm>
#include <functional>
namespace ncnn {
DEFINE_LAYER_CREATOR(ArgMax)
ArgMax::ArgMax()
{
}
int ArgMax::load_param(const ParamDict& pd)
{
out_max_val = pd.get(0, 0);
topk = pd.get(1, 1);
return 0;
}
int ArgMax::forward(const Mat& bottom_blob, Mat& top_blob) const
... | DATA | 0.995166 | 5.860263 |
d218369a-6625-49dc-827a-857aa2a3d7b6 | CodeTrans-Research/RefuTra | dataset/java2cpp2(BatFix)/cpp/NUMBER_RECTANGLES_NM_GRID.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( int n, int m ) {
return ( m * n * ( n + 1 ) * ( m + 1 ) ) / 4;
}
//TOFILL
int main() {
int n_success = 0;
vector<int> param0 {86,33,3,91... | TEST | 0.998145 | 5.08138 |
93043e27-f6cf-4b0f-9f41-684bf1c32d31 | dmazurki/AAL_Project | src/Presentation/Application.cpp | /**
* author: Damian Mazurkiewicz
*/
#include <iostream>
#include <iomanip>
#include <cmath>
#include "Application.h"
#include "../Algorithms/InputDataGenerator.h"
Application::Application(const Options & options_)
:options(options_)
{
if(options.getBool("list_steps"))
Algorithm::setRememberingSteps(true... | ALGO | 0.995157 | 5.359261 |
28249042-a592-4120-92c9-e3315f1d9a99 | Zhouyakai/yolov5_orb2 | Thirdparty/DBoW2/DBoW2/FORB.cpp | #include <vector>
#include <string>
#include <sstream>
#include <stdint-gcc.h>
#include "FORB.h"
using namespace std;
namespace DBoW2 {
// --------------------------------------------------------------------------
const int FORB::L=32;
void FORB::meanValue(const std::vector<FORB::pDescriptor> &descriptors,
FOR... | ALGO | 0.994064 | 6.532464 |
b26530d5-0675-48fd-a5bd-a3b31b88ed6d | DESPEL/code | cpp/stripcomments.cpp | // https://www.codewars.com/kata/strip-comments/javascript
#include <iostream>
#include <string>
#include <vector>
using namespace std;
template <typename T>
istream &operator>>(istream &in, vector<T> container) {
T temp;
for (int i = 0; i < container.size(); i++) {
cin >> temp;
container[i] =... | ALGO | 0.999387 | 4.493479 |
19c1cde0-c458-48da-b402-40c00ba58757 | cmtsij/Vizio_XWR100_GPL | GTK/user/tools/lzma457/CPP/7zip/UI/Common/UpdatePair.cpp | // UpdatePair.cpp
#include "StdAfx.h"
#include <time.h>
#include "Common/Defs.h"
#include "Common/Wildcard.h"
#include "Windows/Time.h"
#include "UpdatePair.h"
#include "SortUtils.h"
using namespace NWindows;
using namespace NTime;
static int MyCompareTime(NFileTimeType::EEnum fileTimeType,
const FILETIME &t... | TOOL | 0.960077 | 6.258458 |
8c0a65ca-50fc-4611-bd55-9061c706d38a | FalseF/Problem-Solving | UVa/10583 Ubiquitous Religions.cpp |
/*######## IN THE NAME OF ALLHA ##########*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 999999999999999999
#define nl cout<<endl
#define r0 return 0
#define r1 return 1
#define sf1(x) scanf("%lld",&x)
#define sf2(x,y) scanf("%lld %lld",&x,&y)
#define sf3(x,y,z) scanf("... | ALGO | 0.999433 | 3.526326 |
b9711779-e7db-4a4e-b698-eccc80af6912 | MeDGranD/MAI_OOP | lab1/src/Solution.cpp | #include "../include/Solution.hpp"
namespace lab1{
std::pair<int, int> Solution::closest_pair_tonum(int64_t upper_limit){
for (int64_t i = upper_limit - 1; i > 0; --i) {
for (int64_t j = i - 1; j > 0; --j) {
double sqrt1 = sqrt(i + j);
double sqrt2 = sqrt(i - ... | ALGO | 0.99985 | 4.460716 |
e55d2520-c444-4532-a8df-76f513b61382 | Pierre-Terdiman/PEEL_PhysX_Edition | PEEL_Externals/5_6_0_GitHub/source/geomutils/src/sweep/GuSweepCapsuleTriangle.cpp | #include "GuSweepCapsuleTriangle.h"
#include "GuIntersectionCapsuleTriangle.h"
#include "GuDistanceSegmentTriangle.h"
#include "GuIntersectionTriangleBox.h"
#include "GuSweepSphereTriangle.h"
#include "GuInternal.h"
using namespace physx;
using namespace Gu;
using namespace aos;
#define COLINEARITY_EPSILON 0.00001f
... | ALGO | 0.997998 | 7.62701 |
11c89376-d936-4967-b93b-627b13a9ba69 | arafe-zawad-sajid/Competitive_Programming | cpp/uva/uva 11332_MethodA.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int n2=0,n3=0,x=0,sum=0;
while(cin>>n){
if(n!=0){
while(n!=0){
x=n%10;
sum=sum+x;
n=n/10;
}
n2=sum;
sum=0;
x=0;
if(n2<=9){
cout<<n2<<endl;
break;
}
else if(n2>9){
while(n2!=0){
x=n2%10;
sum=sum... | ALGO | 0.999924 | 4.182753 |
279b4520-84d6-45c8-b31b-aae5a75bd923 | RTcmix/RTcmix | insts/jg/NPAN/speakers.cpp | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <float.h> // for DBL_MAX
#include <ugens.h>
#include "speakers.h"
#define MIN_DISTANCE_FACTOR 0.25 // distance of 0.25 quadruples gain
#define TWO_PI (M_PI * 2.0)
static int _num_speakers = 0;
static Speaker **_speakers;
S... | TOOL | 0.886847 | 4.44825 |
65e1906f-a950-4df5-a946-cecd120ae4c0 | neko-nyaa/CompetitiveProgramming | SPOJ/QTREE5.cpp | /*
https://www.spoj.com/problems/QTREE5/
- This is a rather hectic problem. But probably a classic on centroid decomposition.
- Okay, so of course we know this problem is centroid decomp. But how to apply so?
- Here is a good tutorial on centroid decomp:
https://medium.com/carpanese/an-illustrated-introductio... | ALGO | 0.999866 | 5.36664 |
608a119d-aabb-4906-99aa-32c3949f7e5a | afrojaarupa/XPSC | Week 16/Practice Sliding Window/B_Number_of_Smaller.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int n, m;
cin >> n >> m;
ll a[n], b[m];
for(int i = 0; i < n; i++) cin >> a[i];
for(int i = 0; i < m; i++) cin >> b[i];
int l = 0, r = 0, cnt = 0;
while(r < m)
{
if(l < n && a[l] < b[r])
{... | ALGO | 0.99999 | 3.480672 |
1dec3820-7ae7-44cb-8e22-b6d78b48932a | ishandutta2007/codeforces | flying2018/normal/19/E.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 100010
#define D 21
using namespace std;
int nxt[N<<1],to[N<<1],id[N<<1],head[N],cnt;
void add(int u,int v,int id1){nxt[++cnt]=head[u];to[cnt]=v;id[cnt]=id1;head[u]=cnt;}
int f[N][D],rfa[N],dep[N];
bool vis[N];
void dfs(int u,int fa)
{
... | ALGO | 0.999985 | 3.915246 |
6d3bfc78-5218-4046-ab31-7d6e80660a64 | YoungseokCh/problem-solving | baekjoon/1916.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __prin... | ALGO | 0.999982 | 4.362812 |
5b41fa39-1f31-42e8-8e13-801f4343236c | raturayya/modul9-strukdat | guided-2.cpp |
#include <iostream>
using namespace std;
// PROGRAM BINARY TREE
// Deklarasi Pohon
struct Pohon
{
char data;
Pohon *left, *right, *parent; // pointer
};
// pointer global
Pohon *root;
// Inisialisasi
void init()
{
root = NULL;
}
bool isEmpty()
{
return root == NULL;
}
Pohon *newPohon(char data)
{
... | ALGO | 0.99595 | 3.853014 |
5df073ca-200c-4463-81a0-3558781d365b | tyask/procon | atcoder/misc/aising2019/1/aising2019/C/main.cpp | #include <bits/stdc++.h>
namespace {
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wsign-compare"
#define overload4(_1,_2,_3,_4,n... | ALGO | 0.999959 | 4.307447 |
cb875c71-4da4-49cc-a512-87b148724c8e | alexandraback/datacollection | solutions_5731331665297408_0/C++/XraY/main.cpp | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <ctime>
using namespace std;
#ifdef WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
typedef... | ALGO | 0.999928 | 3.959388 |
165fadbb-6f40-4660-948d-08d42a898efd | yashswag22/Striver-A-to-Z-DSA-sheet | Stack and Queues [Learning, Pre-In-Post-fix, Monotonic Stack, Implementation]/1. Learning/Stack Extra questions/Make the array beautiful [ gfg ] (solved watching solution).cpp | class Solution {
public:
vector<int> makeBeautiful(vector<int> arr) {
stack<int>s;
for(int i=0;i<arr.size();i++){
if(s.empty()) s.push(arr[i]);
else{
if(arr[i]>=0 && s.top()>=0) s.push(arr[i]);
else if(arr[i]>=0 && s.top()<0) s.pop();
... | ALGO | 0.999977 | 5.881919 |
209c5512-be47-42e9-a71b-7734ab7fa302 | Taha-Adeel/CP | Codeopardy/A_Blocks.cpp | #include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0)
template<class T> struct V: vector<T>{using vector<T>::vector;
void sort() {std::sort(this->begin(), this->end());}
void sort_dsc() {std::sort(this->begin(), this->end(), greater<T>());}
auto sum() {T sum = 0; for(... | ALGO | 0.999953 | 3.79572 |
e538ca36-52b6-4318-a3bb-6557d2c48f1a | gomster96/Byungwoong_Algorithm | lecture/DP_5.cpp | #include<bits/stdc++.h>
using namespace std;
#define mine
#ifdef mine
int main(){
ios_base::sync_with_stdio(false);
freopen("input.txt","rt",stdin);
int n, res = 0;
cin >> n;
vector<int> arr(n+1), dy(n+1);
for(int i=1; i<=n; i++){
cin >> arr[i];
}
dy[1] = 1;
for(int i=2; i... | ALGO | 0.999973 | 4.535963 |
86fceb15-1533-49a5-9842-169b56a33d0e | Couto1411/Submatrix_Multiplication | src/hash.cpp | #include "hash.hpp"
void criaHash(Table** t,int tam){
(*t) = new Table;
(*t)->quantidade = 0;
(*t)->collisions =0;
(*t)->tamanho = proxPrimo(2*tam);
(*t)->table = new Entry*[(*t)->tamanho];
for (int i = 0; i < (*t)->tamanho; i++)
(*t)->table[i]= nullptr;
}
void insertHash(Table* t, int **multiplica... | ALGO | 0.992779 | 3.982614 |
361e7a0f-5b3e-43df-939c-fd553854d3a3 | kiwibang/kattis-uva | uva01339.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string a, b;
while (true) {
// read in the two lines. a is the encrypted text, b is the decrypted text
cin >> a >> b;
if (cin.eof()) {
break;
}
// then count the frequency of the letters using frequen... | ALGO | 0.999992 | 4.683968 |
68403876-195d-475c-a788-86a7012e0f6a | Shubhada249/DSA | Tree/Balanced Binary Tree.cpp | //https://leetcode.com/problems/balanced-binary-tree/
//TC:O(2n) //SC:o(2n)
bool fun(TreeNode* root,unordered_map<TreeNode*,int> &mp)
{
if(!root)
return true;
if(fun(root->left,mp) && fun(root->right,mp) && abs(mp[root->left]-mp[root->right])<=1)
return true;
retur... | ALGO | 0.999869 | 6.393628 |
dd8eed9d-dc4e-4826-96e7-d2177f27dcf5 | murrayismemelai/Leetcode_practice | Daily/200.number-of-islands.cpp | /*
* @lc app=leetcode id=200 lang=cpp
*
* [200] Number of Islands
*/
// @lc code=start
class Solution {
public:
int numIslands(vector<vector<char>>& grid) {
int m = grid.size(), n = grid[0].size();
int res = 0;
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
... | ALGO | 0.999981 | 6.828249 |
86844bc5-ef10-498d-80ca-c878f81e23f3 | slitvinov/lammps-swimmer | src/USER-EFF/compute_temp_deform_eff.cpp | /* ----------------------------------------------------------------------
Contributing author: Andres Jaramillo-Botero (Caltech)
------------------------------------------------------------------------- */
#include "mpi.h"
#include "math.h"
#include "string.h"
#include "compute_temp_deform_eff.h"
#include "domain.h... | ALGO | 0.997152 | 6.839471 |
2dc44cd7-5441-49c1-a722-a5da9bf5304f | gabrielfelipedy/relatorio-progII | quicksort/graph_quick_sort_pr_d.cpp | #include <cstdio>
#include <sys/time.h>
#include <time.h>
#include <cstdlib>
#include <vector>
#include <iostream>
#include "matplotlibcpp.h"
#include "utils.h"
namespace plt = matplotlibcpp;
int main() {
//srand(time(NULL));
std::vector<double> times;
times = abreArquivo(times, "quick_sort_pr_d.txt");
plt::plo... | ALGO | 0.986169 | 3.999995 |
9f045bd0-7094-40b4-971e-591865e57f9a | st117215/2023-cpp-autumn | 2023.10.10-homework-4/Project7/Source.cpp | #include<iostream>
#include<cstdlib>
int main(int argc, char**)
{
int n = 0;
int a = 0;
std::cin >> n;
int** b = (int**)malloc(sizeof(int*) * n);
int m = n - 1;
for (int i = 0; i < n; i++) {
*(b + i) = (int*)malloc(sizeof(int) * m);
}
for (int i = 0; i < n; i++) {
std::cin >> a;
*(*(b + i)) = a;
}
int ... | ALGO | 0.999984 | 3.166773 |
6518686a-a817-41f7-a2ed-d8966d39660a | jonathanturner/createproglang | sifula/parser.cpp | #include <iostream>
#include <map>
#include "node.hpp"
#include "parser.hpp"
void debug_print(NodePtr node, const std::string &prepend) {
std::cout << prepend << node->text << ": " << node->type << std::endl;
for (unsigned int i = 0; i < node->children.size(); ++i) {
debug_print(node->children[i], pre... | ALGO | 0.908293 | 5.918564 |
3b4282f5-d051-4d60-8b76-25721893da85 | mwy3055/Algorithm-codes | baekjoon/cpp/c++/17371.cpp | #include <bits/stdc++.h>
const int INF = 1 << 30;
struct point
{
int x, y;
point(int x = 0, int y = 0) : x(x), y(y) {}
bool operator==(const point p)
{
return (this->x == p.x) && (this->y == p.y);
}
};
// 점 a와 b 사이의 거리
int get_dist_sq(point &a, point &b)
{
int dx = a.x - b.x, dy = a.y... | ALGO | 0.999963 | 5.125911 |
9d687501-08fc-46fc-9875-9a82eaeffa2d | Nakib-Arman/CSE318---ArtificialIntelligence | 4.DecisionTree/.history/decision_tree_20250706123825.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
int column_num;
string label;
unordered_map<string,Node*> children;
Node* parent;
public:
Node(int column_num){
this->column_num = column_num;
this->parent = NULL;
this->label = "";
}
Node(string label){
... | ALGO | 0.998364 | 5.125621 |
3a9b98b8-0aec-4c66-86bb-80645ff36b02 | Longseabear/AlgorithmStudy | 1322.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
long long x, k, y;
int main() {
scanf("%lld%lld", &x, &k);
for (int i = 0, j = 0; j < 32; i++, j++) {
while ((1LL << i) & x)
i++;
if ((1LL << j) & k)
y += (1LL << i);
}
printf("%lld\n", y);
return 0;
}
| ALGO | 0.999931 | 3.746997 |
abd146b5-2e27-4c24-a378-553ac52d48ee | CodeBySushant/SolvedLeetcode | leetcode-main/leetcode-main/solution/1700-1799/1791.Find Center of Star Graph/Solution.cpp | class Solution {
public:
int findCenter(vector<vector<int>>& edges) {
int a = edges[0][0], b = edges[0][1];
int c = edges[1][0], d = edges[1][1];
return a == c || a == d ? a : b;
}
}; | ALGO | 0.999942 | 5.759261 |
44968824-ab37-4291-948c-d0cc341cce11 | xtf0214/CPP | Contest/ZZUIL/郑轻校赛2023/end/5.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
char s[200006];
inline void check() {
for (int i = n; i >= 1; i--) {
if (s[i] > 'z')
s[i] = 'a', s[i - 1] += 1;
else
break;
}
}
int main() {
cin >> n;
scanf("%s", s + 1);
int ok = 0;
for (int i = n; i... | ALGO | 0.999979 | 4.088248 |
11de0c52-9a6b-4733-9f41-702ca13ef246 | MUMINUR-RASHID/WEEKLY-PRACTICE | WEEK-2/A_YES_or_YES.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t; cin>>t;
while(t--)
{
string s;
cin>>s;
transform(s.begin(),s.end(),s.begin(), ::toupper);
if(s=="YES") cout<<s<<endl;
else cout<<"NO"<<endl;
}
} | ALGO | 0.999755 | 4.537497 |
734c95c4-4bbd-4835-9353-7920d833a928 | ishandutta2007/codeforces | peti1234/normal/1119/D.cpp | #include <bits/stdc++.h>
using namespace std;
long long n;
long long t[100001];
long long kom[100001];
vector<long long> d;
long long q;
long long ker(long long x)
{
long long a=0, b=n;
while(b-a>1) {
long long c=(a+b)/2;
if (d[c]<=x) {
a=c;
} else {
b=c;
... | ALGO | 0.99982 | 3.817143 |
ffe8186c-0d83-4b38-b895-aeec00328e1e | maryskar/spbspu-labs-2023-aads-904-a | hrushchev.nikita/FA/convertinfixtopostfix.cpp | #include "convertinfixtopostfix.hpp"
#include <string>
#include <stdexcept>
#include <avltree.hpp>
#include "queue.hpp"
#include "stack.hpp"
namespace hrushchev
{
int getOperatorPriority(const std::string& op)
{
if (op == "*" || op == "/" || op == "%" || op == "sin" || op == "cos")
{
return 2;
}
... | ALGO | 0.990115 | 5.821733 |
119a123e-fe2d-48f2-be4b-55a207182bb8 | CGAL/cgal | Minkowski_sum_2/examples/Minkowski_sum_2/sum_with_holes.cpp | //! \file examples/Minkowski_sum_2/sum_with_holes.cpp
// Computing the Minkowski sum of two non-convex polygons read from a file.
#include <fstream>
#include <CGAL/minkowski_sum_2.h>
#include "bops_linear.h"
#include "pgn_print.h"
int main(int argc, char* argv[])
{
// Open the input file and read the two polygons... | ALGO | 0.981431 | 6.076235 |
01e77596-0329-49db-964c-04d305a3c072 | hellocomrade/happycoding | tree/BinaryTreeTraversal.cpp | #include <cassert>
#include <vector>
#include <stack>
#include <queue>
#include <iostream>
#include "tree.h"
using namespace std;
/*
* Iterative Preorder Traversal is the simplest among three.
* Push head onto stack to form a non-empty stack to start the loop
* Take the top elem from stack then pop it, visit it
*... | ALGO | 0.999471 | 6.035438 |
e2cc8709-fe98-4eab-9e0a-029aebf5bd3d | mt-revolution/Competition | Atcoder/ABC176A.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int N,X,T;
cin >> N >> X >> T;
if(N%X == 0) {
cout << (N/X) * T << endl;
} else {
cout << (N/X + 1) * T << endl;
}
return 0;
} | ALGO | 0.999808 | 3.644894 |
b6a8d474-90b2-4216-bc86-81216459595a | waura/frayer | 3rdparty/OpenCV-2.3.0/samples/cpp/3calibration.cpp | /*
* 3calibration.cpp -- Calibrate 3 cameras in a horizontal line together.
*/
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdio.h>
#include <string.h>
#include <time.h>
using namespace cv;
using namespace std;
enum { DETECTION = 0... | TOOL | 0.995856 | 5.21096 |
5caf18ea-c9d3-42e9-a667-38da45abf6b0 | dianyunPCL/OpenSourceCode | pcl-master/pcl-master/cuda/apps/src/kinect_segmentation_planes_cuda.cpp | #include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <boost/shared_ptr.hpp>
#include <pcl/cuda/features/normal_3d.h>
#include <pcl/cuda/time_cpu.h>
#include <pcl/cuda/time_gpu.h>
#include <pcl/cuda/io/cloud_to_pcl.h>
#include <pcl/cuda/io/extract_indices.h>
#include <pcl/cuda/io/disparity_to_cloud.h>
#i... | ALGO | 0.969367 | 5.361208 |
056fdc38-dc09-4569-a668-701e51f2a421 | Keshavtiwari07/leetcode-problems | hieght checker.cpp | class Solution {
public:
int heightChecker(vector<int>& heights)
{
vector<int> temp(heights.begin(), heights.end());
sort(temp.begin(), temp.end());
int ans=0;
for(int i=0; i<heights.size(); i++)
{
if(heights[i] != temp[i])
{
ans... | ALGO | 0.999892 | 5.798052 |
1563c6d6-4224-448e-a980-f9048314c480 | hyeonjeongs/Algorithm | implementation/kakao1.cpp | #include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
/*
* 1. 서로 선물 주고 받은 경우
* 선물 더 많이 준애가 받기
* 2. 서로 주고 받은 기록 없는 경우
* 선물 지수 큰사람이 받기 (선물 지수 = 준 선물 - 받은 선물)
* -> 선물 가장 많이 받은 친구가 받은 선물 수
*
* gift -> [선물 준 친구, 선물 받은 친구]
*/
int exchan... | ALGO | 0.999869 | 5.146183 |
2fa50840-47c0-4030-b6b9-de96f4137f2f | Seann0425/LeetCode | finished/2087. Minimum Cost Homecoming of a Robot in a Grid.cpp | #include <bits/stdc++.h>
using namespace std;
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) {}
};
struct TreeNode {
int val;
TreeNode *left;
TreeNode *righ... | ALGO | 0.999921 | 4.719154 |
f8bdda46-47bf-4563-ba2d-08c1f12ded78 | uchihadark/CloneForces-My-Submissions | 1669/C.cpp | #include <bits/stdc++.h>
const long long mod = 1e9 + 7;
#define int long long
#define pi pair<int,int>
#define vi vector<int>
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define TIME cerr <... | ALGO | 0.999825 | 4.500762 |
35f3a1e9-f359-4b8e-bea9-bf4dcd00fac6 | KennyHacrt/Cpp-self-practice | Find Max and Min num.cpp | #include <iostream>
using namespace std;
int main(){
double temp=0;
double element[2]={};
for (int i=1;i<=5;i++){
cout<<"Enter element "<<i<<": ";
cin>>temp;
if (i==1){
element[0]=temp;
element[1]=temp;
}
if (temp>element[0]){
ele... | ALGO | 0.999228 | 3.456537 |
23ec43be-1a1c-45c9-8154-319c99253e6d | Exadios/Bayes- | BayesFilter/SIRFlt.cpp | /*
* Sampling Importance Resampling Filter.
*
* Bootstrap filter (Sequential Importance Resampling).
*/
#include "SIRFlt.hpp"
#include "matSup.hpp"
#include "models.hpp"
#include <algorithm>
#include <iterator>
#include <vector>
namespace {
template <class scalar>
inline scalar sqr(scalar x)
// Square
{
return ... | ALGO | 0.999869 | 5.465813 |
c4c5e4fc-1160-4140-bcd7-f0c738d53464 | BodnarGuilherme/CPlusPlus | C++/Primeiro Semestre/Atividades/Divisivel por 3 e 7.cpp | // O programa lê o número e informa se ele é divisivel por 3 e por 7.
#include<iostream>
using namespace std;
int main(){
int n1 = 0;
cout<<"Entre com um numero: \n";
cin>>n1;
if(n1%3==0 && n1%7==0){
cout<<"Numero inserido e divisivel por 3 e 7. \n" ;
}else{
cout<<"Numero inserid... | ALGO | 0.988328 | 3.478347 |
58503eb7-387c-439c-941d-9467de5b2b0d | xidianlina/cppplus | chapter_05_bigstep.cpp | #include <iostream>
int main()
{
using std::cout;
using std::cin;
using std::endl;
cout << "Enter an integer: ";
int by;
cin >> by;
cout << "Counting by " << by << "s:\n";
for (int i = 0; i < 100; i = i + by)
cout << i << endl;
return 0;
} | TOOL | 0.985813 | 4.333207 |
f788335f-7ee8-4584-a04b-cffd1f98d88d | broccoli-97/libigl | tests/include/igl/copyleft/cgal/hausdorff.cpp | #include <test_common.h>
#include <CGAL/Simple_cartesian.h>
#include <igl/copyleft/cgal/hausdorff.h>
#include <igl/copyleft/cgal/point_mesh_squared_distance.h>
#include <igl/upsample.h>
TEST_CASE("hausdorff: knightVScheburashka", "[igl/copyleft/cgal]")
{
Eigen::MatrixXd VA,VB;
Eigen::MatrixXi FA,FB;
igl::read_t... | TEST | 0.954279 | 6.794248 |
cc3ba530-777b-4ddd-953d-4aa2256d6f69 | raincross7/code-similarity | codes/train_code/problem256/problem256_49.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(v) v.bigin(),v.end()
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define R(a) a=sqrt(a)
... | ALGO | 0.999925 | 3.213769 |
2fc65cb5-8805-452e-bf3d-565075e68b3e | AksanaKuzmitskaya/introductiontocpp | 3.3.cpp | /**
* 3.3.cpp
*
* Aksana Kuzmitskaya
* <EMAIL>
*
* Read a number N from the user and then find the first N primes.
*/
#include <iostream>
using namespace std;
bool isprime(int num, int index);
int main()
{
int n;
cout << "Give me N" << endl;
cin >> n;
cout << n << " first prime numbers:" << ... | ALGO | 0.997349 | 4.867996 |
c792f4df-c720-458c-abc1-70b5bc85210c | omkarlenka/ctci_solutions | ctci_8.7_permutation_without_dup.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
void swap_chars(string &s, int a, int b)
{
char temp = s[a];
s[a] = s[b];
s[b] = temp;
}
void printPermutation_util(string s, int start, int len,string prefix, vector<string> &res)
{
if(len == 1)
{
string permuta... | ALGO | 0.999984 | 5.272148 |
31b1ae85-1220-4f8c-8087-013a8dda0882 | khanhbuiduc/ICPC | algo_course/thang2/Buoi3/Array_Division.cpp | #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define lim 200'000'000'000'007
typedef pair<int, int> pii;
typedef long long ll;
int n, k;
int a[200'001];
bool isDivision(ll sum)
{
int countSubArr = 1;
ll subArrSum = 0;
for (int i = 1; i <= n; i++)
{
if (a[i] > ... | ALGO | 0.999994 | 4.066943 |
8e54a155-4b84-427a-88d8-9e1273e65812 | shubhamgyd/mission_TCS | Daily_Coding_problems/111_Count_Indices_Where_Given_words_occurs.cpp | /*
This problem was asked by Dropbox.
Given a string s and a list of words words, where each word is the same length, find all starting indices of substrings in s that is a concatenation of every word in words exactly once.
For example, given s = "dogcatcatcodecatdog" and words = ["cat", "dog"], return [0, 13], since... | ALGO | 0.999964 | 5.977907 |
41fbbfcd-3044-49ad-8f83-a2ab994c4cb1 | vinod-2309/Competitive-Programming | Code N Code/Number theory/Primality_test.cpp | #include<bits/stdc++.h>
using namespace std ;
#define mod 1000000007
bool isprime( int n )
{
if( n == 2 )return false ;
for( int i = 2 ; i <= sqrt(n) ; i++ )
{
if( n % i == 0 )return false ;
}
return true ;
}
int main()
{
int n ;
cin>>n ;
(isprime(n)) ? cout << "YES" : cout <<... | ALGO | 0.999536 | 4.646745 |
62e8d8be-7622-4a91-8291-d93b6f65f433 | PeteHaitch/MethylationTuples | src/sortMatrix.cpp | // [[Rcpp::depends(RcppArmadillo)]]
#include <RcppArmadillo.h>
using namespace Rcpp;
// Read http://thread.gmane.org/gmane.comp.lang.r.rcpp/5818 for a discussion
// on passing R matrices to Armadillo by reference.
//' Sort rows or columns of a numeric matrix.
//'
//' This simply uses the \code{sort} routine in \... | ALGO | 0.999729 | 5.853896 |
1886619e-534c-4e6d-b1b5-b4612aa32ce0 | Linhmoi/SDLES | SDLES/lib/Bullet3-2.8.7/src/LinearMath/btGeometryUtil.cpp | #include "btGeometryUtil.h"
/*
Make sure this dummy function never changes so that it
can be used by probes that are checking whether the
library is actually installed.
*/
extern "C"
{
void btBulletMathProbe ();
void btBulletMathProbe () {}
}
bool btGeometryUtil::isPointInsidePlanes(const btAlignedObjectArr... | ALGO | 0.998107 | 6.583965 |
df2bfa43-51fc-4b21-934b-8c9ed55ae30a | Tanish-Modi/Leetcode_Solutions | String/Hash Table/432_All_O_one_Data_Structure.cpp | /*
432. All O`one Data Structure
Design a data structure to store the strings' count with the ability to return the strings with minimum and maximum counts.
Implement the AllOne class:
AllOne() Initializes the object of the data structure.
inc(String key) Increments the count of the string key by 1. If key does not ex... | ALGO | 0.999167 | 6.35375 |
9e615399-7832-4d0a-938a-6171f3894a4a | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2748_11.cpp | #include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long z = 1000000000;
const long long N = 1e5 + 1;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
in >> a.first >> a.second;
return in;
}
template <typename T1, typename T2>
ostream& operator<<(ost... | ALGO | 0.999958 | 3.433667 |
74990a23-f9b7-4b78-bb26-fa3dc865fd90 | ishandutta2007/codeforces | maroonrk/normal/1209/E2.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
//#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b secon... | ALGO | 0.99996 | 3.762145 |
70d80bf1-ab69-40ab-a23e-18e3e582ab80 | ycui1984/booster | leetcode/removedup.cpp |
Remove Duplicates from Sorted Array
Total Accepted: 20112 Total Submissions: 62880
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
For example,
Given... | ALGO | 0.999845 | 6.069807 |
48da388f-73dc-45b6-8a4d-133352dd3af0 | luckyIITR/dsa450solved | Array/Jump Game Problems/Jump Game VII.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
// bfs solution .., not accepted (TLE)
bool canReach(string s, int minJump, int maxJump)
{
int n = s.size();
if (s[n - 1] == '1')
return false;
queue<int> que;
que.push(0);
while (!que... | ALGO | 0.999938 | 5.2657 |
8d6d82f7-e1f9-4a38-84ad-f7298fdba725 | phhonepyaesonemaung/CPP | C++/function/swap_call_by_value.cpp | #include<iostream>
using namespace std;
void swap (int a , int b){
int temp;
temp =a;
a=b;
b=temp;
}
int main(){
int x = 10, y = 20;
swap(x,y);
cout<<x<<y<<endl;
return 0;
} | ALGO | 0.998154 | 3.530893 |
dec1c85d-c21a-4c89-b1c6-c4c1e5e5d427 | tatupriyanka/project | libCondensation/src/condensation/AdaptiveCondensationTracker.cpp | /*
* AdaptiveCondensationTracker.cpp
*
* Created on: 14.05.2013
* Author: poschmann
*/
#include "condensation/AdaptiveCondensationTracker.hpp"
#include "condensation/Sample.hpp"
#include "condensation/Sampler.hpp"
#include "condensation/MeasurementModel.hpp"
#include "condensation/AdaptiveMeasurementModel.h... | ALGO | 0.995854 | 6.167434 |
2acae9a8-8a3c-4914-ad69-ec2d36af8489 | abunaim1/C-_for_DS | week-1 Introduction_c++/Module-3 class_object/sort_function.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
//asscending...
sort(a, a + n);
for (int i = 0; i < n; i++)
{
cout << a[i] << " ";
}
cout << endl;
//descending...
sort(a,... | ALGO | 0.99965 | 3.947658 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.