Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N,M=map(int,input().split())
come=[]
for i in range(M):
  ab=list(map(int,input().split()))
  if ab[0]==1:
    if ab[1] in come:
      print("POSSIBLE")
      sys.exit()
    come+=[ab[1]]
  if ab[1]==N:
    if ab[0] in come:
      print("POSSIBLE")
      sys.exit()
    come+=[ab[0]]
 
print("IMPOSSIBLE")

Fixed submission:
import sys
N,M=map(int,input().split())
come=[0]*N
for i in range(M):
  ab=list(map(int,input().split()))
  if ab[0]==1:
    if come[ab[1]]:
      print("POSSIBLE")
      sys.exit()
    come[ab[1]]=1
  if ab[1]==N:
    if come[ab[0]]:
      print("POSSIBLE")
      sys.exit()
    come[ab[0]]=1
 
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N,M=map(int,input().split())
ab=[]
for i in range(M):
  ab+=[list(map(int,input().split()))]
come=[]
go=[]
for i in range(M):
  if ab[i][0]==1:
    if ab[i][1] in come:
      print("POSSIBLE")
      sys.exit()
    come+=[ab[i][1]]
  if ab[i][1]==N:
    if ab[i][0] in come:
      print("POSSIBLE")
      sys.exit()
    come+=[ab[i][0]]
 
print("IMPOSSIBLE")

Fixed submission:
import sys
N,M=map(int,input().split())
come=[0]*N
for i in range(M):
  ab=list(map(int,input().split()))
  if ab[0]==1:
    if come[ab[1]]:
      print("POSSIBLE")
      sys.exit()
    come[ab[1]]=1
  if ab[1]==N:
    if come[ab[0]]:
      print("POSSIBLE")
      sys.exit()
    come[ab[0]]=1
 
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N,M=map(int,input().split())
ab=[]
for i in range(M):
  ab+=[list(map(int,input().split()))]
come=[]
go=[]
for i in range(M):
  if ab[i][0]==1:
    come+=[ab[i][1]]
    if ab[i][1] in go:
      print("POSSIBLE")
      sys.exit()
  if ab[i][1]==N:
    go+=[ab[i][0]]
    if ab[i][0] in come:
      print("POSSIBLE")
      sys.exit()
 
print("IMPOSSIBLE")

Fixed submission:
import sys
N,M=map(int,input().split())
come=[0]*N
for i in range(M):
  ab=list(map(int,input().split()))
  if ab[0]==1:
    if come[ab[1]]:
      print("POSSIBLE")
      sys.exit()
    come[ab[1]]=1
  if ab[1]==N:
    if come[ab[0]]:
      print("POSSIBLE")
      sys.exit()
    come[ab[0]]=1
 
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N,M=map(int,input().split())
ab=[]
for i in range(M):
  ab+=[list(map(int,input().split()))]
come=[]
go=[]
for i in range(M):
  if ab[i][0]==1:
    come+=[ab[i][1]]
  if ab[i][1]==N:
    go+=[ab[i][0]]
for i in range(len(come)):
  if come[i] in go:
    print("POSSIBLE")
    sys.exit()
print("IMPOSSIBLE")

Fixed submission:
import sys
N,M=map(int,input().split())
come=[0]*N
for i in range(M):
  ab=list(map(int,input().split()))
  if ab[0]==1:
    if come[ab[1]]:
      print("POSSIBLE")
      sys.exit()
    come[ab[1]]=1
  if ab[1]==N:
    if come[ab[0]]:
      print("POSSIBLE")
      sys.exit()
    come[ab[0]]=1
 
print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
N,K=map(int, input().split())
A=list(map(int, input().split())) 
A.sort(reverse=1)
m=A[0]
for i in range(N-1):
  if A[i]!=A[i+1]:
    m=min(m,A[i]-A[i+1])
amari=[0]*m
for j in range(m):
  for i in range(N):
    if A[i]%m==j:
      amari[j]=1
      break
n=K%m
if K>A[0]:
  print("IMPOSSIBLE")
elif amari[n]:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

