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

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

Buggy submission (verdict: Runtime Error):
N , R = tuple(list(map(int, input().split(' '))))
if N >= 10:
    print(R)
else:
    print(R + 100 * (10 - N))
Problem p02831 (python)

Fixed submission:

def gcd(x, y):
    m = max(x, y)
    n = min(x, y)
    if m % n == 0:
        return n
    else:
        return gcd(n, m%n)
def lcm(x, y):
    return (x * y) // gcd(x, y)

A , B = tuple(list(map(int, input().split(' '))))
if A == 1 or B == 1:
    print(max(A, B))
else:
    print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A , B = tuple(list(map(int, input().split(' '))))
print(lcm(A, B))
Problem p02659 (python)

Fixed submission:
import decimal
a, b = input().split()
x=decimal.Decimal(a)
y=decimal.Decimal(b)
ans = int(x * y) 
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=a*b*100
print(s//100)
Problem p02550 (python)

Fixed submission:
import sys

n,x,m = (int(i) for i in input().split())
l = [x]
ans = x
memo_array = [-1]*(m+1)

for i in range(1,n):
    ans = ans**2%m
    idx = memo_array[ans]
    if idx != -1:
        loop_num, mod = divmod((n-idx),(i-idx))
        print(sum(l[:idx]) + sum(l[idx:])*(loop_num)+sum(l[idx:idx+mod]))
        sys.exit()
    l.append(ans)
    memo_array[ans]=i
print(sum(l))

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

n,x,m = (int(i) for i in input().split())
l = np.array([x])
ans = x
memo_array = [-1]*(m+1)
for i in range(1,n):
    ans = ans**2%m
    idx = memo_array[ans]
    if idx != -1:
        loop_num, mod = divmod((n-idx),(i-idx))
        print(np.sum(l[:loop_start]) + np.sum(l[loop_start:])*(loop_num)+np.sum(l[loop_start:loop_start+mod]))
        sys.exit()
    l = np.append(l,ans)
    memo_array[ans]=i
print(np.sum(l))

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

n,x,m = (int(i) for i in input().split())
l = np.array([x])
ans = x
memo_array = [False]*(m+1)
for i in range(1,n):
    ans = ans**2%m
    if memo_array[ans]:
        loop_start = int(np.where(l==ans)[0])
        loop_num, mod = divmod((n-loop_start),(i-loop_start))
        print(np.sum(l[:loop_start]) + np.sum(l[loop_start:])*(loop_num)+np.sum(l[loop_start:loop_start+mod]))
        sys.exit()
    l = np.append(l,ans)
    memo_array[ans]=True
print(np.sum(l))

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

n,x,m = (int(i) for i in input().split())
l = np.array([x])
ans = x
memo_array = [False]*m
for i in range(1,n):
    ans = ans**2%m
    if memo_array[ans]:
        loop_start = int(np.where(l==ans)[0])
        loop_num, mod = divmod((n-loop_start),(i-loop_start))
        print(np.sum(l[:loop_start]) + np.sum(l[loop_start:])*(loop_num)+np.sum(l[loop_start:loop_start+mod]))
        sys.exit()
    l = np.append(l,ans)
    memo_array[ans]=True
print(np.sum(l))
Problem p02596 (python)

Fixed submission:
k= int(input())

if k % 2 == 0 or k % 5 == 0:
    print("-1")
    
else:
    ans = len(str(k))
    s = int(str(7)* ans)
    while True:
        if s % k == 0:
            print(ans)
            break
        else:
            s = (s % k)*10 + 7
            ans += 1

Buggy submission (verdict: Runtime Error):
k= int(input())
 
if k % 2 == 0 or k % 5 == 0:
    print("-1")
    
else:
    ans = 1
    s = ７
    while True:
        if s % k == 0:
            print(ans)
            break
        else:
            s = (s % k)*10 + 7
            ans += 1
Problem p02552 (python)

Fixed submission:
x=int(input())

if x==0:
  print(1)
elif x==1:
  print(0)

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

if x>0.5:
  print(0)
elif x<0.5:
  print(1)

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

if s==0:
  print( 1)
elif s==1:
  print( 0)

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

if s==0:
  return 1
elif s==1:
  return 0

Buggy submission (verdict: Runtime Error):
x=int(input())
s=input()
if s==0:
  return 1
elif s==1:
  return 0

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

if x==0:
  return 1
elif x==1:
  return 0

Buggy submission (verdict: Runtime Error):
if x==0:
   print (1)
elif x==1:
   print(0)

Buggy submission (verdict: Runtime Error):
x=int(a)
if a==0:
   print (1)
elif a==1:
   print(0)

Buggy submission (verdict: Runtime Error):
x=int(a)
if a==0:
  return 1
elif a==1:
  return 0

Buggy submission (verdict: Runtime Error):
if x==0:
  return 1
elif x==1:
  return 0

Buggy submission (verdict: Runtime Error):
if x==0:
  return 1
else:
  return 0

Buggy submission (verdict: Runtime Error):
if x=0:
  return 1
else:
  return 0
Problem p02570 (python)

Fixed submission:
a=list(map(int,input().split()))
D=a[0]
T=a[1]
S=a[2]
if T*S>=D:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
D=int(input())
T=int(input())
S=int(input())

if T*S>=D:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
input(D)
input(T)
input(S)

if T*S>=D:
  print('Yes')
else:
  print('No')
Problem p02546 (python)

Fixed submission:
S = str(input())
if S[-1] != 's':
  S += 's'
else:
  S += 'es'
print(S)

Buggy submission (verdict: Runtime Error):
S = str(input())
if S[-1] == 's':
  S += 's'
else:
  S += 'es'
return S
Problem p02547 (python)

Fixed submission:
N = int(input())
lst = []
for _ in range(N):
  d1, d2 = map(int, input().split(' '))
  lst.append((d1, d2))
  
idx = 0
flag = False
while idx < N-2:
  cnt = 0
  for i in range(3):
    d1, d2 = lst[i+idx]
    if d1 == d2:
      cnt += 1
  if cnt == 3:
    flag = True
    break
  else:
    idx += 1
 
print('Yes' if flag else 'No')

Buggy submission (verdict: Runtime Error):

Copy
Copy
N = int(input())
lst = []
for _ in range(N):
  d1, d2 = map(int, input().split(' '))
  lst.append((d1, d2))
  
idx = 0
while idx < N-3:
  cnt = 0
  for _ in range(3):
    d1, d2 = lst[idx]
    if d1 == d2:
      cnt += 1
  
  if cnt == 3:
    print('Yes')
    break
  else:
    idx += 1
print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
lst = []
for _ in range(N):
  d1, d2 = map(int, input.split(' '))
  lst.append((d1, d2))
  
idx = 0
while idx < N-3:
  cnt = 0
  for _ in range(3):
    d1, d2 = lst[idx]
    if d1 == d2:
      cnt += 1
  
  if cnt == 3:
    print('Yes')
    break
  else:
    idx += 1
print('No')

Buggy submission (verdict: Runtime Error):
N = input()
lst = []
for _ in range(N):
  d1, d2 = map(int, input.split(' '))
  lst.append((d1, d2))
  
idx = 0
while idx < N-3:
  cnt = 0
  for _ in range(3):
    d1, d2 = lst[idx]
    if d1 == d2:
      cnt += 1
  
  if cnt == 3:
    print('Yes')
    break
  else:
    idx += 1
print('No')

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

idx = 0
while idx < N-3:
  cnt = 0
  for _ in range(3):
    d1, d2 = map(int, input.split(' '))
    if d1 == d2:
      cnt += 1
  
  if cnt == 3:
    print('Yes')
    break
  else:
    idx += 1
print('No')

Buggy submission (verdict: Runtime Error):
i = input()
idx = 0

while idx < i:
  	cnt = 0
	for _ in range(3):
      d1, d2 = list(map(int, input.split(' ')))
      if d1 == d2:
        cnt += 1
    if cnt == 3:
      print('Yes')
    else:
      idx += 1

print('No')

Buggy submission (verdict: Runtime Error):
i = input()
idx = 0

while idx < i:
  	cnt = 0
	for _ in range(3):
      d1, d2 = list(map(int, input.split(' ')))
      if d1 == d2:
        cnt += 1
    if cnt == 3:
      return 'Yes'
    else:
      idx += 3

print('No')
Problem p02578 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split(' ')))

