Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

a, b, c, d = map(int, input().split())

g = 0

for i in range(d):
    if a > 0:
        g += 1
        a -= 1
        continue
    if b > 0:
        b -= 1
        continue
    if c > 0:
        g -= 1
        c -= 1
        continue

print(str(g))


Fixed submission:
# -*- coding: utf-8 -*-

import sys

a, b, c, d = map(int, input().split())

g = 0
gc = d

if d - a > 0 and a > 0:
    g += a
    d -= a
elif a > 0:
    g += d
    print(str(g))
    sys.exit()

if d - b > 0 and b > 0:
    d -= b
elif b > 0:
    print(str(g))
    sys.exit()

if d == c and c > 0:
    g -= d
elif c > 0:
    g -= d

print(str(g))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

a, b, c, d = map(int, input().split())

g = 0

while 0 == d:
    d = d - a * d
    if a - d >= 0:
        g += d
        d = 0

b > 0

for i in range(d):
    if a > 0:
        g += 1
        a -= 1
        continue
    if b > 0:
        b -= 1
        continue
    if c > 0:
        g -= 1
        c -= 1
        continue

print(str(g))


Fixed submission:
# -*- coding: utf-8 -*-

import sys

a, b, c, d = map(int, input().split())

g = 0
gc = d

if d - a > 0 and a > 0:
    g += a
    d -= a
elif a > 0:
    g += d
    print(str(g))
    sys.exit()

if d - b > 0 and b > 0:
    d -= b
elif b > 0:
    print(str(g))
    sys.exit()

if d == c and c > 0:
    g -= d
elif c > 0:
    g -= d

print(str(g))
Buggy python submission (verdict: Time Limit Exceeded):

def cost(n, k, nums):
    dp = [0 for _ in range(n)]
    dp[0] = 0
    dp[1] = abs(nums[1] - nums[0])
    for i in range(2, n):
        mincost = float('inf')
        for j in range(1, k+1):
            if i-j >= 0:
                mincost = min(mincost, dp[i-j] + abs(nums[i] - nums[i-j]))
        dp[i] = mincost
    return dp[-1]

# n, k = 10, 4
# nums = [40, 10, 20, 70, 80, 10, 20, 70, 80, 60]
n, k = [int(i) for i in input().split()]
nums = [int(i) for i in input().split()]
print(cost(n, k, nums))

Fixed submission:

def cost(n, k, nums):
    dp = [0] * n
    dp[0] = 0
    dp[1] = abs(nums[0] - nums[1])
    for i in range(2, n):
        dp[i] = min(abs(nums[i]-nums[j]) + dp[j] for j in range(max(0, i-k), i))
    return dp[-1]

n, k = [int(i) for i in input().split()]
nums = [int(i) for i in input().split()]
print(cost(n, k, nums))
Buggy python submission (verdict: Runtime Error):
import math
float R
R=float(input())
print(2*R*math.pi)

Fixed submission:
import math
R=float(input())
print(2*R*math.pi)

Buggy python submission (verdict: Runtime Error):
import math
float R
R=float(input())
print(2*math.pi*R)

Fixed submission:
import math
R=float(input())
print(2*R*math.pi)

Buggy python submission (verdict: Runtime Error):
import math
froat R
R=input()
print(2*math.pi*R)

Fixed submission:
import math
R=float(input())
print(2*R*math.pi)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
N,K=map(int, input().split())
p=list(map(int, input().split()))
kitai=[0]*N
kitaiwa=[0]*(N-K+1)
for i in range(N):
    kitai[i]=(p[i]+1)/2
if N==K:
    print(sum(kitai))
elif K==1:
    print(max(kitai))
else:
    for i in range(N-K+1):
        for j in range(K):
            kitaiwa[i]+=kitai[i+j]
    print(max(kitaiwa))

Fixed submission:
S,T=map(str, input().split())
A,B=map(int, input().split())
U=input()

if U==S:
    print(A-1,B)
else:
    print(A,B-1)

Buggy python submission (verdict: Runtime Error):
N,K=map(int, input().split())
p=list(map(int, input().split()))
kitai=[0]*N
kitaiwa=[0]*(N-K+1)
for i in range(N):
    kitai[i]=(p[i]+1)/2
