akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
	ll n;
	cin>>n;
	if(n==25){
		cout << "Christmas" << endl;
	}
	if(n==24){
		cout << "Christmas Eve" << endl;
	}
	if(n==23){
		cout << "Christmas Eve Eve" << endl;
	}
	if(n==22){
		cout << "Christmas Eve Eve Eve" << endl;
	}
	return 0;
}

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

int main() {
    vector<int> x(5);
    int k;
    for (int i = 0; i < 5; i++) cin >> x[i];
    cin >> k;
    if ((x[4] - x[0]) > k) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/dp/tasks/dp_c
import numpy as np
N = int(input())
Max_List=[]
N_List=[i for i in range(3)]
for i in range(N):
    Current_List=list(map(int,input().split())) 
    if i == 0:
        Max_List.append(Current_List)
    else:
        Current_Max_List = []
        for j in range(3):
            Index_List=np.array(Max_List[i-1])
            ind = np.ones(3, dtype=bool)
            ind[j] = False
            Current_Max_List.append(max(Index_List[ind])+Current_List[j])
            
        Max_List.append(Current_Max_List)
        
    
print(max(Max_List[-1]))

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}

#define deb(x) cout << '>' << #x << ':' << x << endl;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define END '\n'
#define inf 9e18
#define ff first
#define ss second
#define pb push_back

void solve(){
    int a, b, c[13] = {0, 1, 2, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1};
    cin >> a >> b;
    cout << (c[a] == c[b] ? "Yes" : "No");
}
int 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: 3652
# -*- coding: utf-8 -*-


N = int(input())
a = list(map(int, input().split()))

min = 1000
max = 0
for i in range(len(a)):
    if min > a[i]:
        min = a[i]
    if max < a[i]:
        max = a[i]
print(max - min)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

int n;
vector<int> G[100005];
vector<int> dp(100005, -1);

