akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f3f3f3f3f
using namespace std;
typedef long long ll;
typedef double db;
const int mod = 1e9+7;
const int N = 1e6 + 5;
int n, m;

int main(){
    char ch;
    scanf("%c", &ch);
    printf("%c\n", ch+1);

    return 0;
}
//
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                           O\  =  /O
//                        ____/`---'\____
//                      .'  \|     |//  `.
//                     /  \|||  :  |||//  \
//                    /  _||||| -:- |||||-  \
//                    |   | \  -  /// |   |
//                    | \_|  ''\---/''  |   |
//                    \  .-\__  `-`  ___/-. /
//                  ___`. .'  /--.--\  `. . __
//               ."" '<  `.___\_<|>_/___.'  >'"".
//              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//              \  \ `-.   \_ __\ /__ _/   .-` /  /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//                     佛祖保佑      永无BUG


Measured memory_bytes: 256
k,n=map(int,input().split())
a=list(map(int,input().split()))
diff=0
for i in range(len(a)-1):
  diff_a=a[i+1]-a[i]
  if diff<diff_a:
    diff=diff_a
diff_b=(k-a[n-1])+a[0]
if diff_b>diff:
  diff=diff_b
print(k-diff)

Measured memory_bytes: 26420
#![allow(unused_imports)]
#![allow(unused_variables)]
use proconio::input;
use proconio::marker::*;
use std::cmp::{min, max};
use std::collections::{HashSet, HashMap, BinaryHeap};

fn main() {
    input! {
        x: i64,
    }
    for a in -118..=119 as i64{
        for b in -118..a as i64{
            if x == (a.pow(5) - b.pow(5)){
                println!("{} {}", a, b);
                return;
            }
        }
    }
}


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

int main() {
  long long n;cin >> n;
  string s;cin >> s;
  if (s.size()<=n) cout << s << endl;
  else {
    for (int i=0;i<n;i++) cout << s[i];
    cout << "..." << endl;
  }
}


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

int main() {
    ll N,M;
    cin >> N >> M;
    vector<ll> A(M);
    for (ll i=0; i<M; i++) {
        cin >> A.at(i);
    }
    ll day = 0;
    for (ll i=0; i<M; i++) {
        day += A.at(i);
    }
    if (day>N) {
        cout << -1 << endl;
    }
    else {
        cout << N-day <<endl;
    }
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;

int main(){
  int d,g;cin >> d >> g;
  vector<int> p(10),c(10);
  rep(i,d) cin >> p[i] >> c[i];
  int ind = 0;
  int sum = 0;
  int ans = INF;
  int cnt = 0;
  rep(i,1<<d){
    sum = 0;
    cnt = 0;
    rep(j,d){
      if(i>>j&1) {
        sum += p[j]*(j+1)*100;
        sum += c[j];
        cnt += p[j];
      }else ind = j;
    }
    if(g-sum > (p[ind]-1)*(ind+1)*100) continue;
    cnt += max(g-sum + (ind+1)*100 -1,0)/((ind+1)*100);
    ans = min(ans,cnt);
  }

  cout << ans << endl;
}

Measured memory_bytes: 3628
def warshall_floyd(d,n):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d


h,w = map(int, input().split())
cl = [list(map(int, input().split())) for _ in range(10)]
cl = warshall_floyd(cl,10)

al = [list(map(int, input().split())) for _ in range(h)]
ans = 0
for row in al:
    for a in row:
        if a == -1:continue
        ans += cl[a][1]
print(ans)

Measured memory_bytes: 73744
#include <bits/stdc++.h> 
#include <chrono>
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const int MAX_N=pow(2,18)+2;

int main(){
    int X,Y;
    cin>>X>>Y;
    REP(i,X+1){
        if(i*4+(X-i)*2==Y){
            cout<<"Yes"<<endl;return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

int main()
{
	KAKA
	char ch;
	cin>>ch;
	if((ch >= 'a') and (ch <= 'z'))
	cout<<'a'<<"\n";
	else if((ch >= 'A') and (ch <= 'Z'))
	cout<<"A"<<"\n";
}

Measured memory_bytes: 3684
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
template <typename T> bool chmin(T &a, const T &b) {if(a > b){a = b; return true;} return false;}
template <typename T> bool chmax(T &a, const T &b) {if(a < b){a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill (A (&array)[N], const T & val) {fill ((T*)array, (T*)(array+N), val);}
V<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
V<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
      assert(n < mod);
      fact[0] = 1;
      for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
      ifact[n] = fact[n].inv();
      for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
      if (k < 0 || k > n) return 0;
      return fact[n]*ifact[k]*ifact[n-k];
    }
};

mint dp[1'000'005][2][2];

int main () {
    int n; cin >> n;
    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }
    dp[0][0][0] = 1;
    rep(i, n) {
        rep(j, 2) {
            rep(k, 2) {
                rep(l, 10) {
                    if (l == 0) {
                        dp[i+1][1][k] += dp[i][j][k];
                        continue;
                    }
                    if (l == 9) {
                        dp[i+1][j][1] += dp[i][j][k];
                        continue;
                    }
                    dp[i+1][j][k] += dp[i][j][k];
                }
            }
        }
    }
    cout << dp[n][1][1] << endl;

    return 0;
}

Measured memory_bytes: 34832
#include <bits/stdc++.h>
using namespace std;
int main(){
        int a,b,m,n;
        scanf("%d%d%d%d",&a,&b,&m,&n);
        if(b<=m){
        return !printf("0\n");
        }else{
        if(a<m){
        if(b<=n){
        printf("%d\n",b-m);
                        }else {
        printf("%d\n",n-m);
                        }
                }else {
                if(n>a){
                if(n<=b) return !printf("%d\n",n-a);
                else return!printf("%d\n",b-a);
                        } else return !printf("0\n");

                }
        }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
 
using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;

// 基本的な演算
namespace BasicMath {
    // 二つの値の最大値を求める関数
    static Int Max(const Int a, const Int b);
    // 二つの値の最大値を求める関数
    Int Max(const Int a, const Int b) {
        if (a >= b) {
            return a;
        } else {
            return b;
        }
    }
}
using namespace BasicMath;

int main(void) {
    Int n;
    cin >> n;
    VI h(n);
    for (Int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    Int max_value = 0;
    for (Int i = 0; i < n; ++i) {
        max_value = Max(h[i], max_value);
    }
    h.push_back(-1); // ストッパー

    Int result = 0;
    for (Int i = 0; i < max_value; ++i) {
        for (Int j = 0; j < n; ++j) {
            if (h[j] > i) {
            } else {
                continue;
            }
            while (h[j] > i) {
                ++j;
            }
            result++;
        }
    }
    cout << result << endl;
}



Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] tmpArray = br.readLine().split(" ");
		
		int n = Integer.parseInt(tmpArray[0]);
		int k = Integer.parseInt(tmpArray[1]);
		
		int[] array = new int[n];
		
		tmpArray = br.readLine().split(" ");
		for(int i = 0; i < n; i++) {
			array[i] = Integer.parseInt(tmpArray[i]);
		}
		
		long total = 0;
		for(int i = 0; i < k; i++) {
			total += array[i];
		}
//		System.out.println(total);
		
		long tmp = total;
		
		for(int i = 1; i + k <= n; i++) {
			tmp -= array[i - 1];
			tmp += array[i + k - 1];
			
			total = Math.max(tmp, total);
			
//			System.out.println(total);
		}
		System.out.println((total + k)/2.0);
	}

}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const int INF = numeric_limits<int>::max() / 2;

struct UF
{
	vector<int> data;
	UF(int size) : data(size, -1) {}
	bool unite(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;
		}
		return x != y;
	}
	bool find(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)];
	}
};

