akhauriyash/Code-Regression huggingface dataset:
//  RAKSHIT KADAM
//ALWAYS USE &IT FOR ITERATING USING AUTO ...
//USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN THE RESPECTIVE DATA STRUCTURE
//NOTE THAT MEMSET CANT FILL THE DOUBLE VALUES;
//ACCUMULATE DOES NOT WORK PROPERLY IF VALUES START SUMMING BEYOND 1E9...
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!
 
// NUMERIC DEFINITIONS :
    #define INF 1000000000000000005
    #define inf 1000000037
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
                         #define ll long long
                         #define int long long
//  #define ll int
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
// #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
 
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn =500003;


void solve()
{
    char a;cin>>a;
    if(a>='A' && a<='Z')
    {
        cout<<'A';return;
    }
    cout<<'a';
}
 
signed main()
{
   Need_for_speed(activated);
    
   
//satisfy
//    {
//  solve();
//   }
    solve();
    
    return 0;
}
 


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <stdio.h>
#define llint long long

using namespace std;

llint n, mod;

struct SegTree{
	int size;
	vector<llint> seg;
	
	SegTree(){}
	SegTree(int size){
		this->size = size;
		seg.resize(1<<(size+1));
	}
	
	void init()
	{
		for(int i = 0; i < (1<<(size+1)); i++) seg[i] = 0;
	}
	
	void update(int i, llint val)
	{
		i += (1 << size);
		seg[i] = val;
		while(i > 1){
			i /= 2;
			seg[i] = (seg[i*2] * seg[i*2+1]) % mod;
		}
	}

	llint query(int a, int b, int k, int l, int r)
	{
		if(b < l || r < a) return 1;
		if(a <= l && r <= b) return seg[k];
		llint lval = query(a, b, k*2, l, (l+r)/2);
		llint rval = query(a, b, k*2+1, (l+r)/2+1, r);
		return (lval * rval) % mod;
	}
	llint query(int a, int b)
	{
		if(a > b) return 1;
		return query(a, b, 1, 0, (1<<size)-1);
	}
};


vector<int> G[100005];
int edge[100005][2];
llint dp[100005][2];
SegTree seg(17);

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

int getid(int i, int u)
{
	if(edge[i][0] == u) return 0;
	else return 1;
}

void dfs(llint e, llint id)
{
	llint v = edge[e][id];
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == e) continue;
		dfs(G[v][i], 1-getid(G[v][i], v));
	}
	llint ret = 1;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == e) continue;
		ret *= dp[G[v][i]][1-getid(G[v][i], v)]+1, ret %= mod;
	}
	dp[e][id] = ret;
}


void dfs2(llint e, llint id)
{
	llint v = edge[e][id];
	
	for(int i = 0; i < G[v].size(); i++){
		seg.update(i, dp[G[v][i]][1-getid(G[v][i], v)]+1);
	}
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == e) continue;
		llint tmp = seg.query(0, i-1) * seg.query(i+1, (int)G[v].size()-1) % mod;
		dp[G[v][i]][getid(G[v][i], v)] = tmp;
	}
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == e) continue;
		dfs2(G[v][i], 1-getid(G[v][i], v));
	}
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> mod;
	llint u, v;
	for(int i = 0; i < n-1; i++){
		cin >> u >> v;
		edge[i][0] = u, edge[i][1] = v;
		G[u].push_back(i);
		G[v].push_back(i);
	}
	edge[n-1][0] = 1;
	
	dfs(n-1, 0);
	dfs2(n-1, 0);
	
	for(int i = 1; i <= n; i++){
		llint ans = 1;
		for(int j = 0; j < G[i].size(); j++){
			ans *= dp[G[i][j]][1-getid(G[i][j], i)]+1, ans %= mod;
		}
		cout << ans << "\n";
	}
	flush(cout);
	return 0;
}

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

/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compiles and gets accepted.
 *  ___  __     _______    _______      
 * |\  \|\  \  |\  ___ \  |\  ___ \     
 * \ \  \/  /|_\ \   __/| \ \   __/|    
 *  \ \   ___  \\ \  \_|/__\ \  \_|/__  
 *   \ \  \\ \  \\ \  \_|\ \\ \  \_|\ \ 
 *    \ \__\\ \__\\ \_______\\ \_______\
 *     \|__| \|__| \|_______| \|_______|
 */
