Skip to content

Commit abda5ba

Browse files
idk
1 parent ccdbd36 commit abda5ba

File tree

52 files changed

+1196
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1196
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"A - Rock-paper-scissors","group":"AtCoder - AtCoder Beginner Contest 204","url":"https://atcoder.jp/contests/abc204/tasks/abc204_a","interactive":false,"memoryLimit":1024,"timeLimit":2000,"tests":[{"input":"0 1\n","output":"2\n","id":1622980859302},{"id":1622980859306,"input":"0 0","output":"0"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"ARockPaperScissors"}},"batch":{"id":"f08f42e6-bd5d-4709-9928-8e14f6d0f7f1","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/AtCoder/AtCoder_BC_204_2021/A_Rock_paper_scissors.py"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"B - Nuts","group":"AtCoder - AtCoder Beginner Contest 204","url":"https://atcoder.jp/contests/abc204/tasks/abc204_b","interactive":false,"memoryLimit":1024,"timeLimit":2000,"tests":[{"input":"3\n6 17 28\n","output":"25\n","id":1622981160881},{"id":1622981160891,"input":"4\n8 9 10 11","output":"1"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"BNuts"}},"batch":{"id":"292d3ab7-7147-4a73-b204-ed5878151465","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/AtCoder/AtCoder_BC_204_2021/B_Nuts.cpp"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"C - Tour","group":"AtCoder - AtCoder Beginner Contest 204","url":"https://atcoder.jp/contests/abc204/tasks/abc204_c","interactive":false,"memoryLimit":1024,"timeLimit":2000,"tests":[{"input":"3 3\n1 2\n2 3\n3 2\n","output":"7\n","id":1622981790171},{"input":"3 0\n","output":"3\n","id":1622981790172},{"id":1622981790178,"input":"4 4\n1 2\n2 3\n3 4\n4 1","output":"16"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"CTour"}},"batch":{"id":"18b3bf57-b15f-4fee-806b-7e3bcb691066","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/AtCoder/AtCoder_BC_204_2021/C_Tour.cpp"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"C - Tour","group":"AtCoder - AtCoder Beginner Contest 204","url":"https://atcoder.jp/contests/abc204/tasks/abc204_c","interactive":false,"memoryLimit":1024,"timeLimit":2000,"tests":[{"input":"3 3\n1 2\n2 3\n3 2\n","output":"7\n","id":1622985801248},{"input":"3 0\n","output":"3\n","id":1622985801240},{"id":1622985801258,"input":"4 4\n1 2\n2 3\n3 4\n4 1","output":"16"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"CTour"}},"batch":{"id":"975002a1-cce6-4507-9739-94e66fe8fb85","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/AtCoder/AtCoder_BC_204_2021/C_Tour.py"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"D - Cooking","group":"AtCoder - AtCoder Beginner Contest 204","url":"https://atcoder.jp/contests/abc204/tasks/abc204_d","interactive":false,"memoryLimit":1024,"timeLimit":2000,"tests":[{"input":"5\n8 3 7 2 5\n","output":"13\n","id":1622986172371},{"input":"2\n1000 1\n","output":"1000\n","id":1622986172296},{"id":1622986172350,"input":"9\n3 14 15 9 26 5 35 89 79","output":"138"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"DCooking"}},"batch":{"id":"e96e810f-50e2-4a09-82ae-e43a8e0897af","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/AtCoder/AtCoder_BC_204_2021/D_Cooking.cpp"}

Diff for: AtCoder/AtCoder_BC_204_2021/A_Rock_paper_scissors.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
a, b = map(int, input().split())
2+
if a == b:
3+
print(a)
4+
else:
5+
if a == 0 and b == 1:
6+
print(2)
7+
elif a == 1 and b == 0:
8+
print(2)
9+
elif a == 0 and b == 2:
10+
print(1)
11+
elif a == 2 and b == 0:
12+
print(1)
13+
elif a == 1 and b == 2:
14+
print(0)
15+
elif a == 2 and b == 1:
16+
print(0)

Diff for: AtCoder/AtCoder_BC_204_2021/B_Nuts.cpp

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long int
3+
#define endl "\n"
4+
using namespace std;
5+
6+
int main()
7+
{
8+
ios_base::sync_with_stdio(false);
9+
cin.tie(NULL);
10+
ll test;
11+
12+
ll i, j, k, n, temp, count = 0, ans = 0, sum = 0;
13+
cin >> n;
14+
ll arr[n];
15+
16+
for(i = 0; i < n; i++)
17+
{
18+
cin >> arr[i];
19+
if(arr[i] > 10)
20+
{
21+
arr[i] -= 10;
22+
}
23+
else
24+
{
25+
arr[i] = 0;
26+
}
27+
}
28+
29+
ans = accumulate(arr, arr + n, ans);
30+
cout << ans << endl;
31+
32+
return 0;
33+
}

Diff for: AtCoder/AtCoder_BC_204_2021/C_Tour.cpp

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long int
3+
#define endl "\n"
4+
using namespace std;
5+
6+
int main()
7+
{
8+
ios_base::sync_with_stdio(false);
9+
cin.tie(NULL);
10+
ll test;
11+
12+
ll i, j, k, n, m, temp, count = 0, ans = 0, sum = 0;
13+
cin >> n >> m;
14+
15+
vector<vector<ll>> graph(n);
16+
for(i = 0; i < m; i++)
17+
{
18+
cin >> j >> k;
19+
j--;k--;
20+
graph[j].push_back(k);
21+
}
22+
23+
ans = 0;
24+
25+
for(i = 0; i < n; i++)
26+
{
27+
queue<ll> q;
28+
vector<bool> visited(n);
29+
visited[i] = true;
30+
q.push(i);
31+
32+
while(!q.empty())
33+
{
34+
temp = q.front();
35+
q.pop();
36+
ans++;
37+
38+
for(auto itr: graph[temp])
39+
{
40+
if(!visited[itr])
41+
{
42+
visited[itr] = true;
43+
q.push(itr);
44+
}
45+
}
46+
}
47+
}
48+
49+
cout << ans << endl;
50+
51+
return 0;
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Local: 1637","url":"/home/mudi/acads/Competitive_Submissions/CSES/1637.cpp","tests":[],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"/home/mudi/acads/Competitive_Submissions/CSES/1637.cpp","group":"local","local":true}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Grid Paths","group":"CSES - CSES Problem Set","url":"https://cses.fi/problemset/task/1638","interactive":false,"memoryLimit":512,"timeLimit":1000,"tests":[{"id":1623302727901,"input":"4\n....\n.*..\n...*\n*...","output":"3"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"GridPaths"}},"batch":{"id":"c86cfcea-b103-400b-bb47-df59b9d09d9f","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/CSES/Grid_Paths.cpp"}

Diff for: CSES/1637

19 KB
Binary file not shown.

Diff for: CSES/1637.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include "bits/stdc++.h"
2+
#define ll long long int
3+
#define endl "\n"
4+
using namespace std;
5+
6+
int main()
7+
{
8+
ll n, i, j, ans = 0;
9+
cin >> n;
10+
11+
while(n)
12+
{
13+
i = n; j = 0;
14+
while(i)
15+
{
16+
j = max(j, i % 10);
17+
i /= 10;
18+
}
19+
n -= j;
20+
ans++;
21+
}
22+
23+
cout << ans << endl;
24+
return 0;
25+
}

Diff for: CSES/Grid_Paths.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
#define ll long long int
4+
#define endl "\n"
5+
const ll MOD = 1e9 + 7;
6+
7+
int main()
8+
{
9+
ll i, j, n;
10+
cin >> n;
11+
vector<string> in;
12+
string s;
13+
14+
for(i = 0; i < n; i++)
15+
{
16+
cin >> s;
17+
in.push_back(s);
18+
}
19+
20+
vector<vector<ll>> dp(n + 1, vector<ll>());
21+
22+
}

Diff for: CSES/in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
27

Diff for: Codechef/2021/Codechef_JUN_Long_2021/Bella_Ciao.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "bits/stdc++.h"
2+
#define ll long long int
3+
#define endl "\n"
4+
using namespace std;
5+
6+
int main()
7+
{
8+
ll test;
9+
cin >> test;
10+
while(test--)
11+
{
12+
cin days, d, p, q;
13+
cin >> days >> d >> p >> q;
14+
15+
}
16+
}

Diff for: Codechef/2021/Codechef_JUN_Long_2021/Summer_Heat.cpp

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Charges","group":"CodeChef - May Lunchtime 2021 Division 2","url":"https://www.codechef.com/LTIME96B/problems/CHARGES","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"id":1622471927683,"input":"1\n3 3\n010\n2 1 3","output":"4\n3\n2"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"Charges"}},"batch":{"id":"7b7bf9d5-7346-417f-97ec-e7346dd6736d","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/Codechef/2021/Codechef_MAY_Lunchtime_2021/Charges.cpp"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Charges","group":"CodeChef - May Lunchtime 2021 Division 2","url":"https://www.codechef.com/LTIME96B/problems/CHARGES","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"id":1622472951061,"input":"1\n3 3\n010\n2 1 3","output":"4\n3\n2"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"Charges"}},"batch":{"id":"ec63035a-f23f-47ed-9a81-c25f2060aeab","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/Codechef/2021/Codechef_MAY_Lunchtime_2021/Charges.py"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"K-Subarrays","group":"CodeChef - May Lunchtime 2021 Division 2","url":"https://www.codechef.com/LTIME96B/problems/CHESUB","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"input":"2\n5 2\n1 2 -1 3 1\n5 2\n-1 2 11 -23 12\n","output":"11\n37\n","id":1622479331985},{"id":1622479922366,"input":"2\n5 1\n-5 -5 -2 -5 -5\n5 1\n2 5 -1 15 1","output":""}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"KSubarrays"}},"batch":{"id":"dbf3cf8e-1437-41e1-9452-fb0f76d34eab","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/Codechef/2021/Codechef_MAY_Lunchtime_2021/K_Subarrays.cpp"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Tom And Jerry 1","group":"CodeChef - May Lunchtime 2021 Division 2","url":"https://www.codechef.com/LTIME96B/problems/TANDJ1","interactive":false,"memoryLimit":256,"timeLimit":500,"tests":[{"id":1622471531798,"input":"3\n1 1 2 2 2\n1 1 2 3 4\n1 1 1 0 3","output":"YES\nNO\nYES"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"TomAndJerry1"}},"batch":{"id":"db92c900-acd9-4464-8665-4208ff66f0aa","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/Codechef/2021/Codechef_MAY_Lunchtime_2021/Tom_And_Jerry_1.cpp"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Total Components","group":"CodeChef - May Lunchtime 2021 Division 2","url":"https://www.codechef.com/LTIME96B/problems/NUMCOMP1","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"input":"3\n2\n4\n8\n","output":"1\n2\n3\n","id":1622473618785},{"id":1622474038626,"input":"2\n6\n10","output":""}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"TotalComponents"}},"batch":{"id":"3dffcc71-590e-4bde-9cab-6b2ea00a8353","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/Codechef/2021/Codechef_MAY_Lunchtime_2021/Total_Components.cpp"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Total Components","group":"CodeChef - May Lunchtime 2021 Division 2","url":"https://www.codechef.com/LTIME96B/problems/NUMCOMP1","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"id":1622474319929,"input":"3\n2\n4\n8","output":"1\n2\n3"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"TotalComponents"}},"batch":{"id":"cae38b34-5fed-41d4-a85e-4a0fc898cccc","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/Codechef/2021/Codechef_MAY_Lunchtime_2021/Total_Components.py"}

Diff for: Codechef/2021/Codechef_MAY_Lunchtime_2021/Charges.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
test = int(input())
3+
for _ in range(test):
4+
n, k = map(int, input().split())
5+
s = input()
6+
arr = [0] * n
7+
8+
ans = 0
9+
for i in range(0, n - 1):
10+
if s[i] == s[i + 1]:
11+
ans += 2
12+
else:
13+
ans += 1
14+
arr[i] = int(s[i])
15+
16+
arr[-1] = int(s[-1])
17+
18+
j = list(map(int, input().split()))
19+
20+
for temp in j:
21+
22+
temp -= 1
23+
if n >= 2:
24+
if temp == 0:
25+
if arr[temp] == arr[temp + 1]:
26+
ans -= 1
27+
else:
28+
ans += 1
29+
elif temp == n - 1:
30+
if arr[temp] == arr[temp - 1]:
31+
ans -= 1
32+
else:
33+
ans += 1
34+
else:
35+
if arr[temp] == arr[temp + 1]:
36+
ans -= 1
37+
else:
38+
ans += 1
39+
if arr[temp] == arr[temp - 1]:
40+
ans -= 1
41+
else:
42+
ans += 1
43+
arr[temp] = 1 - arr[temp]
44+
print(ans)
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// C++ program to print largest contiguous array sum
2+
#include<iostream>
3+
#include<climits>
4+
using namespace std;
5+
6+
int maxSubArraySum(int a[], int size)
7+
{
8+
int max_so_far = INT_MIN, max_ending_here = 0;
9+
10+
for (int i = 0; i < size; i++)
11+
{
12+
max_ending_here = max_ending_here + a[i];
13+
if (max_so_far < max_ending_here)
14+
max_so_far = max_ending_here;
15+
16+
if (max_ending_here < 0)
17+
max_ending_here = 0;
18+
}
19+
return max_so_far;
20+
}
21+
22+
/*Driver program to test maxSubArraySum*/
23+
int main()
24+
{
25+
int t;
26+
cin >>t;
27+
while(t--)
28+
{ int n, k;
29+
cin >> n >> k;
30+
int arr[n];
31+
for(i = 0; i < n; i++)
32+
{
33+
cin >> arr[i];
34+
}
35+
int n = sizeof(a)/sizeof(a[0]);
36+
int max_sum = maxSubArraySum(a, n);
37+
cout << max_sum << endl;
38+
}
39+
return 0;
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long int
3+
#define endl "\n"
4+
using namespace std;
5+
6+
int main()
7+
{
8+
ios_base::sync_with_stdio(false);
9+
cin.tie(NULL);
10+
ll test;
11+
cin >> test;
12+
while(test--)
13+
{
14+
ll i, j, k, n, temp, count = 0, ans = 0, sum = 0;
15+
ll a, b, c, d;
16+
cin >> a >> b >> c >> d >> k;
17+
18+
ans = abs(c - a) + abs(d - b);
19+
20+
if(k >= ans and (k - ans) % 2 == 0)
21+
{
22+
cout << "YES" << endl;
23+
}
24+
else
25+
{
26+
cout << "NO" << endl;
27+
}
28+
}
29+
30+
return 0;
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#include <bits/stdc++.h>
2+
#define ll long long
3+
#define endl "\n"
4+
using namespace std;
5+
const ll upper_bound_limmit = 10000001;
6+
7+
int main()
8+
{
9+
ios_base::sync_with_stdio(false);
10+
cin.tie(NULL);
11+
ll test;
12+
13+
14+
ll answer[upper_bound_limmit];
15+
for(ll ind = 0; ind < upper_bound_limmit; ind++)
16+
{
17+
answer[ind] = 1;
18+
}
19+
20+
answer[1] = 0;
21+
for(ll ind = 2; ind * ind < upper_bound_limmit; ind++)
22+
{
23+
if(answer[ind] == 1)
24+
{
25+
for(ll jnd = ind * 2; jnd < upper_bound_limmit; jnd += ind)
26+
{
27+
answer[jnd] = 0;
28+
}
29+
}
30+
}
31+
32+
for(ll ind = 3; ind < upper_bound_limmit; ind++)
33+
{
34+
if(answer[ind] == 1 and 2 * ind < upper_bound_limmit)
35+
{
36+
answer[2 * ind]--;
37+
}
38+
}
39+
40+
for(ll ind = 3; ind < upper_bound_limmit; ind++)
41+
{
42+
answer[ind] = answer[ind] + answer[ind - 1];
43+
}
44+
45+
cin >> test;
46+
while(test--)
47+
{
48+
ll i, j, k, n, temp, count = 0, sum = 0;
49+
cin >> n;
50+
51+
52+
k = answer[n];
53+
54+
55+
cout << k << endl;
56+
}
57+
58+
return 0;
59+
}
60+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"A. Mean Inequality","group":"Codeforces - Codeforces Round #723 (Div. 2)","url":"https://codeforces.com/contest/1526/problem/0","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"id":1622210884871,"input":"3\n3\n1 2 3 4 5 6\n2\n123 456 789 10\n1\n6 9","output":"3 1 4 2 5 6\n123 10 456 789\n9 6"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"AMeanInequality"}},"batch":{"id":"f2564408-1bdc-44cb-9f32-2bf6a4e9f9ee","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/Codeforces/Codeforces_723_2021/A_Mean_Inequality.cpp"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"B. I Hate 1111","group":"Codeforces - Codeforces Round #723 (Div. 2)","url":"https://codeforces.com/contest/1526/problem/B","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"id":1622211374520,"input":"3\n33\n144\n69","output":"YES\nYES\nNO"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"BIHate1111"}},"batch":{"id":"ae306fa6-ddb8-4547-8752-63def0bf9c7d","size":1},"srcPath":"/home/mudi/acads/Competitive_Submissions/Codeforces/Codeforces_723_2021/B_I_Hate_1111.cpp"}

0 commit comments

Comments
 (0)