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

Fixed submission:
N = int(input())
BA = [[0] * 2 for i in range(N)]
for i in range(N):
    A, B = map(int, input().split())
    BA[i][0] = B
    BA[i][1] = A

BA.sort()
t = 0
ans = 'Yes'
#print(BA)
for ba in BA:
    B = ba[0]
    A = ba[1]
    t += A
    if t > B:
        ans = 'No'
        break

print(ans)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

Cprimes = {}
Dprimes = {}

tmpC = C
d = 2
while tmpC > 1:
    if tmpC % d == 0:
        if d in Cprimes:
            Cprimes[d] += 1
        else:
            Cprimes[d] = 1
        tmpC //= d
    else:
        d += 1

tmpD = D
d = 2
while tmpD > 1:
    if tmpD % d == 0:
        if d in Dprimes:
            Dprimes[d] += 1
        else:
            Dprimes[d] = 1
        tmpD //= d
    else:
        d += 1

comPrimes = {}
for k in Cprimes:
    comPrimes[k] = Cprimes[k]
for k in Dprimes:
    if k in comPrimes:
        if comPrimes[k] < Dprimes[k]:
            comPrimes[k] = Dprimes[k]
    else:
        comPrimes[k] = Dprimes[k]

comVal = 1
for k in comPrimes:
    comVal *= k**comPrimes[k]

#print(Cprimes)
#print(Dprimes)
#print(comPrimes)
#print(comVal)

CdivNum = B//C - (A-1)//C
DdivNum = B//D - (A-1)//D
comDivNum = B//comVal - (A-1)//comVal
ans = B-(A-1)
ans -= CdivNum
ans -= DdivNum
ans += comDivNum

print(ans)
Problem p03035 (python)

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

ans = 0
if A <= 5:
    ans = 0
elif A >= 13:
    ans = B
else:
    ans = B//2

print(ans)

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

DIV = 10**9+7

def comb(l, r):
    if l == 0:
        return 1
    val = 1
    for i in range(r, r-l, -1):
        val *= i
    for i in range(l, 0, -1):
        val //= i
    return val


#p = comb(K-2, N*M-2)
#print(K-2, N*M-2, p)
ans = 0
for i in range(N):
    for j in range(M):
        if i == 0 and j == 0:
            continue
        d = i+j
        #print(i, j, calc_rec_num(N, M, 0, 0, i, j))
        cnt = (N-i) * (M-j)
        if i != 0 and j != 0:
            cnt *= 2
        ans += d * cnt
        #if ans > DIV:
        #    ans %= DIV
        #print(ans)

print((ans*p)%DIV)
Problem p03048 (python)

Fixed submission:
R, G, B, N = map(int, input().split())

ans = 0
rsum = 0
for r in range(0, N+1):
    if N < rsum:
        break
    rgsum = rsum
    for g in range(0, N+1):
        if N < rgsum:
            break
        left = N - rgsum
        if left % B == 0:
            ans += 1
        rgsum += G
    rsum += R

print(ans)

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

ans = 0
rsum = 0
for r in range(0, N+1):
    rsum += R
    if N < rsum:
        break
    rgsum = rsum
    for g in range(0, N+1):
        rgsum += G
        if N < grsum:
            break
        left = N - rgsum
        if left % B == 0:
            ans += 1

print(ans)
Problem p03240 (python)

Fixed submission:
N = int(input())
x = []
y = []
h = []
for i in range(N):
    (tmp_x, tmp_y, tmp_h) = map(int, input().split())
    x.append(tmp_x)
    y.append(tmp_y)
    h.append(tmp_h)

def CalcHigh(cx, cy, px, py, ph):
    ch = ph + abs(cx-px) + abs(cy-py)
    return ch

for i in range(101):
    for j in range(101):
        ch = 0
        for k in range(N):
            if h[k] > 0:
                ch = CalcHigh(i, j, x[k], y[k], h[k])

        flag = True
        for k in range(N):
            if ch > 0:
                if h[k] == 0:
                    if CalcHigh(i, j, x[k], y[k], h[k]) < ch:
                        flag = False
                        break
                else:
                    if CalcHigh(i, j, x[k], y[k], h[k]) != ch:
                        flag = False
                        break

        if flag == True:
            ans = (i, j, ch)
            break

