akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	int n;
	int a[102];
	scanf("%d",&n);
	rep(i,n)scanf("%d",&a[i]);
	
	int MAX = 0;
	rep(i,n)MAX = max ( MAX , a[i] );
	
	if(MAX == 1){
		if(n == 2)puts("Possible");
		else puts("Impossible");
		return 0;
	}
	
	int cnt[102] = {};
	rep(i,n){
		cnt[a[i]] ++;
	}
	
	for(int i = 1 ; i*2 < MAX ; i ++){
		if(cnt[i] > 0){
			puts("Impossible");
			return 0;
		}
	}
	if(MAX%2 == 0){
		if(cnt[MAX/2] != 1){
			puts("Impossible");
			return 0;
		}
	}
	else {
		if(cnt[(MAX+1)/2] != 2){
			puts("Impossible");
			return 0;
		}
	}
	for(int i = (MAX+3)/2 ; i <= MAX ; i ++){
		if(cnt[i] < 2){
			puts("Impossible");
			return 0;
		}
	}
	puts("Possible");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds;  
using namespace std;

typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
    
//defines
typedef long long ll;
typedef long double ld;

ll a,b,c,n,m,k;

ll t=1;

void solve()
{
    cin>>n>>m>>k;
    cout<<((n/m)+((n%m)==0?0:1))*k;
 if(t>0)cout<<"\n";
}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  //cin>>t;
    while(t--)
    {
        solve();
    }
  //cout<<sum;
        
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int f[100][10];
int p[100][11];