int rec(int now){
    if(dp[now]!=-1) return dp[now];

    int res=0;
    for(auto to:G[now]){
        chmax(res, rec(to)+1);
    }
    return dp[now] = res;
}

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

    cin >> n;
    int m; cin >> m;

    rep(i, m){
        int a, b; cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
    }

    int ans=0;
    rep(i, n) chmax(ans, rec(i));
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 1; i <= (int)(n); ++i)
int par[100001];
int find(int x){
   if(par[x]==x)
     return x;
   else
     return par[x]=find(par[x]); 
}
int main() {
  int n,m,x,y,ans=0;
  scanf("%d%d",&n,&m);
  int p[n+1];
  rep(i,n){
    par[i]=i;
    scanf("%d",&p[i]);
  }
  rep(i,m){
     scanf("%d%d",&x,&y);
     x=find(x);
     y=find(y);
     if(x==y)
       continue;
     par[y]=x;
  }
  rep(i,n){
     if(p[i]==i){
        ans++; 
     } else if(find(p[i])==find(p[p[i]])){
        ans++; 
     }
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define deb(x) cout << #x << ':' << x << endl;
#define loop3(i, k, n) for(i=k; i<n; i++)
#define ll  long long 
#define loop(i,n) for(int i=0;i<n;i++)
#define loop2(i,n) for(int i = 1;i<=n;i+=1)
#define pb push_back
#define mp make_pair
#define v1d vector<ll> 
#define v2d vector<vector<ll>>
const int INF = 1e9 +5 ;
int main()
{
    ll n;
    cin>>n;
    //v1d ing(n);
    vector<double> ing(n);
    loop(i,n)
    {
        cin>>ing[i];
    }
    sort(ing.begin(),ing.end());
    double a = ing[0] ,b = ing[1] , c = (a+b)/2;
    for(int i = 2; i<n;i++)
    {
        c = (c + ing[i])/2;
    }
    cout<<c;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		String s = sc.next();
		int n = s.length();

		long ret = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 1; i + j <= n; j++) {
				long num = Long.parseLong(s.substring(i, i + j));
				ret += num * num(i) * num(n - (i + j));
			}
		}

		pr.println(ret);
	}

	private static long num(int n) {
		if (n == 0) {
			return 1L;
		} else {
			return 1L << n - 1;
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


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

using namespace std;
typedef long long unsigned int ll;

int main() {
	int n, m;
	
	cin >> n >> m;
	cin.ignore();

	ll a;
	int b;
	vector<pair<ll, int> > v;

	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		v.push_back(make_pair(a, b));
	}
	sort(v.begin(), v.end());

	ll kane = 0;
	int sum = 0;
	for(vector<pair<ll, int> >::iterator it = v.begin(), end = v.end(); it != end; ++it) {
		kane += it->first * it->second;
		sum += it->second;
		int sa = sum - m;
		if (sa > 0) {
			cout << kane - sa * it->first << '\n'; 
			return 0;
		}
	}
	cout << kane << '\n'; 
	return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  int n;
  cin >> n;
  vector<int> d(n);
  rep(i, 0, n) cin >> d[i];
  sort(d.begin(), d.end());
  int half = n / 2;
  cout << d[half] - d[half - 1] << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,ans;
    cin>>n;
  	ans=pow(n,3);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <string>

using namespace std;

int func(int x, int tax) {
  return int(double(x)*(100.+double(tax))/100.);
}

int main() {
  int x, y, s;
  while(cin >> x >> y >> s) {
    if (x == 0 && y == 0 && s == 0) break;
    int ans = 0;
    for (int i = 1; i < s; i++) {
      int l = 1, r = 1000;
      for (int j = 0; j < 100; j++) {
	int p = (l+r)/2;
	if (func(p,x)+func(i,x) <= s) {
	  l = p;
	}else {
	  r = p;
	}
      }
      int j = l-1;
      while (true) {
	if (func(i,x)+func(j,x) > s) {
	  break;
	}
	if (func(i,x)+func(j,x) < s || i < 1 || j < 1) {
	  j++;
	  continue;
	}
	ans = max(ans, func(i,y)+func(j,y));
	j++;
      }
    }
    std::cout << ans << std::endl;
  }
}

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

using namespace std;

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

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int T, X;
  cin >> T >> X;
  cout << fixed << setprecision(5) << (double)T / X << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(a) a, a+sizeof(a)/sizeof(a[0])
using namespace std;

ll gcd(ll n, ll m) {
	if (m == 0) return n;
	return gcd(m, n % m);
}

ll lcm(ll n, ll m) {
	return m / gcd(n, m) * n;
}

int dig_sum(int num) {
	int dig, sum = 0;
	while (num) {
		dig = num % 10;
		sum = sum + dig;
		num = num / 10;
	}
	return sum;
}

int main(void) {
	int a,n,m,ans=0;
	int tmp;
	cin >> a >> n >> m;
	for (int y = 1; y <= 63; y++) {
		tmp = (int)pow(y + a, n);
		if (y == dig_sum(tmp) && tmp<=m) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3408
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll = long long; 
using ld = long double;
#define endl "\n"
//#define int long long
#define all(V) V.begin(),V.end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
const int MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1 << 25;
constexpr long double pi = 3.141592653589793238462643383279;
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll fact_mod(ll n, ll mod) {
    ll f = 1; for (int i = 2; i <= n; i++) f = f * (i % mod) % mod;
    return f;
}
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}
ll keta(ll n) {
    if (n == 0) return 1;
    ll count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
ll mch(ll n) {
    if (n == 1) return 1;
    else return n * mch(n - 1);
}
ll pow_mod(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % mod;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}
ll inv_mod(ll a, ll mod) {
    ll b = mod, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }
    return true;
}
//関数とか

//宣言とか

/*signed*/int main(void) {
    ll x;
    cin >> x;
    if (x <= 6) cout << 1 << endl;
    else if (x <= 11) cout << 2 << endl;
    else {
        ll S = x / 11;
        ll A = x % 11;
        if (A == 0) cout << S * 2 << endl;
        else if (A <= 6) cout << S * 2 + 1 << endl;
        else cout << S * 2 + 2 << endl;
    }
}

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char c[] = sc.next().toCharArray();
		if(c[c.length - 1] == '0' ||c[c.length - 1] == '1' ||c[c.length - 1] == '6' || c[c.length - 1] == '8')
			System.out.println("pon");
		else if(c[c.length - 1] == '2' ||c[c.length - 1] == '4'||c[c.length - 1] == '5'||c[c.length - 1] == '7'||c[c.length - 1] == '9')
			System.out.println("hon");
		else if(c[c.length - 1] == '3')
			System.out.println("bon");
	}

}


Measured memory_bytes: 35684
#include <iostream>
typedef long long int ll;
using namespace std;
int main(int argc, char const *argv[]) {
  ll N, A, B;
  std::cin >> N >> A >> B;
  if(A > B) std::cout << 0 << '\n';
  else if(N==1){
    if(A==B)std::cout << 1 << '\n';
    else std::cout << 0 << '\n';
  }else std::cout << (B - A) * (N - 2) + 1 << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, A;
	cin >> N >> A;
	VI X(N);
	int ma = 0;
	REP(i, N) {
		cin >> X[i];
		ma = max(ma, X[i]);
	}
	ma = max(ma, A);
	int dp[51][51][2510] = { 0 };
	dp[0][0][0] = 1;
	eREP(i, N) {
		eREP(j, N) {
			eREP(k, N*ma) {
				
				if (i == 0 && j == 0 && k == 0)
					dp[i][j][k] = 1;

				else if (i >= 1 && X[i-1] > k) 
					dp[i][j][k] = dp[i - 1][j][k];

				else if (i >= 1 && j >= 1 && k >= X[i-1]) 
					dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - X[i-1]];
				
				else
					dp[i][j][k] = 0;
			}

		}
	}
	int ans = 0;
	eFOR(i, 1, N) {
		ans += dp[N][i][i*A];
	}
	cout << ans << endl;
	return 0;

}



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

