TnT/CodeNet4Repair huggingface dataset:
Problem:
There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise.

Incorrect submission (verdict: Wrong Answer):
a, b, c = map(int, input().split())
if a >= b:
    tmp = a
    b = a
    a = tmp

if a<=c and c<=b:
    print("yes")
else:
    print("no")

Fixed, accepted submission:

a, b, c = map(int, input().split())
if a >= b:
    tmp = b
    b = a
    a = tmp

if a<=c and c<=b:
    print("Yes")
else:
    print("No")
Problem:
Write a program to simulate rolling a dice, which can be constructed by the following net.                  As shown in the figures, each face is identified by a different label from 1 to 6.  Write a program which reads integers assigned to each face identified by the label and a sequence of commands to roll the dice, and prints the integer on the top face. At the initial state, the dice is located as shown in the above figures.

Incorrect submission (verdict: Wrong Answer):
x=[int(i)for i in input().split()]
y=[[int(0)for i in range(4)]for i in range(3)]
y[0][1]=x[0]
y[1][1]=x[1]
y[1][2]=x[2]
y[1][0]=x[3]
y[1][3]=x[4]
y[2][1]=x[5]
m=[i for i in input()]
z=y.copy()
for i in range(len(m)):
    if m[i]=='N':
        y[0][1],z[1][1]=z[1][1],y[0][1]
        y[1][1],z[2][1]=z[2][1],y[1][1]
        y[1][3],z[0][1]=z[0][1],y[1][3]
        y[2][1],z[1][3]=z[1][3],y[2][1]
        z=y.copy()
    elif m[i]=='S':
        y[0][1],z[1][3]=z[1][3],y[0][1]
        y[1][1],z[0][1]=z[0][1],y[1][1]
        y[1][3],z[2][1]=z[2][1],y[1][3]
        y[2][1],z[1][1]=z[1][1],y[2][1]
        z=y.copy()
    elif m[i]=='W':
        y[0][1],z[1][2]=z[1][2],y[0][1]
        y[1][0],z[0][1]=z[0][1],y[1][0]
        y[1][2],z[2][1]=z[2][1],y[1][2]
        y[2][1],z[1][0]=z[1][0],y[2][1]
        z=y.copy()
    else:
        y[0][1],z[1][0]=z[1][0],y[0][1]
        y[1][0],z[2][1]=z[2][1],y[1][0]
        y[1][2],z[0][1]=z[0][1],y[1][2]
        y[2][1],z[1][2]=z[1][2],y[2][1]
        z=y.copy()
print(y[0][1])

Fixed, accepted submission:
x=[int(i)for i in input().split()]
y=[[int(0)for i in range(4)]for i in range(3)]
y[0][1]=x[0]
y[1][1]=x[1]
y[1][2]=x[2]
y[1][0]=x[3]
y[1][3]=x[4]
y[2][1]=x[5]
m=[i for i in input()]
for i in range(len(m)):
    if m[i]=='N':
        y[0][1],y[1][1]=y[1][1],y[0][1]
        y[1][1],y[2][1]=y[2][1],y[1][1]
        y[2][1],y[1][3]=y[1][3],y[2][1]
    elif m[i]=='S':
        y[0][1],y[1][3]=y[1][3],y[0][1]
        y[1][3],y[2][1]=y[2][1],y[1][3]
        y[2][1],y[1][1]=y[1][1],y[2][1]
    elif m[i]=='W':
        y[0][1],y[1][2]=y[1][2],y[0][1]
        y[1][2],y[2][1]=y[2][1],y[1][2]
        y[2][1],y[1][0]=y[1][0],y[2][1]
    elif m[i]=='E':
        y[0][1],y[1][0]=y[1][0],y[0][1]
        y[1][0],y[2][1]=y[2][1],y[1][0]
        y[2][1],y[1][2]=y[1][2],y[2][1]
print(y[0][1])
Problem:
How many ways are there to choose two distinct positive integers totaling N, disregarding the order?

Incorrect submission (verdict: Wrong Answer):
n = int(input())
count = 0
seen = []
for i in range(1,n+1):
  if i!=(n-i):
    if i and n-i not in seen:
      seen.append(i)
      seen.append(n-i)
      count += 1
print(count)
      
  
  

