Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03494 (python)

Fixed submission:
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int, input().split()))
mini = float(inf)
for i in a:
    mini = min(mini, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(mini))
Problem p03448 (python)

Fixed submission:
A, B, C, X = [int(input()) for i in range(4)]

print(sum(500*a + 100*b + 50*c == X for a in range(A + 1) for b in range(B + 1) for c in range(C + 1)))

Buggy submission (verdict: Runtime Error):
A, B, C, X = [list(map(input() for i in range(4)))]

print(sum(500*a + 100*b + 50*c == X for a in range(A + 1) for b in range(b + 1) for c in range(c + 1)))
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
 
if (a*b) % 2 :
  print('Odd')
else:
  print('Even')

Buggy submission (verdict: Runtime Error):
a, b = int(input())

if (a*b) % 2:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = int(input())

if a%b == 0:
  print('Even')
else:
  print('Odd')
Problem p03455 (python)

Fixed submission:
a,b = (int(x) for x in input().split())
c = a * b
if c%2 !=0:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a,b = (int(x) for x in input().split())
c = a * b
if c/2 % 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a, b = int(input()).split()
c = a * b
if c/2 == 0:
    print("Even")
else:
    print("Odd")
Problem p03448 (python)

Fixed submission:
a,b,c,X=[int(input()) for i in range(4)]
print([500*x+100*y+50*z for z in range(c+1) for y in range(b+1) for x in range(a+1)].count(X))

Buggy submission (verdict: Runtime Error):
A,B,C,X=[int(input()) for i in range(4)]
cnt = 0
for a in range(0,A+1):
    Y = X - 500*a
    if Y==0:
        cnt += 1
        continue
    elif Y<0:
        break
    for b in range(0,B+1):
        Z = Y - 100*b
        if Z==0:
            cnt += 1
            continue
        elif Z<0:
            break
        if W%50 == 0:
            cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
A,B,C,X=[int(input()) for i in range(4)]
cnt = 0
for a in range(0,A+1):
    Y = X - 500*a
    if Y==0:
        cnt += 1
        continue
    elif Y<0:
        continue
    for b in range(0,B+1):
        Z = Y - 100*b
        if Z==0:
            cnt += 1
            continue
        elif Z<0:
            continue
        if W == 0:
            cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
A,B,C,X=[int(input()) for i in range(4)]
for a in range(1,A+1):
    Y = X - 500*a
    for b in range(1,B+1):
        Z = Y - 100*b
        for c in range(1,C+1):
            W = Z - 50*c
            if W == 0:
                cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
a,b,c,X=[int(input()) for i in range(4)]
for a in range(1,A+1):
    Y = X - 500*a
    for b in range(1,B+1):
        Z = Y - 100*b
        for c in range(1,C+1):
            W = Z - 50*c
            if W == 0:
                cnt += 1
print(cnt)
Problem p03478 (python)

Fixed submission:
n,a,b=map(int,input().split())
print(sum(i for i in range(n+1) if a<=sum(map(int,str(i)))<=b))

Buggy submission (verdict: Runtime Error):
def keta_sum(x):
    sum = 0
    while x%10 !=0:
        sum += x%10
        x = x//10
    return(sum)

cnt=0
total=0
for x in range(1,N+1):
    y = keta_sum(x)
    if A<=y<=B:
        cnt +=1
        total +=x 
            
print(total)
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for i in range(0, A+1):
        for j in range(0, B+1):
                for k in range(0, C+1):
                        if int(500*i + 100*j + 50*k) == X:
                            cnt += 1
                     
print(cnt)

Buggy submission (verdict: Runtime Error):
A,B,C,X = map(int, input().split())

cnt = 0
for i in range(0, A+1):
        for j in range(0, B+1):
                for k in range(0, C+1):
                        if int(500*i + 100*j + 50*k) == X:
                            cnt += 1
                     
print(cnt)

Buggy submission (verdict: Runtime Error):
A,B,C,X = map(int, input().split())

