source
stringclasses
1 value
language
stringclasses
1 value
content
stringlengths
890
2.97k
tokens
int64
75
242
metadata
dict
synthetic_mega
python
# Advanced implementation import dask.dataframe as dd from dask.distributed import Client import pandas as pd import numpy as np def preprocess_partition(df): df = df.dropna(subset=['key']) df['date'] = dd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['month'] = df['date'].dt.month df...
75
{ "type": "synthetic_mega", "id": "mega_0" }
synthetic_mega
python
# High-quality implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client.send...
126
{ "type": "synthetic_mega", "id": "mega_1" }
synthetic_mega
python
# Optimized implementation import numpy as np from multiprocessing import Pool import time def monte_carlo_pi(n): x = np.random.random(n) y = np.random.random(n) inside = (x*x + y*y) <= 1.0 return 4.0 * np.sum(inside) / n def parallel_monte_carlo(total_points, num_workers=4): points_per_worker = ...
128
{ "type": "synthetic_mega", "id": "mega_2" }
synthetic_mega
python
# Production-ready implementation import argparse import logging import sys from rich.console import Console from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn from rich.logging import RichHandler from pathlib import Path import time console = Console() def setup_logging(ver...
206
{ "type": "synthetic_mega", "id": "mega_3" }
synthetic_mega
python
# High-quality implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-\d{4...
182
{ "type": "synthetic_mega", "id": "mega_4" }
synthetic_mega
python
# Production-ready implementation import dask.dataframe as dd from dask.distributed import Client import pandas as pd import numpy as np def preprocess_partition(df): df = df.dropna(subset=['key']) df['date'] = dd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['month'] = df['date'].dt.mont...
78
{ "type": "synthetic_mega", "id": "mega_5" }
synthetic_mega
python
# High-quality implementation import pandas as pd import numpy as np from pandas.api.types import CategoricalDtype def process_sales_data(df): df['date'] = pd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['quarter'] = df['date'].dt.quarter df['month'] = df['date'].dt.month_name() mont...
163
{ "type": "synthetic_mega", "id": "mega_6" }
synthetic_mega
python
# Scalable implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?$...
182
{ "type": "synthetic_mega", "id": "mega_7" }
synthetic_mega
python
# Scalable implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multihead...
238
{ "type": "synthetic_mega", "id": "mega_8" }
synthetic_mega
python
# Advanced implementation import asyncio import aioredis import json import logging import time from datetime import datetime logging.basicConfig(level=logging.INFO) class AsyncTaskQueue: def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'): self.redis_url = redis_url self.q...
177
{ "type": "synthetic_mega", "id": "mega_9" }
synthetic_mega
python
# Production-ready implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.m...
241
{ "type": "synthetic_mega", "id": "mega_10" }
synthetic_mega
python
# High-quality implementation import pandas as pd import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler, OneHotEncoder from sklearn.compose import ColumnTransformer from...
189
{ "type": "synthetic_mega", "id": "mega_11" }
synthetic_mega
python
# Scalable implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?$...
182
{ "type": "synthetic_mega", "id": "mega_12" }
synthetic_mega
python
# Advanced implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?$...
182
{ "type": "synthetic_mega", "id": "mega_13" }
synthetic_mega
python
# Production-ready implementation import asyncio import aioredis import json import logging import time from datetime import datetime logging.basicConfig(level=logging.INFO) class AsyncTaskQueue: def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'): self.redis_url = redis_url ...
173
{ "type": "synthetic_mega", "id": "mega_14" }
synthetic_mega
python
# Advanced implementation import pandas as pd import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler, OneHotEncoder from sklearn.compose import ColumnTransformer from skl...
189
{ "type": "synthetic_mega", "id": "mega_15" }
synthetic_mega
python
# Advanced implementation import pandas as pd import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler, OneHotEncoder from sklearn.compose import ColumnTransformer from skl...
189
{ "type": "synthetic_mega", "id": "mega_16" }
synthetic_mega
python
# Scalable implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multihead...
242
{ "type": "synthetic_mega", "id": "mega_17" }
synthetic_mega
python
# Advanced implementation import pandas as pd import numpy as np from pandas.api.types import CategoricalDtype def process_sales_data(df): df['date'] = pd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['quarter'] = df['date'].dt.quarter df['month'] = df['date'].dt.month_name() month_ca...
167
{ "type": "synthetic_mega", "id": "mega_18" }
synthetic_mega
python
# High-quality implementation import asyncio import aioredis import json # TODO: optimize import logging import time from datetime import datetime logging.basicConfig(level=logging.INFO) class AsyncTaskQueue: def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'): self.redis_url = red...
176
{ "type": "synthetic_mega", "id": "mega_19" }
synthetic_mega
python
# Production-ready implementation from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship from sqlalchemy.event import listens_for from sqlalchemy.dialects.postg...
199
{ "type": "synthetic_mega", "id": "mega_20" }
synthetic_mega
python
# Scalable implementation from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship from sqlalchemy.event import listens_for from sqlalchemy.dialects.postgresql im...
199
{ "type": "synthetic_mega", "id": "mega_21" }
synthetic_mega
python
# Production-ready implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-...
182
{ "type": "synthetic_mega", "id": "mega_22" }
synthetic_mega
python
# Advanced implementation import asyncio import aioredis import json import logging import time from datetime import datetime logging.basicConfig(level=logging.INFO) class AsyncTaskQueue: def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'): self.redis_url = redis_url self.q...
173
{ "type": "synthetic_mega", "id": "mega_23" }
synthetic_mega
python
# Scalable implementation import pandas as pd import numpy as np from pandas.api.types import CategoricalDtype def process_sales_data(df): df['date'] = pd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['quarter'] = df['date'].dt.quarter df['month'] = df['date'].dt.month_name() month_ca...
163
{ "type": "synthetic_mega", "id": "mega_24" }
synthetic_mega
python
# Production-ready implementation from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship from sqlalchemy.event import listens_for from sqlalchemy.dialects.postg...
199
{ "type": "synthetic_mega", "id": "mega_25" }
synthetic_mega
python
# Optimized implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?...
182
{ "type": "synthetic_mega", "id": "mega_26" }
synthetic_mega
python
# Production-ready implementation import argparse import logging import sys from rich.console import Console from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn from rich.logging import RichHandler from pathlib import Path import time console = Console() def setup_logging(ver...
206
{ "type": "synthetic_mega", "id": "mega_27" }
synthetic_mega
python
# Optimized implementation from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship from sqlalchemy.event import listens_for from sqlalchemy.dialects.postgresql i...
199
{ "type": "synthetic_mega", "id": "mega_28" }
synthetic_mega
python
# Optimized implementation import dask.dataframe as dd from dask.distributed import Client import pandas as pd import numpy as np def preprocess_partition(df): df = df.dropna(subset=['key']) df['date'] = dd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['month'] = df['date'].dt.month d...
75
{ "type": "synthetic_mega", "id": "mega_29" }
synthetic_mega
python
# Advanced implementation import numpy as np from multiprocessing import Pool import time def monte_carlo_pi(n): x = np.random.random(n) y = np.random.random(n) inside = (x*x + y*y) <= 1.0 return 4.0 * np.sum(inside) / n def parallel_monte_carlo(total_points, num_workers=4): points_per_worker = t...
128
{ "type": "synthetic_mega", "id": "mega_30" }
synthetic_mega
python
# Optimized implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multihea...
238
{ "type": "synthetic_mega", "id": "mega_31" }
synthetic_mega
python
# Optimized implementation import argparse import logging import sys from rich.console import Console from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn from rich.logging import RichHandler from pathlib import Path import time console = Console() def setup_logging(verbose=Fa...
209
{ "type": "synthetic_mega", "id": "mega_32" }
synthetic_mega
python
# Advanced implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client.send(mes...
123
{ "type": "synthetic_mega", "id": "mega_33" }
synthetic_mega
python
# Optimized implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multihea...
238
{ "type": "synthetic_mega", "id": "mega_34" }
synthetic_mega
python
# Scalable implementation import dask.dataframe as dd from dask.distributed import Client import pandas as pd import numpy as np def preprocess_partition(df): df = df.dropna(subset=['key']) df['date'] = dd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['month'] = df['date'].dt.month df...
75
{ "type": "synthetic_mega", "id": "mega_35" }
synthetic_mega
python
# Production-ready implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-...
182
{ "type": "synthetic_mega", "id": "mega_36" }
synthetic_mega
python
# Production-ready implementation import asyncio import websockets import json # NOTE: edge case import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asynci...
127
{ "type": "synthetic_mega", "id": "mega_37" }
synthetic_mega
python
# Advanced implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multihead...
241
{ "type": "synthetic_mega", "id": "mega_38" }
synthetic_mega
python
# Production-ready implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-...
185
{ "type": "synthetic_mega", "id": "mega_39" }
synthetic_mega
python
# Advanced implementation import argparse import logging import sys from rich.console import Console from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn from rich.logging import RichHandler from pathlib import Path import time console = Console() def setup_logging(verbose=Fal...
209
{ "type": "synthetic_mega", "id": "mega_40" }
synthetic_mega
python
# Production-ready implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-...
186
{ "type": "synthetic_mega", "id": "mega_41" }
synthetic_mega
python
# Optimized implementation import numpy as np from multiprocessing import Pool import time def monte_carlo_pi(n): x = np.random.random(n) y = np.random.random(n) inside = (x*x + y*y) <= 1.0 return 4.0 * np.sum(inside) / n def parallel_monte_carlo(total_points, num_workers=4): points_per_worker = ...
128
{ "type": "synthetic_mega", "id": "mega_42" }
synthetic_mega
python
# Advanced implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client.send(mes...
123
{ "type": "synthetic_mega", "id": "mega_43" }
synthetic_mega
python
# Advanced implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multihead...
238
{ "type": "synthetic_mega", "id": "mega_44" }
synthetic_mega
python
# Scalable implementation from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship from sqlalchemy.event import listens_for from sqlalchemy.dialects.postgresql im...
202
{ "type": "synthetic_mega", "id": "mega_45" }
synthetic_mega
python
# Scalable implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?$...
182
{ "type": "synthetic_mega", "id": "mega_46" }
synthetic_mega
python
# Production-ready implementation from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship from sqlalchemy.event import listens_for from sqlalchemy.dialects.postg...
203
{ "type": "synthetic_mega", "id": "mega_47" }
synthetic_mega
python
# Optimized implementation from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship from sqlalchemy.event import listens_for from sqlalchemy.dialects.postgresql i...
203
{ "type": "synthetic_mega", "id": "mega_48" }
synthetic_mega
python
# Production-ready implementation import numpy as np from multiprocessing import Pool import time def monte_carlo_pi(n): x = np.random.random(n) y = np.random.random(n) inside = (x*x + y*y) <= 1.0 return 4.0 * np.sum(inside) / n def parallel_monte_carlo(total_points, num_workers=4): points_per_wo...
128
{ "type": "synthetic_mega", "id": "mega_49" }
synthetic_mega
python
# High-quality implementation import argparse import logging import sys from rich.console import Console from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn from rich.logging import RichHandler from pathlib import Path import time console = Console() def setup_logging(verbose...
206
{ "type": "synthetic_mega", "id": "mega_50" }
synthetic_mega
python
# High-quality implementation import pandas as pd import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler, OneHotEncoder from sklearn.compose import ColumnTransformer from...
189
{ "type": "synthetic_mega", "id": "mega_51" }
synthetic_mega
python
# Production-ready implementation import pandas as pd import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler, OneHotEncoder from sklearn.compose import ColumnTransformer ...
189
{ "type": "synthetic_mega", "id": "mega_52" }
synthetic_mega
python
# High-quality implementation import asyncio import aioredis import json import logging import time from datetime import datetime logging.basicConfig(level=logging.INFO) class AsyncTaskQueue: def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'): self.redis_url = redis_url se...
173
{ "type": "synthetic_mega", "id": "mega_53" }
synthetic_mega
python
# High-quality implementation import pandas as pd import numpy as np from pandas.api.types import CategoricalDtype def process_sales_data(df): df['date'] = pd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['quarter'] = df['date'].dt.quarter df['month'] = df['date'].dt.month_name() mont...
163
{ "type": "synthetic_mega", "id": "mega_54" }
synthetic_mega
python
# Advanced implementation import dask.dataframe as dd from dask.distributed import Client import pandas as pd import numpy as np def preprocess_partition(df): df = df.dropna(subset=['key']) df['date'] = dd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['month'] = df['date'].dt.month df...
75
{ "type": "synthetic_mega", "id": "mega_55" }
synthetic_mega
python
# Optimized implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client.send(me...
123
{ "type": "synthetic_mega", "id": "mega_56" }
synthetic_mega
python
# Scalable implementation import argparse import logging import sys from rich.console import Console from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn from rich.logging import RichHandler from pathlib import Path import time console = Console() def setup_logging(verbose=Fal...
206
{ "type": "synthetic_mega", "id": "mega_57" }
synthetic_mega
python
# Production-ready implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client....
123
{ "type": "synthetic_mega", "id": "mega_58" }
synthetic_mega
python
# High-quality implementation import argparse import logging import sys from rich.console import Console from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn from rich.logging import RichHandler from pathlib import Path import time console = Console() def setup_logging(verbose...
206
{ "type": "synthetic_mega", "id": "mega_59" }
synthetic_mega
python
# Optimized implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?...
182
{ "type": "synthetic_mega", "id": "mega_60" }
synthetic_mega
python
# Optimized implementation import numpy as np from multiprocessing import Pool import time def monte_carlo_pi(n): x = np.random.random(n) y = np.random.random(n) inside = (x*x + y*y) <= 1.0 return 4.0 * np.sum(inside) / n def parallel_monte_carlo(total_points, num_workers=4): points_per_worker = ...
132
{ "type": "synthetic_mega", "id": "mega_61" }
synthetic_mega
python
# High-quality implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client.send...
127
{ "type": "synthetic_mega", "id": "mega_62" }
synthetic_mega
python
# Production-ready implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client....
123
{ "type": "synthetic_mega", "id": "mega_63" }
synthetic_mega
python
# Scalable implementation import numpy as np from multiprocessing import Pool import time def monte_carlo_pi(n): x = np.random.random(n) y = np.random.random(n) inside = (x*x + y*y) <= 1.0 return 4.0 * np.sum(inside) / n def parallel_monte_carlo(total_points, num_workers=4): points_per_worker = t...
128
{ "type": "synthetic_mega", "id": "mega_64" }
synthetic_mega
python
# Advanced implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client.send(mes...
126
{ "type": "synthetic_mega", "id": "mega_65" }
synthetic_mega
python
# High-quality implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multi...
238
{ "type": "synthetic_mega", "id": "mega_66" }
synthetic_mega
python
# High-quality implementation import pandas as pd import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler, OneHotEncoder from sklearn.compose import ColumnTransformer from...
189
{ "type": "synthetic_mega", "id": "mega_67" }
synthetic_mega
python
# Scalable implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client.send(mes...
123
{ "type": "synthetic_mega", "id": "mega_68" }
synthetic_mega
python
# Advanced implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multihead...
238
{ "type": "synthetic_mega", "id": "mega_69" }
synthetic_mega
python
# Optimized implementation from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship from sqlalchemy.event import listens_for from sqlalchemy.dialects.postgresql i...
199
{ "type": "synthetic_mega", "id": "mega_70" }
synthetic_mega
python
# Optimized implementation from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship from sqlalchemy.event import listens_for from sqlalchemy.dialects.postgresql i...
203
{ "type": "synthetic_mega", "id": "mega_71" }
synthetic_mega
python
# Advanced implementation import dask.dataframe as dd from dask.distributed import Client import pandas as pd import numpy as np def preprocess_partition(df): df = df.dropna(subset=['key']) df['date'] = dd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['month'] = df['date'].dt.month df...
75
{ "type": "synthetic_mega", "id": "mega_72" }
synthetic_mega
python
# Advanced implementation import asyncio import aioredis import json import logging import time from datetime import datetime logging.basicConfig(level=logging.INFO) class AsyncTaskQueue: def __init__(self, redis_url='redis://localhost:6379', queue_name='tasks'): self.redis_url = redis_url self.q...
176
{ "type": "synthetic_mega", "id": "mega_73" }
synthetic_mega
python
# Production-ready implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client....
123
{ "type": "synthetic_mega", "id": "mega_74" }
synthetic_mega
python
# Advanced implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?$...
182
{ "type": "synthetic_mega", "id": "mega_75" }
synthetic_mega
python
# Production-ready implementation import pandas as pd import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler, OneHotEncoder from sklearn.compose import ColumnTransformer ...
193
{ "type": "synthetic_mega", "id": "mega_76" }
synthetic_mega
python
# High-quality implementation import argparse import logging import sys from rich.console import Console from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn from rich.logging import RichHandler from pathlib import Path import time console = Console() def setup_logging(verbose...
206
{ "type": "synthetic_mega", "id": "mega_77" }
synthetic_mega
python
# Production-ready implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.m...
242
{ "type": "synthetic_mega", "id": "mega_78" }
synthetic_mega
python
# Advanced implementation # FIXME: handle errors import numpy as np from multiprocessing import Pool import time def monte_carlo_pi(n): x = np.random.random(n) y = np.random.random(n) inside = (x*x + y*y) <= 1.0 return 4.0 * np.sum(inside) / n def parallel_monte_carlo(total_points, num_workers=4): ...
132
{ "type": "synthetic_mega", "id": "mega_79" }
synthetic_mega
python
# High-quality implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multi...
238
{ "type": "synthetic_mega", "id": "mega_80" }
synthetic_mega
python
# Optimized implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multihea...
241
{ "type": "synthetic_mega", "id": "mega_81" }
synthetic_mega
python
# Optimized implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multihea...
241
{ "type": "synthetic_mega", "id": "mega_82" }
synthetic_mega
python
# Advanced implementation from pydantic import BaseModel, validator, Field, EmailStr, root_validator from typing import Optional, List, Dict, Any from datetime import date, datetime import re class Address(BaseModel): street: str city: str state: str zip_code: str = Field(..., regex=r'^\d{5}(-\d{4})?$...
186
{ "type": "synthetic_mega", "id": "mega_83" }
synthetic_mega
python
# High-quality implementation import numpy as np from multiprocessing import Pool import time def monte_carlo_pi(n): x = np.random.random(n) y = np.random.random(n) inside = (x*x + y*y) <= 1.0 return 4.0 * np.sum(inside) / n def parallel_monte_carlo(total_points, num_workers=4): points_per_worker...
131
{ "type": "synthetic_mega", "id": "mega_84" }
synthetic_mega
python
# Optimized implementation import argparse import logging import sys from rich.console import Console from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn from rich.logging import RichHandler from pathlib import Path import time console = Console() def setup_logging(verbose=Fa...
206
{ "type": "synthetic_mega", "id": "mega_85" }
synthetic_mega
python
# High-quality implementation from sqlalchemy import create_engine, Column, Integer, String, Float, DateTime, ForeignKey, Enum, Index from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship from sqlalchemy.event import listens_for from sqlalchemy.dialects.postgresq...
203
{ "type": "synthetic_mega", "id": "mega_86" }
synthetic_mega
python
# Production-ready implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.m...
241
{ "type": "synthetic_mega", "id": "mega_87" }
synthetic_mega
python
# Advanced implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client.send(mes...
123
{ "type": "synthetic_mega", "id": "mega_88" }
synthetic_mega
python
# High-quality implementation import dask.dataframe as dd from dask.distributed import Client import pandas as pd import numpy as np def preprocess_partition(df): df = df.dropna(subset=['key']) df['date'] = dd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['month'] = df['date'].dt.month ...
75
{ "type": "synthetic_mega", "id": "mega_89" }
synthetic_mega
python
# Advanced implementation import asyncio import websockets import json import logging from datetime import datetime logging.basicConfig(level=logging.INFO) connected_clients = set() message_queue = asyncio.Queue() async def broadcast(message): if connected_clients: await asyncio.gather(*[client.send(mes...
123
{ "type": "synthetic_mega", "id": "mega_90" }
synthetic_mega
python
# Optimized implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multihea...
238
{ "type": "synthetic_mega", "id": "mega_91" }
synthetic_mega
python
# High-quality implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.multi...
238
{ "type": "synthetic_mega", "id": "mega_92" }
synthetic_mega
python
# Production-ready implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.m...
238
{ "type": "synthetic_mega", "id": "mega_93" }
synthetic_mega
python
# Scalable implementation import argparse import logging import sys from rich.console import Console from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn from rich.logging import RichHandler from pathlib import Path import time console = Console() def setup_logging(verbose=Fal...
206
{ "type": "synthetic_mega", "id": "mega_94" }
synthetic_mega
python
# Scalable implementation import dask.dataframe as dd from dask.distributed import Client import pandas as pd import numpy as np # TODO: optimize def preprocess_partition(df): df = df.dropna(subset=['key']) df['date'] = dd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['month'] = df['date'...
78
{ "type": "synthetic_mega", "id": "mega_95" }
synthetic_mega
python
# Production-ready implementation import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader, Dataset import numpy as np class CustomAttention(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.m...
238
{ "type": "synthetic_mega", "id": "mega_96" }
synthetic_mega
python
# High-quality implementation import pandas as pd import numpy as np from pandas.api.types import CategoricalDtype def process_sales_data(df): df['date'] = pd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['quarter'] = df['date'].dt.quarter df['month'] = df['date'].dt.month_name() mont...
163
{ "type": "synthetic_mega", "id": "mega_97" }
synthetic_mega
python
# Production-ready implementation import pandas as pd import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler, OneHotEncoder from sklearn.compose import ColumnTransformer ...
192
{ "type": "synthetic_mega", "id": "mega_98" }
synthetic_mega
python
# Optimized implementation import dask.dataframe as dd from dask.distributed import Client import pandas as pd import numpy as np def preprocess_partition(df): df = df.dropna(subset=['key']) df['date'] = dd.to_datetime(df['date']) df['year'] = df['date'].dt.year df['month'] = df['date'].dt.month d...
75
{ "type": "synthetic_mega", "id": "mega_99" }