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

Fixed submission:
N,X=map(int, raw_input().split())

a,p=[1], [1]
for i in range(N):
	a.append(a[-1]*2+3)
	p.append(p[-1]*2+1)

def f(N,X):
	if N==0:
		return 0 if X<=0 else 1
	elif X<=1 + a[N-1]:
		return f(N-1,X-1)
	else:
		return p[N-1]+1+f(N-1, X-2-a[N-1])

print f(N,X)

Buggy submission (verdict: Runtime Error):
N,X=map(int, raw_input().split())

p=[1]
a=[1]
for i in range(N):
	p.append( p[-1]*2+1 )
	a.append( a[-1]*2+3 )

#print "p:::",p
#print "a::::",a

X-=1

ans=0
def f(N,X):
	global ans
#	print "f (",N ," , ", X ," ) " ,ans

	if N==0:
		if X>=-1:
			return 1
		else:
			return 0
	elif X>=a[N]/2:
		X-=(a[N-1]+2)
		ans+=p[N-1]+1
		f(N-1,X)
	elif X<a[N]/2:
		X-=(a[N-1]+2)
		ans+=f(N-1,X)

	X-=(a[1]+2)

f(N,X)

print ans
Problem p03291 (python)

Fixed submission:
S=raw_input()

M=10**9+7

all=1
abc=0
ab=0
a=0

for x in S:
	if x=="A":
		a+=all
	if x=="B":
		ab+=a
	if x=="C":
		abc+=ab

	if x=="?":
		abc=abc*3+ab
		ab=ab*3+a
		a= a*3+all
		all*=3

	abc%=M
	ab%=M
	a%=M
	all%=M


print abc%M

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

M=10**9+7

all=1
abc=0
ab=0
a=0

for x in S:
	if x=="A":
		a+=all
	if x=="B":
		ab+=a
	if x=="C":
		abc+=ab

	if x=="?":
		abc=abc*3+ab
		ab=ab*3+a
		a= a*3+all
		all*=3

	abc%=M
	ab%=M
	a%=M
	ans%=M


print abc%M
Problem p03332 (python)

Fixed submission:
N,A,B,K = map(int, raw_input().split())


mod=998244353
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, N+1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, mod-2, mod))


def ncr(n,r):
	if n < 0 or r < 0 or n < r:
		return 0
	else:
		return (fact[n] * inv_fact[r] * inv_fact[n-r]) %mod

y=0
ans=0
for x in range(N+1):
	if (K-A*x)%B==0:
		if K-A*x<0: break
		y=(K-A*x)/B
		if y>N: continue
		ans+=(ncr(N,x))%mod*(ncr(N,y))%mod

print ans%mod

Buggy submission (verdict: Runtime Error):
from math import factorial

N,A,B,K = map(int, raw_input().split())
mod=998244353

def product(iterable):
    prod = 1
    for n in iterable:
        prod *= n
    return prod

def npr(n, r):
    return product(range(n - r + 1, n + 1))

def ncr(n, r):
    if r > n // 2:
        r = n - r
    return npr(n, r) // factorial(r)

if K==0: print 1;quit()

y=0
ans=0
for x in range(1,N+1):
	if (K-A*x)%B==0:
		y=(K-A*x)/B
		ans+=(ncr(N,x))%mod*(ncr(N,y))%mod

print ans

Buggy submission (verdict: Runtime Error):
from math import factorial

N,A,B,K = map(int, raw_input().split())
mod=998244353

def product(iterable):
    prod = 1
    for n in iterable:
        prod *= n
    return prod

def npr(n, r):
    return product(range(n - r + 1, n + 1))

def ncr(n, r):
    if r > n // 2:
        r = n - r
    return npr(n, r) // factorial(r)

if K==0: print 1;quit()

y=None
ans=0
for x in range(1,N+1):
	if (K-A*x)%B==0:
		y=(K-A*x)/B
		ans+=(ncr(N,x))%mod*(ncr(N,y))%mod

print ans

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

N,A,B,K = map(int, raw_input().split())
mod=998244353

memo={}
memo[(0,0)]=1
memo[(1,A)]=1
memo[(1,B)]=1
memo[(1,A+B)]=1



