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

Fixed submission:
n,m=map(int,input().split())
if abs(n-m)>1: print(0)
else:
    mod=10**9+7
    def fact(n):
        ans=1
        for i in range(n):
            ans*=(i+1)
            ans%=mod
        return ans

    ans=(fact(n)*fact(m))%mod
    if n==m: print((2*ans)%mod)
    else: print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
if abs(n-m)>1: print(0)
else:
    mod=10**9+7
    fac=[0]*(n+1)
    fac[0]=1
    fac[1]=1
    def fact(k):
        if fac[k]>0: return fac[k]
        fac[k]=k*fact(k-1)%mod
        return fac[k]
    
    ans=(fact(n)*fact(m))%mod
    if n==m: print((2*ans)%mod)
    else: print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
if abs(n-m)>1: print(0)
else:
    mod=10**9+7
    fac=[0]*n
    fac[0]=1
    fac[1]=1
    def fact(n):
        if fac[n]>0: return fac[n]
        fac[n]=n*fact(n-1)%mod
        return fac[n]
    
    ans=(fac(n)*fac(m))%mod
    if n==m: print((2*ans)%mod)
    else: print(ans)
Problem p03945 (python)

Fixed submission:
s=input()
now,ans=0,0
while now<len(s)-1:
    if s[now]!=s[now+1]:
        ans+=1
    now+=1
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
now,ans=0,0
while now<n-1:
    if s[now]!=s[now+1]:
        ans+=1
    now+=1
print(ans)
Problem p04030 (python)

Fixed submission:
s=input()
ans=""
for b in s:
    if b=="1":
        ans+="1"
    elif b=="0":
        ans+="0"
    else:
        if len(ans)!=0:
            ans = ans[:-1]
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans=""
for b in s:
    if b=="1":
        ans+="1"
    elif b=="0":
        ans+="0"
    else:
        if len(ans)!=0:
            ans[-1]=""
print(ans)
Problem p02573 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)

N, M = map(int, input().split())
f = [set() for _ in range(N)]
v = [False for _ in range(N)]
ans = 1

for _ in range(M):
  a, b = map(int, input().split())
  a, b = a - 1, b - 1
  f[a].add(b)
  f[b].add(a)
  
  
def dfs(fi):
  if v[fi]: return 0
  
  v[fi] = True
  cnt = 1
  
  for fr in f[fi]:
    cnt += dfs(fr)
    
  return cnt

for i in range(N):
  cnt = dfs(i)
  ans = max(ans, cnt)
  
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
f = [set() for _ in range(N)]
v = [False for _ in range(N)]
ans = 1

for _ in range(M):
  a, b = map(int, input().split())
  a, b = a - 1, b - 1
  f[a].add(b)
  f[b].add(a)
  
  
def dfs(fi):
  if v[fi]: return 0
  
  v[fi] = True
  cnt = 1
  
  for fr in f[fi]:
    cnt += dfs(fr)
    
  return cnt

for i in range(N):
  cnt = dfs(i)
  ans = max(ans, cnt)
  
print(ans)
Problem p02947 (python)

Fixed submission:
n = int(input())
b = {}
ans = 0
for _ in range(n):
  x = list(input())
  x.sort()
  x = "".join(x)
  if not x in b:
    b[x] = 0
  else:
    b[x] += 1
    ans += b[x]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input for _ in range(n)]
c = [i in range(1, n)]
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0 for _ in range(n + 1)]
ans = 0
for i in range(1, n + 1):
  d[i] = d[i - 1] + l[i - 1]
for j in range(n + 1):
  if d[j] <= x:
    ans += 1
print(ans)

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

Fixed submission:
w, h, x, y = map(int, input().split())
s = 0
if w / 2 == x and h / 2 == y:
  s = 1
print('{:.6f}'.format(w * h / 2), s)

Buggy submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())
s = 0
if w / x ==  h / y == 2:
  s = 1
print('{:.6f}'.format(w * h / 2), s)
Problem p02677 (python)

Fixed submission:
import math
A, B, H, M = map(int, input().split())


if H == 0:
    H = 12
elif M == 0:
    M = 60
L = M / 5



N = min(abs(L - H), abs(H - L))

if L >= H:
    if M == 60:
        M = 0
    S = 360 * N / 12 - (0.5 * M)
else:
    S = 360 * N / 12 + (0.5 * M)


ANS = A**2 + B**2 - (2*A*B*math.cos(math.radians(S)))
ANS = math.sqrt(ANS)
print(ANS)

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