lst = A[:]
B = [0]
for i in range(1, len(A)):
  if lst[i] < lst[i-1]:
	  B.append(lst[i-1] - lst[i])
	  lst[i] = lst[i-1]
  else:
    B.append(0)
    
print(sum(B))

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

cnt = 0

for i in range(1,len(A)):
  if A[i] < A[i-1]:
	cnt += A[i-1] - A[i]
    A[i] = A[i-1]
    
print(cnt)
Problem p02693 (python)

Fixed submission:
k = int(input())
a, b = map(int,input().split())
list1 = []
x =(k+a-1)//k
y = b // k

for i in range(x,y+1):
  list1.append(i)
if list1 == []:
  print('NG')
else:
  print('OK')

Buggy submission (verdict: Runtime Error):
a, b, n =  map(int, input().split())
p = 0
for i in range(1, n+1):
  if p < (a*i)//b - a*(i//b):
    p = (a*i)//b - a*(i//b)
print(p)
Problem p02833 (python)

Fixed submission:

n = int(input())
cnt = 0
i = 1
x = 10
if n % 2 == 1:
  print(0)
else:
  while x <= n:
    
    cnt += n//x
    x *= 5


  print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
cnt = 0
x = len(str(n))

if n % 2 == 1:
  print(0)
  EXIT()
