akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pi;
typedef pair<int,Pi> P;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int h,w;
    cin>>h>>w;
    Pi st,go;
    cin>>st.fi>>st.se;
    cin>>go.fi>>go.se;
    st.fi--,st.se--,go.fi--,go.se--;
    vector<string> g(h);
    rep(i,h){
        cin>>g[i];
    }
    vector<int> dx={1,-1,0,0},dy={0,0,1,-1};
    auto check=[&](int i,int j){
        return (0<=i && i<h && 0<=j && j<w);
    };
	vector<vector<int>> dp(h+10,vector<int>(w+10,INF));
	dp[st.fi][st.se]=0;
	priority_queue<P,vector<P>,greater<P>> que;
	que.push(P(0,st));
    while(!que.empty()){
        auto tmp=que.top();
        que.pop();
		int d=tmp.fi;
		auto [x,y]=tmp.se;
		if(dp[x][y]<d) continue;
        rep(i,4){
            int nx=x+dx[i],ny=y+dy[i];
            if(check(nx,ny) && g[nx][ny]=='.'){
                if(chmin(dp[nx][ny],dp[x][y])){
					que.push(P(dp[nx][ny],Pi(nx,ny)));
				}
            }
        }
		FOR(i,-2,3)FOR(j,-2,3){
			if(i==0 && j==0) continue;
			int nx=x+i,ny=y+j;
			if(check(nx,ny) && g[nx][ny]=='.' && chmin(dp[nx][ny],dp[x][y]+1)){
				que.push(P(dp[nx][ny],Pi(nx,ny)));
			}
		}
    }
    int ans=dp[go.fi][go.se];
    if(ans==INF) cout<<-1<<endl;
    else cout<<ans<<endl;
}

Measured memory_bytes: 8664
#include <bits/stdc++.h>
using namespace std; void solve(); int main(){cin.tie(0); ios::sync_with_stdio(false); cout<<fixed<<setprecision(10); solve();}
using ll=int_fast64_t; using ld=long double; using pll=pair<ll,ll>; using pld=pair<ld,ld>;
#define fi first
#define se second
#define SELECTOR(_1,_2,_3,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
template<class T> void vecout(const T &v){for(auto it=v.begin();it!=v.end();++it,cout<<(it!=v.end()?" ":"\n"))cout<<*it;}
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}

template <std::uint_fast64_t Modulus> class modint {
public:
  ll a;
  constexpr modint(const ll x = 0) noexcept : a(x % Modulus) {}
  constexpr ll &value() noexcept { return a; }
  constexpr const ll &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    ll exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

void solve(){
  const ll MOD=1'000'000'007;
  string k; cin>>k;
  ll d; cin>>d;
  ll n=k.size();
  auto dp=make_v(n+1,d,2,modint<MOD>(0));
  dp[0][0][0]=modint<MOD>(1);
  rep(i,n){
    ll a=k[i]-'0';
    rep(j,d)rep(o,10){
      dp[i+1][(j+o)%d][1]+=dp[i][j][1];
      if(o<a) dp[i+1][(j+o)%d][1]+=dp[i][j][0];
      else if(o==a) dp[i+1][(j+o)%d][0]+=dp[i][j][0];
    }
  }
  cout<<(dp[n][0][0]+dp[n][0][1]-1).a<<"\n";
}

Measured memory_bytes: 55424
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		sc.close();
		
		System.out.println((N % K == 0) ? "0" : "1");
		
	}

}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;cin >> n;
	cout << n * (n - 1) / 2 << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
const static int MAX = 1000; //容量 
int top, S[MAX]; //栈顶指针，内存数组 

void initialise()   //初始化栈 
{
	top = 0;
}

bool isEmpty()	//判断栈空 
{
	return top == 0;	
} 

bool isFull()	//判断栈满 
{
	return top >=MAX - 1;
}
 
void push(int x){
	if(isFull())
		{
			printf("上溢"); 
		}
	else 
		{
			S[++top] = x;
		}	
}

int pop(){
	if(isEmpty())
	{
		printf("下溢");
	}
	else 
	{
		return S[top--];  //出栈操作还需要返回栈顶元素 
	}
} 

int main()
{
	int a,b;
	top = 0;
	char s[100];
	while(scanf("%s",s) != EOF){
		if(s[0] == '+')
		{
			a = pop();
			b = pop();
			push(a + b);
		}else if(s[0] == '-'){
			b = pop();
			a = pop();
			push(a - b);
		}else if(s[0] == '*'){
			a = pop();
			b = pop();
			push(a * b);
		}else {
			push(atoi(s));
		}
	}
	printf("%d\n",pop());
	return 0;
} 


Measured memory_bytes: 2704
#include <bits/stdc++.h>

using namespace std;

string ans[] = {"pon", "pon", "hon", "bon", "hon", "hon", "pon", "hon","pon", "hon"};

