akhauriyash/Code-Regression huggingface dataset:
def dump(dp, i1_max, i2_max):
    for i1 in range(0, i1_max + 1):
        for i2 in range(0, i2_max + 1):
            print('%4d' % dp[i1][i2], end='')
        print()


s = input()
t = input()
s_len = len(s)
t_len = len(t)
inf = 1 << 60

# dp[i][j] = sのi文字目、tのj文字目までの最大長の部分文字列
dp = [[-inf for j in range(t_len + 1)] for i in range(s_len + 1)]
dp[0][0] = 0
for si in range(0, s_len + 1):
    for ti in range(0, t_len + 1):
        if si >= 1 and ti >= 1:
            if s[si - 1] == t[ti - 1]:
                dp[si][ti] = max(dp[si][ti], dp[si - 1][ti - 1] + 1)
        if si >= 1:
            dp[si][ti] = max(dp[si][ti], dp[si - 1][ti])
        if ti >= 1:
            dp[si][ti] = max(dp[si][ti], dp[si][ti - 1])

ans = ''
si = s_len
ti = t_len
#dump(dp, si, ti)
while si != 0 and ti != 0:
    if si >= 1 and ti >= 1:
        if (dp[si - 1][ti - 1] == dp[si][ti] - 1) and s[si - 1] == t[ti - 1]:
            ans = s[si - 1] + ans
            si -= 1
            ti -= 1
            continue
        if dp[si - 1][ti - 1] == dp[si][ti]:
            si -= 1
            ti -= 1
            continue
    if si >= 1:
        if dp[si - 1][ti] == dp[si][ti]:
            si -= 1
            continue
    if ti >= 1:
        if dp[si][ti - 1] == dp[si][ti]:
            ti -= 1
            continue

print(ans)


Measured memory_bytes: 120284
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

bool solve(string s){
    map<int, int> m;
    for (auto &&i : s) {
        m[i]++;
    }
    sort(s.begin(),s.end());
    vector<string> v, u;
    for (int i = 1; i <= 9; ++i) {
        v.emplace_back(3, (char)(i+'0'));
        u.emplace_back(2, (char)(i+'0'));
    }
    for (int i = 1; i < 8; ++i) {
        string t;
        for (int j = 0; j < 3; ++j) {
            t += (char)(i+j+'0');
        }
        v.emplace_back(t);
    }
    int n = v.size();

    for (int i = 0; i < n; ++i) {
        for (int j = i; j < n; ++j) {
            for (int k = j; k < n; ++k) {
                for (int l = k; l < n; ++l) {
                    for (int o = 0; o < 9; ++o) {
                        string t = v[i]+v[j]+v[k]+v[l]+u[o];
                        sort(t.begin(),t.end());
                        if(s == t) return true;
                    }
                }
            }
        }
    }
    return false;
}

int main() {
    string s;
    while(getline(cin, s)){
        sort(s.begin(),s.end());
        map<int, int> cnt;
        for (auto &&i : s) {
            cnt[i-'0']++;
        }
        int b = 0;
        for (int i = 1; i <= 9; ++i) {
            if(cnt[i] < 4){
                string t = s;
                t += char(i + '0');
                if(solve(t)) {
                    if(b++) cout << " ";
                    cout << i;
                }
            }
        }
        if(!b) printf("0");
        puts("");
    }
    return 0;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
unsigned long long int tui[90];
int main()
{
	int n;
	cin>>n;
	tui[0]=2;
	tui[1]=1;
	for(int i=2;i<=n;i++)
	{
		tui[i]=tui[i-1]+tui[i-2];
	}
	cout<<tui[n];
}

Measured memory_bytes: 256
//manhattan distance trick, constructive algorithm (partitioning area)
//https://code-festival-2017-quala.contest.atcoder.jp/tasks/code_festival_2017_quala_d

#include <iostream>
#include <vector>

using namespace std;

const int INF = 1231231234;

struct pt
{
    int x, y;
};

pt toChebyshev(pt p)
{
    return {p.x + p.y, p.x - p.y};
}

char getColor(pt p, int minx, int miny, int d)
{
    int xPartition = (p.x - minx) / d, yPartition = (p.y - miny) / d;
    if (xPartition & 1)
    {
        return yPartition & 1 ? 'R' : 'B';
    }
    else
    {
        return yPartition & 1 ? 'G' : 'Y';
    }
}

int main()
{
    int h, w, d;
    cin>>h>>w>>d;

    vector <pt> corners = {{0, 0}, {h, 0}, {0, w}, {h, w}};
    int minX = INF, minY = INF;
    for (int i = 0; i < 4; i++)
    {
        pt p = toChebyshev(corners[i]);
        minX = min(minX, p.x);
        minY = min(minY, p.y);
    }

    char grid[h][w];
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            pt p = toChebyshev({i, j});
            grid[i][j] = getColor(p, minX, minY, d);
        }
    }

    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cout<<grid[i][j];
        }
        cout<<'\n';
    }

    return 0;
}


Measured memory_bytes: 768
while True:
    x=int(input())
    y=1000
    if x==0:break
    else:
        z=y-x
        a=z//500
        b=(z-a*500)//100
        c=(z-a*500-b*100)//50
        d=(z-a*500-b*100-c*50)//10
        e=(z-a*500-b*100-c*50-d*10)//5
        f=(z-a*500-b*100-c*50-d*10-e*5)//1
        ans=a+b+c+d+e+f
        print(ans)


