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

Fixed submission:
H,W=map(int,input().split())
G=[list(input()) for i in range(H)]
G_t=[list(x) for x in list(zip(*G))]
def Check(G,H,W):
  Paired_y=[False]*H
  for y1 in range(H):
    if Paired_y[y1]:
      continue
    for y2 in range(H):
      if y1==y2 or Paired_y[y2]:
        continue
      Paired_x=[False]*W
      for x1 in range(W):
        if Paired_x[x1]:
          continue
        for x2 in range(W):
          if x1==x2 or Paired_x[x2]:
            continue
          if G[y1][x1]==G[y2][x2] and G[y1][x2]==G[y2][x1]:
            Paired_x[x1]=True
            Paired_x[x2]=True
            break
      if W%2==1:
        if Paired_x.count(False)==1:
          r=Paired_x.index(False)
          if G[y1][r]==G[y2][r]:
            Paired_y[y1]=True
            Paired_y[y2]=True
            break
      else:
        if Paired_x.count(False)==0:
          Paired_y[y1]=True
          Paired_y[y2]=True
          break
  if H%2==1:
    if Paired_y.count(False)==1:
      return True
    else:
      return False
  else:
    if Paired_y.count(False)==0:
      return True
    else:
      return False
  
if Check(G,H,W) and Check(G_t,W,H):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
G=[list(input()) for i in range(H)]
G_t=[list(x) for x in list(zip(*G))]
Paired_y=[False]*H
def Check(G,H,W):
  for y1 in range(H):
    if Paired_y[y1]:
      continue
    for y2 in range(H):
      if y1==y2 or Paired_y[y2]:
        continue
      Paired_x=[False]*W
      for x1 in range(W):
        if Paired_x[x1]:
          continue
        for x2 in range(W):
          if x1==x2 or Paired_x[x2]:
            continue
          if G[y1][x1]==G[y2][x2] and G[y1][x2]==G[y2][x1]:
            Paired_x[x1]=True
            Paired_x[x2]=True
            break
      if W%2==1:
        if Paired_x.count(False)==1:
          Paired_y[y1]=True
          Paired_y[y2]=True
      else:
        if Paired_x.count(False)==0:
          Paired_y[y1]=True
          Paired_y[y2]=True
  if H%2==1:
    if Paired_y.count(False)==1:
      return True
    else:
      return False
  else:
    if Paired_y.count(False)==0:
      return True
    else:
      return False
  
if Check(G,H,W) and Check(G_t,W,H):
  print("YES")
else:
  print("NO")
