akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <cmath>
#include <string>

using namespace std;

bool isRe(string S) {
	for (int i = 0; i < S.length(); i++)
	{
		if (S[i] != S[S.length()-i-1]) {
			return false;
		}
	}
	return true;
}

int main() {
		string S;
		cin >> S;


		if(!isRe(S)) {
			cout << "No" << endl;
			return 0;
		}

		int rule2 = (S.length() - 1) / 2;
		string rule2S = S.substr(0, rule2);
		if(!isRe(rule2S)) {
			cout << "No" << endl;
			return 0;
		}
		
		int rule3 = (S.length() +3) / 2;
		string rule3S = S.substr(rule3-1);
		if(!isRe(rule3S)) {
			cout << "No" << endl;
			return 0;
		}

		cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <unistd.h>
#include <map>

#define pii pair<int,int>
#define REP(i, n) for (long long i = 0; i < (n); i++) 
using namespace std;


typedef long long ll;
static const ll INF = 1000000000000000000LL;
static const ll MOD = 1000000007;


int main()
{
    vector <vector <int>> a(3,vector<int>(3));
    REP(i,3)
    {
        REP(j,3)
        {
            cin >> a[i][j];
        }
    }
    int N;
    cin >> N;
    map <int,int> m;
    REP(i,N)
    {
        int b;
        cin >> b;
        m[b] = 1;
    }

    string res = "No";
    //縦
    bool flg;
    REP(i,3)
    {
        flg = true;
        REP(j,3)
        {
            decltype(m)::iterator it = m.find(a[i][j]);
            if (it == m.end())
            {
                flg = false;
                break;
            }
        }
        if(flg)res = "Yes";

        flg = true;
        //横
        REP(j,3)
        {
            decltype(m)::iterator it = m.find(a[j][i]);
            if (it == m.end())
            {
                flg = false;
                break;
            }
        }
        if(flg)res = "Yes";
    }

    //斜め
    flg = true;
    REP(i,3)
    {
        decltype(m)::iterator it = m.find(a[i][i]);
        if (it == m.end())
        {
            flg = false;
            break;
        }
    }
    if(flg)res = "Yes";

    //斜め
    flg = true;
    REP(i,3)
    {
        decltype(m)::iterator it = m.find(a[i][2-i]);
        if (it == m.end())
        {
            flg = false;
            break;
        }
    }
    if(flg)res = "Yes";

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
const int mod = 1e9+7;
const int INF = 1e9;
const int MAX = 1e6;
// const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// struct edge {int to, cost;};
// vector<edge> graph[MAX];
// bool visited[MAX];
// int dist[MAX];

int main() {
    // input
    int n;
    cin >> n;
    int a[n];
    set<int> s;
    bool flag = true;
    rep(i, n) {
        cin >> a[i];
        if (s.count(a[i])) flag = false;
        else s.insert(a[i]);
    }
    // output
    if (flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 13720
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}
 
using namespace std;                                                                                  
using namespace __gnu_pbds; 
mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {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;}
 
typedef pair < int , int > pii ;                                            
typedef pair < long long  , long long > pll ;

typedef tree<
pii,
null_type,
less<pii>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int N = 2e5 + 123;

int n, m, d;

int p[100];
unordered_map < int , int > dp1[2] , dp2[2];
int cnt0[200] , cnt[200];
int ans = 0;
void dfs(int pos , int val, int c , int len,  int d){
    if(len % 2 == 1 and pos == len/2){

    	if(d == val)
    		ans += c * 10ll;
    	return;
    }
    //0123

	if(pos >= len/2){
    	if(d == val)
			ans += c;
		return;
	}
	int ost = 0;
	for(int i = pos + 1; i < len;i++){
		if(i < len - 1 - i)
			ost += 9ll*(p[len-1-i]-p[i]);
	}

	if(pos == 0){
//		cerr << ost << '\n';
		for(int i = -9 ; i <= 9 ;i++){
			if(val + i * (p[len - 1] - p[0]) + ost < d  or i * (p[len - 1] - p[0]) - ost > d)
				continue;
//			cerr << len << '\n';	
			dfs(pos + 1,i * (p[len - 1] - p[0]),c * cnt0[i + 10],len,d);
		}
	}
	else{
		for(int i = -9 ; i <= 9 ;i++){
			if(val + i * (p[len - 1 - pos] - p[pos]) + ost < d  or val + i * (p[len - 1 -pos] - p[pos]) - ost > d)
				continue;
			dfs(pos + 1, val + i * (p[len - 1 - pos] - p[pos]),c * cnt[i + 10],len,d);
		}
	}
}
void solve(int len){
	dfs(0, 0, 1 , len, d);
}
int rev(int x){
	string s;
	while(x != 0){
		s += x%10;
		x/= 10;
	}
	int res = 0;
	for(int i = 0; i < sz(s);i++)
		res = res * 10ll + s[i];
	return res;
}
main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> d;
	p[0] = 1;
	int ln = 0;
	for(int i = 1; i <= 18;i++){
		p[i] = p[i - 1] * 10ll;
		if(p[i] > d)
			ln = i;
	}
	for(int i = 0; i < 10;i++)
		for(int j = 0 ; j < 10; j++){
			cnt[i-j+10]++;
			if(j != 0)
				cnt0[i - j + 10]++;
		}
		
	


//	for(int i = 10; i <= 9999;i++)
//		ans += (rev(i) - i == d);
	for(int i = 2 ; i <= 18;i++){
		solve(i);
	}
	ret(ans);
}
 


Measured memory_bytes: 256
local n=io.read("*n")
local b={}
if n%2==0 then
    for i=1,n do
        local a=io.read("*n")
        if i%2==1 then
            b[(n+i+1)//2]=a
        else
            b[1+(n-i)//2]=a
        end
    end
else
    for i=1,n do
        local a=io.read("*n")
        if i%2==1 then
            b[1+(n-i)//2]=a
        else
            b[(n+i+1)//2]=a
        end
    end
end
print(table.concat(b," "))

Measured memory_bytes: 21724
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,W;
	ll value[100],weight[100];
	vint valuew[4];
	scan(N);scan(W);
	rep(i,N){
		scan(weight[i]);scan(value[i]);
		valuew[weight[i]-weight[0]].push_back(value[i]);
	}
	ll minw=weight[0];
	ll wnum[4];
	rep(i,4){
		wnum[i]=valuew[i].size();
		if(wnum[i]) sort(valuew[i].rbegin(),valuew[i].rend());
	}
	ll wi[4];
	int summax=0;
	for(wi[0]=0;wi[0]<=wnum[0];wi[0]++){
		for(wi[1]=0;wi[1]<=wnum[1];wi[1]++){
			for(wi[2]=0;wi[2]<=wnum[2];wi[2]++){
				if(wi[0]*minw+wi[1]*(minw+1)+wi[2]*(minw+2)>W) continue;
				wi[3]=min((W-(wi[0]*minw+wi[1]*(minw+1)+wi[2]*(minw+2)))/(minw+3),wnum[3]);
				int sum=0;
				rep(i,4){
					rep(j,wi[i]){
						sum+=valuew[i][j];
					}
				}
				summax=max(summax,sum);
			}
		}
	}
	prin(summax);
	return 0;
}


Measured memory_bytes: 256
h,w = map(int,input().split()) 
s = [0 for i in range(h)]
s1 = [[-1 for i in range(w)]for j in range(h)]
s2 = [[-1 for i in range(w)]for j in range(h)]
ans = 0
for i in range(h):
    s[i] = list(input())
for i in range(h):
    p = 0
    d = [-1]
    for j in range(w):
        if s[i][j] == '#':
            d.append(j)
    d.append(w)
    for j in range(w):
        if s[i][j] == '.':
            s1[i][j] = d[p+1]-d[p]-1
        else:
            p += 1
for j in range(w):
    p = 0
    d = [-1]
    for i in range(h):
        if s[i][j] == '#':
            d.append(i)
    d.append(h)
    for i in range(h):
        if s[i][j] == '.':
            s2[i][j] = d[p+1]-d[p]-1
        else:
            p += 1       
for i in range(h):
    for j in range(w):
        ans =  max(ans,s1[i][j] + s2[i][j])

        
        
print(ans-1)

Measured memory_bytes: 248712
#include <algorithm>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <string.h>
using namespace std;
int main(void){
	string n;
	int i,f=1;
	cin>>n;
	for(i=1;i<n.size();i++){
		if(n[i]!='9')f=0;
	}
	if(f){
		cout<<(int)n[0]-48+9*(n.size()-1)<<endl;
		return 0;
	} 
	cout<<(int)n[0]-49+9*(n.size()-1)<<endl;
	return 0;
}

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

int main() {
    string S;
    cin >> S;
    int len = S.size();
    vector<int> ans(len, 0);

    int tcnt = 0;
    int lf = 0, rf = 0;
    int tr;
    int lcnt, rcnt;
    rep(i, len) {
        if(lf) { //L連続
            if(S[i] == 'L') {
                lcnt++;
            } else {
                if(!(lcnt%2)) {
                    ans[tr] += lcnt/2;
                    ans[tr+1] += lcnt/2;
                } else {
                    ans[tr+1] += lcnt/2 + 1;
                    ans[tr] += lcnt/2;
                }
                rcnt = 1;
                lf = 0;
                rf = 1;
                tr = i;
            }
        } else if(rf) { //R連続
            if(S[i] == 'R') {
                tr = i;
                rcnt++;
            } else {
                if(!(rcnt%2)) {
                    ans[i] += rcnt/2;
                    ans[i-1] += rcnt/2;
                } else {
                    ans[i-1] += rcnt/2 + 1;
                    ans[i] += rcnt/2;
                }
                lcnt = 1;
                lf = 1;
                rf = 0;
            }
        } else {
            if(S[i] == 'R') { //初R
                tr = i;
                rf = 1;
                rcnt = 1;
            } else { //初L
                lcnt = 1;
                lf = 1;
            }
        }
    }
    if(!(lcnt%2)) {
                    ans[tr] += lcnt/2;
                    ans[tr+1] += lcnt/2;
                } else {
                    ans[tr+1] += lcnt/2 + 1;
                    ans[tr] += lcnt/2;
                }

    rep(i, len-1) {
        cout << ans[i] << " ";
    }
    cout << ans[len-1] << endl;

    return 0;
}

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


bool compare_by_b(pair<string,int > a, pair<string, int> b) {
    if(a.second != b.second){
        return b.second < a.second;
    }else{
        return b.first < a.first;
    }
}
int main(){
  int n;
  cin>>n;
  vector<string>av(n);
  rep(i,n)cin>>av[i];
  //cout<<endl;
  sort(av.begin(),av.end());
  //cout<<"入力end"<<endl;
  //rep(i,n)cout<<av[i]<<endl;
  //cout<<"asorted"<<endl;
  vector<pair<string,int>> v;
  

  int j=0;
  while(j<n){
    int i;
    for(i=j+1;i<n;i++){
      if(av[j]!=av[i]){
        v.push_back(make_pair(av[j],i-j));
        //cout<<j;
        j=i;
        break;
      }
      //cout<<i;
    }
    //cout<<"for"<<"i"<<i;
    if(i==n){
        //cout<<"break";
        v.push_back(make_pair(av[n-1],i-j));
        //cout<<n-1<<endl;
        break;
      }
    
    
  }

  sort(v.begin(),v.end(), compare_by_b);
  //cout<<endl;
  //rep(i,v.size())cout<<v[i].first<<v[i].second<<endl;

  //cout<<endl;
  
  
  vector<string>ans;
  ans.push_back(v[0].first);
  for(int i=1;i<v.size();i++){
    if(v[0].second==v[i].second)ans.push_back(v[i].first);
  }
  sort(ans.begin(),ans.end());
  
  rep(i,ans.size()){
    cout<<ans[i]<<endl;
  }
  
}

Measured memory_bytes: 21744
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stderr, stdin, stdout, BufRead, BufWriter, Read, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::{i64, u64, usize};
#[allow(unused_macros)]
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;($($r :tt ) *) =>{let mut s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
#[allow(unused_macros)]
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;}
#[allow(unused_macros)]
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .expect ("Parse error" ) } ;}
#[allow(unused_macros)]
macro_rules !dbg {($($a :expr ) ,*) =>{writeln !(&mut stderr () ,concat !($(stringify !($a ) ," = {:?}, " ) ,*) ,$($a ) ,*) .unwrap () ;} }
#[allow(non_snake_case)]
#[allow(dead_code)]
fn main() {
    input! {
        a: [[i64; 3]; 3],
        n: usize,
        b: [i64; n],
    }
    let mut s = vec![vec![false; 3]; 3];
    for bb in b {
        for i in 0..3 {
            for j in 0..3 {
                if bb == a[i][j] {
                    s[i][j] = true;
                }
            }
        }
    }
    for i in 0..3 {
        if (s[i][0] && s[i][1] && s[i][2]) ||
           (s[0][i] && s[1][i] && s[2][i]) {
            println!("Yes");
            return;
        }
    }
    if (s[0][0] && s[1][1] && s[2][2]) ||
       (s[0][2] && s[1][1] && s[2][0]) {
        println!("Yes");
        return;
    }
    println!("No");
}

Measured memory_bytes: 4352
#include<stdio.h>
#include<math.h>

int num[1000000];

int main(){
	int i,j;
	int n;

	
	
	for(i=0;i<1000000;i++){
		num[i]=1;
	}
	num[0]=num[1]=0;
	
	for(i=2;i<sqrt(1000000);i++){
		if(num[i]==1){
			for(j=i*i;j<1000000;j+=i) num[j]=0;
		}
	}
	for(i=1;i<1000000-1;i++){
		num[i+1]+=num[i];
	}
	for(;scanf("%d",&n)!=EOF;){
		printf("%d\n",num[n]);
	}
	
	return 0;
}

Measured memory_bytes: 4500
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a,b,p,cnt=0;
        while(true){
            a=sc.nextInt();b=sc.nextInt();cnt=0;
            if(a==0 && b==0)break;
            for(int i=1;i<=a-2;i++){
                for(int j=i+1;j<=a-1;j++){
                    p=b-(i+j);
                    if(j<p && p<=a)cnt++;
                }
            }
            System.out.println(cnt);
        }
 
    }
}


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

using namespace std;

int r;
const double P = 3.14;

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

    cin >> r;

    cout << r * P * 2;

    return 0;
}


