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

Fixed submission:
N,M = map(int,input().split())
A =list(map(int,input().split()))
A.sort(reverse=True)
A_len =len(A)
count =0
if A_len ==1:
    for l in range(0,M):
        A[0]=A[0]/2
else:
    for l in range(0,M):
        comp = A[0]/2
        for i in range(0,A_len-1,1):
            if count >= M:
                break
            if A[i+1]<comp:
                break
            while True:
                count +=1
                if A[i]/2 > A[i+1]:
                    A[i] = A[i]/2
                else:
                    A[i] = A[i]/2
                    break
        A.sort(reverse=True)
        if count>=M:
            break
A = [int(i) for i in A]
sumN =sum(A)
print(sumN)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A =list(map(int,input().split()))
A.sort(reverse=True)
A_len =len(A)
count =0
for l in range(0,M):
    comp = A[0]/2
    for i in range(0,A_len-1,1):
        if count => M:
            break
        if A[i+1]<comp:
            break
        while True:
            count +=1
            if A[i]/2 > A[i+1]:
                A[i] = A[i]/2
            else:
                A[i] = A[i]/2
                break
    A.sort(reverse=True)
    if count=>M:
        break
A = [int(i) for i in A]
sumN =sum(A)
print(sumN)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A =list(map(int,input().split()))
A.sort(reverse=True)
A_len =len(A)
count =0
for l in range(0,M):
    comp = A[0]/2
    for i in range(0,A_len,1):
        if count => M:
            break
        if A[i+1]<comp:
            break
        while True:
            count +=1
            if A[i]/2 > A[i+1]:
                A[i] = A[i]/2
            else:
                A[i] = A[i]/2
                break
    A.sort(reverse=True)
    if count=>M:
        break
A = [int(i) for i in A]
sumN =sum(A)
print(sumN)
Problem p02693 (python)

Fixed submission:
k = int(input())
a, b = [int(i) for i in input().split()]

flg = False
for i in range(a, b+1):
  if i % k == 0:
    flg = True
    break
if flg:
  print("OK")
else:
  print("NG")

Buggy submission (verdict: Runtime Error):
import math
k = int(input())
a, b = [int(i) for i in input().split()]

if math.abs(a-b)+1 >= k:
    print("OK")
else:
    print("NG")
Problem p02831 (python)

