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

Fixed submission:
def COMint():
  fac[0]=1
  fac[1]=1
  finv[0]=1
  finv[1]=1
  inv[1]=1
  for i in range(2,N+1):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD
def com(n,k):
  if n<k:
    return 0
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
MOD=10**9+7
N,K=[int(x) for x in input().split()]
A= [int(x) for x in input().split()]
A= sorted(A)
fac=[0]*(N+1)
inv=[0]*(N+1)
finv=[0]*(N+1)
COMint()
ans=0
#print(fac)
for j in range(N):
  ans+=(A[j])*com(j,K-1)
  ans-=(A[j])*com(N-1-j,K-1)
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
# nCr mod m
# mを法とするaの乗法的逆元
# 拡張ユークリッド互除法
# gcd(a,b) と ax + by = gcd(a,b) の最小整数解を返す
def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m
# modinvが必要
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
N,K=[int(x) for x in input().split()]
A= [int(x) for x in input().split()]
A= sorted(A)
ans=0
if K==1:
  print(0)
elif K==2:
  L = [1]*(N+1)
elif K>=3:
  L = [0]*(N-1)
  for i in range(N-2,-1,-1):
    if i>=K-2:
      L[i]=combination(i,K-2)
#print(L)
for j in range(N-1,-1,-1):
  for i in range(j-K+2):
    mi = A[i]
    ma = A[j]
    #print(ma,mi,i,j,L[j-i-1])
    if j-i-1>=0:
      ans+=(ma-mi)*L[j-i-1]
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
# nCr mod m
# mを法とするaの乗法的逆元
# 拡張ユークリッド互除法
# gcd(a,b) と ax + by = gcd(a,b) の最小整数解を返す
def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m
# modinvが必要
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
N,K=[int(x) for x in input().split()]
A= [int(x) for x in input().split()]
A= sorted(A)
ans=0
if K==1:
  print(0)
elif K==2:
  L = [1]*(N+1)
elif K>=3:
  L = [0]*(N-1)
  for i in range(N-2,-1,-1):
    if i>=K-2:
      L[i]=combination(i,K-2)
#print(L)
for j in range(N-1,-1,-1):
  for i in range(j-K+2):
    mi = A[i]
    ma = A[j]
    #print(ma,mi,i,j,L[j-i-1])
    if j-i-1>=0:
      ans+=(ma-mi)*L[j-i-1]
print(ans%(10**9+7))
Problem p02889 (python)

Fixed submission:
import numpy as np
import sys
from scipy.sparse.csgraph import floyd_warshall,csgraph_from_dense
from scipy.sparse import csr_matrix
input = sys.stdin.readline
def inputs():return [int(x) for x in input().split()]
N,M,L = inputs()
ABC =[inputs() for _ in range(M)]
graph = [[10**13]*(N+1) for _ in range(N+1)]
for a,b,c in ABC:
    graph[a][b] = c
G = csgraph_from_dense(graph, null_value=10**13)
dist_mat = floyd_warshall(graph,directed=False)
graph2 = np.array([[10**13]*(N+1) for _ in range(N+1)])
np.fill_diagonal(graph2,0)
graph2[dist_mat<=L]=1
dist_mat2 = floyd_warshall(graph2,directed=False)
dist_mat2[dist_mat2==10**13]=0
Q = int(input())
for i in range(Q):
    s,t = inputs()
    print(int(dist_mat2[s,t])-1)

Buggy submission (verdict: Runtime Error):
#import numpy as np
import sys
from scipy.sparse.csgraph import floyd_warshall,csgraph_from_dense
from scipy.sparse import csr_matrix
input = sys.stdin.readline
def inputs():return [int(x) for x in input().split()]
N = int(input())
a,b =inputs()
M = int(input())
graph= [[10**9]*(N+1) for _ in range(N+1)]
E = {i:[] for i in range(N+1)}
for i in range(M):
  x,y = inputs()
  graph[x][y] = 1
  graph[y][x] = 1
  E[x].append(y)
  E[y].append(x)