Fixed, accepted submission:
n = int(input())
print((n-1)//2)
Problem:
A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.  Write a program which reads a list of _N_ integers and prints the number of prime numbers in the list.

Incorrect submission (verdict: Wrong Answer):

import math
def check(B,i):
    sum=0 
    for j in range(len(B)):
        if B[j]%10 in [1,2,4,5,6,8]:
            del B[j]
            check(B,i)
        if B[j]%i==0:
            sum+=1
            del B[j]
    return sum
def Prime_Numbers(A):
    mx=max(A)
    sum=0
    if 2 in A:
        sum+=1
    if 3 in A:
        sum+=1
    if 5 in A:
        sum+=1
    if 7 in A:
        sum+=1
    i=10
    while i <= math.sqrt(mx):
        mx=max[A]
        sum+=check(A,i)
        i+=1
    print("A={}".format(A))
    return sum

if __name__ == "__main__":
    A=[]
    n=int(input())
    for i in range(n):
        A.append(int(input()))
    print(Prime_Numbers(A))


Fixed, accepted submission:

import math

def Prime_Numbers_Check(x):
    i=2
    flag=True
    while i <= math.sqrt(x):
        if x%i==0:
            flag=False  
            break
        i+=1
    return flag
def Prime_Numbers_Count(A):
    sum=0
    for i in A:
        if Prime_Numbers_Check(i):
            sum+=1
    return sum

if __name__ == "__main__":
    A=[]
    n=int(input())
    for i in range(n):
        A.append(int(input()))
    sum=Prime_Numbers_Count(A)
    print(sum)
Problem:
You are given an H × W grid.   The squares in the grid are described by H strings, S_1,...,S_H.   The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).   `.` stands for an empty square, and `#` stands for a square containing a bomb.  Dolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.   (Below, we will simply say "adjacent" for this meaning. For each square, there are at most eight adjacent squares.)   He decides to replace each `.` in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.  Print the strings after the process.

Incorrect submission (verdict: Wrong Answer):
h, w = map(int, input().split())
s = [list(input()) for _ in range(0, h)]

dx = [1, 0, -1, 0, 1, -1, -1, -1]
dy = [0, 1, 0, -1, 1, 1, -1, -1]

for i in range(0, h):
    for j in range(0, w):
        if s[i][j] != '.':
            continue

        cnt = 0
        for k in range(0, 8):
            ni = i + dy[k]
            nj = j + dx[k]

            if not (ni < 0 or h <= ni) and not (nj < 0 or w <= nj) and s[ni][nj] == '#':
                cnt += 1

        s[i][j] = str(cnt)

[print(s[ii]) for ii in range(0, h)]


Fixed, accepted submission:
h, w = map(int, input().split())
s = [list(input()) for _ in range(0, h)]

dx = [1, 1, 1, 0, 0, -1, -1, -1]
dy = [1, 0, -1, 1, -1, 1, 0, -1]

for i in range(0, h):
    for j in range(0, w):
        if s[i][j] != '.':
            continue

        cnt = 0
        for k in range(0, 8):
            ni = i + dy[k]
            nj = j + dx[k]

            if not (ni < 0 or h <= ni) and not (nj < 0 or w <= nj) and s[ni][nj] == '#':
                cnt += 1

        s[i][j] = str(cnt)

[print(''.join(s[ii])) for ii in range(0, h)]
Problem:
Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i.  Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.

Incorrect submission (verdict: Wrong Answer):
s = list(input()) 
s.count("1")


Fixed, accepted submission:
a = input()
print(a.count('1'))
Problem:
Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b.  Determine whether the arrangement of the poles is beautiful.

Incorrect submission (verdict: Wrong Answer):
#58

a, b, c = map(int, input().rstrip().split())

if b-a == c-a:
    print("YES")
else:
    print("NO")

Fixed, accepted submission:
#58

a, b, c = map(int, input().rstrip().split())

if b-a == c-b:
    print("YES")
else:
    print("NO")
Problem:
Write a program which calculates the cube of a given integer x.

Incorrect submission (verdict: Wrong Answer):
x = 3
print(x**3)

Fixed, accepted submission:
x = int(input())
print(x**3)
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):


a = list(input())

if a[0] == a[1] and a[1] == a[2] or a[1] == a[2] and a[2] == a[3]:
    print("YES")
else:
    print("NO")





Fixed, accepted submission:


a = list(input())

if a[0] == a[1] and a[1] == a[2] or a[1] == a[2] and a[2] == a[3]:
    print("Yes")
else:
    print("No")
Problem:
You are given a string S consisting of lowercase English letters. We will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom.

