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

Fixed submission:
##!/usr/bin/env python
## -*- coding: utf-8 -*-
#import sys
#import os
#f = open('input.txt', 'r')
#sys.stdin = f
#input = sys.stdin.readline
# A　range flip find route

h, w = map(int, input().split())

dp = [[0 for i in range(w)] for j in range(h)]

maze = []
for i in range(h):
    sub = list(input())
    maze.append(sub)

if maze[0][0] == "#":
    dp[0][0] = 1
for i in range(1, w):
    if maze[0][i - 1] == "." and maze[0][i] == "#":
        dp[0][i] = dp[0][i - 1] + 1

    else:
        dp[0][i] = dp[0][i - 1]
for j in range(1, h):
    if maze[j - 1][0] == "." and maze[j][0] == "#":
        dp[j][0] = dp[j - 1][0] + 1
    else:
        dp[j][0] = dp[j - 1][0]

for i in range(1, h):
    for j in range(1, w):
        d = dp[i - 1][j]
        e = dp[i][j - 1]
        if maze[i - 1][j] == "." and maze[i][j] == "#":
            d += 1
        if maze[i][j - 1] == "." and maze[i][j] == "#":
            e += 1
        dp[i][j] = min(d, e)
print(dp[h - 1][w - 1])

Buggy submission (verdict: Runtime Error):
##!/usr/bin/env python
## -*- coding: utf-8 -*-
#import sys
#import os
#f = open('input.txt', 'r')
#sys.stdin = f
#input = sys.stdin.readline
# A　range flip find route

h, w = map(int, input().split())

dp = [[0 for i in range(w)] for j in range(h)]

maze = []
for i in range(h):
    sub = list(input())[:-1]
    maze.append(sub)

if maze[0][0] == "#":
    dp[0][0] = 1
for i in range(1, w):
    if maze[0][i - 1] == "." and maze[0][i] == "#":
        dp[0][i] = dp[0][i - 1] + 1

    else:
        dp[0][i] = dp[0][i - 1]
for j in range(1, h):
    if maze[j - 1][0] == "." and maze[j][0] == "#":
        dp[j][0] = dp[j - 1][0] + 1
    else:
        dp[j][0] = dp[j - 1][0]

for i in range(1, h):
    for j in range(1, w):
        d = dp[i - 1][j]
        e = dp[i][j - 1]
        if maze[i - 1][j] == "." and maze[i][j] == "#":
            d += 1
        if maze[i][j - 1] == "." and maze[i][j] == "#":
            e += 1
        dp[i][j] = min(d, e)
print(dp[h - 1][w - 1])
Problem p02777 (python)

Fixed submission:
s=list(input().split())
a,b=map(int,input().split())
u=input()
if s[0]==u:
    print(a-1,b)
else:
    print(a,b-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
K=int(input())
if K==1:
    counter=0
    for i in range(100):
        for j in range(1,10):
            a="0"*(i)+str(j)+"0"*(99-i)
            if 1<=int(a)<=n:
                counter+=1
    print(counter)
elif K==2:
    counter=0
    for i in range(100):
        for j in range(i+1,100):
            for k in range(1,10):
                for l in range(1,10):
                    a="0"*(i)+str(k)+"0"*(j-i-1)+str(l)+"0"*(99-j)
                    if 1<=int(a)<=n:
                        counter+=1
    print(counter)
elif K==3:
    counter=0
    for i in range(100):
        if 100-i>len(str(n)):
            pass
        elif 100-i<len(str(n)):
            for j in range(i+1,100):
                for k in range(j+1,100):
                    counter+=9*9*9
        elif 100-i==len(str(n)):
            for j in range(i+1,100):
                for k in range(j+1,100):
                    for a in range(int(str(n)[i]),int(str(n)[i])+1):
                        for b in range(1,10):
                            for c in range(1,10):
                                P=str(a)+"0"*(j-i-1)+str(b)+"0"*(k-j-1)+str(c)+"0"*(99-k)
                                if 1<=int(P)<=n:
                                    counter+=1
            counter+=((98-i)*(99-i)//2)*9*9*(int(str(n)[i])-1)
    print(counter)
Problem p02792 (python)

Fixed submission:
n=int(input())
lists=[[ [] for j in range(10)]for i in range(10)]
for i in range(1,n+1):
    a=str(i)
    lists[int(str(a[0]))][int(str(a[-1]))].append(i)
c=0
for i in range(1,10):
    for j in range(1,10):
        c+=len(lists[i][j])*len(lists[j][i])
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
lists=[[ 0 for j in range(10)]for i in range(10)]
for i in range(1,n+1):
    a=str(i)
    lists[int(a[0])][int(a[-1])]+=1
c=0
for i in range(1,10):
    for j in range(1,10):
        c+=lists[i][j])*lists[j][i]
print(c)
Problem p02829 (python)

Fixed submission:

a=int(input())
b=int(input())
for j in range(1,4):
    if j!=a and j!=b:
        print(j)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000000)