Problem p03410 (python)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  res=0
  t=2**i
  a_nex=sorted([p%(2*t) for p in a])
  b_nex=sorted([p%(2*t) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and k+b_nex[p]<t:
      p+=1
    while q<N and k+b_nex[q]<2*t:
      q+=1
    while r<N and k+b_nex[r]<3*t:
      r+=1
    l+=q-p+N-r
  res=(l%2)<<i
  return res
for k in range(29):
  ans+=f(k)
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left,bisect

N=int(input())
a=list(map(int,input.split()))
b=list(map(int,input.split()))
ans=0
for i in range(29):
  a_nex=sorted(list(map(lambda x:x%2**(i+1),a)))
  b_nex=sorted(list(map(lambda x:x%2**(i+1),b)))
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and b_nex[p]<2**i-k:
      p+=1
    while q<N and b_nex[q]<2*2**i-k:
      q+=1
    while r<N and b_nex[r]<3*2**i-k:
      r+=1
    l+=q-p+N-r
  ans+=l%2<<i
print(ans)
Problem p03469 (python)

Fixed submission:
S=input()
print("2018/"+S[5:])

Buggy submission (verdict: Runtime Error):
N=int(input())
List=[int(input()) for i in range(N)]
List.sort(key=lambda x:x)
n=1
So=[]
while n<=List[N-1]:
  if n in List:
    So.append(n)
  n+=1
print(len(So))
Problem p03493 (python)

Fixed submission:
s=input()
C=0
N=0
while C<3:
  if s[C]=="1":
    N+=1
  C+=1
print(N)

Buggy submission (verdict: Runtime Error):
N=int(input())
List=list(map(int,input().split()))
Flag=0
Counter=-1
Element=0
while Flag<1:
  while Element<N:
      if List[Element]%2==1:
        Flag=1
      List[Element]=List[Element]/2
      Element+=1
  Element=0
  Counter+=1
print(Counter)
Problem p03501 (python)

Fixed submission:
N,A,B=map(int,input().split())
print(min(A*N,B))

Buggy submission (verdict: Runtime Error):
N,C=map(int,input().split())
Time=[[0]*(10**5+1) for c in range(C)]
for i in range(N):
  s,t,c=map(int,input().split())  
  Time[c-1][s-1:t] = [1]*(t-s+1)
Times=max(map(sum,zip(*Time)))
print(Times)
Problem p03504 (python)

Fixed submission:
N,C=map(int,input().split())
Time=[[0]*(10**5+1) for c in range(C)]
for i in range(N):
  s,t,c=map(int,input().split())  
  Time[c-1][s-1:t] = [1]*(t-s+1)
Times=max(map(sum,zip(*Time)))
print(Times)

Buggy submission (verdict: Runtime Error):
N,C=map(int,input().split())
List=[[int(i) for i in input().split()] for i in range(N)]
Time=[[0]*(10**5+1)]*C
for i in range(N):
  T_c=list(Time[List[i][2]-1])
  T_c[List[i][0]-1:List[i][1]]=[1]*(List[i][1]-List[i][0]+1)
  Time[List[i][2]-1]=list(T_c)
T=0
T_max=0
for t in range(10**5):
  for c in range(C):
    T+=Time[c][t]
  if T_max<T:
    T_max=T
  T=0
print(T_max)
print(a)
Problem p03579 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
N,M=map(int,input().split())
G=[[] for i in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  a-=1
  b-=1
  G[a].append(b)
  G[b].append(a)
color=[-1]*N  
def dfs(x):
  for i in G[x]:
    if color[i]==-1:
      color[i]=1^color[x]
      dfs(i)
    elif color[i]==color[x]:
      print((N*(N-1))//2-M)
      exit()
color[0]=0
dfs(0)
b=0
for i in range(N):
  b+=color[i]
print(b*(N-b)-M)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
G=[[] for i in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  a-=1
  b-=1
  G[a].append(b)
  G[b].append(a)
color=[-1]*N  
def dfs(x):
  for i in G[x]:
    if color[i]==-1:
      color[i]=1^color[x]
      dfs(i)
    elif color[i]==color[x]:
      print((N*(N-1))//2-M)
      exit()
color[0]=0
dfs(0)
b=0
for i in range(N):
  b+=color[i]
print(b*(N-b)-M)
Problem p03633 (python)

Fixed submission:
def gcd(a,b):
  if a<b:
    a,b=b,a
  while b>0:
    a,b=b,a%b
  return int(a)
N=int(input())
T=1
for i in range(N):
  ti=int(input())
  T=T*ti//gcd(T,ti)
print(T)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  if a<b:
    a,b=b,a
  while b>0:
    a,b=b,a%b
  return int(a)
def lcm(a,b):
  return int(a*b/gcd(a,b))
N=int(input())
T=1
for i in range(N):
  ti=int(input())
  T=lcm(T,ti)
print(T)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  while b>0:
    a,b=b,a%b
  return int(a)
def lcm(a,b):
  return int(a*b/gcd(a,b))
N=int(input())
T=1
for i in range(N):
  ti=int(input())
  T=lcm(T,ti)
print(T)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  while b>0:
    a,b=b,a%b
  return int(a)
def lcm(a,b):
  return int(a*b/gcd(a,b))
N=int(input())
List_T=[int(input()) for i in range(N)]
T=1
n=1
for i in List_T:
  T=lcm(T,i)
print(T)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  while a>=1 and b>=1:
    a,b=b,a%b
  return int(a)
def lcm(a,b):
  return int(a*b/gcd(a,b))
N=int(input())
List_T=[int(input()) for i in range(N)]
T=1
n=1
for i in List_T:
  T=lcm(T,i)
print(T)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  while b>=1:
    a,b=b,a%b
  return int(a)
def lcm(a,b):
  return int(a*b/gcd(a,b))
N=int(input())
List_T=[int(input()) for i in range(N)]
T=1
n=1
for i in List_T:
  T=lcm(T,i)
print(int(T))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  while b>=1:
    a,b=b,a%b
  return a
def lcm(a,b):
  return a*b/gcd(a,b)
N=int(input())
List_T=[int(input()) for i in range(N)]
T=1
for i in List_T:
  T=lcm(T,i)
print(int(T))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  while b>=1:
    a,b=b,a%b
  return a
def lcm(a,b):
  return a*b/gcd(a,b)
N=int(input())
List_T=[int(input()) for i in range(N)]
T=1
n=1
for i in List_T:
  T=lcm(T,i)
print(int(T))
Problem p03676 (python)

Fixed submission:
N=int(input())
a=[int(i)-1 for i in input().split()]
count=[0]*N
for i in range(N+1):
  count[a[i]]+=1
  if count[a[i]]==2:
    D=a[i]
    break
flag=False
k=0
mod=10**9+7
for i in range(N+1):
  if a[i]==D and not flag:
    flag=True
  elif a[i]==D and flag:
    break
  elif flag:
    k+=1
    
Factorial=[1]*(N+1)
for i in range(1,N+1):
  Factorial[i]=Factorial[i-1]*(i)%mod
def power(x,y):
  if y==0:
    return 1
  elif y==1:
    return x%mod
  elif y%2==0:
    return power(x,y//2)**2%mod
  else:
    return (power(x,y//2)**2)*x%mod

inverseFactorial=[1]*(N+1)
inverseFactorial[N]=power(Factorial[N],mod-2)
for i in range(0,N)[::-1]:
  inverseFactorial[i]=(inverseFactorial[i+1]*(i+1))%mod
  
def comb(x,y):
  if x<y or y<0:
    return 0
  else:
    return (Factorial[x]*inverseFactorial[y]*inverseFactorial[x-y])%mod

dp=[[0]*3 for i in range(N+2)]
dp[0][0]=1

for i in range(N+1):
  dp[i+1][0]=comb(N-1,i+1)
  dp[i+1][1]=-comb(N-k-1,i)+2*dp[i][0]
  if i>=1:
    dp[i+1][2]=dp[i-1][0]
  print(sum(dp[i+1])%mod)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[int(i)-1 for i in input().split()]
count=[0]*N
for i in range(N):
  count[a[i]]+=1
  if count[a[i]]==2:
    D=a[i]
    break
flag=False
k=0
mod=10**9+7
for i in range(N+1):
  if a[i]==D and not flag:
    flag=True
  elif a[i]==D and flag:
    break
  elif flag:
    k+=1
    
Factorial=[1]*(N+1)
for i in range(1,N+1):
  Factorial[i]=Factorial[i-1]*(i)%mod
def power(x,y):
  if y==0:
    return 1
  elif y==1:
    return x%mod
  elif y%2==0:
    return power(x,y//2)**2%mod
  else:
    return (power(x,y//2)**2)*x%mod

inverseFactorial=[1]*(N+1)
inverseFactorial[N]=power(Factorial[N],mod-2)
for i in range(0,N)[::-1]:
  inverseFactorial[i]=(inverseFactorial[i+1]*(i+1))%mod
  
def comb(x,y):
  if x<y or y<0:
    return 0
  else:
    return (Factorial[x]*inverseFactorial[y]*inverseFactorial[x-y])%mod

dp=[[0]*3 for i in range(N+2)]
dp[0][0]=1

for i in range(N+1):
  dp[i+1][0]=comb(N-1,i+1)
  dp[i+1][1]=-comb(N-k-1,i)+2*dp[i][0]
  if i>=1:
    dp[i+1][2]=dp[i-1][0]
  print(sum(dp[i+1])%mod)
Problem p03766 (python)

Fixed submission:
n=int(input())
if n==1:
  print(1)
  exit()
mod=10**9+7
dp=[0]*(n+1)
S=[0]*(n+1)
dp[0]=1
dp[1]=1
dp[2]=1
S[0]=1
for i in range(n):
  if i+1>=3:
    dp[i+1]=2*dp[i]-dp[i-1]+dp[i-2]
  dp[i+1]%=mod
  S[i+1]=S[i]+(n-1)*dp[i]
  S[i+1]%=mod
ans=S[n]
for i in range(1,n):
  ans+=((n-1)**2)*dp[i-1]
  ans%=mod
print(ans)
#print(S)
#print(dp)

Buggy submission (verdict: Runtime Error):
n=int(input())
mod=10**9+7
dp=[0]*(n+1)
S=[0]*(n+1)
dp[0]=1
dp[1]=1
dp[2]=1
S[0]=1
for i in range(n):
  if i+1>=3:
    dp[i+1]=2*dp[i]-dp[i-1]+dp[i-2]
  dp[i+1]%=mod
  S[i+1]=S[i]+(n-1)*dp[i]
  S[i+1]%=mod
ans=S[n]
for i in range(1,n):
  ans+=((n-1)**2)*dp[i-1]
  ans%=mod
print(ans)
#print(S)
#print(dp)
Problem p03782 (python)

Fixed submission:
from bisect import bisect_left
N,K=map(int,input().split())
a=[int(i) for i in input().split()]
a.sort()
a=a[:bisect_left(a,K)]
d=[False]*(K)
d[0]=True
curr_max=0
ans=len(a)
for i,a in reversed(list(enumerate(a))):
  if curr_max+a>=K:
    ans=i
  c=curr_max
  for j in range(curr_max+1)[::-1]:
    if j+a<K and d[j]:
      d[j+a]=True
      c=max(c,j+a)
  curr_max=c
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect
N,K=map(int,input().split())
a=[int(i) for i in input().split()]
a.sort()
def dp(n):
  d=[False]*(K+1)
  d[0]=True
  for i in range(N):
    if i!=n:
      for w in range(K)[::-1]:
        if w+a[i]<=K and d[w]:
          d[w+a[i]]=True
  for i in range(K-a[n],K):
    if d[i]:
      return True
  return False

l,r=0,N-1
while r-l>1:
  m=(l+r)//2
  if dp(m):
    r=m
  else:
    l=m
if r==N-1 and not dp(N-1):
  print(N)
elif not dp(r):
  print(r+1)
elif not dp(l):
  print(l+1)
else:
  print(l)
Problem p03808 (python)

Fixed submission:
N=int(input())
a=[int(i) for i in input().split()]
S=sum(a)
if S%(N*(N+1)//2)==0:
  k=S//(N*(N+1)//2)
else:
  print("NO")
  exit()
D=[]
a.append(a[0])
for i in range(N):
  D.append(a[i+1]-a[i]-k)

for d in D:
  if d>0 or d%N!=0:
    print("NO")
    exit()
    
print("YES")

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[int(i) for i in input().split()]
k=sum(a)//(N*(N-1)//2)
D=[]
a.append(a[0])
for i in range(N):
  D.append(a[i+1]-a[i]-k)

for d in D:
  if d%N!=0:
    print("NO")
    exit()
print("YES")
Problem p03819 (python)

Fixed submission:
N,M=map(int,input().split())
section=[[] for i in range(M+1)]
for i in range(N):
  l,r=map(int,input().split())
  section[r-l+1].append((l,r))

def add(B,a,s):
    x=a
    while x<=len(B)-1:
        B[x]+=s
        x+=x&(-x)
        
def sums(B,a):
    x=a
    S=0
    while x!=0:
        S+=B[x]
        x-=x&(-x)
    return S

Line=[0]*(M+2)
K=N
for d in range(1,M+1):
  for l,r in section[d]:
    add(Line,l,1)
    add(Line,r+1,-1)
    K-=1
  ans=K
  for s in range(M//d+1):
    ans+=sums(Line,s*d)
  print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
section=[[] for i in range(M+1)]
for i in range(N):
  l,r=map(int,input().split())
  section[r-l+1].append((l,r))

def add(B,a,s):
    x=a
    while x<=len(B):
        B[x]+=s
        x+=x&(-x)
        
def sums(B,a):
    x=a
    S=0
    while x!=0:
        S+=B[x]
        x-=x&(-x)
    return S

Line=[0]*(M+2)
K=N
for d in range(1,M+1):
  for l,r in section[d]:
    add(Line,l,1)
    add(Line,r+1,-1)
    K-=1
  ans=K
  for s in range(M//d+1):
    ans+=sums(Line,s*d)
  print(ans)
Problem p03864 (python)

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

Buggy submission (verdict: Runtime Error):
from heapq import heapify,heappop,heappush
xs,ys,xt,yt=map(int,input().split())
P=[]
inf=float("inf")
P.append((xs,ys,0))
N=int(input())
for i in range(N):
  x,y,r=map(int,input().split())
  P.append((x,y,r))
P.append((xt,yt,0))
G=[set() for i in range(N+2)]
for i in range(N+2):
  for j in range(N+2):
    if i!=j:
      x1,y1,r1,x2,y2,r2=P[i][0],P[i][1],P[i][2],P[j][0],P[j][1],P[j][2]
      d=((x1-x2)**2+(y1-y2)**2)**(1/2)
      if d<=r1+r2:
        G[i].add((0,j))
      else:
        G[i].add((d-r1-r2,j))

def dijkstra(s,n,links):
  cost=[inf]*n
  cost[s]=0
  heap=[(0,s)]
  heapify(heap)
  while heap:
    hc,hp=heappop(heap)
    for c,p in links[hp]:
      if c+hc<cost[p]:
        cost[p]=c+hc
        heappush(heap,(cost[p],p))
  return cost        

c=dijkstra(0,N+2,G)
print(c[-1])
Problem p03959 (python)

Fixed submission:
N=int(input())
T=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]
if N==1:
  if A[0]==T[0]:
    print(1)
  else:
    print(0)
  exit()
  
ans=1
mod=10**9+7
for i in range(N):
  if i==0:
    if A[i]!=A[i+1] and T[i]!=A[i]:
      print(0)
      exit()
  elif i==N-1:
    if T[i]!=T[i-1] and T[i]!=A[i]:
      print(0)
      exit()
  else:
    if T[i]==T[i-1] and A[i]==A[i+1]:
      ans=(ans*min(T[i],A[i]))%mod
    elif T[i]!=T[i-1] and A[i]<T[i]:
      print(0)
      exit()
    elif A[i]!=A[i+1] and A[i]>T[i]:
      print(0)
      exit()
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
T=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]
ans=1
mod=10**9+7
for i in range(N):
  if i==0:
    if A[i]!=A[i+1] and T[i]!=A[i]:
      print(0)
      exit()
  elif i==N-1:
    if T[i]!=T[i-1] and T[i]!=A[i]:
      print(0)
      exit()
  else:
    if T[i]==T[i-1] and A[i]==A[i+1]:
      ans=(ans*min(T[i],A[i]))%mod
    elif T[i]!=T[i-1] and A[i]<T[i]:
      print(0)
      exit()
    elif A[i]!=A[i+1] and A[i]>T[i]:
      print(0)
      exit()
print(ans)
Problem p04043 (python)

Fixed submission:
A=sorted([int(i) for i in input().split()])
if A==[5,5,7]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
A=sorted([int(i) for i in input().split()])
if A==[5,5,7]:
  print(“YES”)
else:
  print(“NO”)
Problem p02718 (python)

Fixed submission:
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
sum = sum(A)
cnt = 0
for a in A:
  if a * 4 * m >= sum:
    cnt += 1
if cnt >= m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
sum = sum(A)
for a in A:
  if a * 4 * m < sum:
    cnt += 1
if cnt >= m:
  print("Yes")
else:
  print("No")
Problem p02789 (python)

Fixed submission:
a, b = map(int, input().split())
print('Yes' if a is b else 'No')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print('Yes' if  is b else 'No')
Problem p02953 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
mn = 0
ans = "Yes"
for i in h:
    if i <= mn - 2:
        ans = "No"
    else:
        mn = max(mn, i)
print(ans)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> p(n), x(n);
    for (int i = 1; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    bool ok = false;

    if (ok) {
        puts("POSSIBLE");
    } else {
        puts("IMPOSSIBLE");
    }
    return 0;
}
Problem p03796 (python)

Fixed submission:
import math
print(math.factorial(int(input())) % (10**9+7))

Buggy submission (verdict: Runtime Error):
import math
print(math.factorial(int(input())) % (10**9+7)))
Problem p03212 (python)

Fixed submission:
from collections import deque
n = int(input())
q = deque()
q.append('')
res = set()
while q:
    m = q.popleft()
    for c in '357':
        if int(m+c) > n: continue
        q.append(m+c)
    for c in '357':
        if c not in m: break
    else:
        res.add(m)
print(len(res))

Buggy submission (verdict: Runtime Error):
from collections import deque
n = int(input())
q = deque()
q.append('')
res = set()
while q:
    m = q.pop_front()
    for c in '357':
        if int(m+c) > n: continue
        q.append(m+c)
    for c in '357':
        if c not in m: break
    else:
        res.add(m)
print(len(res))
Problem p03338 (python)

Fixed submission:
N, S = (input() for i in 'NS')
res = 0
for i in range(int(N)):
    s, t = set(S[:i]), set(S[i:])
    res = max(res, len(s.intersection(t)))
print(res)

Buggy submission (verdict: Runtime Error):
N, S = (input() for i in 'NS')
res = 0
for i in range(N):
    s, t = set(S[:i]), set(S[i:])
    res = max(res, len(s.intersection(t)))
print(res)
Problem p03449 (python)

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

res = 0
for i in range(n):
    res = max(res, sum(a[:i+1])+sum(b[i:]))
    
print(res)

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

res = 0
for i in range(n):
    res = max(res, a[:i+1]+b[i:])
    
print(res)
Problem p03485 (python)

Fixed submission:
a, b = map(int, raw_input().split())
print (a+b+1)/2

Buggy submission (verdict: Runtime Error):
x, y = map(int, raw_input().split())
print (a+b+1)/2
Problem p03486 (python)

Fixed submission:
s = raw_input()
t = raw_input()

if sorted(s) < sorted(t, reverse=True):
  print 'Yes'
else:
  print 'No'

Buggy submission (verdict: Runtime Error):
s = raw_input()
t = raw_input()

if sorted(*s) < sorted(*t, reverse=True):
  print 'Yes'
else:
  print 'No'
Problem p03555 (python)

Fixed submission:
print(['NO','YES'][input()==input()[::-1]])

Buggy submission (verdict: Runtime Error):
print('YES'if input()==input[::-1] else'NO')
Problem p03679 (python)

Fixed submission:
X, A, B = map(int, raw_input().split())
if B-A > X:
  print 'dangerous'
else:
  print 'safe' if A < B else 'delicious'

Buggy submission (verdict: Runtime Error):
X, A, B = map(int, raw_input().split())
if A <= B:
  print 'delicious'
else
  print 'dangerous' if X < B-A else 'safe'
Problem p04043 (python)

Fixed submission:
print('YES' if sorted(input()[::2]) == ['5','5','7'] else 'NO')

Buggy submission (verdict: Runtime Error):
print('YES' if sorted(input()) == [*'  557'] else 'NO')

Buggy submission (verdict: Runtime Error):
print('YES' if sorted(input()) == [*'  557'] else 'No')
Problem p02664 (python)

Fixed submission:
t = list(input())
t.reverse()

tmptmp = "P"
for i in range(len(t)):
    if i == 0:
        tmp = t[i]
        continue
    if tmp == "?" and tmptmp != "D":
        t[i-1] = "D"
    elif tmp == "?" and tmptmp == "D" and t[i] != "D":
        t[i-1] = "D"
    elif tmp == "?" and tmptmp == "D" and t[i] == "D":
        t[i-1] = "P"
    tmptmp = t[i-1]
    tmp = t[i]

t.reverse()

if len(t) > 1:
    if t[0] == "?" and t[1] == "D":
        t[0] = "P"
    elif t[0] == "?" and t[1] == "P":
        t[0] = "D"

if len(t) == 1:
    t[0] = "D"

t = "".join(t)
print(t)

Buggy submission (verdict: Runtime Error):
t = list(input())
t.reverse()

tmptmp = "P"
for i in range(len(t)):
    if i == 0:
        tmp = t[i]
        continue
    if tmp == "?" and tmptmp == "P":
        t[i-1] = "D"
    elif tmp == "?" and tmptmp == "D" and t[i] == "P":
        t[i-1] = "D"
    elif tmp == "?" and tmptmp == "D" and t[i] == "D":
        t[i-1] = "P"
    tmptmp = t[i-1]
    tmp = t[i]

t.reverse()

if t[0] == "?" and t[1] == "D":
    t[0] = "P"
elif t[0] == "?" and t[1] == "P":
    t[0] = "D"

t = "".join(t)
print(t)
Problem p02553 (python)

Fixed submission:
a,b,c,d = map(int,input().split())

if(a>= 0 and c>= 0):
    print(b*d)
elif(b<=0 and d<=0):
    print(a*c)
elif(a>=0 and d<=0):
    print(a*d)
elif(b<=0 and c>=0):
    print(b*c)
elif(a*c >= b*d):
    print(a*c)
elif(a*c < b*d):
    print(b*d)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())

if(a >= 0 and d <= 0):
    print(a*d)
elif(b<= 0 and d <= 0):
    print(a*c)
elif((b <= 0 and c >= 0) or (b > 0 and d < 0)):
    print(b*c)
elif((b > 0 and c > 0):
    print(b*d)
elif(a*c > a*d):
    print(a*c)
elif(a*c < a*d):
    print(a*d)
Problem p02742 (python)

Fixed submission:
H, W  = map(int, input().split())

if H == 1 or W == 1:
    print(1)

else:
    print(((H*W) + 1) // 2)

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

if H == 1 or W == 1:
    print(1)

else:
    print(((h*W) + 1) // 2)
Problem p02767 (python)

Fixed submission:
N = int(input())
x = list(map(int, input().split()))
 
t = 0
min = 0

for i in range(0,N):
     t += x[i]/N

s = round(t)
for i in range(0,N):
    min += (x[i] - s) **2

print(min)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
x = list(map(int, input().split()))
 
s = float((x[0] + x[1])/2)
for i in range(2,N-1):
	s = (s + x[i]) / 2
 
min = math.floor(s)
 
print(min)

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

s = float(x[0])
for i in range(N-1):
	t = (s + x[i+1]) / 2

min = math.floor(t)

print(min)
Problem p02606 (python)

Fixed submission:
l,d,r = map(int,input().split())
count = 0
for i in range(l,d+1):
  if i%r==0: count += 1
print(count)

Buggy submission (verdict: Runtime Error):
l,d,r = map(int,input().split())
def div(n): 
  return True if n%r==0 else False
print(len(filter(div,range(l,d+1))))