Fixed submission:
def gcd(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x
a, b = map(int, input().split())
print(a * b // gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(a * b // math.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(a * b / math.gcd(a, b))
Problem p02831 (python)

Fixed submission:
def gcd(_a, _b):
	if _a%_b==0:return _b
	else:return gcd(_b, _a%_b)

A, B=map(int, input().split())
print(A*B//gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math
A, B=map(int, input().split())
print(A*B//math.gcd(A, B))
Problem p03013 (python)

Fixed submission:
N,M=map(int,input().split())
dp=[0]*(N+1)
dp[0]=1
mod=10**9+7
a=[False for _ in range(N+1)]
for _ in range(M):
    a[int(input())]=True
    
for i in range(1,N+1):
    if a[i]:
        continue
    dp[i]=(dp[i-1]+dp[i-2])%mod
 
print(dp[N])

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]
mod=10**9+7
#Dynamic Programming
dp=[0]*(N+1)
dp[0]=1
if 1 not in a:
	dp[1]=1
else:
	dp[1]=0
for i in range(2,N+1):
	if i in a:
		continue
	dp[i]=(dp[i-1]+dp[i-2])%mod
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]
mod=10**9+7
#Dynamic Programming
dp=[0]*(N+1)
dp[0]=1
if 1 not in a:
	dp[1]=1
else:
	dp[1]=0
for i in range(2,N+1):
	if i in a:
		continue
	else:
		dp[i]=dp[i-1]+dp[i-2]%mod
print(ans)
Problem p03127 (python)

Fixed submission:
def gcd(_a, _b):
	if _a%_b==0:return _b
	else:return gcd(_b, _a%_b)

n=int(input())
a=sorted(map(int,input().split()))
INF=2*10**9
ans=INF
for i in range(len(a)-1):
	tmp=gcd(a[i],a[i+1])
	if tmp!=0 and tmp<ans:
		ans=tmp
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd as gcd
n=int(input())
a=sorted(map(int,input().split()))
INF=2*10**9
ans=INF
for i in range(len(a)-1):
	tmp=gcd(a[i],a[i+1])
	if tmp!=0 and tmp<ans:
		ans=tmp
print(ans)
Problem p03774 (python)

Fixed submission:
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N, M = ISI()
ab = [list(ISI()) for _ in range(N)]
cd = [list(ISI()) for _ in range(M)]
for i in range(N):
    min = 1000000000000
    for j in range(M):
        n = abs(ab[i][0] - cd[j][0]) +  abs(ab[i][1] - cd[j][1])
        if min > n:
            min = n
            point = j+1
    print(point)

Buggy submission (verdict: Runtime Error):

#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N, M = ISI()
ab = [list(ISI()) for _ in range(N)]
cd = [list(ISI()) for _ in range(M)]
for i in range(N):
    min = 100
    for j in range(M):
        n = abs(ab[i][0] - cd[j][0]) +  abs(ab[i][1] - cd[j][1])
        if min > n:
            min = n
            point = j+1
    print(point)

Buggy submission (verdict: Runtime Error):
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N, M = ISI()
ab = [list(ISI()) for _ in range(N)]
cd = [list(ISI()) for _ in range(M)]
for i in range(N):
    min = 100
    for j in range(M):
        n = abs(ab[i][0] - cd[j][0]) +  abs(ab[i][1] - cd[j][1])
        if min > n:
            min = n
            point = j+1
    print(point)
Problem p03834 (python)

Fixed submission:
s = input().split(",")
print(" ".join(s))

Buggy submission (verdict: Runtime Error):
print(*inpur().split(","))
Problem p03042 (python)

Fixed submission:
from datetime import datetime

S = input()
former = int(S[:2])
latter = int(S[2:])
YYMM = False
MMYY = False

try:
    datetime(former + 2000, latter, 1)
    YYMM = True
except:
    pass

try:
    datetime(latter + 2000, former, 1)
    MMYY = True
except:
    pass

if YYMM and MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA")

Buggy submission (verdict: Runtime Error):
def ismonth(month):
    return 0 < month < 13


S = input()

former = int(S[:2])
latter = int(S[2:])

if former < 1 or latter < 1:
    ans = "NA"

elif ismonth(former) and ismonth(latter):
    ans = "AMBIGUOUS"

elif ismonth(former):
    ans = "MMYY"

elif ismonth(latter):
    ans = "YYMM"

print(ans)
Problem p03107 (python)

Fixed submission:
S = input()

print(min(S.count('0'), S.count('1')) * 2)

Buggy submission (verdict: Runtime Error):
def extract(string, i):
    split = "".join(string.split("01")).split("10")
    i += len(split) - 1
    split_concat = "".join(split)
    if "01" in split_concat or "10" in split_concat:
        return extract(split_concat, i)
    else:
        return i * 2

S = input()
print(extract(S,0))

Buggy submission (verdict: Runtime Error):
def extract(string, i):
    split = string.split("01")
    split = split.split("10")
    i += len(split) - 1
    split_concat = "".join(split)
    if "01" in split_concat or "10" in split_concat:
        return extract(split_concat, i)
    else:
        return i * 2

S = input()
print(extract(S,0))
Problem p03208 (python)

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

trees = []
for _i in range(n):
  tree = int(input())
  trees.append(tree)

trees.sort()
ans = float('inf')

for i in range(n - k + 1):
  diff = trees[i + k - 1] - trees[i]
  if ans > diff:
    ans = diff

print(ans)

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

trees = []
for _i in range(n):
  trees.append(int(input())

trees.sort()
ans = float('inf')

for i in range(n - k + 1):
  diff = trees[i + k - 1] - trees[i]
  if ans > diff:
    ans = diff

print(ans)
Problem p03209 (python)

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

f_dict = {
  0: 1
}
def f(n):
  if f_dict.get(n):
    return f_dict.get(n)
  return (3 + f(n-1) * 2)


patty_dict = {
  0: 1
}
def total_patty(n):
  if patty_dict.get(n):
    return patty_dict.get(n)
  return (1 + 2 * total_patty(n - 1))

def count_patty(n, x):
  if n == 0 and x == 1:
    return 1
  elif x == 0:
    return 0
  elif 1 <= x and x <= f(n - 1) + 1:
    return count_patty(n - 1, x - 1)
  elif x == f(n - 1) + 2:
    return total_patty(n - 1) + 1
  elif f(n - 1) + 2 <= x and x <= 2 * f(n - 1) + 2:
    return total_patty(n - 1) + 1 + count_patty(n - 1, x - f(n - 1) - 2)
  else:
    return total_patty(n)

print(count_patty(n, x))

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

f_dict = {
  0: 1
}
def f(n):
  if f_dict.get(n):
    return f_dict.get(n)
  return (3 + f(n-1) * 2)


patty_dict = {
  0: 1
}
def total_patty(n):
  if patty_dict.get(n):
    return patty_dict.get(n)
  return (1 + 2 * total_patty(n - 1))

def count_patty(n, x):
  if x == 0:
    return 0
  elif 1 <= x and x <= f(n - 1) + 1:
    return count_patty(n - 1, x - 1)
  elif x == f(n - 1) + 2:
    return total_patty(n - 1) + 1
  elif f(n - 1) + 2 <= x and x <= 2 * f(n - 1) + 2:
    return total_patty(n - 1) + 1 + count_patty(n - 1, x - f(n - 1) - 2)
  else:
    return total_patty(n)

print(count_patty(n, x))

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

f_dict = {
  0: 1
}
def f(n):
  if f_dict.get(n):
    return f_dict.get(n)
  return (3 + f(n-1) * 2)


patty_dict = {
  0: 1
}
def total_patty(n):
  if patty_dict.get(n):
    return patty_dict.get(n)
  return (1 + 2 * total_patty(n - 1))

def count_patty(n, x):
  if x == 0:
    return 0
  elif 1 <= x and x <= f(n - 1) + 1:
    return count_patty(n - 1, x - 1)
  elif x == f(n - 1) + 2:
    return total_patty(n - 1) + 1
  elif f(n - 1) + 2 <= x and x <= 2 * f(n - 1) + 2:
    return total_patty(n - 1) + 1 + count_patty(n - 1, x - f(n - 1) - 2)
  else:
    return total_patty(n)

print(count_patty(n, x))
Problem p02897 (python)

Fixed submission:
n=int(input())
print(1/2 if n % 2 == 0 else (n+1)/(2*n))

Buggy submission (verdict: Runtime Error):
n=input()
print(1/2 if n%2==0 else (n-1)/2n)
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split(' '))
dp = [0 for _ in range(N + 1)]
for _ in range(M):
    i = int(input())
    dp[i] = -float('inf')

mod = 10**9 + 7
dp[0] = 1
for i in range(N+1):
    if dp[i] ==  -float('inf'):
        continue

    if 0 <= i-1 < N and dp[i-1] != -float('inf'):
        dp[i] += dp[i-1]

    if 0 <= i-2 < N and dp[i-2] != -float('inf'):
        dp[i] += dp[i-2]

    dp[i] = dp[i] % mod

print(dp[N] )

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split(' '))
dp = [0 for _ in range(N + 1)]
for _ in range(M):
    i = int(input())
    dp[i] = -float('inf')

dp[0] = 1
for i in range(N+1):
    if 0 <= i-1 < N and dp[i-1] != -float('inf'):
        dp[i] += dp[i-1]

    if 0 <= i-2 < N and dp[i-2] != -float('inf'):
        dp[i] += dp[i-2]

print(dp[N] % 1000000007 )
Problem p03634 (python)

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

import collections


N = int(input())
graph = [[] for _ in range(N)]
# graph = collections.defaultdict(list)

for i in range(N-1):
    # print(i)
    a, b, c = map(int, input().split(' '))
    a -= 1
    b -= 1
    graph[a].append([b, c])
    graph[b].append([a, c])


Q, K = map(int, input().split(' '))

dist = [-1 for _ in range(N)]
dist[K-1] = 0
stack = [K-1]
while len(stack) != 0:
    a = stack.pop()
    for b, c in graph[a]:
        if dist[b] == -1:
            dist[b] = dist[a] + c
            stack.append(b)


# def dfs(a):
#     for b, c in graph[a]:
#         if dist[b] == -1:
#             dist[b] = dist[a] + c
#             dfs(b)
# dfs(K-1)
# print(dist)


for _ in range(Q):
    x, y = map(int, input().split(' '))
    x -= 1
    y -= 1
    print(dist[x] + dist[y])

Buggy submission (verdict: Runtime Error):
import collections

graph = collections.defaultdict(list)

N = int(input())
for i in range(N-1):
    # print(i)
    a, b, c = map(int, input().split(' '))
    a -= 1
    b -= 1
    graph[a].append([b, c])
    graph[b].append([a, c])


Q, K = map(int, input().split(' '))

dist = [-1 for _ in range(N)]
dist[K-1] = 0

def dfs(a):
    for b, c in graph[a]:
        if dist[b] == -1:
            dist[b] = dist[a] + c
            dfs(b)
dfs(K-1)
# print(dist)


for _ in range(Q):
    x, y = map(int, input().split(' '))
    x -= 1
    y -= 1
    print(dist[x] + dist[y])
Problem p03038 (python)

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

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

# key-valueデータで管理
dict_cards = []
for card in g_cards:
	dict_cards.append([card, 1])

# 操作
for i in range(M):
	# sizeと同じ枚数のカードが増えたと考える
	size, val = map(int, input().split())
	dict_cards.append([val, size])

# 降順にする
s_dict_cards = sorted(dict_cards, key=lambda x: -x[0])

s_cards = []
for data in s_dict_cards:
	s_cards += [data[0]] * data[1]
	if(len(s_cards) >= N):
		break
# 出力
sum_val = sum(s_cards[:N])
print(sum_val)

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

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

# 辞書データで管理
dict_cards = {}
for card in g_cards:
	if(card in dict_cards):
		dict_cards[card] += 1
	else:
		dict_cards[card] = 1
# 操作
for i in range(M):
	# sizeと同じ枚数のカードが増えたと考える
	size, val = map(int, input().split())
	if(val in dict_cards):
		dict_cards[val] += size
	else:
		dict_cards[val] = size

# 昇順にする
s_dict_cards = sorted(dict_cards.items(), key=lambda x: -x[0])

# 取り出す
s_cards = []
for val, cnt in s_dict_cards:
	s_cards += [val] * cnt
	# # 始めの個数を超えたら抜ける
	# if(len(s_cards) >= N):
	# 	break
# 出力
sum_val = sum(s_cards[:N])
print(sum_val)

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

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

# 辞書データで管理
dict_cards = {}
for card in g_cards:
	if(card in dict_cards):
		dict_cards[card] += 1
	else:
		dict_cards[card] = 1
# 操作
for i in range(M):
	# sizeと同じ枚数のカードが増えたと考える
	size, val = map(int, input().split())
	if(val in dict_cards):
		dict_cards[val] += size
	else:
		dict_cards[val] = size

# 昇順にする
s_dict_cards = sorted(dict_cards.items(), key=lambda  x: -x[0])

# 取り出す
s_cards = []
for val, cnt in s_dict_cards:
	s_cards += [val] * cnt
	# 始めの個数を超えたら抜ける
	if(len(s_cards) >= N):
		break
# 出力
sum_val = sum(s_cards[:N])
print(sum_val)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
from fractions import Fraction
a,b = input().split()
print(int(int(a)*Fraction(b)))

Buggy submission (verdict: Runtime Error):
a,b = map(input().split())
b = b*100
print(a*b/100)
Problem p02695 (python)

Fixed submission:
n, m, q = map(int, input().split())
req = []
[req.append(tuple(map(int, input().split()))) for _ in range(q)]
a = [0 for _ in range(n)]

def check():
    res = 0
    for i in range(q):
        ra, rb, rc, rd = req[i]
        if a[rb - 1] - a[ra - 1] == rc:
            res += rd
    return res

def set_a(idx: int, au: int):
    ans = 0
    for i in range(au, m + 1):
        a[idx] = i
        if idx + 1 < n:
            ans = max(set_a(idx + 1, i), ans)
        else:
            ans = max(check(), ans)
    return ans

print(set_a(0, 1))

Buggy submission (verdict: Runtime Error):
n, m, q = map(int, input().split())
req = []
[req.append(tuple(map(int, input().split()))) for _ in range(q)]
a = [0 for _ in range(m)]

def check():
    res = 0
    for i in range(q):
        ra, rb, rc, rd = req[i]
        if a[rb - 1] - a[ra - 1] == rc:
            res += rd
    return res

def set_a(idx: int, au: int):
    ans = 0
    for i in range(au, m + 1):
        a[idx] = i
        if idx + 1 < n:
            ans = max(set_a(idx + 1, i), ans)
        else:
            ans = max(check(), ans)
    return ans

print(set_a(0, 1))

Buggy submission (verdict: Runtime Error):
n, m, q = map(int, input().split())
req = []
[req.append(tuple(map(int, input().split()))) for _ in range(q)]
a = [0 for _ in range(m)]

def check():
    res = 0
    for i in range(q):
        ra, rb, rc, rd = req[i]
        if a[rb - 1] - a[ra - 1] == rc:
            res += rd
    return res

def set_a(idx: int, au: int):
    ans = 0
    for i in range(au, m + 1):
        a[idx] = i
        if idx + 1 < n:
            ans = max(set_a(idx + 1, i), ans)
        else:
            ans = max(check(), ans)
    return ans

print(set_a(0, 0))
Problem p02793 (python)

Fixed submission:
import fractions as math
from functools import reduce
 
 
N = int(input())
A=list(map(int, input().split()))
 
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
num = lcm_list(A)
 
ans = 0
 
for i in range(N):
    ans += (num // A[i])
 
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
from fractions import gcd
import fractions
import statistics
import collections
from functools import reduce
import itertools
from collections import defaultdict
import bisect
from fractions import Fraction


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

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

num = lcm_list(A)

ans = 0

for i in range(N):
    ans += (num // A[i])
    ans %= 10**9+7

print(ans）
Problem p03017 (python)

Fixed submission:
n,a,b,c,d = map(int, input().split())
s = str(input())

a,b,c,d = a-1,b-1,c-1,d-1

cnt = 0
for i in range(a,max(c,d)+1):
    if s[i] == '#':
        cnt += 1
        if cnt >= 2:
            print('No')
            exit()
    else:
        cnt = 0

cnt = 0
if b >= 2:
    if s[b-2] == '.' and s[b-1] == '.':
        cnt = 2

if s[b-1] == '.':
    cnt = 1

if c > d:
    if s[d-1] == '.' and s[d+1] == '.':
        print('Yes')
        exit() 
    for i in range(b,d+1):
        if s[i] == '.':
            cnt += 1
            if cnt >= 3:
                print('Yes')
                exit()
        else:
            cnt = 0
        if i == d:
            print('No')
            exit()
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
n,a,b,c,d = map(int, input().split())
s = str(input())

a,b,c,d = a-1,b-1,c-1,d-1

cnt = 0
for i in range(a,max(c,d)+1):
    if s[i] == '#':
        cnt += 1
        if cnt >= 2:
            print('No')
            exit()
    else:
        cnt = 0

cnt = 0
if c > d:
    for i in range(b,d+1):
        if s[i] == '.':
            cnt += 1
            if cnt >= 3:
                if i-1 != d
                print('Yes')
                exit()
        else:
            cnt = 0
        if i == c:
            print('No')
            exit()
else:
    print('Yes')
Problem p02723 (python)

Fixed submission:
s=input()
if (s[2]==s[3]) and (s[4]==s[5]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
if s[2]==s[3]&&s[4]==s[5]:
  print("Yes")
else:
  print("No")
Problem p02860 (python)

Fixed submission:
n = int(input())
S = input()
b = 0
if n % 2 == 0:
  h = int(n/2)
  b = 1
  for i in range(h):
    if S[i] != S[i+h]:
      b = 0
print("Yes" if b == 1 else "No")

Buggy submission (verdict: Runtime Error):
import java.util.Scanner;

class Main {

  static boolean RS(String S, int n) {
    
    if (n%2 == 1) return false;
      
    for(int i = 0; i < n/2; i++)
      if(S.charAt(i) != S.charAt(i+n/2))
        return false;
      
    return true;
  }
  
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    
    int n = stdIn.nextInt();
    String S = stdIn.next();
     
    if(RS(S, n))
      System.out.println("Yes");
    else
      System.out.println("No");
  }
}

Buggy submission (verdict: Runtime Error):
import java.util.Scanner;

class Main {

  static boolean RS(String S, int n) {
    
    if (n%2 == 1) return false;
      
    for(int i = 0; i < n/2; i++)
      if(S.charAt(i)) != S.charAt(i+n/2))
        return false;
      
    return true;
  }
  
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    
    int n = stdIn.nextInt();
    String S = stdIn.next();
     
    switch(RS(S, n)) {
     case true: System.out.println("Yes"); break;
     case false: System.out.println("No"); break;
    }
  }
}

Buggy submission (verdict: Runtime Error):
import java.util.Scanner;

class Main {

  static boolean RS(String S, int n) {
    
    if (n%2 == 1) return false;
      
    for(int i = 0; i < n/2; i++)
      if(S.charAt(i)) != S.charAt(i+n/2))
        return false;
      
    return true;
  }
  
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    
    int n = stdIn.next();
    String S = stdIn.next();
     
    switch(RS(S, n)) {
     case true: System.out.println("Yes"); break;
     case false: System.out.println("No"); break;
    }
  }
}

