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

Fixed submission:
import fractions

n = int(input())
aList = list(map(int, input().split()))

def gcd3(nums):
    ans1 = fractions.gcd(nums[0], nums[1])
    ans2 = fractions.gcd(nums[0], nums[2])
    ans3 = fractions.gcd(nums[1], nums[2])

    if ans1 >= ans2 and ans1 >= ans3:
        return ans1, nums[2]
    if ans2 >= ans1 and ans2 >= ans3:
        return ans2, nums[1]
    if ans3 >= ans1 and ans3 >= ans2:
        return ans3, nums[0]

ans = 0
if n == 2:
    ans = max(aList)
else:
    sList = []
    sList.append(aList.pop(0))
    sList.append(aList.pop(0))
    sList.append(aList.pop(0))
    ans, v = gcd3(sList)

    for i in range(len(aList)):
        tmp = aList.pop(0)
        tmp1 = fractions.gcd(ans, v)
        tmp2 = fractions.gcd(ans, tmp)
        if tmp1 >= tmp2:
            ans = tmp1
            v = tmp
        else:
            ans = tmp2

print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
aList = list(map(int, input().split()))

def gcd(numbers):
    return reduce(math.gcd, numbers)

ans = 0
if n == 2:
    ans = max(aList)
else:
    for i in range(0,n):
        tmp = aList.pop(0)
        r = gcd(aList)
        if ans < r:
            ans = r
        aList.append(tmp)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
aList = list(map(int, input().split()))

def gcd(numbers):
    return reduce(math.gcd, numbers)

ans = 0
if n == 2:
    ans = max(aList)
else:
    for i in range(0,n-1):
        tmp = aList.pop(0)
        r = gcd(aList)
        if ans < r:
            ans = r
        aList.append(tmp)

print(ans)
Problem p03069 (python)

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

white=S.count(".")
countb=0
ans=white

for i in range (len(S)):
  if S[i]==".":
    white -=1
  else:
    countb +=1 
  ans=min(ans, countb+white)

print(ans)

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

count=S.count(".")
first=S.index("#")

print(count-first) if "#" in S else print(N)
Problem p03076 (python)

Fixed submission:
S = []
for _ in range(5):
    S.append(int(input()))

q=[] #quotient
r=[] #reminder
count0=0 #余りが0の時を検出
for i in S:
  j, k= divmod(i, 10)
  q.append(j)
  if k==0:
    count0+=1
  else:
    r.append(k)

# sum(q)*10→商をベースに基本値を算出
# 10*(4-count0)→余り分の待ち時間を算出。ただし、余り0の場合には待ち時間なし
# min(r)→最も余りが短い料理を最後に注文する
# 最初、すべてが0になる場合を想定できていなかったので、REになった
if count0==5:
  print(sum(S))
else:
  print(sum(q)*10+10*(4-count0)+min(r))

Buggy submission (verdict: Runtime Error):
S = []
for _ in range(5):
    S.append(int(input()))

q=[] #quotient
r=[] #reminder
count0=0 #余りが0の時を検出
for i in S:
  j, k= divmod(i, 10)
  q.append(j)
  if k==0:
    count0+=1
  else:
    r.append(k)

# sum(q)*10→商をベースに基本値を算出
# 10*(4-count0)→余り分の待ち時間を算出。ただし、余り0の場合には待ち時間なし
# min(r)→最も余りが短い料理を最後に注文する
print(sum(q)*10+10*(4-count0)+min(r))
Problem p03998 (python)

Fixed submission:

#他人の答えの写経
dic = {k: list(input()) for k in "abc"}

s ="a"

while dic[s]:
  s=dic[s].pop(0)

print(s.upper())

Buggy submission (verdict: Runtime Error):
#人の回答を写経したもの
dic = {k: list(input()) for k in "abc"}

while dic[s]:
  s=dic[s].pop(0)

print(s.upper())
Problem p04043 (python)

