Skip to content

Commit 80ca6b5

Browse files
authored
Add files via upload
0 parents  commit 80ca6b5

18 files changed

+1132
-0
lines changed

A+B (Trial Problem).cpp

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// https://codeforces.com/problemset/problem/1351/A
2+
#include <bits/stdc++.h>
3+
4+
#define fi first
5+
#define se second
6+
#define pb push_back
7+
#define mp make_pair
8+
#define ll long long
9+
#define pll pair<long, long>
10+
#define vll vector<long long>
11+
#define inf 1e18
12+
#define range(a,b) substr(a,b-a+1)
13+
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
14+
15+
using namespace std;
16+
17+
int main()
18+
{
19+
FIO;
20+
21+
#ifndef ONLINE_JUDGE
22+
//remove this piece of code when this has to be submitted in kickstart
23+
freopen("input.txt", "r", stdin);
24+
freopen("output.txt", "w", stdout);
25+
//freopen is used to associate a file with stdin or stdout stream in C++
26+
#endif
27+
28+
ll t;
29+
cin >> t;
30+
while (t--) {
31+
ll a, b;
32+
cin >> a >> b;
33+
cout << a + b << "\n";
34+
}
35+
return 0;
36+
}

ABC String.cpp

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// https://codeforces.com/contest/1494/problem/A
2+
#include <bits/stdc++.h>
3+
4+
#define fi first
5+
#define se second
6+
#define pb push_back
7+
#define mp make_pair
8+
#define ll long long
9+
#define pll pair<long, long>
10+
#define vll vector<long long>
11+
#define inf 1e18
12+
#define range(a,b) substr(a,b-a+1)
13+
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
14+
15+
using namespace std;
16+
17+
18+
int main()
19+
{
20+
FIO;
21+
int t;
22+
cin >> t;
23+
string temp, ans;
24+
while(t--) {
25+
cin >> temp;
26+
if (temp[0] == temp[temp.size() - 1]) {
27+
cout << "NO\n";
28+
continue;
29+
}
30+
else {
31+
char open = temp[0];
32+
char close = temp[temp.size() - 1];
33+
int ans = 0;
34+
for (int i = 0; i < temp.size(); i++) {
35+
if (temp[i] == open)
36+
ans++;
37+
else
38+
ans--;
39+
if (ans < 0)
40+
break;
41+
}
42+
if (!ans) {
43+
cout << "YES\n";
44+
continue;
45+
}
46+
else {
47+
ans = 0;
48+
for (int i = 0; i < temp.size(); i++) {
49+
if (temp[i] == close)
50+
ans--;
51+
else
52+
ans++;
53+
if (ans < 0)
54+
break;
55+
}
56+
}
57+
if (!ans)
58+
cout << "YES\n";
59+
else
60+
cout << "NO\n";
61+
}
62+
}
63+
return 0;
64+
}

AGAGA XOOORRR.cpp

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// https://codeforces.com/problemset/problem/1516/B
2+
#include <bits/stdc++.h>
3+
4+
using namespace std;
5+
6+
#define fi first
7+
#define se second
8+
#define pb push_back
9+
#define mp make_pair
10+
#define all(x) x.begin(), x.end()
11+
#define ll long long
12+
#define pll pair<long, long>
13+
#define vll vector<long long>
14+
#define inf 1e18
15+
#define range(a,b) substr(a,b-a+1)
16+
#define fori(a, n) for (ll i = a; i < n; i++)
17+
#define forj(a, n) for (ll j = a; j < n; j++)
18+
#define fork(a, n) for (ll k = a; k < n; k++)
19+
#define print(x) for (auto i : x) {cout << i << " ";}
20+
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
21+
22+
template <class T>
23+
bool comp(T a, T b) {
24+
if (a < b)
25+
return true;
26+
return false;
27+
}
28+
29+
bool allequal(vll arr) {
30+
ll s = 0, i;
31+
for (i = 1; i < arr.size(); i++)
32+
if (arr[i] == arr[i - 1])
33+
continue;
34+
else
35+
break;
36+
return (i == arr.size());
37+
}
38+
39+
int main()
40+
{
41+
FIO;
42+
43+
#ifndef ONLINE_JUDGE
44+
//remove this piece of code when this has to be submitted in kickstart, coding ninjas
45+
freopen("input.txt", "r", stdin);
46+
freopen("output.txt", "w", stdout);
47+
//freopen is used to associate a file with stdin or stdout stream in C++
48+
#endif
49+
50+
ll t;
51+
cin >> t;
52+
while (t--) {
53+
ll n, temp, ans;
54+
cin >> n;
55+
vll arr(n);
56+
fori(0, n) {
57+
cin >> temp;
58+
arr[i] = temp;
59+
if (i == 0)
60+
ans = temp;
61+
else
62+
ans = ans ^ temp;
63+
}
64+
if (ans == 0 || allequal(arr))
65+
cout << "YES\n";
66+
else {
67+
ll xor1 = 0, co = 0;
68+
fori(0, n) {
69+
xor1 = xor1 ^ arr[i];
70+
if (xor1 == ans) {
71+
xor1 = 0;
72+
co++;
73+
}
74+
}
75+
if (co >= 2)
76+
cout << "YES\n";
77+
else
78+
cout << "NO\n";
79+
}
80+
}
81+
82+
return 0;
83+
}

Add Odd or Subtract Even.cpp

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// https://codeforces.com/problemset/problem/1311/A
2+
#include <bits/stdc++.h>
3+
4+
#define fi first
5+
#define se second
6+
#define pb push_back
7+
#define mp make_pair
8+
#define ll long long
9+
#define pll pair<long, long>
10+
#define vll vector<long long>
11+
#define inf 1e18
12+
#define range(a,b) substr(a,b-a+1)
13+
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
14+
15+
using namespace std;
16+
17+
int main()
18+
{
19+
FIO;
20+
21+
#ifndef ONLINE_JUDGE
22+
//remove this piece of code when this has to be submitted in kickstart
23+
freopen("input.txt", "r", stdin);
24+
freopen("output.txt", "w", stdout);
25+
//freopen is used to associate a file with stdin or stdout stream in C++
26+
#endif
27+
28+
ll t;
29+
cin >> t;
30+
while (t--) {
31+
ll a, b;
32+
cin >> a >> b;
33+
if (a == b)
34+
cout << 0 << "\n";
35+
else if (a > b)
36+
if (b % 2 == 0)
37+
if (a % 2 == 0)
38+
cout << 1 << "\n";
39+
else
40+
cout << 2 << "\n";
41+
else
42+
if (a % 2 != 0)
43+
cout << 1 << "\n";
44+
else
45+
cout << 2 << "\n";
46+
else if (a < b)
47+
if (a % 2 == 0)
48+
if (b % 2 != 0)
49+
cout << 1 << "\n";
50+
else
51+
cout << 2 << "\n";
52+
else
53+
if (b % 2 == 0)
54+
cout << 1 << "\n";
55+
else
56+
cout << 2 << "\n";
57+
}
58+
59+
return 0;
60+
}

Again Twenty Five!.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <iostream>
2+
3+
using namespace std;
4+
5+
int main()
6+
{
7+
cout << 25;
8+
return 0;
9+
}

Again Twenty Five!.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
n = int(input())
2+
print(25)

0 commit comments

Comments
 (0)