int main()
{
    int n;
    cin >> n;

    rep(i, n) rep(j, 10) cin >> f[i][j];
    rep(i, n) rep(j, 11) cin >> p[i][j];

    int ans = -1e9;

    for (int bit = 1; bit < (1 << 10); bit++)
    {
        int t[10] = {};
        for (int i = 0; i < 10; i++)
        {
            if (bit & (1 << i))
                t[i] = 1;
        }

        int sum = 0;
        rep(i, n)
        {
            int cnt = 0;
            rep(j, 10)
            {
                if (f[i][j] == 1 && t[j] == 1)
                    cnt++;
            }
            sum += p[i][cnt];
        }
        ans = max(ans, sum);
    }
    OP(ans);

    return 0;
}


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

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  ul l, r;
  cin >> l >> r;
  ul ans = 2019;
  ul mod = 2019;
  for (ul i=l; i<=min(r, l+mod); ++i) {
    for (ul j=i+1; j<=min(r, l+mod); ++j) ans = min(ans, i%mod*j%mod);
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
    // 制約見て！！！デカかったらlong longにすること！
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = 0;

    if(a >= 2 * c && b >= 2 * c) {
        cout << 2 * max(x, y) * c << endl;
        return 0;
    }

    if(a + b >= 2 * c) {
        ans += 2 * min(x, y) * c;
        if(x > y) {
            if(a >= 2 * c)
                ans += 2 * c * (x - y);
            else
                ans += (x - y) * a;
        } else if(y > x) {
            if(b >= 2 * c)
                ans += 2 * c * (y - x);
            else
                ans += (y - x) * b;
        }
    } else {
        ans += a * x + b * y;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3584
/*
まずは、木クラスを作っておく。

入力されたｎを一周回れば、parentは全部埋まる。
そっからdepthを埋めていく。


nodeは初期値に、?１とか入れて埋めておく。

*/


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>


using namespace std;

class Rooted_Tree
{

public:
	int id;  //idはなくす。　全部添え字で管理　そうしないと配列内でidに対してfindする回数がすごい増えるので
	int parent;
	int depth;
	string type;
	int degree;
	vector<int> c;

	Rooted_Tree()
    {
        id = parent = depth = degree = -1;
		type = "non";
    }

};


//再帰で木をたどって行って、[深さ]を埋める
void fill_depth(vector<Rooted_Tree> &rt, int id, int depth){
	int i;

	rt[id].depth=depth;
	for(i=0;i<rt[id].degree;i++) fill_depth(rt, rt[id].c[i], depth+1);

}

//vector内のidでのソート用　引数内で無名関数？クラス？　を宣言するのはレベル高くて意味不なのでやめとこう。
//　なんで動いてるのか意味不明の参考URL  http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=714973
//引数にconst 入れてないと動かない　なぜだ？
bool asc(const Rooted_Tree &right, const Rooted_Tree &left){ return right.id < left.id;}

int main() {
	int i,j,i_buf;
	int n;
	// id == 添え字　にするので　mapとかでもいいが、添え字をそのまま使痛いのでvector
	vector<Rooted_Tree> rt;

	//input
	cin >> n;
	for(i=0; i<n; i++){
		Rooted_Tree buf;
		cin >> buf.id;
		cin >> buf.degree;
		for(j=0;j<buf.degree;j++){
			cin >> i_buf;
			buf.c.push_back(i_buf);
		}
		rt.push_back(buf);
	}

	//id==添え字　にする
	sort(rt.begin(), rt.end(), asc);
	
	// fill parent
	//ID==iのnodeが持っている子のnodeを埋めていく。
	for(i=0; i<n; i++){
		for(j=0; j<rt[i].degree; j++)
			rt[ rt[i].c[j] ].parent=rt[i].id;
	}

	//fill type and depth
	for(i=0; i<n; i++){
		if(rt[i].parent==-1){
			rt[i].type = "root";
			fill_depth(rt, i, 0); //rootから再帰させてすべてのdepthを埋めていく
		}
		else{
			if(rt[i].degree!=0) rt[i].type = "internal node";
			else rt[i].type = "leaf";
		}
	}

	//出力
	for(i=0; i<n; i++){
		printf("node %d: parent = %d, depth = %d, %s, ", rt[i].id, rt[i].parent, rt[i].depth, rt[i].type.c_str());
		printf("[");
		for(j=0;j<rt[i].degree;j++){
			printf("%d", rt[i].c[j]);
			if(j!=rt[i].degree-1) printf(", ");
		}
		printf("]\n");
	}
	
	
	return 0;
}

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

using namespace std;

int was[1234];

main() {
	string s;
	cin >> s;
	int n = s.size();
	for (int i = 0; i < n; i++) {
		was[(int)s[i]]++;
		if (was[(int)s[i]] > 1) {
			puts("-1");
			return 0;
		}
	}
	for (int i = 0; i < 26; i++) {
		if (!was[i + 'a']) {
			cout << s << char(i + 'a');
			return 0;
		}
	}
	for (int i = n - 2; i >= 0; i--) {
		int mn = 12345;
		for (int j = i + 1; j < n; j++) {
			if (s[j] > s[i]) {
				mn = min(mn, (int)s[j]);
			}
		}
		if (mn != 12345) {
			for (int k = 0; k < i; k++) {
				cout << s[k];
			}
			cout << char(mn);
			return 0;
		}
	}
	puts("-1");
}

Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions 

#endif

bool is_sft(string s){
    bool seven = false, five = false, three = false;
    REP(i,s.size()) {
        if (s[i] == '7') seven = true;
        else if (s[i] == '5') five = true;
        else if (s[i] == '3') three = true;

        if (seven && five && three) {
            return true;
        }
    }

    return false;
}

string S[3] = { "3","5","7" };
vi nums;
void dfs(int n, string res) {
    if (n > 9) return;
    
    if (is_sft(res)) nums.push_back(stoi(res));

    REP(i,3) {
        dfs(n + 1, res + S[i]);       
    }
}

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

    int N; cin >> N;



    dfs(0, "");
    sort(nums.begin(), nums.end());

    int ans = 0;
    REP(i,nums.size()) {
        if (nums[i] <= N) ans++;
        else break;
    }

    cout << ans << endl;

    nums.clear();

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  map<ll,int> p;
  rep(i,n){
    ll x;
    cin>>x;
    if(p.count(x)) p.at(x)++;
    else p[x]=1;
  }

  ll ans=0;
  for(auto z : p){
    if(z.se==0) continue;
    if(z.se>=z.fi) {
      ans+=z.se-z.fi;
    }
    else ans+=z.se;
  }

  cout << ans << endl;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vl vector<ll>
#define pll pair<ll, ll>
#define vll vector<pll>
#define coutp cout << fixed << setprecision(12)
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

ll power(ll x, ll y, ll m)
{
    ll res = 1;
    x = x % m;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % m;
        y = y >> 1;
        x = (x * x) % m;
    }
    return res;
}

void solve()
{
    int n,k;
    string s;
    cin>>n>>k>>s;
    int cnt=0;
    for(int i=1;i<n;i++) {
        if(s[i]==s[i-1]) {
            cnt++;
        }
    }
    int ans = min(n-1,k*2+cnt);
    cout<<ans;
}

int main()
{
    fastio;
    int t;
    
    t = 1;
    //cin >> t;
    //int test=t;
    while (t-- > 0)
    {
        //cout<<"Case #"<<(test-t)<<": ";
        solve();
        cout << newl;
    }

    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<vector>
#include<climits>
using namespace std;

int main(void){

    int a, b, c, d;    
    cin>>a>>b>>c>>d;

    if ((abs(a-b) <= d and abs(c-b)<=d) or abs(c-a)<=d) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), R = sc.nextInt();
		if(N >= 10) {
			System.out.println(R);
		}else {
			System.out.println(100*(10-N)+R);
		}
	}
}


Measured memory_bytes: 23636
#include<cstdio>
using namespace std;
int a,b,c,i,j,n,s;
int main()
{
    scanf("%d%d%d%d",&a,&b,&c,&n);
    for (i=0;i<=a;i++)
     for (j=0;j<=b;j++)
      if ((n-i*500-j*100>=0)&&(n-i*500-j*100<=c*50)) ++s;
    printf("%d\n",s);
    return 0;
}

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

const int mxN = 2e5 + 5;
int a[mxN];

int main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; ++i)
		cin >> a[i];
	int answer = 1;
	set<int> s;
	s.insert(a[1]);
	for(int i = 2; i <= n; ++i) {
		answer += a[i] <= *s.begin();
		s.insert(a[i]);
	}
	cout << answer;
}


