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

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

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n+1)]
print(max(e_sum))

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

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k+1, n+1)]
print(max(e_sum))

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

p_e = [ (x + 1) * 0.5 for x in p]
p_p = [p_e[0]]

for i in range(1, n):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n)]
print(max(e_sum))
Problem p02787 (python)

Fixed submission:
import numpy as np

h, n = map(int, input().split())
ab = np.array([list(map(int, input().split())) for _ in range(n)])

a = ab[:, 0]
b = ab[:, 1]

dp = np.zeros(10**5, dtype=np.int)

for i in range(1, h+1):
    dp[i] = min(dp[i-a]+b)

print(dp[h])

Buggy submission (verdict: Runtime Error):
import numpy as np

h, n = map(int, input().split())
ab = np.array([list(map(int, input().split())) for _ in range(n)])

a = ab[:, 0]
b = ab[:, 1]

dp = np.zeros(10, dtype=np.int)

for i in range(1, h+1):
    dp[i] = min(dp[i-a]+b)

print(dp[h])
Problem p02741 (python)

Fixed submission:
input_line = input()
b = int(input_line)
a = (1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
a_list = list(a)
print(a_list[b-1])

Buggy submission (verdict: Runtime Error):
input_line = input()
b = int(input_line)
a = (1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
a_list = list(a)
print(a_list[b])
Problem p02747 (python)

Fixed submission:
S = input() 
if (S == 'hi' or S == 'hihi' or S == 'hihihi' or S == 'hihihihi' or S == 'hihihihihi'):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input() 
if == ('hi' or 'hihi' or 'hihihihi' or 'hihihihihi'):
  print('Yes')
else:
  print('No')
Problem p02765 (python)

Fixed submission:
N, R = map(int, input().split())
def a(N,R):
     if N >= 10:
             print(R)
     else:
             print(R+(100*(10-N)))
     return
  
a(N,R)

Buggy submission (verdict: Runtime Error):
N, R = map(int, input().split())
def a(N,R):
     if N >= 10:
             print(R)
     else:
             print(R+(100*(10-N)))
     return
  
a()

Buggy submission (verdict: Runtime Error):
def a(N,R):
     if N >= 10:
             print(R)
     else:
             print(R+(100*(10-K)))
     return

  
a(N,R)
Problem p02783 (python)

Fixed submission:
H, A =map(int, input().split())
if H%A == 0:
  print(int(H/A))
else:
  print(H//A+1)

Buggy submission (verdict: Runtime Error):
H, A = map(int, input().split())
H, A = int(H. A)
def a(H,A):
  if H/B <= 0:
    print(H//A+1)
  else:
    print(H/A)
    return

a(H,B)
Problem p02817 (python)

Fixed submission:
A, B = input().split()
C = B + A
print(C)

Buggy submission (verdict: Runtime Error):
list = [T,S]
	setup.strip','
list

Buggy submission (verdict: Runtime Error):
list = []
	print(T,S)
	setup.strip','

list

Buggy submission (verdict: Runtime Error):
list = []
	setup.strip','
	print(T,S)
list

Buggy submission (verdict: Runtime Error):
input = S
input = T
a = list[S,T]:
  print(a)
Problem p03361 (python)

Fixed submission:
val = input()
val = [int(x.strip()) for x in val.split(" ")]
h = val[0]
w = val[1]

s = [[0]*w]*h
for i in range(h):
    s[i] = input()

ans = "Yes"

for i in range(h):
    for j in range(w):
        d = 0
        if s[i][j] == ".":
            continue

        if i > 0:
            if s[i-1][j] == "#":
                d += 1

        if i < h-1:
            if s[i+1][j] == "#":
                d += 1

        if j > 0:
            if s[i][j-1] == "#":
                d += 1

        if j < w-1:
            if s[i][j+1] == "#":
                d += 1
        
        if d == 0:
            ans = "No"
            break
    if ans == "No":
        break

print(ans)

Buggy submission (verdict: Runtime Error):
val = input()
val = [int(x.strip()) for x in val.split(" ")]
h = val[0]
w = val[1]

s = [[0]*w]*h
for i in range(h):
    s[i] = input()

ans = "Yes"

for i in range(h):
    for j in range(w):
        d = 0
        if s[i][j] == ".":
            continue

        if i > 0:
            if s[i-1][j] == "#":
                d += 1

        if i < h-1:
            if s[i+1][j] == "#":
                d += 1

        if j > 0:
            if s[i][j-1] == "#":
                d += 1

        if j < h-1:
            if s[i][j+1] == "#":
                d += 1
        
        if d == 0:
            ans = "No"
            break
    if ans == "No":
        break

print(ans)
Problem p03362 (python)

Fixed submission:
#from sympy import *

def prime(x):
    i = x
    while True:
        f = False
        j = 2
        while i > j:
            if i % j == 0:
                f = True
                break
            j += 1
        if f == False:
            break
        i += 1
    return i


n = int(input())
l = list()
a = 6
i = 0
while i < n:
    a = prime(a+1)
    if a % 5 != 1:
        continue 
    l.append(a)
    i += 1

print(' '.join(map(str, l)))

Buggy submission (verdict: Runtime Error):
from sympy import *

n = int(input())
l = list()
a = 0
i = 0
while i < n:
    a = nextprime(a)
    if a % 5 != 1:
        continue 
    l.append(a)
    i += 1

print(l)
Problem p02642 (python)

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

a.sort()

MAXN = a[-1]


divisors = [False for _ in range(MAXN + 1)]
answer = 0
apast = None
for i, ai in enumerate(a):
    if ai == apast:
        is_good = False
    elif i < n - 1 and ai == a[i + 1]:
        is_good = False
        m = 1
        while m * ai <= MAXN:
            divisors[m * ai] = True
            m += 1
    else:
        is_good = not divisors[ai]

        m = 1
        while m * ai <= MAXN:
            divisors[m * ai] = True
            m += 1

    if is_good:
        answer += 1

    apast = ai


print(answer)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]

a.sort()

MAXN = 2 * 10 ** 5


def prime_factorization(n):
    pmax = int(n ** 0.5 // 1) + 1

    factors = {}
    for p in range(2, pmax + 1):
        while n % p == 0:
            factors[p] = factors.get(p, 0) + 1
            n //= p
    if n != 1:
        factors[n] = factors.get(n, 0) + 1

    return factors


divisors = [False for _ in range(MAXN + 1)]
answer = 0
apast = None
for i, ai in enumerate(a):
    if ai == apast:
        is_good = False
    elif i < n - 1 and ai == a[i + 1]:
        is_good = False
    else:
        is_good = not divisors[ai]

        m = 1
        while ai * m <= MAXN:
            divisors[m * ai] = True
            m += 1

        # factors = prime_factorization(ai)
        # factors[1] = 1
        # for p, m in factors.items():
        #     pm = 1
        #     for i in range(m):
        #         p *=
        #         if p ** (i + 1) in divisors:
        #             is_good = False
        #             break
        #     if not is_good:
        #         break

    if is_good:
        answer += 1

    apast = ai


print(answer)
Problem p03488 (python)

Fixed submission:
from sys import setrecursionlimit

setrecursionlimit(10 ** 6)

s = input() + "T"
x, y = map(int, input().split())

stepx = []
stepy = []

headx = True
step = 0
for c in s:
    if c == "F":
        step += 1
    else:
        if headx:
            stepx.append(step)
        else:
            stepy.append(step)
        headx = not headx
        step = 0

x -= stepx[0]
stepx = stepx[1:]


class Reachable:
    def __init__(self, steps):
        self.steps = steps

        self.maxs = sum(steps)
        self.r = [{} for _ in range(len(steps))]

    def __call__(self, i, s):
        if i == -1:
            return s == 0
        elif not -self.maxs <= s <= self.maxs:
            return False
        elif self.r[i].get(s, None) is not None:
            return self.r[i][s]
        else:
            step = self.steps[i]
            r = self(i - 1, s - step) or self(i - 1, s + step)
            self.r[i][s] = r
            return r


answer = Reachable(stepx)(len(stepx) - 1, x) and Reachable(stepy)(len(stepy) - 1, y)

if answer:
    print("Yes")
else:
    print("No")

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

stepx = []
stepy = []

headx = True
step = 0
for c in s:
    if c == "F":
        step += 1
    else:
        if headx:
            stepx.append(step)
        else:
            stepy.append(step)
        headx = not headx
        step = 0

x -= stepx[0]
stepx = stepx[1:]


class Reachable:
    def __init__(self, steps):
        self.steps = steps

        self.maxs = sum(steps)
        self.r = {
            i: {s: None for s in range(-self.maxs, self.maxs + 1)}
            for i in range(len(steps))
        }

    def __call__(self, i, s):
        if i == -1:
            return s == 0
        elif not -self.maxs <= s <= self.maxs:
            return False
        elif self.r[i][s] is not None:
            return self.r[i][s]
        else:
            step = self.steps[i]
            r = self(i - 1, s - step) or self(i - 1, s + step)
            self.r[i][s] = r
            return r


rx = Reachable(stepx)
ry = Reachable(stepy)
answer = rx(len(stepx) - 1, x) and ry(len(stepy) - 1, y)
if answer:
    print("Yes")
else:
    print("No")
Problem p03504 (python)

Fixed submission:
from itertools import accumulate

MAX_T = 10 ** 5 + 100
MAX_C = 30

n, c = map(int, input().split())
time = {c: [] for c in range(1, MAX_C + 1)}

for _ in range(n):
    s, t, c = map(int, input().split())
    time[c].append((s, t))

n_program = [0 for _ in range(MAX_T + 1)]

for c in range(1, MAX_C + 1):

    recording = [0 for _ in range(MAX_T + 1)]

    for s, t in time[c]:
        recording[s] += 1
        recording[t + 1] -= 1

    recording = accumulate(recording)

    for i, r in enumerate(recording):
        if r:
            n_program[i] += 1

answer = max(n_program)
print(answer)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate

MAX_T = 10 ** 5

n, c = map(int, input().split())
time = []
channel = []
for _ in range(n):
    s, t, c = map(int, input().split())
    time.append((s, t))
    channel.append(c)

n_program = [0 for _ in range(MAX_T + 1)]

for s, t in time:
    n_program[s] += 1
    n_program[t + 1] -= 1

n_program = accumulate(n_program)

answer = max(n_program)
print(answer)
Problem p02681 (python)

Fixed submission:
S = input()
T = input()
if T[:-1] == S:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()
N = input()
if n in N: 
  print("Yes")
else: 
  print("No"
Problem p02811 (python)

Fixed submission:
n = 500
x, y = map(int, input().split())
if x*n >= y: 
    print("Yes")
else: 
    print("No")

Buggy submission (verdict: Runtime Error):
n = 500
x, y = map(int, raw_input().split()) 
if x*n >= y: 
  print("Yes")
else: 
  print("No")
Problem p02602 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(k, n):
  if a[i] > a[i-k]:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(k, n);
  if a[i] > a[i-k]:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range (k, n);
  if a[i] > a[i-k]:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range (k, n);
  if a(i) > a(i-k):
    print("Yes")
  else:
    print("No")
Problem p03964 (python)

Fixed submission:
import math

def quot(p, q):
  return p // q + (p % q != 0)

n = int(input())
ratio = [list(map(int, input().split())) for i in range(n)]

k = 1
for i in range(n-1):
  k1 = quot(ratio[i][0] * k , ratio[i+1][0])
  k2 = quot(ratio[i][1] * k , ratio[i+1][1])
  k = max(k1, k2)

print(sum(ratio[n-1]) * k)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
ratio = [list(map(int, input().split())) for i in range(n)]

k = 1
for i in range(n-1):
  k1 = math.ceil(ratio[i][0] * k / ratio[i+1][0])
  k2 = math.ceil(ratio[i][1] * k / ratio[i+1][1])
  k3 = math.ceil(sum(ratio[i]) * k / sum(ratio[i+1])
  k = max(k1, k2, k3)

print(sum(ratio[n-1]) * k)
Problem p03965 (python)

Fixed submission:
s = input()

score = 0
for i in range(len(s)):
  if i % 2 == 0 and s[i] == "p":
    score -= 1
  elif i % 2 != 0 and s[i] == "g":
    score += 1

print(score)

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

score = 0
for i in range(len(s)):
  if i % 2 == 0 and s[i] = "p":
    score -= 1
  elif i % 2 != 0 and s[i] = "g":
    score += 1

print(s)
Problem p02993 (python)

Fixed submission:
s = input()
l = list(s)
flag = 0
for i in range(0,len(l)-1):
	if l[i+1]==l[i]:
		flag=1
		break
if flag==1:
	print('Bad')
else:
	print('Good')

Buggy submission (verdict: Runtime Error):
s = (input())
l = list(s)
flag = 0
for i in range(0,len(l)-1):
	if l[i+1]==l[i]:
    	flag=1
		break
if flag==1:
	print('Bad')
else:
	print('Good')

Buggy submission (verdict: Runtime Error):
s = (input()
l = list(s)
flag = 0
for i in range(0,len(l)-1):
	if l[i+1]==l[i]:
    	flag=1
		break
if flag==1:
	print('Bad')
else:
	print('Good')

Buggy submission (verdict: Runtime Error):
s = (input()
l = list(s)
flag = 0
for i in range(0,len(l)-1):
	if l[i+1]==l[i]:
    	flag=1
   		break
if flag==1:
	print('Bad')
else:
	print('Good')
Problem p02887 (python)

Fixed submission:
N = int(input())
S = input()
num = 0

for i in range(len(S)-1):
    if S[i] != S[i + 1]:
        num += 1

print(num+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
d = [int(x) for x in input().split()]
num = 0

for a in range(N-2):
    for b in range(a + 1, N-1):
        for c in range(b + 1, N):
            if (abs(d[a]-d[b]) < d[c]) and (d[c] < d[a] + d[b]):
                num += 1

print(num)
Problem p03323 (python)

Fixed submission:
from sys import stdin, stdout
from math import sqrt
from collections import defaultdict
#t = int(stdin.readline().strip())
#R, L, C, Vin = [float(x) for x in stdin.readline().strip().split()]
A, B = [int(x) for x in stdin.readline().strip().split()]
print("Yay!" if (A <= 8 and B <= 8) else ":(")

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
from math import sqrt
from collections import defaultdict
#t = int(stdin.readline().strip())
#R, L, C, Vin = [float(x) for x in stdin.readline().strip().split()]
A = int(stdin.readline().strip())
B = int(stdin.readline().strip())
print("Yay!" if (A <= 8 and B <= 8) else ":(")

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
from math import sqrt
from collections import defaultdict
#t = int(stdin.readline().strip())
#R, L, C, Vin = [float(x) for x in stdin.readline().strip().split()]
A = int(stdin.readline().strip())
B = int(stdin.readline().strip())
print("Yay!" if (A <= 8 and B <= 8) else ":(")
Problem p02612 (python)

Fixed submission:
N = int(input())
for A in range(11) :
    if A * 1000 >= N :
        break
oturi = A * 1000 - N
print(oturi)

Buggy submission (verdict: Runtime Error):
N = int(input())
C0 = 0
C1 = 0
C2 = 0
C3 = 0

for A in N :
    str = input()
    if str == 'AC' :
        C0 += 1
    if str == 'WA' :
        C1 += 1
    if str == 'TLE':
        C2 += 1
    if str == 'RE' :
        C3 += 1

print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))
Problem p02613 (python)

Fixed submission:
N = int(input())
C0 = 0
C1 = 0
C2 = 0
C3 = 0

for A in range(N) :
    B = input()
    if B == 'AC' :
        C0 += 1
    if B == 'WA' :
        C1 += 1
    if B == 'TLE':
        C2 += 1
    if B == 'RE' :
        C3 += 1

print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))

Buggy submission (verdict: Runtime Error):
N = int(input())
C0 = 0
C1 = 0
C2 = 0
C3 = 0

for A in N :
    str = input()
    if str == 'AC' :
        C0 += 1
    if str == 'WA' :
        C1 += 1
    if str == 'TLE':
        C2 += 1
    if str == 'RE' :
        C3 += 1

print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))

Buggy submission (verdict: Runtime Error):
N = int(input())
C0 = 0
C1 = 0
C2 = 0
C3 = 0

for A in N :
    str = input()
    if str == 'AC' :
        C0 += 1
    if str == 'WA' :
        C1 += 1
    if str == 'TLE':
        C2 += 1
    if str == 'RE' :
        C3 += 1

print('AC x ' + C0)
print('WA x ' + C1)
print('TLE x ' + C2)
print('RE x ' + C3)
Problem p02603 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
money=1000
i=0
while i<N-1:
    k=1
    while A[i]==A[i+k]:
        if i+k==N-1:
            i=i+k
            break
        else:
            k+=1
    if i==N-1:
        break
    if A[i+k]>A[i]:
        kabu=money//A[i]
        money-=kabu*A[i]
        money+=kabu*A[i+k]
        i=i+k
    elif A[i+k]<A[i]:
        i=i+k

print(money)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
money=1000
i=0
while i<N-1:
    k=1
    while A[i]==A[i+k]:
        k+=1
   
    if A[i+k]>A[i]:
        kabu=money//A[i]
        money-=kabu*A[i]
        money+=kabu*A[i+k]
        i=i+k
    elif A[i+k]<A[i]:
        i=i+k

print(money)
Problem p02690 (python)

Fixed submission:
import sys
X=int(input())
for A in range(-120,120):
    for B in range(-120,120):
        if A**5-B**5==X:
            print(A,B)
            sys.exit()

Buggy submission (verdict: Runtime Error):
X=int(input())
for A in range(-120,120):
    for B in range(-120,120):
        if A**5-B**5==X:
            print(A,B)
            breakｓ
Problem p02713 (python)

Fixed submission:
from math import gcd
K=int(input())
ans=0 
 
for i in range(1,K+1):
  for j in range(1,K+1):
    for l in range(1,K+1):
      ans+= gcd(gcd(l,j),i)
 
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gdc
K=int(input())
ans=0 
 
for i in range(1,K+1):
  for j in range(1,K+1):
    for l in range(1,K+1):
      ans+= gcd(gcd(i,j),l)
 
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gdc
K=int(input())
ans=0 

for i in range(1,K+1):
  for j in range(1,K+1):
    for l in range(1,K+1):
      ans+= gcd(gcd(l,j),i)

print(ans)
Problem p02718 (python)

Fixed submission:
N,M = map(int,input().split())
A = list(map(int, input().split()))
total = sum(A)
cutoff = total/(4*M)

over=[]
for i in A:
    if i>=cutoff:
        over.append(i)

if len(over)>=M:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int, input().split()))
total = sum(A)
cutoff = total/4N

over=[]
for i in A:
    if i>=cutoff:
        over.append(i)

if len(over)>=M:
    print('Yes')
else:
    print('No')
Problem p02720 (python)

Fixed submission:
K=int(input())

from collections import deque
num=deque()
for i in range(1,10):
  num.append(i)

for j in range(K):
  l=num.popleft()
  if l%10 !=0:
    num.append(l*10+(l%10-1))
  num.append(l*10+(l %10))
  if l%10 != 9:
    num.append(l*10+(l%10+1))

print(l)

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

from collections import deque
num=deque()
for i in range(1,10):
  num.append(i)

for j in range(K):
  l=num.popleft()
  if ans%10 !=0:
    num.append(l*10+(l%10-1))
  num.append(l*10)
  if ans%10 != 9:
    num.append(l*10+(l%10+1))

print(l)
Problem p02730 (python)

Fixed submission:
S=input()
N=len(S)
ans='Yes'

for i in range((N-1)//2):
    if S[i] != S[N-i-1]:
        ans='No'

if int((N-1)/2)%2==1:
    for i in range((N-3)//4):
        if S[i] != S[((N-3)//2)-i] or S[((N+1)//2)+i] != S[N-i-1]:
            ans='No'
else:
    for i in range((N-1)//4):
        if S[i] != S[((N-3)//2)-i] or S[((N+1)//2)+i] != S[N-i-1]:
            ans='No'
 
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
N=len(S)
ans='Yes'
if N==3:
  S[0]!=S[2]:
    ans='No'
else:
    if int((N-1)/2)%2==1:
        for i in range((N-3)//4):
            if S[i] != S[((N-3)//2)-i] or S[((N+1)//2)+i] != S[N-i-1]:
                ans='No'
    else:
        for i in range((N-1)//4):
            if S[i] != S[((N-3)//2)-i] or S[((N+1)//2)+i] != S[N-i-1]:
                ans='No'
 
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
N=len(S)
ans='Yes'
if N=3:
    if S[0]!=S[2]:
        ans='No'
else:
    if int((N-1)/2)%2==1:
        for i in range((N-3)//4):
            if S[i] != S[(N-3)//2-i] or S[(N+1)//2+i] != S[N-i-1]:
                ans='No'
    else:
        for i in range((N-1)//4):
            if S[i]!=S[(N-3)//2-i] or S[(N-1//2)+i]!=S[N-i-1]:
                ans='No'

print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
N=len(S)
ans='Yes'

if int((N-1)/2)%2==1:
    for i in range((N-3)//4):
        if S[i] != S[(N-3)//2-i] or S[(N+1)//2+i] != S[N-i-1]:
            ans='No'
else:
    for i in range((N-1)//4):
        if S[i]!=S[(N-3)//2-i] or S[(N-1//2)+i]!=S[N-i-1]:
            ans='No'

print(ans)
Problem p02748 (python)

Fixed submission:
A,B,M=map(int,input().split())
a_1=list(map(int,input().split()))
b_1=list(map(int,input().split()))
L=[list(map(int,input().split())) for _ in range(M)]

count=[]
count.append(min(a_1)+min(b_1))

for k in range(M):
    count.append(a_1[L[k][0]-1]+b_1[L[k][1]-1]-L[k][2])

print(min(count))

Buggy submission (verdict: Runtime Error):
A,B,M=map(int,input().split())
a_1=list(map(int,input().split()))
b_1=list(map(int,input().split()))
L=[list(map(int,input().split())) for _ in range(M)]

count=[]
for i in a_1:
    for j in b_1:
        count.append(i+j)

for k in range(M):
    count.append(a_1[L[k][0]]+b_1[L[k][1]]-L[k][2])

print(min(count))
Problem p02761 (python)

Fixed submission:
N,M=map(int,input().split())
A=[]
if M==0:
    if N==1:
        print(0)
        exit()
    elif N==2:
        print(10)
        exit()
    else:
        print(100)
        exit()
        
else:
    for _ in range (M):
        s,c=map(int,input().split())
        A.append([s,c])

    for i in range(1000):
        i=str(i)
        if len(i)!=N:
            continue
        ans=0
        for X in A:
            x=X[0]
            y=X[1]
            x-=1
            if i[x]!=str(y):
                ans=1
                break
            else:
                continue
        if ans==0:
            print(i)
            exit()
print(-1)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
INF=10**18
A=[INF]*N
ans=0
for _ in range(M):
    s,c=map(int,input().split())
    s-=1
    if A[s]==INF:
        A[s]=c
    else:
        if A[s]!=c:
            print(-1)
            exit()
        else:
            continue

if A[0]==0:
    print(-1)
    exit()
elif A[0]==INF:
    A[0]=1

for i in range(1,3):
    if A[i]==INF:
        A[i]=0
A=[str(a) for a in A]
print(''.join(A))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
INF=10**18
A=[INF]*N
ans=0
for _ in range(M):
    s,c=map(int,input().split())
    s-=1
    if A[s]==INF:
        A[s]=c
    else:
        if A[s]!=c:
            print(-1)
            exit()

if A[0]==0:
    print(-1)
    exit()
elif A[0]==INF:
    A[0]=1

for i in range(1,3):
    if A[i]==INF:
        A[i]=0
A=[str(a) for a in A]
print(''.join(A))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
INF=10**18
A=[INF]*N
ans=0
for _ in range(M):
    s,c=map(int,input().split())
    s-=1
    if A[s]==INF:
        A[s]=c
    else:
        if A[s]!=c:
            print(-1)
            exit()

if A[0]==0:
    print(-1)
    exit()
elif A[0]==INF:
    A[0]==1

for i in range(1,3):
    if A[i]==INF:
        A[i]=0
A=[str(a) for a in A]
print(''.join(A))