This file contains 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
"""https://www.codechef.com/LRNDSA01/problems/ZCO14003/""" | |
def main(): | |
num_customer = int(input()) | |
bgt_lst = sorted([int(input()) for i in range(num_customer)],reverse=True) | |
revenue = max([(index+1)*value for index,value in enumerate(bgt_lst)]) | |
print(revenue) | |
if __name__ == '__main__': | |
main() |
This file contains 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
"""https://www.codechef.com/LRNDSA01/problems/LAPIN""" | |
def LRNDSA01(ip,first_end,second_start,strlen): | |
d = dict() | |
for i in range(first_end): | |
d[ip[i]] = d.get(ip[i],0)+1 | |
for j in range(second_start,strlen): | |
try: |
This file contains 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
"""https://www.codechef.com/LRNDSA01/problems/FLOW007""" | |
def main(): | |
n=int(input()) | |
while(n!=0): | |
print(int(input()[::-1])) | |
n-=1 | |
if __name__ == '__main__': |
This file contains 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
# coding:utf-8 | |
from elasticsearch import Elasticsearch | |
import json | |
# Define config | |
host = "127.0.0.1" | |
port = 9200 | |
timeout = 1000 | |
index = "index" |
This file contains 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
import torch | |
from torch import nn | |
from torch.autograd import Variable | |
import torch.nn.functional as F | |
class RNN(nn.Module): | |
def __init__(self, input_size, hidden_size, output_size, n_layers=1): | |
super(RNN, self).__init__() | |
self.input_size = input_size | |
self.hidden_size = hidden_size |