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

Fixed submission:
def manhattan_distance(p, q) -> int:
    return abs(p[0] - q[0]) + abs(p[1] - q[1])


N, M = map(int, input().split())
students = [tuple(map(int, input().split())) for _ in range(N)]
checkpoints = [tuple(map(int, input().split())) for _ in range(M)]

for student in students:
    p = min([(manhattan_distance(student, checkpoint), idx) for idx, checkpoint in enumerate(checkpoints, start=1)])
    print(p[1])

Buggy submission (verdict: Runtime Error):
from typing import Tuple, List


def manhattan_distance(p: Tuple[int, int], q: Tuple[int, int]) -> int:
    return abs(p[0] - q[0]) + abs(p[1] - q[1])


N, M = map(int, input().split())
students: List[Tuple[int, int]] = [tuple(map(int, input().split())) for _ in range(N)]
checkpoints: List[Tuple[int, int]] = [tuple(map(int, input().split())) for _ in range(M)]

for student in students:
    p = min([(manhattan_distance(student, checkpoint), idx) for idx, checkpoint in enumerate(checkpoints, start=1)])
    print(p[1])
Problem p02627 (python)

Fixed submission:
x = input()
if 'A' <= x <= 'Z':
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
x = intput()
if 'A' <= x <= 'Z':
  print("A")
else:
  print("a")
Problem p02771 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
list_n = list(map(int, input().split()))
flag = 0
for i in range(N):
  if list_n[i] % 2 == 0:
    if (list_n[i] % 3 != 0) and (list_n[i] % 5 != 0):
      print('DENIED')
      flag = 1
      break
    else:
      continue
if flag == 0:
  print('APPROVED')
Problem p02629 (python)

Fixed submission:
"""
問題の解釈
長さがlであるような文字列の中で辞書順でk番目のものを求めよ

26進表記における位の値の求め方
1. 変数xをk-1で初期化し、xが0となるまで以下の操作を繰り返す
2. xを26で割った商がq、余りがrであるとする。この操作がi回目に実行された時のrがk-1の下からi番目の桁である。xをqで置き換える
"""
ALPHABET = "abcdefghijklmnopqrstuvwxyz"

n = int(input())

# 長さの判定
# 26 **11 > 10*15より
ll = 0
for l in range(1, 12):
    ll += 26**l
    if ll >= n:
        break

ans = []
for li in range(1, l+1):
    r = n % 26
    q = n // 26
    if r == 0:
        q -= 1
    ans.append(r)
    n = q

answer = ""
for s in ans[::-1]:
    answer += ALPHABET[s-1] 
print(answer)

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

keta_now = 0
res_num = []

MAP = {
    1:"a",
    2:"b",
    3:"c",
    4:"d",
    5:"e",
    6:"f",
    7:"g",
    8:"h",
    9:"i",
    10:"j",
    11:"k",
    12:"l",
    13:"m",
    14:"n",
    15:"o",
    16:"p",
    17:"q",
    18:"r",
    19:"s",
    20:"t",
    21:"u",
    22:"v",
    23:"w",
    24:"x",
    25:"y",
    26:"z",
}

while True:
    keta_now += 1
    if n < sum([26**k for k in range(keta_now+1)]):
        
        for i in range(keta_now, 0, -1):
            for al in range(26, 0, -1):
                if i == 1:
                    res_num.append(n)
                    break
                if n >= (26**(i-1) * al):
                    res_num.append(al)
                    n -= (26**(i-1) * al)
                    break
            
        break           
print("".join([MAP[n] for n in res_num]))

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

import math
# 桁判定
keta_now = 0
res_num = []

MAP = {
    1:"a",
    2:"b",
    3:"c",
    4:"d",
    5:"e",
    6:"f",
    7:"g",
    8:"h",
    9:"i",
    10:"j",
    11:"k",
    12:"l",
    13:"m",
    14:"n",
    15:"o",
    16:"p",
    17:"q",
    18:"r",
    19:"s",
    20:"t",
    21:"u",
    22:"v",
    23:"w",
    24:"x",
    25:"y",
    26:"z",
}

