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

Fixed submission:
def fib(n):
    if n <= 1:
        return n
    result = [1, 0, 0, 1]
    matrix = [1, 1, 1, 0]
    while n > 0:
        if n % 2:
            result = mul(matrix, result)
        matrix = mul(matrix, matrix)
        n //= 2
    return result[2]

def mul(a, b):
    return [a[0]*b[0] + a[1]*b[2],
            a[0]*b[1] + a[1]*b[3],
            a[2]*b[0] + a[3]*b[2],
            a[2]*b[1] + a[3]*b[3]]
    
N, M = map(int, input().split())
if N == 1:
    print(1)
    quit()
S = [-1]
for i in range(M):
    S.append(int(input()))
S.append(N + 1)
S = [S[i + 1] - S[i] for i in range(M + 1)]
if any([x == 1 for x in S]):
    print(0)
    exit()
num = 1
for x in S:
    num *=  fib(x - 1)
    num = num % 1000000007
print(num)

Buggy submission (verdict: Runtime Error):
def Fib(n):    
    if n == 2 or n == 3:
        return 1
    else:
        return Fib(n - 1) + Fib(n - 2)
    
N, M = map(int, input().split())
S = [-1]
for i in range(M):
    S.append(int(input()))
S.append(N + 1)
S = [S[i + 1] - S[i] for i in range(M + 1)]
if any([x == 1 for x in S]):
    print(0)
    exit()
num = 1
for x in S:
    num *= Fib(x)
    num = num % 1000000007
print(num)

Buggy submission (verdict: Runtime Error):
def Fib(n):    
    if n == 2 or n == 3:
        return 1
    else:
        return Fib(n - 1) + Fib(n - 2)
    
N, M = map(int, input().split())
S = [-1]
for i in range(M):
    S.append(int(input()))
S.append(N + 1)
S = [S[i + 1] - S[i] for i in range(M + 1)]
if any([x == 1 for x in S]):
    print(0)
    exit()
num = 1
for x in S:
    num *= Fib(x)
print(num % 1000000007)
Problem p02682 (python)

Fixed submission:
l = list(map(int,input().split()))
a = l[0]
b = l[1]
c = l[2]
k = l[3]
if (k-a-b) >0:
  print(a-1*(k-a-b))
else:
  print(min(a,k))

Buggy submission (verdict: Runtime Error):
l = list(map(int,input().split()))
a = l[0]
b = l[1]
c = l[2]
k = l[3]-1
if (c-k-a-b) >0:
  print(a-1(c-k-a-b))
else:
  print(a)
Problem p02699 (python)

Fixed submission:
s = list(map(int, input().split()))
#print(s)
if s[0] <= s[1]:
  print('unsafe')
else:
  print('safe')

Buggy submission (verdict: Runtime Error):
s = input().split()
#print(s)
if s[0] => s[1]:
  print(unsafe)
	else:
      print(safe)
Problem p02759 (python)

Fixed submission:
import math
n=int(input())
print(math.ceil(n/2))

Buggy submission (verdict: Runtime Error):
inport math
n=int(input())
print(math.ceil(n/2))
Problem p02835 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a+b+c >=22:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a+b+c=>22:
  print("bust")
else:
  print("win")
Problem p03013 (python)

Fixed submission:
import functools
import operator

n,m= map(int,input().split())
def fib(n):
  x,y=1,2
  if n==1 or n==0:
    return x
  elif n==2:
    return y
  else:
    for i in range(n-2):
      x, y = y,x+y
    return y
if m==0:
  print(fib(n)%1000000007)
else:
  li=[int(input()) for i in range(m)]
  l=len(li)
  a=0
  b=0
  c=[]
  for i in range(l):
    b=li[i]-1
    c.append(b-a)
    a=li[i]+1
  c.append(n-(li[-1]+1))
  c2=[i for i in c if i<0]
  if sum(c2)<0:
    print(0)
  else:
    ans=list(map(fib,c))
    result = functools.reduce(operator.mul, ans)
    print(result%1000000007)

Buggy submission (verdict: Runtime Error):
import functools
import operator

n,m= map(int,input().split())
li=[int(input()) for i in range(m)]
l=len(li)
a=0
b=0
c=[]
for i in range(l):
  b=li[i]-1
  c.append(b-a)
  a=li[i]+1
