akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

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

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int X,Y; cin >> X >> Y;
    int res = 0;
    if (X==1&&Y==1) res += 400000;
    if (X==1) res += 300000;
    if (X==2) res += 200000;
    if (X==3) res += 100000;
    if (Y==1) res += 300000;
    if (Y==2) res += 200000;
    if (Y==3) res += 100000;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<cmath>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(ll i = 0;i < n;i++)
#define FOR(i,a,b) for(ll i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll digitsum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
int getdigit(ll a) {
	return to_string(a).size();
}
int countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}
int to_num(char c) {
	if (c >= '0' && c <= '9')return (c - '0');
	else return -1;
}

struct edge { ll to, cost; };

int main() {
	IOS;
	ll mod = 1e9 + 7;
	ll n, m;
	cin >> n >> m;
	ll ans;
	if (m - n == 1)ans = m;
	else if (n - m == 1)ans = n;
	else if (n == m)ans = 2;
	else ans = 0;
	FOR(i, 1, min(n,m) + 1) {
		ans *= (i * i) % mod;
		ans %= mod;
	}
	dump(ans);
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N;
	cin >> N;
	int count = 0;
	for (int n = 0;n<N; ++n) {
		int num;
		cin >> num;
		if (num != n+1) {
			count++;
		}
	}
	if (count <= 2) {
		cout << "YES"<< endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1; rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)(n),(int)(n))
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k;
  double result=0.0;
  int tmp,count;
  int l[LIMIT2]={0},r[LIMIT1]={0};
  char s[LIMIT1];
  int lMax,rMin;

  scanf("%lld %lld",&n,&k);
  rep(i,n){
    tmp=i+1;
    count=0;
    while(tmp < k){
      tmp *= 2;
      count++;
    }
    result += (double)pow(0.5,count)/n;
  }
  printf("%.12f",result);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,m,n,res;
    cin>>a>>b>>c;

     if(c>=b&&c<=b+a)
        cout<<0<<endl;
     else if(a+b<c)
     {
         res=abs(a+b-c);
         cout<<res<<endl;
     }
    else{

        res=b-(a+c);
        cout<<res<<endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using std::cin;
using std::cout;
using std::endl;
using std::string;

static bool
check(string const &S)
{
  char a = S[0];
  char b = S[1];
  char c = S[2];
  char d = S[3];
  return (a == b ? (c == d && a != c)
          : ((a == c && b == d) || (a == d && b == c)));
}

int
main()
{
  string S;
  cin >> S;
  cout << (check(S) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAX = 2e5 ;
const int INF = 1e9 + 1e5 + 2;
const int mod= 1e9+7;
#define eps 1e-15
typedef long long ll;
int main()
{
    ll n,a,b;

    cin>>n>>a>>b;
    if (a==0)
    {
        cout<<0;
        return 0;
    }

    ll x=a+b;

    ll y=n%x;

    ll ans=a*(n/x)+min(y,a);

    cout<<ans;








}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n, k) for (int i = n; i < k; i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define printv(v)                      \
    for (int i = 0; i < v.size(); i++) \
        P(v[i]);
#define printt(a, b) cout << a << " " << b << endl;
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int MOD = 1e9 + 7;

void solve()
{
    int x, a;
    cin >> x >> a;
    P(x < a ? 0 : 10);
}

int main()
{
    solve();
    return 0;
}


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

int main() {
  int x;
  cin >> x;
  if (x==2) {
    cout << x << endl;
    return 0;
  }
  while (true) {
    bool a = 0;
    for (int i = 2; i<=sqrt(x); i++) {
      if (x%i==0) {
        a = 1;
        x++;
        break;
      }
    }
    if (a==0) {
      cout << x << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3676
#include <stdio.h>
#define MAX 10000
int main(void){
	int n,i;
	scanf("%d",&n);
	int A[n+1];//入力の配列
	int B[n],C[MAX+1];//カウントの配列
	for(i=0;i<MAX;i++){
		C[i]=0;// カウントの初期化
	}
	for(i=0;i<n;i++){
		scanf("%d",&A[i+1]);
		C[A[i+1]]++;//要素をカウントさせる
	}
	for(i=1;i<=MAX;i++){//0～要素の最大値にカウントされている
		//累積和を求める
		C[i]=C[i]+C[i-1];
	}
	for(i=1;i<=n;i++){
		B[C[A[i]]]=A[i];//表示配列に代入
		C[A[i]]--;//カウントを減らす
	}
	
	for(i=1;i<=n;i++){
		if(i>1){
			printf(" ");
		}
		printf("%d",B[i]);//Bを出力
	}
	printf("\n");
	
	return 0;
}



Measured memory_bytes: 17376
import sys
def inpl(): return [int(i) for i in input().split()]
N = int(input())
A = inpl()
B = inpl()
if sum(A) < sum(B):
    print(-1)
    sys.exit()
sB = [j for i, j in zip(A, B) if i < j]
sA = [i for i, j in zip(A, B) if i < j]
ans = len(sA) 
k = sum(sB) - sum(sA)
C = sorted([i-j for i, j in zip(A,B) if i >= j])
while k > 0:
    c = C.pop()
    k -= c
    ans += 1
print(ans)

Measured memory_bytes: 18620
import sys,collections,math,functools;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

n, s = Is()
xs = Is()
xs2 = [abs(e-s) for e in xs]
c = xs2[0]
ans = c
for e in xs2:
    ans = gcd(ans,e)
print(ans)


Measured memory_bytes: 14748
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    D = [il() for _ in range(N)]

    for i in range(N - 2):
        for j in range(i, i + 3):
            if D[j][0] != D[j][1]: break
        else:
            print('Yes')
            exit()
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9896
#include<stdio.h>
int a[262144];
int num[262144];
int inv[262144];
int pr[262144],inpr[262144],pre[262144];
int c[262144];
int n;
void inc(int wz,int val)
{
	for(int i=wz;i<=n;i+=(i&(-i)))
	{
		c[i]+=val;
		if(c[i]>=1000000007)
		{
			c[i]-=1000000007;
		}
	}
}
int query(int wz)
{
	int ans=0;
	for(int i=wz;i>0;i-=(i&(-i)))
	{
		ans+=c[i];
		if(ans>=1000000007)
		{
			ans-=1000000007;
		}
	}
	return ans;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		num[a[i]]++;
	}
	int nump=1;
	num[n+1]=1;
	for(int i=n;i>0;i--)
	{
		num[i]+=num[i+1]-1;
		if(num[i]==0)
		{
			printf("0\n");
			return 0;
		}
		nump=(long long)nump*num[i]%1000000007;
	}
	inv[1]=1;
	for(int i=2;i<=n;i++)
	{
		inv[i]=(long long)1000000007/i*inv[1000000007%i]%1000000007;
		inv[i]=1000000007-inv[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(num[i]==1)
		{
			pre[i]=i;
			pr[i]=1;
			inpr[i]=1;
		}
		else
		{
			pre[i]=pre[i-1];
			pr[i]=(long long)pr[i-1]*(num[i]-1)%1000000007;
			pr[i]=(long long)pr[i]*inv[num[i]]%1000000007;
			inpr[i]=(long long)inpr[i-1]*inv[num[i]-1]%1000000007;
			inpr[i]=(long long)inpr[i]*num[i]%1000000007;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		c[i]=0;
	}
	for(int i=1;i<=n;i++)
	{
		int val=query(a[i])-query(pre[a[i]]-1);
		if(val<0)
		{
			val+=1000000007;
		}
		ans+=(long long)val*pr[a[i]]%1000000007;
		if(ans>=1000000007)
		{
			ans-=1000000007;
		}
		inc(a[i],inpr[a[i]]);
	}
	for(int i=1;i<=n;i++)
	{
		c[i]=0;
	}
	for(int i=n;i>=1;i--)
	{
		int val=query(a[i]-1)-query(pre[a[i]]-1);
		if(val<0)
		{
			val+=1000000007;
		}
		ans-=(long long)val*pr[a[i]]%1000000007;
		if(ans<0)
		{
			ans+=1000000007;
		}
		inc(a[i],inpr[a[i]]);
	}
	for(int i=1;i<=n;i++)
	{
		c[i]=0;
	}
	for(int i=n;i>=1;i--)
	{
		ans+=query(a[i]-1);
		if(ans>=1000000007)
		{
			ans-=1000000007;
		}
		inc(a[i],2);
	}
	ans=(long long)ans*500000004%1000000007;
	ans=(long long)ans*nump%1000000007;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 6656
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }
 

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int n;
	cin >> n;
	vector<int> a(n), b(n);
	rep(i, n) {
		cin >> a[i]; a[i] *= 100;
	}
	rep(i, n) {
		cin >> b[i]; b[i] *= 100;
	}
	int ans = INF;
	rep(i, (1 << n)) {
		vector<int> odd, even;
		vector<P> vec;
		int oddcnt = 0, evencnt = 0;
		rep(j, n) {
			if (!((i >> j) & 1)) {
				if (j % 2 == 0) {
					oddcnt++;
					odd.pb(a[j]);
					vec.pb(P(a[j], 1));
				}
				else {
					evencnt++;
					even.pb(a[j]);
					vec.pb(P(a[j], 0));
				}
			}
			else {
				if (j % 2 == 0) {
					evencnt++;
					even.pb(b[j]);
					vec.pb(P(b[j], 0));
				}
				else {
					oddcnt++;
					odd.pb(b[j]);
					vec.pb(P(b[j], 1));
				}
			}
		}
		int x = odd.size();
		int y = even.size();
		if (x != y && x != y + 1) continue;
		vector<int> pl(n);
		rep(j, n) {
			rep(k, n) {
				if (j == k) continue;
				if (vec[j].second != vec[k].second) continue;
				if (vec[j].first > vec[k].first) pl[j]++;
				else if (vec[j].first == vec[k].first && j > k) pl[j]++;
			}
			pl[j] *= 2;
			if (vec[j].second == 0) pl[j]++;
		}
		sort(all(odd)); sort(all(even));
		vector<int> check;
		rep(j, y) {
			check.pb(odd[j]);
			check.pb(even[j]);
		}
		if (x == y + 1) check.pb(odd[y]);
		bool ok = true;
		rep(j, n - 1) {
			if (check[j] > check[j + 1]) ok = false;
		}
		if (!ok) continue;
		int cnt = 0;
		rep(j, n) {
			for (int k = j + 1; k < n; k++) {
				if (pl[j] > pl[k]) cnt++;
			}
		}
		chmin(ans, cnt);
	}
	cout << (ans == INF ? -1 : ans) << endl;
}

Measured memory_bytes: 256
n = int(input())
S = list(map(int, input().split()))
S.append(0)
q = int(input())
T = list(map(int, input().split()))
N = 0
for t in T:
    i = 0
    S[n] = t
    while S[i] != t:
        i += 1
    if i != n:
        N += 1
print(N)


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

int main(){
  int c1,c5,c10,c50,c100,c500;

  cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;

  int ans;
  ans=c1 + c5*5 + c10*10 + c50*50 + c100*100 + c500*500;

  if(ans>=1000){
    cout << "1\n";
  }else{
    cout << "0\n";
  }

  return 0;
}



Measured memory_bytes: 3104
n = int(input())
s = [input() for i in range(n)]
ans = [float("inf")] * 26
for i in range(n):
  tmp = [0] * 26
  for j in s[i]:
    tmp[ord(j)-ord("a")] += 1
  for j in range(26):
    ans[j] = min(ans[j],tmp[j])
res = ""
for j in range(26):
  if ans[j] != float("inf"):
    res += chr(97+j)*ans[j]
print(res)

Measured memory_bytes: 40048
using System;
using System.Collections.Generic;
using System.Linq;
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Long() + add;
        }
        return Array;
    }
}
class Program {
    static Scanner cin = new Scanner();
    static void Main() {
        string S = Console.ReadLine();
        int one = 0, zero = 0;
        int tmp = 0, tmp2 = 0;
        //for (int i = 0; i < S.Length; i++) {
        //    if (S[i] == '1') one++;
        //    else zero++;
        //    if(one == zero) {
        //        tmp += one + zero;
        //        one = 0;
        //        zero = 0;
        //    }
        //}
        //one = 0;
        //zero = 0;
        //for(int i = S.Length - 1; i >= 0; i--) {
        //    if (S[i] == '1') one++;
        //    else zero++;
        //    if (one == zero) {
        //        tmp2 += one + zero;
        //        one = 0;
        //        zero = 0;
        //    }
        //}
        //Console.WriteLine(Math.Max(tmp, tmp2));
        for (int i = 0; i < S.Length; i++) {
            if (S[i] == '0') zero++;
            else one++;
            if(one > 0 && zero > 0) {
                int num = Math.Min(one, zero);
                tmp += 2 * Math.Min(one, zero);
                one -= num;
                zero -= num;
            }
        }
        Console.WriteLine(tmp);
        Console.ReadLine();
    }
}

Measured memory_bytes: 13116
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll p[2000010],hell=1000003;
ll exp(ll x,ll y){
    ll res=1;
    while(y>0){
        if(y&1)
        res=(res*x)%hell;
        y>>=1;
        x=(x*x)%hell;
    }
    return res;
}
void solve(){
    ll x,d,n;
    cin>>x>>d>>n;
    if(d==0){
        cout<<exp(x,n)<<endl;
        return;
    }
    else if(n>hell){
        cout<<"0\n";
        return;
    }
    x*=exp(d,hell-2);
    x%=hell;
    if(x==0){
        cout<<"0\n";
        return;
    }
    ll res=(exp(d,n)*p[x+n-1])%hell;
    res%=hell;
    res*=exp(p[x-1],hell-2);
    res%=hell;
    cout<<res<<endl;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    p[0]=1;
    for(ll i=1;i<2000010;i++)
    p[i]=(i*p[i-1])%hell;
    ll q;
    cin>>q;
    for(ll i=0;i<q;i++)
    solve();
}


Measured memory_bytes: 16512
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int a,b,c,d,x,y;
    while(~scanf("%d",&a))
    {
        scanf("%d",&b);
        scanf("%d",&c);
        scanf("%d",&d);
        if(a>b)
            x=b;
        else
            x=a;
        if(c>d)
            y=d;
        else
            y=c;
        printf("%d\n",x+y);
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  // を定義
  int R,G;
  
  cin >> R;
  cin >> G;
  
  G <= 4500 | R >= 0;
 
  /* 時間を計算 */
  cout << 2*G - R << endl;
  
}

Measured memory_bytes: 3572
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
void solve() {
	int h, n; cin >> h >> n;
	vector<int> a(n);
	rep (i, n) cin >> a[i];
	sort(all(a));
	int64 ans = 0;
	for (int i = a.size() - 1; i >= 0; --i) {
		ans += a[i];
		if (ans >= h) {
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
	return;
}

int main() {
	solve();
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
  cin>>n>>k;
  int a[n];
  bool dp[k+1];
 // memset(dp,false,sizeof(dp));
  dp[0]=false;
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=1;i<=k;i++){
    dp[i]=false;
  for(int j=0;j<n;j++){
  if(i>=a[j] && dp[i-a[j]]==false)
                   dp[i]=true;
  
  
  }
  
  }
                   if(dp[k]==true)
                   cout<<"First\n";
                   else
                   cout<<"Second\n";
 
 
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    int sum = 0;
    vector<int> A(N);
    REP(i, 0, N) {
        cin >> A[i];
        sum += A[i];
    }

    if (sum % 10 != 0) {
        cout << sum << endl;
        return 0;
    }

    sort(ALL(A));
    REP(i, 0, N) {
        if (A[i] % 10 != 0) {
            cout << sum - A[i] << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 256
int main(){
    long long elements[100],key;
    int n,i,j;
 
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%lld",&elements[i]);
    }
 
    for(j=0;j<n;j++){
        printf("%lld",elements[j]);
        if(j<(n-1)) printf(" ");
    }
    printf("\n");
 
    for(i=1;i<n;i++){
        key = elements[i];
        j=i-1;
        while(j>=0 && elements[j]>key){
            elements[j+1]=elements[j];
            j--;
        }
        elements[j+1]=key;
 
        for(j=0;j<n;j++){
            printf("%lld",elements[j]);
            if(j<(n-1)) printf(" ");
        }
        printf("\n");
    }
    return 0;
}

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

#define READ freopen("alu.txt", "r", stdin);
#define WRITE freopen("vorta.txt", "w", stdout);
#define INFLOOP puts("lup");getchar()
#define xx first
#define yy second

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<int>::iterator vi_i;
typedef pair<double, double> pff;

const int MAX = 3e5 + 5, MOD = 1e9 + 7;

int main()
{
	ll n, m, ans;
	scanf("%lld %lld", &n, &m);
	if(n > m) swap(n, m);
	if(n == 1){
		if(m == 1) ans = 1;
		else ans = m - 2;
	}
	else if(n == 2) ans = 0;
	else ans = (n - 2) * (m - 2);
	cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
struct grid {int y; int x; int time;};
//black'#'  white'.'
int dx[4] = {0, 1, -1, 0};
int dy[4] = {1, 0, 0, -1};

int main(){
    int h, w;
    cin >> h >> w;
    int seen[h][w];
    int mx = 0;
    memset(seen, -1, sizeof(seen));
    vector<string> field(h);
    rep(i,h) cin >> field[i];
    queue<grid> q;
    rep(i,h){
        rep(j,w){
            if(field[i][j]=='#') {
                grid start = {i, j, 0};
                seen[i][j] = 0;
                q.push(start);
            }
        }
    }
    while(!q.empty()){
        grid now = q.front();
        mx = max(mx, now.time);
        q.pop();
        rep(i,4){
            grid next = {now.y + dy[i], now.x + dx[i], now.time + 1};
            if(next.y < 0 || next.y >= h || next.x < 0 || next.x >= w) continue;
            if(seen[next.y][next.x]==-1) {
                seen[next.y][next.x] = 0;
                q.push(next);
                
            }
            
        }
    }
    cout << mx << endl;
    return 0;
}


Measured memory_bytes: 17296
#include <cstddef>
#include <complex>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <limits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>

using ll = long long;
using ull = unsigned long long;

//vector
template <class T>
using vec = std::vector<T>;

template <class T>
using vvec = vec<vec<T>>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }

int main()
{
    using namespace std;

    bool c1{}, c7{}, c9{}, c4{};

    for (int i = 0; i < 4; ++i)
    {
        char c;
        cin >> c;

        switch (c)
        {
        case '1':
            c1 = true;
            break;
        case '7':
            c7 = true;
            break;
        case '9':
            c9 = true;
            break;
        case '4':
            c4 = true;
            break;
        default:
            break;
        }
    }

    if (c1 && c7 && c9 && c4)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    int H[N];
    rep(i,N) {
        cin >> H[i];
    }
    int s=0;
    int ans=0;
    rep(i,N){
        if(H[i]>=s) ans++;
        s=max(s,H[i]);
    }
    cout << ans << endl;



}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#define rep(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  
  vector<vector<int>> dp(s.size() + 1, vector<int>(t.size() + 1));
  rep(i, 1, s.size() + 1) {
    rep(j, 1, t.size() + 1) {
      if (s[i - 1] == t[j - 1]) dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
      dp[i][j] = max(dp[i][j], dp[i][j - 1]);
      dp[i][j] = max(dp[i][j], dp[i - 1][j]);
    }
  }
  
  string ans = "";
  int i = s.size();
  int j = t.size();
  while(i > 0 && j > 0) {
    if (dp[i][j] == dp[i - 1][j]) --i;
    else if(dp[i][j] == dp[i][j - 1]) --j;
    else {
      ans = s[i - 1] + ans;
      --i;
      --j;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 35584
a,b,h,m=map(int,input().split())
import math
x=(2*math.pi*m)/60
y=(2*math.pi*(60*h+m))/720
x1=(a*math.cos(x),a*math.sin(x))
y2=(b*math.cos(y),b*math.sin(y))
J=(x1[0]-y2[0])**2+(x1[1]-y2[1])**2
print(math.sqrt(J))

Measured memory_bytes: 9520
#include<stdio.h>
int y,x;
char so[200][200];
char out[300][300];
int main(void){
    int i,j;
    scanf("%d %d",&y,&x);
    for(i=0;i<y;i++){
        scanf("%s",&so[i]);
    }
    for(i=0;i<y;i++){
        printf("%s\n",so[i]);
        printf("%s\n",so[i]);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//N:Slimes

using namespace::std;

const int SIZE = 4e2 + 2;
long long TA[SIZE],DP[SIZE][SIZE];

long long sum(int i,int f){
	return TA[f] - TA[i - 1];
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int N;
	cin >> N;

	vector<long long> M(N + 1);
	for(int i = 1;i <= N;i++){
		cin >> M[i];
		TA[i] = TA[i - 1] + M[i];
	}

	for(int i = 1;i <= N;i++)
		fill(DP[i],DP[i] + N + 1,1LL << 60);

	for(int i = 1;i <= N;i++){
		DP[i][i] = 0;
		if(i < N)
			DP[i][i + 1] = M[i] + M[i + 1];
	}

	for(int l = 3;l <= N;l++){
		for(int i = 1;i + l - 1 <= N;i++){
			int j = i + l - 1;
			for(int k = i;k < j;k++){
				DP[i][j] = min(DP[i][j],DP[i][k] + DP[k + 1][j] + sum(i,k) + sum(k + 1,j));
			}
		}
	}

	cout << DP[1][N] << '\n';

	return 0;
}


Measured memory_bytes: 1536
#include<iostream>
using namespace std;
typedef long long ll;
int main() {
	ll a, b;
	cin >> a >> b;
	int counter = 0;
	for (ll i = 1; i < 4; i++) {
		ll memory = a * b*i;
		if (memory % 2 == 1) {
			counter++;
		}
	}
	if (counter != 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	int n, m=0, x=0;
	string s;
	cin >> n >> s;
	rep(i,s.length()){
		if(s[i]=='I') x++;
		else x--;
		m=max(m, x);
	}
	cout << max(m, 0) << endl;
	return 0;
}

Measured memory_bytes: 3632
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main(){
	long long a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max(a * b, c * d) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll N; cin >> N;
  vector<ll> A(N); for (ll i = 0; i < N; i++) cin >> A[i];

  ll s1, m1, s2, m2;
  s1 = 1000 / A[0];
  m1 = 1000 - s1 * A[0];
  s2 = 0;
  m2 = 1000;
  for (ll i = 1; i < N; i++) {
    ll s3 = s1, m3 = m1, s4 = s2, m4 = m2;
    if ( s3 * A[i] + m3 < m4 ) {
      s1 = m4 / A[i];
      m1 = m4 - s1 * A[i];
    }
    if ( s3 * A[i] + m3 > m4) {
      s2 = 0;
      m2 = s3 * A[i] + m3;
    }
  }
  ll ans = max(s1 * A[N - 1] + m1, m2);
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3652
A,B = map(int, input().split())
k = (A + B) / 2
if (A + B) % 2 == 0:    
    if A - k > 0 and B - k < 0:
        #print('pat1')
        print(int(k))
    elif A - k < 0 and B - k > 0:
        #print('pat2')
        print(int(k))    
    else:
        print('IMPOSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

long long solve(const vector<pair<int,int>> &L, const vector<pair<int,int>> &R, const vector<pair<int,int>> &V){
  long long ans = 0;
  int j = 0, x = 0, N = L.size();
  vector<bool> used(N,false);
  for(int i = 0; i < N; ++i){
    int idx = L[i].second;
    if(used[idx]) continue;
    used[idx] = true;
    if(V[idx].first > x or V[idx].second < x){
      ans += abs(L[i].first - x);
      x = L[i].first;
    }
    while(j < N and used[R[j].second]) ++j;
    if(j == N) continue;
    idx = R[j].second;
    used[idx] = true;
    if(V[idx].first > x or V[idx].second < x){
      ans += abs(x-R[j].first);
      x = R[j].first;
    }
  }
  for(; j < N; ++j){
    int idx = R[j].second;
    if(used[idx]) continue;
    used[idx] = true;
    if(V[idx].first > x or V[idx].second < x){
      ans += abs(x-R[j].first);
      x = R[j].first;
    }
  }
  ans += abs(x);
  return ans;
}

int main(){
  int N;
  cin >> N;
  vector<pair<int,int>> L, R, V;
  for(int i = 0; i < N; ++i){
    int l, r;
    cin >> l >> r;
    L.emplace_back(l,i);
    R.emplace_back(r,i);
    V.emplace_back(l,r);
  }
  sort(L.begin(), L.end(), greater<>());
  sort(R.begin(), R.end());
  long long ans = max(solve(L,R,V),solve(R,L,V));
  //cerr << solve(L,R,V) << " " << solve(R,L,V) << endl;
  cout << ans << endl;
}


Measured memory_bytes: 2912
#include <iostream>
class Problem {
  public:
	static void solve () {
    int i1, i2, i3;
    std::cin >> i1;
    if(i1 == 1) {
      std::cout << "Hello World" << std::endl;
    }
    else if (i1 == 2) {
      std::cin >> i2;
      std::cin >> i3;
      std::cout << ( i2 + i3 ) << std::endl;
    }
	}
}
;
int main (int argc, char *argv[]) {
	Problem::solve();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

ll n;
vvll edges;

ll dfs(ll x, ll p) {
  ll ans = 0, leaf = 0;
  for (ll to: edges[x]) {
    if (to==p) continue;
    else if ((ll)edges[to].size() == 1) leaf++;
    else {
      ll tmp = dfs(to, x);
      if (tmp == 0) leaf++;
      else ans += tmp;
    }
  }
  return ans + max(0LL, leaf-1);
}

int main() {
  cin >> n;
  edges.resize(n);
  REP(i, n-1) {
    ll a, b; cin >> a >> b;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }

  ll root=-1, ma=-1;
  REP(i, n) {
    // 最大次数頂点を探す
    if ((ll)edges[i].size()>ma) {
      ma = (ll)edges[i].size();
      root = i;
    }
  }
  cout << max(1LL, dfs(root, -1)) << endl;
  return 0;
}


Measured memory_bytes: 13440
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

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

int main()
{
  map<int, int> m;
  int x;
  for (int i = 0; i < 3; ++i) {
    cin >> x; m[x]++;
  }
  if (m[5] == 2 && m[7] == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H, W; cin >> H >> W;
    string S[H]; rep(i, H) cin >> S[i];
    int x = 0, y = 0;
    bool visited[H][W]; rep(i, H) rep(j, W) visited[i][j] = false;

    while(x < H && y < W){
        visited[x][y] = true;
        bool move = false;
        if(x+1 < H && S[x+1][y] == '#'){
            move = true;
            x++;
        }
        else if(y+1 < W && S[x][y+1] == '#'){
            move = true;
            y++;
        }
        if(!move) break;
    }
    rep(i, H){
        rep(j, W){
            if(S[i][j] == '#' && (!visited[i][j])){
                cout << "Impossible" << endl;
                return 0;
            }
        }
    }
    cout << "Possible" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


int main() {


	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);
	int a, b;
	std::cin >> a >> b;
	int ans = 0;
	if (a + b >= 24)ans = (a + b) % 24;
	else ans = a + b;

	std::cout << ans;


	return 0;


}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int N; cin >>N;
  int D,X; cin >> D >> X;
  int ans = X + N;
  for(int i = 0; i < N; i++){
	int a; cin >>a;
    ans += (D - 1) / a;
  }
  cout << ans << endl;
}

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

#define rep(j,n) for(int j=0;j<n;j++)
#define ll long long
#define MX 100005

#define pb .push_back

using namespace std;

int main(){
     int a,b;
    cin>>a>>b;
    if(b==1){
        cout<<0<<endl;
        return 0;
    }
    a--;b--;
    int i=1;
    while(1){
        if(i*a>=b){
            cout<<i<<endl;
            return 0;
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010;
int dx[5]={0,1,0,-1,0};
int dy[5]={1,0,-1,0,0};
int n;
string s;
ll ans;
map<pair<string,string>,ll> mp,mp2;
void dfs(int i,string s1,string s2){
    if(i==n){
        mp[make_pair(s1,s2)]++;
        return;
    }
    dfs(i+1,s1+s[i],s2);
    dfs(i+1,s1,s2+s[i]);
}
void dfs2(int i,string s1,string s2){
    if(i==2*n){
        mp2[make_pair(s1,s2)]++;
        return;
    }
    dfs2(i+1,s[i]+s1,s2);
    dfs2(i+1,s1,s[i]+s2);
}
int main(){
    cin>>n>>s;
    dfs(0,"","");
    dfs2(n,"","");
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        string s1=itr->first.first;
        string s2=itr->first.second;
        ans+=itr->second*mp2[make_pair(s2,s1)];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 101376
#include<bits/stdc++.h>
#define ll long long
#define For(i,a,b) for (int i=a;i<=b;i++)
#define Rep(i,a,b) for (int i=b;i>=a;i--)
using namespace std;
ll ans,n;
ll a[110];
ll lzq;
inline ll read()
{
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
ll gcd(ll x,ll y)
{
	if(y==0)return x;
	return gcd(y,x%y);
}
int main()
{
	n=read();
	For(i,1,n)a[i]=read();
	ans=1;
	For(i,1,n)
		For(j,i+1,n)
		{
			lzq=gcd(a[i],a[j]);
			if(lzq==1)continue;
			For(k,j+1,n)
				a[k]/=gcd(a[k],lzq);
			a[i]/=lzq;
			a[j]/=lzq;
			ans*=lzq;
		}
	For(i,1,n)ans*=a[i];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    while(true){
        int H,W;
        cin>>H>>W;
        if(H==0&&W==0){
            break;
        }
        for(int y=0;y<H;++y){
            for(int x=0;x<W;++x){
                if(x==0||x==W-1||y==0||y==H-1){
                    cout<<"#";
                }else{
                    cout<<".";
                }
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3080
using System;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int x = a[0] - b[0];
        int y = a[1] - b[1];
        Console.WriteLine(x * y);
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
const int N = 100001;
const int M = 100001;
int a[M];
//int x[N];
int m;
ll k;
vector<ll> x;
//void brute(){
//  vector<ll> sx = x[0];
//  int c = 1;
//  for(int i = 0;i < k;i++){
//    for(int j = 0;j < m;j++){
////      cout << a[j] << endl;
//      sx[a[j]] = sx[a[j] - 1] + sx[a[j] + 1] - sx[a[j]];
//    }
//  }
//  for(int i = 0;i < n;i++)
//    cout << sx[i] << ' ';
//  cout << endl;
//  return ;
//}
vector<int> perm(const vector<int>& v, const vector<int>& p){
  vector<int> res(v.size());
  for(int i = 0;i < p.size();i++)
    res[i] = v[p[i]];
  return res;
}
vector<int> compose(const vector<int>& a, const vector<int>& b){
  vector<int> x(a.size());
  for(int i = 0;i < a.size();i++)
    x[i] = i;
  x = perm(x, b);
  x = perm(x, a);
  return x;
}
vector<int> power(const vector<int>& p, ll k){
  if(k == 1)return p;
  return k % 2 == 0 ? power(compose(p, p), k / 2) : compose(p, power(p, k - 1));
}
int main(){
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
//  srand(time(0));
//  cout << 10 << endl;
//  for(int i = 0;i < 10;i++){
//    cout << rand() % 1000 << ' ';
//  }
//  cout << endl;
//  cout << 10 << ' ' << 10;
//  cout << endl;
//  for(int i = 0;i < 10;i++)
//    cout << rand() % 8 + 2 << ' ';
//  return 0;
  scanf("%d", &n);
  x = vector<ll>(n);
  for(int i = 0;i < n;i++)
    scanf("%lld", &x[i]);
  scanf("%d %lld", &m, &k);
  for(int i = 0;i < m;i++)
    scanf("%d", a + i), a[i]--;
  vector<int> diff(n - 1);
  for(int i = 0;i < n - 1;i++)
    diff[i] = x[i + 1] - x[i];
  vector<int> p(n - 1);
  for(int i = 0;i < n - 1;i++)
    p[i] = i;
  for(int i = 0;i < m;i++)
    swap(p[a[i]], p[a[i] - 1]);
  p = power(p, k);
  vector<int> dd = perm(diff, p);
  ll res[n];
  res[0] = x[0];
  for(int i = 0;i < n - 1;i++)
    res[i + 1] = res[i] + dd[i];
  for(int i = 0;i < n;i++)
    cout << res[i] << endl;
  return 0;
}


Measured memory_bytes: 25968
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;




public class Main{

	public static void main(String[] args) throws IOException, InterruptedException {
		
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		int c = 0;
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i]= sc.nextInt(); 
		}
		for (int i = 2; i <n; i++) {
			int first = a[i-2];
			int second = a[i-1];
			int third = a[i];
			
			if ((second > first && second <= third) || (second > third && second <= first)) 
				c++;
			
		}
		
		out.println(c);
		
		out.flush();

	}
	

	
	

	
}
class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

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

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public char nextChar() throws IOException {
		return next().charAt(0);
	}

	public Long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

	public void waitForInput() throws InterruptedException {
		Thread.sleep(3000);
	}


}

Measured memory_bytes: 22484
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.io.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();

        char[][] board = new char[H][W];
        for(int h=0; h<H; h++){
            String line = sc.next();
            for(int w=0; w<W; w++) board[h][w] = line.charAt(w);
        }

        int[][] shortest = new int[H][W];
        for(int h=0; h<H; h++) for(int w=0; w<W; w++) shortest[h][w]=1000000;
        shortest[0][0] = 0;
        for(int h=1; h<H; h++){
            if(board[h-1][0]=='.' && board[h][0]=='#') shortest[h][0] = 1+shortest[h-1][0];
            else shortest[h][0] = shortest[h-1][0];
        }
        for(int w=1; w<W; w++){
            if(board[0][w-1]=='.' && board[0][w]=='#') shortest[0][w] = 1+shortest[0][w-1];
            else shortest[0][w] = shortest[0][w-1];
        }
        for(int h=1; h<H; h++) for(int w=1; w<W; w++){
            int d = board[h-1][w]=='.' && board[h][w]=='#' ? 1+shortest[h-1][w] : shortest[h-1][w];
            int r = board[h][w-1]=='.' && board[h][w]=='#' ? 1+shortest[h][w-1] : shortest[h][w-1];
            shortest[h][w] = Math.min(d,r);
        }
        
        System.out.println(board[0][0]=='#' ? 1+shortest[H-1][W-1] : shortest[H-1][W-1]);
    }
}


Measured memory_bytes: 37440
x = int(input())
val = 0
ans = 0
for i in range(x, int(1e20)):
    if i % 2 == 0 and i !=2:
        continue
    for j in range(2,i+1):
        if i == j:
            val = 1         
        
        
        if i % j == 0:
            break

          
    if val == 1:
        ans = i
        break
    
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

using Graph=vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n)
	{
		cin >> a[i];
		if (a[i] % 2 == 0)
		{
			if (a[i] % 3 != 0 && a[i] % 5 != 0)
			{
				cout << "DENIED" << endl;
				ret;
			}
		}
	}
	cout << "APPROVED" << endl;


	return 0;
}

Measured memory_bytes: 256
A, B, AB, X, Y = map(int, input().split())

sum_ = 0
if AB <= (A+B)/2:
  if X >= Y:
    sum_ = min(AB*Y*2 + A*(X-Y), AB*X*2)
  else:
    sum_ = min(AB*X*2 + B*(Y-X), AB*Y*2)
else:
  sum_ = A*X + B*Y

print(sum_)

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 112345;
int indeg[MAX_N];
vector<int> g[MAX_N];
int ans[MAX_N];

int main2() {
  CLR(indeg, 0);
  REP(i, MAX_N) g[i].clear();
  CLR(ans, -1);
  int N = nextInt();
  int M = nextInt();
  REP(i, N+M-1) {
    int a = nextInt() - 1;
    int b = nextInt() - 1;
    g[a].push_back(b);
    ++indeg[b];
  }
  deque< pair<int,int> > q; // v, prev
  REP(i, N)if (indeg[i] == 0) { q.push_back( {i, -1} ); }
  while (!q.empty()) {
    auto cur = q.front(); q.pop_front();
    // cout << cur << endl;
    ans[ cur.first ] = cur.second + 1;
    for (auto u : g[cur.first]) {
      --indeg[u];
      if (indeg[u] == 0) {
        q.push_back({ u, cur.first });
      }
    }
  }
  REP(i, N) printf("%d\n", ans[i]);
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 7424