Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
5234e40
Problems
codedsun Dec 14, 2020
c76fde6
Problem 1462
codedsun Dec 20, 2020
9b4d880
feat: Problems
codedsun Jan 6, 2021
68a2d61
A2OJ Difficulty level 1 completed
codedsun May 23, 2021
85abeb7
Problem 227B
codedsun Jun 5, 2021
15ef2ca
problem 227b
Jun 6, 2021
6f4d5e2
Problem 272A
Jun 6, 2021
46c0a19
problem 165A
Jun 9, 2021
fd292bb
Problem 139A
Jun 9, 2021
76a9a11
Problem 224A
Jun 9, 2021
8629a54
Problem 34A
Jun 9, 2021
e5b3b25
Problem 205a
Jun 10, 2021
00a7de5
Contest 725
Jun 10, 2021
489090a
Problem 199A
Jun 11, 2021
c5daa7b
Problem352A
Jun 11, 2021
f9d7d98
Problem 320A, Problem 339B
Jun 11, 2021
40822f7
Problemm 43A
Jun 12, 2021
324e5d3
Problem 34B
Jun 12, 2021
35b548f
Problem 149A
Jun 12, 2021
650f76f
problem 219A
Jun 12, 2021
7fe8015
Problemm 118B
Jun 14, 2021
b1788fd
Codeforces round 726
Jun 19, 2021
9cdfb26
Problem 459B
Jun 20, 2021
fde1963
problemm 352b
Jun 20, 2021
ffd948f
Problem 1539
Jun 21, 2021
140f0f4
Problem 298B Sail
Jun 21, 2021
a65c8b8
Problem 433A
Jun 23, 2021
429a781
Problem 327B Hungry sequence
Jun 24, 2021
0f0ffdf
Problem 242B
Jun 24, 2021
010c0aa
Problem 239A
Jun 26, 2021
bb77225
Problem 253A
Jun 26, 2021
b9a0c97
Problem 236B
Jun 26, 2021
b57013f
Problem 353A
Jun 26, 2021
3d37ccf
Problem 349A
Jun 27, 2021
7f36ec7
Problem 166A
Jun 27, 2021
3728b7c
Problem 433B
Jun 27, 2021
eb04301
Problem 237A
Jun 27, 2021
586eacf
Problem 1521A
Jun 29, 2021
5ae9bb0
Problem 1520C
Jun 30, 2021
0f04509
Problem 1033A
Jul 3, 2021
ea02cce
Probblem 1040A
Jul 4, 2021
3eb6c9f
chore: notes for GCD and problem 1041B
Jul 5, 2021
9f5bf9e
chore: Notes
Jul 5, 2021
0345c85
chore: SOE Algorithm Added
Jul 5, 2021
5874f06
Problem 1051B, Sieve of eratosthenes added
codedsun Jul 5, 2021
1311447
Problem 1054B
codedsun Jul 5, 2021
c81c40b
Problemm 1073A
codedsun Jul 6, 2021
73626bb
Problem 1073B
codedsun Jul 6, 2021
83e63de
Problem 1077B
codedsun Jul 6, 2021
84d8d67
Problem 1090M
codedsun Jul 6, 2021
bcbf0c3
Problem 1088B
codedsun Jul 8, 2021
dd69d7b
Problemm 1107B
codedsun Jul 10, 2021
44ef470
Problem 1133A
codedsun Jul 10, 2021
337a202
Problem 1547B and C
codedsun Jul 12, 2021
af5cc98
Problm 1136B
codedsun Jul 12, 2021
fc76bea
Problem 1139B
codedsun Jul 12, 2021
0b86f3a
Problem 1144C
codedsun Jul 12, 2021
3f389ce
Problem 1144C
codedsun Jul 13, 2021
4b87327
Problem 1165B
codedsun Jul 13, 2021
1dff68d
Problem 1084A
codedsun Jul 13, 2021
1ee83ff
Problem 1195B
codedsun Jul 14, 2021
9acce67
Problem 1195B
codedsun Jul 14, 2021
93a466a
Merge branch 'no-vids' of https://github.com/codedsun/CompetitiveProg…
codedsun Jul 22, 2021
0b236f2
Problem 1195B
codedsun Jul 24, 2021
4b4d393
Problem 1036A
codedsun Jul 24, 2021
6045109
Problem 1101A
codedsun Jul 24, 2021
a631548
Problem 1141A
codedsun Jul 24, 2021
3246011
Problem 492B
codedsun Jul 27, 2021
23fa725
Problem 466A
codedsun Jul 28, 2021
6677a15
Problem 1553C
codedsun Jul 28, 2021
70c2649
Contest 735Div2
codedsun Jul 30, 2021
a1ee5a2
Problem 1465A
codedsun Jul 30, 2021
2dd4097
Problem 1466C
codedsun Jul 31, 2021
b2b2972
Problem 1468B
codedsun Jul 31, 2021
d056a94
Problem 1473B
codedsun Jul 31, 2021
9458684
Sample updated
codedsun Aug 5, 2021
a2a6d46
chore: AtCoder contest
codedsun Aug 8, 2021
2bdfa4d
atcoder contest 213
codedsun Aug 9, 2021
9685a21
contest 212 atcoder
codedsun Aug 16, 2021
2b80202
Problem 1557B
codedsun Aug 17, 2021
b57aeb2
Problem 1541B
codedsun Aug 18, 2021
21c35ff
Contest 739Div3
codedsun Aug 21, 2021
910be0f
Contest Div3-739
codedsun Aug 24, 2021
3660841
Contest 741
codedsun Aug 28, 2021
529bf8d
Pronblem 1559C
codedsun Sep 3, 2021
2dfb10a
Problem 1569A
codedsun Sep 9, 2021
60d3c92
Codeforces global round 16
codedsun Sep 13, 2021
f7c7f9b
Problem 1566D1
codedsun Sep 14, 2021
f98e31a
contest 742
codedsun Sep 17, 2021
35a879d
Contest edu round 114
codedsun Sep 21, 2021
7e30a81
Problem 1549A
codedsun Sep 28, 2021
559b594
Codeforces contest 744
codedsun Sep 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
38 changes: 38 additions & 0 deletions lib/production/CompetitiveProgramming/Notes/GCD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# GCD OF A Number / HCF
If we subtract smaller number from the greater number, the GCD
of the number doesn't change. Hence this is the concept of the
basic euclidean algorithm
````
static int gcd(int a, int b)
{
// Everything divides 0
if (a == 0)
return b;
if (b == 0)
return a;

// base case
if (a == b)
return a;

// a is greater
if (a > b)
return gcd(a-b, b);
return gcd(a, b-a);
}
````

