Skip to content

Instantly share code, notes, and snippets.

View kg86's full-sized avatar

kg kg86

  • LegalOn Technologies
  • Tokyo, Japan
View GitHub Profile
@kg86
kg86 / pull_all.py
Created July 2, 2016 06:56
git pull for all subdirectories
from __future__ import print_function
import os
import subprocess
def main():
cmd = 'git pull'
dir = os.getcwd()
for subdir in os.listdir(dir):
if os.path.isdir(subdir) and os.path.exists(subdir):
class ColorfulChocolates {
public:
int maximumSpread(string chocolates, int maxSwaps) {
int n = chocolates.size();
int ms[26][n];
int i, j, k;
for(i = 0; i < 26; i++){
for(j = 0; j < n; j++){
ms[i][j] = 0;
}
class RotatingBot {
public:
int minArea(vector <int> moves) {
int MAX_W = 55;
int MAX_H = 55;
int newmap[MAX_H*2][MAX_W*2];
vector< vector<int> > map(MAX_H*2);
int i,j;
for(i = 0; i < MAX_H*2; i++){
map[i] = vector<int>(MAX_H*2);
class EasyConversionMachine {
public:
string isItPossible(string originalWord, string finalWord, int k) {
string POSSIBLE = "POSSIBLE";
string INPOSSIBLE = "IMPOSSIBLE";
int n = originalWord.size();
int i;
int diff=0;
for(i = 0; i < n; i++){
class BallAndHats
{
public:
int getHat(string hats, int numSwaps)
{
int idx = hats.find("o");
if (numSwaps == 0) return idx;
return (idx + (numSwaps % 2)) % 2;
}
};
#! -*- coding: utf-8-unix -*-
import sys
def overlap(p1, p2):
# print p1, p2,(p1[0]-p2[0]) ** 2 + (p1[1] - p2[1])**2
return (p1[0]-p2[0]) ** 2 + (p1[1] - p2[1])**2 <= 4
if __name__=='__main__':
lines = [x.strip() for x in sys.stdin.readlines() if x != '' and x != '\n']
# print lines
#! -*- coding: utf-8-unix -*-
import sys
if __name__=='__main__':
lines = [x.strip() for x in sys.stdin.readlines() if x != '' and x != '\n']
for line in lines:
cs = line.split()
stack = []
res = 0.0
for c in cs:
#! -*- coding: utf-8-unix -*-
import math
if __name__=='__main__':
n = int(raw_input())
for i in xrange(n):
x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().strip().split(' '))
if math.fabs((y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1)) < 1e-10:
print 'YES'
else:
#! -*- coding: utf-8-unix -*-
import math
if __name__=='__main__':
n = int(raw_input())
for i in xrange(n):
x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().strip().split(' '))
if math.fabs((y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1)) < 1e-10:
print 'YES'
else:
import sys
if __name__=='__main__':
lines = [int(x.strip()) for x in sys.stdin.readlines() if x != '' and x != '\n']
n = lines[0]
for i in xrange(n):
# a, b = int(lines[i+1]), int(lines[i+2])
a, b = lines[2*i+1], lines[2*i+2]
if len(str(a+b)) > 80:
print 'overflow'