print(ans[0], ans[1], ans[2])

Buggy submission (verdict: Runtime Error):
N = int(input())
x = []
y = []
h = []
for i in range(N):
    (tmp_x, tmp_y, tmp_h) = map(int, input().split())
    x.append(tmp_x)
    y.append(tmp_y)
    h.append(tmp_h)

def CalcHigh(cx, cy, px, py, ph):
    ch = ph + abs(cx-px) + abs(cy-py)
    return ch

for i in range(101):
    for j in range(101):
        ch = CalcHigh(i, j, x[0], y[0], h[0])
        flag = True
        for k in range(N):
            if CalcHigh(i, j, x[k], y[k], h[k]) != ch:
                flag = False
                break
        if flag == True:
            ans = (i, j, ch)
            break
    else:
        continue
    break

print(ans[0], ans[1], ans[2])
Problem p03241 (python)

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

MAX_SQRT = int(math.sqrt(M))
prime_flag = [True] * (MAX_SQRT+1)
prime_dic = {}

prime_flag[0] = False
prime_flag[1] = False

for i in range(2, MAX_SQRT+1):
    mul = 2
    while True:
        p = i * mul
        if p > MAX_SQRT:
            break
        prime_flag[p] = False
        mul += 1

TMPM = M
for i in range(2, MAX_SQRT+1):
    if prime_flag[i]:
        while TMPM%i == 0:
            if i in prime_dic:
                prime_dic[i] += 1
            else:
                prime_dic[i] = 1
            TMPM = int(TMPM/i)

if TMPM > 1 or len(prime_dic) == 0:
    prime_dic[TMPM] = 1

max_mul = 1
def Rec(mul, p):
    global max_mul
    if M//mul < N:
        return

    if p >= len(prime_dic):
        if mul > max_mul:
            max_mul = mul
        return

    k = list(prime_dic.keys())[p]
    v = list(prime_dic.values())[p]
    for i in range(v+1):
        Rec(mul*(k**i), p+1)

Rec(1, 0)
print(max_mul)

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

MAX_SQRT = int(math.sqrt(M))
for i in range(MAX_SQRT, 0, -1):
    if M%i == 0 and M%(i*N) == 0:
        ans = i
        break

print(ans)
Problem p03260 (python)

Fixed submission:
(A, B) = map(int, input().split())
ans = "No"
for i in range(1, 3):
    if((A*B*i)%2 == 1):
        ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
(H, W) = map(int, input().split())
a = []
for i in range(H):
    a.append(list(map(int, input().split())))
#print("a: ")
#print(a)

odd_flag = []
for i in range(len(a)):
    odd_flag.append(list())
    for j in range(len(a[i])):
        if a[i][j]%2 != 0:
            odd_flag[i].append(True)
        else:
            odd_flag[i].append(False)
#print("odd_flag: ")
#print(odd_flag)

odd_sum = 0
for i in range(len(odd_flag)):
    odd_sum += odd_flag[i].count(True)
#print(odd_sum)

s_h = 0
s_w = 0
move_flag = False

def move(h, w):
    if h%2 == 0:
        if w == W-1:
            return (h+1, w)
        else:
            return (h, w+1)
    else:
        if w == 0:
            return (h+1, w)
        else:
            return (h, w-1)

N = 0
ans = ""
while odd_sum >= 2:
    # 移動先到着
    if move_flag is True and odd_flag[s_h][s_w] is True:
        move_flag = False
        (s_h, s_w) = move(s_h, s_w)
        odd_sum -= 2
        N += 1
    # 移動中
    elif move_flag is True and odd_flag[s_h][s_w] is False:
        ans += str(s_h+1) + " " + str(s_w+1) + " "
        (s_h, s_w) = move(s_h, s_w)
        ans += str(s_h+1) + " " + str(s_w+1) + "\n"
    # 移動すべきものなし
    elif move_flag is False and odd_flag[s_h][s_w] is False:
        (s_h, s_w) = move(s_h, s_w)
    # 移動元到着
    elif move_flag is False and odd_flag[s_h][s_w] is True:
        move_flag = True
        ans += str(s_h+1) + " " + str(s_w+1) + " "
        (s_h, s_w) = move(s_h, s_w)
        ans += str(s_h+1) + " " + str(s_w+1) + "\n"