bool f(int x,int y){if(x<y)return false; return true;}

int main(){
	int n,m,p[102]={0};
	vector<int> sor;
	scanf("%d",&n);
	m=n*(n-1)/2;
	for(int i=0;i<m;i++){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		if(c>d)p[a]+=3;
		if(c==d){p[a]++; p[b]++;}
		if(c<d)p[b]+=3;
	}
	for(int i=1;i<=n;i++){
		sor.push_back(p[i]);
	}
	sort(sor.begin(),sor.end(),f);
	for(int i=1;i<=n;i++){
		for(int j=0;;j++){
			if(p[i]==sor[j]){printf("%d\n",j+1); break;}
		}
	}
}

Measured memory_bytes: 1204
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
using namespace std;

static inline void pn(int n)
{
	if (n == 0)
		putchar('0');
	else {

		int i;
		static char buf[20];
		for (i = 0; n; n /= 10, i++)
			buf[i] = n % 10 +'0';
		while (i--)
			putchar(buf[i]);
	}
	putchar('\n');
}

int main()
{
	int n, cnt = 0;

	scanf("%d", &n);

	vector<int> A(n), G;
	for (int &x: A)
		scanf("%d", &x);

	for (int i = 1, x = 1; x <= n; x = (pow(3, ++i) - 1) / 2)
		G.push_back(x);
	reverse(G.begin(), G.end());

	for (int g: G)
		for (auto b = A.begin(), i = b + g, e = A.end(); i != e; i++) {
			int v = *i;
			auto j = i - g;
			for(; j >= b && *j > v; j -= g)
				*(j + g) = *j, cnt++;
			*(j + g) = v;
		}

	pn(G.size());
	for (int &x: G)
		printf("%s%d", (&x == &G[0] ? "" : " "), x);
	putchar('\n');
	pn(cnt);
	for (int x: A) {
		pn(x);
	}
}


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

const int maxs = 1e5 + 4;
long long dp[103][maxs];
int n,w;
int W[101],V[101];

long long go(int pos,long long int sum)
{
    if(pos == n + 1)
        return 0;
    if(dp[pos][sum] != -1)
        return dp[pos][sum];
    
    long long int ans = 0;
    
   
    if(sum + W[pos] <= w)
    {       
        ans = max(ans,V[pos] + go(pos + 1 , sum + W[pos]));
        ans = max(ans,go(pos + 1,sum));
    }
    else
         ans = max(ans,go(pos + 1,sum));
    
    return dp[pos][sum] = ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    memset(dp,-1,sizeof dp);
    
    int i;
    cin >> n >> w;
    for(i = 1;i <= n;++i)
        cin >> W[i] >> V[i];
    
    long long ans = go(1,0);
    
    cout << ans;
    
}