def func(i,k):
	if (i,k) in memo:
		return memo[(i,k)]
	if i<=0 or k<0: return 0
	#print i-1, k-A,i-1,k-B,i-1, k-(A+B),i-1,k
	result=func(i-1, k-A)%mod+func(i-1, k-B)%mod+func(i-1, k-(A+B))%mod+func(i-1,k)%mod
	result=result%mod

	memo[(i,k)]=result
	return result


print func(N,K)
Problem p03805 (python)

Fixed submission:
import itertools
import collections
N,M=map(int,raw_input().split())
#print N,M
a=[map(int,raw_input().split()) for i in range(M)]
#print a
b=list(itertools.permutations(range(1,N+1)))
#print b

ans=0
for i in b:
	if i[0]!=1:
		continue
	c=[]
	for j in i:
		#print i,j
		if len(c)<2:
			c.append(j)

		if len(c)==2:
			if c in a or c[::-1] in a:
				cnt=1
			else:
				cnt=0
				break
			c.pop(0)
	ans+=cnt
print ans

Buggy submission (verdict: Runtime Error):
import itertools
import collections
N,M=map(int,raw_input().split())
#print N,M
a=[tuple(map(int,raw_input().split())) for i in range(N)]
#print a
b=list(itertools.combinations(a,N-1))
#print b

#print collections.Counter(b[0])

cnt=0
for i in b:
	c=[]
	for j,k in i:
		#print j,k
		c.append(j)
		c.append(k)
	#print c
	t_c=collections.Counter(c)
	t_c_v=(collections.Counter(c)).values()
	#print t_c,t_c_v
	if t_c[1]==1:
		for m in t_c_v:
			if m>=3:
				break
		else:
			cnt+=1

print cnt
Problem p02701 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C_fix
# CreatedDate:  2020-06-27 13:59:01 +0900
# LastModified: 2020-06-27 14:04:38 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    n = int(input())
    s = []
    for i in range(n):
        s.append(input())
    s = list(set(s))
    print(len(s))
        


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C_fix
# CreatedDate:  2020-06-27 13:14:18 +0900
# LastModified: 2020-06-27 13:50:05 +0900
#


def main():
    n, m = map(int, input().split())
    h = list(map(int, input().split()))
    ma = [0]*n
    for _ in range(m):
        a, b = map(int, input().split())
        ma[a-1] = max(ma[a-1], h[b-1])
        ma[b-1] = max(ma[b-1], h[a-1])
#        print(ma)
    cnt = 0
    for i in range(n):
        if ma[i] < h[i]:
            cnt += 1
    print(cnt)




if __name__ == "__main__":
    main()
Problem p02754 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-08-30 14:36:32 +0900
# LastModified: 2020-08-30 14:45:15 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    n, a, b = map(int, input().split())
    tmp = n - n // (a+b) * (a+b)
    ans = n//(a+b) * a
    if tmp <= a:
        print(ans+tmp)
    else:
        print(ans+a)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-03-07 21:21:27 +0900
# LastModified: 2020-03-07 22:31:57 +0900
#




def main():
    A,B = map(int,input().split())
    a_min = (A/0.08)
    a_max = (A+1)/0.08
    b_min = (B/0.1)
    b_max = (B+1)/0.1
    if a_min!=int(a_min):
        a_min = int(A/0.08)+1
    if b_min!=int(b_min):
        b_min = int(B/0.1)+1
    s_a = [i for i in range(int(a_min),int(a_max))]
    s_b = [i for i in range(int(b_min),int(b_max))]
    for common in s_a:
        if common in s_b:
            print(common)
            return
    print(-1)


if __name__ == "__main__":
    main()
Problem p03775 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-06-26 16:16:00 +0900
# LastModified: 2020-06-26 19:11:55 +0900
#


import os
import sys
from math import sqrt
# import numpy as np
# import pandas as pd


def F(a, b):
    if len(str(a)) > len(str(b)):
        print(len(str(a)))
    else:
        print(len(str(b)))


def main():
    n = int(input())
    for i in range(int(sqrt(n)+1), -1, -1):
        if n % i == 0:
            a = i
            b = n//i