cnt = 0
for i in range(A+1):
        for j in range(B+1):
                for k in range(C+1):
                        if (500*i + 100*j + 50*k) == X:
                            cnt += 1
                        else:
                            cnt += 0
print(cnt)

Buggy submission (verdict: Runtime Error):
A,B,C,X = map(int, input().split())

cnt = 0
for i in range(A+1):
        for j in range(B+1):
                for k in range(C+1):
                        if 500*i + 100*j + 50*k == X:
                            cnt += 1
                        else:
                            cnt += 0
print(cnt)

Buggy submission (verdict: Runtime Error):
A,B,C,X = map(int, input().split())

cnt = 0
for i in range(A):
        for j in range(B):
                for k in range(C):
                        if 500*A + 100*B + 50*C == X:
                            cnt += 1
                        else:
                            cnt += 0
print(cnt)
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
abc = map(int, input().split())
print(a+b+c)

Buggy submission (verdict: Runtime Error):
s1s2s3 = map(int, input().split())
print(s1+s2+s3)

Buggy submission (verdict: Runtime Error):
s1, s2, s3 = map(int, input().split())
print(s1+s2+s3)
Problem p03680 (python)

Fixed submission:
N = int(input())
buttons = [int(input()) for i in range(N)]

button = 1
count = 0
while(True):
    button = buttons[button - 1]
    count += 1
    if (button == 2):
        print(count)
        break
    elif(count > N):
        print(-1)
        break

Buggy submission (verdict: Runtime Error):
N = int(input())
buttons = [int(input()) for i in range(N)]

pushed = list()
button = 1
count = 0
while(True):
    button = buttons[button - 1]
    count +=1
    if (button == 2):
        print(count)
        break
    elif(button in pushed):
        print(-1)
        break
    else:
        pushued.append(button)
Problem p03447 (python)

Fixed submission:
x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)

Buggy submission (verdict: Runtime Error):
x=int(input())　　#intで整数と指定　、input()は入力されたデータを文字列として返す。
a=int(input())
b=int(input())
print((x-a)%b)

Buggy submission (verdict: Runtime Error):
import math

A = int(A)
B = int(B)
X = int(X)
Y = int(Y)
Z = int(Z)

Y = X - A

Y % B = Z



print("手元に残っている金額は" + str(Y) + "円です")
Problem p03455 (python)

Fixed submission:
def main():
  a, b = map(int, input().split())
  if a*b % 2 == 0:
    print("Even")
  else:
    print("Odd")
main()

Buggy submission (verdict: Runtime Error):
def test(a, b):
  if a*b % 2 == 0:
    print("Even")
  else:
    print("Odd")
test(a, b)
Problem p03493 (python)

Fixed submission:
s = input()
print(s.count("1"))

Buggy submission (verdict: Runtime Error):
s = input()
print(s.count())

Buggy submission (verdict: Runtime Error):
def main():
    a, b, c = map(int, input.split())
    list = [a, b, c]
    count = 1
    for i in list:
        if i == 1:
            count += 1
    print(count)
main()
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if(a*b%2 == 0 ):
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
if a*b%2:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
if (a*b)%2 ==0:
  print('Odd')
else:
  print('Even')

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
if (a*b)%2 ==0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
if a*b%2==0:
  print('Even')
else:
  print('Odd')
Problem p03456 (python)

Fixed submission:
a,b=map(str,input().split())
n=int(a+b)
m=n**0.5
if int(m)-m==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
n=int(a+b)
m==n**0.5
if int(m)-m==0:
  print('Yes')
else:
  print('No')
Problem p03448 (python)

Fixed submission:
import itertools


def main():
    A = int(input()) + 1
    B = int(input()) + 1
    C = int(input()) + 1
    X = int(input())

    cnt = 0
    for n_500, n_100, n_50 in itertools.product(range(A), range(B), range(C)):
        y = 500 * n_500 + 100 * n_100 + 50 * n_50
        if y == X:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import itertools
import sys