Measured memory_bytes: 3700
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define lower(a,x) lower_bound(all(a), x) - a.begin();
#define COUNT(a,x)  upper_bound(all(a), x) - lower_bound(all(a), x);
#define MCOUNT(a,x,y) upper_bound(all(a), y) - lower_bound(all(a), x);
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end());
#define scan(x) scanf("%lld",&x);
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
typedef double D;
const ll inf = 5555555555555555555;
const ll mod = 1000000007;
const D pi = acos(-1);
const D eps = 1e-10;

ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool ok, flag;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111


int main(void) {
  ll d;
  cin >> d >> n;
  
  tmp = pow(100, d)*n;
  if (n == 100) tmp += pow(100, d);
  cout << tmp << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int a,b,c,d,ansm,anss;
  cin >> a >> b >> c >> d;
  anss = a + b + c + d;
  ansm = anss /60;
  anss %= 60;
  cout << ansm << endl;
  cout << anss << endl;  

}


Measured memory_bytes: 3112
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a<=b){
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
    }
}

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

using namespace std;

int main(){
	int N,H;
	cin>>N>>H;
	int sum=0;
	for(int i=0;i<H;i++){
		int a;
		cin>>a;
		sum+=a;
		
	}
	if(sum>=N){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define MOD 1000000007LL
long long dp[2100][2100];
long long modpow(long long p, long long q) {
	long long s[64], sum = 1; s[0] = p; for (int i = 1; i < 64; i++)s[i] = (s[i - 1] * s[i - 1]) % MOD;
	for (int i = 0; i < 63; i++) { if ((q / (1LL << i)) % 2 == 1) { sum *= s[i]; sum %= MOD; } }
	return sum;
}
long long ncr(long long p, long long q) {
	long long r1 = 1; for (long long i = p; i > p - q; i--) { r1 *= (i%MOD); r1 %= MOD; }
	long long r2 = 1; for (long long i = q; i >= 1; i--) { r2 *= (i%MOD); r2 %= MOD; }
	return (r1*modpow(r2, MOD - 2)) % MOD;
}
int main() {
	while (true) {
		for (int i = 0; i < 4410000; i++)dp[i / 2100][i % 2100] = 0;
		dp[0][0] = 1; long long n, d, x; cin >> n >> d >> x; if (n + d + x == 0)break; x--;
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				int L = j - x, R = j - 1; if (L < 0)L = 0;
				long long sum = dp[i - 1][R]; if (L > 0)sum -= dp[i - 1][L - 1];
				sum = (sum + MOD) % MOD; dp[i][j] = sum;
			}
			for (int j = 1; j <= n; j++) { dp[i][j] += dp[i][j - 1]; dp[i][j] %= MOD; }
		}
		long long cnt = 0; for (int i = 1; i <= min(n, d); i++) { cnt += ncr(d, i)*dp[i][n]; cnt %= MOD; }
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 35608
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;

bool check(int a, int b) {
	return a > b;
}

int main() {
	char s[51], t[51];
	cin >> s >> t;
	int tmp = 0;
	for (int i = strlen(s) - strlen(t);0 <= i;i--) {
		rep(j, strlen(t)) {
			if (s[i + j] != t[j] && s[i + j] != '?') {
				tmp = 1;
				break;
			}
		}
		if (tmp == 1) {
			tmp = 0;
			continue;
		}
		rep(j, i) {
			if (s[j] == '?') {
				cout << 'a';
			}
			else {
				cout << s[j];
			}
		}
		cout << t;
		rep(j, strlen(s)) {
			if (j < strlen(t) + i) {
				continue;
			}
			if (s[j] == '?') {
				cout << 'a';
			}
			else {
				cout << s[j];
			}
		}
		cout << endl;
		return 0;
	}
	cout << "UNRESTORABLE" << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
def N(n):
    return (n+1)*(n+2)*(n+3)/6
for n in sys.stdin:
    n=int(n)
    if n>2000:
        n=4000-n
    if n<1001:
        print N(n)
    else:
        m=n-1000
        print N(n)-(N(2*m)-m-1)/2
exit()

Measured memory_bytes: 6436
#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;

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

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

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

int main(){
    int n,k;
    cin >> n >> k;
    COMinit();
    
    for(int i = 1; i <= k ; i++){
        cout << COM(n-k+1,i)*COM(k-1,i-1)%MOD << endl;
    }
    return 0;
}

Measured memory_bytes: 12160
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        // values
        var input = Console.ReadLine();

        // Input n
        int n = int.Parse(input);

        // Input integers.
        string[] str = Console.ReadLine().Split(' ');
        int max = int.Parse(str[0]);
        int min = int.Parse(str[0]);
        long sum = 0;

        // n times loop.
        for (int i = 0; i < n; i++)
        {

            if (int.Parse(str[i]) < min)
            {
                // Update min
                min = int.Parse(str[i]);
            }
            if (int.Parse(str[i]) > max)
            {
                // Update max
                max = int.Parse(str[i]);
            }
            // Update sum
            sum += int.Parse(str[i]);
        }

        // Output
        Console.WriteLine("{0} {1} {2}", min, max, sum);
    }
}

Measured memory_bytes: 9908
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

struct UF {
    vi data;
    void init(int n)
    {
        data.resize(n);
        fill(all(data), -1);
    }
    int root(int x)
    {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (size(x) < size(y)) swap(x, y);
        data[x] += data[y];
        data[y] = x;
    }
    bool same(int x, int y)
    {
        return root(x) == root(y);
    }
    int size(int x)
    {
        return -data[x];
    }
    bool is_root(int x)
    {
        return x == root(x);
    }
} uf;

signed main()
{
    int N, Q; cin >> N >> Q;

    uf.init(N);

    rep(i, Q) {
        int c, x, y; cin >> c >> x >> y;
        if (c == 0) {
            uf.unite(x, y);
        } else {
            cout << uf.same(x, y) << endl;
        }

    }
}

Measured memory_bytes: 1236
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define REP(i,l,r) for(ll i=l;i<(ll)(r);i++) //ll
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)
#define swap(l,r) {ll tp=l;l=r;r=tp;}
const ll MOD = 1000000007;
const int INF = (1<<30);
const ll LINF = (1LL<<60);
int upcmpii(const void *a, const void *b){return(*(int*)a==*(int*)b?0:(*(int*)a>*(int*)b?1:-1));}
void sort_ui(int*a, int n){qsort(a,n,sizeof(int),upcmpii);}
int upcmpll(const void *a, const void *b){return(*(ll*)a==*(ll*)b?0:(*(ll*)a>*(ll*)b?1:-1));}
void sort_u(ll*a, ll n){qsort(a,n,sizeof(ll),upcmpll);}