const long long mod = 1000000007;

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

	int N;
	long long A,B,C,D;
	cin>>N>>A>>B>>C>>D;
	long long diff = abs(A-B);
	if(diff >= (N-1ll) * C && diff <= (N-1ll) * D) {
		cout<<"YES\n";
		return 0;
	}
	for(int i = 1;i < N;i++) {
		long long aMin = A + i * C,aMax = A + i * D;
		long long bMin = B + (N-i-1) * C,bMax = B + (N-i-1) * D;
		if(aMin <= bMax && bMin <= aMax) {
			cout<<"YES\n";
			return 0;
		}
	}
	for(int i = 1;i < N;i++) {
		long long aMin = A - i * C,aMax = A - i * D;
		long long bMin = B - (N-i-1) * C,bMax = B - (N-i-1) * D;
		if(aMin >= bMax && bMin >= aMax) {
			cout<<"YES\n";
			return 0;
		}
	}
	cout<<"NO\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define pa pair<int,int>
#define mod 998244353
#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define cl(x) memset(x,0,sizeof x)
#ifdef Devil_Gary
#define bug(x) cout<<(#x)<<" "<<(x)<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define bug(x)
#define debug(...)
#endif

const int INF = 0x7fffffff;
const int N=1e5+5;
/*
char *TT,*mo,but[(1<<15)+2];
#define getchar() ((TT==mo&&(mo=(TT=but)+fread(but,1,1<<15,stdin),TT==mo))?-1:*TT++)//*/
inline ll read(){
    ll x=0,rev=0,ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')rev=1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
    return rev?-x:x;
}/*
struct Edge{
	int nxt,v;
//	int w;
//	int id;
}e[N<<1];
void add(int u,int v){
	e[++tot].v=v,e[tot].nxt=head[u],head[u]=tot;
	e[++tot].v=u,e[tot].nxt=head[v],head[v]=tot;
}*/

int main(){
#ifdef Devil_Gary
    freopen("in.txt","r",stdin);
//  freopen("out.txt","w",stdout);
#endif
	ll flg=0,x=read(),a=0,cnt=1;
	for(;cnt<=1e7;++cnt){
		(a=a*10+7)%=x;
		if(a==0){
			flg=1;
			break;
		}
	}
	if(flg) cout<<cnt<<endl;
	else cout<<-1<<endl;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){fastio
    ll a,b,c,k;cin>>a>>b>>c>>k;
    if(k<a){
        cout<<k<<endl;
    }else if(a<=k && k<=a+b){
        cout<<a<<endl;
    }else{
        cout<<a-(k-(a+b))<<endl;
    }
    
    return 0;
}




