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

Fixed submission:
a, b = map(int, input().split()) 
if a + b >= 10:
  print("error") 
else:
  print(a + b)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split()) 
if a + b >= 10:
  print("error") 
else:
  print(sum(a + b)

Buggy submission (verdict: Runtime Error):
print("error") if sum(input().split()) >= 10 else print(sum(input().split()))
Problem p03719 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A <= C and C <= B:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N, K, a, b, S, ans;
  cin >> N >> K;
  
  vector<int> C(100000);
  
  for (int i = 0; i < N; i++){
    cin >> a >> b;
    C.at(a-1) += b;
  }
  
  for (int i = 0; i < N; i++){
    S += C.at(i);
    if (S >= K){
      cout << i+1 << endl;
      break;
    }
  }
}

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A =< C and C =< B:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A =< C =< B:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c, = map(int, input().split())
print("Yes") if a <= c =< b else print("No")

Buggy submission (verdict: Runtime Error):
a, b, c, = map(int, input().split())
pront("Yes") if a <= c =< b else print("No")
Problem p03722 (python)

Fixed submission:
INF = float('inf')


def Bellmanford(node, edges, source):
    d = [INF] * node  # ある頂点までのコストを保存するリスト
    d[source] = 0

    for i in range(node):
        for start, goal, cost in edges:
            # 辺の始まりの頂点までのコストが INF でなく
            # 辺の向かう先の頂点のコストが、より軽くなる場合に、
            # リストを更新する
            if d[start] != INF and d[start] + cost < d[goal]:
                d[goal] = d[start] + cost
                if i == node-1 and goal == node-1:
                    return 'inf'
    return -d[node-1]


N, M = map(int, input().split())
abc = [map(int, input().split()) for _ in range(M)]
Edges = [None] * M

for i in range(M):
    ai, bi, ci = abc[i]
    Edges[i] = (ai-1, bi-1, -ci)


ans = Bellmanford(N, Edges, 0)
print(ans)

Buggy submission (verdict: Runtime Error):
V, E = map(int, input().split())
G = [[] for i in range(V+1)]
for i in range(E):
    a, b, c = map(int, input().split())
    G[a-1].append((b-1, 0-c))
G[V-1].append((V, 0))

INF = float('inf')
dist = [INF] * (V + 1)
dist[0] = 0
Flag = False

for i in range(V+1):
    UnUpdate = True
    for v, e in enumerate(G):
        for t, cost in e:
            if dist[v] != INF and dist[v] + cost < dist[t]:
                dist[t] = dist[v] + cost
                UnUpdate = False
    if UnUpdate and i < V:
        Flag = True
        break

if Flag:
    print(0-dist[V])
else:
    print(1/0)
Problem p03729 (python)

Fixed submission:
S = input().split()
if S[0][-1] == S[1][0] and S[1][-1] == S[2][0]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
print("YES") if a[len(a)] == b[0] and b[len(b)] == c[0] else print("NO")
Problem p03738 (python)

Fixed submission:
A = int(input())
B = int(input())

if A > B:
  print("GREATER")
elif A < B:
  print("LESS")
else:
  print("EQUAL")

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if A > B:
  print("GREATER")
else if A < B:
  print("LESS")
else:
  print("EQUAL")
Problem p03759 (python)

Fixed submission:
a, b, c = map(int, input().split())
if b - a == c - b:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if b - a == c - b:
  print("YES")
else:
  pront("NO")
Problem p03844 (python)

Fixed submission:
A, op, B = map(str, input().split())
if op == "+":
  print(int(A) + int(B))
else:
  print(int(A) - int(B))

Buggy submission (verdict: Runtime Error):
A, op, C = map(str, input().split())
if op == "+":
  print(int(A) + int(B))
else:
  print(int(A) - int(B))
Problem p03854 (python)

Fixed submission:
S = input()
L = len(S)

