akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = INT64_MAX;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i=0;i<N;i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,x;
Vi l;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n>>x;
    l.resize(n);
    rep(i,n)cin>>l[i];
    ll ans = 1;
    ll tmp = 0;
    rep(i,n){
        if(tmp+l[i]<=x){
            ans++;
            tmp += l[i];
        }else{
            break;
        }
    }
    print(ans);
    return 0;
}


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


int main() {
string s;
long K;
cin>>s>>K;
long n=s.size();
string ans="";
for(int i=0;i<n;i++){
  if(K>=('z'-s[i]+1)&&s[i]!='a'){
    K-=int('z'-s[i]+1);
    s[i]='a';
  }

}
s[n-1]+=K%26;
//cout<<K<<endl;
cout<<s<<endl;
}


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

using namespace std;

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

    int W[N];
    int sum = 0;
    for (int i = 0; i < N; ++i) {
        cin >> W[i];
        sum += W[i];
    }

    int partial = 0;
    int ans = sum;
    for (int i = 0; i < N; ++i) {
        partial += W[i];
        ans = min(ans, abs(partial - (sum - partial)));
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef pair<int,int> P;
const int inf = 1e9;
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = 1;i <= n;i++)

int used[100000];

int calc(int k, vector<P> x, int f, int a, int b){
	int n = x.size();
	for(int i = 0;i < n;i++){
		if(x[0].fi+k < x[i].fi){
			int u = x[i].se;
			if(x[i].fi+k < x[n-1].fi)return 0;
			if(used[u] == b)return 0;
			if(f)used[u] = a;
		}
	}
	for(int i = n-1;i >= 0;i--){
		if(x[i].fi+k < x[n-1].fi){
			int u = x[i].se;
			if(used[u] == a)return 0;
			if(f)used[u] = b;
		}
	}
	return 1;
}

vector<P> x, y;
int solve(int k){
	int t[3] = {}; 
	t[0] = calc(k, x, 1, 1, 2);
	t[1] = calc(k, y, 0, 1, 2);
	t[2] = calc(k, y, 0, 2, 1);
	//printf("%d %d %d\n", t[0], t[1], t[2]);
	if(t[0] == 0)return 0;
	if(t[1] || t[2])return 1;
	return 0;
}