Measured memory_bytes: 5584
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  ll n,m;
  cin>>n>>m;
  ll sum=0;
  vector<ll> v(m);
  for(ll i=0;i<m;i++)
  {
    cin>>v[i];
    sum+=v[i];
  }
  if(sum>n)
    cout<<-1;
  else cout<<n-sum;
  return 0;
}

Measured memory_bytes: 3684
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <cmath>
#include<iomanip>
#include <unordered_map>
#include <map>
using namespace std;
static const long long MOD = 1000000007LL;
typedef long long ll;
unordered_map <string,int> ump;
map <int,int> mp;
 
int main()
{
	ll n;
	cin>>n;
	if(n==1)
		cout<<0<<endl;
	else if(n==2)
		cout<<1<<endl;
	else
	{
		cout<<n*(n-1)/2<<endl;
	}
 	

	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<long long> acm;
int n, shoot;
long long cost (int k) {
  long long ret = (long long)(n + k) * shoot;
  int trans = 5;
  ret += (acm[k] - acm[0]) * trans;
  for (int i = 1; i * k < n; i++, trans+= 2) {
    ret += (acm[k * (i + 1)] - acm[k * i]) * trans;
    if (ret >= (long long)1e17) {
      return (long long)1e18;
    }
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> shoot;
  vector<int> pos(n);
  acm.resize(2 * n, 0);
  for (int i = 0; i < n; i++) {
    cin >> pos[i];
  }
  sort(pos.begin(), pos.end());
  reverse(pos.begin(), pos.end());
  for (int i = 1; i < 2 * n; i++) {
    acm[i] = acm[i - 1];
    if (i <= n) {
      acm[i] += pos[i - 1];
    }
  }
  long long minv = 1e18;
  for (int k = 1; k <= n; k++) {
    minv = min(minv, cost(k));
  }
  cout << minv << '\n';
  return 0;
}

Measured memory_bytes: 4224
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


public class Test
{	
    public static void Main()
	{
	    int[] nums = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        Console.WriteLine((nums[0]-1) * (nums[1]-1));
        
	}
}

Measured memory_bytes: 11220
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>

#define mid ((l+r)>>1)

using namespace std;

int main()
{
	long long a[5];
	for(int i=1;i<=4;i++)scanf("%lld",&a[i]);
	long long ans=a[2]*a[4];
	ans=max(ans,a[1]*a[3]);
	ans=max(ans,a[1]*a[4]);
	ans=max(ans,a[2]*a[3]);
	printf("%lld",ans);
	return 0;
}

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

struct Card{
  char a;
  int b;
};

bool compare_as_ints(Card x,Card y){
  return (x.b<y.b);
}

int partition(Card A[], int p, int r){
  Card x=A[r];
  int i=p-1;
  for(int j=p; j<r; j++){
    if(A[j].b <= x.b){
      i++;
      swap(A[i],A[j]);
    }
  }
  swap(A[i+1],A[r]);
  return i+1;
}

void quicksort(Card A[] ,int p ,int r){
  if(p<r){
    int q =partition(A,p,r);
    quicksort(A,p,q-1);
    quicksort(A,q+1,r);
  }
}

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

  Card A[100000],B[100000];
  for(int i=0; i<n; i++){
    cin >> A[i].a >> A[i].b;
    B[i]=A[i];
  }

  quicksort(A,0,n-1);
  stable_sort(B,B+n,compare_as_ints);

  bool f=0;
  for(int i=0; i<n; i++){
    if(A[i].a!=B[i].a){
      f=1;
    }
  }
  if(f==true){
    cout << "Not stable\n";
  }else{
    cout << "Stable\n";
  }

  for(int i=0; i<n; i++){
    cout << A[i].a << " " << A[i].b << endl;
  }

  return 0;
}



Measured memory_bytes: 4640
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
const long long ll_max = 9223372036854775807;
const int int_max = 2147483647;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll X, K, D;
	cin >> X >> K >> D;

	if (X < 0) {
		X = -X;
	}

	ll k = X / D;
	ll ans = X % D;

	if (X == 0) {
		k = 0;
		ans = X;
	}

	K -= k;
	if (K < 0) {
		ans -= D * K;
	}
	else if (K & 1) {
		ans -= D;
	}

	cout << abs(ans) << endl;
	return 0;

}