n,u,v=map(int,input().split())
visitedlist=[-1 for  i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
        a,b=map(int,input().split())
        kilist[a-1].append(b)
        kilist[b-1].append(a)
def search(P):
        searchedlist[P-1]=1
        visitedlist[P-1]=1
        flag=0
        for j in kilist[P-1]:
            if visitedlist[j-1]<0:
                visitedlist[j-1]=1
                flag+=1
                anslist[j-1]=anslist[P-1]+1
        else:
            pass

        if flag>0:    
            for k in kilist[P-1]:
                if searchedlist[k-1]==-1:
                    search(k)
search(v)
if v<u:
	print(anslist[u]-1)
else:
  if u>1:
  	print(v-u)
  else:
    print(v-2)
Problem p02834 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000000)
n,u,v=map(int,input().split())
kilist=[[] for i in range(n)]
for i in range(n-1):
        a,b=map(int,input().split())
        kilist[a-1].append((b,1))
        kilist[b-1].append((a,1))    
visitedlist=[-1 for  _ in range(n)]
anslist=[0 for _ in range(n)]
searchedlist=[-1 for _ in range(n)]        
def search(i):
        searchedlist[i-1]=1
        visitedlist[i-1]=1
        flag=0
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag+=1
                anslist[j[0]-1]=anslist[i-1]+j[1]
        else:
            pass
        if flag>0:    
            for k in kilist[i-1]:
                if searchedlist[k[0]-1]==-1:
                    search(k[0])
search(u)
u_list=anslist.copy()
visitedlist=[-1 for  _ in range(n)]
anslist=[0 for _ in range(n)]
searchedlist=[-1 for _ in range(n)]  

q=search(v)
v_list=anslist.copy()

maxi=0
for i in range(n):
    if u_list[i]<=v_list[i]:
        maxi=max(maxi,v_list[i])
print(maxi-1)