int main(){
	int n, a, b;
	
	scanf("%d", &n);
	for(int i = 0;i < n;i++){
		scanf("%d%d", &a, &b);
		x.push_back(P(a+b, i));
		y.push_back(P(b-a, i));
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	
	
	int lb = 0, ub = inf;
	while(ub-lb > 1){
		fill(used, used+100000, 0);
		int mid = (lb+ub)/2;
		int res = solve(mid);
		if(res)ub = mid;
		else lb = mid;
	}
	
	printf("%d\n", ub);
	return 0;
}



Measured memory_bytes: 5776
def check(A,b):
    for raw in range(3):
        for colomn in range(3):
            if A[raw][colomn] == b:
                A[raw][colomn] = -1
                return
    return

A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
is_bingo = 'No'
for _ in range(N):
    b = int(input())
    check(A,b)

for raw in range(3):
    if A[raw][0] + A[raw][1] + A[raw][2] == -3:
        is_bingo = 'Yes'

for colomn in range(3):
    if A[0][colomn] + A[1][colomn] + A[2][colomn] == -3:
        is_bingo = 'Yes'

if A[0][0] + A[1][1] + A[2][2] == -3:
    is_bingo = 'Yes'
if A[0][2] + A[1][1] + A[2][0] == -3:
    is_bingo = 'Yes'

print(is_bingo)

Measured memory_bytes: 3064
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<int, int>
const ll  MOD = 1000000007;

int main() {
	ll n, d;
	cin >> n >> d;
	vector<vector<double>> x(n);
	rep(i, n) {
		rep(j, d) {
			double y;
			cin >> y;
			x.at(i).push_back(y);
		}
	}
	vector<double> len;
	rep(i, n - 1) {
		reps(j, i + 1, n) {
			double s = 0;
			rep(k, d) {
				s += pow((x.at(i).at(k) - x.at(j).at(k)), 2);
			}
			len.push_back(sqrt(s));
		}
	}
	ll ans = 0;
	rep(i, len.size()) {
		int l = len.at(i);
		if (len.at(i) == l) ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
// string a,b;
int dp[1004][1004] = {0};
string  a[1004];

int  solve(int H,int W)
{

	dp[0][0] = a[0][0]=='.'?1:0;
	for(int i=1;i<W;i++)
	{
		if(a[0][i]=='.')
		dp[0][i] = dp[0][i-1];
		else dp[0][i] = 0;
	}
	for(int j=1;j<H;j++)
	{
		if(a[j][0]=='.')
		dp[j][0] = dp[j-1][0];
		else dp[j][0] = 0;
	}

	for(int i=1;i<H;i++)
	{
		for(int j=1;j<W;j++)
		{
			if(a[i][j]=='.'){

				dp[i][j] = (dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
			}
			else dp[i][j] = 0;
		}
	}
	// for(int i=0;i<H;i++)
	// {
	// 	for(int j=0;j<W;j++)
	// 	{
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<"\n";
	// }
	return dp[H-1][W-1];
}
int main()
{
	int t;
	t = 1;
	while(t--)
	{
		int H,W;
		cin>>H>>W;
		// int a[H][W];
		for(int i=0;i<H;i++)
		{
			cin>>a[i];
		}
		cout<<solve(H,W)<<"\n";		

	}

}


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

#define PrintLn(X) cout << X << endl
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)

int H, W;
char m[100][100];

int sub(int h, int w)
{
	if(h < 0) return 0;
	if(w < 0) return 0;
	if(h >= H) return 0;
	if(w >= W) return 0;
	if(m[h][w] == '#') return 1;
	return 0;
}

int count(int h, int w)
{
	int res = 0;
	Rep(i, 3){
		Rep(j, 3){
			if(i != 1 || j != 1){
				res += sub(h + i - 1, w + j - 1);
			}
		}
	}
	return res;
}

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

	Rep(h, H) cin >> m[h];

	Rep(h, H){
		Rep(w, W){
			if(m[h][w] == '.'){
				m[h][w] = count(h, w) + '0';
			}
		}
	}
	Rep(h, H) PrintLn(m[h]);
	return 0;
}


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

using namespace std;

#define FOR(i,f,t) for(int i=(int)f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=(int)f; i>(int)t; i--)
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define pb push_back
#define SYNC ios_base::sync_with_stdio(false)
#define st(v) sort(v.begin(),v.end());
#define F first
#define S second
#define ri(x) scanf("%d",&x)
#define rii(x,y) scanf("%d %d",&x,&y)
#define riii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define lri(x) scanf("%lld",&x)
#define lrii(x,y) scanf("%lld %lld",&x,&y)
#define lriii(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 5e5; //AREGLAAAAAAAAR!!!!
int a[MAXN],b[MAXN];
int main(){
	int n,k;
	rii(n,k);
	FOR(i,0,n) ri(a[i]);
	int cnt = 1;
	FOR(i,k-1,n-1){
		i+=(k-2);
		cnt++;
	}
	printf("%d\n",cnt);
}


Measured memory_bytes: 640
n=int(input())
a=list(map(int,input().split()))

a=sorted(a,reverse=True)
if n==2:
    print(max(a))
    exit(0)

ans=a[0]
a=a[1:]
from math import floor

for i in range(n-2):
    index=floor(i/2)
    ans+=a[index]

print(ans)

Measured memory_bytes: 31508
#include<bits/stdc++.h>
#define mo 998244353
#define ll long long
#define N 100010
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
int n,a[N],g[N];
ll an;
int main(){
	cin>>n;
	for (int i=1;i<=n;i++){cin>>a[i];g[a[i]]++;}
	if (a[1]==0&&g[0]==1)an=1;
	for (int i=1;i<=n;i++){
		for (int j=1;j<=g[i];j++)an=an*g[i-1]%mo;
	}
	cout<<an<<endl;
	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int n = getInt();
        int[] A = new int[n];
        for(int i = 0; i < n; i++) A[i] = getInt();
        int m = getInt();
        for(int i = 0; i < m; i++) {
            int q = getInt();
            String ans = "no";
            for(int j = 0; j < (1 << n); j++) {
                int sum = 0;
                for(int k = 0; k < n; k++) {
                    sum += A[k] * ((j >> k) & 1);
                }
                if(sum == q) {
                    ans = "yes";
                    break;
                }
            }
            System.out.println(ans);
        }
    }

    static int getInt() {
        return Integer.parseInt(sc.next());
    }
}



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


int main(){
    int n;

    scanf("%d",&n);

    if(n%2==0){
        printf("%f\n",(float)1/2);
    }else if(n==1){
        printf("%f\n",(float)1/1);
        
    }else{
        printf("%f\n",(float)((n/2)+1)/n);
    }



    return 0;
}

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

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  swap(x, y);
  swap(x, z);
  printf("%d %d %d\n", x, y, z);
  // cin >> x >> y >> z;
  // cout << z << " "<< x << " " << y << endl;
  return 0;
};

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

using namespace std;

typedef long long ll;