while True:
    keta_now += 1
    # if n < (26**keta_now + 26**(keta_now-1)):
    if n < sum([26**k for k in range(keta_now+1)]):
        # 26より大きく702以下
        
        # 最大桁iのうち、i**1からi**26(a to z)でnより小さく最大のものを26_iとする
        # n - 26_i
        # (i-1)**1から(i-1)**26でn -26_iより小さく最大のもの
        # 繰り返してiが0の時に終了
        for i in range(keta_now, 0, -1):
            for al in range(26, 0, -1):
                if i == 1:
                    res_num.append(n)
                    break
                if n >= (26**(i-1) * al):
                    res_num.append(al)
                    n -= (26**(i-1) * al)
                    break
            
        break           
print("".join([MAP[n] for n in res_num]))
Problem p02712 (python)

Fixed submission:
x = int(input())
ans = 0
for i in range(x+1):
    if (i%3 != 0) and (i%5 != 0):
      ans += i

print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
ans = 0
for i in range(x+1):
    if (i%3 != 0) and (i%5 != 0):
      a += i

print(a)
Problem p02695 (python)

Fixed submission:
#!/usr/bin/env python3
n, m, q  = map(int, input().split())
abcd  = [tuple(map(int, input().split())) for i in range(q)]

ans = 0

def check(A):
    global ans
    max_ = 0

    # 点数計算
    for (a, b, c, d) in abcd:
        if A[b-1] - A[a-1] == c:
            max_ += d

    # 最大値更新
    ans = max(ans, max_)

def suretu(A=[], st=1):
    # 再帰的に数字を1つずつ足してって数列生成
    for i in range(st, m+1):
        if len(A) == n: # 数列完成
            check(A)
            return
        else:
            suretu(A + [i], i)

    return ans

print(suretu())

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
n, m, q  = map(int, input().split())
abcd  = [tuple(map(int, input().split())) for i in range(q)]

ans = 0

def check(A):
    global ans
    max_ = 0

    # 点数計算
    for (a, b, c, d) in abcd:
        if A[b-1] - A[a-1] == c:
            max_ += d

    # 最大値更新
    ans = max(ans, max_)

def suretu(A=[], st=1):
    # 再帰的に数字を1つずつ足してって数列生成
    for i in range(st, 11):
        if len(A) == m: # 数列完成
            check(A)
            return
        else:
            suretu(A + [i], i)

    return ans

print(suretu())
Problem p02712 (python)

Fixed submission:
n = int(input())

sum_ = 0
for i in range(1, n+1):
  if i%15 !=0 and i%3 !=0 and i%5 !=0:
    sum_ += i
    
print(sum_)

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

sum_ = 0
for i in range(1, n+1):
  if i%15 !=0:
    sum += i
    
print(sum_)

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

sum_ = 0
for i in range(1, n+1):
  if n%15 !=0:
    sum += i
    
print(sum_)
Problem p02754 (python)

Fixed submission:
#!/usr/bin/env python3
#  = input()
#a  = int(input())
n, a, b = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

if a == 0:
  print(0)
elif n < (a + b):
  print(min(n, a))
else:
  nab = n // (a + b)
  ans = nab * a
  mod = n % (nab * (a + b))
  ans += min(mod, a)
  print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
#  = input()
#a  = int(input())
n, a, b = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

if a == 0:
  print(0)
else:
  nab = n // (a + b)
  ans = nab * a
  mod = n % (nab * (a + b))
  ans += min(mod, a)
  print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
#  = input()
#a  = int(input())
n, a, b = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

ans = n // a
if (n // (a + b)) % 2 == 1:
    ans += ans % n
print(ans)
Problem p02879 (python)

Fixed submission:
import collections
import numpy as np
 
# = input()
# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
#
 
A, B = map(int, input().split())
 
if 1 <= A <= 9 and 1 <= B <= 9:
  print(A * B)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
import collections
import numpy as np

# = input()
# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
#

A, B = map(int, input().split())

if 1 <= A <= 9 and 1 <= B <= 9:
  print(A * B)
  else:
    print(-1)
Problem p02891 (python)

Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
import re
 
s = input()
k = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
c = collections.Counter(s)

def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける
    """
    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))  # カンマを取ると n 個ちょうどになる
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]

ans = 0

chains = list(nchars(s, 2))

if len(c) == 1:
    print(len(s) * k // 2)
else:
    #print(chains)
    #print(len(chains[0]), len(chains[-1]), k)
    for r in chains:
        ans += len(r) // 2

    if chains and chains[0] == chains[-1]:
        print(ans * k + (k - 1 if chains[0] == chains[-1] else 0))
    else:
        print(ans * k)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
import re
 
s = input()
k = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
c = collections.Counter(s)

def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける
    """
    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))  # カンマを取ると n 個ちょうどになる
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]