Fixed submission:
abc = list(map(int, input().split()))
abc.sort()
print('YES' if [5, 5, 7]==abc else 'NO')

Buggy submission (verdict: Runtime Error):
length=list(map(int, input().split()))
lenght.sort()
print ("Yes" if length==[5,5,7] else "No")
Problem p03061 (python)

Fixed submission:
import fractions
 
n = int(input())
li = list(map(int,input().split()))
 
leftgcd = [0 for i in range(n)]
rightgcd = [0 for i in range(n)]
 
leftgcd[0] = li[0]
rightgcd[n - 1] = li[n - 1]
 
if n == 2:
  print(max(li[0], li[1]))
else:
  for j in range(1, n):
    leftgcd[j] = fractions.gcd(li[j], leftgcd[j - 1])
    rightgcd[n - 1 - j] = fractions.gcd(li[n - 1 - j], rightgcd[n - j])
 
  ans = max(leftgcd[n - 2], rightgcd[1])
  for k in range(1, n - 1):
    g = fractions.gcd(leftgcd[k - 1], rightgcd[k + 1])
    if g > ans:
      ans = g
  print(ans)

Buggy submission (verdict: Runtime Error):
import math
 
n = int(input())
li = list(map(int,input().split()))
 
leftgcd = [0 for i in range(n)]
rightgcd = [0 for i in range(n)]
 
leftgcd[0] = li[0]
rightgcd[n - 1] = li[n - 1]
 
if n == 2:
  print(max(li[0], li[1]))
else:
  for j in range(1, n):
    leftgcd[j] = math.gcd(li[j], leftgcd[j - 1])
    rightgcd[n - 1 - j] = math.gcd(li[n - 1 - j], rightgcd[n - j])

  ans = max(leftgcd[n - 2], rightgcd[1])
  for k in range(1, n - 1):
    g = math.gcd(leftgcd[k - 1], rightgcd[k + 1])
    if g > ans:
      ans = g
  print(ans)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
li = list(map(int,input().split()))

leftgcd = [0 for i in range(n)]
rightgcd = [0 for i in range(n)]

leftgcd[0] = li[0]
rightgcd[n - 1] = li[n - 1]

for j in range(1, n):
  leftgcd[j] = math.gcd(li[j], leftgcd[j - 1])
  rightgcd[n - 1 - j] = math.gcd(li[n - 1 - j], rightgcd[n - j])
  
ans = max(leftgcd[n - 2], rightgcd[1])
for k in range(1, n - 1):
  g = math.gcd(leftgcd[k - 1], rightgcd[k + 1])
  if g > ans:
    ans = g
print(ans)
Problem p03087 (python)

Fixed submission:
n, q = map(int,input().split())
s = input()
inputlist = []
for i in range(q):
  inputlist.append(list(map(int,input().split())))

aclist = []
acnum = 0
for j in range(n - 1):
  if s[j] == "A" and s[j + 1] == "C":
    aclist.append(j)
    acnum += 1
if acnum == 0:
  for i in range(q):
    print(0)
else:
  rightac = []
  acindex = 0
  for j2 in range(n):
    if j2 == aclist[acindex] + 1:
      acindex = min(acindex + 1, len(aclist) - 1)
      acnum -= 1
    rightac.append(acnum)

  anslist = []
  for k in range(q):
    ans = rightac[inputlist[k][0] - 1] - rightac[inputlist[k][1] - 1]
    anslist.append(ans)

  print(*anslist, sep = "\n")

Buggy submission (verdict: Runtime Error):
n, q = map(int,input().split())
s = input()
inputlist = []
for i in range(q):
  inputlist.append(list(map(int,input().split())))

aclist = []
acnum = 0
for j in range(n - 1):
  if s[j] == "A" and s[j + 1] == "C":
    aclist.append(j)
    acnum += 1
rightac = []
acindex = 0
for j2 in range(n):
  if j2 == aclist[acindex] + 1:
    acindex = min(acindex + 1, len(aclist) - 1)
    acnum -= 1
  rightac.append(acnum)

