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

Fixed submission:
n = int(input())
ans = 0
s = [list(map(str,input().split())) for i in range(n)]
key_s = str(input())
key = 0
for t,tt in s:
  if key == 1:
    ans += int(tt)
  if t == key_s:
    key = 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
s = [list(map(str(input().split()))) for i in range(n)]
key_s = str(input())
key = 0
for _ in range(n):
  for t,tt in s:
    if key == 1:
      ans += int(tt)
    if t == key_s:
      key = 1
print(ans)
Problem p02823 (python)

Fixed submission:
n,a,b = map(int,input().split())
if abs(a-b)%2 == 0:
  print(abs(a-b)//2)
else:
  print(min((a+b-1)//2,(n-a+n-b+1)//2))

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

Fixed submission:
a,b = map(int,input().split())
ans = 0
if a == 1:ans += 300000
elif a == 2:ans += 200000
elif a == 3:ans += 100000
if b == 1:ans += 300000
elif b == 2:ans += 200000
elif b == 3:ans += 100000
if ans == 600000:ans += 400000
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = -1
num = 0
for i in range(n):
    a,b = map(int,input().split())
    ans += b
    num += a * b
    if num > 9:
        ans += num // 9
        num %= 9
        if num == 0:
            ans -= 1
            num = 9
print(ans)
Problem p02917 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
ans = lis[0] + lis[-1]
for i in range(n-2):
    ans += min(lis[i],lis[i+1])
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
ans = lis[0] + lis[-1]
for i in range(n-1):
    ans += min(lis[i],lis[i+1])
print(ans)
Problem p02923 (python)

Fixed submission:
n=int(input())
lis=list(map(int,input().split()))
an=0
ans=0
for i in range(n-1):
  if lis[i]>=lis[i+1]:
    an += 1
  else:
    ans =max(ans,an)
    an=0
ans=max(ans,an)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input)
lis=list(map(int,input().split()))
an=0
ans=0
for i in range(n-1):
  if lis[i]>=lis[i+1]:
    an += 1
  else:
    ans =max(ans,an)
    an=0
ans=max(ans,an)
print(ans)
Problem p02939 (python)

Fixed submission:
s = str(input())
n = len(s)
dp = [[0,0] for i in range(n+1)]
for i in range(n):
  for j in [1,2]:
    for k in [1,2]:
      if i + k <= n:
        a = s[i-j:i]
        b = s[i:i+k]
        if a != b:
          dp[i+k][k-1] = max(dp[i+k][k-1],dp[i][j-1]+1)
print(max(dp[n]))

Buggy submission (verdict: Runtime Error):
s = str(input())
num = len(s)
dp = [[0,0] for i in range(n+1)]
for i in range(n):
  for j in [1,2]:
    for k in [1,2]:
      if i + k <= n:
        a = s[i-j:i]
        b = s[i:i+k]
        if a != b:
          dp[i+k][k-1] = max(dp[i+k][k-1],dp[i][j-1]+1)
print(max(dp[n]))
Problem p02952 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n+1):
  if len(str(i)) % 2 == 1:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
for i in range(n-1):
  if lis[i] -1 >= lis[i+1]:
    lis[i] -= 1
for i in range(n-1):
  if lis[i] > lis[i+1]:
    print("No")
    exit()
print("Yes")
Problem p02971 (python)

Fixed submission:
n = int(input())
lis = [int(input()) for i in range(n)]
li=sorted(lis,reverse=True)
for i in range(n):
  if lis[i] == li[0]:
    print(li[1])
  else:
    print(li[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = [int(input()) for i in range(n)]
li=sort(lis,reverse=True)
for i in range(n):
  if lis[i] == lis[0]:
    print(lis[1])
  else:
    print(lis[0])
Problem p02988 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
ans = 0
for i in range(1,n-1):
  li = sorted([lis[i-1],lis[i],lis[i+1]])
  if li[1] == lis[i]:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
ans = 0
for i in range(1,n-1):
  lis = sorted([lis[i-1],lis[i],lis[i+1]])
  if lis[1] == lis[i]:
    ans += 1
print(ans)
Problem p03007 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
minus,plus = [],[]
for num in lis:
    if num >= 0:
        plus.append(num)
    elif num < 0:
        minus.append(num)
plus.sort()
minus.sort(reverse=True)
ans = []
if len(plus) == 0:
    now = minus.pop(0)
    for num in minus:
        ans.append([now,num])
        now -= num
    print(now)
elif len(minus) == 0:
    now = plus.pop(0)
    last_num = plus.pop(0)
    for num in plus:
        ans.append([now,num])
        now -= num
    ans.append([last_num,now])
    last_num -= now
    print(last_num)
else:
    now = minus.pop(0)
    last_num = plus.pop(0)
    for num in plus:
        ans.append([now,num])
        now -= num
    for num in minus:
        ans.append([last_num,num])
        last_num -= num
    ans.append([last_num,now])
    last_num -= now
    print(last_num)
for i in range(n-1):
    print(*ans[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
minus,plus = [],[]
for num in lis:
    if num >= 0:
        plus.append(num)
    elif num < 0:
        minus.append(num)
plus.sort()
minus.sort()
ans = []
if len(plus) == 0:
    now = minus.pop()
    for num in minus:
        ans.append([now,num])
        now -= num
    print(now)
elif len(minus) == 0:
    now = plus.pop()
    last_num = plus.pop()
    for num in minus:
        ans.append([now,num])
        now -= num
    ans.append([last_num,now])
    print(now)
elif len(plus) == 1:
    now = plus.pop()
    for num in minus:
        ans.append([now,num])
        now -= num
    print(now)
else:
    now = minus.pop()
    last_num = plus.pop()
    for num in plus:
        ans.append([now,num])
        now -= num
    for num in minus:
        ans.append([last_num,num])
        last_num -= num
    ans.append([last_num,now])
    last_num -= now
    print(last_num)
for i in range(n-1):
    print(*ans[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
lis.sort(reverse = True)
for i in range(n):
  if lis[i] < 0:
    lia = lis[:i]
    lib = lis[i:]
    break
  if i == n-1:
    lia = lis
    lib = []
num = 0
m = len(lia)
if m > 1:
  if m % 2 == 0:
    print(abs(sum(lia[:m//2]))-abs(sum(lia[m//2:])))-sum(lib)
    print(lia[0],lia[-1])
    num = lia[0]-lia[-1]
    for i in range(1,m//2):
      print(lia[-(i+1)],num)
      num = lia[-(i+1)]-num
      print(lia[i],num)
      num = lia[i]-num

  else:
    print(sum(lia[:m//2])-sum(lia[m//2+1:])+abs(lia[m//2]))-sum(lib)
    print(lia[-1],lia[0])
    num = lia[-1]-lia[0]
    for i in range(1,m//2):
      print(lia[i],num)
      num = lia[i]-num
      print(lia[-(i+1)],num)
      num = lia[-(i+1)]-num     
    print(lia[m//2],num)
elif m == 1:
  print(lia[0] -sum(lib))
  print(lia[0],lib[0])
  num = lia[0]-lib[0]
else:
  print(-sum(lib)+lib[0] * 2)
  num = lib[0]
for i in range(len(lib)-1):
  print(num,lib[i+1])
  num -= lib[i+1]
Problem p03014 (python)

Fixed submission:
h,w = map(int,input().split())
tate = [[0]*w for i in range(h)]
yoko = [[0]*w for i in range(h)]
s = [str(input()) for i in range(h)]

for i in range(h):
    cnt = 0
    now = 0
    for j in range(w):
        if s[i][j] == ".":
            cnt += 1
        else:
            for k in range(now,j+1):
                yoko[i][k] = cnt
            cnt = 0
            now = j+1
    for k in range(now,j+1):
        yoko[i][k] = cnt
for i in range(w):
    cnt = 0
    now = 0
    for j in range(h):
        if s[j][i] == ".":
            cnt += 1
        else:
            for k in range(now,j):
                tate[k][i] = cnt
            cnt = 0
            now = j+1
    for k in range(now,j+1):
        tate[k][i] = cnt
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans,tate[i][j]+yoko[i][j]-1)
print(ans)

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
tate = [[0]*w for i in range(h)]
yoko = [[0]*w for i in range(h)]
s = [str(input()) for i in range(h)]

for i in range(h):
    cnt = 0
    now = 0
    for j in range(w):
        if s[i][j] == ".":
            cnt += 1
        else:
            for k in range(now,cnt+1):
                yoko[i][k] = cnt
            cnt = 0
for i in range(w):
    cnt = 0
    now = 0
    for j in range(h):
        if s[j][i] == ".":
            cnt += 1
        else:
            for k in range(now,cnt+1)
                tate[k][i] = cnt
            cnt = 0
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans,tate[i][j]+yoko[i][j])
print(ans)
Problem p03032 (python)

Fixed submission:
n,k = map(int,input().split())
lis = list(map(int,input().split()))
ans = 0
for i in range(n):
    for j in range(n-i+1):
        num = lis[:i]
        if j:
            num += lis[-j:]
        if len(num) <= k:
            spell = min(len(num),k-len(num))
            num.sort()
            for l in range(spell):
                num[l] = max(0,num[l])
            ans = max(ans,sum(num))
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
lis = list(map(int,input().split()))
ans = 0
for i in range(n):
    for j in range(n-i+1):
        num = lis[:i]
        if j > 0:
            num += lis[-j:]
        if len(num) <= k:
            cnt = min(len(num),k-len(num))
            num.sort()
            for h in range(cnt):
                num[cnt] = max(0,num[cnt])
            ans = max(ans,sum(num))
print(ans)
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

n = int(input())
lis = [[] for i in range(n)]

for i in range(n-1):
    u,v,w = map(int,input().split())
    lis[u-1].append((v-1,w%2))
    lis[v-1].append((u-1,w%2))

li = [-1] * n

def calc(i,c):
    li[i] = c
    for j, w in lis[i]:
        if li[j] < 0:
            calc(j, li[i]^w)

calc(0,0)

for d in li:
    print(d)

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

for i in range(n-1):
    u,v,w = map(int,input().split())
    lis[u-1].append((v-1,w%2))
    lis[v-1].append((u-1,w%2))

li = [-1] * n

def calc(i,c):
    li[i] = c
    for j, w in lis[i]:
        if li[j] < 0:
            calc(j, li[i]^w)

calc(0,0)
for d in li:
    print(d)
Problem p03050 (python)

Fixed submission:
import math
n = int(input())
ans = 0
for i in range(1,math.floor(math.sqrt(n))+1):
    if n % i == 0:
        num = (n//i)-1
        if num > 0:
            if n // num == n % num:
                ans += num
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
ans = 0
for i in range(1,math.floor(math.sqrt(n))+1):
    if n % i == 0:
        num = (n//i)-1
        if n // num == n % num:
            ans += num
print(ans)
Problem p03078 (python)

Fixed submission:
x,y,z,k = map(int,input().split())
lisa = list(map(int,input().split()))
lisb = list(map(int,input().split()))
lisc = list(map(int,input().split()))
lisa.sort(reverse=True)
lisb.sort(reverse=True)
lisc.sort(reverse=True)
an = []
ans = []
for num in lisb:
    for nu in lisa:
        an.append(num+nu)
an.sort(reverse=True)
an = an[:min(3001,x*y*z+1)]
for num in lisc:
    for nu in an:
        ans.append(num+nu)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
x,y,z,k = map(int,input().split())
lisa = list(map(int,input().split()))
lisb = list(map(int,input().split()))
lisc = list(map(int,input().split()))
lisc.sort(reverse=True)
an,ans = [],[]
for num in lisb:for nu in lisa:an.append(num+nu)
an.sort(reverse=True)
an = an[:min(3001,x*y*z+1)]
for num in lisc:for nu in an:ans.append(num+nu)
ans.sort(reverse=True)
for i in range(k):print(ans[i])

Buggy submission (verdict: Runtime Error):
x,y,z,k = map(int,input().split())
lisa = list(map(int,input().split()))
lisb = list(map(int,input().split()))
lisc = list(map(int,input().split()))
lisa.sort(reverse=True)
lisb.sort(reverse=True)
lisc.sort(reverse=True)
an = []
ans = []
for i in range(x):
    for j in range(y):
        an.append(lisa[i]+lisb[j])
an.sort(reverse=True)
an = an[:min(3001,x*y*z+1)]
for i in range(z):
    for j in range(min(3000,x*y*z)):
        ans.append(lisc[i]+an[j])
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])
Problem p03095 (python)

Fixed submission:
lis = [1 for i in range(26)]
n = int(input())
s = str(input())
for i in range(n):
  lis[ord(s[i])-ord("a")] += 1
ans = 1
for num in lis:
  ans *= num
  ans %= 10 ** 9 + 7
print(ans-1)

Buggy submission (verdict: Runtime Error):
lis = [1 for i in range(26)]
s = str(input())
for i in range(len(s)):
  lis[ord(s[i])-ord("a")] += 1
ans = 1
for num in lis:
  ans *= num
print(ans)
Problem p03096 (python)

Fixed submission:
MOD = 10**9 + 7
N = int(input())
C = [int(input()) for _ in range(N)]
dp = [0]*(N+1)
lis = [-1] * (2 * 10**5 + 1)
dp[0] = 1
lis[C[0]] = 0
for i,c in enumerate(C[1:],1):
    prev_i = lis[c]
    dp[i] = dp[i-1]
    if prev_i != i-1:
        dp[i] += dp[prev_i]
        dp[i] %= MOD
    lis[c] = i
answer = dp[N-1]
print(answer)

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7

N = int(input())
C = [int(input()) for _ in range(N)]

dp = [0]*(N+1)
lis = [-1] * (2 * 10**5 + 1)
dp[0] = 1
lis[C[0]] = 0
for i,c in enumerate(C[1:],1):
    prev_i = c_to_i[c]
    dp[i] = dp[i-1]
    if prev_i != i-1:
        dp[i] += dp[prev_i]
        dp[i] %= MOD
    lis[c] = i

answer = dp[N-1]
print(answer)
Problem p03102 (python)

Fixed submission:
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    num = c
    lis = list(map(int,input().split()))
    for j in range(m):
        num += b[j] * lis[j]
    if num > 0:ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    num = c
    lis = list(map(int,input().split()))
    for j in range(m):
        num += b[j] * lis[i]
    if num > 0:ans += 1
print(ans)
Problem p03103 (python)

Fixed submission:
n, m = map(int, input().split())
lis = [list(map(int,input().split())) for i in range(n)]
lis.sort(key=lambda x:x[0])
ans = 0
cou = 0
num = 0
while cou < m:
    nu = min(lis[num][1], m - cou)
    cou += nu
    ans += lis[num][0] * nu
    num += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
lis = list(map(int,input().split()))
lis.sort(key = lambda x:x[1])
ans = 0
cou = 0
num = 0
while cou < m:
  nu = min(lis[num],m-cou)
  cou += nu
  ans += lis[num] * nu
  num += 1
print(ans)
Problem p03150 (python)

Fixed submission:
s = str(input())
n = len(s)
for i in range(n):
  for j in range(i,n):
    if s[:i] + s[j:] == "keyence":
      print("YES")
      exit()
print("NO")

Buggy submission (verdict: Runtime Error):
s = str(input())
n = len(s)
for i in range(n):
  for j in range(i,n):
    if s[:i] + s[k:] == "keyence":
      print("YES")
      exit()
print("NO")

Buggy submission (verdict: Runtime Error):
s = str(input())
num = len(s)
for i in range(n):
  for j in range(i,n):
    if s[:i] + s[k:] == "keyence":
      print("YES")
      exit()
print("NO")
Problem p03155 (python)

Fixed submission:
n = int(input())
h = int(input())
w = int(input())
print((n-h+1)*(n-w+1))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
lis = [str(input()) for i in range(h)]
ans = 0
ch = [[0] * w for i in range(h)]

def firstcheck(x,y):
    if lis[x][y] != "#" or ch[x][y] != 0:
        return False
    if x > 0:
        if lis[x-1][y] == ".":
            return True
    if x < h-1:
        if lis[x+1][y] == ".":
            return True
    if y > 0:
        if lis[x][y-1] == ".":
            return True
    if y < w-1:
        if lis[x][y+1] == ".":
            return True
    return False

for sx in range(h):
    for sy in range(w):
        if firstcheck(sx,sy):
            cnt = 1
            nu = 0
            ch[sx][sy] = 1
            num = [[0] * w for i in range(h)]
            now = {(sx,sy,1)}
            while len(now) != 0:
                tmp = set()
                for x,y,iro in now:
                    if x > 0:
                        if lis[x-1][y] != lis[x][y] and num[x-1][y] == 0:
                            nu += iro
                            tmp.add((x-1,y,(iro+1)%2))
                            num[x-1][y] = 1
                            if lis[x-1][y] == "#" and ch[x-1][y] == 0:
                                cnt += 1
                                ch[x-1][y] = 1
                    if x < h-1:
                        if lis[x+1][y] != lis[x][y] and num[x+1][y] == 0:
                            nu += iro
                            tmp.add((x+1,y,(iro+1)%2))
                            num[x+1][y] = 1
                            if lis[x+1][y] == "#" and ch[x+1][y] == 0:
                                cnt += 1
                                ch[x+1][y] = 1
                    if y > 0:
                        if lis[x][y-1] != lis[x][y] and num[x][y-1] == 0:
                            nu += iro
                            tmp.add((x,y-1,(iro+1)%2))
                            num[x][y-1] = 1
                            if lis[x][y-1] == "#" and ch[x][y-1] == 0:
                                cnt += 1
                                ch[x][y-1] = 1
                    if y < w-1:
                        if lis[x][y+1] != lis[x][y] and num[x][y+1] == 0:
                            nu += iro
                            tmp.add((x,y+1,(iro+1)%2))
                            num[x][y+1] = 1
                            if lis[x][y+1] == "#" and ch[x][y+1] == 0:
                                cnt += 1
                                ch[x][y+1] = 1
                now = tmp
            ans += nu * cnt
print(ans)
Problem p03160 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
ans = [10 ** 9 for i in range(n+5)]
ans[0] = 0
for i in range(n):
    if i < n-1:
        ans[i+1] = min(ans[i+1],ans[i]+abs(lis[i+1]-lis[i]))
    if i < n-2:
        ans[i+2] = min(ans[i+2],ans[i]+abs(lis[i+2]-lis[i]))
print(ans[n-1])

Buggy submission (verdict: Runtime Error):
def dp():
    n,w = map(int,input().split())
    lis = (map(int,input().split()) for i in range(n))
    
    dpp = [0] * (w + 1)
    for weight, value in lis:
        for j in range(w,weight-1,-1):
            dp = dpp[j-weight] + value
            if dpp[j] < dp:
                dpp[j] = dp
    return max(dpp)
print(dp())
Problem p03163 (python)

Fixed submission:
def dp():
    n,w = map(int,input().split())
    lis = (map(int,input().split()) for i in range(n))
    
    dpp = [0] * (w + 1)
    for weight, value in lis:
        for j in range(w,weight-1,-1):
            dp = dpp[j-weight] + value
            if dpp[j] < dp:
                dpp[j] = dp
    return max(dpp)
print(dp())

Buggy submission (verdict: Runtime Error):
def dp():
    n,w = map(int,input().split())
    lis = (map(int,input().split()) for i in range(n))
    
    dpp = [0] * (w + 1)
    for meight, value in lis:
        for j in range(w,weight-1,-1):
            dp = dpp[j-w] + value
            if dpp[j] < dp:
                dpp[j] = dp
    return max(dpp)
print(dp())
Problem p03164 (python)

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

lis = [list(map(int,input().split())) for i in range(n)]
lis.sort(key = lambda x:x[1])

dp = {0:0}

for weight ,value in lis:
    gone = dp.copy()
    for key in dp:
        gone[key+value] = min(dp[key] + weight, dp.get(key+value, float("inf")))
    dp = gone
for key in sorted(dp.keys(), reverse = True):
    if dp[key] <= w:
        print(key)
        exit()

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

lis = [list(map(int,input().split())) for i in range(n)]
lis.sort(key = lambda x:x[1])

dp = {0:0}

for weight ,value in lis:
    gone = dp.copy()
    for key in dp:
        gone[key+value] = min(dp[key] + weight, dp.get(key+v, float("inf")))
    dp = gone
for key in sorted(dp.keys(), reverse = True):
    if dp[key] <= w:
        print(key)
        exit()
Problem p03206 (python)

Fixed submission:
n = int(input())
print("Christmas" + " Eve" * (25-n))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(Christmas + " Eve" * (25-n))
Problem p03212 (python)

Fixed submission:
num = int(input())
def to3(x,n):
  if (int(x/n)):
    return to3(int(x/n),n) + str(x%n)
  return str(x%n)
ch = ["3","5","7"]
ans = 0
for i in range(3 ** len(str(num))+1):
  s = to3(i,3)
  for u in range(len(str(num))-len(s)+2):
    if u > 0:
      s = "0" + s
    k1 = 0
    k2 = 0
    k3 = 0
    ss = ""
    for j in range(len(s)):
      if s[j] == "0":k1 = 1
      elif s[j] == "1":k2 = 1
      else: k3 = 1
      ss += ch[int(s[j])]
    if k1 and k2 and k3 and int(ss) <= num:ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
def to3(x,n):
  if (int(x/n)):
    return to3(int(x/n),n) + str(x%n)
  return str(x%n)
ch = ["3","5","7"]
ans = 0
for i in range(3 ** len(str(num))+1):
  s = to3(i,3)
  for u in range(len(str(num))-len(s)+2):
    if u > 0:
      s = "0" + s
    k1 = 0
    k2 = 0
    k3 = 0
    ss = ""
    for j in range(len(s)):
      if s[j] == "0":k1 = 1
      elif s[j] == "1":k2 = 1
      else: k3 = 1
      ss += ch[int(s[j])]
    if k1 and k2 and k3 and int(ss) <= num:ans += 1
print(ans)
Problem p03214 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
li = []
num = sum(lis)/n
for i in range(n):li.append(abs(lis[i]-num))
print(li.index(min(li)))

Buggy submission (verdict: Runtime Error):
n= int(input())
lis = list(map(int,input().split())
cou = 0
num = sum(lis)/n
for i in range(n):
  lis[i] -= num
  cou = min(cou,abs(lis[i]))
for i in range(n):
  if cou == lis[i]:
    print(i)
    exit()
Problem p03227 (python)

Fixed submission:
s = str(input())
if len(s) == 2:
  print(s)
else:
  print(s[2] + s[1] + s[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
num = 1
while num * (num + 1) <= 2 * n:
  num += 1
now = n
for i in range(num,0,-1):
  if now >= i:
    print(i)
    now -= i
Problem p03228 (python)

Fixed submission:
a,b,k = map(int,input().split())
cnt = 0
while cnt < k:
  b += a//2
  a = a//2
  cnt += 1
  if cnt < k:
    a += b//2
    b = b//2
    cnt += 1
print(a,b)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
for i in range(n):
  b += a//2
  a = a//2
  a += b//2
  b = b//2
print(a,b)
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
  print("Hello World")
  exit()
else:
  a = int(input())
  b = int(input())
  print(a + b)

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = [list(map(int,input().split())) for i in range(n)]
li = []
for nu,nuu,nuuu in lis:
  if nuuu != 0:li.append([nu,nuu,nuuu])
for i in range(101):
  for j in range(101):
    s = set()
    for h in range(len(li)):
      num = abs(li[h][0]-i)+abs(li[h][1]-j)
      if num + li[h][2] < 0:
        s.add(num + li[h][2] + 1)
      s.add(num + li[h][2])
    if len(s) == 1:
      for num in s:
        print(i,j,num)