def main(argv):
    inputs = [int(v.rstrip()) for v in argv]
    A = inputs[0]
    B = inputs[1]
    C = inputs[2]
    X = inputs[3]

    cnt = 0
    for n_500, n_100, n_50 in itertools.product(range(A), range(B), range(C)):
        if 500 * n_500 + 100 * n_100 + 50 * n_50 == X:
           cnt += 1

    print(cnt)


if __name__ == '__main__':
    main(sys.argv[1:])

Buggy submission (verdict: Runtime Error):
import itertools
import sys


def main(argv):
    inputs = [int(v) for v in argv]
    A = inputs[0]
    B = inputs[1]
    C = inputs[2]
    X = inputs[3]

    cnt = 0
    for n_500, n_100, n_50 in itertools.product(A, B, C):
        if 500 * n_500 + 100 * n_100 + 50 * n_50 == X:
           cnt += 1

    print(cnt)


if __name__ == '__main__':
    main(sys.argv[1:])
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
res=0
for  i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if 500*i + 100*j + 50*k == X:
                res += 1
print(res)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count=0
for a in [a*500 for a in range(A + 1)]:
    for b in [b*100 for b in range(B + 1)]:
        for c in [c*50 in range(C + 1)]:
            if a + b + c == X:
                count += 1
print(count)
Problem p03455 (python)

Fixed submission:
a,b = map(int, input().split())
if a%2!=0 and b%2!=0:
  print("Odd")
else:
  print("Even")

Buggy submission (verdict: Runtime Error):
    a, b=map(int, input().split())
    print("Even" if a*b%2 else "Odd")

Buggy submission (verdict: Runtime Error):
    import functools
    print("Even" if functools.reduce(lambda x,y:x*y,map(int,input().split())) %2==0 else "Odd")

Buggy submission (verdict: Runtime Error):
import functools
print("Even" if functools.reduce(lamda x,y:x*y,map(int,input().split())) %2==0 else "Odd")