if H == 0:
    H = 12
elif M == 0:
    M = 60
L = M / 5



N = min(abs(L - H), abs(H - L))

if L >= H:
    if M == 60:
        M = 0
        S = 360 * N / 12 - (0.5 * M)
else:
    S = 360 * N / 12 + (0.5 * M)


ANS = A**2 + B**2 - (2*A*B*math.cos(math.radians(S)))
ANS = math.sqrt(ANS)
print(ANS)

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


if H == 0:
    H = 12
elif M == 0:
    M = 60
L = M / 5



N = min(abs(L - H), abs(H - L))

if L >= H:
    if M == 60:
        M = 0
        S = 360 * N / 12 - (0.5 * M)
else:
    S = 360 * N / 12 + (0.5 * M)


ANS = A**2 + B**2 - (2*A*B*math.cos(math.radians(S)))
ANS = math.sqrt(ANS)
print(ANS)
Problem p02536 (python)

Fixed submission:
class UnionFind:
    __slots__ = ["_data_size", "_roots"]
 
    def __init__(self, data_size: int) -> None:
        self._data_size = data_size
        self._roots = [-1] * data_size
 
    def __getitem__(self, x: int) -> int:
        while self._roots[x] >= 0:
            x = self._roots[x]
        return x
 
    def is_connected(self, x: int, y: int) -> bool:
        return self[x] == self[y]
 
    def unite(self, x: int, y: int) -> None:
        x, y = self[x], self[y]
        if x == y:
            return
        if self._roots[x] > self._roots[y]:
            x, y = y, x
        self._roots[x] += self._roots[y]
        self._roots[y] = x
 
 
import sys
 
readline = sys.stdin.readline
 
N, Q = map(int, readline().split())
tree = UnionFind(N)
res = []
ans=0
for _ in range(Q):
  u, v = map(int, readline().split())
  tree.unite(u-1, v-1)
for u in range(1,N):
  if not tree.is_connected(u, 0):
      ans+=1
      tree.unite(u, 0)
print(ans)

Buggy submission (verdict: Runtime Error):
class UnionFind:
    __slots__ = ["_data_size", "_roots"]
 
    def __init__(self, data_size: int) -> None:
        self._data_size = data_size
        self._roots = [-1] * data_size
 
    def __getitem__(self, x: int) -> int:
        while self._roots[x] >= 0:
            x = self._roots[x]
        return x
 
    def is_connected(self, x: int, y: int) -> bool:
        return self[x] == self[y]
 
    def unite(self, x: int, y: int) -> None:
        x, y = self[x], self[y]
        if x == y:
            return
        if self._roots[x] > self._roots[y]:
            x, y = y, x
        self._roots[x] += self._roots[y]
        self._roots[y] = x
 
 
import sys
 
readline = sys.stdin.readline
 
N, Q = map(int, readline().split())
tree = UnionFind(N)
res = []
ans=0
for _ in range(Q):
  u, v = map(int, readline().split())
  if not tree.unite(u, v):
    res.append(int(tree.is_connected(u, v)))
    ans+=1
print(ans)
Problem p02760 (python)

Fixed submission:
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for k in range(N)]
hole = [[0,0,0] for i in range(3)]
ans = "No"

for i in range(3):
  for j in range(3):
    for k in range(N):
      if A[i][j] == b[k]:
        hole[i][j] = 1
  flag_hol = 1
  for j in range(3):
    flag_hol *= hole[i][j]
  if flag_hol == 1:
  	ans = "Yes"

flag_diag1 = 1
flag_diag2 = 1
for j in range(3):
  flag_vert = 1
  for i in range(3):
    flag_vert *= hole[i][j]
  if flag_vert ==1:
    ans = "Yes"
  flag_diag1 *= hole[j][j]
  flag_diag2 *= hole[j][2-j]
if (flag_diag1 == 1) or (flag_diag2 == 1):
  ans = "Yes"
  
print(ans)

Buggy submission (verdict: Runtime Error):
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]
hole = [[0]*3 for i in range(3)]
ans = "No" #初期値

print(A)
print(N)
print(b)
print(hole)
print(ans)


for i in range(3):
  for j in range(3):
    for k in range(N):
      if A[i][j] == b[k]:
        hole[i][j] = 1 #穴あけ
  if A[i] == [1, 1, 1]:
    ans = "Yes" #横ビンゴ、i個目の要素（配列）はそろうので判別できる