ll a[202020];
int n;

ll solve(){
    ll ans = 0;
    ll sum = 0;
    rep(i,n) {
        sum += a[i];
        if(sum >= MOD) sum -= MOD;
    }
    rep(i,n-1){
        sum -= a[i];
        if(sum < 0) sum += MOD;
        ans += (a[i] * sum)%MOD;
        if(ans >= MOD) ans -= MOD;
    }

    return ans;
}

int main(){
    scanf("%d", &n);
    rep(i, n) scanf("%lld", a+i);
    printf("%lld\n", solve());
}

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

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static void Main() {
        var abx = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long a = abx[0], b = abx[1], x = abx[2];

        long ans = (b / x) - (a / x);
        if (a % x == 0) ans++;
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 3032
#include <iostream>
#include <cmath>
#include <climits>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <stack>
#include <algorithm>
#include <map>
#include <numeric>
#include <set>
using namespace std;

#define ll long long
#define ld long double
// v:vector  type:型  order:greater or less
#define _sort(v,type,order) do { sort(v.begin(),v.end(),order<type>()); } while(0)
// vector 要素の総和算出
// v:vector  default_value:初期値
#define _sum(v,default_value) accumulate(v.begin(),v.end(),default_value )
// vector 最大値( return ite )
#define _max_element(v) max_element(v.begin(),v.end())
// vector 最大値が格納されている要素値
#define _max_element_number(v) distance(v.begin(),max_element(v.begin(),v.end()))

//set<uint32_t> member;	// 重複するデータを保持する事はできない member.insert(2) member.insert(2) ⇒ member.count(2)は1
//multiset<uint32_t> v;	// 重複するデータも保持する事はできる   member.insert(2) member.insert(2) ⇒ member.count(2)は2

// 丸め
#define _round(v) round(v)
// 2乗 / 3乗
#define _square(v) pow(v,2)
#define _cube(v)   pow(v,3)
// 大小判定
#define _max(x,y) max(x,y)
#define _min(x,y) min(x,y)
// string ⇒ int
#define _stringtoi(s) stoi(s)
// double 平方根
#define _sqrt(x) sqrt(x)
// double 引数 x 以上で最小の整数値 ex) 3.30303 ⇒ 4
#define _ceil(x) ceil(x)
// 指定された要素以上の値が現れる最初の位置のイテレータを取得する
#define _lower_bound(v,min) lower_bound(v.begin(), v.end(), min)
// 指定された要素より大きい値が現れる最初の位置のイテレータを取得する
#define _upper_bound(v,min) upper_bound(v.begin(), v.end(), min)

// 順列 n個の数が与えられる
// 0,1,2,...,n-1
// 全ての並べ方を1行ごとに出力する
// ex 0 1 2 / 0 2 1 / 1 0 2 / 1 2 0 / 2 0 1 / 2 1 0
#define _next_permutation(v) do {   \
	for (auto num : v) {            \
		printf("%d ", num);         \
	}                               \
	printf("\n");                   \
} while (next_permutation(v.begin(), v.end()))