Measured memory_bytes: 3616
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    if((a == 3 && b == 2) || (a == 2 && b == 3)){
        PUTS(1);
    }
    if((a == 1 && b == 3) || (a == 3 && b == 1)){
        PUTS(2);
    }
    if((a == 1 && b == 2) || (a == 2 && b == 1)){
        PUTS(3);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
    LL n;
    while(~scanf("%lld", &n)){
        for(LL a=1;a<=3500;a++){
            for(LL b=1;b<=3500;b++){
                LL c, x;
                if(((4*a*b-n*a-n*b)!=0)&&((a*b*n)%(4*a*b-n*a-n*b)==0)){
                    c=(a*b*n)/(4*a*b-n*a-n*b);
                }
                else continue;
                if((a*b*c)%n==0)x=a*b*c/n;
                if(c<=0)continue;
                printf("%lld %lld %lld\n", a, b, c);
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
n = int(input())

results = [[0] * n for i in range(n)]

for i in range(n):
    arr = list(map(int, input().split()))
    for j in range(arr[1]):
        results[i][arr[j+2]-1] = 1

for ret in results:
    for i in range(len(ret)):
        if i == len(ret)-1:
            print(ret[i], end='')
        else:
            print(ret[i], '', end='')
    print('')



Measured memory_bytes: 7096
S_a = list(input())
S_b = list(input())
S_c = list(input())

def a_turn(a, b, c):
    if len(a) == 0:
        print("A")
    elif a[0] == "a":
        a.pop(0)
        a_turn(a, b, c)
    elif a[0] == "b":
        a.pop(0)
        b_turn(a, b, c)
    elif a[0] == "c":
        a.pop(0)
        c_turn(a, b, c)

def b_turn(a, b, c):
    if len(b) == 0:
        print("B")
    elif b[0] == "a":
        b.pop(0)
        a_turn(a, b, c)
    elif b[0] == "b":
        b.pop(0)
        b_turn(a, b, c)
    elif b[0] == "c":
        b.pop(0)
        c_turn(a, b, c)

def c_turn(a, b, c):
    if len(c) == 0:
        print("C")
    elif c[0] == "a":
        c.pop(0)
        a_turn(a, b, c)
    elif c[0] == "b":
        c.pop(0)
        b_turn(a, b, c)
    elif c[0] == "c":
        c.pop(0)
        c_turn(a, b, c)

a_turn(S_a, S_b, S_c)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


ll dp[111][101010];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);

    REP(i,N) cin >> w[i] >> v[i];
    REP(i,111) REP(j,101010) dp[i][j] = LINF;
    dp[0][0] = 0;
    for(int i=0;i<N;i++){
        for(int j=0;j<101010;j++){
            if(j - v[i] >= 0) chmin(dp[i+1][j], dp[i][j-v[i]] + w[i]);
            chmin(dp[i+1][j], dp[i][j]);
        }
    }
    ll ans = 0;
    REP(i,101010) if(dp[N][i] <= W) ans = i;
    cout << ans << endl;
}

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

using namespace std;

int dp[5001][5001];

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

    int n;
    string s;

    cin >> n >> s;

    int ans = 0;

    for(int i = n - 1; i>= 0; i--)
    {
        for(int j = n-1; j > i; j--)
        {
            if(s[i] == s[j])
                dp[i][j] = min(j-i, dp[i+1][j+1] + 1);
            else dp[i][j] = 0;

            ans = max(ans,dp[i][j]);
        }
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 96768
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

long double dp[110][100100];

int main(void){
    char b;
    cin >> b;

    if(b == 'A'){
        cout << 'T' << endl;
    } else if(b == 'T'){
        cout << 'A' << endl;
    } else if(b == 'C'){
        cout << 'G' << endl;
    } else {
        cout << 'C' << endl;
    }
}



Measured memory_bytes: 256
#include<stdio.h>

const int MAX=2*100000+5;

int main(){
	int a[MAX],b[MAX],n,forth,back,flag=1;
	
	scanf("%d",&n);
	
	if(n%2==0){
		back=n/2;
		forth=back-1;
		
		for(int i=0;i<n;i++){
			scanf("%d",&a[i]);
			if(flag%2)
				b[back++]=a[i];
			else
				b[forth--]=a[i];
			flag++;
		}
	}
	else{
		forth=n/2;
		back=forth+1;
		
		for(int i=0;i<n;i++){
			scanf("%d",&a[i]);
			if(flag%2)
				b[forth--]=a[i];
			else
				b[back++]=a[i];
			flag++;
		}
	}
	
	for(int i=0;i<n;i++){
		if(i==n-1)
			printf("%d",b[i]);
		else
			printf("%d ",b[i]);
	}
		
		
	return 0;
} 

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

#define int long long
//typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif



signed main() {
    int N;
    cin >> N;
    int F[100][10]={0}, P[100][11]={0};
    rep(i,N)rep(j,10) cin >> F[i][j];
    rep(i,N)rep(j,11) cin >> P[i][j];
    
    int ans = -INF;
    rep(k,1LL<<10){
        if(k==0) continue;
        
        int val=0;
        rep(i,N){
            int cnt=0;
            rep(bit,10){
                if((k&(1LL<<bit))>0 && F[i][bit]>0 ) cnt++;
            }
            val += P[i][cnt];
        }
//        if(val > ans){
 //           cerr << bitset<10>(k) << "," << val << endl;
  //      }
        
        ans = max(ans, val);
    }
    cout << ans << endl;
    

}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, age;
    while (cin >> n, n) {
        int num[7] = {};
        for (int i=0; i<n; ++i) {
            cin >> age;
            if (age < 10) {
                ++ num[0];
            } else if (age < 20) {
                ++ num[1];
            } else if (age < 30) {
                ++ num[2];
            } else if (age < 40) {
                ++ num[3];
            } else if (age < 50) {
                ++ num[4];
            } else if (age < 60) {
                ++ num[5];
            } else {
                ++ num[6];
            }
        }
        for (int i=0; i<7; ++i) {
            cout << num[i] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h> 
#include <string.h> 
#include <iostream> 
using namespace std; 
int isPalindrome(string str) 
{ 

    int l = 0; 
    int h = str.size() - 1; 
 
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        { 
           
            return 0; 
        } 
    } 
    return 1;
} 
int main() 
{ 
    string a;cin>>a;
 int n=a.length();
  string s=a.substr(0,(n-1)/2);
  string s1=a.substr((n+1)/2,(n-1)/2);
  if((isPalindrome(s)&&isPalindrome(s1))&&(isPalindrome(a))){
  cout<<"Yes";}
  else cout<<"No";
    return 0; 
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int l, r, d;
    cin >> l >> r >> d;
    int ans = r/d - (l-1)/d;
    cout << ans << endl;
}



Measured memory_bytes: 3616
n = int(input())
l = [0] + [int(input()) for i in range(n)]
cnt = 0
a = 1
while a != 2:
    if a==0:
        print(-1)
        break
    tmp=l[a]
    l[a]=0
    a=tmp
    cnt += 1
else:
    print(cnt)


Measured memory_bytes: 7852
import java.util.*;
import java.io.*;

public class Main {
	static class Node {
		int id = 0;
		Node left = NIL;
		Node right = NIL;
	}
	static Node NIL = new Node();
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		
		Node[] tree = new Node[n + 1];
		tree[0] = NIL;
		NIL.id = 0;
		for (int i = 1; i < n + 1; i ++) {
			tree[i] = new Node();
		}
		int[] preorder = new int[n];
		int[] inorder = new int[n];
		int[] postorder = new int[n];
		
		for (int i = 0; i < n; i ++) {
			preorder[i] = scanner.nextInt();
		}
		for (int i = 0; i < n; i ++) {
			inorder[i] = scanner.nextInt();
		}
		
		scanner.close();
		
		reci = 0;
		reconstruct(preorder, inorder, 0, n - 1, tree);
		
		postorder(tree[preorder[0]], postorder, 0);
		for (int i = 0; i < n - 1; i ++) {
			System.out.print(postorder[i]);
			System.out.print(" ");
		}
		System.out.println(postorder[n - 1]);
	}
	
	static int reci;
	static Node reconstruct(int[] preorder, int[] inorder, int left, int right, Node[] tree) {
		if (left > right) return NIL;
		Node root = tree[preorder[reci]];
		root.id = preorder[reci];
		
		int mid;
		for (mid = left; tree[inorder[mid]] != root; mid ++);
		reci ++;
		
		root.left = reconstruct(preorder, inorder, left, mid - 1, tree);
		root.right = reconstruct(preorder, inorder, mid + 1, right, tree);
		
		return root;
	}
	
	static int postorder(Node u, int[] postorder, int posti) {
		if (u == NIL) return posti;
		
		posti = postorder(u.left, postorder, posti);
		posti = postorder(u.right, postorder, posti);
		postorder[posti] = u.id;
		
		return posti + 1;
	}
} 



Measured memory_bytes: 26516
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

const ll mod = 998244353;

int a, b, c, d;
ll dp[3010][3010];

signed main() {
	cin >> a >> b >> c >> d;
	dp[a][b] = 1;
	for (int i = a; i <= c; i++)for (int j = b; j <= d; j++) {
		if (i == a && j == b)continue;
		dp[i][j] = (dp[i - 1][j] * j + dp[i][j - 1] * i - dp[i - 1][j - 1] * (i - 1)*(j - 1) % mod + mod) % mod;
	}
	cout << dp[c][d] << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;

#define PrintLn(X) cout << X << endl
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)

ull comb(int n, int r)
{
	ull ret = 1;
	int x[50];
	Rep(i, r){
		x[i] = i + 1;
	}
	for(int i = n; i > (n - r); i--){
		ret *= i;
		Rep(j, r){
			if(x[j] && ret % x[j] == 0){
				ret /= x[j];
				x[j] = 0;
			}
		}
	}
	return ret;
}

int main(void)
{
	int N, P;
	cin >> N >> P;

	int odd = 0;
	int even = 0;
	Rep(i, N){
		int a;
		cin >> a;
		if(a % 2){
			odd++;
		}else{
			even++;
		}
	}

	ull ans = 1;
	Rep(i, even) ans *= 2;

	ull ans2 = 0;
	for(int i = 0; i <= odd; i++){
		if((i % 2) == P){
			ans2 += comb(odd, i);
		}
	}

	printf("%llu\n", (ull)ans * ans2);
	return 0;
}


Measured memory_bytes: 256
'''
Search - Allocation
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_D

Algorythm
Referenced #1670532 Solution for ALDS1_4_D: Allocation by Chris_Kobayashi

1. Decide the searching point -> (top of the range + bottom of the range) / 2
2. Check whether it is possible to load all of the luggage to the trugs
    in the weight limit of the searching point
3. If it is possible, then move the top to the searching point
   If it is impossible, then move the bottom to the searching point + 1
4. Continue 1~4 as long as the top is greater than bottom

Range
Serching the maximum loading capacity(MLC) number
 between the maximam weight item num and the total weight num

top: total weight num
.
.
. <- search the num point
.
.
bottom: maximam weight item num

Why?
A1. Why not "bot = sp" but "bot = sp + 1"?
Q1. for example
    top = 5
    bot = 3
    sp = (5 + 3) / 2 = 4
    ...
    bot = sp
    sp = (5 + 4) / 2 = 4
    ...
    bot = sp
    ...for inf

A2. Why the top is total weight and bot is max weight?
Q2. Sure it is ok "top = 99999999, bot = 0".
     But, MLC never pass the total weight
      and the limit never be lower than the max.
       So, it is the most effective range.
'''

# input
n, k = map(int,raw_input().split())
w = []
for i in xrange(n):
    w.append(input())

# initial searching range
top = sum(w) # the top of the searching range
bot = max(w) # the bottom of the searching range

# searching until there is no serching range
while top > bot:
    sp = (top + bot) / 2 # the searching point

    tk = 0 # temp index of the trugs
    weight = 0 # temp total weight of a trug

    # check whether it is possible to load all of the luggage
    #  to the trugs in the weight limit of the searching point
    for tw in w:
        if weight + tw <= sp:
            weight += tw
        else:
            tk += 1
            if tk >= k:
                # when impossible, then raise the bottom
                bot = sp + 1
                break
            weight = tw
    else:
        # when possible, then lowering the top
        top = sp

# output MLC
print top

Measured memory_bytes: 9464
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int N=sc.nextInt();
		int sum=0;
		
		for(int i=1;i<=N;i++){
			sum+=i;
		}
		
		sc.close();
		
		System.out.print(sum);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    for (int i=0; i<3; i++) {
        string s;
        cin >> s;
        cout << s[0];
    }
    cout << endl;
}

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

int main()
{
	int n,i,j,k;
	cin>>n>>k;
	int h[n+1];
	for(i=1;i<=n;i++)
	cin>>h[i];
	int dp[n+1];
	dp[1]=0;
	for(i=2;i<=n;i++)
	{
		dp[i]=INT_MAX;
		for(j=1;j<=k && i-j>0 ;j++)
	     dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
    }
	cout<<dp[n];
}






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

int main(){
	int num;
	double t,s;
	while(scanf("%d,%lf,%lf",&num,&t,&s)!=EOF){
		double ans = t / (s * s);
		if(ans >= 25.0){
			cout << num << endl;
		}
	}
}

Measured memory_bytes: 1236
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int x,y,z;
  cin >> x >> y >> z;
  
  cout << z << " " << x << " " << y << endl;
  
  return 0;
}


Measured memory_bytes: 256
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    sys.setrecursionlimit(10**5)
    n = I()
    s = S()
    global cnt
    cnt = 0
    def tansaku(st,depth):
        global cnt
        for i in range(10):
            index = st.find(str(i))
            if index != -1:
                if depth == 0:
                    cnt += 1
                    # print(i)
                # print(st,i,index,depth)
                else:
                    tansaku(st[index+1:],depth-1)
    tansaku(s,2)

    print(cnt)

main()

Measured memory_bytes: 75012
h, w = map(int, input().split())
grid = [list(input()) for _ in range(h)]

rows = [0] * h
for i in range(h):
    for j in range(w):
        rows[i] |= (grid[i][j] == '#')

cols = [0] * w
for j in range(w):
    for i in range(h):
        cols[j] |= (grid[i][j] == '#')

for i in range(h):
    if not rows[i]:
        continue
    for j in range(w):
        if not cols[j]:
            continue
        print(grid[i][j], end='')
    print()

Measured memory_bytes: 4596
#include<bits/stdc++.h>
using namespace std;
int main(){
  int X,Y;
  cin>>X>>Y;
  if(Y%2!=0){
    cout<<"No"<<endl;
    return 0;
  }
  if(2*X<=Y && Y<=4*X){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;

int main(){
    string weather;
    cin >> weather;
    if (weather == "Sunny"){
        cout << "Cloudy";
    }
    else if (weather== "Cloudy"){
        cout << "Rainy";
    
    }
    else {cout << "Sunny";
    }
}



Measured memory_bytes: 256
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

rp :: IO (Int,Int)
rp  = toTup . unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

toTup [a,b] = (a,b)



main :: IO ()
main = do
    [n,k] <- r'
    print $ product (replicate (n-1) (k-1)) * k



Measured memory_bytes: 380
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    double x[8], y[8];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> x[i] >> y[i];
    }
    double sum = 0;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < i; j++){
            sum += sqrtf((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
        }
    }
    double ans = sum*2/N;
    cout << ans << endl;
}

Measured memory_bytes: 256
import qualified Data.List as L
import Data.Functor((<$>))

solve (0:_) res = reverse res
solve (x:xs) res =
  let (as, bs) = splitAt x xs
      sortedList = L.sort as
      diff = zipWith (\x y -> y-x) sortedList (tail sortedList) in
      solve bs (minimum diff : res)

main :: IO ()
main = do
  ls <- (map read . words) <$> getContents :: IO [Int]
  mapM_ (putStrLn . show) $ solve ls []


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

using namespace std;

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)

