This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
#include<math.h> | |
typedef int ll; | |
using namespace std; | |
inline uint max(uint x, uint y) { | |
return (x > y)?x:y; | |
} | |
struct Node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import stdin | |
nex = iter(map(int,stdin.read().split())).next | |
n = nex() | |
list = [] | |
lt = [] | |
rt = [] | |
for i in xrange(n): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import stdin | |
nex = iter(map(int,stdin.read().split())).next | |
t = nex() | |
for _ in xrange(t): | |
n = nex() | |
list = [] | |
for i in xrange(n): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
struct Data | |
{ ll s,f,p; }; | |
bool operator < (Data const &a, Data const &b) | |
{return (a.p!=b.p)?(a.p<b.p):(a.f<b.f);} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import stdin | |
nex = iter(map(int,stdin.read().split())).__next__ | |
def markMultiples(vis,k): | |
i = 2 | |
num=i*k | |
while num <= len(vis): | |
vis[num-1] = 1 | |
i+=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import stdin | |
import dis | |
get = iter(map(int,stdin.read().split())).__next__ | |
def knapSack(lis,K,N): | |
dp = [[0]*(K+1)]*(N+1) | |
for n in range(N+1): | |
for k in range(K+1): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def operations(x): | |
val = 0 | |
val += x//5 | |
x%=5 | |
val+=x//2 | |
x%=2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import stdin | |
nex = iter(map(int,stdin.read().split())).__next__ | |
def knapSack(wt,val,W,N): | |
dp = [[0]*(5+W)]*(5+N) | |
for n in range(N+1): | |
for w in range(W+1): | |
if(w==0 or n==0): | |
dp[n][w] = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
int main() | |
{ | |
while(1) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 10 | |
12 3 | |
15 8 | |
16 9 | |
16 6 | |
10 2 | |
21 9 | |
18 4 | |
12 4 |