for i in range(1,26):
  cnt += n//((5**i)* 2)


print(cnt)
Problem p02873 (python)

Fixed submission:
s = input()
n = len(s) #length s
aa = ['.'] * (n + 1)

if s[0] == '<':
  aa[0] = 0
if s[-1] == '>':
  aa[-1] = 0

for i in range(n-1):
  if s[i] ==  '>' and s[i+1] == '<':
    aa[i+1] = 0 
  elif s[i] == '<' and s[i+1] == '>':
    aa[i+1] = n
    
z = [i for i,x in enumerate(aa) if x == 0]
m = [i for i, x in enumerate(aa) if x == n]


for i in range(len(z)-1):
  aa[m[i]] = max(m[i]-z[i], z[i+1]-m[i])
  aa[m[i]+1] = z[i+1]-m[i]-1
  for j in range(z[i]+1, m[i]):
    aa[j] = aa[j-1] +1
  for k in range(m[i]+2,z[i+1]):
    
    aa[k] = aa[k-1]-1
for i in range(z[-1], n+1):
  if aa[i] == '.':
    aa[i] = aa[i-1]+1
for i in range(z[0]):
  if aa[i] == '.':
    aa[i] = z[0] - i
    

print(sum(aa))

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s) #length s
aa = ['.'] * (n + 1)

if s[0] == '<':
  aa[0] = 0

for i in range(n-1):
  if s[i] ==  '>' and s[i+1] == '<':
    aa[i+1] = 0 
  elif s[i] == '<' and s[i+1] == '>':
    aa[i+1] = n
    
id0 = [i for i,x in enumerate(aa) if x == 0]
idm = [i for i, x in enumerate(aa) if x == n]


for i in range(len(id0)-1):
  aa[idm[i]] = max(idm[i]-id0[i], id0[i+1]-idm[i])

for i in range(n):
  if s[i] == '<' and aa[i+1] == '.':
    aa[i+1] = aa[i] + 1
for i in range(n-1, 0,-1):
  if aa[i] == '.' and s[i] == '>':
    aa[i] = aa[i+1] +1

print(sum(aa))
Problem p03617 (python)

Fixed submission:
Q, H, S, D = map(int, input().split())
N = int(input())
x = N % 2
y = N // 2
arr = [4*Q*x, 2*H*x, S*x]
arr1 = [8*Q*y, 4*H*y, 2*S*y, D*y]
#if N % 2 == 0:
#  arr.append(int(0.5*D*N))
#else:
#  arr.append(int(0.5*D*(N-1)+ min(S, 2*H, 4*Q)))
   
print(min(arr) + min(arr1))

Buggy submission (verdict: Runtime Error):
Q, H, S, D = map(int, input().split())
N = int(input())
arr = [4*Q*N, 2*H*N, S*N]
if N % 2 == 0:
  arr.append(int(0.5*D*N))
elif:
  if N >= 3:
    arr.append(int(0.5*D*(N-1)+ min(S, 2*H, 4*Q)))
    
print(min(arr))
Problem p03745 (python)

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