ans = 0

chains = list(nchars(s, 2))

if len(c) == 1:
    print(len(s) * k // 2)
else:
    #print(chains)
    #print(len(chains[0]), len(chains[-1]), k)
    for r in chains:
        ans += len(r) // 2

    print(ans * k + (k - 1 if chains[0] == chains[-1] else 0))
Problem p02897 (python)

Fixed submission:
N = int(input())

odd = 0
for i in range(N):
  if i % 2 == 0:
  	odd += 1

print(odd / N)

Buggy submission (verdict: Runtime Error):
import math 

A, B = map(int, input().split())

def sieve_of_eratosthenes(n): 
    candidate = [i for i in range(2, n+1)] 
    prime = []
    limit = math.sqrt(n) + 1 

    while True:
        p = min(candidate) 
        if limit <= p:
            prime.extend(candidate) 
            break
        prime.append(p) 

        candidate = [i for i in candidate if i % p != 0]

    return prime

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    
    return list(set(table))
  
ma = max(A, B)
mi = min(A, B)

yakusu = [d for d in divisor(mi) if ma % d == 0]

yakumax = max(yakusu)
if yakumax == 1:
	prime = [1]
elif yakumax == 2:
  prime = [1, 2]
else:
  prime = sieve_of_eratosthenes(500)
  prime.append(1)

c = 0
for y in yakusu:
  if y in prime:
    c += 1

if A == B:
  print(1)
else:
  print (c)

Buggy submission (verdict: Runtime Error):
import math 

A, B = map(int, input().split())

def sieve_of_eratosthenes(n): 
    candidate = [i for i in range(2, n+1)] 
    prime = []
    limit = math.sqrt(n) + 1 

    while True:
        p = min(candidate) 
        if limit <= p:
            prime.extend(candidate) 
            break
        prime.append(p) 

        candidate = [i for i in candidate if i % p != 0]

    return prime

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    
    return list(set(table))
  
ma = max(A, B)
mi = min(A, B)

yakusu = [d for d in divisor(mi) if ma % d == 0]

yakumax = max(yakusu)
if yakumax == 1:
	prime = [1]
elif yakumax == 2:
  prime = [1, 2]
else:
  prime = sieve_of_eratosthenes(yakumax)
  prime.append(1)

c = 0
for y in yakusu:
  if y in prime:
    c += 1
    
print (c)
Problem p03242 (python)

Fixed submission:
intput_ = list(input())
output = ""
for s_ in intput_:
  if s_ == '1':
    output += "9"
  elif s_ == '9':
    output += "1"
  else:
    output += s_

print(output)

Buggy submission (verdict: Runtime Error):
n = int(input())
vlist = list(map(int, input().split(" ")))

head = vlist[::2]
foll = vlist[1::2]

import collections
ch = collections.Counter(head).most_common()
cf = collections.Counter(foll).most_common()

h_ = ch[0]
f_ = cf[0]

if h_[0] == f_[0]:
    if h_[1] > f_[1]:
        if len(cf) != 1:
            f_ = cf[1]
        else:
            f_ = (-1.1, 0)
    else:
        if len(ch) != 1:
            h_ = ch[1]
        else:
            h_ = (-1.1, 0)
elif h_[1] == f_[1]:
    if h_[0] == vlist[0]:
        f_ = (-1.1, 0)
    else:
        h_ = (-1.1, 0)

count = 0
for i in range(len(vlist)):
    if i % 2 == 0 and vlist[i] != h_[0]:
        count += 1
    if i % 2 == 1 and vlist[i] != f_[0]:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
vlist = list(map(int, input().split(" ")))

head = vlist[::2]
foll = vlist[1::2]

import collections
ch = collections.Counter(head).most_common()
cf = collections.Counter(foll).most_common()

h_ = ch[0]
f_ = cf[0]

if h_[0] == f_[0]:
    #if h_[1] == f_[1]:
    #    if h_[0] == vlist[0]:
    #        f_ = (-1.1, 0)
    #    else:
    #        h_ = (-1.1, 0)
    if h_[1] > f_[1]:
        if len(cf) != 1:
            f_ = cf[1]
        else:
            f_ = (-1.1, 0)
    else:
        if len(ch) != 1:
            h_ = ch[1]
        else:
            h_ = (-1.1, 0)

count = 0
for i in range(len(vlist)):
    if i % 2 == 0 and vlist[i] != h_[0]:
        count += 1
    if i % 2 == 1 and vlist[i] != f_[0]:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
vlist = list(map(int, input().split(" ")))

import collections
c = collections.Counter(vlist)

head = c.most_common()[0][0]
if c.most_common()[0][1] == n:
    foll = -1
else:
    foll = c.most_common()[1][0]


for i in range(len(vlist)):
    if vlist[i] == head:
        break
    if vlist[i] == foll:
        head, foll == foll, head
        break

count = 0
for i in range(len(vlist)):
    if i % 2 == 0 and vlist[i] != head:
        count += 1
    if i % 2 == 1 and vlist[i] != foll:
        count += 1

print(count)
Problem p03107 (python)

Fixed submission:
S = list(input())

num_1 = S.count("1")
num_0 = S.count("0")

print(len(S) - abs(num_1-num_0))

Buggy submission (verdict: Runtime Error):
import copy
S = list(input())

flag = True
total = len(S)

S_ = S

while flag:
  S = S_
  S_ = copy.copy(S)
  j = 0
  carsor = 0
  while carsor < len(S)-1:
    if S[carsor] != S[carsor+1]:
      del S_[j]
      del S_[j]
      j -= 2
      carsor += 1
    j += 1
    carsor += 1
  if carsor == j:
    flag = False
      
print(total - len(S))
Problem p03137 (python)

Fixed submission:
N, M = map(int, input().split(" "))
X = list(map(int, input().split(" ")))
X.sort()
total = X[-1]-X[0]
dif = [X[i+1] - X[i] for i in range(len(X)-1)]
dif.sort()
Y = [0 for i in range(N-1)]
for i in range(N-1):
  try:
    Y[i] = dif.pop()
  except:
    Y[i]=0
print(total-sum(Y))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split(" "))
X = list(map(int, input().split(" ")))
X.sort()
total = X[-1]-X[0]
dif = [X[i+1] - X[i] for i in range(len(X)-1)]
dif.sort()
Y = [0 for i in range(N-1)]
for i in range(N-1):
	Y[i] = dif.pop()