struct edge
{
	int src, dst, weight;
	edge(int src, int dst, int weight) : src(src), dst(dst), weight(weight) {}
};
bool operator<(const edge &e, const edge &f)
{
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
			   e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

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

	int n, m;
	while (true)
	{
		cin >> n >> m;
		if (n == 0)
			break;
		vector<P> g[100];
		vector<edge> edges;
		for (int i = 0; i < m; i++)
		{
			int a, b, w;
			cin >> a >> b >> w;
			a--;
			b--;
			edge e(a, b, w);
			edges.push_back(e);
			g[a].push_back(P(b, w));
			g[b].push_back(P(a, w));
		}
		int res = INF;
		for (int i = 0; i < m; i++)
		{
			UF uf(n);
			edge e = edges[i];
			int a = e.src, b = e.dst;
			int ma = e.weight, mi = e.weight;
			priority_queue<P, vector<P>, greater<P>> q;
			uf.unite(a, b);
			for (int j = 0; j < (int)g[a].size(); j++)
			{
				if (g[a][j].second >= mi)
					q.push(P(g[a][j].second, g[a][j].first));
			}
			for (int j = 0; j < (int)g[b].size(); j++)
			{
				if (g[b][j].second >= mi)
					q.push(P(g[b][j].second, g[b][j].first));
			}
			while (!q.empty())
			{
				P p = q.top();
				q.pop();
				if (p.first < mi)
					continue;
				if (uf.find(a, p.second))
					continue;
				ma = max(ma, p.first);
				uf.unite(a, p.second);
				for (int j = 0; j < (int)g[p.second].size(); j++)
				{
					if (g[p.second][j].second >= mi && !uf.find(a, g[p.second][j].first))
						q.push(P(g[p.second][j].second, g[p.second][j].first));
				}
			}
			if (uf.size(a) < n)
				continue;
			else
				res = min(res, ma - mi);
		}
		if (res == INF)
			cout << -1 << endl;
		else
			cout << res << endl;
	}
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define hii cout << "hii" << endl
#define int long long
#define endl '\n'
#define all(s) s.begin(), s.end()
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

const int N = 5e5 + 5;
const int MAX = 250000 + 5;
const int M = 1e6 + 5;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int INF = 1e15;
const int LG = 21;

int arr[M];
int cnt[M];

void solve()
{
	int n;
	cin >> n;
	int g = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> arr[i];
		cnt[arr[i]]++;
		g = __gcd(g, arr[i]);
	}
	if(g > 1)
	{
		cout << "not coprime" << endl;
		return;
	}
	bool ok = 1;
	for(int i = 2; i < M; i++)
	{
		int sum = 0;
		for(int j = i; j < M; j += i)
		{
			sum += cnt[j];
		}
		ok &= (sum <= 1);
	}
	if(ok)
	{
		cout << "pairwise coprime" << endl;
	}
	else
	{
		cout << "setwise coprime" << endl;
	}
}

 
int32_t main() 
{	
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	    int t = 1;
	    // cin >> t;
	while(t--)solve();
	return 0;
}