Fixed submission:
import sys
N,K=map(int, input().split())
A=list(map(int, input().split())) 
A.sort(reverse=1)
m=A[0]
for i in range(N-1):
  if A[i]!=A[i+1]:
    m=min(m,A[i]-A[i+1])

n=K%m
if K>A[0]:
  print("IMPOSSIBLE")
  sys.exit()
for i in range(N):
  if A[i]%m==n:
    print("POSSIBLE")
    sys.exit()

print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
N,K=map(int, input().split())
A=list(map(int, input().split())) 
A.sort(reverse=1)
m=A[0]
for i in range(N-1):
  m=min(m,A[i]-A[i+1])
amari=[0]*m
for j in range(m):
  for i in range(N):
    if A[i]%m==j:
      amari[j]=1
n=K%m
if K>A[0]:
  print("IMPOSSIBLE")
elif amari[n]:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

Fixed submission:
import sys
N,K=map(int, input().split())
A=list(map(int, input().split())) 
A.sort(reverse=1)
m=A[0]
for i in range(N-1):
  if A[i]!=A[i+1]:
    m=min(m,A[i]-A[i+1])

n=K%m
if K>A[0]:
  print("IMPOSSIBLE")
  sys.exit()
for i in range(N):
  if A[i]%m==n:
    print("POSSIBLE")
    sys.exit()

print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
ab=[]
for i in range(N-1):
  ab.append(list(map(int, input().split())))

def BFS(i):
  dist=[0]*N
  d=[-1]*N
  d[i]=0#未訪問ならd=-1,訪問済みならiからの距離
  que=[i]
  dist=1
  while que:
    for j in range(len(que)):
      label=que.pop(0)+1
      for i in range(N-1):
        if ab[i][0]==label and d[ab[i][1]-1]==-1:
          d[ab[i][1]-1]=dist
          que+=[ab[i][1]-1]
        if ab[i][1]==label and d[ab[i][0]-1]==-1:
          d[ab[i][0]-1]=dist
          que+=[ab[i][0]-1]
    dist+=1
  return(d)

dist1=BFS(0)
dist2=BFS(N-1)
Fe=0
Su=0
for i in range(N):
  if dist1[i]<=dist2[i]:
    Fe+=1
  else:
    Su+=1
if Fe>Su:
  print("Fennec")
else:
  print("Snuke")

Fixed submission:
N=int(input())
ab=[]
for i in range(N-1):
  ab.append(list(map(int, input().split())))
A=[ [] for i in range(N) ]
for i in range(N-1):
  A[ab[i][0]-1]+=[ab[i][1]-1]
  A[ab[i][1]-1]+=[ab[i][0]-1]

def BFS(i,A):
  dist=[0]*N
  d=[-1]*N
  d[i]=0#未訪問ならd=-1,訪問済みならiからの距離
  que=[i]
  dist=1
  while que:
    for j in range(len(que)):
      label=que.pop(0)
      for i in range(len(A[label])):
        if d[A[label][i]]==-1:
          d[A[label][i]]=dist
          que+=[A[label][i]]
    dist+=1
  return(d)

dist1=BFS(0,A)
dist2=BFS(N-1,A)
Fe=0
Su=0
for i in range(N):
  if dist1[i]<=dist2[i]:
    Fe+=1
  else:
    Su+=1
if Fe>Su:
  print("Fennec")
else:
  print("Snuke")
Buggy python submission (verdict: Runtime Error):
,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
if odd==0:
  if P==1: print(0)
  else: print(2**N)
else:
  print(2**(N-1))

Fixed submission:
N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
if odd==0:
  if P==1: print(0)
  else: print(2**N)
else:
  print(2**(N-1))

Buggy python submission (verdict: Runtime Error):
N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
    break
if odd==0:
  if P==1: print(0)
  else: print(2**N)
else:
  print(2**(N-1))

Fixed submission:
N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
if odd==0:
  if P==1: print(0)
  else: print(2**N)
else:
  print(2**(N-1))

Buggy python submission (verdict: Time Limit Exceeded):
import math
def comb(n,r):
  if r>n: return 0
  else: return int(math.factorial(n)/(math.factorial(r)*math.factorial(n-r)))