int main(){
    int n;
    cin >> n;
    cout << ans[n % 10] << endl;
	return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const int mod= 1e9+7;
ll power(ll x,ll y){ll res=1;x=x%mod;while(y>0){if(y&1)res=((res%mod)*(x%mod))%mod;y=y>>1;x=((x%mod)*(x%mod))%mod;}return res;}
int main ()
{
   ll a,b;
   string s,t,u;
   cin>>s>>t>>a>>b>>u;
   if (u==s)
      cout<<a-1<<" "<<b;
   else
      cout<<a<<" "<<b-1;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main(){
    int n , d = 0;
    cin >> n;
    char S[n];
    for(int i = 0;i < n;i++){
        cin >> S[i];
    }
    for(int i = 0; i < n; i++){
        if(S[i] == S[i+1]){
            d += 1;
        }
    }
    cout << n - d << endl;
    return 0;
}

Measured memory_bytes: 384
import sys,heapq
from collections import defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False

def ddprint(x):
  if DBG:
    print(x)

n,t = inm()
a = inl()
heappair = []
hpair = defaultdict(int)
hcnt = defaultdict(int)
hcnt[a[0]] = 1
mn = a[0]
dif = 0
for i in range(1,n):
    z = a[i]
    hcnt[z] += 1
    if z<mn:
        mn = z
    if z-mn>=dif:
        if z-mn>dif:
            dif = z-mn
        e = (-dif,mn,z)
        if e not in hpair:
            hpair[e] = 1
            heapq.heappush(heappair,e)
cnt = 0
v = 1
while len(heappair)>0:
    mdif,mn,z = heapq.heappop(heappair)
    if v==1:
        v = mdif
    if v != mdif:
        break
    cnt += min(hcnt[mn],hcnt[z])
print(cnt) 


Measured memory_bytes: 85740
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <cstdio>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  string a;
  cin >> a;
  int b = 0;
  rep(i, 4) {
    if (a[i] == '+') {
      b++;
    } else {
      b--;
    }
  }
  cout << b;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
//配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 256
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n; cin >> n;
	vector<pair<int, int>> v(n);
	rep(i, n)cin >> v[i].second >> v[i].first;
	sort(all(v));
	int now = 0;
	rep(i, n)
	{
		int a, b;
		tie(b, a) = v[i];
		now += a;
		if (b < now)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 4832
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;
const double PI = acos(-1.0);
const int MAX_N = 200010;

int dp[200010];
int n, a[100010];

int lis(){
    fill(dp, dp + n, INF);
    for(int i = 0; i < n; i++){
        *lower_bound(dp, dp + n, a[i]) = a[i];
    }
    return lower_bound(dp, dp + n, INF) - dp;
}

bool contain(int sy, int gy, int y){
    if(sy > gy) swap(sy, gy);
    return (sy <= y && y <= gy);
}

signed main(){
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    int sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    int n;
    cin >> n;
    vector<P> d, za; 
    if(sx > gx){
        swap(sx, gx);
        swap(sy, gy);
    }
    rep(i, 0, n){
        int x, y;
        cin >> x >> y;
        if(sx <= x && x <= gx){
            if(contain(sy, gy, y)) d. push_back(P(x, y));
        }
    }
    sort(all(d));
    rep(i, 0, d.size()){
        za. push_back(P(d[i].second, i));
    }
    sort(all(za));
    vector<P> a(d.size());
    rep(i, 0, d.size()){
        a[i].first = d[i].first;
    }
    int c = 1;
    if(sy > gy) c = -1; 
    rep(i, 0, a.size()){
        a[za[i].second].second = i * c;
    }
    // rep(i, 0, a.size()){
    //     cout << a[i].first << " " << a[i].second << " " << d[i].second << endl;
    // }
    fill(dp, dp + MAX_N, INF);
    rep(i, 0, a.size()){
        *lower_bound(dp, dp + MAX_N, a[i].second) = a[i].second;
    }
    int cnt = lower_bound(dp, dp + MAX_N, INF) - dp;
    // cout << cnt << endl;
    // rep(i, 0, cnt){
    //     cout << dp[i] << " ";
    // }
    // cout << endl;
    double ans = 100 * ((gx - sx) + abs(gy - sy));
    // cout << ans << endl;
    if(cnt == abs(gy - sy) + 1 || cnt == abs(gx - sx) + 1){
        ans += (cnt - 1) * (-20 + 5 * PI);    
        ans += -20 + 10 * PI;        
        // if(cnt == 1){
            // ans += -20 + 10 * PI;
        // }else{
        //     ans += (cnt - 1) * (-20 + 5 * PI);    
        // }
    }else{
        ans += cnt * (-20 + 5 * PI);
    }
    printf("%.14lf\n", ans); 
}

Measured memory_bytes: 13292
N, A, B, C, D = map(int, input().split())
S = input()

ok = 1
for p, q in ((A, C), (B, D)):
    cnt = 0
    for i in range(p-1, q):
        if S[i] == '#':
            cnt += 1
        else:
            if cnt > 2:
                ok = 0
            cnt = 0
if not ok:
    print("No")
    exit(0)

if C > D:
    ok = 0
    for i in range(B-1, D):
        if S[i-1] == S[i] == S[i+1] == '.':
            ok = 1
if ok:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3572
#include <stdio.h>
#include <algorithm>
int r[205];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)
		scanf("%d",&r[i]);
	std::sort(r+1,r+1+2*n);
	int ans=0;
	for(int i=1;i<=n;i++)
		ans+=r[i*2-1];
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ft first
#define sd second
#define pb push_back
using namespace std;
const ll mod = 1e9+7;
const ll inf = 1e9+9;
 
ll power(ll a, ll b, ll m = mod) {
    ll x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
 
const int N = 10009;
vector<int> g[N];
int a[N], assign[N], f[N];
vector<pair<int, int>> nodes;
void dfs(int u, int par) {
    f[u] = 1;
    for(int v: g[u]) {
        if(v == par) continue;
        dfs(v, u);
        f[u] = max(f[u], f[v]+1);
    }
    nodes.push_back({f[u], u});
}
signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    int n; cin >> n;
    for(int i = 1; i < n; i++) {
        int u, v; cin >> u >> v;
        g[u].push_back(v); g[v].push_back(u);
    }
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a+1, a+n+1);
    dfs(1, 0);
    sort(nodes.begin(), nodes.end());
    long long sum = 0;
    for(int i = 0; i < n; i++) {
        assign[nodes[i].second] = a[i+1];
        sum += a[i+1];
    }
    sum -= a[n];
    cout << sum << "\n";
    for(int i = 1; i <= n; i++) {
        cout << assign[i] << " ";
    }
    cout << "\n";



    return 0;
    
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>

using namespace std;

/********** TEMPLATE STARTS HERE ***********/

#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define gcd __gcd 
#define digits(n) (int)(log10(n) + 1)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <long long> vl;
typedef vector <pll> vll;
typedef vector <pii> vii;

const int INF = 0x3f3f3f3f;
const int LINF = 0x3f3f3f3f3f3f3f3f;

template <typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template <typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

/*********** TEMPLATE ENDS HERE *************/

const int DIM = 1e5 + 7;

#define int long long

vi arr;
int v[DIM];

main()
{
	IOS
	
	int n;
	cin >> n;
	
	for(int i = 1; i <= n; i++)
		cin >> v[i];
	
	sort(v + 1, v + 1 + n);
	
	int l = v[1];
	int r = v[1];
	
	int st = 2;
	int dr = n;
	
	bool le = 1;
	bool ri = 1;
	
	int s = 0;
	
	while(st <= dr)
	{
		int sl = 0;
		int sr = 0;
		
		if(le == 1)
			sl = abs(l - v[dr]);
		else
			sl = abs(l - v[st]);
		
		if(ri == 1)
			sr = abs(r - v[dr]);
		else
			sr = abs(r - v[st]);
		
		if(sl > sr)
		{
			if(le == 1)
			{
				le = 0;
				l = v[dr--];
			}
			else
			{
				le = 1;
				l = v[st++];
			}
			
			s += sl;
		}
		else
		{
			if(ri == 1)
			{
				ri = 0;
				r = v[dr--];
			}
			else
			{
				ri = 1;
				r = v[st++];
			}
			
			s += sr;
		}
	}
	
	cout << s;
}

Measured memory_bytes: 1024
#include <stdio.h>

#define N 10000

int is_prime(int x){ 
  int i;
  if(x == 1) return 0;
  if(x == 2) return 1;
  if(x%2 == 0) return 0;
  for(i=3; i*i <= x;i +=2){
    if(x%i == 0) return 0;
  }
  return 1;
}

int main(void){

  int i,n,c=0;
  int arr[N];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&arr[i]);
  }

  for(i=0;i<n;i++){
    if(is_prime(arr[i])){
	c++;
    }
  }

  printf("%d\n",c);
  
  return 0;
}