Buggy submission (verdict: Runtime Error):
n,u,v=map(int,input().split())
visitedlist=[-1 for  i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
        a,b=map(int,input().split())
        kilist[a-1].append(b)
        kilist[b-1].append(a)
def search(P):
        searchedlist[P-1]=1
        visitedlist[P-1]=1
        flag=0
        for j in kilist[P-1]:
            if visitedlist[j-1]<0:
                visitedlist[j-1]=1
                flag+=1
                anslist[j-1]=anslist[P-1]+1
        else:
            pass

        if flag>0:    
            for k in kilist[P-1]:
                if searchedlist[k-1]==-1:
                    search(k)
search(v)
if v<u:
	print(anslist[u]-1)
else:
  if u>1:
  	print(v-u)
  else:
    print(v-2)
Problem p02863 (python)

Fixed submission:
#ALL you can eat 
#0-1 なっぷサック問題をとく* N

#要領T-1のバックと　大きさがA,価値がBの荷物がNこずつある。　この時これらを使って価値をT-1をこえない範囲で最大にする方法を考える。


#dpl[N][V]=1番目からN番目までの荷物を用いて、重さをVにする上で実現可能な価値の最大値
N,T=map(int,input().split())
d=[]
for i in range(N):
    a,b=map(int,input().split())
    d.append((a,b))
dpl=[[0 for i in range(T)] for j in range(N+1)]
for i in range(N):
    weight,value=d[i]
    for j in range(T):
        if j>=weight:
            dpl[i+1][j]=max(dpl[i][j],dpl[i][j-weight]+value)
        else:
            dpl[i+1][j]=dpl[i][j]

            
#dpr[K][V]=K番目からN番目までの荷物を用いて、重さをVにする上で実現可能な価値の最大値
dpr=[[0 for i in range(T)] for j in range(N+2)]
for i in range(1,N+1):
    weight,value=d[-i]
    for j in range(T):
        if j>=weight:
            dpr[N+1-i][j]=max(dpr[N+2-i][j],dpr[N+2-i][j-weight]+value)
        else:
            dpr[N+1-i][j]=dpr[N+2-i][j]

#dpr[K][V]=K番目からN番目までの荷物を用いて重さをV以下にする上で実現可能な価値の最大値にする
for i in range(1,N+1):
    for j in range(1,T):
        dpr[i][j]=max(dpr[i][j],dpr[i][j-1])
    
ans=0
for i in range(N):
    sub=d[i][1]
    #i+1番目の物を使わない
    add=0
    for j in range(T):
        add=max(add,dpl[i][j]+dpr[i+2][T-1-j])
    sub+=add
    ans=max(sub,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
#E-all you can eat
n,t=map(int,input().split())
how=0
T=how+t-1
uselist=[list(map(int,input().split())) for i in range(n)]
lists=sorted(uselist,key=lambda x: (-x[1],x[0]))
print(lists)
j=0
def search():
    global T
    global ans
    ans=0
    T=T
    flag2=True
    flag=False
    for i in range(n):
        print(lists[i])
        if lists[i][0]<=T:
            ans+=lists[i][1]
            T-=lists[i][0]
            lists[i]=[10**9,10**9]
            flag=True
            break
        else:
            continue
    if not flag:
        flag2=False
        j=ans

    if T>=0 and flag2:
        return search()
search()
print(j)
Problem p02912 (python)

Fixed submission:
from bisect import bisect_right
import heapq
n,m=map(int,input().split())
lists=list(map(int,input().split()))
uselists=[]
for _ in lists:
    uselists.append(-_)

heapq.heapify(uselists)

cnt=0
while cnt<m:
    y=heapq.heappop(uselists)

    z=(-y)//2
    heapq.heappush(uselists,-z)
    

    cnt+=1
anslist=[]
for j in uselists:
    anslist.append(-j)
print(sum(anslist))

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right

n,m=map(int,input().split())
lis=list(map(int,input().split()))
lists=sorted(lis)

cnt=0
while cnt<m:
    y=lists[-1]//2
    del lists[-1]
    
    indexes=bisect_left(lists,y)
    #indexesというところに新しいyの値を代入しておきたい
    lists.insert(indexes,y)

    cnt+=1
print(sum(lists))
Problem p02925 (python)

Fixed submission:
n=int(input())
import time
T=time.time()
data_set=[0 for i in range(n)]
for i in range(n):
    a=list(map(int,input().split()))
    a.append(-1)
    data_set[i]=a
index=[0 for i in range(n)]
ans=-1
flag=True
semi=False
now=[data_set[i][index[i]] for i in range(n)]
finished=[False for i in range(n)]
while flag:
    visited=[False for i in range(n)]
    sub=False
    for i in range(n):
        #nowリストのうち日ありからi+1番目のものについての一致条件の確認
        K=now[i]
        if now[K-1]==i+1 and not(visited[i] or visited[K-1]) and not(finished[i] or finished[K-1]):
                    visited[i]=True
                    visited[K-1]=True
                    index[i]+=1
                    index[K-1]+=1
                    sub=True
                    if index[i]==n-1:
                        finished[i]=True             
                    now[i]=data_set[i][index[i]]
                    if index[K-1]==n-1:
                        finished[K-1]=True                   
                    now[K-1]=data_set[K-1][index[K-1]]
    if not sub:
        flag=False
    if time.time()-T>1.5:
        flag=False
        semi=True
    ans+=1
judge=True
for i in range(n):
  if finished[i]==False:
    judge=False
    break
if judge:
  print(ans)
else:
  if not semi:
    print(-1)
  if semi:
    print(499500)

Buggy submission (verdict: Runtime Error):
n=int(input())
data_set=[0 for i in range(n)]
for i in range(n):
    a=list(map(int,input().split()))
    a.append(-1)
    data_set[i]=a
index=[0 for i in range(n)]
ans=-1
flag=True
semi=True
now=[data_set[i][index[i]] for i in range(n)]
finished=[False for i in range(n)]
while flag:
    visited=[False for i in range(n)]
    sub=False
    for i in range(n):
        #nowリストのうち日ありからi+1番目のものについての一致条件の確認
        K=now[i]
        if now[K-1]==i+1 and not(visited[i] or visited[K-1]) and not(finished[i] or finished[K-1]):
                    visited[i]=True
                    visited[K-1]=True
                    index[i]+=1
                    index[K-1]+=1
                    sub=True
                    if index[i]==n-1:
                        finished[i]=True             
                    now[i]=data_set[i][index[i]]
                    if index[K-1]==n-1:
                        finished[K-1]=True                   
                    now[K-1]=data_set[K-1][index[K-1]]
    if not sub:
        flag=False
    ans+=1
    if ans>1000:
    	flag=False
        semi=True
judge=True
for i in range(n):
  if finished[i]==False:
    judge=False
    break
if judge:
  print(ans)
else:
  if not semi:
  	print(-1)
  else:
    print(499500)
Problem p02933 (python)

Fixed submission:
a=int(input())
s=input()
if a>=3200:
	print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
a=int(input())
s=input()
if a>=3200:
	print(s)
else:
print("red")
Problem p02987 (python)

Fixed submission:
s=input()
import collections
s=dict(collections.Counter(s))
if len(s)==2:
  flag=True
  for k in s.values():
    if k!=2:
      flag=False
  if flag:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
import colletions
s=dict(collections.Counter(s))
if len(s)==2:
  flag=True
  for k in s.values():
    if k!=2:
      flag=False
  if flag:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Problem p02989 (python)

Fixed submission:
n=int(input())
s=list(map(int,input().split()))

changed=sorted(s,reverse=True)


if changed[int(n/2-1)]==changed[int(n/2)]:
        print(0)
else:
        print(-changed[int(n/2)]+changed[int(n/2-1)])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
use=[0]
ans=1
for i in range(m):
    use.append(int(input()))
use.append(n)

if n>=2:        
    lists=[1,2]

    for i in range(n-2):
        lists.append((lists[-1]+lists[-2])%1000000007)

    
    for i in range(m+1):
    
        if use[i+1]-use[i]==1 and i>=1:
            ans=0
            break
        else:
            ans=(ans*lists[int(use[i+1]-use[i]-2)])%1000000007
            
            
    print(ans)
elif n==1:
    print(1)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(map(int,input().split()))

changed=sorted(s,reverse=True)


    if changed[int(n/2-1)]==changed[int(n/2)]:
        print(0)
    else:
        print(-changed[int(n/2)]+changed[int(n/2-1)])
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
print("".join(s))

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

n=int(input())
visitedlist=[-1 for  i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
        a,b,c=map(int,input().split())
        kilist[a-1].append((b,c))
        kilist[b-1].append((a,c))
def search(i):
        searchedlist[i-1]=1
        visitedlist[i-1]=1
        flag=0
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag+=1
                anslist[j[0]-1]=anslist[i-1]+j[1]
        else:
            pass

        if flag>0:    
            for k in kilist[i-1]:
                if searchedlist[k[0]-1]==-1:
                    search(k[0])
search(2)
for i in anslist:
    print(i%2)

Buggy submission (verdict: Runtime Error):
#d-even relation
#ふかさ優先探索の実装
#再起関数の実装を行う
n=int(input())
visitedlist=[-1 for  i in range(n)]
lists=[tuple(map(int,input().split())) for i in range(n-1)]
kilist=[[] for i in range(n)]
for i in lists:
    kilist[i[0]-1].append(i[1:])
    kilist[i[1]-1].append(i[0:3:2])
visitedlist[0]=1
anslist=[0 for i in range(n)]
#開始地点1のところは0を基準としている
#1には初めに訪れる
def search(i):
        flag=False
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag=True
                if j[1]%2==0:
                    anslist[j[0]-1]=anslist[i-1]
                elif j[1]%2!=0:
                    anslist[j[0]-1]=1-anslist[i-1]      
            else:
                pass  
        if flag:    
            for j in kilist[i-1]:
                return search(j[0])
        if not flag:
            pass
            
search(1)
for k in anslist:
    print(k)
Problem p03075 (python)

Fixed submission:
lists=[]
for i in range(5):
  nums=int(input())
  lists.append(nums)
dis=int(input())
lists=sorted(lists)
if lists[-1]-lists[0]<=dis:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
lists=[]
for i n range(5):
  nums=int(input())
  lists.append(nums)
dis=int(input())
lists=sorted(lists)
if lists[-1]-lists[0]<=dis:
  print("Yay!")
else:
  print(":(")
Problem p03127 (python)

Fixed submission:
import fractions
n=int(input())
lists=list(map(int,input().split()))
gcds=lists[0]
for x in range(n-1):
    if n==0:
        gcds=fractions.gcd(lists[0],lists[1])
    else:
        add=fractions.gcd(lists[x],lists[x+1])
        gcds=fractions.gcd(gcds,add)
print(gcds)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
lists=list(map(int,input().split()))
gcds=lists[0]
for x in range(n-1):
    if x==0:
        gcds=math.gcd(lists[0],lists[1])
    else:
        add=math.gcd(lists[x],lists[x+1])
        gcds=math.gcd(gcds,add)
print(gcds)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
lists=list(map(int,input().split()))
gcds=lists[0]
for x in range(n-1):
    if x==0:
        gcds=math.gcd(lists[0],lists[1])
    else:
        add=math.gcd(lists[x],lists[x+1])
        gcds=math.gcd(gcds,add)
print(gcds)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
lists=list(map(int,input().split()))
gcds=lists[0]
for x in range(n-1):
    if n==0:
        gcds=math.gcd(lists[0],lists[1])
    else:
        add=math.gcd(lists[x],lists[x+1])
        gcds=math.gcd(gcds,add)
print(gcds)
Problem p03221 (python)

Fixed submission:
n,m=map(int,input().split())
somelists=[]

for i in range(m):
    a,b=map(int,input().split())
    somelists.append([i,a,b])

somelists.sort(key=lambda x:(x[1],x[2]))

prefs=1
numbers=0

for x in somelists:
    
    if x[1]==prefs:
        numbers+=1
        
        x.append(numbers)
    if x[1]!=prefs:
        prefs=x[1]
        numbers=1
        x.append(numbers)

somelists.sort(key=lambda x:x[0])
for _ in range(m):
    print(str(somelists[_][1]).zfill(6)+str(somelists[_][3]).zfill(6))

Buggy submission (verdict: Runtime Error):
somelists=[]

for i in range(m):
    a,b=map(int,input().split())
    somelists.append([i,a,b])

somelists.sort(key=lambda x:(x[1],x[2]))

prefs=1
numbers=0

for x in somelists:
    
    if x[1]==prefs:
        numbers+=1
        
        x.append(numbers)
    if x[1]!=prefs:
        prefs=x[1]
        numbers=1
        x.append(numbers)

somelists.sort(key=lambda x:x[0])
for _ in range(m):
    print(str(somelists[_][1]).zfill(6)+str(somelists[_][3]).zfill(6))
Problem p03618 (python)

Fixed submission:
s=list(input())
import collections
dics=collections.Counter(s)
num=len(s)
ans=num*(num-1)//2
for i in dics.values():
  ans-=(i*(i-1)//2)
print(ans+1)

Buggy submission (verdict: Runtime Error):
s=input()
def cal(n):
  if len(s)==1:
    return 0
  else:
    new=s[0]
    ans=0
    cnt=0
    for i in range(1,n):
      if s[i]!=new:
        new=s[i]

        cnt=0

        ans+=(i+1)

        

      else: s[i]==new:

          
        cnt+=1

        ans+=cnt

    return ans
Problem p03634 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
n=int(input())
visitedlist=[-1 for  i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
        a,b,c=map(int,input().split())
        kilist[a-1].append((b,c))
        kilist[b-1].append((a,c))        
def search(i):
        searchedlist[i-1]=1
        visitedlist[i-1]=1
        flag=0
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag+=1
                anslist[j[0]-1]=anslist[i-1]+j[1]
        else:
            pass

        if flag>0:    
            for k in kilist[i-1]:
                if searchedlist[k[0]-1]==-1:
                    search(k[0])
q,k=map(int,input().split())
List=[0 for i in range(q)]
search(k)
for i in range(q):
    x,y=map(int,input().split())
    List[i]=anslist[x-1]+anslist[y-1]
for j in List:
    print(j)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
n=int(input())
visitedlist=[-1 for  i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
        a,b,c=map(int,input().split())
        kilist[a-1].append((b,c))
        kilist[b-1].append((a,c))
def search(i):
        searchedlist[i-1]=1
        visitedlist[i-1]=1
        flag=0
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag+=1
                anslist[j[0]-1]=anslist[i-1]+j[1]
        else:
            pass

        if flag>0:    
            for k in kilist[i-1]:
                if searchedlist[k[0]-1]==-1:
                    search(k[0])

q,k=map(int,input().split())
List=[0 for i in range(q)]
search(k)
for i in range(q):
    x,y=map(int,input().split())
    List[i]=anslist[x-1]+anslist[y-1]
for j in List:
    print(j)
Problem p03805 (python)

Fixed submission:
import itertools

n,m=map(int,input().split())
uselist=[]
for _ in range(m):
    ad=list(map(int,input().split()))
    uselist.append(ad)
cnt=0
for i in itertools.permutations(range(1,n+1)):
    if i[0]==1:
        flag=True
        for j in range(n-1):
            if [i[j],i[j+1]]  not in uselist and [i[j+1], i[j]] not in uselist:
                flag =False
                break
            else:
                continue
        if flag==True:
            cnt+=1
        else:
            continue
        
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
uselist=[]
for _ in range(m):
    ad=list(map(int,input().split()))
    uselist.append(ad)
cnt=0
for i in itertools.permutations(range(1,n+1)):
    if i[0]==1:
        flag=True
        for j in range(n-1):
            if [i[j],i[j+1]]  not in uselist and [i[j+1], i[j]] not in uselist:
                flag =False
                break
            else:
                continue
        if flag==True:
            cnt+=1
        else:
            continue
        
print(cnt)
Problem p02627 (python)

Fixed submission:
x = input()
print('A' if ord(x) < ord('a') else 'a')

Buggy submission (verdict: Runtime Error):
n, k = input().split(" ")
n = int(n)
k = int(k)
a = [int(x) for x in input().split(" ")]
a.sort()
ans = 0
for i in range(k):
 ans += int(a[i])
print(ans)
Problem p02682 (python)

Fixed submission:
a, b, c, k = [int(i) for i in input().split(" ")]
print(min(a, k) - max(0, k-a-b))

Buggy submission (verdict: Runtime Error):
a, b, c, k = [int(i) i in input().split(" ")]
print(min(a, k) - max(0, k-a-b))

Buggy submission (verdict: Runtime Error):
a, b, c, k = [int(i) in input().split(" ")]
print(min(a, k) - max(0, k-a-b))
Problem p02723 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input())
a -= a%5
print(2*a - a%500)
Problem p03745 (python)

Fixed submission:
p = -1
xp = -1
ans = 1
input()
for i in input().split(" "):
  i = int(i)
  if i == p: continue
  if p != -1:
    x = p < i
    if xp != -1:
      ans += x != xp
    if xp != -1 and x != xp:
      xp = -1
    else:
      xp = x
  p = i
print(ans)

Buggy submission (verdict: Runtime Error):
p = -1
xp = -1
ans = 0
input()
for i in range(input().split(" ")):
  i = int(i)
  if i == p: continue
  if p != -1:
    x = p < i
    if xp != -1
      ans += x != xp
    xp = x
  p = i
Problem p02987 (python)

Fixed submission:
S = list(input())
S.sort()
if (S[0] == S[1]) and (S[2] == S[3]) and (S[1] != S[2]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S = list(input())
S.sort()
if (S[0] == S[1]) and (S[2] == S[3]):
  print(Yes)
else:
  print(No)