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

Fixed submission:
import sys
sys.setrecursionlimit(10**7)

N = int(input())
color = [-1] * N
G = [[] for _ in range(N)]
W = [[] for _ in range(N)]
for i in range(N-1):
  u, v, w = map(int, input().split())
  G[u-1].append(v-1)
  G[v-1].append(u-1)
  W[u-1].append(w)
  W[v-1].append(w)

def dfs(v, cur):
  color[v] = cur
  for next_v, w in zip(G[v], W[v]):
    if color[next_v] != -1:
      continue
    if w % 2 == 0:
      dfs(next_v, cur)
    else:
      dfs(next_v, 1 - cur)
      
for i in range(N):
  if color[i] != -1:
    continue
  dfs(i, 0)
for i in range(N):
  print(color[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
color = [-1] * N
G = [[] for _ in range(N)]
for i in range(N-1):
  u, v, w = map(int, input().split())
  G[u-1].append((v-1, w))
  G[v-1].append((u-1, w))

def dfs(v, cur):
  color[v] = cur
  for next_v, w in G[v]:
    if color[next_v] != -1:
      continue
    if w % 2 == 0:
      dfs(next_v, cur)
    else:
      dfs(next_v, 1 - cur)
      
dfs(0, 0)
for i in range(N):
  print(color[i])

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

N = int(input())
color = [-1] * N
G = [[] for _ in range(N)]
W = [[] for _ in range(N)]
for i in range(N-1):
  u, v, w = map(int, input().split())
  G[u-1].append(v-1)
  G[v-1].append(u-1)
  W[u-1].append(w)
  W[v-1].append(w)

def dfs(v, cur):
  color[v] = cur
  for next_v, w in zip(G[v], W[v]):
    if color[next_v] != -1:
      continue
    if w % 2 == 0:
      dfs(next_v, cur)
    else:
      dfs(next_v, 1 - cur)
      
for i in range(N):
  if color[i] != -1:
    continue
  dfs(i, 0)
for i in range(N):
  print(color[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
color = [-1] * N
G = [[] for _ in range(N)]
W = [[] for _ in range(N)]
for i in range(N-1):
  u, v, w = map(int, input().split())
  G[u-1].append(v-1)
  G[v-1].append(u-1)
  W[u-1].append(w)
  W[v-1].append(w)

def dfs(v, cur):
  color[v] = cur
  for next_v, w in zip(G[v], W[v]):
    if color[next_v] != -1:
      continue
    if w % 2 == 0:
      dfs(next_v, cur)
    else:
      dfs(next_v, 1 - cur)
      
for i in range(N):
  if color[i] != -1:
    continue
  dfs(i, 0)
for i in range(N):
  print(color[i])
Problem p03434 (python)

Fixed submission:
N = int(input())
A = [int(v) for v in input().split()]
A.sort()

Alice = 0
Bob = 0
for i, v in enumerate(A[::-1]):
  if i % 2 == 0:
    Alice += v
  else:
    Bob += v
print(Alice - Bob)

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

Alice = 0
Bob = 0
for i, v in enumerate(A[::-1]):
	if i % 2 == 0:
      Alice += v
    else:
      Bob += v
print(Alice - Bob)
Problem p03448 (python)

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

ret = 0
for i in range(int(min(X / 500, A) + 1)):
  for j in range(int(min((X - i * 500) / 100, B) + 1)):
    for k in range(int(min((X - i * 500 - j * 100) / 50, C) + 1)):
      if i * 500 + j * 100 + k * 50 == X:
        ret += 1
print(ret)

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

ret = 0
for i in range(X / A + 1):
  for j in range((X - i * 500) / B + 1):
    for k in range((X - i * 500 - j * 100) / C + 1):
      if i * 500 + j * 100 + k + 50 == x:
        ret += 1
print(ret)
Problem p03478 (python)

Fixed submission:
N, A, B = map(int, input().split())
ret = 0
for i in range(N + 1):
  v = sum(map(int, list(str(i))))
  if v >= A and v <= B:
    ret += i
print(ret)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
sum = 0
for 1 in range(N + 1):
  if i % 10 >= A and i % 10 <= B:
    sum += i
print(sum)
Problem p03479 (python)

Fixed submission:
X, Y = map(int, input().split())
count = 0
while True:
  count = count + 1
  X = X * 2
  if X > Y:
    break
print(count)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())
count = 0
while True:
  count++
  X = X * 2
  if X > Y:
    break
print(count)
Problem p03493 (python)

Fixed submission:
s1, s2, s3 = map(int, list(input()))
print(s1 + s2 + s3)

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

ret = 0
flag = True
while(flag):
  for i in range(3):
    if(A[i] % 2 != 0):
      flag = False
    else:
      A[i] /= 2
  if(flag):
    ret += 1  
print(ret)
Problem p03494 (python)

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

ret = 0
flag = True
while(flag):
  for i in range(N):
    if(A[i] % 2 != 0):
      flag = False
    else:
      A[i] /= 2
  if(flag):
    ret += 1  
print(ret)

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

ret = 0
while(True):
  for(i=0; i<N; i++):
    if(A[i] % 2 != 0):
      break;
    else:
      A[i] /= 2
    ret += 1
print(ret)
Problem p03545 (python)

Fixed submission:
A = [int(v) for v in input()]

flag = False
for i in range(2):
  if flag:
    break
  total = A[0]
  if i == 0:
    total += A[1]
  else:
    total -= A[1]
  for j in range(2):
    if flag:
      break
    total2 = total
    if j == 0:
      total2 += A[2]
    else:
      total2 -= A[2]
    for k in range(2):
      total3 = total2
      if k == 0:
        total3 += A[3]
      else:
        total3 -= A[3]
      if total3 == 7:
        print(A[0], end='')
        if i == 0:
          print('+{}'.format(A[1]), end='')
        else:
          print('-{}'.format(A[1]), end='')
        if j == 0:
          print('+{}'.format(A[2]), end='')
        else:
          print('-{}'.format(A[2]), end='')
        if k == 0:
          print('+{}=7'.format(A[3]))
        else:
          print('-{}=7'.format(A[3]))
        flag = True
        break

Buggy submission (verdict: Runtime Error):
A = [int(v) for v in input()]

for i in range(2):
  total = A[0]
  if i == 0:
    total += A[1]
  else:
    total -= A[1]
  for j in range(2):
    if j == 0:
      total += A[2]
    else:
      total -= A[2]
    for k in range(2):
      if k == 0:
        total += A[3]
      else:
        total -= A[3]
      if total == 7:
        print(A[0], end='')
        if i == 0:
          print('+{}'.format(A[1]), end='')
        else:
          print('-{}'.format(A[1]), end='')
        if j == 0:
          print('+{}'.format(A[2]), end='')
        else:
          print('-{}'.format(A[2]), end='')
        if k == 0:
          print('+{}=7'.format(A[3]))
        else:
          print('-{}=7'.format(A[3]))
        return
Problem p03565 (python)

Fixed submission:
S = input()
T = input()

flag = False
for i in range(len(S) - len(T), -1, -1):
  flag = True
  for j in range(len(T)):
    if S[i+j] != '?' and S[i+j] != T[j]:
      flag = False
      break
  if flag:
    break
if flag:
  U = S[:i] + T + S[i+len(T):]
  U = U.replace('?', 'a')
  print(U)
else:
  print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

for i in range(len(S) - len(T), -1, -1):
  flag = True
  for j in range(len(T)):
    if S[i+j] != '?' and S[i+j] != T[j]:
      flag = False
      break
  if flag:
    break
if flag:
  U = S[:i] + T + S[i+len(T):]
  U = U.replace('?', 'a')
  print(U)
else:
  print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

for i in range(len(S) - len(T), -1, -1):
  flag = True
  for j in range(len(T)):
    if S[i+j] != '?' and S[i+j] != T[j]:
      flag = False
      break
  if flag:
    break
if flag:
  U = S[:i] + T + S[i+len(T):]
  U = U.replace('?', 'a')
  print(U)
else:
  print('UNRESTORABLE')
Problem p03574 (python)

Fixed submission:
H, W = map(int, input().split())
A = []
for i in range(H):
  A.append(input())
  
for i in range(H):
  for j in range(W):
    if A[i][j] == '#':
      print('#', end='')
    else:
      count = 0
      for k in range(max(0, i-1), min(i+1, H-1)+1):
        for l in range(max(0, j-1), min(j+1, W-1)+1):
          if A[k][l] == '#':
            count += 1
      print(count, end='')
  print()

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

H, W = map(int, input().split())
A = []
for i in range(H):
  A.append(input())
  
for i in range(H):
  for j in range(W):
    if A[i][j] == '#':
      print('#', end='')
    count = 0
    for k in range(min(0, i-1), max(i+1, H-1)+1):
      for l in range(min(0, j-1), max(j+1, W-1)+1):
        if A[k][l] == '#':
          count += 1
    print(count, end='')
  print()
Problem p03632 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
s = max(A, C)
e = min(B, D)
span = max(0, e - s)
print(span)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input())
s = max(A, C)
e = min(B, D)
span = max(0, e - s)
print(span)
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)

N = int(input())

edges = [[] for _ in range(N)]
for i in range(N-1):
    u, v, w = map(int, input().split())
    edges[u-1].append((v-1, w))
    edges[v-1].append((u-1, w))

dist = [-1 for _ in range(N)]
def measure(src):
    """
    srcを根とした木に対し、根から各頂点までの距離を求める
    """
    for v, w in edges[src]:
        if dist[v] == -1:
            dist[v] = dist[src] + w
            measure(v)

dist[0] = 0
measure(0)

for i in range(N):
    if dist[i] % 2:
        print(1)
    else:
        print(0)

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

edges = [[] for _ in range(N)]
for i in range(N-1):
    u, v, w = map(int, input().split())
    edges[u-1].append((v-1, w))
    edges[v-1].append((u-1, w))

dist = [0 for _ in range(N)]
def measure(src):
    """
    srcを根とした木に対し、根から各頂点までの距離を求める
    """
    for v, w in edges[src]:
        dist[v] = dist[src] + w
        measure(v) 
measure(0)

for i in range(N):
    if dist[i] % 2:
        print(1)
    else:
        print(0)
Problem p03061 (python)

Fixed submission:
from fractions import gcd 

N = int(input())
A = [int(i) for i in input().split()]

# Lを埋める
L = [0 for _ in range(N+1)]
for i in range(1, N+1):
    if not L[i-1]:
        L[i] = A[i-1]
    else: 
        L[i] = gcd(L[i-1], A[i-1])

# Rを埋める
R = [0 for _ in range(N+1)]
for i in range(1, N+1)[::-1]:
    if not R[i]:
        R[i-1] = A[i-1] 
    else:
        R[i-1] = gcd(R[i], A[i-1])

# Mを埋める
M = [0 for _ in range(N)]
for i in range(N):
    if not L[i]:
        M[i] = R[i+1]
    elif not R[i]:
        M[i] = L[i]
    else: 
        M[i] = gcd(L[i], R[i+1])

print(max(M))

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    """
    ユークリッドの互除法を用いて最大公約数を求める
    """
    if not x:
        return y
    return gcd(y % x, x)

def dfs(L, A):
    if not len(L):
        return A
    return gcd(dfs(L[:-1], L[-1]), A)

def get_M_i(A, i):
    """
    i番目のAを取り除いて得られる最大公約数を返す
    """
    L = dfs(A[:i-1], A[i-1]) if i > 0 else 0
    R = dfs(A[i+1:-1], A[-1]) if i+1 < len(A) else 0
    return gcd(L, R)

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))

    if N == 2:
        print(max(A))

    else:
        # i番目のMの値はi番目のAを取り除いて得られるN-1個の整数の最大公約数
        M = [0 for _ in range(N)]

        for i in range(N):
            M[i] = get_M_i(A, i)

        print(max(M))

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    """
    ユークリッドの互除法を用いて最大公約数を求める
    """
    if not x:
        return y
    return gcd(y % x, x)