G = csgraph_from_dense(graph, null_value=10**9)
dist_mat = floyd_warshall(graph,directed=False)
visited=[-1]*(N+1)
stk =[[a,-1,0]]
cnt=0
while stk:
  v,p,path =stk.pop()
  if v==b and path==dist_mat[a][b]:
    cnt+=1
    cnt%=(10**9+7)
  #visited[v]=1
  for i in E[v]:
    if i != p and path<dist_mat[a][b]:
      stk.append([i,v,path+1])
print(cnt%(10**9+7))
Problem p02917 (python)

Fixed submission:
N = int(input())
B = [int(x) for x in input().split()]
ans = [0]*(N)
if N==2:
  print(int(B[0])*2)
  exit()
for i in range(1,N-1):
  ans[i] = min(B[i-1],B[i])
ans[0] = B[0]
ans[N-1] = B[N-2]
print(sum(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
B = [int(x) for x in input().split()]
ans = [0]*(N)
for i in range(1,N-2):
  ans[i] = min(B[i-1],B[i],B[i+1])
ans[0] = min(B[0],B[1])
ans[N-2] =  min(B[N-3],B[N-2])
ans[N-1] = B[N-2]
print(sum(ans))
Problem p02922 (python)

Fixed submission:
A,B = list(map(int,input().split()))
ans = 1
i = 0
while ans < B:
  ans += A-1
  i +=1
print(i)

Buggy submission (verdict: Runtime Error):
A,B = list(map(int,input()))
print((A+B-1)//A)
Problem p02927 (python)

Fixed submission:
import sys
M, d = input().split()
if int(d)>=10:
  d10 = int(d[0])
  d1 = int(d[1])
else:
  print(0)
  sys.exit()
M = int(M)
ans = 0
for j in range(2,d10+1):
  for i in range(2,10):
    if 10*j+i>d10*10+d1:
      print(ans)
      sys.exit()
    if M >=j*i:
      ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
M, d = input().split()
d10 = int(d[0])
d1 = int(d[1])
M = int(M)
ans = 0
import sys
for j in range(2,d10+1):
  for i in range(2,10):
    if 10*j+i>d10*10+d1:
      print(ans)
      sys.exit()
    if M >=j*i:
      ans+=1
Problem p02928 (python)

Fixed submission:

N, K = map(int,input().split())
A= list((map(int, input().split())))
an = (K*(K+1))//2
a = ((K-1)*K)//2
au =0
al = 0
for i in range(N):
  for j in range(N):
    au += 1 if A[i]<A[j] and i>j else 0
    al += 1 if A[i]<A[j] and i<j else 0
print((au*an+al*a)%(10**9+7))

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K = map(int,input().split())
A= list((map(int, input().split())))
an = (K*(K+1))//2
a = ((K-1)*K)//2
au =0
al = 0
for i in range(N):
    for j in range(N):
        au += 1 if A[i]<A[j] and i>j else 0
        al += 1 if A[i]<A[j] and i<j else 0
print((au*an+al*a)%(10**9+7))
Problem p02957 (python)

Fixed submission:
A,B = list(map(int,input().split()))
if (A+B)%2==0:
  print((A+B)//2)
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
S = list(input())
dp = [[0 for _ in range(13)] for _ in range(len(S)+1)]
dp[0][0]=1
#print(dp[15][5])
for i in range(len(S)):
  a = 0
  if S[i]=="?":
    for j in range(10):
      for k in range(13):
        dp[i+1][(k*10+j)%13] += dp[i][k]
  else:
    a = int(S[i])
    for k in range(13):
      dp[i+1][(k*10+a)%13] += dp[i][k]
  for k in range(13):
    dp[i + 1][k] %= (10**9+7)
print(dp[len(S)][5])
Problem p02972 (python)

Fixed submission:
#import numpy as np
N = int(input())
a = [0]+list(map(int,input().split()))
ans = [0]*(N+1)
an = []
for i in range(N,0,-1):
  c =0
  b = [i*j for j in range(2,N//i+1)]
  for j in b:
    c +=ans[j]
  c = c%2
  if c!=a[i]:
    ans[i]=1
    an.append(i)
print(len(an))
for i in range(len(an)):
  print(an[i],end=" ")

Buggy submission (verdict: Runtime Error):
#import numpy as np
N = int(input())
a = [0]+list(map(int,input().split()))
ans = [0]*(N+1)
an = []
for i in range(N,0,-1):
  c =0
  c = sum(ans[s*i::i])
  if c%2!=a[i]:
    ans[i]=1
    an.append(i)
print(len(an))
for i in range(len(an)):
  print(an[i],end=" ")
Problem p02982 (python)

Fixed submission:
N,D = list(map(int,input().split()))
X = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for i in range(N):
  for j in range(i+1,N):
    a = 0
    for d in range(D):
      a += (X[i][d]-X[j][d])**2
    for l in range(a+1):
      if l**2==a:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
N,D = list(map(int,input().split()))
X = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for i in range(N):
  for j in range(i+1,N):
    for d in range(D):
      a += (X[i][d]-X[j][d])**2
    for l in range(a):
      if l**2==a:
        ans+=1
print(ans)
Problem p02994 (python)

Fixed submission:
N,L = list(map(int,input().split()))
A = list(range(L,L+N))
ans = sum(A)
mi = min(list(map(abs,A)))
if abs(A[0])==mi:
  print(ans-A[0])
elif abs(A[N-1])==mi:
  print(ans-A[N-1])
else:
  print(ans-mi)

Buggy submission (verdict: Runtime Error):
N,L = list(map(int,input().split()))
A = list(range(L,L+N))
ans = sum(A)
if abs(A[0])>abs(A[N]):
  print(ans-A[N])
else:
  print(ans-A[0])
Problem p03006 (python)

Fixed submission:
from collections import Counter
n= int(input())
if n==1:
  print(1)
  exit()
xy=[[int(x) for x in input().split()] for _ in range(n)]
gr = [[[0,0]for _ in range(n)]for _ in range(n)]
for i in range(n):
  a,b = xy[i]
  for j in range(n):
    gr[i][j] = [xy[j][0]-a,xy[j][1]-b]
gr1 = []
for i in gr:
  for j in i:
    gr1.append(tuple(j))
#print(gr1)
c = Counter(gr1)
l,f = c.most_common()[0]
if l!=(0,0):
  print(n-f)
else:
  l,f = c.most_common()[1]
  print(n-f)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n= int(input())
xy=[[int(x) for x in input().split()] for _ in range(n)]
gr = [[[0,0]for _ in range(n)]for _ in range(n)]
for i in range(n):
  a,b = xy[i]
  for j in range(n):
    gr[i][j] = [xy[j][0]-a,xy[j][1]-b]
gr1 = []
for i in gr:
  for j in i:
    gr1.append(tuple(j))
#print(gr1)
c = Counter(gr1)
l,f = c.most_common()[0]
if l!=(0,0):
  print(n-f)
else:
  l,f = c.most_common()[1]
  print(n-f)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n= int(input())
xy=[[int(x) for x in input().split()] for _ in range(n)]
gr = [[[0,0]for _ in range(n)]for _ in range(n)]
for i in range(n):
  a,b = xy[i]
  for j in range(n):
    gr[i][j] = [abs(xy[j][0]-a),abs(xy[j][1]-b)]
gr1 = []
for i in gr:
  for j in i:
    gr1.append(tuple(j))
#print(gr1)
c = Counter(gr1)
l,f = c.most_common()[0]
if l!=(0,0):
  print(n-f//2)
else:
  l,f = c.most_common()[1]
  print(n-f//2)
Problem p03035 (python)

Fixed submission:
A, B = map(int, input().split())
if A>=13:
    print(B)
elif A<=12 and A>=6:
    print(int(B/2))
else:
    print(int(0))

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
b =[]
for i in range(M):
    B,C = map(int, input().split())
    b.extend([C for _ in range(B)])
bisec = bisect_left
ex = A.extend
b.sort()
b.reverse()
for i in range(N):
    if A[i]<b[-1]:
        l = bisec(b,A[i])
        A[i] = b[l]
        del b[l]
    else:
        break
print(sum(A))
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
def dfs(p,v,c):
    ans[v]=c
    for i in E[v]:
        if i[0]==p:
            continue
        if i[1]%2==1:
            dfs(v,i[0],1-c)
        else:
            dfs(v,i[0],c)
N= int(input())
ans = [100]*(N+1)
memo = {i:False for i in range(1,N+1)}
E = {i: []for i in range(1,N+1)}
for i in range(N-1):
    u,v,w = list(map(int,input().split()))
    E[v].append((u,w))
    E[u].append([v,w])
dfs(-1,1,1)
for i in range(1,N+1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
def dfs(p,v,c):
    ans[v]=c
    for i in E[v]:
        if i[0]==p:
            continue
        if i[1]%2==1:
            dfs(v,i[0],1-c)
        else:
            dfs(v,i[0],c)
N= int(input())
ans = [100]*(N+1)
memo = {i:False for i in range(1,N+1)}
E = {i: []for i in range(1,N+1)}
for i in range(N-1):
    u,v,w = list(map(int,input().split()))
    E[v].append((u,w))
    E[u].append([v,w])
dfs(-1,1,1)
for i in range(1,N+1):
    print(ans[i])
Problem p03050 (python)

Fixed submission:
import math
n = int(input())
a = math.sqrt(n)
if int(a)<a:
  a=int(a)+1
else:
  a=int(a)
ans = 0
for i in range(1,a):
  if (n-i)%i==0 and n%((n-i)//i)==i:
    ans+=(n-i)//i
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = math.sqrt(n)
if int(a)<a:
  a=int(a)+1
else:
  a=int(a)
ans = 0
for i in range(1,a+1):
  if (n-i)%i==0 and n%((n-i)//i)==i:
    ans+=(n-i)//i
print(ans)
Problem p03060 (python)

Fixed submission:
N = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
ans = [l-p for l,p in zip(v,c)]
ans1 = 0
for i in ans :
  ans1 += i if i>0 else 0
print(ans1)

Buggy submission (verdict: Runtime Error):
N = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().spplit()]
ans = [l-p for l,p in zip(v,c)]
ans1 = 0
for i in ans :
  ans1 += i if i>0 else 0
print(ans1)
Problem p03071 (python)

Fixed submission:
A,B = list(map(int,input().split()))
a = 0
for i in range(2):
    a= a+max(A,B)
    if A>B:
        A = A-1
    else:
        B = B-1
print(a)

Buggy submission (verdict: Runtime Error):
N,K = list(map(int,input().split()))
A = input()
A = list(A)
A = list(map(int,A))
l = [0]
s = []

for i in range(N-1):
    if A[i] != A[i+1]:
        l.append(i+1)
        s.append(l[len(l)-1]-l[len(l)-2])
l.append(N)
s.append(l[len(l)-1]-l[len(l)-2])
a = 0
right = 0
left = 0
g = 0
su = 0
if A[0] == 0:
    for i in range(len(s)):
        print(right)
        su +=s[right]
        if right%2==0:
            g += 1
        right +=1
        if g<=K:
            a = max(a,su)
        else:
            while g>K:
              su -= s[left]
              if left%2==0:
                  g -=1
              left +=1
        a = max(a,su)
else:
    for i in range(len(s)):
        su +=s[right]
        if right%2==1:
            g += 1
        right +=1
        if g<=K:
            a = max(a,su)
        else:
            while g>K:
              su -= s[left]
              if left%2==1:
                  g -=1
              left +=1
        a = max(a,su)

print(a)
Problem p03086 (python)

Fixed submission:
S = input()
ans = 0
cnt = 0
for i in range(len(S)):
  if S[i] == "A" or S[i] =="G" or S[i] =="C" or S[i] =="T":
    cnt += 1
  else:
    ans = max(ans,cnt)
    cnt = 0

print(max(ans,cnt))

Buggy submission (verdict: Runtime Error):
S = input()
ans = 0
cnt = 0
for i in range(len(S)):
  if S[i] == "A" or S[i] =="G" or S[i] =="C" orS[i] =="T":
    cnt += 1
  else:
    ans = max(ans,cnt)
    cnt = 0
print(ans)
Problem p03087 (python)

Fixed submission:
import numpy as np
from collections import Counter
import collections
import numpy as np 
from scipy import sqrt, power, exp, log10
from scipy.fftpack import fft, ifft, fftfreq
import tarfile
import re
import os
import glob
from datetime import datetime
import time
import numpy.linalg as LA

round = lambda x:(x*2+1)//2
a,b = list(map(int,input().split()))
S = input()
sub= "AC"
l = np.zeros(len(S)+1)
for i in range(len(S)):
  l[i+1] = l[i] + (1 if S[i:i+2]=="AC" else 0)

for i in range(b):
    r,t = list(map(int,input().split()))
    n = l[t-1]-l[r-1]
    print(int(n))

Buggy submission (verdict: Runtime Error):
import numpy as np
from collections import Counter
import collections
import numpy as np 
from scipy import sqrt, power, exp, log10
from scipy.fftpack import fft, ifft, fftfreq
import tarfile
import re
import os
import glob
from datetime import datetime
import time
import numpy.linalg as LA
 
round = lambda x:(x*2+1)//2
a,b = list(map(int,input().split()))
S = input()
sub= "AC"
for i in range(b):
    r,l = list(map(int,input().split()))
    n = S1.count(sub,r-1,l-1)
    print(n)

Buggy submission (verdict: Runtime Error):
import numpy as np
from collections import Counter
import collections
import numpy as np 
from scipy import sqrt, power, exp, log10
from scipy.fftpack import fft, ifft, fftfreq
import tarfile
import re
import os
import glob
from datetime import datetime
import time
import numpy.linalg as LA

round = lambda x:(x*2+1)//2
a,b = list(map(int,input().split()))
S = input()
sub= "AC"
for i in range(b):
    r,l = list(map(int,input().split()))
	S1 = S[r-1:l]
    n = S1.count(sub)
    print(n)

Buggy submission (verdict: Runtime Error):
import numpy as np
from collections import Counter
import collections
import numpy as np 
from scipy import sqrt, power, exp, log10
from scipy.fftpack import fft, ifft, fftfreq
import tarfile
import re
import os
import glob
from datetime import datetime
import time
import numpy.linalg as LA

round = lambda x:(x*2+1)//2
a,b = list(map(int,input().split()))
S = input()
sub= "AC"
for i in range(b):
    r,l = list(map(int,input().split()))
    print(S1)
    n = S1.count(sub)
    print(n)
Problem p03110 (python)

Fixed submission:
N = int(input())
ans =0
for i in range(N):
  a,b = input().split()
  a = float(a)
  if b=="JPY":
    ans+=a
  else:
    ans +=a*380000
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans =0
for i in range(N):
  a,b = input().split()
  a = int(a)
  if b=="JPY":
    ans+=a
  else:
    ans +=a*380000
print(ans)
Problem p03111 (python)

Fixed submission:
def rec (i,a,b,c):
    if i==N:
        if a==0 or b==0 or c==0:
            return INF
        else:
            return abs(a-A)+abs(b-B)+abs(c-C)
    res = rec(i+1,a,b,c)
    
    res = min(res,rec(i+1,a+L[i],b,c)+(10 if a>0 else 0))
    res = min(res,rec(i+1,a,b+L[i],c)+(10 if b>0 else 0))
    res = min(res,rec(i+1,a,b,c+L[i])+(10 if c>0 else 0))
    
    return res
N,A,B,C = list(map(int,input().split()))
INF=10**8
L = [int(input()) for _ in range(N)]
print(rec(0,0,0,0))

Buggy submission (verdict: Runtime Error):
def rec (i,a,b,c):
    if i==N:
        if a==0 and b==0 and c==0:
            return INF
        else:
            return abs(a-A)+abs(b-B)+abs(c-C)
    res = rec(i+1,a,b,c)
    
    res = min(res,rec(i+1,a+L[i],b,c)+(10 if a>0 else 0))
    res = min(res,rec(i+1,a,b+L[i],c)+(10 if b>0 else 0))
    res = min(res,rec(i+1,a,b,c+L[i])+(10 if c>0 else 0))
    
    return res
N,A,B,C = list(map(int,input().split()))
L = [int(input()) for _ in range(N)]
print(rec(0,0,0,0))
Problem p03128 (python)

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

A = list(map(int,input().split()))
sorted(A)
B =[0,2,5,5,4,5,6,3,7,6]
C =[]
for i in A:
    C.append(B[i])
dp = [-1]*(N+1)
dp[0] = 0
for i in range(N+1):
    for a in range(len(C)):
        if i+C[a]<=N and 0<=dp[i]:
            dp[i+C[a]] = max(dp[i]*10+A[a],dp[i+C[a]])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
import fractions
N = int(input())
A = [int(x) for x in input().split()]
a = A[0]
for i in range(1,N):
  a =fractions.gcd(a,A[i])
print(a)
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(4100000)
N,M = [int(x) for x in input().split()]
E ={i: [] for i in range(1, N+1)}
for _ in range(M):
  u,v = [int(x) for x in input().split()]
  E[u].append(v)
#print(E)
dp =[-1]*(N+1)
def memo(v):
  if dp[v]!= -1:
    return dp[v]
  res = 0
  for nv in E[v]:
    res = max(res,memo(nv)+1)
  dp[v] =res
  return dp[v]
res = 0
for v in range(1,N+1):
  res = max(res,memo(v))
print(res)

Buggy submission (verdict: Runtime Error):
N,M = [int(x) for x in input().split()]
E ={i: [] for i in range(1, N+1)}
for _ in range(M):
  u,v = [int(x) for x in input().split()]
  E[u].append(v)
#print(E)
dp =[-1]*(N+1)
def memo(v):
  if dp[v]!= -1:
    return dp[v]
  res = 0
  for nv in E[v]:
    res = max(res,memo(nv)+1)
  dp[v] =res
  return dp[v]
res = 0
for v in range(1,N+1):
  res = max(res,memo(v))
print(res)
Problem p03238 (python)

Fixed submission:
N = int(input())
if N ==1:
  print("Hello World")
else:
  A = int(input())
  B =int(input())
  print(A+B)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N ==1:
  print("Hello World")
else:
  A,B = [int(x) for x in input().split()]
  print(A+B)
Problem p03239 (python)

Fixed submission:
N,T = [int(x) for x in input().split()]
ans =100000000
for i in range(N):
  c,t =[int(x) for x in input().split()]
  if t<=T:
    ans = min(c,ans)
if ans!=100000000:
  print(ans)
else:
  print("TLE")

Buggy submission (verdict: Runtime Error):
N,T = [int(x) for x in input().split()]
ans =100000000
for i in range(N):
  c,t =[int(x) for x in input().split()]
  if t<=T:
    ans = min(c,ans)
if ans!=100000000
    print(ans)
else:
  print("TLE")
Problem p03244 (python)

Fixed submission:
import collections as col
N= int(input())
A = [int(x) for x in input().split()]
a = A[::2]

a = col.Counter(a)
b = A[1::2]

b = col.Counter(b)
ans = 0
i = 0
j = 0
if len(a.most_common())==1 and len(b.most_common())==1 and a.most_common()[i][0]==b.most_common()[j][0]:
  print(N//2)
  exit()
while a.most_common()[i][0]==b.most_common()[j][0]:
  m=a.most_common()[i][1]
  n=b.most_common()[j][1]
  if m>n:
    j +=1
  elif m==n:
      if a.most_common()[i+1][1]>b.most_common()[j+1][1]:
        i+=1
      else:
        j +=1
  else:
    i +=1
#print(i,j,a,b)
ans += sum(a.values())+sum(b.values())-a.most_common()[i][1]-b.most_common()[j][1]
print(ans)

Buggy submission (verdict: Runtime Error):
import collections as col
N= int(input())
A = [int(x) for x in input().split()]
a = A[::2]
a = col.Counter(a)
b = A[1::2]
b = col.Counter(b)
ans = 0
i = 0
j = 0
#while a.most_common()[i][0]!=b.most_common()[j][0]:
if a.most_common(1)[0][0]!=b.most_common(1)[0][0]:
  ans += sum(a.values())+sum(b.values)-a.most_common(1)[0][1]-b.most_common(1)[0][1]
print(ans)
Problem p03261 (python)

Fixed submission:
N = int(input())
A = [input() for _ in range(N)]
b=A[0][0]
for i in range(N):
  if b==A[i][0]:
    b=A[i][-1]
  else:
    print("No")
    exit()
A.sort()
for i in range(N-1):
  if A[i]==A[i+1]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [[input()] for _ in range(N)]
for i in range(N):
  if b==A[i][0]:
    b= A[i][-1]
  else:
    print("No")
    exit()
A.sort()
for i in range(N-1):
  if A[i]==A[i+1]:
    print("No")
    exit()
print("Yes")
Problem p03273 (python)

Fixed submission:
H,W = [int(x) for x in input().split()]
ans = []
for i in range(H):
  cnt= 0
  S = list(input())
  for j in range(W):
    if S[j]==".":
      cnt +=1
  if cnt!=W:
    ans.append(S)
ans1 = []
for j in range(len(ans[0])):
  cnt = 0
  for i in range(len(ans)):
    if ans[i][j]==".":
      cnt+=1
  if cnt ==len(ans):
    ans1.append(j)
for i in range(len(ans)):
  for j in ans1:
    ans[i][j]=0
for i in range(len(ans)):
  for j in range(len(ans[0])):
    if ans[i][j] !=0:
    	print(ans[i][j],end="")
  print()

Buggy submission (verdict: Runtime Error):
H,W = [int(x) for x in input().split()]
ans = []
for i in range(H):
  cnt= 0
  S = list(input())
  for j in range(W):
    if S[j]==".":
      cnt +=1
  if cnt!=W:
    ans.append(S)
ans1 = []
for j in range(len(ans[0])):
  cnt = 0
  for i in range(len(ans)):
    if ans[i][j]==".":
      cnt+=1
  if cnt ==len(ans):
    ans1.append(j)
for i in range(len(ans)):
  for j in ans1:
    ans[i][j]=0
for i in range(len(ans)):
  for j in range(len(ans[0])):
    if ans[i][j] !=0:
    	print(ans[i][j],end"")
  print()
Problem p03282 (python)

Fixed submission:
N = list(input())
K = int(input())
for i in range(K) :
  a = int(N[i])
  if a!=1:
    print(a)
    exit()
print(1)

Buggy submission (verdict: Runtime Error):
N = list(input())
K = int(input())
for i in range(len(K)) :
  a = int(N[i])
  if a!=1:
    print(a)
    exit()
print(1)

Buggy submission (verdict: Runtime Error):
N = list(input())
K = int(input())
for i in range(len(K)) :
  a = int(i)
  if a!=1:
    print(a)
    exit()
print(1)

Buggy submission (verdict: Runtime Error):
N = list(input())
K = int(input())
for i in N :
  a = int(i)
  ans += a**(5*10**15)
  if ans>=K:
    print(a)