TnT/CodeNet4Repair huggingface dataset:
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()))
sorted_x = sorted(x)

lmid = sorted_x[n // 2 - 1]
rmid = sorted_x[n // 2]

for xi in x:
    if xi > rmid:
        print(lmid)
    else:
        print(rmid)

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

lmid = sorted_x[n // 2 - 1]
rmid = sorted_x[n // 2]

for xi in x:
    if xi <= lmid:
        print(rmid)
    else:
        print(lmid)
Problem:
You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer.

Incorrect submission (verdict: Wrong Answer):
a,b=map(int, input().split())
m=(a+b)//2
print(m+1)

Fixed, accepted submission:
a,b=map(int, input().split())
m=(a+b)//2
if (a+b)%2==1:
  print(m+1)
else:
  print(m)
Problem:
In this problem, you should process T testcases.  For each testcase, you are given four integers N, M, A, B.  Calculate \sum_{i = 0}^{N - 1} floor((A \times i + B) / M).

Incorrect submission (verdict: Time Limit Exceeded):
def solve(n,m,a,b):
    ans = 0
    lim = (a*n+b)//m
    
    for i in range(1,lim+1):
        l = (i*m-b+a-1)//a
        r = (i*m+m-b-1)//a

        ans += (min(r,n-1)-l+1)*i

    return ans

def main():
    t = int(input())
    while t>0:
        n,m,a,b = map(int, input().split(' '))
        print(solve(n,m,a,b))
        t-=1

if __name__ == "__main__":
    main()

Fixed, accepted submission:

#     ans = 0

    

#         l = (i*m-b+a-1)//a
#         r = (i*m+m-b-1)//a

#         ans += (min(r,n-1)-l+1)*i

#     return ans

def floor_sum(n, m, a, b):
    ans = 0

    # (a*i+b)//m
    
    if a>=m:
        ans += n*(n-1)*(a//m)//2
        a %= m


    
    if b>=m:
        ans += n*(b//m)
        b %= m

    yn = (a*n+b)//m

    if yn == 0:
        return ans 

    x_least = (yn * m - b) #the first x for which y(x) == yn ,'x_least' refers to the val a*x.

    l = (x_least+(a-1))//a
    r = n-1 

    return ans + (r-l+1)*yn + floor_sum(yn, a, m, (a-x_least%a)%a)
    '''
    #r+1 as we pass the element that does not belong in the range.

    '''
def main():
    t = int(input())
    while t>0:
        n,m,a,b = map(int, input().split(' '))
        # print(solve(n,m,a,b))
        print(floor_sum(n,m,a,b))
        t-=1

if __name__ == "__main__":
    main()




#left code
    # ans += (r-l+1)*yn  #if ans was not returned then this implies y(n) == y(n-1) == yn. element in window [l...r] have y(x) = yn
    # ans += floor_sum(yn, a, m, (a-x_least%a)%a)
Problem:
AtCoDeer has three cards, one red, one green and one blue.   An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card.   We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer.   Is this integer a multiple of 4?

Incorrect submission (verdict: Wrong Answer):
a, b, c = map(int, input().split())
if (100*a + 10*b + c) % 4 == 0:
    print("yes")
else:
    print("no")


Fixed, accepted submission:
a, b, c = map(int, input().split())
if (100*a + 10*b + c) % 4 == 0:
    print("YES")
else:
    print("NO")
Problem:
An elementary school student Takahashi has come to a variety store.  He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it?  Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan.

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

print('Yes') if a+b<=c else print('No')

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

print('Yes') if a+b>=c else print('No')
Problem:
You are given three strings A, B and C. Check whether they form a _word chain_.  More formally, determine whether both of the following are true:    * The last character in A and the initial character in B are the same.   * The last character in B and the initial character in C are the same.  If both are true, print `YES`. Otherwise, print `NO`.

Incorrect submission (verdict: Wrong Answer):
A, B, C = input().split()
print(['No', 'Yes'][A[-1] == B[0] and B[-1] == C[0]])

Fixed, accepted submission:
A, B, C = input().split()
print(['NO', 'YES'][A[-1] == B[0] and B[-1] == C[0]])
Problem:
You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x?

Incorrect submission (verdict: Wrong Answer):
a,b,x=map(int,input().split())
if a%x:
  print(b//x-a//x+1)
else:
  print(b//x-a//x)

Fixed, accepted submission:
a,b,x=map(int,input().split())
c=(b//x-a//x)
if a%x==0:
  print(c+1)
else:
  print(c)
Problem:
How many multiples of d are there among the integers between L and R (inclusive)?

Incorrect submission (verdict: Wrong Answer):
l, r, d = map(int,input().split())
ans = l // d - r // d
print(ans)

Fixed, accepted submission:
l, r, d = map(int,input().split())
print(r // d - (l-1)//d)
Problem:
It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.   There are N houses along _TopCoDeer street_. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses.   Find the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions.

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

ans = 0

for a_i in range(1, len(A)):
  ans += A[a_i]-A[a_i-1]
  
print(ans)

Fixed, accepted submission:
n = int(input())
A = sorted(set(map(int, input().split())))

ans = 0

for a_i in range(1, len(A)):
  ans += A[a_i]-A[a_i-1]
  
print(ans)
Problem:
There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N).  For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.  We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:    * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.  Does there exist a good set of choices? If the answer is yes, find one good set of choices.

Incorrect submission (verdict: Wrong Answer):
def yakusuu(n):
    yakusuu_list = list()
    for i in range(n):
        if n % i == 0:
            yakusuu_list.append(i)
    return yakusuu_list


def baisuu(n, max_N):
    baisuu_list = list()
    for i in range(n, max_N + 1, n):
        baisuu_list.append(i)
    return baisuu_list


N = int(input())
A = [-1] + list(map(int, input().split()))
box = [0 for _ in range(N + 1)]

for i in range(N, N // 2, -1):
    box[i] = A[i]

for i in range(N // 2, 0, -1):
    baisuu_list = baisuu(i, N)
    baisuu_xor = 0
    for b in baisuu_list:
        baisuu_xor ^= box[b]
    box[i] = baisuu_xor ^ A[i]

print(" ".join(map(str, box[1:])))


Fixed, accepted submission:
def yakusuu(n):
    yakusuu_list = list()
    for i in range(n):
        if n % i == 0:
            yakusuu_list.append(i)
    return yakusuu_list


def baisuu(n, max_N):
    baisuu_list = list()
    for i in range(n, max_N + 1, n):
        baisuu_list.append(i)
    return baisuu_list


N = int(input())
A = [-1] + list(map(int, input().split()))
box = [0 for _ in range(N + 1)]
ans = list()

for i in range(N, N // 2, -1):
    box[i] = A[i]

for i in range(N // 2, 0, -1):
    baisuu_list = baisuu(i, N)
    baisuu_xor = 0
    for b in baisuu_list:
        baisuu_xor ^= box[b]
    box[i] = baisuu_xor ^ A[i]

print(sum(box))
for i in range(1, N + 1):
    if box[i] == 1:
        ans.append(i)
print(" ".join(map(str, ans)))
Problem:
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b.

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

a = k[0]
b = k[1]

r = a % b
while r != 0:
    a = b
    b = r
    r = a % b
else:
    ans1 = b


a = k[0]
b = k[1]

v = a % b
index = 2
while v != 0:
    aa = a * index
    v = aa % b
    index = index + 1
else:
    ans2 = aa

print(ans1, ans2)

Fixed, accepted submission:
import sys

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    return int(a*b / gcd(a,b))

for s in sys.stdin:
    a, b = map(int, s.split())
    
    print(gcd(a,b), lcm(a,b))
Problem:
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.  The problem has N test cases.  For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`, `WA`, `TLE`, and `RE`, respectively.  See the Output section for the output format.

Incorrect submission (verdict: Wrong Answer):
import sys
na=0
nw=0
nt=0
nr=0
i = int(input())
for n in range(i):
    a=input()
    if a=="AC":
        na= na +1
    elif a=="WA":
        nw= nw+1
    elif a=="TLE":
        nt=nt+1
    else:
        nr=nr+1
print('AC ×',na)
print('WA ×',nw)
print('TLE ×',nt)
print('RE ×',nr)

Fixed, accepted submission:
na=0
nw=0
nt=0
nr=0
i = int(input())
for n in range(i):
    a=input()
    if a=="AC":
        na= na +1
    elif a=="WA":
        nw= nw+1
    elif a=="TLE":
        nt=nt+1
    else:
        nr=nr+1
print('AC x %d'%na)
print('WA x %d'%nw)
print('TLE x %d'%nt)
print('RE x %d'%nr)
Problem:
Write a program which reads three integers, and prints them in ascending order.

Incorrect submission (verdict: Wrong Answer):
#!/bin/usr/python

a = sorted([int(i) for i in input().split()])

for i in range(len(a)):
  print(str(a[i]), end = ' ' if i != len(a)-1 else '\b\n')

Fixed, accepted submission:
#!/bin/usr/python

a = sorted([int(i) for i in input().split()])

for i in range(len(a)):
  print(str(a[i]), end = ' ' if i != len(a)-1 else '\n')
Problem:
You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}.  Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1.

Incorrect submission (verdict: Wrong Answer):
h,w=map(int,input().split());print("#"*(w+2));
for i in range(h):print("#"+input()+"#");print("#"*(w+2))

Fixed, accepted submission:
h,w=map(int,input().split())
s,a,x="#"*(w+1),"#","#\n#"
for i in range(h):
	a+=input()+x

print("#"+s,a+s,sep="\n")
Problem:
You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_.   Here, a correct bracket sequence is defined as follows:    * `()` is a correct bracket sequence.   * If X is a correct bracket sequence, the concatenation of `(`, X and `)` in this order is also a correct bracket sequence.   * If X and Y are correct bracket sequences, the concatenation of X and Y in this order is also a correct bracket sequence.   * Every correct bracket sequence can be derived from the rules above.  Find the shortest correct bracket sequence that can be obtained. If there is more than one such sequence, find the lexicographically smallest one.

Incorrect submission (verdict: Wrong Answer):
_,s=open(0)
x=y=0
for c in s:
	if c=="(":
		x+=1
	else:
		x-=1
	y=max(y,-x)
print("("*y+s+")"*(x+y))

Fixed, accepted submission:
input()
s=input()
x=y=0
for c in s:
	if c=="(":
		x+=1
	else:
		x-=1
	y=max(y,-x)
print("("*y+s+")"*(x+y))
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):
l = input()
t = 0
for c in l:
    if c == '1': t+=1
print(c)

Fixed, accepted submission:
l = input()
t = 0
for c in l:
    if c == '1': t+=1
print(t)
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())
ans=0
for _ in range(N):
  l,r=map(int,input().split())
  ans+=(r-l+1)

Fixed, accepted submission:
N=int(input())
ans=0
for _ in range(N):
  l,r=map(int,input().split())
  ans+=(r-l+1)
print(ans)
Problem:
Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L.  She will concatenate all of the strings in some order, to produce a long string.  Among all strings that she can produce in this way, find the lexicographically smallest one.  Here, a string s=s_1s_2s_3...s_n is _lexicographically smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds:    * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i.   * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.

Incorrect submission (verdict: Wrong Answer):
n,l = map(int, input().split())
print(sorted([input() for i in range(n)]))

Fixed, accepted submission:
n,l = map(int, input().split())
list = sorted([input() for i in range(n)])
print(*list, sep='')
Problem:
We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.   According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.   Determine if he is correct.

Incorrect submission (verdict: Wrong Answer):
def ans():
    C = []
    C.append([])
    C.append(list(map(int, ('0 ' + input()).split())))
    C.append(list(map(int, ('0 ' + input()).split())))
    C.append(list(map(int, ('0 ' + input()).split())))

    A = [0] * 4
    B = [0] * 4
    A[1] = 0

    for i in range(1,4):
        B[i] = C[1][i] - A[1]

    for i in range(2, 4):
        A[i] = C[i][1] - B[1]

    for i in range(1,4):
        for j in range(1, 4):
            if C[i][j] == (A[i] + B[j]):
                pass
            else:
                return print('No')
    return print('Yes')


Fixed, accepted submission:
def ans():
    C = []
    C.append([])
    C.append(list(map(int, ('0 ' + input()).split())))
    C.append(list(map(int, ('0 ' + input()).split())))
    C.append(list(map(int, ('0 ' + input()).split())))

    A = [0] * 4
    B = [0] * 4
    A[1] = 0

    for i in range(1,4):
        B[i] = C[1][i] - A[1]

    for i in range(2, 4):
        A[i] = C[i][1] - B[1]

    for i in range(1,4):
        for j in range(1, 4):
            if C[i][j] == (A[i] + B[j]):
                pass
            else:
                return print('No')
    return print('Yes')
ans()
Problem:
There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.  You planned a trip along the axis. In this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.  However, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i. You will visit the remaining spots as planned in the order they are numbered. You will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.  For each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
A = [int(i) for i in input().split()]+[0]
S = [0]*(n+1)
current = 0
s = 0
print(A)
for i in range(n):
    S[i] = abs(A[i]-current)
    current = A[i]


S[n] = abs(0-current)
print(S)
for i in range(n):
    if i != 0:
        b = S.copy()
        b[i] = 0
        b[i+1] = 0
        print(sum(b)+abs(A[i+1]-A[i-1]))
    else:
        b = S.copy()
        b[i] = 0
        b[i+1] = 0
        print(sum(b)+abs(A[i+1]-0))  

Fixed, accepted submission:
n = int(input())
A = [0]+[int(i) for i in input().split()]+[0]
S = [0]*(n+2)
current = 0
s = 0

for i in range(len(A)):
    s += abs(A[i]-current)
    S[i] = s
    current = A[i]




for i in range(1,n+1):
    print(S[i-1]+S[-1]-S[i+1]+abs(A[i+1]-A[i-1]))
Problem:
In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets.  Write a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem.

Incorrect submission (verdict: Wrong Answer):
# -*- coding: utf-8 -*-
for c in range(100000):
    x = int(input().strip())
    if(x < 1):
        break
    print("Case {0}: {1}".format(c,x))

Fixed, accepted submission:
# -*- coding: utf-8 -*-
for c in range(1,10001):
    x = int(input().strip())
    if(x < 1):
        break
    print("Case {0}: {1}".format(c,x))
Problem:
You are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it.

Incorrect submission (verdict: Wrong Answer):
s = input()
print(s if len(s)==2 else reversed(s))

Fixed, accepted submission:
s = input()
print(s if len(s)==2 else s[::-1])
Problem:
Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied:    * Each lowercase letter of the English alphabet occurs even number of times in w.  You are given the string w. Determine if w is beautiful.

Incorrect submission (verdict: Wrong Answer):
import collections

s = input()
cnt = collections.Counter()

for i in s:
    cnt[i] += 1


if all([True if i % 2 == 0 else False for i in cnt.values()]):
    print("YES")
else:
    print("NO")
    

Fixed, accepted submission:
import collections

s = input()
cnt = collections.Counter()

for i in s:
    cnt[i] += 1


if all([True if i % 2 == 0 else False for i in cnt.values()]):
    print("Yes")
else:
    print("No")
Problem:
Sitting in a station waiting room, Joisino is gazing at her train ticket.  The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).  In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.  The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.

Incorrect submission (verdict: Wrong Answer):
s = input()
n = len(s)

ops = None
for i in range((n-1)**2):
  tmp = int(s[0])
  for j in range(0, n-1):

    if (i>>j)&1:
      tmp += int(s[j+1])
    else:
      tmp -= int(s[j+1])

  if tmp == 7:
    ops = i
    break

res = ""
for i in range(n):
  res += s[i]
  if i < n:
    if (ops>>i)&1:
      res += "+"
    else:
      res += "-"

print(res+"=7")

Fixed, accepted submission:
s = input()
n = len(s)

ops = None
for i in range((n-1)**2):
  tmp = int(s[0])
  for j in range(0, n-1):

    if (i>>j)&1:
      tmp += int(s[j+1])
    else:
      tmp -= int(s[j+1])

  if tmp == 7:
    ops = i
    break

res = ""
for i in range(n):
  res += s[i]
  if i < n-1:
    if (ops>>i)&1:
      res += "+"
    else:
      res += "-"

print(res+"=7")
Problem:
An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.  Given an integer N, determine whether it is a Harshad number.

Incorrect submission (verdict: Wrong Answer):
X = input();print('Yes' if sum(map(int,X))/int(X)==0 else 'No')


Fixed, accepted submission:
X = input();print('Yes' if (int(X)%sum(map(int,X)))==0 else 'No')
Problem:
You are given a string S consisting of `0` and `1`. Find the maximum integer K not greater than |S| such that we can turn all the characters of S into `0` by repeating the following operation some number of times.    * Choose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\geq K must be satisfied). For each integer i such that l\leq i\leq r, do the following: if S_i is `0`, replace it with `1`; if S_i is `1`, replace it with `0`.

Incorrect submission (verdict: Wrong Answer):
#from numpy import*
#from scipy import*
from collections import* 
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* 
from heapq import* 
from math import factorial
from copy import deepcopy
import sys

sys.setrecursionlimit(10**6)


def main():
    bound=0
    ans=[]
    s=input()
    if all(i=="0" for i in s):
        print(0)
        exit()
    for k,v in groupby(s):
        bound+=len(list(v))
#        ans.append()
        ans.append(max(bound,len(s)-bound))
    print(min(ans))
    
    
if __name__ == '__main__':
    main()

Fixed, accepted submission:
from itertools import*;s=input();print(min(max(len(s)-i,i)for i in accumulate(len(list(v))for k,v in groupby(s))))
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):
S = input()
cnt = 0
for i in range(3):
  if S[i]==S[i+1]:
    cnt += 1
    if cnt>=3:
      print("Yes")
      exit()
  else:
    cnt = 0
print("No")

Fixed, accepted submission:
S = input()
cnt = 1
for i in range(3):
  if S[i]==S[i+1]:
    cnt += 1
    if cnt>=3:
      print("Yes")
      exit()
  else:
    cnt = 1
print("No")
Problem:
AtCoder Mart sells 1000000 of each of the six items below:    * Riceballs, priced at 100 yen (the currency of Japan) each   * Sandwiches, priced at 101 yen each   * Cookies, priced at 102 yen each   * Cakes, priced at 103 yen each   * Candies, priced at 104 yen each   * Computers, priced at 105 yen each  Takahashi wants to buy some of them that cost exactly X yen in total. Determine whether this is possible.   (Ignore consumption tax.)

Incorrect submission (verdict: Wrong Answer):
X = int(input())
flag=False

a=X//100
b=X%100

for i in range(0,a+1):
  for j in range(0,a-i):
    for k in range(0,a-i-j):
      for l in range(0,a-i-j-k):
        for m in range(0,a-i-j-k-l):
          if i+2*j+3*k+4*l+5*m == b:
            #print(i,j,k,l,m)
            print(1)
            flag=True
            break
            
if flag==False:
  print(0)

Fixed, accepted submission:
X = int(input())
flag=False

if X>=2100:
  print(1)
  flag=True
else:
  for i in range(0,22):
    for j in range(0,22-i):
      for k in range(0,22-i-j):
        for l in range(0,22-i-j-k):
          for m in range(0,22-i-j-k-l):
            for n in range(0,22-i-j-k-l-m):
              if 100*i+101*j+102*k+103*l+104*m+105*n==X:
                if flag==False:
                  print(1)
                  flag=True
                  break
              
if flag==False:
  print(0)
Problem:
Takahashi is distributing N balls to K persons.  If each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?

Incorrect submission (verdict: Wrong Answer):
N, K = map(int, input().split(" "))

print([0, 1][N%K==0])

Fixed, accepted submission:
N, K = map(int, input().split(" "))

if K == 1:
    print(0)
else:
    print(N-K)