def dfs(L, A):
    if not len(L):
        return A
    return gcd(dfs(L[:-1], L[-1]), A)

def get_M_i(A, i):
    """
    i番目のAを取り除いて得られる最大公約数を返す
    """
    L = dfs(A[:i-1], A[i-1]) if i > 0 else 0
    R = dfs(A[i+1:-1], A[-1]) if i+1 < len(A) else 0
    return gcd(L, R)

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))

    # i番目のMの値はi番目のAを取り除いて得られるN-1個の整数の最大公約数
    M = [0 for _ in range(N)]

    for i in range(N):
        M[i] = get_M_i(A, i)

    print(max(M))

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    """
    ユークリッドの互除法を用いて最大公約数を求める
    """
    if not x:
        return y
    return gcd(y % x, x)

def dfs(L, A):
    if not len(L):
        return A
    return gcd(dfs(L[:-1], L[-1]), A)

def get_M_i(A, i):
    """
    i番目のAを取り除いて得られる最大公約数を返す
    """
    L = dfs(A[:i-1], A[i-1]) if i > 0 else 0
    R = dfs(A[i+1:-1], A[-1]) if i < len(A) else 0
    return gcd(L, R)

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))

    # i番目のMの値はi番目のAを取り除いて得られるN-1個の整数の最大公約数
    M = [0 for _ in range(N)]

    for i in range(N):
        M[i] = get_M_i(A, i)

    print(max(M))