#            print(a,b)
            F(a, b)
            break


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math
def main():
    N = int(input())
    count = 0
    for i in range(1,int(math.sqrt(N))):
        if N%i==0:
            iremono = i

    print(len(str(N//iremono)))
    

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

Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))

Buggy submission (verdict: Runtime Error):
I = map(int, input().split())
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
list1 = [1] * (n)
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:
        list1[a - 1] = 0
    if h[a - 1] < h[b - 1]::
        list1[b - 1] = 0
print(sum(list1))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
list1 = [1] * (n)
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:
        list1[a - 1] = 0
    if:
        list1[b - 1] = 0
print(sum(list1))

Buggy submission (verdict: Runtime Error):
import itertools
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
list1 = [] #あって    眺めがいい
list2 = [] #ない     道が通ってる
list3 = [x for x in range(1,n+1)]
list4 = []
for i in range(m):
    a,b = map(int,input().split())
    list2.append(a)
    list2.append(b)
    if h[a-1] > h[b-1]:
        list1.append(a)
    else:
        list1.append(b)
list1 = list(set(list1))
list2 = list(set(list2))
for i in range(n):
    if list2[i] not in list3:
        list4.append(list2[i])

print(len(list1)+len(list4))
Problem p02725 (python)

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

s = list(map(int, input().split()))
longest = 0
for i in range(n - 1):
    long = s[i + 1] - s[i]
    if long > longest:
        longest = long
if longest >= k - s[n - 1] + s[0]:
    print(k - longest)
else:
    print(s[n - 1] - s[0])

Buggy submission (verdict: Runtime Error):
    k,n = map(int,input().split())
     
    s = list(map(int,input().split()))
    longest = 0
    for i in range(n-1):
        long = s[i+1] - s[i]
        if long > longest:
            longest = long
    if longest >= k - s[n-1] + s[0]:
        print(k - longest)
    else:
        print(s[n-1] - s[0])
Problem p02729 (python)

Fixed submission:
import math
n,m = map(int,input().split())
n2 = n*(n-1)/2
m2 = m*(m-1)/2

print(round(n2+m2))

Buggy submission (verdict: Runtime Error):
n,m = import math
n,m = map(int,input().split())
print(math.factorial(n)+math.factorial(m))
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ans = [0]*n
for i in range(m):
  s,c = map(int,input().split())
  if ans[s-1] != 0 and ans[s-1] != c:
    print(-1)
    exit()
  elif n != 1 and s == 1 and c == 0:
    print(-1)
    exit()
  else:
    ans[s-1] = c
ans_f = "".join((map(str,ans)))
if n>1 and ans_f[0] == "0":
  print("1"+ans_f[1::])
else:
  print(ans_f)
Problem p02771 (python)

Fixed submission:
abc = list(map(int, input().split()))
a = len(set(abc))
if len(set(abc)) == 2:
    print("Yes")
    exit()
print("No")

Buggy submission (verdict: Runtime Error):
abc = map(int,input().split())
if len(abc) == len(set(abc)):
  print("No")
  exit()
print("Yes")abc = list(map(int, input().split()))
if len(abc) == len(set(abc)):
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")
Problem p02790 (python)

Fixed submission:
a,b = map(int,input().split())
if a>b:
  print(str(b)*a)
else:
  print(str(a)*b)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a>b:
  print(str(b)*a)a,b = map(int,input().split())
if a>b:
  print(str(b)*a)
else:
  print(str(a)*b)
Problem p02831 (python)

Fixed submission:
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
a,b = map(int,input().split())

print(lcm(a, b))

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

print(lcm(a, b))

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

print(lcm(a, b))

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

print(lcm(a, b))
Problem p02835 (python)

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

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

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

Buggy submission (verdict: Runtime Error):
a = int(input())
priint(a*a)
Problem p02860 (python)

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

if n % 2 == 0:
    n //= 2
else:
    print("No")
    exit()
s2 = s[n:]
for i in range(n):
    if s[i] != s2[i]:
        print("No")
        exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
if n==1:
    print("No")
    exit()

if n % 2 == 0:
    n //= 2
else:
    n = n // 2 + 1
s2 = s[n:]
for i in range(n):
    if s[i] != s2[i]:
        print("No")
        exit()
print("Yes")
Problem p02970 (python)

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

ans = n / (2 * d + 1)
if ans == int(ans):
    print(int(ans))
    exit()
else:
    print(int(ans) + 1)
    exit()

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

for i in range(1,21):
  if (i - d) == 1:
    num = i + d
    ans = n / num 
    if ans = int(ans):
      print(ans)
    else:
      print(ans+1)

Buggy submission (verdict: Runtime Error):
n,d = map(unt,input().split())

for i in range(1,21):
  if (i - d) == 1:
    num = i + d
    ans = n / num 
    if ans = int(ans):
      print(ans)
    else:
      print(ans+1)
Problem p03073 (python)

Fixed submission:
s = input()
pattern1 = 0
pattern2 = 0
for i in range(len(s)):
  if i %2 == 0:
    if s[i] == "0":
      pattern1 += 1
    else:
      pattern2 += 1
  else:
    if s[i] == "0":
      pattern2 += 1
    else:
      pattern1 += 1
print(min(pattern1,pattern2))

Buggy submission (verdict: Runtime Error):
s = input()
pattern1 = 0
patetrn2 = 0
for i in range(len(s)):
  if i %2 == 0:
    if s[i] == "0":
      pattern1 += 1
    else:
      patetrn2 += 1
  else:
    if s[i] == "0":
      pattern2 += 1
    else:
      patetrn1 += 1
print(min(patetrn1,patetrn2))
Problem p03803 (python)

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

if a > b :
    if b == 1:
        print("Bob")
    else:
        print("Alice")
elif a <b :
    if a==1:
        print("Alice")
    else:
        print("Bob")
else:
    print("Draw")

Buggy submission (verdict: Runtime Error):
if a > b :
    if b == 1:
        print("Bob")
    else:
        print("Alice")
    print("Alice")
elif a <b :
    if a==1:
        print("Alice")
    else:
        print("Bob")
else:
    print("Draw")
Problem p02571 (python)

Fixed submission:
s = list(input())
t = list(input())
ans = []
if len(s)-len(t) == 0:
  an = 0
  for j in range(len(t)):
      if s[j] == t[j]:
        an += 1
  print(len(t)-an)
else:
  for i in range(len(s)-len(t)):
    ans.append(0)
    for j in range(len(t)):
      if s[i+j] == t[j]:
        ans[i] += 1
  print(len(t) - max(ans))

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())
ans = []
for i in range(len(s)-len(t)):
  ans.append(0)
  for j in range(len(t)):
    if s[i+j] == t[j]:
      ans[i] += 1
