Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

mod=1000000007
def mpow2(n):
    ret=1
    while n>0:
        ret*=2
        ret%=mod
        n-=1
    return ret

def gcd(a,b):
    if a<0:
        a*=-1
    if b<0:
        b*=-1
    if a<b:
        a,b=b,a
    if a%b:
        return gcd(b,a%b)
    return b

shift=2**64
d=defaultdict(int)
n=int(input())
l=[]
cnt0=0
for i in range(n):
    a,b=map(int,input().split())
    if a==b==0:
        cnt0+=1
        continue
    g=gcd(a,b)
    a//=g
    b//=g
    l.append((a,b))
    d[a*shift+b]+=1
res=1
for p in l:
    a=p[0]
    b=p[1]
    c=d[a*shift+b]+d[-a*shift-b]
    if c==0:
        continue
    d[a*shift+b]=0
    d[-a*shift-b]=0
    a=-p[1]
    b=p[0]
    cc=d[a*shift+b]+d[-a*shift-b]
    d[a*shift+b]=0
    d[-a*shift-b]=0
    if cc==0:
        res*=mpow2(c)
        res%=mod
    else:
        res*=mpow2(c)+mpow2(cc)-1
        res%=mod
print((res+cnt0+mod-1)%mod)


Fixed submission:
from collections import defaultdict

mod=1000000007
def mpow2(n):
    ret=1
    while n>0:
        ret*=2
        ret%=mod
        n-=1
    return ret

def gcd(a,b):
    if a<0:
        a*=-1
    if b<0:
        b*=-1
    if a<b:
        a,b=b,a
    if a%b:
        return gcd(b,a%b)
    return b

shift=2**64
d=defaultdict(int)
n=int(input())
l=[]
cnt0=0
for i in range(n):
    a,b=map(int,input().split())
    if a==b==0:
        cnt0+=1
        continue
    elif a==0:
        b=1
    elif b==0:
        a=1
    else:
        g=gcd(a,b)
        a//=g
        b//=g
    l.append((a,b))
    d[a*shift+b]+=1
res=1
for p in l:
    a=p[0]
    b=p[1]
    c=d[a*shift+b]+d[-a*shift-b]
    if c==0:
        continue
    d[a*shift+b]=0
    d[-a*shift-b]=0
    a=-p[1]
    b=p[0]
    cc=d[a*shift+b]+d[-a*shift-b]
    d[a*shift+b]=0
    d[-a*shift-b]=0
    if cc==0:
        res*=mpow2(c)
        res%=mod
    else:
        res*=mpow2(c)+mpow2(cc)-1
        res%=mod
print((res+cnt0+mod-1)%mod)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,m,x=map(int,input().split())
c=[None for i in range(n)]
a=[None for i in range(n)]
for i in range(n):
    l=[int(i) for i in input().split()]
    c[i]=l[0]
    a[i]=np.array(l[1:])
mincos=1000000000000
for mask in range(2**n):
    rikai=np.zeros(m,dtype="int32")
    cos=0
    mm=mask
    for i in range(n):
        if mm%2:
            rikai+=a[i]
            cos+=c[i]
        mm//=2
    if np.all(rikai>=x):
        mincos=min(cos,mincos)

if mincos==1000000000000:
    print(-1)
else:
    print(mincos)


Fixed submission:
import sys
s=input()
t=input()
for c in ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]:
    if s+c==t:
        print("Yes")
        sys.exit(0)
print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,m,x=map(int,input().split())
c=[None for i in range(n)]
a=[None for i in range(n)]
for i in range(n):
    l=[int(i) for i in input().split()]
    c[i]=l[0]
    a[i]=np.array(l[1:])
mincos=1000000000000
for mask in range(2**n):
    rikai=np.zeros(m,dtype="int32")
    cos=0
    mm=mask
    for i in range(n):
        if mm%2:
            rikai+=a[i]
            cos+=c[i]
        mm//=2
    if np.all(rikai>=x):
        mincos=min(cos,mincos)