print(total-sum(Y))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split(" "))
X = list(map(int, input().split(" ")))
X.sort()
total = X[-1]-X[0]
dif = [X[i+1] - X[i] for i in range(len(X)-1)]
dif.sort()
print(dif)
Y = [0 for i in range(N-1)]
for i in range(N-1):
	Y[i] = dif.pop()
print(total-sum(Y))
Problem p02682 (python)

Fixed submission:
a, b, c, k = map(int, input().split())
if a > k:
    print(k)
elif k >= a and b > k-a:
    print(a)
else:
    d = k - (a+b)
    print(a-d)

Buggy submission (verdict: Runtime Error):
import numpy as np
a, b, c, k = map(int, input().split())
aa = [1]*a
bb = [0]*b
cc = [-1]*c
nn = aa + bb + cc
su = 0
for i in range(0,k):
    su = su + nn[i]
print(su)
Problem p02693 (python)

Fixed submission:
K = int(input())
a, b = map(int, input().split())
for i in range(1,1000):
    c = K*i
    if a <= c <= b:
        print("OK")
        test = 1
        break
    else:
        test = 0
        continue
if test == 0:
    print("NG")

Buggy submission (verdict: Runtime Error):
a,b,n = map(int, input().split())
def f(x):
    return int(a*x/b) - a*int(x/b)
Max = f(min(b-1,n))
print(Max)
Problem p02723 (python)

Fixed submission:
# problem A
X = list(input())
if (X[2] == X[3]) and (X[4] == X[5]):
        print('Yes')
else:
        print('No')

Buggy submission (verdict: Runtime Error):
# problem A
X = list(input())
if (X[2] == X[3]) and (X[4] == X[5]):
        print('Yes')
else:
        prin('No')
Problem p02754 (python)

Fixed submission:
# problem B
N,A,B = map(int,input().split())

syou = N // (A+B)
amari = N % (A+B)

ans = syou * A 
if amari >= A:
    ans += A
else:
    ans += amari
    
print(ans)

