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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define E 2.71828182845905
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define debug(x) cout<<#x<<" is "<<x<<endl;
#define PI 3.14159265
#define mem(x) memset(x,0,sizeof(x));
using namespace std;

void sol() {
	int n,m;
	cin>>n>>m;
	char arr[n][m];
	rep(i,0,n)
		rep(j,0,m)
			cin>>arr[i][j];
	bool dp1[n][m];
	mem(dp1);
	dp1[n-1][m-1]=1;
	for(int i=n-1;i>=0;i--){
		for(int j=m-1;j>=0;j--){
			if(i==n-1 && j==m-1)
				continue;
			if(arr[i][j]=='.')
			{
				if(i+1<n && dp1[i+1][j])
					dp1[i][j]=1;
				if(j+1<m && dp1[i][j+1])
					dp1[i][j]=1;
			}
		}
	}
	ll dp[n+1][m+1];
	mem(dp);
	for(int i=n-1;i>=0;i--){
		for(int j=m-1;j>=0;j--){
			if(i==n-1 && j==m-1)
				dp[i][j]=1;
			if(dp1[i][j])
			{
				if(i+1<n && dp1[i+1][j])
					dp[i][j]=(dp[i][j]%hell+dp[i+1][j]%hell)%hell;
				if(j+1<m && dp1[i][j+1])
					dp[i][j]=(dp[i][j]%hell + dp[i][j+1]%hell)%hell;
			}
		}
	}
	cout<<dp[0][0]%hell<<endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t=1;
 	//cin>>t;
 	while(t--){	
	sol();
 	}
}

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


int main(void)
{
  int n;
  cin >> n;
  
  vector<string> s(n);
  for(int i=0;i<n;i++){
    cin >> s.at(i);
    sort(s.at(i).begin(),s.at(i).end());
  }
  
  sort(s.begin(),s.end());

  int64_t ans=0;
  int64_t re=1;
  for (int i=0;i<n-1;i++){
     if(s.at(i)==s.at(i+1)){
      re++;
     }else{
       ans+=re*(re-1)/2;
       re=1;
     }
  }
  ans+=re*(re-1)/2;

  cout << ans << endl;
}


Measured memory_bytes: 7296
/**
 * Created by Sakib on 06/16/2018.
 */
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define debug(args...) { dbg,args; cerr<<"\n"; }
template <typename T>
using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
struct debugger{
template<typename T>debugger& operator,(const T& v){cerr<<v<<" ";return *this;}}dbg;

#define Fix( x ) setprecision( x ) << fixed
#define mem( a , x ) memset( a , x , sizeof( a ) )
#define bug( a , b ) cerr<< #a <<" = "<<a<<" , "<< #b <<" = "<<b<<"\n";
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define FOR( i , a , b ) for( int i = a; i <= b; i++ )
#define ROF( i , a , b ) for( int i = a; i >= b; i-- )
#define sz( V ) (int)V.size( )
#define all( V ) V.begin( ),V.end( )
#define Found( S , val ) S.find( val ) != S.end( )
#define Unique( V ) sort( all( V ) ), V.erase( unique( all( V ) ), V.end() )
typedef pair < int , int > ii;
typedef pair < int , ii > iii;
typedef long long int LL;
typedef unsigned long long uLL;
const int inf = (int)1e9;
const LL INF = (LL)1e18;
const int N = 100005;
const int mod = 1000000007;
const double eps = 1e-8;
const double pi = acos( -1.0 );

int a , b;

int main( int argc, char const *argv[] ) {
    fast_io;
    cin >> a >> b;
    if( abs(a-b) > 1 ) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}








Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <map>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

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

int a,b;

void solve(){
  cin >> a >> b;
  int ans=0;
  ans+=max(a,b);
  if(a==ans)a--;
  else b--;
  ans+=max(a,b);
  cout << ans << endl;

}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 256
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
    let v:Vec<i32> = procon_read();
    let x = v[0]; let n = v[1];
    let p:Vec<i32> = procon_read();
    let mut q = [0;101];
    for i in p {
        q[i as usize] = 1;
    }
    for i in 0.. {
        if x - (i as i32) < 0 {
            println!("{}", x- (i as i32));
            break;
        }
        if q[(x as usize) - i] != 1 {
            println!("{}", x - (i as i32) );
            break;
        }
        if x + (i as i32) > 100 {
            println!("{}", x+(i as i32));
            break;
        }
        if q[(x as usize) + i] != 1 {
            println!("{}", x + (i as i32) );
            break;
        }
    }
}

Measured memory_bytes: 2136
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
int A[4005]={0};