Measured memory_bytes: 13752
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint n, m, d;
    cin >> n >> m >> d;
    double ans = 0.0;
    if(d == 0){
        ans = (double)(m-1)  / (double)(n);
    }
    else {
        ans = (double)((m - 1) * 2 * (n - d)) / (double)(n * n);
    }
    printf("%.15f\n", ans);
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
using namespace std;
void file(){
	#ifndef ONLINE_JUDGE
    	freopen("tst.txt", "r", stdin);
	#endif	
}
const int N=1e5+5,MAX=3e7,MOD=1e9+7;
 
int a,b;
int main()
{	
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//file();

	cin>>a>>b;
	if(a>b)swap(a,b);
	if((b+a)%2)cout<<"IMPOSSIBLE\n";
	else cout<<(b+a)/2<<"\n";
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
#define loop(x) for(int i=0;i<x;i++)
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define dd fflush(stdout)
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mt make_tuple //use tie
#define eb emplace_back
typedef tuple<int,int,int> State;//use in dijkstra
ll mod=1e9+7;
// ll power(ll x,ll y,ll mod){
//  ll ans=1;
//  while(y>0){
//   if(y&1){
//     ans=ans*x;
//   }
//   x=x*x;
//   y=y/2;
//  }
//  return ans;
// }
 ll a[500+1];
 int n;
int main(){
    IOS;   
    // int n;

  
  cin>>n;
ll aa[n+1]={0};
  loop(n)
  {
    cin>>a[i];

    aa[i+1]=aa[i]+a[i];
  }
  ll dp[n+1][n+1];
  for(int l=1;l<=n;l++){
    for(int i=0;i<n-l+1;i++){
      int j=i+l-1;
      if(i==j){
        dp[i][j]=0;
      }
      else
      {
      dp[i][j]=2e25;
      for(int k=i;k<j;k++){
        ll l=aa[k+1]-aa[i];//sum from i to k
        ll kk=aa[j+1]-aa[k+1];// dum from k+1 tp j
        dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+l+kk);
      }
    }
    }
  }
  cout<<dp[0][n-1]<<endl;
     
}
// https://atcoder.jp/contests/dp/tasks/dp_d
// https://codeforces.com/contest/1131/problem/C
 
//csjosh

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

using namespace std;

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


template<class T>
T gcd(T a, T b)
{
  if(a && b) {
    return gcd(min(a, b), max(a, b) % min(a, b));
  } else {
    return a;
  }
}

template<class T>
T lcm(T a, T b)
{
  return a / gcd(a, b) * b;
}

ll power(ll base, ll exponent, ll module)
{
  if(exponent % 2) {
    return power(base, exponent - 1, module) * base % module;
  } else if(exponent) {
    ll root_ans = power(base, exponent / 2, module);
    return root_ans * root_ans % module;
  } else {
    return 1;
  }
}

struct combination
{
  vector<ll> fact, inv;
  combination(int sz) : fact(sz + 1), inv(sz + 1)
  {
    fact[0] = 1;
    for(int i = 1; i <= sz; i++) {
      fact[i] = fact[i - 1] * i % mod;
    }
    inv[sz] = power(fact[sz], mod - 2, mod);
    for(int i = sz - 1; i >= 0; i--) {
      inv[i] = inv[i + 1] * (i + 1) % mod;
    }
  }
  ll Pair(int n, int r)
  {
    if(r < 0 || n < r) return 0;
    return (fact[n] * inv[n - r] % mod);
  }
  ll C(int p, int q)
  {
    if(q < 0 || p < q) return 0;
    return (fact[p] * inv[q] % mod * inv[p - q] % mod);
  }
};

template<typename T>
void print_vec(vector<T>& v)
{
  for(const auto& e: v) {
    cout << e << " ";
  }
  cout << endl;
}
template<typename T>
void print_2dvec(vector<vector<T>>& m)
{
  for(const auto& v: m) {
    for(const auto& e: v) {
      cout << e << " ";
    }
    cout << endl;
  }
}