Measured memory_bytes: 19176
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

#[fastout]
fn main() {
   input! {
      n: usize,
      a: [Usize1; n]
   }
   let mut count = vec![0; 100000];
   for &a in a.iter() {
      count[a] += 1;
   }

   let mut ans = 0;
   let mut m = 0;
   for &c in count.iter() {
      if c >= 3 {
         ans += (c - 3) / 2 + 1;
         if c % 2 == 0 {
            m += 1;
         }
      } else if c > 1 {
         m += 1;
      }
   }
   ans += m / 2 + m % 2;
   ans = n - 2 * ans;
   println!("{}", ans);
}


Measured memory_bytes: 4128
#include <cstdio>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const int sz = 1e5, ma = 1e9;
int a[sz];
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
int abs(int a) { return max(a, -a); }
signed main()
{
    int n;
    scanf("%d", &n);
    int cnt = 0, mi = ma;
    ll ans = 0;
    rep(i, n)
    {
        scanf("%d", a + i);
        if (a[i] < 0)
        {
            cnt++;
            a[i] = -a[i];
        }
        ans += a[i];
        mi = min(mi, a[i]);
    }
    if (cnt % 2)
        ans -= 2 * mi;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int r;
	cin >> r;

	if (r<1200) {
		cout << "ABC" << "\n";
	}
	else if (r<2800) {
		cout << "ARC" << "\n";

	}
	else {
		cout << "AGC" << "\n";
	}

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    string a, b;
    cin >> a >> b;
    if (a.size() > b.size())
        return cout << "GREATER", 0;
    else if (a.size() < b.size())
        return cout << "LESS", 0;
    else 
    {
        rep(i, 0, a.size())
        {
            if (a[i] > b[i])
                return cout << "GREATER", 0;
            else if (a[i] < b[i])
                return cout << "LESS", 0;
        }
    }
    cout << "EQUAL";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    string n;
    cin >> n;
    int s = 0;
    rep(i,n.size()){
        s += n[i]-'0';
        s %=9;
    }
    if(s==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3748
def p_d():
    S = input()
    N = 13

    dp = [0] * N
    dp[0] = 1

    mul = 1
    mod = 10 ** 9 + 7

    for i in reversed(range(len(S))):
        nextDP = [0] * N
        c = S[i]
        if c == "?":
            for k in range(10):  # 数字[0-9]
                for j in range(N):
                    nextDP[(k * mul + j) % N] += dp[j]
                    nextDP[(k * mul + j) % N] %= mod
        else:
            k = int(c)
            for j in range(N):
                nextDP[(k * mul + j) % N] += dp[j]
                nextDP[(k * mul + j) % N] %= mod
        mul *= 10
        mul %= N
        dp = nextDP

    print(int(dp[5]))


if __name__ == '__main__':
    p_d()


Measured memory_bytes: 43372
#include <stdio.h>

int main(){
	int N;

	scanf("%d", &N);

	int tmp;
	int* sum;
	sum = new int[N - 1];

	for (int i = 0; i < N - 1;i++) {
		sum[i] = 0;
	}

	for (int i = 0; i < N - 1;i++) {
		scanf("%d", &tmp);
		sum[tmp - 1] += 1;
	}

	for (int i = 0;i < N - 1;i++) {
		printf("%d\n", sum[i]);
	}
	printf("0");

	return 0;
}

Measured memory_bytes: 4036
#include <iostream>
template<typename T>
T gcd(T a, T b) {
	if (a % b == 0)
		return(b);
	else
		return(gcd(b, a % b));
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
int main() {
	using namespace std;
	unsigned long long a, b, c, d;
	cin >> a >> b >> c >> d;

	unsigned long long acn = (a-1) / c, adn = (a-1) / d;
	unsigned long long bcn = b / c, bdn = b / d;
	unsigned long long l = lcm(c, d);
	unsigned long long aln = (a-1) / l, bln = b / l;

	cout << (b-(a-1))-(bcn-acn)-(bdn-adn)+(bln-aln);
	return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 100
i64 N;
i64 A[MAX_N];


void solve() {
  bool ok = true;
  REP(i, N) {
    if (A[i] % 2 == 1) continue;
    if ((A[i] % 3 == 0) || (A[i] % 5 == 0)) continue;
    ok = false;
  }
  if (ok) {
    cout << "APPROVED" << endl;
  } else {
    cout << "DENIED" << endl;
  }
}


int main() {
  cin >> N;
  REP(i, N) cin >> A[i];

  solve();

  return 0;
}

Measured memory_bytes: 256
fun main (args:Array<String>){
    val intN = readLine()!!.toInt()
    var count = 0
    for(i in 1..9){
       for(j in 1..9){
           if(i * j == intN){
               print("Yes")
               return
           } else continue
       }
    }
    print("No")
}

Measured memory_bytes: 34532
#!/usr/bin/env python3
import heapq
n, m = map(int, input().split())
que = []
for _ in range(n):
    a, b = map(int, input().split())
    heapq.heappush(que, (a, b))
answer = 0
while m > 0:
    a, b = heapq.heappop(que)
    answer += a * min(m, b)
    m -= b
print(answer)


Measured memory_bytes: 16672
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
	public static void Main()
	{
		var n = int.Parse(ReadLine());
		var a = ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
		var b = new bool[n].Select((x, i) => a[i] == i).ToArray();
		var count = 0;
		for(int i = 0; i < n; i++)
		{
			if(b[i])
			{
				count++;
				if(i < n - 1)
				{
					a[i + 1] = a[i];
					b[i + 1] = i + 1 == a[i + 1];
				}
			}
		}
		WriteLine(count);
	}
}


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

long long int h[200005];
int main()
{
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		scanf("%lld", &h[i]);
	}
	sort(h, h + n);
	long long int sum = 0;
	for (int i = 0; i < n - k; i++) {
		sum += h[i];
	}
	cout << sum;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long 
#define pb push_back
using namespace std;
const ll inf=10000000000;
int main()
{
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n,i,k,j,a,b,c;
    cin>>n;
    vector <vector <ll> > dp(n+2,vector<ll>(3,-1));

    cin>>dp[0][0]>>dp[0][1]>>dp[0][2];
    for(i=1;i<n;i++)
    {
        for(j=0;j<3;j++)
        {
            cin>>a;
            for(k=0;k<3;k++)
            {
                if(j!=k)
                    dp[i][j]=max(dp[i][j],dp[i-1][k]);
            }
            dp[i][j]+=a;
        }
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
    return 0;
}
    

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF = 1001001001001001;
const ll MAX = 3000;

struct edge { ll to, cost, time; };

vector<edge> g[55];
pair<ll, ll> exch[55];

ll dp[55][MAX + 5]; // dp[i][j] ... 頂点iにいて、銀貨をj枚持っている、という状態にたどり着くまでにかかる最小の時間

int main() {
    ll n, m, s;
    cin >> n >> m >> s;
    s = min(MAX, s);
    for (int i = 0, u, v, a, b; i < m; i++) {
        cin >> u >> v >> a >> b;
        u--; v--;
        edge e1, e2;
        e1 = { v, a, b }, e2 = { u, a, b };
        g[u].push_back(e1);
        g[v].push_back(e2);
    }
    for (int i = 0, c, d; i < n; i++) {
        cin >> c >> d;
        exch[i] = { c, d };
    }
    for (int i = 0; i < n; i++) for (int j = 0; j <= MAX; j++) dp[i][j] = INF;
    dp[0][s] = 0;

    queue<pair<ll, ll>> que; // from, coin
    que.push({ 0, s });
    while (!que.empty()) {
        pair<ll, ll> t = que.front(); que.pop();
        ll v = t.first, c = t.second;
        for (auto x : g[v]) {
            if (c < x.cost) continue;
            if (dp[v][c] + x.time < dp[x.to][c - x.cost]) {
                dp[x.to][c - x.cost] = dp[v][c] + x.time;
                que.push({ x.to, c - x.cost });
            }
        }
        if (dp[v][c] + exch[v].second < dp[v][min(MAX, c + exch[v].first)]) {
            dp[v][min(MAX, c + exch[v].first)] = min(dp[v][min(MAX, c + exch[v].first)], dp[v][c] + exch[v].second);
            que.push({ v, min(MAX, c + exch[v].first) });
        }
    }
    for (int i = 1; i < n; i++) {
        ll res = INF;
        for (int j = 0; j <= MAX; j++) {
            res = min(res, dp[i][j]);
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
/*---define types---*/
typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
/*---define variables---*/
ll n;
ll h[100005],t[100005];
ll a,b,L=1ll,R,ans,mid;
/*---define function---*/

bool check(ll x)
{
	ll res=0ll;
	memcpy(t,h,sizeof(h));
	ll damage=x*b;
	for(ll i=1;i<=n;++i)
	{
		t[i]-=damage;
	}
	ll dif=a-b;
	for(ll i=1;i<=n;++i)
	{
		if(t[i]>0)
		{
			if(t[i]%dif!=0)
			{
				res+=t[i]/dif+1;
			}
			else
			{
				res+=t[i]/dif;
			}
		}

	}
	return res<=x;
}

/*---main code---*/
int main()
{
	FIO;
	cin>>n>>a>>b;
	for(int i=1;i<=n;++i)
	{
		cin>>h[i];
	}
	sort(h+1,h+n+1);
	R=1e10;
	while(L<=R)
	{
		mid=(L+R)>>1;
		if(check(mid))
		{
			ans=mid;
			R=mid-1;
		}
		else
		{
			L=mid+1;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 1792
N=gets.to_i
x = 3500
if 4 <= N
    n = N/4
else
    n = 1
end
n.upto(x) do |i|
    i.upto(x) do |j|
        r = Rational(4*i*j-N*j-N*i,N*i*j)
        if r.numerator == 1
            puts [i,j,r.denominator].join(' ')
            exit
        end
    end
end



Measured memory_bytes: 14408
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	String input1 = scan.next();
	int a = Integer.parseInt(input1);
	String input2 = scan.next();
	int b = Integer.parseInt(input2);
	int area = a * b;
	int length = (a + b) * 2;
	System.out.println(area + " " + length);
    }
}

Measured memory_bytes: 25976
# -*- coding utf-8 -*-
import itertools
import math

ryori = [int(input()) for _ in range(5)]

ans = 10000000000

for order in itertools.permutations(ryori):
    t = sum([math.ceil(order[i]/10) * 10 for i in range(4)])
    t += order[4]
    ans = min(ans, t)

print(ans) 

Measured memory_bytes: 3060
#include<stdio.h>

int main(){
  int i, n, q, total=0, remain, first = 0, tail = 0, time[100000], dis[100000];
  char name[100000][10];

  scanf("%d %d", &n, &q);
  if(n > 0 && n <= 100000 && q >= 1 && q <= 1000){
    for(i = 0; i < n; i++){
      scanf("%s %d", name[i], &time[i]);
      dis[i] = 1;
    }
    remain = n;
    tail = n - 1;
    
    while(remain != 0){
      time[first] = time[first] - q;
      if(time[first] < 0){
	total += (q + time[first]); 
	time[first] = 0;
      }else{
	total += q;
      }
      
      if(time[first] == 0){

	printf("%s %d\n", name[first], total);
        remain--;
	dis[tail] += dis[first];
	dis[first] = 0;
	first = tail;
	first += dis[tail];
	if(first >= n){
	    first = first - n;
	}
	
      }else{
	tail = first;
	first += dis[first];
      	if(first >= n) first = first - n;
      }
    }
  }
}



Measured memory_bytes: 2592
def palin?(t)
  n = t.size
  n.times{|i| return false if t[i] != t[n - i - 1]}
  true
end

s = gets.chomp
n = s.size

t = s.chars.zip(0...n).select{|x| x[0] != 'x'}

if t.size == 0
  p 0
elsif not palin?(t.map{|x| x[0]})
  p -1
else
  i = (t.size - 1) / 2
  i = t[i][1]
  j = t.size / 2
  j = t[j][1]
  ans = 0
  while i >= 0 && j < n
    if s[i] == s[j]
      i -= 1
      j += 1
    elsif s[i] == 'x'
      ans += 1
      i -= 1
    elsif s[j] == 'x'
      ans += 1
      j += 1
    end
  end
  while j < n
    ans += 1
    j += 1
  end
  while i >= 0
    i -= 1
    ans += 1
  end
  p ans
end


Measured memory_bytes: 18428
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> a;
  reps(i,1,sqrt(m)+1){
    if(m%i==0){
      a.push_back(i);
      if(i*i!=m)a.push_back(m/i);
    }
  }
  sort(all(a),greater<int>());
  for(auto au:a){
    if((ll)au*(ll)n<=(ll)m){
      cout<<au;return 0;
    }
  }
}

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

int op(int a, int b) { return max(a, b); }
int e() { return -1; }
int tar;
bool f(int x) { return x < tar; }

int main() {
	int N, Q;
	cin >> N >> Q;
	segtree<int, op, e> seg(N);
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		seg.set(i, A);
	}
	for (int q = 0; q < Q; q++) {
		int t;
		cin >> t;
		int x;
		switch (t) {
		case 1:
			int v;
			cin >> x >> v;
			seg.set(x - 1, v);
			break;
		case 2:
			int l, r;
			cin >> l >> r;
			cout << seg.prod(l - 1, r) << endl;
			break;
		case 3:
			cin >> x >> tar;
			cout << seg.max_right<f> (x - 1) + 1 << endl;
		}
	}
}


Measured memory_bytes: 6128
//
//  ARC085D.cpp
//  
//
//  Created by Yoshida Satoshi on 2017/11/11.
//
//

#include <iostream>
using namespace std;

long Abs(long x){
    if(x>0) return x;
    else    return -1l*x;
}

long Max(long x,long y){
    if(x>y) return x;
    else    return y;
}

long Min(long x,long y){
    if(x<y) return x;
    else    return y;
}

int main(){
    int N,Z,W;
    long a[2000];
    long ap[2000];
    long bp[2000];
    long min;
    long max;
    long ans;
    
    cin>>N>>Z>>W;
    
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    
    if(N==1){
        ans=Abs(a[0]-W);
        cout << ans << endl;
        return 0;
    }
    if(N==2){
        ans=Max(Abs(a[0]-a[1]),Abs(a[1]-W));
        cout << ans << endl;
        return 0;
    }
    
    ap[N-1]=Abs(a[N-2]-a[N-1]);
    bp[N-1]=Abs(a[N-2]-a[N-1]);
    min=ap[N-1];
    max=bp[N-1];
    
    for(int i=N-2;i>0;--i){
        min=Min(min,ap[i+1]);
        bp[i]=Min(min,Abs(a[i-1]-a[i+1]));
        max=Max(max,bp[i+1]);
        ap[i]=Max(max,Abs(a[i-1]-a[i+1]));
    }
    ans=Max(max,bp[1]);
    ans=Max(ans,Abs(W-a[N-1]));
    
    cout << ans << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>

using namespace std; 

#define MP make_pair
typedef unsigned long long ULL;

//dp[i+1][j]...i番目まで使って重さj以下になるように選んだ時の最大価値
//dp[0][j]=0
//dp[i+1][j]=max{dp[i][j-k*w[i]]+k*v[i] | kは0以上の整数 かつ j-k*w[i]>=0}
//          =max(dp[i][j],max{dp[i][j-k*w[i]]+k*v[i] | kは1以上の整数 かつ j-k*w[i]>=0}) ... 展開した
//          =max(dp[i][j],max{dp[i][(j-w[i])-k*w[i]]+k*v[i] | kは0以上の整数 かつ j-k*w[i]>=0}+v[i]) ... kをずらした
//          =max(dp[i][j],dp[i+1][j-w[i]]+v[i]) ... 元の更新式より
long dp[101][10001];

int main(){

	int N,W;
	cin>>N>>W;

	vector<int> v(N),w(N);
	for(int i=0;i<N;i++) cin>>v[i]>>w[i];

	for(int i=0;i<N;i++){
		for(int j=0;j<=W;j++){
			if(j<w[i]) dp[i+1][j]=dp[i][j];
			else       dp[i+1][j]=max(dp[i][j],dp[i+1][j-w[i]]+v[i]);
		}
	}

	cout<<dp[N][W]<<endl;

	return 0;
}

Measured memory_bytes: 9016
#include <cstdio>
#include <algorithm>
using std::min;
using std::max;
using std::sort;
#define MAXN 103

int main(void)
{
    int N, K, R;
    int a[MAXN],plate[MAXN];
    scanf("%d%d",&N,&K);
    int i,j,res=0;
    
    for(i=0;i<N;i++)
    {
        scanf("%d",a+i);
    }

    R=min(N,K);
    for(int A=0;A<=R;A++)
    {
        for(int B=0;B<=R-A;B++)
        {
            for(i=0;i<A;i++)
            {
                plate[i]=a[i];
            }
            for(j=0;j<B;j++)
            {
                plate[i+j]=a[N-1-j];
            }
            sort(plate,plate+A+B);
            i=0;
            while(i<K-(A+B) && plate[i]<0)
            {
                i++;
            }
            int s = 0;
            for(;i<A+B;i++)
            {
                s+=plate[i];
            }
            res = max(s,res);
        }
    }
    printf("%d\n",res);
    return 0;
}

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

using namespace std;

int main()
{
	//freopen("input16.txt","r",stdin);freopen("output16.txt","w",stdout);
	int a,b,c,d[101]={0},t=0,i;
	cin>>a>>b>>c;
	d[a]++;
	d[b]++;
	d[c]++;
	for (i=1;i<101;i++){
		if (d[i]>0){
			t++;
		}
	}
	cout<<t;
	return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

// 約数列挙
vector<ll> divisor(ll n) {
    vector<ll> ret;
    for(ll i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return ret;
}


int main() {
    int n; cin >> n;
    map<string, int> s;
    rep(i, n) {
        string tmp; cin >> tmp;
        s[tmp]++;
    }
    int num = 0;
    auto begin = s.begin(), end = s.end();
    for (auto iter = begin; iter != end; iter++) {
        chmax(num, iter->second);
    }
    for (auto iter = begin; iter != end; iter++) {
        if(iter->second == num) {
            cout << iter->first << endl;
        }
    }


    return 0;

}


Measured memory_bytes: 25216
void main() {
	auto str = rs.to!(dchar[]);
	auto q = ri;
	foreach(_; 0..q) {
		auto ip = readAs!(string[]), cmd = ip[0], a = ip[1].to!int, b = ip[2].to!int + 1;
		dchar[] p;
		if(ip.length == 4) p = ip[3].to!(dchar[]);
		switch(cmd) {
			case "print":
				str[a..b].writeln;
				break;
			case "reverse":
				str = str[0..a] ~ str[a..b].retro.array ~ str[b..$];
				break;
			case "replace":
				str = str[0..a] ~ p ~ str[b..$];
				break;
			default: break;
		}
	}
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}



Measured memory_bytes: 2924
N=int(input())
A=input()
B=input()
C=input()
S=""
count=0
for i in range(N):
	S=[A[i],B[i],C[i]]
	if len(set(S))==3:
		count+=2
	elif len(set(S))==2:
		count+=1
print(count)

Measured memory_bytes: 3064
A, B, Q = map(int, input().split())

INF = 10 ** 11 + 1
S = [-INF] + [int(input()) for _ in range(A)] + [INF]
T = [-INF] + [int(input()) for _ in range(B)] + [INF]
X = [int(input()) for _ in range(Q)]

def bsr(a, v):
	lo, hi = 0, len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x < a[mid]: hi = mid
		else: lo = mid + 1
	return lo

for x in X:
	sr = bsr(S, x)
	sl = sr - 1
	tr = bsr(T, x)
	tl = tr - 1
	cost = []
	for m in [S[sr], S[sl]]:
		for n in [T[tr], T[tl]]:
			cost += [abs(x - m) + abs(m - n), abs(x - n) + abs(m - n)]
	print(min(cost))


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

int main() {
        int A, B, x1, x2, x4, x5, i, y,
            count = 0;
        cin >> A >> B;

        for (i = A; i < B + 1; i++) {
                y = i;
                x1 = i % 10;
                i /= 10;
                x2 = i % 10;
                i /= 100;
                x4 = i % 10;
                i /= 10;
                x5 = i % 10;
                i = y;

                if ((x1 == x5) && (x2 == x4)) {
                        count++;
                }
        }
        cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define FASTIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main()
{
    int x;
    cin>>x;
    if(x>=30)
    {
        cout<<"Yes";
    }
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 3632
// https://atcoder.jp/contests/dp/tasks/dp_h
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
#define lengthof(x) (sizeof(x) / sizeof(*(x)))

const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

int h, w;
int dp[1000][1000]; // ゴールまでの経路数
string s[1001];     // 迷路の通れる道

// 右下までのパターン
inline int dfs(int _h, int _w) {
    // 右下の場合は探索終了
    if (_h == h - 1 && _w == w - 1) {
        return 1;
    }
    // 探索済みの場合は終了
    if (dp[_h][_w] != -1) {
        return dp[_h][_w];
    }
    int ans = 0;
    if (_h + 1 < h && s[_h + 1][_w] == '.') {
        ans += dfs(_h + 1, _w);
    }
    if (_w + 1 < w && s[_h][_w + 1] == '.') {
        ans += dfs(_h, _w + 1);
    }
    ans %= MOD;
    return dp[_h][_w] = ans;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }
    fill((int *)dp, (int *)(dp + lengthof(dp)), -1);
    dfs(0, 0);
    cout << dp[0][0] << endl;
    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {
	
	void Solve() {
		UL k, x;
		cin >> k >> x;
		if (k * 500 >= x) cout << "Yes" << endl;
		else cout << "No" << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5+7, M = 1e2+7;
int f[M][N];
int main()
{
	int n, w, ans = 0;
	scanf("%d%d", &n, &w);
	memset(f, 0x3f, sizeof(f));
	f[0][0] = 0;
	for(int i = 1; i <= n; i++)
	{
		int w, v;
		scanf("%d%d", &w, &v);
		for(int j = 0; j < N; j++)
		{
			f[i][j] = min(f[i][j], f[i-1][j]);
			if(j+v<N)
			{
			    f[i][j+v] = min(f[i][j+v], f[i-1][j]+w);
			}
		}
	}
	for(int i = N-1; i >= 0; i--)
	{
		if(f[n][i]<=w)
		{
			printf("%d\n", i);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 41984
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<long long int,long long int>a,pair<long long int,long long int>b)
{
    if(a.first==b.first)
    {
        if(a.second<=b.second)
        return true;
        else
        return false;
    }
    if(a.first>b.first)
    return true;
    else return false;
}
long long int gcd(long long int bdda,long long int chota)
{
    if(chota==0)
        return bdda;
    return gcd(chota,bdda%chota);
}
void solve()
{
    int n, a, b;
    cin >> n >> a >> b;
 
    vector<char> s(n);
    for(int i=0;i<n;i++)
        cin >> s.at(i);
 
    int c = 0, cb = 0;
 
    for(int i=0;i<n;i++) {
        if (s.at(i) == 'a') {
            if (c < (a + b)) {
                cout << "Yes" << endl;
                c++;
            } else {
                cout << "No" << endl;
            }
        } else if (s.at(i) == 'b') {
            if (c < (a + b) && cb < b) {
                cout << "Yes" << endl;
                c++;
                cb++;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;    
    t=1;

    //cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3740
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n,L[1<<17],R[1<<17];
vector<int>Left,Right;
long ans=0;
main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>L[i]>>R[i];
		Left.push_back(-R[i]*2);
		Right.push_back(L[i]*2);
	}
	sort(Left.begin(),Left.end(),greater<int>());
	sort(Right.begin(),Right.end(),greater<int>());
	long sum=0;
	for(int i=0;i<n;i++)
	{
		ans=max(ans,sum+Left[i]);
		ans=max(ans,sum+Right[i]);
		sum+=Left[i]+Right[i];
		ans=max(ans,sum);
	}
	cout<<ans<<endl;
}


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

int main()
{
      string str = "";
      for(int i = 0; i < 3; i++)
      {
             for(int j = 0; j < 3; j++)
             {
                   char ch;
                   cin >> ch;
                   if( i== j)
                       str += ch;
             }
      }
       cout << str << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main (){
int A,B;
  cin>>A>>B;
  int x=-1;
  if(10*B<=(25*(A+1)-1)/2){
  if((25*A+1)/2<=10*B) x=10*B;
    else x=(25*A+1)/2;
  
  }
  if(10*(B+1)-1<(25*A+1)/2)
    x=-1;
  cout<<x<<endl;

return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int W,H,x,y,r;
	cin >> W >> H >> x >> y >> r;
	if(x+r>W || x-r<0 || y+r>H || y-r<0){
		cout << "No" << endl;
	}
	else{
		cout << "Yes" << endl;
	}
	return  0;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
//double pi=3.1415926535898;
//double pi=acos(-1.0);
#define scarr(a,s,e) for(int i=s;i<=int(e);i++) scanf("%d ",&a[i]);
#define prarr(a,s,e) for(int i=s;i<=int(e);i++) printf("%d ",a[i]);
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define mkp        make_pair
#define fr         first
#define se         second
#define sc(x)      scanf("%d",&x)
#define pr(x)      printf("%d ",x)
#define scl(x)     scanf("%lld",&x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define r0         return 0;
#define CC         continue;
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x);
#define bb(x)      cerr<< x <<endl;
//#define max(a,b) a<b?b:a
//#define min(a,b) a<b?a:b
const ll M   = 1e7+9 ;
const ll inf = 1e19  ;
const int si = 1e5+9 ;
//////////////////////    Hi    ^_^  hack me if you can :P
int n,x;
ll ans;
int a[55];
ll mem[55][3000][55];
ll dp(int i,int sum,int num){
    if(i==n){
        if(num&&sum%num==0&&sum/num==x){
            return 1LL;
        }
        return 0LL;
    }
    ll &res=mem[i][sum][num];
    if(res!=-1LL)
        return res;
    res=0LL;
    res+=dp(i+1,sum+a[i],num+1);
    res+=dp(i+1,sum,num);
    return res;
}
int main()
{
cin>>n>>x;
lop(i,n)
cin>>a[i];
ms(mem,-1LL);
cout<<dp(0,0,0)<<endl;
r0;
}



/*

ll pwmod(ll a, ll n, ll mod) {
    ll ret = 1;
    while (n) {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

*/
/*
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);
for (int i=0;i<n;i++)            Hi    ^_^  hack me if you can :P
int mx[]= {0,0,1,1,1,-1,-1,-1};
int my[]= {1,-1,0,1,-1,0,1,-1};
bool inside (int i,int j) {return (i>=0 && i<n && j>=0 && j<m);}
*/


Measured memory_bytes: 71296
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


long factorial(long n){
    if(n > 0){
        return n*factorial(n-1);
    }else{
        return 1;
    }
}
struct town{
    ll x;
    ll y;
};

int main() {
   

    int n;
    cin >> n;
    vector <town> v;
    for (ll i=0;i<n;i++){
        ll x,y;
        cin >> x >> y;
        town t;
        t.x = x;
        t.y = y;
        v.push_back(t);
    }
    vector<int> it;
    for (ll i=0;i<n;i++){
        it.push_back(i);
    }
    long double sumLen = 0;
    do{
        for(int i=1;i<n;i++){
//            cout << sumLen << endl;
            sumLen += sqrt((v[it[i]].x - v[it[i-1]].x) * (v[it[i]].x - v[it[i-1]].x) + (v[it[i]].y - v[it[i-1]].y) * (v[it[i]].y - v[it[i-1]].y));
        }
    }while(next_permutation(it.begin(), it.end()));

    cout << setprecision(10) << sumLen / factorial(n) << endl;

}

Measured memory_bytes: 256