int main(){
ll ans=0;
int n;
cin>>n;

for(int i=1;i<=n;i++){
  if(i%3!=0&&i%5!=0)ans+=i;
}
cout<<ans<<endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <fstream>
#include <cstdlib>
#include <cstdio>
#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, a, n) for(int i=(a); i<(n); i++)
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<string> vs;

int main(){
    int N, K;cin>>N>>K;
    int ans = (N-1)%(K-1) == 0 ? (N-1)/(K-1) : (N-1)/(K-1)+1;
    cout << ans << endl;
    return 0;
}

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

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define ll long long
#define dl double long

using namespace std;

const int NN = 1e6 + 7;
const int N = 2e5 + 7;
const int M = 20;
const int mod = 998244353;
const ll inf = 1e18 + 7;
const dl rf = 1e-14;

int n,m,k;
int ans[N];
int used[N];
vector < int > g;
vector < int > v[N];
vector < int > t[N];
map < int , int > ch[N];

void dfs( int x , int p )
{
    used[x] = used[p];
    g.push_back(x);
    for( auto y : v[x] ){
        if( used[y] )continue;
        dfs( y , x );
    }
}

void solve1()
{
    cin >> n >> m >> k;
    for( int i = 1; i <= m; i++ ){
        int x,y;
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for( int i = 1; i <= k; i++ ){
        int x,y;
        cin >> x >> y;
        t[x].push_back(y);
        t[y].push_back(x);
    }
    int G = 0;
    for( int i = 1; i <= n; i++ ){
        if( !used[i] ){
            g.clear();
            used[i] = ++G;
            dfs( i , i );
            for( auto x : g ){
                int cnt = 0;
                for( auto y : t[x] ){
                    if( used[y] == used[x] ){
                        ch[x][y] = 1;
                    }
                }
                for( auto y : v[x] ){
                    ch[x][y] = 1;
                }
                ans[x] = (int)g.size() - (int)ch[x].size() - 1;
            }
        }
    }
    for( int i = 1; i <= n; i++ ){
        cout << ans[i] << " ";
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


Measured memory_bytes: 45816
#include <stdio.h>
#define N 20
#define Q 200
#define TRUE 1
#define FALSE 0

void solve(int,int);

int A[N];
int M[Q];
int i;
int n,q;;
int check;

int main(void){

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++)
    scanf("%d",&M[i]);

  for(i=0;i<q;i++){
    check = 0;
    solve(0,M[i]);
    if(check == TRUE)
      printf("yes\n");
    else
      printf("no\n");
  }

  return 0;
}

void solve(int index,int remnant){
  
  if(index == n){
    if(remnant == 0) 
      check = 1;
  }

  else{
    solve(index+1,remnant - A[index]);
    solve(index+1,remnant);
  }
} 

Measured memory_bytes: 580
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

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

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	vector<int> h(n);
	for (int i = 0; i < n; i++)
	{
		cin >> h.at(i);
	}

	vector<int> dp(n, inf);
	dp.at(0) = 0;

	// 貰うDP
	/*
	for (int i = 1; i < n; i++)
	{
		for (int j = 1; j <= k; j++)
		{
			if (i - j >= 0)
			{
				dp.at(i) = min(dp.at(i), dp.at(i - j) + abs(h.at(i) - h.at(i - j)));
			}
		}
	}
	*/

	// 配るDP
	for (int i = 0; i < n; i++)
	{
		for (int j = 1; j <= k; j++)
		{
			if (i + j < n)
			{
				dp.at(i + j) = min(dp.at(i + j), dp.at(i) + abs(h.at(i + j) - h.at(i)));
			}
		}
	}

	cout << dp.at(n - 1) << endl;
}

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

int main() {
  int N,M;
  cin >> N;
  M = N - N/10 *10;
  string ans;
  if (M==2 || M==4 || M==5 || M==7 || M==9) {
    ans = "hon";
  }
  else if (M==0 || M==1 || M==6 || M==8) {
    ans = "pon";
  }
  else if (M==3) {
    ans = "bon";
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    while(true) {
        auto n = readInt();
        if(n == 0) {
            return;
        }
        bool[Tuple!(int, int)] set;
        foreach(i; iota(n)) {
            int h, r;
            readlnTo(h, r);
            set[tuple(h,r)] = true;
        }
        auto m = readInt();
        foreach(i; iota(m)) {
            int h, r;
            readlnTo(h, r);
            set[tuple(h,r)] = true;
        }
        auto dp = new int[][](1000, 1000);
        foreach(i; iota(1, 1000)) {
            foreach(j; iota(1, 1000)) {
                if(tuple(i, j) in set) {
                    dp[i][j] = max(dp[i-1][j], dp[i][j-1], dp[i-1][j-1] + 1);
                } else {
                    dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
                }
            }
        }
        writeln(dp[$-1][$-1]);
    }
}

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

const int MOD = 1000000007;
const int INF = 1e9;

int main(){
  int n;
  const int max_n = 2 * 1e5;
  int a[max_n + 1];
  cin >> n;
  for(int i = 0; i < n; i++) cin >> a[i];

  bool ball[max_n + 1] = {};
  int cnt = 0;
  for(int i = n; i >= 1; i--){
    int sum = 0;
    int now = 2 * i;
    while(now <= n){
      sum += ball[now-1];
      now += i;
    }
    if(sum % 2 - a[i-1] != 0) {
      ball[i-1] = 1;
      cnt ++;
    }
  }

  cout << cnt << endl;
  for(int i = 0; i < n; i++){
    if(ball[i] == 0) continue;
    if(i == n - 1) cout << i + 1<< endl;
    else cout << i + 1 << " ";
  }
  
  

  return 0;
}

Measured memory_bytes: 4596
#include<stdio.h>
#include<iostream>
#include<algorithm>
#define N 105
using namespace std;

short line[N][N],list[N][N],ans[N][N][N][N],n,m,op,sx,sy;
char s[N][N];

int main()
{
    cin>>n>>m;
    for (short i=1;i<=n;i++) scanf("%s",s[i]+1);
    for (short i=1;i<=n;i++) for (short j=1;j<=m;j++)
    {
        line[i][j]=line[i][j-1]+(s[i][j]=='o');
        list[i][j]=list[i-1][j]+(s[i][j]=='o');
        if (s[i][j]=='E') sx=i,sy=j;
    }
    for (short i=sx;i;i--) 
for (short j=sy;j;j--) 
        for (short k=sx;k<=n;k++) 
for (short p=sy;p<=m;p++)
    {
        if (1<i && k+1<sx+i) op=max(op,ans[i-1][j][k][p]=max((int)ans[i-1][j][k][p],ans[i][j][k][p]+line[i-1][min((int)p,m-sy+j)]-line[i-1][max(j-1,p-sy)]));
        if (k<n && sx+k<n+i) op=max(op,ans[i][j][k+1][p]=max((int)ans[i][j][k+1][p],ans[i][j][k][p]+line[k+1][min((int)p,m-sy+j)]-line[k+1][max(j-1,p-sy)]));
        if (1<j && p+1<sy+j) op=max(op,ans[i][j-1][k][p]=max((int)ans[i][j-1][k][p],ans[i][j][k][p]+list[min((int)k,n-sx+i)][j-1]-list[max(i-1,k-sx)][j-1]));
        if (p<m && sy+p<m+j) op=max(op,ans[i][j][k][p+1]=max((int)ans[i][j][k][p+1],ans[i][j][k][p]+list[min((int)k,n-sx+i)][p+1]-list[max(i-1,k-sx)][p+1]));
    }
    cout<<op;
}

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

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

using namespace std;

int main(void)
{
	ll n, m;
	ll need[10]={0,2,5,5,4,5,6,3,7,6};
	cin >> n >> m;
	vector<ll> a(m);
	rep(i, m){
		cin >> a[i];
	}
	vector<string> dp(n+10, "");
	for(ll i=0; i<n; i++){
		if (i!=0 && dp[i]=="") continue;
		for(auto e:a){
			string x, y;
			x = dp[i+need[e]];
			y = dp[i]+char('0'+e);
			if (x.length()<y.length()){
				dp[i+need[e]] = y;
			}else if(x.length()==y.length()){
				dp[i+need[e]] = max(x, y);
			}
		}
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 43648
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<vector>
#include<cctype>
using namespace std;

//ITP1_8
int main(){
	string a;
	cin>>a;
	string s=a+a;
	string p;
	cin>>p;
	if(s.find(p)!=string::npos)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	

return 0;
}

Measured memory_bytes: 1192
import std.stdio, std.algorithm, std.range, std.conv, std.string, std.math;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln

void main() {
	const int MOD = 998244353;
	string s = chomp(readln());
	int n = to!int(s.length);
	int[] a = new int[n];
	foreach (i; 0..n) {
		a[i] = s[i]-'a';
	}

	bool same() {
		foreach (i; 1..n) {
			if (a[i-1] != a[i]) return false;
		}
		return true;
	}
	if (same()) {
		writeln(1);
		return;
	}

	if (n == 2) {
		writeln(2);
		return;
	}
	if (n == 3) {
		if (a[0] != a[1] && a[1] != a[2] && a[2] != a[0]) {
			writeln(3);
			return;
		}
	}

	long ans = 1;
	foreach (i; 0..n-1) ans = (ans*3)%MOD;
	bool unstable() {
		foreach (i; 1..n) {
			if (a[i-1] == a[i]) return false;
		}
		return true;
	}
	if (unstable()) ans++;

	long[][][] dp = new long[][][](n,3,3);
	foreach (i; 0..3) dp[0][i][i] = 1;
	foreach (i; 1..n) {
		foreach (j; 0..3) foreach (k; 0..3) {
			foreach (x; 0..3) {
				if (k == x) continue;
				(dp[i][(j+x)%3][x] += dp[i-1][j][k]) %= MOD;
			}
		}
	}
	ans -= dp[n-1][a.sum%3].sum;
	ans = (ans%MOD+MOD)%MOD;
	writeln(ans);
}

Measured memory_bytes: 40248
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

vector<vu64> vec(10);

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

    int N;
    char c;
    cin >> N;
    rep (i, N)
    {
        cin >> c;
        vec[c - '0'].push_back(i);
    }

    int ans = 0;
    rep (i, 10)
    {
        rep (j, 10)
        {
            rep (k, 10)
            {
                auto iit = lower_bound(vec[i].begin(), vec[i].end(), 0);
                if (iit == vec[i].end()) continue;
                auto jit = lower_bound(vec[j].begin(), vec[j].end(), *iit + 1);
                if (jit == vec[j].end()) continue;
                auto kit = lower_bound(vec[k].begin(), vec[k].end(), *jit + 1);
                if (kit == vec[k].end()) continue;
                ++ans;
            }
        }
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
static const long long INF = INT64_MAX;
static const long long MOD = (ll)1e9+7;

#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i, n) for(ll i=0;i<n;i++)
#define SZ(v) (ll)((v).size())
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).begin(), (v).end())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

void solve() {
    str s;
    cin >> s;
    str t = s;
    UNIQ(t);
    out((t.size() == s.size() ? "yes" : "no"));
}

int main() {
    fast_io;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
using iii = pair<ll, ii>;
#define vt vector
#define pq priority_queue
#define pb push_back
#define mp make_pair
#define fi first
#define se second
// #define multicase
const ll MOD = 1e9 + 7;
const ll INF = 2e9;
const ll N = 1e6 + 5;

ll n;
ll dp[N][5][5];

ll add(ll x, ll y) {
    return ((x % MOD) + (y % MOD)) % MOD;
}

void computeDP() {
    dp[0][1][1] = 1;
    for(ll idx = 1; idx <= n; idx++) {
        for(ll zero = 1; zero >= 0; zero--) {
            for(ll nine = 1; nine >= 0; nine--) {
                ll &sol = dp[idx][zero][nine];
                sol = 8 * dp[idx - 1][zero][nine];
                sol = add(sol, dp[idx - 1][1][nine]);
                sol = add(sol, dp[idx - 1][zero][1]);
                // for(int i = 0; i <= 9; i++) {
                //     if(i == 0) sol = add(sol, dp[idx - 1][1][nine]);
                //     else if(i == 9) sol = add(sol, dp[idx - 1][zero][1]);
                //     else sol = add(sol, dp[idx - 1][zero][nine]);
                // }
            }
        }
    }
}

void solve() {
    ll T = 1;
  #ifdef multicase
    cin >> T;
  #endif
    while(T--) {
        cin >> n;
        computeDP();
        cout << dp[n][0][0] << "\n";
    }
}

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

Measured memory_bytes: 198900
N = int(input())

A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

# c_counter = 0
value = 0

for i in range(N):    
    value += B[A[i] - 1]
    if i > 0 and A[i] == A[i-1] + 1:
            value += C[A[i-1]-1]            
    # print(value)

print(value)

Measured memory_bytes: 3064
import math
import itertools
N = int(input())
x = [0]*N
y = [0]*N
s = 0
for i in range(N):
  x[i],y[i] = (int(z) for z in input().split())
for i in itertools.permutations(range(N)):
  towns = list(i)
  for t in range(len(towns)-1):
    s += math.sqrt((x[towns[t+1]]-x[towns[t]])**2+(y[towns[t+1]]-y[towns[t]])**2)
print(s/math.factorial(N))

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

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

const int MAXN = 2e5;

struct Node
{
	int cnt[26];
	Node *chd[26];
	Node()
	{
		for(int i=0; i<26; i++) chd[i]=NULL, cnt[i]=0;
	}
};

int T[26];
Node *A[MAXN+10];
void push(Node *node, string &S, int pos, int x)
{
	if(pos+1==S.size()) A[x]=node;
	if(pos==S.size()) return;
	char c=S[pos];
	if(node->chd[c-'a']==NULL) node->chd[c-'a']=new Node();
	push(node->chd[c-'a'], S, pos+1, x);
	T[c-'a']=1;
	for(int i=0; i<26; i++) node->cnt[i]+=T[i];
}

int N;
string S[MAXN+10];
ll ans;

Node *root=new Node();

int main()
{
	cin>>N;
	for(int i=1; i<=N; i++)
	{
		for(int j=0; j<26; j++) T[j]=0;
		cin>>S[i];
		reverse(S[i].begin(), S[i].end());
		push(root, S[i], 0, i);
	}
	for(int i=1; i<=N; i++)
	{
		ans+=A[i]->cnt[S[i].back()-'a']-1;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 379744
#include "bits/stdc++.h"
using namespace std;

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	string s;
	cin >> s;
	int cont = 0;
	if (s[0] == 'A') {
		if ((s[1] >= 'A') && (s[1] <= 'Z')) {
			cout << "WA";
			return 0;
		}
		for (int i = 2; i < s.size() - 1; i++) {
			char moji = s[i];
			if (moji == 'C') {
				cont++;
				continue;
			}
			if ((moji >= 'A') && (moji <= 'Z')) {
				cout << "WA";
				return 0;
			}
		}
		if ((s[s.size()-1] >= 'A') && (s[s.size()-1] <= 'Z')) {
			cout << "WA";
			return 0;
		}
	}
	else {
		cout << "WA";
		return 0;
	}

	if (cont == 1) {
		cout << "AC";
	}
	else {
		cout << "WA";
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int main(){
  int n,x;
  cin>>n>>x;
  int l[n];
  rep(i,n) cin>>l[i];
  int ans = 1;
  int sum =0;
  rep(i,n){
    sum+=l[i];
    if(sum<=x)ans++;
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
////////////////////////////////////////////    _LeMur_
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <chrono>
#include <random>
#include <bitset>
#include <cstdio>
#include <vector>
#include <string>
#include <ctime>
#include <stack>
#include <queue>
#include <cmath>
#include <list>
#include <map>
#include <set>

using namespace std;

const int N = 100005;
const int inf = 1000 * 1000 * 1000;
const int mod = 998244353;

int n;

long double a[N];
long double answ;

int main(){
	mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
	cout.setf(ios::fixed);
	cout.precision(13);
	cin >> n;
	for(int i=1;i<=n;i++){
        cin >> a[i];
	}
	sort(a + 1 , a + n + 1);
	answ = a[1];
	for(int i=2;i<=n;i++){
        answ = (answ + a[i]) / 2.0;
	}
	cout << answ << endl;
    return 0;
}


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

#define INF 9'000'000'000'000'000;
#define int long long
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

typedef long long ll;

class SegmentTree {
private:
	int n;
	vector<int> node;
public:
	SegmentTree (vector<int> v) {
		int sz = v.size();
		n = 1;while(n < sz) n *= 2;
		node.resize(2*n-1, -1);
		for (int i = 0;i < sz;i++) {node[i+n-1] = v[i];}
		for (int i = n-2;i >= 0;i--) node[i] = max(node[2*i+1], node[2*i+2]);
	}

	int getmax(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		//要求区間と対象区間が交わらない
		if (r <= a || b <= l) return -1;
		//要求区間と対象区間を完全に被覆
		if (a <= l && r <= b) return node[k];
		int vl = getmax(a,b,2*k+1,l,(l+r)/2);
		int vr = getmax(a,b,2*k+2,(l+r)/2,r);
		return max(vl,vr);
	}
};

signed main() {
	int x,y,z,k;
	cin >> x >> y >> z >> k;
	vector<pair<pair<int,int>,int>> p;
	int a[x],b[y],c[z];
	REP (i,x) {cin >> a[i];p.push_back({{a[i],0},i});}
	REP (i,y) {cin >> b[i];p.push_back({{b[i],1},i});}
	REP (i,z) {cin >> c[i];p.push_back({{c[i],2},i});}
	// if (x * y * z <= 3000) {
	// 	vector<int> ans;
	// 	REP (i,x) {
	// 		REP (j,y) {
	// 			REP (l,z) {
	// 				ans.push_back(a[i]+b[j]+c[l]);
	// 			}
	// 		}
	// 	}
	// 	sort(ans.begin(),ans.end());
	// 	REP (i,k) {
	// 		cout << ans[ans.size()-i-1] << endl;
	// 	}
	// } else 
	{
		vector<int> yz;
		REP (i,y) {
			REP (j,z) {
				yz.push_back({b[i]+c[j]});
			}
		}
		vector<int> ans;
		SORT(yz);
		REVERSE(yz);
		REP (i,x) {
			REP (j,min((ll)yz.size(),k)) {
				ans.push_back(a[i]+yz[j]);
			}
		}
		SORT(ans);
		REVERSE(ans);
		REP (i,k) printf("%lld\n",ans[i]);
	}
}

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

int main(){
	int a;
	cin >> a;
	int data[8];
	int ans[a];
	for(int i=0;i<a;i++){
		int b;
		cin >> b;		
		data[0] = b%10;
		data[1] = b%100/10;
		data[2] = b%1000/100;
		data[3] = b%10000/1000;
		data[4] = b%100000/10000;
		data[5] = b%1000000/100000;
		data[6] = b%10000000/1000000;
		data[7] = b%100000000/10000000;
		
		sort(data,data+8);
		 

		int max = data[7]*10000000+data[6]*1000000+data[5]*100000+data[4]*10000+data[3]*1000+data[2]*100+data[1]*10+data[0];
		int min = data[0]*10000000+data[1]*1000000+data[2]*100000+data[3]*10000+data[4]*1000+data[5]*100+data[6]*10+data[7];

		ans[i]= max-min;
		

	}

	for(int i=0;i<a;i++){
		cout << ans[i] << endl;
	}
	return 0;
}

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

#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007

ll power(ll a,ll b){ll ans=1;while(b>0){if(b&1){ans = (ans*a);}b>>=1;a=a*a;}return ans;}
ll gcd(ll a,ll b){if(b==0){return a;}return gcd(b,a%b);}

int main() {
   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
   // cout << fixed << setprecision(10);
   string a,p;
   cin>>a>>p;
   for(ll i=0;i<a.length();i++){
       if(a[i]!=p[i]){
           cout<<"No"<<endl;
           return 0;
       }
   }
   cout<<"Yes"<<endl;
	return 0;
}


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

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define INF 10e7
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
using namespace std;

void solve(void)
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n - k)
    {
        if (a[i] < a[k + i])
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}
int main(void)
{
    solve();
}

Measured memory_bytes: 4036
N,K = map(int,input().split())
M = 10**9+7
def nCr(n, r, mod=10**9+7):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

for i in range(1,K+1):
    if N-K+1 < i:
        print(0)
        continue
    else:
        print((nCr(N-K+1,i)*nCr(K-1,i-1))%M)


Measured memory_bytes: 3316
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const (
	initialBufSize = 1024
	maxBufSize     = 1e6
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	// writer  = bufio.NewWriterSize(os.Stdout, 1000000)
)

func main() {
	scanner.Split(bufio.ScanWords)
	// scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	// defer writer.Flush()
	r := scanFloat64()

	fmt.Println(2. * r * math.Pi)
}

func scanInt() int {
	i, _ := strconv.Atoi(scanString())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[i] = scanInt()
	}
	return ints
}

func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanString(), 64)
	return f
}

func scanFloat64s(size int) []float64 {
	f := make([]float64, size)
	for i := 0; i < size; i++ {
		f[i] = scanFloat64()
	}
	return f
}

func scanString() string {
	scanner.Scan()
	return scanner.Text()
}

func scanStrings(size int) []string {
	s := make([]string, size)
	for i := 0; i < size; i++ {
		s[i] = scanString()
	}
	return s
}


Measured memory_bytes: 1756
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

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

    int n, k;
    cin >> n >> k;
    vi w(n);
    rep(i, n) cin >> w[i];
    auto check = [&](int p) {
                     int now = 0;
                     int cnt = 0;
                     rep(i, n) {
                         if (w[i] > p) return false;
                         if (now + w[i] > p) {
                             cnt++;
                             now = w[i];
                         } else {
                             now += w[i];
                         }
                     }
                     cnt++;
                     return cnt <= k;
                 };
    int l = -1, r = 1e9;
    while (r - l > 1) {
        int m = (l+r) >> 1;
        if (check(m)) r = m;
        else l = m;
    }
    cout << r << endl;
}



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

int main(){
    int a, b;
    cin >> a >> b;
    string ans;
    if(a < b){
        ans = " < ";
    } else if (a > b) {
        ans = " > ";
    } else{
        ans = " == ";
    }
    cout << "a" << ans << "b" << endl;
    return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

ll gcd(ll x, ll y)
{
    if (y == 0)
        return x;
    if (x < y)
        return gcd(y, x);
    else
        return gcd(y, x % y);
}

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

int main()
{
    ll n, ans;
    cin >> n >> ans;
    rep(i, n - 1)
    {
        ll t;
        cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int A[10];
int n;

bool dfs(int, int, int);

int main(){
  scanf("%d", &n);
  for(int i = 0; i < n; i++)
  {
  for(int i = 0; i < 10; i++)
    scanf("%d", &A[i]);

    cout << (dfs(0, 0, 0) ? "YES" : "NO") << endl;
  }
  return 0;
}

bool dfs(int ai, int b, int c)
{
  if(ai == 10)
    return true;
  int bb = b;
  int bc = c;
  bool ans = false;
  if(A[ai] > b)
  {
    b = A[ai];
    //cout << b  << " into B" << ai << endl;
    ans = ans || dfs(ai + 1, b, c);
    b = bb;
  }
  if(A[ai] > c)
  {
    c = A[ai];
    //cout << b  << " into C" << ai << endl;
    ans = ans || dfs(ai + 1, b, c);
    c = bc;
  }
  return ans;
}

Measured memory_bytes: 1200
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i++){
        int cnt = 0;
        if (i % 2 == 1) {
            for(int j = 1; j <= i/2; j++){
                if (i % j == 0) {
                    cnt++;
                }
            }
            if (cnt == 7) {
                ans++;
            }
        }
        
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {
	int n, m, l; cin >> n >> m >> l;
	vector<vector<int> > a(n, vector<int>(m)), b(m, vector<int>(l));
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			cin >> a[i][j];
	for (int i = 0; i < m; ++i)
		for (int j = 0; j < l; ++j)
			cin >> b[i][j];
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < l; ++j) {
			long long sum = 0;
			for (int k = 0; k < m; ++k) {
				sum += a[i][k] * b[k][j];
			}
			if (j) cout << " ";
			cout << sum;
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3156
import math

a, b, x = map(int, input().split())

if pow(a,2) * b == x:
    print(0)
elif pow(a,2) * b / 2 <= x:
    print(90 - math.degrees(math.atan((a / 2) / (b - x / pow(a,2)))))
else:
    print(90 - math.degrees(math.atan((2 * x / (a * b)) / b)))

'''
left = 0
right = math.pi / 2
for i in range(10**5):
    mid = (left + right) / 2
    water = b * b * math.tan(math.pi / 2 - mid) * 0.5 * a
    if water > x:
        left = mid
    elif water < x:
        right = mid
    else: break
print(i, water, x)
print(math.degrees(mid))
'''

Measured memory_bytes: 62500
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    int n, x; cin >> n >> x;
    vi a(n); rep(i, n) cin >> a[i];
    sort(all(a));
    int ans = 0;
    rep(i, n){
        if(x >= a[i]) {
            ans++;
            x -= a[i];
        }else{
            cout << ans << endl;
            return;
        }
    }
    if(x == 0) cout << n << endl;
    else cout << n-1 << endl;
    return;
}

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

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define sz(x) ((int) x.size())
#define fo(i, n) for( int i = 0; i < n; i++ )

const int INF = 1e9;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;


int main() {sws;

    int n;
    cin >> n;

    cout << 1000 - (n % 1000 == 0 ? 1000 : n % 1000) << endl;

    return 0;
}

Measured memory_bytes: 3632
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val N = in.nextInt
  val As = new Array[Long](100_001)
  val sum = (1 to N).map{_ =>
    val i = in.nextInt
     As(i) += 1
     i.toLong
   }.sum

  val Q = in.nextInt
  (1 to Q).foldLeft(sum) {(sum, i) =>
    val from = in.nextInt
    val to = in.nextInt
    val newSum = sum + (to - from) * As(from)
    println(newSum)
    As(to) += As(from)
    As(from) = 0
    newSum
  }
}

Measured memory_bytes: 63764
#include <cstdio>
#include <cmath>

using namespace std;

int main(void)
{
  long int num, distance, count;
  count = 0;
  scanf("%ld %ld", &num, &distance);
  for (int i = 0; i < num; i++)
  {
    long int x, y, result;
    scanf("%ld %ld", &x, &y);
    result = ceil(sqrt(x * x + y * y));
    if (result <= distance)
    {
      count++;
    }
  }
  printf("%ld", count);
  return 0;
}


Measured memory_bytes: 2216
n,c,k = map(int,input().split())
buf = []
for i in range(n):
    t = int(input())
    buf.append(t)

buf.sort()

ans = 0
lasttime = 1e9
tcnt = 0
for i in range(n):
    if i == 0:
        tcnt += 1
        lasttime = buf[i]
        ans += 1
    else:
        t = buf[i]
        if t <= lasttime+k and tcnt < c:
            tcnt += 1
        else:
            ans += 1
            lasttime = buf[i]
            tcnt = 1
    # print(ans)
print(ans)

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

using namespace std;

namespace {
    int N, W, H;
    vector<int> X, Y, Z;
    void input() {
        cin >> N >> W >> H;
        for (int i = 0; i < N; i++) {
            int x, y, w; cin >> x >> y >> w;
            X.push_back(x);
            Y.push_back(y);
            Z.push_back(w);
        }
    }

    template<class T> ostream& operator<<(ostream& os, const vector<T>& xs) {
        if (xs.empty()) {
            return os << "[]";
        }
        os << "[" << xs[0];
        for (int i = 1; i < xs.size(); i++) {
            os << " " << xs[i];
        }
        return os << "]";
    }

    bool check(const vector<int>& X, int W) {
        vector<int> D(W + 2, 0);
        vector<int> L(W + 2, 0);
        for (int i = 0; i < N; i++) {
            int x = X[i], w = Z[i];
            D[ max(0, x - w) ]++;
            L[ min(W + 1, x + w) ]--;
        }
        int c = 0;
        for (int i = 0; i < W; i++) {
            c += D[i];
            c += L[i];
            if (c <= 0) {
                return false;
            }
        }
        return true;
    }

    void solve() {
        cout << (check(X, W) || check(Y, H) ? "Yes" : "No") << endl;
    }
}

int main() {
    input(); solve();
    return 0;
}

Measured memory_bytes: 3248
import java.io.PrintWriter
import java.util.StringTokenizer

fun main() {

    fun PrintWriter.solve() {
        var s = next()
        var t = next()

        var ans = s.zip(t).filter { it.first != it.second }.count()
        println(ans)

    }

    writer.solve()
    writer.flush()


}


private val reader = System.`in`.bufferedReader()
private val writer = PrintWriter(System.out, false)

private var tokenizer: StringTokenizer = StringTokenizer("")

private fun next(): String {
    while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(reader.readLine())
    return tokenizer.nextToken()
}

private fun nextInt() = next().toInt()
private fun nextLong() = next().toLong()
private fun nextDouble() = next().toDouble()
private fun nextLine() = reader.readLine()



Measured memory_bytes: 48648
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <cmath>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	int num, i;
	double n, a = 100;
	cin >> n;
	for (i = 1; i < 10000000; i++) {
		a *= 1.01;
		a = floor(a);
		if (a >= n)
			break;
	}
	cout << i << "\n";
	return 0;
}

Measured memory_bytes: 3724
#include<iostream>
using namespace std;
int n,a,b;
int main(){
	cin>>n;
	b=n%100;
	a=n/100;
	if(1<=a&&a<=12){
		if(1<=b&&b<=12)
			cout<<"AMBIGUOUS";
		else cout<<"MMYY";
	}
	else{
		if(1<=b&&b<=12)
			cout<<"YYMM";
		else cout<<"NA";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define lld long double
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

lli dp[6000][6000];

signed main(){

	lli n;
	cin>>n;

	string s;
	cin>>s;

	for(lli i=n-1;i>=0;i--){
		for(lli j=n-1;j>i;j--){
			if(s[i]==s[j]){
				dp[i][j] = max(dp[i][j],dp[i+1][j+1]+1);
			}
		}
	}

	lli ans = 0;
	REP(i,0,n)REP(j,0,n)ans = max(ans,min(dp[i][j],j-i));

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 235648
def dfs(game):
    a,b = game.count("A"),game.count("B")
    if  (a == 5 and b < 4 or a < 4 and b == 5 or a == b == 5 or 
            a == 6 and b == 4 or a == 4 and b == 6):
        possible.add(game)
    elif (max(a,b) <= 4 or a == b == 4 or a == 5 and b == 4 or a == 4 and b == 5):
        possible.add(game)
        if game+"A" not in possible: dfs(game+"A")
        if game+"B" not in possible: dfs(game+"B")
            
j,y = map(int,raw_input().split())
possible = set([])
dfs("")
ans = []
for game in possible:
    if (game.count("A"),game.count("B")) == (j,y): ans.append(game)
print  "\n".join(sorted(ans))

Measured memory_bytes: 4288
#include<stdio.h>
 int main(void)
 {
     int D,N,i,j=0;

     scanf("%d%d",&D,&N);

     if(D==0){
       for(i=1;i<=10000;i++){
         if(i%100!=0) j++;
         if(j==N){
           printf("%d\n",i);
           return 0;
         }
       }
     }
     if(D==1){
       for(i=0;i<=10000;i++){
         if(i%100!=0) j++;
         if(j==N){
           printf("%d\n",i*100);
           return 0;
         }
       }
     }

     if(D==2){
       for(i=1;i<=10000;i++){
         if(i%100!=0) j++;
         if(j==N){
           printf("%d\n",i*10000);
           return 0;
         }
       }
     }

 }


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (abs(a-c) <= d) cout << "Yes" << endl;
  else if (abs(a-b) <= d && abs(b-c) <= d) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3636
#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;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    ll num=0;
    while(n){
        n/=k;
        num++;
    }
    cout <<num<<endl;
    return 0;
}


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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<vector<int>> e(n, vector<int>(3));
  for (int i = 0; i < n; i++) {
    cin >> e[i][0] >> e[i][1] >> e[i][2];
  }
  vector<vector<int>> dp(n + 1, vector<int>(3));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (j == k) continue;
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + e[i][j]);
      }
    }
  }
  int ans = max({dp[n][0], dp[n][1], dp[n][2]});
  cout << ans << endl;
  return 0;
}


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

#define range 100005
#define mod 1000000007
#define eps 1e18
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<
#define int long long 

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

int a[50][50];

int res[50][50];

int output[50][50];

int n,k;

void multipy()
{
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			res[i][j]=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			for(int k=0;k<n;k++)
			{
				res[i][j] += (a[i][k]*a[k][j])%mod;
				res[i][j]%=mod;
			}
		}
	}
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			a[i][j] = res[i][j];
	return; 

} 

void adda()
{
	for(int i=0;i<n;i++)
		 for(int j=0;j<n;j++)
			 res[i][j]=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			for(int k=0;k<n;k++)
			{
				res[i][j] += (output[i][k]*a[k][j])%mod;
				res[i][j]%=mod;
			}
		}
	}
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			output[i][j] = res[i][j];
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("test.txt","r",stdin);
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i==j)
				output[i][j]=1;
			cin>>a[i][j];
		}
	}
	while((k)!=0)
	{
		if((k&1))
			adda();
		multipy();
		k/=2;
	}
	int ans = 0 ;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			ans+=output[i][j];
			ans%=mod;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 384