// 絶対値
static int32_t _abs(const int32_t x) { return  (x > 0 ? x : -x); }
// 最大公約数
static int gcd(int a, int b)
{
	if (a < b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}
	return b ? gcd(b, a % b) : a;
}
// 最小公倍数
static int lcm(int a, int b) { return a * b / gcd(a, b); }
// 多次元 std::vector 生成
template<class T>
vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
// ex) auto dp = make_vec<uint64_t>(SIZE + 1, 2, 2);

int main()
{

	uint64_t x;
	cin >> x;


	for (int32_t i = -1000; i < 1000; i++) {
		for (int32_t j = -1000; j < 1000; j++) {
			if ((uint64_t)pow(i, 5) - (uint64_t)pow(j, 5) == x) {
				printf("%d %d\n", i, j);
				return 0;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 4132
import sys
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


fin = sys.stdin.readline
N, K = [int(elem) for elem in fin().split()]

for i in range(1, K+1):
    if (N-K+1) < i:
        print(0)
    else:
        result = int(combinations_count(N-K+1, i) * combinations_count(K-1, i-1))
        print(int(result % 1000000007))


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


int N,A[200000];

int main(void){
    cin >> N;
    rep(i,N)cin >> A[i];
    //rep(i,N) cout << A[i];
    int idx = 1;
    int cnt =0;
    rep(i,N){
        if(idx != A[i]){
            cnt++;
        }else{
            idx++;
        }
    }
    if(idx==1)cout << -1 << endl;
    else cout << cnt << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
    using namespace std;
	int main(){
      int A,B;
      cin >> A >> B;
      int answer = 0;
      
      for(int i = A; i < B+1; i++){
        string j = to_string(i);
        string p,q,r,s,t;
        p = j[0];
        q = j[1];
        r = j[2];
        s = j[3];
        t = j[4];
        if (p == t && q ==s) answer++;
        else continue;
      }
      cout << answer << endl;
    }

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

#define ll long long
#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)

//library----------------------------------------------


int main(){
  int x,y; cin>>x>>y;
  int ans = x+y/2;
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <vector>
#include <utility>

using namespace std;

int main(){
    int h,w;
    cin >> h >> w;
    int matrix[h][w];
    vector < vector< vector< pair <int,int> > > > adj(h ,vector< vector <pair<int,int> > >(w));
    bool visited[h][w];
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            matrix[i][j] = 0;
            visited[i][j] = false;
        }
    }
    int result = 0;
    list <pair <int,int> > queue, depth;
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            char x;cin >> x;
            pair <int,int> point (i,j);
            if(i + 1 < h) adj[i][j].push_back(pair <int,int>(i + 1,j));
            if(j + 1 < w) adj[i][j].push_back(pair <int,int>(i,j + 1));
            if(i - 1 >= 0) adj[i][j].push_back(pair <int,int>(i - 1,j));
            if(j - 1 >= 0) adj[i][j].push_back(pair <int,int>(i,j - 1));
            if(x == '#'){
                matrix[i][j] = 1;
                
                queue.push_back(point);
                visited[i][j] = true;
            }else{
                matrix[i][j] = 0;
            }
        }
    }
    int ans = 0;
    while(!queue.empty())
    {
        pair <int,int> s = queue.front();
        queue.pop_front();

        for(int i = 0;i < adj[s.first][s.second].size();i++){
            pair <int, int> p =  adj[s.first][s.second][i];
            if(!visited[p.first][p.second]){
                visited[p.first][p.second] = true;
                queue.push_back(p);
                matrix[p.first][p.second] = matrix[s.first][s.second] + 1;
                ans = max(ans, matrix[p.first][p.second]);
            }
        }
        /*for(int i = 0;i < h;i++){
            for(int j = 0;j < w;j++){
                cout << matrix[i][j];
            }
            cout << endl;
        }
        cout << endl;*/
    }
    cout << (ans <= 0 ? 0 : ans - 1);
}


Measured memory_bytes: 106752
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int l; cin >> l;
  vector<int> a(l); REP(i, l) cin >> a[i];
  vector<vector<long long> > dp(l+1, vector<long long>(5, 0)); // 0 even odd even 0
  REP(i, l) {
    long long even, odd;
    if (a[i] == 0) {
      even = 2;
      odd = 1;
    } else if (a[i] & 1) {
      even = 1;
      odd = 0;
    } else {
      even = 0;
      odd = 1;
    }
    dp[i+1][0] = dp[i][0] + a[i];
    dp[i+1][1] = min(dp[i][0], dp[i][1]) + even;
    dp[i+1][2] = min({dp[i][0], dp[i][1], dp[i][2]}) + odd;
    dp[i+1][3] = min({dp[i][0], dp[i][1], dp[i][2], dp[i][3]}) + even;
    dp[i+1][4] = min({dp[i][0], dp[i][1], dp[i][2], dp[i][3], dp[i][4]}) + a[i];
  }
  cout << min({dp[l][0], dp[l][1], dp[l][2], dp[l][3], dp[l][4]}) << '\n';
  return 0;
}


Measured memory_bytes: 15104
// https://atcoder.jp/contests/abc172/tasks/abc172_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> d(N + 1);
    // １の倍数＋２の倍数＋３の倍数＋・・・
    FOR(i, 1, N + 1) {
        for (int j = i; j <= N; j += i)
            d[j]++;
    }
    int ans = 0;
    FOR(i, 1, N + 1) { ans += d[i] * i; }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

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

ll exp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n)
    {
        if(n & 1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n=n>>1;
    }
    return result;
}



