Skip to content

Instantly share code, notes, and snippets.

View SudhagarS's full-sized avatar

Sudhagar SudhagarS

View GitHub Profile
1. Go to your sublime home directory, then Packages/SublimeREPL/config/
2. Open 'Ruby' directory in config, make the changes in this PR to pry_repl.rb
https://github.com/wuub/SublimeREPL/pull/372/files
3. Run 'which ruby' in your terminal, and copy the path it returns.
eg. /Users/sudhagarsachin/.rbenv/shims/ruby
4. In Main.sublime-menu, line 33, the "osx" to this JSON.
"osx": [
"/Users/sudhagarsachin/.rbenv/shims/ruby", // replace this with your path
"${packages}/SublimeREPL/config/Ruby/pry_repl.rb",
"$editor"
import java.io.*;
import java.util.*;
public class Schedule {
public static void main(String args[]) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer(br.readLine());
boolean m[]=new boolean[1441];m[1440]=false;
int n=Integer.parseInt(st.nextToken());int meeting_time=Integer.parseInt(st.nextToken()),shh,smm,ehh,emm,ashh=0,asmm=0,aehh=0,aemm=0;
while(n--!=0){
st=new StringTokenizer(br.readLine());
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std ;
#define _(x,a) memset(x,a,sizeof(x))
#define LET(x,a) __typeof(a) x(a)
#define FOR(i,a,b) for(LET(i,a);i!=(b);++i)
#define REP(i,n) FOR(i,0,n)
#define GI ({int t;scanf("%d",&t);t;})
@SudhagarS
SudhagarS / mixingmilk.cpp
Created October 30, 2012 19:43
My solutions for USACO train.usaco.org, part 2
/*
ID: sudhaga1
PROG: milk
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
#define MAXCOSTS 1001
@SudhagarS
SudhagarS / beads.cpp
Created October 30, 2012 19:40
My solutions for USACO train.usaco.org
/*
ID: sudhaga1
PROG: beads
LANG: C++
*/
#include "iostream"
#include "fstream"
using namespace std;
int main()
import java.util.*;
public class EvenTree {
public static void main(String args[]){
Scanner s=new Scanner(System.in);
int n,m;
int e1,e2;
n=s.nextInt();
m=s.nextInt();
Tree t=new Tree(n);
line1=raw_input().split()
N,K,total,completed,Costs=int(line1[0]),int(line1[1]),0,0,[]
for n in raw_input().split():Costs.append(int(n))
Costs.sort(reverse=True)
friend=[0]*K
for i in range(N):
friend[completed%K]+=1
total=total+friend[completed%K]*Costs[i]
completed+=1
print total
class StrSimilar{
public static void main(String[] args) {
java.util.Scanner sc=new java.util.Scanner(System.in);
int N=sc.nextInt(),sol;
while(N--!=0){
sol=0;
char[] s=sc.next().toCharArray();
for(int i=0;i<s.length;i++){
for(int j=i;j<s.length;j++){
if(s[j]==s[j-i]) sol++;
N, R = int(raw_input()), []
V = [1] * N
for x in xrange(N):
R.append(int(raw_input()))
while True:
finished = True
for i in xrange(N):
for k in [-1, 1]:
next = i + k
if next >= 0 and next < N and R[next] > R[i] and V[next] <= V[i]:
from math import sqrt
N = int(raw_input())
x, y = [], []
y = []
for i in xrange(N):
temp = raw_input().split()
x.append(int(temp[0]))
y.append(int(temp[1]))
avg_x = sum(x) / N
avg_y = sum(y) / N