Incorrect submission (verdict: Wrong Answer):
s=input()
w=int(input())
ans=s[0]
for i in range(1,len(s)//w):
	ans+=s[i*w]
print(ans)

Fixed, accepted submission:
s=input()
w=int(input())
print(s[0::w])
Problem:
Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them.  He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2).  Find the minimum total cost to achieve his objective.

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

#print(a) 

x_min = round(sum(a) / 3 )

cost = sum([(x_min - i) * (x_min - i) for i in a])

print(cost)

Fixed, accepted submission:
n = int(input())
a = input()
a = list(map(int, a.split()))

#print(a) 

x_min = round(sum(a) / n )

cost = sum([(x_min - i) * (x_min - i) for i in a])

print(cost)
Problem:
We have an H \times W grid whose squares are painted black or white. The square at the i-th row from the top and the j-th column from the left is denoted as (i, j).   Snuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square (1, 1). The player repeatedly moves Kenus up, down, left or right by one square. The game is completed when Kenus reaches square (H, W) passing only white squares.   Before Snuke starts the game, he can change the color of some of the white squares to black. However, he cannot change the color of square (1, 1) and (H, W). Also, changes of color must all be carried out before the beginning of the game.   When the game is completed, Snuke's score will be the number of times he changed the color of a square before the beginning of the game. Find the maximum possible score that Snuke can achieve, or print -1 if the game cannot be completed, that is, Kenus can never reach square (H, W) regardless of how Snuke changes the color of the squares.  The color of the squares are given to you as characters s_{i, j}. If square (i, j) is initially painted by white, s_{i, j} is `.`; if square (i, j) is initially painted by black, s_{i, j} is `#`.

Incorrect submission (verdict: Wrong Answer):
from collections import deque
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]

dx = [-1, 1, 0, 0]
dy = [ 0, 0,-1, 1]

q = deque([(0, 0, 0)])
used = {(0, 0)}
res = None

while q:
    i, j, cost = q.popleft()
    if i == w - 1 and j == h - 1:
        res = cost
        break
    for k in range(4):
        if not (0 <= i + dx[k] < w):
            continue
        if not (0 <= j + dy[k] < h):
            continue

        if s[j + dy[k]][i + dx[k]] == '#':
            continue
        if (i + dx[k], j + dy[k]) in used:
            continue

        used.add((i + dx[k], j + dy[k]))
        q.append((i + dx[k], j + dy[k], cost + 1))

if res:
    ans = h * w - cost - 1
    for j in range(h):
        print(s[j][:].count('#'))
        ans -= s[j][:].count('#')
    print(ans)
else:
    print(-1)

Fixed, accepted submission:
from collections import deque
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]

dx = [-1, 1, 0, 0]
dy = [ 0, 0,-1, 1]

q = deque([(0, 0, 0)])
used = {(0, 0)}
res = None

while q:
    i, j, cost = q.popleft()
    if i == w - 1 and j == h - 1:
        res = cost
        break
    for k in range(4):
        if not (0 <= i + dx[k] < w):
            continue
        if not (0 <= j + dy[k] < h):
            continue

        if s[j + dy[k]][i + dx[k]] == '#':
            continue
        if (i + dx[k], j + dy[k]) in used:
            continue

        used.add((i + dx[k], j + dy[k]))
        q.append((i + dx[k], j + dy[k], cost + 1))

if res:
    ans = h * w - cost - 1
    for j in range(h):
        ans -= s[j][:].count('#')
    print(ans)
else:
    print(-1)
Problem:
You are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N. Determine if we can repeat the following operation zero or more times so that the sequences a and b become equal.  Operation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two actions **simultaneously** :    * Add 2 to a_i.   * Add 1 to b_j.

Incorrect submission (verdict: Wrong Answer):
N=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]

total_do=sum(a)-sum(b)
must_do_a=0
must_do_b=0

for i in range(N):
	dist=a[i]-b[i]
	if dist<0:
		dist=-dist
		must_do_a+=int(dist/2)
		if dist%2!=0:
			must_do_b+=1
	elif dist>0:
		must_do_b+=dist

if must_do_a>=must_do_b:
	print("YES")
else:
	print("NO")



Fixed, accepted submission:
N=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]

can = sum(b)-sum(a)
actA,actB = 0,0
for i in range(N):
    diff = b[i]-a[i]
    if diff==0:continue
    if diff>0:
        actA+=(diff+1)//2
        actB+=diff%2
    else:
        actB+=(-diff)