flag_diag1 = 1
flag_diag2 = 1
for j in range(3):
  flag_vert = 1 #列ごとに初期化
  for i in range(3):
    flag_vert *= hole[i][j] #3つとも1のときだけ1
  if flag_vert ==1:
    ans = "Yes" #縦ビンゴ
  flag_diag1 *= hole[j][j] #＼
  flag_diag2 *= hole[j][3-j] #／
if flag_diag1 == 1 or flag_diag2 == 1:
  ans = "Yes" #斜めビンゴ
  
print(ans)
Problem p03244 (python)

Fixed submission:
import collections
n = int(input())
v = [int(x) for x in input().split()]
v_odd, v_evn = [], []
for i in range(n):
  if i%2==0:
    v_odd.append(v[i])
  else:
    v_evn.append(v[i])
v_odd_cnt = collections.Counter(v_odd)
v_evn_cnt = collections.Counter(v_evn)
if len(v_odd_cnt) == len(v_evn_cnt) == 1:
  if v[0] == v[1]:
    print(n//2)
    exit()
  else:
    print(0)
    exit()
max_kv_odd = max(v_odd_cnt.items(), key=lambda x: x[1])
max_kv_evn = max(v_evn_cnt.items(), key=lambda x: x[1])
if max_kv_odd[0] == max_kv_evn[0]:
  if len(v_odd_cnt) == 1:
    v_evn_cnt.pop(max_kv_evn[0])
    max_kv_evn_tmp = max(v_evn_cnt.items(), key=lambda x: x[1])
    print(n-max_kv_odd[1]-max_kv_evn_tmp[1])
    exit()
  if len(v_evn_cnt) == 1:
    v_odd_cnt.pop(max_kv_odd[0])
    max_kv_odd_tmp = max(v_odd_cnt.items(), key=lambda x: x[1])
    print(n-max_kv_odd_tmp[1]-max_kv_evn[1])
    exit()
  v_odd_cnt_tmp = v_odd_cnt
  v_evn_cnt_tmp = v_evn_cnt
  v_odd_cnt_tmp.pop(max_kv_odd[0])
  v_evn_cnt_tmp.pop(max_kv_evn[0])
  max_kv_odd_tmp = max(v_odd_cnt_tmp.items(), key=lambda x: x[1])
  max_kv_evn_tmp = max(v_evn_cnt_tmp.items(), key=lambda x: x[1])
  a = max_kv_odd[1] + max_kv_evn_tmp[1]
  b = max_kv_evn[1] + max_kv_odd_tmp[1]
  print(n-max(a, b))
  exit()
print(n-max_kv_odd[1]-max_kv_evn[1])

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
v = [int(x) for x in input().split()]
v_odd, v_evn = [], []
for i in range(n):
  if i%2==0:
    v_odd.append(v[i])
  else:
    v_evn.append(v[i])
v_odd_cnt = collections.Counter(v_odd)
v_evn_cnt = collections.Counter(v_evn)
#print(v_odd_cnt, v_even_cnt)
max_kv_odd = max(v_odd_cnt.items(), key=lambda x: x[1])
max_kv_evn = max(v_evn_cnt.items(), key=lambda x: x[1])
if max_kv_odd[0] == max_kv_evn[0]:
  v_odd_cnt_tmp = v_odd_cnt
  v_evn_cnt_tmp = v_evn_cnt
  v_odd_cnt_tmp.pop(max_kv_odd[0])
  v_evn_cnt_tmp.pop(max_kv_evn[0])
  max_kv_odd_tmp = max(v_odd_cnt_tmp.items(), key=lambda x: x[1])
  max_kv_evn_tmp = max(v_evn_cnt_tmp.items(), key=lambda x: x[1])
  a = max_kv_odd[1] + max_kv_evn_tmp[1]
  b = max_kv_evn[1] + max_kv_odd_tmp[1]
  print(n-max(a, b))
  exit()
print(n-max_kv_odd[1]-max_kv_evn[1])
'''
v_odd = [0] * 10**5
veven = [0] * 10**5
for i in range(0, n//2+1, 2):
  v_odd[v[i]] += 1
  veven[v[i+1]] += 1
for i, x in enumerate(v_odd):

v_odd = {}
veven = {}
for i in range(0, n//2+1, 2):
  v_odd[v[i]] = v_odd.get(v[i], 0) + 1
  veven[v[i+1]] = veven.get(v[i+1], 0) + 1
'''
Problem p03598 (python)

Fixed submission:
N = int(input())
K = int(input())
if N > 1:
  x = list(map(int, input().split()))
  ans = 0
  for i in range(N):
    ans += min(2*x[i], 2*(K-x[i]))
else: 
  x = int(input())
  ans = min(2*x, 2*(K-x))
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
x = [int(input()) for i in range(N)]
ans = 0
for i in range(N):
    ans += min(2x[i], 2*(K-x[i]))
print(ans)
Problem p02536 (python)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.parents = list(range(n))

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        self.parents[y] = x
        
n,m = map(int,input().split())
uf = UnionFind(n)
for i in range(m):
    a,b=map(int,input().split())
    uf.union(a-1,b-1)

size = 0
for i in range(n):
    if uf.parents[i] == i:
        size += 1
print(size-1)

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.parents = list(range(n))

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        self.parents[y] = x
        
n,m = map(int,input().split())
uf = UnionFind(n)
for i in range(m):
    a,b=map(int,input().split())
    uf.union(a,b)
size = 0
for i in range(n):
    if uf.parents[i] == i:
        size += 1
print(size-1)
Problem p02584 (python)

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

a=abs(x)//d

if x<0:
  d=d*(-1)

if a>=k:
  x=x-(d*k)
  print(abs(x))
else:
  x=x-(d*a)
  b=k-a
  if abs(x)<abs(x-d):
    if b%2==0:
      print(abs(x))
    else:
      print(abs(x-d))
  else:
    x=x-d
    b-=1
    if b%2==0:
      print(abs(x))
    else:
      print(abs(x+d))

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

a=x//d

if a>=k:
  x=x-(d*k)
  print(abs(x))
else:
  x=x-(d*a)
  b=k-a
  if b%2==0:
    print(abs(x))
  else:
Problem p02663 (python)

Fixed submission:
h1,m1,h2,m2,k=map(int,input().split())

s=h1*60+m1
e=h2*60+m2

a=e-s

print(a-k)

Buggy submission (verdict: Runtime Error):
map(int,input().split())
h1,m1,h2,m2,k=map(int,input().split())

s=h1*60+m1
e=h2*60+m2

a=e-s

print(a-k)
Problem p02719 (python)

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

x=n%k

y=abs(x-k)

if x<y:
  print(x)
else:
  print(y)

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

while(1):
  m=abs(n-k)

  if m>n:
    print(n)
    break
  else:
    n=m
Problem p02747 (python)

Fixed submission:
s=str(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=str(input())

if s=="hi" or s=="hihi" or s=="hihihi" or s=="hihihihi" or s=="hihihihihi":
  print("Yes")
elif:
  print("No")

Buggy submission (verdict: Runtime Error):
import sys

s=string(input())

for i in range(len(s)-1):
  if s[i]=="h" and s[i+1]=="i":
    print("Yes")
    sys.exit()
print("No")
Problem p02748 (python)

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

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

minc=min(a)+min(b)

for i in range(M):
  x,y,c=map(int,input().split())
  cash=a[x-1]+b[y-1]-c

  if cash<minc:
    minc=cash

print(minc)

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

m=[[0] * B for i in range(A)]

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

minc=min(a)+min(b)

for i in range(M):
  x,y,c=map(int,input().split())
  cash=a[x]+b[y]-c

  if cash<minc:
    minc=cash


print(minc)
Problem p02761 (python)

Fixed submission:
import sys

n,m=map(int,input().split())

g=[-1]*n

for i in range(m):

  s,c=map(int,input().split())

  if g[s-1]!=-1 and g[s-1]!=c:
    print("-1")
    sys.exit()

  elif n>=2 and s==1 and c==0:
    print("-1")
    sys.exit()

  else:
    g[s-1]=c

ans=0
h=1

for i in range(n-1,-1,-1):

  if g[i]==-1:

    if n>=2 and i==0:
      g[i]=1

    else:
      g[i]=0


  ans+=int(g[i])*h
  h=h*10

#print(g)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys

n,m=map(int,input().split())

g=[-1]*n

for i in range(m):

  s,c=map(int,input().split())

  if g[s-1]!=-1 and g[s-1]!=c:
    print("-1")
    sys.exit()

  elif n>=2 and s==1 and c==0:
    print("-1")
    sys.exit()

  else:
    g[s-1]=c

ans=0
h=1

for i in range(m-1,-1,-1):

  if g[i]==-1:

    if n>=2 and i==0:
      g[i]=1
    else:
      g[i]=0


  ans+=int(g[i])*h
  h=h*10


print(ans)
Problem p02786 (python)

Fixed submission:
def attack(x):
  if x==1:
    return 1
  else:
    return (attack(x//2)*2+1)

h=int(input())

print(attack(h))

Buggy submission (verdict: Runtime Error):
def attack(x):
  if x==1:
    return 1
  else:
    return (attack(-(-x/2))*2+1)

h=int(input())

print(attack(h))
Problem p02934 (python)

Fixed submission:
N=int(input())
sum=0.0

A=[i for i in range(N)]

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

for i in range(0,N):
  sum+=1/A[i]

print(1/sum)

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

for i in range(0,N):
  a=int(input())
  sum+=1/a

print(1/sum)
Problem p02582 (python)

Fixed submission:
s = input()
a=0
if "R" in s:
  a = 1
  if "RR" in s:
    a += 1
    if "RRR" in s:
      a += 1
print(a)

Buggy submission (verdict: Runtime Error):
s = input()
if "R" in s:
  a = 1
  if "RR" in s:
    a += 1
    if "RRR" in s:
      a += 1
print(a)
Problem p02602 (python)

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

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(k,n+1):
  c = a[i-k:i+1]
  d = 1
  for j in range(k):
    d *= c[j]
  b.append(d)
for i in range(len(d)-1):
  if d[i+1]-d[i] > 0:
    print("Yes")
  else:
    print("No")
Problem p02613 (python)

Fixed submission:
n = int(input())
s = []
for i in range(n):
  s.append(input())
print("AC x ",s.count("AC"))
print("WA x ",s.count("WA"))
print("TLE x ",s.count("TLE"))
print("RE x ",s.count("RE"))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
  s.append(int(input()))
print("AC x ",s.count("AC"))
print("WA x ",s.count("WA"))
print("TLE x ",s.count("TLE"))
print("RE x ",s.count("RE"))
Problem p02618 (python)

Fixed submission:
import random
d = int(input())
c = list(map(int, input().split()))
s = []
for i in range(d):
  s.append(list(map(int, input().split())))
for i in range(d):
  print(random.randrange(1,27))

Buggy submission (verdict: Runtime Error):
import random
d = int(input())
c = list(map(int, input().split()))
s = []
for i in range(d):
  s = list(map(int, input().split()))
  print(1+s.index(max(x)))
Problem p02690 (python)

Fixed submission:
import math
x = int(input())
i = 0
while True:
  if (i**5 <= x):
    s = (x-i**5)**0.2
    s = math.floor(s*(10**7))/(10**7)
  t = (x+i**5)**0.2
  t = math.floor(t*(10**7))/(10**7)
  if s.is_integer() and i**5 <= x:
    print(int(s),-i)
    break
  elif t.is_integer():
    print(int(t), i)
    break
  i += 1

Buggy submission (verdict: Runtime Error):
x = int(input())
for i in range(65):
  s = (x-i**5)**0.2
  t = (x+i**5)**0.2
  if s.is_integer():
    print(int(s),-i)
    break
  elif t.is_integer():
    print(int(t), i)
    break
Problem p02813 (python)

Fixed submission:
import itertools
n = int(input())
l = list(range(1,n+1))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
r = list(itertools.permutations(l))
for i in range(len(r)):
  if r[i] == p:
    a = i
  if r[i] == q:
    b = i
print(abs(a-b))

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
l = list(range(1,n+1))
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
r = list(itertools.permutations(l))
for i in range(len(r)):
  if r[i] == p:
    a = i
  elif r[i] == q:
    b = i
print(abs(a-b))
Problem p02975 (python)

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

if b == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = []
def f(a):
  c = 0
  for i in range(n-1):
    if a[i-1] ^ a[i+1] == a[i]:
      c += 1
    else:
      c = -1
      break
  if a[0] ^ a[n-2] == a[n-1] and c > -1:
    return True
  else:
    return False
for i in range(n):
  b.append(f(a))
  c = a.pop(a[0])
  a.append(c)
if any(b):
  print("Yes")
else:
  print("No")
Problem p03000 (python)

Fixed submission:
n,x = map(int, input().split())
l = [0] + list(map(int, input().split()))
d = 0
i = 0
c = 0
while d <= x:
  d += l[i]
  i += 1
  if n+1 == i and d <= x:
    c = 1
    break
if c == 1:
  print(n+1)
else:
  print(i-1)

Buggy submission (verdict: Runtime Error):
n,x = map(int, input().split())
l = [0] + list(map(int, input().split()))
d = 0
i = 0
while d <= x and n+2 > i:
  d += l[i]
  i += 1
if n+2 <= i:
  print(n+1)
else:
  print(i-1)

Buggy submission (verdict: Runtime Error):
n,x = map(int, input().split())
l = [0] + list(map(int, input().split()))
m = 0
d = 0
i = 1
while d <= x:
  d += l[i]
  i += 1
  if n+1 <= i:
    i = None
    break
if i = None:
  print(n+1)
else:
  print(i-1)

Buggy submission (verdict: Runtime Error):
n,x = map(int, input().split())
l = [0] + list(map(int, input().split()))
m = 0
d = 0
i = 0
while d <= x:
  d += l[i]
  i += 1
print(i-1)
Problem p03030 (python)

Fixed submission:
l = []
for i in range(int(input())):
  s,p = map(str, input().split())
  l.append((s,100-int(p),i+1))
m = sorted(l)
for i in m:
  print(i[2])

Buggy submission (verdict: Runtime Error):
l = []
for i in range(int(input())):
  s,p = map(str, input().split())
  l.append((s,100-int(p),i+1))
m = sorted(l)
for i in l:
  print(l[2])
Problem p03037 (python)

Fixed submission:
n,m = map(int, input().split())
p,q = float('-inf'),float('inf')
for i in range(m):
  a,b = map(int, input().split())
  if a > p:
    p = a
  if b < q:
    q = b
if (q-p) < 0:
  print(0)
else:
  print(q-p+1)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
n = range(1,n+1)
for i in range(m):
  a,b = map(int, input().split())
  n = [j for j in n if a <= j <= b]
print(len(j))
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
	l, r = map(int, input().split())
	print(t[r-1] - t[l-1])

Buggy submission (verdict: Runtime Error):
n,q = map(int, input().split())
s = input()
t = []
for i in range(len(s)):
  if s[i] == "A" and s[i+1] == "C":
    t.append(i+1)
for i in range(q):
  l,r = map(int, input().split())
  print(len([1 for i in t if l <= i and i+1 <= r]))
Problem p03105 (python)

Fixed submission:
a,b,c = map(int, input().split())
if b//a < c:
  print(b//a)
else:
  print(c)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().spit())
if b//a < c:
  print(b//a)
else:
  print(c)
Problem p03136 (python)

Fixed submission:
n = int(input())
l = [int(i) for i in input().split()]
if max(l) < sum(l)/2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [int(i) for i in input().split()]
if max(l) < sum([i for i in l if i != max[l]]):
  print('Yes')
else:
  print('No')
Problem p03139 (python)

Fixed submission:
n,a,b = map(int, input().split())
if a > b:
  c = b
else:
  c = a
if 0 <= a + b - n:
  d = a + b -n
else:
  d = 0
print(c,d)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int, input().slit())
if a > b:
  c = b
else:
  c = a
if 0 <= a + b - n:
  d = a + b -n
else:
  d = 0
print(c,d)
Problem p03206 (python)

Fixed submission:
d = int(input())
if d == 25:
  print('Christmas')
elif d == 24:
  print('Christmas Eve')
elif d == 23:
  print('Christmas Eve Eve')
else:
  print('Christmas Eve Eve Eve')

Buggy submission (verdict: Runtime Error):
d = int(input())
if d = 25:
  print('Christmas')
elif d = 24:
  print('Christmas Eve')
elif d = 23:
  print('Christmas Eve Eve')
else:
  print('Christmas Eve Eve Eve')

Buggy submission (verdict: Runtime Error):
d = int(input())
if d = 25:
  print('Christmas')
elif d = 24:
  print('Christmas Eve')
elif d = 23:
  print('Christmas Eve Eve')
else d = 22:
  print('Christmas Eve Eve Eve')

Buggy submission (verdict: Runtime Error):
D = int(input())
if d = 25:
  print('Christmas')
elif d = 24:
  print('Christmas Eve')
elif d = 23:
  print('Christmas Eve Eve')
else d = 22:
  print('Christmas Eve Eve Eve')
Problem p03211 (python)

Fixed submission:
s = input()
g = float('inf')
for i in range(len(s)-2):
  if g > abs(int(s[i:i+3])-753):
  	g = abs(int(s[i:i+3])-753)
print(g)

Buggy submission (verdict: Runtime Error):
s = input()
g = float('inf')
for i in range(len(s)-2):
  if g > abs(int(s[i:i+3])-753):
  g = abs(int(s[i:i+3])-753)
print(g)