uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
e76cfe9d-9728-4364-b32c-e223f43d3a5c | WTlumos/PAT-A | 1028/1028.8.28.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct node
{
int id,grade;
char name[10];
}v[100010];
int c;
bool cmp(node a,node b)
{
if (c==1)
{
return a.id<b.id;
}else if(c==2){
if (strcmp(a.name,b.name)!=0)
{
return strcmp(a.name,b.name)<0;
}else{
return a.id<b.id;
... | ALGO | 0.998902 | 3.364022 |
51c906d8-7b8b-4e16-84f5-bdbf52a2b420 | Ram-the-coder/interview-prep | stack and queue/valid_parantheses.cpp | /*
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
Note that an empty string is ... | ALGO | 0.998214 | 6.918056 |
9087ea43-ae0a-45b6-8abe-5a7f621d4aa6 | tegetege/tegetege_AtCoder | Practice/ABC/Bcontest164_a.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int S, W;
cin >> S >> W;
if (S <= W) {
cout << "unsafe" << endl;
} else {
cout << "safe" << endl;
}
}
| ALGO | 0.998836 | 4.2253 |
783a4a3f-4fe2-4d16-96b3-5f6f01748caf | ldct/cp | codeforces/695/D/D.cpp | #include <bits/stdc++.h>
using namespace std;
constexpr int MODULUS = 1000000007;
int N, K, Q;
long long factor[5009][5009];
long long A[5009];
int main() {
memset(factor, 0, sizeof(factor));
cin >> N >> K >> Q;
for (int i=0; i<N; i++) {
cin >> A[i];
}
// DP to populate factor
K++;
for (int i... | ALGO | 0.999588 | 4.097796 |
9823aefb-8885-4cf4-a1a9-5baf0346e938 | Living-Hell/LeetCode | Array/#300-LongestIncreasingSubsequence.cpp | //M1
//Using DP
//Faster than 63.44%(349ms)
class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
int n = nums.size();
vector<int> dp(n,1);
for(int i=1; i<n; i++){
for(int j=0; j<i; j++){
if(nums[i]>nums[j])
dp[i] = max(dp[i],... | ALGO | 0.999985 | 5.847831 |
c1722a42-21a1-4739-90b4-5a7ab8492ebf | abhishek18124/LVCPPSept2023 | Lecture 26/01 - String Operations/003Strings_Searching.cpp | #include<iostream>
#include<string>
using namespace std;
int main() {
string s = "bcdabcdabc";
string subString = "abc";
cout << s.find(subString) << endl;
cout << s.rfind(subString) << endl;
subString = "xyz";
cout << s.find(subString) << endl;
cout << string::npos << endl;
if (s.find(subString) != stri... | ALGO | 0.992776 | 4.989184 |
e063523f-f637-4e1c-89b5-6ada7e3b74e2 | Minnggg/CPP-CODEPTIT | cpp0103.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
double n;
cin >> n;
double sum=0;
for(double i=1;i<=n;i+=1)
{
sum+=(double)1/(double)i;
}
printf("%.4lf",sum);
return 0;
}
| ALGO | 0.999416 | 4.019043 |
bf388344-b713-4737-b8f4-bd971dbc107a | Jperez65/Sequoia-Tree | sequoia-driver.cpp | #include "sequoia.h"
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include <stdexcept>
using namespace std;
const string INPUT_FILE("input.txt");
const string OUTPUT_FILE("output.txt");
//Checks whether the height of this node and all of its
// descendents are calcula... | ALGO | 0.997294 | 5.748134 |
e19e67e0-bce2-491f-8f4c-f0637db3d4ad | alulu-zh/software | boost_1_70_0/libs/numeric/ublas/doc/samples/matrix_vector_range.cpp | #include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
... | ALGO | 0.970289 | 3.376717 |
28f73a36-3482-411b-901b-052a00b7b616 | vitoyan/leetcode | Medium/31.Next_Permutation.cpp | class Solution {
public:
void reverse(vector<int>& nums, int start, int end)
{
while(start < end)
{
int tmp = nums[start];
nums[start] = nums[end];
nums[end] = tmp;
start++;
end--;
}
}
int findSwap(vector<int>& nums, int... | ALGO | 0.999998 | 5.897296 |
982d0880-5f12-4b6b-91f3-9628e2b371d7 | Siriayanur/DSA | StacksAndQueues/309reverseStack.cpp | #include <iostream>
#include <stack>
using namespace std;
void reverseStack(stack<int> &input, stack<int> &extra)
{
if (input.size() == 0 || input.size() == 1)
{
return;
}
int temp = input.top();
input.pop();
reverseStack(input, extra);
while (!input.empty())
{
extra.p... | ALGO | 0.999841 | 5.124681 |
a3f7a1de-1939-4ebb-ba00-8ddcd3cfdb3c | ishandutta2007/codeforces | atatomir/normal/592/A.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define mp make_pair
#define pb push_back
int a, b;
char ch;
char s[10][10];
bool good[10];
int main()
{
//freopen("test.in","r",stdin);
a = b = 100;
for (int i = 1; i... | ALGO | 0.999932 | 3.582421 |
37d8352e-6a9a-4c8b-947e-3c32ab5cd9ac | brotherchris/Candy_Claw | firmware/Marlin-2.1_machine/Marlin/src/libs/least_squares_fit.cpp | /**
* Least Squares Best Fit by Roxy and Ed Williams
*
* This algorithm is high speed and has a very small code footprint.
* Its results are identical to both the Iterative Least-Squares published
* earlier by Roxy and the QR_SOLVE solution. If used in place of QR_SOLVE
* it saves roughly 10K of program memory. I... | ALGO | 0.999159 | 5.833176 |
9b55250f-c812-46e5-932f-c875e823ad50 | trevorblacklock/Stella | src/uci.cpp | #include "uci.hpp"
#include "perft.hpp"
#include "types.hpp"
#include "movegen.hpp"
#include "position.hpp"
#include "tt.hpp"
#include "misc.hpp"
#include "search.hpp"
#include "timing.hpp"
#include "nn/evaluate.hpp"
#include <iostream>
#include <thread>
#include <vector>
namespace Stella {
// Check if every element... | TOOL | 0.884661 | 6.229712 |
f05162fa-ae14-49b5-8e89-45ee799ca0fa | Abhijit1102/DSA_by_shraddha | advance/sort_algo/cout_ineversion.cpp | #include <iostream>
#include <vector>
using namespace std;
int merge(vector<int>& arr, int start, int mid, int end){
vector<int> temp;
int i = start, j = mid + 1;
int invCount = 0;
while (i <= mid && j <= end) {
if (arr[i] <= arr[j]) {
temp.push_back(arr[i++]);
} else {
... | ALGO | 0.999997 | 5.819633 |
00530af3-6e36-4da4-9688-93147a630c88 | ishandutta2007/codeforces | christ/normal/472/B.cpp | #include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
const int MN = 2e5 + 5;
int main () {
int n,k; scanf ("%d %d",&n,&k);
vector<int> a(n);
for (int &i : a) scanf ("%d",&i);
sort(a.begin(),a.end()); reverse(a.begin(),a.end());
long long ret = 0;
for (int i = 0; i < n; i += k) {
int ed = a[i];
ret... | ALGO | 0.999581 | 3.73925 |
81244c2a-1559-4eab-9019-71625e6576bc | abhiranjankumar00/TopCoder-SRM-submissions | TheOlympiadInInformatics.cpp | #include <iostream>
#include <ctime>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cassert>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cs... | ALGO | 0.999922 | 4.098361 |
8e693d82-4eea-4dd9-8183-d992c7cbf892 | meehirlokhande/Leetcode-daily-practice | 1011. Capacity To Ship Packages Within D Days.cpp | https://leetcode.com/problems/capacity-to-ship-packages-within-d-days/description/
class Solution {
public:
int solve(vector<int>& weights,int mid){
int sum =0;
int daysCount=1;
for(int i=0;i<weights.size();i++)
{
if(sum + weights[i] > mid){
d... | ALGO | 0.999997 | 5.914189 |
f9680dd0-7be1-4fec-9513-b9cd2954a9a6 | danrasband/libpraat | dwtools/Spectrum_extensions.cpp | #include "Ltas.h"
#include "Spectrum_extensions.h"
#include "Sound_and_Spectrum.h"
#include "NUM2.h"
#define SIGN(x,s) ((s) < 0 ? -fabs (x) : fabs(x))
#define THLCON 0.5
#define THLINC 1.5
#define EXP2 12
#define PPVPHA(x,y,test) ((test) ? atan2 (-(y),-(x)) : atan2 ((y),(x)))
#define PHADVT(xr,xi,yr,yi,xa) ((xa) >... | ALGO | 0.999751 | 5.267024 |
d1b2f706-bd54-4531-ad0a-c4ef694087a3 | chandru007raju/LeetCodeSolutions | C++/FindUniqueBinaryString.cpp | /*
Source: https://leetcode.com/problems/find-unique-binary-string/
Time: O(n), where n is the size of given string array(nums)
Space: O(1), in-place, though we are using extra string(res) to assign desired character('0' or '1') at their appropriate place
but we will still treat space as O(1) and not O(n) because we ... | ALGO | 0.99995 | 6.599065 |
21061e3e-6967-4c7c-9400-6cb29ba31ef8 | tharunkorla94444444/CSA0614-DAA | Binary search algorithm.cpp | #include <stdio.h>
int Search(int a[], int beg, int end, int t)
{
int mid;
if(end >= beg)
{ mid = (beg + end)/2;
if(a[mid] == t)
{
return mid+1;
}
else if(a[mid] < t)
{
ret... | ALGO | 0.999102 | 4.131833 |
c7c72e84-c79b-4aea-a12c-36e79aee8e43 | KrisCTer/PTIT-Online-Judge | CPP/CPP0133 - ƯỚC SỐ NGUYÊN TỐ NHỎ HƠN N.cpp | #include<bits/stdc++.h>
#define ll long long
#define yes puts("YES");
#define no puts("NO");
#define N 1000001
int snt[N];
using namespace std;
void init()
{
memset(snt,0,sizeof(snt));
snt[0]=snt[1]=1;
for(int i=2;i*i<N;i++)
for(int j=i*i;j<N;j+=i)
snt[j]=1;
}
void solve(int n)
{
cout<<2<<" ";
for(int i=3;i<=n... | ALGO | 0.998701 | 4.622955 |
817916ca-b206-4a33-8f18-3ebdca91a71f | ishandutta2007/codeforces | emengdeath/normal/1194/B.cpp | #include <ctime>
#include <cstdio>
#include <random>
#include <algorithm>
#include <ctime>
#include <iostream>
#include <queue>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <unordered_map>
#include <map>
#include <set>
using namespace std;
const int N = 1e6;
int l[N], r[N];
char s[N]... | ALGO | 0.999879 | 3.639923 |
ee65c549-89da-40fc-8464-44642f14a0b7 | 920052859/Cod_ProblemasResueltos_Codeforce | forsimple.cpp | //mostrar los cubos de los numeros
//de 1 hasta n
#include<iostream>
using namespace std;
long long int i,n;
int main()
{ cout<<"ingrese n: ";
cin>>n;
for(i=1;i<=n;i++)
cout<<i*i*i<<"\n";
}
| ALGO | 0.99588 | 3.215693 |
8250bbf9-43cb-45d9-8dc6-ec00d52bcfc8 | HameedMulani/SdeSheetChallenge | Find duplicates in an array - GFG/find-duplicates-in-an-array.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
// stl solutions
vector<int> duplicates(int arr[], int n) {
// code here
unordered_map<int,int> mp;
for(int i=0;i<n;i++){
mp[arr[i]]++;
}
vector<int>res;... | ALGO | 0.99969 | 6.055536 |
0b5eb4ad-3a9e-436e-be9f-98c9caace79c | bochen0909/pyoslom | cpp/louvain_oslomnet_undir.cpp | #include "set_parameters.h"
#include "undir_weighted_tabdeg.h"
#include "louvain_oslomnet_undir.h"
namespace oslom {
extern Parameters* paras;
namespace undir {
oslom_module::oslom_module(int a) {
nc = 1;
kout = a;
ktot = a;
}
;
oslom_module::~oslom_module() {
}
;
void prints(map_int_om & M) {
for (map_int_om:... | ALGO | 0.99722 | 5.01179 |
3b2d15fd-e974-459b-8237-af840c0ddaf6 | syarale/LeetCode101 | chapter 14/572 另一棵树的子树.cpp |
// 572. Subtree of Another 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) {}
* TreeNode(int x, TreeNode *... | ALGO | 0.999847 | 6.859846 |
0d698ef3-c521-4135-86eb-01e2f15dec59 | crystal9210/AtCoder | tessoku/a34.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,m,x) for(int i=m;i<(x);i++)
#define rep_ll(i,m,x) for(ll i=m;i<(x);i++)
typedef long long ll;
typedef long double lb;
// 両者が最善を尽くした時、先手と後手どっちが勝つか
int main(){
int n;
cin>>n;
vector<int> a(n);
return 0;
}
| ALGO | 0.999946 | 3.118135 |
431f8215-8a43-4656-90d6-d75c064a777d | saga92/leetcode | implement_queue_using_stacks.cpp | #include<stack>
using namespace std;
class MyQueue {
private:
stack<int> input;
stack<int> output;
public:
/** Push element x to the back of queue. */
void push(int x) {
input.push(x);
}
/** Removes the element from in front of queue and returns that element. */
int pop() {
... | ALGO | 0.997816 | 5.202241 |
30cc6e8d-a9b2-41fa-8420-0c03e7f041a0 | headmastersquall/Cpp | CH08/06.cpp | /*
* 06. String Selection Sort
*
* Uses the selection sort algorithm to sort an array of strings.
*/
#include <iostream>
#include <string>
using namespace std;
const int NUM_NAMES = 20;
string names[NUM_NAMES] =
{
"Collins, Bill", "Smith, Bart", "Allen, Jim",
"Griffin, Jim", "Stamey, Marty", "Rose, Geri",
"T... | ALGO | 0.999927 | 5.632934 |
2763d94c-6360-4544-a1ad-cf212b3d6a17 | neko-huang/oi-code | dfs1.cpp | #include <iostream>
#include <vector>
using namespace std;
const int maxn = int(1e6 + 5);
struct node {
int l, r;
int sum;
};
node segtree[maxn << 2];
void upd(int x) {
segtree[x].sum = segtree[x * 2].sum + segtree[x * 2 + 1].sum;
return;
}
void build(int x,int bl, int br) {
segtree[x].l = bl;
segtree[x].r =... | ALGO | 0.999951 | 4.220855 |
ce3c0007-b57d-4803-b4a2-85d6f12edef1 | LakshmanS27/Phonecall_screen | 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 |
65fc4ea7-d94e-4229-918d-5e6d02ec5a24 | fatmaashraframadan/Problem_Solving | CodeForces_Solutions_2/Olesya and Rodion.cpp | #include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, t,a(1);
cin >> n >> t;
string g = "";
if(n==1 && t==10)
cout << "-1"<<endl;
else
{
int i = 1;
cout << t;
if(t==10) i++;
for(;i<n;i++)
cout<<'0';
}... | ALGO | 0.9995 | 3.298663 |
fe1f7645-dcd5-4103-afe2-c0a28b12744c | Kawser-nerd/CLCDSA | Source Codes/AtCoder/agc023/A/2436803.cpp | // Atcoder Grand Contest 023 A ver 2.0
#include <iostream>
//#define DEBUG
using namespace std;
#ifdef DEBUG
void print_array_i(int* a, int l)
{
for (int i=0; i<l; i++) {
cout << a[i] << " ";
}
cout << endl;
}
void print_array_l(long long int* a, int l)
{
for (int i=0; i<l; i++) {
cout << a[i] << " ";
... | ALGO | 0.99998 | 3.996613 |
9ddc1400-95d9-4d18-af28-8e443287b187 | fps-final-project/OfficeOverrun | FirstPersonShooter/RoomSelector.cpp | #include "pch.h"
#include "RoomSelector.h"
#include "RoomGraphExtensions.h"
using namespace WorldGenerator;
WorldGenerator::RoomSelector::RoomSelector(RoomSelectorArgs args)
{
H = args.initialGraph;
s = args.startVertex;
N = std::floor(H.Size() * args.roomDensity);
floors = args.floorCount;
e_c = args.edgeDensit... | ALGO | 0.971257 | 3.80475 |
049764f3-d471-4140-b9b7-84c1cb1d8afd | tsuchi0410/AtCoder | problems/ABC/ABC179/D.cpp | #include <bits/stdc++.h>
using namespace std;
int MOD = 998244353;
int main(){
int N, K;
cin >> N >> K;
vector<vector<int>> S;
for (int i = 0; i < K; i++) {
int L, R;
cin >> L >> R;
S.push_back({L, R});
}
sort(S.begin(), S.end());
vector<long long> dp(N);
vector<l... | ALGO | 0.999869 | 4.86274 |
00b74160-fe82-441d-af17-5b36547aad97 | leehy98/coding-test | coding upload/PerfixSum 구간합 구하기 4 11659.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> Nums;
vector<int> Sums; // 0 1 3 6 10
// Prefix Sum
int main()
{
ios_base::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
int N, M, Num, I, J;
cin >> N >> M;
Nums.resize(N);
Sums.resize(N + 1, 0);
for (int i = 0; i < N; i++)... | ALGO | 0.999978 | 4.837202 |
dc8cbd27-f1a2-42fe-88e8-51c50d4379d6 | hiking90/aidl-cpp | io_delegate.cpp | #include "io_delegate.h"
#include <cstring>
#include <fstream>
#include <vector>
#ifdef _WIN32
#include <direct.h>
#else
#include <sys/stat.h>
#include <unistd.h>
#endif
#include <android-base/strings.h>
#include "logging.h"
#include "os.h"
using std::string;
using std::unique_ptr;
using std::vector;
using androi... | TOOL | 0.953742 | 6.929102 |
1eeb3691-c98b-4990-a2e0-911dcea12ec5 | Pranshh19/DSA | Assignment10/05.cpp |
class Solution {
public:
int getlen(ListNode *temp){
int count = 0;
while(temp!=NULL){
temp = temp->next;
count++;
}
return count;
}
ListNode* removeNthFromEnd(ListNode* head, int n) {
int len = getlen(head);
if(n>len){
... | ALGO | 0.999967 | 5.658291 |
39f622d5-a5ce-4078-8fa2-1f78c2984fa7 | URSec/SVA-Compiler | llvm/tools/llvm-cvtres/llvm-cvtres.cpp | #include "llvm/ADT/StringSwitch.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/WindowsMachineFlag.h"
#include "llvm/Object/WindowsResource.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/BinaryStreamError.h"
#include "llvm/Support/Error.h... | TOOL | 0.865015 | 7.016566 |
c68904ab-9700-48b2-bbc7-0f2e27a05981 | Xavier-sa/aprendizado | LINGUAGENS/C++ cisco/C++ Advanced/Modulo 3/exemplo_27.cpp | template < class InputIterator, class T >
typename iterator_traits < InputIterator >::difference_type
count (InputIterator first, InputIterator last, const T & value);
template < class InputIterator, class UnaryPredicate >
typename iterator_traits < InputIterator >::difference_type
count_if (InputIterator first, I... | TOOL | 0.987326 | 6.675774 |
cd6ccdbe-3de7-484f-bc0e-012441e2fa48 | KhoiBui16/Fullhouse_Code_Online | C/Source code/Buoi_07/Bai10.cpp | //7.10
#include <stdio.h>
int giaithua(int n){
int gt=1;
for(int i=1;i<=n;i++) gt*=i;
return gt;
}
int tonggt(int n){
int tam=n;
int tong=0;
while(n!=0){
tong+=giaithua(n%10);
n/=10;
}
if (tam==tong) return 1;
return 0;
}
int main(){
int a,b;
scanf("%d%d",&a,&b);
int tam=0;
for(int i=a;i<=b;i++){
... | ALGO | 0.999903 | 3.605797 |
9948af28-06f8-4ec6-b570-a0ed30c19aef | OptiPurity/packages_apps_Camera2 | jni/feature_stab/db_vlvm/db_utilities_poly.cpp | /* $Id: db_utilities_poly.cpp,v 1.2 2010/09/03 12:00:10 bsouthall Exp $ */
#include "db_utilities_poly.h"
#include "db_utilities.h"
/*****************************************************************
* Lean and mean begins here *
****************************************************... | ALGO | 0.999555 | 5.195219 |
4132918b-60a3-44c8-8765-db3e37e6f5ed | AhmedAliHashmi-git/LeetCode_75 | StringCompression.cpp | #include <iostream>
#include <vector>
#include<string.h>
using namespace std;
class Solution {
public:
int compress(vector<char>& chars) {
int n = chars.size();
string s = "";
int count = 1;
int index = 0;
int i;
for( i = 1 ; i < n ; i++){
if(chars[i] == chars[i-1]... | ALGO | 0.999909 | 5.353294 |
774962a8-6922-4e21-a22b-d01f996722e9 | Kira-1937/repo-for-codeforces-contests | 1828C.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>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pd... | ALGO | 0.999915 | 4.144526 |
04c54a41-7a0c-4838-9438-a5d095948e26 | alexandraback/datacollection | solutions_5753053697277952_0/C++/Pascualino/A.cpp | #include <iostream>
#include <map>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int,int> PII;
typedef pair<int, PII> PIII;
typedef pair<PII, PII> PIIII;
#define x first
#define y second
int main(){
int T;
cin >> T;
for(int t=1;t<=T;t++){
int N;
cin >> N;
... | ALGO | 0.999564 | 4.112396 |
74548749-6947-4513-bc93-d8a215bfff7b | AnkitVarshney01/My-Coding-Playground | Codeforces/A_Spell_Check.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <climits>
#include <vector>
#include <stdlib.h>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <random>
#include <numeric>
#include <iomanip>
#include <chrono>
#include <cmath>
#include <cassert>
#include... | ALGO | 0.999965 | 5.142606 |
70b7eba0-26e2-49e3-b4cb-20a36b5130aa | me-jain-anurag/codeforces | R900/down_with_brackets.cpp | #include <bits/stdc++.h>
using namespace std;
constexpr double PI = 3.141592653589793;
constexpr int MOD = 1000000007;
#define ll long long
#define ld long double
#define ull unsigned long long
#define vll vector<long long>
#define vvll vector<vector<long long>>
#define usl unordered_set<ll>
#define umll unordered_ma... | ALGO | 0.999787 | 5.232686 |
9d60bac8-c80b-40e8-8dc5-d620f796ea4d | samahuja642/leetcode | linked_list/remove_n_from_end.cpp | // Attempt # 1
// Simply By calculating size of linked list and then traversing till the previous node from deletion node and then remove the connection.
// May be I can deal with edge cases in a better way.
// Complexity Analysis
// Space Complexity -> O(1)
// Time Complexity -> O(N)
// Code
class Solution {
public:... | ALGO | 0.999946 | 6.238131 |
1917b6a7-a9d2-49cd-b092-81a0177dd382 | bardend/Competitive_Programing | Codeforce/1933f.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rall(A) A.rbegin(),A.rend()
#define endl '\n'
#define pb push_back
#define dbg(x) do {cerr << #x <<" = " << (x) << endl; } while (false)
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> ii;
typede... | ALGO | 0.999677 | 4.95286 |
b5b3812c-16cc-4839-b667-385a7527d2c6 | AerialSpy4/DMOJSolutions | dmopc14c3p6_notenoughtime.cpp | #include <bits/stdc++.h>
using namespace std;
const int MM = 1e6+5;
int dp[MM], dp2[MM];
int main() {
cin.sync_with_stdio(0);
cin.tie(0);
int n, w;
cin >> n >> w;
for (int i=1; i<=n; i++) {
int p1, v1, p2, v2, p3, v3;
cin >> p1 >> v1 >> p2 >> v2 >> p3 >> v3;
copy(dp2, dp2... | ALGO | 0.999954 | 4.052459 |
5c91859c-c00d-4b16-98d6-20134044e0b1 | Kovis97/Prog_gyak | 11.het/elso.cpp | #include <iostream>
using namespace std;
struct elem
{
int szam;
elem *kov;
};
elem *letrehoz()
{
int szamok[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, -1};
elem *horgony = NULL;
for (int i = 0; szamok[i] != -1; i++)
{
elem *uj = new elem;
uj->szam = szamok[i];
uj->kov = horgony;
... | ALGO | 0.998843 | 3.986484 |
d5cf949d-94ce-428b-a1e2-f12e3a6a253b | SeokhunEom/Coding_Test | Programmers/Lv.1/문자열 나누기.cpp | #include <string>
#include <vector>
using namespace std;
int solution(string s) {
int answer = 0;
int a = 0, b = 0;
char x = '\0';
for (char c : s) {
if (x == '\0') x = c;
if (c == x)
a++;
else
b++;
if (a == b) {
answer++;
a = 0;
b = 0;
x = '\0';
}
}
... | ALGO | 0.999898 | 5.277065 |
6ef52975-2a3b-42e1-a404-f6a4d71be478 | liuq901/code | HD/hd_3373.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;
const int maxn=100000+10;
pair <int,pair <int,int> > a[3*maxn];
int N,c[maxn],X[maxn],Y[maxn],l[maxn],r[maxn],mid[maxn],p[maxn],in[maxn];
bool ok[maxn];
int main()
{
void insert(in... | ALGO | 0.999824 | 3.663151 |
6b666edf-35f5-4a6d-a19a-663fb024f828 | palcu/algo | CodeForces/Round_216/c.cpp | /***************************************************
* Alex Palcuie
* Romania - 2013
* alex [dot] palcuie [at] gmail [dot] com
* http://palcu.blogspot.com/
****************************************************/
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cs... | ALGO | 0.999995 | 4.080342 |
1079d34a-0f0d-43a0-a88e-11f8f2b74dee | SeungBeomLim/24-1_PPS-Camp | A142_임승범_20240715.cpp | // A142. 같은 숫자는 싫어 - Programmers
#include <vector>
#include <iostream>
using namespace std;
vector<int> solution(vector<int> arr) {
vector<int> answer;
answer.push_back(arr[0]);
for (int i = 1; i < arr.size(); i++) {
if (answer.back() != arr[i])
answer.push_back(arr[i]);
}
... | ALGO | 0.999947 | 5.243217 |
87450380-7519-4762-9223-e647a2ca4abc | omarchehab98/open.kattis.com-problems | amazing/amazing.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
pii rotate_right(pii direction){
return make_pair(direction.second, -direction.first);
}
pii add(pii op1, pii op2){
return make_pair(op1.first + op2.first, op1.second + op2.second);
}
string get_str_dir(pii direction){
if(direction.first ==... | ALGO | 0.999954 | 3.85336 |
922702ed-80a2-4363-8a0f-8086a2ab687e | coinwebfactory/peps230 | src/libzerocoin/AccumulatorProofOfKnowledge.cpp | /**
* @file AccumulatorProofOfKnowledge.cpp
*
* @brief AccumulatorProofOfKnowledge class for the Zerocoin library.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This pro... | ALGO | 0.98885 | 6.607809 |
e12ecb7c-033f-407c-8425-9bb8162b35f2 | Duonghbtt/CODEPTIT | Thuat toan DSA/CayNhiPhan/Bai9Duyetxoanoc.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node *left , *right;
Node(int x){
data = x;
left = right = NULL;
}
};
void makeNode(Node *root , int u , int v , char c){
if(c=='L') root->left = new Node(v);
else root->right = new Node(v);
}
void insert(No... | ALGO | 0.999989 | 3.777413 |
8ed79779-efac-405d-94c0-3fd75f1cb2cd | tholian-network/retrokit | Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorMetalDirect/DiscoverDependentFunctions.cpp | #include <cstring>
#include <unordered_map>
#include <unordered_set>
#include "compiler/translator/TranslatorMetalDirect/DiscoverDependentFunctions.h"
#include "compiler/translator/TranslatorMetalDirect/DiscoverEnclosingFunctionTraverser.h"
#include "compiler/translator/TranslatorMetalDirect/MapFunctionsToDefinitions.... | TOOL | 0.856046 | 7.87465 |
c6faee35-be77-4686-8c27-65b2d64c7975 | arjo31/Personal-DSA-Problems | DP/DP on Subsequences/count_subsets_with_sum_k.cpp | #include <bits/stdc++.h>
using namespace std;
// arr[i] does not include the number 0;
// Memoization
int solveMemoization(int n, int k, vector<int> &arr, vector<vector<int>> &dp)
{
if (k == 0)
return 1;
if (n < 0)
return 0;
if (dp[n][k] != -1)
return dp[n][k];
int notTake = so... | ALGO | 0.999958 | 5.093276 |
4db1cd5b-7a66-4d80-9ddf-994ee072c113 | hadjitejuco/CCS0015_TN05 | linkedlist2.cpp | /*
Program: Singly Linked Queue
*/
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
struct node{
int data;
node *next;
}*head;
void createlist(int);
void addbegin(int);
void addafter(int,int);
void display();
void del(int);
void delfirstelem();
void count();
void reverse();
void sea... | ALGO | 0.998461 | 4.530904 |
1f7864e6-090c-4715-b666-f1535bbc1d6f | tolegenovaaa05/Project_9 | 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.998809 | 6.763549 |
2da1171c-9248-4284-83a0-0b4e286bb13f | deveshsrivastava1212/DS-Algo | Stack/postfix_eval.cpp | #include<iostream>
#include<stack>
#include<math.h>
using namespace std;
int postfixEval(string s)
{
stack<int> st;
for(int i=0;i<s.length();i++)
{
if(s[i]>='0' && s[i]<='9')
st.push(s[i]-'0');
else{
int op2 = st.top();
st.pop();
int op1 = st.... | ALGO | 0.99976 | 4.34635 |
f85857b0-9e39-40b5-98d0-fee483f90d62 | Octavi-Staging/android_frameworks_native | cmds/lshal/TableEntry.cpp | #define LOG_TAG "lshal"
#include <android-base/logging.h>
#include <map>
#include <android-base/hex.h>
#include <android-base/strings.h>
#include <hidl-hash/Hash.h>
#include <vintf/parse_string.h>
#include "TableEntry.h"
#include "TextTable.h"
#include "utils.h"
namespace android {
namespace lshal {
static const ... | TOOL | 0.850028 | 6.654334 |
442aedc1-7199-4e66-aae6-57f12e9ced64 | deepin-community/mesa | src/gallium/drivers/r600/sfn/sfn_split_address_loads.cpp | #include "../r600_isa.h"
#include "sfn_split_address_loads.h"
#include "sfn_alu_defines.h"
#include "sfn_defines.h"
#include "sfn_instr_alugroup.h"
#include "sfn_instr_fetch.h"
#include "sfn_instr_mem.h"
#include "sfn_instr_tex.h"
#include "sfn_instr_export.h"
namespace r600 {
class AddressSplitVisitor : public Inst... | TOOL | 0.876202 | 6.460633 |
d95e6cca-d358-4119-bf81-f75fce16ecab | TAPSIKATYAL/Data-Structure | Queue,stacks,Arrays,Graphs,bst/ArrayDuplicatesRemoval.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter size of array\n";
cin>>n;
cout<<"Enter elements of array\n";
int a[n];
for(int i = 0 ; i < n ; i ++)
{
cin>>a[i];
}
cout<<"The array is:\n";
for(int i = 0 ; i < n ; i ++)
{
cout<<a[i]<<"\t";
}
cout<<endl;
int count = 0;
for(int ... | ALGO | 0.999723 | 3.702754 |
7a6bc687-b992-4352-84bf-81dfd968e43e | rituraj0/OtherCompetitions | Codechef June 14/Chef and Subarray.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz size()
#define bg begin()
#define en end()
#define Y second
#define X first
typedef long long ll;
#define fi freopen("input.txt","r",stdin)
#define fo freopen("output.txt","w",stdout)
const double pi = acos(-1.0);
c... | ALGO | 0.999881 | 3.580226 |
d47229a5-9b87-4fb4-9d2b-3e9ec3c8de2b | littleGnAl/mirror_platform_frameworks_av | media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "VectorArithmetic.h"
void From2iToMS_Float(const LVM_FLOAT* src, LVM_FLOAT* dstM, LVM_FLOAT* dstS, LVM_INT16 n) {
LVM_F... | ALGO | 0.987804 | 5.260035 |
114b6582-ee4b-425a-a15c-3986ff24f9b5 | TusharSachdeva29/CP-template | CP-Templates-master/String Algorithms/ZAlgirthm.cpp | vector<int> z_function(string s) {
int n = (int) s.length();
vector<int> z(n);
for (int i = 1, l = 0, r = 0; i < n; ++i) {
if (i <= r)
z[i] = min (r - i + 1, z[i - l]);
while (i + z[i] < n && s[z[i]] == s[i + z[i]])
++z[i];
if (i + z[i] - 1 > r)
l ... | ALGO | 0.999605 | 5.282731 |
b851366e-70f2-455a-bcc0-238e3056fc5c | diana26/Markov-Chain-Generator | MarkovDll/MarkovDll/stdafx.cpp | /* C++ program to apply MArkov-Chain algorithm based on "The Programming Practice" book,
the program using map, vector and deque data structures to maintain the input and generate the output*/
#include "stdafx.h"
#include <iostream>
#include <string>
#include <deque>
#include <vector>
#include <map>
#include <istream>
... | ALGO | 0.998831 | 5.669167 |
9c911c60-5d94-4aa1-8a66-3cb8f47c3c55 | vinay1212/StriversSDESheet-Challenge2023 | Day 7/searchIn2DMatrix.cpp | bool searchMatrix(vector<vector<int>>& mat, int target) {
// for(int i = 0; i < mat.size(); i++){
// for(int j = 0; j < mat[0].size(); j++){
// if(mat[i][j] == target){
// return true;
// }
// }
// }
// return false;
int m = mat[0].size()-1;
... | ALGO | 0.999893 | 5.522978 |
86435745-09af-4189-9996-d2f498b3b0de | Kavin1421/Leetcode-Solution | 2100-2199/2179.Count Good Triplets in an Array/Solution.cpp | class BinaryIndexedTree {
public:
int n;
vector<int> c;
BinaryIndexedTree(int _n)
: n(_n)
, c(_n + 1) {}
void update(int x, int delta) {
while (x <= n) {
c[x] += delta;
x += lowbit(x);
}
}
int query(int x) {
int s = 0;
wh... | ALGO | 0.999963 | 5.597489 |
5ec0be98-2825-4e0e-8d5c-7356a1b584d9 | caee/Photoluminescence-scanner | Marlin-2.1.2.5-PLRobot/Marlin/src/gcode/motion/G5.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(BEZIER_CURVE_SUPPORT)
#if AXIS_COLLISION('I') || AXIS_COLLISION('J')
#error "G5 parameter 'I' or 'J' collision with axis name."
#endif
#include "../../module/motion.h"
#include "../../module/planner_bezier.h"
/**
* Parameters interpreted according to:
* https://li... | ALGO | 0.930506 | 7.600971 |
b1f9955d-c781-4895-8bfc-38c54bb08013 | 2MP2/Pea | Etap2/TabuSearch.cpp | #include "TabuSearch.h"
TabuSearch::TabuSearch (int** matrixCon, int sizeCon, unsigned long long stopTimeCon)
{
matrix = matrixCon;
size = sizeCon;
stopTime = stopTimeCon;
tabuMatrix = new int* [size];
for (int i = 0; i < size; i++)
tabuMatrix[i] = new int[size];
for (int i = 0; i < size; i++)
for (int j =... | ALGO | 0.999957 | 4.195674 |
0e77e12f-e467-4b00-bccd-c670f47ecb8a | nybzmr/CP | Rebuild/Basics/13_bitwise_operations_and_bitmasks/B_Preparing_Olympiad.cpp | // Author: Nayaab Zameer
#include <bits/stdc++.h>
using namespace std;
#define pi (3.141592653589)
#define mod 1000000007
#define pb push_back
#define is insert
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(... | ALGO | 0.999952 | 3.872118 |
722559e8-8a8c-45b8-9880-8cb8631a3da7 | yeshengm/SJTU_OJ | hw_revisited/1202_bigint.cpp | #include <iostream>
using namespace std;
int a[1000005], b[1000005], sum[100005];
int asz, bsz, sumsz;
int main()
{
char ch;
while ((ch = cin.get()) != '\n') a[asz++] = ch - '0';
while ((ch = cin.get()) != '\n') b[bsz++] = ch -'0';
while (asz > 0 || bsz > 0) {
if (asz > 0 && bsz > 0) sum[sumsz... | ALGO | 0.999942 | 4.049665 |
01320277-331f-459f-8528-6bbf0d225b45 | changsongzhu/leetcode | C++/per_day/05-25-2017/036_m.cpp | /**
36[M]. Valid Sudoku
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
**/
class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
if(board.size()!=9||board[0].si... | ALGO | 0.999499 | 6.514332 |
b8bd9491-ac69-49cc-bcf7-1a4c449fa74c | apurvarawal/Stacks | palindrome.cpp | #include <iostream>
#include<stack>
using namespace std;
bool check(int arr[], stack <int> &s, int n){
int i=0;
if(n%2==0){
i=n/2;
}else{
i=(n/2)+1;
}
while(!s.empty() && i<n){
if(s.top()==arr[i]){
return true;
}
s.pop();
i++;
}
r... | ALGO | 0.999942 | 4.359524 |
43b3c3fb-f648-4530-a352-532e41296f99 | Mohit-106/DSA_Level_2 | DP/LIS/2_NumberofLIS.cpp | // class Solution {
// public:
// int findNumberOfLIS(vector<int>& nums) {
// int n = nums.size();
// vector<int>dp(n);
// dp[0]=1;
// vector<int>nolis(n);
// nolis[0]=1;
// int lis = 1;
// for(int i=1; i<n; i++){
// int maxlen = 0;
// ... | ALGO | 0.999978 | 5.20409 |
7c13a65f-9429-40ad-a393-7b55f77beaca | caoahn/CodePTIT-DSA | giatrinhonhatcuabieuthuc.cpp | #include<bits/stdc++.h>
using namespace std ;
long long n ;
long long solve(long long a[],long long b[]) {
sort(a,a+n) ;
sort(b,b+n,greater<long long> ()) ;
long long sum = 0 ;
for(int i=0; i < n ; i++) {
sum += 1ll*a[i]*b[i] ;
}
return sum ;
}
int main() {
... | ALGO | 0.99999 | 4.052792 |
d96906da-e890-40bd-b286-3e76834a4560 | hyoungkyeu8359/BOJ-Solutions | BOJ/C++/If statement/ifmoon4.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void){
int T,N;
double total,avg,overavg;
cin >> T;
for(int i = 0; i < T; i++){
cin >> N;
total = 0;
avg = 0;
overavg = 0;
int temp[N];
for(int j = 0; j < N; j++){
cin >> temp[j];
total += temp[j];
}
avg = total/N;
for(int j ... | ALGO | 0.999246 | 3.977858 |
856b8ef8-6163-4142-be52-756e213d0c80 | dr-islam-sa/Bio-Marline | Bio-marline Firmware/planner_bezier.cpp | /**
* planner_bezier.cpp
*
* Compute and buffer movement commands for bezier curves
*
*/
#include "MarlinConfig.h"
#if ENABLED(BEZIER_CURVE_SUPPORT)
#include "planner.h"
#include "language.h"
#include "temperature.h"
#include "Marlin.h"
// See the meaning in the documentation of cubic_b_spline().
#define MIN_S... | ALGO | 0.999626 | 7.905711 |
e2a8eeac-446a-4330-9035-23537258ac0c | minpaeng/algorithm | tree/1991.cpp | #include <iostream>
#include <cstring>
#include <vector>
using namespace std;
char tree[27];
int A = 64;
void pre(char v, int n) {
int i = v - A;
if (i > n) return;
cout << v;
if (tree[i * 2] != '.') {
pre(tree[i * 2], n);
}
if (tree[i * 2 + 1] != '.') {
pre(tree[i * 2 + 1], n);
}
}
void mid(char v, int n... | ALGO | 0.999526 | 3.773723 |
c97daef0-9bd2-4cd3-a1a4-e48b3a1dafc6 | yfyang86/pmat | proc/src/sort.cpp | /*
* sort.c
* implementation of various sorting algorithms
*
* @author Steve Hoffmann
* @date Mon 27 Nov 2006
*
* SVN
* Revision of last commit: $Rev: 77 $
* Author: $Author: steve $
* Date: $Date: 2008-11-17 13:16:59 +0100 (Mon, 17 Nov 2008) $
*
* Id: $Id: sort.c 77 2008-11-17 12:16:59Z steve $
* Ur... | ALGO | 0.999936 | 5.135265 |
ba727f0b-d1fd-46db-b146-835788da194e | nutthanonn/problem-solving | borntodevOfficialTask/cpp/1-star/บวกลบคูณหารเรื่องกล้วยๆ.cpp | #include <bits/stdc++.h>
using namespace std;
int main (){
int a, b;
cin >> a >> b;
cout << a << " + " << b << " = " << a+b << endl;
cout << a << " - " << b << " = " << a-b << endl;
cout << a << " * " << b << " = " << a*b << endl;
cout << a << " / " << b << " = " << a/b << endl;
return 0;
} | ALGO | 0.988422 | 4.085552 |
72520976-46cd-48ba-92bc-6a92b0dbca2a | TuZZiX/ROS_IDE_inc | eigen/bench/sparse_cholesky.cpp | // #define EIGEN_TAUCS_SUPPORT
// #define EIGEN_CHOLMOD_SUPPORT
#include <iostream>
#include <Eigen/Sparse>
// g++ -DSIZE=10000 -DDENSITY=0.001 sparse_cholesky.cpp -I.. -DDENSEMATRI -O3 -g0 -DNDEBUG -DNBTRIES=1 -I /home/gael/Coding/LinearAlgebra/taucs_full/src/ -I/home/gael/Coding/LinearAlgebra/taucs_full/build/lin... | ALGO | 0.993493 | 4.147974 |
89396df3-ce6d-4040-ba73-a04b013a7b60 | gabdumal/estrutura_de_dados | dcc013/tads_base/ed_aula_matrizes/matriz_triangular_superior/MatrizTriSup.cpp | #include <iostream>
#include "MatrizTriSup.h"
using namespace std;
MatrizTriSup::MatrizTriSup(int n)
{
numOrd = n;
int numElems = (n + 1) * n / 2;
vet = new float[numElems];
}
MatrizTriSup::~MatrizTriSup()
{
delete[] vet;
}
int MatrizTriSup::detInd(int i, int j)
{
if (i >= 0 && i < numOrd && j >... | ALGO | 0.987995 | 3.106728 |
0258376a-4eb7-4bfb-8611-9e47181d12ed | yeahsilver/algorithm | 백준/sort/1181.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
bool cmp (string a, string b) {
if(a.length() == b.length()) return a < b;
return a.length() < b.length();
}
int main(void) {
int N;
cin >> N;
vector<string> words;
for(int i = 0; i < N; i++) ... | ALGO | 0.999937 | 5.15049 |
5ba5312b-9836-4862-bc5e-492c7a43f9cb | Ankitsharma991/DSA | StriverA2ZDSA/DynamicProgramming/Stocks/Best_time_to_Buy_and_Sell.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> prices = {7,1,5,3,6,4};
int n = prices.size();
int minPrice = prices[0];
int maxProfit = 0;
for(int i=1;i<n;i++){
int cost = prices[i] - minPrice;
maxProfit = max(maxProfit, cost);
minPrice = min(minPrice,... | ALGO | 0.999029 | 4.54821 |
9dbef39c-3048-4485-a4d3-7486d688dbf8 | cheng33c/pat | basiclevel/1020.cpp | #include <iostream>
#include <iomanip>
using namespace std;
#define MAXSIZE 1001
int main()
{
int N,D;
/*
mooncake[0]: tons
mooncake[1]: price
mooncake[2]: price/tons
*/
double mooncake[MAXSIZE][3];
double total = 0;
cin>>N>>D;
for(int i = 0; i < N; i++)
{
cin>>mooncake[i][0];
... | ALGO | 0.999849 | 3.624784 |
6bb4005d-7450-4c8c-97ba-2bc9ebd834a4 | HONGYU-LEE/TheWayToAlgorithm | 动态规划/Solution/三角矩阵.cpp | //给出一个三角形,计算从三角形顶部到底部的最小路径和,每一步都可以移动到下面一行相邻的数字,
//https://www.nowcoder.com/practice/2b7995aa4f7949d99674d975489cb7da?tpId=46&tqId=29060&tPage=2&rp=2&ru=/ta/leetcode&qru=/ta/leetcode/question-rankin
//自底向上
class Solution {
public:
int minimumTotal(vector<vector<int> > &triangle) {
if(!triangle.size() || !tr... | ALGO | 0.999993 | 5.659406 |
bed29c33-6545-43e7-a658-8be9c8fed5e6 | sayed0refaat/Problem_Solving | Codeforces/B - Pairs.cpp | using namespace std;
#include <iostream>
#include <stdio.h>
#include <cmath>
#include<set>
#include<vector>
int n,m;
vector<pair<int,int >>vec;
bool can(int x){
int badpairs=0;
vector<int>valcant(n+3);
for(int i=0;i<vec.size();++i){
if(vec[i].first==x||vec[i].second==x){continue;}
... | ALGO | 0.99999 | 3.971533 |
c5b81411-3d12-4a7d-ae4b-f4f4cd931091 | jiyun0205/study | 백준/15894.cpp | #include <iostream>
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
long n;
std::cin >> n;
std::cout << 4*n;
return 0;
} | ALGO | 0.999488 | 3.535733 |
c5d4521c-ceeb-474e-bc0c-0163eb2d1962 | glassechidna/zxing-cpp | core/src/zxing/oned/OneDReader.cpp | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#include <zxing/ZXing.h>
#include <zxing/oned/OneDReader.h>
#include <zxing/ReaderException.h>
#include <zxing/oned/OneDResultPoint.h>
#include <zxing/NotFoundException.h>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <cfloa... | ALGO | 0.967261 | 6.08873 |
f4330a70-3d9a-4784-9e27-6a8ab21b0ed0 | dkhonker/sysu | 数据结构/数据结构实验课文件/EXP13-EXAM02/for_test/source/20354057/c2t.cpp | #include<iostream>
using namespace std;
struct Node {
char data;
int parent, lchild, rchild;
} nodes[101];
int n, lastchild[101];
void buildTree(){
cin >> n;
for (int i = 1; i <= n; i++)
cin >> nodes[i].data >> nodes[i].parent;
for (int i = 2; i <= n; i++){
int f = nodes[i].parent;
if (lastchild[f... | ALGO | 0.999941 | 3.933702 |
be046d1f-f9d2-4189-9b1c-b51582dbedfb | GeislerAgata/unicornAttack | ObiektGry.cpp | #include "ObiektGry.h"
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define SCENE_HEIGHT 600
#define WIELKOSC_JEDNOROZCA 30
#define X_START 5 //startowa pozycja x jednoroca
#define Y_START 230 //startowa pozycja u jednoroca
#define MOVE 1 //przemieszczenie... | TOOL | 0.911783 | 3.711836 |
cdf30883-dceb-43ff-9390-9d5ecfb864f3 | Ritwik33/cpp_projects | educational_codeforces_round_125/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define inf 1e18
#define mod 1000000007
#define int ... | ALGO | 0.999795 | 3.509567 |
0a6142b0-e737-43de-bc79-456daaec72a1 | jwseph/competitive-programming | cses/1682v2.cpp | #include <bits/stdc++.h>
using namespace std;
struct SCC {
int N, NC = 0;
vector<vector<int>> A[2];
vector<int> C, O;
vector<bool> V;
SCC(int N) : N(N) {
A[0].resize(N), A[1].resize(N), V.resize(N), C.assign(N, -1);
}
void add(int i, int j) {
A[0][i].push_back(j), A[1][j].pu... | ALGO | 0.999991 | 4.344429 |
28bcebac-8e56-482b-b2a9-cf13fe0e5ac4 | Ayushyadav04/leetcode-solution | 0290-word-pattern/0290-word-pattern.cpp | class Solution {
public:
vector<string> fun(string st){
vector<string> v;
string s;
stringstream a(st);
while(getline(a,s,' ')){
v.push_back(s);
}
return v;
}
bool wordPattern(string pattern, string s) {
vector<string> ou=fun(s);
if(pattern.length()!=o... | ALGO | 0.999506 | 6.162031 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.