using ll = long long;

class UnionFind {
public:
  vector<int> par;

  UnionFind(int N) {
    par = vector<int>(N, -1);
  }

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

  int size(int x) {
    return -par[root(x)];
  }

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

  bool unite(int x, int y) {
    x = root(x);
    y = root(y);

    if (x == y) return false;
    if (size(x) < size(y)) swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return true;
  }
};

int main() {
  UnionFind uf = UnionFind(100010);
  ll N,M;
  int i;

  cin >> N >> M;
  vector<pair<int,int>> e = vector<pair<int,int>>(M);
  vector<ll> res = vector<ll>(M);
  REP(i,M) {
    int a,b;
    scanf("%d %d", &a, &b);
    e[i] = make_pair(a - 1, b - 1);
  }

  reverse(e.begin(), e.end());

  ll v = N * (N - 1) / 2;
  REP(i,M) {
    res[i] = v;
    int a = e[i].first, b = e[i].second;
    if (!uf.same(a, b)) {
      ll x = uf.size(a), y = uf.size(b);
      uf.unite(a, b);
      v -= x * y;
    }
  }

  reverse(res.begin(), res.end());
  REP(i,M) cout << res[i] << endl;

  return 0;
}


Measured memory_bytes: 3328
# https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_d
n = int(input())
s = input()

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            num = str(i) + str(j) + str(k)
            t = 0
            p = 0
            while t < 3 and p < n:
                if num[t] == s[p]:
                    t += 1
                p += 1
            if t == 3:
                ans += 1