if N==K:
    print(sum(kitai))
elif K==1:
    print(max(kitai))
else:
    for i in range(N-K+1):
        for j in range(K):
            kitaiwa[i]+=kitai[i+j]
    print(max(kitaiwa))

Fixed submission:
S,T=map(str, input().split())
A,B=map(int, input().split())
U=input()

if U==S:
    print(A-1,B)
else:
    print(A,B-1)

Buggy python submission (verdict: Runtime Error):
N,K=map(int, input().split())
p=list(map(int, input().split()))
kitai=[0]*N
kitaiwa=[0]*(N-K+1)
if N=K:
    print(sum(kitai))
elif K==1:
    print(max(kitai))
else:
    for i in range(N):
        kitai[i]=(p[i]+1)/2
    for i in range(N-K+1):
        for j in range(K):
            kitaiwa[i]+=kitai[i+j]
    print(max(kitaiwa))

Fixed submission:
S,T=map(str, input().split())
A,B=map(int, input().split())
U=input()

if U==S:
    print(A-1,B)
else:
    print(A,B-1)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
N,K=map(int, input().split())
p=list(map(int, input().split()))
kitaiwa=[0]*(N-K+1)
for i in range(N):
    p[i]=(p[i]+1)/2
for i in range(N-K+1):
    kitaiwa[i] = sum(p[i:i+K])
print(max(kitaiwa))

Fixed submission:
S,T=map(str, input().split())
A,B=map(int, input().split())
U=input()

if U==S:
    print(A-1,B)
else:
    print(A,B-1)

Buggy python submission (verdict: Runtime Error):
N,K=map(int, input().split())
p=list(map(int, input().split()))
kitaiwa=[0]*(N-K+1)
for i in range(N):
    p[i]=(p[i]+1)/2
for i in range(N-K+1):
    kitaiwa[i] = sum(p[i:i+K])
print(max(kitaiwa))

Fixed submission:
S,T=map(str, input().split())
A,B=map(int, input().split())
U=input()

if U==S:
    print(A-1,B)
else:
    print(A,B-1)
Buggy python submission (verdict: Time Limit Exceeded):
a=list(map(int, input().split()))
taka=a[0]
ao=a[1]
K=a[2]
i=0
while 1:
    if i<K:
        if taka>0:
            taka-=1
            i+=1
        elif ao>0:
            ao-=1
            i+=1
        else:
            break
    else:
        break
print(taka,ao)

Fixed submission:
a=list(map(int, input().split()))
taka=a[0]
ao=a[1]
K=a[2]
if K==taka:
    print(0,ao)
elif K<taka:
    print(taka-K,ao)
elif K>taka and K-taka<=ao:
    print(0,ao-(K-taka))
elif K>taka and K-taka>=ao:
    print(0,0)
Buggy python submission (verdict: Runtime Error):
s=[int(input()) for i in range(2)]
elif s[0]+s[1]==3:
	print("3")
elif s[0]+s[1]==4:
	print("2")
elif s[0]+s[1]==5:
	print("1")
else:
	print("error")

Fixed submission:
s=[int(input()) for i in range(2)]
if s[0]+s[1]==3:
	print("3")
elif s[0]+s[1]==4:
	print("2")
elif s[0]+s[1]==5:
	print("1")
else:
	print("error")
Buggy python submission (verdict: Runtime Error):
import math
N=int(input())
X=float(N)/1.08
if X%1==0.0:
    print(int(X))
else:
    Y=math.floor(X)
    if math.floor(Y*1.08)==N or math.floor((Y-1)*1.08)==N:
        print(Y)
    else:
        print(":(")

Fixed submission:
a=list(map(int, input().split()))
b=list(map(int, input().split()))
ou=b[0]-a[0]
if ou == 1:
  print(1)
elif ou==0:
  print(0)
elif ou==1-12:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int, input().split()))for i in range(n)]
cnt = 0
for i in range(n):
  total = 0
  for j in range(m):
    total += b[j] * a[i][j]
  total += c
  if total > 0:
    cnt += 1
print(cnt)