list1 =[0] * n
cnt = 1  
for i in range(n-1):
  if aa[i+1] > aa[i]:
    list1[i+1] = 1
  elif aa[i+1] < aa[i]:
    list1[i+1] = -1
  elif aa[i+1] == aa[i]:    
    list1[i+1] = 0

while 1 in list1 and -1 in list1:
  del list1[:max(list1.index(1), list1.index(-1))]
  list1[0] = 0
  cnt += 1
  
print(cnt)

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

list1 =[0] * n
list1[0] = 1
list1[1] = 1

for i in range(2,n):
  if list1[i-2] == list1[i-1]:
    if (aa[i] - aa[i-1]) * (aa[i-1] -aa[i-2]) < 0:
      list1[i] = list1[i-1] + 1
    else:
      list1[i] = list1[i-1]
  else:
    list1[i] = list1[i-1]
    
print(list1[n-1])
Problem p02547 (python)

Fixed submission:
n = int(input())
count = 0
flag = False
while count < n:
  a, b = map(int, input().split())
  count += 1
  if a == b and count < n:
    a, b = map(int, input().split())
    count += 1
    if a == b and count < n:
      a, b = map(int, input().split())
      count += 1
      if a == b and count <= n:
        flag = True
        print("Yes")
        break

if flag == False:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
flag = False
while count < n:
  a, b = map(int, input().split())
  count += 1
  if a == b and count <= n:
    a, b = map(int, input().split())
    count += 1
    if a == b and count <= n:
      a, b = map(int, input().split())
      count += 1
      if a == b and count <= n:
        flag = True
        print("Yes")
        break

if flag == False:
  print("No")
Problem p03041 (python)

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

Buggy submission (verdict: Runtime Error):
n,k = list(map(int,input().split()))
S = input()
print(S.replace(S[k], S[k].lower()))
Problem p02762 (python)

Fixed submission:
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parent = [i for i in range(n)]  # 親
        self.rank = [1] * n  # 木の高さ
        self.size = [1] * n  # size[i] は i を根とするグループのサイズ
 
    def find(self, x):  # x の根を返す
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])  # 経路圧縮
            return self.parent[x]
 
    def unite(self, x, y):  # x, y の属する集合を併合する
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                self.parent[x] = y
                self.size[y] += self.size[x]
            else:
                self.parent[y] = x
                self.size[x] += self.size[y]
                if self.rank[x] == self.rank[y]:
                    self.rank[x] += 1
 
    def is_same(self, x, y):  # x, y が同じ集合に属するか判定する
        return self.find(x) == self.find(y)
 
    def group_size(self, x):  # x が属する集合の大きさを返す
        return self.size[self.find(x)]
 

n,m,k=map(int,input().split())
friend=[[]for i in range(n)]
block=[[]for i in range(n)]
group=[[]for i in range(n)]
uf=UnionFind(n)

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

for i in range(k):
    c,d=map(int,input().split())
    if uf.is_same(c-1,d-1):
        block[c-1].append(d-1)
        block[d-1].append(c-1)

for i in range(n):
    ans=uf.group_size(i)-1-len(friend[i])-len(block[i])
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
friend=[[]for i in range(n)]
block=[[]for i in range(n)]
G=[]

for i in range(m):
    a,b=map(int,input().split())
    friend[a-1].append(b-1)
    friend[b-1].append(a-1)
for i in range(k):
    c,d=map(int,input().split())
    block[c-1].append(d-1)
    block[d-1].append(c-1)

def dfs(now):
    global group
    for next in friend[now]:
        if visited[next]==False:
            visited[next]=True
            group.append(next)
            dfs(next)
            
    return group
group=[]
visited=[False]*n
for i in range(n):
        visited=[False]*(n)
        visited[i]=True
        G.append(dfs(i))
        group=[]
for i in range(n):
    ans=set(G[i])-set(friend[i])-set(block[i])
    print(len(ans))
Problem p02779 (python)

Fixed submission:
#154 c
n=int(input())
a=list(map(int,input().split()))
num=set(a)
if len(a)==len(num):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
#154 c
n=int(input())
a=list(map(int,input().split()))
num=dict()
flag=True
for x in a:
    if x not in num:
        a[x]=1
    else:
        flag=False
    if flag==False:
        break
if flag:
    print("YES")
else:
    print("NO")
Problem p03250 (python)