Measured memory_bytes: 3556
#include <iostream>
using namespace std;
int a, b, c, x, y, r;
int main() {
  cin >> a >> b >> c >> x >> y;
  cout << min(min(a*x+b*y, c*2*max(x,y)), min(x,y)*2*c+abs(x-y)*(x>y?a:b));
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define X first
#define Y second
#define pb push_back

void solve();

int main() {
    // freopen("schools.in", "r", stdin);
    // freopen("schools.out", "w", stdout);
	ios_base::sync_with_stdio(0), cin.tie(0);
	int t;
	// cin >> t;
	t = 1;	
	while(t--) solve();
	return 0;
}

int h, w, a[1005][1005], dp[1005][1005];
const int mod = 1e9 + 7;

void solve() {
	cin >> h >> w;
	for (int i = 1; i <= h; ++i) {
		for (int j = 1; j <= w; ++j) {
			char c;
			cin >> c;
			a[i][j] = (c == '#');
		}
	}
	dp[1][1] = 1;
	for (int i = 1; i <= h; ++i) {
		for (int j = (i == 1 ? 2 : 1); j <= w; ++j) {
			if (a[i][j]) continue;
			dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
		}
	}
	cout << dp[h][w] << '\n';
}

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


int c(int x)
{
    int m = 0, t = 0, ret = 0;
    while(m <= x)
    {
        ret++;
        t++;
        m+=t;
    }
    return ret-1;
}

void solve()
{
    ll n;
    cin >> n;
    ll ogn = n;
    ll cnt = 0, twos = 0;

    while(n%2==0)
    {
        twos++;
        n/=2;
    }
    cnt += c(twos);

    for(ll i = 3; i*i<ogn; i+=2)
    {
        twos = 0;
        while(n%i==0)
        {
            twos++;
            n/=i;
        }
        cnt += c(twos);
    }
    if(n>1)
        cnt++;
    cout << cnt << endl;
}


int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll t;
    solve();
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
#define _USE_MATH_DEFINES
#include <math.h>
int main() {
	ll n,m;cin>>n>>m;
	ll sum=0;
	for(ll i=0;i<m;i++){
		ll now;
		cin>>now;
		sum+=now;
	}
	if(sum<=n){
		cout << n-sum;
	}
	else{
		cout << -1;
	}
	// your code goes here
	return 0;
}

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

#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()

using namespace std;
typedef long long ll; typedef vector<ll> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, x;
	cin >>n >>x;
	VI s(n);
	rep(i, n) cin >>s[i];
	sort(all(s));
	VI dp(x+4); iota(all(dp), 0);
	rep(i, n){
		VI np(x+4);
		rep(j, x+1){
			(np[j] += dp[j % s[i]] + (i * dp[j] % MD)) %=MD;
		}
		swap(dp , np);
		//for(auto x :dp) printf("%lld ",x); puts("");
	}
	cout << dp[x] <<"\n";
}



Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;
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; }

struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){
    int n,m;
    cin>>n>>m;
    UnionFind tree(n);
    rep(i,m){
        int x,y,z;
        cin>>x>>y>>z;
        x--;y--;
        tree.unite(x,y);
    }
    int ans=0;
    rep(i,n){
        if(tree.par[i]==i)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
N = int(input())
num = []
for i in range(1,N+1):
    num.append(i)

for j in range(N):

    if num[j] % 3 == 0 and num[j]  % 5 == 0 :
        num[j] = 'FizzBuzz'
    elif num[j] % 3 == 0:
        num[j] = 'Fizz'
    elif num[j] % 5 == 0:
        num[j] = 'Buzz'

sum = 0

for k in range(N):
    if num [k] == 'FizzBuzz' or num[k] == 'Fizz' or num[k] =='Buzz':
        sum = sum
    else:
        sum = sum + num[k]

print(sum)


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

int count1=0;

int judge(int a,int b,int c){
    if(a>b && b>c){
        count1++;
    }else if(a<b &&b<c){
        count1++;
    }
}

int main(){
    int n;
    int p[20];
    cin >>n;
    for(int i=0;i<n;i++) cin >> p[i];
    for(int i=1;i<n-1;i++){
    judge(p[i-1],p[i],p[i+1]);
    }
    cout <<count1<<endl;
}

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

typedef long long ll;
typedef pair<int,int> P;
#define INF (int)(1e9)
#define EPS (1e-7)
#define MOD ((ll)1e9+7)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i = 1;i <= (int)(n); i++)
#define FOR(i,k,n) for(int i = (k); i < (int)(n); i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define pb push_back
#define vec vector<int>


/*--------------------------------------------*/
/*ll factorial(ll);
void list_Prime(ll);
ll divisor(ll);
ll lcm(ll, ll);//AとBの最小公倍数
ll gcd(ll,ll);

int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
*/
/*--------------------------------------------*/
/*--------------------------------------------*/
/*
ll factorial(ll n){
    if(n==1)return 1;
    return n*factorial(n-1);
}
ll lcm(ll A, ll B) {//最小公倍数
    ll a = A;
    ll b = B;
    if (a == 0 || b == 0) { return 0; }
    if (a < 0) { a = -a; }
    if (b < 0) { b = -b; }
    while (b > 0) {
        ll c = a % b;
        a = b;
        b = c;
    }
    return A/a*B;
}

ll gcd(ll a,ll b){
    while (b != 0) {
        int t = b;
        b = a % b;
        a = t;
    }
    return a;
}


void list_Prime(ll n){//n以下の素数を全て見つける
    ll Limit=(int)sqrt((double)n);
    for(ll i=2;i<=n;i++)prime[i]=1;//最初はみんな素数かも
    //素数の整数倍を消していく(ルートnまで)
    for(ll i=2;i<=Limit;i++){
        if(prime[i]){
            for(ll j=2*i;j<=n;j++){
                if(j%i==0){
                    prime[j]=0;                
                }
            }
        }
    }
}

ll divisor(ll n){
    for(ll i=2;i<=n;i++){
        ll d=1;
        ll tmp=i;
        while(tmp>0){
            d++;
            while(tmp%d==0){
                prime[i]++;
                tmp/=i;
            }
        }
    }
    ll sum=1;
    for(ll i=2;;i<=n;i++){
        sum*=(prime[i]+1)/MOD;
    }    
    cout<<"sum="<<sum<<endl;

    return sum%MOD;
}
*/
/*--------------------------------------------*/
int bfs(void);//最短距離をreturn
const int MAX_N=100010;
int n;
vec dp(MAX_N,-1);
int main(){//最短経路問題
    cin>>n;
    dp[0]=0;
    cout<<bfs()<<endl;
}
int bfs(void){
    queue<int> que;//レジ順
    que.push(0);
    while(que.size()){
        int prev=que.front();//prevに保存
        que.pop();//待ち行列の先頭を取り出して保存し終えたので消す
        for(int pow6=1;prev+pow6<=n;pow6*=6){
            if(dp[prev+pow6]==-1){//未訪問
                dp[prev+pow6]=dp[prev]+1;
                //printf("dp[%d]=%d\n",prev+pow6,dp[prev+pow6]);
                que.push(prev+pow6);
            }
        }
        for(int pow9=1;prev+pow9<=n;pow9*=9){
            if(dp[prev+pow9]==-1){//未訪問
                dp[prev+pow9]=dp[prev]+1;
                //printf("dp[%d]=%d\n",prev+pow9,dp[prev+pow9]);
                que.push(prev+pow9);
            }
        }
        
    }
    return dp[n];
}


Measured memory_bytes: 768
//g++ -std=c++17 -Wall t.cpp -o test -lm -g -O2
#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int, int>
#define vi vector<int>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl '\n'
#define teto(a, b) (a+b-1)/(b)

const int MAX = 400010;
const int MOD = 998244353;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-8;
const ld PI = acosl(-1.0);

// End - Template //

using namespace std;

int main()
{
    ll r, D, x, aux;

    cin >> r >> D >> x;

    for(int i=0;i<10;i++)
    {
        aux = r*x - D;
        x=aux;
        cout << aux << endl;
    }

    return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
a = []
for i in range(n):
    a.append(input())
b = []
for g in range(m):
    b.append(input())
#print(a)
#print(b)
ans = 'No'

for c in range(n-m+1):
    for d in range(n-m+1):
        C = [a[d+e][c:c+m] for e in range(m)]
        if C == b:
            ans = 'Yes'
    
print(ans)

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

int main(int argc, char *argv[])
{
  vector<int> v;
  int tmp;
  cin >> tmp;
  while(tmp != 0) {
    v.push_back(tmp);
    cin >> tmp;
  }

  for(int i = 0; i < (int)v.size(); i++) {
    cout << "Case " << i+1 << ": " << v.at(i) << endl;
  }

  return 0;
}



Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define pb push_back
#define bp __builtin_popcount
#define sz size()
#define ff first
#define ss second
#define vll vector<ll>
#define vbool vector<bool>
#define vpll vector<pair<ll,ll>>
#define pll pair<ll,ll>
#define vllv vector<vector<ll>>
#define setpri(x) cout<<setprecision(x)<<fixed;
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){if(n%x==0)return n/x; else return (n/x)+1;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;
}
ll modinv(ll n,ll mod){
    return pow1(n,mod-2,mod);
}
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
    if(a.ff != b.ff)return a.ff < b.ff;
    return a.ss > b.ss;
}

void solve(){
    ll i,j,k,l,n,m,x,y,z,r;
	cin>>n;
	
	ll t=100;
	ll ans=0;
	while(t<n){
		t=t+(t/100);
		ans++;
	}
	cout<<ans<<endl;
    
  
}
int main(){
    FS;
    ll i,j,k,n,m,x,y,z,q;
    q=1;
    // cin>>q;
    while(q--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
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; }
ll MOD = 1000000007;
int INF = 1001001001;

void solve()
{
	string s; cin >> s;
    int ans = 0;
    rep(i, sz(s))ans += (s[i]-'0');
    cout << ans << endl;
    return;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


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

int main(){
    int a[5];
    for(int i = 0;i < 5;i++){
        cin >> a[i];
    }

    int k;

    cin >> k;

    if(a[4]-a[0] > k){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input!(n: usize, a: [u64; 1 << n]);
    let mut dp: Vec<_> = std::iter::successors(Some(0), |x| Some(x + 1))
        .map(|i| [i, i])
        .take(a.len())
        .collect();
    for bs in 1..1 << n {
        let mut v: Vec<_> = (0..n)
            .filter(|&i| bs >> i & 1 == 1)
            .map(|i| dp[bs ^ 1 << i].iter())
            .flatten()
            .copied()
            .chain(std::iter::once(bs))
            .collect();
        v.sort_by_key(|&i| std::cmp::Reverse(a[i]));
        v.dedup();
        dp[bs] = [v[0], v[1]];
    }
    let mut ans = 0;
    for bs in 1..1 << n {
        let x = a[dp[bs][0]] + a[dp[bs][1]];
        if ans < x {
            ans = x;
        }
        println!("{}", ans);
    }
}


Measured memory_bytes: 12056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, l, r) for (int i = l; i <= (int)(r); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define all(v) v.begin(), v.end()
#define MOD (int) (1e9+7)
#define INF (int) 1e9
#define LLINF (ll) 1e18

int main(){
    int n;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];
    int q;
    cin >> q;
    int b[q], c[q];
    rep(i, q) cin >> b[i] >> c[i];

    ll s = 0;

    map<int, int> m;
    rep(i ,n){
        m[a[i]]++;
    }
    for (auto &&i : m){
        s += (ll)i.first * i.second;
    }
    
    rep(i, q){
        int tmp = m[b[i]];
        m[c[i]] += m[b[i]];
        m[b[i]] = 0;
        s += (ll) (c[i]-b[i]) * tmp;
        cout << s << endl;
    }

    
    // printf("%d\n", N);
    return 0;
}

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

#define REP(i, s,  n) for(int i = s;i < (n);i++)
#define VSORT(v) sort(v.begin(), v.end());
#define int64 long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> PP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

//---------------------------------------------------------------
//---------------------------------------------------------------

int N, K;

signed main(){
	cin >> N >> K;
	
	int ans;
	if(N <= K)	ans = 1;
	else {
		ans = (N - K) / (K - 1) + 1;
		if((N - K) % (K - 1) > 0)	ans += 1;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
N = int(input())
S = list(map(str, input()))
flg = 0

def f(a, b, c):
	if a == "S" and b == "S" and c == "o":
		return "S"
	elif a == "S" and b == "S" and c == "x":
		return "W"
	elif a == "S" and b == "W" and c == "o":
		return "W"
	elif a == "S" and b == "W" and c == "x":
		return "S"
	elif a == "W" and b == "S" and c == "o":
		return "W"
	elif a == "W" and b == "S" and c == "x":
		return "S"
	elif a == "W" and b == "W" and c == "o":
		return "S"
	else:
		return "W"

for first, second in [("S", "S"), ("S", "W"), ("W", "S"), ("W", "W"), ]:
	ans = [None] * N
	ans[0], ans[1] = first, second
	
	for i in range(1, N - 1):
		ans[i + 1] = f(ans[i - 1], ans[i], S[i])
		
	if f(ans[-2], ans[-1], S[-1]) == ans[0] and f(ans[-1], ans[0], S[0]) == ans[1]:
		flg = 1
		break
		
if flg:
	for a in ans:
		print(a, end = "")
else:
	print(-1)

Measured memory_bytes: 63632
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int n,k;
double ans =0;
double temp =0;
ll jud =0;

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


    rep(i,n){
        temp = i+1;
        jud =0;
        while(temp < k){
            temp *= 2;
            jud ++;
        }
        ans += (1.0/n) * pow(0.5, jud);
    }

    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef long long ll;
map<ll,int> s;
map<ll,bool> h;
const int maxn=100000+10,maxd=2200;
int id[maxn],pri[maxn],f[maxn],p[maxn][2],sta[maxn];
ll a[maxn],b[maxn];
bool bz[maxn];
int i,j,l,n,m,tot,top,cnt,ans,ca;
ll k,t;
int main(){
	fo(i,2,maxn-10){
		if (!bz[i]) pri[++top]=i,f[i]=i;
		fo(j,1,top){
			if ((ll)i*pri[j]>maxn-10) break;
			bz[i*pri[j]]=1;
			f[i*pri[j]]=pri[j];
			if (i%pri[j]==0) break;
		}
	}
	scanf("%d",&n);
	fo(i,1,n){
		scanf("%lld",&a[i]);
		k=a[i];
		a[i]=b[i]=1;
		fo(j,2,maxd){
			if (k==1) break;
			if (bz[j]) continue;
			t=(ll)j*j*j;
			while (k%t==0) k/=t;
			t=j*j;
			if (k%t==0){
				a[i]*=t;
				b[i]*=j;
			}
			else if (k%j==0){
				a[i]*=j;
				b[i]*=t;
			}
			while (k%j==0) k/=j;
		}
		if (k>1){
			t=ll(sqrt(k));
			if (t*t==k){
				a[i]*=k;
				b[i]*=t;
			}
			else{
				a[i]*=k;
				b[i]*=k*k;
			}
		}
	}
	fo(i,1,n) s[a[i]]++;
	fo(i,1,n)
		if (!h[a[i]]){
			h[a[i]]=1;
			if (a[i]==b[i]) ans++;
			else{
				ans+=max(s[a[i]],s[b[i]]);
				h[b[i]]=1;
			}
		}
	/*ca=20;
	fo(i,1,n) id[i]=i;
	while (ca--){
		random_shuffle(id+1,id+n+1);
		tot=0;
		fo(i,1,n)
			if (!s[b[id[i]]]){
				sta[++tot]=id[i];
				s[a[id[i]]]=1;
			}
		ans=max(ans,tot);
		fo(i,1,tot) s[a[sta[i]]]=0;
	}*/
	printf("%d\n",ans);
}

Measured memory_bytes: 27392
using System;
using System.Linq;
using System.Collections.Generic;

class Program {
    static void Main() {
        string s = Console.ReadLine();
        string ns = "";
        for(int i = 0; i < s.Length; i++) {
            if('a' <= s[i] && s[i] <= 'z') ns += (char)(s[i] + 'A' - 'a');
            else if('A' <= s[i] && s[i] <= 'Z') ns += (char)(s[i] + 'a' - 'A');
            else ns += s[i];
        }
        Console.WriteLine(ns);
    }
}


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

#define hell                         1000000007
#define lcm(a,b)                     ((a*b)/__gcd(a,b))
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;
vll adj[MAXN],out(MAXN);
ll vis[MAXN],ans;
map<pair<ll,ll>,ll> mm;
void dfs(ll u,ll c){
	vis[u]=1;
	ll st=0;
	for(auto it:adj[u]){
		if(!vis[it]){
			if(c==st) st=(st+1)%ans;
			out[mm[mp(u,it)]]=st+1;
			dfs(it,st);
			st++;
		}
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	ll i,j,n,m,k,cnt=0,t=1;
	cin>>n;
	rep(i,0,n-1){
		cin>>j>>k;
		adj[j].pb(k);
		adj[k].pb(j);
		mm[mp(j,k)]=i;
		mm[mp(k,j)]=i;
	}	
	rep(i,1,n+1) ans=max(ans,(ll)adj[i].size()); 
	dfs(1,-1);
	cout<<ans<<endl;
	rep(i,0,n-1) cout<<out[i]<<endl;
	return 0;
}

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

#define N 4
#define X 0
#define Y 1
#define Z 2
#define W 3

int main()
{
	while (true)
	{
		int n;
		cin >> n;
		if (!n)
		{
			return 0;
		}

		for (int i=0; i<n; i++)
		{
			int val1[N], val2[N];
			for (int j=0; j<N; j++)
			{
				cin >> val1[j];
			}
			for (int j=0; j<N; j++)
			{
				cin >> val2[j];
			}

			int ans[N];

			ans[X] = val1[X]*val2[X]
					 -val1[Y]*val2[Y]
					 -val1[Z]*val2[Z]
					 -val1[W]*val2[W];

			ans[Y] = val1[X]*val2[Y]
					 +val1[Y]*val2[X]
					 +val1[Z]*val2[W]
					 -val1[W]*val2[Z];

			ans[Z] = val1[X]*val2[Z]
					 -val1[Y]*val2[W]
					 +val1[Z]*val2[X]
					 +val1[W]*val2[Y];

			ans[W] = val1[X]*val2[W]
					 +val1[Y]*val2[Z]
					 -val1[Z]*val2[Y]
					 +val1[W]*val2[X];

			cout << ans[X] << ' '
				 << ans[Y] << ' '
				 << ans[Z] << ' '
				 << ans[W] << '\n';
		}
	}
}

Measured memory_bytes: 1160
import Foundation
// 第一引数に二分探索したい配列を渡す
// 第二引数に検索したい要素を渡す
// 第三引数に二分探索したい配列の大きさを渡す
func binarySearch(list:[Int],item:Int,cnt:Int)->Int{
    // 解の存在範囲を初期化
    var low = -1
    var high = cnt 
    // 解の存在範囲が1より大きい間、繰り返す
    while (high - low > 1) {
        let mid = Int(floor(Double(low + high) / 2))
        if list[mid] >= item {
            // midが条件を満たせば、解の存在範囲は(low,mid]
            high = mid
        } else {
            // midが条件を満たさなければ、解の存在範囲は(mid,high]
            low = mid
        }
    }
    // この時点で、low + 1 = highとなっている
    return high
}
 
// 標準入力の受け取り
let n = Int(readLine()!)!
var a = readLine()!.split(separator:" ").map{Int($0)!}
var b = readLine()!.split(separator:" ").map{Int($0)!}
var c = readLine()!.split(separator:" ").map{Int($0)!}
 
// 配列aと配列cをソートする
a.sort { $0 < $1 }
c.sort { $0 < $1 }
 
// 答えを入れる変数を用意
var ans = 0
 
// 中部のパーツの配列に対して全探索
for i in b{
    // 各配列に対して二分探索
    let ai = binarySearch(list:a,item:i,cnt:n)
    let ci = binarySearch(list:c,item:i+1,cnt:n)
    
    // ansに考えられるパーツの組み合わせの個数を加える
    ans += (ai)*(n-ci)
}
 
// 答えを出力
print(ans)

Measured memory_bytes: 22948
import java.util.Scanner;

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

		while(true){
			int icegauretakazu = stdIn.nextInt();
			if(icegauretakazu==0){
				break;
			}
			int[] uretaice = new int[icegauretakazu];
			int[] kakuicenouretakazu = new int[10];

			for(int i=0;i<icegauretakazu;i++){
				uretaice[i]=stdIn.nextInt();
			}
			for(int i=0;i<uretaice.length;i++){
				switch (uretaice[i]){
				case 0:
					kakuicenouretakazu[0]++;
					break;
				case 1:
					kakuicenouretakazu[1]++;
					break;
				case 2:
					kakuicenouretakazu[2]++;
					break;
				case 3:
					kakuicenouretakazu[3]++;
					break;
				case 4:
					kakuicenouretakazu[4]++;
					break;
				case 5:
					kakuicenouretakazu[5]++;
					break;
				case 6:
					kakuicenouretakazu[6]++;
					break;
				case 7:
					kakuicenouretakazu[7]++;
					break;
				case 8:
					kakuicenouretakazu[8]++;
					break;
				case 9:
					kakuicenouretakazu[9]++;
					break;
				}
			}
			for(int i=0;i<10;i++){
				if(kakuicenouretakazu[i] != 0){
					for(int j=0;j<kakuicenouretakazu[i];j++){
						System.out.print('*');
					}
				}else{
					System.out.print('-');
				}
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 13000
s=list(input())
n=len(s)+1
l=[]

for i in range(n-1):
    if s[i:i+2]==[">","<"]:
        l.append(i+1)

m=0
if l==[]:
        a=s.count("<")
        b=s.count(">")
        m=m+(max(a,b)+1)*max(a,b)//2+(min(a,b)+1)*min(a,b)//2-min(a,b)


else:
    l.insert(0,0)
    l.append(n)
    for i in range(len(l)-1):
        a=s[l[i]:l[i+1]].count("<")
        b=s[l[i]:l[i+1]].count(">")
        m=m+(max(a,b)+1)*max(a,b)//2+(min(a,b)+1)*min(a,b)//2-min(a,b)

print(m)

Measured memory_bytes: 12656
#include<stdio.h>
#define N 101
#define INF (1<<21)
#define NIL -1
#define Black -2
#define White -3

typedef struct{
  int dis;
  int color;
}Node;

int main(){
  int e, i, j, k, n, u[N], A[N][N], sum = 0;
  Node d[N];
  scanf("%d", &n);
  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      scanf("%d", &e);
      A[i][j] = (e == -1)?INF:e;
      d[i].color = White;
      if(i == 0)d[i].dis = 0;
      else d[i].dis = INF;
    }
  }
  u[0] = 0;
  d[0].color = Black;
  for(k = 1;k < n;k++){
    for(i = 0;i < k;i++){
      for(j = 0;j < n;j++){
	if(d[k].dis > A[u[i]][j] && d[j].color != Black){
	  d[k].dis = A[u[i]][j];
	  u[k] = j; 
	}
      }	
    }
    d[u[k]].color = Black;  
    sum += d[k].dis;
  }
  printf("%d\n", sum);
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

string L;
int constexpr N = 100009, MOD = 1000000007;
vector<int> p3(N);

int mpow(int a, int b) {
    int ans = 1;
    do {
        if(b & 1)
            ans = 1ll * ans * a % MOD;
        a = 1ll * a * a % MOD;
    } while(b >>= 1);
    return ans;
}

int go(int i) {
    if(i == (int) L.size())
        return 1;
    
    int ret = 0;
    if(L[i] == '1') {
        ret = 2ll * go(i + 1) % MOD + mpow(3, (int) L.size() - i - 1);
    }
    if(L[i] == '0') {
        ret = go(i + 1);
    }
    if(ret >= MOD)
        ret -= MOD;
    return ret;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> L;
    
    cout << go(0) << '\n';
}

Measured memory_bytes: 4048
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	m := make(map[string]struct{})
	var s string
	for i := 0; i < n; i++ {
		fmt.Scan(&s)
		m[s] = struct{}{}
	}
	var cnt int
	for _, _ = range m {
		cnt++
	}
	if cnt == 3 {
		fmt.Println("Three")
		return
	}
	fmt.Println("Four")
}


Measured memory_bytes: 512
n,m,x = map(int,input().split())
c = []
for i in range(n):
    ci = list(map(int,input().split()))
    c.append(ci)
t = [0 for i in range(m+1)]
def dfs(l,i):
    if i == n:
        if min(l[1:]) >= x:
            return l[0]
        else:
            return 10**9
    d = l[:]
    for j in range(m+1):
        d[j] += c[i][j]
    return min(dfs(l,i+1),dfs(d,i+1))
ans = dfs(t,0)
if ans == 10**9:
    print(-1)
    exit()
print(ans)

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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {

            var line1 = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
            var N = line1[0];
            var M = line1[1];
            var a = new long[M];
            var b = new long[M];

            int bridge = 0;

            int[,] dag = new int[N,N];

            for (int i = 0; i < M; i++)
            {
                var line2 = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
                a[i] = line2[0]-1;
                b[i] = line2[1]-1;
                dag[a[i], b[i]] = 1;
                dag[b[i], a[i]] = 1;
            }

            for (int i = 0; i < M; i++)
            {
                bool[] visited = new bool[N];
                dag[a[i], b[i]] = 0;
                dag[b[i], a[i]] = 0;
                DFS(0,visited,dag);

                if (visited.Where(n => n == true).Count() != N)
                {
                    bridge++;
                }

                dag[a[i], b[i]] = 1;
                dag[b[i], a[i]] = 1;
            }
            Console.WriteLine(bridge);
        }

        public static void DFS(int v,bool[] visited,int[,] dag)
        {
            visited[v] = true;

            for (int i = 0; i < visited.Length; i++)
            {
                if (dag[v, i] == 0) continue;
                if (visited[i]) continue;
                DFS(i,visited,dag);
            }

        }

        public static long LowerBound<T>(T[] arr, long start, long end, T value, IComparer<T> comparer)
        {
            long low = start;
            long high = end;
            long mid;
            while (low < high)
            {
                mid = ((high - low) >> 1) + low;
                if (comparer.Compare(arr[mid], value) < 0)
                    low = mid + 1;
                else
                    high = mid;
            }
            return low;
        }

        //引数省略のオーバーロード
        public static long LowerBound<T>(T[] arr, T value) where T : IComparable
        {
            return LowerBound(arr, 0, arr.Length, value, Comparer<T>.Default);
        }

        public static long UpperBound<T>(T[] arr, long start, long end, T value, IComparer<T> comparer)
        {
            long low = start;
            long high = end;
            long mid;
            while (low < high)
            {
                mid = ((high - low) >> 1) + low;
                if (comparer.Compare(arr[mid], value) <= 0)
                    low = mid + 1;
                else
                    high = mid;
            }
            return low;
        }

        //引数省略のオーバーロード
        public static long UpperBound<T>(T[] arr, T value)
        {
            return UpperBound(arr, 0, arr.Length, value, Comparer<T>.Default);
        }
    }

}


Measured memory_bytes: 13396
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr usize operator"" _z(unsigned long long x) noexcept {
  return static_cast<usize>(x);
}

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}

} // namespace n91

#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <tuple>
#include <utility>

namespace n91 {

void main_() {
  static constexpr u64 INF = std::numeric_limits<u64>::max() / 100;

  usize n;
  std::cin >> n;
  std::vector<u64> v(n);
  for (auto &e : v) {
    std::cin >> e;
  }
  using arg = std::tuple<usize, usize, u64, u64>;
  std::map<arg, u64> memo;
  const auto dp = [&](const auto &dp, const arg &a) -> u64 {
    if (!memo.count(a)) {
      usize l, r;
      u64 x, y;
      std::tie(l, r, x, y) = a;
      u64 min = INF;
      if (r - l == 1_z) {
        min = static_cast<u64>(0);
      } else if (x > INF || y > INF) {
        min = INF;
      } else {
        for (const auto m : rep(l + 1_z, r)) {
          min = std::min(min, dp(dp, arg(l, m, x, x + y)) +
                                  dp(dp, arg(m, r, x + y, y)) + v[m] * (x + y));
        }
      }
      memo[a] = min;
    }
    return memo[a];
  };
  std::cout << v[0_z] +
                   dp(dp,
                      arg(0_z, n - 1_z, static_cast<u64>(1), static_cast<u64>(1))) +
                   v[n - 1_z]
            << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 43136
def main():
    N, M, K = (int(_) for _ in input().split())
    for a in range(N+1):
        for b in range(M+1):
            if b*(N-a)+a*(M-b) == K:
                print('Yes')
                break
        else:
            continue
        break
    else: print('No')
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
//#define MOD (998244353)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    int n,b;cin>>n>>b;
    int cnt=0;
    while(n){
        n/=b;
        cnt++;
    }
    cout<<cnt;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=1e6+9;
 
// Happy Coding!


void solve(){
    int n,m;
    cin>>n>>m;
    
    vi freq(m+1,0);
    for(int i=0;i<n;i++){
        int sz;
        cin>>sz;
        for(int j=0;j<sz;j++){
            int f;
            cin>>f;
            freq[f]++;
        }
    }
    int ans=0;
    for(int i=1;i<=m;i++){
        if(freq[i]==n){
            ans++;
        }
    }
    cout<<ans<<endl;
}



int main() {
    faster;
    int t=1;
    // cin>>t;
    while(t-->0){
        solve();
    }
	return 0;
}

Measured memory_bytes: 3580
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn is_ok(a: &Vec<char>, b: &Vec<char>) -> Vec<bool> {
    let mut ret = vec![true; a.len()];
    for i in 0..a.len() {
        if (0..b.len())
            .any(|j| i + j < a.len() && b[j] != '?' && a[i + j] != '?' && b[j] != a[i + j])
        {
            ret[i] = false;
        }
    }
    ret
}

fn main() {
    let a = read::<String>().chars().collect::<Vec<_>>();
    let b = read::<String>().chars().collect::<Vec<_>>();
    let c = read::<String>().chars().collect::<Vec<_>>();
    // [0]a->b, [1]b->a, [2]b->c, [3]c->b, [4]a->c, [5]c->a
    let mut ok = vec![vec![]; 6];
    for (i, &(ref a, ref b)) in [(&a, &b), (&b, &a), (&b, &c), (&c, &b), (&a, &c), (&c, &a)]
        .iter()
        .enumerate()
    {
        ok[i] = is_ok(&a, &b);
    }

    let mut ans = a.len() + b.len() + c.len();
    let criterion = |ok: &Vec<bool>, i| i >= ok.len() || ok[i];
    for &(ref ok0, ref ok1, ref ok2, l1, l2, l3) in &[
        (&ok[0], &ok[2], &ok[4], a.len(), b.len(), c.len()), // a -> b -> c
        (&ok[4], &ok[3], &ok[0], a.len(), c.len(), b.len()), // a -> c -> b
        (&ok[1], &ok[4], &ok[2], b.len(), a.len(), c.len()), // b -> a -> c
        (&ok[2], &ok[5], &ok[1], b.len(), c.len(), a.len()), // b -> c -> a
        (&ok[5], &ok[0], &ok[3], c.len(), a.len(), b.len()), // c -> a -> b
        (&ok[3], &ok[1], &ok[5], c.len(), b.len(), a.len()), // c -> b -> a
    ] {
        for i in 0..ok0.len() {
            if !criterion(ok0, i) {
                continue;
            }
            for j in i..ok0.len() + ok1.len() {
                if criterion(ok1, j - i) && criterion(ok2, j) {
                    let cur_length = *[l1, i + l2, j + l3].iter().max().unwrap();
                    ans = min(ans, cur_length);
                    break;
                }
            }
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
int main(void){
char s[100000];
int i;
scanf("%s",s);
for(i=0;i<strlen(s);i++){
	if((i+1)%2!=0){
		
		
		printf("%c",s[i]);
		
		
		
		
		
	}
	
	
	
	
	
	
	
	
}
printf("\n");

	return 0;
}

Measured memory_bytes: 256