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

Fixed submission:
N,M=map(int,input().split())
s=[0]*M
c=[0]*M

for i in range(M):
  s[i],c[i]= map(int,input().split())

if M==0:
  for j in range(1000):
    k=str(j)
    if len(k)==N:
      ans=j
      break
else:
  max_s=max(s)
  ans=-1
  for j in range(1000):
    flag=True
    k=str(j)
    if len(k)!=N:
      pass
    else:
      for l in range(M):
        if int(k[s[l]-1])!=c[l]:
          flag=False
          break
      if flag==True:
        ans=j
        break
      
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M

for i in range(M):
  s[i],c[i]= map(int,input().split())
  
max_s=max(s)
ans=-1

for j in range(1000):
  flag=True
  k=str(j)  
  if len(k)<max_s:
    pass
  else:
    if len(k)!=N:
      pass
    else:    
      for l in range(M):
        if int(k[s[l]-1])!=c[l]:
          flag=False
          break
      if flag==True:
        if ans==-1:
          ans=j
        else:
          ans=min(ans,j)
        break
      
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M

for i in range(M):
  s[i],c[i]= map(int,input().split())
  
max_s=max(s)
ans=-1

for j in range(1000):
  flag=True
  k=str(j)  
  if len(k)<max_s:
    pass
  else:
    if len(k)!=N:
      pass
    else:    
      for l in range(M):
        if int(k[s[l]-1])!=c[l]:
          flag=False
          break
      if flag==True:
        ans=j
        break
      
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M

for i in range(M):
  s[i],c[i]= map(int,input().split())
  
max_s=max(s)
ans=-1

for j in range(1000):
  flag=True
  k=str(j)
  if len(k)<max_s:
    pass
  else:    
    for l in range(M):
      if int(k[s[l]-1])!=c[l]:
        flag=False
        break
    if flag==True:
      ans=j
      break
      
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*M
c=[0]*M

for i in range(M):
  s[i],c[i]= map(int,input().split())
  
max_s=max(s)
ans=-1

for j in range(702,703):
  flag=True
  k=str(j)
  if len(k)<max_s:
    pass
  else:    
    for l in range(M):
      if int(k[s[l]-1])!=c[l]:
        flag=False
        break
    if flag==True:
      ans=j
      break
      
print(ans)
Problem p02802 (python)

Fixed submission:
N,M=map(int,input().split())
p=[0]*M
S=[0]*M
sei=[0]*N
pena=[0]*N
total=[0]*N

for i in range(M):
  p[i],S[i] = input().split()
  p[i]=int(p[i])

  if S[i]=="AC":
    if sei[p[i]-1]>=1:
      pass
    else:
      sei[p[i]-1] +=1
      
  else: # WAのとき
    if sei[p[i]-1]>=1:
      pass
    else: #0のとき
      pena[p[i]-1] +=1

for j in range(N):
  total[j]=sei[j]*pena[j]
  
print(sum(sei),sum(total))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
p=[0]*N
S=[0]*N
sei=[0]*N
pena=[0]*N
total=[0]*N

for i in range(M):
  p[i],S[i] = input().split()
  p[i]=int(p[i])

  if S[i]=="AC":
    if sei[p[i]]>=1:
      pass
    else:
      sei[p[i]] +=1
      
  else: # WAのとき
    if sei[p[i]]>=1:
      pass
    else: #0のとき
      pena[p[i]] +=1

for j in range(N):
  total[j]=sei[j]*pena[j]
  
print(sum(sei),sum(total))
Problem p02806 (python)

Fixed submission:
N=int(input())
s=[0]*N
t=[0]*N
for i in range(N):
  s[i],t[i] = input().split()
  t[i]=int(t[i])
X=input()

j= s.index(X)
if X==s[-1]:
  ans=0
else:
  ans= sum(t[j+1:])

print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
s=[0]*N
t=[0]*N
for i in range(N):
  s[i],t[i] = input().split()
  t[i]=int(t[i])
X=input()

j= s.index(X)
if X==s[-1]:
  ans=0
else:
  ans= t[j+1:]

print(sum(ans))
Problem p02823 (python)