if mincos==1000000000000:
    print(-1)
else:
    print(mincos)


Fixed submission:
import numpy as np
n,m,x=map(int,input().split())
c=[None for i in range(n)]
a=[None for i in range(n)]
for i in range(n):
    l=[int(i) for i in input().split()]
    c[i]=l[0]
    a[i]=np.array(l[1:])
mincos=1000000000000
for mask in range(2**n):
    rikai=np.zeros(m,dtype="int32")
    cos=0
    mm=mask
    for i in range(n):
        if mm%2:
            rikai+=a[i]
            cos+=c[i]
        mm//=2
    if np.all(rikai>=x):
        mincos=min(cos,mincos)

if mincos==1000000000000:
    print(-1)
else:
    print(mincos)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
mp={}
m=0
for i in range(n):
  s=input()
  if s in mp.keys():
    mp[s]+=1
    m=max(m,mp[s])
  else:
    mp[s]=1
    m=max(m,1)
for s in sorted(mp.keys()):
  if mp[s]==m:
    print(s)

Fixed submission:
n=int(input())
l=[None for i in range(n)]
for i in range(n):
    l[i]=input()
l.sort()
m=0
now=l[0]
cnt=1
ll=[[] for i in range(n+1)]
for i in range(1,n):
    if l[i]!=now:
        m=max(m,cnt)
        ll[cnt].append(now)
        now=l[i]
        cnt=1
    else:
        cnt+=1
m=max(m,cnt)
ll[cnt].append(now)
for s in ll[m]:
    print(s)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
t=input()
for i in range(n):
  print(s[i],end="")
  print(t[i],end="")


Fixed submission:
n=int(input())
s,t=input().split()
for i in range(n):
  print(s[i],end="")
  print(t[i],end="")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a+b+c=>22:
  print("bust")
else:
  print("win")

Fixed submission:
a,b,c=map(int,input().split())
if a+b+c>=22:
  print("bust")
else:
  print("win")
Buggy python submission (verdict: Runtime Error):
dp=[0 for i in range(100001)]
dp[0]=1
a=[i for i in range(100,106)]
for i in range(100001):
  if dp[i]==1:
    for j in a:
      dp[i+j]=1
print(dp[int(input())])

Fixed submission:
dp=[0 for i in range(100110)]
dp[0]=1
a=[i for i in range(100,106)]
for i in range(100000):
  if dp[i]==1:
    for j in a:
      dp[i+j]=1