print(len(t) - max(ans))
Problem p02594 (python)

Fixed submission:
x = int(input())
if x >= 30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import sys
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
if k ==0:
  print(max(a))
  sys.exit()
def check(t):
  ans = 0
  if t==0:
    return False
  for aa in a:
    if aa > t:
      ans += aa//t
  return ans <= k
max = 10**9+1
min = 0
while max-min>1:
  mid = (max+min)//2
  if check(mid):
    max = mid
  else:
    min = mid
print(math.ceil(max))

Buggy submission (verdict: Runtime Error):
import sys
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
if k ==0:
  print(max(a))
  sys.exit()
def check(t):
  ans = 0
  for aa in a:
    if aa > t:
      ans += aa//t
  if ans > k:
    return False
  else:
    return True
max = 10**9
min = 0
while max-min>1:
  mid = (max+min)/2
  if check(mid):
    max = mid
  else:
    min = mid
print(math.ceil(max))
Problem p02596 (python)

Fixed submission:
import sys
k = int(input())
d = 0
for i in range(k+1):
  d = (10*d) + 7
  d %= k
  if d == 0:
    print(i+1)
    sys.exit()
print(-1)

Buggy submission (verdict: Runtime Error):
k = int(input())
i = 1
if a%2 ==1:
    while True:
        s = 0
        for j in range(i):
            s += (10**j)*7
        if s % k == 0:
            print(i)
            break
        i += 1
else:
    print(-1)
Problem p02891 (python)

Fixed submission:
import math
S = list(input())
K = int(input())
s = S * 2
c1 = 0
c2 = 0
for i in range(len(s)-1):
    if s[i+1] == s[i]:
        if i < len(S)-1:
            c1 += 1
        c2 += 1
        s[i+1] = 0
c = S[0]
for s in S:
    if s != c:
        print(c1+(c2-c1)*(K-1))
        exit()
print(math.floor(len(S)*K/2))

Buggy submission (verdict: Runtime Error):
    import math
    S = list(input())
    K = int(input())
    s = S * 2
    c1 = 0
    c2 = 0
    for i in range(len(s)-1):
        if s[i+1] == s[i]:
            if i < len(S)-1:
                c1 += 1
            c2 += 1
            s[i+1] = 0
    c = S[0]
    for s in S:
        if s != c:
            print(c1+(c2-c1)*(K-1))
            exit()
    print(math.floor(len(S)*K/2))

