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

Fixed submission:
from bisect import bisect
N, M, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
a = [0] * (N+1)
b = [0] * (M+1)
for i in range(N):
    a[i+1] = a[i] + A[i]
for i in range(M):
    b[i+1] = b[i] + B[i]
ans = 0
for i in range(N+1):
    tmp = K - a[i]
    if tmp < 0:
        break
    ans = max(ans, i + bisect(b, tmp) - 1)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
N, M, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
a = deque(A)
b = deque(B)
ans = 0
l = len(a) + len(b)
while a and b:
    if K - a[0] >= 0 or K - b[0] >= 0:
        if a[0] > b[0]:
            x = b.popleft()
            K = K - x
            ans += 1
        if a[0] <= b[0]:
            x = a.popleft()
            K = K - x
            ans += 1
    else:
        break
C = list(a) + list(b)
c = deque(C)
while c:
    if K - c[0] >= 0:
        x = c.popleft()
        K = K - x
        ans += 1
    else:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
N, M, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
a = deque(A)
b = deque(B)
ans = 0
l = len(a) + len(b)
while a and b:
    if K - a[0] >= 0 or K - b[0] >= 0:
        if a[0] > b[0]:
            x = b.popleft()
            K = K - x
            ans += 1
        if a[0] <= b[0]:
            x = a.popleft()
            K = K - x
            ans += 1
    else:
        break
c = a + b
while c:
    if K - c[0] >= 0:
        x = c.popleft()
        K = K - x
        ans += 1
    else:
        break
print(ans)
Problem p02624 (python)

Fixed submission:
N = int(input())
mul = [0] * (N+1)
for i in range(1, N+1):
    for j in range(i, N+1, i):
        mul[j] += 1
