Skip to content

Instantly share code, notes, and snippets.

View KhaledElshamy's full-sized avatar

Khaled Elshamy KhaledElshamy

View GitHub Profile
@KhaledElshamy
KhaledElshamy / C. Registration System Solution-Codeforces
Created October 28, 2017 00:02
C. Registration System Solution-Codeforces
#include <bits/stdc++.h>
using namespace std;
//Compiler version g++ 6.3.0
int main()
{
int n,count=0;
string s;
cin>>n;
set<string>s1;
@KhaledElshamy
KhaledElshamy / Compute Tree Height-Data Structure-Coursera
Created May 13, 2017 13:50
Compute Tree Height-Data Structure-Coursera Course
#include <bits/stdc++.h>
using namespace std;
int root=0;
int main()
{
int n;
cin>>n;
vector< vector<int> >nodes(n);
queue<int>q;
int a[n];
@KhaledElshamy
KhaledElshamy / B. Easy Number Challenge(Codeforces)
Created April 17, 2017 13:00
B. Easy Number Challenge (Codeforces)
#include <bits/stdc++.h>
using namespace std ;
#define size 1000001
int main() {
unsigned long long a,b,c,d[1000001]={0},count=0;
for(int i=1;i<size;i++)
for(int j=i;j<size;j+=i)
++d[j];
cin>>a>>b>>c;
for(int i=1;i<=a;i++)
@KhaledElshamy
KhaledElshamy / B. Meeting- Codeforces Solution
Created March 23, 2017 18:24
B. Meeting- Codeforces Solution
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int dx[10001],dy[1001],r[1001],n;
int check(int x,int y)
{
for(int i=0;i<n;i++)
if(((x-dx[i])*(x-dx[i]))+((y-dy[i])*(y-dy[i]))<=r[i]*r[i])
return 0;
return 1;
@KhaledElshamy
KhaledElshamy / (B) Bear and Strings Solution -Codeforces
Created March 14, 2017 13:51
(B) Bear and Strings Solution -Codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
int count=0;
cin>>s;
for(int i=0;i<s.size();i++)
{
@KhaledElshamy
KhaledElshamy / B. Pashmak and Flowers-Codeforces Solution
Created March 10, 2017 08:04
B. Pashmak and Flowers-Codeforces Solution
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,b,min=0,max=pow(10,9),num1,num2,count1=0,count2=0;
cin>>n;
for(int i=0;i<n;i++)
{
@KhaledElshamy
KhaledElshamy / 725-UVA Solution
Created March 3, 2017 11:48
725-UVA Solution
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int abcde,fghij,n;
while(cin>>n)
{
for(fghij=1234;fghij<98765/n;fghij++)
{
@KhaledElshamy
KhaledElshamy / B. Growing Mushrooms solution-Codeforces
Created February 27, 2017 17:06
B. Growing Mushrooms solution-Codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
struct myfunc
{
bool operator()(const vector<double>& s1,
const vector<double>& s2) const
{
if(s1[0]==s2[0])
return s1[1] < s2[1];
@KhaledElshamy
KhaledElshamy / B. Inna and New Matrix of Candies-Codeforces
Created February 13, 2017 17:21
B. Inna and New Matrix of Candies-Codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
string s;
vector<int>s1;
vector<int>::iterator it;
@KhaledElshamy
KhaledElshamy / B. Filya and Homework-Codeforces
Created February 12, 2017 18:31
B. Filya and Homework-Codeforces
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;i++)
cin>>a[i];