print(N)
#print(ans[0:-1])
Problem p02909 (python)

Fixed submission:
s = input()
if s[0] == "S": print("Cloudy")
elif s[0] == "C": print("Rainy")
else: print("Sunny")

Buggy submission (verdict: Runtime Error):
s = input()
if s[0] = "S": print("Cloudy")
if s[0] = "C": print("Rainy")
else: print("Sunny")
Problem p02957 (python)

Fixed submission:
a, b = map(int, input().split())
print(max(a, b) - abs(a - b) // 2 if not (a + b) % 2 else "IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(max(a, b) - abs(a, b) // 2 if not (a + b) % 2 else "IMPOSSIBLE")
Problem p03238 (python)

Fixed submission:
N = int(input())

if N == 1: print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)

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

mc = float("inf")
ans = "TLE"

for i in range(N):
    c, t = map(int, input().split())
    if t <= T and c < mc:
        mc = c
        ans = str(c)

print(ans)

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

mc = float("inf")
ans = "TLE"

for i in range(N):
    c, t = map(int, input().split())
    if t <= T and c < mc:
        mc = c
        ans = str(c)

print(ans)
Problem p02743 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a**0.5+b**0.5<c**0.5
  print('Yes')
else:
  print('No')
Problem p02768 (python)

Fixed submission:
n,a,b=map(int,input().split())
mod=10**9+7
ors=[n]
rev=[1]

