akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#include <set>
#include <iterator>
using namespace std;
using namespace __gnu_pbds;


#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define INF INT_MAX
#define matrix vector<vector<ll> >

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )
#define maxbits 9
#define maxmask (1ll<<maxbits)
typedef tree<pll, null_type, less<pll>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
const int  N=100000 +10, M=(ll)1e9+1 ;
 const int mod =998244353 ,sz=5 ;

void work(){
  ll n;
  cin >> n;
  vll a(n);
  for(ll i=0;i<n;i++){
    ll x;
    cin >> x;
    a[i]={x,i};
  }
  sort(a.begin(),a.end());
  ll ma=a[n-1].f,id=a[n-1].s;
  for(ll i=0;i<n;i++){
    if(i==id)
      cout << a[n-2].f << "\n";
    else
      cout << ma << "\n";
  }
  
    
}
int main(){
 ios_base::sync_with_stdio(0);
 cin.tie(0);
    ll t;
    // cin >> t;
    t=1;
    while(t--){
            work();
    }
   return 0;

}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
/*#include <boost/range/irange.hpp>
using boost::irange;*/
using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, s, n) for (int i = s; i < (int)(n); i++)
#define inpv(i, n, v) rep(i,n) do {int tmp; cin>>tmp; v.push_back(tmp);} while(0)
#define outv(i,n,v) rep(i,n) cout << v[i] << endl
/*
for (int i : irange(0, n))
*/

void Main() {
    int n,r;
    cin >> n >> r;
    if (n < 10) r=r+100*(10-n);
    cout << r;
}

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

Measured memory_bytes: 256
#pragma comment(linker, "/STACK:1024000000,1024000000")
//#include<bits/stdc++.h>
#include <algorithm>  
#include <iostream>  
#include <cstdlib>  
#include <cstring>  
#include <string>
#include <cstdio>  
#include <climits>
#include <cmath> 
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <sstream>
#define inf 0x3f3f3f3f
#define ll long long
#define fora(i,a,n) for(int i=a;i<=n;i++)
#define fors(i,n,a) for(int i=n;i>=a;i--)
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define sci2(x,y) scanf("%d%d",&x,&y)
#define scl2(x,y) scanf("%lld%lld",&x,&y)
const int maxn = 100024;
const int mod = 1e9 + 7;
const double eps = 1e-8;
using namespace std;
typedef pair<int, int> pr;


int n, m;
char s[122][111];
int visr[111];
int visc[111];
int main() {
#ifdef local
	freopen("in.txt", "r", stdin);
	//freopen("out.txt","w",stdout);
#endif
	cin >> n >> m;
	fora(i, 0, n - 1) {
		scanf("%s", s[i]);
	}
	fora(i, 0, n - 1) {
		int num = 0;
		fora(j, 0, m - 1) {
			if (s[i][j] == '#') num++;
		}
		if(num==0)	visr[i] = 1;
	}
	
	fora(j, 0, m - 1) {
		int num = 0;
		fora(i, 0, n - 1) {
			if (s[i][j] == '#') num++;
		}
		if (num == 0) visc[j] = 1;
	}

	fora(i, 0, n - 1) {
		bool flag = false;
		if (visr[i]) flag = true;
		fora(j, 0, m - 1) {
			if (visr[i] || visc[j]) {
				continue;
			}
			printf("%c", s[i][j]);
		}
		if (flag== false) printf("\n");
	}
	return 0;
}

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

int calc_score(int M, int D, vector<vector<int>> &S, vector<int> &T, vector<int> &C)
{
    int ans = 0;
    vector<int> last(M, -1);
    for(int i=0; i<D; i++)
    {
        ans += S[i][T[i]];
        last[T[i]] = i;
        for(int j=0; j<M; j++)
        {
            ans -= C[j] * (i - last[j]);
        }
    }
    return ans;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int D;
    cin >> D;
    const int M = 26;
    vector<int> C(M);
    for(int i=0; i<M; i++) cin >> C[i];
    vector<vector<int>> S(D, vector<int>(M));
    for(int i=0; i<D; i++)
    {
        for(int j=0; j<M; j++)
        {
            cin >> S[i][j];
        }
    }
    vector<int> T(D);
    for(int i=0; i<D; i++)
    {
        cin >> T[i];
        T[i]--;
    }
    int N;
    cin >> N;
    vector<int> H(N), Q(N);
    for(int i=0; i<N; i++)
    {
        cin >> H[i] >> Q[i];
        H[i]--; Q[i]--;
    }
    int score = calc_score(M, D, S, T, C);
    for(int i=0; i<N; i++)
    {
        int tmp = T[H[i]];
        T[H[i]] = Q[i];
        int nscore = calc_score(M, D, S, T, C);
        cout << nscore << endl;
        // if(score < nscore)
        // {
        //     score = nscore;
        // }
        // else
        // {
        //     T[H[i]] = tmp;
        // }
    }


    return 0;
}


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

