Skip to content

Commit bd44983

Browse files
committed
Added new templates
1 parent d6f375b commit bd44983

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ Below is a brief description of the files:
3232
3333
* timer.cpp
3434
> It contains a small code snippet to print the time taken by the program to execute the given test case data.
35+
36+
* java_template.java
37+
> It conatins the code template for java solutions.
38+
39+
* python_template.py
40+
> It conatins the code template for python solutions.

java_template.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import java.io.*;
2+
import java.util.*;
3+
import java.math.*;
4+
5+
public class Main {
6+
public static void main(String[] args) throws Exception {
7+
InputStream inputStream = System.in;
8+
OutputStream outputStream = System.out;
9+
InputReader in = new InputReader(inputStream);
10+
PrintWriter out = new PrintWriter(outputStream);
11+
Task solver = new Task();
12+
int tesCases = in.nextInt();
13+
for(int test = 1; test <= tesCases; test += 1) {
14+
solver.solve(test, in, out);
15+
}
16+
out.close();
17+
}
18+
19+
static class Task {
20+
static final int MOD = (int) (1e9 + 7);
21+
22+
public void solve(int testNumber, InputReader in, PrintWriter out) {
23+
//Your code goes below
24+
25+
}
26+
}
27+
28+
static class InputReader {
29+
public BufferedReader take;
30+
public StringTokenizer split;
31+
public InputReader(InputStream stream) {
32+
take = new BufferedReader(new InputStreamReader(stream), 10000000);
33+
split = null;
34+
}
35+
public String next() {
36+
while (split == null || !split.hasMoreTokens()) {
37+
try {
38+
split = new StringTokenizer(take.readLine());
39+
}
40+
catch (IOException e) {
41+
throw new RuntimeException(e);
42+
}
43+
}
44+
return split.nextToken();
45+
}
46+
public int nextInt() {
47+
return Integer.parseInt(next());
48+
}
49+
}
50+
}

python_template.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#AUTHOR : BHUVNESH JAIN
2+
#INSTITUTION : BITS, PILANI
3+
4+
MAX = 100005
5+
MOD = 1000000007
6+
def add(a,b,c):
7+
res=a+b
8+
if(res>=c):
9+
return res-c
10+
else:
11+
return res
12+
13+
def mod(a,b,c):
14+
res=a*b
15+
if(res>=c):
16+
return res%c
17+
else:
18+
return res
19+
20+
def gcd(a,b):
21+
while b:
22+
a,b=b,a%b
23+
return a
24+
25+
def lcm(a,b):
26+
w=a//gcd(a,b)
27+
return w*b
28+
29+
def expo(a,b):
30+
x,y=1,a
31+
while(b>0):
32+
if(b&1):
33+
x=x*y
34+
y=y*y
35+
b>>=1
36+
return x
37+
38+
def power(a,b,m):
39+
x,y=1,
40+
while(b>0):
41+
if(b&1):
42+
x=mod(x,y,m)
43+
y=mod(y,y,m)
44+
b>>=1
45+
return x
46+
47+
if __name__ == "__main__":
48+
#code goes below79

0 commit comments

Comments
 (0)