Fixed submission:
n,m,c=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int, input().split()))for i in range(n)]
cnt = 0
for i in range(n):
  total = 0
  for j in range(m):
    total += B[j] * A[i][j]
  total += c
  if total > 0:
    cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n, m, c = map(int, input().split()
B = list(map(int, input().split()))
A = [list(map(int, input().split()))for i in range(n)]
cnt = 0
for i in range(n):
  total = 0
  for j in range(m):
    total += b[j] * a[i][j]
  total += c
  if total > 0:
    cnt += 1
print(cnt)


Fixed submission:
n,m,c=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int, input().split()))for i in range(n)]
cnt = 0
for i in range(n):
  total = 0
  for j in range(m):
    total += B[j] * A[i][j]
  total += c
  if total > 0:
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):

n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
    a[i] -= 1

loop = [0]
loop_corr = []
while len(loop) < k:
    curr = loop[len(loop) - 1]
    if a[curr] not in set(loop):
        loop.append(a[curr])
        # print(loop)
    else:
        loop_corr = loop[loop.index(a[curr]):len(loop)]
        break
        # loop_idx.append(loop.index(a[curr]))
        # loop_idx.append(len(loop)-1)


# print(loop)
# print(loop_corr)
if len(loop) > k:
    print(loop[k]+1)
else:
    diff = k - len(loop) + 1
    mod = (diff % len(loop_corr)) -1
    # print(diff)
    # print(mod)
    print(loop_corr[mod]+1)
        
    

Fixed submission:

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


s = []
ord = [-1] * (n+1)

v = 1
c = 1
l = 0
while ord[v] == -1:
    ord[v] = len(s)
    s.append(v)
    v = a[v-1]
c = len(s) - ord[v]
l = ord[v]

if l > k:
    print(s[k])
else:
    k -= l
    k %= c
    print(s[l+k])

Buggy python submission (verdict: Runtime Error):

n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
    a[i] -= 1

loop = [0]
loop_corr = []
while len(loop) < k:
    curr = loop[len(loop) - 1]
    if a[curr] not in loop:
        loop.append(a[curr])
        # print(loop)
    else:
        loop_corr = loop[loop.index(a[curr]):len(loop)]
        break

if len(loop) > k:
    print(loop[k]+1)
else:
    diff = k - len(loop) + 1
    mod = (diff % len(loop_corr)) -1
    print(loop_corr[mod]+1)
        
    

Fixed submission:

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


s = []
ord = [-1] * (n+1)

v = 1
c = 1
l = 0
while ord[v] == -1:
    ord[v] = len(s)
    s.append(v)
    v = a[v-1]
c = len(s) - ord[v]
l = ord[v]

if l > k:
    print(s[k])
else:
    k -= l
    k %= c
    print(s[l+k])
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n = int(input())

a = list(map(int,input().split()))
ans = 0
for seq in itertools.combinations(range(n),2):
    if abs(seq[0]-seq[1]) == a[seq[0]] + a[seq[1]]:
        ans+=1
print(ans)

Fixed submission:
from collections import Counter

n = int(input())

a = list(map(int,input().split()))
ans = 0
cc = Counter()

for i,val in enumerate(a):
    if i - val > 0:
        ans+=cc[i-val]
    cc[i+val]+=1