N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
even=0
a=0
for i in range(N):
  if A[i]%2==0: even+=1
  else: odd+=1
  a+=A[i]
if (a-P)%2==0: flag=0
else: flag=1
n=2**even

ans=0
if flag==0:#evenの場合
  for i in range(odd//2+1):
    ans+=comb(odd,2*i)
else:#oddの場合
  for i in range(2*(n+1)//2+1):
    ans+=comb(odd,1+2*i)
print(ans*n)

Fixed submission:
N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
if odd==0:
  if P==1: print(0)
  else: print(2**N)
else:
  print(2**(N-1))

Buggy python submission (verdict: Runtime Error):
import math
def comb(n,r):
  return int(math.factorial(n)/(math.factorial(r)*math.factorial(n-r)))

N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
even=0
total=0
for i in range(N):
  total+=A[i]
  if A[i]%2==0:
    even+=1
  else: 
    odd+=1
total=total%2
evens=2**even

ans=0
if total==even%2:
  for i in range(int(odd/2)+1): 
    ans+=comb(odd,2*i)
else:
  for i in range(int((odd-1)/2)+1):
    ans+=comb(odd,2*i+1)
print(ans*evens)

Fixed submission:
N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
if odd==0:
  if P==1: print(0)
  else: print(2**N)
else:
  print(2**(N-1))

Buggy python submission (verdict: Runtime Error):
import math
def comb(n,r):
  return int(math.factorial(n)/(math.factorial(r)*math.factorial(n-r)))

N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
even=0
total=0
for i in range(N):
  total+=A[i]
  if A[i]%2==0:
    even+=1
  else: 
    odd+=1
total=total%2
evens=2**even

ans=0
if total==even%2:
  for i in range(int((odd)/2+1)): 
    ans+=comb(odd,2*i)
else:
  for i in range(int((odd-1)/2)+1):
    ans+=comb(odd,2*i+1)
print(ans*evens)

Fixed submission:
N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
if odd==0:
  if P==1: print(0)
  else: print(2**N)
else:
  print(2**(N-1))
Buggy python submission (verdict: Runtime Error):
import math
N=int(input())
a=list(map(int,input().split()))
c=[]
for i in range(N+1):
  if a[i] in c:
    b=a[i]
    j=c.index(a[i])
    k=i
    L=j+N-k
    break
  c+=[a[i]]
Base=N+1
Minu=1
for i in range(0,min(L+1,N+1)):
  print((Base-Minu)%(10**9+7))
  Base=int(Base*(N-i)/(i+2))
  Minu=int(Minu*(L-i)/(i+1))
  #print(int(math.factorial(N+1)/(math.factorial(i+1)*math.factorial(N-i))-math.factorial(L)/(math.factorial(i)*math.factorial(L-i))))
for i in range(L+1,N+1):
  print(Base%(10**9+7))
  Base=int(Base*(N-i)/(i+2))

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=[]
if N%2==0:
  for i in range(int(N/2)):
    b+=[a[N-1-2*i]]
  for i in range(int(N/2)):
    b+=[a[2*i]]
else:
  for i in range(int((N+1)/2)):
    b+=[a[N-1-2*i]]
  for i in range(int((N-1)/2)):
    b+=[a[2*i+1]]
print(' '.join(map(str, b)))
Buggy python submission (verdict: Runtime Error):
X,A,B=map(int,input().split())
if A-B>=0:
  print("delicious")
eilf B-A<=X:
  print("safe")
else:
  print("dangerous")

Fixed submission:
X,A,B=map(int,input().split())
if A-B>=0:
  print("delicious")
elif B-A<=X:
  print("safe")
else:
  print("dangerous")

Buggy python submission (verdict: Runtime Error):
X,A,B=map(int,input().split())
if A-B>=0:
  print("delicious")
eilf B-A<=X:
  print("safe")
else:
  print(dangerous)

Fixed submission:
X,A,B=map(int,input().split())
if A-B>=0:
  print("delicious")
elif B-A<=X:
  print("safe")
else:
  print("dangerous")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ixy=[]
for i in range(N):
  x, y = map(int,input().split())
  ixy+=[[i,x,y]]
costs = [[] for i in range(N)]

ixy.sort(key=lambda x:x[1])
for j in range(N-1):
  costs[ixy[j][0]] += [[ixy[j+1][0],abs(ixy[j][1]-ixy[j+1][1])]]
  costs[ixy[j+1][0]] += [[ixy[j][0],abs(ixy[j][1]-ixy[j+1][1])]]
ixy.sort(key=lambda y:y[2])
for j in range(N-1):
  costs[ixy[j][0]] += [[ixy[j+1][0],abs(ixy[j][2]-ixy[j+1][2])]]
  costs[ixy[j+1][0]] += [[ixy[j][0],abs(ixy[j][2]-ixy[j+1][2])]]

import heapq
pq = []
heapq.heappush(pq,[0,0])

visited = [0]*N
ans = 0
while pq:
  cost, v = heapq.heappop(pq)

  if visited[v]: continue
  
  ans += cost
  visited[v]=1
  
  for u,c in costs[v]:
    if not visited[u]:
      heapq.heappush(pq, [c,u])

print(ans)

Fixed submission:
N = int(input())
ixy=[]
for i in range(N):
  x, y = map(int,input().split())
  ixy+=[[i,x,y]]
costs = [[] for i in range(N)]

ixy.sort(key=lambda x:x[1])
for j in range(N-1):
  costs[ixy[j][0]] += [(ixy[j+1][0],abs(ixy[j][1]-ixy[j+1][1]))]
  costs[ixy[j+1][0]] += [(ixy[j][0],abs(ixy[j][1]-ixy[j+1][1]))]
ixy.sort(key=lambda y:y[2])
for j in range(N-1):
  costs[ixy[j][0]] += [(ixy[j+1][0],abs(ixy[j][2]-ixy[j+1][2]))]
  costs[ixy[j+1][0]] += [(ixy[j][0],abs(ixy[j][2]-ixy[j+1][2]))]

import heapq
pq = []
heapq.heappush(pq, (0,0))

visited = [0]*N
ans = 0
while pq:
  cost, v = heapq.heappop(pq)

  if visited[v]: continue
  
  ans += cost
  visited[v]=1
  
  for u,c in costs[v]:
    if not visited[u]:
      heapq.heappush(pq, (c,u))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ixy=[]
for i in range(N):
  x, y = map(int,input().split())
  ixy+=[[i,x,y]]
costs = [[] for i in range(N)]

ixy.sort(key=lambda x:x[1])
for j in range(N-1):
  costs[ixy[j][0]] += [[ixy[j+1][0],abs(ixy[j][1]-ixy[j+1][1])]]
  costs[ixy[j+1][0]] += [[ixy[j][0],abs(ixy[j][1]-ixy[j+1][1])]]
ixy.sort(key=lambda y:y[2])
for j in range(N-1):
  costs[ixy[j][0]] += [[ixy[j+1][0],abs(ixy[j][2]-ixy[j+1][2])]]
  costs[ixy[j+1][0]] += [[ixy[j][0],abs(ixy[j][2]-ixy[j+1][2])]]

import heapq
pq = []
heapq.heappush(pq,[0,0])

visited = [0]*N
ans = 0
while pq:
  cost, v = heapq.heappop(pq)

  if visited[v]: continue
  
  ans += cost
  visited[v]=1
  
  for u,c in costs[v]:
    if not visited[u]:
      heapq.heappush(pq, [c,u])

print(ans)

Fixed submission:
N = int(input())
ixy=[]
for i in range(N):
  x, y = map(int,input().split())
  ixy+=[[i,x,y]]
costs = [[] for i in range(N)]

ixy.sort(key=lambda x:x[1])
for j in range(N-1):
  costs[ixy[j][0]] += [(ixy[j+1][0],abs(ixy[j][1]-ixy[j+1][1]))]
  costs[ixy[j+1][0]] += [(ixy[j][0],abs(ixy[j][1]-ixy[j+1][1]))]
ixy.sort(key=lambda y:y[2])
for j in range(N-1):
  costs[ixy[j][0]] += [(ixy[j+1][0],abs(ixy[j][2]-ixy[j+1][2]))]
  costs[ixy[j+1][0]] += [(ixy[j][0],abs(ixy[j][2]-ixy[j+1][2]))]

import heapq
pq = []
heapq.heappush(pq, (0,0))

visited = [0]*N
ans = 0
while pq:
  cost, v = heapq.heappop(pq)

  if visited[v]: continue
  
  ans += cost
  visited[v]=1
  
  for u,c in costs[v]:
    if not visited[u]:
      heapq.heappush(pq, (c,u))

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
N=int(input())
a=[int(i) for i in input().split()]
a.sort()

if a[N-1]-a[0]>1:
  print("No")
  sys.exit()
if a[0]==N-1:
  print("Yes")
  sys.exit()
if a[N-1]==1:
  print("Yes")
  sys.exit()
if a[0]==a[N-1]:
  if 2*a[0]<=N:
    print("Yes")
  else:
    print("No")
  sys.exit()
print(a[N])

Fixed submission:
import sys
N=int(input())
a=[int(i) for i in input().split()]
a.sort()

if a[N-1]-a[0]>1:
  print("No")
  sys.exit()
if a[0]==N-1:
  print("Yes")
  sys.exit()
if a[N-1]==1:
  print("Yes")
  sys.exit()
if a[0]==a[N-1]:
  if 2*a[0]<=N:
    print("Yes")
  else:
    print("No")
  sys.exit()

count=a.index(a[N-1])
if count+1<=a[N-1] and a[N-1]<=count+int((N-count)/2):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
import sys
N=int(input())
a=[int(i) for i in input().split()]
a.sort()

if a[N-1]-a[0]>1:
  print("No")
  sys.exit()
if a[0]==N-1:
  print("Yes")
  sys.exit()
print(a[N])

Fixed submission:
import sys
N=int(input())
a=[int(i) for i in input().split()]
a.sort()

if a[N-1]-a[0]>1:
  print("No")
  sys.exit()
if a[0]==N-1:
  print("Yes")
  sys.exit()
if a[N-1]==1:
  print("Yes")
  sys.exit()
if a[0]==a[N-1]:
  if 2*a[0]<=N:
    print("Yes")
  else:
    print("No")
  sys.exit()

count=a.index(a[N-1])
if count+1<=a[N-1] and a[N-1]<=count+int((N-count)/2):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
import sys
N=int(input())
a=[int(i) for i in input().split()]
a.sort()

if a[N-1]-a[0]>1:
  print("NO")
  sys.exit()
if a[N-1]>N-1:
  print("NO")
  sys.exit()
if a[0]==N-1:
  print("YES")
  sys.exit()
if a[0]==a[N-1]:
  print("YES")
  sys.exit()
print(a[N])

Fixed submission:
import sys
N=int(input())
a=[int(i) for i in input().split()]
a.sort()

if a[N-1]-a[0]>1:
  print("No")
  sys.exit()
if a[0]==N-1:
  print("Yes")
  sys.exit()
if a[N-1]==1:
  print("Yes")
  sys.exit()
if a[0]==a[N-1]:
  if 2*a[0]<=N:
    print("Yes")
  else:
    print("No")
  sys.exit()

count=a.index(a[N-1])
if count+1<=a[N-1] and a[N-1]<=count+int((N-count)/2):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
S=[]
times=len(format(A^B,"b"))
for i in range(A,B+1):
  S+=[i]
D=S[:] #Dは基礎集合
SET=set(S)
#for t in range(times):
for i in range(len(S)):
  for j in range(len(D)):
    S+=[S[i]|D[j]]
    SET.add(S[i]|D[j])
print(len(SET))

Fixed submission:
N,A,B=map(int, input().split())
# 出力
if A>B:
  print(0)
elif N==1:
  if A==B:
    print(1)
  else:
    print(0)
else:
  M=A+B*(N-1)
  m=A*(N-1)+B
  print(M-m+1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
S=-10**14
for i in range(N+1):
  b=a[0:N+i]
  c=a[N+i:3*N]
  b.sort(reverse=1)
  c.sort()
  B=0
  C=0
  for j in range(N):
    B+=b[j]
    C+=c[j]
  S=max(S,B-C)
print(S)

Fixed submission:
import heapq
N=int(input())
a=list(map(int,input().split()))
earl=[]
late=[]
for i in range(N):
  heapq.heappush(earl,a[i])
  heapq.heappush(late,-a[2*N+i])
E=0
L=0
for i in range(N):
  E+=a[i]
  L-=a[2*N+i]
e=[E]*(N+1)
l=[L]*(N+1)
for i in range(N):
  e[i+1]=e[i]+a[N+i]-heapq.heappushpop(earl,a[N+i])
  l[N-1-i]=l[N-i]-a[2*N-1-i]-heapq.heappushpop(late,-a[2*N-1-i])

ans=e[N]+l[N]
for i in range(N):
  ans=max(ans,e[i]+l[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
k=0
for i in range(0,N):
  k+=p[i][0]]
  if k>=K:
    print(p[i][1])
    sys.exit()
import sys
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
k=0
for i in range(0,N):
  k+=p[i][1]
  if k>=K:
    print(p[i][0])
    sys.exit()

Fixed submission:
import sys
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
k=0
for i in range(0,N):
  k+=p[i][1]
  if k>=K:
    print(p[i][0])
    sys.exit()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
q=[]
for i in range(0,N):
  q+=[p[i][0]]*p[i][1]
  if len(q)>K:
    print(q[K-1])
    sys.exit()

Fixed submission:
import sys
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
k=0
for i in range(0,N):
  k+=p[i][1]
  if k>=K:
    print(p[i][0])
    sys.exit()

Buggy python submission (verdict: Runtime Error):
import sys
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
q=[]
for i in range(0,N):
  q+=[p[i][0]]*p[i][1]
  if len(q)>K;
    print(q[K-1])
    sys.exit()

Fixed submission:
import sys
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
k=0
for i in range(0,N):
  k+=p[i][1]
  if k>=K:
    print(p[i][0])
    sys.exit()

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
q=[]
for i in range(0,N):
  q+=[p[i][0]]*p[i][1]
print(q[K-1])


Fixed submission:
import sys
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
k=0
for i in range(0,N):
  k+=p[i][1]
  if k>=K:
    print(p[i][0])
    sys.exit()
Buggy python submission (verdict: Runtime Error):
import sys
# 整数の入力
N,M=list(map(int, input().split()))
p=[]
q=0
count=0
for i in range(0,M):
  p.append(list(map(int, input().split())))
for i in range(0,M):
  q+=p[i][0]-p[i][1]
if q%2==1:
  print("NO")
else:
  m=int(M/100)
  for j in range(0,M,m):
    for i in range(0,M):
      if p[i][0]==j or p[i][1]==j:
        count+=1
    if count%2==1:
      print("NO")
      sys.exit()
  else: 
    print("YES")

Fixed submission:
# -*- coding: utf-8 -*-
import sys
# 整数の入力
A, B, C= map(int, input().split())
# 出力
if A==B and B==C:
 if A%2 ==0 and B%2==0 and C%2==0:
  print(-1)
  sys.exit()
count=0
while True:
 if A%2 ==1 or B%2==1 or C%2==1:
  print(count)
  sys.exit()
 else:
  A_a=B/2+C/2
  B_a=A/2+C/2
  C_a=A/2+B/2
  A=A_a
  B=B_a
  C=C_a
  count+=1

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys
# 整数の入力
A, B, C= map(int, input().split())
# 出力
if A==B and B==C:
 if A%2 ==0 and B%2==0 and C%2==1:
  print(-1)
  sys.exit()
count=0
while True:
 if A%2 ==1 or B%2==1 or C%2==1:
  print(count)
  sys.exit()
 else:
  A_a=B/2+C/2
  B_a=A/2+C/2
  C_a=A/2+B/2
  A=A_a
  B=B_a
  C=C_a
  count+=1


Fixed submission:
# -*- coding: utf-8 -*-
import sys
# 整数の入力
A, B, C= map(int, input().split())
# 出力
if A==B and B==C:
 if A%2 ==0 and B%2==0 and C%2==0:
  print(-1)
  sys.exit()
count=0
while True:
 if A%2 ==1 or B%2==1 or C%2==1:
  print(count)
  sys.exit()
 else:
  A_a=B/2+C/2
  B_a=A/2+C/2
  C_a=A/2+B/2
  A=A_a
  B=B_a
  C=C_a
  count+=1
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# 整数の入力
N, T= map(int, input().split())
t=list(map(int, input().split()))
end_t=T
for j in range (0,N):
  end_t=max(end_t, t[j]+T)
count=0
for s in range (0,end_t):#s秒時点で水で照るかっチェック
  for j in range (0,N):
    if t[j]<=s and s-T< t[j]:
      count+=1
      break
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
N, T= map(int, input().split())
t=list(map(int, input().split()))
count=0
for j in range (0,N-1):
  count+=min(T,t[j+1]-t[j])
print(count+T)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# 整数の入力
N, T= map(int, input().split())
t=list(map(int, input().split()))
end_t=T
for j in range (0,N):
  end_t=max(end_t, t[j]+T)
R=[]
for i in range (0,end_t):
  R.append(0)
for s in range (0,end_t):#s秒時点で水で照るかっチェック
  for j in range (0,N):
    if t[j]<=s and s-T< t[j]:
      R[s]=1

count=0
for s in range (0, end_t):
  count+=R[s]
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
N, T= map(int, input().split())
t=list(map(int, input().split()))
count=0
for j in range (0,N-1):
  count+=min(T,t[j+1]-t[j])
print(count+T)
Buggy python submission (verdict: Time Limit Exceeded):
#入力
n, W=map(int, input().split())
w,v=[],[]
for i in range(n):
  a,b=map(int,input().split())
  w.append(a)
  v.append(b)

# i番目以降から重さの総和がj 以下になるように選んだ時の重量
def rec(i,j):
  #既に計算されているなら、メモdp[][]を受け取る
  if dp[i][j]>=0:
    return dp[i][j]
  if i==n:#もう品物がないから終わり
    res=0
  elif w[i]>j:#i番目の荷物は入らないから次へ
    res= rec(i+1,j)
  else:#i番目の荷物が入る場合と入らない場合の両方を試す
    res=max(rec(i+1,j), rec(i+1,j-w[i]) +v[i])
  dp[i][j]=res
  return res

dp=[[-1 for i in range(W+1)] for j in range(n+1)]#メモの初期化
print(rec(0,W))

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

value_table = [[] for i in range(4)]
for i in range(N):
    w, v = map(int,input().split())
    if i == 0:
        w1 = w
    value_table[w-w1] += [v]

[value_table[i].sort(reverse=True) for i in range(4)]

ans = 0
value_table_ruiseki = [[0] for i in range(4)]
for i in range(4):
    for v in value_table[i]:
        value_table_ruiseki[i] += [value_table_ruiseki[i][-1] + v]

ans = 0
for i, iv in enumerate(value_table_ruiseki[0]):
    for j, jv in enumerate(value_table_ruiseki[1]):
        for k, kv in enumerate(value_table_ruiseki[2]):
            for ell, ellv in enumerate(value_table_ruiseki[3]):
                weight = i*w1 + j*(w1+1) + k*(w1+2) + ell*(w1+3)
                value = iv + jv + kv + ellv
                if weight <=W:
                    ans = max(ans, value)

print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
A=input()
B=input()
ans=str()
if len(A)==len(B):
  for i in range (0,len(A)):
    ans+=A[i]+B[i]
else:
  for i in range (0,len(A)):
    ans+=A[i]+B[i]
  ans+=A[-1]
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
A=input()
B=input()
ans=str()
if len(A)==len(B):
  for i in range (0,len(A)):
    ans+=A[i]+B[i]
else:
  for i in range (0,len(A)-1):
    ans+=A[i]+B[i]
  ans+=A[-1]
print(ans)