akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
    int n,m,x;
    cin >> n >> m >> x;

    vector<int> c(n,0);
    vector<vector<int>> a(n,vector<int>(m,0));
    

    for(int i=0; i<n; i++){
        cin >> c[i];
        for(int j=0; j<m; j++){
            cin >> a[i][j];
        }
    }

    int min = -1;

    for(int bit = 0; bit < (1<<n); bit++){
        vector<int> u(m,0);
        int sum = 0;
        bool flg = true;

        for(int i=0; i<n; i++){
            if(bit & (1<<i)){
                sum += c[i];
                for(int j=0; j<m; j++){
                    u[j] += a[i][j];
                }
            }
        }

        for(int j=0; j<m; j++){
            if(u[j] < x) flg = false;
        }
        
        if(flg && (sum < min || min == -1)) min = sum;
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    ll a,b,k,i;
    cin>>a>>b>>k;
    if ((b-a+1)<=2*k)
    {
        for (i=a;i<=b;i++)
            cout<<i<<endl;
    }
    else
    {
        for (i=a;i<a+k;i++)
            cout<<i<<endl;
        for (i=b-k+1;i<=b;i++)
            cout<<i<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <limits.h>
using namespace std;
typedef long long ll;
long long big = 200000000000;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin>>n;
    
    ll w;
    cin>>w;
    
    vector<vector<ll>> ans;
    
    int k = n*1000+1;
    vector<ll> e(k,big);
    ans.push_back(e);
    
    for(int i =0; i<n;i++){
        vector<ll> f(k,big);
        ans.push_back(f);
    }
    
    int hi = 0;
    for(int i =1; i<=n;i++){
        ll wei;
        int val;
        cin>>wei>>val;
        
        for(int j=0; j<k;j++){
            if(j<val)
                ans[i][j] = ans[i-1][j];
            else if(j>val)
                ans[i][j] = min(ans[i-1][j], wei+ans[i-1][j-val]);
            else
                ans[i][j] = min(wei,ans[i-1][j]);
            if(ans[i][j]<=w && hi<j)
                hi = j;
        }
    }
    cout<<hi<<endl;
    
    
    return 0;
}

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

int main(){
  long N;
  cin >> N;
  vector<long long> A(N);
  long long dif = 0;
  for(long i = 0; i < N; i++){
    long long tmp;
    cin >> tmp;
    A[i] = tmp;
  }
  long count = 0;
  long i1 = 0, i2 = N-1;
  while(count < N){
    if(dif <= 0){
      dif += A[i1];
      i1++;
      count++;
    }else{
      dif -= A[i2];
      i2--;
      count++;
    }
  }
  if(dif < 0) dif *= -1;
  cout << fixed;
  cout << setprecision(20) << dif << endl;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e3 + 5;

vector<int> g[N];
int vis[N], dis[N];


map<int, int> m;

signed main(){
    IOS;
    int n, x, y;
    cin >> n >> x >> y;
    for (int i = 1; i < n; i++) {
        g[i].push_back(i+1);
        g[i+1].push_back(i);
    }
    g[x].push_back(y);
    g[y].push_back(x);

    for (int i = 1; i <= n; i++) {
        queue<int> q;
        memset(vis, 0, sizeof(vis));
        memset(dis, 0, sizeof(dis));
        q.push(i);
        vis[i] = 1;
        while (!q.empty()) {
            int t = q.front();
            q.pop();
            for (auto i : g[t] ){
                if (vis[i]) continue;
                vis[i] = 1;
                dis[i] = dis[t] + 1;
                m[dis[i]]++;
                q.push(i);
            }
        }
    }
    int cnt = n - 1;
    for (auto i : m) {
        cnt--;
        cout << i.se / 2 << endl;
    }
    while (cnt--)
        cout << 0 << endl;
    return 0;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

int main()
{

    lint n;
    cin >> n;
    lint ans, tmp,lnum;

    vector<lint> h(n);
    REP(i, n) { cin >> h[i]; }

    lnum = h[0];
    REP(i, n)
    {
        if(h[i]>lnum){
            lnum = h[i] - 1;
        }
        if (h[i] < lnum)
        {
            cout << "No"
                 << "\n";

            return 0;
        }
    }

    cout << "Yes" <<"\n";
    
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;

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

    int n;cin>>n;
    vector<int> d;
    rep(i,n){
        int x;cin>>x;d.push_back(x);
    }
    sort(d.begin(),d.end());
    int count=1;
    int x = d.front();
    for(int i = 1;i<d.size();i++)
    {
        if(x == d[i])
        continue;
        else {
            x = d[i];
            count++;
        }
    }

    cout<<count<<endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    static int res = 0;
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var b = Console.ReadLine().Split().Select(int.Parse).ToArray();
        res = int.MaxValue;
        var arr = Enumerable.Repeat(0, n).Select(_ => new Card()).ToList();
        for (int i = 0; i < (1 << n); i++)
        {
            for (int j = 0; j < n; j++)
            {
                var f = (i >> j & 1) == 1;
                arr[j].Sign = f ? b[j] : a[j];
                arr[j].Flipped = f;
            }
            res = Min(res, Solve(arr));
        }
        if (res == int.MaxValue) res = -1;
        Console.WriteLine(res);
    }
    static int Solve(List<Card> arr)
    {
        var sorted = arr.OrderBy(x => x.Sign).ToArray();
        int[] oddCount = new int[51];
        int[] evenCount = new int[51];
        for (int i = 0; i < sorted.Length; i++)
        {
            if ((i & 1) == 0)
                evenCount[sorted[i].Sign]++;
            else
                oddCount[sorted[i].Sign]++;
        }
        for (int i = 0; i < arr.Count; i++)
        {
            if (arr[i].Flipped ^ ((i & 1) == 1))
            {
                if (--oddCount[arr[i].Sign] < 0) return int.MaxValue;
            }
            else
            {
                if (--evenCount[arr[i].Sign] < 0) return int.MaxValue;
            }
        }
        int step = 0;
        for (int i = 0; i < arr.Count; i++)
        {
            var min = arr.Skip(i).Min(x => x.Sign);
            var minInd = arr.TakeWhile(
                (x, y) => y < i || x.Sign != min || (((y - i) & 1) == 1) != x.Flipped
            ).Count();
            if (minInd == arr.Count) return int.MaxValue; 
            var minElem = arr[minInd];
            arr.RemoveAt(minInd);
            arr.Insert(i, minElem);
            var diff = minInd - i;
            step += diff;
            if ((diff & 1) == 1) arr[i].Flipped ^= true;
            for (int j = i + 1; j <= minInd; j++)
                arr[j].Flipped ^= true;
            if (res <= step) return int.MaxValue;
        }
        return step;
    }
}

class Card
{
    public bool Flipped;
    public int Sign;
    public override string ToString() => $"{Sign} {Flipped}";
}


Measured memory_bytes: 17784
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

mod = 10**9+7

class PERM_COMB_MOD():
    def __init__(self, max_n=510000, mod=10**9+7):
        self.fac = [0]*max_n
        self.finv = [0]*max_n
        self.inv = [0]*max_n
        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1
        self.max = max_n
        self.mod = mod
        self._maesyori()

    def _maesyori(self):
        for i in range(2,self.max):
            self.fac[i] = self.fac[i-1] * i % self.mod
            self.inv[i] = self.mod - self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.finv[i] = self.finv[i-1] * self.inv[i] % self.mod

n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)
PCM = PERM_COMB_MOD(2*n)
root = n//2

tmp = [[] for i in range(n)]
cost = [1]*n
size = [1]*n
def bfs1(root):
    rev = [(root, -1)]
    for i in range(n):
        cur, par = rev[i]
        for to in G[cur]:
            if to != par:
                rev.append((to, cur))
    for i in reversed(range(1,n)):
        cur, par = rev[i]
        size[par] += size[cur]
        if len(tmp[cur]) == 0:
            pass
        elif len(tmp[cur]) == 1:
            cost[cur] = tmp[cur][0]
        else:
            size_sum = 0
            inv_sum = 1
            count_sum = 1
            for to in G[cur]:
                if to != par:
                    size_sum += size[to]
                    inv_sum *= PCM.finv[size[to]]
                    inv_sum %= mod
                    count_sum *= cost[to]
                    count_sum %= mod
            cost[cur] = PCM.fac[size_sum] * inv_sum * count_sum % mod
        tmp[par].append(cost[cur])

bfs1(root)

ans = [0]*n
def bfs2(root):
    rev = [(root, -1, 1)]
    for i in range(n):
        cur, par, d_par = rev[i]
        size_par = n - size[cur]
        size_sum = 0
        inv_sum = 1
        count_sum = 1
        for to in G[cur]:
            if to != par:
                size_sum += size[to]
                inv_sum *= PCM.finv[size[to]]
                count_sum *= cost[to]
            else:
                size_sum += size_par
                inv_sum *= PCM.finv[size_par]
                count_sum *= d_par
            inv_sum %= mod
            count_sum %= mod
        ans_i = PCM.fac[size_sum]*inv_sum*count_sum % mod
        ans[cur] = ans_i
        for to in G[cur]:
            if to == par:
                continue
            b = size[to]
            bb = cost[to]
            d_nxt = ans_i * PCM.fac[b] * pow(bb, mod-2, mod) * PCM.fac[size_sum-b] * PCM.finv[size_sum] % mod
            rev.append((to, cur, d_nxt))
bfs2(root)
print(*ans, sep="\n")


Measured memory_bytes: 149692
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define fi first 
#define se second

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

const ll HMOD = (ll)1e9 + 7;
const ll LMOD = 998244353;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;
const long double EPS = 1e-10;


void YN(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Yn(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void yn(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	int N,x; cin >> N >> x;
	VL A(N),B(N); REP(i, N) cin >> A[i];
	
	sort(ALL(A));
	B[0] = A[0];
	FOR(i, 1, N) B[i] = B[i - 1] + A[i];

	if (B[0] > x) {
		cout << 0 << endl;
		return 0;
	}

	REP(i, N) {
		if (B[i] == x) {
			cout << i + 1 << endl;
			
			return 0;
		}
	}

	REP(i, N) {
		if (B[i] > x) {
			ll sum = B[i - 1];
			for (int j = i; j < N; ++j) {
				if (sum + A[j] == x) {
					cout << i + 1 << endl;
					return 0;
				}
			}
			cout << i << endl;
			return 0;
		}
	}
	cout << N-1 << endl;		
	return 0;
}



Measured memory_bytes: 256
#include<queue>
#include<cstdio>
#include<cstring>

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

using namespace std;

int main(){
	// 4*5 ãÌ myon ðSñ
	int n_ptn=0,ptn[150];
	rep(i2,4) rep(i1,i2+1) rep(j2,5) rep(j1,j2+1) {
		int S=0;
		for(int y=i1;y<=i2;y++) for(int x=j1;x<=j2;x++) S|=1<<y*5+x;
		ptn[n_ptn++]=S;
	}

	static int dp[1<<20];
	memset(dp,-1,sizeof dp);
	dp[0]=0;
	queue< pair<int,int> > Q; Q.push(make_pair(0,0));
	while(!Q.empty()){
		int t=Q.front().first,S=Q.front().second; Q.pop();
		rep(i,n_ptn) if(dp[S^ptn[i]]==-1) {
			dp[S^ptn[i]]=t+1;
			Q.push(make_pair(t+1,S^ptn[i]));
		}
	}

	int n_ptn2[5]={1,1,1,1,1},ptn2[5][26]={};
	rep(i1,5) rep(j2,5) rep(j1,j2+1) {
		int S=0;
		for(int y=i1;y<5;y++) for(int x=j1;x<=j2;x++) S|=1<<y*5+x;
		ptn2[j1][n_ptn2[j1]++]=S;
	}

	for(int n;scanf("%d",&n),n;){
		int S0=0;
		rep(i,n) rep(j,n) {
			int a; scanf("%d",&a);
			S0|=a<<i*5+j;
		}

		if(n<5){
			rep(i,dp[S0]) printf("myon"); puts("");
			continue;
		}

		int ans=77;
		rep(k0,n_ptn2[0]) rep(k1,n_ptn2[1]) rep(k2,n_ptn2[2]) rep(k3,n_ptn2[3]) rep(k4,n_ptn2[4]) {
			int cost=0;
			if(k0>0) cost++;
			if(k1>0) cost++;
			if(k2>0) cost++;
			if(k3>0) cost++;
			if(k4>0) cost++;
			int S=S0^ptn2[0][k0]^ptn2[1][k1]^ptn2[2][k2]^ptn2[3][k3]^ptn2[4][k4];
			if((S&((1<<20)-1))==S) ans=min(ans,dp[S]+cost);
		}

		rep(i,ans) printf("myon"); puts("");
	}

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n,m;
	cin >> n >> m;
	int sum=0;
	rep(i,1,m+1){
		int x;
		cin >> x;
		sum+=x;
	}
	if(sum<=n){
		cout<<n-sum<<endl;
	}
	else{
		cout<<"-1";
	}
	return 0;
}



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

const int N=1e6;
int dp[1000010];
int dp2[1000010];
int move[200];
int main(){
	for(int i=0;i<1000010;i++)	dp[i]=dp2[i]=i;
	for(int i=2;;i++){
		int add=i*(i+1)*(i+2)/6;
		if(add>N)	break;
		for(int j=add;j<=N;j++)	dp[j]=min(dp[j],dp[j-add]+1);
		if(add&1)	for(int j=add;j<=N;j++){
			dp2[j]=min(dp2[j],dp2[j-add]+1);
		}
	}
	while(true){
		int n;	cin>>n;
		if(n==0)	break;
		cout<<dp[n]<<" "<<dp2[n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 10844
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  int n, k;
  cin >> n >> k;

  if(n % k == 0) cout << 0 << endl;
  else cout << 1 << endl;

  return 0;
}


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

using namespace std;

#define MAX 100005

#define int int64_t

int n, a[MAX], b[MAX], c[MAX], dp[MAX][4];

int f(int i, int flag)
{
    if (dp[i][flag] != -1)
        return dp[i][flag];
    if (i == n)
        return 0;
    int tmp, tmp1, tmp2;
    // if (i + 1 == n)
    // {
    tmp = f(i + 1, 1) + a[i];
    tmp1 = f(i + 1, 2) + b[i];
    tmp2 = f(i + 1, 3) + c[i];
    // }
    // else
    // {
    //     tmp = max(f(i + 1, 1) + a[i], f(i + 2, 1) + a[i] + a[i + 1]);
    //     tmp1 = max(f(i + 1, 2) + b[i], f(i + 2, 2) + b[i] + b[i + 1]);
    //     tmp2 = max(f(i + 1, 3) + c[i], f(i + 2, 3) + c[i] + c[i + 1]);
    // }
    if (flag == 0)
        dp[i][flag] = max(tmp, max(tmp1, tmp2));
    if (flag == 1)
        dp[i][flag] = max(tmp1, tmp2);
    if (flag == 2)
        dp[i][flag] = max(tmp, tmp2);
    if (flag == 3)
        dp[i][flag] = max(tmp1, tmp);
    return dp[i][flag];
}

signed main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        dp[i][0] = -1;
        dp[i][1] = -1;
        dp[i][2] = -1;
        dp[i][3] = -1;
        scanf("%d %d %d", a + i, b + i, c + i);
    }
    printf("%d\n", f(0, 0));
}


Measured memory_bytes: 13568
#include<iostream>
#include<cstdio>
using namespace std;
long long a;
int main()
{
	cin>>a;
	long long x=a;
	long long sum=0;
	while(x>0)
	{
		sum+=x%10;
		x/=10;
	} 
	if(a%sum==0)  cout<<"Yes";
	else          cout<<"No"; 
	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 = int64_t;
using pint = pair<int, int>;

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

    s[k - 1] = s[k - 1] - 'A' + 'a';
    cout << s << endl;
}

Measured memory_bytes: 3624
# -*- coding: utf-8 -*-

N = int(input())
H = list(map(int, str(input()).split()))

output = "Yes"
if N == 1:
    print(output)
    exit()

pre = -1
for i in range(N):
    if pre <= H[i] -1:
        pre = H[i] - 1
    elif pre <= H[i]:
        pre = H[i]
    else:
        output = "No"
        break

print(output)


Measured memory_bytes: 14704
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp36 {
    class Program {
        static void Main(string[] args) {
            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());
            int C = int.Parse(Console.ReadLine());
            int X = int.Parse(Console.ReadLine());

            int ans = 0;

            for (int i = 0; i <= Math.Min(A, X / 500); i++) {
                for (int j = 0; j <= Math.Min(B, X / 100); j++) {
                    for (int k = 0; k <= Math.Min(C, X / 50); k++) {
                        if (500 * i + 100 * j + 50 * k == X) {
                            ans++;
                        }

                    }
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
int main(void){
        int H,W,h,w;
        while(1){
                scanf("%d %d",&H,&W);
                if(H==0 && W==0)
                        break;
                for(h=0; h<H; h++){
                        for(w=0; w<W; w++){
                                if(w==0 || h==0 || w==W-1 ||h==H-1)
                                        putchar('#');
                                else
                                        putchar('.');
                        }
                        putchar('\n');
                }
                putchar('\n');
        }
        return 0;
}

Measured memory_bytes: 572
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>

using namespace std;

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

const ll INF = 1e15;
const double eps = 1e-6;
const ll MOD = 1000000007;

int main() {
	string s;
	cin >> s;
	vector<ll> dp(10);
	vector<ll> ndp(10);
	const ll z = 0, zz = 1, zo = 2, o = 3, oz = 4, ozz = 5, ok = 6;
	if (s[0] == '1')
		dp[o]++;
	else if (s[0] == '0')
		dp[z]++;
	else if (s[0] == '?') {
		dp[o]++; dp[z]++;
	}
	for (int i = 1;i < s.size();i++) {
		ndp = vector<ll>(10);
		if (s[i] == '1') {
			ndp[z]   = dp[zz];
			ndp[zz]  = 0;
			ndp[zo]  = dp[z];
			ndp[o]   = dp[oz] + dp[zo];
			ndp[oz]  = dp[ozz];
			ndp[ozz] = 0;
			ndp[ok]  = dp[ok] + dp[o];
		}
		else if (s[i] == '0') {
			ndp[z]   = dp[zz] + dp[zo];
			ndp[zz]  = dp[z];
			ndp[zo]  = 0;
			ndp[o]   = 0;
			ndp[oz]  = dp[o] + dp[ozz];
			ndp[ozz] = dp[oz];
			ndp[ok]  = dp[ok];
		}
		else {
			ndp[z]  = dp[zz];
			ndp[zz] = 0;
			ndp[zo] = dp[z];
			ndp[o]  = dp[oz] + dp[zo];
			ndp[oz] = dp[ozz];
			ndp[ozz]= 0;
			ndp[ok] = dp[ok] + dp[o];

			ndp[z]  += dp[zz] + dp[zo];
			ndp[zz] += dp[z];
			ndp[zo] += 0;
			ndp[o]  += 0;
			ndp[oz] += dp[o] + dp[ozz];
			ndp[ozz]+= dp[oz];
			ndp[ok] += dp[ok];

		}
		dp = ndp;
		for (int i = 0;i < dp.size();i++)
			dp[i] %= MOD;
	}
	ll ans = (dp[o] + dp[ok]) % MOD;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,n) for(lli i=0;i<n;i++)
#define repb(i,n) for(lli i=n-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define bg() begin()
#define en() end()
#define ft first
#define sc second
#define vect_lli_it vector<lli>::iterator
#define set_lli_it set<lli>::iterator
#define inf 1e18
#define all(X) X.begin(),X.end()
#define iterate(X) for(it=X.begin();it!=X.end();it++)
lli combi(lli n,lli k)
{
    lli ans=1;
    k=k>n-k?n-k:k;
    lli j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
lli findlcm(vector <lli> arr, lli n)
{
    lli ans = arr[0];
    for (lli i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));

    return ans;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli a,b,c,d;
    cin>>a>>b>>c>>d;
    lli low=a;
    lli high=b;
    if(low%c!=0){
    	low=low+c-(low%c);
	}
	if(high%c!=0){
		high=high-(high%c);
	}
	lli doc=(high/c)-(low/c)+1;
	low=a;
	high=b;
	if(low%d!=0){
    	low=low+d-(low%d);
	}
	if(high%d!=0){
		high=high-(high%d);
	}
	lli dod=(high/d)-(low/d)+1;
	lli lcm=(c*d)/(__gcd(c,d));
	low=a;
	high=b;
	if(low%lcm!=0){
    	low=low+lcm-(low%lcm);
	}
	if(high%lcm!=0){
		high=high-(high%lcm);
	}
	lli com=(high/lcm)-(low/lcm)+1;
	lli ans=(b-a+1)-(dod+doc-com);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9

using ll = long long;
const ll mod = 100000000+7;
const ll MAX_N = 1000;

ll sx,sy,tx,ty;
int main(){
  cin>>sx>>sy>>tx>>ty;
  ll memo2=tx-sx;
  ll memo1=ty-sy;

  rep(i,memo1)cout<<'U';
  rep(i,memo2)cout<<'R';

  rep(i,memo1)cout<<'D';
  rep(i,memo2)cout<<'L';

  cout<<'L';
  rep(i,memo1)cout<<'U';
  cout<<'U';
  cout<<'R';
  rep(i,memo2)cout<<'R';
  cout<<'D';

  cout<<'R';
  rep(i,memo1)cout<<'D';
  cout<<'D';
  cout<<'L';
  rep(i,memo2)cout<<'L';
  cout<<'U';

  cout<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int a, b;
  cin >> a >> b;
  rrep(i,10000) {
    if (i*8/100 == a && i*10/100 == b) {
      cout << i << endl;
      return 0;
    }
  }

  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Phuong ios_base::sync_with_stdio(0); cin.tie(0);

typedef long long ll;
using namespace std;
const ll modprime = 998244353;
const int MAXN = 3*1e5+2;
ll fact[MAXN];

ll n,a,b;

ll numA, numB, k;

void init()
{
    fact[0]=1;
    fact[1]=1;
    for(int i=2; i<=MAXN-2; ++i)
    {
        fact[i]=(i*fact[i-1])%modprime;
    }
}

ll lt(ll x)
{
    if (x==1) return 1;
    ll res=1;
    int y =modprime -2;
    while (y>0)
    {
        if (y&1) res=(res*x)%modprime;
        y=y>>1;
        x=(x*x)%modprime;
    }
    return res;
}

ll compute(ll x, ll y)
{
    if (y>=x) return 1;
    if (y==0) return 1;
    ll inv1=lt(fact[y]);


    ll inv2=lt(fact[x-y]);
    ll ans = (fact[x]*inv1)%modprime;
    ans=(ans*inv2)%modprime;

    return (ans);

}

int main()
{
    Phuong;
    //freopen("input.txt", "r", stdin);
    init();
    cin >> n >> a >> b >> k;
    ll sum=0;
    for(int i=0; i<=n; ++i)
    {
        numA= i;
        numB= k-i*a;
        if (numB<0) continue;
        if (numB%b!=0) continue;
        numB/=b;
        if (numB>n) continue;
        ll ansA= compute(n,numA);
        ll ansB= compute(n,numB);

        sum+= (ansA*ansB)%modprime;
        sum%=modprime;
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <queue>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <set>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

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

int main(void){
  int n, a, b;

  cin >> n >> a >> b;

  cout << min(n*a, b) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a, b, x;

int main(){
	cin >> a >> b >> x;
	ll na = (a-1)/x + 1;
	if (a == 0) na = 0;
	ll nb = (b)/x + 1;
	cout << nb - na << endl;
	return 0;
}


Measured memory_bytes: 256
import heapq
initial_cost = 10 ** 9
initial = 10 ** 15

def di(link_costs, s):
    costs = [initial] * n
    costs[s] = 0
    q = []
    heapq.heappush(q, (0, s))
    
    while(len(q) != 0):
        index_cost, index = heapq.heappop(q)
        if costs[index] < index_cost:
            continue

        for j in link_costs[index]:
            newcost = costs[index] + link_costs[index][j]
            if newcost < costs[j]:
                costs[j] = newcost
                heapq.heappush(q, (newcost, j))
    return costs
    
n, m, s, t  = list(map(int, input().split()))
s -= 1
t -= 1
links_cost_en = [{} for _ in range(n)]
links_cost_sn = [{} for _ in range(n)]

for _ in range(m):
    u, v, a, b  = list(map(int, input().split()))
    u -= 1
    v -= 1
    links_cost_en[u][v] = a
    links_cost_en[v][u] = a
    links_cost_sn[u][v] = b
    links_cost_sn[v][u] = b

cost_en_from_s = di(links_cost_en, s)
cost_sn_to_t = di(links_cost_sn, t)
cost_list = [cost_en_from_s[i] + cost_sn_to_t[i] for i in range(n)]

ans = [initial] * n
ans[-1] = cost_list[-1]
for i in list(range(n - 1))[::-1]:
    ans[i] = min(ans[i + 1], cost_list[i])
for i in range(n):
    print(initial - ans[i])

Measured memory_bytes: 98248
import sys
from functools import lru_cache

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    MOD = 998244353
    N, S, *A = map(int, read().split())

    dp = [[0] * (S + 1) for _ in range(N + 1)]
    dp[0][0] = 1

    for i in range(N):
        for s in range(S + 1):
            dp[i + 1][s] += 2 * dp[i][s]
            dp[i + 1][s] %= MOD
            if s - A[i] >= 0:
                dp[i + 1][s] += dp[i][s - A[i]]
                dp[i + 1][s] %= MOD

    print(dp[N][S])
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 139796
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
void vprint() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
template <class H, class... T> void vprint(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << '\n';
    vprint(std::forward<T>(args)...);
}
template <class T> void vprint(std::vector<T> &v) {
    for (auto &&i : v) {
        std::cout << i << '\n';
    }
}
template <class T> void mprint(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << "";
        }
    }
}

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

    int N;
    cin >> N;
    string ans = "";
    int i      = 0;
    while (N != 0) {
        int a = abs(N % 2);
        if (a) {
            if (i % 2 == 0)
                N--;
            else
                N++;
        }
        char c = '0' + a;
        ans    = c + ans;
        N /= 2;
        i++;
    }
    if (ans == "")
        ans = "0";

    print(ans);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

signed main()
{
  int h,w,n,y,x; cin>>h>>w>>n>>y>>x;
  string s,t; cin>>s>>t;
  
  x--;y--;
  
  // left, right
  int left=0, right=w;
  
  // 最終ターンの先手の手から、後手が勝つためにいないといけないエリアを決める
  // 最終ターンの後手の手は評価する必要はない
  if(s[n-1]=='L')left++;
  else if(s[n-1]=='R')right--;
  string ans="YES";
  for(int i=n-2;i>=0;i--){
    // このターンの後手の手から、手を打つ前に居ていいエリアを広げられるか判断
    if(t[i]=='L') right=min(right+1,w);
    else if(t[i]=='R') left=max(left-1,0);
    // 先手の手からエリアを狭め、前ターンに居なければならないエリアを決める
    if(s[i]=='L') left++;
    else if(s[i]=='R') right--;
    // 居ていいエリアがつぶれる
    if(left>=right) ans="NO";
  }
  if(x<left||right<=x) ans="NO";
  
  // up, down
  left=0; right=h;
  if(s[n-1]=='U')left++;
  else if(s[n-1]=='D')right--;
  for(int i=n-2;i>=0;i--){
    if(t[i]=='U') right=min(right+1,h);
    else if(t[i]=='D') left=max(left-1,0);
    if(s[i]=='U') left++;
    else if(s[i]=='D') right--;
    if(left>=right) ans="NO";
  }
  if(y<left||right<=y) ans="NO";
  
  cout<<ans<<endl;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;


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

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////


void solve(long long A, long long B, long long T){
  cout << T/A*B << endl;
}

int main(){ 
    cout << setprecision(10);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long T;
    scanf("%lld",&T);
    solve(A, B, T);
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long int
#define tc int t; cin>>t; while(t--)
#define fora(i,n) for(int i=0;i<n;i++)
#define forb(i,a,n) for(int i=a;i<n;i++)
#define mod 1000000007

template<class T> T power(T N,T P){ return (P==0)?  1: N*power(N,P-1);}

int32_t main()
{
    fastio
    int n;
    cin>>n;
    cout<<(1000-(n%1000))%1000;
    


    return 0;


}

Measured memory_bytes: 3648
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	#a = int(input())
	#b , c = tin()
	s = list(input())
	cc=[c for c in s if c != 'x']
	ccc=cc[::-1]
	if cc != ccc:
		return -1
	add=0
	ci=0
	ls = len(s)
	for i, c in enumerate(s):
		#cc = s[ls-1-ci]
		#if cc == c:
		#	ci+=1
		#else:
		while c != s[ls-1-ci]:
			pa((i,ci,c,s[ls-1-ci]))
			if c == 'x':
				add+=1
				ci-=1
				break
			else:
				add+=1
				ci+=1
		ci+=1
		if i + ci >= ls:
			break
	return add
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	int d, ans=0;
	vector<int> c, t, ld, at;
	vector< vector<int> >s;

	cin>> d;

	c.resize(26);
	rep(i, 26) cin>> c[i];
	s.resize(d);
	rep(i, d){
		s[i].resize(26);
		rep(j, 26) cin>> s[i][j];
	}
	t.resize(d);
	at.resize(d);
	rep(i, d){
		int tmp=0, ma=0;
		rep(j, 26){
			if(ma<s[i][j]){
				tmp=j;
				ma=s[i][j];
			}
		}
		t[i]=tmp;
		cout<< t[i]+1 <<endl;
	}
	return 0;
	ld.resize(26);

	/*int m;
	vector<int> qd, qq;
	cin>> m;
	qd.resize(m);
	qq.resize(m);
	rep(i, m) cin>> qd[i] >> qq[i];*/
	
  	std::random_device seed_gen;
  	std::mt19937 engine(seed_gen());

	int ti = clock();
    while (clock() - ti < 189 * CLOCKS_PER_SEC / 100){
		//t[qd[k]-1]=qq[k]-1;
		ans=0;
		rep(i, 26) ld[i]=0;

		rep(i, d){
			ans+=s[i][t[i]];
			ld[t[i]]=i+1;
			rep(j, 26) ans-=(i-ld[j]+1)*c[j];
		}
		cout<< ans << endl;
	}
 
	return 0;
}

Measured memory_bytes: 3680
import sys
# gcd
from fractions import gcd
# 切り上げ，切り捨て
# from math import ceil, floor
# リストの真のコピー（変更が伝播しない）
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l)  # カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})
# print(S.most_common(2))  # [('b', 5), ('c', 4)]
# print(S.keys())  # dict_keys(['a', 'b', 'c'])
# print(S.values())  # dict_values([3, 5, 4])
# print(S.items())  # dict_items([('a', 3), ('b', 5), ('c', 4)])
# from collections import Counter
# import math
# from functools import reduce
#
# input関係の定義
# import os
# fin = open('in_2.txt', 'r')
# sys.stdin = fin
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


def iterate_tokens():
    for line in sys.stdin:
        for word in line.split():
            yield word


if __name__ == '__main__':

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    S = next(tokens)  # type: str

    # write code
    A = list(S)
    A[K-1] = A[K-1].lower()
    print(''.join(A))


Measured memory_bytes: 5716
n,a,b=map(int, input().split())
al=0
kai=0
for i in input():
    ans='No'
    if i=='a':
        if al<a+b:
            ans='Yes'
            al+=1
    if i=='b':
        if al<a+b and kai<b:
            ans='Yes'
            al+=1
            kai+=1
    print(ans)

Measured memory_bytes: 4016
x = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
 
    return divisors


d = make_divisors(x)


for i in d:
    for b in range(-10000,10000):
        a = i + b
        if x // i == a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4:
            ans = [str(a),str(b)]
            break
        
print(*ans)

Measured memory_bytes: 9372
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<set>
#include<queue>
using namespace std;

int value[555555] = { 0 };
bool cmp(const int& x, const int& y)
{
	return x > y;
}
int main()
{
	priority_queue<int> q;
	int n, i, max, m, t;
	cin >> n >> m;
	for (i = 0; i < n; i++)
	{
		cin >> t;
		q.push(t);
	}
	sort(value, value + n, cmp);
	while (m--)
	{
		t = q.top(); q.pop();
		t>>= 1;
		q.push(t);
	}
	long long sum = 0;
	while (q.size())
	{
		sum += q.top();
		q.pop();
	}
	cout << sum << endl;
	return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const int MD = 1e9+7; typedef vector<ll> VL;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

ll  fct[200200], inv[200200];
void finit(int cmx, ll mod){
	auto bin_pows =[](ll x, ll n, ll mod){
		ll res = 1LL;
		for(; n > 0; n >>=1, x = x*x %mod) if(n & 1) res = res * x %mod;
		return res;
	};
	fct[0] = fct[1] = inv[1] = 1;
	for(int i=2;i<cmx+3;i++) fct[i] = fct[i-1] * i % mod;
	inv[cmx] = bin_pows(fct[cmx], mod-2, mod);
	for(int i=cmx;i>=1;i--) inv[i-1] = inv[i] * i % mod;
}
ll nCk(ll n, ll k, ll mod) {
	if(k > n) return 0;
	ll ret =fct[n] * inv[k] % mod * inv[n-k] % mod;
	return ret;
}
map<ll, int> fctm( ll x ){
	map<ll, int> fmp;
	for( ;x>=4 && x%2==0; x/=2)  fmp[2]++;
	for(ll d=3, q=x/d; q>=d ; q=x/d){if(x%d==0) fmp[d]++, x=q; else d +=2;}
	if(x!=1) fmp[x]++;
	return fmp;
}


int main()
{
	
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m;
	cin >>n >>m;
	finit(200010, MD);
	auto rmp = fctm(m);
	ll ans =1LL;
	for(auto x: rmp){
		(ans *= nCk(x.second + n - 1, x.second, MD ))%=MD;
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 3328
#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>;

bool visited[105];
int ans[105];
vector<vector<int> > v(105);

int main() {
    int n;
    cin >> n;
    
    int x, y;
    rep(i, n){
        cin >> x >> y;
        rep(j, y){
            int t;
            cin >> t;
            v[x-1].push_back(t-1);
        }
    }
    
    rep(i, 105){
        visited[i] = false;
        ans[i] = -1;
    }
    
    queue<pair<int, int> > q;
    q.push(make_pair(0, 0));
    visited[0] = true;
    
    while(!q.empty()){
        int node = q.front().first;
        int t_found = q.front().second;
        q.pop();
        rep(i, (int)v[node].size()){
            if(!visited[v[node][i]]){
                q.push(make_pair(v[node][i], t_found+1));
                visited[v[node][i]] = true;
            }
        }
        ans[node] = t_found; 
    }
    
    rep(i, n){
        cout << i+1 << " " << ans[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3132