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

Fixed submission:
a,b,c=map(int,input().split())
if a==b and b==c and c==a:
  print("No")
elif a!=b and b!=c and c!=a:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a==b and b=c and c=a:
  print("No")
elif a!=b and b!=c and c!=a:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a==b and b=c and c=a:
  print(No)
elif a!=b and b!=c and c!=a:
  print(No)
else:
  print(Yes)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a==b and b=c and c=a
  print(No)
elif a!=b and b!=c and c!=a
  print(No)
else:
  print(Yes)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a==b and b=c
  print(No)
elif a!=b and b!=c
  print(No)
else:
  print(Yes)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a=b=c:
  print(No)
elif a!=b!=C:
  print(No)
else:
  print(Yes)

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
if a=b=c:
  print(No)
else:
  print(Yes)

Buggy submission (verdict: Runtime Error):
a,b,c=input()split()
if a=b=c:
  print(No)
else:
  print(Yes)
Problem p02897 (python)

Fixed submission:
S=int(input())
if S%2==0:
    print(0.5)
else:
    print((S//2+1)/S)

Buggy submission (verdict: Runtime Error):
S=int(input())
if S/2=0.5:
    print(0.5)
else:
    prrint(3/S)
Problem p02987 (python)

Fixed submission:
s=input()
if len(set(s))==2 and s.count(s[0])==2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s=input()
if len(set(s))=2 and count(s[0])=2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s=input()
if len(set(s))=2 and count(s[0])=2:
       print('Yes')
else:
       print('No')

Buggy submission (verdict: Runtime Error):
s=input()
if len(set((s))=2 and count(s[0])=2:
       print('Yes')
else:
       print('No')
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
S=s[0:k-1]+s[k-1].lower()+s[k:]
print(S)

Buggy submission (verdict: Runtime Error):
n=int,input()
k=int,input()
s=input()
S=s[0:k-1]+s[k-1].lower()+s[k:]
print(S)

Buggy submission (verdict: Runtime Error):
n=int,input()
k=int,input()
s=input()
S='s[0:k-1]' + 's[k-1].lower()' + 's[k:]'
print(S)

Buggy submission (verdict: Runtime Error):
n=int,input()
k=int,input()
s=input()
S='s[0:k-1]'+'s[k-1].lower()'+'s[k:]'
print(S)

Buggy submission (verdict: Runtime Error):
n=int,input(4)
k=int,input(3)
s=input(CABA)
S=s[0:k-1]+s[k-1].lower()+s[k:]
print(S)

Buggy submission (verdict: Runtime Error):
n=int,input(4)
k=int,input(3)
s=input(CABA)
S='s[0:k-2]'+'s[k-1].swapcase()'+'s[k:]'
print(S)

Buggy submission (verdict: Runtime Error):
n=int,input()
k=int,input()
s=input()
S='s[0:k-2]'+'s[k-1].swapcase()'+'s[k:n]'
print(S)
Problem p02577 (python)

Fixed submission:
n = int(input())
if (n % 9 == 0):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# import sys
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')


def isDivBy9(n):

    if (n == 0 or n == 9):
        return True
    if (n < 9):
        return False

    return isDivBy9((int)(n >> 3) - (int)(n & 7))


n = int(input())
if (isDivBy9(n)):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')


def isDivBy9(n):

    if (n == 0 or n == 9):
        return True
    if (n < 9):
        return False

    return isDivBy9((int)(n >> 3) - (int)(n & 7))


n = int(input())
if (isDivBy9(n)):
    print("Yes")
else:
    print("No")
Problem p02793 (python)

Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
n=int(input())
mod=1000000007
s=[int(i) for i in input().split()]
ans=1
for i in s:
    ans*=i//gcd(ans,i)
print(sum(ans//i for i in s)%mod)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if(b == 0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b):
    return (a*b)//gcd(a,b)
n = int(input())
mod = 1e9 + 7
a = [int(i) for i in input().split()]
ans = 1    
for i in a:
    ans = lcm(ans,i)

print(sum(ans//i for i in a)%mod)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if(b == 0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b):
    return (a*b)//gcd(a,b)
n = int(input())
mod = 1e9 + 7
a = [int(i) for i in input().split()]
ans = 1    
for i in a:
    ans = lcm(ans,i)

print("%d" %(sum(ans//i for i in a)%mod))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if(b == 0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b):
    return (a*b)//gcd(a,b)

n = int(input())
b = [1]*(n+5)
mod = 1e9 + 7
a = [int(i) for i in input().split()]
    
for i in range(n):
    for j in range(i+1,n):
        x = a[i]
        y = a[j]
        m = gcd(x,y)
        x //= m
        y //= m
        b[i] = lcm(b[i],y)
        b[j] = lcm(b[j],x)
sum = 0
for i in range(n):
    sum += b[i]
print(int(sum%mod))

Buggy submission (verdict: Runtime Error):
import math

def lcm(a,b):
    return (a*b)//math.gcd(a,b)

n = int(input())
b = [1]*(n+5)
mod = 1e9 + 7
a = [int(i) for i in input().split()]
    
for i in range(n):
    for j in range(i+1,n):
        x = a[i]
        y = a[j]
        m = math.gcd(x,y)
        x //= m
        y //= m
        b[i] = lcm(b[i],y)
        b[j] = lcm(b[j],x)
sum = 0
for i in range(n):
    sum += b[i]
print(int(sum%mod))

Buggy submission (verdict: Runtime Error):
import math

def lcm(a,b):
    return (a*b)//math.gcd(a,b)

n = int(input())
b = [1]*(n+5)
mod = 1e9 + 7
a = [int(i) for i in input().split()]
    
for i in range(n):
    for j in range(i+1,n):
        x = a[i]
        y = a[j]
        m = math.gcd(x,y)
        x //= m
        y //= m
        b[i] = lcm(b[i],y)
        b[j] = lcm(b[j],x)
sum = 0
for i in range(n):
    sum += b[i]
print("%d" %(sum%mod))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
b = [1]*(n+1)
mod = 1e9 + 7
a = [int(i) for i in input().split()]
    
for i in range(n):
    for j in range(i+1,n):
        x = a[i];y = a[j];m = math.gcd(x,y);
        x //= m;y //= m;
        b[i] = int(b[i]*y)//int(math.gcd(b[i],y))
        b[j] = int(b[j]*x)//int(math.gcd(b[j],x))
sum = 0
for i in range(n):
    sum += b[i]
print("%d" %(sum%mod))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
b = [1]*(n+1)
mod = 1e9 + 7
a = [int(i) for i in input().split()]
    
for i in range(n):
    for j in range(i+1,n):
        x = a[i];y = a[j];m = math.gcd(x,y);
        x //= m;y //= m;
        b[i] = int(b[i]*y)//int(math.gcd(b[i],y))
        b[j] = int(b[j]*x)//int(math.gcd(b[j],x))
sum = 0
for i in range(n):
    sum += b[i]
print("%d" %(sum%mod))
Problem p02578 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
ans = 0
high = 0
for i in range (1,N):
    if  A[i-1] > high:
        high = A[i-1]
    if high > A[i]:
        ans += high - A[i]
print (ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans = 0
for i in range (1,N):
    if  A[i-1] > high:
        high = A[i-1]
    if high > A[i-1]:
        ans += high - A[i]
print (ans)
Problem p02595 (python)

Fixed submission:
N,D=map(int,input().split())
X=[]
Y=[]
for i in range(N):
    x,y=map(int,input().split())
    X.append(x)
    Y.append(y)
ans=0    
for i in range(N):
    if X[i]**2+Y[i]**2 <= D**2:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
,D=map(int,input().split())
X=[]
Y=[]
for i in range(N):
    x,y=map(int,input().split())
    X.append(x)
    Y.append(y)
ans=0    
for i in range(N):
    if X[i]**2+Y[i]**2 <= D**2:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N,D=map(int,input().split())
X=[]
Y=[]
for i in range(N):
    x,y=map(int,input().split())
    X.append(x)
    Y.append(y)
ans=0    
for i in range(N):
    if X[i]**2+Y[i]**2 <= D**2:
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N,D=map(int,input().split())
X=[]
Y=[]
for i in range(N):
    x,y=map(int,input().split())
    X.append(x)
    Y.append(y)
ans=0    
for i in range(N):
    if X[i]**2+Y[i]**2 <= D**2
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N,D=map(int,input().split())
X=[]
Y=[]
for i in range(N)
    x,y=map(int,input().split())
    X.append(x)
    Y.append(y)
ans=0    
for i in range(N)
    if X[i]**2+Y[i]**2 <= D**2
    ans += 1

print(ans)
Problem p02711 (python)

Fixed submission:
N = list(input())

for i in N:
    if i == "7":
        print("Yes")
        break
    
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = list(input())

for i in N:
    if i == "7"
        print("Yes")
        break
    
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = list(input())

for i in N：
    if i == "7"
        print("Yes")
        break
    
else：
    print("No")

Buggy submission (verdict: Runtime Error):
N = list(input())

for i in N：
    if i == "7"
      print("Yes")
      break
    
else：
    print("No")

Buggy submission (verdict: Runtime Error):
N = list(input())

for i in N：
    if i == "7"
     print("Yes")
     break
    
else：
    print("No")

Buggy submission (verdict: Runtime Error):
N = list(input())

for i in N：
    if i == "7"
    print("Yes")
    break
    
else：
    print("No")
Problem p02835 (python)

Fixed submission:
A = list(map(int,input().split()))
a = sum(A)
if a >= 22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split())
a = sum(A)
if a >= 22:
    print("bust")
else:
    print("win")
Problem p02777 (python)

Fixed submission:
tmp = input().split()
S = tmp[0]
T = tmp[1]
i = list(map(int, input().split()))
A = i[0]
B = i[1]
U = input()

if S == U:
  print(str(A-1) + " " + str(B))
else:
  print(str(A) + " " + str(B-1))

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())

count = 0
i = 1
while i <= N:
  s = str(i)
  if K == (len(s) - s.count("0")):
    count = count + 1
  i = i + 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())

count = 0
i = 1
while i <= N:
  s = str(i)
  if K == len(s) - s.count("0"):
    count = count + 1
  i = i + 1

print(count)
Problem p02793 (python)

Fixed submission:
from fractions import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
A = list(map(int, input().split()))
answer = 0
mod = 10**9 + 7
LCM = lcm(*A)

for i in range(N):
    answer += LCM // A[i]

print(answer % mod)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
A = list(map(int, input().split()))
answer = 0
mod = 10**9 + 7
# print(*A)
# print(lcm(*A))
LCM = lcm(*A)

for i in range(N):
    answer += LCM // A[i]

print(answer % mod)
Problem p02831 (python)

Fixed submission:
A, B = map(int, input().split())
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x,y)

print(lcm(A, B))
Problem p02951 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a - b < c:
    ans = c - (a - b)
else:
    ans = 0

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
sv = h[n-1]
ok = True
for i in range(n-1):
    if h[i] - sv - 1 >= 2:
        ok = False

if ok:
    print('Yes')
else:
    print('No')
Problem p03038 (python)

Fixed submission:
n, m = map(int, input().split())
A = sorted(map(int, input().split()))
info = []
for _ in range(m):
    b, c = map(int, input().split())
    info.append([b, c])
info.sort(key=lambda x: x[1], reverse=True)
# print(info, A)
index = 0
for i in range(m):
    if index == n:
        break
    for j in range(info[i][0]):
        if index == n:
            break
        if A[index] < info[i][1]:
            A[index] = info[i][1]
            index += 1
        else:
            break

ans = sum(A)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = sorted(map(int, input().split()))
info = []
for _ in range(m):
    b, c = map(int, input().split())
    info.append([b, c])
info.sort(key=lambda x: x[1], reverse=True)
# print(info, A)
index = 0
for i in range(m):
    if index == n:
        break
    for j in range(info[i][0]):
        if A[index] < info[i][1]:
            A[index] = info[i][1]
            index += 1
        else:
            break

ans = sum(A)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = sorted(map(int, input().split()))
info = []
for _ in range(m):
    b, c = map(int, input().split())
    info.append([b, c])
info.sort(key=lambda x: x[1], reverse=True)
# print(info, A)
index = 0
for i in range(m):
    for j in range(info[i][0]):
        if A[index] < info[i][1]:
            A[index] = info[i][1]
            index += 1
            if index == n-1:
                break
        else:
            break

ans = sum(A)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = sorted(map(int, input().split()))
info = []
for _ in range(m):
    b, c = map(int, input().split())
    info.append([b, c])
info.sort(key=lambda x: x[1], reverse=True)
# print(info, A)
index = 0
for i in range(m):
    for j in range(info[i][0]):
        if A[index] < info[i][1]:
            A[index] = info[i][1]
            index += 1
            if index == n:
                break
        else:
            break

ans = sum(A)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = sorted(map(int, input().split()))
info = []
for _ in range(m):
    b, c = map(int, input().split())
    info.append([b, c])
info.sort(key=lambda x: x[1], reverse=True)
# print(info, A)
index = 0
for i in range(m):
    for j in range(info[i][0]):
        if A[index] <= info[i][1]:
            A[index] = info[i][1]
            index += 1
        else:
            break

ans = sum(A)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = sorted(map(int, input().split()))
info = []
for _ in range(m):
    b, c = map(int, input().split())
    info.append([b, c])
info.sort(key=lambda x: x[1], reverse=True)
# print(info, A)
index = 0
for i in range(m):
    for j in range(info[i][0]):
        if A[index] < info[i][1]:
            A[index] = info[i][1]
            index += 1
        else:
            break

ans = sum(A)
print(ans)
Problem p03774 (python)

Fixed submission:
N, M = map(int, input().split())
a = [0] * N
b = [0] * N
c = [0] * M
d = [0] * M
for i in range(N):
    a[i], b[i] = map(int, input().split())
for i in range(M):
    c[i], d[i] = map(int, input().split())

for i in range(N):
    d1 = float('inf')
    for j in range(M):
        d2 = abs(a[i] - c[j]) + abs(b[i] - d[j])
        if d1 > d2:
            d1 = d2
            check = j + 1
    print(check)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
stud = []
poit = []
for i in range(n):
    a, b = map(int, input().split())
    stud.append([a, b])
for i in range(n):
    c, d = map(int, input().split())
    poit.append([c, d])
for a, b in stud:
    # print(a, b)
    dist = float('inf')
    for i, info in enumerate(poit):
        c = info[0]
        d = info[1]
        mdist = abs(a-c) + abs(b-d)
        if dist > mdist:
            dist = mdist
            ans = i+1
    print(ans)
    # print(i, info)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
stud = []
poit = []
for i in range(n):
    a, b = map(int, input().split())
    stud.append([a, b])
for i in range(n):
    c, d = map(int, input().split())
    poit.append([c, d])
for a, b in stud:
    # print(a, b)
    dist = float('inf')
    ans = -1
    for i, info in enumerate(poit):
        c = info[0]
        d = info[1]
        mdist = abs(a-c) + abs(b-d)
        if dist > mdist:
            dist = mdist
            ans = i+1
    print(ans)
    # print(i, info)
Problem p04005 (python)

Fixed submission:
A, B, C = map(int, input().split())
if (A * B * C) % 2 == 0:
    ans = 0
    print(ans)
else:
    ans = float('inf')
    V = A*B*C
    AB = A*B
    BC = B*C
    CA = C*A
    ans = min(ans, abs((A//2)*BC - ((A//2) + 1)*BC))
    ans = min(ans, abs((B//2)*CA - ((B//2) + 1)*CA))
    ans = min(ans, abs((C//2)*AB - ((C//2) + 1)*AB))
    print(ans)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if (A * B * C) % 2 == 0:
    ans = 0
else:
    V = A*B*C
    AB = A*B
    BC = B*C
    CA = C*A
    ans = min(V-(A//2)*BC, V-((A//2) + 1)*BC)
    ans = min(V-(B//2)*CA, V-((B//2) + 1)*CA)
    ans = min(V-(C//2)*AB, V-((C//2) + 1)*AB)
print(V - 2*ans)
Problem p02594 (python)

Fixed submission:
x = int(input())

if x >= 30:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
c = input()

wcount = c.count('R')
count = 0

for i in range(n):
    if c[i] == 'W' and i<= wcount:
        count += 1
print(count)
Problem p02595 (python)

Fixed submission:
c = list(map(int, input().split()))
n, d = c[0], c[1]

xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]

count = 0

for l in range(n):
    a = x[l]*x[l] + y[l]*y[l]
    if a <= d*d:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
c = list(map(int, input().split()))[0]
n, d = c[0], c[0]

xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]

count = 0

for i in range(n-1):
    a = x[i]*x[i] + y[i]*y[i]
    if a <= d*d:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))[0]
d = list(map(int, input().split()))[1]

xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]

count = 0

for i in range(n):
    if x[i]*x[i] + y[i]*y[i] <= d*d:
        count += 1
print(count)
Problem p02596 (python)

Fixed submission:
s = 7
a = int(input())

for i in range(10**6):
    if s%a == 0:
        print(i+1)
        exit()
    s = (s*10+7) % a
print(-1)

Buggy submission (verdict: Runtime Error):
a = 7
b = int(inout())

list = [7]
for i in range(b):
    list.append(list[-1]*10 +7)

for l in range(len(list)):
    if list[l] % b == 0:
        print(l+1)
        exit()
Problem p03013 (python)

Fixed submission:
n, m = list(map(int, input().split()))
a = []
for i in range(m):
    a.append(int(input()))

mod = 1000000007

memo = [-1]*(n+1)
memo[0] = 0

for k in range(m):
    memo[a[k]] = 0

for i in range(1, n+1):
    if memo[i] != -1:
        pass 
    elif i <= 2:
        memo[i] = memo[i-1] + 1
    else:
        memo[i] = memo[i-1] + memo[i-2]
print(memo[-1]%mod)

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
a = []
for i in range(m):
	a.append(int(input())
mod = 1000000007

memo = [0]*(n+1)
memo[0] = 1


for i in range(1, n+1):
    memo[i] = memo[i-1] + memo[i-2]
    if i in a:
        memo[i] = 0

print(memo[-1]%mod)
Problem p03038 (python)

Fixed submission:
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
list = [list(map(int, input().split())) for x in range(m)]
list.sort(key=lambda x: x[1], reverse=True) # １番の要素で降順ソート

app_count = 0
for i in list:
    a += [i[1]]*i[0]
    app_count += i[0]
    if app_count>n:
        break

a.sort(reverse=True)

print(sum(a[:n]))

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
list = [list(map(int, input().split())) for x in range(m)]
list.sort(list, key=lambda x: x[1], reverse=True) # １番の要素で降順ソート

app_count = 0
for i in list:
    a += [i[1]]*i[0]
    app_count += i[0]
    if app_count>n:
        break

a.sort(reverse=True)

print(a[:n])
Problem p03042 (python)

Fixed submission:
s = input()

b = int(s[:2])
a = int(s[2:])

def yorm(i):
    flag = 'none'
    if 0<i<=12:
        flag = 'MM'
    elif i<100:
        flag = 'YY'
    return flag

bf = yorm(b)
af = yorm(a)
   
ans = bf+af
if len(ans) != 4:
    ans = 'NA'
if ans == 'MMMM':
    ans = 'AMBIGUOUS'
if ans == 'YYYY':
    ans = 'NA'
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()

b = int(s[:2])
a = int(s[2:])

print(b)
print(a)

def yorm(i):
    flag = 'none'
    if 0<i<12:
        flag = 'MM'
    elif i<100:
        flag = 'YY'
    return flag
   
ans = bf+af
if len(ans) != 4:
    ans = 'NA'
if ans == 'MMMM':
    ans = 'AMBIGUOUS'
if ans == 'YYYY':
    ans = 'NA'
print(ans)
Problem p02873 (python)

Fixed submission:
S = input()
N = len(S)+1
k = 0
score= 0
countup = 0
countdown = 0
final = None
for i in range(N-1):
  if S[i] == "<":
    if final == ">":
      score += int(countdown*(countdown-1)/2)
      if countup <= countdown:
        score += countdown - countup
      countup = 0
    countdown = 0
    final = "<"
    countup += 1
    score += countup
  elif S[i] == ">":
    final = ">"
    countdown += 1
if final == ">":
  score += int(countdown*(countdown-1)/2)
  if countup <= countdown:
    score += countdown - countup
print(score)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)+1
array = [0]*(N)
for i in range(N-1):
  if S[i] == "<":
    array[i+1] = array[i] + 1
    k = i+1
#  elif array[i] > array[i+1]:
#    k = i+1
  else:
    for j in reversed(range(k,i+1)):
      if array[j]<=array[j+1]:
        array[j] += 1
#print(array)
print(sum(array))
Problem p02897 (python)

Fixed submission:
n = int(input())
print( int((n+1)/2)/n )

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
n = int(input())
A = input().split()
for i in range(n):
  A[i] = [int(A[i]),i+1]
A = sorted(A, key=itemgetter(0))
for a in A[:-1]:
  print(a[1],end=" ")
print(A[-1][1])

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
n = int(input())
A = input().split()
for i in range(n):
  A[i] = [int(A[i]),i+1]
A = sorted(A, key=itemgetter(0))
for a in A:
  print(a[1],end=" ")
Problem p02571 (python)

Fixed submission:
S = input()
T = input()
maxs = 0
for x in range(len(S)-len(T)+1):
    count=0
    for y in range(len(T)):
        if T[y] == S[x+y]:
            count += 1
        maxs = max(count,maxs) 

print(len(T)-maxs)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
maxs = 0
for x in range(len(S)-len(T)+1):
    for y in range(len(T)):
        if T[y] == S[x+y]:
            count += 1
        else:
            count = 0
        maxs = max(count,maxs) 

print(len(T)-maxs)
Problem p02623 (python)

Fixed submission:
if __name__ == "__main__":
    (N,M,K) = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    a = [0]
    b = [0]
    for i in range(N):
        a.append(a[i]+A[i])
    for i in range(M):
        b.append(b[i]+B[i])

    ans, j = 0, M
    for i in range(N+1):
        if a[i] >K:
            break
        while b[j] > K-a[i]:
            j -= 1
        ans = max(ans, i+j)
    print(ans)

Buggy submission (verdict: Runtime Error):
def dokusyo(A,B,i,j,K,total):
    a = A[i]
    b = B[j]
    if total+min(a,b)>K:
        return 0
    if a<b:
        return 1+dokusyo(A,B,i+1,j,K,total+a)
    elif a>b:
        return 1+dokusyo(A,B,i,j+1,K,total+b)
    else:
        return 1+max(dokusyo(A,B,i+1,j,K,total+a),dokusyo(A,B,i,j+1,K,total+b))
       


if __name__ == "__main__":
    (N,M,K) = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    A.append(10**10)
    B.append(10**10)
    i=0
    j=0
    total = 0
    print(dokusyo(A,B,i,j,K,total))