Buggy submission (verdict: Runtime Error):
for i in [map(int, input().split())]:
  print("Even" if i[0]*i[1]%2==0 else "Odd")
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))
cnt = 0
while all(a%2==0 for a in A):
    A = [a/2 for a in A]
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = input()
A = list(map(int, input().split()))
c = 0
while all(a%2==0 for a in A):
    A = [a/2 for a in A]
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
c=0
while(all([a%2==0 for a in A])):
    A = list(map(lambda i:i//2, A))
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
c=0
while(all([a%2==0 for a in A])):
    A = list(map(lambda i:i//2, A))
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
print(input().count('1')
Problem p03494 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
c=0
loop=True
while(loop):
    for a in A:
        if a%2!=0:
            loop=False
            break
    if loop:
        A = list(map(lambda i:i//2, A))
        c+=1
    else:
        break
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=map(int,input().split())
c=0
loop=True
while(loop):
  for a in A:
    if a%2!=0:
      loop=False
      break
  a = map(lambda a//2, a)
  count+=1
print(c)
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
if ((A+B+C<1) or (A<0 or A>50) or (B<0 or B>50) or (C<0 or C>50) or (X<50 or X > 20000 or X%50!=0)):
    print("条件を満たしてください")
count = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            Y = i*500 + j*100 + k*50
            if (X==Y):
                count = count+1

print (count)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input()
if ((A+B+C<1) or (A<0 or A>50) or (B<0 or B>50) or (C<0 or C>50) or (X<50 or X > 20000 or X%50!=0)):
    print("条件を満たしてください")
count = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            Y = i*500 + j*100 + k*50
            if (X==Y):
                count = count+1

print (count)
Problem p03447 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
print((a-b)%c)

Buggy submission (verdict: Runtime Error):
a = readline()
b = readline()
c = readline()
print((a-b)%c)
Problem p03447 (python)

Fixed submission:
"""
あなたは、X 円を持ってケーキとドーナツを買いに出かけました。
あなたはまずケーキ屋で 1 個 A 円のケーキを 1 個買いました。 次に、ドーナツ屋で 1 個 B 円のドーナツをできるだけたくさん買いました。
これらの買い物のあと手元に残っている金額は何円ですか。
"""

def buying_sweets(money,p_cake,p_dounuts):
    t_money  = money - p_cake
    c_dounuts = t_money // p_dounuts
    p_after_money = t_money - (c_dounuts * p_dounuts)
    return p_after_money

money = int(input())
p_cake = int(input())
p_dounuts = int(input())
print(buying_sweets(money,p_cake,p_dounuts))

Buggy submission (verdict: Runtime Error):
"""
あなたは、X 円を持ってケーキとドーナツを買いに出かけました。
あなたはまずケーキ屋で 1 個 A 円のケーキを 1 個買いました。 次に、ドーナツ屋で 1 個 B 円のドーナツをできるだけたくさん買いました。
これらの買い物のあと手元に残っている金額は何円ですか。
"""

def buying_sweets(money,p_cake,p_dounuts):
    t_money  = money - p_cake
    c_dounuts = t_money // p_dounuts
    p_after_money = t_money - (c_dounuts * p_dounuts)
    return p_after_money

N = int(input())
a = []
for i in range(N):
    a.append(int(input()))

money = a[1]
p_cake = a[2]
p_dounuts = a[3]
print(buying_sweets(money,p_cake,p_dounuts))

Buggy submission (verdict: Runtime Error):
"""
あなたは、X 円を持ってケーキとドーナツを買いに出かけました。
あなたはまずケーキ屋で 1 個 A 円のケーキを 1 個買いました。 次に、ドーナツ屋で 1 個 B 円のドーナツをできるだけたくさん買いました。
これらの買い物のあと手元に残っている金額は何円ですか。
"""

import sys

def buying_sweets(money,p_cake,p_dounuts):
    t_money  = money - p_cake
    c_dounuts = t_money // p_dounuts
    p_after_money = t_money - (c_dounuts * p_dounuts)
    return p_after_money
a = []
for line in sys.stdin:
    a.append(int(line))
money = a[1]
p_cake = a[2]
p_dounuts = a[3]
print(buying_sweets(money,p_cake,p_dounuts))

Buggy submission (verdict: Runtime Error):
"""
あなたは、X 円を持ってケーキとドーナツを買いに出かけました。
あなたはまずケーキ屋で 1 個 A 円のケーキを 1 個買いました。 次に、ドーナツ屋で 1 個 B 円のドーナツをできるだけたくさん買いました。
これらの買い物のあと手元に残っている金額は何円ですか。
"""

def buying_sweets(money,p_cake,p_dounuts):
    t_money  = money - p_cake
    c_dounuts = t_money // p_dounuts
    p_after_money = t_money - (c_dounuts * p_dounuts)
    return p_after_money
N = input()
a = [input() for i in range(N)]
money = a[1]
p_cake = a[2]
p_dounuts = a[3]
print(buying_sweets(money,p_cake,p_dounuts))
Problem p03587 (python)

Fixed submission:
S = [int(n) for n in list(input())]
print(sum(S))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
B = []
for n in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
print(max(A) + min(B))
Problem p03447 (python)

Fixed submission:
if __name__ == '__main__':
    x = int(input())
    a = int(input())
    b = int(input())
    if x <= a:
        print(0)
    else:
        print((x - a) % b)

Buggy submission (verdict: Runtime Error):
def evaluate_positions(positions, cache, assume_origin_set, unevaluated_positions):
    has_conflict = False
    origin_set = assume_origin_set
    for position_data in positions:
        l, r, d = position_data
        if cache[l] != -1 and cache[r] != -1:
            if cache[r] - cache[l] != d:
                has_conflict = True
                break
        elif cache[l] == -1 and cache[r] != -1:
            cache[l] = cache[r] - d
        elif cache[l] != -1 and cache[r] == -1:
            cache[r] = cache[l] + d
        else:
            if not origin_set:
                cache[l] = 0
                cache[r] = d
                origin_set = True
            else:
                unevaluated_positions.append(position_data)
    return has_conflict

if __name__ == '__main__':
    n, m = list(map(int, input().split(" ")))
    cache = [-1 for _ in range(n + 1)]
    positions = []
    for _ in range(m):
        positions.append(list(map(int, input().split(" "))))
    unevaluated_positions = []

    has_conflict = False
    assume_origin_set = False
    while True:
        has_conflict = evaluate_positions(positions, cache, assume_origin_set, unevaluated_positions)
        assume_origin_set = True
        #print("{} vs {}".format(positions, unevaluated_positions))
        if has_conflict:
            break
        if len(unevaluated_positions) == 0:
            break
        if len(positions) == len(unevaluated_positions):
            assume_origin_set = False
        positions = unevaluated_positions
        unevaluated_positions = []

    print("No" if has_conflict else "Yes")
Problem p03657 (python)

Fixed submission:
a, b = map(int, input().split(" "))
if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
  print("Possible")
else:
  print("Impossible")

Buggy submission (verdict: Runtime Error):
a, b = input().split(' ')
c = int(a) + int(b)
if a%3==0 or b%3==0 or c%3==0:
  print("Possible")
else:
  print("Impossible")

Buggy submission (verdict: Runtime Error):
a, b = input().split(' ')
c = int(a) + int(b)
if (a%3==0 and a > 3) or (b%3==0 and b>3) or (c%3==0 and c>3):
  print("Possible")
else:
  print("Impossible")

Buggy submission (verdict: Runtime Error):
a, b = input().split(' ')
c = int(a) + int(b)
if (a%3==0 and a > 3) or (b%3==0&&b>3) or (c%3==0 &&c>3):
  print("Possible")
else:
  print("Impossible")
Problem p04032 (python)

Fixed submission:
if __name__ == '__main__':
    s = input()
    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            print("{} {}".format(i + 1, i + 2))
            exit(0)
    for i in range(len(s) - 2):
        if s[i] == s[i + 2]:
            print("{} {}".format(i + 1, i + 3))
            exit(0)
    print("-1 -1")

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    s = input()
    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            print("{} {}".format(i + 1, i + 2))
            exit(0)
    for i in range(len(s - 2)):
        if s[i] == s[i + 2]:
            print("{} {}".format(i + 1, i + 3))
            exit(0)
    print("-1 -1")

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    s = input()
    d = {}
    unbalanced = False
    unbalanced_char = ''
    for c in s:
        if c in d:
            d[c] += 1
            unbalanced = (d[c] >= int(len(s) / 2))
            if unbalanced:
                unbalanced_char = c
                break
        else:
            d[c] = 1

    if unbalanced:
        count = 0
        start = s.find(unbalanced_char)
        end = start
        for i in range(start, len(s)):
            if s[i] == unbalanced_char:
                end = i
                count += 1
            if count >= int(len(s) / 2):
                break
        print(f"{start + 1} {end + 1}")
    else:
        print("-1 -1")
Problem p03447 (python)

Fixed submission:
X = int(raw_input())
A = int(raw_input())
B = int(raw_input())
X -= A
while X >= B:
    X -= B
print X

Buggy submission (verdict: Runtime Error):
X = int(raw_input())
A = int(raw_input())
B = int(raw_input())
X -= A
for X>B:
    X -= B
print X
Problem p03447 (python)

Fixed submission:
# -*- coding: utf-8 -*-

import sys

x = int(raw_input().split()[0])
a = int(raw_input().split()[0])
b = int(raw_input().split()[0])

sys.stdout.write('%d\n' % ((x - a) % b))
sys.stdout.flush()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

def reachable(td, l, r, d):
    if not(l in td):
        return (False, d)
    vl = td[l]
    for v in vl:
        vr, vd = v
        if vr == r:
            return (True, d + vd)
        rb, rd = reachable(td, vr, r, d + vd)
        if rb:
            return (rb, rd)
    return (False, d)

n, m = [int(i) for i in raw_input().split()]
tl = list()
for i in range(m):
    l = [int(i) for i in raw_input().split()]
    tl.append(l)
# print n, m
# print tl

consistent = 'Yes'
td = {}
for t in tl:
    l, r, d = t
    
    found, fd = reachable(td, r, l, 0)
    if found:
        consistent = 'No'
        break
    
    found, fd = reachable(td, l, r, 0)
    if found:
        if fd != d:
            consistent = 'No'
            break
        else:
            v = (r, d)
            td[l].add(v)
    else:
        if not (l in td):
            td[l] = set()
        v = (r, d)
        td[l].add(v)

sys.stdout.write('%s\n' % consistent)
sys.stdout.flush()
Problem p03455 (python)

Fixed submission:
# -*- coding: utf-8 -*-

import sys

a, b = [int(e) for e in raw_input().split()]

ans = 'Even'
if (a & 1) and (b & 1):
    ans = 'Odd'
    
sys.stdout.write('%s\n' % (ans))
sys.stdout.flush()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

def color(x, y, k):
    r = 0
    if ((x % (2*k)) / k) != 0:
        r = -1
    
    if ((y % (2*k)) / k) != 0:
        r ^= -1

    return 'B' if  r == 0 else 'W'

def nSatisfied(n, k, tl):
    maxH = 0
    for yi in xrange(0, 2*k):
        for xi in xrange(0, 2*k):
            h = 0
            for e in tl:
                x, y, c = e
                if color(x + xi, y + yi, k) == c:
                    h += 1
            if h > maxH:
                maxH = h
            if maxH == n:
                return maxH
    return maxH


n, k = [int(e) for e in raw_input().split()]
tl = []
for i in range(0, n):
    x, y, c = [e for e in raw_input().split()]
    tl.append([int(x), int(y), c])

# print
# print n, k
# print tl

# for i in range(0, 2*k):
#     print color(i, k),

# print

maxH = nSatisfied(n, k, tl)

sys.stdout.write('%d\n' % maxH)
sys.stdout.flush()
Problem p03501 (python)

Fixed submission:
# -*- coding: utf-8 -*-

import sys

n, a, b = [int(e) for e in raw_input().split()]
# print n, a, b
# print n*a, b
# print min(n*a, b)

sys.stdout.write('%d\n' % ( min(n*a, b) ))
sys.stdout.flush()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

a, b = [int(e) for e in raw_input().split()]

ans = 'Even'
if (a & 1) and (b & 1):
    ans = 'Odd'
    
sys.stdout.write('%s\n' % (ans))
sys.stdout.flush()
Problem p03503 (python)

Fixed submission:
# -*- coding: utf-8 -*-

import sys

u"""
1023回全て check
"""

def ones(n):
    o = 0
    for i in xrange(0, 10):
        b = 1 << i
        if n & b:
            o += 1
    return o

n = int(raw_input().split()[0])
# print n

openL = []
for _ in xrange(0, n):
    fs = ''.join( [e for e in raw_input().split()] )
    openL.append( int(fs, base=2) )
    
profL = []
for _ in xrange(0, n):
    profL.append( [int(e) for e in raw_input().split()] )

# print n
# print [hex(e) for e in openL]
# print profL, len(profL[0])

# print ones(0), ones(0x3ff)

maxP = -sys.maxint - 1
for i in xrange(1, 1024):
    p = 0
    for x in xrange(0, len(openL)):
        ox = openL[x]
        px = profL[x]
        p += px[ ones(ox & i) ]

    if p > maxP:
        maxP = p
    
sys.stdout.write('%d\n' % maxP)
sys.stdout.flush()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

n = int(raw_input().split()[0])
tl = []
for i in range(n):
    e = [int(e) for e in raw_input().split()]
    tl.append(e)
#print tl

t = 0
x = 0
y = 0
ans = 'Yes'
for i in tl:
    ti, xi, yi = i
    dt = ti - t
    dx = abs(xi - x)
    dy = abs(yi - y)
    # print [t,x,y], i, [dt,dx,dy],
    if (dx + dy) > dt:
        # print '!',
        ans = 'No'
        break
    if (dt - (dx + dy)) & 1:
        # print '!!',
        ans = 'No'
        break
    # print
    t = ti
    x = xi
    y = yi
    
# print
sys.stdout.write('%s\n' % (ans))
sys.stdout.flush()