Fixed submission:
N,A,B=map(int,input().split())
C=B-A

if C%2==0:
  print(C//2)
else:
  dist_a=A-1
  dist_b=N-B
  base=min(dist_a,dist_b)
  print(base+(B-A+1)//2)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
C=A+B

if C%2==0:
  print(C/2/)
else:
  dist_a=A-1
  dist_b=N-B
  base=min(dist_a,dist_b)
  print(base+(B-A+1)//2)
Problem p02843 (python)

Fixed submission:
X = int(input())
flag=False

if X>=2100:
  print(1)
  flag=True
else:
  for i in range(0,22):
    for j in range(0,22-i):
      for k in range(0,22-i-j):
        for l in range(0,22-i-j-k):
          for m in range(0,22-i-j-k-l):
            for n in range(0,22-i-j-k-l-m):
              if 100*i+101*j+102*k+103*l+104*m+105*n==X:
                if flag==False:
                  print(1)
                  flag=True
                  break
              
if flag==False:
  print(0)

Buggy submission (verdict: Runtime Error):
X = int(input())
flag=False

if X>=2000:
  print(1)
else:
  for i in range(0,21):
    for j in range(0,21-i):
      for k in range(0,21-i-j):
        for l in range(0,21-i-j-k):
          for m in range(0,21-i-j-k-l):
            for n in range(0,21-i-j-k-l-m):
              if 100*i+101*j+102*k+103*l+104*m+105*n==X:
                if flag=False:
                  print(1)
                  flag=True
                  break
              
if flag==False:
  print(0)
Problem p02845 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
p=1000000007


R=[0]
G=[0]
B=[0]

#print(A)
ans=1
for i in range(N):
    tmp=0
    if A[i]==R[-1]:
        tmp+=1
    if A[i]==G[-1]:
        tmp+=1
    if A[i]==B[-1]:
        tmp+=1
    ans = (ans*tmp)%p

    if A[i]==R[-1]:
        R.append(R[-1]+1)
        G.append(G[-1])
        B.append(B[-1])
    elif A[i]==G[-1]:
        R.append(R[-1])
        G.append(G[-1]+1)
        B.append(B[-1])
    else:
        R.append(R[-1])
        G.append(G[-1])
        B.append(B[-1]+1)
    
#print(R)
#print(G)
#print(B)
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
p=1000000007


R=[0]
G=[0]
B=[0]

#print(A)
ans=1
for i in range(N):
    if A[i]==R[-1]:
        tmp+=1
    if A[i]==G[-1]:
        tmp+=1
    if A[i]==B[-1]:
        tmp+=1
    ans = (ans*tmp)%p

    if A[i]==R[-1]:
        R.append(R[-1]+1)
        G.append(G[-1])
        B.append(B[-1])
    elif A[i]==G[-1]:
        R.append(R[-1])
        G.append(G[-1]+1)
        B.append(B[-1])
    else:
        R.append(R[-1])
        G.append(G[-1])
        B.append(B[-1]+1)
    tmp=0
    
#print(R)
#print(G)
#print(B)
print(ans)
Problem p02853 (python)

Fixed submission:
X,Y=map(int,input().split())
awa=0

if X==3:
  awa += 100000
elif X==2:
  awa += 200000
elif X==1:
  awa += 300000
  
if Y==3:
  awa += 100000
elif Y==2:
  awa += 200000
elif Y==1:
  awa += 300000
  
if X==1 and Y==1:
  awa += 400000
  
print(awa)

Buggy submission (verdict: Runtime Error):
X,Y=map(int,input().split())
awa=0

if X==3:
  awa += 100000
elif X==2:
  awa += 200000
else X==1:
  awa += 300000
  
if Y==3:
  awa += 100000
elif Y==2:
  awa += 200000
else Y==1:
  awa += 300000
  
if X==1 and Y==1:
  awa += 400000
  
print(awa)
Problem p02866 (python)

Fixed submission:
from collections import Counter
N=int(input())
D=list(map(int, input().split() ))
d=dict(Counter(D))
p=998244353
#print(d)
maxi=max(d)

ans=1
if D[0]!=0:
  print(0)
else:
  if d[0]!=1:
    print(0)
  else:
    for i in range(1,maxi+1):
      if i not in d:
        print(0)
        exit()
      else:
        s =  (d[i-1]**d[i])%p
        ans = (ans * s)%p
    print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
D=list(map(int, input().split() ))
d=dict(Counter(D))
p=998244353
#print(d)
maxi=max(d)

mini=float("inf")
ans=1
if D[0]!=0:
  print(0)
else:
  if d[0]!=1:
    print(0)
  else:
    for i in range(1,maxi+1):
      mini=min(mini,d[i])
      if i not in d:
        print(0)
        exit()
      else:
        s =  (d[i-1]**d[i])%p
        ans = (ans * s)%p
    print(ans)
    print(mini)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
D=list(map(int, input().split() ))
d=dict(Counter(D))
p=998244353

#print(d)

ans=1
if 0 not in d:
  print(0)
else:
  if d[0]!=1:
    print(0)
  else:
    for num in d:
      if num==0:
        pass
      else:
        s= ((d[num-1])**d[num])%p
        ans = (ans * s)%p
    print(ans)

Buggy submission (verdict: Runtime Error):
def combi(n,r):
  s = fac[n]
  t = fac[r]
  u = fac[n-r]
  ans = (s*pow(t,p-2,p)*pow(u,p-2,p) )%p
  return ans
  
from collections import Counter
N=int(input())
D=list(map(int, input().split() ))
di=dict(Counter(D))
p=998244353

fac=[1]
for i in range(1,N):
  fac.append( (fac[-1]*i)%p )

ans=1
for i,num in enumerate(sorted(di)):
  if i==0:
    if di[num]!=1:
      ans=0
      break
  else:    
    ans = (ans * combi(di[i-1]+di[i]-1,di[i-1]-1))%p
    ans = (ans * fac[ di[i-1] ]) %p
    print(i,num,di[num],combi(di[i-1]+di[i]-1,di[i-1]-1),fac[ di[i-1] ],ans)
  
print(ans)
Problem p02903 (python)

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

for i in range(B):
  print("0" * A+ "1" * (W-A))
for i in range(B,H):
  print("1" * A+ "0" * (W-A))

Buggy submission (verdict: Runtime Error):
H,W,A,B=map(int,input().split())
a=[ [-1 for _ in range(W)] for _ in range(H) ]

L=0
for i in range(H):
  R=min(L+A,W)
  for j in range(L,R):
    a[i][j]=0
  for j in range(R,W):
    a[i][j]=1
  if L+A>W:
    p =L+A
    for j in range(0,p):
      a[i][j]=1
    L=p
  else:
    for j in range(0,L):
      a[i][j]=1
    L =L+A

for j in range(W):
  cnt=0
  for i in range(H):
    cnt += a[i][j]
  if min(cnt,H-cnt)>B:
    ans="No"
    print(ans)
    exit()
else:
  for gyou in a:
    st = list( map(str,gyou) )
    print("".join(st))

Buggy submission (verdict: Runtime Error):
H,W,A,B=map(int,input().split())
a=[ [-1 for _ in range(W)] for _ in range(H) ]

L=0
for i in range(H):
  R=min(L+A,W)
  for j in range(L,R):
    a[i][j]=0
  for j in range(R,W):
    a[i][j]=1
  if L+A>W:
    p =L+A
    for j in range(0,p):
      a[i][j]=1
    L=p
  else:
    for j in range(0,L):
      a[i][j]=1
    L =L+A

for j in range(W):
  cnt=0
  for i in range(H):
    cnt += a[i][j]
  if min(cnt,H-cnt)>B:
    ans="No"
    print(ans)
    break
else:
  for gyou in a:
    st = list( map(str,gyou) )
    print("".join(st))
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline

N,Q=map(int,input().split())
a=[0]*(N-1)
b=[0]*(N-1)
p=[0]*Q
x=[0]*Q
c=[[] for _ in range(N)]  #接続リスト
cnt=[0]*N  #カウンター値

for i in range(N-1):
  a[i],b[i]=map(int,input().split())
  c[a[i]-1].append(b[i]-1)
  c[b[i]-1].append(a[i]-1)
for i in range(Q):
  p[i],x[i]=map(int,input().split())
  cnt[p[i]-1] += x[i]

def dfs(x,parent):
  if parent!=-1:
    cnt[x] += cnt[parent]
  for child in c[x]:
    if child!=parent:
      dfs(child,x)

dfs(0,-1)
print(*cnt)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline

N,Q=map(int,input().split())
a=[0]*(N-1)
b=[0]*(N-1)
p=[0]*Q
x=[0]*Q
c=[[] for _ in range(N)]  #接続リスト
cnt=[0]*N  #カウンター値

for i in range(N-1):
  a[i],b[i]=map(int,input().split())
  c[a[i]-1].append(b[i]-1)
  c[b[i]-1].append(a[i]-1)
for i in range(Q):
  p[i],x[i]=map(int,input().split())
  cnt[p[i]-1] += x[i]

def dfs(x,parent):
  if parent!=-1:
    cnt[x] += cnt[parent]
  for child in c[x]:
    if child!=parent:
      dfs(child,x)

dfs(0,-1)
print(*cnt)

Buggy submission (verdict: Runtime Error):
N,Q=map(int,input().split())
a=[0]*(N-1)
b=[0]*(N-1)
p=[0]*Q
x=[0]*Q
c=[[] for _ in range(N)]  #接続リスト
cnt=[0]*N  #カウンター値

for i in range(N-1):
  a[i],b[i]=map(int,input().split())
  c[a[i]-1].append(b[i]-1)
  c[b[i]-1].append(a[i]-1)
for i in range(Q):
  p[i],x[i]=map(int,input().split())
  cnt[p[i]-1] += x[i]

def dfs(x,parent):
  if parent!=-1:
    cnt[x] += cnt[parent]
  for child in c[x]:
    if child!=parent:
      dfs(child,x)

dfs(0,-1)
print(*cnt)

Buggy submission (verdict: Runtime Error):
N,Q=map(int,input().split())
a=[0]*(N-1)
b=[0]*(N-1)
p=[0]*Q
x=[0]*Q
c=[[] for _ in range(N)]  #接続リスト
cnt=[ 0 for _ in range(N)]  #カウンター値

for i in range(N-1):
  a[i],b[i]=map(int,input().split())
  c[a[i]-1].append(b[i]-1)
  c[b[i]-1].append(a[i]-1)
for i in range(Q):
  p[i],x[i]=map(int,input().split())
  cnt[p[i]-1] += x[i]

def dfs(x,parent):
  if parent!=-1:
    cnt[x] += cnt[parent]
  for child in c[x]:
    if child!=parent:
      dfs(child,x)

dfs(0,-1)
print(*cnt)
Problem p03023 (python)

Fixed submission:
print(180*( int(input())-2 ))

Buggy submission (verdict: Runtime Error):
print(180*(int(input())-2)
Problem p03024 (python)

Fixed submission:
S=input()
if S.count("o")+(15-len(S))>=8:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
S=input()
if S.count("o")+(15-len(S)>=8:
  print("YES")
else:
  print("NO")
Problem p03069 (python)

Fixed submission:
N=int(input())
S = input()

W=[1 if S[0]=="." else 0]
ans=float("inf")

for i in range(1,N):
  if S[i]==".":
    W.append(W[-1]+1)
  else:
    W.append(W[-1])
    
if W[-1]==0 or W[-1]==N:
  print(0)
  exit()

for i in range(N):
  cost_W = i+1-W[i]
  cost_B = W[-1]-W[i]
  cost=cost_W+cost_B
  #print(N, W[-1], i+1, W[i])
  #print(i,"cost_W:",cost_W,"cost_B:",cost_B,"Total",cost)
  ans=min(ans,cost)
ans=min(W[-1],N-W[-1],ans)
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
S = input()

if N==1:
  print(0)
  exit()
else:
  W=[1 if S[0]=="." else 0]
  ans=float("inf")

  for i in range(1,N):
    if S[i]==".":
      W.append(W[-1]+1)
    else:
      W.append(W[-1])
      
  if W[-1]==0 or W[-1]==N:
    print(0)
    eixt()

  for i in range(N):
    cost_W = i+1-W[i]
    cost_B = W[-1]-W[i]
    cost=cost_W+cost_B
    #print(N, W[-1], i+1, W[i])
    #print("cost_W:",cost_W,"cost_B:",cost_B,"Total",cost)
    ans=min(ans,cost)
    print(ans)
Problem p03074 (python)

Fixed submission:
N,K=map(int,input().split())
S=list(input())
T=[int(a) for a in S]
U=[]

if N==1:
  U=[ [T[0],1] ]
else:
  tmp=T[0]
  cnt=1
  for i in range(1,N):
    if i==N-1:
      if T[i]==T[i-1]:
        cnt+=1
        U.append([tmp,cnt] )
      else:
        U.append([tmp,cnt] )
        U.append([T[i],1])
    else:
      if T[i]==T[i-1]:
        cnt+=1
      else:
        U.append([tmp,cnt] )
        tmp=T[i]
        cnt=1

summ=0
for j in range(len(U)):
  summ += U[j][1]
  U[j][1]=summ
if U[0][0]==0:
  U.insert(0,[1,0])
  U.insert(0,[0,0])
else:
  U.insert(0,[0,0])

#print(U)
maxi=0
  
for p,q in enumerate(U):
  if q[0]==1:
    pass
  else:
    right=min(p+K*2+1,len(U)-1)
    diff=U[right][1]-U[p][1]
    maxi=max(diff,maxi)
    #print(p,right,diff)
print(maxi)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=list(input())
T=[int(a) for a in S]
U=[]

tmp=T[0]
cnt=1
for i in range(1,N):
  if i==N-1:
    if T[i]==T[i-1]:
      cnt+=1
      U.append((tmp,cnt) )
    else:
      U.append((tmp,cnt) )
      U.append((T[i],1))
  else:
    if T[i]==T[i-1]:
      cnt+=1
    else:
      U.append((tmp,cnt) )
      tmp=T[i]
      cnt=1
    
print(U)

for _ in range(K):
  maxi=0
  for i,kumi in enumerate(U):
    if kumi[0]==0:
      if i==0:
        if len(U)>1:
          tmp = kumi[1]+U[i+1][1]
        else:
          tmp= kumi[1]
      elif 0<i<len(U)-1:
        tmp = U[i-1][1] + kumi[1]+ U[i+1][1]
      else: # i=len(U)-1
        tmp= U[i-1][1] + kumi[1]
      maxi=max(maxi,tmp)
  print("search:",maxi)
  for i,kumi in enumerate(U):
    if kumi[0]==0 and kumi[1]==maxi:
      if i==0:
        if len(U)>1:
          U[1][1] += kumi[1]
          U.pop(0)
        else:
          kumi[0]=1
      elif 0<i<len(U)-1:
        U[i-1][1] += kumi[1]+U[i+1][1]
        U.pop(i)
        U.pop(i)
      else: # i=len(U)-1
        U[i-1][1] += kumi[1]
        U.pop()
  print(U)
Problem p03085 (python)

Fixed submission:
def main():
  b=input()

  if b=="A":
    print("T")
  elif b=="C":
    print("G")
  elif b=="G":
    print("C")
  elif b=="T":
    print("A")

main()

Buggy submission (verdict: Runtime Error):
def main():
  b=int(input())

  if b=="A":
    return "T"
  elif b=="C":
    return "G"
  elif b="G":
    return "C"
  elif b=="T":
    return "A"

main()
Problem p03105 (python)

Fixed submission:
def main():
  A,B,C=map(int, input().split())

  if B>= A*C:
    print(C)
  else:
    print(B//A)

main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
{ % if prediction_success % }
{ % endif % }
{ % if mod or yes_str or no_str % }

{ % endif % }
{ % if mod % }
MOD = None  # type: int
{ % endif % }
{ % if yes_str % }
YES = "None"  # type: str
{ % endif % }
{ % if no_str % }
NO = "None"  # type: str
{ % endif % }
{ % if prediction_success % }


def solve(A: int, B: int, C: int):
    return
{ % endif % }


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    { % if prediction_success % }

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)
    { % else % }
    # Failed to predict input format
    pass
    { % endif % }


if __name__ == '__main__':
    main()
Problem p03231 (python)

Fixed submission:
from fractions import gcd
N,M=map(int,input().split())
S=input()
T=input()
L=N*M//gcd(N,M)
p=[]
q=[]

if S[::L//M]==T[::L//N]:
  print(L)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N,M=map(int,input().split())
S=input()
T=input()
ans=L
L=N*M//gcd(N,M)

U=[]
V=[]

#1個目
for i in range(N):
  U.append( [i*(L//N),S[i]])
#2個目
for i in range(M):
  V.append( [i*(L//M),T[i]])
#print(U)
#print(V)
for i in U:
  for j in V:
    if i[0]==j[0] and i[0]!=j[1]:
      print(-1)
      exit()


#  U[i*(L//N)]=S[i]
#  if U[j*(L//M)]!="#" and U[j*(L//M)]!=T[j]:
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N,M=map(int,input().split())
S=input()
T=input()
ans=L
L=N*M//gcd(N,M)

U=[]
V=[]

#1個目
for i in range(N):
  U.append( [i*(L//N),S[i]])
#2個目
for i in range(M):
  V.append( [i*(L//M),T[i]])
#print(U)
#print(V)
for i in U:
  for j in V:
    if i[0]==j[0] and i[0]!=j[1]:
      print(-1(
      exit


#  U[i*(L//N)]=S[i]
#  if U[j*(L//M)]!="#" and U[j*(L//M)]!=T[j]:
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N,M=map(int,input().split())
S=input()
T=input()

t=math.gcd(N,M)

if t==1:
  print(N*M)
elif t==min(N,M):
  print("-1")
elif:
  print(t*max(N,M))

Buggy submission (verdict: Runtime Error):
import math

N,M=map(int,input().split())
S=input()
T=input()
n=1

t=math.gcd(N,M)

if t==1:
  print(N*M)
elif t==min(N,M):
  print(-1)
elif:
  print(t*max(N,M))
Problem p03238 (python)

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

        
main()

Buggy submission (verdict: Runtime Error):
def main():
    N= int(input())
    A= int(input())
    B= int(input())

    if N==1:
        print("Hello World") 
    else:
        print(A+B)
        
main()

Buggy submission (verdict: Runtime Error):
def main():
    N= input()
    A= int(input())
    B= int(input())

    if N==1:
        print("Hello World") 
    else:
        print(A+B)
        
main()

Buggy submission (verdict: Runtime Error):
def main()
    N= input()
    A= input()
    B= input()

    If N==1:
        print("Hello World") 
    else:
        print(A+B)
        
main()
Problem p03239 (python)

Fixed submission:
def main():
    N,T= (int(i) for i in input().split())
    a_min=1001

    for i in range(N):
        ai,bi= (int(j) for j in input().split())  
        if bi<= T:
            if ai <= a_min:
                a_min = ai

    if a_min==1001:
        print("TLE")
    else:
        print(a_min)
          
     
main()

Buggy submission (verdict: Runtime Error):
def main():
    N,T= (int(i) for i in input().split())
    A=[]
    B=[]
    
    for i in range(N):
        ai,bi= (int(j) for j in input().split())  
        A.append(ai)
        B.append(bi)

    if (min(A)) <= T:
        print(min((A))
    else:
        print("TLE")
    
          
main()
Problem p03244 (python)

Fixed submission:
from collections import Counter
n=int(input())
v=list(map(int,input().split()))

A=v[0::2]
B=v[1::2]
a=len(A)
b=len(B)

#print(Counter(A).most_common()[0][0])
#print(Counter(B).most_common()[0][0])

if Counter(A).most_common()[0][0] !=Counter(B).most_common()[0][0]:
    s=Counter(A).most_common()[0][1]
    t=Counter(B).most_common()[0][1]
    print( (a-s)+(b-t))
else:
  r=a
  s=b
  if Counter(A).most_common()[0][1]<a:
    o=Counter(A).most_common()[1][1]
    p=Counter(B).most_common()[0][1]
    r= (a-o)+(b-p)
  if Counter(B).most_common()[0][1]<b:
    w=Counter(A).most_common()[0][1]
    x=Counter(B).most_common()[1][1]
    s= (a-w)+(b-x)
  print(min( r, s))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
v=list(map(int,input().split()))

A=v[0::2]
B=v[1::2]
a=len(A)
b=len(B)

#print(Counter(A).most_common()[0][0])
#print(Counter(B).most_common()[0][0])

if Counter(A).most_common()[0][0] !=Counter(B).most_common()[0][0]:
    s=Counter(A).most_common()[0][1]
    t=Counter(B).most_common()[0][1]
    print( (a-s)+(b-t))
else:
    o=Counter(A).most_common()[1][1]
    p=Counter(B).most_common()[0][1]
    r= (a-o)+(b-p)
    w=Counter(A).most_common()[0][1]
    x=Counter(B).most_common()[1][1]
    s= (a-w)+(b-x)
    print(min( r, s))
Problem p03262 (python)

Fixed submission:
import copy
from fractions import gcd
N,X=map(int,input().split())
x=list(map(int,input().split()))
z=copy.deepcopy(x)+[X]
z.sort()

if N>1:
  y=[0]*N
  for i in range(N):
    y[i] = z[i+1]-z[i]
  ans=y[0]
  for j in range(N):
    ans = gcd(y[j],ans)
  print(ans)
else:
  print(abs(X-x[0]))

Buggy submission (verdict: Runtime Error):
import copyfrom fractions import gcd
N,X=map(int,input().split())
x=list(map(int,input().split()))
z=copy.deepcopy(x)+[X]
z.sort()

if N>1:
  y=[0]*N
  for i in range(N):
    y[i] = z[i+1]-z[i]
  ans=y[0]
  for j in range(N):
    ans = gcd(z[j],ans)
  print(ans)
else:
  print(abs(X-x[0]))
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
A,B=map(input().split())
print((A-1)*(B-1))
Problem p03282 (python)

Fixed submission:
S=input()
K=float(input())
lis=list(S)
ss=set(lis)

if len(ss)==1:
  print(S[0])
else:
  if K<=len(S):
    check_list=lis[:int(K)]
    check_set=set(check_list)
    if len(check_set)==1:
      print(check_list[0])
    else:
      for num in lis:
        if int(num)!=1:
          print(int(num))
          break            
  else:
    for num in lis:
      if int(num)!=1:
        print(int(num))
        break

Buggy submission (verdict: Runtime Error):
S=input()
K=float(input())
lis=list(S)
ss=set(lis)

if len(ss)==1:
  print(S[0])
else:
  if K<=len(S):
    check_list=lis[:K]
    check_set=set(check_list)
    if len(check_set)==1:
      print(check_list[0])
    else:
      for num in lis:
        if int(num)!=1:
          print(int(num))
        break            
  else:
    for num in lis:
      if int(num)!=1:
        print(int(num))
        break
Problem p03285 (python)

Fixed submission:
N=int(input())
flag=False

for i in range(N//4+1):
  if flag==False:
    for j in range(N//7+1):
      if 4*i+7*j==N:
        print("Yes")
        flag=True
        break


if flag==False:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())

for i in range(N//4+1):
  for i in range(N//7+1):
    if 4*i+7*j==N:
      print("Yes")
      break
else:
  print("No")
Problem p03289 (python)

Fixed submission:
S=input()
flag=False

if S[0]=="A":
  if S[2:-1].count("C")==1:
    pos=S.find("C")
    T=S[1:pos]+S[pos+1:]
    if T.islower():
      print("AC")
      flag=True
      
if flag==False:
  print("WA")

Buggy submission (verdict: Runtime Error):
S=input()
flag=False

if S[0]=="A":
  if S[2:-1].count("C")==1:
    pos=S.find("C")
    T=S[1:pos]+S[pos+1:]
    if T.islower():
      print("AC")
      flag=True
      
if flag=False:
  print("WA")