Measured memory_bytes: 84136
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
#define vec2(a,y,x) vector<vector<int>> a(y,vector<int>(x,0))
#define vec1(a,n) vector<int> a(n);rep(i,n)cin>>a[i]
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int h,w;
    cin>>h>>w;
    vector<vector<char>> a(h,vector<char>(w,0));
    rep(i,h){rep(j,w) cin>>a[i][j];}
    vec2(dp,h,w);
    dp[0][0]=1;
    rep(i,h)rep(j,w){
        if(dp[i][j]==0) continue;
        if(i<h-1 && a[i+1][j]!='#'){ dp[i+1][j]+=dp[i][j];dp[i+1][j]%=MOD;}
        if(j<w-1 && a[i][j+1]!='#') {dp[i][j+1]+=dp[i][j];dp[i][j+1]%=MOD;}
    }
    cout<<dp[h-1][w-1]<<endl;
    return 0;
}

Measured memory_bytes: 5248
#include<bits/stdc++.h>
#define int long long 
#define LL long long 
#define LD long double
#define PI 3.14159265358979323846
#define MOD ((LL)1e9+7)
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

			
int32_t main()
{
	IOS
	vector<int>A(5);
	for(int i=0;i<5;i++)cin>>A[i];
	int d;cin>>d;
	for(int i=0;i<5;i++)
	{
		for(int j=0;j<5;j++)
		{
			if(abs(A[i]-A[j])>d)
			{
				cout<<":("<<endl;return 0;
			}
		}
	}
	cout<<"Yay!"<<endl;
}
	

	
		


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>

int main(void){
double a,b,c,d;
scanf("%lf %lf %lf %lf",&a,&b,&c,&d);

printf("%.10lf\n",sqrt((c-a)*(c-a)+(d-b)*(d-b)));
}






Measured memory_bytes: 2120
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    long long total = 0;
    for (auto x : A) {
        total += x;
    }
    
    bool res = true;
    for (int i = 0; i < n; ++i) {
        if (total - 2 * A[i] <= 0) {
            res = false;
            break;
        }
    }

    if (res) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast_io cin.tie(0);ios_base::sync_with_stdio(0);
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cout << endl; }
void show() { cout << endl; }
void pret() { cout << endl; exit(0);}
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cout << " " << to_string(H); debug_out(T...);}
template <typename Head, typename... Tail> void show(Head H, Tail... T) {cout <<H<<" "; show(T...);}
template <typename Head, typename... Tail> void pret(Head H, Tail... T) {cout <<H<<" "; pret(T...);}
#define pr(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
typedef long long ll;
#define int ll
typedef long double ld;
typedef vector<int> vi;
#define disp(x) cout<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(int)b;i++)
#define fo(i,a,b) for(int i=a;i<=(int)b;i++)
#define rf(i,a,b) for(int i=a;i>=(int)b;i--)
#define mp make_pair
#define pb emplace_back
#define F first
#define S second
#define endl '\n'
//cout.setf(ios::fixed);cout.precision(18)
const int MOD = 1e9+7;
const int maxn = 300000+10;

int32_t main(){
	fast_io;
	int x;
	cin >> x;
	show(1 - x);
	return 0;
}

Measured memory_bytes: 3652
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

//ベルマンフォード法
//https://abc061.contest.atcoder.jp/submissions/4484303

struct edge {ll to, cost;};
vector<vector<edge>> g;
const ll INF = 1e18;
const int MAX_N = 1e5;

ll dist[MAX_N];
ll n,m;

vector<pair<ll, ll>> edge;
vector<ll> cost;

bool bellman_ford(ll s){
  REP(i,n) dist[i] = INF;  
  dist[s] = 0;
  bool flag = true;
  REP(v, n){
    flag = false;
    REP(i, m){
      ll s = edge[i].first, t = edge[i].second;
      if(dist[s] != INF && dist[t] > dist[s] + cost[i]){
	dist[t] = dist[s] + cost[i];
	flag = true;	  	
	//n回目に n-1 に更新がある -> 負のサイクル
	if(v == n-1 && t == n-1){
	  return true;
	}
      }      
    }
    if(!flag) break;
  }
  return false;
}