int main() {
  // 所持金1円硬貨A枚、500円硬貨無限枚の時、ちょうどN円払えるか？
  //できるならYes、できないならNoを出力。
  // 1<=N<=10000,0<=A<=1000
  
  int N, A, x;
  cin >> N >> A;
  x = N % 500;

  //N = 1500, A = 1000;
  
  	if  (A >= x) {
      cout << "Yes" << endl;
  	}
  	else {
      cout << "No" << endl;
	}
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, X;
	cin >> N >> X;
	int B[100000], L[100000], U[100000];
	rep(i, N) {
		cin >> B[i] >> L[i] >> U[i];
	}
	pair<ll, int> S[100000];
	rep(i, N) {
		S[i].first = 1ll * X * U[i] - 1ll * B[i] * (U[i] - L[i]);
		S[i].second = i;
	}
	sort(S, S + N);
	reverse(S, S + N);

	ll taka = 0;
	ll ao = 0;	
	rep(i, N) {
		int k = S[i].second;
		ao += 1ll * B[k] * L[k];
	}
	int doko = 0;
	rep(i, N) {
		doko = i;
		int k = S[i].second;
		taka += 1ll * X * U[k] - 1ll * B[k] * (U[k] - L[k]);
		if (taka >= ao) break;
	}

	if (taka == ao) {
		co(1ll * (doko + 1) * X);
		return 0;
	}

	ll ans = 1ll * (doko + 1) * X;
	int Umin = 200000;
	ll tiisai = 1e18;
	rep(i, doko + 1) {
		int k = S[i].second;
		Umin = min(Umin, U[k]);

		ll kari = -(taka - ao + 1ll * B[k] * (U[k] - L[k]) - 1ll * X * U[k]);
		tiisai = min(tiisai, (kari + L[k] - 1) / L[k]);
	}
	ans -= (taka - ao) / Umin;
	ce(ans);
	ans = min(ans, 1ll * doko * X + tiisai);

	ll tmp = ao - taka;
	int t = S[doko].second;
	tmp += 1ll * X * U[t] - 1ll * B[t] * (U[t] - L[t]);
	ll saishou = 1e18;
	for (int i = doko + 1; i < N; i++) {
		int k = S[i].second;

		ll kari = (tmp + 1ll * B[k] * (U[k] - L[k]) + U[k] - 1) / U[k];
		kari = min(kari, (tmp + L[k] - 1) / L[k]);

		saishou = min(saishou, kari);
	}

	ans = min(ans, 1ll * doko * X + saishou);

	co(ans);

	Would you please return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#include <string>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;

#define rep(i, n) for(int i = 0; i < n ; i++ )
#define For(i, a, b) for(int i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const int MAX_S = 100000;

int main(void){
    string S;
    int answer = 0;

    cin >> S;
    int N = (int)(S.length());

    rep(i, N){
        if(S[i] == '0' && i % 2 == 0 || S[i] == '1' && i % 2 == 1){
            answer ++;
        }
    }

    cout << min(N - answer, answer) << endl;

    return 0;
}

Measured memory_bytes: 512
a, v = gets.split(" ").map(&:to_i)
b, w = gets.split(" ").map(&:to_i)
t = gets.to_i

if v <= w
  puts "NO"
  exit
end

initial_ditance = (a - b).abs
speed_diff = v - w

if initial_ditance > speed_diff * t
  puts "NO"
else
  puts "YES" 
end

Measured memory_bytes: 14424
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)

const int L=1e6+7;
int a[L], n, k;
std::vector<int> dp(L, 1000000000);
int main()
{
		ios_base::sync_with_stdio(false);
	 	cin.tie(NULL);
	 	cin >> n >> k;
	 	FOR(i,1,n+1)cin >> a[i];
	 	dp[n] =  0;
		RFOR(i,n-1,1)
		{
			FOR(j,i+1,i+k+1)
			{
				if( j > n) break;
				dp[i] = min(dp[i],dp[j] + abs(a[i]- a[j]));
			}
		}
		cout<<dp[1];
		return 0;
}

Measured memory_bytes: 4608
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<long long int>A(N);
  for(int i=0; i < N; i++)
    cin >> A[i];
  sort(A.begin(),A.end(),greater<long long int>());
  vector<long long int>Acc(N);
  Acc[N-1] = 0;
  for(int i=N-2; i >= 0; i--)
    Acc[i] = Acc[i+1] + A[i+1];
  int ans = 1;
  for(int i=1; i < N; i++){
    if(A[i-1] <= 2*(A[i]+Acc[i])) ans++;
    else break;
  }
  cout << ans << endl;
  return 0;
}


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

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

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

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

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

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

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

	map<string, int> m;
	rep(i, N) {
		string s;
		cin >> s;
		m[s] += 1;
	}

	int result = 0;
	for(auto itr: m) {
		result+=1;
	}

	cout << result << endl;
  return 0;
}


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