print(ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

n, k = map(int, input().split())
A = list(map(int, input().split()))
a = [0]*n
b = A[0]
per = []
tes = -1

if n >= k:
    for _ in range(k-1):
        b = A[b-1]
    print(b)
    exit()

for _ in range(k*k):
    a[b-1] += 1
    tes += 1
    if 3 in a:
        tes -= len(per)*2
        break
    if 2 in a:
        per.append(b)
    b = A[b-1]

_len = len(per)

ans = (k - tes) % _len

print(per[ans-1])

Fixed submission:
#!/usr/bin/env python3

s = input()
t = input()

le = len(s)

if t[0:le] == s:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

n, k = map(int, input().split())
A = list(map(int, input().split()))
a = [0]*n
b = A[0]
per = []
tes = -1

if n <= k:
    for _ in range(k-1):
        b = A[b-1]
    print(b)
    exit()

for _ in range(k+1):
    a[b-1] += 1
    tes += 1
    if 3 in a:
        tes -= len(per)*2
        break
    if 2 in a:
        per.append(b)
    b = A[b-1]

_len = len(per)

ans = (k - tes) % _len

print(per[ans-1])

Fixed submission:
#!/usr/bin/env python3

N, K = map(int, input().split())
A = [int(a) - 1 for a in input().split()]

if K <= N:
    p = 0
    for _ in range(K):
        p = A[p]
    print(p + 1)
    exit()

p = 0
t = [-1] * N
t[0] = 0
for i in range(1, N):
    p = A[p]
    if t[p] != -1:
        break
    t[p] = i

d = i - t[p]
K -= i
K %= d

for i in range(K):
    p = A[p]
print(p + 1)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

n, k = map(int, input().split())
A = list(map(int, input().split()))
a = [0]*n
b = A[0]
per = []
tes = -1

if n >= k:
    for _ in range(k-1):
        b = A[b-1]
    print(b)
    exit()

for _ in range(k*k):
    a[b-1] += 1
    tes += 1
    if 3 in a:
        tes -= len(per)*2
        break
    if 2 in a:
        per.append(b)
    b = A[b-1]

_len = len(per)

ans = (k - tes) % _len

print(per[ans-1])

Fixed submission:
#!/usr/bin/env python3

N, K = map(int, input().split())
A = [int(a) - 1 for a in input().split()]

if K <= N:
    p = 0
    for _ in range(K):
        p = A[p]
    print(p + 1)
    exit()

p = 0
t = [-1] * N
t[0] = 0
for i in range(1, N):
    p = A[p]
    if t[p] != -1:
        break
    t[p] = i

d = i - t[p]
K -= i
K %= d

for i in range(K):
    p = A[p]
print(p + 1)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

N = int(input())
H = list(map(int, input().split()))
L = [None]*N
R = [None]*N

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

cnt = 0

for i in range(N):
    for j in range(N):
        if i < j:
            if L[i] == R[j]:
                cnt += 1

print(cnt)

Fixed submission:
#!/usr/bin/env python3

from collections import Counter

N = int(input())
H = list(map(int, input().split()))
L = []
R = []

for i, j in enumerate(H):
    L.append(i+j)
    R.append(i-j)

b = Counter(R)
ans = 0

for i in L:
    ans += b.get(i,0)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

import itertools

N, M, Q = map(int, input().split())
lis = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
cnt = 0
X = [i for i in range(1, M+1)]
Y = X * N
lis_2 = []

for i in itertools.combinations_with_replacement(Y, r=N):
    cnt = 0
    j = list(i)
    j.sort()
    for k in lis:
        if j[k[1]-1] - j[k[0]-1] == k[2]:
            cnt += k[3]
    ans = max(ans, cnt)

print(ans)

Fixed submission:
#!/usr/bin/env python3

import itertools

N, M, Q = map(int, input().split())
lis = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
cnt = 0
X = [i for i in range(1, M+1)]

for i in itertools.combinations_with_replacement(X, r=N):
    cnt = 0
    j = list(i)
    for k in lis:
        if j[k[1]-1] - j[k[0]-1] == k[2]:
            cnt += k[3]
    ans = max(ans, cnt)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

import itertools

N, M, Q = map(int, input().split())
lis = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
cnt = 0
X = [i for i in range(1, M+1)]
Y = X * N
lis_2 = []

for i in itertools.permutations(Y, r=N):
    cnt = 0
    j = list(i)
    j.sort()
    if j in lis_2:
        continue
    for k in lis:
        if j[k[1]-1] - j[k[0]-1] == k[2]:
            cnt += k[3]
    ans = max(ans, cnt)
    lis_2.append(j)

print(ans)

Fixed submission:
#!/usr/bin/env python3

import itertools

N, M, Q = map(int, input().split())
lis = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
cnt = 0
X = [i for i in range(1, M+1)]

for i in itertools.combinations_with_replacement(X, r=N):
    cnt = 0
    j = list(i)
    for k in lis:
        if j[k[1]-1] - j[k[0]-1] == k[2]:
            cnt += k[3]
    ans = max(ans, cnt)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

import itertools

N, M, Q = map(int, input().split())
lis = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
cnt = 0
X = [i for i in range(1, M+1)]
Y = X * N

for i in itertools.permutations(Y, r=N):
    cnt = 0
    j = list(i)
    j.sort()
    for k in lis:
        if j[k[1]-1] - j[k[0]-1] == k[2]:
            cnt += k[3]
    ans = max(ans, cnt)

print(ans)

Fixed submission:
#!/usr/bin/env python3

import itertools

N, M, Q = map(int, input().split())
lis = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
cnt = 0
X = [i for i in range(1, M+1)]

for i in itertools.combinations_with_replacement(X, r=N):
    cnt = 0
    j = list(i)
    for k in lis:
        if j[k[1]-1] - j[k[0]-1] == k[2]:
            cnt += k[3]
    ans = max(ans, cnt)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

A, B, N = map(int, input().split())
num = 0
ans = 0

for x in range(1, N+1):
    num = (A*x)//B - A*(x//B)
    ans = max(ans, num)
print(ans)

Fixed submission:
#!/usr/bin/env python3

A, B, N = map(int, input().split())
num = 0
ans = 0

if N >= B:
    print((A*(B-1))//B - A*((B-1)//B))
else:
    print((A*N)//B - A*(N//B))
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

S = input()
lis_2019 = [str(2019 * i) for i in range(1, 99)]
cnt = 0
S_len = len(S)
cnt_1 = 0
S_lis = [S]

for i in range(4, S_len):
    while cnt_1 != S_len - i + 1:
        if S[cnt_1:cnt_1+i] in lis_2019:
            cnt += 1
        cnt_1 += 1
    cnt_1 = 0

print(cnt)


Fixed submission:
#!/usr/bin/env python3

S = input()[::-1]

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for i in S:
    num += int(i) * d
    num %= 2019
    d *= 10
    d %= 2019
    counts[num] += 1

ans = 0
for i in counts:
    ans += i * (i - 1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

S = input()
lis_2019 = [2019 * i for i in range(1, 99)]
cnt = 0
S_len = len(S)
cnt_1 = 0
S_lis = [S]

for i in range(4, S_len):
    while cnt_1 != S_len - i + 1:
        for j in lis_2019:
            if str(j) == str(S[cnt_1:cnt_1+i]):
                cnt += 1
        cnt_1 += 1
    cnt_1 = 0

print(cnt)

Fixed submission:
#!/usr/bin/env python3

S = input()[::-1]

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for i in S:
    num += int(i) * d
    num %= 2019
    d *= 10
    d %= 2019
    counts[num] += 1

ans = 0
for i in counts:
    ans += i * (i - 1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

S = input()
lis_2019 = [2019 * i for i in range(1, 99)]
cnt = 0
S_len = len(S)
cnt_1 = 0
S_lis = [S]

for i in range(4, S_len):
    while cnt_1 != S_len - i + 1:
        #print(S[cnt_1:cnt_1+1+i])
        S_lis.append(S[cnt_1:cnt_1+i])
        cnt_1 += 1
    cnt_1 = 0

for i in S_lis:
    for j in lis_2019:
        if str(i) == str(j):
            cnt += 1

print(cnt)

Fixed submission:
#!/usr/bin/env python3

S = input()[::-1]

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for i in S:
    num += int(i) * d
    num %= 2019
    d *= 10
    d %= 2019
    counts[num] += 1

ans = 0
for i in counts:
    ans += i * (i - 1) // 2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/evn python3

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

cnt = 0

for i in range(1, N+1):
    if not A:
        break
    else:
        print(A.count(i))
        A =[j for j in A if j != i]
    cnt += 1

print('\n'.join(map(str, [0]*(N-cnt))))

Fixed submission:
#!/usr/bin/env python3

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

lis = [0] * N
for i in A:
    lis[i-1] += 1

for i in range(len(lis)):
    print(lis[i])

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/evn python3

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

cnt = 0

for i in range(1, N+1):
    if not A:
        break
    else:
        print(A.count(i))
        A =[j for j in A if j != i]
    cnt += 1

print('\n'.join(map(str, [0]*(N-cnt))))

Fixed submission:
#!/usr/bin/env python3

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

lis = [0] * N
for i in A:
    lis[i-1] += 1

for i in range(len(lis)):
    print(lis[i])

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/evn python3

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

for i in range(1, N+1):
    if not A:
        print(0)
    else:
        print(A.count(i))
        A =[j for j in A if j != i]

Fixed submission:
#!/usr/bin/env python3

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

lis = [0] * N
for i in A:
    lis[i-1] += 1

for i in range(len(lis)):
    print(lis[i])

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/evn python3

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

for i in range(1, N+1):
    print(A.count(i))

Fixed submission:
#!/usr/bin/env python3

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

lis = [0] * N
for i in A:
    lis[i-1] += 1

for i in range(len(lis)):
    print(lis[i])
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

import re

if int(input()) > 100 and int(input()) <= 999:
    x = str(input())
else:
    print("No")
    exit

if re.match("7", x):
    print("Yes")
else:
    print("No")

Fixed submission:
#!/usr/bin/env python3

if "7" in str(input()):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

def gcd(m, n):
    x = max(m, n)
    y = min(m,n)
    if x%y == 0:
        return y
    else:
        while x%y != 0:
            z = x%y
            x = y
            y = z
        else:
            return z

K = int(input())
ans = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        temp = gcd(i, j)
        for k in range(1, K+1):
            ans += gcd(temp, k)
print(ans)

Fixed submission:
#!/usr/bin/env python3

import math

K = int(input())
ans = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        temp = math.gcd(i, j)
        for k in range(1, K+1):
            ans += math.gcd(temp, k)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

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

N_1 = abs(N - K)

while N_1 <= N:
    N = N_1
    N_1 = abs(N_1 - K)

print(N)

Fixed submission:
#!/usr/bin/env python3

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

t_1 = N % K
t_2 = K - t_1

if t_1 > t_2:
    print(t_2)
else:
    print(t_1)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

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

print((N//(A+B))*A + min(A, (N%(A+B))))

Fixed submission:
#!/usr/bin/env python3

S = input()
print("Yes" if "A" in S and "B" in S else "No")

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

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

if N%(A+B) <= A:
    print((N//(A+B))*A + (N%(A+B)))
else:
    print((N//(A+B))*A + A)

Fixed submission:
#!/usr/bin/env python3

S = input()
print("Yes" if "A" in S and "B" in S else "No")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
cnt = 0

for i in range(0, N):
    P_i = P[i]
    P_j = P[0:i+1]
    if P_i == min(P_j):
        cnt += 1

print(cnt)

Fixed submission:
#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
cnt = 0
tmp = 10 ** 10

for i in range(N):
    if tmp >= P[i]:
        cnt += 1
    tmp = min(tmp, P[i])

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
cnt = 0

for i in range(0, N):
    if all(P[i] <= P[j] for j in range(0, i+1)):
        cnt += 1

print(cnt)

Fixed submission:
#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
cnt = 0
tmp = 10 ** 10

for i in range(N):
    if tmp >= P[i]:
        cnt += 1
    tmp = min(tmp, P[i])

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

plus = A + B
minus = A - B
cross = A * B

if plus >= minus:
	if plus >= cross:
		print(plus)
    else:
		print(cross)
else:
	print(minus)


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

plus = A + B
minus = A - B
cross = A * B
test = [plus, minus, cross]
print(max(test))

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

plus = A + B
minus = A - B
cross = A * B

if plus >= minus:
	if plus >= cross:
      print(plus)
    else:
      print(cross)
else:
	print(minus)

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

plus = A + B
minus = A - B
cross = A * B
test = [plus, minus, cross]
print(max(test))
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

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

C = max(A, B)

for i in range(1, C+1):
    if abs(A-i) == abs(B-i):
        print(i)
        exit()

print("IMPOSSIBLE")

Fixed submission:
#!/usr/bin/env python3

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

if (A+B)%2 == 0:
    print((A+B)//2)
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

lis = [a, e, i, o, u]

if input() in lis:
    print("vowel")
else:
    print("consonant")

Fixed submission:
#!/usr/bin/env python3

lis = ["a", "e", "i", "o", "u"]

if input() in lis:
    print("vowel")
else:
    print("consonant")