int
main(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;  
  
  REP(i, m){
    ll a, b, c;
    cin >> a >> b >> c;
    a--; b--; c*=-1;
    edge.push_back(make_pair(a, b));
    cost.push_back(c);
  }
  
  cout << (!bellman_ford(0) ? to_string(-dist[n-1]) : "inf" ) << endl;
  
  return 0;
}


/*
bool bellman_ford_naive(ll s){
  REP(i,n) dist[i] = INF;
  dist[s] = 0;

  bool negative_cycle = false;

  REP(i, n){
    REP(v, n){
      for(edge e: g[v]){
	if(dist[v] != INF && dist[e.to] > dist[v] + e.cost){
	  dist[e.to] = dist[v] + e.cost;
	  //n回目に n-1 に更新がある -> 負のサイクル
	  if(i == n-1 && e.to == n-1){
	    dist[e.to] = -INF;
	    negative_cycle = true;
	  }
	}
      }
    }
  }
  return negative_cycle;
}
*/


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;

int main(){
  int a,b,sum;
  cin >> a >> b;
  for(int i = 1;i<=b-a-1;i++){
    sum+=i;
  }
  cout << sum-a<<endl;
}

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


int main(){
    int rectangle=0,diamond=0;
    int x1,x2,diagonal;
    while(scanf("%d,%d,%d",&x1,&x2,&diagonal)!=EOF){
        if(x1*x1+x2*x2==diagonal*diagonal){
            rectangle++;
            continue;
        }else if(x1+x2>diagonal&&x1==x2){
            diamond++;
            continue;
        }
    }
    cout << rectangle << endl;
    cout << diamond << endl;
    return 0;
}

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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using Pint = pair<int, int>;
const ll mod = 1e9+7;

int main(int argc, char const* argv[])
{
  int n;
  cin>>n;

  bool app = true;
  REP(i,n) {
    int a;
    cin>>a;
    if(!(a&1)) {
      if((a%3!=0) && (a%5!=0)) {
        app = false;
        break;
      }
    }
  }

  if(app) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;

  return 0;
}

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

using namespace std;

int main(void)
{
    int N, X;
    cin >> N >> X;
    vector<int> L(N);
    for(auto& x: L){
        cin >> x;
    }
    int lim = X;
    int cnt = 1;
    int Di = 0;
    for(int i = 0; i < N; i++){
        int Di2 = Di+L[i];
        if(Di2 > X){
            break;
        } 
        cnt++;
        Di = Di2;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...) 42
#endif
#define y0 y12345
#define y1 y54321
typedef unsigned long ul;
typedef long long ll;
//typedef pair<int, int> mpair;
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;}
using namespace std;

int n;
int a[100000], b[100000], c[100000];
ul dt[100002][4];
ul dp(int p, int zen){
	ul ma = 0;
	if(p >= n)return 0;
	if(dt[p][zen] != -1){return dt[p][zen];}
	if(zen!=0)chmax(ma, a[p]+dp(p+1, 0));
	if(zen!=1)chmax(ma, b[p]+dp(p+1, 1));
	if(zen!=2)chmax(ma, c[p]+dp(p+1, 2));
	return dt[p][zen] = ma;
}


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	
	cin>>n;
	rep(i, n){
	   cin>>a[i]>>b[i]>>c[i];
	   
	}
	memset(dt, -1, sizeof(dt));
	cout << dp(0, 4) << endl;
	return 0;
}


Measured memory_bytes: 9344
def iroha():
    a, b, c = input().split()
    
    s = a[len(a)-1]
    sshead = b[0]
    sstail = b[len(b)-1]
    sss = c[0]

    if s == sshead and sstail == sss:
        print("YES")
    else:
        print("NO")





if __name__ == "__main__":
    iroha()



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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    ll n, k;
    cin >> n >> k;
    cout << min(n % k, abs(k - n % k));
    return 0;
}