anslist = []
for k in range(q):
  ans = rightac[inputlist[k][0] - 1] - rightac[inputlist[k][1] - 1]
  anslist.append(ans)

print(*anslist, sep = "\n")
Problem p03088 (python)

Fixed submission:
n = int(input())
dp = [{} for i in range(n + 1)]
s = "AGCT"
M = 10 ** 9 + 7
 
for j in range(n + 1):
  for c1 in s:
    for c2 in s:
      for c3 in s:
        dp[j][c1 + c2 + c3] = 0
 
dp[0]["TTT"] = 1
 
for l in range(n):
  for c1 in s:
    for c2 in s:
      for c3 in s:
        for p in s:
          if c2 == "A" and c3 == "G" and p == "C":
            continue
          if c1 == "A" and c3 == "G" and p == "C":
            continue
          if c1 == "A" and c2 == "G" and p == "C":
            continue
          if c2 == "G" and c3 == "A" and p == "C":
            continue
          if c2 == "A" and c3 == "C" and p == "G":
            continue
          dp[l + 1][c2 + c3 + p] += dp[l][c1 + c2 + c3]
          dp[l + 1][c2 + c3 + p] = dp[l + 1][c2 + c3 + p] % M
 
ans = 0
for c1 in s:
  for c2 in s:
    for c3 in s:
      ans += dp[n][c1 + c2 + c3]
      ans = ans % M
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
dp = [{} for i in range(n + 1)]
s = "AGCT"

for c1 in s:
  for c2 in s:
    for c3 in s:
      dp[0][c1 + c2 + c3] = 0

dp[0]["TTT"] = 1

for l in range(n):
  for c1 in s:
    for c2 in s:
      for c3 in s:
        for p in s:
          if c2 == "A" and c3 == "G" and p == "C":
            continue
          if c1 == "A" and c3 == "G" and p == "C":
            continue
          if c1 == "A" and c2 == "G" and p == "C":
            continue
          if c2 == "G" and c3 == "A" and p == "C":
            continue
          if c2 == "A" and c3 == "C" and p == "G":
            continue
          dp[j + 1][c2 + c3 + p] += dp[j][c1 + c2 + c3]

ans = 0
for c1 in s:
  for c2 in s:
    for c3 in s:
      ans += dp[n][c1 + c2 + c3]
print(ans)
Problem p03103 (python)

Fixed submission:
n, m = map(int,input().split())
drink = []
for i in range(n):
  drink.append(list(map(int,input().split())))
sorteddrink = sorted(drink, key = lambda x:x[0])

count = 0
cost = 0
index = 0

while True:
  if index > n - 1:
    break
  if count + sorteddrink[index][1] > m:
    break
  cost += sorteddrink[index][0] * sorteddrink[index][1]
  count += sorteddrink[index][1]
  index += 1

if index <= n - 1:
  cost += sorteddrink[index][0] * (m - count)
print(cost)

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
drink = []
for i in range(n):
  drink.append(list(map(int,input().split())))
sorteddrink = sorted(drink, key = lambda x:x[0])

count = 0
cost = 0
index = 0

while True:
  if index > n - 1:
    break
  if count + sorteddrink[index][1] > m:
    break
  cost += sorteddrink[index][0] * sorteddrink[index][1]
  count += sorteddrink[index][1]
  index += 1

cost += sorteddrink[index][0] * (m - count)
print(cost)

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
drink = []
for i in range(n):
  drink.append(list(map(int,input().split())))
sorteddrink = sorted(drink, key = lambda x:x[0])

count = 0
cost = 0
index = 0

while True:
  if count + sorteddrink[index][1] > m:
    break
  cost += sorteddrink[index][0] * sorteddrink[index][1]
  count += sorteddrink[index][1]
  index += 1
  
cost += sorteddrink[index][0] * (m - count)
print(cost)
Problem p03110 (python)

