TnT/CodeNet4Repair huggingface dataset:
Problem:
It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers.  You are given an integer N. Find the N-th Lucas number.  Here, the i-th Lucas number L_i is defined as follows:    * L_0=2   * L_1=1   * L_i=L_{i-1}+L_{i-2} (i≥2)

Incorrect submission (verdict: Wrong Answer):
n = int(input())
l_1 = 2; l_2 = 1;l_n = 3
for i in range(n):
  l_1, l_2, l_n = l_2, l_n, (l_1 + l_2)
print(l_1)

Fixed, accepted submission:
n = int(input())
l_0 = 2; l_1 = 1; l_n = 3
for i in range(n):
  l_0, l_1, l_n = l_1, l_n, (l_1 + l_n)
print(l_0)
Problem:
Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s).  Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends with `Z`.

Incorrect submission (verdict: Wrong Answer):
def main():
  s=input()
  start=0
  end=len(s)
  for i in range(0,len(s)):
    if s[i]=='A':
      start=i
      break
  for i in range(1,len(s)):
    if s[-i]=='Z':
      end=len(s)-i
      break
main()


Fixed, accepted submission:
def main():
  s=input()
  start=0
  end=len(s)
  for i in range(0,len(s)):
    if s[i]=='A':
      start=i
      break
  for i in range(1,len(s)):
    if s[-i]=='Z':
      end=len(s)-i
      break
  print(end-start+1)
main()
Problem:
When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l.  You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i.  Find B_i for each i = 1, 2, ..., N.

Incorrect submission (verdict: Wrong Answer):
from sys import stdin
input = stdin.readline

n = int(input())
x = list(map(int, input().split()))