while L:
  f = True
  if L >= 7:
    if S[L-7:L] == "dreamer":
      L -= 7
      f = False
  if L >= 6:
    if S[L-6:L] == "eraser":
      L -= 6
      f = False
  if L >= 5:
    if S[L-5:L] == "dream" or S[L-5:L] == "erase":
      L -= 5
      f = False
  if f:
    break

if L:
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
def f(S,L):
  if not L:
    return True
  if L >= 7:
    if S[-7:] == "dreamer":
      return f(S[:-7],L-7)
  if L >= 6:
    if S[-6:] == "eraser":
      return f(S[:-6],L-6)
  if L >= 5:
    if S[-5:] == "dream" or S[-5:] == "erase":
      return f(S[:-5],L-5)
  return False

s = input()
if f(s, len(s)):
  print("YES")
else:
  print("NO")
Problem p03943 (python)

Fixed submission:
import sys

S = [int(i) for i in input().split()]
T = sum(S)/2

for i in range(3):
  if S[i] == T:
    print("Yes")
    sys.exit()
    
print("No")

Buggy submission (verdict: Runtime Error):
import sys

S = [int(i) for i in input().split()]
T = sum(T)/2

for i in range(3):
  if S[i] == T:
    print("Yes")
    sys.exit()
    
print("No")
Problem p03993 (python)

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
S = 0
for i in range(N):
  if a[a[i]-1] == i+1:
    S += 1
print(S//2)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
S = 0
for i in range(N):
  if a[a[i]] == i:
    S += 1
print(S//2)
Problem p02741 (python)

Fixed submission:
i = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[i - 1])

Buggy submission (verdict: Runtime Error):
    i = int(input())
    a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    print(a[i - 1])

Buggy submission (verdict: Runtime Error):
i = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[i + 1])
Problem p02573 (python)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())



N,M = map(int,input().split())
uf = UnionFind(N)

for _ in range(M):
    a,b = map(int,input().split())
    uf.union(a-1,b-1)

ans = 1
for i in range(N):
    ans = max(ans,uf.size(i))

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter

N,M = map(int,input().split())
num = [i for i in range(N+1)]
ab = [list(map(int,input().split())) for _ in range(M)]

ab.sort()

for a,b in ab:
    m = min(num[a],num[b])
    num[a] = num[b] = m

print(max(Coutner(num).values()))
Problem p02585 (python)