int main(){
  ll N,X;
  cin >> N >> X;
  vector<ll> x(N);
  ll tmp;
  for(ll i=0;i<N;++i) cin >> x[i];
  if(N==1) tmp = abs(x[0]-X);
  else {
    tmp = __gcd(abs(x[0]-X),abs(x[1]-X));
    for(ll i=1;i<N-1;++i){
      tmp = __gcd(tmp,abs(x[i+1]-X));
    }
  }
  cout << tmp << endl;
}

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

bool flg[1000100];
vector<int> p;

void mkPrime(void){
	memset(flg,true,sizeof(flg));
	flg[0] = flg[1] = false;

	for(int i=2;i<=1000010;i++){
		if(flg[i]){
			for(int j=i+i;j<=1000010;j+=i){
				flg[j] = false;
			}
		}
	}

	for(int i=0;i<=1000010;i++){
		if(flg[i]){
			p.push_back(i);
		}
	}
}

int solve(int x){
	int res = 0;
	int last = 0;
	for(int i=0;p[i]<=x;i++){
		if(x % p[i] == 0){
			res -= p[i];
			last = i;
		}
	}

	return res + 2 * p[last];
}

int main(void){
	mkPrime();

	int a,b;
	while(cin>>a>>b, a){
		int remA = solve(a);
		int remB = solve(b);

		//cout<<remA<<","<<remB<<endl;

		cout<<(remA >= remB ? "a" : "b")<<endl;
	}

	return 0;
}

Measured memory_bytes: 2304
import math

N,D = map(int, input().split())
X =[0]*N
Y =[0]*N
R = [0]*N
cnt = 0
for i in range(N):
    X[i],Y[i] = map(int, input().split())
    R[i] = math.sqrt(X[i]**2+Y[i]**2)
    if(R[i]<=D):
        cnt += 1
print(cnt)






Measured memory_bytes: 32552
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    string s[3];
    for(int i=0;i<3;i++)cin>>s[i];
    int now=0,ans;
    while(1){
        if(s[now].empty()){
            ans=now;
            break;
        }
        int next;
        if(s[now][0]=='a')next=0;
        else if(s[now][0]=='b')next=1;
        else next=2;
        s[now]=s[now].substr(1);
        now=next;
    }
    if(ans==0)cout<<"A"<<endl;
    else if(ans==1)cout<<"B"<<endl;
    else cout<<"C"<<endl;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N = in_n()
    A = in_nl()

    A_sum = [0] * (N + 1)
    A_xor = [0] * (N + 1)

    for i in range(N):
        A_sum[i + 1] = A_sum[i] + A[i]
        A_xor[i + 1] = A_xor[i] ^ A[i]

    count = 0
    r = 0
    for l in range(N):
        while r < N:
            #print(l, r, A_sum[r + 1] - A_sum[l], A_xor[r + 1] ^ A_xor[l])
            if A_sum[r + 1] - A_sum[l] == A_xor[r + 1] ^ A_xor[l]:
                r += 1
            else:
                break
        count += r - l
        if r == l:
            r += 1

    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 36992
a, b = list(map(int, input().split()))

c = 0

for i in range(a, b+1):
    s = str(i)
    f = True
    for j in range(len(s)):
        #print(s[j], s[-j], i)
        if s[j] != s[-j-1]:
            f = False
            break
    if f:
        #print(i)
        c += 1

print(c)

Measured memory_bytes: 9084
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 3e5 + 5, mod = 1e9 + 7;

ll pw[60], cum[N][65];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    pw[0] = 1;
    for(int i = 1; i <= 61; i++) pw[i] = pw[i - 1] * 2 % mod;
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        ll x;
        cin >> x;
        for(int j = 0; j < 61; j++){
            cum[i][j] = (x >> j & 1);
            cum[i][j] += cum[i - 1][j];
        }
    }
    ll ans = 0;
    for(int i = 1; i < n; i++){
        for(int j = 0; j < 61; j++){
            int kam = cum[n][j] - cum[i][j];
            if(cum[i][j] - cum[i - 1][j] == 1) kam = n - i - kam;
            ll tmp = pw[j] * kam % mod;
            ans = (ans + tmp) % mod;
        }
    }
    cout << ans;


    return 0;
}


Measured memory_bytes: 155912
#include <stdio.h>
#include <stdlib.h>
#define MAX 100
int top;
void push(int);
int pop(void);
int S[MAX];

int a,b,c,sum;
int main(){
  char inputc[100];
  char *c;
  int inputi,i=0;

  while(1){
    if(scanf("%s",inputc)==EOF)break;
    if(inputc[0]!=' '){  
      if(inputc[0]=='+'){
	a=pop();
	b=pop();
	sum=a+b;
	push(sum);
      }
      else if(inputc[0]=='-'){
	a=pop();
	b=pop();
	sum=b-a;
	push(sum);
      }
      else if(inputc[0]=='*'){
	a=pop();
	b=pop();
	sum=a*b;
	push(sum);
}
      else {
	inputi=atoi(inputc);
	push(inputi);
      }
    }
  }
  printf("%d\n",S[1]);
  
  return 0;
}