int main(){

    ll N, M;

    cin >> N >> M;

    if(N == 1 && M == 1) cout << "1" << endl;
    else if(N == 1) cout << M-2 << endl;
    else if(M == 1) cout << N-2 << endl;
    else cout << (N-2)*(M-2) << endl;
 
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
int n, k;
string s;
int sum[maxn];
int main() {
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
    while(cin >> n >> k >> s) {
//        printf("k = %d\n", k);
        memset(sum, 0, sizeof(sum));
        int cnt1 = 0, cnt0 = 0, num = 0;
        vector<int> v, v1;
        //if(s.front() == '0') v.push_back(0);
        for(int i = 0; i < s.size(); ++i) {
            if(s[i] == '1') {
                ++cnt1;
                if(cnt0 == 0) continue;
                v.push_back(-cnt0); ++num;
                cnt0 = 0;
            }
            else {
                ++cnt0;
                if(cnt1 == 0) continue;
                v.push_back(cnt1);
                cnt1 = 0;
            }
        }
        if(cnt1) v.push_back(cnt1);
        if(cnt0) v.push_back(-cnt0), ++num;
        for(int i = 1; i <= v.size(); ++i) {
            sum[i] = sum[i-1] + abs(v[i-1]);
//            printf("sum = %d\n", sum[i]);
        }
        sum[v.size()+1] = sum[v.size()];
        if(k >= num) cout << s.size() << endl;
        else {
            int a = v.front(), b = v.back();
            int l = 1, r = v.size();
            if(a < 0) l--;
            if(b < 0) r++;
//            printf("l = %d, r = %d\n", l, r);
//            printf("k = %d\n", k);
            int len = 2*k + 1;
//            printf("len = %d\n", len);
            int ans = 0, cur;
            for(int i = l; i + len <= r+1; i+=2) {
                if(i == 0) cur = sum[i + len-1];
                else cur = sum[i + len-1] - sum[i-1];
//                printf("cur = %d\n", cur);
                ans = max(ans, cur);
            }
            cout << ans << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 1404
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9) + 7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n)
{
	vector<pair<ll, ll>> p;
	for (ll i = 2; i * i <= n; i++)
	{
		if ((n % i) != 0)
			continue;
		pair<ll, ll> a = make_pair(i, 0);
		while ((n % i) == 0)
		{
			n /= i;
			a.second += 1;
		}
		p.push_back(a);
	}

	if (n != 1)
		p.push_back(make_pair(n, 1));
	return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a)
{
	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;
}
// 順列
ll permutation(const ll n, const ll m)
{
	ll result = 1;
	for (ll i = n; i > n - m; i--)
	{
		result = (result * i) % MOD;
	}
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x)
{
	if (x == 0)
		return 1;
	ll res = repeat_square(n, x / 2);
	res = res * res % MOD;
	if ((x % 2) == 1)
		res = res * n % MOD;
	return res;
}
// 組み合わせ nCm
ll combination(ll n, ll m)
{
	ll p = permutation(n, m);
	ll div = 1;
	for (ll i = 2; i <= m; i++)
	{
		div = (div * i) % MOD;
	}
	return (p * modinv(div)) % MOD;
}

int main() {
	int H, W, N;
	cin >> H >> W >> N;
	vector<int> a(N);
	rep(i, N) cin >> a[i];

	vector<int> s(H*W, 0);

	int idx = 0;
	rep(i, N) {
		rep(j, a[i]) {
			s[idx] = i+1;
			idx++;
		}
	}

	bool is_return = false;
	rep(i, H) {
		rep(j, W) {
			if (is_return) {
				cout << s[i*W + (W-1) - j] << " ";
			} else {
				cout << s[i*W + j] << " ";
			}
		}
		is_return = !is_return;
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		StringBuffer sb = new StringBuffer();
		
		String string = sc.nextLine();
		String[] strings = string.split(" ");

		for(int i = 0; i < strings.length; i++) {
			sb.append(strings[i].substring(0, 1));
		}
		
		System.out.println(sb);
	}

}

Measured memory_bytes: 35608
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> L(N, 0);
    for (int i = 0; i < N; i++)
        cin >> L[i];
    
    sort(L.begin(), L.end());

    int ans = 0;
    for (int i = 0; i < N-2; i++) {
        for (int j = i+1; j < N-1; j++) {
            for (int k = j+1; k < N; k++) {
                if ((L[i] + L[j] > L[k]) && L[i] != L[j] && L[i] != L[k] && L[j] != L[k])
                    ans++;
            }
        }
    }

    cout << ans << endl;
}

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

string S;

int main() {
  cin >> S;
  int cnt = 0;
  int N = S.size();
  for(int i=0; i<N/2; i++) {
    if(S[i] != S[N-1-i]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#define int long long
using namespace std;

bool dp_l[5001][5001] = {false};	//dp_l[i][j] = 左からi枚目までで部分和iを作れるか？
bool dp_r[5001][5001] = {false};	//dp_r[i][j] = 右からi枚までで部分和jを作れるか？
int n, k;
int a[5000];

signed main() {
	int i, j;
	
	cin >> n >> k;
	for (i = 0; i < n; i++) { cin >> a[i]; }
	
	dp_l[0][0] = true;
	for (i = 0; i < n; i++) {
		for (j = 0; j <= k; j++) {
			if (!dp_l[i][j]) continue;
			dp_l[i + 1][j] = true;
			if (j + a[i] <= k) {
				dp_l[i + 1][j + a[i]] = true;
			}
		}
	}
	
	dp_r[0][0] = true;
	for (i = 0; i < n; i++) {
		for (j = 0; j <= k; j++) {
			if (!dp_r[i][j]) continue;
			dp_r[i + 1][j] = true;
			if (j + a[n - 1 - i] <= k) {
				dp_r[i + 1][j + a[n - 1 - i]] = true;
			}
		}
	}
	
	int ans = n;
	
	for (i = 0; i < n; i++) {
		vector<int> u, v;
		
		for (j = 0; j <= k; j++) {
			if (dp_l[i][j]) {
				u.push_back(j);
			}
			if (dp_r[n - 1 - i][j]) {
				v.push_back(j);
			}
		}
		
		for (j = 0; j < u.size(); j++) {
			int low =  k - a[i] - u[j];
			int high = k - u[j];
			
			vector<int>::iterator it = lower_bound(v.begin(), v.end(), low);
			if (it == v.end()) { continue; }
			
			int value = (*it);
			
			if (value < high) {
				break;
			}
		}
		if (j < u.size()) {
			ans--;
		}
	}
	
	cout << ans << endl;
	return 0;
}

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

int const N = 3e5+1;
int main(){
    int a[5] , fr[N] = {}; 
    for(int i=0;i<4;++i){cin >> a[i];++fr[a[i]];}
   if(fr[7] && fr[4] && fr[1] && fr[9])return puts("YES"),0;
   puts("NO");
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define PUTS(x) cout << (x) << endl;
using namespace std;
int main() {
    int n, m;
    cin >> n >> m;
    auto ans = 1;
    auto divisors = set<int>();
    for (int i = 1; i * i <= m; i++) {
        auto q = m / i;
        auto r = m % i;
        if (r == 0) {
            divisors.insert(i);
            divisors.insert(q);
        }
    }
    for (auto i : divisors) {
        auto q = m / i;
        auto r = m % i;
        if (r == 0 && q >= n) ans = i;
        if (q < n) break;
    }
    PUTS(ans);
}


Measured memory_bytes: 256
h,w,k = map(int,input().split())
s = [[] for _ in range(h)]
for i in range(h):
    s[i] = input()
    
a = [[0]*w for _ in range(h)]

strno = 1
for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            a[i][j] = strno
            strno += 1
            
for i in range(h):
    for j in range(w-1):
        if a[i][j+1] == 0:
            a[i][j+1] = a[i][j]
for i in range(h):
    for j in range(w-1):
        if a[i][w-j-2] == 0:
            a[i][w-j-2] = a[i][w-j-1]
            
for i in range(h-1):
    for j in range(w):
        if a[i+1][j] == 0:
            a[i+1][j] = a[i][j]
for i in range(h-1):
    for j in range(w):
        if a[h-i-2][j] == 0:
            a[h-i-2][j] = a[h-i-1][j]
            
for i in a:
    print(*i)

Measured memory_bytes: 48348
#include <cstdio>
#include <iostream>

using namespace std;

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

	cin >> a >> b >> c;

	if (a < b && b < c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 1116
#include <iostream>

int main() {

    int n, m, x;

    std::cin >> n;
    std::cin >> m;
    std::cin >> x;

    int	tmp, g = 0, l = 0;

    int i;

    for (i = 0; i < m; i++) {
        std::cin >> tmp;
        if (tmp > x) g++;
        else l++;
    }

    if (g < l)	
        std::cout << g << std::endl;
    else
        std::cout << l << std::endl;

    return 0;

}

Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
li = LI()
li.sort()
print(li[0]*li[1]//2)

Measured memory_bytes: 3896
// code.begin();
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back 
#define what_is(x) cerr<<#x<<" is "<<x<<endl;
#define print(v) for(auto i:v) cout<<i<<" ";cout<<endl;
#define my_time ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long 
#define endl "\n"
#define MOD 1000000007
const long long int INF=1e18;
#define mod 1000000007
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    ordered_set; 
//find_by_order(x)
//order_of_key(x)  


int power(int x,unsigned int y)
{
    int res=1;
    
    while(y>0)
    {
        // if y is odd multiply with result
        if(y&1)
        res=res*x;
        
        y=y>>1; // y=y/2;
        x=x*x;
        
    }
    return res;
}

int gcd(int a,int b)
{
    if(b==0)
    return a;
    
    return gcd(b,a%b);
}

ll  max3(ll  a, ll  b, ll c)
{
    return max(c, max(a, b));
}
int min3(int a, int  b, int  c)
{
    return min(a, min(b, c));
}

int  powermod(int  x, int  y, int p )
{
    int res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int logg(int  a)
{
    int  x = 0;
    while (a > 1)
    {
        x++;
        a /= 2;
    }
    return x;
}


int modinv(int x)
{
    return powermod(x, mod - 2, mod);
}



int  main(){
	my_time;

int t;
t=1;
//cin>>t;int test=0;
while(t--)
{
    int n;
    cin>>n;
    
    
    int arr[n][3];  int dp[n][3];
    
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>arr[i][j];
            dp[i][j]=0;
        }
        
    }
    
  
    dp[0][0]=arr[0][0];
    dp[0][1]=arr[0][1];
    dp[0][2]=arr[0][2];
    for(int i=1;i<n;i++)
    {
       
    
            dp[i][1]=arr[i][1]+max(dp[i-1][0],dp[i-1][2]);
            dp[i][0]=arr[i][0]+max(dp[i-1][1],dp[i-1][2]);            
            dp[i][2]=arr[i][2]+max(dp[i-1][0],dp[i-1][1]);      
       
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}
    return 0;
}


//code.end();





Measured memory_bytes: 5932
import java.awt.*;
import java.util.Scanner;
 
public class Main{
  public static void main(String[] args){
  String str1,str2;
  Scanner scan=new Scanner(System.in);
  str1=scan.next();
  str2=scan.next();
  String str12=str2.concat(str1);
  System.out.println(str12);
  scan.close();
}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
 
 
 
int main(){
    int N,M;
    int X[100100];
    int Y[100099];
    cin >> N >> M;
    for (int i = 0; i < M; ++i) cin >> X[i];

    sort(X, X + M, greater<int>());
    for (int i = 0; i < M - 1; ++i){
      Y[i] = X[i] - X[i + 1];
    }
    
    sort(Y, Y + M - 1, greater<int>());
    int ans = 0;
    if (N > M){cout << 0 << endl;}
    else{
    for (int i = N - 1 ; i < M - 1; ++i){
      ans = ans + Y[i];}
    
    cout << ans << endl;}
  }
 

Measured memory_bytes: 1024
//ITP1_3_D

    using System;
    using System.Collections.Generic;
    /*using System.Linq;
    using System.Text;
    using System.Threading.Tasks;*/

    class Program {
        static void Main(string[] args)
        {
            //?????????????????????????????????int??????iaaray????????????????????\

            int[] iarray = Array.ConvertAll<string, int>((Console.ReadLine().Split(' ')), delegate (string value)
            {
                return int.Parse(value);
            });

            int count = 0;

            for(int i = iarray[0]; i <= iarray[1]; i++)
            {
                if ((iarray[2] % i) == 0)
                    count++;
            }

            Console.WriteLine(count);
        }
    }

Measured memory_bytes: 9128
use std::io::Read;
use std::io::Write;

fn run() {
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    it.next();
    let a = it.next().unwrap();
    let b = it.next().unwrap();
    for (a, b) in a.chars().zip(b.chars()) {
        write!(out, "{}{}", a, b).ok();
    }
    writeln!(out, "").ok();
}

fn main() {
    run();
}

Measured memory_bytes: 4352
H, W = map(int, input().split())
S = [input() for i in range(H)]
 
def check(l):
    u = [0]*W
    mid = W % 2
    for i in range(W):
        if u[i]:
            continue
        for j in range(i+1, W):
            for p, q in l:
                sp = S[p]; sq = S[q]
                if sp[i] != sq[j] or sp[j] != sq[i]:
                    break
            else:
                u[j] = 1
                break
        else:
            if mid:
                for p, q in l:
                    sp = S[p]; sq = S[q]
                    if sp[i] != sq[i]:
                        break
                else:
                    mid = 0
                    continue
            break
    else:
        return 1
    return 0
 
def make(c, l, u, p):
    while c in u:
        c += 1
    if c == H:
        if check(l):
            print("YES")
            exit(0)
        return
    if p:
        l.append((c, c))
        make(c+1, l, u, 0)
        l.pop()
    for i in range(c+1, H):
        if i in u:
            continue
        u.add(i)
        l.append((c, i))
        make(c+1, l, u, p)
        l.pop()
        u.remove(i)
 
make(0, [], set(), H%2)
print("NO")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
 string s;
  cin >> s;
  ll k;
  cin >> k;
 if(k <= s.size()){
   int count=0;
   rep(i,k){
     if(s.at(i)=='1'){
       count++;
     }
     if(s.at(i)!='1'){
       break;
     }
   }
   if(count==k) cout << 1 << endl;
   else cout << s.at(count) << endl;
 }
  else{
    int count=0;
    rep(i,100){     
     if(s.at(i)=='1'){
       count++;
     }
     if(s.at(i)!='1'){
       break;
     }
   }
    cout << s.at(count) << endl;
 }
     
 
  
     
}

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

using namespace std;

using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< int > A(N + 1);
  for(int i = 1; i <= N; i++) cin >> A[i];
  vector< int > tap(N + 1);
  for(int i = N; i >= 1; i--) {
    bool f = A[i];
    for(int j = i; j <= N; j += i) {
      f ^= tap[j];
    }
    tap[i] = f;
  }
  vector< int > p;
  for(int i = 0; i <= N; i++) {
    if(tap[i]) p.emplace_back(i);
  }
  cout << p.size() << endl;
  for(auto &t : p) cout << t << endl;
}







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

int main()
{
    const double PI = acos(-1.0);
    double a, b, h, m;
    cin >> a >> b >> h >> m;

    double r_h = 30.0*h + 30.0/60.0*m;
    double r_m = 6*m;
    double r = abs(r_h - r_m);
    if (r > 180.0) {
        r = 360.0 - r;
    }

    double theta = r / 180.0 * M_PI;

    double ans = sqrt(a*a + b*b - 2.0*a*b*cos(theta));

    cout << std::fixed << std::setprecision(20) << ans << endl;
}


Measured memory_bytes: 4216
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

constexpr int64_t MOD = 1'000'000'007;
constexpr int     MAX =       200'005;

int64_t fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
int64_t COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void) {
    int n;
    cin >> n;
    vector<int> a(n+1);
    vector< vector<int> > pos(n);
    for(int i=0; i<n+1; i++) {
        cin >> a[i];
        --a[i];
        pos[a[i]].emplace_back(i);
    }

    int l, r;
    for(int i=0; i<n; i++) {
        if(pos[i].size() == 2) {
            l = min(pos[i][0], pos[i][1]);
            r = n - max(pos[i][0], pos[i][1]);
        }
    }

    COMinit();
    for(int k=1; k<=n+1; k++) {
        int64_t ans = COM(n+1, k) - COM(l+r, k-1);
        if(ans < 0) ans += MOD;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 11776
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<int,pi> pii;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    int ans = 0;
    int b[]={0,1,2};
    do {
        ans = max(ans,a[b[0]]*10+a[b[1]]+a[b[2]]);
    } while (next_permutation(b,b+3));
    cout<<ans;
}


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

  int n;
   int e;
  scanf("%d",&n);
  for(int i=1;i<=n;i++)
  {
    scanf("%d",&e);
    s.insert(e);
  }
  if(s.size()==n)
  {
    printf("YES");
  }
  else
  {
    printf("NO");
  }
  return 0;
}



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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

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

    int H,W;
    while(cin>>H>>W, H || W){
        vector<vector<int>> e(H,vector<int>(W));
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                cin>>e[i][j];
            }
        }
        int res=0;
        for(int h=1;h<=H-2;h++){
            for(int w=1;w<=W-2;w++){
                for(int sx=1;sx<=H-1-h;sx++){
                    for(int sy=1;sy<=W-1-w;sy++){
                        int hmin=INF, pmax=0;
                        for(int i=sx-1;i<=sx+h;i++){
                            for(int j=sy-1;j<=sy+w;j++){
                                if(sx<=i && i<=sx+h-1 && sy<=j && j<=sy+w-1){
                                    pmax=max(pmax, e[i][j]);
                                }
                                else{
                                    hmin=min(hmin, e[i][j]);
                                }
                            }
                        }
                        if(hmin<=pmax) continue;
                        int sum = 0;
                        for(int i=sx;i<=sx+h-1;i++){
                            for(int j=sy;j<=sy+w-1;j++){
                                sum += hmin-e[i][j];
                            }
                        }
                        res=max(res,sum);
                    }
                }
            }
        }
        cout<<res<<endl;
    }
}



Measured memory_bytes: 3156
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int4(r, w, c, l);
    if(!(r | w | c | l))break;
    for(i = 0;;++i)if((r + i * l) / w >= c)break;
    pri(i);

//*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 3156
import java.util.Scanner;

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

        int N = sc.nextInt();

        System.out.println(solve(N));

        sc.close();
    }

    static int solve(int N) {
        int root = 0;
        while ((root + 1) * (root + 1) <= N) {
            ++root;
        }

        return root * root;
    }
}