Buggy submission (verdict: Runtime Error):
n = int(input())
S = input()
b = 0
if n % 2 == 0:
  b = 1
  for i in range(n/2):
    if S[i] != S[i+n/2]:
      b = 0
print("Yes" if b == 1 else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
S = input()
b = 0
if n % 2 == 0:
  b = 1
  for i in range(n/2):
    if S[i] != S[i+n/2]:
      b = 0
print("Yes" if b = 1 else "No")
Problem p02912 (python)

Fixed submission:
import queue

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))

q = queue.PriorityQueue()
for k in a:
  q.put(k)
  
for _ in range(m):
  q.put(-(-q.get()//2))
  
ans = 0
for _ in range(n):
  ans += q.get()
  
print(-ans)

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <queue>

using namespace std;

int main()
{
  int n, m; cin >> n >> m;
  
  priority_queue<int> pq;
  while (n--) {
    int a; cin >> a;
    pq.push(a);
  }
  
  while (m--) {
    pq.push(pq.top()/2);
    pq.pop();
  }
  
  long long ans = 0;
  while (pq.size()) {
    ans += pq.top();
    pq.pop();
  }
  
  cout << ans << endl;
  return 0;
}
Problem p02689 (python)

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(M)]



graph = [[] for _ in range(N+1)]
for edge in edges:
    graph[edge[0]].append(edge[1])
    graph[edge[1]].append(edge[0])

ans = []

for i in range(1,N+1):
    can = graph[i]
    hights = []
    for j in can:
        hights.append(H[j-1])
    if len(hights) == 0:
        ans.append(i)
    else:
        h = max(hights)
        if H[i-1] > h:
            ans.append(i)

print(len(set(ans)))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(M)]



graph = [[] for _ in range(N+1)]
for edge in edges:
    graph[edge[0]].append(edge[1])
    graph[edge[1]].append(edge[0])

ans = []

for i in range(1,N+1):
    can = graph[i]
    hights = []
    for j in can:
        hights.append(H[j-1])
    h = max(hights)
    if H[i-1] > h:
        ans.append(i)

print(len(set(ans)))