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

Fixed submission:
n, W = map(int, input().split())
dp = [[0] * (W + 1) for _ in range(n + 1)]

dp[0][W] = 0
for i in range(n):
    w, v = map(int, input().split())
    for j in range(W + 1):
        if j >= w:
            dp[i + 1][j] = max(dp[i][j - w] + v, dp[i][j])
        else:
            dp[i + 1][j] = dp[i][j]
print(dp[n][W])

Buggy submission (verdict: Runtime Error):
import numpy as np
n, W = map(int, input().split())
dp = np.zeros((n + 1, W + 1))

for i in range(n):
    w, v = map(int, input().split())
    dp[i + 1] = dp[i]
    if w <= W:
        dp[i + 1][w:] = np.maximum(dp[i][:W - w + 1] + v, dp[i][w:])
print(int(dp[n][W]))
Problem p03164 (python)

Fixed submission:
n, W = map(int, input().split())
dp = [W + 1] * (1010 * (n + 1))

dp[0] = 0
v_max = 0
for i in range(n):
    w, v = map(int, input().split())
    v_max += v
    for j in range(v_max, v - 1, -1):
        dp[j] = min(dp[j - v] + w, dp[j])

ans = 0
for i in range(v_max, -1, -1):
    if dp[i] <= W:
        ans = max(ans, i)
print(ans)

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

n, W = [int(i) for i in input().split()]
dp = [W + 1] * (1010 * (n + 1))

dp[0] = 0
v_max = 0
for i in range(n):
    w, v = map(int, input().split())
    v_max += v
    for j in range(v_max, v - 1, -1):
        dp[j] = min(dp[j - v] + w, dp[j])

ans = 0
for i in range(v_max, -1, -1):
    if dp[i] <= W:
        ans = max(ans, i)
print(ans)

Buggy submission (verdict: Runtime Error):
n, W = map(int, input().split())
dp = [0] * (W + 1)

for i in range(n):
    w, v = map(int, input().split())
    for j in range(W, w - 1, -1):
        dp[j] = max(dp[j - w] + v, dp[j])
print(dp[W])

Buggy submission (verdict: Runtime Error):
n, W = map(int, input().split())
dp = [[0] * (W + 1) for _ in range(n + 1)]

for i in range(n):
    w, v = map(int, input().split())
    for j in range(W + 1):
        if j >= w:
            dp[i + 1][j] = max(dp[i][j - w] + v, dp[i][j])
        else:
            dp[i + 1][j] = dp[i][j]
print(dp[n][W])

Buggy submission (verdict: Runtime Error):
import numpy as np
n, W = map(int, input().split())
dp = np.zeros((n + 1, W + 1))

for i in range(n):
    w, v = map(int, input().split())
    dp[i + 1] = dp[i]
    if w <= W:
        dp[i + 1][w:] = np.maximum(dp[i][:W - w + 1] + v, dp[i][w:])
print(int(dp[n][W]))
Problem p03166 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(200000)

n, m = map(int, input().split())
graph = [[] for _ in range(n)]
for i in range(m):
    x, y = map(int, input().split())
    graph[x - 1].append(y - 1)

dp = [-1] * n
def count(a):
    if dp[a] != -1:
        return dp[a]
    else:
        dp[a] = 0
        for i in graph[a]:
            dp[a] = max(count(i) + 1, dp[a])
        return dp[a]

print(max([count(i) for i in range(n)]))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
graph = [[] for _ in range(n)]
for i in range(m):
    x, y = map(int, input().split())
    graph[x - 1].append(y - 1)

dp = [-1] * n
def count(a):
    if dp[a] != -1:
        return dp[a]
    else:
        dp[a] = 0
        for i in graph[a]:
            dp[a] = max(count(i) + 1, dp[a])
        return dp[a]

print(max([count(i) for i in range(n)]))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
graph = [[] for _ in range(n)]
for i in range(m):
    x, y = map(int, input().split())
    graph[x - 1].append(y - 1)

dp = [-1] * n
def count(a):
    if dp[a] != -1:
        return dp[a]
    else:
        dp[a] = 0
        for i in graph[a]:
            dp[a] = max(count(i) + 1, dp[a])
        return dp[a]

print(max([count(i) for i in range(n)]))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
graph = [[] for _ in range(n)]
for i in range(m):
    x, y = map(int, input().split())
    graph[x - 1].append(y - 1)