c.append(n-(li[-1]+1))
c2=[i for i in c if i<0]
if sum(c2)<0:
  print(0)
else:
  def fib(n):
    x,y=1,2
    if n==1 or n==0:
      return x
    elif n==2:
      return y
    else:
      for i in range(n-2):
        x, y = y,x+y
      return y
  ans=list(map(fib,c))

  result = functools.reduce(operator.mul, ans)
  print(result%1000000007)
Problem p03835 (python)

Fixed submission:
x,s=map(int,input().split())
n=x+1
a=0
for i in range(n):
    for j in range(n):
        if 0<=(s-(i+j))<=x:
            a+=1
print(a)

Buggy submission (verdict: Runtime Error):
x,s=map(int(input().split()))
n=x+1
a=0
for i in range(n):
    for j in range(n):
        if 0<=s-(i+j)<=x:
            a+=1
print(a)
Problem p02622 (python)

Fixed submission:
s=input()
t=input()
l=len(s)
count=0
if(s==t):
  print(count)
  
else:
  for i in range(l):
    if(s[i]==t[i]):
      continue
    else:
      count+=1

  print(count)

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
l=len(s)
count=0
if(s==t):
  break
else:
  for i in range(l):
    if(s[i]==t[i]):
      continue
    else:
      count+=1

print(count)
Problem p02771 (python)

Fixed submission:
A,B,C=input().split()

if  A==B==C:
    print('No')
elif A!=B and A!=C and B!=C:
    print('No')
else:
    print('Yes')

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

i=[int(input()) for i in range(3)]
print(i)
if i[0]==i[1]&i[1]!=i[2]:
  print('Yes')
elif i[0]==i[2]&i[1]!=i[2]:
  print('Yes')
elif i[1]==i[2]&i[0]!=i[1]:
  print('Yes')
else:
  print('no')

Buggy submission (verdict: Runtime Error):
i=[int(input()) for i in range(3)]
print(i)
if i[0]==i[1]&&i[1]!=i[2]:
  print('Yes')
else if i[0]==i[2]&&i[1]!=i[2]:
  print('Yes')
else if i[1]==i[2]&&i[0]!=i[1]:
  print('Yes')
else:
  print('no')
Problem p02916 (python)

Fixed submission:
n = int(input())
a_lis = list(map(int,input().split()))
b_lis = list(map(int,input().split()))
c_lis = list(map(int,input().split()))
 
s = 0
 
for i in range(n-1):
  if a_lis[i+1] - a_lis[i] == 1:
    s += c_lis[a_lis[i]-1]
print(sum(b_lis)+s)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_lis = list(map(int,input().split()))
b_lis = list(map(int,input().split()))
c_lis = list(map(int,input().split()))

s = 0

for i in range(n):
  if a_lis[i+1] - a_lis[i] == 1:
    s += c_lis[a_lis[i]]
print(sum(b_lis)+s)
Problem p02935 (python)

Fixed submission:
n = int(input())
l =list(map(int,input().split()))
l = sorted(l)
 
for i in range(n-1):
    ave = (l[0] + l[1])/2
    l[0:2] = []
    l.insert(0,ave)
    
