akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cstring>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define vi vector < int >
#define vll vector < long long >
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    cout << (a[0] == 5 && a[1] == 5 && a[2] == 7 ? "YES\n" : "NO\n");

	return 0;
}

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

int main() {
    int n; cin >> n;
    vector<vector<int>> abc(n, vector<int>(3));
    for(int i = 0; i < n; i ++) cin >> abc[i][0] >> abc[i][1] >> abc[i][2];
    vector<vector<int>> dp(n, vector<int>(3));
    dp[0] = {abc[0][0], abc[0][1], abc[0][2]};
    if(n==1) {
        cout << *max_element(dp[0].begin(), dp[0].end()) << endl;
        return 0;
    }
    dp[1] = {max(abc[1][0]+abc[0][1], abc[1][0]+abc[0][2]), max(abc[1][1]+abc[0][0], abc[1][1]+abc[0][2]), max(abc[1][2]+abc[0][0], abc[1][2]+abc[0][1])};
    for(int i = 2; i < n; i++) {
        dp[i] = {abc[i][0]+max(dp[i-1][1], dp[i-1][2]), abc[i][1]+max(dp[i-1][0], dp[i-1][2]), abc[i][2]+max(dp[i-1][0], dp[i-1][1])};
    }
    cout << *max_element(dp[n-1].begin(), dp[n-1].end()) << endl;
}

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

int main() {
	long A[3];
	for(int i=0; i<3; ++i) cin >> A[i];
	if((A[0]%2) && (A[1]%2) && (A[2]%2)){
	    sort(A, A+3);
	    long P=A[0]*A[1];
	    cout << P << endl;
	}
	else cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

	class AOJ0119{
		public AOJ0119() {
			int m = in.nextInt();
			int n = in.nextInt();
			int[] cnt = new int[m];
			boolean edge[][] = new boolean[m][m];
			for(int i=0;i<n;i++){
				int x = in.nextInt(),y = in.nextInt();
				edge[y-1][x-1] = true;
				cnt[y-1]++;
			}
			ArrayList<Integer> list = new ArrayList<Integer>();
			for(int k=0;k<m;k++){
				for(int i=0;i<m;i++)if(cnt[i]==0){
					list.add(i+1);
					cnt[i] = Integer.MAX_VALUE;
					for(int s=0;s<m;s++)if(edge[s][i])cnt[s]--;
				}
			}
			for(int i=0;i<list.size();i++)System.out.println(list.get(i));
		}
	}
}

Measured memory_bytes: 18792
Option Strict On
Module Module1

    Sub Main()
        Dim n As Integer = Convert.ToInt32(Console.ReadLine())
        Dim S As String = Console.ReadLine()
        Dim white As Integer = 0
        For i As Integer = 0 To n - 1
            If Mid(S, i + 1, 1) = "." Then
                white += 1
            End If
        Next
        Dim leftblack As Integer = 0
        Dim sum As Integer = leftblack + white
        For i As Integer = 0 To n - 1
            If Mid(S, i + 1, 1) = "#" Then
                leftblack += 1
            Else
                white -= 1
            End If
            If sum > leftblack + white Then
                sum = leftblack + white
            End If

        Next
        Console.WriteLine(sum)
        Console.ReadLine()
    End Sub

End Module

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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	vector<int>A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	vector<int> R;
	int v;
	for (v = N-1; v >= 0; v -= 2) R.push_back(A[v]);
	v += 2;
	for (v ^= 1; v < N; v += 2) R.push_back(A[v]);
	for (int i = 0; i < N; i++) {
		cout << R[i] << " \n"[i+1==N];
	}

	return 0;
}


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

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

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

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

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

//---------------------------------------------------------------
//
//	工事中・・・
//
//---------------------------------------------------------------

int N;
int h[100];

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

	cin >> N;
	REP(i, 0, N)	cin >> h[i];
	int ans = 0;
	int min = 101;
	int st = 0;
	bool flag = true;
	while(flag) {
		flag = false;
		min = 101;
		st = 0;
		REP(i, 0, N) {
            // cout << "start --> h[" << i << "] = " << h[i] << "  st = " << st << "  min = " << min 
            //             << "  flag = " << flag << "  ans = " << ans << endl;
    // 		if(h[i] < 0) {
    // 	       st = i + 1;
    // 	       continue;
    // 		}
    		if(h[i] == 0) {
    			if(st < i && min < 101) {
	    			ans += min;
	    			REP(j, st, i) {
	    				h[j] -= min;
                        // cout << "  updated 1 --> h[" << j << "] = " << h[j] << endl;
	    			}
	    			min = 101;
	    		}
    			st = i + 1;
    			continue;
    		} else if(h[i] > 0 && min > h[i]) {
    		  //  cout << " min = " << min << " > h[" << i << "] = " << h[i] << endl;
				min = h[i];
				flag = true;
			}
			if(i == N - 1) {
    			if(min < 101) {
	    			ans += min;
	    			REP(j, st, N) {
	    				h[j] -= min;
                        // cout << "  updated 2 --> h[" << j << "] = " << h[j] << endl; 
	    			}
	    		}
			}
            // cout << "end   --> h[" << i << "] = " << h[i] << "  st = " << st << "  min = " << min 
            //             << "  flag = " << flag << "  ans = " << ans << endl << endl;
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
def get_number_of_coin(coins, dp_coin, total):
    for c in coins:
        for j in range(c, total + 1):
            dp_coin[j] = min(dp_coin[j], dp_coin[j - c] + 1)
    return dp_coin[-1]


if __name__ == "__main__":
    total, n_coin = map(int, input().split())
    *coins, = map(int, input().split())    
    dp_coin = [10000] * (total + 1)
    dp_coin[0] = 0
    print(get_number_of_coin(coins, dp_coin, total))


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

int main(){
  int N,K;
  cin >> N >> K;
  int k = 1;
  for(int i =0;i<N;i++){
    if(k*2<k+K)
      k =k*2;
    else
      k=k+K;
  }
  cout << k << endl;
}


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

typedef long long ll;   
const ll mod=1000000007;
const ll msize=1e5+100;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin >> n;
    ll ans[n+5];
    set<int> s[n+5];
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        ans[i]=0;
        for(int j=1;j<=n;j++)
        {
            if(i!=j)
            {
                s[i].insert(j);
            }
        }
        if(n%2==0)
            s[i].erase(n+1-i);
        else
            s[i].erase(n-i);
        
        sum+=s[i].size();
    }
    cout << sum/2 << endl;
    for(int i=1;i<=n;i++)
    {
        for(auto j:s[i])
            if(j>i)
                cout << i << " " << j << endl;
    }
    

}