Fixed submission:
n = int(input())
money = []
tuka = []
for i in range(n):
    li = input().split()
    money.append(float(li[0]))
    tuka.append(li[1])

ans = 0
for j in range(n):
    if tuka[j] == "JPY":
        ans += money[j]
    else:
        ans += 380000 * money[j]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
money = []
tuka = []
for i in range(n):
  li = input().split()
  money.append(int(li[0]))
  tuka.append(li[1])
  
ans = 0
for j in range(n):
  if tuka[j] == "JPY":
    ans += money[j]
  else:
    ans += 380000 * money[j]
print(ans)
Problem p03074 (python)

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

from itertools import groupby, accumulate

def gen(s):
  if s[:1] == '0':
  	yield 0
  for ke, g in groupby(s):
    yield len(list(g))
  if s[-1:] == '0':
    yield 0


mc = 0
acc = list(accumulate(gen(s)))
r = 2 * k + 1
if len(acc) < r:
  mc = n
else:
  for i in range(0, len(acc)-r+1, 2):
    if i == 0:
      mc = max(mc, acc[i+r-1])
    else:
      mc = max(mc, acc[i+r-1] - acc[i-1])
print(mc)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
t = ''

if s[0] == '0':
  t += '0'
c = 1
for i in range(1, n):
  if s[i-1] == '0' and s[i] == '0':
    c += 1
  if s[i-1] == '1' and s[i] == '0':
    t += str(c)
    c = 1
  if s[i-1] == '0' and s[i] == '1':
    t += str(c)
    c = 1
  if s[i-1] == '1' and s[i] == '1':
    c += 1
t += str(c)
t = list(map(int, t))
print(t)

# 範囲
r = 2 * k + 1
gs = []
for i in range(0,n,2):
  if i + r < n:
    gs.append(sum(t[i:i+r]))
print(max(gs))
Problem p03160 (python)

Fixed submission:
N = int(input())
H = [0] + list(map(int, input().split()))

DP = [0] * (N+1)
for i in range(2, N+1):
  dp = DP[i-1] + abs(H[i-1] - H[i])
  if i > 2:
    dp = min(dp, DP[i-2] + abs(H[i-2] - H[i]))
  DP[i] = dp
print(DP[N])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = [0] + list(map(int, input().split()))

DP = [0] * (N+1)

for i in range(2, N+1):
  s = []
  for j in range(1, K+1):
    if i > j:
      dp = DP[i-j] + abs(H[i-j] - H[i])
      s.append(dp)
  DP[i] = min(s)
print(DP[N])
Problem p03164 (python)

Fixed submission:
import sys
input = sys.stdin.readline

def dp_fn():
  N, W = map(int, input().split())
  WV = (map(int, input().split()) for _ in range(N))
  
  DP = {0:0}
  
  for w, v in WV:
    keys = sorted(DP.keys(), reverse=True)
    for i in keys:
      j = DP[i]
      if j+w <= W:
        if i+v in DP:
          DP[i+v] = min(DP[i+v], j+w)
        else:
          DP[i+v] = j+w
  return max(DP.keys())
  
print(dp_fn())

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
WV = (map(int, input().split()) for _ in range(N))

DP = [0] * (W+1)

for w, v in WV:
  for j in range(W, w-1, -1):
    dp = DP[j-w] + v 
    if DP[j] < dp:
      DP[j] = dp
print(max(DP))
Problem p03385 (python)

Fixed submission:
S = list(input().strip())

b = all(i in S for i in 'abc')
print(b and 'Yes' or 'No')

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

L = list(range(A,B+1))
L = sorted(list(set(L[:K])|set(L[-K:])))
print(*L, sep='\n')
Problem p03062 (python)

Fixed submission:
n = int(input())
num = list(map(int,input().split()))
numabs = [abs(i) for i in num]
cnt = 0           
for i in num :
    if i < 0 :
        cnt += 1

if cnt % 2 == 0 :
    print(sum(numabs))

if cnt % 2 == 1 :
    print(sum(numabs) - 2*min(numabs))

