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

Fixed submission:
n = int(input())
a = list(int(x) for x in input().split())
a.sort()

a_i = a[-1]

key_small, key_large = 0, n-1
border = a_i//2
while key_small < key_large-1:
    key = (key_small+key_large)//2
    if a[key] <= border:
        key_small = key
    else:
        key_large = key

p, q = a[key_small], a[key_large]

judge = a_i / 2
if abs(p-judge) < abs(q-judge):
    a_j = p
else:
    a_j = q
if a_i == a_j:
    a_j = 0
print(a_i, a_j)

Buggy submission (verdict: Runtime Error):
def nCr(n, r):
    r = min(r, n - r)
    if r == 0: return 1;
    if r == 1: return n;
    numerator = [n - r + i + 1 for i in range(r)]
    denominator  = [i + 1 for i in range(r)]
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1: 
            result *= numerator[k]
    return result

n = int(input())
a = list(int(x) for x in input().split())
a.sort()
key = []
key1 = a[0]
key2 = 1000000007
for i in range(1, n):
    key3 = a[i] - a[i-1]
    if key3 < key1 and key3 < key2:
        key2 = key3
        key.append([a[i], a[i-1]])
key.append([a[1], a[0]])
ans = 0
answer = 0
for value in key:
    i, j = value[0], value[1]
    k = nCr(i, j)
    if ans:
        if k < ans:
            ans = k
            answer = [i, j]
    else:
        ans = k
        answer = [i, j]
for i in range(2):
    print(answer[i], end=" ")

Buggy submission (verdict: Runtime Error):
def nCr(n, r):
    r = min(r, n - r)
    if r == 0: return 1;
    if r == 1: return n;
    numerator = [n - r + i + 1 for i in range(r)]
    denominator  = [i + 1 for i in range(r)]
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1: 
            result *= numerator[k]
    return result

n = int(input())
a = list(int(x) for x in input().split())
a.sort()
ans = 0
for i in range(1, n):
    value = a[i]
    key = min([value-a[0], value-a[i-1]])
    judge = nCr(value, key)
    if ans:
        if judge < ans:
            ans = judge
    else:
        ans = judge
print(ans)
Problem p03400 (python)

Fixed submission:
n = int(input())
d, x = map(int, input().split())
ans = x
for i in range(n):
    a = int(input())
    ans = ans+(d-1)//a+1
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
d, x = map(int, input().split())
ans = x
for i in range(n):
    a = int(input())
	ans += (d-1)//a+1
    
print(ans)
Problem p03449 (python)

Fixed submission:
def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]
    ans = a[0]+sum(b)
    sub = ans
    for i in range(1, n):
        sub += a[i]
        sub -= b[i-1]
        if ans < sub:
            ans = sub
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().solit()]
ans = a[0]+sum(b)
sub = ans
for i in range(1, n):
  sub += a[i]
  sub -= b[i-1]
  if ans < sub:
    ans = sub
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().solit()]
ans = a[0]+sub(b)
sub = ans
for i in range(1, n):
  sub += a[i]
  sub -= b[i-1]
  if ans < sub:
    ans = sub
print(ans)
Problem p03455 (python)

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

Buggy submission (verdict: Runtime Error):
a, b =(int, input().split())
if (a*b)%2:
  print("Odd")
else:
  print("Even")
Problem p03476 (python)