Measured memory_bytes: 768
d=list(map(int,input().split()))
o=str(input())
for i in o:
	if i=='N':
		d[0],d[1],d[4],d[5]=d[1],d[5],d[0],d[4]
	elif i=='S':
		d[0],d[1],d[4],d[5]=d[4],d[0],d[5],d[1]
	elif i=='E':
		d[0],d[2],d[3],d[5]=d[3],d[0],d[5],d[2]
	elif i=='W':
		d[0],d[2],d[3],d[5]=d[2],d[5],d[0],d[3]
print(int(d[0]))


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

int main(void) {
	string s;
	cin >> s;
	set<string> t;
	for (int i = 0; i < s.length(); i++) t.insert(string() + s[i]);
	cout << (t.size() == s.length() ? "yes" : "no") << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int a[100001],b[100001];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i]>>b[i];
	sort(a,a+n);
	sort(b,b+n);
	b[n]=-1;
	int ans=1,top=0;
	int k=1;
	for(int i=0;i<n;i++){
		k++;
		while(b[top]+1==k)
			top++,k--;
		if(a[i]<=k)
			ans=max(ans,k);
	}
	cout<<ans-1<<endl;
	return 0;
}

Measured memory_bytes: 1956
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define INF 1000000000000000

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> A(N);
  int sum=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    sum+=A.at(i);
  }
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  bool flag=true;
  for(int i=0;i<M;i++){
    if(4*M*A.at(i)<sum){
      flag=false;
      break;
    }
  }
  if(flag){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<(int)N;i++)
int main()
{
  int N,key=0;
  map<int,int> group;
  cin>>N;
  rep(i,N-1){cin>>key;group[key]++;}
  rep(i,N)group.count(i+1)>0?cout<<group.at(i+1)<<endl:cout<<0<<endl;
}

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

int main(){
  int N;
  cin>>N;
  int ans(1);
  while (true){
    if (ans>N){
      cout << ans/2 << endl;
      return 0;
    }
    cerr << ans << " ";
    ans*=2;
  }
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_IOSTREAM
#include<bits/stdc++.h>
#define maxn 500100
using namespace std;
int dp[maxn],ans,n;
char s[maxn];
int main(){
	scanf("%d%s",&n,s+1);
	for(int i=1,lst=-1;i<=n;++i){
		dp[i]=dp[i-1];
		if(s[i]=='0'&&s[i-1]=='1')lst=i-1;
		else if(s[i]=='0')lst=-1;
		if(s[i]=='1'){
			if(s[i-1]=='0')for(int j=i-2;j>=1&&s[j]=='1';--j)
				dp[i]=max(dp[i],dp[j-1]+(i-j-1));
			if(lst!=-1)dp[i]=max(dp[i],dp[lst-1]+(i-lst-1));
		}
	}
	printf("%d",dp[n]);
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vi vector<int>
#define sl set<ll>
#define sc set<char>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mpi map<ll,ll>
#define mpc map<char,ll>
#define forn(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define inf        1000000000000

int main()
{
	ll n,w;
	cin>>n>>w;
	vector<ll> dp(n*1001,inf);
	ll sum=0;
	ll a[n][2];
	forn(i,n)
	{
		cin>>a[i][0]>>a[i][1];
		sum+=a[i][1];
	}
	dp[0]=0;
	forn(i,n)
	{
		for(ll j=sum-a[i][1];j>=0;j--)
		{
			dp[j+a[i][1]]=min(dp[j+a[i][1]],dp[j]+a[i][0]);
		}
	}
	ll ans=0;
	for(ll i=0;i<=sum;i++)
	{
		if(dp[i]<=w)
			ans=max(ans,i);
	}
	cout<<ans;
}

Measured memory_bytes: 1024
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    string s, t;
    cin >> s >> t;

    cout << t << s << endl;
    
}


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

int main(){
    int A, B, H, M;
    cin >> A >> B >> H >> M;

    long double thetah, thetam, theta;
    thetah = 0.5 * (H * 60 + M);
    thetam = M * 6;
    theta = abs(thetam - thetah);

    long double l;
    l = sqrt((A * A + B * B) - (2 * (A * B) * cos((theta / 360) * 2 * M_PI)));

    printf("%20.20Lf", l);
    return 0;
}

Measured memory_bytes: 4108
#include <iostream>

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

    int a, b;
    std::cin >> a >> b;
    std::cout << ((a<b)?"a < b":(a>b)?"a > b":"a == b") << "\n";
    return 0;
}