leftA = can-actA
leftB = can-actB
print("Yes" if leftA>=0 and leftA*2==leftB else "No")
Problem:
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.  The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.  One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.  If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.    * X < Z \leq Y   * x_1, x_2, ..., x_N < Z   * y_1, y_2, ..., y_M \geq Z  Determine if war will break out.

Incorrect submission (verdict: Wrong Answer):
l = input().split()


N = int(l[0])
M = int(l[1])
X = int(l[2])
Y = int(l[3])

if X < -100:
    X = -100
elif X > 100:
    X = 100

if Y < -100:
    Y = -100
elif Y > 100:
    Y = 100


lx = input().split()
ly = input().split()

lx = [int(z) for z in lx]
ly = [int(z) for z in ly]

lx = sorted(lx)


ly = sorted(ly)

flag = True


if int(ly[0]) - int(lx[N-1]) >= 1:
    for z in range(int(lx[N-1]) + 1, int(ly[0]) + 1):
        if z > X and z <= Y:
            flag = True
        else:
            flag = False
            break
else:
    flag = False

if flag:
    print("No war")
else:
    print("War")


Fixed, accepted submission:
l = input().split()


N = int(l[0])
M = int(l[1])
X = int(l[2])
Y = int(l[3])

"""
if X < -100:
    X = -100
elif X > 100:
    X = 100

if Y < -100:
    Y = -100
elif Y > 100:
    Y = 100
"""

lx = input().split()
ly = input().split()

lx = [int(z) for z in lx]
ly = [int(z) for z in ly]

lx = sorted(lx)


ly = sorted(ly)

flag = True


if int(ly[0]) - int(lx[N-1]) >= 1:
    for z in range(int(lx[N-1]) + 1, int(ly[0]) + 1):

        if z > X and z <= Y:
            flag = False
            break


if flag:
    print("War")
else:
    print("No War")
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 = input()
if (N[0] == N[1] and N[1] == N[2]) or (N[1] == N[2] and N[2] == N[3]):
    print("true")
else:
    print("false")

Fixed, accepted submission:
N = input()
if (N[0] == N[1] and N[1] == N[2]) or (N[1] == N[2] and N[2] == N[3]):
    print("Yes")
else:
    print("No")
Problem:
You are given two integers A and B. Find the largest value among A+B, A-B and A \times B.

Incorrect submission (verdict: Wrong Answer):
A,B=list(map(int, input().split()))
max(A+B, A-B, A*B)

Fixed, accepted submission:
A,B=list(map(int, input().split()))
print(max(A+B, A-B, A*B))
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):
n = int(input())
x = list(map(int, input().split()))