print(dp[int(input())])
Buggy python submission (verdict: Runtime Error):
l={"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print(s[input()])

Fixed submission:
l={"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print(l[input()])
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
x=s[int(input())]
for i in range(n):
  if s[i]==x:
    print(x,end="")
  else:
    print("*",end="")

Fixed submission:
n=int(input())
s=input()
x=s[int(input())-1]
for i in range(n):
  if s[i]==x:
    print(x,end="")
  else:
    print("*",end="")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(1000000)

def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(j-i,i)

n=int(input())
l=[int(i) for i in input().split()]
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(j-i,i)

n=int(input())
l=[int(i) for i in input().split()]
l.sort()
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(1000000)

def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(i,j-i)

n=int(input())
l=[int(i) for i in input().split()]
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(j-i,i)

n=int(input())
l=[int(i) for i in input().split()]
l.sort()
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(i,j-i)

n=int(input())
l=[int(i) for i in input().split()]
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(j-i,i)

n=int(input())
l=[int(i) for i in input().split()]
l.sort()
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)

Buggy python submission (verdict: Runtime Error):
def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(i,j-i)

n=int(input())
l=[int(i) for i in input().split()]
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

def gcd(i,j):
  if i>j:
    i,j=j,i
  if j%i==0:
    return i
  return gcd(j-i,i)

n=int(input())
l=[int(i) for i in input().split()]
l.sort()
g=gcd(l[0],l[1])
for i in range(2,len(l)):
  g=gcd(g,l[i])
print(g)
Buggy python submission (verdict: Time Limit Exceeded):
def f(x,a):
    while x>0:
        a*=10
        x//=10
    return a

n,m=map(int,input().split())
cost=[0,2,5,5,4,5,6,3,7,6]
la=[int(i) for i in input().split()]
la.sort()
ma=[0 for i in range(10010)]
for a in la:
    ma[cost[a]]=a
for i in range(2,n+1):
    if ma[i]==0:
        continue
    for a in la:
        ma[i+cost[a]]=max(ma[i+cost[a]],max(ma[i]*10+a,ma[i]+f(ma[i],a)))
print(ma[n])

Fixed submission:
def greater(a,b):
    if len(a)>len(b):
        return a
    elif len(b)>len(a):
        return b
    for i in range(len(a)):
        if a[i]<b[i]:
            return b
        if b[i]<a[i]:
            return a
    return a

cost=[0,2,5,5,4,5,6,3,7,6]
n,m=map(int,input().split())
la=[int(a) for a in input().split()]
la.sort()
sa=[str(a) for a in la]
ca=[cost[a] for a in la]
max=[None for i in range(10010)]
for i in range(m):
    max[ca[i]]=sa[i]
for i in range(2,n):
    if max[i]==None:
        continue
    for j in range(m):
        if max[i][0]>sa[j]:
            k=max[i]+sa[j]
        else:
            k=sa[j]+max[i]
        if max[i+ca[j]]==None:
            max[i+ca[j]]=k
        else:
            max[i+ca[j]]=greater(max[i+ca[j]],k)
print(max[n])
Buggy python submission (verdict: Time Limit Exceeded):
flg=[False for i in range(1000001)]
a=int(input())
flg[a]=True
for i in range(2,10000000000000):
  if a%2==0:
    a//=2
  else:
    a=3*a+1
  if flg[a]:
    break
print(i)

Fixed submission:
flg=[False for i in range(1000001)]
a=int(input())
flg[a]=True
for i in range(2,10000000000000):
  if a%2==0:
    a//=2
  else:
    a=3*a+1
  if flg[a]:
    break
  flg[a]=True
print(i)
Buggy python submission (verdict: Runtime Error):
def solve():
  s=input()
  for l in range(len(s)):
    for r in range(l,len(s)):
      if "keyence" in a[:l]+a[r:]:
        print("YES")
        return
  print("NO")

solve()

Fixed submission:
def solve():
  s=input()
  for l in range(len(s)):
    for r in range(l,len(s)+1):
      if "keyence"==s[:l]+s[r:]:
        print("YES")
        return
  print("NO")

solve()
Buggy python submission (verdict: Runtime Error):
def do(level,x):
    if x<=0: #1層も手を付けないとき
        return 0
    elif x>=whole[level]: #完食できるとき
        return patty[level]
    #それ以外、途中まで食べるときはlevel>=1の場合のみあり得る
    x-=1 #このとき1層目は必ずバンズ
    res=0 ＃食べたパティの総数を記録する
    if x>=whole[level-1]+1: #真ん中のパティまで到達できるとき
        x-=whole[level-1]+1
        res+=patty[level-1]+1
    return res+do(level-1,x)

n,x=map(int,input().split())
whole=[1]+[0]*50
patty=[1]+[0]*50
for i in range(1,n+1):
    whole[i]=whole[i-1]*2+3
    patty[i]=patty[i-1]*2+1
res=0
print(do(n,x))

Fixed submission:
def do(level,x):
    if x<=0:
        return 0
    if level==0:
        return 1
    res=0
    x-=1
    if x>j[level-1]:
        x-=j[level-1]+1
        res+=k[level-1]+1
    return res+do(level-1,x)

n,x=map(int,input().split())
j=[1]+[0]*50
k=[1]+[0]*50
for i in range(1,n+1):
    j[i]=j[i-1]*2+3
    k[i]=k[i-1]*2+1
res=0
print(do(n,x))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=map(int,input().split())
su=sum(l)
best=10000000000000000
res=0
for i in range(len(l)):
  if(su-n*l[i]<best):
    best=su-n*l[i]
    res=i
print(res)

Fixed submission:
n=int(input())
s=input().split()
l=[int(s[i]) for i in range(n)]
su=sum(l)
best=10000000000000000
res=0
for i in range(n):
  if(abs(su-n*l[i])<best):
    best=abs(su-n*l[i])
    res=i
print(res)
Buggy python submission (verdict: Runtime Error):
import bisect
n,m = map(int,input().split())

l1 = [[] for i in range(n)]
l2 = []

for i in range(m):
    p,y = map(int,input().split())
    l1[p-1].append(y)
    l2.append((p,y))

for p in range(n):
    l1[p].sort()

for i in range(m):
    p = l2[i][0]
    k = bisect.right(l1[p-1],l2[i][1])
    p = str(p)
    k = str(k)
    ans = "0"*(6-len(p))+p+"0"*(6-len(k))+k
    print(ans)


Fixed submission:
s=input().split()
n=int(s[0])
m=int(s[1])
l=[[] for i in range(100000)]
d=[{} for i in range(100000)]
inp=[]
for i in range(m):
    s=input().split()
    p=int(s[0])
    y=int(s[1])
    inp.append((p,y))
    l[p-1].append(y)
for i in range(100000):
    l[i].sort()
for i in range(100000):
    cnt=1
    for j in l[i]:
        d[i][j]=cnt
        cnt+=1
for pa in inp:
    L=pa[0]
    R=d[L-1][pa[1]]
    L=str(L)
    R=str(R)
    for i in range(6-len(L)):
        print("0",end="")
    print(L,end="")
    for i in range(6-len(R)):
        print("0",end="")
    print(R)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

l1 = [[] for i in range(n)]
l2 = []

for i in range(m):
    p,y = map(int,input().split())
    l1[p-1].append(y)
    l2.append((p,y))

for p in range(n):
    l1[p].sort()

for i in range(m):
    p = l2[i][0]
    k = l1[p-1].index(l2[i][1])+1
    p = str(p)
    k = str(k)
    ans = "0"*(6-len(p))+p+"0"*(6-len(k))+k
    print(ans)


Fixed submission:
s=input().split()
n=int(s[0])
m=int(s[1])
l=[[] for i in range(100000)]
d=[{} for i in range(100000)]
inp=[]
for i in range(m):
    s=input().split()
    p=int(s[0])
    y=int(s[1])
    inp.append((p,y))
    l[p-1].append(y)
for i in range(100000):
    l[i].sort()
for i in range(100000):
    cnt=1
    for j in l[i]:
        d[i][j]=cnt
        cnt+=1
for pa in inp:
    L=pa[0]
    R=d[L-1][pa[1]]
    L=str(L)
    R=str(R)
    for i in range(6-len(L)):
        print("0",end="")
    print(L,end="")
    for i in range(6-len(R)):
        print("0",end="")
    print(R)

Buggy python submission (verdict: Runtime Error):
s=input().split()
n,m=int(s[0]),int(s[1])
l=[[] for i in range(100001)]
d=[{} for i in range(100001)]
inp=[]
for i in range(m):
    s=input().split()
    p,y=int(s[0]),int(s[1])
    inp.append((p,y))
    l[p].append(y)
for i in range(100001):
    l[i].sort()
for i in range(100001):
    cnt=1
    for j in l[i]:
        d[i][j]=cnt
        cnt+=1
for pa in inp:
    print(str(pa[0]).zfill(6)+str(d[pa[0]-1][pa[1]]).zfill(6))

Fixed submission:
s=input().split()
n=int(s[0])
m=int(s[1])
l=[[] for i in range(100000)]
d=[{} for i in range(100000)]
inp=[]
for i in range(m):
    s=input().split()
    p=int(s[0])
    y=int(s[1])
    inp.append((p,y))
    l[p-1].append(y)
for i in range(100000):
    l[i].sort()
for i in range(100000):
    cnt=1
    for j in l[i]:
        d[i][j]=cnt
        cnt+=1
for pa in inp:
    L=pa[0]
    R=d[L-1][pa[1]]
    L=str(L)
    R=str(R)
    for i in range(6-len(L)):
        print("0",end="")
    print(L,end="")
    for i in range(6-len(R)):
        print("0",end="")
    print(R)
Buggy python submission (verdict: Runtime Error):
n,t=input().split()
n=int(n)
t=int(t)
res=10000
for i in range(n):
  s=input().split()
  if int(s[1])<=T:
    res=min(res,int(s[0]))
if res==10000:
  print("TLE")
else:
  print(res)

Fixed submission:
n,t=input().split()
n=int(n)
t=int(t)
res=10000
for i in range(n):
  s=input().split()
  if int(s[1])<=t:
    res=min(res,int(s[0]))
if res==10000:
  print("TLE")
else:
  print(res)
Buggy python submission (verdict: Runtime Error):
import numpy as np
s=input().split()
l=[int(s[i]) for i in range(4)]
v1=np.array([l[0],l[1]])
v2=np.array([l[2],l[3]])
v=v2-v1
A=np.array([[0,-1],[1,0]])
v3=v2+np.dot(A,v)
v=v3-v2
v4=v3+np.dot(A,v)
print(v3[0],v3[1],v4[0],v4[1])

Fixed submission:
import numpy as np
s=input().split()
l=[int(s[i]) for i in range(4)]
v1=np.array([l[0],l[1]])
v2=np.array([l[2],l[3]])
v=v2-v1
A=np.array([[0,-1],[1,0]])
v3=v2+np.dot(A,v)
v=v3-v2
v4=v3+np.dot(A,v)
print(v3[0],v3[1],v4[0],v4[1])
Buggy python submission (verdict: Runtime Error):
l=int(input())-1
s=bin(l)[2:]
if s.count("0")==0:
    n=len(s)+1
    print(str(n-1)+" "+str(2*(n-1)))
    for i in range(n-1):
        print(str(i+1)+" "+str(i+2)+" 0")
        print(str(i+1)+" "+str(i+2)+" "+str(2**i))
else:
    n=len(s)
    res=""
    for i in range(n-1):
        res+=str(i+1)+" "+str(i+2)+" 0\n"
        res+=str(i+1)+" "+str(i+2)+" "+str(2**i)+"\n"
    while s.count("1")>1:
        if s[-1]=="1":
            for i in range(1,n+1):
                if s[-i]=="0":
                    break
            ss=s[:-i]+"0"*i
            nnn=int(ss,2)
            res+=str(i)+" "+str(n)+" "+str(nnn)+"\n"
            s=bin(nnn-1)[2:]
            if len(s)<n:
                break
        else:
            res+="1 "+str(n)+" "+str(l)+"\n"
            s=bin(l-1)[2:]
r=res.count("\n")
res=res[:-1]
print(str(n)+" "+str(r))
print(res)


Fixed submission:
l=int(input())-1
s=bin(l)[2:]
if s.count("0")==0:
    n=len(s)+1
    print(str(n)+" "+str(2*(n-1)))
    for i in range(n-1):
        print(str(i+1)+" "+str(i+2)+" 0")
        print(str(i+1)+" "+str(i+2)+" "+str(2**i))
else:
    n=len(s)
    res=""
    for i in range(n-1):
        res+=str(i+1)+" "+str(i+2)+" 0\n"
        res+=str(i+1)+" "+str(i+2)+" "+str(2**i)+"\n"
    while True:
        if s[-1]=="1":
            for i in range(1,n+1):
                if s[-i]=="0":
                    break
            ss=s[:-i]+"0"*i
            nnn=int(ss,2)
            res+=str(i)+" "+str(n)+" "+str(nnn)+"\n"
            s=bin(nnn-1)[2:]
            if len(s)<n:
                break
        else:
            res+="1 "+str(n)+" "+str(l)+"\n"
            if s.count("1")>1:
                s=bin(l-1)[2:]
            else:
                break
    r=res.count("\n")
    res=res[:-1]
    print(str(n)+" "+str(r))
    print(res)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,m=map(int,input().split())
arr=[]
for i in range(n):
    l=[ord(c)-46 for c in input()]
    if l.count(0)==m:
        continue
    arr.append(l)
a=np.array(arr)
a=a.T
b=[]
for i in range(len(a)):
    if list(a[i]).count(0)==len(a[i]):
        continue
    b.append(list(a[i]))
b=list(np.array(b).T)
for l in b:
    for x in l:
        if x==0:
            print(".",end="")
        else:
            print("#",end="")
    print()


Fixed submission:
import numpy as np
n,m=map(int,input().split())
arr=[]
for i in range(n):
    l=[ord(c)-46 for c in input()]
    if l.count(0)==m:
        continue
    arr.append(l)
a=np.array(arr)
a=a.T
b=[]
for i in range(len(a)):
    if list(a[i]).count(0)==len(a[i]):
        continue
    b.append(list(a[i]))
b=list(np.array(b).T)
for l in b:
    for x in l:
        if x==0:
            print(".",end="")
        else:
            print("#",end="")
    print()
Buggy python submission (verdict: Runtime Error):
s=input()
k=int(input())
if s[:k]=="1"*k:
    print("1")
else:
    i=0
    while True:
        if s[i]!="1":
            print(s[i])
            break
        i+=1


Fixed submission:
import sys
s=input()
k=int(input())
if k<105:
    if s[:k]=="1"*k:
        print("1")
        sys.exit(0)
i=0
while True:
    if s[i]!="1":
        print(s[i])
        break
    i+=1

Buggy python submission (verdict: Runtime Error):
ss=input()
l=len(s)
if s=="1"*l:
    print("1")
else:
    i=0
    while True:
        if s[i]!="1":
            print(s[i])
            break
        i+=1


Fixed submission:
import sys
s=input()
k=int(input())
if k<105:
    if s[:k]=="1"*k:
        print("1")
        sys.exit(0)
i=0
while True:
    if s[i]!="1":
        print(s[i])
        break
    i+=1
Buggy python submission (verdict: Runtime Error):
import bisect
def put(a,b):
    l=max(len(a),len(b))
    a="0"*l+a
    b="0"*l+b
	s=""
    for i in range(-1,-l-1,-1):
      s+=a[i]+b[i]
    print(s[-1::-1])

def quad(i):
    s=""
    while i>0:
        s+=str(i%4)
        i//=4
    return s[-1::-1]

l=[0,1]
for i in range(1,18):
    l+=[4**i+j for j in l]

n=int(input())
for i in range(len(l)):
    if (n-l[i])%2==0:
        ind=bisect.bisect_left(l,(l[i]-n)//2)
        if l[i]-2*l[ind]==n:
            put(quad(l[i]),quad(l[ind]))
            break


Fixed submission:
def f(n):
    s=""
    while n>0:
        s=str(n%2)+s
        n//=2
        if n==0:
            break
        if n%2==1:
            n+=2
            s="1"+s
        else:
            s="0"+s
        n//=2
    return s

n=int(input())
if n==0:
    print(0)
elif n<0:
    print(f(n*(-2))[:-1])
else:
    print(f(n))

Buggy python submission (verdict: Runtime Error):
import bisect
def put(a,b):
    l=max(len(a),len(b))
    a="0"*l+a
    b="0"*l+a
	s=""
    for i in range(-1,-l-1,-1):
      s+=a[i]+b[i]
    print(s[-1::-1])

def quad(i):
    s=""
    while i>0:
        s+=str(i%4)
        i//=4
    return s[-1::-1]

l=[0,1]
for i in range(1,18):
    l+=[4**i+j for j in l]

n=int(input())
for i in range(len(l)):
    if (n-l[i])%2==0:
        ind=bisect.bisect_left(l,(l[i]-n)//2)
        if l[i]-2*l[ind]==n:
            put(quad(l[i]),quad(l[ind]))
            break


Fixed submission:
def f(n):
    s=""
    while n>0:
        s=str(n%2)+s
        n//=2
        if n==0:
            break
        if n%2==1:
            n+=2
            s="1"+s
        else:
            s="0"+s
        n//=2
    return s

n=int(input())
if n==0:
    print(0)
elif n<0:
    print(f(n*(-2))[:-1])
else:
    print(f(n))

Buggy python submission (verdict: Runtime Error):
import bisect
def put(a,b):
 	l=max(len(a),len(b))
    a="0"*l+a
    b="0"*l+a
	s=""
    for i in range(-1,-l-1,-1):
      s+=a[i]+b[i]
    print(s[-1::-1])

def quad(i):
    s=""
    while i>0:
        s+=str(i%4)
        i//=4
    return s[-1::-1]

l=[0,1]
for i in range(1,18):
    l+=[4**i+j for j in l]

n=int(input())
for i in range(len(l)):
    if (n-l[i])%2==0:
        ind=bisect.bisect_left(l,(l[i]-n)//2)
        if l[i]-2*l[ind]==n:
            put(quad(l[i]),quad(l[ind]))
            break


Fixed submission:
def f(n):
    s=""
    while n>0:
        s=str(n%2)+s
        n//=2
        if n==0:
            break
        if n%2==1:
            n+=2
            s="1"+s
        else:
            s="0"+s
        n//=2
    return s

n=int(input())
if n==0:
    print(0)
elif n<0:
    print(f(n*(-2))[:-1])
else:
    print(f(n))
Buggy python submission (verdict: Runtime Error):
import bisect
def put(a,b):
    a+="0"*20
    b+="0"*20
    s=""
    for  i in range(20):
        s+=a[i]+b[i]
    s=s[-1::-1]
    ind=s.find("1")
    if ind==-1:
        print(0)
    else:
        s=s[ind:]
        print(s[-1::-1])
 
def quad(i):
    s=""
    while i>0:
        s+=str(i%4)
        i//=4
    return s[-1::-1]
 
l=[0,1]
for i in range(1,22):
    l+=[4**i+j for j in l]
 
n=int(input())
for i in range(len(l)):
    if (n-l[i])%2==0:
        ind=bisect.bisect_left(l,(l[i]-n)//2)
        if l[i]-2*l[ind]==n:
            put(quad(l[i]),quad(l[ind]))
            break

Fixed submission:
s=input().split()
n,m=int(s[0]),int(s[1])
s=input().split()
l=[0]
for i in range(n):
    l.append((l[-1]+int(s[i]))%m)
l.sort()
j=-1
cnt=-100
ll=[]
for i in range(len(l)):
    cnt+=1
    if j!=l[i]:
        j=l[i]
        ll.append(cnt)
        cnt=0
ll.append(cnt+1)
res=0
for i in ll:
    if i>1:
        res+=(i*(i-1))//2
print(res)
Buggy python submission (verdict: Runtime Error):
s=input().split()^M
print(-int(s[0])+(int(s[1])-int(s[0])-1)*(int(s[1])-int(s[0]))//2)

Fixed submission:
s=input().split()
print(-int(s[0])+(int(s[1])-int(s[0])-1)*(int(s[1])-int(s[0]))//2)

Buggy python submission (verdict: Runtime Error):
s=input().split()
print(int[1]-(int(s[1])-int(s[0])-1)*(int(s[1])-int(s[0]))/2)

Fixed submission:
s=input().split()
print(-int(s[0])+(int(s[1])-int(s[0])-1)*(int(s[1])-int(s[0]))//2)