Buggy submission (verdict: Runtime Error):
n = int(input())
num = list(map(int,input().split()))
numabs = [abs(i) for i in num]
cnt = 0    
negative = []        
for i in num :
    if i < 0 :
        cnt += 1
        negative.append()

if cnt % 2 == 0 :
    print(sum(numabs))

if cnt % 2 == 1 :
    print(sum(numabs)-2*max(negative))

Buggy submission (verdict: Runtime Error):
n = int(input())
num = list(map(int,input().split()))
numabs = [abs(i) for i in num]
cnt = 0    
negative = []        
for i in num :
    if i < 0 :
        cnt += 1
        negtive.append()

if cnt % 2 == 0 :
    print(sum(numabs))

if cnt % 2 == 1 :
    print(sum(numabs)-2*max(negative))
Problem p03109 (python)

Fixed submission:
s = input()
if int(s[5]) == 0 and int(s[6]) <= 4 :
    print('Heisei')
else :
    print('TBD')

Buggy submission (verdict: Runtime Error):
S = input()
if int(s[5]) == 0 and int(s[6]) <= 4 :
    print('Heisei')
else :
    print('TBD')
Problem p03238 (python)

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

Buggy submission (verdict: Runtime Error):
n = input()
if n == '1' :
    print('Hello World')
else :
    a,b = map(int,input().split())
    print(a+b)

Buggy submission (verdict: Runtime Error):
n = input()
if n == '1' :
    print('Helli World')
else :
    a,b = map(int,input().split())
    print(a+b)
Problem p03260 (python)

Fixed submission:
a,b = map(int,input().split())
if (a*b)%2 == 1 :
    print('Yes')
else :
    print('No')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
for i in range(1,4) :
    if (a*b*c)%2 == 1 :
        print('Yes')
    else :
        print('No')
Problem p03264 (python)

Fixed submission:
a = int(input())
if a%2  == 0 :
    print(int(a**2/4))
else :
    print(int((a+1)/2*(a-1)/2))

Buggy submission (verdict: Runtime Error):
a = int(input())
if a%2  == 0 :
    print(a**2)
else :
    prin((a+1)/2*(a-1)/2)
Problem p03288 (python)

Fixed submission:
a = int(input())
if a < 1200 :
    print('ABC')
elif a >= 1200 and a < 2800 :
    print('ARC')
else :
    print('AGC')

Buggy submission (verdict: Runtime Error):
a = int(input())
if a < 1200 :
    prunt('ABC')
elif a >= 1200 and a < 2800 :
    print('ARC')
else :
    print('AGC')
Problem p03292 (python)

Fixed submission:
n = list(map(int,input().split()))
n.sort()
print(n[2]-n[0])

Buggy submission (verdict: Runtime Error):
n = list(map(input().split()))
n.sort()
print(int(n[2])-int(n[0]))

Buggy submission (verdict: Runtime Error):
n = list(input())
n.sort()
print(int(n[2])-int(n[0]))

Buggy submission (verdict: Runtime Error):
n = input()
n.sort()
print(int(n[2])-int(n[0]))
Problem p03352 (python)

Fixed submission:
X = int(input())
x = int(X**0.5)
num = []
if X <= 3 :
    print(1)
else :
    for b in range(2,x+1) :
        p = 2
        while b**p <= X :
            p += 1
        num.append(b**(p-1))
    print(max(num))

Buggy submission (verdict: Runtime Error):
X = int(input())
x = int(X**0.5)
num = []
for b in range(2,x+1) :
    p = 2
    while b**p <= X :
        p += 1
    num.append(b**(p-1))
print(max(num))
Problem p03360 (python)

Fixed submission:
a,b,c = map(int,input().split())
k = int(input())
x = max(a,b,c)
print(x*(2**k) + a + b + c - x)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
k = int(input())
x = map(a,b,c)
print(x*(2**k) + a + b + c - x)
Problem p03477 (python)