Measured memory_bytes: 2064
#include "bits/stdc++.h"

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=n-1;i>=m;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };

typedef long long ll;
using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<string> a(n), b(m);
	REP(i, n)cin>>a[i];
	REP(i, m)cin>>b[i];
	
	REP(i, n-m+1) {
		REP(j, n-m+1) {
			int flag = 1;
			REP(k, m) {
				REP(l, m) {
					if (a[i + k][j + l] != b[k][l])flag = 0;
				}
			}
			if (flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()


i64 dp[3030][3030][2];
int main() {
  i64 N, T;
  cin >> N >> T;
  vector<i64> A(N), B(N);
  rep(i,0,N) cin >> A[i] >> B[i];

  vector<i64> idx(N);
  rep(i,0,N) idx[i] = i;

  /*do {
    i64 sum = 0;
    i64 cnt = 0;
    vector<i64> vec;
    for(auto x: idx) {
      if(cnt >= T) continue;
      vec.push_back(x);
      cnt += A[x];
      sum += B[x];
    }
    if(sum == 145) {
      for(auto x: vec) {
        cout << x << " ";
      }
      cout << endl;
    }
  } while(next_permutation(all(idx))); */

  i64 ans = 0;
  rep(i,0,N) {
    rep(t,0,T) {
      rep(s,0,2) {
        dp[i + 1][t][s] = max(dp[i + 1][t][s], dp[i][t][s]);
        ans = max(ans, dp[i + 1][t][s]);

        if(t + A[i] < T) {
          dp[i + 1][t + A[i]][s] = max(dp[i + 1][t + A[i]][s], dp[i][t][s] + B[i]);
          ans = max(ans, dp[i + 1][t + A[i]][s]);
        }
        if(s == 0) {
          dp[i + 1][t][1] = max(dp[i + 1][t][1], dp[i][t][s] + B[i]);
          ans = max(ans, dp[i + 1][t][1]);
        }
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 143616
#include <bits/stdc++.h>

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, n);
  vector<int> target(3);
  rep(i, 3) cin >> target[i];
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  vector<int> current(3);
  int ans = numeric_limits<int>::max();
  function<void(int, int)> dfs = [&](int depth, int used_mp) {
    if (depth == n) {
      rep(i, 3) {
        if (current[i] == 0) return;
        used_mp += abs(target[i] - current[i]);
      }
      ans = min(ans, used_mp);
      return;
    }
    rep(i, 4) {
      int mp = 0;
      if (i < 3) {
        if (current[i] != 0) {
          mp += 10;
        }
        current[i] += l[depth];
      }
      dfs(depth + 1, used_mp + mp);
      if (i < 3) {
        current[i] -= l[depth];
      }
    }
  };
  dfs(0, 0);
  out(ans);
}


Measured memory_bytes: 3564
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

const ll INF = 1LL << 50;

const ll mod = 1e9 + 7;

int main() {
  while (true) {
    ll n;
    cin >> n;
    if (n == 0) break;

    ll lsize = 60 * 60 * 24;
    vll lst(lsize, 0);
    rep(i, n) {
      string str;
      cin >> str;
      ll bt = stoi(str.substr(0, 2)) * 3600 + stoi(str.substr(3, 2)) * 60 +
              stoi(str.substr(6, 2));
      cin >> str;
      ll et = stoi(str.substr(0, 2)) * 3600 + stoi(str.substr(3, 2)) * 60 +
              stoi(str.substr(6, 2));
      lst[bt]++;
      lst[et]--;
      assert(bt < lsize);
      assert(et < lsize);
    }

    ll ans = 0;
    rep(i, lsize-1) {
      lst[i + 1] += lst[i];
      chmax(ans, lst[i + 1]);
    }
    assert(lst[lsize - 1] == 0);
    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 3868
#include <iostream>
#include <vector>
#include <algorithm>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

int main() {
    const int maxn = 3e5+1;
    int n, k;
    cin >> n >> k;

    vector<int> a(n);
    for(int &i: a)
        cin >> i;

    auto operation = [] (int a, int b) -> int { return max(a, b); };
    auto starting = [] () -> int { return 0; };

    segtree<int, operation, starting> segmentitos(maxn);

    int ans = -1;
    for(int i: a) {
        int l = max(i - k, 0);
        int r = min(i + k, 300'000);
        int maxima = segmentitos.prod(l, r + 1) + 1;
        ans = max(ans, maxima);
        segmentitos.set(i, maxima);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9188
use proconio::{fastout, input};

use std::cmp::max;

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [u64; n]
    }
    let mut ans = 0;
    let mut dp = vec![vec![0; n + 1]; n + 1];
    let mut a = a.iter().enumerate().collect::<Vec<_>>();
    a.sort_by_key(|x| std::cmp::Reverse(x.1));
    let abs = |x, y| if x > y { x - y } else { y - x };
    for i in 0..n {
        for j in 0..=i {
            let k = i - j;
            dp[i + 1][j] = max(
                dp[i + 1][j],
                dp[i][j] + a[i].1 * abs(n - 1 - k, a[i].0) as u64,
            );
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + a[i].1 * abs(a[i].0, j) as u64);
        }
    }
    for x in dp[n].iter() {
        ans = max(ans, *x);
    }
    println!("{}", ans);
}


Measured memory_bytes: 33492
n = int(input())
a = list(map(int,input().split()))
a.sort()
s = 0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if a[i]<a[j] and a[j]<a[k] and a[k]<a[i]+a[j]:
        ##print(i,j,k)
        s += 1
print(s)      

Measured memory_bytes: 9064
#include<bits/stdc++.h>
using namespace std;
const int MAXN=40010;
const int maxn=120010;
const int maxm=7000010;
struct E
{
    int to,next;
}edge[maxm];
int head[maxn],tol;
inline void Addedge(int u,int v)
{
    edge[tol].to=v;edge[tol].next=head[u];head[u]=tol++;
    return;
}
int dfn[maxn],low[maxn],stk[maxn],bel[maxn],top,tot,blocks;
inline void Tarjan(int u)
{
    dfn[u]=low[u]=++tot;
    stk[top++]=u;
    int v;
    for(int i=head[u];i!=-1;i=edge[i].next){
        v=edge[i].to;
        if(!dfn[v]){
            Tarjan(v);
            if(low[v]<low[u]) low[u]=low[v];
        }
        else if(!bel[v]&&dfn[v]<low[u]) low[u]=dfn[v];
    }
    if(low[u]==dfn[u]){
        ++blocks;
        do
        {
            v=stk[--top];
            bel[v]=blocks;
        }while(v!=u);
    }
    return;
}
struct Node
{
    int val,id;
    bool operator<(const Node&p)const
    {
        return val<p.val;
    }
}w[MAXN];
int h[MAXN],rh[MAXN],id[maxn],pos,n;
inline void build(int l,int r,int rt)
{
    id[rt]=pos++;
    if(l==r){
        Addedge(id[rt]<<1|1,rh[l]^1);
        Addedge(rh[l],id[rt]<<1);
        return;
    }
    int mid=l+r>>1;
    build(l,mid,rt<<1);
    build(mid+1,r,rt<<1|1);
    Addedge(id[rt]<<1|1,id[rt<<1]<<1|1);
    Addedge(id[rt]<<1|1,id[rt<<1|1]<<1|1);
    Addedge(id[rt<<1]<<1,id[rt]<<1);
    Addedge(id[rt<<1|1]<<1,id[rt]<<1);
    return;
}
inline void update(int L,int R,int u,int l,int r,int rt)
{
    if(L<=l&&R>=r){
        Addedge(u,id[rt]<<1|1);
        Addedge(id[rt]<<1,u^1);
        return;
    }
    int mid=l+r>>1;
    if(L<=mid) update(L,R,u,l,mid,rt<<1);
    if(R>mid) update(L,R,u,mid+1,r,rt<<1|1);
    return;
}
inline bool check(int d)
{
    if(!d) return 1;
    memset(dfn,0,sizeof(dfn));
    memset(bel,0,sizeof(bel));
    memset(head,-1,sizeof(head));
    pos=n;
    tol=top=tot=blocks=0;
    build(1,n<<1,1);
    for(int i=0;i<n<<1;i++){
        Node tmp;
        tmp.val=w[h[i]-1].val-d+1;
        int l=lower_bound(w,w+(n<<1),tmp)-w+1;
        tmp.val+=d+d-2;
        int r=upper_bound(w,w+(n<<1),tmp)-w;
        if(l<h[i]) update(l,h[i]-1,i,1,n<<1,1);
        if(r>h[i]) update(h[i]+1,r,i,1,n<<1,1);
    }
    for(int i=0;i<pos<<1;i++) if(!dfn[i]) Tarjan(i);
    for(int i=0;i<pos<<1;i+=2){
        if(bel[i]==bel[i^1]) return 0;
    }
    return 1;
}
inline int solve()
{
    int l=0,r=1e9+1;
    while(l<r)
    {
        int mid=l+r+1>>1;
        if(check(mid)) l=mid;
        else r=mid-1;
    }
    return l;
}
int main()
{
  //  freopen("a.txt","r",stdin);
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++){
            scanf("%d%d",&w[i<<1].val,&w[i<<1|1].val);
            w[i<<1].id=i<<1,w[i<<1|1].id=i<<1|1;
        }
        sort(w,w+(n<<1));
        for(int i=0;i<n<<1;i++){
            rh[i+1]=w[i].id;
            h[w[i].id]=i+1;
        }
        printf("%d\n",solve());
    }
    return 0;
}


Measured memory_bytes: 17408
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}

int main(){
  int n,m;
  scanf("%d%d",&n,&m);
  int a[n+1];
  int b[m+1];
  int i;
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  a[n] = -1;
  for(i=0;i<m;i++){
    scanf("%d",&b[i]);
  }
  b[m] = -1;
  qsort(a, n, sizeof(int), compare_int);
  qsort(b, m, sizeof(int), compare_int);
  long long int ans = 1;
  i = n * m;
  int row = 0;
  int column = 0;
  while(i > 0){
    //printf("%d %d %d\n", a[row], b[column], i);
    if(a[row] == i && b[column] == i){
      row++;
      column++;
    }else if(a[row] != i && b[column] == i){
      column++;
      ans *= (long long int) row;
    }else if(a[row] == i && b[column] != i){
      row++;
      ans *= (long long int) column;
    }else{
      ans *= (long long int) (row * column - (n * m - i));
    }
    if(ans == 0){
      break;
    }
    ans = ans % 1000000007;
    i--;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 128
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>

using namespace std;

#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }

typedef long long LL;

const int N = (int) 1e6 + 6, mod = (int) 0;

set<int> all[N];
int qv[N], qd[N], qc[N], q[N * 10], seen[N], res[N];
vector<int> adj[N];
int main() {
	ios_base::sync_with_stdio(0);
	int n, m;
	cin >> n >> m;
	memset(seen, -1, sizeof seen);
	for (int j = 0; j < m; ++j) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	int qn;
	cin >> qn;
	for (int j = 0; j < qn; ++j) {
		cin >> qv[j] >> qd[j] >> qc[j];
		--qv[j];
	}
	for (int j = qn - 1; j >= 0; --j) {
		int h = 0, t = 0;
		if (seen[qv[j]] < qd[j]) {
			seen[qv[j]] = qd[j];
			q[t++] = qv[j];
		}
		while (h != t) {
			int v = q[h++];
			if (!res[v]) {
				res[v] = qc[j];
			}
			if (seen[v] <= 0) {
				continue;
			}
			for (int u : adj[v]) {
				if (seen[u] < seen[v] - 1) {
					seen[u] = seen[v] - 1;
					q[t++] = u;
				}
			}
		}
	}
	for (int j = 0; j < n; ++j)
		cout << res[j] << '\n';

}



Measured memory_bytes: 88056
import java.util.Scanner;


public class Main {
	Scanner in = new Scanner(System.in);
	
	int idx = 0;
	
	String s;
	

	void searchMarukakko() {
		for ( ;idx < s.length(); idx++) {
			if (s.charAt(idx) == ')') {
				marukakko--;
				return;
			}
			else if (s.charAt(idx) == '(') {
				marukakko++;
				idx++;
				searchMarukakko();
			} else if (s.charAt(idx) == '[') {
				kakukakko++;
				idx++;
				searchKakukakko();
			} else if (s.charAt(idx) == ']') {
				marukakko = 100000;
				return;
			}
		} 
	}

	void searchKakukakko() {
		for ( ;idx < s.length(); idx++) {
			if (s.charAt(idx) == ']') {
				kakukakko--;
				return;
			}
			else if (s.charAt(idx) == '(') {
				marukakko++;
				idx++;
				searchMarukakko();
			} else if (s.charAt(idx) == '[') {
				kakukakko++;
				idx++;
				searchKakukakko();
			} else if (s.charAt(idx) == ')') {
				kakukakko = 100000;
				return;
			}
		} 
	}
	
	int kakukakko, marukakko;
	
	void run() {
		while (true) {
			s = in.nextLine();
			if (s.charAt(0) == '.') break;
			
			kakukakko = 0;
			marukakko = 0;
			idx = 0;
			boolean res = true;
			for ( ; idx < s.length(); idx++) {
				if (s.charAt(idx) == '(') {
					marukakko++;
					idx++;
					searchMarukakko();
				} else if (s.charAt(idx) == '[') {
					kakukakko++;
					idx++;
					searchKakukakko();
				} else if (s.charAt(idx) == ')' || s.charAt(idx) == ']') {
					res = false;
					break;
				}
			}
			if (marukakko != 0 || kakukakko != 0) res = false;
			
			System.out.println(res ? "yes" : "no");
		}
	}
	
	public static void main(String args[]) {
		new Main().run();
	}
}

Measured memory_bytes: 56012
#include <bits/stdc++.h>

using namespace std;

double p[3002];
double dp[3002][3002];

int main(){
    int N;
    cin >> N;
    for(int i=1; i<=N; i++){
        cin >> p[i];
    }

    dp[0][0] = 1.0;
    dp[1][0] = 1 - p[1];
    dp[1][1] = p[1];
    for(int i=2; i<=N; i++){
        for(int j=0; j<=i; j++){
            if (j==0){
                dp[i][0] = dp[i-1][0] * (1 - p[i]);
            }else if (j==i){
                dp[i][j] = dp[i-1][j-1] * p[i];
            }else{
                dp[i][j] = dp[i-1][j-1] * p[i] + dp[i-1][j] * (1 - p[i]);
            }
        }
    }
    double ans = 0.0;
    for(int j=N/2 + 1; j<=N; j++){
        ans += dp[N][j];
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 68992
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  ll n, m, d;
  cin >> n >> m >> d;

  double x = 2.0 * max(0LL, n-d);
  if(d==0) x /= 2.0;
  double ret = x * (m-1) / (double)n / (double)n;
  
  printf("%.16lf\n", ret);
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <queue>
#include <assert.h>
#include <cmath>
#include <deque>
using namespace std;
using ll = long long;
using ld = long double;
const ll mxs = 200010;
const ll mod = 1e9+7;

bool cmp(const pair<int, int> p1, const pair<int, int> p2) {
	return (p1.first+p1.second)<(p2.first+p2.second);
}

ll fact[mxs], inv_fact[mxs];

ll my_pow(ll a, ll b) {
	ll ret = 1ll;
	while(b) {
		if(b&1) {
			ret = ret*a%mod;
		}
		a = a*a%mod;
		b/=2;
	}
	return ret;
}

ll my_inv(ll a) {
	return my_pow(a, mod-2ll)%mod;
}

void pre() {
	inv_fact[0] = fact[0] = 1ll;
	for(int i=1; i<mxs; i++) {
		fact[i] = fact[i-1]*i%mod;
		inv_fact[i] = my_inv(fact[i]);
	}
}

ll C(ll n, ll k) {
	assert(k<=n);
	return fact[n]*inv_fact[k]%mod*inv_fact[n-k]%mod;
}

ll count_ways(int a, int b, int c, int d) {
	assert(a<=c and b<=d);
	ll diff1 = c-a, diff2 = d-b;
	return C(diff2+diff1, diff1)%mod;
}

int main() {
	pre();
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int H, W, N;
	cin>>H>>W>>N;
	vector<pair<int, int> > forbidden(N+1);
	for(int i=0; i<N; i++) {
		cin>>forbidden[i].first>>forbidden[i].second;
	}
	vector<ll> dp(N+1);
	forbidden[N] = make_pair(H, W);
	sort(forbidden.begin(), forbidden.end(), cmp);

	for(int i=0; i<=N; i++) {
		//cout << "loop\n";
		ll tmp = count_ways(1, 1, forbidden[i].first, forbidden[i].second);
		ll minus = 0ll;
		for(int j=0; j<i; j++) {
			if(forbidden[j].first<=forbidden[i].first and forbidden[j].second<=forbidden[i].second) {
				minus+=dp[j]*count_ways(forbidden[j].first, forbidden[j].second, forbidden[i].first, forbidden[i].second)%mod;
				minus%=mod;
			}
		}
		tmp-=minus;
		if(tmp<0ll) tmp+=mod;
		dp[i] = tmp;
	}

	cout << dp[N] << '\n';

	return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main() {
   int n;
   cin >> n;
   vector<int>cnt(100000), a(n),b(n),c(n);
   rep(i, 0, n)cin >> a[i];
   sort(a.begin(), a.end());
   if(n%2==0){
       rep(i, 0, n){
           if(i%2==0)b[i]=i+1;
           else b[i]=i;
       }
       if(a == b){
           ll ans = 1;
           rep(i, 0, (b[b.size()-1]+1)/2){
               ans *= 2;
               ans %= mod;
           }
           cout << ans << endl;
       }else{
           cout << 0 << endl;
       }
   }else{
       rep(i, 0, n){
           if(i%2==0)c[i]=i;
           else c[i]=i+1;
       }
       if(a == c){
           ll ans = 1;
           rep(i, 0, c[c.size()-1]/2){
               ans *= 2;
               ans %= mod;
           }
           cout << ans << endl;
       }else{
           cout << 0 << endl;
        }
   }
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>

using namespace std;
typedef long long ll;

ll A, B;

int main() {
	cin >> A >> B;
	cout << max(2 * A - 1, max(A + B, 2 * B - 1)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    string o, e;
    cin >> o >> e;
    string ans;
    for (int i=0; i<o.size()+e.size(); i++){
        if (i%2 == 0){
            ans += o[i/2];
        }
        else ans += e[i/2];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = ReadStringToCharArray();

            Console.WriteLine(a[0] != a[1] && a[1] != a[2] && a[0] != a[2] ? "Yes" : "No");
        }

        static int[] ReadInt()
        {
            return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        }
        static char[] ReadStringToCharArray()
        {
            return Console.ReadLine().ToArray();
        }
    }
}



Measured memory_bytes: 13268
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
// use std::collections::BinaryHeap;

fn main() {
  let s = read::<String>();
  let s_char: Vec<char> = s.chars().collect();
  let mut ans = String::from("");
  ans.push_str(&s_char[0].to_string());
  let s_len = s.len() as usize;
  ans.push_str(&(s_len-2).to_string());
  ans.push_str(&s_char[s_len-1].to_string());

  println!("{}", ans);

}


Measured memory_bytes: 4352
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=300005,md=1000000007;
int n,i,j,k,f[N][3][3],ans;
char s[N];
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	f[0][0][0]=1;
	for(i=0;i<n;++i)
		for(j=0;j<=2;++j)
			for(k=0;k<=2;++k)
				if(f[i][j][k])
				{
					if(s[i+1]=='?'||s[i+1]=='0')
						f[i+1][j][k==2?1:k+1]=(f[i+1][j][k==2?1:k+1]+f[i][j][k])%md;
					if(s[i+1]=='?'||s[i+1]=='1')
					{
						if(k==0)
							f[i+1][min(2,j+1)][k]=(f[i+1][min(2,j+1)][k]+f[i][j][k])%md;
						else
							f[i+1][j][k-1]=(f[i+1][j][k-1]+f[i][j][k])%md;
					}
				}
	ans=(1ll*f[n][1][0]+f[n][2][0]+f[n][2][1]+f[n][2][2])%md;
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 11008
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    int n, m, k;
    while (cin >> n >> m >> k, n) {
        vector<vector<lli>> dp(n + 1, vector<lli>(n * m + 1, 0));
        dp[0][0] = 1LL;
        REP (i, 0, n) {
            REP (j, 0 * i, m * i + 1) {
                REP (t, 1, m + 1) {
                    dp[i + 1][j + t] += dp[i][j];
                }
            }
        }
        lli sum = 0;
        REP (i, 0, dp[n].size()) {
            int score = (i <= k ? 1 : i - k);
            sum += score * dp[n][i];
        }
        lli div = 1;
        REP (i, 0, n) div *= m;
        cout << fixed << setprecision(10) << (double) sum / div << endl;
    }
    return 0;
}

Measured memory_bytes: 3312
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define REP(i, n) for (ll i = 0; i < n; i++)
using ll = long long;
using namespace std;

ll H, W;

vector<string> S;
vector<ll> board(400);

inline bool isOK(ll i, ll j, ll cur) {
  if (!(0 <= i && i < W && 0 <= j && j < H)) {
    return false;
  }

  if (S[j][i] == '#') {
    return false;
  }

  if (board[j * W + i] == -1) {
    return true;
  }

  if (board[j * W + i] <= cur) {
    return false;
  }

  return true;
}

ll srch(ll i, ll j, ll cur) {
  board[j * W + i] = cur;

  ll mn = 19190721;

  ll dS[4][2] = { { 1, 0 }, { -1, 0 }, { 0, 1}, {0, -1}};

  REP(t, 4) {
    ll ni = i + dS[t][0];
    ll nj = j + dS[t][1];

    if (isOK(ni, nj, cur + 1)) {
      ll tmp = srch(ni, nj, cur + 1);
      if (tmp >= 0) {
        mn = min(mn, tmp);
      }
    }
  }

  if (mn == 19190721) {
    return -1;
  }
  return mn;
}


int main() {
  cin >> H >> W;

  for (int i = 0; i < H; i++) {
    string tmp;
    cin >> tmp;
    S.push_back(tmp);
  }

  ll mx = 0;

  REP(si, W) {
    REP(sj, H) {
          if (S[sj][si] == '.') {
            fill(board.begin(), board.end(), -1);
            ll tmp = srch(si, sj, 0);
            tmp = *max_element(board.begin(), board.end());

            mx = max(tmp, mx);
          }
        }
  }

  cout << mx << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int d;
  d = c - (a - b);
    if (d >= 0) {
    cout << d << endl;
  } else {
    cout << "0" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
#define MOD 1000000007

int main() {
	int N, M;
	cin >> N >> M;
	string S;
	cin >> S;
	vector<int> SF(N + 1);

	int g = N;
	for (int i = N;i >= 0;i--) {
		if (S[i] == '0') {
			g = i;
		}
		SF[i] = g;
	}
	//for (int i = 0;i <= N;i++)cout << SF[i] << " ";
	vector<int> ans;
	int x;g = N;
	while (g != 0) {
		if (g - M >= 0) {
			x = SF[g - M];
		}
		else {
			x = 0;
		}
		ans.push_back(g - x);
		if (g == x) {
			cout << -1 << endl;
			return 0;
		}
		g = x;
	}
	reverse(all(ans));
	for (int i : ans) {
		cout << i << " ";
	}
	cout << endl;
}

Measured memory_bytes: 1528
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final int n = fs.nextInt();
        if (n == 1) {
            System.out.println("Hello World");
        } else {
            System.out.println(fs.nextInt() + fs.nextInt());
        }
    }

    static final class Utils {
        public static void shuffleSort(int[] arr) {
            shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffleSort(long[] arr) {
            shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffle(int[] arr) {
            final Random r = new Random();

            for (int i = 0; i <= arr.length - 2; i++) {
                final int j = i + r.nextInt(arr.length - i);
                swap(arr, i, j);
            }
        }

        public static void shuffle(long[] arr) {
            final Random r = new Random();

            for (int i = 0; i <= arr.length - 2; i++) {
                final int j = i + r.nextInt(arr.length - i);
                swap(arr, i, j);
            }
        }

        public static void swap(int[] arr, int i, int j) {
            final int t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
        }

        public static void swap(long[] arr, int i, int j) {
            final long t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
        }

        private Utils() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        private String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int[] nextIntArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long[] nextLongArray(int n) {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++) { a[i] = nextLong(); }
            return a;
        }
    }
}


Measured memory_bytes: 32744
#include <bits/stdc++.h>
using namespace std;

int main() {
	int x1, x2, x3, x4, x5;
	cin >> x1 >> x2 >> x3 >> x4 >> x5;

	if(x1 == 0){
		cout << 1 << endl;
	}else if(x2 == 0){
		cout << 2 << endl;
	}else if(x3 == 0){
		cout << 3 << endl;
	}else if(x4 == 0){
		cout << 4 << endl;
	}else{
		cout << 5 << endl;
	}

}


Measured memory_bytes: 3636
use proconio::input;

fn main() {
    input! {
        a: u32,
        b: u32,
        c: u32,
        d: u32,
    }

    let n = if a % d > 0 {
        a / d + 1
    } else {
        a / d
    };

    let m = if c % b > 0 {
        c / b + 1
    } else {
        c / b
    };

    if n >= m {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2104
N = int(input())

nA = [ 0 for i in range(N)]
nB = [ 0 for i in range(N)]
nC = [ 0 for i in range(N-1)]

Tmp = []
Tmp = input().rstrip().split(' ')
for i in range(N):
  nA[i] = int(Tmp[i])

Tmp = []
Tmp = input().rstrip().split(' ')
for i in range(N):
  nB[i] = int(Tmp[i])

Tmp = []
Tmp = input().rstrip().split(' ')
for i in range(N-1):
  nC[i] = int(Tmp[i])
  
Ans = 0

nTmpOld = N + 2
for i in range(N):
  nTmp = nA[i] - 1
  
  Ans += nB[nTmp]
  
  if i > 0 and nTmp == nTmpOld + 1:
    Ans += nC[nTmp-1]
  
  nTmpOld = nTmp

print(Ans)



  
  
  

Measured memory_bytes: 3064