Buggy submission (verdict: Runtime Error):
# problem B
N,A,B = map(int,input().split())

test_1 = 'b'*A + 'r'*B
test_2 = test_1 * N 
test_3 = test_2[:N]

summ = 0
for i in test_3:
    if i == 'b':
        summ += 1
    else:
        pass
print(summ)
Problem p03326 (python)

Fixed submission:
a, b = map(int, input().split())
sum0 = []
sum1 = []
sum2 = []
sum3 = []
sum4 = []
sum5 = []
sum6 = []
sum7 = []

for i in range(a):
  x, y, z = map(int, input().split())
  sum0.append((x + y + z))
  sum1.append((x + y - z))
  sum2.append((x - y + z))
  sum3.append((x - y - z))
  sum4.append((- x + y + z))
  sum5.append((- x + y - z))
  sum6.append((- x - y + z))
  sum7.append((- x - y - z))

sum0 = sum(sorted(sum0, reverse=True)[:b])
sum1 = sum(sorted(sum1, reverse=True)[:b])
sum2 = sum(sorted(sum2, reverse=True)[:b])
sum3 = sum(sorted(sum3, reverse=True)[:b])
sum4 = sum(sorted(sum4, reverse=True)[:b])
sum5 = sum(sorted(sum5, reverse=True)[:b])
sum6 = sum(sorted(sum6, reverse=True)[:b])
sum7 = sum(sorted(sum7, reverse=True)[:b])


print(max([sum0,sum1,sum2,sum3,sum4,sum5,sum6,sum7]))

Buggy submission (verdict: Runtime Error):
10 5
10 -80 21
23 8 38
-94 28 11
-26 -2 18
-69 72 79
-26 -86 -54
-72 -50 59
21 65 -32
40 -94 87
-62 18 82
Problem p02831 (python)

Fixed submission:
import fractions

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

k = fractions.gcd(a, b)

ans = (a * b) // k

print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

k = math.gcd(a, b)

ans = (a * b) // k

print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

k = math.gcd(a, b)

ans = a * b // k

print(ans)
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
dp=[0]*(n+1)
for i in range(m):
    dp[n-a[i]]=-1
if dp[1]==0:
    dp[1]=1
else:
    dp[1]=0
if n>1:
    if dp[2]==0:
        dp[2]=dp[1]+1
    else:
        dp[2]=0
if n>=3:
    for i in range(3,n+1):
        if dp[i]==0:
            dp[i]=dp[i-1]+dp[i-2]
        else:
            dp[i]=0
print(dp[n]%1000000007)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
dp=[0]*(n+1)
for i in range(m):
    dp[n-a[i]]=-1
if dp[1]==0:
    dp[1]=1
else:
    dp[1]=0
if dp[2]==0:
    dp[2]=dp[1]+1
else:
    dp[2]=0
if n>=3:
    for i in range(3,n+1):
        if dp[i]==0:
            dp[i]=dp[i-1]+dp[i-2]
        else:
            dp[i]=0
print(dp[n]%1000000007)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
dp=[0]*(n+1)
for i in range(m):
    dp[n-a[i]]=-1
if dp[1]==0:
    dp[1]=1
else:
    dp[1]=0
if dp[2]==0:
    dp[2]=dp[1]+1
else:
    dp[2]=0
if n>=3:
    for i in range(3,n+1):
        if dp[i]==0:
            dp[i]=dp[i-1]+dp[i-2]
        else:
            dp[i]=0
            continue
print(dp[n]%1000000007)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
dp=[0]*(n+1)
ans=0
if n-1 not in a:
    dp[1]=1
if n-2 not in a:
    dp[2]=dp[1]+1
if n>=3:
    for i in range(3,n+1):
        if n-i not in a:
            dp[i]=dp[i-1]+dp[i-2]
        else:
            continue
print(dp[n]%1000000007)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[0]*(n+1)
ans=0
if n-1 not in a:
    dp[1]=1
if n-2 not in a:
    dp[2]=dp[1]+1
for i in range(3,n+1):
    if n-i not in a:
        dp[i]=dp[i-1]+dp[i-2]
    else:
        continue
print(dp[n]%1000000007)
Problem p03042 (python)

Fixed submission:
s=list(map(int,input()))
a=10*s[0]+s[1]
b=10*s[2]+s[3]
counta=0
countb=0
'''month'''
if 0<a<=12:
    counta+=1