##Extended Euclidean Algorithm
Now instead of subtraction, we find the mod of the number and stop
when the number/remainder becomes 0.

``` Euclidiean Algorithm
//Euclidiean algorithm
static long gcd(long a, long b){

if(b == 0){
return a;
}
return gcd(b, a%b);
}
```
24 changes: 24 additions & 0 deletions lib/production/CompetitiveProgramming/Notes/SieveofEratosthenes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
##Sieve of Eratoshenes
Complexity: O(NloglogN)

The basic idea is to mark the numbers as composite which are multiple or factors
of some other numbers.

```
private static boolean[] generatePrime() {
boolean a[] = new boolean[1000000];
for (int i = 0; i < a.length; i++) {
a[i] = true;
}

for (int p = 2; p * p < a.length; p++) {
if (a[p]) {
for (int i = p * p; i < a.length; i+=p) {
a[i] = false;
}
}
}

return a;
}
```
Binary file not shown.
Binary file added lib/production/CompetitiveProgramming/Suneet.class
Binary file not shown.
19 changes: 19 additions & 0 deletions src/AtCoder/contest212/A.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package AtCoder.contest212;

import java.util.Scanner;

public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
if (a == 0 && b>0) {
System.out.println("Silver");
}else if(b==0 && a>0) {
System.out.println("Gold");
}else{
System.out.println("Alloy");
}

}
}
29 changes: 29 additions & 0 deletions src/AtCoder/contest212/B.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package AtCoder.contest212;

import java.util.Scanner;

public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
if(s.charAt(0)==s.charAt(1) && s.charAt(1)==s.charAt(2) && s.charAt(2) == s.charAt(3)){
System.out.println("Weak");
}else {
//check for follows
boolean weak = true;
for (int i = 0; i < s.length()-1; i++) {
int a = s.charAt(i)-48;
int b = s.charAt(i+1)-48;
if((a+1) % 10 != b %10){
weak = false;
}

}
if(weak){
System.out.println("Weak");
}else{
System.out.println("Strong");
}
}
}
}
19 changes: 19 additions & 0 deletions src/AtCoder/contest212/c.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package AtCoder.contest212;

import java.util.Scanner;

public class c {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int a[] =new int[n];
int b[] = new int[m];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
for (int i = 0; i < m; i++) {
b[i] = sc.nextInt();
}
}
}
13 changes: 13 additions & 0 deletions src/AtCoder/twoonethree/A.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package AtCoder.twoonethree;

import java.util.Scanner;