Fixed submission:
#abc110 a
num=list(map(int,input().split()))
l=max(num)
s=min(num)
m=sum(num)-l-s
ans=int(str(l)+str(m))+s
print(ans)

Buggy submission (verdict: Runtime Error):
#abc110 a
num=list(map(int,input().split()))
l=max(num)
s=min(num)
m=sum(l)-l-s
ans=int(str(l)+str(m))+s
print(ans)
Problem p02547 (python)

Fixed submission:
N = int(input())
cnt = 0
ans = False
for i in range(N):
    a, b = input().split()
    if a == b:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        ans = True
        break
print('Yes' if ans else 'No')

Buggy submission (verdict: Runtime Error):
N = int(input())
cnt = 0
ans = False
for i in range(N):
    a, b = input().split()
    print(a, b)
    if a == b:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        ans True
        break
    print(cnt)
print('Yes' if ans else 'No')
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
 
ruiseki_A = [0]
ruiseki_B = [0]
 
for i in range(len(A)):
    ruiseki_A.append(ruiseki_A[i]+A[i])
for i in range(len(B)):
    ruiseki_B.append(ruiseki_B[i]+B[i])
#print(ruiseki_A)
 
ans = 0
for i in range(len(ruiseki_A)):
    tmp = K - ruiseki_A[i]
    if tmp < 0:
        continue
    r = len(ruiseki_B)
    l = 0
    while r-l > 1:
        mid = (r + l) // 2
        if ruiseki_B[mid] <= tmp:
            l = mid
        else:
            r = mid
    ans = max(ans, i+l)
 
print(ans)

Buggy submission (verdict: Runtime Error):
def mi(): return map(int,input().split())
def lmi(): return list(map(int,input().split()))
def ii(): return int(input())
def isp(): return input().split()

from collections import deque
n,m,k=mi()
a=deque(lmi())
b=deque(lmi())
i=0
cnt=0
value=0
while a or b:
  try:
    r=a[i]
  except:
    r=float('inf')
  try:
    q=b[i]
  except:
    q=float('inf')
  if q==r:
    if a[1]<b[1]:
      p=a.popleft()
    elif a[1]>b[1]:
      p=b.popleft()
  else:
    p=min(q,r)
    if p==r:
      p=a.popleft()
    else:
      p=b.popleft()
    
  print(p)
  
  value+=p
  if value>k:
    break
  elif value==k:
    cnt+=1
    break
  cnt+=1
  
  
  
print(cnt)
Problem p02688 (python)

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

list_n=[]
for i in range(1,N+1):
    list_n.append(i)
    
t=[]
for i in range(K):
    d=int(input())
    s=list(map(int,input().split()))
    t+=s
    
s=list(set(t))
s.sort()

cnt=0
for i in list_n:
    if i not in s:
        cnt+=1
        
print(cnt)

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

list_n=[]
for i in range(1,N+1):
    list_n.append(i)
    
t=[]
for i in range(K):
    d=int(input())
    s=list(map(int,input().split()))
    t+=s
    
s=set(t)
s.sort()

cnt=0
for i in list_n:
    if i not in s:
        cnt+=1
        
print(cnt)
Problem p02711 (python)

Fixed submission:

N=input()
if N.count('7')==0:
  print('No')
  
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
N=int(input())
if N.count('7')==0:
  print('No')
  
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
num=int(input())
list_num=list(input)
for i in range(list_num):
  if i=7:
    return Yes
    
return No
Problem p02879 (python)

Fixed submission:
a,b=map(str,input().split())
if len(a)==1 and len(b)==1:
  print(int(a)*int(b))
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if len(a)==1 and len(b)==1:
  print(a*b)
else:
  print(-1)
