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

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

ans = 0

for i in range(n):
      #print(i)
      ans += b[a[i]-1]
      #print("ans",ans)
  #print("aaa",a[i])
      if i != 0:
        hantei = a[i-1] + 1
        if a[i] == hantei:
          ans += c[a[i]-2]
    
print(ans)

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

ans = 0

for i in range(n):
      #print(i)
      ans += b[a[i]-1]
      #print("ans",ans)
  #print("aaa",a[i])
      if i != 0:
        hantei = a[i-1] + 1
        if a[i] == hantei:
            ans += c[i]
    
print(ans)

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

ans = 0

for i in range(n):
    ans += b[a[i]]
    if a[i]+1 == a[i+1]:
        ans += c[i]
        
print(ans)
Problem p02933 (python)

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


if(a >= 3200):
    ans = s
else:
    ans = 'red'
    
print(ans)

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

n,q = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n+q-1)]

matrix = np.zeros((n,n))
ans = np.zeros((n,n))

for i in range(n-1):
  matrix[ab[i][0]-1,ab[i][1]-1] = 1
#  matrix[ab[i][1]-1,ab[i][0]-1] = 1

for l in range(n):
  for m in range(n):
    if matrix[l][m]:
      for o in range(n):
        if matrix[m][o]:
          matrix[l][o] = 1
          
ans = np.zeros((n))

for j in range(n-1,n+q-1):
  ans[ab[j][0]-1] += ab[j][1]
  for k in range(n):
    if matrix[ab[j][0]-1][k] == 1:
      ans[k] += ab[j][1]
  

for p in range(n):
  print(int(ans[p]))
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
a, b = map(Decimal, input().split())
print(int(a*b))