Fixed submission:
def prime(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for j in range(4, n+1, 2):
        is_prime[j] = False
    for i in range(3, int(n**0.5) + 1, 2):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

Q = int(input())
l, r = [0]*Q, [0]*Q
for i in range(Q):
    l[i], r[i] = map(int, input().split())
 
K = max(r)
prime = prime(K)
a = [1]*(K+1)
s = [0]*(K+1)
a[0] = 0
a[1] = 0
for i in range(2,K+1):
    if a[i]:
        for j in range(i*i, K+1, i):
            a[j] = 0

for i in range(3,K+1,2):
    if a[i] and a[(i+1)//2]:
        s[i] = 1

for i in range(K):
    s[i+1] += s[i]

for i in range(Q):
    rr, ll = r[i], l[i]
    if rr == ll:
        if s[ll]-s[ll-2] == 1:
            print(1)
        else:
            print(0)
    else:
        print(s[rr] - s[ll-1])

Buggy submission (verdict: Runtime Error):
def prime(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for j in range(4, n+1, 2):
        is_prime[j] = False
    for i in range(3, int(n**0.5) + 1, 2):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

Q = int(input())
l, r = [0]*Q, [0]*Q
for i in range(Q):
    l[i], r[i] = map(int, input().split())
 
K = max(r)
prime = Eratosthenes(K)
ans = [0]
for i in range(K):
    if i % 2 == 0:
        ans.append(ans[-1])
    elif i in prime and (i+1)/2 in prime:
        ans.append(ans[-1]+1)
    else:
        ans.append(ans[-1])
        
for j in range(Q):
    if r[j] == l[j]:
        print(0)
    else:
        print(ans[r[j]]-ans[l[j]])
Problem p03486 (python)

Fixed submission:
s = input()
t = input()
letters_s = []
letters_t = []
for i in range(len(s)):
  letters_s.append(s[i])
letters_s.sort()
for i in range(len(t)):
  letters_t.append(t[i])
letters_t.sort(reverse=True)
ss = "".join(letters_s)
tt = "".join(letters_t)
if ss < tt:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
letters_s = []
letters_t = []
for i in range(len(s)):
  letters_s.append(s[i])
letters_s.sort()
for i in range(len(t)):
  letters_t.append(len(t))
letters_t.sort(reverse=True)
ss = "".join(letters_s)
tt = "".join(letters_t)
if ss < tt:
  print("Yes")
else:
  print("No")
Problem p03550 (python)

Fixed submission:
import sys
from itertools import product
input = sys.stdin.readline

def main():
    n, z, w = map(int, input().split())
    
    a = list(map(int, input().split()))
    
    ans = abs(w-a[-1])
    if n != 1:
        ans = max(ans, abs(a[-2]-a[-1]))
    
    print(ans)
        

    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n, z, w = map(int, input().split())
a = [int(x) for x in input().split()]

turn = True
flag = False
p= max(a)
for i in range(n-1):
  if turn:
    if a[i] <= a[i+1]:
      continue
    elif a[i] < z and a[i] != p:
      continue
    else:
      z = a[i]
      turn = False
      if a[i] < z and a[i] == p:
        q = min(a[i+1:])
  else:
    if a[i] >= a[i+1]:
      continue
    elif a[i] > w and a[i] != q:
      continue
    else:
      w = a[i]
      turn = True
      if a[i] > w and a[i] == q:
        p = max(a[i+1:])
if turn:
  z = a[-1]
else:
  w = a[-1]
print(abs(z-w))

Buggy submission (verdict: Runtime Error):
n, z, w = map(int, input().split())
a = [int(x) for x in input().split()]

turn = True
p= max(a)
for i in range(n-1):
  if turn:
    if a[i] <= a[i+1]:
      continue
    elif a[i] < z and a[i] != p:
      continue
    else:
      z = a[i]
      turn = False
      if a[i] < z and a[i] == p:
        q = min(a[i+1:])
  else:
    if a[i] >= a[i+1]:
      continue
    elif a[i] > w and a[i] != q:
      continue
    else:
      w = a[i]
      turn = True
      if a[i] > w and a[i] == q:
        p = max(a[i+1:])
if turn:
  z = a[-1]
else:
  w = a[-1]
print(abs(z-w))

Buggy submission (verdict: Runtime Error):
n, z, w = map(int, input().split())
a = [int(x) for x in input().split()]

turn = True
p= max(a)
for i in range(n-1):
  if turn:
    if a[i] <= a[i+1]:
      continue
    elif a[i] < z and a[i] != p:
      continue
    else:
      z = a[i]
      turn = False
      if a[i] < z and a[i] == p:
        q = min(a[i+1:])
  else:
    if a[i] >= a[i+1]:
      continue
    elif a[i] > w and a[i] != q:
      continue
    else:
      w = a[i]
      turn = True
      if a[i] > w and a[i] == q:
        p = max(a[i+1:])
if turn:
  z = a[-1]
else:
  w = a[-1]
print(abs(z-w))

Buggy submission (verdict: Runtime Error):
n, z, w = map(int, input().split)
a = [int(x) for x in input().split()]

p = max(a)
q = min(a)
if z < p:
  z = p
if w > q:
  w = q
print(abs(p-q))
Problem p03564 (python)

Fixed submission:
n = int(input())
k = int(input())
ans = 1
for i in range(n):
  ans = min([ans*2, ans+k])
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
ans = 1
for i in range(n):
  ans = min([ans*2, ans+k])
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int(input()))
ans = 1
for i in range(n):
  ans = min([ans*2, ans+k])
print(ans)
Problem p03610 (python)

Fixed submission:
s = input()
ans = ""
for i in range(len(s)):
  if i%2 == 0:
    ans = ans + s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
print("".join([str(s[2*i+1]) for i in range((len(s)+1)//2)]))
Problem p03612 (python)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
ans = 0
for i in range(n):
  if i == n-1 and a[i] == n:
    ans += 1
  elif a[i] == i+1:
    ans += 1
    a[i], a[i+1] = a[i+1], a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]
ans = 0
for i in range(n):
  if i == n-1 and a[i] == n:
    ans += 1
  if a[i] == i+1:
    ans += 1
    a[i], a[i+1] = a[i+1], a[i]
print(ans)
Problem p03633 (python)

Fixed submission:
def gcd(p, q):
    if p < q:
        p, q = q, p
    while q > 0:
        p, q = q, p%q
    return p

n = int(input())
ans = 1
for i in range(n):
  t = int(input())
  ans = ans*t//gcd(ans, t)
print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(p, q):
    if p < q:
        p, q = q, p
    while q > 0:
        p, q = q, p%q
    return p

n = int(input())
ans = 1
for i in range(n):
  t = int(input())
  ans = a*t//gcd(a, t)
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n = int(input())
ans = 1
for i in range(n):
  t = int(input())
  ans = a*t//gcd(a, t)
print(ans)
Problem p03730 (python)

Fixed submission:
from fractions import gcd

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

if c%gcd(a, b):
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
from fructions import gcd

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

if c%gcd(a, b):
  print("NO")
else:
  print("YES")
Problem p03760 (python)

Fixed submission:
s = input()
t = input()
n = len(t)
for i in range(n):
  print(s[i], end="")
  print(t[i], end="")
if len(s) != len(t):
  print(s[-1], end="")
print()

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
n = len(s)
for i in range(n):
  if i%2:
    print(t[i], end="")
  else:
    print(s[i], end="")
print()

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
n = len(s)
for i in range(n):
  if i%2:
    print(s[i], end="")
  else:
    print(t[i], end="")
print()
Problem p04031 (python)

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

ans = 1e9
for p in range(-100, 101):
  sub = 0
  for q in a:
    sub += pow(p - q, 2)
  ans = min(ans, sub)

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input(split())))

ans = 1e9
for p in a:
  sub = 0
  for q in a:
    sub += pow(p - q, 2)
  ans = min(ans, sub)

print(ans)
Problem p04033 (python)

Fixed submission:
a, b = map(int, input().split())
if a*b < 0:
  print("Zero")
elif a > 0:
  print("Positive")
elif a == 0 or b == 0:
  print("Zero")
else:
  if (b-a)%2:
    print("Positive")
  else:
    print("Negative")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
if a*b < 0:
  print("Zero")
elif a > 0:
  print("Positive")
else:
  if (b-a)%2:
    print("Positive")
  else:
    print("Negative")
Problem p02639 (python)

Fixed submission:
print(list(map(int,input().split())).index(0)+1)

Buggy submission (verdict: Runtime Error):
sieve=[0]*1000009
n=int(input())
s=sorted(map(int,input().split()))
for i in s:
    if sieve[i]<2:
        for j in range(i,1000009,i):sieve[j]+=1
print(sum(sieve[i]==1for i in s))
Problem p02640 (python)

Fixed submission:
x,y=map(int,input().split())
print('Yes'if y%2==0 and x*2<=y<=x*4else'No')

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
print('YES'if y%2==0 and x*2<=y<=x*4)
Problem p02602 (python)

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

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
lis = list(map(int,input().split()))
for i in range(k):
  if lis[i] < lis[i+k]:
    print("Yes")
  else:
    print("No")
Problem p02697 (python)

Fixed submission:
n,m = map(int,input().split())
if n % 2 == 1:
    ans = [[1+i,n-i] for i in range(n//2)]
else:
    ans = [[1+i,n-i] for i in range(n//4)]+[[n//2+1+i,n//2-1-i] for i in range(n//2-n//4-1)]
for i in range(m):
    print(ans[i][0],ans[i][1])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
point = 1
now = [i for i in range(n)]
exist = [1 for i in range(n)]
for turn in range(1,m+1):
    cnt = 0
    while True:
        if exist[cnt]:
            if exist[(now[cnt]+turn)%n]:
                print(cnt+1,(cnt+turn)%n+1)
                exist[cnt] = 0
                exist[(now[cnt]+turn)%n] = 0
                break
        cnt += 1
Problem p02705 (python)

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

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
print(n * math.pi())
Problem p02713 (python)

Fixed submission:
import math
n = int(input())
lis = [[0] * n for i in range(n)]
for i in range(n):
  for j in range(n):
    lis[i][j] = math.gcd(i+1,j+1)
ans = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      ans += lis[i][lis[k][j]-1]
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
lis = [[0] * n for i in range(n)]
for i in range(n):
  for j in range(n):
    lis[i][j] = math.gcd(i+1,j+1)
ans = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      ans += lis[i][lis[k][j]]
print(ans)
Problem p02714 (python)

Fixed submission:
n = int(input())
lis = str(input())
r = []
g = []
b = []
for i in range(n):
  if lis[i] == "R":
    r.append(i)
  elif lis[i] == "G":
    g.append(i)
  else:
    b.append(i)
ans = len(r) * len(g) * len(b)
for i in range(1,n-1):
  for j in range(i+1,n):
    if i != j and 2 * j -i <= n:
      k = j + (j-i)
      if (lis[i-1] != lis[j-1]) and (lis[j-1] != lis[k-1]) and (lis[k-1] != lis[i-1]):
        ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = str(input())
r = []
g = []
b = []
for i in range(n):
  if lis[i] == "R":
    r.append(i)
  elif lis[i] == "G":
    g.append(i)
  else:
    b.append(i)
ans = len(r) * len(g) * len(b)
for i in range(n-2):
  for j in range(i+1,n-1):
    k = j + (j-i)
    if (lis[i] != lis[j]) and (lis[j] != lis[k]) and (lis[k] != lis[i]):
      ans -= 1
print(ans)
Problem p02720 (python)

Fixed submission:
n=int(input())
now=[1,2,3,4,5,6,7,8,9]
if n<10:
  print(now[n-1])
  exit()
cnt=9
while True:
  next=[]
  for s in now:
    s=str(s)
    if s[-1]!="0":
      cnt+=1
      if cnt<n:
        next.append(s+str(int(s[-1])-1))
      else:
        print(s+str(int(s[-1])-1))
        exit()
    cnt+=1
    if cnt<n:
      next.append(s+s[-1])
    else:
      print(s+s[-1])
      exit()
    if s[-1]!="9":
      cnt+=1
      if cnt<n:
        next.append(s+str(int(s[-1])+1))
      else:
        print(s+str(int(s[-1])+1))
        exit()
  now=next

Buggy submission (verdict: Runtime Error):
n=int(input())
now=[1,2,3,4,5,6,7,8,9]
if n<10:
  print(now[n-1])
  exit()
cnt=9
while True:
  next=[]
  for s in now:
    s=str(s)
    if s[-1]!="0":
      cnt+=1
      if cnt<n:
        next.append(s+str(int(s[-1]-1)))
      else:
        print(s+str(int(s[-1]-1)))
        exit()
    cnt+=1
    if cnt<n:
      next.append(s+s[-1])
    else:
      print(s+s[-1])
      exit()
    if s[-1]!="9":
      cnt+=1
      if cnt<n:
        next.append(s+str(int(s[-1]+1)))
      else:
        print(s+str(int(s[-1]+1)))
        exit()
  now=next
Problem p02727 (python)

Fixed submission:
x,y,a,b,c=map(int,input().split())
lia=list(map(int,input().split()))
lib=list(map(int,input().split()))
lic=list(map(int,input().split()))
lia.sort(reverse=True)
lib.sort(reverse=True)
lic.sort(reverse=True)
ans=lia[:x]+lib[:y]
ans.sort()
cnt=0
now=0
while cnt < x+y and now < c:
  if lic[now] > ans[cnt]:
    ans[cnt]=lic[now]
    now+=1
  cnt+=1
print(sum(ans))

Buggy submission (verdict: Runtime Error):
x,y,a,b,c=map(int,input().split())
lia=list(map(int,input().split()))
lib=list(map(int,input().split()))
lic=list(map(int,input().split()))
lia.sort(reverse=True)
lib.sort(reverse=True)
lic.sort(reverse=True)
ans=lia[:x]+lib[:y]
ans.sort(reverse=True)
cnt=0
now=0
while cnt < a+b and now < c:
  if lic[now] > ans[cnt]:
    ans[cnt]=lic[now]
    now+=1
  cnt+=1
print(sum(ans))
Problem p02732 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
num = [0 for i in range(n+1)]
for nn in lis:
  num[nn] += 1
ans = 0
for nnn in num:
  ans += (nnn*(nnn-1))//2
for i in range(n):
  print(ans-(num[lis[i]]*(num[lis[i]]-1))//2+((num[lis[i]]-1)*(num[lis[i]]-2))//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
num = [0 for i in range(n)]
for nn in lis:
  num[nn-1] += 1
ans = 0
for nnn in num:
  ans += (nnn*(nnn-1))//2
for i in range(n):
  print(ans-(num[lis[i]]*(num[lis[i]]-1))//2+((num[lis[i]]-1)*(num[lis[i]]-2))//2)
Problem p02733 (python)

Fixed submission:
import math

h,w,k = map(int,input().split())
s = [str(input()) for i in range(h)]
ans = h * w

if h == 1:
    print(math.ceil("1".count(s[0])/k))
    exit()

for i in range(2 ** (h-1)):
    ss = str(format(i,"b").zfill(h-1))
    cnt = 0
    zerocnt = 0
    key = 1
    for j in range(len(ss)):
        if ss[j] == "0":
            zerocnt += 1
    now = [0 for i in range(zerocnt+1)]

    for j in range(w):
        next = []
        num = 0
        for n in range(h):
            if s[n][j] == "1":
                num += 1
            if num > k:
                key = 0
            if n < h-1 and ss[n] == "0":
                next.append(num)
                num = 0
        next.append(num)
  #        print(next,now)
        keykey = 1
        for n in range(zerocnt+1):
            if keykey:
                if now[n] + next[n] > k:
                    now = next
                    cnt += 1
                    keykey = 0
                else:
                    now[n] += next[n]
  #    print(now)
  #    print(ans,cnt,zerocnt)
    if key:ans = min(ans,cnt+zerocnt)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

h,w,k = map(int,input().split())
s = [str(input()) for i in range(h)]
ans = h * w

if h == 1:
    print(math.ceil("1".count(s[0])/k))
    exit()

for i in range(2 ** (h-1)):
    ss = str(format(i,"b").zfill(h-1))
    cnt = 0
    zero = 0
    key = 1
    for j in range(len(ss)):
        if ss[j] == "0":
            zero += 1
    now = [0 for i in range(zerocnt+1)]

    for j in range(w):
        next = []
        num = 0
        for n in range(h):
            if s[n][j] == "1":
                num += 1
            if num > k:
                key = 0
            if n < h-1 and ss[n] == "0":
                next.append(num)
                num = 0
        next.append(num)
        
        keykey = 1
        for n in range(zero+1):
            if keykey:
                if now[n] + next[n] > k:
                    now = next
                    cnt += 1
                    keykey = 0
                else:
                    now[n] += next[n]
                    
    if key:ans = min(ans,cnt+zero)
print(ans)
Problem p02741 (python)

Fixed submission:
lis=[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]
k=int(input())
print(lis[k-1])

Buggy submission (verdict: Runtime Error):

ab=""
cnt = 0
while ab=="" and cnt<len(a):
  for i in range(min(len(b),len(a)-cnt)):
    if a[i+cnt]!="?" and b[i]!="?" and a[i+cnt]!=b[i]:
      ab=""
      break
    else:
      if a[i+cnt]!="?":
        ab += a[i+cnt]
      else:
        ab +=b[i]
if ab=="":
  ab =a+b
abc=""
cnt=0
while abc=="" and cnt<len(ab):
  for i in range(min(len(c),len(ab)-cnt)):
    if ab[i+cnt]!="?" and c[i+cnt]!="?" and ab[i+cnt]!=c[i+cnt]:
      abc=""
      break
    else:
      if ab[i+cnt]!="?":
        abc+=ab[i+cnt]
      else:
        abc+=c[i]
if abc!="":
  ans =min(ans,len(abc))

Buggy submission (verdict: Runtime Error):
import math
a,b,c =map(int,input().split())
if math.sqrt(a)+math.sqrt(b)==math.sqrt(c):
  print("Yes")
else:
  print("No")
Problem p02743 (python)

Fixed submission:
a,b,c=map(int,input().split())
if 0>=c-a-b:
  print("No")
  exit()
if 4*a*b<(c-a-b)**2:
  print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
import math
a,b,c =map(int,input().split())
if math.sqrt(a)+math.sqrt(b)=math.sqrt(c):
  print("Yes")
else:
  print("No")
Problem p02756 (python)

Fixed submission:
s=str(input())
q=int(input())
now = 0
mae,usiro="",""
for _ in range(q):
  lis = list(map(str,input().split()))
  if int(lis[0]) == 1:
    now = (now+1)%2
  else:
    if (int(lis[1])+now)%2 == 1:
      mae = lis[2]+mae
    else:
      usiro= usiro +lis[2]
s = mae+s+usiro
if now ==0:
  print(s)
else:
  print(s[::-1])

Buggy submission (verdict: Runtime Error):
=list(str(input()))
q=int(input())
now = 0
for _ in range(q):
  lis = list(map(str,input().split()))
  if int(lis[0]) == 1:
    now = (now+1)%2
  else:
    if (int(lis[1])+now)%2 == 1:
      s.insert(0,lis[2])
    else:
      s.append(lis[2])
if now ==0:
  for i in range(len(s)):
    print(s[i],end="")
else:
  for i in range(len(s)):
    print(s[-i-1],end="")

Buggy submission (verdict: Runtime Error):
s=list(str(input()))
q=int(input())
now = 0
for _ in range(q):
  lis = list(map(str,input().split()))
  if int(lis[0]) == 1:
    now = (now+1)%2
  else:
    if (int(lis[1])+now)%2 == 1:
      s.insert(lis[2],0)
    else:
      s.append(lis[2])
if now ==1:
  print(*s)
else:
  for i in range(len(s)):
    print(s[-i-1],end="")
Problem p02761 (python)

Fixed submission:
n,m = map(int,input().split())
ans = [-1 for i in range(n)]
for i in range(m):
  s,c = map(int,input().split())
  if s == 1 and c == 0 and n != 1:
    print(-1)
    exit()
  if ans[s-1] != -1 and ans[s-1] != str(c):
    print(-1)
    exit()
  ans[s-1] = str(c)
for i in range(n):
  if ans[i] == -1:
    if i == 0 and n != 1:
      ans[0] = "1"
    else:
      ans[i] = "0"
print(int("".join(ans)))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ans = [-1 for i in range(n)]
for i in range(n):
  s,c = map(int,input().split())
  if ans[s-1] != -1 and ans[s-1] != str(c):
    print(-1)
    exit()
  ans[s-1] = str(c)
for i in range(n):
  if ans[i] == -1:
    ans[i] = "0"
print(int("".join(ans)))
Problem p02797 (python)

Fixed submission:
n,k,s = map(int,input().split())
ans = []
if s == 10 ** 9:
    num = 10 ** 9-1
else:
    num = 10 ** 9
for i in range(k):
    ans.append(str(s))
for i in range(n-k):
    ans.append(str(num))
print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
if s == 10 ** 9:
    num = 10 ** 9-1
else:
    num == 10 ** 9
print(" ".join([str(s)]+["0" for i in range(k-1)]+[str(num) for j in range(n-k)]))
Problem p02801 (python)

Fixed submission:
s = str(input())
print(chr(ord(s)+1))

Buggy submission (verdict: Runtime Error):
s = str(input())
print(char(ord(s)+1))