public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = a^b;
System.out.println(c);
}
}
24 changes: 24 additions & 0 deletions src/AtCoder/twoonethree/B.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package AtCoder.twoonethree;

import java.util.Arrays;
import java.util.Scanner;

public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long arr[] = new long[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextLong();
}
long[] b = arr.clone();
Arrays.sort(b);
int i = 0;
for (i = 0; i < n; i++) {
if(arr[i] == b[b.length-2]) {
break;
}
}
System.out.println(i+1);
}
}
21 changes: 21 additions & 0 deletions src/AtCoder/twoonethree/C.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package AtCoder.twoonethree;

import java.util.Arrays;
import java.util.Scanner;

public class C {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long h = sc.nextLong();
long w = sc.nextLong();
long n = sc.nextLong();
int x[] = new int[(int)n];
int y[] = new int[(int)n];
for (int i = 0; i < n; i++) {
x[i] = sc.nextInt();
y[i] = sc.nextInt();
}
Arrays.sort(x);
Arrays.sort(y);
}
}
16 changes: 16 additions & 0 deletions src/Codeforces/A.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package Codeforces;

import java.util.Scanner;
import java.util.Stack;

public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- >= 1) {

}
}


}
14 changes: 14 additions & 0 deletions src/Codeforces/B.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package Codeforces;

import java.util.Scanner;

public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- >= 1) {

}
}

}
46 changes: 46 additions & 0 deletions src/Codeforces/C.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package Codeforces;

import java.util.Scanner;

public class C {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
long number[] = new long[t];
long sum = 0;
long max = Long.MIN_VALUE;
long min = Long.MAX_VALUE;
for (int i = 0; i < t; i++) {
long a = sc.nextLong();
sum = sum + a;
if (a < min) {
min = a;
}
if (a > max) {
max = a;
}
}
int m = sc.nextInt();
for (int i = 0; i < m; i++) {
long x = sc.nextLong();
long y = sc.nextLong();
long sumEqual = sum;
long coins = 0;
if (x < max) {
} else {
coins = x - max;
sum = sum+coins;
}
sum = sum-x;

if (y < sum) {
} else {
long coins2 = y - sum;
coins += coins2;
}
sum = sumEqual;
System.out.println(coins);
}
}
}
14 changes: 14 additions & 0 deletions src/Codeforces/D.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package Codeforces;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class D {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- >= 1) {
}
}
}
45 changes: 45 additions & 0 deletions src/Codeforces/E1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package Codeforces;

import java.util.ArrayList;
import java.util.Scanner;

public class E1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- >= 1) {
int n = sc.nextInt();
ArrayList<Long> arr = new ArrayList<Long>();
for (int i = 0; i < n; i++) {
arr.add(sc.nextLong());
}
long length = 0;
long finalnumber = 0;
for (int i = 0; i < n; i++) {
long addingToBeg = (long) (Math.pow(10, length) * arr.get(i));
long addingToEnd = (long) (Math.pow(10, 1) * finalnumber);
if (addingToBeg + finalnumber > addingToEnd + arr.get(i)) {
finalnumber = addingToEnd + arr.get(i);
} else {
finalnumber = addingToBeg + finalnumber;
}
length++;
}
ArrayList<Long> finalAns = new ArrayList<>();
long ff = finalnumber;
while (ff != 0) {
finalAns.add(0, ff % 10);
ff = ff / 10;
}

if (finalAns.size() == 0) {
System.out.println(arr.get(0));
} else {
for (int i = 0; i < finalAns.size(); i++) {
System.out.print(finalAns.get(i) + " ");
}
System.out.println();
}
}
}
}
23 changes: 23 additions & 0 deletions src/Codeforces/Problem1033A.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package Codeforces;

import java.util.Scanner;

public class Problem1033A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int q1 = sc.nextInt();
int q2 = sc.nextInt();
int k1 = sc.nextInt();
int k2 = sc.nextInt();
int c1 = sc.nextInt();
int c2 = sc.nextInt();
if ((c1 > q1 && k1 > q1 && c2 > q2 && k2 > q2) || (k1 < q1 && k2 > q2 && c1 < q1 && c2 > q2) ||
(c1 < q1 && k1 < q1 && c2 < q2 && k2 < q2) ||
(k1>q1 && c1>q1 && k2<q2 && c2<q2)) {
System.out.println("YES");
}else{
System.out.println("NO");
}
}
}
12 changes: 12 additions & 0 deletions src/Codeforces/Problem1036A.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package Codeforces;

import java.util.Scanner;

public class Problem1036A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long k = sc.nextLong();
System.out.println((n+k-1)/n);
}
}
Loading