void push(int x){
    top++;
    S[top]=x;

}

int pop(void){

    top--;
    return S[top+1];
}

Measured memory_bytes: 548
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
bool comp(int a,int b){
return a>b;
}
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int main()
{
	fast;
	int n,m;
	cin>>n>>m;
	ll  dp[n+1][m+1];
	memset(dp,0,sizeof(dp));
	
//	cin>>n>>m;
	char c[n+1][m+1];
	rep(i,1,n+1)
	{
		rep(j,1,m+1)
		{		
			cin>>c[i][j];				
		}
	}
	

	
	rep(i,1,n+1)
	{
		rep(j,1,m+1)
		{
			if(i==1&&j==1)
			dp[i][j]=1;
			
			else if(c[i][j]=='.')
			{
				dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
			}
	
			
		//	cout<<dp[i][j]<<" ";
			
		}
	//	cout<<endl;
	}
	cout<<dp[n][m];
	
	


}



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

int main() {
  int H, N;
  cin >> H >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    H -= A[i];
  }
  
  string ans;
  if (H <= 0)
    ans = "Yes";
  else
    ans = "No";
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
int n;
vector<int> dp;
void dfs(int a, int b){
	if(b < dp[a]){
		dp[a] = b;
		dfs(a*10%n, dp[a]);
		dfs((a+1)%n, dp[a]+1);
	}
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    dp.resize(n, 100);
    dfs(1, 1);
    cout << dp[0] << endl;
    return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
//#include <unordered_map>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a-1); i >= (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
ll mod=1000000007;
//ll mod=67280421310721;
//ll mod=998244353;
ll INF=1e18;
ll po(ll a,ll b)
{
	ll re=1;
	while(b)
	{
		if(b%2==1)
		{
			re=(re*a);
			re%=mod;
		}
		a=(a*a);
		a%=mod;
		b>>=1;
	}
	return re;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
//	cin>>test;
	while(test--)
	{
		int a,b,c;
		cin>>a>>b>>c;
		if(a==b||a==c||c==b)
		{
			if(a==b&&a==c&&b==c)
			{
				cout<<"No";
			}
			else
			cout<<"Yes";
		}
		else
		cout<<"No";
	}
	return 0;
}


Measured memory_bytes: 256
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()
}
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let n = read::<usize>();
    let an = read_vec::<i64>();
    let ans = an.iter().fold(0,|acc,&x| {
        gcd(acc,x)
    });
    println!("{}",ans);
}

fn gcd(x:i64,y:i64) -> i64 {
    if y == 0 { x
    } else {
        gcd(y,x % y)
    }
}

Measured memory_bytes: 8444
# -*- coding: utf-8 -*-
# 整数の入力
a, b = map(str, input().split())
# スペース区切りの整数の入力
c, d = map(int, input().split())
# 文字列の入力
e = str(input())

if a == e:
    c = c - 1
elif b ==e:
    d = d - 1
    
# 出力
print("{} {}".format(c, d))

Measured memory_bytes: 2940
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

string YorN(bool P) { if (P)return "Yes"; else return "No"; }

int main() {

    int A,B;
    char op;
    cin >> A>>op>>B;
    
    cout << ((op=='+') ? A+B : A-B) << endl;

    return 0;

}

Measured memory_bytes: 256
// D - Powerful Discount Tickets

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

	priority_queue<int> PQ;

	int A;
	for (int i=0; i<N; i++) {
		cin >> A;
		PQ.push(A);
	}

	while (M > 0) {
		int price = PQ.top();
		PQ.pop();
		price = price / 2;
		M--;
		PQ.push(price);
	}

	ll ans = 0;
	while (!PQ.empty()) {
		ans += PQ.top();
		PQ.pop();
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 892
# coding: utf-8
# Your code here!

S = input()

# print(S[0])
# print(S[1])
# print(S[2])
# print(S[3])

if S[0] == S[1]:
    print('Bad')
elif S[1] == S[2]:
    print('Bad')
elif S[2] == S[3]:
    print('Bad')
else:
    print('Good')

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

  ll ans=0,tmp=0;
  for(int i=0;i<n;i++){
    tmp+=a[i];
    ans+=tmp/2;
    tmp=tmp%2;
    if(a[i]==0) tmp=0;
  }
  cout<<ans<<endl;

  return 0;
}


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