int32_t main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    IOS

    ll n;
    cin>>n;
    ll ans=0;

    for(ll i=2;i<=1000005;i++)
    {
    	ll temp=0;
    	while(n%i==0)
    	{
    		temp++;
    		n/=i;
    	}
    	for(int j=1;j<1010;j++)
    	{
    		if(j>temp)
    			break;
    		ans++;
    		temp-=j;
    	}
    }

    if(n>1)
    	ans++;

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

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

#define cin(x) cin >> x;
#define cout(x) cout << x << endl;

using namespace std;

int main(int argc, char const *argv[])
{
    string s;
    int ans = 0;
    cin(s);
    
    for(int i = 0; i < s.size(); i++)
    {
        
        if (s[i] == '1') {
            ans++;
        }
        
    }
    cout(ans);
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(){
	double r;
	double b,c;

	scanf("%lf",&r);

	b = M_PI*r*r;
	c = 2*M_PI*r;
	
	printf("%.5f %.5f\n",b,c);

	return 0;
}

Measured memory_bytes: 652
#include<stdio.h>
int main(void)
{
    int b1, b2, b3;
    scanf("%d %d %d", &b1, &b2, &b3);
    if (b1 == 1 && b2 == 0 && b3 == 0) {
        printf("Close\n");
    }
    else if (b1 == 0 && b2 == 1 && b3 == 0) {
        printf("Close\n");
    }
    else if (b1 == 1 && b2 == 1 && b3 == 0) {
        printf("Open\n");
    }
    else if (b1 == 0 && b2 == 0 && b3 == 1) {
        printf("Open\n");
    }
    else {
        printf("Close\n");
    }
    return 0;
}

Measured memory_bytes: 584
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;



int main() {
	int a, b, t;
	cin >> a >> b >> t;
	cout << t / a * b << endl;

}


Measured memory_bytes: 3616
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

r, D, x = LI()

for i in range(10):
    x = x*r-D
    print(x)


Measured memory_bytes: 3064
open Batteries

let scan fmt f =
  Scanf.sscanf (read_line ()) fmt f

let scan_list cnv =
  read_line ()
  |> String.split_on_char ' '
  |> List.map cnv

let scan_array n m e conv =
  let arr = Array.make_matrix n m e in
  Enum.Labels.iter (0 --^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list conv);
  arr

let rec zip xs ys =
  match xs, ys with
  | [], _ -> []
  | _, [] -> []
  | x::xs, y::ys ->
    (x, y) :: zip xs ys

let dbg x = Printf.printf "%s\n" @@ dump x; x

let (a,b,c,x,y) = scan "%d %d %d %d %d" Tuple.Tuple5.make

let () =
  let n = min x y in
  let m = max x y in
  List.min [2*n*c+a*(x-n)+b*(y-n); a*x+b*y; 2*c*m]
  |> Printf.printf "%d\n"


Measured memory_bytes: 3072
#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 prec(n) fixed<<setprecision(n)
#define MOD 1000000007
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.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){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}
 
