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

Fixed submission:
def input_list():
  return list(map(int, input().split()))

def main():
  r, g, b, n = input_list()
  ans = 0
  for x in range(n//r+1):
    for y in range(n//g+1):
      rr = r*x
      gg = g*y
      if rr + gg > n:
        continue
      bb = (n - rr - gg)
      if bb % b != 0:
        continue
      ans += 1
  print(ans)

main()

Buggy submission (verdict: Runtime Error):
def main():
  r, g, b, n = input_list()
  ans = 0
  for x in range(n//r+1):
    for y in range(n//g+1):
      rr = r*x
      gg = g*y
      if rr + gg > n:
        continue
      bb = (n - rr - gg)
      if bb % b != 0:
        continue
      ans += 1
  print(ans)
main()
Problem p03062 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MIN_A = min(map(abs, A))
MINUS = 0

for i in A:
  if i < 0:
    MINUS += 1

if min(A) > 0:
  print(sum(A))
  exit(0)
  
ans = 0
if MINUS % 2 == 0:
  for a in A:
    ans += abs(a)
else:
  for a in A:
    ans += abs(a)
  ans -= MIN_A * 2

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
MINUS = 0
B = []

for i in A:
  if i < 0:
    MINUS += 1
  else:
    B.append(i)
  
if min(A) > 0:
  print(sum(A))
  exit(0)
  
ans = 0
if MINUS % 2 == 0:
  for a in A:
    ans += abs(a)
else:
  mb = min(B)
  mb_flag = True
  for a in A:
    if mb_flag and a == mb:
      mb_flag = False
      continue
    ans += abs(a)
  ans -= mb

print(ans)
Problem p03161 (python)

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

dp = [float('inf')] * n
dp[0] = 0

for i in range(1, n):
  for ki in range(1, k+1):
    if ki > i:
      continue
    dp[i] = min(dp[i], dp[i-ki] + abs(a[i] - a[i-ki]))
    #print(i, ki, dp[i-ki] + abs(a[i] - a[ki]), dp)

print(dp[-1])

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

dp = [float('inf')] * n
dp[0] = 0

for i in range(1, n):
  for ki in range(1, k+1):
    dp[i] = min(dp[i], dp[i-ki] + abs(a[i] - a[i-ki]))
    #print(i, ki, dp[i-ki] + abs(a[i] - a[ki]), dp)

print(dp[-1])

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

dp = [float('inf')] * n
dp[0] = 0

for i in range(1, n):
  for ki in range(1, k+1):
    dp[i] = min(dp[i], dp[i-ki] + abs(a[i] - a[i-ki]))
    #print(i, ki, dp[i-ki] + abs(a[i] - a[ki]), dp)

print(dp[-1])

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

dp = [float('inf')] * n
dp[0] = 0

for i in range(1, n):
  for ki in range(1, k+1):
    dp[i] = min(dp[i], dp[i-ki] + abs(a[i] - a[i-ki]))
    #print(i, ki, dp[i-ki] + abs(a[i] - a[ki]), dp)

print(dp[-1])
Problem p03353 (python)

Fixed submission:
s = input()
k = int(input())
a = []
for i in range(len(s)):
  for j in range(1, k+1):
    jj = j+i
    a.append(s[i:jj])
a = sorted(set(a))
print(a[k-1])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

slen = len(s)
bstr = '1'*slen

B = int(bstr,2)
f = '0'+str(slen)+'b'
ss = list(s)

a = []
for i in range(B):
  w = ''
  fb = str(format(i, f))
  for i,si in enumerate(list(fb)):
    if si == '1':
      w += ss[i]
      
  if w != '' and w not in a:
    a.append(w)
    
a = sorted(a)
print(a[k-1])
Problem p03524 (python)

Fixed submission:
def main():
  s = input()
  ac = s.count('a')
  bc = s.count('b')
  cc = s.count('c')
  if abs(ac-bc) <= 1 and abs(bc-cc) <= 1 and abs(ac-cc) <= 1:
    print('YES')
  else:
    print('NO')
  
  
def input_list():
  return map(int, input().split())

def input_list_str():
  return map(str, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c 

import math
import fractions
import collections
from functools import reduce
main()

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

input = sys.stdin.readline

def main():
    s = input_list()
    a_num = s.count('a')
    b_num = s.count('b')
    c_num = s.count('c')
    if abs(a_num - b_num) <= 1 and abs(b_num - c_num) <= 1 and abs(a_num - c_num) <= 1:
        print('YES')
    else:
        print('NO')



def divide_list(l, args):
    result = []
    pre = 0
    for i, a in enumerate(args):
        if i != 0:
            pre = args[i-1]
        result.append(l[pre:a])
        if i == len(args) - 1:
            result.append(l[a:])
    return result

def divide_two(n):
    c = 0
    while True:
        if c >= 2:
            break
        if n % 2 != 0:
            break
        n //= 2
        c += 1
    return c

def get_camulative(l):
    import itertools
    # 累積和
    return [0] + list(itertools.accumulate(l))

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def gcd(*numbers):
    return reduce(fractions.gcd, numbers)


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


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

Fixed submission:
import collections
n = int(input())

r = []
for i in range(n):
  r.append(int(input()))

c = collections.Counter(r)
count = 0
for key, v in c.items():
  if v % 2 != 0:
    count += 1
print(count)

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

a = {}
r = []
for i in range(n):
  s = int(input())
  if s in a:
    a[s] += 1
    if a[s] % 2 == 0:
      r.remove(s)
  else:
    a[s] = 1
    r.append(s)
    
print(len(r))
Problem p03659 (python)

Fixed submission:
n = int(input())
sticks = list(map(int, input().split()))
s = sum(sticks)

a = []
sum_i = 0
for i, v in enumerate(sticks):
  sum_i += v
  if i == len(sticks) - 1:
    continue
  a.append(abs(s - 2*sum_i))

print(min(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
sticks = list(map(int, input().split()))
s = sum(sticks)

a = []
sum_i = 0
for i, v in enumerate(sticks):
  sum_i += v
  if i == 0:
    continue
  if i == len(sticks) - 1:
    continue
  a.append(abs(s - 2*sum_i))

print(min(a))
Problem p03816 (python)

Fixed submission:
n = int(input())

a = map(int, input().split())

kind = len(set(a))

if kind % 2 == 0:
  print(kind - 1)
else:
  print(kind)

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

a = map(int, input().split())

kind = len(set(a))

if kind % 2 == 0:
  print(kind - 1)
else:
  print(kin)
Problem p03828 (python)

Fixed submission:
n = int(input())

import math

def prime_factorize(n):
  a = []
  while n % 2 == 0:
    a.append(2)
    n //= 2
  f = 3
  while f*f <= n:
    if n % f == 0:
      a.append(f)
      n //= f
    else:
      f += 2
  if n != 1:
    a.append(n)
  return a

def make_divisors(n):
  divisors = []
  mod = 10**9 + 7
  s = (n**0.5)%mod
  for i in range(1, int(s)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors

p = []
for i in range(1, n+1):
  p += prime_factorize(i)

import collections
pc = collections.Counter(p)

a = 1
for v, c in pc.items():
  a *= c+1

mod = 10**9 +7
print(a%mod)

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

import math

f = math.factorial(n)

def prime_factorize(n):
  a = []
  while n % 2 == 0:
    a.append(2)
    n //= 2
  f = 3
  while f*f <= n:
    if n % f == 0:
      a.append(f)
      n //= f
    else:
      f += 2
  if n != 1:
    a.append(n)
  return a

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors

d = make_divisors(f)

print(len(d))
Problem p03838 (python)

Fixed submission:
x, y = map(int, input().split())
l = []
if x <= y:
    l.append(y - x)
if -x <= y: # 最初に1回符号反転
    l.append(y + x + 1)
if x <= -y: # 最後に1回符号反転
    l.append(-y - x + 1)
if -x <= -y: # 両方符号反転
    l.append(-y + x + 2)

ans = min(l)
print(ans)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())

l = []

if x <= y:
  l.appen(y-x)
  
if -x <= y:
  l.append(y + x + 1)
  
if x <= -y:
  l.append(-y-x+1)
  
if -x <= -y:
  l.append(-y+x+2)
  
print(min(l))

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())

l = []

if x <= y:
  l.appen(y-x)
  
if -x <= y:
  l.append(y + x + 1)
  
if x <= -y:
  l.append(-y-x+1)
  
if -x <= -y:
  l.append(-y+x+2)
  
print(min(l))
Problem p04044 (python)

Fixed submission:
# -*- coding: utf-8 -*-
count, length = list(map(int, input().split()))

words = []
for i in range(count):
  s = input()
  if len(s) != length:
    continue
  words.append(s)

words = sorted(words)

r = ''.join(words)
print(r)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
length, count = list(map(int, input().split()))

words = []
for i in range(count):
  s = input()
  if len(s) != length:
    continue
  words.append(s)

words = sorted(words)

r = ''.join(words)
print(r)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
length, count = list(map(int, input().split()))

words = []
for i in range(count):
  words.append(input())

words = sorted(words)

r = ''.join(words)
print(r)
Problem p02678 (python)

Fixed submission:
from collections import deque
import sys
def bfs(graph, N, start):
    visited = [0] * N
    visited[start] = 1
    que = deque([start])
    while que:
        node = que.popleft()
        for n in graph[node]:
            if not visited[n]:
                visited[n] = node + 1
                que.append(n)
    return visited

input = sys.stdin.readline

def main():
    N, M = map(int, input().split())

    graph = [[] for _ in range(N)]
    for i in range(M):
        A, B = map(lambda n: int(n) - 1, input().split())
        graph[A].append(B)
        graph[B].append(A)

    visited = bfs(graph, N, 0)[1:]
    if all(visited):
        print("Yes")
        print(*visited, sep="\n")
    else:
        print("No")


main()

Buggy submission (verdict: Runtime Error):
from collections import deque
import sys
def bfs(graph, N, start):
    visited = [0] * N
    visited[start] = 1
    que = deque([start])
    while que:
        node = que.popleft()
        for n in graph[node]:
            if not visited[n]:
                visited[n] = node + 1
                que.append(n)
    return visited

input = sys.stdin.readline

def main():
    N, M = map(int, input().split())

    graph = [[] for i in range(N)]
    for i in range(M):
        A, B = map(lambda n: int(n) - 1, input().split())
        graph[A].append(B)
        graph[B].append(A)

    visited = bfs(graph, N, 0)[1:]
    if all(visited):
        print("Yes")
        print(*visited, seq="\n")
    else:
        print("No")


main()
Problem p02684 (python)

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

def main():
    N, K = map(int, input().split())
    A = list(map(lambda n: int(n)-1, input().split()))

    visited = [False] * N
    visited[0] = True

    index = 0
    visited_index = [0]

    while K:
        index = A[index]
        if visited[index]:
            K -= 1
            start = visited_index.index(index)
            loop_index = visited_index[start:]
            print(loop_index[K % len(loop_index)] + 1)
            sys.exit()
        visited_index.append(index)
        visited[index] = True
        K -= 1
    print(index + 1)
    
main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    A = list(map(lambda n: int(n)-1, input().split()))

    visited = [False] * N
    visited[0] = True

    index = 0
    visited_index = [0]

    while K:
        index = A[index]
        if visited[index]:
            K -= 1
            start = A.index(A[index])
            loop_index = visited_index[start:]
            print(visited_index[K % len(loop_index)] + 1)
            exit()
        visited_index.append(index)
        visited[index] = True
        K -= 1
    print(index + 1)
    
main()
Problem p03035 (python)

Fixed submission:
from fractions import *
a, b = map(int, input().split())

if a<= 5:
    print(0)
elif 6 <= a and a <= 12:
    print(int(b/2))
else:
    print(b)

Buggy submission (verdict: Runtime Error):
from fractions import *
import sys
N, M = map(int, input().split())

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

a = sorted(a)
bc = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]

bc = sorted(bc)    

subar = a
for i in bc:
    sc = [i[1]] * i[0]
    suba = []
    ra = subar[i[0]:]
    if i[0] == len(a):
        suba = a
    suba = subar[:i[0]]
    if i[1] - max(suba) < 0:
        continue
    subar = sc + ra
    subar.sort()

print(sum(subar))
Problem p03086 (python)

Fixed submission:
S = list(input())

b = 0

ans = [0]

for n, i in enumerate(S, 1):
  if (i == 'A' or i == 'G' or i == 'C' or i == 'T'):
    b += 1
  else:
    b = 0
  ans.append(b)
print(max(ans))

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

b = 0

ans = []

s = list(S)

for i in s:
  if (i == 'A' or i == 'G' or i == 'C' or i == 'T'):
    b += 1
  else:
    ans.append(b)
    b = 0
print(max(ans))

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

b = 0

ans = []

for i in s:
  if (i == 'A' or i == 'G' or i == 'C' or i == 'T'):
    b += 1
  else:
    ans.append(b)
    b = 0

print(max(ans))
Problem p03087 (python)

Fixed submission:
import sys
 
N, Q = map(int, input().split())
 
S = input()
 
lr = [list(map(int, i.split())) for i in sys.stdin]

Sum = [0]

sum_ = 0

for i in range(len(S)-1):
  if S[i] == 'A' and S[i+1] == 'C':
    sum_ += 1
  Sum.append(sum_)

for  q in range(Q):
  ans = Sum[lr[q][1]-1]-Sum[lr[q][0]-1]
  print(ans)

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

S = input()

lr = []

for q in range(Q):
  lr.append(input().split())
  
for q in lr:
  st = q[0]-1
  en = q[1]
  s = S[st:en]
  print(s.count('AC'))
Problem p03102 (python)

Fixed submission:
N, M, C = map(int, input().split())
 
B = list(map(int, input().split()))
 
ans = 0
 
src = []

for i in range(N):
  src.append(list(map(int, input().split()))) 
  
for i in range(N):
  d = C
  for n in range(M):
    d += src[i][n]*B[n]
  if (d > 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
 
src = []

for i in range(N):
  src.append(list(map(int, input().split()))) 
  
for i in range(N):
  d += C
  for n in range(M):
    d += src[i][n]*B[n]
  print(d)
  if (d > 0):
    ans+= 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
 
B = list(input().split())
 
ans = []
 
src = []
 
for i in range(N):
  src.append(list(map(int, input().split())))
  
  for n in range(M):
    d = src[i][n]*B[n] + C
    if (d > 0):
      ans.append(1)
 
print(ans.count(1))

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

B = list(input().split())

ans = []

src = []

for i in range(N):
  src.append(list(map(int, input().split())))
  
  for n in range(N):
    d = src[i][n]*B[n] + C
    if (d > 0):
      ans.append(1)

print(ans.count(1))
Problem p03105 (python)

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

ans = 0

if (b < a):
    ans = 0
elif (b / a < c):
    ans = int(b / a)
else:
    ans = c

print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = 0

lista = list(range(a+1))
aa = lista.pop(0)

listb = list(range(b+1))
bb = listb.pop(0)

if (a < b):
    li = [i for i in lista if a % i == 0 and b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]
else:
    li = [i for i in listb if a % i == 0 and b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]

print(ans)
Problem p03109 (python)

Fixed submission:
a = str(input())

a = a[:4] + a[5:7] + a[8:]

a = int(a)

if (a > 20190430):
    print('TBD')
else:
    print('Heisei')

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

b = []

for i in range(a):
    b.append(input().split())

res = 0

for i in b:
    if (i[1] == 'BTC'):
        res += int(i[0])*380000
    else:
        res += int(i[0])

print(res)

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

b = []

for i in range(a):
    b.append(input().split())

res = 0

for i in b:
    if (i[1] == 'BTC'):
        res += i[0]*380000
    else:
        res += i[0]

print(res)

Buggy submission (verdict: Runtime Error):
a = str(input.split())

a = int(a[:4]) + int(a[5:7]) + int(a[8:])

if (a > 20190430):
    print('TBD')
else:
    print('Heisei')

Buggy submission (verdict: Runtime Error):
a = str(input.split())

a = int(a[0][:4]) + int(a[0][5:7]) + int(a[0][8:])

if (a > 20190430):
    print('TBD')
else:
    print('Heisei')

Buggy submission (verdict: Runtime Error):
a = list(map(string, input.split()))

a = int(a[0][:4]) + int(a[0][5:7]) + int(a[0][8:])

if (a > 20190430):
    print('TBD')
else:
    print('Heisei')
Problem p03125 (python)

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

def f(a, b):
    if (b % a == 0):
        return a + b 
    else:
        return b - a 
print(f(a[0], a[1]))

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

hp = list(map(int, input().split()))
result = 0
checkyakusuru = []
checkodd = []
checkeven = []

if (hp.count(hp[0]) == m[0]):
    result = hp[0]

minhp = min(hp)

for p in hp:
    if (p % minhp == 0):
        checkyakusuru.append(1)
    
    if (checkyakusuru.count(1) == m[0]):
        result = p
        break
    else:
        if (p % 2 == 0):
            checkeven.append(1)
        if (checkeven.count(1) == m[0]):
            result = 2
            break
        else:
            result = 1

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

hp = list(map(int, input().split()))
result = 0
checkyakusuru = []
checkodd = []
checkeven = []

if (hp.count(hp[0]) == m[0]):
    result = hp[0]

minhp = min(hp)

for p in hp:
    if (p % minhp == 0):
        checkyakusuru.append(1)
    
    if (checkyakusuru.count(1) == m[0]):
        result = p
        break
    else:
        if (p % 2 == 0):
            checkeven.append(1)
        if (checkeven.count(1) == m[0]):
            result = 2
        else:
            result = 1
Problem p03136 (python)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
b=0
L.sort()
 
a = L.pop(-1)
 
for i in range(N-1):
  b+= L[i]
 
if (a < b):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
L = list(input().split())
b=0
L.sort()
 
a = L.pop(-1)
 
for i in range(N-1):
  b += L[i]
 
if (a < b):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
L = list(input().split())
b=0
L.sort()
 
a = L.pop(-1)
 
for i in range(N-1):
  b+= L[i]
 
if (a < b):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
L = input().split()
b=0
L.sort()

a = L.pop(-1)

for i in range(N-1):
  b+= L[i]

if (a < b):
  print("Yes")
else:
  print("No")
Problem p03146 (python)

Fixed submission:
s = int(input())
 
ans = 0
 
if (s == 1 or s == 2 or s == 4):
  print(4)
else:
  while (s != 4):
    if (s % 2 == 0):
      s  =  int(s/2)
    else:
      s = 3*s + 1
    ans += 1
  
 
  print(ans+4)

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

ans = 0

if (s == 1 || s == 2 || s == 4):
  print(4)

while (s != 4):
  if (s % 2 == 0):
    s /= 2
  else:
    s = 3*s + 1
  ans += 1

print(ans+4)

Buggy submission (verdict: Runtime Error):
s = int(input())
 
ans=0
 
def f(n):
  if (n % 2 == 0):
    return n / 2
  else:
    return 3*n + 1
  
while (True):
  a_n = [s]
  for i in len(a_n):
    if (a_n.count(4) != 2):
      a_i = f(a_n.pop(-1))
      a_n.append(a_i)
    else:
      index = a_n.index(4)
      ans = a_n[index+3]
      break
    
print(ans)

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

ans=0

def f(n):
  if (n % 2 == 0):
    return f(n /2)
  else:
    return f(3*n + 1)
  
while (True):
  a_n = [s]
  if (a_n.count(4) != 2):
    a_n.append(f(s))
  else:
    index = a_n.index(4)
    ans = a_n[index+3]
    break
    
print(ans)
Problem p03212 (python)

Fixed submission:
N = int(input())


# N以下の753数を全列挙
def dfs(s):
  if int(s) > N:
    return 0
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0
  for c in '753':
    ret += dfs(s + c)
  return ret
    
print(dfs('0'))

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


# N以下の753数を全列挙
def dfs(s):
  if int(s) > N:
    return 0
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0
  for c in '753':
    ret += dfs(s + c)
    
print(dfs('0'))
Problem p03415 (python)

Fixed submission:
c1 = input()
c2 = input()
c3 = input()

print(c1[0]+c2[1]+c3[2])

Buggy submission (verdict: Runtime Error):
c1 = input()
c2 = input()
c3 = inpnt()

print(c1[0]+c2[1]+c3[2])
Problem p03423 (python)

Fixed submission:
N = int(input())

ans = N / 3
print(int(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
 
S = list(map(int, input().split()))
 
color = [0, 0, 0, 0]
 
for s in S:
  if (color.count(0) == 0):
    print("Four")
    break
  
  if (s == "P"):
    color[0] += 1
  elif (s == "G"):
    color[1] += 1
  elif (s == "W"):
    color[2] += 1
  else:
    color[3] += 1
  
if (color.count(0) == 1):
  print(Three)
Problem p03424 (python)

Fixed submission:
N = int(input())
 
S = list(map(str, input().split()))
 
color = [0, 0, 0, 0]
 
for s in S:
  if (color.count(0) == 0):
    print("Four")
    break
  
  if (s == "P"):
    color[0] += 1
  elif (s == "G"):
    color[1] += 1
  elif (s == "W"):
    color[2] += 1
  else:
    color[3] += 1
  
if (color.count(0) == 1):
  print("Three")

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

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

color = [0, 0, 0, 0]

for s in S:
  if (s == "P"):
    color[0] += 1
  elif (s == "G"):
    color[1] += 1
  elif (s == "W"):
    color[2] += 1
  else:
    color[3] += 1
  
if (color.count(0) == 3):
  print(Three)
else:
  print(Four)
Problem p03573 (python)

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

if A == B:
    print(C)
elif B == C:
    print(A)
else:
    print(B)

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

if A == B:
    print(C)
elif B == C:
    print(A)
else:
    print(B)
Problem p03623 (python)

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

if abs(x-a) > abs(x-b):
  print('B')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
x, a, b = map(int, input().split())

if abs(x-a) > abs(x-b):
  print(B)
else:
  print(A)
Problem p03635 (python)

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

print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n, m = input().split()

print((n-1)*(m-1))
Problem p03827 (python)

Fixed submission:
from fractions import *
n = int(input())
s = input()

x = 0
ans = 0
for i in range(n):
    if s[i] == 'I':
        x += 1
    else:
        x -= 1
    ans = max(x, ans)

print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import *
n = int(input())
s = input()

x = 0
ans = 0
for i in range(N):
    if s[i] == 'I':
        x += 1
    else:
        x -= 1
    ans = max(x, ans)

print(ans)
Problem p03845 (python)

Fixed submission:
import copy
n = int(input())

t = list(map(int, input().split()))
m = int(input())

for i in range(m):
    copy_t = copy.copy(t)
    p, x  = map(int, input().split())
    copy_t[p-1] = x
    print(sum(copy_t))

Buggy submission (verdict: Runtime Error):
import copy
n = int(input())

t = list(map(int, input().split()))
m = int(input())

for i in range(M):
    copy_t = copy.copy(t)
    p, x  = map(int, input().split())
    copy_t[p-1] = x
    print(sum(copy_t))