uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
eebdc09f-7da5-48e5-b7e2-939a381c3548 | zezehz/opencvvv | opencv-3.0.0/modules/superres/src/btv_l1_cuda.cpp | // S. Farsiu , D. Robinson, M. Elad, P. Milanfar. Fast and robust multiframe super resolution.
// Dennis Mitzel, Thomas Pock, Thomas Schoenemann, Daniel Cremers. Video Super Resolution using Duality Based TV-L1 Optical Flow.
#include "precomp.hpp"
using namespace cv;
using namespace cv::cuda;
using namespace cv::supe... | ALGO | 0.988642 | 5.154957 |
d5c8ea1a-939b-41e4-b2f7-d3c8bbb88227 | IsaiasR12345/Medida-de-Eficiencia | Desktop/me rufino/Primeiro Letra B.cpp | #include <iostream>
using namespace std;
int main()
{int i;
for(i=1000;i>=0;i--)
cout << "Numeros crescentes de 0 ate 1000: " << i << endl;
return 0;
}
| TOOL | 0.969616 | 3.581173 |
1d280567-e35e-42e1-95f4-1947e5745f88 | sppostman/coding-questions | 232-implement-queue-using-stacks/implement-queue-using-stacks.cpp | class MyQueue {
public:
stack<int> q;
stack<int> deQ;
void push(int x) {
q.push(x);
}
int pop() {
int el = peek();
if(el == -1)
return el;
deQ.pop();
return el;
}
int peek() {
if(deQ.empty()){
while(!q.empty()... | ALGO | 0.997576 | 5.627386 |
fde649f9-8292-415c-8df9-c06c5405a57b | yutianwu/MyCodes | leetcode/RemoveDuplicates.cpp | /*
Remove Duplicates from Sorted Array
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 input array A = [1,1,2],
Your function shou... | ALGO | 0.999954 | 5.791536 |
fdeeaa29-0f22-4abc-baad-55d8b75e6136 | hurmatkhalid/Leetcode-Solutions | arrays/53max_subarray.cpp | // Given an integer array nums, find the subarray with the largest sum,
// and return its sum.
#include <iostream>
#include <vector>
using namespace std;
// brute force
int maxSubarraySum(int arr[], int n)
{
int maxi = INT_MIN; // maximum sum
for (int i = 0; i < n; i++)
{
for (int j = i; j < n; j... | ALGO | 0.999936 | 6.52654 |
f1ac8bf5-828e-464a-8bee-2ad1995b75d9 | Valet-V0ult-de-Fur1e/basics_of_programming_repo | prj.codeforces/0978b.cpp | #include <iostream>
int main()
{
int count, out = 0;
std::cin>>count;
bool flag1=false, flag2=false;
for (int i = 0; i < count; i++){
char item;
std::cin>>item;
if (item == 'x'){
if (flag1){
if (flag2){
out += 1;
}
... | ALGO | 0.999714 | 3.782104 |
d7e6e2df-9ef8-44af-bbcf-4a2f0e3eaf23 | ryotgm0417/AtCoder | problems/B/abc089b.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
int main(){
int n;
cin >> n;
char c;
bool yellow = false;
rep(i,n){
cin >> c;
if(c=='Y') yellow=true;
}
if(yellow) cou... | ALGO | 0.999496 | 4.089782 |
23d8e697-4347-499a-88f5-5cdbaee7291b | ishandutta2007/codeforces | duality/normal/1439/A2.cpp | #define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printA... | ALGO | 0.999909 | 3.559958 |
433f8efa-73c3-4c14-bab5-4f1ef25d5b9f | Legoman6157/CS302_Spring-2020 | challenges/chal2/solution.cpp | #include <algorithm> //std::sort
#include <cmath> //std::abs
#include <iostream> //std::cin, std::cout, std::flush, std::endl
#include <vector> //std::vector
struct small_thing {
std::pair<int, int> indices;
small_thing(std::pair<int, int> n_indices) {
indices = n_indices;
}//small_thing constructor
};//small_t... | ALGO | 0.999963 | 3.838438 |
37142395-a7ca-4cc2-ae44-761fbf48da33 | schen59/SPOJ | AConcreteSimulation/aConcreteSimulation.cpp | /*
* aConcreteSimulation.cpp
* SPOJ 376 A Concrete Simulation
* Created on: Aug 10, 2013
* Author: Sherwin
*/
#include <iostream>
#include <cstring>
using namespace std;
int rows[1235];
int cols[5679];
int rev_rows[1235];
int rev_cols[5679];
void query(int x, int y)
{
cout << (rows[x]-1) * 5678 + cols[y]... | ALGO | 0.999369 | 3.499938 |
69daa09b-dd37-4863-88b5-5b2d05e885bc | MaxEstHere/Display-Number | C/Display.cpp |
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::underflow_error;
using std::invalid_argument;
void num(int number)
{
switch (number / 100)
{
case 1: cout << "one hundred "; break;
case 2: cout << "two hundred "; break;
case 3: cout << "three hundred "; break;
case 4: cout << "fo... | TOOL | 0.989777 | 5.16555 |
3b72f18b-ae89-472f-821c-348ac5e38bd8 | anoobzg/qi | src/opencv/src/3rdparty/carotene/src/integral.cpp | #include "common.hpp"
namespace CAROTENE_NS {
void integral(const Size2D &size,
const u8 * srcBase, ptrdiff_t srcStride,
u32 * sumBase, ptrdiff_t sumStride)
{
internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON
uint32x4_t v_zero = vmovq_n_u32(0u);
// the first itera... | ALGO | 0.998431 | 5.724962 |
1b011035-dac9-4a7b-8c1b-19caf5fd6a4d | aksoumya99/algo | Graph/strongly_connected_comp.cpp | stack<int > stk;
int vis[101];
void dfs(int u,vector<int > adj[])
{
vis[u]=1;
for(int v:adj[u])
{
if(!vis[v])
{
dfs(v,adj);
}
}
stk.push(u);
}
void dfs2(int u,vector<int > adj2[])
{
vis[u]=1;
for(int v:adj2[u])
{
if(!vis[v])
{
... | ALGO | 0.999205 | 4.513288 |
98ad599a-4172-4163-9875-a2328bd4d49a | ppipee/ProblemSolving | practice beforefinal/maxlate.cpp | #include <iostream>
#include <set>
using namespace std;
typedef pair<int,int> intpair;
int main()
{
int n;
int x, y;
multiset<intpair> schedule;
scanf("%d",&n);
for (int i = 0; i < n; i++)
{
scanf("%d %d",&x,&y);
schedule.insert(make_pair(x,y)); //last first
}
// sort(... | ALGO | 0.999574 | 3.753903 |
8e587a45-0efc-4b96-b05b-1918a974b4dc | emamhasan1804/XPSC | week -07/day -02/I_3_Palindrome.cpp | #include<bits/stdc++.h>
#define int long long
#define float double
#define endl '\n'
using namespace std;
/*
When I wrote this code ,
only Allah and I knew what I did.
Now... only Allah knows
*/
int32_t main ()
{
int n;
cin>>n;
int cnt = 0;
for(int i=1;i<=n;i++) {
if(cnt<2) {
... | ALGO | 0.999337 | 3.38606 |
3709e163-111e-4808-9ac2-881fe1752b75 | doantienthongbku/Leetcode-150 | 3_Sliding_Window/1_Sell_Stock.cpp | /*
https://leetcode.com/problems/best-time-to-buy-and-sell-stock
You are given an array prices where prices[i] is the price of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and choosing
a different day in the future to sell that stock.
Return the maximum prof... | ALGO | 0.999715 | 6.68911 |
831fcf81-075e-463c-b4ab-b859e3ba38ea | cai-cheng-baibaibai/wqmx | res/recognition/ring.cpp | #include "../../include/ring.h"
void Ring::reset(void) {
ringType = RingType::RingLeft; //
ringStep = RingStep::None; //
}
Ring::Ring() { // 캯
entering_Left.threshold = 13;
entering_Left.action = [this] {
ringType = RingType::RingLeft;
ringStep = RingStep::Entering;
... | TOOL | 0.99829 | 4.053334 |
870b5507-b0da-4ad2-b7bc-663259c49c6d | vallarasuk/LeetCode | solutions/849. Maximize Distance to Closest Person/849.cpp | class Solution {
public:
int maxDistToClosest(vector<int>& seats) {
const int n = seats.size();
int ans = 0;
int j = -1;
for (int i = 0; i < n; ++i)
if (seats[i] == 1) {
ans = j == -1 ? i : max(ans, (i - j) / 2);
j = i;
}
return max(ans, n - j - 1);
}
};
| ALGO | 0.999857 | 6.260077 |
3da0f3c8-07f1-4207-b0f8-8c51bd40895b | sarvex/leetcode-swift | solution/2300-2399/2366.Minimum Replacements to Sort the Array/Solution.cpp | class Solution {
public:
long long minimumReplacement(vector<int>& nums) {
long long ans = 0;
int n = nums.size();
int mx = nums[n - 1];
for (int i = n - 2; i >= 0; --i) {
if (nums[i] <= mx) {
mx = nums[i];
continue;
}
... | ALGO | 0.999863 | 5.749861 |
2fb005a8-b726-4acd-af5c-4262b339ed09 | andreasmaucher/CPP-08 | ex01/Span.cpp | #include "Span.hpp"
// default constructor
Span::Span() : N(0) {}
// parameterized constructor
Span::Span(unsigned int N) : N(N) {}
// copy constructor
Span::Span(const Span& other) : N(other.N), numbers(other.numbers) {}
// copy assignment operator
Span& Span::operator=(const Span& other) {
if (this != &other)... | ALGO | 0.991433 | 5.056541 |
5e0d080e-8318-4849-b3df-e04311eb3af0 | keshavsingh4522/hacktoberfest | CPP/check_if_ll_is_palindrome.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
struct node{
int data;
struct node *next;
};
bool check_pal(struct node* head_ref){
struct node* curr=head_ref;
stack<int> s;
while(curr!=NULL){
s.push(curr->data);
curr=curr->next;
}
while(head_ref!=NULL){
... | ALGO | 0.999717 | 4.221798 |
40ac8485-4cef-4212-bba9-643ee8e4dc91 | AluminumKen/hl2sb-src | src/utils/vvis/flow.cpp | int g_TraceClusterStart = -1;
int g_TraceClusterStop = -1;
/*
each portal will have a list of all possible to see from first portal
if (!thread->portalmightsee[portalnum])
portal mightsee
for p2 = all other portals in leaf
get sperating planes
for all portals that might be seen by p2
mark as unseen if n... | ALGO | 0.999544 | 4.307685 |
4c8bbf7d-fc94-4f6d-b586-e76402e892e9 | Alexia378/C-scripts | Contest_16/Task_4/main.cpp | #include "ReadWriter.h"
//string, fstream, iostream - included in ReadWriter.h
//Можно создавать любые классы и методы для решения задачи
using namespace std;
//Основной метод решения задачи, параметры:
//n - размер исходной задачи и результата (NxN)
//field - матрица NxN, не до конца заполненное поле, содержит цифр... | ALGO | 0.998132 | 4.044181 |
fe0a16f4-52b0-48a3-9070-4d94fa635cf4 | doocs/leetcode | solution/2000-2099/2086.Minimum Number of Food Buckets to Feed the Hamsters/Solution.cpp | class Solution {
public:
int minimumBuckets(string street) {
int n = street.size();
int ans = 0;
for (int i = 0; i < n; ++i) {
if (street[i] == 'H') {
if (i + 1 < n && street[i + 1] == '.') {
++ans;
i += 2;
}... | ALGO | 0.999524 | 4.890925 |
74334a67-613c-4f70-b251-38e3b8db8cd0 | musnows/Lets-OJ | oj/musnow/Leetcode/216组合问题3.cpp | class Solution {
void _combinationSum3(int k, int n,int start,int sum, vector<int> curV,vector<vector<int>>& retV ) {
if(curV.size() == k){
if(sum == n){
retV.push_back(curV);
}
return;
}
// 已经不符合条件,不进入循环
if(sum > n){
... | ALGO | 0.999977 | 6.891802 |
eb5bfa20-605b-4785-945d-af0e13786ea6 | Huey-ZhangHaiyu/-offer | code/acwing43不分行层序遍历树.cpp | //从上往下打印出二叉树的每个结点,同一层的结点按照从左到右的顺序打印。
//就是个宽搜
class Solution {
public:
vector<int> printFromTopToBottom(TreeNode* root) {
vector<int> res;
if(!root) return res;
queue<TreeNode *> q;
q.push(root);
while(q.size()){
auto f=q.front();//f=root;
res.push_back... | ALGO | 0.999982 | 5.448165 |
97b49339-a56a-4dfc-a6c1-2d13b25fc7f8 | adamap/code-test2 | 56mergeintervals.cpp | //Given a collection of intervals, merge all overlapping intervals.
//
//For example,
// Given [1,3],[2,6],[8,10],[15,18],
// return [1,6],[8,10],[15,18].
struct comparator
{
bool operator()(Interval a, Interval b)
{
if ( a.start != b.start)
{
return (a.start < b.start);
}
... | ALGO | 0.999956 | 6.327786 |
1cad416d-80c9-4969-98b2-e7e75122c8c4 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5662_4.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string a, b;
cin >> a >> b;
if (a.size() != b.size()) {
cout << "NO";
return 0;
} else if (a == b) {
cout << "YES";
return 0;
}
int c1 = 0;
int c2 = 0;
for (int i = 0; i < a.size(); i++) {
c1 += a[i] == '1';
c2 += b[i] ==... | ALGO | 0.999988 | 4.086214 |
49506e39-fd65-4425-bbfa-0e22bad03f16 | SHASHANKRAJ21/LEETCODE | 2520-using-a-robot-to-print-the-lexicographically-smallest-string/using-a-robot-to-print-the-lexicographically-smallest-string.cpp | class Solution {
public:
string robotWithString(string s) {
unordered_map<char, int> cnt;
for (char c : s) {
cnt[c]++;
}
stack<char> stk;
string res;
char minCharacter = 'a';
for (char c : s) {
stk.emplace(c);
cnt[c]--;
... | ALGO | 0.999858 | 6.424498 |
7e693541-bb0b-4042-b454-b8d964d98188 | leecottrellPTC/Cpp2023 | Week 7 ~Lists/STLLecure.cpp | #include <string>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <forward_list>
#include <iterator>
#include <cstring>
#include <cctype>
#include <algorithm> //need for_each
using namespace std;
void fillTheList(forward_list <string> &theList, string fileName){
string word;
int count = ... | TOOL | 0.91424 | 5.251801 |
6d05540d-36f2-4d38-a804-84d101c18862 | chenyang1999/MyComputerCollegeCourses | ACM算法/653002 挑战程序设计竞赛2 算法和数据结构/源码/第3章/Shell Sort.cpp | #include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
//g数组
vector<int>G;
long long cnt;
int A[1000000 + 10];
// 间隔为g的插入排序
void insertionSort(int A[], int n, int g) {
for (int i = g; i < n; i++) {
int v = A[i];
int j = i - g;
while (j >= 0 && A[j] > v) {
A[j... | ALGO | 0.999976 | 3.285379 |
4649757b-4b40-43e4-aebe-2376fade6865 | vivek-sundli/leet | 33.rotated.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int n=nums.size();
if(n==0){
return -1;
}
int low=0, res=-1 , mid, high=n-1;
while(low<=high){
mid = low+(high-low)/2;
if(nums[mid]==target){
return mid;
... | ALGO | 0.999995 | 6.240227 |
c8e8b90d-9d52-47db-be8d-7b4233f98c05 | SpencerLutz/Algo-Solutions | Codeforces/1783 - Educational Codeforces Round 141/1783B - Matrix of Differences/code.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define rrep(i, a, b) for (int i = (a); i >= (b); --i)
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t; cin >> t;
while (t--) {
int n; cin >> n;
int nsq = n*n;
int o[nsq];
rep(i... | ALGO | 0.999556 | 4.212077 |
f62e3cdf-4cc7-4523-9952-f0faa3be3ccf | sky-bro/AC | leetcode.com/1600 Throne Inheritance/main.cpp | #include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
struct Node {
string name;
vector<Node *> children;
Node(string name) { this->name = name; }
Node() {}
~Node() {
for (Node *child : children) delete child;
}
};
class ThroneInheritance {
priv... | ALGO | 0.999501 | 6.09787 |
bd627974-12ef-4326-bceb-d6186ae38e45 | Jwaminju/2020datastructure | Baekjoon1620_Solution1/Baekjoon1620_Solution1/source(re-1).cpp | #include <iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cctype>
using namespace std;
int main() {
cin.tie(NULL);
cin.sync_with_stdio(false);
int n, m, index, left, right, cmp;
vector<pair<string, int>>pkmon;
vector<string>quiz;
vector<string>reply;
string name, ask;
cin >> n >> m;
... | ALGO | 0.99995 | 4.752683 |
9487dd37-826e-401b-98b4-2a1121c72406 | darominski/vslib_experiments | source/vslib/components/src/srfPll.cpp | #include "srfPll.hpp"
namespace vslib
{
[[nodiscard]] std::tuple<double, double, double>
SRFPLL::synchroniseWithDQ(const double f_a, const double f_b, const double f_c) noexcept
{
const auto [d, q, zero] = abc_2_dq0.transform(f_a, f_b, f_c, m_wt);
// for consistency with Matlab, forward-Eu... | TOOL | 0.995149 | 5.902842 |
056fd5e3-93a3-448f-b1cd-28d37fbea6d9 | halozxc/My_C_Code | 数组/数组最大小值.cpp | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(){
int random_variable = 10+rand()%10;
int a[random_variable];
int sum =0;
int min =20,max=10;
for(int i =1;i<=random_variable;i++){
int num = 10+rand()%10;
printf("%d\n",num) ;
a[i-1]=n... | ALGO | 0.980903 | 3.055339 |
a3892d43-a111-4eaa-abfb-a160621cdb5f | doocs/leetcode | solution/3300-3399/3392.Count Subarrays of Length Three With a Condition/Solution.cpp | class Solution {
public:
int countSubarrays(vector<int>& nums) {
int ans = 0;
for (int i = 1; i + 1 < nums.size(); ++i) {
if ((nums[i - 1] + nums[i + 1]) * 2 == nums[i]) {
++ans;
}
}
return ans;
}
};
| ALGO | 0.999963 | 6.054082 |
9bb9088c-221a-4554-851e-61cb0b5dd76b | AbhangMandwale/LeetCode-Problems | kidsWithCandies.cpp | class Solution {
public:
vector<bool> kidsWithCandies(vector<int>& candies, int extraCandies) {
vector<bool> result;
int max = *max_element(candies.begin(),candies.end());
for(int i=0; i<candies.size(); i++){
result.push_back(candies[i]+extraCandies>=max);
}
retur... | ALGO | 0.999818 | 6.06218 |
5280eb1e-a141-4578-ba55-ec4ca6243f02 | DanielGrenehed/adventofcode2020 | cpp/d11p1.cpp | // Author Daniel Grenehed 11 12 2020
#include "util.hpp"
int adjecentOccupied(int x, int y, std::vector<std::string> map) {
// count '#' for the 8 adjecent positions
int count = 0, max_x = map[0].size(), max_y = map.size();
for (int i = x-1; i < x+2; i++) {
if (i < 0) continue;
if (i >= max... | ALGO | 0.999487 | 6.590912 |
e96088ae-7dc6-4413-a4e0-bd1c86be1a7f | DavidNicoNatanaelRumahorbo/pemrograman-terstruktur | 2217051129_David Nico Natanael Rumahorbo_angka baik.cpp | #include <iostream>
using namespace std;
int main(){
int angka;
cin>>angka;
for(int i = 1;i<=angka;i++){
if(i%5!=0){
if(i>30){
cout<<"NOT FOUND";
break;
}
cout<<i<<endl;
}
}
}
| ALGO | 0.999348 | 3.503665 |
3fffa64b-a470-4970-9a0a-3802bed0f9e3 | MohitBaid/CodeChef | Practice/Medium/To Do/POUR1.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(c==0) cout<<"0"<<endl;
else if(c==b || c==a) cout<<"1"<<endl;
else if(c==abs(b-a)) cout<<"2"<<endl;
else cout<<"-1"<<endl;
}
}
| ALGO | 0.999952 | 4.0513 |
e3d6746f-a7ac-4729-893a-004888ccf264 | homedory/codetree-TILs | 240122/책꽂이 정리/bookshelf-clean.cpp | #include <iostream>
using namespace std;
#define MAX_K 105
struct Node {
Node *prev, *next;
int data;
Node(int data) : data(data), prev(nullptr), next(nullptr) {}
};
int book_cnt[MAX_K];
Node* head[MAX_K];
Node* tail[MAX_K];
void connect(Node* u, Node* v) {
if (u != nullptr)
u->next = v;
... | ALGO | 0.99999 | 4.465317 |
02038434-7955-4839-b31d-33e51b6754a4 | ishandutta2007/codeforces | keyid/normal/842/E.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN=300005;
#define pb push_back
int maxbit,fa[20][MAXN],deep[MAXN],sum[MAXN],d[MAXN];
vector <int> G[MAXN],kp;
bool ok[MAXN];
void dfs(int u)
{
for (int v:G[u])
{
deep[v]=deep[u]+1;
dfs(v);
}
}
int LCA(int u,int v)
{
if (deep[u]<deep[v])
swap(u,v)... | ALGO | 0.99992 | 3.839556 |
f95e5114-0e6e-4400-b547-f4ade7e0aa12 | ketan270/cpp-practice | Lecture6.cpp |
// #include <bits/stdc++.h>
// using namespace std;
// int main(){
// int n;
// cout << "ENTER NUMBER: ";
// cin >> n;
// int ans=0;
// int i=0;
// while(n!=0){
// int bit = n & 1;
// ans = (bit * pow(10,i) )+ ans;
// n=n >> 1;
// i++;
// }
// cout << "ANSWER IS : " << ans << endl;
// }
#include <bits... | ALGO | 0.99942 | 5.091403 |
81e70b53-9bb3-42d1-bc8b-67396b6e41a2 | ChaosPKU/Exercise | Practice - 推箱子.cpp | /*
大家一定玩过“推箱子”这个经典的游戏。具体规则就是在一个N*M的地图上,有1个玩家、1个箱子、1个目的地以及若干障碍,其余是空地。玩家可以往上下左右4个方向移动,但是不能移动出地图或者移动到障碍里去。如果往这个方向移动推到了箱子,箱子也会按这个方向移动一格,当然,箱子也不能被推出地图或推到障碍里。当箱子被推到目的地以后,游戏目标达成。现在告诉你游戏开始是初始的地图布局,请你求出玩家最少需要移动多少步才能够将游戏目标达成。
输入描述:
每个测试输入包含1个测试用例
第一行输入两个数字N,M表示地图的大小。其中0<N,M<=8。
接下来有N行,每行包含M个字符表示该行地图。其中 . 表示空地、X表示玩家、*表示箱子、#表示障碍... | ALGO | 0.999867 | 4.371763 |
4602239e-3425-4940-8804-52182f79219c | gavioto/nsis3 | NSIS/tags/v232/Contrib/VPatch/Source/GenPat/ChunkedFile.cpp | #include "ChunkedFile.h"
using namespace std;
ChunkedFile::ChunkedFile(bistream& f, TFileOffset fSize, TFileOffset chunkSize) :
chunks(NULL) {
chunkCount = fSize / chunkSize;
cout << "[ChunkedFile] Filesize of " << static_cast<unsigned int>(fSize) << " gives " << static_cast<unsigned in... | TOOL | 0.851025 | 4.766248 |
489e2f3d-c7ee-45ec-8a6a-188a5329ff66 | abhijeet-anshu/Codechef-Sols | bytecode/COOLGUYS.cpp | #include<cstdio>
#define uli unsigned long long int
uli gcd(uli a,uli b){
if(a<b)
return gcd(b,a);
else if(b==0)
return a;
else
return gcd(b,a%b);
}
int main(){
uli n,i,j,k,count=0;
int t;
scanf("%d",&t);
while(t--){
count=0;
scanf("%llu",&n);
for(i=1;i*... | ALGO | 0.999563 | 4.303118 |
effce2e7-b979-438a-a00a-e7cb36c67964 | Programmazione-per-la-Fisica/exercises | problemi/recursive_count/recursive_count.cpp | #include <algorithm>
#include <cassert>
#include <iostream>
#include <iterator>
#include <vector>
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"
int recursive_count(std::vector<int>::iterator first,
std::vector<int>::iterator last, int value,
int counter = 0) {... | TEST | 0.992054 | 6.892886 |
b6a55e1d-9b50-4aed-a2ad-593aa77d41de | RomainBUAA/leetcode | jianzhi_offer/23_PrintFromTopToBottom/Solution.cpp | #include "../common.h"
#include <queue>
#include <iostream>
void PrintFromTopToBotton(BinaryTreeNode* pTreeNode)
{
if(!pTreeNode)
{
return ;
}
std::queue<BinaryTreeNode * > queueTreeNode;
queueTreeNode.push(pTreeNode);
while(queueTreeNode.size())
{
BinaryTreeNode * curNode = ... | ALGO | 0.999719 | 3.805421 |
8b004894-bf92-41f6-98d9-625b269ac933 | mukisang/Study_codingTest | Muki/programmers/heap/heap1.cpp | #include <string>
#include <vector>
#include <queue>
using namespace std;
int solution(vector<int> scoville, int K) {
int itr = 0, mix1, mix2;
priority_queue<int, vector<int>, greater<int>> pq(scoville.begin(), scoville.end());
while (!pq.empty())
{
if (pq.top() >= K)//ں
break;
else//ں
{
mix1 =... | ALGO | 0.999637 | 5.53778 |
61ee640e-5844-47c9-b7b3-9ba55802bd9c | goodstudyqaq/ACM | codeforces/2100-2199/2113/D.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "copypaste/debug.h"
#else
#define debug(...) 42
#endif
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
struct fast_ios {
fast_ios() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fix... | ALGO | 0.999969 | 4.466858 |
8475352c-b58b-49da-ab0c-e53361ef9063 | Vivekrathore2002/DSA-Coding | 0074-search-a-2d-matrix/0074-search-a-2d-matrix.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
// //Basically this below code is a simple copy paste of spiral matrix code with few changes only
// int row=matrix.size();
// int col=matrix[0].size();
// bool flag=false;
// int count=0;
... | ALGO | 0.999985 | 5.844831 |
b9585b7d-3c20-4e4f-a78b-4363c0845c75 | ishandutta2007/codeforces | froggyzhang/normal/1490/F.cpp | #include<bits/stdc++.h>
using namespace std;
#define N 200020
typedef long long ll;
inline ll read(){
ll x=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){
if(c=='-')f=-1;
c=getchar();
}
while(c>='0'&&c<='9'){
x=(x<<1)+(x<<3)+c-'0';
c=getchar();
}
return x*f;
}
int T,n,a[N],m;
map<int,int> mp;
void Solve(){... | ALGO | 0.999535 | 4.052068 |
28d382c8-e377-4c45-bc44-472e4b60d8ec | MuthuvelA/Techdose_Assignment | sorting/bubble_sort.cpp | #include <bits/stdc++.h>
using namespace std;
void bubbleSort(int arr[], int n) {
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1])
swap(arr[j], arr[j + 1]);
}
}
}
int main(){
int arr[]={1,3,2};
bubbleSort(arr,3... | ALGO | 0.999885 | 4.840978 |
b1cb7ac0-558c-473d-8681-10be55ce97c2 | amitasj7/DSA_CODES | String/largest_odd_no.cpp | #include <bits/stdc++.h>
using namespace std;
string largestOddNumber(string num)
{
int i = num.length() - 1;
// cout<<num[i]<<endl;
// return "hello";
while (i != -1)
{
int value = num[i];
if (value % 2 != 0)
{
return num.substr(0, i + 1);
}
... | ALGO | 0.999472 | 4.849166 |
914ee57f-1a20-45f4-985e-275ee5865b07 | PranjalTheCoder/TLE_SHEET | 900/q11.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
int n;
cin >> n;
vector<int> arr(n);
for(int i=0; i<n;i++){
cin >> arr[i];
}
// while(1){
// bool f1 = true;
// for(int i=0; i<n-1; i++){
// if(arr[i+1]%arr[i]==0){
// arr[i]+... | ALGO | 0.999755 | 3.499879 |
a3db8888-9166-4729-b1de-ad4a56f2ca3e | raincross7/code-similarity | codes/train_code/problem453/problem453_491.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int a,b,c;
int x;
vector<int> y;
bool input(){
int n;
cin>>n>>a>>b>>c>>x;
if(n==0&&a==0&&b==0&&c==0&&x==0)return false;
y.clear();
for(int i=0;i<n;i++){
int tmp;cin>>tmp;
y.push_back(tmp);
}
return true;
}
int mmm(int X... | ALGO | 0.999663 | 3.368729 |
26fa4509-bca9-4424-81d5-2bd6251b4211 | yangpyeong522/Algorithm_1year | a-91/a-91/a-91.cpp | #include <iostream>
#include <algorithm>
using namespace std;
long long a, b, c, e, f;
long long arr[1000];
int main()
{
cin >> a >> b;
if (a>=b) {
cout << max((a + b) / 2, (a - b) / 2) << " " << min((a - b) / 2, (a + b) / 2);
}
else {
cout << "-1";
}
} | ALGO | 0.999942 | 4.32214 |
0d8ea5ee-dbdf-43a2-9ef2-dd933fcace7e | craftzbay/e-olymp | 1000-1999/1515 - Repeated Josephus - Повторяющийся Иосиф - Іосиф повторюється.cpp | #include <iostream>
using namespace std;
int last(int n)
{
if (n == 1) return 1;
if (n % 2 == 0) return 2 * last(n / 2) - 1;
return 2 * last((n - 1) / 2) + 1;
}
int main() {
//Переменная r содержит количество повторений процедуры казни (изначально r = 0). По заданному
//входному n ищем номер уцелевшего k.Если... | ALGO | 0.998931 | 3.882565 |
a7f120a0-b7b4-4b7d-9489-1baf3b9530ea | simpzan/android-frameworks-av | media/libstagefright/codecs/amrnb/enc/src/c8_31pf.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "c8_31pf.h"
#include "typedef.h"
#include "cnst.h"
#include "inv_sqrt.h"
#include "cor_h.h"
#include "cor_h_x2.h"
#include "set_sign.h"
#inclu... | ALGO | 0.999956 | 4.42862 |
96b7d298-35e0-4df3-805a-3714b71565b4 | LS-Manila/takeapicture-NOELandVoid | libraries/tess-two/jni/com_googlecode_tesseract_android/src/textord/drawtord.cpp | #ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "pithsync.h"
#include "topitch.h"
#include "drawtord.h"
#define TO_WIN_XPOS 0 //default window pos
#define TO_WIN_YPOS 0
#define TO_WIN_NAME "Textord"
//title of window
#define ... | TOOL | 0.903123 | 4.665752 |
14a7f911-b760-44b2-ab69-08c82ebd6619 | tomaso909/boost | libs/spirit/classic/example/fundamental/functor_parser.cpp | #include <boost/spirit/include/classic_core.hpp>
#include <boost/spirit/include/classic_functor_parser.hpp>
#include <boost/spirit/include/classic_assign_actor.hpp>
#include <iostream>
#include <vector>
#include <string>
///////////////////////////////////////////////////////////////////////////////
//
// Demonstrate... | TOOL | 0.925127 | 7.249001 |
b1d5192b-b9c9-4050-8b68-6dc9a7933667 | AMReX-Combustion/PeleC | Source/Diffusion.cpp | #include "Diffusion.H"
#include "prob.H"
void
PeleC::getMOLSrcTerm(
const amrex::MultiFab& S,
amrex::MultiFab& MOLSrcTerm,
const amrex::Real /*time*/,
const amrex::Real dt,
const amrex::Real reflux_factor)
{
BL_PROFILE("PeleC::getMOLSrcTerm()");
if (
(!diffuse_temp) && (!diffuse_enth) && (!diffuse_sp... | ALGO | 0.999748 | 5.716084 |
097c91c0-1b4f-4d34-ae02-c43663a6eb77 | LiuLongyang0305/LeetCode | cpp/1660_correct-a-binary-tree.cpp | // https://leetcode.com/problems/correct-a-binary-tree/
/**
* 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) {}
* Tree... | ALGO | 0.999899 | 7.429311 |
743298f4-679d-4c63-a2f7-d8b1acb2976e | 24icewolf42/gtsam | gtsam/3rdparty/GeographicLib/dotnet/examples/ManagedCPP/example-EllipticFunction.cpp | using namespace System;
using namespace NETGeographicLib;
int main(array<System::String ^> ^/*args*/)
{
try {
EllipticFunction^ ell = gcnew EllipticFunction(0.1, 1.0); // parameter m = 0.1
// See Abramowitz and Stegun, table 17.1
Console::WriteLine( String::Format( "{0} {1}", ell->K(), ell... | ALGO | 0.999279 | 4.942891 |
20bdf091-438d-4b74-8cb8-3851ea96b809 | jcapellman/sar2k25 | Player.cpp | #include "Player.h"
#include "RandomNumberGenerator.h"
#include "GameStats.h"
void Player::AttemptPlay(AvailablePlays play, Player& opponent) {
auto rollCheck = [](int playerAttribute, int opponentAttribute) -> int {
int playerRoll = RandomNumberGenerator::Generate(1, 20) + playerAttribute;
int opp... | ALGO | 0.860405 | 5.752242 |
bfcddbc3-017b-423b-becc-254d3dbe2eed | dementrock/acm | poj/Archives/new/7098966_AC_875MS_1720K.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAXN 200001
int n,m,a[MAXN],s[MAXN],appear[MAXN];
int main()
{
while(1)
{
scanf("%d%d",&n,&m);
if(!n&&!m) break;
for(int i=1;i<=m;++i)
{
scanf("%d",&a[i]);
s[i]=(s[i-1]+a[i])%n;
}
memset(appear,0xff,sizeof(appear));
appear[0]=0;
for... | ALGO | 0.999998 | 3.172176 |
ff0cb406-5ac8-447f-b669-284ed0788b16 | TaranpalSingh18/PracticeRepo | practice/fibonaaciseries.cpp | #include<iostream>
using namespace std;
int main(){
int n=9;
int a=0;
int b=1;
cout<<a<<"";
cout<<b<<"";
for(int i=1; i<=n; i++){
int nextNumber=a+b;
cout<<nextNumber<<endl;
a=b;
b=nextNumber;
}
return 0;
} | ALGO | 0.999944 | 3.120119 |
8dcee1df-4517-4d6d-a783-b7b583af9c18 | dinox0r/comp-prog | aoc/2021/9-a.cpp | #include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <sstream>
#include <string>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
int main() {
vector<string> lines;
string line;
while (getline(cin, line)) ... | ALGO | 0.997733 | 4.033244 |
0d8d1ec6-79d9-457b-a8a1-d2687be903ef | bhavyakalra19/cpp_comp_prog_dsa | LevelUp/Strings/BiggestPalindrome.cpp | #include<bits/stdc++.h>
using namespace std;
string getPalindrome(string s, int i, int j){
while(i>=0 && j < s.length() && s[i] == s[j]){
i--;
j++;
}
return s.substr(i+1,j-i-1);
}
string biggestPalindrome(string s){
if(s.length() == 1){
return s;
}
string odd,even,ans;
... | ALGO | 0.999803 | 4.818467 |
466aa399-8459-4959-853e-f44e4be2264b | liliansteven/Competitive-Programming--Solution | 702C C. Cellular Network.cpp | /*
problem link: https://codeforces.com/contest/702/problem/C
my solution on codeforces : https://codeforces.com/contest/702/submission/184054051
problem name: C. Cellular Network
status: accepted
author: lilian_steven or LELLO
*/
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <set>
#include... | ALGO | 0.999995 | 4.83006 |
e29a7498-1d4b-4434-b8a8-a7d32bec99f3 | ishandutta2007/codeforces | lzoi.win/normal/1325/D.cpp | #include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long ll;
ll u,v;
int ans[70],len;
int main(){
cin>>u>>v;
if(u>v||(v-u)%2){
puts("-1");
return 0;
}
ll p=v-u>>1;
for(int i=0;i<=60;i++)
len=max(len,ans[i]=(p>>i)%2*2+(u>>i)%2);
cout<<len<<endl;
for(int i=1;i<=len;i++){... | ALGO | 0.999778 | 3.305444 |
cccd4698-740b-4755-881e-df1dbdd20e50 | QuadDarv1ne/maestro7it_education | leetcode/Medium/cpp/837. New 21 Game.cpp | /**
* https://leetcode.com/problems/new-21-game/description/?envType=daily-question&envId=2025-08-17
*/
#include <vector>
using namespace std;
class Solution {
public:
/**
* Игра "Новый Блэкджек".
* Мы начинаем с 0 очков и тянем карты до тех пор, пока сумма < k.
* Каждая карта даёт от 1 до maxPts... | ALGO | 0.999905 | 6.820268 |
ab1f9eb2-b2c9-43c6-96da-4d981c63f2d0 | riku546/cpp-tutorial | c_practice/323.cpp | #include <bits/stdc++.h>
#define rep(i, m, n) for (int i = m; i < n; i++)
using ull = unsigned long long;
using ll = long long;
using namespace std;
int main()
{
int N, M;
cin >> N >> M;
vector<int> A(M);
vector<pair<int, int>> cA(M);
rep(i, 0, M)
{
int temp;
cin >> temp;
A[i] = temp;
cA[i]... | ALGO | 0.999974 | 3.914652 |
ba4248a8-11dd-44fc-961a-c28bf8106f17 | LineageExtended/android_frameworks_av | media/codecs/amrnb/common/src/lsfwt.cpp | /*
Pathname: ./audio/gsm-amr/c/src/lsfwt.c
Functions: Lsf_wt
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated to accept new parameter, Flag *pOverflow. Placed
file in the proper PV Software template.
Description:
1. Eliminated u... | ALGO | 0.999818 | 6.617649 |
f3b40ce2-8131-4ee4-85fa-b0f9ca0e8a70 | chanda739/Programming | 876-middle-of-the-linked-list/876-middle-of-the-linked-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* middleNode(... | ALGO | 0.999877 | 5.83762 |
dfa53cbc-3b34-46c4-86bb-09a5d3340a82 | OwaisK4/Competitive-Programming | Codeforces/Contests/2024 ICPC Asia Taichung Regional Contest/D_Drunken_Maze.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define all(a) a.begin(), a.end()
#define seed chrono::high_resolution_clock::now().time_since_epoch().count()
#define file_read(filepath) freopen(filepath, "r", stdin);
#define file_write(filepa... | ALGO | 0.999982 | 5.303878 |
39233b7e-dec0-4b03-88b8-1758420c8855 | DevTamakuwala/C-- | Sorting/quickSort.cpp | /*
In quick sort algorithm first we will decide the pivot index and after that we will Recursively call the quick sort algorithm on left side
and right side.
While finding the pivot index we will first have to choose the pivot and then we will compare all the values with that pivot
value and all the values greather the... | ALGO | 0.999978 | 5.222139 |
88690aad-8b81-461c-9aa6-1c912d2fa7d7 | ISOLDE-Project/riscv-llvm | bolt/lib/Passes/SplitFunctions.cpp | #include "bolt/Passes/SplitFunctions.h"
#include "bolt/Core/BinaryBasicBlock.h"
#include "bolt/Core/BinaryFunction.h"
#include "bolt/Core/FunctionLayout.h"
#include "bolt/Core/ParallelUtilities.h"
#include "bolt/Utils/CommandLineOpts.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/S... | TOOL | 0.897249 | 7.91877 |
2ff67b96-ee53-41e6-a972-bece2939015e | Alfeim/njuee_LeetCode_Solutions | Leuckart/LeetCode_007_ReverseInteger.cpp | /**************************************************
> File Name: LeetCode_007_ReverseInteger.cpp
> Author: Leuckart
> Time: 2019-04-10 23:06
**************************************************/
#include <iostream>
#include <climits>
class Solution
{
public:
int reverse(int x)
{
bool is_negetive = x <... | ALGO | 0.999842 | 5.361734 |
3446b5f7-66e6-453e-8edf-1e2c01cf924c | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_13076_3.cpp | #include <bits/stdc++.h>
using namespace std;
long long arr[10];
int main() {
string s;
long long i, j, n, m, t;
long long mx = 0;
cin >> t;
for (i = 0; i < t; i++) {
cin >> s;
for (j = 0; j < 7; j++) {
arr[j] += s[j] - '0';
mx = max(mx, arr[i]);
}
}
cout << mx << endl;
}
| ALGO | 0.998849 | 4.026893 |
c3eb133b-ff99-40d0-a3ba-01eaafa80582 | jevonhuang/beautifulhome | book/C++ Primer Plus 6th/05 Loops and Relational Expressions/08/main.cpp | #include <iostream>
#include <cstring>
int main()
{
using namespace std;
cout << "Enter words (to stop, type the word done):" << endl;
int count = 0;
char word[32];
cin >> word;
while(strcmp(word, "done"))
{
count++;
cin >> word;
}
cout << "You entered a total of " << count << " words." << endl;
} | ALGO | 0.968156 | 4.4558 |
5270c5ba-8339-41ec-b58b-30662aa41b5c | GuacheSuede/MSSubmission1234567890 | submission/bollinger/boost_1_69_0/libs/numeric/odeint/examples/phase_oscillator_ensemble.cpp | #include <iostream>
#include <utility>
#include <boost/numeric/odeint.hpp>
#ifndef M_PI //not there on windows
#define M_PI 3.141592653589793 //...
#endif
#include <boost/random.hpp>
using namespace std;
using namespace boost::numeric::odeint;
//[ phase_oscillator_ensemble_system_function
typedef vector< double > ... | ALGO | 0.999277 | 6.161011 |
6f756ccc-0b2d-44f3-b004-5826c2d0fe23 | jluissandovalm/smd_lammps | src/KOKKOS/pair_coul_cut_kokkos.cpp | #include "math.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "pair_coul_cut_kokkos.h"
#include "kokkos.h"
#include "atom_kokkos.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "update.h"
#include "integrate.h"
#include "r... | ALGO | 0.976852 | 6.529731 |
012f0d63-807f-43ed-a1e3-7004007048e2 | i-aman0/Cpp-Codes | CPBatchCipher/DP/buyAndSellStock2.cpp | #include<iostream>
#include<vector>
using namespace std;
// On each day, you may decide to buy and/or sell the stock.
// You can only hold at most one share of the stock at any time.
// However, you can buy it then immediately sell it on the same day
// or sell and then buy on the same day
// if buyAllowed = 1, buyi... | ALGO | 0.999942 | 5.78651 |
f31e9d8c-fe3d-468b-9c4c-134b81b5bc6b | Biank23/Competitive-Programming | Codeforces/Round 932 (Div. 2)/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x), end(x)
#define sz(x) int(x.size())
using ll = long long;
using ii = pair<int, int>;
#define fst first
#define snd second
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t;
cin >> t;
while (t--) {
... | ALGO | 0.999884 | 4.669392 |
599620f7-ed05-4877-9fc2-7a8362ac4093 | cloudysman/C_Programming_PTIT | C04027_Sap_Xep_Chon.cpp | #include<stdio.h>
void swap(int *xp, int *yp) {
int temp = *xp;
*xp = *yp;
*yp = temp;
}
void printArray(int arr[], int size) {
int i;
for (i=0; i < size; i++)
printf("%d ", arr[i]);
printf("\n");
}
void selectionSort(int arr[], int n) {
int i, j, min_idx;
for (i = 0; i < n-1;... | ALGO | 0.999825 | 4.303248 |
89058ef6-ad83-4e83-9d56-68afba541811 | darchr/gem5 | src/systemc/tests/systemc/misc/unit/data/datawidth_bool_to_unsigned/promote_truncation/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.960632 | 5.742909 |
20033461-b812-40b2-a758-c5b2a1538406 | proydakov/codeforces | Codeforces_Round_#156/A/solution.cpp | #include <vector>
#include <iostream>
#include <algorithm>
struct item_t
{
int count;
std::string desc;
};
bool operator<(const item_t& i1, const item_t& i2)
{
return i1.count < i2.count;
}
int main()
{
std::ios::sync_with_stdio(false);
int n;
std::cin >> n;
std::vector<item_t> array{ {... | ALGO | 0.99933 | 4.685075 |
653b27e0-0965-4440-bc4f-102684a99b35 | shivamm-jha/leet-code | Reaching the heights - GFG/reaching-the-heights.cpp | // { Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
vector<int> reaching_height(int n, int a[]) ;
int main() {
int t;
cin >> t;
while (t-- > 0) {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
vector<int> v;
... | ALGO | 0.999921 | 5.369117 |
91356a00-ba13-435e-9746-9f42eb7b6a56 | Aziz0026/Algorithms-And-Data-Structures | Lab03/apaxiaaans.cpp | #include <iostream>
using namespace std;
int main() {
string word;
cin >> word;
string result;
char previous = word[0];
result += previous;
for (int i = 1; i < word.length(); i++) {
if (word[i] != previous)
result += word[i];
previous = word[i];
}
cout << result << endl;
}
| ALGO | 0.999961 | 4.773794 |
facb7f76-6d0d-4662-9820-2c2427408e26 | ProgramingOnLoongson/mesa-19.2.8 | src/compiler/glsl/opt_rebalance_tree.cpp | /**
* \file opt_rebalance_tree.cpp
*
* Rebalances a reduction expression tree.
*
* For reduction operations (e.g., x + y + z + w) we generate an expression
* tree like
*
* +
* / \
* + w
* / \
* + z
* / \
* x y
*
* which we can rebalance into
*
* +
* / \
*... | ALGO | 0.995677 | 7.486701 |
cd4e33da-278e-4e00-b4ba-e5a3e570720a | liardanc3/algorithm | cpp/17427.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll N; cin >> N;
ll ans = 0;
for (ll i = 1; i <= N; i++)
ans += i*(N / i);
cout << ans;
return 0;
} | ALGO | 0.99988 | 3.981798 |
ca511c7d-a520-400b-9572-6a5bda66a4b3 | ravibhushankumarsonu/Competitive-Programming | HackerRank/Algorithms/Greedy/Luck_Balance.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n,k;
cin>>n>>k;
vector<int>arr;
long int sum=0;
for(int i=0;i<n;i++)
{
... | ALGO | 0.999899 | 3.388363 |
a038d039-35a9-447f-be87-a39c85776c5b | ROBOT-RIAD/XPSC_MISSION | week 3/C_1_Powering_the_Hero_easy_version.cpp | #include<bits/stdc++.h>
#define fo(i,s,n) for(int i=s;i<n;i++)
#define ffo(i,s,n) for(int i=s;i<=n;i++)
#define ll long long int
using namespace std;
int main() {
int t;cin>>t;
while(t--)
{
ll n;cin>>n;
vector<ll>v(n);
fo(i,0,n)cin>>v[i];
priority_queue<ll>q;
ll ans... | ALGO | 0.999889 | 4.186604 |
ebca8c23-6825-46d5-ac05-6443589a6ea0 | chosh95/STUDY | BaekJoon/2019/포도주 시식.cpp | #include<iostream>
using namespace std;
int p[10002];
int dp[10002][3];
int max(int a,int b){
if(a>=b) return a;
else return b;
}
int main()
{
int N;
cin>>N;
for(int i = 1; i<=N;i++) cin>>p[i];
dp[1][0] = 0;
dp[1][1] = p[1];
dp[2][0] = p[1];
dp[2][1] = p[2];
dp[2][2] = p[1]+p[2];
if(N<=2) cout<<dp[2][2];
... | ALGO | 0.99999 | 3.406974 |
b84a172a-c08d-4670-b013-acf9360776fb | Aden-Tao/LeetCode | 0198 House Robber/solution.cpp | #include "bits/stdc++.h"
using namespace std;
class Solution {
public:
int rob(vector<int>& nums) {
int n = nums.size();
if (n == 0) return 0;
vector<int> f(n + 1, 0), g(n + 1, 0);
for (int i = 1; i <= n; i ++)
{
g[i] = max (g[i - 1], f[i - 1]);
f[i]... | ALGO | 0.999955 | 4.982285 |
8e34f1e7-1d8f-4560-a73e-f04748ef5ea5 | gaohongy/Algorithm-Competition-Code | pta/1045.cpp | // 按照给定序列的顺序选择原串中的元素,询问拼接后得到的串的最大长度
// 按照给定序列的顺序是指例如2 3 1 5 6,选择1之后就不能再选择3了,
// 同时在原串中是不能走回头路的,只能向后选择,比如走到某个位置时正在选择5,只能选择该位置之的元素,前面的5不能再选择
// 如果将给定序列看为一种递增关系,那么本题求解的实际为最长上升子序列,更准确地说应当为最长有序子序列
// 显然是道dp
// 状态表示:dp[i]:所有以颜色i结尾的子序列
// 属性:所有子序列长度最大值
// 状态计算(集合划分):可以按照最后一位颜色的前一位进行划分,对于所有以颜色i结尾的子序列,它的前一位颜色可以为给定顺序该颜色及其以前的颜色(因... | ALGO | 0.999952 | 4.415437 |
12a5b27e-57d7-4798-a480-cb1021fee96f | aeum1016/miscPrograms | src/UFPTPractice/problem_types/adhoc/pachydermpeanutpacking.cpp | #include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;
int main()
{
int nBoxes;
while(scanf("%d\n", &nBoxes) != EOF)
{
if(nBoxes == 0) return 0;
vector<vector<double>> boxes(nBoxes);
int i = 0;
while(nBoxes--)
{
double x1, y1, x2, y2;
stri... | ALGO | 0.989576 | 3.86704 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.