Measured memory_bytes: 256
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int A, B, C;
	std::cin >> A >> B >> C;
	
	if (A == B)
		std::cout << C << "\n";
	else if (B == C)
		std::cout << A << "\n";
	else
		std::cout << B << "\n";
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int N_MAX = 100;
int main()
{
  int n,t,i,p,res=1000000;
  int x[N_MAX];
  cin >> n;
  for(i=0;i<n;i++)
    cin >> x[i];
  for(p=1;p<=N_MAX;p++){
    t=0;
    for(i=0;i<n;i++)
      t+=(x[i]-p)*(x[i]-p);
    if(t<res) res=t;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
                using namespace std;
                 
                int main() {
                  int64_t W; 
                  int64_t H;
                  int64_t x;
                  int64_t y;
                  cin >>W >> H >> x >>y; 
                  double S; 
                  S= (W*H)/2.00000;  
                  cout<< S ;
                  if(2*x==W && 2*y == H){
                    cout<<' '<< 1 << endl;
                  }
                  else{
                    cout<<' '<< 0 << endl; 
                  }
                }

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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL(x) memset(x,0,sizeof(x))


using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

int main()
{
  ll N;
  cin >> N;

  vector<ll> A(N);

  rep(i, N)
    cin >> A[i];

  ll counter[N+10];
  FILL(counter);
  
  for(int i=0; i<N; i++)
    {
      counter[A[i]]++;
    }

  ll sum =0;
  
  for(int i=0; i<N+1; i++)
    {
      if(counter[i]>0)
	sum += counter[i]*(counter[i]-1)/2;
    }

  //cout << "sum="<<sum << endl;
  
  for(int i=0; i<N; i++)
    {
      ll ans=0;
      ll num = A[i];
      if(counter[num]>1)
	{
	  ans = sum - counter[num]*(counter[num]-1)/2 + (counter[num]-1)*(counter[num]-2)/2;
	}
      else
	{
	  ans=sum;
      }
      cout << ans << endl;
    }

  return 0;
}


//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find
//vector.count



Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long int ll;

ll INF = 1e18;

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

Measured memory_bytes: 4844
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;

signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    vector<int> cnt(30,0);
    string w; cin >> w;
    rep(i,w.size()){
        int x=w[i]-'a';
        cnt[x]++;
    }
    bool ok=1;
    rep(i,30)if(cnt[i]%2==1)ok=0;
    cout << (ok?"Yes":"No") << endl;
}


Measured memory_bytes: 3660
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<set>
using namespace std;
#define ls (rt<<1)
#define rs (rt<<1|1) 
#define mid ((l+r)/2)
#define ll long long
#define pb(x) push_back(x)
#define pr(x) cerr<<#x<<"="<<(x)<<endl
#define pri(x,lo) {cerr<<#x<<"={";for (int ol=0;ol<=lo;ol++)cerr<<x[ol]<<",";cerr<<"}"<<endl;}
#define N 1001000
#define inf 100000000
int minn[N],b[N],n,ans,i,j,m,o,p;
vector<int> s[N];
struct node{int l,r;}q[N];
bool cmp(node a,node b){if (a.l==b.l) return a.r>b.r;return a.l<b.l;}
void build(int rt,int l,int r)
{
	minn[rt]=inf;
	if (l==r) return ;
	build(ls,l,mid),build(rs,mid+1,r);
}
void modify(int rt,int l,int r,int x,int y)
{
	if (l==r) {minn[rt]=min(minn[rt],y);return;}
	if (x<=mid) modify(ls,l,mid,x,y);
	else modify(rs,mid+1,r,x,y);
	minn[rt]=min(minn[ls],minn[rs]);
}
int query(int rt,int l,int r,int x,int y)
{
	int ret=inf;
	if (x<=l&&r<=y) return minn[rt];
	if (x<=mid) ret=min(ret,query(ls,l,mid,x,y));
	if (y>=mid+1) ret=min(ret,query(rs,mid+1,r,x,y));
	return ret;
}
int main()
{
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&b[i]),ans+=1-b[i];
	scanf("%d",&m);
	for (i=1;i<=m;i++) scanf("%d %d",&o,&p),q[i].l=o,q[i].r=p;
	sort(q+1,q+1+m,cmp);
	for (i=1;i<=m;i++) s[q[i].l].pb(q[i].r);
	build(1,0,n);
	modify(1,0,n,0,0);
	for (i=1;i<=n;i++) 
	{
		for (j=0;j<s[i].size();j++)
		{
			int tmp=query(1,0,n,i-1,s[i][j]);
			modify(1,0,n,s[i][j],tmp);
		}
		modify(1,0,n,i,query(1,0,n,i-1,i-1)+(b[i]?1:-1));
	}
	printf("%d\n",ans+query(1,0,n,n,n));
	return 0;
}

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