dp = [-1] * n
def count(a):
    if dp[a] != -1:
        return dp[a]
    else:
        dp[a] = 0
        for i in graph[a]:
            dp[a] = max(count(i) + 1, dp[a])
        return dp[a]

print(max([count(i) for i in range(n)]))
Problem p03175 (python)

Fixed submission:
import sys
sys.setrecursionlimit(500000)

n = int(input())
mod = 10 ** 9 + 7
node = [[] for _ in range(n)]
memo_f, memo_g = [0] * n, [0] * n
for i in range(n - 1):
    x, y = map(int, input().split())
    node[x - 1].append(y - 1)
    node[y - 1].append(x - 1)

def f(x, prev):
    if memo_f[x]:
        return memo_f[x]
    memo_f[x] = 1
    for i in node[x]:
        if i == prev:
            continue
        memo_f[x] = (memo_f[x] * g(i, x)) % mod
    memo_f[x] = (memo_f[x] + g(x, prev)) % mod
    return memo_f[x]

def g(x, prev):
    if memo_g[x]:
        return memo_g[x]
    memo_g[x] = 1
    for i in node[x]:
        if i == prev:
            continue
        memo_g[x] = (memo_g[x] * f(i, x)) % mod
    return memo_g[x]

print(f(0, -1))

Buggy submission (verdict: Runtime Error):
n = int(input())
mod = 10 ** 9 + 7
node = [[] for _ in range(n)]
for i in range(n - 1):
    x, y = map(int, input().split())
    node[x - 1].append(y - 1)
    node[y - 1].append(x - 1)

def f(x, prev):
    cnt = 1
    for i in node[x]:
        if i != prev:
            cnt *= g(i, x)
            cnt %= mod
    return g(x, prev) + cnt

def g(x, prev):
    cnt = 1
    for i in node[x]:
        if i != prev:
            cnt *= f(i, x)
            cnt %= mod
    return cnt

print(f(0, -1))
Problem p03240 (python)

Fixed submission:
n = int(input())
pyr = []
for i in range(n):
    x, y, h = map(int, input().split())
    if h != 0:
        pyr.append((x, y, h))

if len(pyr) == 1:
    print(*pyr[0])
    exit()

for i in range(101):
    for j in range(101):
        cx, cy = (i, j)
        h_list = []
        for k in range(len(pyr)):
            x, y, h = pyr[k]
            h_list.append(h + abs(x - cx) + abs(y - cy))
        if len(set(h_list)) != 1:
            continue
        else:
            print(cx, cy, h_list[0])
            exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
pyr = []
for i in range(n):
    x, y, h = map(int, input().split())
    if h != 0:
        pyr.append((x, y, h))

if len(pyr) == 1:
    print(*pyr[0])
    exit()

for i in range(101):
    for j in range(101):
        cx, cy = (i, j)
        h_list = []
        for k in range(n):
            x, y, h = pyr[k]
            h_list.append(h + abs(x - cx) + abs(y - cy))
        if len(set(h_list)) != 1:
            continue
        else:
            print(cx, cy, h_list[0])
            exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
pyr = []
for i in range(n):
    x, y, h = map(int, input().split())
    if h != 0:
        pyr.append((x, y, h))

if len(pyr) == 1:
    print(*pyr[0])
    exit()

for i in range(101):
    for j in range(101):
        cx, cy = (i, j)
        h_list = []
        for k in range(n):
            x, y, h = pyr[k]
            if h != 0:
                h_list.append(h + abs(x - cx) + abs(y - cy))
        if len(set(h_list)) != 1:
            continue
        else:
            print(cx, cy, h_list[0])
            exit()
Problem p03565 (python)

Fixed submission:
s = input()
t = input()
ns = len(s)
nt = len(t)

ans = "UNRESTORABLE"
for i in range(ns - nt + 1):
    if all([s[i + j] == "?" or s[i + j] == t[j] for j in range(nt)]):
        ans = s[:i] + t + s[i + nt:]
        ans = ans.replace("?", "a")
print(ans)

Buggy submission (verdict: Runtime Error):
nt = len(t)

if ns < nt:
    print("UNRESTORABLE")