def ie(n,r,mod):
  if r==1:
    return n
  elif r%2==0:
    return (ie(n,r//2,mod)**2)%mod
  else:
    return n*((ie(n,(r-1)//2,mod))**2)%mod
    
  
for i in range(1,b):
  ors.append(ors[-1]*(n-i)%mod)
  rev.append(rev[-1]*(i+1)%mod)  
N=ie(2,n,mod)
A=ors[a-1]*ie(rev[a-1],mod-2,mod)
B=ors[b-1]*ie(rev[b-1],mod-2,mod)
print((N-A-B-1)%mod)

Buggy submission (verdict: Runtime Error):
mod=10**9+7
ors=[n]
rev=[1]

def ie(n,r,mod):
  if r==1:
    return n
  elif r%2==0:
    return (ie(n,r//2,mod)**2)%mod
  else:
    return n*((ie(n,(r-1)//2,mod))**2)%mod
  
for i in range(1,b):
  ors.append(ors[-1]*(n-i)%mod)
  rev.append(rev[-1]*(i+1)%mod)  
N=ie(2,n,mod)
A=ors[a-1]*ie(rev[a-1],mod-2,mod)
B=ors[b-1]*ie(rev[b-1],mod-2,mod)
print((N-A-B-1)%mod)
Problem p02789 (python)

Fixed submission:
m,n=map(int,input().split())
if m==n:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
def ac(m,n):
  if m==n:
    return 'YES'
  else:
    return 'NO'
  
m,n=map(int,imput().split())
ac(m,n)
Problem p02795 (python)

Fixed submission:
import math
a=int(input())
b=int(input())
x=int(input())
print(math.ceil(x/max(a,b)))

Buggy submission (verdict: Runtime Error):
import math
a=int(input())
b=int(input())
x=int(input())
print(math.ceil(x/(max(a,b)))
Problem p02811 (python)

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

Buggy submission (verdict: Runtime Error):
x,k=map(int,input().split())
if x*500>=k:
  print(Yes)
else:
  print(No)
Problem p02910 (python)

Fixed submission:
ugrd={'L'}
grd={'R'}
s=str(input())
for i in range(len(s)):
  if i%2==0:
    if s[i] in ugrd:
      print('No')
      break
  if i%2==1:
    if s[i] in grd:
      print('No')
      break
  if i==len(s)-1:
    print('Yes')

Buggy submission (verdict: Runtime Error):
ugrd={'L'}
grd={'R'}
s=string(input())
for i in range(len(s)):
  if i%2==0:
    if s[i] in ugrd:
      print('No')
      break
  if i%2==1:
    if s[i] in grd:
      print('No')
      break
  elif i==len(s)-1:
    print('Yes')
Problem p02911 (python)

Fixed submission:
n,k,q=map(int,input().split())
l=[]
for i in range(n):
  v=[i,0]
  l.append(v)
for j in range(q):
  p=int(input())
  l[p-1][1]+=1
for m in range(n):
  if l[m][1]>q-k:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
l=[]
for i in range(n):
  v=[i,0]
  l.append(v)
for j in range(q):
  p=int(input())
  l[p-1][1]+=1
for l in range(n):
  if l[l][1]>q-k:
    print('Yes')
  else:
    print('No')
Problem p02917 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
vec=[]
vec.append(v[0])
for i in range(0,n-2):
  vec.append(min(v[i],v[i+1]))
vec.append(v[n-2])
sum=0
for i in range(n):
  sum+=vec[i]
print(sum)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
vec=[]
vec.append(v[0])
for i in range(0,n-1):
  vec.append(min(v[i],v[i+1]))
vec.append(v[n-1])
sum=0
for i in range(n+1):
  sum+=vec[i]
print(sum)
Problem p02994 (python)

Fixed submission:
n,k=map(int,input().split())
sum=k
tmp=k
for i in range(1,n):
  sum+=k+i
  if abs(tmp)>abs(k+i):
    tmp=k+i
print(sum-tmp)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
sum=k
tmp=k
for i in range(1,n):
  sum+=k+i
  if abs(tmp)>abs(k+i):
    tmp=k+i
print(sumtmp)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
sum=k
tmp=abs(k,0)
for i in range(1,n):
  sum+=k+i
  if tmp>abs(k+i,0):
    tmp=abs(k+i,0)
print(sum-tmp)
Problem p03000 (python)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]
for i in range(n):
  d.append(d[-1]+l[i])
  if d[-1]>x:
    print(len(d)-1)
    break
  if i==n-1:
    print(n+1)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]
for i in range(n):
  d.append(d[-1]+l[i])
  if d[-1]>x:
    print(len(d)-1)
     break
  if i==n-1:
    print(n+1)
Problem p03029 (python)

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

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

Fixed submission:
n,m=map(int,input().split())
ltmp=1
rtmp=n
for i in range(m):
  l,r=map(int,input().split())
  ltmp=max(l,ltmp)
  rtmp=min(r,rtmp)
if ltmp>rtmp:
  print(0)
else:
  print(rtmp-ltmp+1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ltmp=1,rtmp=n
for i in range(m):
  l,r=map(int,input().split())
  ltmp=max(l,ltmp)
  rtmp=min(r,rtmp)
if ltmp>rtmp:
  print(0)
else:
  print(rtmp-ltmp+1)
Problem p03085 (python)

Fixed submission:
s=str(input())
l=[]
for i in range(len(s)):
  if s[i]=='A':
    l.append('T')
  if s[i]=='T':
    l.append('A')
  if s[i]=='G':
    l.append('C')
  if s[i]=='C':
    l.append('G')
print(''.join(l))

Buggy submission (verdict: Runtime Error):
s=str(input())
l=[]
for i in range(len(s)):
  if s[i]=='A':
    l.append('T')
  if s[i]=='T':
    l.append('A')
  if s[i]=='G':
    l.append('C')
  if l[i]=='C':
    l.append('G')
print(''.join(l))

Buggy submission (verdict: Runtime Error):
b=str(input())
l=[]
for i in range(len(s)):
  if s[i]=='A':
    l.append('T')
  if s[i]=='T':
    l.append('A')
  if s[i]=='G':
    l.append('C')
  if l[i]=='C':
    l.append('G')
print(''.join(l))
Problem p03251 (python)

Fixed submission:
n,m,x,y=map(int,input().split())
tmpx=x
tmpy=y
li_x=list(map(int,input().split()))
li_y=list(map(int,input().split()))
for i in range(n):
  tmpx=max(tmpx,li_x[i])
for j in range(m):
  tmpy=min(tmpy,li_y[j])
if tmpx+1<=tmpy:
  print('No War')
else:
  print('War')

Buggy submission (verdict: Runtime Error):
n,m,x,y=map(int(input().split()))
tmpx=x
tmpy=y
for i in range(n):
  x_i=int(input())
  tmpx=max(tmpx,x_i)
for j in range(m):
  y_i=int(input())
  tmpy=min(tmpy,y_i)
if tmpx+1<=tmpy:
  print('No War')
else:
  print('War')
Problem p03325 (python)

Fixed submission:
def count(n):
  p=0
  while n%2==0:
    p+=1
    n=n//2
  return(p)

n=int(input())
l=list(map(int,input().split()))
sum=0
for i in range(n):
  sum+=count(l[i])
print(sum)

Buggy submission (verdict: Runtime Error):
def count(n):
  p=0
  while n%2==0:
    p+=1
  return(p)

n=int(input())
l=list(map(int,input().split()))
count=0
for i in range(n):
  count+=count(l[i])
print(count)
Problem p03328 (python)

Fixed submission:
a,b=map(int,input().split())
s=0
for i in range(b-a-1):
  s+=1+i
print(s-a)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
s=0
for i in range(b-a-1):
  s+=1+i
print(s-a)
Problem p03435 (python)

Fixed submission:
l=[]
l.append(list(map(int,input().split())))
l.append(list(map(int,input().split())))
l.append(list(map(int,input().split())))
for i in range(2):
  if l[i][1]-l[i][0]!=l[i+1][1]-l[i+1][0] or l[i][2]-l[i][1]!=l[i+1][2]-l[i+1][1]:
    print('No')
    break
  if i==1:
    print('Yes')

Buggy submission (verdict: Runtime Error):
l=[]
list(map(int,input().split())).append(l)
list(map(int,input().split())).append(l)
list(map(int,input().split())).append(l)
for i in range(2):
  if l[i][1]-l[i][0]!=l[i+1][1]-l[i+1][0] and l[i][2]-l[i][1]!=l[i+1][2]-l[i+1][1]:
    print('No')
    break
  if i==1:
    print('Yes')
Problem p03469 (python)

Fixed submission:
s=list(str(input()))
s[3]='8'
print(''.join(s))

Buggy submission (verdict: Runtime Error):
s=str(input())
s[3]='8'
print(s)
Problem p03470 (python)

Fixed submission:
n=int(input())
l=[int(input()) for _ in range(n)]
print(len(set(l)))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[int(input()) for i in range(n)]
print(len(set(l))
Problem p03607 (python)

Fixed submission:
n=int(input())
s=set([])
for i in range(n):
  x=int(input())
  if not x in s:
    s.add(x)
  else:
    s.remove(x)
print(len(s))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(n):
  x=int(input())
  if x in set(l):
    l.append(x)
  if not x in set(l):
    l.remove(x)
print(len(l))
Problem p03636 (python)

Fixed submission:
s=str(input())
l=len(s)
li=str(l-2)
list=[s[0],li,s[l-1]]
print(''.join(list))

Buggy submission (verdict: Runtime Error):
s=str(input())
l=str(len(s))
list=[s[0],l,s[l-1]]
print(''.join(list))

Buggy submission (verdict: Runtime Error):
x=str(input())
l=str(len(s))
list=[s[0],l,s[l-1]]
print(''.join(list))

Buggy submission (verdict: Runtime Error):
x=str(input())
l=len(s)
list=[s[0],l,s[l-1]]
print(''.join(list))
Problem p03854 (python)

Fixed submission:
s=list(str(input()))
b=0
while len(s)>=7:
  if s[-1]=='r':
    sd=[s[-7],s[-6],s[-5],s[-4],s[-3],s[-2],s[-1]]
    se=[s[-6],s[-5],s[-4],s[-3],s[-2],s[-1]]
    if ''.join(sd)=='dreamer':
      del s[-7:]
    elif ''.join(se)=='eraser':
      del s[-6:]
    else:
      print('NO')
      b+=1
      break
  elif s[-1]=='m':
    sd=[s[-5],s[-4],s[-3],s[-2],s[-1]]
    if ''.join(sd)=='dream':
      del s[-5:]
    else:
      print('NO')
      b+=1
      break
  elif s[-1]=='e':
    sd=[s[-5],s[-4],s[-3],s[-2],s[-1]]
    if ''.join(sd)=='erase':
      del s[-5:]
    else:
      print('NO')
      b+=1
      break  
  else:
    print('NO')
    b+=1
    break
if len(s)==0 or (len(s)==6 and ''.join(s)=='eraser') or (len(s)==5 and ''.join(s)=='dream') or (len(s)==5 and ''.join(s)=='erase'):
  print('YES') 
elif b!=1:
  print('NO')

Buggy submission (verdict: Runtime Error):
s=list(str(input()))
b=0
while len(s)>=5:
  if s[-1]=='r':
    sd=[s[-7],s[-6],s[-5],s[-4],s[-3],s[-2],s[-1]]
    se=[s[-6],s[-5],s[-4],s[-3],s[-2],s[-1]]
    if ''.join(sd)=='dreamer':
      del s[-7:]
    elif ''.join(se)=='eraser':
      del s[-6:]
    else:
      print('NO')
      b+=1
      break
  elif s[-1]=='m':
    sd=[s[-5],s[-4],s[-3],s[-2],s[-1]]
    if ''.join(sd)=='dream':
      del s[-5:]
    else:
      print('NO')
      b+=1
      break
  elif s[-1]=='e':
    sd=[s[-5],s[-4],s[-3],s[-2],s[-1]]
    if ''.join(sd)=='erase':
      del s[-5:]
    else:
      print('NO')
      b+=1
      break  
  else:
    print('NO')
    b+=1
    break
if len(s)==0:
  print('YES')
elif b!=1:
  print('NO')
Problem p02730 (python)

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

S = str(input())
N = len(S)-1

N1 = int((N-1)/2)
N2 = int((N+3)/2)

s1 = S[:N]
s2 = S[:N1]
s3 = S[N2-1:N]

flag = True
for ss in [s1, s2, s3]:
    ss_l = len(ss)
    for i in range(ss_l):
        if ss[i] != ss[ss_l-i-1]:
            flag = False
            break
    if not flag:
        break

if flag:
    print('Yes')
else:
    print('No')

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

S = str(input())
N = len(S)-1

N1 = (N-1)/2
N2 = (N+3)/2

s1 = S[:N]
s2 = S[:N1]
s3 = S[N2-1:N]

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

S = str(input())
N = len(S)-1

N1 = (N-1)/2
N2 = (N+3)/2

s1 = S[:N]
s2 = S[:N1]
s3 = S[N2-1:N]

flag = True
for ss in [s1, s2, s3]:
    ss_l = len(ss)
    for i in range(ss_l):
        if ss[i] != ss[ss_l-i-1]:
            flag = False
            break
    if not flag:
        break

if flag:
    print('Yes')
else:
    print('No')

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

S = str(input())
N = len(S)-1


N1 = (N-1)/2
N2 = (N+3)/2

s1 = S[:N]
s2 = S[:N1]
s3 = S[N2-1:N]

flag = True
for ss in [s1, s2, s3]:
    ss_l = len(ss)
    for i in range(ss_l):
        if ss[i] != ss[ss_l-i-1]:
            flag = False
            break
    if not flag:
        break

if flag:
    print('Yes')
else:
    print('No')
Problem p02713 (python)

Fixed submission:
from math import gcd 

mysum = 0
K = int(input())
for i in range(1,K+1):
	for j in range(1,K+1):
		for k in range(1,K+1):
			mysum += gcd(gcd(i,j),k)

print(mysum)

Buggy submission (verdict: Runtime Error):
import math 

mysum = 0
K = int(input())
for i in range(1,K+1):
	for j in range(1,K+1):
		for k in range(1,K+1):
			mysum += math.gcd(math.gcd(x,y),z)

print(mysum)
Problem p03079 (python)

Fixed submission:
A, B, C = map(lambda x: int(x), input().split(" "))
if A is B and B is C:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = map(lambda x: int(x), input().split(" "))
if A=B and B=C:
  print("Yes")
else:
  print("No")
Problem p03087 (python)

Fixed submission:
N, Q = [int(nq) for nq in input().split(" ")]
S = input()
t = [0] * (N)
for i in range(1, N):
  t[i] = t[i-1] + (1 if (S[i-1] == "A" and S[i] == "C") else 0)
for _ in " " * Q:
  l, r = [int(lr) for lr in input().split(" ")]
  print(t[r-1]-t[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = [int(nq) for nq in input().split(" ")]
S = input()
for i in range(Q):
    li, ri = [int(lr) for lr in input().split(" ")]
    print(s[li-1:ri].count("AC"))

Buggy submission (verdict: Runtime Error):
N, Q = [int(nq) for nq in input().split(" ")]
S = input()
s = S.replace("AC", "NM")
for i in range(Q):
    li, ri = [int(lr) for lr in input().split(" ")]
    print(li, ri, S[li-1:ri])
    print(s[li-1:ri].count("NM"))

Buggy submission (verdict: Runtime Error):
N, Q = input().split(" ")
N, Q = int(N), int(Q)
S = input()
s = S.replace("AC", "__")
counts = range(Q)
for i in range(Q):
    li, ri = [int(lr) for lr in input().split(" ")]
    print(s[li, ri].count("__"))

Buggy submission (verdict: Runtime Error):
N, Q = input().split(" ")
N, Q = int(N), int(Q)
S = input()
s = S.replace("AC", "__")
counts = range(Q)
for i in range(Q):
    li, ri = [int(lr) for lr in input().split(" ")]
    counts[i] = s[li-1, ri].count("__")

print(max(counts))

Buggy submission (verdict: Runtime Error):
N, Q = input().split(" ")
N, Q = int(N), int(Q)
S = input()
s = S.replace("AC", "__")
counts = []
for i in range(Q):
    li, ri = [int(lr) for lr in input().split(" ")]
    counts[i] = s[li-1, ri].count("__")

print(max(counts))
Problem p03101 (python)

Fixed submission:
H, W = map(int, raw_input().split())
h, w = map(int, raw_input().split())

sum = (H - h) * (W - w)
print sum

Buggy submission (verdict: Runtime Error):
H, W = map(int, raw_input().split())
h, w = map(int, raw_input().split())

sum = (H - h) * (W - w)
print sum
H, W = map(int, raw_input().split())
h, w = map(int, raw_input().split())

sum = (H - h) * (W - w)
print sum
Problem p03351 (python)

Fixed submission:
a, b, c, d = map(int,raw_input().split())
if abs(c-a) <= d or abs(a-b) <= d and abs(b-c) <= d:
    print "Yes"
else:
    print "No"

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
d = input()
if b - a < d and c - b < d:
    print "Yes"
else:
    print "No"
Problem p03597 (python)

Fixed submission:
N = input()
A = input()
print N * N - A

Buggy submission (verdict: Runtime Error):
N, A = map(int, raw_input() .split())
print N * N - A
Problem p03777 (python)

Fixed submission:
a, b = map(str, raw_input() .split())
if a == 'H' and b == 'H':
    print "H"
elif a == 'H' and b == 'D':
    print "D"
elif a == "D" and b == "H":
    print "D"
else:
    print "H"

Buggy submission (verdict: Runtime Error):
a, b = map(int, raw_input() .split())
x = 0
y = 0
if a == 'H':
    x += 1
elif b == 'H':
    y += 1

if x == 1 and y == 1:
    print "H"
if x == 0 and y == 0:
    print "H"
if x == 1 and y == 0:
    print "D"
if x == 0 and y == 1:
    print "D"