x_sorted=sorted(x)
c = (x_sorted[n//2-1]+x_sorted[n//2])/2
print(x_sorted)

for i in range(n):
    if x[i]>=c:
        print(x_sorted[n//2-1])
    else:
        print(x_sorted[n//2])


Fixed, accepted submission:
from sys import stdin
input = stdin.readline

n = int(input())
x = list(map(int, input().split()))

x_sorted=sorted(x)
c = (x_sorted[n//2-1]+x_sorted[n//2])/2

for i in range(n):
    if x[i]>=c:
        print(x_sorted[n//2-1])
    else:
        print(x_sorted[n//2])
Problem:
You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.

Incorrect submission (verdict: Wrong Answer):
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

s = input()
l = set(s)
if len(s) == l:
    print("yes")
else:
    print("no")

Fixed, accepted submission:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

s = input()
li = []
for i in range(len(s)):
    for j in range(len(li)):
        if s[i] == li[j]:
            print("no")
            sys.exit()
    li.append(s[i])
print("yes")
Problem:
There is a bar of chocolate with a height of H blocks and a width of W blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle.  Snuke is trying to divide the bar as evenly as possible. More specifically, he is trying to minimize S_{max} \- S_{min}, where S_{max} is the area (the number of blocks contained) of the largest piece, and S_{min} is the area of the smallest piece. Find the minimum possible value of S_{max} - S_{min}.

Incorrect submission (verdict: Wrong Answer):
h, w = map(int, input().split())

s_org = h * w

answer = h * w
for i in range(2):
  if i == 1:
    h, w = w, h
  for height in range(1, h+1):
    s1 = height * w
    remain_height = h - height
    s2 = remain_height * int(w / 2)
    s3 = s_org - (s1 + s2)
    s_max = max([s1, s2, s3])
    s_min = min([s1, s2, s3])
    answer = min([answer, (s_max - s_min)])

    s1 = height * w
    s2 = (h - height) * w
    s3 = s_org - (s1 + s2)
    s_max = max([s1, s2, s3])
    s_min = min([s1, s2, s3])
    answer = min([answer, (s_max - s_min)])
  
print(answer)

Fixed, accepted submission:
h, w = map(int, input().split())

s_org = h * w

answer = h * w
for i in range(2):
  if i == 1:
    h, w = w, h
  for height in range(1, h+1):
    s1 = height * w
    remain_height = h - height
    s2 = remain_height * int(w / 2)
    s3 = s_org - (s1 + s2)
    s_max = max([s1, s2, s3])
    s_min = min([s1, s2, s3])
    answer = min([answer, (s_max - s_min)])

    s1 = height * w
    s2 = int((h - height) / 2) * w
    s3 = s_org - (s1 + s2)
    s_max = max([s1, s2, s3])
    s_min = min([s1, s2, s3])
    answer = min([answer, (s_max - s_min)])
  
print(answer)
Problem:
We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**.  You are given a 4-digit integer N. Answer the question: Is N **good**?

Incorrect submission (verdict: Wrong Answer):
int_n = int(input())

if str(int_n).count(str(int_n)[0]) == 4:
    print("Yes")
else:
    print("No")

Fixed, accepted submission:
n = input()

counter = 0
tmp = ""
for w in n:
    if tmp != w:
        counter = 1
        tmp = w
    else:
        counter += 1
        if counter >= 3:
            print("Yes")
            exit(0)
else:
    print("No")
Problem:
Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1.

Incorrect submission (verdict: Wrong Answer):
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    a = [int(i) for i in input().split()]


    if a[0]//2 >=a[1] :
        print("YES")
    else:
        print("NO")


Fixed, accepted submission:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    
    if a[0] % 2 ==1:
        a[0] +=1


    if a[0]//2 >=a[1] :
        print("YES")
    else:
        print("NO")
Problem:
How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?

Incorrect submission (verdict: Wrong Answer):
M = int(input())

answer = 24 - M 

print(answer)

Fixed, accepted submission:
M = int(input())

answer = 24 - M + 24 

print(answer)
Problem:
Snuke has a favorite restaurant.  The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.  So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y.

Incorrect submission (verdict: Wrong Answer):
n= int(input())

print(n*800-n%15*200)

Fixed, accepted submission:
n= int(input())

print(n*800-n//15*200)
Problem:
We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**.  You are given a 4-digit integer N. Answer the question: Is N **good**?

Incorrect submission (verdict: Wrong Answer):
N=set(input())
if len(N)<1:
    print('Yes')
else:
    print('No')

Fixed, accepted submission:
a,b,c,d=input()
print('Yes' if a==b==c or b==c==d else 'No')
Problem:
Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s).  Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends with `Z`.

Incorrect submission (verdict: Wrong Answer):
s = input()
for a in range(len(s)):
  if s[a]=='A':
    break
s = s[::-1]
for z in range(len(s)):
  if s[z] =='Z':
    break
s= s[::-1]
print(s[a:-z+1])

Fixed, accepted submission:
s = input()
for a in range(len(s)):
  if s[a]=='A':
    break
s = s[::-1]
for z in range(len(s)):
  if s[z] =='Z':
    break
print(len(s)-z-a)
Problem:
Joisino is working as a receptionist at a theater.  The theater has 100000 seats, numbered from 1 to 100000.  According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive).  How many people are sitting at the theater now?

Incorrect submission (verdict: Wrong Answer):
N = int(input())
l = []
r = []
for i in range(N):
    temp_l, temp_r = input().split()
    l.append(int(temp_l))
    r.append(int(temp_r))
ans = 0
for i in range(N):
    ans += l[i] - r[i] + 1
print(ans)

Fixed, accepted submission:
N = int(input())
l = []
r = []
for i in range(N):
    temp_l, temp_r = input().split()
    l.append(int(temp_l))
    r.append(int(temp_r))
ans = 0
for i in range(N):
    ans += r[i] - l[i] + 1
print(ans)
Problem:
You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence.  For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
mod = 10**9 + 7
a = list(map(int,input().split()))
il = [[]for i in range(n)]
for i in range(n+1):
    il[a[i]-1].append(i)
    if len(il[a[i]-1]) > 1:
        p,q = il[a[i]-1]
comb = 1
c = p + n - q
for i in range(n+1):
    comb = comb*(n+1-i)//(i+1)
    if c >= i:
        comb2 = 1
        for j in range(i):
            comb2 = comb2*(c-j)//(j+1)
            print((comb-comb2)%mod)
    else:
        print(comb%mod)

Fixed, accepted submission:
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod + x % mod)% mod
n = int(input())
mod = 10**9 + 7
a = list(map(int,input().split()))
il = [[]for i in range(n)]
for i in range(n+1):
    il[a[i]-1].append(i)
    if len(il[a[i]-1]) > 1:
        p,q = il[a[i]-1]
comb = 1
comb2 = 1
c = p + n - q
for i in range(n+1):
    comb = (((comb*(n+1-i))%mod)*mod_inv(i+1,mod))%mod
    if c >= i:
        print((comb-comb2)%mod)
        comb2 = (((comb2*(c-i))%mod)*mod_inv(i+1,mod))%mod
    else:
        print(comb%mod)
Problem:
Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives.  You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative.  For example, if x_1 = `10000` and u_1 = `JPY`, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = `0.10000000` and u_2 = `BTC`, the otoshidama from the second relative is 0.1 bitcoins.  If we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?

Incorrect submission (verdict: Wrong Answer):
#coding:utf-8

def main():
    N = int(input())
    money = []
    for i in range(N):
        x, u = input().split()

        if u == 'BTC':
            x = float(x) * 380000
        money.append(int(x))

    print(sum(money))


if __name__ == "__main__":
    main()

Fixed, accepted submission:
#coding:utf-8

def main():
    N = int(input())
    money = []
    for i in range(N):
        x, u = input().split()

        if u == 'BTC':
            x = float(x) * 380000
        money.append(float(x))

    moneysum = float(sum(money))
    print(moneysum)


if __name__ == "__main__":
    main()
Problem:
Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:    * 1 \leq x,y,z   * x^2 + y^2 + z^2 + xy + yz + zx = n  Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N).

Incorrect submission (verdict: Wrong Answer):
n = int(input())
r = range(1,101)
l = [0]*n

for x in r:
    for y in r:
        for z in r:
            t = x*x+y*y+z*z+y*z+z*x+x*y
            if t == n:
                l[t-1] +=1
for i in l:
    print(i)



Fixed, accepted submission:
n = int(input())
r = range(1,101)
l = [0]*n

for x in r:
    for y in r:
        for z in r:
            t = x*x+y*y+z*z+y*z+z*x+x*y
            if t <= n:
                l[t-1] +=1
for i in l:
    print(i)
Problem:
You are given an integer sequence of length N. The i-th term in the sequence is a_i. In one operation, you can select a term and either increment or decrement it by one.  At least how many operations are necessary to satisfy the following conditions?    * For every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.   * For every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
A = list(map(int, input().split()))
ans = 0
total = A[0]
if A[0] == 0:
    ans += 1
    total = -A[1] // A[1]
for i in range(1, len(A)):
    print(total, ans, A[i], total + A[i])
    if total > 0:
        if total + A[i] >= 0:
            ans += total + A[i] + 1
            print("1 ans +=", total + A[i] + 1)
            total = -1
        else:
            total += A[i]
    else:
        if total + A[i] <= 0:
            ans += 1 - (total + A[i])
            print("2 ans +=", 1 - (total + A[i]))
            total = 1
        else:
            total += A[i]
print(ans)


Fixed, accepted submission:
n = int(input())
A = list(map(int, input().split()))
ans = {True:0, False:0}
for s in [True, False]:
    sign = s
    total = 0
    for i in range(len(A)):
        if total + A[i] == 0 or sign == (total + A[i] > 0):
            ans[s] += abs(total + A[i]) + 1
            total = -1 if sign else 1
        else:
            total += A[i]
        sign = total > 0
print(min(ans.values()))
Problem:
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week.  Write a program which computes the amount of the debt in n weeks.

Incorrect submission (verdict: Wrong Answer):
import math
n = int(input())
debt = 100000
for i in range(n):
	debt = int(math.ceil((debt * 1.05 / 1000) * 1000))
print(debt)

Fixed, accepted submission:
import math
n = int(input())
debt = 100000
for i in range(n):
	debt = int(math.ceil(debt * 1.05 / 1000)) * 1000
print(debt)
Problem:
You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:    * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`.

Incorrect submission (verdict: Wrong Answer):
s = input()
s_rev = s[::-1]
while s_rev[0:1]:
    if s_rev.startswith("maerd"):
        s_rev = s_rev[5::1]
    elif s_rev.startswith("remaerd"):
        s_rev = s_rev[7::1]
    elif s_rev.startswith("esare"):
        s_rev = s_rev[5::1]
    elif s_rev.startswith("resare"):
        s_rev = s_rev[6::1]
    else:
        print("NO")
        break
if s_rev[0:1]==False:
    print("YES")

Fixed, accepted submission:
s = input()
s_rev = s[::-1]
while s_rev[0:1]:
    if s_rev.startswith("maerd"):
        s_rev = s_rev[5::1]
    elif s_rev.startswith("remaerd"):
        s_rev = s_rev[7::1]
    elif s_rev.startswith("esare"):
        s_rev = s_rev[5::1]
    elif s_rev.startswith("resare"):
        s_rev = s_rev[6::1]
    else:
        print("NO")
        break
if bool(s_rev[0:1]) == False:
    print("YES")
Problem:
Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.  Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence.  Here, the distance between two points s and t on a number line is represented by |s-t|.

Incorrect submission (verdict: Wrong Answer):
x, a, b = map(int, input().split())

print(min(abs(x-a), abs(x-b)))

Fixed, accepted submission:
x, a, b = map(int, input().split())

if abs(x-a) > abs(x-b):
    print('B')
else:
    print('A')
Problem:
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.

Incorrect submission (verdict: Wrong Answer):
while True:
    try:
        W, H, x, y = map(int, input().split())
        
        cut = (x == W // 2) + (y == H // 2)
        if cut > 0:
            area = (W * H) / 2
        else:
            area = min(x*H, y*W)
            
        print(area, 1 if cut > 1 else 0)
    except:
        break

Fixed, accepted submission:
while True:
    try:
        W, H, x, y = map(int, input().split())
        
        if (x*2 == W) and (y*2 == H):
            res = 1
        else:
            res = 0
            
        print("%.6f %d" % (W*H/2, res))
    except:
        break
Problem:
Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer.

Incorrect submission (verdict: Wrong Answer):
n=int(input())
print(int(n**(1/2)))

Fixed, accepted submission:
n=int(input())
print(int(n**(1/2))**2)
Problem:
This contest is `CODEFESTIVAL`, which can be shortened to the string `CF` by deleting some characters.  Mr. Takahashi, full of curiosity, wondered if he could obtain `CF` from other strings in the same way.  You are given a string s consisting of uppercase English letters. Determine whether the string `CF` can be obtained from the string s by deleting some characters.

Incorrect submission (verdict: Wrong Answer):
s = input()
m = 0
n = 0
a = 0
b = 0
for i in range(len(s)):
    if i == 'C':
        m += 1
        a = i
    elif i == 'F':
        n += 1
        b = i
if a < b and m > 1 and n > 1:
    print('Yes')
else:
    print('No')


Fixed, accepted submission:
string=str(input())
swich1=0
swich2=0
final_swich=0
for i in range(len(string)):
    if string[i]=='C':
        swich1=1
    elif swich1==1 and string[i]=='F':
        swich2=1
        print("Yes")
        final_swich=1
        break
if final_swich==0:
    print("No")
Problem:
Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so.

Incorrect submission (verdict: Wrong Answer):
while True:
	try:
		a,b,c = map(int, input().split())
	except:
		exit()

	if c**2 == a**2 + b**2:
		print(YES)
	else:
		print(NO)

Fixed, accepted submission:
n = int(input())
for _ in range(n):
	num = sorted(map(int, input().split()))
	print("YES" if num[2]**2 == num[1]**2 + num[0]**2 else "NO")
Problem:
Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.  The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)  Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?

Incorrect submission (verdict: Wrong Answer):
X = int(input())
b = 100
ans = 0
while b <= X:
    b += int(b*0.01)
    ans += 1
print(ans)

Fixed, accepted submission:
X = int(input())
b = 100
ans = 0
while b < X:
    b += int(b*0.01)
    ans += 1
print(ans)
Problem:
You went shopping to buy cakes and donuts with X yen (the currency of Japan).  First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop.  How much do you have left after shopping?

Incorrect submission (verdict: Wrong Answer):
x=int(input())
a=int(input())
b=int(input())
print(x-a-b)


Fixed, accepted submission:
x=int(input())
a=int(input())
b=int(input())
c=(x-a)//b
print(x-a-(b*c))
Problem:
You are given two non-negative integers L and R. We will choose two integers i and j such that L \leq i < j \leq R. Find the minimum possible value of (i \times j) \mbox{ mod } 2019.

Incorrect submission (verdict: Wrong Answer):
while True:
    try:
        L, R = map(int, input().split())
        if L%2019==0 or R%2019==0 or L<=2019<=R or R-L+1>=2019:
            print(0)
            continue
        mod = []
        for i in range(L, R+1):
            mod.append(i%2019)
            if len(mod) >= 2019:
                break
        mod.sort()
        print(mod[0]*mod[1])
    except:
        break

Fixed, accepted submission:
MOD = 2019
while True:
    try:
        L, R = map(int, input().split())
        ans = 2019*2019
        if R-L <= MOD-1:
            for i in range(L, R+1):
                for j in range(i+1, R+1):
                    ans = min(ans, i*j%MOD)
            print(ans)
        else:
            print(0)
    except:
        break
Problem:
Write a program which reads three integers, and prints them in ascending order.

Incorrect submission (verdict: Wrong Answer):
# coding: utf-8

n = list(map(int, input().split()))
n.sort()

print(n)


Fixed, accepted submission:
# coding: utf-8

n = list(map(int, input().split()))
n.sort()
n = map(str, n)

print(' '.join(n))
Problem:
We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied:    * For any two vertices painted in the same color, the distance between them is an even number.  Find a coloring of the vertices that satisfies the condition and print it. It can be proved that at least one such coloring exists under the constraints of this problem.

Incorrect submission (verdict: Wrong Answer):
import sys
sys.setrecursionlimit(10000000)
n=int(input())
s=[[]for i in range(n+1)]
g=[0]*(n+1)
h=[True]*(n+1)
for i in range(n-1):
    a,b,c=map(int,input().split())
    s[a].append([b,c])
    s[b].append([a,c])
def dfs(x):
    h[x]=False
    for i in s[x]:
        if h[i[0]]:
            g[i[0]]=g[x]+i[1]
            dfs(i[0])
dfs(1)
print(g)
for i in range(1,n+1):
    if g[i]%2==0:
        print(0)
    else:
        print(1)

Fixed, accepted submission:
import sys
sys.setrecursionlimit(10000000)
n=int(input())
s=[[]for i in range(n+1)]
g=[0]*(n+1)
h=[True]*(n+1)
for i in range(n-1):
    a,b,c=map(int,input().split())
    s[a].append([b,c])
    s[b].append([a,c])
def dfs(x):
    h[x]=False
    for i in s[x]:
        if h[i[0]]:
            g[i[0]]=g[x]+i[1]
            dfs(i[0])
dfs(1)
for i in range(1,n+1):
    if g[i]%2==0:
        print(0)
    else:
        print(1)
Problem:
Snuke is giving cookies to his three goats.  He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).  Your task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.

Incorrect submission (verdict: Wrong Answer):
A, B = map(int, input().split())
if A%3 == 0 or B%3 == 0 or (A+B)%3 == 0:
    print("possible")
else:
    print("impossible")

Fixed, accepted 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")