int main(int argc, char const* argv[])
{
  int h, a;

  cin >> h >> a;

  int ans;

  ans = (h + a - 1) / a;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
xyh = []
for _ in range (N):
    xyh.append([int(x) for x in input().split()])

count = 0
while True:
    if xyh[count][2] > 0:
        xstd = xyh[count][0]
        ystd = xyh[count][1]
        hstd = xyh[count][2]
        break
    else:
        count += 1

for x in range (101):
    for y in range (101):
        Cx = x
        Cy = y
        H = hstd + abs(xstd-Cx) + abs (ystd - Cy)
        xyhcand = []
        for k in range (N) :
            xi = xyh[k][0]
            yi = xyh[k][1]
            h = max(H-abs(xi-Cx)-abs(yi-Cy),0)
            xyhls = [xi,yi,h]
            xyhcand.append(xyhls)
            xyhls = []
        if sorted(xyh) == sorted(xyhcand):
            ans = " ".join([str(x),str(y),str(H)])
            break
        
print(ans)





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

int main() {
    ll x,y;
    cin>>x>>y;
    vector<ll> ans;
    ans.push_back(x);
    while(ans[ans.size()-1]<=y) {
        ans.push_back(ans[ans.size()-1]*2);
    }
    cout<<ans.size()-1<<endl;
}


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

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

string solve(int N, const vector<ll>& xs)
{
    set<ll> ys(xs.begin(), xs.end());

    return ys.size() == xs.size() ? "YES" : "NO";
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<ll> xs(N);

    for (int i = 0; i < N; ++i)
        cin >> xs[i];

    auto ans = solve(N, xs);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 11264
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

int n,m,ans,a[4];
int s,c;

int main()
{
	scanf("%d%d",&n,&m);
    
    for (int i=1 ; i<=n ; i++)
        a[i]=-1;
    
	for (int i=1 ; i<=m ; i++)
	{
		scanf("%d%d",&s,&c);
	
		if (a[s]==-1 || a[s]==c) {
			a[s]=c;
		}
		else
		{
			printf("-1\n");
			return 0;
		}
	}
	
	if (n==1 && (a[1]==-1 || a[1]==0)) {
		printf("0\n");
		return 0;
	}
	else
	{
		
		for (int i=1 ; i<=n ; i++)
		{
			if (i==1 && a[i]==0)
			{
				printf("-1\n");
				return 0;
			}
			else
			{
				if (a[i]==-1 && i!=1) printf("%d",0);
				else
				{
					if (i==1 && a[i]==-1) printf("%d",1);
					else printf("%d",a[i]);
				}
			}
		}
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    int n;
    cin >> n;
    akari<int> as(n), bs(n);
    for (int i = 0; i < n; i++)
    {
        cin >> as[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin >> bs[i];
    }
    yukari<int> dp(1 << n, akari<int>(51, 1e9));
    dp[0][0] = 0;
    for (int s = 0; s < 1 << n; s++)
    {
        int popcnt = __builtin_popcount(s), off = 0;
        for (int i = 0; i < n; i++)
        {
            if (s >> i & 1)
            {
                continue;
            }
            int x = abs(i - popcnt) & 1 ? bs[i] : as[i];
            int mask = s | 1 << i;
            for (int j = 0; j <= x; j++)
            {
                dp[mask][x] = min(dp[mask][x], dp[s][j] + off);
            }
            off++;
        }
    }
    int ans = *min_element(dp.back().begin(), dp.back().end());
    if (ans == 1e9)
    {
        ans = -1;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 63744
#include<bits/stdc++.h>
using namespace std;
main()
{

                long long A,B,C,k=0,j=0;
                cin>>A>>B>>C;
                if(A==5){
                                k++;
                }
                else{
                                j++;
                }
                 if(B==5){
                                k++;
                }
                else{
                                j++;
                }
                   if(C==5){
                                k++;
                }
                else{
                                j++;
                }
                if(k==2&&j==1)
                {
                                cout<<"YES"<<endl;
                }
                else{
                                cout<<"NO"<<endl;
                }


}


Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;

int main(){
    int a, b;
    cin >>  a >> b;
    if(a+b>=a-b && a+b>=a*b){
        cout << a+b << endl;
    }
      else if(a-b>=a*b && a-b>=a+b){
            cout << a-b << endl;
      }
       else cout << a*b << endl;

}

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

typedef long long ll;

const ll MAX_N = 1e5;
vector<ll> cost(MAX_N + 1, -1);
vector<ll> height(MAX_N + 1);

ll dp(ll n) {
    if (cost[n] == -1) {
        if (n == 2) {
            cost[n] = abs(height[1] - height[2]);
        } else {
            cost[n] = min(dp(n - 1) + abs(height[n] - height[n-1]) , dp(n - 2) + abs(height[n] - height[n-2]));
        }
    }
    return cost[n];
}

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> height[i+1];
    }
    cost[1] = 0;
    cout << dp(N) << endl;
}

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

int main()
{
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<vector<int>> express(N, vector<int>(N, 0));
    rep(i, M)
    {
        int L, R;
        cin >> L >> R;
        express[L - 1][R - 1]++;
    }

    for (int i = 0; i < N; i++)
        for (int j = 0; j < N - i - 1; j++)
        {
            int l0, l1, l2, r0, r1, r2;
            l0 = j;
            r0 = l0 + i + 1;
            l1 = l0;
            r1 = l1 + i;
            l2 = l0 + 1;
            r2 = l2 + i;

            express[l0][r0] += express[l1][r1] + express[l2][r2];
            if (i > 0)
                express[l0][r0] -= express[l2][r1];
        }

    rep(i, Q)
    {
        int p, q;
        cin >> p >> q;
        cout << express[p - 1][q - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;



int main(){
    fast_io
    
    long long a,b,c;
    cin>>a>>b>>c;
    ll tmp=c-a-b;
    if(tmp>0 && (tmp*tmp-4*a*b)>0) cout <<"Yes"<<endl;
    else cout<<"No"<<endl;


    return 0;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

    int N, K;
    cin >> N >> K;
    
    int ans = 0;
    if (N == K) {
        ans = 1;
    } else {
        N -= K;
        ans = 1;
        while(N > 0) {
            N -= (K-1);
            ans++;
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef  long long  ll;
typedef long double db;
#define pb push_back
#define mp make_pair
#define ub(v,val) upper_bound(v.begin(),v.end(),val)
#define lb(v,val) lower_bound(v.begin(),v.end(),val)
#define sortv(vec) sort(vec.begin(),vec.end())
#define rev(p) reverse(p.begin(),p.end());
#define v vector
#define PI 3.1415926535
#define len length()
#define repc(i,s,e) for(ll i=s;i<e;i++)
#define np(str) next_permutation(str.begin(),str.end())
#define fi first
#define se second
#define mset(a,val) memset(a,val,sizeof(a));
#define mt make_tuple
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define rep(i,n) for(ll  i=0;i<n;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll M = 1e9 + 7;
ll INF = 1e18;
ll n, m;

int main() {
	// your code goes here
	IOS;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll  i, j, t, k, x, y, z,  N;
	string s;
	cin >> s;
	ll sum = 0;
	rep(i, s.len) {
		sum += (s[i] - '0');
	}
	if (sum % 9 == 0)
		cout << "Yes";
	else
		cout << "No";

	return 0;
}





Measured memory_bytes: 3744
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int n;
    string s;
    cin >> n >> s;

    int x = 0;
    int ans = 0;
    for(int i=0; i<n; ++i){
        if(s[i] == 'I')
            ++ x;
        else
            -- x;
        ans = max(ans, x);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i = j; i <= k; i++) 
#define dow(i,j,k) for(int i = j; i >= k; i--)

using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 100;
const int M = 4105;
int n, a[N], b[N];
long long f[M<<2], inv[M<<2];
long long dp[M][M];
long long vis[M][M];

int qpow(int x, int y) {
	int res = 1;
	while (y) {
		if (y & 1) res = res * 1ll * x % mod;
		x = 1ll * x * x % mod; y >>= 1;
	}
	return res;
}

int main() {
	ios::sync_with_stdio(0);
	cin >> n;
	rep (i, 1, n) cin >> a[i] >> b[i], vis[2000-a[i]][2000-b[i]]++;
	for (int i = 0; i <= 8000; i ++) {
		for (int j = 0; j <= 4000 && j <= i; j++) {
			int k = i - j;
			if (j != 0) dp[j][k] += vis[j-1][k] + dp[j-1][k];
			if (k != 0) dp[j][k] += vis[j][k-1] + dp[j][k-1];
			dp[j][k] %= mod;
		}
	}
	long long ans = 0;
	rep (i, 1, n) ans = (ans + dp[a[i] + 2000][b[i] + 2000]) % mod;
	f[0] = 1; inv[0] = 1;f[1] = inv[1] = 1;
	rep (i, 2, 8000) f[i] = f[i-1] * i % mod, inv[i] = qpow(f[i], mod-2);
//    rep (i, 1, 10) cout << f[i] << " " << f[i] * inv[i] % mod << endl;
//    rep (i, 1, n) cout << f[a[i] + b[i] << 1] * inv[a[i] + b[i]] % mod * inv[a[i] + b[i]] % mod << endl;
	rep (i, 1, n) ans = (ans - f[a[i] + b[i] << 1] * inv[a[i] + a[i]] % mod * inv[b[i] + b[i]] % mod + mod) % mod;
	cout << ans * inv[2] % mod << endl;



}

Measured memory_bytes: 196992
#include <stdio.h>

int main(){
  int h,m,n[2],i,k;
  for(i=0;i<2;i++){
    scanf("%d",&h);
    scanf("%d",&m);
    n[i]=h*60+m;
  }
  scanf("%d",&k);
  printf("%d",n[1]-n[0]-k);
  return(0);
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int num[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
bool uru(int checkyear){if(checkyear%4==0){if(checkyear%100!=0||checkyear%400==0)return true;}return false;}
int gcd( int x, int y ){return y ? gcd(y, x%y) : x;}
signed main() {
    int x=0,y=0,z=0,w=0,n=0,m=0;
    string s,d;
    cin >>s>>d;
    if(s[0]==d[2]){
        if(s[1]==d[1]){
            if(s[2]==d[0]){
                cout << "YES";
                return 0;
            }
        }
    }
    cout << "NO";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (int)1e9
#define endl "\n"
#define ll long long
#define ull unsigned long long

using namespace std;

int main()
{
    ll n, m;
    cin >> n >> m;
  
  cout << (m == n ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

typedef struct point {
  int x, ver, length;
} GVE;

int main(){
  GVE G[500000];
  int n,i,j,g,c,a = 1,size = 0,d[10000];

  scanf("%d",&n);

  for(i = 0;i < n;i++){
    scanf("%d",&c);
    scanf("%d",&g);

    for(j = 1;j <= g;j++){
      G[size].x = c;
      scanf("%d %d",&G[size].ver,&G[size].length);
      size++;
    }
  }

  for(i = 1;i < n;i++){
    d[i]=INT_MAX;
  }
  while(a){
    a = 0;
    for(i = 0; i < size; i++) {
      if(d[G[i].x] !=INT_MAX && d[G[i].x]+G[i].length < d[G[i].ver]) {
        d[G[i].ver] = d[G[i].x]+G[i].length;
        a++;
      }
    }
  }
  for(i = 0; i < n; i++){
    printf("%d %d\n",i,d[i]);
  }
  return 0;
}


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

int main (void)
{
	int a , b;
	for(a = 1 ; a < 10 ; a++)
	{
		for(b = 1 ; b < 10 ; b++)
		{
			printf("%dx%d=%d\n" , a , b , a * b);
		}
	}
	return 0;
}


Measured memory_bytes: 2012
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

// ll me(ll x,ll n)
// {
//   ll res=1;

//   while(n)
//   {
//     if(n&1)
//       res=(res*x)%mod;

//       x=(x*x)%mod;

//       n/=2;
//   }

//   return res;
// }


int fac[N],inv[N];

int me(int x, int n) 
{
  int res = 1;
  while(n) {
      if(n & 1) 
         res = (1LL * res * x) % mod;
      x = (1LL * x * x) % mod;
      n >>= 1;
  }
  return res;
}

int mi(int x, int m)
{
    return me(x, m-2);
}

void fact() 
{
  fac[0] = 1;

  rep(i, 1, N) 
     fac[i] = (1LL * fac[i - 1] * i) % mod;
   

  inv[N-1] = mi(fac[N-1], mod);

  for(int i = N - 1; i > 0; i--) 
    inv[i - 1] = (1LL * inv[i] * i) % mod;
   
}

int nCr(int n, int k) 
{
  if(k > n)
      return 0;

  int ans = (1LL * fac[n] * inv[k]) % mod;
  ans = (1LL * ans * inv[n - k]) % mod;

  return ans;
}



int main() 
{ 
    int n;
    scf(n); 

    ll ans=0;

    fact();

    rep(i,1,2000)
    {
      if(n-3*i<0)
        break;

      int x=n-3*i;

      ans+=nCr(x+i-1,i-1);
      ans%=mod;
    } 


 


   

    lprin(ans%mod);


        //printf("\n");     
      
  
}

Measured memory_bytes: 11636
#include <bits/stdc++.h>
#define int long long
using namespace std;

int n,cnt1,cnt2,cnt3;
double dp[310][310][310];

signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		if(x==1) cnt1++;
		else if(x==2) cnt2++;
		else cnt3++;
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			for(int k=0;k<=n;k++) if(!(i==0&&j==0&&k==0)&&(i+j+k<=n)){
				if(k!=0) dp[i][j][k]+=dp[i][j][k-1]*k*1.0/(i+j+k);
				if(j!=0) dp[i][j][k]+=dp[i][j-1][k+1]*j*1.0/(i+j+k);
				if(i!=0) dp[i][j][k]+=dp[i-1][j+1][k]*i*1.0/(i+j+k);
				dp[i][j][k]+=n*1.0/(i+j+k);
				//cout<<i<<" "<<j<<" "<<k<<" "<<dp[i][j][k]<<endl; 
			}
		}
	}
	cout<<fixed<<setprecision(15)<<dp[cnt3][cnt2][cnt1]<<endl;
	return 0;
}

Measured memory_bytes: 225536
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    vector<string>in(n);
    rep(i,n)cin>>in[i];
    map<int,vector<int> >tmp;
    rep(i,n){
      rep(j,in[i].size())if(in[i][j]!='.'){
	if(j){
	  in[i][j-1]='+';
	  tmp[j].pb(i);
	}
	break;
      }else in[i][j]=' ';
    }

    map<int,vector<int> >::iterator it=tmp.begin();
    for(;it!=tmp.end();it++){
      int d=it->first;
      rep(i,tmp[d].size()-1){
	if(tmp[d][i+1]-tmp[d][i]<2)continue;
	bool h=true;
	loop(j,tmp[d][i],tmp[d][i+1])if(isalpha(in[j][d-1]))h=false;
	if(h)loop(j,tmp[d][i]+1,tmp[d][i+1])in[j][d-1]='|';
      }
    }
    rep(i,n)cout<<in[i]<<endl;
  }
}

Measured memory_bytes: 2116
#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 ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/
#define fast            ios_base::sync_with_stdio(false)
#define mems(x, y)      memset(x, y, sizeof x)
#define pii             pair < int, int >
#define prec(x)         << fixed << setprecision(x)
#define itf             it->first
#define its             it->second
#define it(x)           it = x.begin(); it != x.end(); it++
#define pq_max(x)       priority_queue < x >
#define pq_min(x)       priority_queue < x, vector < x >, greater < x > >
#define ll              long long
#define nl              << "\n"
#define spc             << " "
#define pb              push_back
#define inf             0x3f3f3f3f
#define PI              3.14159265358979323846
#define E               2.71828182845904523536
#define gamma           0.5772156649
#define EPS             1e-9
#define toint(st, x)    stringstream ss(st); ss >> x
// =======Debug========//
#define watch(x)        cout << (#x) spc << x nl
//int fx[] = {1, -1, 0, 0};
//int fy[] = {0, 0, 1, -1};
const int mod=1e9+7;
const ll mxn=2e5+9;
int cases = 1;
//ll BigMod(ll n,ll power) {ll ans=1;assert(power>=0);n%=mod;while(power>0){if(power&1) ans=(ans*n)%mod;n=(n*n)%mod;power>>=1;}return ans%mod;}
//ll ModInverse(int n)  { return BigMod(n, mod - 2); }
int h, w;
char grid[1003][1003];
int dp[1003][1003];
int func(int i, int j)
{
	if(i >= h || j >= w)	return 0;
	if(grid[i][j] == '#')	return 0;
	if(i == h - 1 && j == w - 1)	return 1;
	if(dp[i][j] != -1)	return dp[i][j];
	int ways1 = func(i, j + 1);
	int ways2 = func(i + 1, j);
	return dp[i][j] = (ways1 + ways2) % mod;
}
int main()
{
	//    freopen("input.txt", "r", stdin);
    //    freopen("out.txt", "w", stdout);
    cin >> h >> w;
    for(int i = 0; i < h; i++)	for(int j = 0; j < w; j++)	cin >> grid[i][j];
    mems(dp, -1);
    int ans = func(0, 0);
    cout << ans nl;
    
    return 0;
	
}

Measured memory_bytes: 5248
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    LLONG A, V, B, W, T; cin >> A >> V >> B >> W >> T;
    if (A < B)
    {
        cout << (A + V * T >= B + W * T ? "YES\n" : "NO\n");
    }
    else
    {
        cout << (A - V * T <= B - W * T ? "YES\n" : "NO\n");
    }
}


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

int main(){
	long long M=pow(10,9);
	long long s;	cin>>s;

	printf("0 0 1000000000 1 ");
	long long x = (-s%M + M)%M;
	long long y = (s+x)/M;

	cout<<x<<" "<<y<<endl;




	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>

using namespace std;

int a[3456789];
int main() {
    int n;
    scanf("%d",&n);
    for(int i=0; i<3*n; i++) {
        scanf("%d",&a[i]);
    }
    sort(a,a+3*n,greater <int> ());
    long long s=0;
    int h=0;
    int i=1;
    while(h<n) {
        s+=a[i];
        i+=2;
        h++;
    }
    printf("%lld\n",s);
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>

using namespace std;

bool rect(vector<vector<int>> &v, int u, int d, int l, int r) {
    d++;
    r++;
    for (int i = u; i < d; i++) {
        for (int j = l; j < r; j++) {
            if (v[i][j] >= 0) return false;
        }
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> ban(h);
    vector<vector<int>> ret(h, vector<int>(w, -1));
    for (int i = 0; i < h; i++) {
        cin >> ban[i];
        for (int j = 0; j < w; j++) {
            if (ban[i][j] == '#')ret[i][j] = 0;
        }
    }

    int count = 1;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (ban[i][j] == '#') {
                int l = j;
                while (l != 0 && rect(ret, i, i, l - 1, l - 1)) l--;
                int u = i;
                while (u != 0 && rect(ret, u - 1, u - 1, l, j)) u--;
                int r = j;
                while (r + 1 < w && rect(ret, u, i, r + 1, r + 1)) r++;
                int d = i;
                while (d + 1 < h && rect(ret, d + 1, d + 1, l, r)) d++;

                for (int x = u; x <= d; x++) {
                    for (int y = l; y <= r; y++) {
                        ret[x][y] = count;
                    }
                }
                count++;
            }
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (j > 0)cout << " ";
            cout << ret[i][j];
        }
        cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 1280
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cmath>
#include<map>
#include<sstream>
#define rep(i,l,r) for (int i=l;i<=r;i++)
#define down(i,l,r) for (int i=l;i>=r;i--)
#define clr(x,y) memset(x,y,sizeof(x))
#define maxn 500500
#define inf 1152921504606846976
#define ll long long
#define mm 1000000007
#define eps 1e-9
#define low(x) x&(-x)
#define pb push_back
#define PII pair<int,int>
using namespace std;

ll read(){
    ll x=0,f=1; char ch=getchar();
    while (!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
    while (isdigit(ch)){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
int n;
int main(){
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
	n=read();
	printf("ABC%d",n);
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
	static StringBuilder sb=new StringBuilder();
	public static void main(String[] args) {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String work[]=new String[4];
		int n;
		int b;
		int f;
		int r;
		int v;
		
		int[][] one=new int[3][10];
		int[][] two=new int[3][10];
		int[][] three=new int[3][10];
		int[][] four=new int[3][10];
		
		//初期化
		for(int i=0; i<one.length; i++) {
			for(int j=0; j<one[0].length; j++) {
				one[i][j]=0;
			}
		}
		for(int i=0; i<two.length; i++) {
			for(int j=0; j<two[0].length; j++) {
				two[i][j]=0;
			}
		}
		for(int i=0; i<three.length; i++) {
			for(int j=0; j<three[0].length; j++) {
				three[i][j]=0;
			}
		}
		for(int i=0; i<four.length; i++) {
			for(int j=0; j<four[0].length; j++) {
				four[i][j]=0;
			}
		}
		
		//入力
		try {
			n=Integer.parseInt(br.readLine());
			for(int i=0; i<n; i++) {
				work=br.readLine().split("\\s+");
				b=Integer.parseInt(work[0]);
				f=Integer.parseInt(work[1]);
				r=Integer.parseInt(work[2]);
				v=Integer.parseInt(work[3]);
				
				switch(b) {
				case 1:
					one[f-1][r-1]+=v;
					checkpersons(one,f,r);
					break;
				case 2:
					two[f-1][r-1]+=v;
					checkpersons(two,f,r);
					break;
				case 3:
					three[f-1][r-1]+=v;
					checkpersons(three,f,r);
					break;
				case 4:
					four[f-1][r-1]+=v;
					checkpersons(four,f,r);
					break;
				}
			}
		}catch(Exception e) {
			e.printStackTrace();
		}
		
		//出力
		printroom(one);
		sb.append("####################");
		sb.append(String.format("%n", ""));
		printroom(two);
		sb.append("####################");
		sb.append(String.format("%n", ""));
		printroom(three);
		sb.append("####################");
		sb.append(String.format("%n", ""));
		printroom(four);
		System.out.print(sb);
		sb.append(String.format("%n", ""));
	}
	
	public static void checkpersons(int[][] checkFloor, int f, int r) {
		if(checkFloor[f-1][r-1]<0){checkFloor[f-1][r-1]=0;}
		if(checkFloor[f-1][r-1]>9){checkFloor[f-1][r-1]=9;}
	}
	
	public static void printroom(int prt[][]) {
		for(int[] temp:prt) {
			int cnt=0;
			for(int temp2:temp) {
				sb.append(" ");
				sb.append(temp2);
				cnt++;
				if(cnt%10==0) {
					cnt=0;
					sb.append(String.format("%n", ""));
				}
			}
		}
	}

}


Measured memory_bytes: 25760
N=int(input())
S=input()
K=int(input())
tmp=S[K-1]
out=[]
for i in range(N):
    if S[i]!=tmp:
        out.append("*")
    else:
        out.append(S[i])
ttt=""
for i in out:
    ttt="{}{}".format(ttt,i)
print(ttt)


Measured memory_bytes: 3060
import collections
input()
math_dic = collections.Counter((map(int,input().split())))
num = int(input())
total_num = sum([index*value for index,value in math_dic.items()])
for i in range(num):
    a,b = map(int,input().split())
    if a not in math_dic:
        print(total_num)
        continue
    if b not in math_dic:
        math_dic[b] = 0
    total_num -= a*math_dic[a]
    total_num += b*math_dic[a]
    math_dic[b] += math_dic.pop(a)
    print(total_num)

Measured memory_bytes: 22180
#include <iostream>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
	int d;
	while(cin >> d){
		int ret = 0;
		for (int i = 1; i * d < 600; ++i) ret += i*d * i*d * d;
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
x = int(input())
a = input().split()
list(map(int, a))
c = 100
d = 100
cange = 0
f = 0
for i in range(x):
  f += int(a[i]) 
  
b = f / x

for i in range(x):
    if abs(b - int(a[i])) < d :
        d = abs(b - int(a[i]))
        e = i
        cange = 1
if cange:
	print(e)
else:
    print(0)
  



Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>


using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e15;
const int MB = 20;
const int MOD = 1e9 + 7;

void solve() {
    string s;
    cin >> s;
    int n = s.size();
    vector<int> dp(n);
    int sum = 0;
    vector<int> suff(n);
    suff[n - 1] = 1;
    for (int i = n - 2; i >= 0; i--) {
        suff[i] = suff[i + 1];
        if (s[i + 1] == '?') suff[i] = suff[i] * 3 % MOD;
    }
    vector<int> pref(n);
    pref[0] = 1;
    for (int i = 1; i < n; i++) {
        pref[i] = pref[i - 1];
        if (s[i - 1] == '?') pref[i] = pref[i] * 3 % MOD;
    }
    for (int i = 0; i < n; i++) {
        int x = dp[i];
        if (s[i] == 'B' || s[i] == '?') dp[i] = sum;
        if (s[i] == '?') sum = sum * 3 % MOD;
        if (s[i] == 'A' || s[i] == '?') sum = (sum + pref[i]) % MOD;
    }

    
    sum = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int x = dp[i];
        if (s[i] == 'C' || s[i] == '?') ans = (ans + sum * suff[i]) % MOD;
        if (s[i] == '?') sum = sum * 3 % MOD;
        if (s[i] == 'B' || s[i] == '?') sum = (sum + x) % MOD;
    }

    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //int t;
    //cin >> t;
    int t = 1;
    srand(time(0));
    while (t--) solve();
}

Measured memory_bytes: 2896
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, k;
long long ans;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	for (int i = k; i <= n + 1; i++) {
		long long t1 = (0 + i - 1) * 1LL * i / 2;
		long long t2 = (n - i + 1 + n) * 1LL * i / 2;
		ans += t2 - t1 + 1;
		ans %= MOD;
	}
	cout << ans << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 3648