import math
S = list(input())
K = int(input())
s = S * 2
c1 = 0
c2 = 0
for i in range(len(s)-1):
    if s[i+1] == s[i]:
        if i < len(S)-1:
            c1 += 1
        c2 += 1
        s[i+1] = 0
c = S[0]
for s in S:
    if s != c:
        print(c1+(c2-c1)*(K-1))
        exit()
print(math.floor(len(S)*K/2))
Problem p02766 (python)

Fixed submission:
N,K=map(int,input().split())
def B(X, n):
    if (int(X/n)):
        return B(int(X/n), n)+str(X%n)
    return str(X%n)
print(len(B(N,K)))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
def B(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
print(len(B(N,K)))
Problem p02881 (python)

Fixed submission:
N=int(input())
for i in reversed(range(int(N**0.5)+1)):
    if N % i == 0:
        print(int(i+N//i-2))
        break

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
for i in reversed(range(int(math.sqrt(N)))):
    if N % i == 0:
        a=i
        break
print(int(a+int(N/a)-2))

Buggy submission (verdict: Runtime Error):
N=int(input())
for i in reversed(range(int(N**0.5))):
    if N % i == 0:
        a=i
        break
print(int(a+int(N/a)-2))

Buggy submission (verdict: Runtime Error):
N=int(input())
for i in reversed(range(int(N**0.5))):
    if N % i == 0:
        a=i
        break
print(int(a+(N/a)-2))
Problem p02834 (python)

Fixed submission:
from collections import deque
N, u, v = map(int, input().split())

G = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = map(int, input().split())
    G[a].append(b)
    G[b].append(a)


def bfs(s):
    dist = [-1] * (N + 1)
    dist[s] = 0
    d = deque([s])
    while len(d) > 0:
        v = d.popleft()
        for w in G[v]:
            if dist[w] < 0:
                dist[w] = dist[v] + 1
                d.append(w)
    return dist


tkhs = bfs(u)
aok = bfs(v)
ans = 0
for i in range(1, N + 1):
    if tkhs[i] < aok[i]:
        ans = max(ans, aok[i] - 1)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
N, u, v = map(int, input().split())

G = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = map(int, input().split())
    edge[a].append(b)
    edge[b].append(a)


def bfs(s):
    dist = [-1] * (N + 1)
    dist[s] = 0
    d = deque([s])
    while len(d) > 0:
        v = d.popleft()
        for w in edge[v]:
            if dist[w] < 0:
                dist[w] = dist[v] + 1
                d.append(w)
    return dist


tkhs = bfs(u)
aok = bfs(v)
ans = 0
for i in range(1, N + 1):
    if tkhs[i] < aok[i]:
        ans = max(ans, aok[i] - 1)
print(ans)
Problem p02578 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
step=0
for i in range(n-1):
  if a[i]>a[i+1]:
    step+=a[i]-a[i+1]
    a[i+1]=a[i]
print(step)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
step=0
for i in range(n-1):
  if a[i]>a[i+1]:
    humi+=a[i]-a[i+1]
    a[i+1]=a[i]
print(step)
Problem p02676 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
K=input()
if len(k)<=n:
  print(k)
else:
  a=k[0:n+1]
  print(a+"...")
Problem p02819 (python)

Fixed submission:
n=int(input())
for i in range(n,10**6):
  for j in range(2,int(i**0.5)+1):
    if i%j==0:
      break
  else:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
for i in range(n,10**6):
  for j in range(2,int(math.sqrd(i**0.5))+1):
    if i%j==0:
      break
  else:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==2:
    print(n)
else:
    cost=0
    for i in range(n,10**6):
        for j in range(2,int(i**0.5))+1):
            if i%j==0:
                cost+=1
        if cost==0:
            print(i)
            break

Buggy submission (verdict: Runtime Error):
from sympy import nextprime
n=int(input())
print(nextprime(n))

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(n,10**5):
  for j in range(2,10*5):
	if i%j==0:
      print(i)
      quit()
Problem p02935 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
v.sort(key=int)
for i in range(n-1):
  z=(v[i]+v[i+1])/2
  v[i]=z
  v[i+1]=z
print(v[n-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
v.sort(key=int)
for i in range(n-1):
  z=(v[i]+v[i+1])/2
  v[i]=z
  v[i+1]=z
print(v[n])