template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
#define endl '\n'
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define forn(i,a,n) for(int i=a; i < n; i++)
typedef long long int lli;
typedef long double Double;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod = 1e9+7;
const int inf= 1<<30;
const int maxn = 200005;

int main(){__
	int d,t,s;
	cin >> d >> t >> s;
	if(t * s >= d) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


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

int main() {
  int A, B, x, a, cnt=0;
  int C[10];
  cin >> A >> B;
  
  for(int i=A; i<=B; i++){
    x=i;
    a=0;
    while(x > 0){
      C[a] = x % 10;
      x /= 10;
      a++;
    }
    
    if(C[0] == C[4] && C[1] == C[3])
      cnt++;
  }
  
  cout << cnt << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main(){
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	if(a[0]+a[1]==a[2])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define fi first
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)
#define repd(i, l, r) for (int i=(int)(l);i>=(int)(r);i--)

int32_t main() 
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	fastIO;
	ll t,n,i,j,a,b,c,d,m,k,q,l,r,x,y;
	// cin>>t;
	// while(t--)
	// {
		cin>>a>>b>>c>>d;
		ll p1=max(a,b);
		ll p2=max(c,d);
		ll ans=p1*p2;
		//cout<<ans<<endl;
		p1=max(a,b);
		p2=min(c,d);
		//cout<<p2<<" ";
		ans=max(ans,p1*p2);
		//cout<<ans<<endl;
		p1=min(a,b);
		p2=max(c,d);
		ans=max(ans,p1*p2);
		//cout<<ans<<endl;
		p1=min(a,b);
		p2=min(c,d);
		ans=max(ans,p1*p2);
		cout<<ans<<endl;
	// }

	return 0;
}

Measured memory_bytes: 3636
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
num = None
for i in range(n):
    ans += b[a[i] - 1]
    if num == a[i] - 2:
        ans += c[a[i] - 2]
    num = a[i] - 1
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

bool dp[89][89][12729];
int A[89][89];
int B[89][89];

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

	int H, W; cin >> H >> W;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) cin >> A[i][j];
	}
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) cin >> B[i][j];
	}

	dp[1][1][abs(A[1][1] - B[1][1])] = true;

	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			for (int k = 0; k < 12729; k++) {
				if (dp[i][j][k]) {
					if (i < H) {
						int m = abs(A[i + 1][j] - B[i + 1][j]);
						dp[i + 1][j][k + m] = true;
						dp[i + 1][j][abs(k - m)] = true;
					}
					if (j < W) {
						int m = abs(A[i][j+1] - B[i][j+1]);
						dp[i][j+1][k + m] = true;
						dp[i][j+1][abs(k - m)] = true;
					}
				}
			}
		}
	}

	for (int k = 0; k < 12729; k++) {
		if (dp[H][W][k]) {
			cout << k << endl;
			break;
		}
	}


	return 0;
}

Measured memory_bytes: 88832
#include <stdio.h>