Problem p03480 (python)

Fixed submission:
S = input()

ans = len(S)
for i in range(1, len(S)):
    if S[i-1] != S[i]:
        ans = min(ans, max(i, len(S)-i))

print(ans)

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

# 0と1の個数のうち、大きい方
cnt = 0
for i in range(len(S)):
    if S[i] == "0":
        cnt += 1
cnt = max(cnt, len(S) - cnt)
print(cnt)
Problem p03565 (python)

Fixed submission:
S = input()
T = input()

# Tが当てはまる？
s = 0 # Tが当てはまる最初のインデックス
for i in range(len(S)-len(T)+1)[::-1]:
    flag = 1
    for j in range(len(T)):
        if S[i+j] != "?" and S[i+j] != T[j]:
            flag = 0
            break
    if flag:
        s = i
        break

if len(S) < len(T) or not flag:
    print("UNRESTORABLE")
else: # Tが当てはまった場合
    S = S[:s] + T + S[s+len(T):]
    # "?"を"a"で埋める
    S = S.replace("?", "a")
    print(S)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

# Tが当てはまる？
s = 0 # Tが当てはまる最初のインデックス
for i in range(len(S)-len(T)+1):
    flag = 1
    for j in range(len(T)):
        if S[i+j] != "?" and S[i+j] != T[j]:
            flag = 0
    if flag:
        s = i
        break