int main() {
  char s[3];
  for (int i = 0; i < 3; i++) {
    cin >> s[i];
  }
  
  if (s[0] == 'S' && s[1] == 'S' && s[2] == 'S') {
    cout << 0;
  } else if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') {
    cout << 3;
  } else if (s[0] == 'R' && s[1] == 'S' && s[2] == 'S') {
    cout << 1;
  } else if (s[0] == 'S' && s[1] == 'R' && s[2] == 'S') {
    cout << 1;
  } else if (s[0] == 'S' && s[1] == 'S' && s[2] == 'R') {
    cout << 1; 
  } else if (s[0] == 'R' && s[1] == 'R' && s[2] == 'S') {
    cout << 2;
  } else if (s[0] == 'S' && s[1] == 'R' && s[2] == 'R') {
    cout << 2;
  } else if (s[0] == 'R' && s[1] == 'S' && s[2] == 'R') {
    cout << 1;
  }
}

Measured memory_bytes: 3588
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String[] hiki = scan.nextLine().split(" ");
    int H = Integer.parseInt(hiki[0]);
    int W = Integer.parseInt(hiki[1]);
    hiki = scan.nextLine().split(" ");
    int h = Integer.parseInt(hiki[0]);
    int w = Integer.parseInt(hiki[1]);
    System.out.println((H-h)*(W-w));
  }
}


Measured memory_bytes: 22868
A, B, C = map(int, input().split())
if A == B == C:
    if A % 2 == B % 2 == C % 2 == 0:
        print(-1)
    else:
        print(0)
    exit()
cnt = 0
while A % 2 == B % 2 == C % 2:
    a = A // 2
    b = B // 2
    c = C // 2
    A, B, C = b + c, a + c, a + b
    cnt += 1
print(cnt)

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