int main()
{
    int N;
    scanf("%d", &N);
    for(int i=1; i<10; i++){
        for(int j=1; j<10; j++){
            if(i*j == N){
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
    return 0;
}


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

char ans[11];
int j,y;


void ab(int s,int t,int q){
  if(j==s && y==t){
    cout<<ans<<endl;
  }
  if(j>s && s+1<=4 ){
    ans[q]='A';
    ab(s+1,t,q+1);
  }
  if(y>t && t+1<=4 ){
    ans[q]='B';
    ab(s,t+1,q+1);
  }

  if(s+1==5 && q>4 && j==s+1 &&( t==y && t>0) ){
    ans[q]='A';
    ab(s+1,t,q+1);
  }
  if(t+1==5 && q>4 && y==t+1 &&( s==j && s>0) ){
    ans[q]='B';
    ab(s,t+1,q+1);
  }
  if(j==5 && y==5 && t==4 && s==4){
    ans[q]='A';
    ab(s+1,t,q+1);
    ans[q]='B';
    ab(s,t+1,q+1);
  }
  else if((j==6 && y==4 &&t==4 && s==4) ||(j==4 && y==6 && t==4 && s==4)){
     ans[q]='A';
    ab(s+1,t,q+1);
    ans[q]='B';
    ab(s,t+1,q+1);
  }
  if((j==6 && y==4 && t==4 && s==5) || (j==4 && y==6 && t==5 &&s==4)){
      ans[q]='A';
    ab(s+1,t,q+1);
    ans[q]='B';
    ab(s,t+1,q+1);
  }
 

      
}

int main(){
  cin>>j>>y;
  ab(0,0,0);

  return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int W,H;
vector<vector<int> > field;

void dfs(int h, int w){
    field[h][w] = 0;
    for(int i = -1; i <= 1; i++){
        for(int j = -1; j <= 1; j++){
            int nh = h + i;
            int nw = w + j;
            if(nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
            if(field[nh][nw]==0) continue;
            dfs(nh,nw);
        }
    }
}

int main(){
    while(cin >> W >> H){
        if(W==0 || H==0) break;
        field.assign(H, vector<int>(W,0));
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                cin >> field[i][j];
            }
        }
        int count = 0;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if(field[i][j]==0)continue;
                dfs(i,j);
                count++;
            }
        }
        cout << count << endl;
    }
    return 0;
}


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

int main(){
	int n;
	int output;
	while(cin >> n, n){
		output = 0;
		for(int i=0; i < n / 4; i++){
			int value;
			cin >> value;
			output += value;
		}
		cout << output << endl;
	}
}

Measured memory_bytes: 1160
// [[ABC134C] Exception Handling] https://www.luogu.com.cn/problem/AT4843
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
int main() {
  int n;
  cin >> n;

  map<string, int> m;
  string inp;
  for (int i = 0; i < n; i++) {
    cin >> inp;
    m[inp]++;
  }

  int maxx = 0;
  map<string, int>::iterator it;
  for (it = m.begin(); it != m.end(); it++) maxx = max(maxx, (*it).second);

  for (it = m.begin(); it != m.end(); it++)
    if ((*it).second == maxx) cout << (*it).first << endl;

  return 0;
}


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

constexpr int MAX_N = 8;
constexpr int MAX_M = MAX_N*(MAX_N-1)/2;

int N, M;
bool graph[MAX_N + 1][MAX_N + 1];
bool reached[MAX_N + 1];

int dfs(int a) {
  bool reachedAll{true};
  for (int i{1}; i <= N; ++i) {
    if (!reached[i]) {
      reachedAll = false;
      break;
    }
  }
  if (reachedAll)
    return 1;

  int count{};
  for (int b{1}; b <= N; ++b) {
    if (b == a || !graph[a][b] || reached[b])
      continue;
    reached[b] = true;
    count += dfs(b);
    reached[b] = false;
  }

  return count;
}

int main() {
  cin >> N >> M;
  for (int i{}; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    graph[a][b] = graph[b][a] = true;
  }

  reached[1] = true;
  printf("%d\n", dfs(1));
  return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

int main() {
   int a,pl;
   cin>>a;
   vector<int> vec(a);
   rep(i,a){
      cin>>vec.at(i);
   }
   int max = *std::max_element(vec.begin(), vec.end());
   rep(i,a){
      if(vec.at(i)==max){
         vec.at(i)=0;
         pl=i;
         break;
      }
   }
   int max2 = *std::max_element(vec.begin(), vec.end());
   vec.at(pl)=max;
   rep(i,a){
      if(vec.at(i)==max){
         cout<<max2<<endl;
      }
      else{
         cout<<max<<endl;
      }
   }
}



Measured memory_bytes: 2432