else:
    for i in range(ns - nt + 1):
        if all([s[i + j] == "?" or s[i + j] == t[j] for j in range(nt)]):
            ans = s[:i] + t + s[i + nt:]
            ans = ans.replace("?", "a")
            print(ans)
            exit()
print("UNRESTORABLE")
Problem p03220 (python)

Fixed submission:
N=int(input())
T, A=map(int, input().split())
N=list(map(int,input().split()))
temp1=list(map(lambda x: (T-0.006*x),N))
temp=list(map(lambda x: abs(A-(T-0.006*x)),N))
print(temp.index(min(temp))+1)

Buggy submission (verdict: Runtime Error):
N=int(input())
T, A=map(int, input().split())
N=list(map(int,input().split()))
temp=list(map(lambda x: abs(A-(T-0.006*x)),N))
temp.index(min(temp)+1)
Problem p03308 (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=input()
A=list(map(int, input().split()))
A.sort()
print(A[N-1]-A[0])
Problem p03369 (python)

Fixed submission:
S=str(input())
N=int(700)
if S[0]=='o':
  N=N+100
if S[1]=='o':
  N=N+100
if S[2]=='o':
  N=N+100
print(N)

Buggy submission (verdict: Runtime Error):
S=str(input())
N=int(700)
if S[0]=='o'
  N=N+100
if S[1]=='o'
  N=N+100
if S[2]=='o'
  N=N+100
print(N)
Problem p03373 (python)

Fixed submission:
A,B,C,X,Y=map(int, input().split())
cnta=0
cntb=0
cntc=0
if X>Y:
  if A+B>2*C:
    cntc+=2*Y
  else:
    cnta+=Y
    cntb+=Y
  if A>2*C:
    cntc+=2*(X-Y)
  else:
    cnta+=(X-Y)
else:
  if A+B>2*C:
    cntc+=2*X
  else:
    cnta+=X
    cntb+=X
  if B>2*C:
    cntc+=2*(Y-X)
  else:
    cntb+=(Y-X)

print(cnta*A+cntb*B+cntc*C)

Buggy submission (verdict: Runtime Error):
a,b,c,x,y=map(int, input().split())
cnta=0
cntb=0
cntc=0
if a+b>2*c:
  cntc=min(x,y) * 2
else:
  cnta=min(x,y)
  cntb=min(x,y)

if x>y:
  if a>2*c:
    cntc+=2*(x-y)
  else:
    cnta+=x-y
else:
  if b>2*c:
    cntc+=2*(y-x)
  else:
    cntb+=y-x

ptint(cnta*a+cntb*b+cntc*c)
Problem p03408 (python)

Fixed submission:
N=int(input())
result={}
s=[]
t=[]
for i in range(N):
  s.append(input())
  if s[i] in result.keys():
    result[s[i]]+=1
  else:
    result[s[i]]=1
M=int(input())
for j in range(M):
  t.append(input())
  if t[j] in result.keys():
    result[t[j]]-=1
if max(result.values()) > 0:
  print(max(result.values()))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
N=int(input())
result={}
s=[]
t=[]
for i in range(N):
  s.append(input())
  if s[i] in result.keys():
    result[s[i]]+=1
  else:
    result[s[i]]=1
M=int(input())
for j in range(M):
  t.append(input())
  if t[j] in result.keys():
    result[t[j]]-=1
print(max(k for k in result.values() if k > 0))
Problem p03485 (python)

Fixed submission:
a,b = map(int, input().split())
print(int((a+b+2-1)/2))

Buggy submission (verdict: Runtime Error):
s=sorted(str(input()))
t=sorted(str(input()),reverse=True)
if s<t:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s=sorted(str(input()))
t=sorted(str(input()),reverse=True)
if s<=t:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s=sorted(str(input())
t=sorted(str(input(),reverse=True))
if s<=t:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s=sorted(str(input()))
t=sorted(str(input(),reverse=True))
if s<=t:
  print('Yes')
else:
  print('No')
Problem p03493 (python)

Fixed submission:
a = str(input())
n = int(0)
if a[0]=='1':
  n = n+1
if a[1]=='1':
  n = n+1
if a[2]=='1':
  n = n+1
print(n)

Buggy submission (verdict: Runtime Error):
a = string(input())
n = int(0)
if a[0]=='1':
  n = n+1
if a[1]=='1':
  n = n+1
if a[2]=='1':
  n = n+1
print(n)
Problem p03599 (python)

Fixed submission:
A,B,C,D,E,F=map(int, input().split())
cnt_A=0
cnt_B=0
cnt_C=0
cnt_D=0
max_noudo=0
water=A*100
sugar=0
while cnt_A*100*A <= F:
  cnt_B=0
  while cnt_B*100*B <= F-cnt_A*100*A:
    cnt_C=0
    while cnt_C*C <= F-cnt_A*100*A-cnt_B*100*B:
      cnt_D=0
      while cnt_D*D <= F-cnt_A*100*A-cnt_B*100*B-cnt_C*C:
        if (cnt_A*A+cnt_B*B)*E >= cnt_C*C+cnt_D*D >0:
          if max_noudo < 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B):
            max_noudo = 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B)
            water=cnt_A*A*100+cnt_B*B*100+cnt_C*C+cnt_D*D
            sugar=cnt_C*C+cnt_D*D
        cnt_D+=1
      cnt_C+=1
    cnt_B+=1
  cnt_A+=1
 