Fixed submission:
A,B,C,D = map(int,input().split())
if A + B > C + D :
    print('Left')
elif A + B == C + D :
    print('Balanced')
else :
    print('Right')

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,input(),split())
if A + B > C + D :
    print('Left')
elif A + B == C + D :
    print('Balanced')
else :
    print('Right')
Problem p03501 (python)

Fixed submission:
n,a,b = map(int,input().split())
print(min(n*a,b))

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input()split())
print(min(n*a,b))
Problem p03606 (python)

Fixed submission:
N  = int(input())
a = 0
for i in range(N):
    l, r = map(int, input().split())
    a += r - l + 1
print(a)

Buggy submission (verdict: Runtime Error):
N  = int(input())
a = 0
for i in range(N):
    l, r = map(int, input().split())
    ans += r - l + 1
print(a)
Problem p03694 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
print(a[n-1]-a[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split())
a.sort()
print(a[n-1]-a[0])
Problem p03076 (python)

Fixed submission:
T = []
for i in range(5):
    T.append(input())
tmp = []
for i in range(5):
    tmp.append(int(T[i][-1]))
T2 = []
for i in range(5):
    if tmp[i] != 0:
        T2.append(int(T[i]) + 10 - tmp[i])
    else:
        T2.append(int(T[i]))
ans = []
for i in range(5):
    if tmp[i] != 0:
        ans.append(sum(T2) - 10 + tmp[i])
    else:
        ans.append(sum(T2))
    
    
    
    

print(min(ans))

Buggy submission (verdict: Runtime Error):
T = []
for i in range(5):
    T.append(input())
tmp = []
for i in range(5):
    tmp.append(int(T[i][-1]))
ans = []
for i in range(5):
    if 0 < tmp[i] and tmp[i] <= 5:
        ans.append(i)

lastidx = tmp.index(min([tmp[x] for x in ans]))

sum_ = 0
for i in range(5):
    if tmp[i] == 0:
        sum_ += int(T[i])
    else:
        sum_ += (int(T[i]) + 10 - tmp[i])
print(sum_ - 10 + tmp[lastidx])

Buggy submission (verdict: Runtime Error):
T = []
for i in range(5):
    T.append(input())
tmp = []
for i in range(5):
    tmp.append(10 - int(T[i][-1]))
minlist = []
for i in range(5):
    if tmp[i] > 4:
        minlist.append(tmp[i])
    else:
        minlist.append(10)
last = tmp.index(min(minlist))
tmp2 = [0 if x == 10 else x for x in tmp]
ans = []
for i in range(5):
    ans.append(tmp2[i] + int(T[i]))
print(sum(ans) - ans[last] + int(T[last]))
Problem p03086 (python)

Fixed submission:
S = input()
ACGT = ['A', 'C', 'G', 'T']
ans = []
if len(S) == 1:
    if S in ACGT:
        print(1)
    else:
        print(0)
else:
    for i in range(len(S)):
        j = 0
        while i + j < len(S):
            if S[i + j] in ACGT:
                j += 1
            else:
                ans.append(S[i : i + j])
                break
        if i + j == len(S):
            ans.append(S[i : len(S)])
    
    print(max([len(x) for x in ans]))

Buggy submission (verdict: Runtime Error):
S = input()
ACGT = ['A', 'C', 'G', 'T']
ans = []
if len(S) == 1:
    if S in ACGT:
        print(1)
    else:
        print(0)
else:
    for i in range(len(S)):
        j = 0
        while i + j < len(S):
            if S[i + j] in ACGT:
                j += 1
            else:
                ans.append(S[i : i + j])
                break
    
    print(max([len(x) for x in ans]))

Buggy submission (verdict: Runtime Error):
S = input()
ACGT = ['A', 'C', 'G', 'T']
ans = []

for i in range(len(S)):
    j = 0
    while i + j < len(S):
        if S[i + j] in ACGT:
            j += 1
        else:
            ans.append(S[i : i + j])
            break
print(max([len(x) for x in ans]))
Problem p03324 (python)

Fixed submission:
D, N = map(int, input().split())
if D == 0:
    if N == 100:
        print(101)
    else:
        print(N)
    
else:
    if N == 100:
        print((100 ** D) * (N + 1))
    else:
        print((100 ** D) * N)

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

tmp = 0
for i in range(len(N)):
    tmp += int(N[i])

if int(N) % tmp == 0:
    print('Yes')
else:
    print('No')

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

tmp = 0
for i in range(len(N)):
    tmp += int(N[i])

if int(N) % tmp == 0:
    print('Yes')
else:
    print('No')
Problem p03632 (python)

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

if A <= C:
    print(max(min(B, D) - C, 0))
else:
    print(max(min(B, D) - A, 0))

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

if A <= C:
    print(max(min(B, D) - C), 0)
else:
    print(max(min(B, D) - A), 0)
Problem p03657 (python)

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

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')

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

if A % 3 == 0 or B % 3 == 0 or A + B % == 0:
    print('Possible')
else:
    print('Impossible')
Problem p03827 (python)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
S = input()

I_count = [i for i, x in enumerate(S) if x == 'I']
D_count = [i for i, x in enumerate(S) if x == 'D']

tmp = [0] * N
for i in I_count:
    tmp[i] = 1
for i in D_count:
    tmp[i] = -1

ans = 0
List = []
for i in range(N):
    ans += tmp[i]
    List.append(ans)

print(max(0, max(List)))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
S = input()

I_count = [i for i, x in enumerate(S) if x == 'I']
D_count = [i for i, x in enumerate(S) if x == 'D']

tmp = [0] * N
for i in I_count:
    tmp[i] = 1
for i in D_count:
    tmp[i] = -1

ans = 0
List = []
for i in range(N):
    ans += tmp[i]
    List.append(ans)

print(max(0, List))
Problem p03998 (python)

Fixed submission:
SA = input()
SB = input()
SC = input()

Aidx, Bidx, Cidx = 0, -1, -1
X = SA[0]
i = 0

while True:
    if X == 'a':
        Aidx += 1
        if Aidx == len(SA):
            ans = 'A'
            break
        X = SA[Aidx]
    elif X == 'b':
        Bidx += 1
        if Bidx == len(SB):
            ans = 'B'
            break
        X = SB[Bidx]
    elif X == 'c':
        Cidx += 1
        if Cidx == len(SC):
            ans = 'C'
            break
        X = SC[Cidx]


print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
S = []
for i in range(3):
    S.append(input())
for i in range(3):
    S[i] = S[i].replace('a', '0').replace('b', '1').replace('c', '2')
    
idx = int(S[0][0])
S[0] = S[0][1:]

while True:
    tmp = int(S[idx][0])
    S[idx] = S[idx][1:]
    idx = tmp
    if S[idx] == '':
        print(['A', 'B', 'C'][idx])
        break

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
S = []
for i in range(3):
    S.append(input())
for i in range(3):
    S[i] = S[i].replace('a', '0').replace('b', '1').replace('c', '2')
    
idx = int(S[0][0])
S[0] = S[0][1:]

while True:
    tmp = int(S[idx][0])
    S[tmp] = S[tmp][1:]
    idx = tmp
    if len(S[0]) == 0:
        print('A')
        break
    elif len(S[1]) == 0:
        print('B')
        break
    elif len(S[2]) == 0:
        print('C')
        break

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
S = []
for i in range(3):
    S.append(input())
for i in range(3):
    S[i] = S[i].replace('a', '0').replace('b', '1').replace('c', '2')
    
idx = int(S[0][0])
S[0] = S[0][1:]

while True:
    tmp = int(S[idx][0])
    S[tmp] = S[tmp][1:]
    idx = tmp
    if len([i for i, x in enumerate(S) if len(x) == 0]) == 1:
        print(['A', 'B', 'C'][int([i for i, x in enumerate(S) if len(x) == 0][0])])
        break