print(l[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
l =[]
for i in range(n):
    l.append(int(input()))
l = sorted(l)
 
for i in range(n-1):
    ave = (l[0] + l[1])/2
    l[0:2] = []
    l.insert(0,ave)
    
print(l[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
l =[]
for i in range(n):
    l.append(int(input()))
l.sort()

for i in range(n-1):
    ave = (l[0] + l[1])/2
    l[0:2] = []
    l.insert(0,ave)
    
print(l[0])
Problem p03207 (python)

Fixed submission:
n = int(input())
l = list()
for i in range(n):
  a = int(input())
  l.append(a)

l.sort()
p = 0.5*l[-1] + sum(l[:-1])
print(int(p))

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [int(input()) for i in range(n)].sort()
print(int(0.5*l[-1] + sum(l[-1])))
Problem p03250 (python)

Fixed submission:
l = list(map(int,input().split()))
l.sort()
print(10*l[2] + l[1] + l[0])

Buggy submission (verdict: Runtime Error):
l = map(int,input().split())
l.sort()
print(10*l[0] + l[1] + l[2])
Problem p03631 (python)

Fixed submission:
n = input()
if n[0] == n[2]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = input()
if n[0] == n[2]:
  print("Yes)
else:
  print("No")
Problem p03835 (python)

Fixed submission:
k,s = map(int,input().split())
cnt = 0
 
for x in range(k+1):
  for y in range(k+1):
      if x + y <= s and x + y >= s - k:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
k,s = map(int,input().split())
cnt = 0
 
for x in range(k+1):
  for y in range(k+1):
      if x + y <= s and x + y >= s - k 
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
k,s = map(int,input())
cnt = 0

for x in range(k):
  for y in range(k):
    for z in range(k):
      if x + y + z == s:
        cnt += 1
print(cnt)
Problem p02623 (python)

Fixed submission:
N, M, K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a, b=[0], [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):
N, M, K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a, b=[0], [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-=117ans=max(ans, i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
time=0
count=0
l=len(a)+len(b)
for i in range(l)
    if len(b)>0:
        if len(a)>0:
            if a[0]<b[0]:
                if time+a[0]<=k:
                    time+=a[0]
                    a.pop(0)
                else:
                    break
            else:
                if time+b[0]<=k:
                    time+=b[0]
                    b.pop(0)
                else:
                    break
        else:
            if time+b[0]<=k:
                time+=b[0]
                b.pop(0)
            else:
                break
    elif len(a)>0:
        if time+a[0]<=k:
            time+=a[0]
            a.pop(0)
        else:
            break
    else:
        break
    count+=1
print(count)
Problem p02624 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def main():
    N = int(input())
    ans = 0
    for i in range(1, N + 1):
        n = N // i
        ans += n * (n + 1) * i // 2
    print(ans)
    return


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def countp(cp, p):
    ret = 0
    while cp % p == 0:
        ret += 1
        cp //= p
    return ret


def count_in(fx_dict):
    if not fx_dict:
        return 2
    ret = 1
    for v in fx_dict:
        ret *= (v + 1)
    return ret


def main():
    N = int(input())
    va = [i for i in range(N + 1)]
    fx = [[] for _ in range(N + 1)]
    for p in range(2, int(N**0.5) + 2):
        if va[p] == 1:
            continue
        for cp in range(p, N + 1, p):
            tmp = countp(cp, p)
            va[cp] //= p**tmp
            fx[cp].append(tmp)
    # print(fx)

    ans = 1
    for i in range(2, N + 1):
        if va[i] != 1:
            fx[i].append(1)
        tmp = count_in(fx[i])
        # print(i, tmp)
        ans += i * tmp

    print(ans)
    return


if __name__ == '__main__':
    main()
Problem p02726 (python)

Fixed submission:
def inpl():
    return list(map(int, input().split()))


N, X, Y = inpl()
X -= 1
Y -= 1
ans = {i: 0 for i in range(N)}
for i in range(N):
    for j in range(i + 1, N):
        c = min(j - i, abs(i - X) + 1 + abs(j - Y), abs(i - Y) + 1 + abs(j - X))
        ans[c] += 1

for i in range(1, N):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra


def inpl():
    return list(map(int, input().split()))


N, X, Y = inpl()

edge = [[-1 for n in range(N)] for i in range(N)]

for i in range(N - 1):
    edge[i][i + 1] = 1
    edge[i + 1][i] = 1
edge[X - 1][Y - 1] = 1
edge[Y - 1][X - 1] = 1

G = csgraph_from_dense(edge, null_value=-1)
ans_dict = {}
for g in dijkstra(G):
    for i in g:
        ans_dict[i] = ans_dict.get(i, 0) + 1

for i in range(1, N):
    print(ans_dict.get(i, 0) // 2)
Problem p03107 (python)

Fixed submission:
def inpl():
    return list(map(int, input().split()))


S = input()
print(min(S.count('0'), S.count('1')) * 2)

Buggy submission (verdict: Runtime Error):
def inpl():
    return list(map(int, input().split()))


S = inpu()
print(min(S.count('0'), S.count('1')))
Problem p03127 (python)

Fixed submission:
import sys

sys.setrecursionlimit(20000)


def inpl():
    return list(map(int, input().split()))


def gcd(a, b):
    la = max(a, b)
    sm = min(a, b)
    if la % sm == 0:
        return sm
    else:
        return gcd(sm, la - sm)


n = int(input())
A = inpl()
A.sort()
ans = gcd(A[0], A[1])
for a in A:
    ans = gcd(ans, a)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(20000)


def inpl():
    return list(map(int, input().split()))


def gcd(a, b):
    la = max(a, b)
    sm = min(a, b)
    if la % sm == 0:
        return sm
    else:
        return gcd(sm, la - sm)


n = int(input())
A = inpl()

ans = gcd(A[0], A[1])
for a in A:
    ans = gcd(ans, a)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(2000)


def inpl():
    return list(map(int, input().split()))


def gcd(a, b):
    la = max(a, b)
    sm = min(a, b)
    if la % sm == 0:
        return sm
    else:
        return gcd(sm, la - sm)


n = int(input())
A = inpl()

ans = gcd(A[0], A[1])
for a in A:
    ans = gcd(ans, a)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(2000)


def inpl():
    return list(map(int, input().split()))


def gcd(a, b):
    la = max(a, b)
    sm = min(a, b)
    if la % sm == 0:
        return sm
    else:
        return gcd(sm, la - sm)


n = int(input())
A = inpl()

ans = gcd(A[0], A[1])
for a in A[2:]:
    ans = gcd(ans, a)
print(ans)

Buggy submission (verdict: Runtime Error):
def inpl():
    return list(map(int, input().split()))


def gcd(a, b):
    la = max(a, b)
    sm = min(a, b)
    if la % sm == 0:
        return sm
    else:
        return gcd(sm, la - sm)


n = int(input())
A = inpl()

ans = gcd(A[0], A[1])
for a in A[2:]:
    ans = gcd(ans, a)
print(ans)
Problem p03232 (python)

Fixed submission:
def multiply(x, y):
    return (x * y) % mod


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x
    elif x == 1:
        return 1
    elif x == 0:
        return 0
    else:
        # print(mod)
        tmp = power(x, y // 2)
        return (multiply(tmp, tmp) * [1, x][y % 2]) % mod


N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

plist = [0]
nfact = 1
N
tmp = 0
for i in range(1, N):
    tmp = (tmp + power(i + 1, mod - 2)) % mod
    nfact = (nfact * (i + 1)) % mod
    plist.append(tmp)

ans = 0
# print(plist)
# print(nfact)
for i, a in enumerate(A):
    # print(i, N - i - 1, N)
    tmp = (1 + plist[i] + plist[N - i - 1]) % mod
    ans = (ans + multiply(multiply(a, tmp), nfact)) % mod

print(ans)

Buggy submission (verdict: Runtime Error):
ef multiply(x, y):
    return (x * y) % mod


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x
    elif x == 1:
        return 1
    elif x == 0:
        return 0
    else:
        # print(mod)
        tmp = power(x, y // 2)
        return (multiply(tmp, tmp) * [1, x][y % 2]) % mod


N = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

plist = [0]
nfact = 1
N
tmp = 0
for i in range(1, N):
    tmp = (tmp + power(i + 1, mod - 2)) % mod
    nfact = (nfact * (i + 1)) % mod
    plist.append(tmp)

ans = 0
# print(plist)
# print(nfact)
for i, a in enumerate(A):
    # print(i, N - i - 1, N)
    tmp = (1 + plist[i] + plist[N - i - 1]) % mod
    ans = (ans + multiply(multiply(a, tmp), nfact)) % mod

print(ans)
Problem p03253 (python)

Fixed submission:
import sys

N, M = map(int, input().split())

factor = {}
tmp = 2
while(M // tmp >= 1):
    if(M % tmp != 0):
        if(tmp == 2):
            tmp += 1
        elif(M // tmp < tmp):
            tmp = M
        else:
            tmp += 2
        continue

    M = M // tmp
    factor[tmp] = factor.get(tmp, 0) + 1

if(factor == {}):
    print(1)
    sys.exit()

ans = 1
max_a = 7 + 10 ** 9
max_value = max(list(factor.values()))
aho = {0: 1}
fact = {0: 1}
abc = {}
for i in range(1, max_value + 1):
    # print(i)
    aho[i] = ((aho[i - 1] * (i + N - 1)))
    fact[i] = (fact[i - 1] * i)
    abc[i] = (aho[i] // fact[i]) % max_a


# print(factor)
# print(aho, fact)
for i in factor.values():
    # print(i)
    ans = (ans * abc[i]) % max_a
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

N, M = map(int, input().split())

factor = {}
tmp = 2
while(M // tmp >= 1):
    if(M % tmp != 0):
        if(tmp == 2):
            tmp += 1
        elif(M // tmp < tmp):
            tmp = M
        else:
            tmp += 2
        continue

    M = M // tmp
    factor[tmp] = factor.get(tmp, 0) + 1

if(factor == {}):
    pimport sys

N, M = map(int, input().split())

factor = {}
tmp = 2
while(M // tmp >= 1):
    if(M % tmp != 0):
        if(tmp == 2):
            tmp += 1rint(1)
    sys.exit()

ans = 1
max_a = 7 + 10 ** 9
max_value = max(list(factor.values()))
aho = {0: 1}
fact = {0: 1}
abc = {}
for i in range(1, max_value + 1):
    # print(i)
    aho[i] = ((aho[i - 1] * (i + N - 1)))
    fact[i] = (fact[i - 1] * i)
    abc[i] = (aho[i] // fact[i]) % max_a


# print(factor)
# print(aho, fact)
for i in factor.values():
    # print(i)
    ans = (ans * abc[i]) % max_a
print(ans)
Problem p03291 (python)

Fixed submission:
S = input()

d = [0, 0, 0, 1]

max_ans = 10**9 + 7

for c in reversed(S):
    # print(c, d)
    m = [c == "A", c == "B", c == "C", c == "?"]
    if(m[3] is True):
        tmp = 3
    else:
        tmp = 1

    for j in range(3):
        d[j] = (tmp * d[j] + int(m[j] or m[3]) * d[j + 1]) % max_ans
    d[3] = (tmp * d[3]) % max_ans

print(d[0])

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

max_S = 10**9 + 7

N_Q = S.count("?")
N_C = S.count("C")

t_A = 0
t_Q = 0
if(S[0:1] == "C"):
    t_C = N_C - 1
else:
    t_C = N_C

S_list = [{"bA": t_A, "bQ": t_Q, "aC": t_C, "aQ": N_Q - t_Q}]
for i in range(1, len(S)):
    if(S[i - 1:i] == "A"):
        t_A += 1
    elif(S[i - 1:i] == "?"):
        t_Q += 1

    ba_dic = {}
    ba_dic["bA"] = t_A
    ba_dic["bQ"] = t_Q
    if(S[i:i + 1] == "?"):
        ba_dic["aQ"] = N_Q - t_Q - 1
    else:
        ba_dic["aQ"] = N_Q - t_Q
    if(S[i:i + 1] == "C"):
        t_C -= 1
    ba_dic["aC"] = t_C

    S_list.append(ba_dic)

ans = 0
for i in range(len(S)):
    if(S[i:i + 1] == "A" or S[i:i + 1] == "C"):
        continue

    bA = S_list[i]["bA"]
    bQ = S_list[i]["bQ"]
    aC = S_list[i]["aC"]
    aQ = S_list[i]["aQ"]

    Q_0 = int(3**(bQ + aQ))
    if(Q_0 == 1):
        Q_1 = 0
        Q_2 = 0
    elif(Q_0 == 3):
        Q_1 = 1
        Q_2 = 0
    else:
        Q_1 = Q_0 / 3
        Q_2 = Q_1 / 3
    ans += Q_0 * bA * aC + bQ * aQ * Q_2 + Q_1 * (bA * aQ + bQ * aC)
    ans = ans % max_S

print(ans)
Problem p03776 (python)

Fixed submission:
from collections import Counter
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def inpl(): return list(map(int, input().split()))


N, a, b = inpl()
array = inpl()
value = Counter(array)
array.sort(reverse=True)
ans = {}
sum_a = 0
kosuu = 0
last = -1
# print("koko")
for i, num in enumerate(array):
    # print(i, num)
    sum_a += num
    if last != num:
        kosuu = 1
        last = num
    else:
        kosuu += 1
    if a <= i+1 <= b:
        ans[sum_a/(i+1)] = ans.get(sum_a/(i+1), 0) + cmb(value[num], kosuu)
print("{:.10f}".format(max(ans)))
print(int(ans[max(ans)]))

Buggy submission (verdict: Runtime Error):
from collections import Counter
from scipy.special import comb

def inpl(): return list(map(int, input().split()))


N, a, b = inpl()
array = inpl()
value = Counter(array)
array.sort(reverse=True)
ans = {}
sum_a = 0
kosuu = 0
last = -1
# print("koko")
for i, num in enumerate(array):
    # print(i, num)
    sum_a += num
    if last != num:
        kosuu = 1
        last = num
    else:
        kosuu += 1
    if a <= i+1 <= b:
        ans[sum_a/(i+1)] = ans.get(sum_a/(i+1), 0) + comb(value[num], kosuu)
print("{:.10f}".format(max(ans)))
print(int(ans[max(ans)]))
Problem p02633 (python)

Fixed submission:
X=int(input())
K=0
B=0
C=0
for i in range(0,360):
    B=B+X
    C=B%360
    K=K+1
    if C==0:
        print(K)
        break

Buggy submission (verdict: Runtime Error):
X=int(input())
B=0
C=0
for i in range(0,360):
    B=B+X
    C=B%360
    K=K+1
    if C==0:
        print(K)
        break
Problem p02676 (python)

Fixed submission:
K=int(input())
S=input()
if len(S)<=K:print(S)
else:print(S[0:K]+'...')

Buggy submission (verdict: Runtime Error):
K=int(input())
S=input()
C=0
B=0
B=len(S)
if B<=K:
    print(S)
else:
    R=B-K
    for i in range(0,R):
        i=i+1
        C=C+S[i]
        
    print(C)

Buggy submission (verdict: Runtime Error):
K=int(input())
S=input()
B=0
D=0
B=len(S)
B=int(B)
B=B+1
D=S+...
if B>=K:
    print(S)
else:
    print(D)

Buggy submission (verdict: Runtime Error):
K=int(input())
S=input()
B=0
D=0
B=len(S)
B=int(B)
D=S+'...'
if S>=K:
    print(S)
else:
    print(D)

Buggy submission (verdict: Runtime Error):
K=int(input())
S=input()
B=0
D=0
B=len(S)
B=int(B)
D=S+'...'
if S=>K:
    print(S)
else:
    print(D)
Problem p02723 (python)

Fixed submission:
S=input()
if S[2]==S[3] and S[4]==S[5]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S=input()
if S[3]==S[4] and S[5]==S[6]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S=input().split()
if S[3]==S[4] and S[5]==S[6]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S=int(input())
if S[3]==S[4] and S[5]==S[6]:
    print('Yes')
else:
    print('No')
Problem p02753 (python)

Fixed submission:
S=input()
if S[0]!=S[1]:
    print('Yes')
elif S[1]!=S[2]:
    print('Yes')
elif S[0]!=S[2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S=int(input())
if S[0]==S[1]:
    print('Yes')
elif S[1]==S[2]:
    print('Yes')
elif S[0]==S[2]:
    print('Yes')
else:
    print('No')
Problem p02835 (python)

Fixed submission:
A=list(map(int,input().split()))
B=0
B=A[0]+A[1]+A[2]
if B>=22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
A=list(map(int,input()split()))
B=0
B=A[0]+A[1]+A[2]
if B>=22:
    print("bust")
else:
    print("win")
Problem p02682 (python)

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

count = 0
if a < k:
    count += a
    if a+b < k:
        count -= k-a-b
else:
    count = k

print(count)

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())

num_list = [1] * a + [0] * b + [-1] * c

count = sum(num_list[:k])
print(count)
Problem p02689 (python)

Fixed submission:

n, m = map(int, input().split())
h = list(map(int, input().split()))

good = 0

obs = [[] for i in range(n) ]

for i in range(m):
    a, b = map(int, input().split())
    obs[a-1].append(b)
    obs[b-1].append(a)

for idx,o in enumerate(obs):
    higher = True
    if len(o) == 0:
        good += 1
        continue
    o = set(o)
    for i in o:
        if h[idx] <= h[i-1]:
            higher = False
    if higher:
        good += 1

print(good)

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

good = 0

obs = [[] for i in range(n) ]

for i in range(m):
    a, b = map(int, input().split())
    obs[a-1].append(b)
    obs[b-1].append(a)

    higher = True
    if len(o) == 0:
        good += 1
        continue
    o = set(o)
    for i in o:
        if h[idx] <= h[i-1]:
            higher = False
    if higher:
        good += 1

print(good)
Problem p02847 (python)

Fixed submission:
a = input()
b = ['SUN','MON','TUE','WED','THU','FRI','SAT']
print(7 - b.index(a))

Buggy submission (verdict: Runtime Error):
a = input()
b = ['SUN','MON','TUE','WED','THU','FRI','SAT']
ptint(7 - b.index(a))