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

Fixed submission:
import sys
readline = sys.stdin.readline

def main():
    A, B, C, D, E, F = map(int, readline().rstrip().split())
    X = set()
    for a in range(F//(100*A)+1):
        for b in range(F//(100*B)+1):
            if 100 * a * A + 100 * b * B <= F:
                X.add(100 * a * A + 100 * b * B)
    X.remove(0)

    Y = set()
    for c in range(F//C+1):
        for d in range(F//D+1):
            if c * C + d * D <= F/2:
                Y.add((c * C + d * D))

    ans = (0, 0)
    max_dens = -1
    for x in X:
        for y in Y:
            if x + y > F:
                continue
            if y * 100 <= x * E:
                dens = y/(x+y)
                if dens > max_dens:
                    ans = (x+y, y)
                    max_dens = dens
    print(*ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline

def main():
    A, B, C, D, E, F = map(int, readline().rstrip().split())
    X = set()
    for a in range(F//(100*A)+1):
        for b in range(F//(100*B)+1):
            if 100 * a * A + 100 * b * B <= F:
                X.add(100 * a * A + 100 * b * B)
    X.remove(0)

    Y = set()
    for c in range(F//C+1):
        for d in range(F//D+1):
            if c * C + d * D <= F/2:
                Y.add((c * C + d * D))

    # ans = (0, 0)
    max_dens = 0
    for x in X:
        for y in Y:
            if x + y > F:
                continue
            if y * 100 <= x * E:
                dens = y/(x+y)
                if dens > max_dens:
                    ans = (x+y, y)
                    max_dens = dens
    print(*ans)

if __name__ == '__main__':
    main()
Problem p03633 (python)

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

#from math import gcd
num_clock = int(input())
times = [int(input()) for i in range(num_clock)]
spent_time = times[0]
for time in times[1:]:
    spent_time = (spent_time * time) // gcd(spent_time, time)
print(spent_time)

Buggy submission (verdict: Runtime Error):
from math import gcd
num_clock = int(input())
times = [int(input()) for i in range(num_clock)]
spent_time = times[0]
for time in times[1:]:
    spent_time = (spent_time * time) // gcd(spent_time, time)
print(spent_time)
Problem p03696 (python)

Fixed submission:
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    S = readline().rstrip()
    res = S[:]

    pls_left = 0
    pointer = 0
    for s in S:
        if s == '(':
            pointer += 1
        else:
            if pointer == 0:
                pls_left += 1
            else:
                pointer -= 1

    pls_right = pointer
    res = '(' * pls_left + S
    res += ')' * pls_right

    print(res)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    S = readline().rstrip()
    res = S[:]

    if '(' in S:
        idx = S.index('(')
        cnt = 1
        for s in S[idx+1:]:
            if s == '(':
                cnt += 1
            else:
                cnt -= 1
        res += ')' * max(cnt, 0)
    
    S = S[::-1]
    idx = S.index(')')
    cnt = 1
    for s in S[idx+1:]:
        if s == ')':
            cnt += 1
        else:
            cnt -= 1
    res = '(' * max(cnt, 0) + res

    print(res)

if __name__ == '__main__':
    main()
Problem p03713 (python)

Fixed submission:
import sys
readline = sys.stdin.readline
from math import floor, ceil

def main():
    H, W = map(int, readline().rstrip().split())
    ans = H * W
    if H >= 3:
        ans = min(ans, abs(W*(H//3) - W*(H-H//3*2)))
    if W >= 3:
        ans = min(ans, abs(H*(W//3) - H*(W-W//3*2)))
    
    # 縦にスライス + 残りに横にスライス
    # x1_cand = [floor(W/3), ceil(W/3)]
    x1_cand = [i for i in range(1, W)]
    y1 = H
    for x1 in x1_cand:
        x2 = W - x1
        x3 = x2
        y2 = H // 2
        y3 = H - y2
        ans = min(ans, max((x1*y1), (x2*y2), (x3*y3)) - min((x1*y1), (x2*y2), (x3*y3)))

        x2 = (W-x1) // 2
        x3 = (W-x1-x2)
        ans = min(ans, max((x1*H), (x2*H), (x3*H)) - min((x1*H), (x2*H), (x3*H)))

    # 横にスライス + 残りに縦にスライス
    # y1_cand = [floor(H/3), ceil(H/3)]
    y1_cand = [i for i in range(1, H)]
    x1 = W
    for y1 in y1_cand:
        y2 = H - y1
        y3 = y2
        x2 = W // 2
        x3 = W - x2
        ans = min(ans, max((x1*y1), (x2*y2), (x3*y3)) - min((x1*y1), (x2*y2), (x3*y3)))

        y2 = (H-y1) // 2
        y3 = (H-y1-y2)
        ans = min(ans, max((W*y1), (W*y2), (W*y3)) - min((W*y1), (W*y2), (W*y3)))

    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

def round(f, r=0):
    return Decimal(str(f)).quantize(Decimal(str(r)), rounding=ROUND_HALF_UP)

def main():
    H, W = map(int, readline().rstrip().split())
    # 横にスライスする場合
    if H >= 3:
        ans = abs(W*(H//3) - W*(H-H//3*2))
    if W >= 3:
        ans = min(ans, abs(H*(W//3) - H*(W-W//3*2)))
    
    # 縦にスライス + 残りに横にスライス
    y1 = H
    y2 = H//2
    y3 = H - H//2
    x3 = int(round((H*W) / (H+y3)))
    x1 = W - x3
    x2 = x3
    ans = min(ans, max((x1*y1), (x2*y2), (x3*y3)) - min((x1*y1), (x2*y2), (x3*y3)))

    # 横にスライス + 残りに縦にスライス
    x1 = W
    x2 = W//2
    x3 = W - W//2
    y3 = int(round((H*W) / (W+x3)))
    y1 = H - y3
    y2 = y3
    ans = min(ans, max((x1*y1), (x2*y2), (x3*y3)) - min((x1*y1), (x2*y2), (x3*y3)))

    print(ans)

if __name__ == '__main__':
    main()
Problem p02802 (python)

Fixed submission:
n, m = map(int, input().split())
sub_ls = []
for i in range(m):
    p, s = list(map(str, input().split()))
    p = int(p)-1
    sub_ls.append([p,s])
ac_cnt = []
wa_cnt = []
for i in range(n):
    ac_cnt.append(0)
    wa_cnt.append(0)
#print(ac_cnt, wa_cnt)
for i in range(m):
    if ac_cnt[sub_ls[i][0]] == 0:
        #print(sub_ls[i][1], ac_cnt[i])
        if sub_ls[i][1] == "AC":
            ac_cnt[sub_ls[i][0]] = 1
        else:
            wa_cnt[sub_ls[i][0]]+=1
ac_sum = 0
wa_sum = 0
for i in range(n):
    #print(ac_cnt[i], wa_cnt[i])
    ac_sum+=ac_cnt[i]
    if ac_cnt[i] == 1:
        wa_sum+=wa_cnt[i]
print(ac_sum, wa_sum)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
sub_ls = []
for i in range(m):
    p, s = list(map(str, input().split()))
    p = int(p)
    sub_ls.append([p,s])
ac_cnt = []
wa_cnt = []
for i in range(n):
    ac_cnt.append(0)
    wa_cnt.append(0)
#print(ac_cnt, wa_cnt)
for i in range(m):
    if ac_cnt[sub_ls[i][0]-1] == 0:
        #print(sub_ls[i][1], ac_cnt[i])
        if sub_ls[i][1] == "AC":
            ac_cnt[sub_ls[i][0]-1] = 1
        else:
            wa_cnt[i-1]+=1
ac_sum = 0
wa_sum = 0
for i in range(n):
    if ac_cnt[i] == 1:
        ac_sum+=1
    wa_sum+=wa_cnt[i]
print(ac_sum, wa_sum)
Problem p02817 (python)

Fixed submission:
s, t = map(str, input().split())
print(t+s)

Buggy submission (verdict: Runtime Error):
x = int(input())
flg = 0
_flg = 1
while flg == 0:
    mx  = int(x**0.5)
    for i in range(2, mx+1):
        if x % i == 0:
            _flg = 0
            break
    fig = _flg
    if flg == 0:
        x+=1
print(x)
Problem p02911 (python)

Fixed submission:
n, k, q = map(int, input().split())
man = [0] * n
#合計正解数はq
for i in range(q):
    man[int(input()) - 1]+=1

for i in range(n):
    if k - (q - man[i]) >= 1:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
man = [0] * n
#合計正解数はq
for i in range(k):
    man[int(input()) - 1]+=1

for i in range(n):
    if k - (q - man[i]) >= 1:
        print("Yes")
    else:
        print("No")
Problem p02963 (python)

Fixed submission:
import math
s = int(input())
root = math.ceil(s**0.5)
#print("root",root)
diff = abs(root**2 - s)
#print("diff",diff)
pf=[]
a = 0
b = 0
#print(int(diff**0.5))
if diff != 1:
  if diff == 2:
    a = 1
    b = 2
  elif diff == 3:
    a = 1
    b = 3
  else:
    test = int(diff**0.5)+1
    for i in range(2, test):
      #print("diffloop",diff)
#      if i == 1710:
#        print("1710diff",diff)
#      if i ==25322:
#        print("25322diff",diff%i)
      while diff%i==0:
        pf.append(i)
        diff//=i
#        print("i",i,"diff",diff)
    if diff>1:pf.append(diff)
    for i in range(len(pf)):
      if(i%2==0):
        if a ==0:
          a = 1
        a*=pf[i]
      else:
        if b ==0:
          b = 1
        b*=pf[i]
else:
  a = 1
  b = 1
if a != 0 and b == 0:
  b = 1
if b != 0 and a == 0:
  a = 0
if a > 10**9:
  a /= pf[0]
  b *= pf[0]
if b > 10**9:
  a *= pf[0]
  b /= pf[0]
#print("pf",pf)
if a >= 0 and b >= 0:
  print("0","0",a,root,root,b)
elif a >= 0 and b < 0:
  print("0",-b,a,root-b,root,0)
elif a < 0 and b >= 0:
  print(-a,"0","0",root,root-a,b)
else:
  print(-a,-b,"0",root-b,root-a,"0")

Buggy submission (verdict: Runtime Error):
s = int(input())
pf=[]
for i in range(2,int(s**0.5)+1):
    while s%i==0:
        pf.append(i)
        s//=i
if s>1:pf.append(i)
a = 0
b = 0
for i in range(len(pf)):
  if(i%2==0):
    a+=pf[i]
  else:
    b+=pf[i]
if a==0:
  a = 1
if b==0:
  b = 1
print("0","0",a,"0","0",b)
Problem p02630 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b, c = [0] * q, [0] * q
for i in range(q):
    b[i], c[i] = map(int, input().split())

sum = 0
kazu = [0] * (10**5+1) 
for i in a:
    kazu[i] += 1
    sum += i
for i in range(q):
    cnt = kazu[b[i]]
    kazu[b[i]] = 0
    kazu[c[i]] += cnt
    sa = c[i] - b[i]
    sum += (sa * cnt)
    print(sum)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b, c = [0] * q, [0] * q
for i in range(q):
    b[i], c[i] = map(int, input().split())

sum = 0
kazu = [0] * (10**5)
for i in a:
    kazu[i] += 1
    sum += i
for i in range(q):
    cnt = kazu[b[i]]
    kazu[b[i]] = 0
    kazu[c[i]] += cnt
    sa = c[i] - b[i]
    sum += (sa * cnt)
    print(sum)
Problem p02641 (python)

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

if not x in p:
    print(x)
    exit()
up = x + 1
down = x - 1
while True:
    if not down in p:
        print(down)
        exit()
    elif not up in p:
        print(up)
        exit()
    up += 1
    down -= 1

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

p2 = [i for i in range(1, 101)]
p3 = list(set(p2) - set(p))

minv = 1000
for i in p3:
    if abs(i-x) < minv:
        minv = abs(i-x)
        ans = i

print(ans)
Problem p02642 (python)

Fixed submission:
from collections import Counter

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

a.sort()
cnt = 0
nmax = a[-1]
table = [True] * (nmax+1)
c = Counter(a)

duplicate = []
for i in c.keys():
    if c[i] > 1:
        duplicate.append(i)
for i in a:
    if not table[i]:
        continue
    if not i in duplicate:
        cnt += 1
    for j in range(i*2, nmax+1, i):
        table[j] = False
print(cnt)

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

a.sort()
def Eratosthenes(x):
    cnt = 0
    nmax = x[-1]
    is_prime = [True] * (nmax+1)
    for i in range(1, int(n**0.5)+1):
        if not is_prime[i]:
            continue
        if i in x:
            for j in range(i*2, nmax+1, i):
                is_prime[j] = False
    for i in x:
        if x.count(i) > 1:
            continue
        if is_prime[i] == True:
            cnt += 1
    print(cnt)

Eratosthenes(a)
Problem p02681 (python)

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

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
if s==t(:-1):
  print("Yes")
else:
  print("No")
Problem p02696 (python)

Fixed submission:
a,b,n=map(int,input().split())
m=min(n,b-1)
tmp=(a*m//b)-((m//b)*a)    
print(tmp)

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
m=min(n,b)
tmp=(a*//b)-(((m-1)//b)*a)    
print(tmp)
Problem p02743 (python)

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

Buggy submission (verdict: Runtime Error):
import math
a,b,c=map(int,input().split())
ar=math.sqrt(a)
br=math.sqrt(b)
cr=math.sqrt(c)
if (a-b)/(cr*(ar-br))<1:
    print("Yes")
else:
    print("No")
Problem p02761 (python)

Fixed submission:
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]

for i in range(10**n):
  i2=str(i)
  if len(i2)==n and all([i2[s-1]==str(c) for s,c in sc]):
      print(i2)
      exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]
for i in range(10**(n-1),10**n):
    stri=str(i+1)
    c=0
    for j in range(m):
        if stri[sc[j][0]-1]==str(sc[j][1]):
            c+=1
        else:
            continue
    if j==m-1 and c==m:
        print(i+1)
        break
    elif j==m-1 and i==10**n-1:
        print(-1)
        break

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[0]*m
c=[0]*m
t=[]
for i in range(m):
    s[i], c[i]=map(int,input().split())
for i in range(n):
    t.append("0")
for i in range(m):
    t[s[i]-1]=str(c[i])
for i in reversed(range(m)):
    if t[s[i]-1]!=str(c[i]):
        print(-1)
        break
    elif ''.join(t)=="000":
        print(-1)
        break
    elif i==0 and t[0]="0":
        t[0]="1"
        print(''.join(t))
        break
    elif i==0:
        print(''.join(t))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[]*m
c=[]*m
t=[]
for i in range(m):
    s[i], c[i]=map(int,input().split())
for i in range(n):
    t.append("0")
for i in range(m):
    t[s[i]-1]=str(c[i])
for i in reversed(range(m)):
    if t[s[i]-1]!=str(c[i]):
        print(-1)
        break
    elif ''.join(t)=="000" and i!=0:
        print(-1)
        break
    elif i==0:
        print(''.join(t))
Problem p02765 (python)

Fixed submission:
n,r=map(int, input().split())
if n <10:
  print(r+100*(10-n))
else:
  print(r)

Buggy submission (verdict: Runtime Error):
n,r=int(input().split())
if n <10:
  print(r-100*(10-2))
else:
  print(r)
Problem p02801 (python)

Fixed submission:
print(chr(ord(input())+1))

Buggy submission (verdict: Runtime Error):
a=input()
b=('abcdefghijklmnopqrstuvwxyz')
for i in range(int(len(b)):
	if b[i]==a:
    	print(b[i+1])
Problem p02812 (python)

Fixed submission:
n=int(input())
s=input()
c=0
for i in range(len(s)-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                c+=1
                i+=2

print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
c=0
for i in range(len(s)):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                c+=1
                i+=2

print(c)
Problem p02818 (python)

Fixed submission:
a,b, k=map(int, input().split())
if k>=a+b:
    print("0 0")
elif k>a:
    print("0"+" "+str(b-(k-a)))
else:
    print(str(a-k)+" "+str(b))

Buggy submission (verdict: Runtime Error):
a,b, k=map(int, input().split())
for i in range(k):
    if a>=1:
        a-=1
    elif b>=1:
        b-=1

print(str(a)+" "+str(b)
Problem p02848 (python)

Fixed submission:
n = int(input())
s = input()
 
l = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
out = ""
 
for c in s:
    out += l[(l.index(c)+n)%26]
 
print(out)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()

l="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
out=""

for i in S:
    out += l[(l.index(i)+n)%26]

print(out)
Problem p02861 (python)

Fixed submission:
n=int(input())
xy=[]
for _ in range(n):
    x,y=map(int,input().split())
    xy.append([x,y])
ans=0
for i in range(n):
    for j in range(n):
        ans +=((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)**0.5
print(ans/n)

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

t=[]
for i in range(n):
    t=list(map(int, input().split(" ")))
    t.append(t)

def dis(t1, t2):
    x1, y1 = t1
    x2, y2 = t2
    return ((x1- x2)**2 + (y1-y2)**2)**0.5

total_dis = 0

for i in range(0, len(t)):
    t1=t[i]
    for j in range(0, len(t)):
        t2 = t[j]
        total_dis += dis(t1, t2)

ans = (1/n)*total_dis
print(ans)
Problem p02887 (python)

Fixed submission:
n = int(input())
d = input()

c = 0
for i in range(len(d)-1):
    if d[i] != d[i+1]:
        c += 1

print(c+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = input()

c = 0
for i in range(len(d):
    if d[i] != d[i+1]:
        c += 1

print(c+1)
Problem p02952 (python)

Fixed submission:
n=int(input())
c=0
for i in range(n):
  if len(str(i+1))%2!=0:
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
c=0
for i in range(,n):
  if len(str(i+1))%2!=0:
    c+=1
print(c)
Problem p02953 (python)

Fixed submission:
n=int(input())
h=list(map(int, input().split()))
c=0
if n!=1:
    for i in reversed(range(n-1)):
        if h[i]==h[i+1]+1:
            h[i]-=1
        elif h[i]-h[i+1]>=2:
            c=1
    if c==0:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int, input().split()))
c=0
if n!=1:
    for i in reversed(range(n-1)):
        if h[i]==h[i+1]+1:
            h[i]-=1
        elif h[i]-h[i+1]>=2:
            c=1
    if c==1:
        print("Yes")
    else:
        prin("No")
else:
    print("Yes")
Problem p02988 (python)

Fixed submission:
n=int(input())
p=list(map(int, input().split()))
c=0
for i in range(1,n-1):
    if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i-1]>p[i] and p[i]>p[i+1]):
        c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=list(map(int, input().solilt()))
c=0
for i in range(1,n-1):
    if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i-1]>p[i] and p[i]>p[i+1]):
        c+=1
print(c)
Problem p03029 (python)

Fixed submission:
a,p=map(int, input().split())
p+=a*3
print(p//2)

Buggy submission (verdict: Runtime Error):
a,p=map(int, input())
p+=a*3
print(p//2)
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
if a>=b+2:
  print(2*a-1)
elif b>=a+2:
  print(2*b-1)
else:
  print(a+b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input()/split())
if a>=b+2:
  print(2*a-1)
elif b>=a+2:
  print(2*b-1)
else:
  print(a+b)
Problem p03086 (python)

Fixed submission:
S = input()
N = len(S)
ans = 0
for i in range(N):
    for j in range(i, N):
        if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
            ans = max(ans, j - i + 1)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
ans = 0
for i in range(N):
for j in range(i, N):
if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
ans = max(ans, j - i + 1)
print(ans)
Problem p04019 (python)

Fixed submission:
t=input()
n=0
s=0
w=0
e=0
for i in range(int(len(t))):
    if t[i] =="N":
        n=1
    if t[i] =="S":
        s=1
    if t[i] =="E":
        e=1
    if t[i] =="W":
        w=1
if (w+e)%2==0 and (n+s)%2==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
t=input()
d={}
n=0
s=0
w=0
e=0
for i in range(int(len(s))):
    if t[i] =="N":
        n=1
    if t[i] =="S":
        s=1
    if t[i] =="E":
        e=1
    if t[i] =="W":
        w=1
if (w+e)%2==0 and (n+s)%2==0:
    print("Yes")
else:
    print("No")
Problem p02719 (python)

Fixed submission:
import sys

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


if(N > K):
    if(N % K == 0):
        print(0)
        sys.exit()
    else:
        tmp=N % K
        print(min(tmp,abs(K - tmp)))
        sys.exit()
else:
    tmp = abs(N - K)
    if(tmp <= N):
        print(tmp)
    else:
        print(N)

Buggy submission (verdict: Runtime Error):
import sys

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


if(N > K):
    if(N % K == 0):
        print(0)
        sys.exit()
    else:
        tmp=N % K
        print(min(tmp,abs(K - tmp)))
        sys.exit()
else:
    tmp = abs(N - K)
    if(tmp <= N):
        print(tmp)
    else:
Problem p02730 (python)

Fixed submission:
import sys
S=input()
N=len(S)
S1=list(S[0:(N-1)//2])
S2=list(S[(N+3)//2-1:])
S=list(S)
S.pop(N//2)
if(len(S1)%2==1):
    S1.pop(len(S1)//2)

if(len(S2)%2==1):
    S2.pop(len(S2)//2)

for i,s in enumerate(S):
    if(s!=S[-1-i]):
        print('No')
        sys.exit()

for i,s in enumerate(S1):
    if(s!=S1[-1-i]):
        print('No')
        sys.exit()

for i,s in enumerate(S2):
    if(s!=S2[-1-i]):
        print('No')
        sys.exit()
        
print('Yes')

Buggy submission (verdict: Runtime Error):
S=input()
N=len(S)
S1=list(S[0:(N-1)//2])
S2=list(S[(N+3)//2-1:])
if(len(S1)%2==1):
    S1.pop(len(S1)//2)

if(len(S2)%2==1):
    S2.pop(len(S2)//2)

for i,s in enumerate((S1)):
    if(s!=S1[-1-i]):
        print('No')
        sys.exit()

for i,s in enumerate((S2)):
    if(s!=S2[-1-i]):
        print('No')
        sys.exit()
        
print('Yes')
Problem p02756 (python)

Fixed submission:
from collections import deque
S=input()
Q=int(input())
ans=deque(S)
cnt=0
for _ in range(Q):
    i=(input().split())
    if(int(i[0]) == 1):
        cnt= (cnt+1) % 2
    elif((cnt== 0 and i[1]=='1') or (cnt == 1 and i[1]=='2')):
        ans.appendleft(i[2])
    else:
        ans.append(i[2])
ans=''.join(ans)
print(ans[::-1]) if(cnt % 2 == 1) else print(ans)

Buggy submission (verdict: Runtime Error):


S=input()
Q=int(input())
lis=[]
for _ in range(Q):
    lis.append(input().split())
ans=S
cnt=0
for i in lis:
    if(int(i[0]) == 1):
        cnt= (cnt+1) % 2
    elif((cnt== 0 and i[1]=='1') or (cnt == 1 and i[1]=='2')):
        ans= i[2] + ans
    else:
        ans+=i[2]

print(ans[::-1]) if(cnt % 2 == 1) else print(ans)
print(time.time() - t)
Problem p02854 (python)

Fixed submission:
from itertools import accumulate
def myAnswer(N:int,A:list) -> int:
   accum = list(accumulate(A))
   ans = 10**10
   now = accum.pop()
   for a in accum:
      if(abs(now - a - a) < ans):
         ans = abs(now - 2*a)
   return ans

   

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   A = list(map(int,input().split()))
   print(myAnswer(N,A[:]))
if __name__ == '__main__':
   main()

Buggy submission (verdict: Runtime Error):
rom itertools import accumulate
def myAnswer(N:int,A:list) -> int:
   accum = list(accumulate(A))
   ans = 10**10
   now = accum.pop()
   for a in accum:
      if(abs(now - a - a) < ans):
         ans = abs(now - 2*a)
   return ans

   

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   A = list(map(int,input().split()))
   print(myAnswer(N,A[:]))
if __name__ == '__main__':
   main()
Problem p02899 (python)

Fixed submission:

def myAnswer(N:int,A:list) -> int:
   dic ={}
   for i in range(1,N+1):
      dic[i]=A[i - 1]
   ans = sorted(dic.items(), key=lambda x:x[1])
   for a in ans:
      print(a[0],end=" ")
   print()
def modelAnswer():
   tmp=1
def main():
   N = int(input())
   A = list(map(int,input().split()))

   myAnswer(N,A[:])

if __name__ == '__main__':
   main()

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
for a in A:
  if(a >= K):ans+=1
print(ans)
Problem p02909 (python)

Fixed submission:
S=input()

weather={"Sunny":"Cloudy","Rainy":"Sunny","Cloudy":"Rainy"}

print(weather[S])

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

weather={"Sunny":"Cloudy","Rainy":"Sunny","Cloudy":"Rainy"}

print(wather[S])