if not flag:
    print("UNRESTORABLE")
else: # Tが当てはまった場合
    S = S[:s] + T + S[s+len(T):]
    # "?"を"a"で埋める
    S = S.replace("?", "a")
    print(S)
Problem p04014 (python)

Fixed submission:
class nnDigitSum:
	def dfs(self,b,n):
		if n<b:
			return n
		return self.dfs(b,n/b)+n%b
	def returnMinimumB(self,n,s):
		if n<s: return -1
		if n==s: return n+1
		i=2
		while i*i<=n:
			if self.dfs(i,n)==s: return i
			i+=1
		cands=[]
		i=1
		while i*i<=n-2:
			if not (n-s)%i: cands.append((n-s)/i+1)
			i+=1
		cands=sorted(cands)
		for cand in cands:
			if self.dfs(cand,n)==s: return cand
		if s==1: return n
		return -1
if __name__ == "__main__":
	N = int(raw_input())
	s = int(raw_input())
	d = nnDigitSum()
	print d.returnMinimumB(N,s)

Buggy submission (verdict: Runtime Error):
class nnDigitSum:
	def dfs(self,b,n):
		if n<b:
			return n
		return self.dfs(b,n/b)+n%b
	def returnMinimumB(self,n,s):
		i=2
		while i*i<=n:
			if self.dfs(i,n)==s: return i
			i+=1
		cands=[]
		i=1
		while i*i<=n-2:
			if not (n-s)%i: cands.append((n-s)/i+1)
			i+=1
		cands=sorted(cands)
		for cand in cands:
			if self.dfs(cand,n)==s: return cand
		if n==s:
			return n+1
		elif s==1:
			return n
		return -1
if __name__ == "__main__":
	N = int(raw_input())
	s = int(raw_input())
	d = nnDigitSum()
	print d.returnMinimumB(N,s)