if 0<b<=12:
    countb+=1
'''year'''
if a==0 or a>=13:
    counta+=5
if b==0 or b>=13:
    countb+=5
j=counta+countb
if j==2:
    print('AMBIGUOUS')
elif j==6 and counta==5:
    print('YYMM')
elif j==6 and countb==5:
    print('MMYY')
else:
    print('NA')

Buggy submission (verdict: Runtime Error):
s=list(map(int,input()))
a=10*s[0]+s[1]
b=10*s[2]+s[3]
if a<=12 and b<=12:
    print('AMBIGUOUS')
elif a+b==0:
    print('NA')
elif a>12 and b>12:
    print('NA')
elif a==0,b>12:
    print('NA')
elif b==0.a>12:
    print('NA')
elif 0<a<=12 and 12<b:
    print('MMYY')
elif 0<b<=12 and 12<a:
    print('YYMM')
elif 0<a<=12 and 0==b:
    print('MMYY')
elif 0<b<=12 and 1==a:
    print('YYMM')
Problem p02689 (python)

Fixed submission:
import numpy as np
N, M = map(int, input().split(' '))

height = np.array(list(map(int, input().split(' '))))
height_all = np.array(list(height))

for i in range(M):
  a, b = map(int, input().split(' '))
  #print(a, b, height[a - 1], height[b - 1])
  if height[a - 1] > height[b - 1]:
    height_all[b - 1] = 0
  
  elif height[a - 1] == height[b - 1]:
    height_all[a - 1] = 0
    height_all[b - 1] = 0
    
  else:
    height_all[a - 1] = 0
    
  #print(height_all)
  
print(len(np.nonzero(height_all)[0]))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split(' '))

height = list(map(int, input().split(' ')))
height_all = height

for i range(M):
  a, b = map(int, input().split(' '))
  if height[a - 1] == height[b - 1]:
    height_all.remove(height[a - 1])
  elif height[a - 1] > height[b - 1]:
    height_all.remove(height[b - 1])
  else:
    height_all.remove(height[a - 1])
print(len(height_all))
Problem p02699 (python)

Fixed submission:
s,w = map(int,input().split())
if w>=s:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
import itertools
s = input()
s_li = list(s)
lee = len(s_li)

count = 0
keta = list(itertools.combinations([i for i in range(lee)], 2))
for k in keta:
    lk = list(k)
    #print(s_li[lk[0]:lk[1]+1])
    if int(''.join(s_li[lk[0]:lk[1]+1]))%2019 == 0:
        count += 1
print(count)
Problem p02711 (python)

Fixed submission:
n = list(input())
if '7' in n:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
s = list(input())
a_li = []
b_li = []
c_li = []
for i,ss in enumerate(s):
    if ss == 'R':
        a_li.append(i)
    elif ss == 'G':
        b_li.append(i)
    else:
        c_li.append(i)
if len(a_li) == 0 or len(b_li)== 0 or len(c_li) == 0:
    print(0)
    sys.exit()
all_count = 0
for a in a_li:
    for b in b_li:
        tmp = len(c_li)
        lili = []
        if (2*b - a)  in c_li:
            lili.append(2*b - a)
        if (2*a - b)  in c_li:
            lili.append(2*a - b)
        if (a + b)% 2 == 0 and (a + b)//2   in c_li:
            lili.append((a + b)//2)
        tmp -= len(set(lili))
        all_count += tmp
print(all_count)
Problem p02777 (python)

Fixed submission:
s,t = input().split()
a,b = map(int,input().split())
u = input()
if s == u:
    print(a-1,b)
else:
    print(a,b-1)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
lis = list(map(int,input().split()))
tmp = 0
for i,l in enumerate(lis):
    if i+k <= len(lis)-1:
        #print(i,k)
        if lis[i+k]>l:
            tmp = i+1
#print(tmp)
#print(new_lis)
#print(lis[tmp:tmp+k])
print(sum([(ll+1)/2 for ll in  lis[tmp:tmp+k+1]]))
#print((sum(lis[tmp:tmp+k])+k)/2)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
lis = list(map(int,input().split()))
new_lis = [(l+1)/2 for l in lis]
ans = 0
for i in range(n-k+1):
    if sum(new_lis[i:i+k]) > ans:
        #print(new_lis[i:i+k])
        ans = sum(new_lis[i:i+k])
print(ans)