N, K = map(int, input().split())
X = list(map(int, input().split()))

ans = 10 ** 9
for i in range(N-K+1):
    a = X[i]
    b = X[i+K-1]
    if a * b > 0:
        v = max(abs(a), abs(b))
    else:
        v = abs(a) + abs(b) + min(abs(a), abs(b))
    ans = min(ans, v)
print(ans)


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;

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

    string s, t;
    cin >> s >> t;

    reverse(all(t));
    if(s == t) {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}



Measured memory_bytes: 256
import sys
N = int(input())
for i in range(1,3501):
    for j in range(i,3501):

        if 4*i*j-N*i-N*j > 0:
            if (N*i*j)%(4*i*j-N*i-N*j) == 0:
                w = int((N*i*j)/(4*i*j-N*i-N*j))
                print(i,j,w)
                sys.exit()


Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;

using LL = long long;

LL n;
vector<LL>a;


int main(void)
{
	cin >> n;
	for (LL i = 0; i < 3 * n; ++i)
	{
		LL aa; cin >> aa;
		a.push_back(aa);
	}
	priority_queue<LL, vector<LL>, greater<LL>>pq_lef; 
	LL sum_lef = 0;
	for (LL x = 0; x < n; ++x)
	{
		pq_lef.push(a[x]);
		sum_lef += a[x];
	}
	deque<LL>deq_lef;
	deq_lef.push_back(sum_lef);
	for (LL lef = n; lef < n + n; ++lef)
	{
		pq_lef.push(a[lef]);
		sum_lef += a[lef];
		LL is = pq_lef.top();
		sum_lef -= is;
		pq_lef.pop();
		deq_lef.push_back(sum_lef);
	}

	priority_queue<LL>pq_rht;
	LL sum_rht = 0;
	for (LL x = n + n + n - 1; x >= n + n; --x)
	{
		pq_rht.push(a[x]);
		sum_rht += a[x];
	}
	deque<LL>deq_rht;
	deq_rht.push_front(sum_rht);
	for (LL rht = n + n - 1; rht >= n; --rht)
	{
		pq_rht.push(a[rht]);
		sum_rht += a[rht];
		LL is = pq_rht.top();
		sum_rht -= is;
		pq_rht.pop();
		deq_rht.push_front(sum_rht);
	}

	LL ans = -LLONG_MAX;
	for (LL x = 0; x <= n; ++x)
	{
		ans = max(ans, deq_lef[x] - deq_rht[x]);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 7780
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
  cin>>s;
  int i,count=0;
  for(i=0;i<s.length();i++)
  {
  	if(s[i]=='7')
  	{
  		cout<<"Yes"<<endl;
  		count=1;
  		break;
	  }
  }
  if(count==0) cout<<"No"<<endl;
}

Measured memory_bytes: 3620
N, M = map(int, input().split())
s = [list(map(int, input().split())) for i in range(M)]
s.sort(key=lambda x:x[1])

count=1
mae=s[0][1]
for i in range(1,M):
    if s[i][0]>=mae:
        count+=1
        mae=s[i][1]

print(count)

Measured memory_bytes: 29084