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

Fixed submission:
a,b=map(int,input().split())
if a%b==0:
    print(-1)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if sum(a)>=sum(b):
    print("No")
else:
    ans=0
    lim=sum(b)-sum(a)
    for i in range(n):
        if a[i]<b[i]:
            ans+=(b[i]-a[i])//2
    if ans>lim:
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a%b==0:
    print(-1)
else:
    print(x)
Problem p03469 (python)

Fixed submission:
a,b,c=input().split("/");print("2018/"+b+"/"+c)

Buggy submission (verdict: Runtime Error):
n,h=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
b=max(a,key=lambda x:x[0])[0]
c=sorted(t for(s,t)in a if t>b)[::-1]
d=0
for i in c:
    h-=i
    d+=1
    if h<0:
        print(d)
        exit()
if h>0:
    d+=max(h-1,-1)//b+1
print(d)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
for s in range(b//10000+1):
    try:
        for t in range(b//5000+1):
            r=b-s-t
            if 10000*s+5000*t+1000*r==b and s+t+r==a:
                print(s,t,r)
                exit()
    except ZeroDivisionError:
        continue
print(-1,-1,-1)
Problem p03470 (python)

Fixed submission:
print(len(set(open(0).read().split()[1:])))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
for s in range(b//10000+1):
    try:
        for t in range(b//5000+1):
            r=b-s-t
            if 10000*s+5000*t+1000*r==b and s+t+r==a:
                print(s,t,r)
                exit()
    except ZeroDivisionError:
        continue
print(-1,-1,-1)
Problem p03485 (python)

Fixed submission:
import math
a,b=map(int,input().split())
print(math.ceil((a+b)/2))

Buggy submission (verdict: Runtime Error):
*s,=map(int,open(0));print(-~sum(s)//2)

Buggy submission (verdict: Runtime Error):
input();a=list(map(int,input().split()))
print(sum([a.count(i) if (i-a.count(i))>(a.count(i)-i) else abs(i-a.count(i)) for i in set(a)]))

Buggy submission (verdict: Runtime Error):
s=sorted;print("NYoe s"[s(input())<s(input())[::-1]::2])
Problem p03487 (python)

Fixed submission:
from collections import Counter
input();a=Counter(list(map(int,input().split())))
print(sum([v if k>v else v-k for k,v in a.items()]))

Buggy submission (verdict: Runtime Error):
from collections import*;print(sum(min(abs(v-k),v)for k,v in Counter(map(int,open(0).read().split())[1:]).items()))
Problem p03488 (python)

Fixed submission:
#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)

def main():
    *s,=map(len,input().split("T"))
    x,y=map(int,input().split())
    start=s[0]
    n=s[2::2]
    m=s[1::2]
#    print(n,m)
    dx={start}
    dy={0}
#    print(dx)
    for i in n:
        dx={r+j for j in dx for r in{-i,i}}
#        print(dx)
    for i in m:
        dy={r+j for j in dy for r in{-i,i}}
#        print(dy)
    if x in dx and y in dy:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)

def main():
    *s,=map(len,input().split("T"))
    x,y=map(int,input().split())
    start=s[0]
    n=s[2::2]
    m=s[1::2]
#    print(n,m)
#    print(start)
    dx=deque()
    dy=deque()
    dx.append(start)
    dy.append(0)
    for i in range(len(n)):
        tmp=deque()
        for j in dx.copy():
            tmp.appendleft(j+n[i])
            tmp.appendleft(j-n[i])
        dx=tmp
#    print(dx)
    for i in range(len(m)):
        tmp=deque()
        for j in dy.copy():
            tmp.appendleft(j+m[i])
            tmp.appendleft(j-m[i])
        dy=tmp
#    print(dy)
    if x in dx and y in dy:
        print("Yes")
    else:
        print("No")


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

Fixed submission:
n=list(input());print("YNeos"[1-(n[0]==n[1]==n[2] or n[1]==n[2]==n[3])::2])

Buggy submission (verdict: Runtime Error):
a=input();print('YNeos'[2<len({*a})or a[1]!=a[2]::2]) #バージョンが違うせい最短（？

Buggy submission (verdict: Runtime Error):
a=input();print('YNeos'[2<len({*a})or a[1]!=a[2]::2])
Problem p03547 (python)

Fixed submission:
a,b=input().split();print([[">","="][ord(a)==ord(b)],"<"][ord(a)<ord(b)])

Buggy submission (verdict: Runtime Error):
a,b,c,d=list(input());print("YNeos"[1-(a==b==c or b==c==d)::2])

Buggy submission (verdict: Runtime Error):
X,Y=input().split();print("=><"[X>Y | -(X<Y)])

Buggy submission (verdict: Runtime Error):
X,Y=input().split();print("=><"[X>Y |-(X<Y)])
Problem p03555 (python)

Fixed submission:
s=input()
t=input()
print("YES"if s==t[::-1] else "NO")

Buggy submission (verdict: Runtime Error):
x,y=input().split();print("=><"[(x>y)-(x<y)])
Problem p03567 (python)

Fixed submission:
if "AC"in input():
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
print(3**int(input())-2**sum(~int(s)%2for s in input().split()))

Buggy submission (verdict: Runtime Error):
print(3**int(input())-2**sum(~int(s)%2 for s in input().split()))
Problem p03573 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(c if a==b else b if a==c else a)

Buggy submission (verdict: Runtime Error):
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)



def main():
    n,k=map(int,input().split())
    grid=[tuple(map(int,input().split()))for i in range(n)]
    x=set(s for s,t in grid)
    y=set(t for s,t in grid)
    ans=[]
    for i in combinations(x,2):
        for j in combinations(y,2):
            xx=max(i)
            xxx=min(i)
            yy=max(j)
            yyy=min(j)
            if sum(xxx<=s<=xx and yyy<=t<=yy for s,t in grid)>=k:
                ans.append(abs((yy-yyy)*(xx-xxx)))
    print(min(ans))
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from numpy import*
a,b=map(int,input().split())
c=["0"]*(b+2)
x=[list("0"+input().replace(".","0").replace("#","1")+"0")for i in range(a)]
x.insert(0,c)
x.append(c)
x=array(x).astype(int)
for s in range(1,1+a):
    tmp=""
    for t in range(1,1+b):
        if x[s][t]==1:
            tmp+="#"
        else:
            tmp+=str(sum(x[s-1:s+2,t-1:t+2]))
    print(tmp)
Problem p03574 (python)

Fixed submission:
from numpy import*
a,b=map(int,input().split())
c=["0"]*(b+2)
x=[list("0"+input().replace(".","0").replace("#","1")+"0")for i in range(a)]
x.insert(0,c)
x.append(c)
y=zeros((a+2,b+2))
x=array(x).astype(int)
for s in range(1,1+a):
    tmp=""
    for t in range(1,1+b):
        if x[s][t]==1:
            tmp+="#"
        else:
            tmp+=str(sum(x[s-1:s+2,t-1:t+2]))
    print(tmp)

Buggy submission (verdict: Runtime Error):
from numpy import*
a,b=map(int,input().split())
c=["0"]*(b+2)
x=[list("0"+input().replace(".","0").replace("#","1")+"0")for i in range(a)]
x.insert(0,c)
x.append(c)
x=array(x).astype(int)
for s in range(1,1+a):
    tmp=""
    for t in range(1,1+b):
        if x[s][t]==1:
            tmp+="#"
        else:
            tmp+=str(sum(x[s-1:s+2,t-1:t+2]))
    print(tmp)
Problem p03587 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
print(input().scount("1"))
Problem p03588 (python)

Fixed submission:
n,*a=map(int,open(0).read().split())
b=[a[i]for i in range(0,len(a),2)]
c=[a[i]for i in range(1,len(a),2)]
print(max(b)+c[b.index(max(b))])

Buggy submission (verdict: Runtime Error):
#n,*a=map(int,open(0).read().split())
b=[a[i]for i in range(0,len(a),2)]
c=[a[i]for i in range(1,len(a),2)]
print(max(b)+c[b.index(max(b))])

Buggy submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
b=[a[i]for i in range(0,len(a),2)]
c=[a[i]for i in range(1,len(a),2)]
print(max(b)+c[c.index(max(b))*2+1])

Buggy submission (verdict: Runtime Error):
n,*a=map(int,read(0).split())
b=max([a[i]for i in range(0,len(a),2)])
print(b+a[a.index(b)+1])
Problem p03591 (python)

Fixed submission:
if input()[:4]=="YAKI":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split());print("NYoe s"[1in[k==(b-t)*s+t*(a-s)for t in range(b+1)for s in range(a+1)]::2])
Problem p03597 (python)

Fixed submission:
n=int(input())
a=int(input())
print(n**2-a)

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;
Matrix d; // グラフの距離を格納した2次元配列（隣接行列）
Matrix D; // d[u][v]は辺e=(u,v)のコスト（辺が存在しない場合はINF、ただしd[i][i]=0）

void warshall_floyd(int n) { // nは頂点数
  for (int i = 0; i < n; i++)      // 経由する頂点
    for (int j = 0; j < n; j++)    // 開始頂点
      for (int k = 0; k < n; k++)  // 終端
        d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
}




int main() {
  int n;
  cin >> n;

  d = Matrix(n, vector<int>(n, INF));
  D = Matrix(n, vector<int>(n, INF));
  for (int i = 0; i < n; i++) d[i][i] = 0;
  
  int tmp;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin>>tmp;
      d[i][j] = tmp;
      d[j][i] = tmp;
      D[i][j] = tmp;
      D[j][i] = tmp;
    }
  }
  
  warshall_floyd(n);
  
  int ans=100000000;
  tmp=0;
  
  if (D!=d){ cout<< -1 <<endl;
  }else{
      cout<<"1"<<endl;
      
      
  }
}
Problem p03601 (python)