print(water,sugar)

Buggy submission (verdict: Runtime Error):
cnt_A=0
cnt_B=0
cnt_C=0
cnt_D=0
max_noudo=0
water=0
sugar=0
while cnt_A*100*A <= F:
  cnt_B=0
  while cnt_B*100*B <= F-cnt_A*100*A:
    cnt_C=0
    while cnt_C*C <= F-cnt_A*100*A-cnt_B*100*B:
      cnt_D=0
      while cnt_D*D <= F-cnt_A*100*A-cnt_B*100*B-cnt_C*C:
        if (cnt_A*A+cnt_B*B)*E >= cnt_C*C+cnt_D*D >0:
          if max_noudo < 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B):
            max_noudo = 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B)
            water=cnt_A*A*100+cnt_B*B*100+cnt_C*C+cnt_D*D
            sugar=cnt_C*C+cnt_D*D
          cnt_D+=1
        else:
          break
      cnt_C+=1
    cnt_B+=1
  cnt_A+=1

print(str(water)+' '+str(sugar))
Problem p03644 (python)

Fixed submission:
N=int(input())
n=0
while N>=2**n:
  n+=1
print(2**(n-1))

Buggy submission (verdict: Runtime Error):
N=int(input())
n=0
while N>=2**n:
  n+=1
print(2**(n-1)
Problem p03693 (python)

Fixed submission:
r,g,b = map(int, input().split())
if (r*100+g*10+b)%4 == 0:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
r,g,b = map(int, input().split())
if (r*100+g*10+b)%%4 == 0:
  print('YES')
else:
  print('NO')
Problem p03807 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
kazu = len([x for x in A if x%2 == 1])
if kazu%2==1:
  print('NO')
else:
  print('YES')

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split())
kazu = len([x for x in A if x%2 == 1])
if kazu%2==1:
  print('NO')
else:
  print('YES')
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