Buggy submission (verdict: Runtime Error):
nums = input().split()
a = int(nums[0])
b = float(nums[1])
print(int((a*(100*b))/100)

Buggy submission (verdict: Runtime Error):
nums = list(map(float, input().split()))
print(math.floor(nums[0] * nums[1]))
Problem p02859 (python)

Fixed submission:
a = int(input())
print(a**2)

Buggy submission (verdict: Runtime Error):
a = int(input())
print a**2
Problem p02753 (python)

Fixed submission:
s=list(input())
if len(set(s))==1:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
x=a*100//8
y=b*10
i=1
f=False
while(i<=1250):
  if i*8//100 == x and i//10 == y:
    print(i)
    f=True
    break
  i+=1
if not f:
  print(-1)

Buggy submission (verdict: Runtime Error):
n, a, b=map(int,input().split())
if n==a+b:
  print(a)
else:
  if a==0:
    print(0)
  else:
    print((n//(a+b))*a + min(n%(a+b), a))
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
print(int(input()//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)

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

if A + B + C >= 22
    print("bust")
else:
    print(win)
Problem p02707 (python)

Fixed submission:
import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N = int(input())
A = np.array(list(map(int, input().split())), dtype=np.int64)
cnt = np.zeros(N+1, dtype=np.int64)

for a in A:
	cnt[a] += 1

for c in cnt[1:]:
	print(c)

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N, M = map(int, input().split())
A = np.array(list(map(int, input().split())))
tot = np.sum(A)

if tot > N:
	print(-1)
else:
	print(N-tot)
Problem p02793 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
def gcd(a,b):
	if b == 0:
		return a
	return gcd(b, a%b)
LCM = A[0]
for i in range(1, N):
	GCD = gcd(LCM, A[i])
	LCM *= A[i]
	LCM //= GCD
LCM %= mod
ans = 0
for i in range(N):
	t = LCM * pow(A[i], mod-2, mod)
	ans += t
	ans %= mod

print(ans)

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

N = int(input())
A = np.array(list(map(int, input().split())), np.int64)
mod = 10**9+7
LCM = np.lcm.reduce(A)
B = [LCM] * N
B = B // A
#print(LCM)
#print(B)
ans = 0
for i in range(N):
	t = B[i]%mod
	ans += t
	ans %= mod

print(ans)
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
print(6-a-b)

Buggy submission (verdict: Runtime Error):
a, b= map(int, input().split())
print(6-a-b)

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
print(6-a-b)
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
inf = float("inf")
dp = [0] * (N+1)
for i in A:
	dp[i] = inf
dp[0] = 1
if dp[1] != inf:
	dp[1] = 1
for i in range(2,N+1):
	if dp[i] == inf:
		continue

	a = dp[i-2] if dp[i-2] != inf else 0
	b = dp[i-1] if dp[i-1] != inf else 0

	dp[i] = (a + b) % 1000000007


print(dp[N])

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
a = [int(input()) for _ in range(m)]
if 1 in a:
    ans = [0,1]
elif 2 in a:
    ans = [1,0]
else:
    ans = [1,2]
if n == 1:
    print(ans[0])
    sys.exit()
elif n == 2:
    print(ans[1])
    sys.exit()
else:
    for i in range(2,n):
        if i+1 not in a:
            ans.append((ans[i-1]+ans[i-2])%1000000007)
        else:
            ans.append(0)
    print(ans[len(ans)-1]%1000000007)

Buggy submission (verdict: Runtime Error):
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=map(int,input().split())
a = [-1]+[int(input()) for _ in range(m)]+[n+1]

def comb(dann):
    num_comb = 0
    for i in range((dann//2)+1):
        num_comb += combinations_count(dann-i, i)
    return num_comb

danns = [(a[i+1] - a[i]) - 2 for i in range(len(a)-1)]

ans = 1
for j in danns:
    ans *= comb(j) % 1000000007
print(ans%1000000007)
Problem p03042 (python)

Fixed submission:
d=input()
a,b=map(int, [d[:2],d[2:]])
temp=[]
for i in [a,b]:
    if 1 <= i <=12:
        temp.append(2)
    elif 0 <= i <= 99:
        temp.append(1)
    else:
        temp.append(0)

if sum(temp) == 4:
    print('AMBIGUOUS')
elif sum(temp) == 3:
    if temp[0]==2:
        print('MMYY')
    else:
        print('YYMM')
else:
    print('NA')

Buggy submission (verdict: Runtime Error):
d=input()
a,b=map([d[:2],d[2:]])
temp=[]
for i in [a,b]:
    if 1 <= i <=12:
        temp.append(2)
    elif 0 <= i <= 99:
        temp.append(1)
    else:
        temp.append(0)

if sum(temp) == 4:
    print('AMBIGUOUS')
elif sum(temp) == 3:
    if temp[0]==2:
        print('MMYY')
    else:
        print('YYMM')
else:
    print('NA')
Problem p03137 (python)

Fixed submission:
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
xx = sorted([x[i+1] - x[i] for i in range(m-1)])

for i in range(n-1):
    if len(xx) == 0:
        break
    xx.pop()

ans = sum(xx)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
xx = sorted([x[i+1] - x[i] for i in range(m-1)])

for i in range(n-1):
    xx.pop()

ans = sum(xx)
print(ans)
Problem p03207 (python)

Fixed submission:
n=int(input())
p=[int(input()) for i in range(n)]

print(sum(p)-(max(p)//2))

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

print(sum(p)-(max(p)//2))

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

print(int(sum(p))-(int(max(p))/2))

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

print(sum(p)-(max(p)/2))

Buggy submission (verdict: Runtime Error):
n=int(input())
p=[int(input() for i in range(n)]

print(sum(p)-(max(p)/2))

Buggy submission (verdict: Runtime Error):
n=int(input())
p=[input() for i in range(n)]
print(sum(p)-max(p)/2)
Problem p03208 (python)

Fixed submission:
n,k = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1] - h[i] for i in range(n-k+1)))

Buggy submission (verdict: Runtime Error):
N, K=map(int,input().split())2h=[int(input())foriinrange(N)]3h.sort()4print(min(h[i+K-1]-h[i]foriinrange(N-K+1)))
Problem p03286 (python)

Fixed submission:
N = int(input())

L = [[0,1]]
i = 1
while True:
	d = (-2) ** i
	if d < 0:
		L.append([L[-1][0]+d,L[-1][1]])
	else:
		L.append([L[-1][0],L[-1][1]+d])

	a,b = L[-1]
	if a <= N <= b:
		break

	i += 1
		
ans = []
tmp = N
for i in reversed(range(len(L))):
	if i == 0:
		if tmp == 1:
			ans.append("1")
		else:
			ans.append("0")
		break

	add = (-2) ** i
	a,b = L[i]
	c,d = L[i-1]
	if a == c:
		if d < tmp <= b:
			ans.append("1")
			tmp -= add
			continue
	elif b == d:
		if a <= tmp < c:
			ans.append("1")
			tmp -= add
			continue

	ans.append("0")

if ans[0] == "0":
	ans.pop(0)

print("".join(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
ans=[]
t=N
while t != 0:
    if t%(-2)==0:
        ans.append('0')
        t //= -2
    else:
        ans.append('1')
        t=(t-1)//(-2)
        
ans = rereversed(ans)
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
ans=[]
t=N
while t > 0:
    if t%(-2)==0:
        ans.append('0')
        t //= -2
    else:
        ans.appappend('1')
        t=(t-1)//(-2)
        
print(''.join(reversed(ans)))
Problem p03295 (python)

Fixed submission:
N, M = map(int,input().split())
E = sorted([list(map(int, input().split())) for _ in range(M)])

c = E[0]
cnt = 0
for i in range(1,M):
	if c[0] <= E[i][0] < c[1]:
		c = [max(c[0],E[i][0]), min(c[1],E[i][1])]
	else:
		cnt += 1
		c = E[i]

print(cnt+1)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab = sorted(ab, key = lambda x:x[1], reverse = True)
ab = sorted(ab)

def find_seed(ab, t):
	if len(ab) == 0:
		return 1
	if t[0] <= ab[0][0] < t[1]:
		t = [ab[0][0], min([ab[0][1],t[1]])]
		ab.pop(0)
		return find_seed(ab,t)

	return 1

ans = 0

while len(ab) > 0:
	t = ab.pop(0)
	ans += find_seed(ab,t)

print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab = sorted(ab, key = lambda x:x[1], reverse = True)
ab = sorted(ab)

def find_seed(ab, t):
	if len(ab) == 0:
		return 1
	if t[0] <= ab[0][0] < t[1]:
		t = [ab[0][0], min([ab[0][1],t[1]])]
		ab.pop(0)
		if len(ab) == 0:
			return 1
		else:
			return find_seed(ab,t)

	return 1

ans = 0

while len(ab) > 0:
	t = ab.pop(0)
	ans += find_seed(ab,t)

print(ans)
Problem p03835 (python)

Fixed submission:
k, s = map(int, input().split())
c = 0

for i in range(k+1):
    for j in range(k+1):
        z = s - i - j
        if z >= 0 and z <= k:
            c += 1
print(c)

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

Fixed submission:
from decimal import Decimal
from math import floor

a_in, b_in= input().split()
a = int(a_in)
b = Decimal(b_in)

print(floor(a * b))

Buggy submission (verdict: Runtime Error):
from decimal import Decimal
from math import floor

a_in, b_in= input().split()
a = int(a)
b = Decimal(b_in)

print(floor(a * b))
Problem p02729 (python)

Fixed submission:
import sys
X,Y = map(int,input().split())
if(X == 1 and Y == 1):
    print(0)
    sys.exit()
elif(Y == 1):
    print(int(X/2))
    sys.exit()
elif(X == 0 and Y ==2):
    print(1)
    sys.exit()
print(int((X * (X-1))/2 + int((Y * (Y-1))/2 )))

Buggy submission (verdict: Runtime Error):
import sys
X,Y = map(int,input().spliut())
if(X == 1 or Y == 1):
    print(0)
    sys.exit()
print(int((X * (X-1))/2 + Y))
Problem p02785 (python)

Fixed submission:
import math
N,K = map(int,(input().split()))
#print(N,K)
L = list(map(int,(input().split())))
L.sort()
#print(L)
num = N-K
if(num < 0):
    num = 0
L = L[0:num]
#print(L)
print(sum(L))

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort(reverse=True)
#print(L)
for x in range(K-1):
    del L[0]
   # print(L)
print(sum(L))

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort(reverse=True)
#print(L)
for x in range(K-1):
    del L[0]
    print(L)
print(sum(L))

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort()
#print(L)
for x in range(K):
    del L[-1]
print(sum(L))

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort()
#print(L)
for x in range(K):
    del L[-1]
print(sum(L))

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort()
print(L)
for x in range(K):
    del L[-1]
print(sum(L))
Problem p02831 (python)

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

def lcm(x, y):
    return (x * y) // gcd(x, y)

print(lcm(A, B))

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

print(lcm(A, B))

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

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

Fixed submission:
L=list(map(int,input().split()))
print(sum(L)-max(L))

Buggy submission (verdict: Runtime Error):
L=list(map(int,input().split()))
	print(sum(L)-max(L))
Problem p02676 (python)

Fixed submission:
def solution():
    k = int(input())
    s = str(input())
    if len(s) > k:
        return s[:k] + '...'
    else:
        return s

print(solution())

Buggy submission (verdict: Runtime Error):
def solution():
    k = int(input())
    s = int(input())
    if len(s) > k:
        return s[:k] + '...'
    else:
        return s

print(solution())
Problem p02679 (python)

Fixed submission:
from math import gcd
from collections import defaultdict
mod = 10**9+7
_, *S = open(0)
mp = defaultdict(lambda: [0, 0])
O = 0
for s in S:
    a, b = map(int, s.split())
    if a == b == 0:
        O += 1
    else:
        g = gcd(a, b)
        a //= g
        b //= g
        if a < 0 or a == 0 < b:
            a, b = -a, -b
        f = 0
        if b < 0:
            a, b, f = -b, a, 1
        mp[(a, b)][f] += 1
ans = 1
for k in mp:
    x, y = mp[k]
    ans = ans*(pow(2, x, mod)+pow(2, y, mod)-1) % mod
print((ans+O-1) % mod)

Buggy submission (verdict: Runtime Error):
_, *e = [[*map(int, t.split())] for t in open(0)]
ans = 1
mod = 10 ** 9 + 7
slope_dict = {}
zeros = 0
vect_x = 0
for x, y in e:
    if x == y == 0:
        zeros += 1
    elif y == 0:
        vect_x += 1
    else:
        slope_dict[x/y] = slope_dict.get(x/y, 0) + 1
ans = ans * (pow(2, vect_x, mod) + pow(2, slope_dict.get(0, 0), mod) - 1) % mod
slope_dict.pop(0)
for k in slope_dict:
    if -1/k in slope_dict:
        if k >= 1:
            ans = ans * (pow(2, slope_dict[k], mod) +
                         pow(2, slope_dict[-1/k], mod) - 1) % mod
    else:
        ans = ans * (pow(2, slope_dict[k], mod)) % mod
print(ans + zeros - 1 % mod)

Buggy submission (verdict: Runtime Error):
_, *e = [[*map(int, t.split())] for t in open(0)]
ans = 1
mod = 10 ** 9 + 7
slope_dict = {}
zeros = 0
vect_x = 0
for x, y in e:
    if x == y == 0:
        zeros += 1
    elif y == 0:
        vect_x += 1
    else:
        slope_dict[x/y] = slope_dict.get(x/y, 0) + 1
ans = ans * (pow(2, vect_x, mod) + pow(2, slope_dict.get(0, 0), mod) - 1) % mod
slope_dict.popitem(0)
for k in slope_dict:
    if -1/k in slope_dict:
        if k >= 1:
            ans = ans * (pow(2, slope_dict[k], mod) +
                         pow(2, slope_dict[-1/k], mod) - 1) % mod
    else:
        ans = ans * (pow(2, slope_dict[k], mod)) % mod
print(ans + zeros - 1 % mod)

Buggy submission (verdict: Runtime Error):
[n], *e = [[*map(int, t.split())] for t in open(0)]
ans = 0
mod = 10 ** 9 + 7
slope_dict = {}
for x, y in e:
    a = 2**slope_dict.get(x/y, 0)
    b = 2**slope_dict.get(-y/x, 0)
    ans = ((ans * (2 * a + b - 1) + a)/(a + b - 1))  # % mod
    slope_dict[x/y] = slope_dict.get(x/y, 0) + 1

print(int(ans % mod))

Buggy submission (verdict: Runtime Error):
[n], *e = [[*map(int, t.split())] for t in open(0)]
ans = 0
mod = 10 ** 9 + 7
slope_dict = {}
for x, y in e:
    a = 2**slope_dict.get(x/y, 0)
    b = 2**slope_dict.get(-y/x, 0)
    ans = ((ans * (2 * a + b - 1) + a)/(a + b - 1)) % mod
    slope_dict[x/y] = slope_dict.get(x/y, 0) + 1

print(int(ans))

Buggy submission (verdict: Runtime Error):
[n], *e = [[*map(int, t.split())] for t in open(0)]
ans = 0
count = 0
slope_dict = {}
for x, y in e:
    count += 1
    if x/y in slope_dict:
        slope_dict[x/y] += 1
    else:
        slope_dict[x/y] = 1
    ans = ans + \
        2**(count - 1 - (0 if -y/x not in slope_dict else slope_dict[-y/x]))
print(ans)
Problem p02685 (python)

Fixed submission:
n, m, k = [int(t) for t in open(0).read().split()]
mod = 998244353
mem = [0] * max(k + 3, n + 1)
for i in range(k + 2):
    mem[i] = pow(m, i, mod)
c = 1
for i in range(k + 2, n + 1):
    mem[i] = (m * mem[i - 1] - m * c * pow(m - 1, i - k - 2, mod)) % mod
    c = (c * (i - 1) * pow(i - k - 1, - 1, mod)) % mod
print(mem[n])

Buggy submission (verdict: Runtime Error):
n, m, k = [int(t) for t in open(0).read().split()]
mod = 998244353


def solve(n):
    if n <= k + 1:
        return pow(m, n, mod)
    elif n == k + 2:
        return (pow(m, n, mod) + mod - m) % mod
    else:
        return (m * solve(n - 1) - (m - 1) * solve(n - k - 2)) % mod


print(solve(n))
Problem p02831 (python)

Fixed submission:
import fractions
a, b = map(int, input().split())
ans = a * b // fractions.gcd(a, b)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
ans = a * b // math.gcd(a, b)
print(ans)
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()

if K >= len(S):
    print(S)
else:
    print(S[:K] + '...')

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

length = len(s)
if K >= length:
    print(S)
else:
    print(S[:K] + '...')

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

length = len(s)
if K <= length:
    print(S)
else:
    print(S[:K] + '...')
Problem p02682 (python)

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

if A >= K:
    print(K)
elif A + B >= K:
    print(A)
else:
    print(A+(K-B-A)*(-1))

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

if A => K:
    print(K)
elif A + B => K:
    print(A)
else:
    print(A+(K-C)*(-1))
Problem p02659 (python)

Fixed submission:
from decimal import Decimal

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

print(int(Decimal(A*B)))

Buggy submission (verdict: Runtime Error):
,B = list(map(float, input().split()))
print(int((A*(B*1000))/1000))

Buggy submission (verdict: Runtime Error):
A,B = list(map(float, input().split()))
print(int((A*(B*100))/100)))
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
a, b = map(Decimal, input().split())
print(int(Decimal(a*b)))

Buggy submission (verdict: Runtime Error):
from decimal import *
a, b = map(decimal,input().split())
print(int(a*b))
Problem p02676 (python)

Fixed submission:
k = int(input())
s = input()
n = len(s)
     
if n <= k:
	print(s)
else:
	print(s[:k] + '...')

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

if len(S) < K:
    print(s)
else:
    print(s[:k] + "...")

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

if len(S) <= K:
    print(s)
else:
    print(s[:k] + "...")

Buggy submission (verdict: Runtime Error):
k = int(input())
s = raw_input()
n = len(s)
     
if n <= k:
	print(s)
else:
	print(s[:k] + '...')

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

if s <= k :
print(s)

else :
print(s[:k] + '...')

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

if s <= k :
print(s)

else s >= k :
print(s[:k]+'...')

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

if n <= k 
print(s)

if n >= k
print(s[:k]+'...')

Buggy submission (verdict: Runtime Error):
k = int(input())
s = intput()

if len(s) <= k 
print(s)

if len(s) >= k
print(s[:k]+'...')

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

if s <= k 
print(s)

if s >= k
print(s[:k]+'...')
Problem p02682 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
     
if a >= k:
  print(k)
elif:
  a+b >= k
  print(a)
else:
  k -= a+b
  print(a-1*k)
Problem p02689 (python)

Fixed submission:
n,m=map(int,input().split())
h=[0]+list(map(int, input().split()))
roads=[[] for _ in range(n+1)]
cnt=0
for i in range(m):
    a,b=map(int,input().split())
    roads[a].append(b)
    roads[b].append(a)

for i in range(1,n+1):
    for j in roads[i]:
        if h[i]<=h[j]:
            break
    else:
         cnt+=1
    
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
h=[0]+list(map(int, input().split()))
roads=[[] for _ in range(n+1)]
cnt=0
for i in range(m):
    a,b=map(int,input().split())
    roads[a].append(b)
    roads[b].append(a)
 
for i in range(1,n+1):
    for j in roads[i]:
        if h[i]<=h[j]:
            break
    else:
         cnt+=1
    
print(cnt

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [[] for _ in range(n)]
check = [False for _ in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  ab[a-1].append(b)
  ab[b-1].append(a)

for j in range(n):
  for k in ab[j]:
    if h[j] <= h[k]:
      check[j] = True
      
print(check.count(True))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [[] for _ in range(n)]
check = [False for _ in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  ab[a-1].append(b)
  ab[b-1].append(a)

for j in range(n):
  for k in ab[j]:
    if k < h[j]:
      check[j] = True
    elif k > h[j]:
      check[j] = False
	else:
      check[j] = False

print(check.count(True))