Harryxun/testdata huggingface dataset:
Buggy python 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)

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 python 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)

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 python 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)

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 python 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)

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 python submission (verdict: Runtime Error):
abc = map(int, input().split())
print(a+b+c)

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

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

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

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

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Time Limit Exceeded):
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)

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 python submission (verdict: Time Limit Exceeded):
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:
        pushed.append(button)

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 python 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)

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

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

Buggy python 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) + "円です")

Fixed submission:
x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)
Buggy python submission (verdict: Runtime Error):
def test(a, b):
  if a*b % 2 == 0:
    print("Even")
  else:
    print("Odd")
test(a, b)

Fixed submission:
def main():
  a, b = map(int, input().split())
  if a*b % 2 == 0:
    print("Even")
  else:
    print("Odd")
main()
Buggy python submission (verdict: Runtime Error):
s = input()
print(s.count())

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

Buggy python 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()

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


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

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


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

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


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

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

Fixed submission:
a, b = map(int, input().split())
if(a*b%2 == 0 ):
  print('Even')
else:
  print('Odd')
Buggy python 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')


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 python 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:])


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 python 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:])


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 python 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)

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 python submission (verdict: Runtime Error):
    a, b=map(int, input().split())
    print("Even" if a*b%2 else "Odd")

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

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

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

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


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

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

Fixed submission:
a,b = map(int, input().split())
if a%2!=0 and b%2!=0:
  print("Odd")
else:
  print("Even")
Buggy python 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)

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

Buggy python 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)

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

Buggy python 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)

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

Buggy python 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)

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

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

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Time Limit Exceeded):
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
  if loop:
      A = map(lambda i:i//2, A)
      c+=1
  else:
      break
print(c)

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 python 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)

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 python 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)

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 python submission (verdict: Runtime Error):
a = readline()
b = readline()
c = readline()
print((a-b)%c)

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

Buggy python 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))


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 python 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))


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 python 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))

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 python 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))

Fixed submission:
S = [int(n) for n in list(input())]
print(sum(S))
Buggy python 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")



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 python 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")

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 python 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")

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 python 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")

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 python 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")

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 python 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")


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 python 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

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

Buggy python 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()


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 python 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()


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()