uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
4caee97b-3489-4f8f-bd4a-bbac2995efb4 | AntonSkachko/Fundamentals_of_Algorithmization_and_Programming | firstSemester/variant9/laba_3/third_level.cpp | #include <iostream>
#include <cmath>
using namespace std;
double y(double x)
{
return (1 + x * x) / 2 * atan(x) - x / 2;
}
double s(double x, double eps, int& k)
{
double sum = 0, w = -x; k = 0;
do
{
k++;
w *= -x * x;
sum += w / (4 * k * k - 1);
} while (fabs(w / (4 * k * k - 1)) > eps);
return sum;
}
i... | ALGO | 0.989296 | 3.530039 |
05baef83-eec8-4562-9053-ee798ba430e6 | ishandutta2007/codeforces | miraclefafa/normal/960/G.cpp | #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 all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long l... | ALGO | 0.999973 | 4.642188 |
701dc12d-20fb-4ef3-ac9c-29b0d150b626 | GQH123/Renatus-Project-Euler-Solutions | 081 - Path sum: two ways/81.cpp | #include <bits/stdc++.h>
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, r, l) for (int i = r; i >= l; i--)
#define srep(i, l, r) for (int i = l; i < r; i++)
#define sper(i, r, l) for (int i = r; i > l; i--)
#define erep(i, x) for (int i = h[x]; i; i = e[i].next)
#define erep2(i, x) for (int& i = cur[x... | ALGO | 0.999915 | 3.64734 |
4995e87d-cb10-4e53-a361-92e882f4facf | Mohamed-Hossam/Problem-Solving | live archive/LiveArchive - 4627.cpp | //In the name of Allah
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<iterator>
#include<cmath>
#include<string>
#include<sstream>
#include<cstring>
#include<ctype.h>
#include<iomanip>
#include<functional>
#inc... | ALGO | 0.999861 | 3.712685 |
d8c7d6df-2e16-4ffa-9ef3-d5d78e0f36f0 | 3l-d1abl0/DS-Algo | cpp/practise/sorted-rotated-array-search.cpp | #include<bits/stdc++.h>
using namespace std;
int rotatedBS(int arr[], int _start, int _end, int data ){
if(_start > _end)
return -1;
int mid = _start + (_end - _start)/2;
if(data == arr[mid])
return mid;
if(arr[_start] <= arr[mid] ){
if(data >= arr[_start] && data< arr[mid... | ALGO | 0.999987 | 5.097696 |
3ed7aa1d-25fc-4b7d-97ab-b32f044c7073 | adarshnarayan04/Codeforces | abc312_a.cpp |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define popcount(x) __builtin_popcountll(x)
#define w(t) ll testcase; cin>>testcase; for (ll tc = 1; tc <= testcase; ++tc)
#define v(x) for(int i = 0; i < n; ++i){int x;cin>>x;v.pb(x);}
#define vm(x) for(... | ALGO | 0.999962 | 3.660577 |
2c9e9c2b-1039-42ac-b599-58bedd3d4c7a | alexandraback/datacollection | solutions_5634697451274240_1/C++/cathook/b.cpp | #include <stdio.h>
#include <string.h>
const size_t SMAX = 100;
int main(void) {
int num_cases;
scanf("%d", &num_cases);
for (int case_idx = 1; case_idx <= num_cases; ++case_idx) {
static char states[SMAX + 1];
scanf("%s", states);
int ans = 0;
char* last = states + strlen(states) - 1;
wh... | ALGO | 0.999575 | 4.287868 |
e8262eed-33d1-4acc-8ee2-2ab5e8662592 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_6385_4.cpp | #include <bits/stdc++.h>
char s[30002][22];
int main() {
int n, i, j, c, ans = 0, d;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%s", s[i]);
}
for (i = 0; i < strlen(s[1]); i++) {
c = 0;
for (j = 2; j <= n; j++) {
if (s[j][i] == s[j - 1][i]) {
c++;
}
}
if (c != n... | ALGO | 0.999907 | 3.555138 |
bf6ed850-cf94-4075-a172-a53c3f50263e | fenghuayumo/mngp | dependencies/eigen/test/visitor.cpp | #include "main.h"
template<typename MatrixType> void matrixVisitor(const MatrixType& p)
{
typedef typename MatrixType::Scalar Scalar;
Index rows = p.rows();
Index cols = p.cols();
// construct a random matrix where all coefficients are different
MatrixType m;
m = MatrixType::Random(rows, cols);
for(Ind... | TEST | 0.86627 | 6.893219 |
c8091063-5d54-4b64-a675-a0f75a308760 | CharlieHon/heima_cpp | code/16_STL/06_queue.cpp | #include <iostream>
#include <queue>
#include <string>
using namespace std;
// queue
class Person{
public:
Person(const string &name, const int &a) : Name(name), Age(a) {}
string Name;
int Age;
};
void test01(){
// 创建队列
queue<Person> q;
// 准备数据
Person p1("Tom", 25), p2("Bruce", 22), p3("... | ALGO | 0.851078 | 4.430892 |
e37f38e2-25e8-4f63-9e0b-f99b40ccd36a | Kirti123x/ocd | day00.cpp | // Q1) Duplicate elements in array
// APPROACH: sort the array, then check if there are any repeating elements.
// TC: O(n) SC:O(1)
class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
sort(nums.begin(), nums.end()); // O(N log N)
for (int i = 1; i < nums.size(); i++... | ALGO | 0.99921 | 5.418827 |
47357c93-afc3-464b-900a-6b7a2a17aa57 | Suraj-Kaple/Data-Structures-Algorithms | Trees/Path to given node.cpp | // https://www.interviewbit.com/problems/path-to-given-node/
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
int findPath(vector<int> &ans, TreeNode* A, int B){
if(A == NULL)... | ALGO | 0.999995 | 5.581937 |
1507b7ed-a20d-456d-8ef3-f2430d84b17d | hakomori64/atcoder | abc/063a.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << (a + b >= 10 ? "error" : to_string(a + b)) << endl;
return 0;
}
| ALGO | 0.99877 | 3.661715 |
7b956564-2cc5-4063-8f92-9ea09c551498 | Saksham-Mishra03/small-important-concept-for-cp | bit manipulation/Given an integer array nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.cpp | class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
long long int rem2 = 0;
for(int n:nums)
{
rem2 ^=n;
}
int last1 = rem2 & (-rem2); //int last1 = rem2 & -(rem2-1);//both true
vector<int>ans = {0,0};
for(int n:nums)
{
... | ALGO | 0.999964 | 5.220548 |
0fafc16b-0690-4850-bec8-c59d1cd48462 | s-k-jha/DSA_STL | Trees/createTree.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
vector<Node*> children;
//constructor
Node(int data){
this->data=data;
}
};
void printTree(Node*root){
cout<<root->data<<":";
for(int i=0;i<root->children.size();i++){
cout<<root->children[i]->data... | ALGO | 0.993433 | 4.427811 |
e98fbce9-6f87-43d4-a77e-9561b748ee78 | sonai99/Leetcode-DP-Study-Plan-1 | 198. House Robber.cpp | class Solution {
public:
int rob(vector<int>& nums) {
int n=nums.size();
if(nums.empty()) return 0;
if(n == 1) return nums[0];
int prev1=nums[0];
int prev2=max(nums[0],nums[1]);
int curr=prev2;
for(int i=2;i<n;i++){
curr=max(prev2, prev1+nums[i]);... | ALGO | 0.999779 | 5.897637 |
f0fe58d2-aa8f-4dcc-b785-b8722b3fa04b | ishandutta2007/codeforces | geothermal/normal/1680/C.cpp | #include "bits/stdc++.h"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll>... | ALGO | 0.999805 | 4.898512 |
642f6480-8ba5-4f1c-8b9e-6e45d62b1dcc | sarvex/leetcode-matlab | solution/0700-0799/0746.Min Cost Climbing Stairs/Solution.cpp | class Solution {
public:
int minCostClimbingStairs(vector<int>& cost) {
int a = 0, b = 0;
for (int i = 1; i < cost.size(); ++i) {
int c = min(a + cost[i - 1], b + cost[i]);
a = b;
b = c;
}
return b;
}
}; | ALGO | 0.999976 | 6.230235 |
0227ae1f-2281-4613-afc7-fadcdc3f97fe | git-rahul1/login_button_disable | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
a6800f54-2773-4bab-9184-c6b91b6964f4 | mayuuu05/Quick_Starter | 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 |
29966a33-e6a9-41dc-8400-104d6f89f273 | tarunsamanta2k22/Data-Structure---Algorithm | #Tech dose/#Selection Sort.cpp | #include<bits/stdc++.h>
using namespace std;
void SEL_sort(int arr[],int n)
{
for(int i=0;i<n-1;i++)
{
int imin=i;
for(int j=i+1;j<n;j++)
{
if(arr[j]<arr[imin])
imin=j;
}
swap(arr[i],arr[imin]);
}
}
void Display(int arr[],int n)
{
for(int i=0;i<n;i++)
cout<<arr[i]<<" ";
}
int main()
{
int T;... | ALGO | 0.999926 | 4.261294 |
93365452-4672-45bb-96a0-1ea705ba42fa | shashank20-02/data_structures_and_algorithms- | codechef/MedianMax.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<long long> a(n, 0), b(n, 0);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n; i++)
... | ALGO | 0.999995 | 3.762007 |
5ad926da-aba0-4629-83c7-2598884a7d77 | Error-Nasim/Data-Structure | SORTING/Merge_Sort.cpp | #include <bits/stdc++.h>
using namespace std;
/*
Time complexity=O(nlogn);
Space Complexity=O(n);
*/
void merge(int ar[], int low, int mid, int high)
{
int left = low;
int right = mid + 1;
int tmp[high - low + 1] = {0};
int x = 0;
while (left <= mid && right <= high)
{
if (ar[lef... | ALGO | 0.999993 | 5.096237 |
8a0d42cf-981d-4cbc-be94-896ec4bb34d9 | DarthPiotr/Portfolio | University/Algorithms/potyczki/pot-01/sam.cpp | #include <iostream>
#define OFFSET 1000000
using namespace std;
struct ln{
int a = 0, b = 0;
} tab[2000001];
int main (){
ios_base::sync_with_stdio(0);
int t, a, b, i, n;
cin >> n;
for(i = 0; i < n; i++){
cin >> t >> a >> b;
if(t == 1)
tab[a-b+OFFSET].a++;
els... | ALGO | 0.999876 | 3.470024 |
05acaa17-59fa-42cb-a18c-0cc00acf36d3 | MazenTayseer/Codeforces_Solutions | B-Problems/1367B - Even Array.cpp | //Mazen Tayseer
//Accepted
#include <bits/stdc++.h>
typedef long long int a1;
using namespace std;
void insertArr(int arr[], int t) {
for (int i = 0; i < t; i++) {
cin >> arr[i];
}
}
int main()
{
int n; cin >> n;
int t;
int arr[500];
while (n--) {
cin >> t;
int even = 0, odd = 0;
insertArr(arr, t);
... | ALGO | 0.999137 | 4.492536 |
30f63364-5d97-401d-9055-0372d2b83065 | algo-study-embedded-21/algorithm-study | gyuri/Week19/Beakjoon_11060.cpp | //#include <iostream>
//#define endl '\n'
//#define MAX 1001
//using namespace std;
//
//int N;
//int arr[1001];
//int dp[1001];
//int result;
//
//// dp[A] = V
//// V : A° ĭ ִ ּ
//
//void Input() {
//
// cin >> N;
//
// for (int i = 0; i < N; i++) {
// cin >> arr[i];
// }
//
//}
//
//void FillDp() ... | ALGO | 0.999908 | 3.920734 |
717a2414-01a7-4773-809f-192ea04bd428 | patelviralb/LeetCode-CPP | add-two-numbers.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
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) {}
}... | ALGO | 0.999479 | 6.431034 |
5c7b978b-60a2-4093-ad37-32334a523833 | tsawke/OI | Luogu/P4XXX/P4859.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define PI M_PI
#define E M_E
#define npt nullptr
#define SON i->to
#define OPNEW void* operator new(size_t)
#define ROPNEW void* Edge::operator new(size_t){static Edge* P = ed; return P++;}
using namespace std;
mt19937 rnd(random_device{}());
int rndd(int l, int r)... | ALGO | 0.999995 | 4.013048 |
dc2c8089-168d-4c55-a587-0153145948db | Paradox05/N-Body | body.cpp | #include <string>
#include <stdexcept> // For error handling
#include "body.hpp"
#include "Universe.hpp"
const double G = 6.67e-11;
// Constructor using correct initialization order
Universe::Body::Body(int winSize)
: x_pos(0), y_pos(0), x_vel(0), y_vel(0), x_accel_(0), y_accel_(0) {
}
// Destructor
Universe::B... | TOOL | 0.92954 | 5.350038 |
675dd3aa-778f-4139-8ebd-8049aaf50a8f | shahidul-brur/OnlineJudge-Solution | UVa/12968 - EuroBasket Champions.cpp | /************************************************************
* Problem:
* Link:
* Verdict:
* Date:
*
* Coder: Md. Shahidul Islam
* Dept. : Computer Science and Engineering
* Institute: Begum Rokeya U... | ALGO | 0.999875 | 3.630973 |
e0b276fb-75f0-4411-938e-cc491c39b464 | mert-tetik/LigidPainter | LigidPainter/Main/thirdparty/include/qrcodegen.cpp | #include <algorithm>
#include <cassert>
#include <climits>
#include <cstddef>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <utility>
#include "qrcodegen.hpp"
using std::int8_t;
using std::uint8_t;
using std::size_t;
using std::vector;
namespace qrcodegen {
/*---- Class QrSegment ----*/
QrSegmen... | TOOL | 0.927869 | 6.345041 |
c5b18012-fcc5-4512-9af1-10772b2eb34a | sunpierce/EE2410 | Coding_1/1.3_string.cpp | #include <iostream>
using namespace std;
class String
{
friend ostream& operator<<(ostream& out, String& s);
friend istream& operator>>(istream& in, String& s);
public:
String(char *init, int m);
// constructor using input string init of length m
bool operator == (String t);//equali... | ALGO | 0.972077 | 3.631198 |
79d2ab8a-78ed-44fe-893d-6117705c6d82 | suryarathee/DSA | Searching & Sorting/euclidian.cpp | #include<iostream>
using namespace std;
int gcd(int a,int b){
if(b==0) return -1;
if(b>a){
return gcd(b,a);
}
while(b!=0)
{
int reminder = a%b;
a=b;
b=reminder;
}
return a;
}
int LCM(int a,int b){
int gcdValue = gcd(a,b);
return (a*b)/gcdValue;
}
int ... | ALGO | 0.999419 | 3.632102 |
aed5852c-64af-4c8e-a8de-831b977155aa | ishandutta2007/codeforces | nocodenolife/normal/1322/B.cpp | //#define DEBUG
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define BSET(a, p) ((a) | (1ll << (p)))
#define BCHK(a, p) ((a) & (1ll << (p)))
#define BXOR(a, p) ((a) ^ (1ll << (p)));
#define BREM(a, p) (BCHK(a,... | ALGO | 0.999995 | 3.974214 |
e5f9f3c7-93da-4988-8304-4cbdd330798c | shruti1421/Data-Structures-and-Algorithms | Dynamic Programming/Basic Problems/5. Minimum Falling Path Sum 1.cpp | /*Given an n x n array of integers matrix, return the minimum sum of any falling path through matrix.
A falling path starts at any element in the first row and chooses the element in the next row that is either directly below or diagonally left/right. Specifically, the next element from position (row, col) will be (ro... | ALGO | 0.999993 | 6.549403 |
1234c636-5640-4c15-9974-7a9797409cae | MioZh/asbdbsdbas | Lab8/Hash.cpp | #include <iostream>
#include <vector>
using namespace std;
long long MOD = 1e9 + 7;
long long X = 31;
long long getHash(string s) {
long long hash = 0;
long long curX = 1;
for (int i = 0; i < s.size(); i++) {
long long curHash = (s[i] - 'a' + 1) * curX % MOD;
hash = (hash + curHash) % MOD;... | ALGO | 0.999981 | 5.507187 |
7fde0b9a-eab5-4c85-ba95-66283386df21 | Phylliida/slam-libs | eigen/include/doc/examples/DenseBase_middleCols_int.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(1..3,:) =\n" << A.middleCols(1,3) << endl;
return 0;
}
| ALGO | 0.975396 | 3.133398 |
478be8a8-2137-4916-ad99-74d312745cb9 | hjpark83/Baekjoon | Silver/Silver1/RGB.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int house[1001][3];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int cost[3];
int N;
cin>>N;
house[0][0]=0;
house[0][1]=0;
house[0][2]=0;
for(int i=1;i<=N;i++){
cin>>cost[0]>... | ALGO | 0.999662 | 4.239571 |
512ac411-68a7-472b-a53c-062b3edf61a0 | RobinMaheshwary/5th-Sem | Practice/C/C++/q.cpp | // def miniMaxSum(arr):
// arr.sort()
// hold = [None]*int(len(arr)-3)
// for i in range (0,len(arr)-3):
// temp=0
// for j in range(i,i+4):
// temp = temp + arr[j]
// hold[i] = temp
// print(hold[0],hold[-1])
// convert it into cpp
// Path: C/C++/q.cpp
#include <bi... | ALGO | 0.999879 | 5.194333 |
bea0d7e2-fdb7-4dab-b8b4-bd23531ecc6a | SunilKumarPradhan/C_Plus_Plus_DSA | 03. Bit Magic/07TwoOddOccurring.cpp | #include <bits/stdc++.h>
using namespace std;
pair<int, int> findTwoOddOccurring(const vector<int>& arr) {
int xor2 = 0;
for (int num : arr) {
xor2 ^= num;
}
int setBit = xor2 & ~(xor2 - 1);
int x = 0, y = 0;
for (int num : arr) {
if (num & setBit) {
x ^= num;
... | ALGO | 0.99992 | 5.742871 |
29879e5f-2615-48ad-b04a-7f39d07ae6b3 | rafisgithub/CppLabClasses | C++lab-04 solve pb using function/callByAddress.cpp | /* The call by pointer method of passing arguments to a function copies the address of an argument into
the formal parameter.
Inside the function,the address is used to access the actual argument used in the call.This means that changers
made to the parameter affect the passed argument.
*/
#include<iostream>
using nam... | ALGO | 0.999526 | 4.89882 |
64806c5c-6fff-49fb-bb75-275a93fcc634 | Tanishgupta007/DSA-CPP | 163_remove_duplicated_from_unsorted_list.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int d)
{
this->data = d;
this->next = NULL;
}
};
void print(Node *&head)
{
if (head == NULL)
{
cout << "List is empty!!!" << endl;
}
Node *temp = head;
while (temp... | ALGO | 0.996574 | 4.217089 |
6b8f3fa8-87e2-4bec-92cd-8acf8d2e93a9 | ProdanRaduMatei/Probleme-Pbinfo | Solutions/EasyQuery/main.cpp | #include <iostream>
#include <fstream>
using namespace std;
long long int a[1000002], b[1000002];
int main()
{
long long int n, s = 0, t, op, left, right, v, i;
ifstream fin("easyquery.in");
ofstream fout("easyquery.out");
b[0] = 0;
fin >> n;
for (i = 1; i <= n; i++)
{
fin >> a[i]... | ALGO | 0.999699 | 3.123066 |
987de8ff-861e-49aa-8979-cb8493f669fb | PhuNd2k3/Algorithms | Class_exercise/longestCommonSubsequence.cpp | // CPP
// Chua co truy vet
#include <bits/stdc++.h>
using namespace std;
int n, m;
#define MAX 10000 + 100
int s[MAX][MAX], x[MAX], y[MAX];
void input()
{
cin >> n >> m;
x[0] = 0;
y[0] = 0;
for (int i = 1; i <= n; i++)
{
cin >> x[i];
}
for (int j = 1; j <= m; j++)
{
cin ... | ALGO | 0.999969 | 3.783008 |
8c4cf1e6-2662-4222-adf2-feeba0455b9a | WeiHe999/dmoj_cpp_level_2 | comfortable_cows.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
bool a[1001][1001];
vector <int> dx = {-1,1,0,0};
vector <int> dy = {0,0,-1,1};
bool valid_position(int x,int y)
{
return x >= 0 && x <= n && y >= 0 && y <= n;
}
bool comfortable(int x, int y)
{
if (a[x][y] == 0) return 0;
int neighbours = 0;
for (int d = 0;... | ALGO | 0.999894 | 4.386572 |
3f6c2ef3-d442-4901-8b9a-29e47a45b77a | aestheticisma/leetcode_daily | cpp/839_相似字符串组_hard.cpp | class UnionFind {
private:
vector<int> parent;
vector<int> sz;
int setCount;
public:
UnionFind (int n): parent(n), sz(n, 1), setCount(n) {
iota(parent.begin(), parent.end(), 0);
}
int find (int x) {
return parent[x] == x ? x : parent[x] = find(parent[x]);
}
bool united (i... | ALGO | 0.999977 | 5.962182 |
f10f3c78-fc46-4adb-89f8-14ce28e54ae9 | chhetri123/Data-Structure-And-Algorithm | Reverse Linked List/recursionPrint.cpp | #include<iostream>
using namespace std;
struct Node{
int data;
Node* next;
};
void Insert(Node** head,int x){
Node *temp = new Node();
temp->data = x;
temp->next = *head;
*head = temp;
}
// print the linked list in reversed order
void reversePrint(Node* head ){
if(head==NULL) {
return;
}
reversePrint(he... | ALGO | 0.999871 | 4.5696 |
4e90d74e-ebcf-4f4f-beb2-4e4a3ff8bc19 | rishabdev2997/CrackYourPlacement | buy and sell stocks.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int mini = prices[0];
int maxProfit = 0;
for(int i = 1;i<prices.size();i++){
int cost = prices[i]-mini;
maxProfit = max(maxProfit,cost);
mini = min(mini,prices[i]);
}
return maxP... | ALGO | 0.999913 | 6.108826 |
b5f3cf4b-471a-4fcd-ac84-5a825bf488ef | Fostiriy/PDP | lab_5/lab_5.cpp | #include <barrier>
#include <bit>
#include <chrono>
#include <complex>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <numbers>
#include <random>
#include <thread>
#include <vector>
using namespace std;
/*
const unsigned nibbles[16] = {0, 0B1000, 0B0100, 0B1100, 0B0010, 0B1010, 0B0110, 0B1110,
... | ALGO | 0.998911 | 4.929676 |
87078e86-1dbc-4acd-8b2b-258c3aadbd53 | pawanps55/LeetCode_Codes | 179-largest-number/largest-number.cpp | class Solution {
public:
static bool compare(int a,int b){
string ab = to_string(a)+to_string(b);
string ba = to_string(b)+to_string(a);
return ab>ba;
}
string largestNumber(vector<int>& nums) {
sort(nums.begin(), nums.end(), compare);
string result;
... | ALGO | 0.999994 | 6.316593 |
0dd81f10-2698-428a-9132-0d85ddbcd385 | dhivyeshrk/OpenMP_MPI_Assignments | lab5/lab5/2.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
int inside_circle = 0;
int total_points = 1000000; // Adjust total_points as needed
srand(time(NULL));
printf("-----DHIVYESH R K---------2021BCS0084----\n");
for (int i = 0; i < total_points; i++) {
double x = (double)ra... | ALGO | 0.999762 | 4.347026 |
e1c1537a-f394-439c-a845-fffb4a07ccd4 | JatinBhargava/Cohort | 0238-product-of-array-except-self/0238-product-of-array-except-self.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int n = nums.size();
int prefixProduct[n];
int suffixProduct[n];
vector<int>pro(n);
prefixProduct[0] = 1;
for(int i=1;i<n;i++){
prefixProduct[i] = nums[i-1] * pre... | ALGO | 0.99997 | 6.472591 |
75deaca7-c9a7-4748-98a9-ab5284a518d7 | orioldedios/Pinball-physics | PINBALL/Box2D/Box2D/Collision/Shapes/b2ChainShape.cpp | #include <Box2D/Collision/Shapes/b2ChainShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <new>
#include <string.h>
b2ChainShape::~b2ChainShape()
{
Clear();
}
void b2ChainShape::Clear()
{
b2Free(m_vertices);
m_vertices = NULL;
m_count = 0;
}
void b2ChainShape::CreateLoop(const b2Vec2* vertices, i... | ALGO | 0.977707 | 6.764051 |
51a8fd10-fe2c-4be0-85bf-d4b0cf488cb8 | AnanyaSinha2717/CPP-Projects | INDIE/factorial.cpp | #include <iostream>
#include <cmath>
using namespace std;
// after 31! it will go out of range
int factorial(int num)
{
if (num == 0)
{
return 1;
}
int result = 1;
for (int i = 1; i <= num; i++)
{
result = result * i;
}
return result;
}
int main()
{
int a;
cout... | ALGO | 0.999436 | 4.643729 |
7c4ef9db-b380-4c46-abf0-7febe4b49b66 | mmPranto/Online-Judge | Codeforces/1692_A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int a,b,c,d;
cin>>a>>b>>c>>d;
int count=0;
if(a<b)
{
count+=1;
}
if(a<c)
{
count+=1;
}
if(a<d)
{
... | ALGO | 0.999693 | 3.195425 |
d50e9158-179c-410f-b257-383259e16e57 | mtfuka/competitive-programming | AtCoder/AtCoder_Beginner_Contest/241/D.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int q;
cin >> q;
multiset<long long> st;
while (q--) {
int t;
cin >> t;
if (t == 1) {
long long x;
cin >> x;
st.insert(x);
} else if (t == 2) {
long long x, k;
... | ALGO | 0.999806 | 4.579384 |
8d4fa439-04fe-44b0-9cda-d41ecbca7e1c | nidhived/Assignment1 | inflation.cpp | #include <iostream>
using namespace std;
//inflation problem that guages the expected cost of an item in # of years
int main(int argc, char **argv){
float cost;
int years;
float rate;
cout << "Enter the cost of the item: " << endl;
cin>> cost;
cout << "Enter the years: " << endl;
cin>> years;
cout <<... | ALGO | 0.929578 | 3.753137 |
d86590f9-42f2-4cee-918a-2f80ce5b6eec | ZhouWeikuan/zoj | zju.finished/1716.cpp | #include<cstdio>
#include<cstring>
using namespace std;
struct Node {
int mark;
int s;
};
enum {
SIZ = 104,
};
Node tree[SIZ][SIZ];
int W,H;
int S,T;
int num;
void readIn(){
int i,j;
scanf("%d%d",&W,&H);
memset(tree, 0, sizeof(tree));
for(int k=0;k<num;k++){
scanf("%d%d",&i,&j);
... | ALGO | 0.998531 | 3.609806 |
8ffac0d0-78ad-424d-8cad-acf475c25013 | DrSwad/CP | Submissions/Camps/Onsite PTZ Training Camp/Day 10/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> convert_base(ll n, ll k) {
vector<ll> d;
while (n) {
d.push_back(n % k);
n /= k;
}
return d;
}
ll base10_value(vector<ll> num, ll base) {
int nd = num.size();
ll value = 0;
for (ll d : num) {
value = value * base... | ALGO | 0.999874 | 4.203037 |
5952db8b-3b9c-4f35-b5dd-ef7fb87d0372 | yiqichenshallwetalk/GROMACS-FEP-GPU | src/gromacs/restraint/restraintmdmodule.cpp | #include "gmxpre.h"
#include "restraintmdmodule.h"
#include <memory>
#include "gromacs/mdtypes/forceoutput.h"
#include "gromacs/mdtypes/iforceprovider.h"
#include "restraintmdmodule_impl.h"
namespace gmx
{
RestraintForceProvider::RestraintForceProvider(std::shared_ptr<IRestraintPotential> restraint,
... | ALGO | 0.997257 | 7.516234 |
c0ddea83-bf68-404f-841c-144fd0750752 | VatsalS31/DSA | Graphs/LC1971-Find-if-path-exists-in-graph.cpp | // https://leetcode.com/problems/find-if-path-exists-in-graph/description/
class Solution
{
public:
bool dfs(unordered_map<int, vector<int>> &graph, vector<bool> &seen, int currNode, int destination)
{
if (currNode == destination)
{
return true;
}
if (!seen[currNode]... | ALGO | 0.999992 | 6.508728 |
60afd4b3-f813-411f-b51b-345d26cf36d0 | TW-Robotics/ROD_SS2024_BB | universal_robot/ur_kinematics/src/ur_kin.cpp | #include <ur_kinematics/ur_kin.h>
#include <math.h>
#include <stdio.h>
namespace ur_kinematics {
namespace {
const double ZERO_THRESH = 0.00000001;
int SIGN(double x) {
return (x > 0) - (x < 0);
}
const double PI = M_PI;
//#define UR16e_PARAMS
#ifdef UR16e_PARAMS
const double d1 ... | ALGO | 0.999591 | 4.926683 |
175d2809-4cb8-4552-8cbc-9fffea29fd73 | c3-competitiveprogramming/cp-template-isadoravrx | hackerrank/X_and_Y_set_bits /X_and_Y_set_bits.cpp | #include <iostream>
#include <map>
typedef long long ll;
using namespace std;
ll resto = 1e9+7;
int main(){
ll pot = 1;
map<ll,ll>mp;
for(ll i = 0; i <= 100000; i++){
mp[i] = pot % resto;
pot = ((pot % resto) * 2) % resto;
}
ll t;
cin >> t;
while(t--){
ll a,b;
... | ALGO | 0.999565 | 4.629788 |
ad2f88e1-f246-4ab9-be0f-b1aaeed85ebd | ionuttbara/programareMateInfo | clasa 11 - 12/divide_et_impera/suma_vectori_par.cpp | // Sumare numerelor pare din vector.
#include <iostream>
using namespace std;
int n, v[30];
void divizeaza (int s, int d, int &m)
{
m=(s+d)/2;
}
void combina(int x, int y, int &z)
{
z=x+y;
}
void dei(int s, int d, int &z)
{
int m, x1, x2;
if(d==s)
if(v[s]%2==0)
z=v[s];
else
z=0;
e... | ALGO | 0.99994 | 4.55999 |
adbbc8b9-635d-4e5d-a280-96c16aab1253 | dhruv-patel-04/cpp | prac_4.cpp | #include <iostream>
using namespace std;
//function to find area of circle
void area(float a)
{
cout<<"\nArea of circle is "<<a*a*3.14<<endl;
}
//function to find area of rectangle
void area(float a, float b)
{
cout<<"\nArea of rectangle is "<<a*b<<endl;
}
//function to find area of cuboid
void area(float a, floa... | ALGO | 0.968137 | 3.065351 |
c875103b-0e13-4234-91f1-a506c8b2253f | Abhrajyoti00/Data-Structures-and-Algorithms | 450 Questions for DSA/Love Babbar DSA/2. Matrix/44_Rotate_Matrix_by_90.cpp | #include <bits/stdc++.h>
using namespace std;
#define N 4
// Function to rotate the matrix 90 degree clockwise
void rotate90Clockwise(int arr[N][N])
{
int temp;
for(int i = 0; i < N; i++){
for(int j = N-1; j > -1; j--){
cout<<arr[j][i]<<" ";
}
cout<<endl;
}
}
// Dri... | ALGO | 0.999775 | 4.528059 |
6bf70502-2473-4dfe-a53f-2939a16e6068 | Viateur-akimana/solutions | exercise56.cpp | #include <iostream>
int isFilter(int a[], int len) {
bool contains9 = false;
bool contains11 = false;
bool contains7 = false;
bool contains13 = false;
// Iterate through the array to check the conditions
for (int i = 0; i < len; ++i) {
if (a[i] == 9) {
contains9 = true;
... | ALGO | 0.998355 | 5.443085 |
7fa55d6a-95df-414c-83ec-62ea462ac411 | sakshi-06/Leetcode-daily-tasks | 1029-two-city-scheduling/1029-two-city-scheduling.cpp | class Solution {
public:
int twoCitySchedCost(vector<vector<int>>& costs) {
int n=costs.size();
vector<int> loss(n, 0);
int tot=0;
for(int i=0;i<costs.size();i++)
{
tot+=costs[i][0];
loss[i]=costs[i][0]-costs[i][1];
}
sort(loss.begin(), ... | ALGO | 0.999985 | 5.932497 |
af1a6f74-8552-4a40-b7e7-cd007576c041 | andream7/cuit_sharing | C 语言/PTA 题目/1A/ 组合数的和 .cpp | #include <stdio.h>
int main(){
int n, num[15], sum = 0, mul;
scanf("%d", &n);
for(int i=0; i<n; i++)
scanf("%d", &num[i]);
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(i == j) continue;
mul = num[i]*10 + num[j];
sum += mul;
}
}
... | ALGO | 0.999659 | 3.870802 |
b86199a8-a2cc-4649-a14f-ddfeeb6077d7 | CoderNessim/world_time_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998756 | 6.772262 |
f7760422-f38c-491d-8415-2783d7eba399 | youmorry/atcoder | abc095/arc096_a/main.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int a, b, c, x, y; cin >> a >> b >> c >> x >> y;
int mi = min(x, y);
ll ans = 0;
if (a + b > c * 2) {
ans += mi * c * 2;
x -= mi, y -= mi;
}
if (a > c * 2) ans += x * c * 2;
else ans += x * a;... | ALGO | 0.998556 | 3.664328 |
7ccb6ecf-a8c1-4f70-b41d-403287e65fdf | flexath/flexath-cpp | C++ Recursion/factorial_with_recursion.cpp | #include <iostream>
using namespace std;
int factorial(int n){
if(n==0){
return 1;
}
return n*factorial(n-1);
}
int main()
{
int sizes;
cin >> sizes;
int result = factorial(sizes);
cout << result << endl;
}
| ALGO | 0.999842 | 5.424557 |
4d778a66-2387-4a2d-81d4-8c4fb3246c0e | Abunyawa/contests | codecraft/c.cpp | #include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define vi vector<int>
#define vl vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define abu ios_base::sync_with_stdio(0)
#de... | ALGO | 0.999987 | 3.534179 |
029af501-e0a4-4f36-a3b4-b45997d39041 | rahul17081998/Data-Structure | code_cpp/self pased DSA/Hashing/LEETCODE/1-Number-of-Arithmetic-Triplets.cpp | #include<bits/stdc++.h>
using namespace std;
//write your function here
class Solution {
public:
// method 2:
//It's amazing, I improved my approach after getting this.
//Simply for every element(x) in array, check if x+diff and x-diff also exist in array using set. That's it.
int solve(vector<int>& nu... | ALGO | 0.999983 | 5.768999 |
9deacb77-301e-4ed1-b605-9510e5555b81 | ztipnis/QATZip-mysql | extra/icu/source/common/uset.cpp | #include "unicode/utypes.h"
#include "unicode/uobject.h"
#include "unicode/uset.h"
#include "unicode/uniset.h"
#include "cmemory.h"
#include "unicode/ustring.h"
#include "unicode/parsepos.h"
U_NAMESPACE_USE
U_CAPI USet* U_EXPORT2
uset_openEmpty() {
return (USet*) new UnicodeSet();
}
U_CAPI USet* U_EXPORT2
uset_o... | TOOL | 0.915522 | 7.489789 |
6f4b4b2c-75af-474c-ac82-8881a9d1896e | ravi29125/Leetcode | 1285-balance-a-binary-search-tree/1285-balance-a-binary-search-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999987 | 6.225212 |
c3ea489f-f925-4205-bc3b-737ddb58ba27 | 03-prathamesh/DSA_LEETCODE_PROBLEMS | 0001_array/0080_most_frequent_even_element.cpp | class Solution {
public:
int mostFrequentEven(vector<int>& nums) {
vector<int> ans;
int minElement=INT_MAX;
int finalElement;
int count=0;
int maxCount=0;
for(int i=0;i<nums.size();i++){
if(nums[i]%2==0){
count=0;
... | ALGO | 0.999801 | 5.736872 |
67490925-8e60-470c-8d44-db9d0b78c7be | ConradWarren/AoC-2023 | Day10/day_10_part_2.cpp | #include <fstream>
#include <map>
#include <string>
#include <vector>
enum directions{none = 0,up = 1,down = 2,left = 4,right = 8};
std::map<char, int> direction_map = { { '|', up | down },
{ '-', left | right },
{ 'L', up | right },
{ 'J', up | left },
{ '7', down | left },
{ 'F', down | right },
{ '.', none },
{ 'S... | ALGO | 0.999001 | 4.561445 |
4ffe8d6e-f488-4834-ab2d-b4c27dd08581 | piash76/uva-atcoder-cf-lj--6 | prepostfreind.cpp | #include<bits/stdc++.h>
using namespace std;
class prepos
{
int x;
public:
void getval()
{
cin>>x;
}
void show()
{
cout<<x<<endl;
}
friend prepos operator++(prepos &z);//prefix
friend prepos operator++(prepos &q,int v);
};
prepos operator++(prepos &z) //prefix
{... | ALGO | 0.977696 | 3.428497 |
e59d4662-1db2-406c-9165-e6f892f9db1e | himaniaggarwal2/Leetcode-Problems | reorder-list/reorder-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* midnode(Lis... | ALGO | 0.999948 | 5.718569 |
9fd441da-4edc-424c-998b-1006d2ec4a18 | binchengecon/TwoCapital_Final | src/cppcore/eigen3/bench/sparse_transpose.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_transpose.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
// -DNOGMM -DNOMTL
// -DCSPARSE -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef... | ALGO | 0.995086 | 5.110691 |
fcfb7f52-aed9-4c0f-95fd-af3d18a0629b | nm011/advent-of-code | 2023/8.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void part1() {
string inst; getline(cin, inst);
string s;
map<string, pair<string, string>> map;
while (getline(cin, s)) {
if (!s.size()) continue;
map[s.substr(0,3)] = {s.substr(7,3), s.substr(12,3)};
}
int ans... | ALGO | 0.999645 | 4.528328 |
ec8babe4-732e-4982-a06a-270f0612a26f | mahirlabibdihan/Codeforces-Solution | 1374A.cpp | /*
______ _________ _ _ _
| ____ \|___ ___| | | | | |
| | \ \ | | | |____| | | |
| | | | | | | ____ | | |
| |____/ /___| |___| | | |_____| |
|_______/|_________|_| |_________|
*/
#include<bits/stdc++.h>
using namespace std;
#define ed end()
#define INF 1e18
#define... | ALGO | 0.998842 | 3.268432 |
63246b75-2a97-406e-a8e5-49bf1e2592d0 | ZahidAlNahid1/Grendel | Tutorials/C++/OOP_Classes_and_Objects/DeclareClassAndObjects/main.cpp | // Section 13
// Declare Classes and Objects
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Player {
// attributes
string name {"Player"};
int health {100};
int xp {3};
// methods
void talk(string);
bool is_dead();
};
class Account {
// attribu... | TOOL | 0.944825 | 4.268261 |
4b420b90-3c35-44b0-9c1e-d373c4308bc5 | Hozny/programming-solutions | div2b/cf550d2b.cpp | #include <iostream>
#include <climits>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <bi... | ALGO | 0.999564 | 3.885445 |
5b47fbd7-ef31-4453-ac10-9242ba497f27 | wabiverse/UnrealEngineOldArchived | Engine/Source/ThirdParty/Intel/ISPC/ispc-1.16.1/examples/cpu/mandelbrot/mandelbrot_serial.cpp | static int mandel(float c_re, float c_im, int count) {
float z_re = c_re, z_im = c_im;
int i;
for (i = 0; i < count; ++i) {
if (z_re * z_re + z_im * z_im > 4.f)
break;
float new_re = z_re * z_re - z_im * z_im;
float new_im = 2.f * z_re * z_im;
z_re = c_re + new_r... | ALGO | 0.998987 | 5.082566 |
98b4bcf0-2cb4-42ad-9cda-ca2d79bf940e | veracioux/algorithms-cpp | logic/VeitchDiagram.cpp | #include "VeitchDiagram.h"
namespace logic
{
// Need to change this some time in the future. The inelegance is unbearable.
std::vector<unsigned int> rowLookupTable[5][5] = {
// A B C D E
{{0}}, // n=1
{{0}}, // n=2
{{0}}, // n=3
{{0, 1}, {}, {}, {1, 2}}, // n=4
{{0, 1}, {}, {}, {1, 2}} //n... | ALGO | 0.992964 | 5.926863 |
fd707373-ff56-4898-ada2-44fcd5f63354 | shamliyasaidalavi/Retail_mgmt_system_1 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
f1fd91c8-518f-44fa-ac69-e2e3f8743a91 | Chelshiyaa/DSA_CPP | C++ & DSa/Array/count_digits.cpp | #include<iostream>
using namespace std;
int main() {
int a;
cin>>a;
int temp = a;
int digit = 0;
while (temp != 0) {
digit++;
temp /= 10;
}
cout<<digit;
return 0;
} | ALGO | 0.999689 | 3.84359 |
0f30fb68-7dfd-4dc9-aa97-eea012171945 | Minnggg/CPP-CODEPTIT | cpp 0125.cpp | #include<bits/stdc++.h>
using namespace std;
int nt[1000000]={};
void sang()
{
for(int i=0;i<1000000;i++) nt[i]=1;
nt[0]=nt[1]=0;
for(int i=2;i*i<1000000;i++)
{
if(nt[i]==1)
{
for(int j=i*i;j<1000000;j+=i) nt[j]=0;
}
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
... | ALGO | 0.999884 | 3.704673 |
95408047-26f6-4840-980e-9fc4de47e56e | FullteaR/CompetitiveProgramming | AOJ/Volume 2/Cutting Down Water Bills.cpp | #include <iostream>
using namespace std;
int cost(int water);
int main(void){
int water;
while(1){
cin>>water;
if(water==-1){return 0;}
cout<<4280-cost(water)<<endl;
}
}
int cost(int water){
if(water<10){
return 1150;
}
else if(water<20){
return 1150+125*(water-10);
}
else if(wate... | ALGO | 0.997491 | 3.773804 |
3a49a429-02a0-4452-b3b1-a26f070c518e | rsk9607/MY-PRATICE | digital summision.cpp | #include<iostream>
using namespace std;
int main(){
int a;
int b;
cin>>a>>b;
int c;
c=(a%10)+(b%10);
cout<<c;
return 0;
} | ALGO | 0.999501 | 3.085671 |
d59fc038-430c-4c5c-8d01-ec15235f122f | KnewHow/studyAlgorithms | leetcode/100-149/Symmetric/Symmetric/src/Solution.cpp | #include "Solution.h"
bool Solution::isSymmetric(TreeNode* root)
{
return check(root, root);
}
bool Solution::check(TreeNode* p, TreeNode* q)
{
if (p == nullptr && q == nullptr) {
return true;
}
else if (p != nullptr && q != nullptr) {
return p->val == q->val && check(p->left, q->right) && check(p->right, q->l... | ALGO | 0.999977 | 6.516929 |
b89b6f11-5444-4173-94ed-778b6bccbd83 | sptzmllr/legends-gis | saga-gis/src/tools/shapes/shapes_grid/grid_line_direction.cpp | //---------------------------------------------------------
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
#include "grid_lin... | ALGO | 0.934786 | 5.10295 |
f2eb19c1-226e-477c-86dc-ff758894da59 | BaekHG/acmicpc-Baekjoon-PS | 단계별_문제풀이/10. 재귀/3 (2447번).cpp | #include <iostream>
using namespace std;
char arr[3000][3000];
void star(int n, int x, int y){
if(n == 1){
arr[x][y] = '*';
return;
}
int div = n/3;
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
if(i != 1 || j != 1){
star(div, x + (div * i), y + (div * j));
... | ALGO | 0.999912 | 3.833672 |
0cbace71-56e8-4f88-95e9-9b7cc9a91f14 | ImperishableMe/codeforces-submissions | codeforces/224/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef pair<int,int> PII;
const int up = 1e-9;
#define loop(i , a , b) for(int i = int(a); i <= int(b); i++)
#define vi(x) vector<int> x;
int main()
{
int s1... | ALGO | 0.999188 | 3.590655 |
24457389-0b2c-490f-908e-6d0c6af7bf2d | ishandutta2007/codeforces | ra16bit/normal/377/D.cpp | #include <cstdio>
#include <vector>
using namespace std;
const int MX=100010,LEN=3*MX;
struct Node { int add,mx,w; } a[LEN*4];
int n,i,j,res,wl,wr,lc[MX],vc[MX],rc[MX];
vector<int> mid[LEN],rig[LEN];
void add(int i, int L, int R, int l, int r, int v) {
if (L==l && R==r) {
a[i].add+=v;
a[i].mx+=v;
if (a[i]... | ALGO | 0.999973 | 3.587014 |
2065afb3-deb3-4172-86e2-ea444f2add20 | RajaBabu15/DSA_Learning | YetAnotherCoinProblem.cpp | #include<bits/stdc++.h>
using namespace std;
void solve() {
int n; cin >> n;
vector<int> vec = {2, 1, 2, 1, 2, 3, 1, 2, 3, 2, 1, 2, 2, 2, 3, 1, 2, 3, 2, 3, 2, 2, 3, 3, 3, 2, 3, 3, 3, 4, 2, 3, 4, 3, 4, 3, 3, 4, 4, 4, 3, 4, 4, 4, 5, 3, 4, 5, 4, 5, 4, 4, 5, 5, 5, 4};
cout << vec[n % 30] + (n > 30 ? (n - n % 30) / 15 -... | ALGO | 0.999017 | 3.67888 |
66d2fac6-62c5-421c-b568-65633a123165 | pkushal148/cses-problem-set | ferrisWheel.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
int main()
{
int n, x;
cin >> n >> x;
vector<int> a(n);
for (int i = 0; i < n; i++)
{
cin >> a[i];
... | ALGO | 0.999966 | 4.462399 |
54cf6490-c5dd-40c3-b55e-8b115eeb73a0 | sisi0808/atcoder-env | abc/086/b.cpp | #include <bits/stdc++.h>
/* ACLのライブラリを追加*/
#include <atcoder/all>
using namespace atcoder;
#define fio() \
cin.tie(nullptr); \
ios::sync_with_stdio(false);
using namespace std;
#define rep(i, n) for(int i = 0; i < int(n); ++i)
#define rrep(i, n, m) for(int i = n; i >= m; --i)
#define repp(i, n, m) for(... | ALGO | 0.999956 | 5.055603 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.