Fixed submission:
def res(n):
    pos = n
    cnt = 1
    while 1:
        pos = P[pos]-1
        if pos == n:
            break
        cnt += 1

    tmp = 0
    ans = -float("inf")
    pos = n

    for _ in range(min(K,cnt)):
        pos = P[pos]-1
        tmp += C[pos]
        ans = max(ans,tmp)
    
    ##ループして0以上なら(K//cnt)回ループしてあまりをシミュレーション
    if tmp > 0 and K > cnt:
        pos = n
        d = K%cnt
        tmp = (K//cnt-1)*tmp
        ans = max(ans,tmp)
        for _ in range(d+cnt):
            pos = P[pos]-1
            tmp += C[pos]
            ans = max(ans,tmp)

    return ans

N,K = map(int,input().split())
P = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = -float("inf")
for i in range(N):
    ans = max(ans,res(i))

print(ans)

Buggy submission (verdict: Runtime Error):
def res(n):
    pos = n
    cnt = 1
    while 1:
        pos = P[pos]-1
        if pos == n:
            break
        cnt += 1

    tmp = 0
    pos = n
    ans = []

    for _ in range(min(K,cnt)):
        pos = P[pos]-1
        tmp += C[pos]
        ans.append(tmp)
    
    pos =
    ##ループして0以上なら(K//cnt)回ループしてあまりをシミュレーション
    if tmp > 0:
        d = K%cnt
        tmp = (K//cnt)*tmp
        ans.append(tmp)
        for _ in range(d):
            pos = P[pos]-1
            tmp += C[pos]
            ans.append(tmp)

    return max(ans)

            
N,K = map(int,input().split())
P = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = -1e20
for i in range(N):
    ans = max(ans,res(i))

print(ans)
Problem p02645 (python)

Fixed submission:
S = input()
print(S[:3])

Buggy submission (verdict: Runtime Error):
"""
https://atcoder.jp/contests/tokiomarine2020/submissions/14229099
"""
N,K = map(int,input().split())
A = list(map(int,input().split()))
 
def update(A):
    b = [0]*N
    for i,a in enumerate(A):
        l = max(0,i-a)
        r = min(N-1,i+a)
        b[l] += 1
        if r+1 < N:
            b[r+1] -= 1
    res = []
    s = 0
    for i in b:
        s += i
        res.append(s)
    return res
 
for _ in range(min(K,30)):
    A = update(A)
 
print(*A)

Buggy submission (verdict: Runtime Error):
"""
https://atcoder.jp/contests/tokiomarine2020/submissions/14229099
"""
N,K = map(int,input().split())
A = list(map(int,input().split()))
 
def update(A):
    b = [0]*N
 
    for i,a in enumerate(A):
        l = max(0,i-a)
        r = min(N-1,i+a)
 
        b[l] += 1
        if r+1 < N:
            b[r+1] -= 1
    
    res = []
    s = 0
    for i in b:
        s += i
        res.append(s)
    return res
 
for _ in range(min(K,50)):
    A = update(A)
 
print(*A)
Problem p02684 (python)

Fixed submission:
from collections import defaultdict,deque

N,K = map(int,input().split())
A = list(map(int,input().split()))

loop = N
pos = 0
oto = defaultdict(int)
ind = 0
tej = deque([])
for i in range(N):
    pos = A[pos] - 1
    tej.append(pos+1)
    if oto[pos] == 1:
        ind = tej.index(pos+1)
        loop = i - ind 
        break
    oto[pos] = 1
K -= 1
##print("loop",loop,"ind",ind)
##print(tej)
if K <= ind:
    print(tej[K])
else:
    print(tej[(K-ind)%loop+ind])

Buggy submission (verdict: Runtime Error):
from collections import defaultdict,deque

N,K = map(int,input().split())
A = list(map(int,input().split()))

loop = N
pos = 0
oto = defaultdict(int)
ind = 0
tej = deque([])
for i in range(N):
    pos = A[pos] - 1
    tej.append(pos+1)
    if oto[pos] == 1:
        ind = A.index(pos+1)
        loop = i - ind + 1
        break
    oto[pos] = 1

##print("loop",loop,"ind",ind)
##print(tej)
if K <= ind:
    print(tej[K])
else:
    print(tej[(K-ind)%loop+max(0,ind-1)])

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

N,K = map(int,input().split())
A = list(map(int,input().split()))

loop = N
pos = 0
oto = defaultdict(int)
ind = 0
tej = []
for i in range(N):
    pos = A[pos] - 1
    tej.append(pos+1)
    if oto[pos] == 1:
        ind = A.index(pos+1)
        loop = i - ind + 1
        break
    oto[pos] = 1

##print("loop",loop,"ind",ind)
##print(tej)
if K <= ind:
    print(tej[K])
else:
    print(tej[K%loop+ind])
Problem p02743 (python)

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

if c - b - a <= 0:
    print("No")
elif 4*a*b < (c-b-a)**2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from numpy import sqrt
a,b,c = map(int,input().split())

if a+b+2*sqrt(a*b)<c:
  print("Yes")
else:
  print("No)
Problem p02747 (python)

Fixed submission:
S = input()
if S.count("hi") == len(S)/2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
S.replace("hi",":")
if len(set(s)) == 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
S.replace("hi",":")
if len(set(S)) == 1:
  print("Yes")
else:
  print("No)

Buggy submission (verdict: Runtime Error):
S = input()
S.replace("hi",":")
if len(set(list(s))) == 1:
  print("Yes")
else:
  print("No)

Buggy submission (verdict: Runtime Error):
S = input()
S.replace("hi",":")
if len(set(s)) == 1:
  print("Yes")
else:
  print("No)
Problem p02761 (python)

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

sc = []
for i in range(M):
    s,c = map(int,input().split())
    c = str(c)
    sc.append([s-1,c])

for i in range(10**N+1):
    tmp = str(i)
    flag = False
    count = 0
    if len(tmp) == N:
        for s,c in sc:
            if tmp[s] == c:
                count += 1
        if count == M:
            flag = True
    if flag:
        print(tmp)
        exit()
print(-1)

Buggy submission (verdict: Runtime Error):
def same(h):
    if len(h)==0:
        return True
    else:
        if len(set(h))==1:
            return True
        else:
            return False

N,M = map(int,input().split())
if M == 0:
    print(1)
    exit()
h = []
t = []
o = []
if N == 1:
    for i in range(M):
        s,c = map(int,input().split())
        o.append(o)
    if same(o):
        if o[0] == 0:
            print(-1)
        else:
            print(o[0])
    else:
        print(-1)
if N == 2:
    for i in range(M):
        s,c = map(int,input().split())
        tmp = c *(10**(-s+3))
        if s == 1:
            h.append(tmp)
        elif s == 2:
            t.append(tmp)
    if same(h) and same(t):
        h.append(0)
        t.append(0)
        ans = h[0]+t[0]
        if ans==0:
            print(-1)
        else:
            print(ans)
    else:
        print(-1)

if N == 3:
    for i in range(M):
        s,c = map(int,input().split())
        tmp = c *(10**(-s+3))
        if s == 1:
            h.append(tmp)
        elif s == 2:
            t.append(tmp)
        elif s == 3:
            o.append(tmp)
    if same(o) and same(h) and same(t):
        h.append(0)
        t.append(0)
        o.append(0)
        ans = h[0]+t[0]+o[0]
        if ans==0:
            print(-1)
        else:
            print(ans)
    else:
        print(-1)
Problem p02778 (python)

Fixed submission:
S = input()

ans = ""
for i in range(len(S)):
    ans += "x"

print(ans)

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

if U == S:
    A -= 1
elif U == T:
    B -= 1

print(A,B)
Problem p02780 (python)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
 
for i in range(N):
    p[i] = (p[i]+1)/2
a = [0]*(N-K+1)
f = sum(p[:K])
a[0] = f

for i in range(N-K):
    f = f + p[i+K] - p[i]
    a[i+1] = f

print(max(a))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
p = list(map(int,input().split()))
 
a = [0]*N
f = sum(p[:K])

for i in range(N-K):
    f = f + p[i+K] - p[i]
    a[i] = f
    
num = 0

for i in range(1,N-K):
    if a[i] > a[i-1]:
        num = i
ans = 0

for i in range(num+1,num+K+1):
    ans += (p[i]+1)/2

print(ans)
Problem p02787 (python)

Fixed submission:
H,N = map(int,input().split())
AB = [list(map(int, input().split())) for i in range(N)]

M = max(a for a,b in AB)

dp = [0]*(H+M)

for i in range(1,H+M):
    dp[i] = min(dp[i-a]+b for a,b in AB)
    
print(min(dp[H:]))

Buggy submission (verdict: Runtime Error):
H,N = map(int,input().split())
AB = [list(map(int, input().split())) for i in range(N)]

M = 1

dp = [0]*(H+M)

for i in range(1,H+M):
    dp[i] = min(dp[i-a]+b for a,b in AB)
    
print(min(dp[H:]))

Buggy submission (verdict: Runtime Error):
H,N = map(int,input().split())
AB = [list(map(int, input().split())) for i in range(N)]

dp = [0]*(H+1)

for i in range(1,H+1):
    dp[i] = min(dp[i-a]+b for a,b in AB)
    
print(dp[H])

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

AB = []

for i in range(N):
    a,b = map(int,input().split())
    AB.append([a,b])

dp = [0]*(H+1)

for i in range(1,H+1):
    dp[i] = min(dp[i-a]+b for a,b in AB)
    
print(dp[H])

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

AB = []

for i in range(N):
    a,b = map(int,input().split())
    AB.append([a,b])

dp = [1e9]*(H+3)

for i in range(H+1):
    dp[i] = min(dp[i-a]+b for a,b in AB)
    
print(min(dp[H-1:]))

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

AB = []

for i in range(N):
    a,b = map(int,input().split())
    AB.append([a,b])

dp = [0]*(H+1)

for i in range(H+1):
    dp[i] = min(dp[i-a]+b for a,b in AB)
    
print(min(dp[H-1:]))

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

AB = []

for i in range(N):
    a,b = map(int,input().split())
    AB.append([a,b])

dp = [0]*(H+1)

for i in range(H+1):
    dp[i] = min(dp[i-a]+b for a,b in AB)
    
print(dp[H-1])
Problem p02791 (python)

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

minp = P[0]
ans = 0

for i in range(N):
    if i != 0:
        minp = min(minp,P[i])
    if minp == P[i]:
        ans += 1

print(ans)

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

minp = P[0]
ans = 0

for i in range(N)::
    minp = min(minp,P[i])
    if minp == P[i]:
        ans += 1

print(ans)
Problem p02797 (python)

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

ans = [0]*N

if S == 1e9:
    for i in range(K):
        ans[i] = S
    for i in range(K,N):
        ans[i] = 1 
else:
    for i in range(K):
        ans[i] = S
    for i in range(K,N):
        ans[i] = S+1
    

print(*ans)

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

xl = []

for i in range(N):
    xl.append(list(map(int,input().split())))

itv = []

for i in range(N):
    right = xl[i][0] + xl[i][1]  ##right
    left = xl[i][0] - xl[i][1]  ##left   
    itv.append([right,left])
itv.sort()

ass = 0
tt = -1e10
for i in range(N):
    if tt <= itv[i][1]:
        ass += 1
        tt = itv[i][0]
print(ass)
Problem p02802 (python)

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

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+N)
ACed = [0]*(N+M)
tmp_num = [0]*(M+N)
tmp = 0
for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        tmp_num[num] += 1
    elif RES[i][1] == "WA" and ACed[num]:
        tmp += 1
    else:
        ACed[num] = 1
        WA[num] = tmp_num[num]

print(sum(ACed),end=" ")
print(sum(WA))

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

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+2)
ACed = [0]*(N+2)
tmp = 0
for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        WA[num] += 1
    elif RES[i][1] == "WA" and ACed[num]:
        tmp += 1
    else:
        ACed[num] = 1

print(sum(ACed),end=" ")
print(sum(WA))

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

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+3) ##WAするのは提出数
ACed = [0]*(N+3) ##ACするのは問題数

for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        WA[num] += 1
    elif RES[i][1] == "AC":
        ACed[num] = 1

print(sum(ACed),end=" ")
print(sum(WA))

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

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+1)
ACed = [0]*(N+1)

for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        WA[num] += 1
    else:
        ACed[num] = 1

print(sum(ACed),end=" ")
print(sum(WA))
Problem p02811 (python)

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


if 500*K>=X:
    print("Yes")
else:
    print("No")

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

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

def lcm(a, b):
    return (a * b)//gcd(a,b)

N,M = map(int,input().split())
a = list(map(int,input().split()))

A = np.array(a)

##while np.sum(A%2) == 0:
  ##  A = A//2

if np.sum(A%2) != len(A):
    print("0")
    sys.exit()
    
tmp = 1##LCM

for i in range(N):
    tmp = lcm(tmp,a[i]//2)

if tmp > M:
    print("0")

else:
    print((M//tmp+1)//2)
Problem p02812 (python)

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

for i in range(len(S)-2):
    tmp = 0
    if S[i]=="A" and S[i+1] == "B" and S[i+2] == "C":
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N=input()
print(input().count("ABC")
Problem p02846 (python)

Fixed submission:
T1,T2 = map(int,input().split())
A1,A2 = map(int,input().split())
B1,B2 = map(int,input().split())

dis1 = (A1 - B1) * T1
dis2 = (A2 - B2) * T2

if dis1 > 0:
    dis1 = -dis1
    dis2 = -dis2

if dis1 + dis2 <0:
    print(0)

elif dis1 == -dis2:
    print("infinity")
    
else:
    S = dis1//(dis1+dis2)
    R = dis1%(dis1+dis2) 
    if R == 0:
        ans = S*2 
    else:
        ans = S*2 + 1
    
    print(abs(ans))

Buggy submission (verdict: Runtime Error):
T1,T2 = map(int,input().split())
A1,A2 = map(int,input().split())
B1,B2 = map(int,input().split())

dis1 = (A1 - B1) * T1
dis2 = (A2 - B2) * T2

if dis1 == -dis2:
    print("infinity")

elif (dis1<0 and dis2<0) or (dis1>0 and dis2>0):
    print("0")

else:
    S = abs(dis1//(dis1+dis2))
    R = abs(dis1%(dis1+dis2)) 
    if rem == 0:
        ans = S*2 
    else:
        ans = S*2 + 1
    
    print(ans)
Problem p02852 (python)

Fixed submission:
N,M = map(int,input().split())
S = input()[::-1]

if M >= N:
    print(N)
    exit()

p = -1
for i in reversed(range(1,M+1)):
    if S[i] == "0":
        p = i
        break

if p == -1:
    print(-1)
    exit()

ps = [p]
while 1:
    tmp = -1
    for i in reversed(range(ps[-1]+1,ps[-1]+M+1)):
        try:
            if S[i] == "0" or i == N:
                ps.append(i)
                tmp = i
                break
        except:
            pass
    if tmp == -1:
        print(-1)
        exit()
    if ps[-1] == N:
        break

pp = ([ps[i+1]-ps[i] for i in range(len(ps)-1)])[::-1] + [ps[0]]
print(*pp)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
S = input()[::-1]

if M >= N:
    print(N)
    exit()

p = -1
for i in reversed(range(1,M+1)):
    if S[i] == "0":
        p = i
        break

if p == -1:
    print(-1)
    exit()
print(p)
ps = [p]
for _ in range(N//M):
    tmp = -1
    for i in reversed(range(ps[-1]+1,ps[-1]+M+1)):
        try:
            if S[i] == "0":
                ps.append(i)
                tmp = i
                break
        except:
            pass
    if tmp == -1:
        print(-1)
        exit()
pp = [ps[i+1]-ps[i] for i in range(len(ps)-1)]
print(*pp[::-1],ps[0])
Problem p02899 (python)

Fixed submission:
N = int(input())

A = list(map(int,input().split()))

B = [0]*N

for i in range(N):
    B[A[i]-1] = i+1

print(*B)

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

A = list(map(int,input().split()))

for i in range(N):
    print(A.index(i)+1,end=" ")
Problem p02918 (python)

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

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        count += 1

print(min(N-1,count+2*K))

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

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        count += 1

print(min(N-1,count+2*K))
Problem p03106 (python)

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

a = []

for i in range(1,100000):
    if A%i == 0 and B%i == 0:
        a.append(i)

print(a[-K])

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

a = []

if K == 1:
    print(K)
    exit()

for i in range(1,100):
    if A%i == 0 and B%i == 0:
        a.append(i)
if 
print(a[-K])