int dp[10000][10000]={0};
 
signed main(){
    FASTER;
    int n,m;cin>>n>>m;
    vector<vector<char> > v(n,vector<char>(m));cin>>v;
    for(int i=0;i<m;i++){
        if(v[0][i]=='#')break;
        dp[0][i]=1;
    }
    for(int i=0;i<n;i++){
        if(v[i][0]=='#')break;
        dp[i][0]=1;
    }
    for(int i=1;i<n;i++){
        for(int j=1;j<m;j++){
            if(v[i][j]!='#')dp[i][j]=(dp[i][j-1]+dp[i-1][j])%MOD;
        }
    }
    cout<<dp[n-1][m-1];
 
}

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

int main(void) {

	// TODO: submit前にprintf-debugの削除確認！
	int a, b;
	cin >> a >> b;
	
	if (a == 2 || b == 2)
		cout << "No";
	else
		cout << "Yes";
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <bitset>
 
using namespace std;
 
int main(){
    string s;
    cin >> s;
    int n = s.size();
    
    long long ans=0;
    bitset<20> bit(0);
    for(int mask=0; mask < (1 << (n-1) ); mask++){
        bit = mask;
        string str="";
        long long sum=0;
 
        str=s[0];
        for(int i=0; i < n-1; i++){
            if(bit[i]==1) {
                sum+=stol(str);
                str=s[i+1];
            }
            else
                str+=s[i+1];
        }
        sum+=stol(str);
        ans+=sum;
    }
    cout << ans << endl;
    return 0;
}

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

const ll INF = ll(1e18) + 1;

int main()
{
    int N; ll K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    sort(A.begin(), A.end());
    ll L = -INF, R = INF, mid, total;
    while (L < R -1) {
        mid = (L+R)/2;
        total = 0;
        rep(i,N) {
            if (A[i] < 0) {
                int _left = -1, _right = N, _mid;
                while (_left < _right - 1) {
                    _mid = (_left + _right)/2;
                    if (A[_mid]*A[i] < mid) _right = _mid; else _left = _mid;
                }
                total += N - _right;
            } else {
                int _left = -1, _right = N, _mid;
                while (_left < _right - 1) {
                    _mid = (_left + _right)/2;
                    if (A[_mid]*A[i] < mid) _left = _mid; else _right = _mid;
                }
                total += _right;
            }
            if (A[i]*A[i] < mid) total--;
        }
        total /= 2;
        if (total < K) L = mid; else R = mid;
    }
    cout << L << endl;
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n){
        cin >> a.at(i);
    }
    
    string s = "YES";
    int count = 0;
    rep(i, n){
        if(a.at(i)%2) count++;
    }
    if(count%2) s = "NO";
    
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;
 
int main() {
    ll a,b,k; cin >> a >> b >> k;
    if(a+b <= k){
        cout << 0 << " " << 0 << endl;
    }else{
        if(k <= a){
            cout << a - k << " " << b << endl;
        }else{
            cout << 0 << " " << b + a - k << endl;
        }
    }
}

Measured memory_bytes: 256
/*
    NEVER GIVE UP!
    THE EXPERT IN ANYTHING WAS ONCE A BEGINNER
*/

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define f(i,a,b) for(ll i=a; i<=b; i++)
#define fi(i,a,b) for(ll i=a; i>=b; i--)
#define fa(x,b) for(auto x:b)
#define TC ll test_case; cin>>test_case; for(ll number=1 ; number <= test_case ; number ++ )
#define vll vector<ll>
#define pb push_back
#define pll pair<ll,ll>
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (ll)(a).size()
#define sp(x) cout << fixed << setprecision(x);
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define endl "\n"

const ld pi = acos(-1);
const ll M=1e9+7,N=1e7+5,INF=1e18;


void solve()
{
    ll k,x;
    cin >> k >> x;
    
    if(500*k >= x)
        cout << "Yes";
    else 
        cout << "No";
}

int32_t main()
{
    FIO
    solve();
    return 0;
}

Measured memory_bytes: 256
c = {'I'=> 1, 'V'=> 5, 'X'=>10, 'L'=>50, 'C'=>100, 'D'=>500, 'M'=>1000}
c.default = 0
readlines.each do |l|
  x = 1000
  puts l.chars.each_cons(2).inject(0){|sum,(i,j)|
    c[i] < c[j] ? sum-c[i] : sum+c[i]
  }
end

Measured memory_bytes: 6108
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b;
  cin >> a >> b;
  bool x=true;
  int ans=0;
  while(x && ans<1010){
    if (floor(ans*0.08)==a && floor(ans*0.1)==b){
      cout << ans << endl;
      return 0;
    }
    ans++;
  }
  cout << -1 <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <numeric>

using namespace std;
typedef long long ll;

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

    cin >> n >> k;
    cin >> s;

    if (s[k-1] == 'A') s[k-1] = 'a';
    else if (s[k-1] == 'B') s[k-1] = 'b';
    else s[k-1] = 'c';

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include <ctype.h>

using namespace std;

int main() {
 int n,k;
  cin >> n >> k;
  if(n%2==1){
    if(k<=n/2+1){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  }
  else{
    if(k<=n/2){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }
}

Measured memory_bytes: 384
import itertools
import operator

N = int(input())
a = list(map(int, input().split()))

cumsum = list(itertools.accumulate(a, operator.add))
# print('cumsum', cumsum)

s = cumsum[-1]
min_v = 10**10
for i in range(0, N - 1):
    x = cumsum[i]
    v = abs(2 * x - s)
    if v < min_v:
        min_v = v
print(min_v)


Measured memory_bytes: 23920
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int main() {

  int A,B,K;

  std::cin >> A;
  std::cin >> B;
  std::cin >> K;
  
  int count=0;
  for(int i=100;i>0;i--){
    if(A%i==0&&B%i==0){
      count++;
    }
    if(count==K){
      cout <<i<<endl;
    return 0;
    }
  }
  
   
}


Measured memory_bytes: 256
import sys
from math import factorial

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
K = ir()
length = 0
for i in range(1, 102):
    if 10 ** i > N:
        length = i
        break

answer = 0
def F(length, K, N):
    ret = 0
    if length == 1:
        if K == 1:
            return N
        elif K == 0:
            return 1
        else:
            return 0
    if length < K:
        return 0
    top = int(str(N)[0])
    if length-K >= 1:
        ret += factorial(length-1) // factorial(K) // factorial(length-K-1) * 9 ** K # 一個前まで    
    ret += factorial(length-1) // factorial(K-1) // factorial(length-K) * (top-1) * 9 ** (K-1) # 一桁目がtopより小さい数  
    if K > 1: # 一桁目がtopと同じ数
        N = int(str(N)[1:])
        length = 0
        for i in range(1, 100):
            if 10 ** i > N:
                length = i
                break
        ret += F(length, K-1, N)
    else:
        ret += 1 # 2000のような数
    return ret

answer = F(length, K, N)
print(answer)


Measured memory_bytes: 3064