A,B,C,D = map(int,input().rstrip().split(' '))
x = (B // C) - ((A-1) // C)
y =  (B // D) - ((A-1) // D)
E = (C * D) // gcd(C,D)
z = (B // E) - ((A-1) // E)
print((B-A+1)-(x+y-z))

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().rstrip().split(' '))
x = (B // C) - ((A-1) // C)
y =  (B // D) - ((A-1) // D)
E = (C * D) // math.gcd(C,D)
z = (B // E) - ((A-1) // E)
print((B-A+1)-(x+y-z))
Problem p03001 (python)

Fixed submission:
a,b,x,y = map(int,input().rstrip().split(' '))
r = 0
if x + x == a and y + y == b:
    r = 1
print(a*b/2,r)

Buggy submission (verdict: Runtime Error):
a,b,x,y = input().rstrip().split(' ')
r = 0
if x + x == a and y + y == b:
    r = 1
print(a*b/2,r)
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
  
def lcm(a, b):
	return a * b // gcd (a, b)

A,B,C,D = [int(x) for x in input().split(' ')]
a = (B - A + 1) 
b = ((B // C) - ((A-1) // C))
c = ((B // D) - ((A-1) // D))
CD = lcm(C,D)
d = ((B // (CD)) - ((A-1) // (CD)))
q = a - b - c + d
print(q)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x,y):
  return (x*y) // math.gcd(x,y)

A,B,C,D = [int(x) for x in input().split(' ')]
a = (B - A + 1) 
b = ((B // C) - ((A-1) // C))
c = ((B // D) - ((A-1) // D))
CD = lcm(C,D)
d = ((B // (CD)) - ((A-1) // (CD)))
q = a - b - c + d
print(q)
Problem p03047 (python)

Fixed submission:
N,K = [int(x) for x in input().split(' ')]
ans = N - (K-1)
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = [int(x) for x in input().split(' ')]

return N - (K - 1)
Problem p03059 (python)

Fixed submission:
A,B,T = [int(x) for x in input().split(' ')]
print(int(B * ((T + 0.5) // A)))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(x) for x in input().split(' ')]

s = 0
mc = 0
for i in A:
  if i <= 0:
    mc += 1
  s += abs(i)

if (mc % 2 == 1):
  mv = min(A[0],A[-1])
  #print('mv',mv)
  s -= mv*2
print(s)
Problem p03971 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created:  2016-10-10
#

# Usage
#
"""

def read_value():
    first_line = input()
    status = first_line.split(" ")

    num_of_contestant = int(status[0])
    basis = int(status[1])
    oversea_limit = int(status[2])

    second_line = input()
    rank_str = second_line

    return [num_of_contestant, basis, oversea_limit, rank_str]


def check_japan(rank, basis, oversea_limit):
    if rank < basis + oversea_limit:
        return "Yes"
    else:
        return "No"

def check_overseas(rank, oversea_rank, basis, oversea_limit):
    if rank < basis + oversea_limit and oversea_rank <= oversea_limit:
        return "Yes"
    else:
        return "No"


if __name__ == "__main__":
    input_items = read_value()

    basis = input_items[1]
    oversea_limit = input_items[2]
    rank_str = input_items[3]

    oversea_rank = 0
    passed = 0

    for rank, type in enumerate(rank_str):
        if type == "a":
            if check_japan(passed, basis, oversea_limit) == "Yes":
                print("Yes")
                passed += 1
            else:
                print("No")

        if type == "b":
            oversea_rank += 1
            if check_overseas(passed, oversea_rank, basis, oversea_limit) == "Yes":
                print("Yes")
                passed += 1
            else:
                print("No")

        if type == "c":
            print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created:  2016-10-10
#

# Usage
#
"""

def read_value():
    first_line = input()
    status = first_line.split(" ")

    num_of_contestant = status[0]
    basis = status[1]
    oversea_limit = status[2]

    second_line = input()
    rank_str = second_line

    return [num_of_contestant, basis, oversea_limit, rank_str]


def check_japan(rank, basis, oversea_limit):
    if rank < basis + oversea_limit:
        return "Yes"
    else:
        return "No"

def check_overseas(rank, oversea_rank, basis, oversea_limit):
    if rank < basis + oversea_limit and oversea_rank < oversea_limit:
        return "Yes"
    else:
        return "No"


if __name__ == "__main__":
    input_items = read_value()

    basis = input_items[1]
    oversea_limit = input_items[2]
    rank_str = input_items[3]

    oversea_rank = 0

    for rank, type in enumerate(rank_str):
        if type == "a":
            print(check_japan(rank, basis, oversea_limit))

        if type == "b":
            oversea_rankt += 1
            print(check_overseas(rank, oversea_rank, basis, oversea_limit))

        if type == "c":
            print("No")
Problem p03992 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created:  2016-09-28
#

# Usage
#
"""
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import

def input_process():
    """Receive Inputs."""
    return input()


def insert_space(target_str: str) -> str:
    """
    >>> insert_space("codefestival")
    code festival
    """
    return target_str[0:4] + " " + target_str[4:]

if __name__ == "__main__":
    target = input()

    print(insert_space(target))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created:  2016-09-28
#

# Usage
#
"""
import sys

def input_single_line():
    """Receive Inputs."""
    return input()

def input_two_line():
    """Receive Two Lined Inputs.
    Like this.

    N
    1 2 3 4 5
    """
    sys.stdin.readline()
    target = sys.stdin.readline()
    target = target.rstrip("\n")
    target = target.split(" ")

    return target


def search_lovers(target_list: list) -> None:
    """Search Simple."""
    lovers = []
    for i in target_list:
        pos = int(i)
        if target_list[pos-1] == pos-1:
            lovers.append(pos-1)

    print(len(lovers))


if __name__ == "__main__":
    import doctest
    doctest.testmod()

    target = input_two_line()

    search_lovers(target)
Problem p03993 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created:  2016-09-28
#

# Usage
#
"""
import sys

def input_single_line():
    """Receive Inputs."""
    return input()

def input_two_line():
    """Receive Two Lined Inputs.
    Like this.

    N
    1 2 3 4 5
    """
    sys.stdin.readline()
    target = sys.stdin.readline()
    target = target.rstrip("\n")
    target = target.split(" ")

    return target


def search_lovers(target_list: list) -> None:
    """Search Simple.
    >>> target_list = [2, 3, 1]
    >>> search_lovers(target_list)
    0
    >>> target_list = [2, 1, 4, 3]
    >>> search_lovers(target_list)
    2
    >>> target_list = [5, 5, 5, 5, 1]
    >>> search_lovers(target_list)
    1
    """
    target_list = [int(i) - 1 for i in target_list]
    lovers = []
    ans = 0
    for i, n in enumerate(target_list):
        if target_list[n] == i:
            ans = ans + 1

    print(int(ans/2))


if __name__ == "__main__":
    import doctest
    doctest.testmod()

    target = input_two_line()

    search_lovers(target)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created:  2016-09-28
#

# Usage
#
"""
import sys

def input_single_line():
    """Receive Inputs."""
    return input()

def input_two_line():
    """Receive Two Lined Inputs.
    Like this.

    N
    1 2 3 4 5
    """
    sys.stdin.readline()
    target = sys.stdin.readline()
    target = target.rstrip("\n")
    target = target.split(" ")

    return target


def search_lovers(target_list: list) -> None:
    """Search Simple."""
    lovers = []
    for i in target_list:
        if target_list[i-1] == i-1:
            lovers.append(i-1)

    print(len(lovers))


if __name__ == "__main__":
    import doctest
    doctest.testmod()

    target = input_two_line()

    search_lovers(target)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
 
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a, b = input().split()
if a * b % 2 == 0:
    print("True")
else:
    print("False")
Problem p03493 (python)

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

Buggy submission (verdict: Runtime Error):
s1, s2, s3 = map(int, input().split())
print(s1 + s2 + s3)
Problem p03050 (python)

Fixed submission:
import math
N = int(input())
result = 0

root = math.ceil(math.sqrt(N))
for i in range(root):
    if N % (i + 1) == 0 and (i + 1) + 1 < N // (i + 1):
        result += N // (i + 1) - 1

print(result)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
result = 0

root = math.ceil(math.sqrt(N))
for i in range(root):
    if N % i  == 0:
        result += (N // i)  - 1

print(result)

Buggy submission (verdict: Runtime Error):

import math
N = int(input())
result = 0

root = math.ceil(math.sqrt(N))
for i in range(root):
    if N % i  == 0:
        result += N // i  - 1

print(result)
Problem p03086 (python)

Fixed submission:
N = input()
charlist = list(N)
hoge = 0
maxscore = 0
def onon(char, hogehoge):
    nowscore = 0
    while char[hogehoge] == "A" or char[hogehoge] == "T" or char[hogehoge] == "G" or char[hogehoge] == "C" :
        hogehoge = hogehoge + 1
        nowscore += 1
        if hogehoge  >= len(char):
            break
    return nowscore 
for i in charlist:
    score = 0
    if i == "A" or i == "T" or i == "G" or i == "C"  :
        score = onon(charlist,hoge)
    if maxscore <= score:
        maxscore = score
    hoge = hoge + 1
print(maxscore)

Buggy submission (verdict: Runtime Error):

N = input()
charlist = list(N)
hoge = 0
maxscore = 0
def onon(char, hogehoge):
    nowscore = 0
    while char[hogehoge] == "A" or char[hogehoge] == "T" or char[hogehoge] == "G" or char[hogehoge] == "C" :
        hogehoge = hogehoge + 1
        nowscore += 1
    return nowscore 
for i in charlist:
    score = 0
    if i == "A" or i == "T" or i == "G" or i == "C"  :
        score = onon(charlist,hoge)
    if maxscore <= score:
        maxscore = score
    hoge = hoge + 1
print(maxscore)