Problem p02951 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(max(0,c-(a-b)))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(max(0,c-(a-b))
Problem p02970 (python)

Fixed submission:
import math
n,d=map(int,input().split())
x=d*2+1
print(math.ceil(n/x))

Buggy submission (verdict: Runtime Error):
import math
n.d=map(int,input().split())
x=d*2+1
print(math.ceil(n/x))
Problem p02987 (python)

Fixed submission:
s=input()
t=list(set(s))
if len(t)==2:
  cnt1=0
  cnt2=0
  for i in s:
    if i==t[0]:
      cnt1+=1
      
    elif i==t[1]:
      cnt2+=1
      
  if cnt1==2 and cnt2==2:
    print('Yes')
    exit()
    
print('No')

Buggy submission (verdict: Runtime Error):
s=input()
t=set(s)
if len(t)==2:
  cnt1=0
  cnt2=0
  for i in s:
    if i==t[0]:
      cnt1+=1
      
    elif i==t[1]:
      cnt2+=1
      
  if cnt1==2 and cnt2==2:
    print('Yes')
    exit()
    
print('No')
Problem p03041 (python)

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

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
s[k-1]=s[k-1].lower()

print(s)
Problem p03075 (python)

Fixed submission:
a=[]
for i in range(5):
  s=int(input())
  a.append(s)
k=int(input())
if (a[4]-a[0])<=k:
  print('Yay!')
  
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a=[]
for i in range(5):
  s=int(input())
  a.apppend(s)
k=int(input())
if (a[4]-a[0])<=k:
  print('Yay!')
  
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a=[]
for i in range(5):
  s=int(input())
  
k=int(input())
if a[-1]-a[0]<=k:
  print('Yay!')
  
else:
  print(':(')
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):
    z=s-x-y
    if z>=0 and z<=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):
    z=s-x-y
    ifz>=0 andz<=2500:
      cnt+=1
        
print(cnt)
Problem p02682 (python)

Fixed submission:
import sys

a, b, c, k = map(int, input().split())
if a >= k:
    print(k)
    sys.exit()

total = a
k = k - a
if k <= 0:
    print(total)
    sys.exit()

k = k - b
if k <= 0:
    print(total)
    sys.exit()

print(total - k)

Buggy submission (verdict: Runtime Error):
import sys

a, b, c, k = map(int, input().split())
if a >= k:
    print(k)
    sys.exit()
elif a + b >= k:
    print(a)
    sys.exit()

ones = [1] * a
zeros = [0] * b
negas = [-1] * c

totals = []
totals.extend(ones)
totals.extend(zeros)
totals.extend(negas)

totals = totals[0:k]
print(sum(totals))

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
ones = [1] * a
zeros = [0] * b
negas = [-1] * c

totals = []
totals.extend(ones)
totals.extend(zeros)
totals.extend(negas)

totals = totals[0:k]
print(sum(totals))
Problem p02578 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n-1) :
    if a[i+1] - a[i] >= 0 :
        continue
    else :
        ans += abs(a[i+1] - a[i])
        a[i+1] += abs(a[i+1] - 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+1) :
    if a[i] - a[i-1] >= 0 :
        continue
    else :
        ans += abs(a[i] - a[i-1])
        a[i] += abs(a[i] - a[i-1])
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(1,n-1) :
    if a[i] - a[i-1] >= 0 :
        continue
    else :
        ans += abs(a[i] - a[i-1])
        a[i] += abs(a[i] - a[i-1])
        print(a)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(1,5) :
    if a[i] - a[i-1] >= 0 :
        continue
    else :
        ans += abs(a[i] - a[i-1])
        a[i] += abs(a[i] - a[i-1])
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(1,5) :
    if a[i] - a[i-1] >= 0 :
        continue
    else :
        ans += abs(a[i] - a[i-1])
        a[i] += abs(a[i] - a[i-1])
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(1,5) :
    if a[i] - a[i-1] >= 0 :
        continue
    else :
        ans += abs(a[i] - a[i-1])
        a[i] += abs(a[i] - a[i-1])
print(ans)
Problem p02682 (python)

Fixed submission:
a,b,c,k = map(int,input().split())
if k <= a :
    print(k)
else :
    m = min(k,a)
    k -= a

    if k <= b :
        print(a)
    else :
        n = min(k,b)
        k -= b
        l = k
        print(1*m+(-1)*l)

Buggy submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
m = min(k,a)
if m == k :
    n = 0
    l = 0
n = min(k-a,b)
if n == k=a :
    l = 0
l = min(k-a-b,c)
print(1*m+0*n+(-1)*l)
Problem p02753 (python)

Fixed submission:
s = input()
if s == 'AAA' or s == 'BBB' :
    print('No')
else :
    print('Yes')

Buggy submission (verdict: Runtime Error):
s = int(input())
if s == 'AAA' or s == 'BBB' :
    print('No')
else :
    print('Yes')