Measured memory_bytes: 21972
mod = 1000000007
fact = []
fact_inv = []
pow_ = []
pow25_ = []
pow26_ = []

def pow_ini(nn):
	global pow_
	pow_.append(nn)
	for j in range(62):
		nxt = pow_[j] * pow_[j]
		nxt %= mod
		pow_.append(nxt)
	return

def pow1(k):
	ansk = 1
	for ntmp in range(62):
		if((k >> ntmp) % 2 == 1):
			ansk *= pow_[ntmp]
			ansk %= mod
	return ansk

def fact_ini(n):
	global fact
	global fact_inv
	global pow_
	fact = [0] * (n+1)
	fact_inv = [0] * (n+1)
	fact[0] = 1
	for i in range(1, n + 1, 1):
		fact_tmp = fact[i - 1] * i
		fact_tmp %= mod
		fact[i] = fact_tmp
	pow_ini(fact[n])
	fact_inv[n] = pow1(mod - 2)
	for i in range(n - 1, -1, -1):
		fact_inv[i] = fact_inv[i + 1] * (i + 1)
		fact_inv[i] %= mod
	return

def nCm(n, m):
	ans = fact[n] * fact_inv[m]
	ans %= mod
	ans *= fact_inv[n - m]
	ans %= mod
	return ans;

