Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def sum_m(m):
    return m*(m-1)//2
S=str(input())
n=len(S)
mod=2019
ans=0
mod_set=set()
box=[0 for i in range(n)]
T=[0 for i in range(n+1)]
T[n-1]=int(S[n-1])
box[n-1]=1
for i in range(n-2,-1,-1):
    box[i]=box[i+1]*10%mod
    a=int(S[i])*box[i]+T[i+1]
    k=a%mod
    T[i]=k
    mod_set.add(k)
for i in mod_set:
    m=T.count(i)
    ans+=sum_m(m)
print(ans)


Fixed submission:
S=str(input())
n=len(S)
mod=2019
ans=0
mod_set=[0]*mod
mod_set[0]+=1
ten=1
k=0
for i in range(n-1,-1,-1):
    k=(k+ten*int(S[i]))%mod
    mod_set[k]+=1
    ten=(ten*10)%mod

for i in mod_set:
    ans+=i*(i-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=str(input())
n=len(S)
mod=2019
ans=0
box=[0 for i in range(n)]
T=[0 for i in range(n)]
T[-1]=int(S[-1])
box[-1]=1
for i in range(n-2,-1,-1):
    box[i]=box[i+1]*10%mod
    a=int(S[i])*box[i]+T[i+1]
    k=a%mod
    T[i]=k
T.append(0)
for i in range(mod):
    if i in T:
        m=T.count(i)
        ans+=m*(m-1)//2
print(ans)


Fixed submission:
S=str(input())
n=len(S)
mod=2019
ans=0
mod_set=[0]*mod
mod_set[0]+=1
ten=1
k=0
for i in range(n-1,-1,-1):
    k=(k+ten*int(S[i]))%mod
    mod_set[k]+=1
    ten=(ten*10)%mod

for i in mod_set:
    ans+=i*(i-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=str(input())
k=len(S)
count=0
for i in range(k-4):
    for j in range(k-4):
        if i+j+4>k:
            continue
        n=int(S[j:i+j+4])
        if n%2019==0:
            count+=1
print(count)


Fixed submission:
S=str(input())
n=len(S)
mod=2019
ans=0
mod_set=[0]*mod
mod_set[0]+=1
ten=1
k=0
for i in range(n-1,-1,-1):
    k=(k+ten*int(S[i]))%mod
    mod_set[k]+=1
    ten=(ten*10)%mod

for i in mod_set:
    ans+=i*(i-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=str(input())
k=len(S)
count=0
for i in range(k-4):
    for j in range(k-4):
        if i+j+4>k:
            continue
        n=int(S[j:i+j+4])
        if n%2019==0:
            count+=1
print(count)


Fixed submission:
S=str(input())
n=len(S)
mod=2019
ans=0
mod_set=[0]*mod
mod_set[0]+=1
ten=1
k=0
for i in range(n-1,-1,-1):
    k=(k+ten*int(S[i]))%mod
    mod_set[k]+=1
    ten=(ten*10)%mod

for i in mod_set:
    ans+=i*(i-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=str(input())
k=len(S)
count=0
for i in range(k-2):
    for j in range(4,k):
        if i+j>k:
            continue
        n=int(S[i:i+j])
        if n%2019==0:
            count+=1
print(count)


Fixed submission:
S=str(input())
n=len(S)
mod=2019
ans=0
mod_set=[0]*mod
mod_set[0]+=1
ten=1
k=0
for i in range(n-1,-1,-1):
    k=(k+ten*int(S[i]))%mod
    mod_set[k]+=1
    ten=(ten*10)%mod

for i in mod_set:
    ans+=i*(i-1)//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
queue=[i for i in range(1,10)]
for _ in range(k-1):
    x=queue.pop(0)
    if x%10 != 0:
        queue.append(10*x+x%10-1)
    queue.append(10*x+x%10)
    if x%10 != 9:
        queue.append(10*x+x%10+1)
print(queue[0])


Fixed submission:
k=int(input())
queue=[i for i in range(1,10)]
if k <10:
    print(k)
else:
    l=0
    while l+9 < k:
        x=queue.pop(0)
        if x%10 != 0:
            queue.append(10*x+x%10-1)
            l+=1
        if l+9==k:
            break
        queue.append(10*x+x%10)
        l+=1
        if l+9==k:
            break
        if x%10 != 9:
            queue.append(10*x+x%10+1)
            l+=1
    print(queue[-1])

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
queue=[i for i in range(1,10)]
for _ in range(k-1):
    x=queue.pop(0)
    if x%10 != 0:
        queue.append(10*x+x%10-1)
    queue.append(10*x+x%10)
    if x%10 != 9:
        queue.append(10*x+x%10+1)
print(queue[0])


Fixed submission:
k=int(input())
queue=[i for i in range(1,10)]
if k <10:
    print(k)
else:
    l=0
    while l+9 < k:
        x=queue.pop(0)
        if x%10 != 0:
            queue.append(10*x+x%10-1)
            l+=1
        if l+9==k:
            break
        queue.append(10*x+x%10)
        l+=1
        if l+9==k:
            break
        if x%10 != 9:
            queue.append(10*x+x%10+1)
            l+=1
    print(queue[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y=map(int,input().split())
ans=[0]*(n-1)
for i in range(1,n):
    for j in range(i+1,n+1):
        length=min(abs(i-j),abs(x-i)+1+abs(y-j),abs(y-i)+1+abs(x-j))
        ans[length-1]+=1
for i in range(n-1):
    print(ans[i])


Fixed submission:
n,x,y=map(int,input().split())
ans=[0]*(n-1)
ans[0]=n-1
for i in range(1,n-1):
    for j in range(i+2,n+1):
        length=min(abs(i-j),abs(x-i)+1+abs(y-j),abs(y-i)+1+abs(x-j))
        ans[length-1]+=1
for i in range(n-1):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
def corp(i):
    return i*(i-1)//2

N=int(input())
A=list(map(int,input().split()))
box=[0]*N
for i in A:
    box[i-1]+=1

for i in A:
    sum=0
    for j in range(N):
        if j==i:
            sum+=corp(box[j-1]-1)
        else:
            sum+=corp(box[j-1])
    print(sum)


Fixed submission:
def corp(i):
    return i*(i-1)//2

N=int(input())
A=list(map(int,input().split()))
box=[0]*N
for i in A:
    box[i-1]+=1
sum=0
for i in box:
    if i != 1:
        sum+=corp(i)
for i in A:
    ans=sum
    if box[i-1] != 1:
        ans=ans-corp(box[i-1])+corp(box[i-1]-1)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def W_tips(j):
    global K,g,now,tips
    for i in range(g):
        now[i]+=tips[i][j]
    for i in range(g):
        if now[i] > K:
            return False
    return True

f_inf=float("inf")
H,W,K=map(int,input().split())
s=[None]*H
for i in range(H):
    s[i]=str(input())
ans = f_inf
for div in range(1 << (H-1)):
    g=int(0)
    id =[0]*H
    for j in range(H):
        id[j]=g
        if div>>j&1:g+=1
    num = g
    g+=1
    tips=[[0 for i in range(W)] for j in range(g)]
    for i in range(H):
        for j in range(W):
            tips[id[i]][j]+=(s[i][j] !="0")
    now=[0]*g
    for j in range(W):
        if W_tips(j)==False:
            num+=1
            now=[0]*g
            if W_tips(j)==False:
                num=f_inf
                break
    ans=min(ans,num)
print(ans)


Fixed submission:
def W_tips(j):
    global K,g,now,tips
    for i in range(g):
        now[i]+=tips[i][j]
    for i in range(g):
        if now[i] > K:
            return False
    return True

f_inf=float("inf")
H,W,K=map(int,input().split())
S=[list(map(int,list(input()))) for _ in range(H)]
ans = f_inf
for div in range(1 << (H-1)):
    g=0
    tips=[[0]*W]
    tips[g]=[s+b for s, b in zip(S[0],tips[g])]
    for i in range(1,H):
        if div >> (i-1) &1:
            g+=1
            tips.append([0]*W)
        tips[g]=[s + b for s, b in zip(S[i],tips[g])]
    num=g
    g+=1
    now=[0]*g
    for j in range(W):
        if W_tips(j)==False:
            num+=1
            now=[0]*g
            if W_tips(j)==False:
                num=f_inf
                break
    ans=min(ans,num)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,S =map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
ans=0
q=[0]*(S+1)
for i in range(N):
    q[0]+=1
    q2=[0]*(S+1)
    for j in range(S+1):
        q[j]%=mod
        q2[j]+=q[j]
        if (j + A[i]) <= S:
            q2[j+A[i]]+=q[j]
    q = q2
    ans+=q[S]
    ans%=mod
print(ans)


Fixed submission:
N,S =map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
ans=0
q=[0]*(S+1)
for i in range(N):
    q2=q.copy()
    if A[i]<=S:
        for j in range(A[i],S+1):
            q[j]+=q2[j-A[i]]
        q[A[i]]+=i+1
    ans+=q[S]
    ans%=mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,S =map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
ans=0
q=[0]*(S+1)
for i in range(N):
    q[0]+=1
    q2=[0]*(S+1)
    for j in range(S+1):
        q[j]%=mod
        q2[j]+=q[j]
        if (j + A[i]) <= S:
            q2[j+A[i]]+=q[j]
    q = q2
    ans+=q[S]%mod
    ans%=mod
print(ans)


Fixed submission:
N,S =map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
ans=0
q=[0]*(S+1)
for i in range(N):
    q2=q.copy()
    if A[i]<=S:
        for j in range(A[i],S+1):
            q[j]+=q2[j-A[i]]
        q[A[i]]+=i+1
    ans+=q[S]
    ans%=mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S=str(input())
Q=int(input())
for i in range(Q):
    T=list(map(str,input().split()))
    if T[0]=="1":
        S=S[::-1]
    else:
        if T[1]=="1":
            S=T[2]+S
        else: S=S+T[2]
print(S)

Fixed submission:
S1=""
S2=""
S=str(input())
Q=int(input())
flag=1
for i in range(Q):
    T=list(map(str,input().split()))
    if T[0]=="1":
        flag*=-1
    else:
        if T[1]=="1":
            if flag==1:
                S1=T[2]+S1
            else: S2=S2+T[2]
        else:
            if flag==1:
                S2=S2+T[2]
            else:S1=T[2]+S1
if flag==1:
    S=S1+S+S2
else:S=S2[::-1]+S[::-1]+S1[::-1]
print(S)

Buggy python submission (verdict: Time Limit Exceeded):
S=str(input())
Q=int(input())
for i in range(Q):
    T=list(map(str,input().split()))
    if T[0]=="1":
        S=S[::-1]
    else:
        if T[1]=="1":
            S=T[2]+S
        else:S=S+T[2]
print(S)

Fixed submission:
S1=""
S2=""
S=str(input())
Q=int(input())
flag=1
for i in range(Q):
    T=list(map(str,input().split()))
    if T[0]=="1":
        flag*=-1
    else:
        if T[1]=="1":
            if flag==1:
                S1=T[2]+S1
            else: S2=S2+T[2]
        else:
            if flag==1:
                S2=S2+T[2]
            else:S1=T[2]+S1
if flag==1:
    S=S1+S+S2
else:S=S2[::-1]+S[::-1]+S1[::-1]
print(S)
Buggy python submission (verdict: Runtime Error):
N,P=map(int,input().split())
S=str(input())
ans=0

if 10%P==0:
    for i in range(N):
        if int(S[i])%P==0:
            ans+=i+1
else:
    rem = [0]*P
    mod = 0
    ten = 1
    rem[mod]=1
    for i in range(N):
        mod=(mod+S[N-i-1]*ten)%P
        ten=ten*10%P
        rem[mod]+=1
    for j in rem:
        ans+=(j*(j-1))//2
print(ans)

Fixed submission:
N,P=map(int,input().split())
S=str(input())
ans=0

if 10%P==0:
    for i in range(N):
        if int(S[i])%P==0:
            ans+=i+1
else:
    rem = [0]*P
    mod = 0
    ten = 1
    rem[mod]=1
    for i in range(N):
        mod=(mod+int(S[N-i-1])*ten)%P
        ten=ten*10%P
        rem[mod]+=1
    for j in rem:
        ans+=(j*(j-1))//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,P=map(int,input().split())
S=str(input())

ans=0
if 10%P==0:
    for i in range(N):
        if int(S[i])%P==0:
            ans+=i+1
else:
    rem=[0]*P
    rem[0]=1
    for i in range(N-1,-1,-1):
        rem[int(S[i:N])%P]+=1
    for j in rem:
        ans+=(j*(j-1))//2
print(ans)


Fixed submission:
N,P=map(int,input().split())
S=str(input())
ans=0

if 10%P==0:
    for i in range(N):
        if int(S[i])%P==0:
            ans+=i+1
else:
    rem = [0]*P
    mod = 0
    ten = 1
    rem[mod]=1
    for i in range(N):
        mod=(mod+int(S[N-i-1])*ten)%P
        ten=ten*10%P
        rem[mod]+=1
    for j in rem:
        ans+=(j*(j-1))//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N = int(input())
P = list(map(int, input().split()))
ans=0
for i in range(N-1,-1,-1):
    M=min(P)
    if P[i] ==M:
        ans+=1
    del P[-1]
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
P = list(map(int, input().split()))
ans=1
if N!=1:
    M=P[0]
    for i in range(1,N,1):
        M=min(P[i],M)
        if P[i] ==M:
            ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N = int(input())
P = list(map(int, input().split()))
ans=1
while len(P)!=1 :
    k=P.index(min(P))
    if k ==0:
        break
    P=P[0:k:1]
    ans+=1
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
P = list(map(int, input().split()))
ans=1
if N!=1:
    M=P[0]
    for i in range(1,N,1):
        M=min(P[i],M)
        if P[i] ==M:
            ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N = int(input())
P = list(map(int, input().split()))
ans=1
for i in range(1,N,1):
    flag=0
    for j in range(0,i,1):
        if P[j] < P[i]:
            flag=1
            break
    if flag==0:ans+=1
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
P = list(map(int, input().split()))
ans=1
if N!=1:
    M=P[0]
    for i in range(1,N,1):
        M=min(P[i],M)
        if P[i] ==M:
            ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main (){
  int n,a,b,ans;
  cin >> n >> a >> b;
  if ((b-a)% == 0){
    ans=(b-a)/2;
  }
  else{
    if(n-b > a-1){
      ans=a-1+1;
      b-=ans;
      a=1;
      ans+=(b-a)/2;
    }
    else{
      ans=n-b+1;
      a+=ans;
      b=n;
      ans+=(b-a)/2;
    }
  }
  cout << ans << endl;
}


Fixed submission:
N,A,B=map(int,input().split())
if (B-A)%2==0:
    ans =(B-A)//2
else:
    if A-1 > N-B:
        ans = N-B+1
        A+=ans
        ans+=(N-A)//2
    else:
        ans =A
        B-=ans
        ans+=(B-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
a,b = (int(i) for i in input().split())
print(a * b // math.gcd(a, b))


Fixed submission:
# -*- coding: utf-8 -*-
import fractions
a,b = (int(i) for i in input().split())
print(a * b // fractions.gcd(a, b))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
S=str(input())
if(S="Sunny"):
    print('Cloudy')
elif(S="Cloudy"):
    print('Rainy')
else: print('Sunny')


Fixed submission:
# -*- coding: utf-8 -*-
S=str(input())
if(S=="Sunny"):
    print('Cloudy')
elif(S=="Cloudy"):
    print('Rainy')
else: print('Sunny')
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
#入力

N,K,Q=map(int,input().split())
a=[int(input()) for i in range(Q)]

for i in range(1,N+1,1):
    l=a.count(i)
    if(K+l-Q>0):print("Yes")
    else:print("No")


Fixed submission:
# -*- coding: utf-8 -*-
#入力

N,K,Q=map(int,input().split())
a=[int(input()) for _ in range(Q)]
b=[0]*N
for i in a:
    b[i-1]+=1
for l in range(0,N,1):
    if(K+b[l]-Q>0):print("Yes")
    else:print("No")

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#入力
N,K,Q=map(int,input().split())
a=[int(input()) for i in range(Q)]

for i in range(0,N,1):
    j=re.findall(i,a)
    if(K+len(j)-Q>0):print("Yes")
    else:print("No")


Fixed submission:
# -*- coding: utf-8 -*-
#入力

N,K,Q=map(int,input().split())
a=[int(input()) for _ in range(Q)]
b=[0]*N
for i in a:
    b[i-1]+=1
for l in range(0,N,1):
    if(K+b[l]-Q>0):print("Yes")
    else:print("No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=0
for i in range(N):
  if V[i]-C[i] >0:
    ans+=V[i]-C[i]
print(ans)


Fixed submission:
A,B,T=map(int,input().split())
print(int(B*((T+0.5)//A)))
Buggy python submission (verdict: Runtime Error):
N=int(input())
V=[int,input().split()]
C=[int,input().split()]
ans=0
for i in range(N):
  if V[i]-C[i] >0:
    ans+=V[i]-C[i]
print(ans)

Fixed submission:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=0
for i in range(N):
  if V[i]-C[i] >0:
    ans+=V[i]-C[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
h=list(map(int,input().split()))
INF=float('inf')
dp=[INF]*N
dp[0]=0
for i in range(N-1):
    for j in range(1,K+1,1):
        if i+j>N-1:
            break
        dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
print(dp[N-1])


Fixed submission:
N,K=map(int,input().split())
h=list(map(int,input().split()))
INF=float('inf')
dp=[INF]*N
dp[0]=0
for i in range(N-1):
    for j in range(1,K+1,1):
        if i+j>N-1:
            break
        dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
print(dp[N-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
h=list(map(int,input().split()))
INF=float('inf')
dp=[INF]*N
dp[0]=0
for i in range(1,N):
    for j in range(min(i,K)):
        dp[i]=min(dp[i],dp[i-j-1]+abs(h[i]-h[i-j-1]))
print(dp[-1])

Fixed submission:
N,K=map(int,input().split())
h=list(map(int,input().split()))
INF=float('inf')
dp=[INF]*N
dp[0]=0
for i in range(N-1):
    for j in range(1,K+1,1):
        if i+j>N-1:
            break
        dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,w=map(int,input().split())
weight=[]
value=[]
for _ in range(n):
    ww,vv=map(int,input().split())
    weight.append(ww)
    value.append(vv)
dp=[[0 for i in range(w+1)] for j in range(n+1)]
for i in range(0,n):
    for w_sum in range(w+1):
        if w_sum >= weight[i]:
            dp[i+1][w_sum]=max(dp[i+1][w_sum],dp[i][w_sum-weight[i]]+value[i])
        dp[i+1][w_sum]=max(dp[i+1][w_sum],dp[i][w_sum])
print(dp[n][w])


Fixed submission:
n,w=map(int,input().split())
weight=[]
value=[]
for _ in range(n):
    ww,vv=map(int,input().split())
    weight.append(ww)
    value.append(vv)
dp=[[0 for i in range(w+1)] for j in range(n+1)]
for i in range(0,n):
    for w_sum in range(w+1):
        if w_sum >= weight[i]:
            dp[i+1][w_sum]=max(dp[i+1][w_sum],dp[i][w_sum-weight[i]]+value[i])
        dp[i+1][w_sum]=max(dp[i+1][w_sum],dp[i][w_sum])
print(dp[n][w])
Buggy python submission (verdict: Runtime Error):
if X >= 30:
  print("Yes")
else:
  print("No")

Fixed submission:
X = int(input())
if X >= 30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
infty = int(1E9)
d = [[infty for i in range(n)] for j in range(n)]
edges = []

for i in range(n):
  d[i][i] = 0

for _ in range(m):
  x, y, c = map(int, input().split())
  x -= 1; y -= 1
  edges.append((x, y, c))
  d[x][y] = d[y][x] = c

for k in range(n):
  for i in range(n):
    for j in range(n):
      d[i][j] = min(d[i][j], d[i][k] + d[k][j])

ans = 0
for e in edges:
  x, y, c = e;
  need = False
  for i in range(n):
    for j in range(n):
      if d[i][j] == d[i][x] + d[j][y] + c:
        need = True
        break
  ans += not need

print(ans)

Fixed submission:
n, m = map(int, input().split())
infty = int(1E9)
d = [[infty for i in range(n)] for j in range(n)]
edges = []

for i in range(n):
  d[i][i] = 0

for _ in range(m):
  x, y, c = map(int, input().split())
  x -= 1; y -= 1
  edges.append((x, y, c))
  d[x][y] = d[y][x] = c

for k in range(n):
  for i in range(n):
    for j in range(n):
      d[i][j] = min(d[i][j], d[i][k] + d[k][j])

ans = 0
for e in edges:
  x, y, c = e;
  need = False
  for i in range(n):
    for j in range(n):
      if d[i][j] == d[i][x] + d[j][y] + c:
        need = True
        break
  ans += not need

print(ans)
Buggy python submission (verdict: Runtime Error):
_in = list(map(int, input().split()))
k = _in[0]
n = _in[1]
p = 0
_i = list(map(int, input().split()))
dis = 0
mdis = k - _i[n-1] + _i[0]
for i in range(0,n-2):
    dis = _i[i+1]- _i[i]
    if dis>mdis:
        mdis = dis
print(k-mdis)

Fixed submission:
s = str(input())
if s[2]==s[3] and s[4]==s[5]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
_in = list(map(int, input().split()))
k = _in[0]
n = _in[1]
p = 0
_i = list(map(int, input().split()))
dis = 0
mdis = k - _i[n-1] + _i[0]
for i in range(1,n-2):
    dis = _i[i+1]- _i[i]
    if dis>=mdis:
        mdis = dis
print(k-mdis)

Fixed submission:
s = str(input())
if s[2]==s[3] and s[4]==s[5]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
s = str(input())
if s[3]==s[4] && s[5]==s[6]:
    pritn("Yes")
else:
    print("No")

Fixed submission:
s = str(input())
if s[2]==s[3] and s[4]==s[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
x = int(input())
u = 0

def b(x,u):
    if x>=5:
        x-=5
        u+=5
        b(x,u)
    else:
        print(u)

def a(x,u):
    if x>=500:
        x-=500
        u+=1000
        a(x,u)
    else:
        b(x,u)

a(x,u)


Fixed submission:
x = int(input())
u = 0
def a(x,u):
    if x>=500:
        u+=1000 * (x // 500)
        x = x % 500
        a(x,u)
    elif x>=5:
        u+=5 * (x // 5)
        x = x % 5
        a(x,u)
    else:
        print(u)
a(x,u)

Buggy python submission (verdict: Runtime Error):
x = int(input())
u = 0

def b(x,u):
    if x>5:
        x-=5
        u+=5
        b(x,u)
    else:
        print(u)

def a(x,u):
    if x>500:
        x-=500
        u+=1000
        a(x,u)
    else:
        b(x,u)

a(x,u)

Fixed submission:
x = int(input())
u = 0
def a(x,u):
    if x>=500:
        u+=1000 * (x // 500)
        x = x % 500
        a(x,u)
    elif x>=5:
        u+=5 * (x // 5)
        x = x % 5
        a(x,u)
    else:
        print(u)
a(x,u)
Buggy python submission (verdict: Runtime Error):
i = list(map(int, input().split()))
N=i[0]
K=i[1]
def abc(N,K,x):
    if N-(K**x)>=0:
      abc(N,K,x+1)
    else:
        print(x)
abc(N,K,1)

Fixed submission:
i = list(map(int, input().split()))
if i[0]>9:
    print(i[1])
else:
    print(i[1]+1000-100*i[0])
Buggy python submission (verdict: Runtime Error):
N=int(input())
X=list(map(int, input().split()))
s=[]
for XP in range(min(X),max(X)):
    a=0
    for i in range(N):
        a+=(XP-X[i])**2
    s.append(a)
print(min(s))

Fixed submission:
N=int(input())
X=list(map(int, input().split()))
s=[]
for i in range(min(X),max(X)+1):
    a=0
    for i2 in range(N):
        a+=(i-X[i2])**2
    s.append(a)
print(min(s))
Buggy python submission (verdict: Runtime Error):
N=int(input())
i=list(map(int,input().split()))
a=0
for x in range(N):
    if i[x]%2==0:
        if i[x]%3!=0:
            if i[x]%5!=0:
                x+=1
if a==0:
    print("APPROVED")
else:
    print("DENIED")

Fixed submission:
a,b,c=input().split()
 
if a==b==c:
  print("No")
elif a==b!=c:
  print("Yes")
elif a==c!=b:
  print("Yes")
elif a!=b==c:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N=int(input())
i=list(map(int,input().split()))
x=0
for x in range(N):
  if x%2==0:
    if x%3!=0:
      if x%5!=0:
        x+=1
if x==0:
  print("APPROVED")
else:
  print("DENIED")

Fixed submission:
a,b,c=input().split()
 
if a==b==c:
  print("No")
elif a==b!=c:
  print("Yes")
elif a==c!=b:
  print("Yes")
elif a!=b==c:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N=int(input())
i=list(map(int,input().split()))
x=0
for x in range(N):
  if x%2==0:
    if x%3!=0:
      if x%5!=0:
        x+=1
if x==0:
  return "APPROVED"
else:
  return "DENIED"

Fixed submission:
a,b,c=input().split()
 
if a==b==c:
  print("No")
elif a==b!=c:
  print("Yes")
elif a==c!=b:
  print("Yes")
elif a!=b==c:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
s = str(raw_input())
k=n/2
if s[0:h] == s[h:n]:
    print 'Yes'
else:
    print 'No'


Fixed submission:
r=int(input())
print(r*r)
Buggy python submission (verdict: Runtime Error):
n=int(input())
k=n/2;
s=input()
p=s[k:]
t=s[:k]
if p=t print 'Yes' else print 'No'

Fixed submission:
n = int(raw_input())
s = str(raw_input())
h=n/2
if s[0:h] == s[h:n]:
    print 'Yes'
else:
    print 'No'

Buggy python submission (verdict: Runtime Error):
n=int(input())
k=n/2;
s=input()
p=s[k:]
t=s[:k]
if p=t print 'Yes' else print 'No'

Fixed submission:
n = int(raw_input())
s = str(raw_input())
h=n/2
if s[0:h] == s[h:n]:
    print 'Yes'
else:
    print 'No'
Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = [int(a) for a in list(input().split())]
X = abs(X)
for i in range(X//D):
    X -= D
    K -= 1
    if K == 0:
        print(abs(X))
        exit()
if K % 2 == 0:
    print(X)
else:
    print(abs(X-D))

Fixed submission:
X, K, D = [int(a) for a in list(input().split())]
X = abs(X) 
q = X//D
r = X%D
if q >= K:
    print(X - D*K)
    exit()
rem = K - q
if rem % 2 == 0:
    print(r)
else:
    print(abs(D-r))