print(ans)

Measured memory_bytes: 41948
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,p[5001],pp[5001],MIN,i,j,cnt;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&pp[i]);
	}
	pp[i]=0;
	MIN=100000000;
	for(i=0;i<=3;i++){
		cnt=0;
		for(j=1;j<=n;j++){
			p[j]=pp[j];
		}
		p[1]-=i;
		cnt+=i;
		for(j=2;j<=n;j++){
			if(p[j-1]>0){
				p[j]-=p[j-1];
				cnt+=p[j-1]*2;
			}
		}
		if(p[n]<0){
			p[n]=0;
		}
		cnt+=p[n];
		MIN=min(MIN,cnt);
	}
	printf("%d\n",MIN);
	return 0;
}


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

int main() {
  int N; cin >> N;
  int c = 0;
  rep(i,N) {
    int a; cin >> a;
    if (i%2==0 && a%2==1) c++;
  }
  cout << c << endl;
}


Measured memory_bytes: 3632
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

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

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

const int Maxn = 100010;
const int INF = (int) 1e6;

int d[2][Maxn];

int n;

vector<int> g[Maxn];

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

    cin >> n;
    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
    }

    fill(d[0], d[0] + n, INF);
    fill(d[1], d[1] + n, INF);
    d[0][0] = 0, d[1][n - 1] = 0;

    queue<int> que;
    que.push(0);
    while (!que.empty()) {
        int p = que.front();
        que.pop();
        for (auto &c : g[p]) {
            if (d[0][c] == INF) {
                d[0][c] = d[0][p] + 1;
                que.push(c);
            }
        }
    }

    que.push(n - 1);
    while (!que.empty()) {
        int p = que.front();
        que.pop();
        for (auto &c : g[p]) {
            if (d[1][c] == INF) {
                d[1][c] = d[1][p] + 1;
                que.push(c);
            }
        }
    }

    int cnt_f = 0, cnt_s = 0;
    for (int i = 0; i < n; ++i) {
        if (d[0][i] <= d[1][i]) cnt_f++;
        else cnt_s++;
    }
    if (cnt_f > cnt_s) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;
}