int main() {
	char a[11], b[10000];
	cin >> a;
	cin >> b;
	int i;
	for (i = 0; a[i] != 0; i++) {
		if (a[i] != b[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	if (b[i] != 0 && b[i + 1] == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

using namespace std;

void Main() {
    long long a, b, c;
    cin >> a >> b >> c;

    bool s = false;
    long long d = c - a - b;
    if (d > 0 && d * d > 4 * a * b) {
        s = true;
    }
    cout << (s ? "Yes" : "No") << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3588
import sys
input = sys.stdin.readline

N, K, C = map(int, input().split())
S = list(input().rstrip())

A = [0]
go = C
for s in S:
    if go >= C:
        if s == "o":
            A.append(A[-1]+1)
            go = 0
        else:
            A.append(A[-1])
    else:
        go += 1
        A.append(A[-1])

B = [0]*(N+1)
go = C
for i in reversed(range(N)):
    s = S[i]
    if go >= C:
        if s == "o":
            B[i] = B[i+1]+1
            go = 0
        else:
            B[i] = B[i+1]
    else:
        go += 1
        B[i] = B[i+1]

ans = []
for n in range(N):
    if S[n] == "o" and A[n] + B[n+1] < K:
        ans.append(str(n+1))

print("\n".join(ans))

Measured memory_bytes: 75720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10,mo=1e9+7;
int a[N],b[N],n,m,t;
set<int> s;
vector<pair<int,int> > d;
ll tr[N];
map<int,int> p,q;
#define low(x) (x&(-x))
void add(int x,ll v){
	for (;x<=2*n;x+=low(x))(tr[x]+=v)%=mo;
}
ll query(int x){
	ll ans=0;
	for (;x;x-=low(x))(ans+=tr[x])%=mo;
	return ans;
}
map<pair<int,int>,int> p1;
int main(){
	cin>>n>>m;
	for (int i=1;i<=n;i++)scanf("%d",&a[i]);
	for (int i=1;i<=m;i++)scanf("%d",&b[i]),s.insert(b[i]);
	for (int i=1;i<=n;i++)
		if (*s.begin()<=a[i]&&a[i]<=*s.rbegin()){
			d.push_back(make_pair(a[i]-*--s.upper_bound(a[i]),*s.lower_bound(a[i])-a[i]));
		}
	for (auto i:d)
		p[i.first]=p[i.second]=1;
	for (auto i:p)q[i.first]=++t;
	for (int i=0;i<d.size();i++){
		d[i].first=q[d[i].first],d[i].second=-q[d[i].second];
		if (p1[d[i]])d[i].first=-1;
		else p1[d[i]]=1;
	}
	sort(d.begin(),d.end());
	ll ans=1;
	for (auto i:d){
		if (i.first<0)continue;
		ll sum=query(-i.second-1)+1;
		add(-i.second,sum);
		ans=(ans+sum)%mo;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 27640
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>

#define rep(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (3e9)

using namespace std;
typedef long long int ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef priority_queue<int> PQI;
typedef priority_queue<int,vector<int>,greater<int> > PQSI;
typedef priority_queue<ll> PQL;
typedef priority_queue<ll,vector<ll>,greater<ll> > PQSL;

const int MOD = 1000000007;
struct mint { int n; mint(int n_ = 0) : n(n_) {} };
mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
mint operator+(mint a, mint b) { int x = a.n + b.n; return x - (x >= MOD) * MOD; }
mint operator-(mint a, mint b) { int x = a.n - b.n; return x + (x < 0) * MOD; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }
istream &operator>>(istream &i, mint &a) { return i >> a.n; }
ostream &operator<<(ostream &o, mint a) { return o << a.n; }

vector<mint> F_{1, 1}, R_{1, 1}, I_{0, 1};
void check_fact(int n) {
  for (int i = I_.size(); i <= n; i++) {
    I_.push_back(I_[MOD % i] * (MOD - MOD / i));
    F_.push_back(F_[i - 1] * i);
    R_.push_back(R_[i - 1] * I_[i]);
  }
}

mint I(int n) { check_fact(abs(n)); return n >= 0 ? I_[n] : -I_[n]; }
mint F(int n) { check_fact(n); return n < 0 ? 0 : F_[n]; }
mint R(int n) { check_fact(n); return n < 0 ? 0 : R_[n]; }
mint C(int n, int r) { return F(n) * R(n - r) * R(r); }
mint P(int n, int r) { return F(n) * R(n - r); }
mint H(int n, int r) { return n == 0 ? (r == 0) : C(n + r - 1, r); }

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; }
template<typename T>
vector<T> enum_div(T n){
    vector<T> ret;
    for(T i=1;i*i<=n;i++){
        if(n%i==0){
            ret.push_back(i);
            if(i*i!=n) ret.push_back(n/i);
        }
    }
    //sort(ret.begin(), ret.end());
    return ret;
}
template<typename T>
T gcd(T x, T y){
    if (y == 0) return x;
    else return gcd(y, x % y);
}
template<typename T>
T lcm(T x, T y){
    return (x / gcd(x, y)) * y;
}

int a;
string s;
int main(void){
    cin >> a;
    cin >> s;
    if (a >= 3200) cout << s << endl;
    else cout << "red" << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll k,n; cin >> k >> n;
	vl v(n+1); rep(i,n) cin >> v[i];
	v[n] = k;
	ll ans = 0;
	rep(i,n-1){
		if(i==0) chmax(ans,v[i]+v[n]-v[n-1]);
		else chmax(ans,v[i+1]-v[i]);
	}
	cout << k - ans << endl;
}


Measured memory_bytes: 1792
import sys
import socket

if socket.gethostname() in ['N551J', 'F551C']:
    sys.stdin = open('d1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def solve0():
    h = read_int()
    m = 1
    c = 1
    while h > 1:
        h = h//2
        m *= 2
        c += m
    return c

def solve():
    h = read_int()
    m = 1
    c = 0
    while h >= 1:
        c += m
        h = h//2
        m *= 2
    return c


def main():
    res = solve()
    print(res)


if __name__ == '__main__':
    main()


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

int main(void) {
	int a,b,c;
	cin >> a >> b >> c;
	int count= 0;

	for (int i = a; i <= b; i++)
	{
		if (c % i == 0)
		{
			count++;
		}
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 3116
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

int mod = 1e9 + 7;

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

    int N;
    cin >> N;

    vector<int> a(N);
    REP(i, N) cin >> a[i];
    sort(a.begin(), a.end());

    bool ok = true;
    if (N % 2 == 1) {
        if (a[0] != 0) {
            ok = false;
        } else {
            int cur = 2;
            for (int i = 1; i <= N - 2; i += 2) {
                if (a[i] != cur || a[i + 1] != cur) {
                    ok = false;
                    break;
                }
                cur += 2;
            }
        }
    } else {
        int cur = 1;
        for (int i = 0; i <= N - 2; i += 2) {
            if (a[i] != cur || a[i + 1] != cur) {
                ok = false;
                break;
            }
            cur += 2;
        }
    }
    if (!ok) {
        cout << 0 << endl;
        return 0;
    }

    int n = N / 2;

    int ans = 1;
    REP(i, n) {
        ans = (ans * 2) % mod;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

ll dp[MAXn];
ll d[MAXn];


int main()
{
    IOS();
    ll n, k;
    cin>>n>>k;
    REP(i,n)cin>>d[i];
    for(int i = 0;i <= k;i ++)
    {
        for(int j = 0;j < n;j ++)if(d[j] <= i && !dp[i - d[j]])dp[i] = 1;
    }
    if(dp[k])cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;
typedef pair<int, int> PI;
typedef vector<int> VI;
const LL MOD = 1000000007LL;

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

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

typedef long long int lli;

lli cnt[27];

inline lli c2(lli x) { return (x*(x-1))/2; }

int main(void)
{
	lli res = 0;
	string S;
	cin >> S;
	for(auto it: S) cnt[lli(it-'a')]++;

	for(lli i = 0;i < 27;i++) res += c2(cnt[i]);
	printf("%lld\n", c2(lli(S.size()))-res+1);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

  int n;
  cin >> n;

  int ans = 800 * n;
  ans -= 200 * (n / 15);

  cout << ans << '\n';

  return (0);
}


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const int MAX_N=300;

const int INF=1e8;

int N;
int p[MAX_N+1][MAX_N+1];

int dp[MAX_N+2][MAX_N+2],dp2[MAX_N+2][MAX_N+2][2];

int main(){
	scanf("%d",&N);
	FOR(i,1,N+1){
		FOR(j,1,N+1){
			scanf("%d",&p[i][j]);
		}
	}
	int res=-INF;
	FOR(i,1,N+1){
		for (int j=i;j>=1;j--){
			dp2[j][i][1]=dp2[j+1][i][1]+p[j][1];
			res=max(res,dp2[j][i][1]);
		}
	}
	FOR(j,2,N+1){
		FOR(i,1,N+1){
			for (int k=i;k>=1;k--){
				dp2[k][i][j&1]=dp2[k+1][i][j&1]+p[k][j];
				res=max(res,dp2[k][i][j&1]);
			}
			FOR(k,1,i+1){
				if (j==2){
					dp[k][i]=dp2[k][i][0]+dp2[k][i][1];
				}else{
					dp[k][i]=dp2[k][i][j&1]+max(dp2[k][i][(j-1)&1],dp[k][i]-dp2[k+1][i-1][(j-1)&1]);
				}
				res=max(res,dp[k][i]);
			}
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 2608
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }

int n;
int a[111][111];
int main() {
    scanf("%d", &n);
    rep(i, 2) rep(j, n) scanf("%d", &a[i][j]);

    static int dp[2][101];
    dp[0][0] = a[0][0];
    dp[1][0] = a[0][0] + a[1][0];
    FOR(i, 1, n) {
        dp[0][i] = dp[0][i - 1] + a[0][i];
        dp[1][i] = dp[1][i - 1] + a[1][i];
        chmax(dp[1][i], dp[0][i] + a[1][i]);
    }

    cout << dp[1][n - 1] << "\n";
    return 0;
}


Measured memory_bytes: 256
S = list(input())
K = int(input())

if len(set(S)) == 1:
    print((len(S) * K) // 2)
else:
    cnt = 0
    last = 0
    renzoku = 1
    for i in range(1, len(S)):
        if S[i] == S[0]:
            renzoku += 1
        else:
            break
    for i, s in enumerate(S):
        if i == 0 and S[i] == s and renzoku % 2 == 0:
            S[0] = '_'
            cnt += 1
        elif S[(i + 1) % len(S)] == S[(i + 2) % len(S)] == s:
            S[(i + 1) % len(S)] = '_'
            cnt += 1
        elif S[(i + 1) % len(S)] == s:
            S[i] = '_'
            cnt += 1
            if i == len(S) - 1:
                last = 1
    print(cnt * K - last)

Measured memory_bytes: 3064
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#endif

const double PI=3.1415926535897932384626433;
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }

typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

void solve() {
    cini(x);
    int d=x%100;
    int n=d/5;
    if(d%5)
        n++;
    int minX=100*n;
    if(minX<=x)
        cout<<1<<endl;
    else
        cout<<0<<endl;
}

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
        solve();
}



Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
from fractions import gcd
mod=10**9+7
g=A[0]
for a in A:
  g=g*a//gcd(g,a)

ans=0
b=g%mod
for a in A:
  ans+=b*pow(a,mod-2,mod)
  ans%=mod  
print(ans%mod)

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

//GCD
long long gcd(long long x, long long y){
	if( y == 0 ) return x;
	return gcd(y, x % y);
}
//LCM
long long lcm(long long x, long long y){
	return x * y / gcd(x, y);
}

int main() {
    // your code goes here
    long long a,b;
    cin >> a >> b;
    cout << lcm(a,b) << endl;
    return 0;
}

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

int main(){
  int a;
  string s;
  cin >> a >> s;
  if( a % 2 != 0 ) cout << "No" << endl;
  else{
    bool flag = true;
    for(int i = 0; i < a/2; i++){
      if( s[i] != s[i+a/2] ) {
        flag = false;
      }
    }
    if(flag == true) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 3580
n = int(input())
a = [int(i) for i in input().split()]
x = {}
for i in a:
    if i in x:
        x[i] += 1
    else:
        x[i] = 1
q = int(input())
s = sum(a)
for _ in range(q):
    b, c = map(int, input().split())
    if b in x:
        i = x[b]
        s -= x[b] * (b-c)
    else:
        i = 0
    x[b] = 0
    if c in x:
        x[c] += i
    else:
        x[c] = i
    print(s)

Measured memory_bytes: 88776
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    for i in range(1,H+1):
        for j in range(1,W+1):
            if (i+j)%2==0:
                print('#',end='')
            else:
                print('.',end='')
        print()
    print()


Measured memory_bytes: 7008
#include<stdio.h>
#include<string.h>
int main(){
    char moji[200],moji2[100], ao[100];
 
    int a,b,c;
    scanf("%s",&moji);
    scanf("%s",&ao);
    strcpy(moji2, moji);
    strcat(moji,moji2);
 
    if(strstr(moji,ao) != NULL)
    {printf("Yes\n");
    }else{
        printf("No\n");
    }
 
 return 0;
} 


Measured memory_bytes: 2108
N,A,B,C = map(int,input().split())

mod = 10**9+7

def inv(n):
    n %= mod
    return pow(n,mod-2,mod)

fact = [1]*(N+1)

for i in range(N):
    fact[i+1] = (i+1)*fact[i]%mod

a = A*inv(100)%mod
b = B*inv(100)%mod
c = C*inv(100)%mod

d = [0]*(2*N+1)

d[0] = inv(1-c)
for i in range(2*N):
    d[i+1] = (i+1)*inv(1-c)*d[i]%mod

ans = 0
for k in range(N):
    ans += (pow(a,N,mod)*pow(b,k,mod)+pow(a,k,mod)*pow(b,N,mod))%mod*inv(fact[N-1])*inv(fact[k])%mod*d[N+k]%mod
    ans %= mod
print(ans)


Measured memory_bytes: 62700
def main():
  while True:
    m = int(input())
    if not m: break
    seiza = []
    for i in range(m):
      seiza.append(list(map(int,input().split())))
    kijun = seiza.pop(0)
    
    n = int(input())
    hosi = []
    point = {}
    
    for i in range(n):
      x,y = map(int,input().split())
      point[x,y] = 1
      hosi.append([x,y])
  
    for a in hosi:
      dx,dy = a[0] - kijun[0], a[1] - kijun[1]
      for b in seiza:
        if not (b[0] + dx, b[1] + dy) in point:
          break
      else:
        print(dx,dy)
        break
main() 


Measured memory_bytes: 5720
#include<stdio.h>

#define ULL unsigned long long

int length(char S[101]){
  int i=0;
  while(1){
    if(S[i]=='\0'){
      break;
    }
    i++;
  }
  
  return i;
}

int sn(char s){
  return s - 48;
}

int main(){  
  char S[101];
  unsigned long long k;
  scanf("%s", S);
  scanf("%lld", &k);

  int len = length(S);

  int ans;
  for(int i=0; i<len; i++){
    if(sn(S[i]) == 1){
      if(i+1 == k){ 
	ans = 1;
	break;
      }
    }
    else{
      ans = sn(S[i]);
      break;
    }
  }

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


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

// 10進数から2進数
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}





int main() {
  ll n;
  cin >> n;
  ll a[n+1];
  rep (i,n){
    cin >> a[i];
  }
  sort(a,a+n,greater<ll>());
  ll ans = 0;
  ll j = 0,k=1;
  rep (i,n){
    if (i==0){
      //ans += a[i];
      continue;
    }
    if (i==1){
      ans+=a[i-1];
    }
    else{
     j++;
     if (j==1 || j==2){
       ans += a[k];
     }
     else {
       j = 1;       
       k++;
       ans += a[k];
       
     }
    }
  }
    cout << ans << endl;
}

Measured memory_bytes: 5252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <class T> ll size(const T &x) { return x.size(); }
#define rep(i,a,b) for(ll i = (a); i < (b); i++)
#define iter(it,c) for(auto it = (c).begin(); it != (c).end();++it)
#define pb push_back
#define fs first
#define sc second
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const int INF = ~(1<<31);
const double pi = acos(-1);
const double EPS = 1e-9;

int n;
bool broke[100100];
ll mod = 1000000007;
ll mem[100100];
ll dp(int at){
    if(at >= n || broke[at]){
        return 0;
    }
    if(at == n-1){
        return 1;
    }
    if(mem[at] != -1) return mem[at];
    ll sm = 0;
    sm += dp(at+1) % mod;
    sm += dp(at+2) % mod;
    return mem[at] = (sm % mod);
}

int main()
{
    cin.sync_with_stdio(false);
    memset(broke, 0, sizeof(broke));
    memset(mem, -1, sizeof(mem));
    int m;
    cin >> n >> m;
    rep(i,0,m){
        ll a;
        cin >> a;
        a--;
        broke[a] = true;
    }
    cout << (dp(0)+dp(1)) % mod;
    return 0;
}


Measured memory_bytes: 4224
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		boolean[] f = new boolean[11];
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		f[a] = f[b] = f[c] = true;

		int x = a + b;
		double cnt = 0;
		for (int i=1; i<11; i++) {
			if (!f[i] && x + i <= 20) {
				cnt++;
			}
		}

		out.println(cnt/7 >= 0.5 ? "YES" : "NO");
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		while(in.hasNext()) solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 26520
fun func(s: String?){
  if( s == "SAT" ){
   	print("1") 
  }
  else if( s == "FRI" ){
    print("2")
  }
  else if( s == "THU" ){
    print("3")
  }
  else if( s == "WED" ){
    print("4")
  }
  else if( s == "TUE" ){
    print("5")
  }
  else if( s == "MON" ){
    print("6")
  }
  else if( s == "SUN" ){
    print("7")
  }
}


fun main(args: Array<String>) {
    val input = readLine()
	func(input)
}


Measured memory_bytes: 31676