Measured memory_bytes: 1172
n, q = map(int, input().split())
stacks = [[] for i in range(n)]
while q:
    q -= 1
    s = [*map(int, input().split())]
    if s[0] == 0:
        stacks[s[1]].append(s[2])
    elif s[0] == 1 and len(stacks[s[1]]):
        print(stacks[s[1]][-1])
    elif len(stacks[s[1]]):
        stacks[s[1]].pop()


Measured memory_bytes: 13448
#include <iostream>

using namespace std;
int main(void)
{
	int S;
	int h, m, sec;

	cin >> S;
	
	if( (0 <= S) && ( S < 86400 ) )
	{
		h = S / 3600;
		S = S - (3600*h);
		m = S / 60;
		S = S -(60*m);
		sec = S;
		cout << h << ":" << m << ":" << sec << endl;
	}
	else
	{
		cout << "Convert failed." << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin>>a;
    int arr[300]={0};
    for(int i=0;i<a.size();i++){
        int n=a[i];
        arr[n]+=1;
    }
    int cnt=0;
    for(int i=0;i<300;i++){
        if (arr[i]%2!=0){
            cnt+=1;
        }
    }
    if (cnt!=0){
        printf("No");
    }
    else {
        printf("Yes");
    }
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    multiset<long long> lower_a, upper_a;
    long long lower_a_sum = 0, upper_a_sum = 0;
    long long b_sum = 0;
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        int t;
        cin >> t;
        if (t == 1) {
            long long a, b;
            cin >> a >> b;
            b_sum += b;
            if (lower_a.size() <= upper_a.size()) {
                lower_a.insert(a);
                lower_a_sum += a;
            } else {
                upper_a.insert(a);
                upper_a_sum += a;
            }
            if (lower_a.size() > 0 && upper_a.size() > 0) {
                int x = *lower_a.rbegin();
                int y = *upper_a.begin();
                if (x > y) {
                    lower_a.erase(lower_a.find(x));
                    lower_a.insert(y);
                    lower_a_sum += y-x;
                    upper_a.erase(upper_a.find(y));
                    upper_a.insert(x);
                    upper_a_sum += x-y;
                }
            }
        } else {
            long long x_0 = *lower_a.rbegin();
            // answer is then: x_0*|lower_a| - lower_a_sum + upper_a_sum - x_0*|upper_a| + b_sum
            long long f_x_0 = b_sum + upper_a_sum - lower_a_sum + x_0 * (lower_a.size() - upper_a.size());
            cout << x_0 << " " << f_x_0 << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    vector <ll> ls;
    REP(i, n){
        ll l; cin >> l;
        ls.push_back(l);
    }
    ll ans = 0;
    REP(i, n){
        for(ll j=i+1; j<n; j++){
            for(ll k=j+1; k<n; k++){
                if (ls[i]==ls[j]){
                    continue;
                }
                if (ls[j]==ls[k]){
                    continue;
                }
                if (ls[k]==ls[i]){
                    continue;
                }
                if (ls[i]+ls[j] <= ls[k]){
                    continue;
                }
                if (ls[j]+ls[k] <= ls[i]){
                    continue;
                }
                if (ls[k]+ls[i] <= ls[j]){
                    continue;
                }
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define ii pair<int, int>
#define iii pair<int, ii>
#define M 90001
#define pb push_back
#define mp make_pair
#define x first
#define y second

int h, w, k, q, px[M], py[M];
int f[M];

int main(){
    cin >> h >> w >> k;
    for (int i = 1; i <= h; i++)
        for (int j = 1; j <= w; j++){
            int x;
            cin >> x;
            px[x] = i, py[x] = j;
        }
    for (int i = 0; i < k; i++){
        f[i] = 0;
        for (int j = 1; i + k*j <= h*w; j++){
            f[i + k*j] = f[i + k*(j-1)] + abs(px[i+k*(j-1)] - px[i + k*j])
                                    + abs(py[i+k*(j-1)] - py[i + k*j]);
        }
    }
    cin >> q;
    for (int i = 1; i <= q; i++){
        int x, y;
        cin >> x >> y;
        if (x == y || (x%k) != (y%k)) cout << 0 << endl;
        else cout << f[y] - f[x] << endl;
    }
}


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

class UnionFind {
private:
  int sz;
  vector<int> par, size_;
public:
  UnionFind() {}
  UnionFind(int n) : sz(n), par(sz), size_(sz, 1) {
    iota(par.begin(), par.end(), 0);
  }
  int root(int x) {
    if (par.at(x) == x) return x;
    else return par.at(x) = root(par.at(x));
  }
  void unit(int x,int y) {
    x = root(x), y = root(y);
    if (x == y) return;
    if (size_.at(x) < size_.at(y)) swap(x, y);
    par.at(y) = x;
    size_.at(x) += size_.at(y);
  }
  int size(int x) {
    x = root(x);
    return size_.at(x);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
};

int main() {
  int N, M, K;
  cin >> N >> M >> K;
  UnionFind UF(N);
  vector<int> NG(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    UF.unit(a, b);
    NG.at(a)++, NG.at(b)++;
  }
  for (int i = 0; i < K; i++) {
    int c, d;
    cin >> c >> d;
    c--, d--;
    if (UF.same(c, d)) NG.at(c)++, NG.at(d)++;
  }
  for (int i = 0; i < N; i++) {
    int tmp = UF.size(i);
    cout << tmp - (NG.at(i) + 1) << "\n";
  }
}

Measured memory_bytes: 4592
/*	MASTER HAS FAILED MORE TIMES
	THAN BEGINNER HAS EVER TRIED
*/

#include <bits/stdc++.h>

using namespace std;

#define endl             '\n'
#define all(a)           a.begin(), a.end()
#define mem(a, n)        memset(a, n, sizeof(a))
#define Unique(n)        (n).erase(unique(all(n)), (n).end())
#define NumofDigits(n)   ((long long)log10(n)+1)
#define repeat(i, a, n)  for(int i=a; i<n; i++)
#define isPowerOfTwo(n)  (n && !(n & (n - 1)))

typedef long long ll;
typedef long double ld;

int sieve(int n);
unsigned long long pow(long long base, long long power);
long long gcd(long long a, long long b){ return a%b ? gcd(b, a%b) : b; }
long long lcm(long long a, long long b){ return a*b/gcd(a, b); }

void quicken(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
void file(){
#ifdef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif /*ONLINE_JUDGE*/
}

bool isPalindrome(string a){
    string b = a;
    reverse(all(b));
    return a == b;
}

int main(){
    quicken();

    string s; cin >> s;
    int n = s.size();

    if(isPalindrome(s) && isPalindrome(s.substr(0, (n-1)/2))
       && isPalindrome(s.substr((n+3)/2-1, n-(n+3)/2+1)))
        cout << "Yes";
    else cout << "No";

    return 0;
}

unsigned long long pow(long long base, long long power){  /// mod?
    if(power==0)
        return 1;
    if(power==1)
        return base;

    unsigned long long ans = pow(base, power/2); /// mod?
    ans *= ans; /// ((ans%mod)*(ans%mod))%mod;

    if(power&1)
        return ans*base; /// ((ans%mod)*(base%mod))%mod;
    return ans;
}

int sieve(int n){
    int c = 0;
    vector<bool> isPrime(n+1, true);
    isPrime[0] = isPrime[1] = 0;

    for(long long i=2; i*i<=n; i++)
        if(isPrime[i])
            for(long long j=i*2; j<=n; j+=i)
                isPrime[j] = 0;
    repeat(i, 0, n+1)
    if(isPrime[i])
        c++;
    return c; /// primeCount [1:n]
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include "bits:stdc++.h"
#define INF 1234567890987654321
typedef long long ll;
using namespace std;
set <char> s;
int main()
{
//	freopen("inputfile.cpp", "r", stdin);
	for(ll i = 0; i < 3; i++)
	{
		char cc;
		cin >> cc;
		s.insert(cc);
	}
	if(s.size() < 3)cout << "No";
	else cout << "Yes";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,ans = 0;
    cin >> a >> b >> c;

    for(int i = a; i <= b; i++)
        if(c%i == 0)
            ans++;
    
    cout << ans << endl;
    
    return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	ll n, h;cin >> h >> n;
	REP(i, n){
		ll a;cin >> a;
		h -= a;
	}
	cout << (h <= 0 ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 256
def p(X):
    print(X)
N = list(map(int, input().split()))

zahyou = abs(N[0])
sums = N[1]
move = N[2]
shou = zahyou // move
a =[0,0]

if shou >= sums:
    p(zahyou-move*sums)
else:
    zahyou -= move*shou
    if (sums - shou) %2 ==0:
        p(zahyou)
    else:
        p(abs(zahyou-move))

Measured memory_bytes: 9188
package main

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

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func main() {
	sc := NewScanner()
	A, B := sc.nextInt(), sc.nextInt()
	a := A + B
	b := A - B
	c := A * B
	m := max(a, b)
	m = max(m, c)
	fmt.Println(m)
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    string s;
    cin >> n >> s;
    int answer = 0;
    REP(i,s.length()-2){
        if(s.substr(i,3) == "ABC")answer++;
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

typedef db T;
struct P{
    T x,y;
    P(){} P(T x,T y):x(x),y(y){}
    P operator - (const P&b) const {return P(x-b.x,y-b.y);}
    P operator + (const P&b) const {return P(x+b.x,y+b.y);}
    P operator * (const T&k) const {return P(x*k,y*k);}
    T operator * (const P&b) const {return x*b.x+y*b.y;}
    void read() {scanf("%lf%lf",&x,&y);}
};
T norm(P a){return a.x*a.x+a.y*a.y;}
P proj(P p,P a,P b){return (b-a)*((p-a)*(b-a)/norm(b-a))+a;}

int main(){
    P p,a,b;
    a.read();b.read();
    int Q;scanf("%d",&Q);
    rep(i,0,Q){
        p.read();
        P q=proj(p,a,b);
        printf("%.10f %.10f\n",q.x,q.y);
    }
    return 0;
}

Measured memory_bytes: 3228
package main

import (
	"fmt"
)

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

	x := make([]int, n)
	mx := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&x[i])
		if mx < x[i] {
			mx = x[i]
		}
	}

	ans := int(1e9)
	for p := 1; p <= mx; p++ {
		t := 0
		for j := 0; j < n; j++ {
			p := (x[j] - p) * (x[j] - p)
			t += p
		}
		if t < ans {
			ans = t
		}
	}

	fmt.Println(ans)
}


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

template <typename T, typename U>
vector<pair<T, U>> prime_factorization(T x)
{
    vector<pair<T, U>> ret;
    for (T i = 2; i * i <= x; i++)
    {
        U count = 0;
        while (x % i == 0)
        {
            count++;
            x /= i;
        }
        if (count > 0)
        {
            ret.push_back(make_pair(i, count));
        }
    }
    if (x != 1)
    {
        ret.push_back(make_pair(x, 1));
    }
    return ret;
}

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

    size_t ans = 0;
    for (pair<long long, size_t> p : prime_factorization<long long, size_t>(N))
    {
        size_t current = 1;
        while (current <= p.second)
        {
            ans++;
            p.second -= current;
            current++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3616
i = list(map(int, input().split()))
n = i[0]
l = i[1]
if l >= 0:
    print(round((n-1)*(2*l+n)/2))
elif l+n-1 <= 0:
    print(round((n-1)*(2*l+n-2)/2))
else:
    print(round(n*(2*l+n-1)/2))

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

using namespace std;

typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll A, B, b = 1, num = 0;
	cin >> A >> B;
	while (A*b <= B){
		b *= 2;
		num++;
	}
	cout << num << '\n';
}

Measured memory_bytes: 256
import sys
import fractions
input = sys.stdin.readline

A, B = map(int, input().split())

n = fractions.gcd(A, B)
if n == 1:
    print(1)
    sys.exit()


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


a = {x[0] for x in factorization(A)}
b = {x[0] for x in factorization(B)}

print(len(a & b) + 1)


Measured memory_bytes: 5980
use proconio::{fastout, input};
use std::collections::HashSet;

#[fastout]
fn main() {
    input! {in_n: usize, in_ss: [String; in_n]};
    let mut names = HashSet::new();

    for s in in_ss.iter() {
        names.insert(s);
    }

    println!("{}", names.len());
}


Measured memory_bytes: 18624
import java.io.*;

public class Main{
  public static void main(String[] args) {
    try {
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      int n, x;

      n = Integer.parseInt(reader.readLine());
      x = n/3;

      System.out.println(x);
    }
    catch (Exception e) {
      
    }
  }
}

Measured memory_bytes: 20820
#include <iostream>

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b == c || b + c == a || c + a == b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3080
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define INT_MAX 2147483647
#define LLINT_MAX 9223372036854775807
#define mod 1000000007
#define ll long long int
using namespace std;

int main() {
	int h, w;
	string s[52];
	cin >> h >> w;
	s[0] = "";
	s[h + 1] = "";
	lp(w+2) {
		s[0].push_back('.');
		s[h + 1].push_back('.');
	}
	lp(h) {
		cin >> s[i + 1];
		s[i + 1] = '.' + s[i + 1] + '.';
	}
	lp(h)
		lop(w, j) {
			if (s[i + 1][j + 1] == '.') {
				int cnt = 0;
				lop(3, k)
					lop(3, l)if (s[i + k][j + l] == '#')cnt++;
				s[i + 1][j + 1] = char('0'+cnt);
			}
	}
//	lp(h + 2)cout << s[i] << endl;
	lp(h) {
		cout << s[i + 1].substr(1, w) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, start, stop) for (int i = start; i < stop; i++)
#define FORR(i, start, stop) for (int i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<int>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<int>());
#define REMOVE(v,n) remove(vector<int> v,v+v.size(),int n)
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<int> vint;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }

//vector< vector<int> > v (size1, vector<int>(size2) );

ll N,A,B,C;

vector<int> l(10);

int func(int i,int a,int b,int c){
    if(i==N){
        //cout<<a<<' '<<b<<' '<<c<<endl;
        if(a==0 || b==0 || c==0) return INF;
        else return abs(A-a)+abs(B-b)+abs(C-c);
    }
    
    //retをfunc外で宣言するとWA
    int ret = func(i+1, a, b, c);

    ret=min(ret,func(i+1,a+l[i],b,c)+(a ? 10 : 0));
    ret=min(ret,func(i+1,a,b+l[i],c)+(b ? 10 : 0));
    ret=min(ret,func(i+1,a,b,c+l[i])+(c ? 10 : 0));
    
    return ret;

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N>>A>>B>>C;
    
    FOR(i,0,N){
        cin>>l[i];
    }

    cout<<func(0,0,0,0)<<endl;
    
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
 static int[][] gyo2=new int[1000000][9];
 static int count=0;
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		boolean used[]=new boolean[N];
		int[] gyo=new int[N];
		rekyo(gyo, N, 0, used);
		int P[]=new int[N];
		int Q[]=new int[N];
		for(int i=0;i<N;i++) {
			P[i]=sc.nextInt();
		}
		for(int i=0;i<N;i++) {
			Q[i]=sc.nextInt();
		}
		int p=0,q=0;
		boolean flag=false;
		for(int i=0;i<count;i++) {
			for(int j=0;j<N;j++) {
				if(P[j]!=gyo2[i][j]) {
					break;
				}
				if(j==N-1) {
					p=i;
					flag=true;
					break;
				}
			}
			if(flag)
				break;
		}
		 flag=false;
		for(int i=0;i<count;i++) {
			for(int j=0;j<N;j++) {
				if(Q[j]!=gyo2[i][j]) {
					break;
				}
				if(j==N-1) {
					q=i;
					flag=true;
					break;
				}
			}
			if(flag)
				break;
		}
		System.out.println(Math.abs(p-q));

		}

	public static void rekyo(int gyo[],int n,int kosu,boolean used[]) {
		if(kosu<n) {
			for(int i=1;i<=n;i++) {
				if(!used[i-1]) {
					gyo[kosu]=i;
					used[i-1]=true;
					rekyo(gyo,n,kosu+1,used);
					used[i-1]=false;
				}
			}
		}else {
			for(int i=0;i<n;i++) {
				gyo2[count][i]=gyo[i];
			}
			count++;
			return;

		}}

	}





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

long countXOR(long N){
  long ans;
  if(N%2==0){
    long d=N/2;
    if(d%2==0) ans=N;
    else ans=N+1;
  }
  else{
    long d=(N+1)/2;
    if(d%2==0) ans=0;
    else ans=1;
  }
  return ans;
}
    

int main(){
  long A,B;cin>>A>>B;
  long X,Y;
  if(A==0) X=0;
  else X=countXOR(A-1);
  Y=countXOR(B);
  cout<<(X^Y)<<endl;
}


Measured memory_bytes: 3628
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a = list(reversed(sorted(a)))
b = list(reversed(sorted(b)))
c = list(reversed(sorted(c)))

abc = []
for p in range(x):
    for q in range(y):
        if (p+1) * (q+1) > k:
            break
        for r in range(z):
            if (p+1) * (q+1) * (r+1) > k:
                break
            abc.append(a[p]+ b[q] + c[r])

abc = list(reversed(sorted(abc)))

for i in range(k):
    print(abc[i])


Measured memory_bytes: 10000
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

int main(int argc, char *argv[]){
    int N;
    std::cin >> N;

    std::vector<int> X(N);
    
    int V;
    for(auto &x : X){
        std::cin >> V;
        x = V;
    }
    
    int C;
    for(auto &x : X){
        std::cin >> C;
        x -= C;
    }

    std::sort(X.begin(),X.end(),std::greater<int>());

    auto bound = std::lower_bound(X.begin(),X.end(),0,std::greater<int>());
    int value = 0;
    for(auto iter = X.begin(); iter < bound; ++iter){
        value += *iter;
    }

    std::cout << value << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>

using namespace std;

int main() {
	string a;
	getline(cin,a);
	for (int i = 0; i < a.size(); i++) {
		if (islower(a[i])) {
			cout << (char)toupper(a[i]) << flush;
		} else if (isupper(a[i])){
			cout << (char)tolower(a[i]) << flush;
		} else {
			cout << a[i] << flush;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include<math.h>
#include <iomanip>
using namespace std;
int main() {
	int n;
	cin >> n;

	for (int i = 0;i < n;i++) {
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		double px, py, r;
		 double A1, B1, C1, A2, B2, C2;
		A1 = 2 * (x2 - x1);
		B1 = 2 * (y2 - y1);
		C1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
		A2 = 2 * (x3 - x1);
		B2 = 2 * (y3 - y1);
		C2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;

		px = (B1*C2 - B2*C1) / (A1*B2 - A2*B1);
		py = (C1*A2 - C2*A1) / (A1*B2 - A2*B1);

		r = sqrt((x1 - px)*(x1 - px) + (y1 - py)*(y1 - py));

		cout << fixed << setprecision(3) << px << " ";
		cout << fixed << setprecision(3) << py << " ";
		cout << fixed << setprecision(3) << r << endl;
	}
	return 0;

}

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

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define endl "\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

ll const inf = 1e18;
ll const maxn = 1e6+5;
ll const mod = 1e9+7;

// code begins here

int main(){
    fast;

    ll n,k;
    cin>>n>>k;
    
    vector<ll> arr(n);
    for(auto &u: arr)
        cin>>u;
    
    for(ll j=0;j<min(k,100LL);j++){
        vector<ll> prefix(n+1, 0);
        
        for(ll i=0;i<n;i++){
            ll x = (i - arr[i] + 0.4);
            ll y = (i + arr[i] + 0.5);
            prefix[max(0LL,x)]++;
            prefix[min(y+1,n)]--;
        }
        
        for(ll i=1;i<n;i++)
            prefix[i] += prefix[i-1];
            
        for(ll i=0;i<n;i++)
            arr[i] = prefix[i];
    }
    
    for(ll i=0;i<n;i++)
        cout<<arr[i]<<" ";
    cout<<endl;
    
    return 0;
}


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

int main(){
	int n;
  cin >> n;
  vector<P> v;
  int a;
 for(int i=1;i<n+1;i++){
    cin >>a;
  	v.push_back(make_pair(a,i));
  }
  sort(v.begin(),v.end());
  rep(i,n){
  cout << v[i].second;
    cout<< " ";
    
  }
  //vector<int> v2;
 // rep(i,n){
  //	v2.push_back(i+1);
 // }
 // rep(i,n){
  //  rep(j,n){
    //	if()
   // }
 // }
}

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

ll solve() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll sum = 0;
    for (int i = 2; i < n; i++) {
        sum ^= a[i];
    }
    if (a[0]+a[1] < sum) return -1;
    ll D = (a[0]+a[1] - sum)/2; // A&B
    if (a[0] < D) return -1;
    ll A = D;
    for (int k = 60; k >= 0; k--) {
        if (((A|bit(k)) <= a[0]) && (bit(k)&sum)) {
            A = A | bit(k);
        }
    }
    if (A == 0) return -1;
    ll B = (a[0]-A+a[1]);
    if ((A&B) != D) return -1;
    return a[0]-A;
}

int main(void){
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 3636
import sys
input = sys.stdin.readline
import numpy as np
import math
def print_ans(ar):
    """Test Case
    >>> print_ans(['29', '20', '7', '35','120'])
    215
    >>> print_ans(['101', '86', '119','108', '57'])
    481
    >>> print_ans(['123', '123', '123','123','123'])
    643
    """
    tmp_list = np.array([int(a[-1]) for a in ar])
    tmp_list[tmp_list == 0] = 10
    min_arg = tmp_list.argmin()
    ans = 0
    for i, a in enumerate(ar):
        if i != min_arg:
            tmp = math.ceil(int(a) / 10) * 10
        else:
            tmp = int(a)
        ans += tmp
    print(ans)


    

if __name__ == '__main__':
    ar = [input().rstrip() for _ in range(5)]
    print_ans(ar)


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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using pint = pair<int, int>; 
using pll  = pair<ll, ll>;
using vint = vector<int>; 
using vll  = vector<ll>;
using vstr = vector<string>;

//　定数, 変数 *********************************************
const ll MOD=1e9+7;
const ll INF=1ll<<60;

int S; // 1<=S<=2000
ll dp[2001];

// *********************************************************
ll solve(){

}

int main(){

    cin >> S;

    dp[0]=1;

    for(int i=1;i<S+1;++i){
        if(i<3){
            dp[i]=0;
        }else{
            dp[i]=(dp[i-1]+dp[i-3])%MOD;
        }
    }

    cout << dp[S]<<endl;



    return 0;
}

Measured memory_bytes: 3604
/*  Bichrome Cells  
    unomi    */

#include <stdio.h>
int main(void){
    int N=0, A=0;
    //Nを入力
    scanf("%d",&N);
    //Aを入力
    scanf("%d",&A);
    //N*N-Aを出力
    printf("%d\n",N*N-A);

    return 0;
}


Measured memory_bytes: 128
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sn = new Scanner(System.in);
		String[] abc= sn.nextLine().split(" ");

		sn.close();
		BigDecimal a = sqrt(new BigDecimal(Integer.valueOf(abc[0])), 50);
		BigDecimal b = sqrt(new BigDecimal(Integer.valueOf(abc[1])), 50);
		BigDecimal c = sqrt(new BigDecimal(Integer.valueOf(abc[2])), 50);

		int result = c.compareTo(a.add(b));
		if(result > 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

    public static BigDecimal sqrt(BigDecimal a, int scale){
        //とりあえずdoubleのsqrtを求める
        BigDecimal x = new BigDecimal(
                Math.sqrt(a.doubleValue()), MathContext.DECIMAL64);
        if(scale < 17) return x;

        BigDecimal b2 = new BigDecimal(2);
        for(int tempScale = 16; tempScale < scale; tempScale *= 2){
            //x = x - (x * x - a) / (2 * x);
            x = x.subtract(
                    x.multiply(x).subtract(a).divide(
                    x.multiply(b2), scale, BigDecimal.ROUND_HALF_EVEN));
        }
        return x;
    }
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  string s ;
  cin >> s ;
  rep(i,3){
    cout << s.at(i) ;
  }

}


Measured memory_bytes: 3628
/*** akshaykumar99 ***/
 
#include<bits/stdc++.h> 
using namespace std;
 
const long long MOD = 1e9+7;
const long double PI = acos(-1);
const long long N = 2e5+1;
 
typedef long long ll;
typedef long double ld;
ll pts[200005][6]={0};

ll mnht(ll pt[200005][6], int kth, int idx, int d)
{
    ll dist=0;

    for(int i=0;i<d;i++)
    {
        dist+=abs(pt[kth][i]-pt[idx][i]);
    }

    return dist;
}
   /*
   10
   -70 -64 -6 -56 64 61 -57 16 48 -98
   */
ll max_cmb(ll cmbn[6], ll pt[200005][6], int n, int d)
{
    ll pk=0;ll idx=0;

   for(int i=0;i<n;i++)
   {
       ll val=0;

       for(int j=0;j<d;j++)
       {
           val+=(1-2*cmbn[j])*pt[i][j];
       }

       if(val>pk)
       {
           pk=val;
           idx=i;
       }
   }

   return idx;
}
void test_case()
{
	int n, d;
   cin >> n;
   d = 2;

   for(int i=0;i<n;i++)
   {
       for(int j=0;j<d;j++)
        cin>>pts[i][j];
   }

   ll pk[2<<d];

   for(int j=0;j< 1<<(d);j++)
   {
       ll cmbn[6]={0};
       for(int dig=0;dig< d; dig++)
       {
           if(j & 1<<dig)
             cmbn[dig]=1;
          // cout<<cmbn[dig]<<" ";
       }
//cout<<endl;
       pk[j]=max_cmb(cmbn, pts, n, d);
   }

   ll maxd=0;
   for(int i=0;i<n;i++)
   {
       for(int j=0;j< 1<<(d);j++)
       maxd=max(maxd, mnht(pts, i, pk[j], d));
   }

   cout<<maxd<<endl;
	
}
 
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}


Measured memory_bytes: 12904
s = input()
t = input()
ls = []
for i in range(len(s) - len(t) + 1):
    ls.append(s[i:i+len(t)])
now = 0
minimum = len(t)
for i in range(len(ls)):
    now = 0
    for j in range(len(t)):
        if t[j] == ls[i][j]:
            now += 1
    if len(t) - now < minimum:
        minimum = len(t) - now
print(minimum)

Measured memory_bytes: 9136
#include<bits/stdc++.h>
using namespace std;
#define crap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main(){
    crap;
  	int n;
  	cin >> n;
  	int arr[n][3];
  	for(int i = 0;  i < n;  i++)
  	    cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
  	int dp[3];
  	dp[0] = arr[0][0];
  	dp[1] = arr[0][1];
    dp[2] = arr[0][2];
  	for(int i = 1;  i < n;  i++){
  	    int new_dp[3];
  	    new_dp[0] = arr[i][0] + max(dp[1], dp[2]);
  	    new_dp[1] = arr[i][1] + max(dp[0], dp[2]);
  	    new_dp[2] = arr[i][2] + max(dp[1], dp[0]);
  	    dp[0] = new_dp[0];
  	    dp[1] = new_dp[1];
  	    dp[2] = new_dp[2];
  	}
  	
  	cout << max(dp[2], max(dp[0], dp[1])) << endl;
	return 0;
}

Measured memory_bytes: 4828
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
ll f(ll n) {
  ll u = 0;
  while (n > 0) {
    u += n % 10;
    n /= 10;
  }
  return u;
}
int main(){
    ll k,s=1,a=1;
    cin>>k;
    for (ll i = 1; i <= k; i++)
    {
        cout<<s<<endl;
        if((db)s/f(s)<(db)(s+a)/f(s+a) && (db)(s+a)/f(s+a) > (db)(s+2*a)/f(s+2*a))a*=10;
        s+=a;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int maxmin(int a[],int left,int right, int &max,int &min)
{
  int max1,min1,mid;

  if(left==right)
  max=min=a[left];

  else if(left==right-1)
  {
    if(a[left]>a[right])
    {
      max=a[left];
      min=a[right];
    }
    else
    {
      max=a[right];
      min=a[left];
    }
  }
    else
    {
      mid=(left+right)/2;
      maxmin(a,left,mid,max,min);
      maxmin(a,mid+1,right,max1,min1);

      if(max1>max)
       max=max1;
      if(min1<min)
       min=min1;
    }

  return 0;
}
main()
{

    int n;
    cin>>n;
    int arr[n];
    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        arr[i]=x;
    }
    int max;
    int min;
    maxmin(arr,0,n-1,max,min);
    //cout<<max<<' '<<min<<endl;
    cout<<max-min<<endl;;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

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

string s;
int d[105000];

int main()
{
	cin >> s;
	int len = s.length();
	int mn = len;
	for (int i = 1; i < len; i++) {
		if (s[i] != s[i - 1])mn = min(mn, max(i, len - i));
	}
	
	cout << mn << endl;



	return 0;
}


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


int main() {
	int N, M;
	cin >> N >> M;
	int ans = 1;
	for (int i = 1;i * i <= M;++ i) if (M % i == 0) ans = max(max(i <= M / N ? i : 1, i >= N ? M / i : 1), ans);
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、答えはM/N以下になる
答えを仮にxとする
この時、全てのa_iはxの倍数となるので、Mがxで割り切れるならそれが答えとなる
要するに、M/N以下で最大のMの因数を出力すれば良い
*/

Measured memory_bytes: 256
n, q = map(int, input().split())
s = "#" + input() + "#"
TD = [input().split() for _ in range(q)]

def test(x):
  for t, d in TD:
    if s[x] == t:
      if d == "L":
        x -= 1
      else:
        x += 1
  return x

def bisrch(ng, ok, C):
  while abs(ng-ok) > 1:
    mid = (ng+ok)//2
    if test(mid) == C:
      ok = mid
    else:
      ng = mid
  return ok

l = bisrch(n+1, 0, 0)
r = bisrch(0, n+1, n+1)
ans = r-l-1
print(ans)

Measured memory_bytes: 42644
unittest
{
	assert( [ "2 3 3", "2 2", "1 1", "1 3" ].solve == 3 );
	assert( [ "3 3 4", "3 3", "3 1", "1 1", "1 2" ].solve == 3 );
	assert( [ "5 5 10", "2 5", "4 3", "2 3", "5 5", "2 2", "5 4", "5 3", "5 1", "3 5", "1 4" ].solve == 6 );
}



import std.algorithm;
import std.container;
import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto h = 0L;
	auto w = 0L;
	auto m = 0L;
	input.front.formattedRead!"%s %s %s"( h, w, m );
	auto hws = new long[ 2 ][ m ];
	foreach( ref hw; hws )
	{
		input.popFront;
		hw = input.front.split.to!( long[] );
		hw[] -= 1;
	}
	
	auto pss = new long[][ h ];
	auto yts = new long[ w ];
	auto xts = new long[ h ];
	foreach( hw; hws )
	{
		pss[ hw[ 0 ] ] ~= hw[ 1 ];
		yts[ hw[ 1 ] ]++;
		xts[ hw[ 0 ] ]++;
	}
	
	auto ans = 0L;
	auto rbt = redBlackTree!( true, long )( yts );
	foreach( y, xt, ps; lockstep( xts, pss ) )
	{
		foreach( p; ps )
		{
			rbt.removeKey( yts[ p ] );
			rbt.insert( yts[ p ] - 1 );
		}
		ans = max( ans, xt + rbt.back );
		foreach( p; ps )
		{
			rbt.removeKey( yts[ p ] - 1 );
			rbt.insert( yts[ p ] );
		}
	}
	return ans;
}


Measured memory_bytes: 61800