Problem p03059 (python)

Fixed submission:

(A, B, T) = map(int, input().split(" "))

biscuit = 0

for i in range(A * 10, T*10 + 5, A * 10):
    biscuit += B

print(biscuit)

Buggy submission (verdict: Runtime Error):

(A, B, T) = (int, input().split())

biscuit = 0

for i in range(0, A*10, T*10 + 5):
    biscuit += B

print(B)
Problem p03074 (python)

Fixed submission:
import sys

(N, K) = map(int, input().split(" "))
S = input()

nowOn = S[0]
count = 0
serialList = []

for i in S:

    if(nowOn == i):
        count += 1

    else:
        serialList.append(count)
        count = 1
        nowOn = i

serialList.append(count)

T = 2 * K + 1
A = 0

#serialList -> ["1", "0", "1", "0", ...]
if S[0] == "0":
    serialList.insert(0, 0)
    
#exception
if int(len(serialList) / 2) < K:
    print(len(S))
    sys.exit()

maxA = 0
for i in range(T):
    A += serialList[i]
    maxA = A
    
for i in range(T, len(serialList), 2):
    A -= serialList[i - T]
    A -= serialList[i - T + 1]
    A += serialList[i]

    if(i+1 < len(serialList)):
        A += serialList[i + 1]

    if maxA < A:
        maxA = A
        
print(maxA)

Buggy submission (verdict: Runtime Error):

(N, K) = map(int, input().split(" "))
S = input()

nowOn = S[0]
count = 0
serialList = []

for i in S:

    if(nowOn == i):
        count += 1

    else:
        serialList.append(count)
        count = 1
        nowOn = i

serialList.append(count)

T = 2 * K + 1
A = 0

#serialList -> ["1", "0", "1", "0", ...]
if S[0] == "0":
    serialList.insert(0, 0)
    
#exception
# --???

maxA = 0
for i in range(T):
    A += serialList[i]
    maxA = A
    
for i in range(T, len(serialList), 2):
    A -= serialList[i - T]
    A -= serialList[i - T + 1]
    A += serialList[i]

    if(i+1 < len(serialList)):
        A += serialList[i + 1]

    if maxA < A:
        maxA = A
        
print(maxA)
Problem p03079 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a == b and b == c:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a == b and b == c:
  return True
return False
Problem p03080 (python)

Fixed submission:
N = int(input())
s = input()
cnt = 0
for char in s:
  if char == 'R':
    cnt += 1
  if cnt > N / 2:
    print('Yes')
    break
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = map(int, input())
s = input()
for char in s:
  if char == 'R':
    cnt += 1
  if cnt > N / 2:
    print('Yes')
 	break
else:
  print('No')
Problem p03048 (python)