fact_ini(2200000)
K = int(input())
S = input()
N = len(S)
ans = 0

ans25=[1] * (K+11)
ans26=[1] * (K+11)

for k in range(K+10):
	ans25[k+1] = ans25[k] * 25
	ans26[k+1] = ans26[k] * 26
	ans25[k+1] %= mod
	ans26[k+1] %= mod

for k in range(0, K+1, 1):
	n = N + K - k
	anstmp = 1
	anstmp *= ans26[k]
	anstmp %= mod
	anstmp *= nCm(n - 1, N - 1)
	anstmp %= mod
	anstmp *= ans25[n - N]
	anstmp %= mod
	ans += anstmp
	ans %= mod
print(ans)

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

int main()
{
    string s;
    cin >> s;
    string ans = "No";
    if(s[2]==s[3] && s[4]==s[5]) ans="Yes";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/* Generated by cf-tool.
 * You can download the binary file in here: 
 * https://github.com/xalanq/cf-tool (Windows, macOS, Linux)
 * Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/

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

template <typename T = double>
using point = complex<T>; // 2D point only

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

using ii = pair<int,int>;
using iii = pair<int, ii>;
using ii_i = pair<ii, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using viii = vector<iii>;
template <typename T = int>
using lim = numeric_limits<T>;

#ifdef _DEBUG
#define debug_text(...) printf(__VA_ARGS__)
#else
#define debug_text(...) /* --- NOTHING --- */
#endif

#define re real()
#define im imag()
#define fi first
#define se second
#define sz(v) (v).size()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

// OST
template <typename T>
using ordered_set = __gnu_pbds::tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// from: https://codeforces.com/blog/entry/62393
// struct custom_hash {
// 	static uint64_t splitmix64(uint64_t x) {
// 		// http://xorshift.di.unimi.it/splitmix64.c
// 		x += 0x9e3779b97f4a7c15;
// 		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
// 		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
// 		return x ^ (x >> 31);
// 	}

// 	size_t operator()(uint64_t x) const {
// 		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
// 		return splitmix64(x + FIXED_RANDOM);
// 	}
// };

const int INF = ~(1<<31);
const ll LINF = (1LL << 60);
const long double EPS = 1e-9;
const long double PI = acos(-1);

const int N = 2005;
const int M = 1 << 19;
const int MOD = 1e9+7; // 998244353;
const int MOD2 = 1e9+9;
const int IMAX = 1e9+7;
const ll LMOD = 1LL << 59;
const ll LMAX = 1e16+7;
const ll P = 131;
const ll P2 = 151;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};
const int dx8[8] = {-1,-1,-1,0,0,1,1,1};
const int dy8[8] = {-1,0,1,-1,1,-1,0,1};