Measured memory_bytes: 6656
#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);

#define nl "\n"
#define fr first
#define sc second
#define MP make_pair
#define pb push_back
#define VI vector<int>
#define VII vector<ll>
#define MAP map <int,int>
#define PI pair < int , int >
#define sz(v) (int)(v).size()
#define all(v) v.begin(),v.end()
#define mem(a,val) memset(a,val,sizeof(a))
#define precise(n) fixed(cout);cout<<setprecision(n)

const int N = (int)4e7;
const int MOD = (int)1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

typedef long long ll;
typedef double db;

using namespace std;

int main()
{
    io;
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);

    ///Let the showdown begin

    int x;
    cin >> x;

    ll ans1,ans2;
    ans1 = (x/500)*1000;
    x %= 500;
    ans2 = (x/5)*5;

    cout << ans1+ans2 << nl;

    ///Happily DONE

    return 0;
}


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

int main(){
	int h,w;
	char field[102][102];
	cin >> h >> w;
	for(int i = 0;i <= h + 1;i++){
		for(int j = 0;j <= w + 1;j++) field[i][j] = '#';
	}
	getchar();
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++) field[i + 1][j + 1] = getchar();
		getchar();
	}
	for(int i = 0;i <= h + 1;i++){
		for(int j = 0;j <= w + 1;j++) cout << field[i][j];
		cout << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */


int main(const int argc, char * argv [])
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  size_t n;
  cin >> n;
  vector<int> a(n);
  cin >> a;

  vector<int> out;
  out.reserve(n);
  for(size_t i = 0; i < n; i += 2)
    out.push_back(a[i]);

  reverse(begin(out), end(out));
  for(size_t i = 1; i < n; i += 2)
    out.push_back(a[i]);

  if(!(n & 1))
    reverse(begin(out), end(out));

  dump(begin(out), end(out), " ");

  return EXIT_SUCCESS;
}


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