Fixed submission:
R, G, B, N = map(int,input().split())
ans = 0
for r in range(N//R + 1):
  for g in range((N - r*R)//G + 1):
    if (N - r*R - g*G) % B == 0:
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
R, G, B, N = map(int,input().split())
ans = 0
for r in range(N//R + 1):
  for g in range((N - r*R)//G + 1):
    if (N - rR - gG) % B == 0:
      ans += 1
print(ans)
Problem p03071 (python)

Fixed submission:
A,B = map(int, input().split())
sum = 0
for i in range(2):
  if A < B:
    sum += B
    B -= 1
  else:
    sum += A
    A -= 1
print(sum)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
sum = 0
for i in range(1,2):
	if A <= B:
      sum += B
      B -= 1
    else:
      sum += A
      A -= 1
print(str(sum))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
sum = 0
for i in range(1,2):
	if a < b:
      sum += b
      b -= 1
    else:
      sum += a
      a -= 1
print('sum')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split(' '))
sum = 0
for i in range(1,2):
	if a < b:
      sum += b
      b -= 1
    else:
      sum += a
      a -= 1
print('sum')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
sum = 0
for i in range(1,2):
	if a < b:
      sum += b
      b -= 1
    else:
      sum += a
      a -= 1
print(sum)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split(' '))
sum = 0
for i in range(1,2):
	if a < b:
      sum += b
      b -= 1
    else:
      sum += a
      a -= 1
print(sum)
Problem p03047 (python)

Fixed submission:
n,k=map(int,input().split())
print(n-k+1)

Buggy submission (verdict: Runtime Error):
include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int N = 0;
  int K = 0;
  int A = 1;
  std::cin >> N;
  std::cin >> K;
  for(int i;i<N;i++){
  A*=i
  }
  for(int i;i<K;i++){
  A/=i
  }
  for(int i;i<N-K;i++){
  A/=i
  }
  
  std::cout << A << std::endl;
  return 0;
}
Problem p03047 (python)

Fixed submission:
N, K = map(int, input().split())
print(N - (K - 1))

Buggy submission (verdict: Runtime Error):
N, K = input().split()
print(N - (K - 1))
Problem p03047 (python)

Fixed submission:
N,K = map(int,input().split())
answer = int(N) - int(K) + 1
print(str(answer))

Buggy submission (verdict: Runtime Error):
R, G, B, N = map(int, input().split())
r = 0
g = 0
X = N - r*R - g*G
num = 0
while X >= 0:
	while X >= 0:
			if X % B == 0:
				num += 1
			r += 1
			X = N - r*R - g*G
	g += 1
	r = 0
	X = N - r * R - g * G
 
print(num)

Buggy submission (verdict: Runtime Error):
n = input("N:")
k = input("K:")
answer = int(n) - int(k) + 1
print(str(answer))
Problem p03048 (python)

Fixed submission:
R,G,B,N = map(int, input().split())
count = 0
for r in range(N // R + 1) :
    for g in range((N - r*R) // G + 1) :
        if (N - r*R - g*G) %B == 0 :
            count += 1
print(count)

Buggy submission (verdict: Runtime Error):
R = int(input("R:"))
G = int(input("G:"))
B = int(input("B:"))
N = int(input("N:"))
r = 0
g = 0
X = N - r*R - g*G
num = 0
while X >= 0:
	while X >= 0:
			if X % B == 0:
				num += 1
			r += 1
			X = N - r*R - g*G
	g += 1
	r = 0
	X = N - r * R - g * G

print(num)
Problem p03369 (python)

Fixed submission:

a = input()

b = a.count("o")

print(700 + b*100)

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

m = [int(input()) for i in range(N)]

m.sort()


dounut = 0#消費した素の量
count = 0 #追加で作った数
for i in range(N):
    dounut = dounut + m[i]

while dounut < X:
        dounut = dounut + m[0]
        count += 1

if dounut >  X:
    count -= 1

print(N + count)

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())
#N = ドーナツの種類
#X = お菓子の素
#m = 消費するお菓子の素の量

m = [int(input()) for i in range(N)]

m.sort()

#print(m)

dounut = 0#消費した素の量
count = 0 #追加で作った数
for i in range(N):
    dounut = dounut + m[i]
#print(dounut)

while dounut < X:
        dounut = dounut + m[0]
        count += 1
#        print(dounut)
#        print(count)

if dounut >  X:
    count -= 1

#print(count)

print(N + count)
Problem p03385 (python)

Fixed submission:

s = list(input())
s.sort()
if "".join(s) == "abc":
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):

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

for i in range(K):
    if A+i <= B:
        print(A+i)

for i in range(K):
    if B-K+i >= A + K:
        print(B-K+i)
Problem p03493 (python)

Fixed submission:
A = list(input())

print(A.count("1"))

Buggy submission (verdict: Runtime Error):
https://beta.atcoder.jp/contests/abc081/tasks/abc081_a
Problem p03047 (python)

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

n = int(n)
k = int(k)

ans = n - k + 1
print (ans)

Buggy submission (verdict: Runtime Error):
n = input();
k = input();

n = int(n);
k = int(k);

ans = n - k + 1;
print (ans);

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

n = int(n)
k = int(k)

ans = n - k + 1
print (ans)

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

n = int(n)
k = int(k)

ans = n - k + 1
print (ans)

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

ans = n - k + 1
print (ans)
Problem p03360 (python)

Fixed submission:
a = list(map(int, input().split()))
k = int(input())
a.sort()
print(pow(2, k) * a[2] + a[1] + a[0])

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
a.sort()
print(pow(2, k) * a[2] + a[1] + a[0])