ll s, dp[N];

ll solve(int x) {
	if (x == 0)
		return 1;
	if (x < 3)
		return 0;
	ll &ans = dp[x];
	if (ans != -1)
		return ans;
	ans = 0;
	for (int i = 3; i <= x; ++i) {
		(ans += solve(x-i)) %= MOD;
	}
	return ans;
}

void solution() {
	cin >> s;
	cout << solve(s) << endl;
}

void pregen() {
	
}

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

int main () {
	ios_base::sync_with_stdio(false); cin.tie(0); // cout.tie(0);
	// cout.precision(2); cout << fixed;

	int T = 1;
	// cin >> T;
	pregen();
	for (int i = 1; i <= T; ++i) {
		prepare();
		solution();
	}

	return 0;
}

Measured memory_bytes: 3616
//JSD
#include<iostream>
#include<vector>
#include<set>
#include<cmath>
#include<cstring>
#define ll long long 
using namespace std;
int main(){
	ll n,k;
	cin>>n>>k;
	if(n%k==0){
		cout<<"0\n";
	}
	else{
		cout<<1<<"\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	if(n==0){
		cout << 0;
		return 0;
	}
	vector<ll>a;
	while(n!=0){
		ll sho=0;
		if(n<0){
			ll N=abs(n);
			sho=(N+2-1)/(2);
			a.push_back(n+2*sho);
			n=sho;
		}
		else{
			sho=n/2;
			a.push_back(n%2);
			//cout << n%2;
			n=-1*sho;
		}
	}
	reverse(a.begin(),a.end());
	for(auto itr=a.begin();itr!=a.end();itr++){
		cout << *itr;
	}
	// your code goes here
	return 0;
}

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