int main(){
  int A,B;
  cin >> A >> B;
  if(A%3 == 0 || B%3 == 0 || (A+B)%3==0) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.Functor

main :: IO ()
main = do
  n <- readLn
  as <- join <$> (replicateM n $ map read . words <$> getLine) :: IO [Int]
  print . length . filter isPrime $ as


isPrime :: Int -> Bool
isPrime 1 = False
isPrime 2 = True
isPrime n = all (\i -> not $ n `mod` i == 0) [2..(1 + (truncate . sqrt $ fromIntegral n))]



Measured memory_bytes: 9932
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
int main(){
	char a[200],b[200];
	scanf("%s",a);
	scanf("%s",b);
	int na = strlen(a);
	int nb = strlen(b);
	if(na > nb) printf("GREATER\n");
	else if(na < nb) printf("LESS\n");
	else if(na == nb){
		int ok = 0;
		for(int i = 0;a[i] != '\0';i++){
			if(a[i] == b[i]) continue;
			if(a[i] > b[i]){
				ok = 1;
				printf("GREATER\n");
				break;
			}
			if(a[i] < b[i]){
				ok = 1;
				printf("LESS\n");
				break;
			}
		}
		if(ok == 0) printf("EQUAL\n");
	}
	return 0;
}

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

const int MAXN = 256;
int N;
char G[MAXN][MAXN];

int count(int pi, int pj, int vi, int vj) {
  if(G[pi][pj] == '0') return 0;
  int ni = pi + vi;
  int nj = pj + vj;
  if(ni < 0 || ni >= N) return 1;
  if(nj < 0 || nj >= N) return 1;
  return count(ni, nj, vi, vj) + 1;
}

int main() {
  while(cin >> N && N) {
    for(int i = 0; i < N; ++i) {
      for(int j = 0; j < N; ++j) {
        cin >> G[i][j];
      }
    }
    int maxi = 0;
    for(int i = 0; i < N; ++i) {
      for(int j = 0; j < N; ++j) {
        maxi = max(maxi, count(i,j,1,0));
        maxi = max(maxi, count(i,j,0,1));
        maxi = max(maxi, count(i,j,1,1));
        maxi = max(maxi, count(i,j,1,-1));
      }
    }
    cout << maxi << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
# -*- coding: utf-8 -*-

n,m=map(int, input().split())
ab = ["" for _ in range(m)]

for i in range(m):
    ab[i] = list(map(int, input().split()))
#print(ab)

for i in range(1, n+1):
#    print("i",i)
    count = 0
    for j in range(m):
#        print("j",j)
        if i in ab[j]:
            count += 1
    print(count)


Measured memory_bytes: 3060
l,r = map(int,input().split())
r -= (l//2019)*2019
l %= 2019
ans = 2018
if r-l >= 2019:
    print(0)
    exit()

for i in range(l,r):
    for j in range(i+1,r+1):
        ans = min(ans,(i*j)%2019)

print(ans)

Measured memory_bytes: 3064
O=list(input())
E=list(input())
L=[]

if len(O)==len(E):
    for i in range(len(O)):
        L.append(O[i])
        L.append(E[i])
else:
    for i in range(len(E)):
        L.append(O[i])
        L.append(E[i])
    L.append(O[len(O)-1])
L="".join(L)
print(L)

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

int main() {
	for (;;) {
		int h, w;
		cin >> h >> w;
		if (h == 0 && w == 0) {
			break;
		}
		for (int y = 0; y < h; y++) {
			for (int x = 0; x < w; x++) {
				if ((x + y) % 2 == 0) {
					cout << "#";
				} else {
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 3104
#include<stdio.h>
#include<math.h>
int main(){
int deg,a,bdeg,b,c;
double rad,x=0,y;
double PI=acos(-1);
scanf("%d,%d\n",&a,&deg);
y=a;
deg=90-deg;
while(1){
scanf("%d,%d\n",&a,&bdeg);
if(a==0 && bdeg==0){
break;
}
rad=PI*deg/180;
x=x+a*cos(rad);
y=y+a*sin(rad);
deg=deg-bdeg;
}
b=x,c=y;
printf("%d\n%d\n",b,c);
return 0;
}


Measured memory_bytes: 2084
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI  = acos(-1.0);

typedef list<int> li;
void add(li::iterator &it,li &lst){
	it++;
	if(it==lst.end()){
		it=lst.begin();
	}
}
void reduce(li::iterator &it,li &lst){
	if(it==lst.begin()){
		it=lst.end();
	}
	it--;
}
int main(){
	int n,k,m;
	while(cin>>n>>k>>m,n|k|m){
		li l(n);
		int a=1;
		for(li::iterator it=l.begin();it!=l.end();it++){
			(*it)=a;
			a++;
		}
		li::iterator it=l.begin();
		REP(j,m-1){
			add(it,l);
		}
		it=l.erase(it);
		reduce(it,l);
		int sz=l.size();
		REP(i,n-2){
			REP(j,k%sz){
				add(it,l);
			}
			it=l.erase(it);
			reduce(it,l);
			sz--;
		}
		cout<<(*it)<<endl;
	}
}

Measured memory_bytes: 1504
import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    
    int total = c - (a - b);
    
    if (total >= 0) {
      System.out.println(total);
    } else {
      System.out.println(0);
    }
  }
}

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

// #define fi first
// #define se second
#define rep(i, n) for (ll i=0;i<(n); i++)
#define ALL(v) (v).begin(), (v).end()
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
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 (a>b) { a=b; return 1; } return 0; }

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;

const ll M=1000000007ll;
const ll MOD=1000000007ll;
const ll MAX=100000001ll;
//const ll M = 1000000000+7;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
   return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(ll n){
  if(n==0) return 1;
  mint ans = f(n/2);
  ans *= ans;
  if(n%2==1) ans*= 2;
  return ans;
}

mint choose(ll n, ll k){
  mint x=1, y=1;
  rep(i,k){
    x *= (n-i);
    y *= (i+1);
  }
  return x / y;
}

struct BIT {
  private:
   vector<ll> bit;
   ll N;
 
  public:
   BIT(ll size) {
     N = size;
     bit.resize(N + 1);
   }
 
   // 一点更新です
   void add(ll a, ll w) {
     for (ll x = a; x <= N; x += x & -x) bit[x] += w;
   }
 
   // 1~Nまでの和を求める。
   int sum(ll a) {
     ll ret = 0;
     for (ll x = a; x > 0; x -= x & -x) ret += bit[x];
     return ret;
   }
 };
 
ll fff(ll n, vector<ll>& v, ll i, ll j, ll rl){
  ll can = 0;
  ll can_i = 0;

  cout << v[0]<<endl;
  
  // right
  if(rl == 0){
    rep(k, n){
      if(v[k]*(j-k)>can){
	can = v[k]*(j-k);
	can_i = k;
      }
      //cout << can<<endl;
    }
    v[can_i] = 0;
    return can;
  }
  // left
  else{
    rep(k, n){
      if(v[k]*(k-i)>can){
	can = v[k]*(k-i);
	can_i = k;
      }
      //cout << can<<endl;

    }
    v[can_i] = 0;
    return can;
  }
  
}


int main(){
  string a;
  string b;

  cin>>a>>b;

  a += b;

  ll ab = stoll(a);
  rep(i, 350){
    if((i+1)*(i+1)==ab) {
      cout << "Yes"<<endl;
      return 0;
    }
  }
  
  cout << "No"  <<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int mincost(int a[],int n,int k,int dp[])
{
    if(n==0||n==1)return 0;

    else if(dp[n]!=-1)return dp[n];
    else
    {
        int ans=INT_MAX;
        for(int i=1;i<=k;i++)
        {
            if(n-i>=1)
            {
                if(ans>(abs(a[n]-a[n-i])+mincost(a,n-i,k,dp)))
                    ans=abs(a[n]-a[n-i])+mincost(a,n-i,k,dp);
            }
        }
        dp[n]=ans;
    }
    return dp[n];


}

int main()
{
    int n,k;
    cin>>n>>k;
    int a[n+1],dp[n+1];
    for(int i=1;i<=n;i++){cin>>a[i];dp[i]=-1;}
    cout<<mincost(a,n,k,dp);
    return 0;
}


Measured memory_bytes: 10368