Fixed submission:
a,b,c,d,e,f=map(int,input().split())
maxsugar=f*e/(100+e)
maxwater=f*100/(100+e)
#print(maxsugar,maxwater)
sugar=[]
for i in range(int(maxsugar)//min(c,d)+2):
    for j in range(int(maxsugar)//min(c,d)+2):
        x=i*c+j*d
        if x<=maxsugar:
            sugar.append(x)
#print(sugar)
water=[]
for i in range(int(maxwater//100+2)//min(a,b)+5):
    for j in range(int(maxwater//100+2)//min(a,b)+5):
        y=i*a+j*b
        water.append(y)
#print(water)
water.remove(0)
ansl=[]
for i in sugar:
    for j in water:
        z=i/(j*100+i)
        xyz=i+j*100
        if xyz<=f and z<=e/(100+e):
            ansl.append((i,j,z))
s,t,r=sorted(ansl,key=lambda x:x[-1])[-1]
print(s+t*100,s)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
maxsugar=f*e/(100+e)
maxwater=f*100/(100+e)
#print(maxsugar,maxwater)
sugar=[]
for i in range(int(maxsugar)//min(c,d)+2):
    for j in range(int(maxsugar)//min(c,d)+2):
        x=i*c+j*d
        if x<=maxsugar:
            sugar.append(x)
#print(sugar)
water=[]
for i in range(int(maxwater//100+2)//min(a,b)+1):
    for j in range(int(maxwater//100+2)//min(a,b)+1):
        y=i*a+j*b
        water.append(y)
#print(water)
water.remove(0)
ansl=[]
for i in sugar:
    for j in water:
        z=i/(j*100+i)
        xyz=i+j*100
        if xyz<=f and z<=e/(100+e):
            ansl.append((i,j,z))
s,t,r=sorted(ansl,key=lambda x:x[-1])[-1]
print(s+t*100,s)
Problem p03605 (python)

Fixed submission:
print("Yes" if "9" in list(input()) else "No")

Buggy submission (verdict: Runtime Error):
#じゅっぴーフロイド
from collections import*
from itertools import*
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(1,n+1):
        for i in range(1,n+1):
            for j in range(1,n+1):
                d[(i,j)] = min(d[(i,j)],d[(i,k)] + d[(k,j)])
    return d

##############################
n,w,r = map(int,input().split()) #n:頂点数　w:辺の数
d = defaultdict(lambda:float("inf"))
*r,=map(int,input().split())
#d[u][v] : 辺uvのコスト(存在しないときはinf)

for i in range(w):
    x,y,z = map(int,input().split())
    d[(x,y)] = z
    d[(y,x)] = z
#print(d)
for i in range(n):
    d[(i,i)] = 0 #自身のところに行くコストは０
d=warshall_floyd(d)
#print(d)
#print([d[i] for i in permutations(r)])
print(min(sum(d[(s,t)]for s,t in zip(i,i[1:]))for i in permutations(r)))
Problem p03606 (python)

Fixed submission:
n=int(input())
ans=0
for s in range(n):
  a,b=map(int,input().split())
  ans+=b-a+1
print(ans)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[[0 if s=="." else "#" for s in list(input())] for i in range(h)]
for _ in range(h):
  for s in range(w):
    if a[_][s]=="#":
      try:
        a[_-1][s]+=1
      except:
        continue
      try:
        a[_+1][s]+=1
      except:
        continue
      try:
        a[_][s-1]+=1
      except:
        continue
      try:
        a[_][s+1]+=1
      except:
        continue
      try:
        a[_+1][s+1]+=1
      except:
        continue
      try:
        a[_+1][s-1]+=1
      except:
        continue
      try:
        a[_-1][s+1]+=1
      except:
        continue
      try:
        a[_-1][s-1]+=1
      except:
        continue
    print(a)
for s in range(h):
  print(a[s])
Problem p03609 (python)

Fixed submission:
x,t=map(int,input().split())
print(x-t if x-t>0 else 0)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=Counter(a)
t=[]
for _ in b.most_common(100):
  t.append(len([i for i in a if _[0]-1<i<_[0]+3]))
  t.append(len([i for i in a if _[0]-2<i<_[0]+2]))
  t.append(len([i for i in a if _[0]-3<i<_[0]+1]))
print(max(t))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=Counter(a)
t=[]
for _ in b.most_common(10):
  t.append(len([i for i in a if _[0]-1<i<_[0]+3]))
  t.append(len([i for i in a if _[0]-2<i<_[0]+2]))
  t.append(len([i for i in a if _[0]-3<i<_[0]+1]))
print(max(t))
Problem p03611 (python)

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=[i-1 for i in a]+a+[i+1 for i in a]
b=Counter(b).most_common(1)
print(b[0][1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=[i-1 for i in a]+a+[i+1 for i in a]
b=Counter(a).most_max(1)
print(b[0][1])
Problem p03636 (python)

Fixed submission:
s=list(input())
print(s[0]+str(len(s)-2)+s[-1])

Buggy submission (verdict: Runtime Error):
s=list(input())
print(s[0]+str(len(s-2))+s[-1])
Problem p03637 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[1 for i in a if i%4==0]
c=[1 for i in a if i%4!=0 and i%2==0]
print("Yes" if len(b)+len(c)//2>=n//2 else "No")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[1 for i in list(map(int,input().split())) if i%4==0]
print("Yes" if len(a)>=n//2 "No")
Problem p03700 (python)

Fixed submission:
#import numpy as np
from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph)
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse import csr_matrix

from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！

def main():
    n,a,b,*h=map(int,open(0).read().split())
    h=array(h)

    ok=-1
    ng=max(h)+10
    
    def judge(t):
        H=deepcopy(h)
        H-=b*t
        H=H[H>0]
        if sum((H-1)//(a-b)+1)<=t:
            return 1
        else:
            return 0
    
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
#        print(mid,"NY"[judge(mid)])
        if judge(mid):
            ng=mid
        else:
            ok=mid
    l=ok+1
    print(l)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from copy import deepcopy
def main():
    n,a,b,*h=map(int,open(0).read().split())
    h=array(h)

    ok=-1
    ng=max(h)//a+10
    
    def judge(t):
        H=deepcopy(h)
        H-=b*t
        H=H[H>0]
        if sum((H-1)//(a-b)+1)<=t:
            return 1
        else:
            return 0
    
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if judge(mid):
            ng=mid
        else:
            ok=mid
    l=ok+1
    print(l)

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

Fixed submission:
from heapq import*
n,*a=map(int,open(0).read().split())
b=a[:n]
c=[-i for i in a[n:][::-1]]
d=c[:n]
e=c[n:]
heapify(b)
heapify(d)
s=sum(b)
t=sum(d)
red=[s]
blue=[t]
for i in range(n,n*2):
    s+=a[i]-heappushpop(b,a[i])
    t+=c[i]-heappushpop(d,c[i])
    red+=[s]
    blue+=[t]
print(max(map(sum,zip(red,blue[::-1]))))

#あｈｊｆｋぁｄｓｈｆｌｋじゃｇはｌｋｊｄｊｇｌｋ；あｊｄｇｌｋ；あｄｓｊｇｌ；あｊｓｄｇｌｋ；あｊｓｄｇｌ；かｓ

Buggy submission (verdict: Runtime Error):
def f(a):q=a[:n];heapify(q);return sum(q)+cumsum([e-heappushpop(q,e)for e in a[n:n-~n]]);from heapq import*;from numpy import*;n,*a=map(int,open(0).read().split());print(max(map(sum,zip(f(a),f([-e for e in a[::-1]])[::-1]))))

Buggy submission (verdict: Runtime Error):
def f(a):
	q=a[:n];s=sum(q);heapify(q)
	for e in a[n:n-~n]:yield s;s+=e-heappushpop(q,e)
from heapq import*;r=raw_input;n,a=r(),map(int,r());print max(map(sum,zip(f(a),list(f([-e for e in a[::-1]]))[::-1])))
Problem p03719 (python)

Fixed submission:
a,b,c=map(int,input().split());print("Yes" if a<=c<=b else "No")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
L=[]
for s in range(n):
  a,b=map(int,input().split())
  L.append((a,b))
#print(L)
L=sorted(L,key=lambda x:x[0])
#print(L)
sun=0
for s in L:
  sun+=s[1]
  if sun+1>k:
    print(s[0])
    exit()
Problem p03722 (python)

Fixed submission:
from collections import *
d=defaultdict(list)
n,m=map(int,input().split())
 
for s in range(m):
    a,b,c=map(int,input().split())
    d[a].append([b,c])
#print(d)

def BELLMANFORD(point,d):
    cost       = {node:-float("inf")for node in range(1,n+1)}
    preference = {node:None         for node in range(1,n+1)}      #最適路のこと 
    cost[point]= 0
    for i in range(n-1):                                  #経路の長さは最大n-1であるため
        for now,lis in d.copy().items():
            for nex,c in lis:
                if cost[nex]<cost[now]+c:
                    cost[nex]=cost[now]+c
                    preference[nex]=now

    negative=[0]*n                                        #負閉路の長さは最大nであるため
    
    for i in range(n):                  #閉路判定
        for now,lis in d.copy().items():
            for nex,c in lis:
                if negative[now-1]==1:
                    negative[nex-1]=1
                if cost[nex]<cost[now]+c:
                    cost[nex]=cost[now]+c
                    preference[nex]=now
                    negative[now-1]=1

    return cost,negative

x,y=(BELLMANFORD(1,d))
#print(x,y)
if y[n-1]==1:
    print("inf")
else:
    print(x[n])

Buggy submission (verdict: Runtime Error):
from collections import *
d=defaultdict(list)
n,m=map(int,input().split())
 
for s in range(m):
    a,b,c=map(int,input().split())
    d[a].append([b,c])
#print(d)

def BELLMANFORD(point,d):
    cost       = {node:-float("inf")for node in range(1,n+1)}
    preference = {node:None         for node in range(1,n+1)}      #最適路のこと 
    cost[point]= 0
    for i in range(n-1):                                  #経路の長さは最大n-1であるため
        for now,lis in d.copy().items():
            for nex,c in lis:
                if cost[nex]<cost[now]+c:
                    cost[nex]=cost[now]+c
                    preference[nex]=now

    negative=[0]*n                                        #負閉路の長さは最大nであるため
    
    for i in range(n):                  #閉路判定
        for now,lis in d.copy().items():
            for nex,c in lis:
                if negative[now]==1:
                    negative[nex]=1
                if cost[nex]<cost[now]+c:
                    cost[nex]=cost[now]+c
                    preference[nex]=now
                    negative[now-1]=1

    return cost,negative

x,y=(BELLMANFORD(1,d))
#print(x,y)
if y[n-1]==1:
    print("inf")
else:
    print(x[n])
Problem p03732 (python)

Fixed submission:
from collections import *

N,W=map(int,input().split())
d=defaultdict(int)
d[0]=0
for i in range(N):
    w,v=map(int,input().split())
    c=d.copy()
    for p,q in c.items():
        if p+w<=W:
            d[p+w]=max(d[p+w],q+v)
print(max(d.values()))

Buggy submission (verdict: Runtime Error):
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
def cmb(n, r):
    if n-r<0:
        return 0
    return factorial(n) // factorial(r) // factorial(n - r)
 
def main():
    n,W=map(int,input().split())
    d=defaultdict(int)
    d[0]=0
    for i in range(n):
        w,v=map(int,input().split())
        for k,j in d.items():
            if k+w<=W:
                d[k+w]=max(d[k+w],j+v)
#    print(d)
    print(max(d.values()))
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from numpy import*
N,W=map(int, input().split())
dp=zeros(W+1)
for i in range(N):
    w,v=map(int, input().split())
    dp[w:]=maximum(dp[w:], dp[:-w]+v)
print(int(max(dp)))

Buggy submission (verdict: Runtime Error):
from numpy import*
N,W=map(int, input().split())
dp=zeros(W+1)
for i in range(N):
    w,v=map(int, input().split())
    dp[w:]=maximum(dp[w:], dp[:-w]+v)
print(int(max(dp)))

Buggy submission (verdict: Runtime Error):
N,W=map(int,input().split())
2.dp=[0]*(W+1)
3.for i in range(N):
4.    w,v=map(int,input().split())
5.    for p,q in enumerate(dp):
6.        if p+w<=W:
7.            dp[p+w]=max(dp[p+w],q+v)
8.print(max(dp))

Buggy submission (verdict: Runtime Error):
N,W=map(int,input().split())
dp=[0]*(W+1)
for i in range(N):
    w,v=map(int,input().split())
    for p,q in enumerate(dp.copy()):
        if p+w<=W:
            dp[p+w]=max(dp[p+w],q+v)
print(max(dp))
Problem p03734 (python)

Fixed submission:
from collections import*
import functools
import sys
input=sys.stdin.readline
@functools.lru_cache(maxsize=None)
def Knapsack(N,W):
    for i in range(N):
        w,v=map(int,input().split())
        for k,b in d.copy().items():
            if k+w<=W:
                d[k+w]=max(d[k+w],b+v)
    return max(d.values())
N,W=map(int,input().split())   #pypyで実行！
d=defaultdict(int)
d[0]=0
print(Knapsack(N,W))

Buggy submission (verdict: Runtime Error):
from numpy import*
N,W=map(int, input().split())
dp=zeros(W+1)
for i in range(N):
    w,v=map(int, input().split())
    dp[w:]=maximum(dp[w:], dp[:-w]+v)
print(int(max(dp)))
Problem p03773 (python)

Fixed submission:
a=map(int,input().split());print(sum(a)%24)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
l=[]
for i in range(1,int(math.sqrt(n))+2):
    if n%i==0:
        l+=[max(len(str(i)),len(str(n//i)))]
print(min(l))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split());print(sum(a,b)%24)
Problem p03796 (python)

Fixed submission:
from math import factorial;print(factorial(int(input()))%(10**9+7))

Buggy submission (verdict: Runtime Error):
from math import fractorial;print(fractorial(int(input()))%(10**9+7))