ans = 0
for i in range(1, N+1):
    ans += i * mul[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
def cal(n):
    return n * (n + 1) // 2
for i in range(1, N+1):
    x = N // i
    ans += i * (x * (x + 1) // 2)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
a = [0] * (N+1)
b = [0] * (M+1)
for i in range(N):
    a[i+1] = a[i] + A[i]
for i in range(M):
    b[i+1] = b[i] + B[i]
ans = 0
j = M
for i in range(N+1):
    tmp = K - a[i]
    if tmp < 0:
        break
    while b[j] > tmp:
        j -= 1
    ans = max(ans, i + j)
print(ans)
Problem p02659 (python)

Fixed submission:
import decimal
A, B = input().split()
A = decimal.Decimal(A)
B = decimal.Decimal(B) * decimal.Decimal(100)
print(decimal.Decimal(A * B // decimal.Decimal(100)))

Buggy submission (verdict: Runtime Error):
A, B = input().split()
A = int(a)
B = round(float(B) * 100)
print(A * B // 100)
Problem p02711 (python)

Fixed submission:
S = input()
if S.count('7'):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
if S.count(7):
  print("Yes")
else:
  print("No")
Problem p02729 (python)

Fixed submission:
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, M = map(int, input().split())
if N == 1 or N == 0:
    guu = 0
else:
    guu = combinations_count(N, 2)
if M == 1 or M == 0:
    kisu = 0
else:
    kisu = combinations_count(M, 2)
print(guu + kisu)

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, M = map(int, input().split())
if N == 1 or N == 0:
    guu = 0
else:
    guu = combinations_count(N, 2)
if M == 1 or N == 0:
    kisu = 0
else:
    kisu = combinations_count(M, 2)
print(guu + kisu)
Problem p02759 (python)

Fixed submission:
import math
N = int(input())
print(math.ceil(N/2))

Buggy submission (verdict: Runtime Error):

N, M = map(int, input().split())
SC = set(sorted([tuple(map(int, input().split())) for _ in range(M)]))

ans = [-1] * N
for s, c in SC:
    if ans[s-1] == -1:
        ans[s-1] = c
if N >= 2:
    if ans[0] == -1 or ans[0] == 0:
        print(-1)
        exit()
kotae = ''
for a in ans:
    if a == -1:
        kotae += '0'
    else:
        kotae += str(a)
print(kotae)
Problem p02773 (python)

Fixed submission:
from collections import Counter
N = int(input())
S = Counter([input() for _ in range(N)])
v = max(S.values())
s = sorted(S.most_common())
if len(S) == 1:
    print(list(S)[0])
    exit()
for k, val in s:
    if val == v:
        print(k)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = Counter(input() for _ in range(N))
m = max(S.values())
for v in sorted(s for k, v in S.items() if v == m):
	print(v)
Problem p02785 (python)

Fixed submission:
N, K = map(int, input().split())
*H, = map(int, input().split())
H.sort(reverse=True)
ans = 0
if len(H) - K <= 0:
    print(0)
else:
    ans += sum(H[K:])
    print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = list(map(int, input().split())).sort(reverse=True)
ans = 0
if len(H) - K <= 0:
    print(0)
else:
    ans += sum(H[K:])
    print(ans)
Problem p02897 (python)

Fixed submission:
N = int(input())
print(((N + 1) // 2) / N)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % == 0:
  print(2/N)
else:
  print((N - N/2) / N)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % == 0:
  print(2/N)
else:
  print((N - N//2)/N)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % 2 == 0:
  print(2/N)
else:
  print((N//2) / (N//2)+1)
Problem p02933 (python)

Fixed submission:
A = int(input())
S = input()
if A >= 3200:
  print(S)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)
N, Q = map(int, input().split())
to = [[] for _ in range(N)]
ans = [0] * N
def dfs(v, p=-1):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
for _ in range(Q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x
dfs(0)
print(*ans)
Problem p02935 (python)

Fixed submission:
def mix(x, y):
    return (x + y) / 2
    
N = int(input())
*V, = map(int, input().split())
V.sort()
ans = V[0]
for i in range(1, N):
    ans = mix(ans,V[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
*V, = map(int, input().split())
V.sort()
ans = V[0]
for i in range(1, N):
    ans = mix(ans,V[i])
print(ans)
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = list(input())
S[K-1] = S[K-1].lower()
print(''.join(S))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(input())
S[K] = S[K].lower()
print(''.join(S))
Problem p03042 (python)

Fixed submission:
S = input()
Fa = int(S[:2])
Se = int(S[2:])
if 1 <= Fa <= 12 and 1 <= Se <= 12:
	print("AMBIGUOUS")
elif 1 <= Fa <= 12:
	print("MMYY")
elif 1 <= Se <= 12:
	print("YYMM")
else:
	print("NA")

Buggy submission (verdict: Runtime Error):
S = input()
Fa = int(S[:2])
Se = int(S[2:])
if 1 <= Fa,Se <= 12:
	print("AMBIGIOUS")
elif 1 <= Fa <= 12:
	print("MMYY")
elif 1 <= Se <= 12:
	print("YYMM")
else:
	print("NA")

Buggy submission (verdict: Runtime Error):
S = input()
if 0 <= S[:2] <= 99 and 1 <= S[2:] <= 12:
    print("YYMM")
elif 1 <= S[:2] <= 12 and 0 <= S[2:] <= 99:
    print("MMYY")
elif (0 <= S[:2] <= 99 and 1 <= S[2:] <= 12) and (1 <= S[:2] <= 12 and 0 <= S[2:] <= 99):
    print("AMBIGUOUS")
else:
    print("NA")
Problem p03207 (python)

Fixed submission:
N = int(input())
p = sorted([int(input()) for _ in range(N)], reverse=True)
ans = p[0] // 2 + sum(p[1:])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input)
p = sorted([int(input()) for _ in range(N)], reverse=True)
ans = p[0] // 2 + sum(p[1:])
print(ans)
Problem p03208 (python)

Fixed submission:
N, K = map(int, input().split())
H = sorted([int(input()) for _ in range(N)])
cum = [0] * (N-K+1)
for i in range(N-K+1):
    cum[i] = abs(H[i] - H[K+i-1])
print(min(cum))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = sorted([int(input()) for _ in range(N)])
cum = [0] * (N-K+1)
for i in range(N-K+1):
    cum[i] = abs(H[i] - H[i+2])
print(sorted(cum)[0])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = sorted([int(input()) for _ in range(N)])
cum = [0] * K
for i in range(N-K+1):
    cum[i] = abs(H[i] - H[i+2])
print(sorted(cum)[0])
Problem p03252 (python)

Fixed submission:
S, T = input(), input()
ma, ima = {}, {}
ok = True
for i in range(len(S)):
    s, t = S[i], T[i]
    if s in ma and ma[s] != t:
        ok = False
    if t in ima and ima[t] != s:
        ok = False
    ma[s] = t
    ima[t] = s
if ok:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S, T = input(), input()
ma, ima = {}, {}
ok = True
for i in range(len(S)):
    s, t = S[i], T[i]
    if s in ma and ma[s] != t:
        ok = False
    if t in ima and ima[t] != s:
        ok = False
    ma[s] = t, ima[t] = s
if ok:
    print("Yes")
else:
    print("No")
Problem p03329 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
N = int(input())
dp = [-1] * (N + 1)

def rec(n):
    if n == 0:
        return 0
    if dp[n] != -1:
        return dp[n]
    res = n
    i = 0
    while n >= 6 ** i:
        pow6 = 6 ** i
        res = min(res, rec(n - pow6) + 1)
        i += 1
    j = 0
    while n >= 9 ** j:
        pow9 = 9 ** j
        res = min(res, rec(n - pow9) + 1)
        j += 1
    dp[n] = res
    return res
print(rec(N))

Buggy submission (verdict: Runtime Error):
N = int(input())
import sys
sys.setrecursionlimit(100000)
dp = [-1] * (N + 1)
def rec(n):
    if n == 0:
        return 0
    if dp[n] != -1:
        return dp[n]
    res = n
    i = 0
    while n >= i ** 6:
        pow6 = i ** 6
        res = min(res, rec(n - pow6) + 1)
        i += 1

    j = 0
    while n >= j ** 9:
        pow9 = j ** 9
        res = min(res, rec(n - pow9) + 1)
        i += 1

    dp[n] = res
    return dp[n]
print(rec(N))
Problem p02594 (python)

Fixed submission:
i = int(input())
if i >= 30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
i = int(input())
if i >= 30:
  print("Yes")
  else:
    print("No")
Problem p02622 (python)

Fixed submission:
s = input()
t = input()
count = 0
for i in range(len(s)):
    if s[i] != t[i]:
        count += 1
    
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
count = 0
for i in len(s):
  if s[i] != t[i]:
    count += 1
    
print(count)
Problem p02623 (python)

Fixed submission:
import random
n, m, k = map(int, input().split())
# n, m, k = random.randint(1, 10**5), random.randint(1, 10**5), random.randint(10**8, 10**9)
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
# a_list = [random.randint(1, 10**3) for i in range(n)]
# b_list = [random.randint(1, 10**3) for i in range(m)]
# print(n,m,k)
# print(a_list[0], b_list[0])
a_sum = [0]
b_sum = [0]
max_a = 0
for i in range(1, max(n+1, m+1)):
    if i < n+1:
        a_sum.append(a_sum[i-1] + a_list[i-1])
        if a_sum[i] <= k:
            max_a = i
    if i < m+1:
        b_sum.append(b_sum[i-1] + b_list[i-1])

ans = 0
j = m
for i in range(0, max_a+1):
    while b_sum[j] > k - a_sum[i]:
        j -= 1
    ans = max(ans, i+j)
        
print(ans)
# print(n+m)

Buggy submission (verdict: Runtime Error):
import random
n, m, k = map(int, input().split())
# n, m, k = random.randint(1, 10**5), random.randint(1, 10**5), random.randint(10**7, 10**8)
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
# a_list = [random.randint(1, 10**2) for i in range(n)]
# b_list = [random.randint(1, 10**2) for i in range(m)]
# print(n,m,k)
# print(a_list[0], b_list[0])
a_sum = [0]
b_sum = [0]
for i in range(1, max(n+1, m+1)):
    if i < n+1:
        a_sum.append(a_sum[i-1] + a_list[i-1])
    if i < m+1:
        b_sum.append(b_sum[i-1] + b_list[i-1])

ans = 0
for i in range(n+1):
    if a_sum[i] > k:
        break
    else:
        j = m
        while b_sum[j] <= k - a_sum[i]:
            j -= 1
    ans = max(ans, i+j)
        
print(ans)
# print(n+m)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
a_index = 0
b_index = 0
count = 0

def nap(a_index, b_index, time, count):
    if a_index >= len(a_list) and b_index >= len(b_list):
        return count
    else:
        if a_index >= len(a_list) or a_list[a_index]>time:
            nap1 = count
        else:
            nap1 = nap(a_index+1, b_index, time-a_list[a_index], count+1)
        if b_index >= len(b_list) or b_list[b_index]>time:
            nap2 = count
        else:
            nap2 = nap(a_index, b_index+1, time-b_list[b_index], count+1)
    return max(nap1, nap2)

print(nap(0, 0, k, 0))
Problem p02693 (python)

Fixed submission:
k = int(input())
a, b = map(int, input().split())
flag = 0
for i in range(a, b+1):
    if i%k == 0:
        flag = 1
if flag == 1:
	print("OK")
else:
	print("NG")

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split())
flag = 0
for i in range(a, b+1)
	if i%k == 0:
    	flag = 1
if flag == 1:
	print("OK")
else:
	print("NG")
Problem p02726 (python)

Fixed submission:
n, x, y = map(int, input().split())
edge = [[] for _ in range(n+1)]
dist = [[abs(i-j) for i in range(n+1)] for j in range(n+1)]
counter = [0 for i in range(n)]
for i in range(1, n):
    edge[i].append(i+1)
    edge[i+1].append(i)
edge[x].append(y)
edge[y].append(x)
for i in range(y+1):
    for j in range(x, n+1):
        if j > i:
            new_dist = abs(x-i)+abs(y-j)+1
            if new_dist < dist[i][j]:
                dist[i][j] = new_dist

for i in range(1, n+1):
    for num in dist[i][i+1:]:
        counter[num] += 1
# print(dist)

for num in counter[1:]:
    print(num)

Buggy submission (verdict: Runtime Error):
n, x, y = map(int, input().split())
edge = [[] for _ in range(n+1)]
dist = [[abs(i-j) for i in range(n)] for j in range(i+1,n+1)]
counter = [0 for i in range(n)]
for i in range(1, n):
    edge[i].append(i+1)
    edge[i+1].append(i)
edge[x].append(y)
edge[y].append(x)
for i in range(y+1):
    for j in range(x, n+1):
        new_dist = abs(x-i)+abs(y-j)+1
        if new_dist < dist[i][j]:
            dist[i][j] = new_dist

for i in range(1, n+1):
    for num in dist[i][1:]:
        counter[num] += 1
# print(dist)

for num in counter[1:]:
    print(num)
Problem p02785 (python)

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

h = list(map(int, input().split()))
h.sort(reverse=True)

print(sum(h[k:]))

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

h = input().split()
h.sort(reverse=True)

print(sum(h[k:]))
Problem p02689 (python)

Fixed submission:
n, m = map(int, input().split())
h = list(map(int, input().split()))
t = [1 for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if h[a] > h[b]:
        t[b] = 0
    elif h[a] == h[b]:
        t[a] = 0
        t[b] = 0
    else:
        t[a] = 0
ans = 0
for i in t:
    if i==1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = list(map(int, input().split()))
g = [[] for _ in range(n)]
t = [-1 for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)

def dfs(i):
    if t[i] != -1:
        return
    else:
        t[i] = 1
    for j in g[i]:
        if h[i] <= h[j]:
            t[i] = 0
        dfs(j)

for i in range(n):
    dfs(i)
ans = n
for i in t:
    if i == 0:
        ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = list(map(int, input().split()))
g = [[] for _ in range(n)]
t = [-1 for _ in range(n)]

def dfs(i):
    if t[i] != -1:
        return
    else:
        t[i] = 1
    for j in g[i]:
        if h[j] >= h[i]:
            t[i] = 0
        dfs(j)
    
for i in range(m):
    a, b = map(int, input().split())
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)

dfs(0)
ans = n
for i in t:
    if i == 0:
        ans -= 1
print(ans)
Problem p02754 (python)

Fixed submission:
N, A, B = map(int, input().split())
if A == 0:
    print(0)
    exit()
P = A + B
X = N//P
x = N%P

if x >= A:
    ans = A*X+A
elif x < A:
    ans = A*X+x

print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, A, B = map(int, input().split())
p = A*'b'+B*'r'
v = math.ceil(N/(A+B))
P = p * v
x = P[:N]
print(x.count('b'))

Buggy submission (verdict: Runtime Error):
import math
N, A, B = map(int, input().split())
p = A*'b'+B*'r'
v = math.ceil(N/(A+B))
P = p * v
x = P[:N]
print(x.count('b'))
Problem p02831 (python)

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

 #最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

a, b = [int(i) for i in input().split()]
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a, b = [int(i) for i in input().split()]
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a, b = [int(i) for i in input().split()]123 456
print(lcm(a, b))
Problem p02935 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
import heapq
heapq.heapify(a)
for i in range(N-1):
  x = heapq.heappop(a)
  y = heapq.heappop(a)
  z = (x+y)/2
  heapq.heappush(a,z)
answer = heapq.heappop(a)
print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = map(int,input().split())
heap.heapify(a)
for i in range(N-1):
  x = heap.heappop(a)
  y = heap.heappop(a)
  z = (x+y)/2
  heap.heappush(a,z)
answer = heap.heappop(a)
print(answer)
Problem p03107 (python)

Fixed submission:
s=input()
stk=0
h=0
for c in s:
  x=int(c)
  if x==1:
    if stk<0:
      h+=1
    stk+=1
  else:
    if stk >0:
      h+=1
    stk -=1
print(2*h)

Buggy submission (verdict: Runtime Error):
s=input()
stk=0
h=0
for c in s:
  if x==1:
    if stk<0:
      h+=1
    stk+=1
  else:
    if stk >0:
      h+=1
    stk -=1
print(2*h)
Problem p03222 (python)

Fixed submission:
MOD = 1000000007
H,W,K=map(int,input().split())
##Precalculation            
num = [[0 for _ in range(W)] for _ in range(W)]
for value in range(2**(W-1)):
    bit = [False for _ in range(W-1)]
    for d in range(W-1):
        bit[d] = (2**d & value) > 0
    duplicate = False
    for d in range(1,W-1):
        if bit[d] and bit[d-1]:
            duplicate = True
            break
    if duplicate:
        continue
    ##No Duplicate Assured
    for x in range(W):
        num[x][x] += 1
    for d in range(W-1):
        if bit[d]:
            num[d][d+1] += 1
            num[d+1][d] += 1
            num[d][d] -= 1
            num[d+1][d+1] -= 1
##Time to Dynamic Programming YEAHHHHHH##
dp = [[0 for _ in range(W)] for _ in range(H+1)]
dp[0][0] = 1
for h in range(1,H+1):
    for k in range(W):
        for j in range(W):
            dp[h][k] += (dp[h-1][j]*num[j][k])%MOD
            dp[h][k] %= MOD
print(dp[H][K-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
from numpy.linalg import matrix_power
H,W,K=map(int,input().split())
def c(i,j):
    f=[1,1,2,3,5,8,13,21]
    a=0
    if i==j+1: a=f[j]*f[W-i-1]
    if j in (i,i+1): a=f[i]*f[W-j-1]
    return(a)
def mp(m,n,p):
    a = m%p
    if n==0:
        return(np.identity(m.diagonal().size,dtype='int32'))
    if n==1:
        return(a)
    else:
        q,r=divmod(n,2)
        x=np.matmul(a,a)%p
        if r==1:
            return(np.matmul(a,mp(x,q,p))%p)
        else:
            return(mp(x,q,p)%p)

m=mp(np.array([[c(i,j) for i in range(W)] for j in range(W)]),H,1000000007)
x=np.array([[c(i,j) for i in range(W)] for j in range(W)])
print(m[0,K-1])
Problem p03252 (python)

Fixed submission:
S = input()
T = input()
L = len(S)
dicS = {}
dicT = {}
ans = "Yes"
for i in range(L):
    if S[i] not in dicS:
        dicS[S[i]] = T[i]
    else:
        if T[i] != dicS[S[i]]:
            ans ="No"
    if T[i] not in dicT:
        dicT[T[i]] = S[i]
    else:
        if S[i] != dicT[T[i]]:
            ans = "No"
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
f = [-1 for _ in range(130)]
g = [-1 for _ in range(130)]
ans = "Yes"
for i in len(S):
  s = ord(S[i])
  t = ord(T[i])
  if f[s] == -1:
    f[s] = t
  else:
    if f[s] != t:
      ans = "No"
  if g[t] == -1:
    g[t] = s
  else:
    if g[t] != s:
      ans = "No"
print(ans)
Problem p02790 (python)

Fixed submission:
def main():
    x, y = [int(i) for i in input().split()]
    if x > y:
        print(str(y) * x)
    elif x < y:
        print(str(x) * y)
    else:
        print(str(x) * y)
main()

Buggy submission (verdict: Runtime Error):
def main():
  x=int(input())
  y=int(input())
  
  if x>y:
    print(str(y)*x)
  elif x<y:
    print(str(x)*y)
  else:
    print(str(x)*y)
main()

Buggy submission (verdict: Runtime Error):
def main():
  x=int(input())
  y=int(input())
  
  if x>y:
    print(str(y)*x)
  elif x<y:
    print(str(x)*y)
  else:
    print(str(x)*y)
main()

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

if x>y:
  print(str(y)*x)
elif x<y:
  print(str(x)*y)
else:
  print(str(x)*y)
Problem p03345 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
if(k%2==0):
  print(a-b)
else:
  print(b-a)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
  x=int(input())
  a.append(x)
d={}
f=0
maxi=0
for i in range(n):
  if((a[i]-1) in d):
    d[a[i]]=d[a[i]-1]+1
    if(f==0):
      maxi=d[a[i]]
    else:
      if(d[a[i]]>maxi):
        maxi=d[a[i]]
  else:
    d[a[i]]=0
print(n-maxi-1)
Problem p02627 (python)

Fixed submission:
s=str(input())
if s.isupper()==True:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
s=str(input())
if s.isupper()=True:
  print("A")
else:
  print("a")
Problem p02571 (python)

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


ans = len(T)
for i in range(len(S) - len(T) + 1):
  s = 0
  for j in range(len(T)):
    if S[i + j] != T[j]:
      s += 1
  ans = min(ans, s)

print(ans)

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


ans = [len(T) -1]
for i in range(len(S)):
  if S[i] == T[0]:
    s = 0
    for j in range(1,len(T)):
      if S[i + j] == T[j]:
        pass
      else:
        s += 1
    ans.append(s)

print(min(ans))
Problem p02699 (python)

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

if W >= S:
  print('unsafe')
else:
  print('safe')

Buggy submission (verdict: Runtime Error):
S, W = map(int, input().split())
if S <= 2 * W:
  print("unsafe")
else:
  print(safe)
Problem p03127 (python)

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

while len(A) > 1:
  min_A = min(A)
  next_A = set([min_A])
  for i in A:
    B = i % min_A
    if B != 0:
      next_A.add(B)
  A = list(next_A)
print(list(A)[0])

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

while len(A) > 1:
  min_A = min(A)
  next_A = set([min_A])
  for i in A:
    B = i % min_A
    if B != 0:
      next_A.add(B)
  A = list(next_A)
print(A[0])
Problem p02572 (python)

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

# n=3
# ai = np.array([1, 2, 3])

# ai = ai[np.newaxis, :]
# 
# ai2 = ai.T.dot(ai)
# ai2u = np.triu(ai2, k=1)
# 
# s = ai2u.sum()


l = len(ai)

integ = [ai[0]] * len(ai)
for i in range(1, len(ai)):
    integ[i] = integ[i-1] + ai[i]

s = 0
for j in range(l):
    this_s = integ[-1] - integ[j]
    s += ai[j] * this_s

ans = s % (1000000000 + 7)

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
ai = np.array(list(map(int, input().split())))

# n=3
# ai = np.array([1, 2, 3])

ai = ai[np.newaxis, :]

ai2 = ai.T.dot(ai)
ai2u = np.triu(ai2, k=1)

s = ai2u.sum()


# l = len(ai)
# 
# s = 0
# for j in range(l):
#     for i in range(j+1, l):
#         s += ai[j] * ai[i]

ans = s % (1000000000 + 7)

print(ans)