int main(){
    string s[3];
    cin >> s[0] >> s[1] >> s[2];
    ll head[3] = {0, 0, 0};
    ll next = 0;
    while(true){
        if(head[next] == s[next].size()){
            cout << (char)(next + 'A') << endl;
            break;
        }
        ll cp = s[next][head[next]] - 'a';
        head[next]++;
        next = cp;
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  string S;
  cin >> S;

  rep(i, S.size()) { cout << "x"; }
  return 0;
}


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

using namespace std;

int main(){
    while(1){
        int px = 0, py = 0,t = 0; 
        int h,w; cin >> h >> w;
        if(!h&&!w) break;
        string cell[55];

        for(int i = 0; i < h; i++){
            cin >> cell[i];
        }

        string str; cin >> str ;

        for(int x = 0; x < str.length(); x++){
            for(int j  = 0; j < h; j++){
                int find = 0;
                for(int i = 0; i < w; i++){
                    if(cell[j][i] == str[x]){
                        t += abs(j - py) + abs(i - px) + 1;
                        px = i;
                        py = j;
                        find = 1;
                        break;
                    }
                }
                if(find) break;
            }
        }

        cout << t << endl;

    }
    return 0;
}



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

using namespace std;

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

int n,D[100001];
std::string st;

int main() {
	std::cin >> n;
	std::cin >> st;
	int res = 1;
	char cur = st[0]; 
	For(i,1,n - 1) 
	  if (cur != st[i])
	{
	  
      res++;
      cur = st[i];
	}
	
	cout << res;

	return 0;
}

Measured memory_bytes: 512
from numpy import zeros, maximum, int32

def main():
    N, T, *AB = map(int, open(0).read().split())

    dp = zeros(6010, int32)
    for w, v in sorted(zip(*[iter(AB)] * 2)):
        dp[w:T + w] = maximum(dp[w:T + w], dp[:T] + v)

    print(dp.max())

main()


Measured memory_bytes: 12728
#include<bits/stdc++.h>
using namespace std;
char a[3005],b[3005];int f[3005][3005],l1,l2,fa[3005][3005];
void print(int x,int y)
{
    if(x<1||y<1) return;
    if(fa[x][y]==1) print(x-1,y);
    else if(fa[x][y]==2) print(x,y-1);
    else print(x-1,y-1),putchar(a[x]);
}
int main()
{
    scanf("%s%s",a+1,b+1);
    l1=strlen(a+1);l2=strlen(b+1);
    for(int i=1;i<=l1;i++)
    for(int j=1;j<=l2;j++)
    {
        if(a[i]==b[j]) f[i][j]=f[i-1][j-1]+1,fa[i][j]=3;
        else {if(f[i-1][j]>f[i][j-1]) f[i][j]=f[i-1][j],fa[i][j]=1;
        else f[i][j]=f[i][j-1],fa[i][j]=2;}
    }
    int a=f[l1][l2];
    print(l1,l2);
    return 0;
}

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

#define LL long long
const int N = 1e5 + 5;
int n, m, l, r, w;
vector<pair<LL, LL>> g[N];
LL d[N]; bool vis[N];

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    cin >> n >> m;
    while(m--) {
        cin >> l >> r >> w;
        g[l].push_back({r, w});
    }   
    for(int i = 1; i <= n; i++) d[i] = 4e18;
    for(int i = 2; i <= n; i++) g[i].push_back({i-1, 0});
    d[1] = 0;
    priority_queue<pair<LL, LL>, vector<pair<LL,LL>>, greater<pair<LL,LL>>> q;
    q.push({0, 1});

    while(!q.empty()) {
        pair<LL, LL> z = q.top();
        q.pop();
        if(z.second == n) {
            cout << z.first;
            return 0;
        }

        if(vis[z.second]) continue;
        vis[z.second] = 1;
        for(auto i : g[z.second]) {
            if(d[i.first] > z.first + i.second) {
                d[i.first] = z.first + i.second;
                q.push({d[i.first], i.first});  
            }
        }
    }
    cout << -1;
}

Measured memory_bytes: 12488
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
using namespace std;

int main() {
	int r;
	cin >> r;
	
	if (r < 1200) {
		cout << "ABC" << endl;
		return 0;
	}
	if (r < 2800) {
		cout << "ARC" << endl;
		return 0;
	}
	else {
		cout << "AGC" << endl;
		return 0;
	}
}

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

#define PI 3.1415926535

int main(void){
    double dst,angl,angl_now;
    double x,y;
    x=y=0;
    angl_now=90;
    char ch;
    while(std::cin>>dst>>ch>>angl){
        if(dst==0 && angl==0) break;
        x+=dst*cos(PI/180*angl_now);
        y+=dst*sin(PI/180*angl_now);
        angl_now-=angl;
    }
    std::cout<<(int)x<<std::endl<<(int)y<<std::endl;
    return 0;
}


Measured memory_bytes: 3384