sort_x = sorted(x)
l = sort_x[n//2 - 1]
r = sort_x[n//2]

for xi in x:
  print(l if xi <= l else r)



Fixed, accepted submission:
n = int(input())
x = list(map(int, input().split()))

sort_x = sorted(x)
l = sort_x[n//2 - 1]
r = sort_x[n//2]

for xi in x:
  print(r if xi <= l else l)
Problem:
There are N computers and N sockets in a one-dimensional world. The coordinate of the i-th computer is a_i, and the coordinate of the i-th socket is b_i. It is guaranteed that these 2N coordinates are pairwise distinct.  Snuke wants to connect each computer to a socket using a cable. Each socket can be connected to only one computer.  In how many ways can he minimize the total length of the cables? Compute the answer modulo 10^9+7.

Incorrect submission (verdict: Wrong Answer):
import sys
import numpy as np

read = sys.stdin.read

N, *ab = map(int, read().split())
mod = 10 ** 9 + 7
a = np.array(ab[:N], np.int64)
b = np.array(ab[N:], np.int64)

a.sort()
b.sort()
idx = np.searchsorted(b, a)
print(0)


Fixed, accepted submission:
import sys
from operator import itemgetter

read = sys.stdin.read

N, *ab = map(int, read().split())
mod = 10 ** 9 + 7
ab = list(zip(ab, [0] * N + [1] * N))
ab.sort(key=itemgetter(0))

remain_pc = 0
remain_power = 0
answer = 1

for x, p in ab:
    if p == 0:
        if remain_power == 0:
            remain_pc += 1
            continue
        answer *= remain_power
        remain_power -= 1
    else:
        if remain_pc == 0:
            remain_power += 1
            continue
        answer *= remain_pc
        remain_pc -= 1
    answer %= mod

print(answer)
Problem:
Write a program which reads a $n \times m$ matrix $A$ and a $m \times l$ matrix $B$, and prints their product, a $n \times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula:  \\[ c_{ij} = \sum_{k=1}^m a_{ik}b_{kj} \\]  where $a_{ij}$, $b_{ij}$ and $c_{ij}$ are elements of $A$, $B$ and $C$ respectively.

Incorrect submission (verdict: Wrong Answer):
n, m, l = map(int, input().split()) # n = 3, c = 2, l = 3

a_matrix = [list(map(int, input().split())) for row in range(n)] # [[1, 2], [0, 3], [4, 5]]
b_matrix = [list(map(int, input().split())) for row in range(m)] # [[1, 2, 1], [0, 3, 2]]

result_matrix = [[0 for x in range(l)] for y in range(n)] # [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
print(result_matrix)
for i in range(n):
	for j in range(l):
		for k in range(m):
			result_matrix[i][j] += a_matrix[i][k] * b_matrix[k][j]

for i in range(n):
	print(' '.join(map(str, result_matrix[i])))

Fixed, accepted submission:
n, m, l = map(int, input().split()) # n = 3, c = 2, l = 3

a_matrix = [list(map(int, input().split())) for row in range(n)] # [[1, 2], [0, 3], [4, 5]]
b_matrix = [list(map(int, input().split())) for row in range(m)] # [[1, 2, 1], [0, 3, 2]]

result_matrix = [[0 for x in range(l)] for y in range(n)] # [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in range(n):
	for j in range(l):
		for k in range(m):
			result_matrix[i][j] += a_matrix[i][k] * b_matrix[k][j]

for i in range(n):
	print(' '.join(map(str, result_matrix[i])))
Problem:
Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.  To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

Incorrect submission (verdict: Wrong Answer):
a = input().split()
print('Yes' if a.count('5') == 2 and a.count('7') == 1 else 'No') 

Fixed, accepted submission:
a = input()
print('YES' if a.count('5') == 2 and a.count('7') == 1 else 'NO')
Problem:
Given is an integer sequence D_1,...,D_N of N elements. Find the number, modulo 998244353, of trees with N vertices numbered 1 to N that satisfy the following condition:    * For every integer i from 1 to N, the distance between Vertex 1 and Vertex i is D_i.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
d = [int(i) for i in input().split()]
a = [0] * n
for i in d:
    a[i] += 1
if d[0] != 0:
    print(0)
else:
    j = 1
    for i in range(n - 1):
        if a[i] == 0:
            break
        j *= a[i] ** a[i + 1]
        j %= 998244353
    print(a)
    print(j)

Fixed, accepted submission:
n = int(input())
d = [int(i) for i in input().split()]
a = [0] * n
k = 0
for i in d:
    a[i] += 1
    k=max(k,i)
if d[0] != 0:
    print(0)
elif a[0] != 1:
    print(0)
else:
    j = 1
    for i in range(k):
        j *= a[i] ** a[i + 1]
        j %= 998244353
    print(j)
Problem:
E869120 has A 1-yen coins and infinitely many 500-yen coins.   Determine if he can pay exactly N yen using only these coins.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
a = int(input())
if n % 500 <= a:
  print("YES")
else:
  print("NO")

Fixed, accepted submission:
n = int(input())
a = int(input())
if n % 500 <= a:
  print("Yes")
else:
  print("No")
Problem:
There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs.  Determine if it is possible that there are exactly X cats among these A + B animals.

Incorrect submission (verdict: Wrong Answer):
A,B,X = map(int,input().split())
if A <= X <= A+B :
  print("Yes")
else :
  print("No")

Fixed, accepted submission:
A,B,X = map(int,input().split())
if A <= X <= A+B :
  print("YES")
else :
  print("NO")
Problem:
You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when we cut the string at the optimal position.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
S = input()
ans = 0
for i in range(1,N):
    x = set(S[:i]) and set(S[i:])
    ans = max(ans,len(x))
print(ans)

Fixed, accepted submission:
N = int(input())
S = input()
ans = 0
for i in range(1,N):
    x = set(S[:i]) & set(S[i:])
    ans = max(ans,len(x))
print(ans)
Problem:
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?

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

Fixed, accepted submission:
N = int(input())
print(N * (N + 1)//2)