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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define F            first
#define S            second
#define pb(x)        push_back(x)
#define mp(a,b)      make_pair(a,b)
#define mt(a,b,c)    make_tuple(a,b,c);
#define sz           size()
#define all(A)       A.begin(), A.end()
#define mem(a, b)    memset(a, b, sizeof(a))   // all elements of A are b=0 or b=-1 else don't work
#define f0(i,b)      for(ll i=0;i<(b);i++)
#define f1(i,b)      for(ll i=1;i<=(b);i++)
#define f2(i,a,b)    for(ll i=(a);i<=(b);i++)
#define f3(i,b,a)    for(ll i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(ll i=(a);i!=(b);i+=(c))

#define mod          10000
#define PI           acos(-1.0)

#define whilee(i,t)  while(i!=t)
#define  sl(a)       scanf("%lld",&a)
#define  pl(a)       printf("%lld\n",a)

#define scan(x)      do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;

//for(auto it =A.begin(); it!=A.end(); it++)
//sort(A.begin(),A.end()); //sort(A, +n, greater<int>());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//count(A.begin(), A.end(), X); //counts the occurrences of X
//distance(A.begin(),A.end());  //distance between first to last element
//accumulate(A.begin(), A.end(), 0); //add
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());
//swap(S[0], T[0]);

//scanf("%lld",&x);
//printf("%lld\n",x);
//while (scanf("%lld %lld", &a, &b) == 2)
//printf("Case %lld: %lld\n", t++, a);

//vector <ll> A;
//deque <ll> A;
//queue <ll> A;
//stack <ll> A;
//list <int> A;
//set <ll> A;
//map <ll,ll> A;
//pair <ll,ll> A ;
//tuple <ll, ll, ll> A;
//vector <pair <ll,ll>> A ;
//bitset<32> bset1;
//bool ok = true;
//char ch;
//string S, T, U;
ll i=0, j=0, k=0, a, b, c, d, e, f, g, h, l, m, n, o, p, q, r, s, t=1, u, v, w, x, y, z, maxx=INT_MIN, minn=INT_MAX, ans=0, sum=0, cnt=0;

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

    //scan(n);
    cin>>n;
    cout<<n*n*n<<endl;
    return 0;
}


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

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

    double w, h, x, y;
    cin >> w >> h >> x >> y;
    
    double a = w * h / 2;
    if(x == w / 2 and y == h / 2 and (int)w % 2 == 0 and (int)h % 2 == 0) cout << fixed << setprecision(9) << a << ' ' << 1 << endl;
    else cout << fixed << setprecision(9) <<  a << ' ' << 0 << endl;

    return 0;
}

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

int main(){
	int L,A,B,C,D,X,Y,N,Z;
	scanf("%d",&L);
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&C);
	scanf("%d",&D);
	X = A/C;
	if(A%C > 0){
		X ++;
	}
	Y = B/D;
	if(B%D > 0){
		Y ++;
	}
	N = fmax(X,Y);
	Z = L - N;
	printf("%d\n",Z);
	return 0;
}

Measured memory_bytes: 2788
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for (int i=a; i<b; ++i)

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string S; cin >> S;
    ll N=S.length();
    reverse(S.begin(),S.end());
    vector <ll> rem(N);
    rem[0]=(S[0]-'0')%2019;
    ll pow10=10;
    for (int i=1; i<N; ++i) {
        rem[i]=(pow10*(S[i]-'0')+rem[i-1])%2019;
        pow10*=10;
        pow10%=2019;
    }
    map <ll, ll> count;
    ll ans=0, currem=0;
    for (auto x: rem) count[x]++;
    // for (auto x: rem) cout << x << " "; cout << "\n";
    pow10=1;
    for (int i=0; i<N; ++i)
    {
        ans+=count[currem];
        currem+=pow10*(S[i]-'0');
        currem%=2019;
        pow10*=10;
        pow10%=2019;
        count[rem[i]]--;
    }
    cout << ans << "\n";
    return 0;
}

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

template <typename Monoid>
class SegmentTree {
	using T = typename Monoid::type;
	const int n;
	vector<T> data;
	int size(int n) {
		int res;
		for (res = 1; res < n; res <<= 1);
		return res;
	}
public:
	SegmentTree(int n_) :
		n(size(n_)), data(n * 2, Monoid::id()) {}
	void init(const vector<T>& data_) {
		for (int i = 0; i < (int)data_.size(); i++)
			data[i + n] = data_[i];
		for (int i = n - 1; i >= 0; i--)
			data[i] = Monoid::op(data[i * 2], data[i * 2 + 1]);
	}
	void update(int p, T val) {
		p += n;
		data[p] = val;
		while (p >>= 1) data[p] = Monoid::op(data[p * 2], data[p * 2 + 1]);
	}
	void add(int p, T val) {
		p += n;
		data[p] += val;
		while (p >>= 1) data[p] = Monoid::op(data[p * 2], data[p * 2 + 1]);
	}
	T find(int i) {
		return data[i + n];
	}
	T find(int l, int r) {
		l += n; r += n + 1;
		T res1 = Monoid::id(), res2 = Monoid::id();
		while (l < r) {
			if (l & 1) res1 = Monoid::op(res1, data[l++]);
			if (r & 1) res2 = Monoid::op(data[--r], res2);
			l >>= 1; r >>= 1;
		}
		return Monoid::op(res1, res2);
	}
};

struct RMQ {
	using type = int;
	static const type id() { return INT_MAX; }
	static type op(const type& l, const type & r) { return min(l, r); }
};

int main()
{
	int n, q, com, x, y;
	scanf("%d%d", &n, &q);
	SegmentTree<RMQ> seg(n);
	while (q--) {
		scanf("%d%d%d", &com, &x, &y);
		if (com) printf("%d\n", seg.find(x, y));
		else seg.update(x, y);
	}
	return 0;
}

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

using namespace std;

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

  int q;
  cin >> q;
  while(q--) {
    int t, l, r;
    cin >> t >> l >> r;
    if(t == 0) cout << *min_element(a.begin()+l, a.begin()+r) << endl;
    else cout << *max_element(a.begin()+l, a.begin()+r) << endl;
  }
  return 0;
}


Measured memory_bytes: 3100
import collections as cl
import itertools as it
N = int(input())
s = []
for i in range(N):
    ss = input()
    s.append(ss)
#print(s)
t = sorted(s)
t= []
for i in range(N):
    tt= sorted(s[i])
    ts = ",".join(tt)
    t.append(ts)
#    print(ts)
#print(t)
l = cl.Counter(t)
#print(l)
count = 0
for v in l.values():
    if v > 1:
        count = count + v*(v-1)/2
#    print(v)
print(int(count))

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

const int MOD = 1e9 + 7;
const int N = 1e5 + 10;
vector<int> g[N];
int dp[N][2], n; // 0 -> white, 1 -> black

inline int mul(int a, int b) { return (long long)a * b % MOD; }
inline int add(int a, int b) { if ((a += b) >= MOD) a -= MOD; return a; }

int solve(int u, int c, int p) {
   int &dp = ::dp[u][c];
   if (dp != -1)
      return dp;
   if (c == 0) {
      dp = 1;
      for (auto &v : g[u]) {
         if (v == p)
            continue;
         dp = mul(dp, add(solve(v, 0, u), solve(v, 1, u)));
      }
   }
   else {
      dp = 1;
      for (auto &v : g[u]) {
         if (v == p)
            continue;
         dp = mul(dp, solve(v, 0, u));
      }
   }
   return dp;
}

int main() {
   scanf("%d", &n);
   for (int i = 0; i < n - 1; ++i) {
      int x, y;
      scanf("%d%d", &x, &y);
      g[x].push_back(y);
      g[y].push_back(x);
   }
   memset(dp, -1, sizeof(dp));
   g[0].push_back(1);
   g[1].push_back(0);
   cout << solve(0, 0, -1) << '\n';
   return 0;
}

Measured memory_bytes: 13440
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

static const int N=100;

int min(int a,int b){
  if(a<b) return a;
  else return b;
}

int main(){
  int n, p[N+1],m[N+1][N+1];
  int i,l,k,j;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d %d",&p[i-1],&p[i]);
  }
  
  for(i=1;i<=n;i++) m[i][i]=0;
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=(1<<21);
      for(k=i;k<=j-1;k++){
	m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
      }
    }
  }
  printf("%d",m[1][n]);
  printf("\n");
  return 0;
}



Measured memory_bytes: 2104
#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;

int main()
{
    int g=1,f=1,k=0,i,j;
    string s1,s2;

    cin >> s1 >> s2;

    for(i=0;i<s1.length();i++)
    {
        for(j=0;j<s2.length();j++)
        {
            if(s1[i]==s2[j])
                {g=1;
                k=1;}
            else
            {
                g=0;
                k=0;
                break;
            }
        }
        if(g==0)
            break;
    }

    if(k==1)
    {
        if(s1.length()<s2.length())
            cout<<"Yes\n";
        else cout<<"No\n";

        return 0;
    }
    else
    {

    for(i=0;i<s1.length();i++)
    {
        for(j=0;j<s2.length();j++)
        {
            if(s1[i]<s2[j])
            {
                f=0;
                swap(s1[i],s1[0]);
                swap(s2[j],s2[0]);
                break;
            }
        }
    }
    }
    if(f==0)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll =long long int ;
int main()
{
  ll h,n;
  cin>>h>>n;
  
  while(n--)
  {
    ll x;
    cin>>x;
    h-=x;
    if(h<=0)
    {
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}


Measured memory_bytes: 3572
#include <stdio.h>

int main(){

	int N;

	scanf("%d",&N);

	int i,j;

	int ans=0;

	for(i=1;i<=N;i++){
		int cnt=0;
		if(i%2==1){
			for(j=1;j<=i;j++){
				if(i%j==0){cnt++;}
			}
		}
		if(cnt==8){ans++;}
	}
	printf("%d\n",ans);

	return 0;
}

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

#define ff first
#define ss second
using namespace std;
#define maxn 2000006
#define pb push_back
#define ll long long
#define lll __int128
#define vll vector<ll>
#define mll map<ll,ll>
#define MOD 1000000007
#define pll pair<ll,ll>
#define ull unsigned long long
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
inline void fastio() {ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);}

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



int main() {
	fastio();

	string text1, text2; cin >> text1 >> text2;

	int n = text1.length(), m = text2.length();

	pair<int, char> dp[n + 1][m + 1];

	for (int i = 0; i <= n; i++) for (int j = 0; j <= m; j++)  dp[i][j] = {0, '*'};
	if ((text1[0] == text2[0])) {
		dp[0][0].ff = 1;
		dp[0][0].ss = text1[0];
	}
	for (int j = 1; j < m; j++) {
		dp[0][j].ff = dp[0][j - 1].ff;
		if ((text1[0] == text2[j]) * (dp[0][j - 1].ff == 0)) {
			dp[0][j].ff += 1;
			dp[0][j].ss = text1[0];
		}
	}
	for (int i = 1; i < n; i++) {
		dp[i][0].ff = dp[i - 1][0].ff;
		if ((text1[i] == text2[0]) * (dp[i - 1][0].ff == 0)) {
			dp[i][0].ff = +1;
			dp[i][0].ss = text1[i];
		}
	}

	for (int i = 1; i < n; i++) {
		for (int j = 1; j < m; j++) {
			if (dp[i - 1][j - 1].ff >= dp[i][j - 1].ff and dp[i - 1][j - 1].ff >= dp[i - 1][j].ff) {
				dp[i][j].ff = dp[i - 1][j - 1].ff;
				if ((text1[i] == text2[j])) {
					dp[i][j].ff += 1;
					dp[i][j].ss = text1[i];
				}

			}
			else dp[i][j].ff = max(dp[i - 1][j].ff, dp[i][j - 1].ff);
		}
	}

	ll r = n, c = m;
	string ans;
	while (r >= 0 and c >= 0) {
		if (r == 0 and c == 0) {
			if (dp[r][c].ss != '*') ans.pb(dp[r][c].ss);
			break;
		}

		else if (r == 0 and c != 0) {
			if (dp[r][c].ss != '*') ans.pb(dp[r][c].ss);
			c--;
		}

		else if (r != 0 and c == 0) {
			if (dp[r][c].ss != '*') ans.pb(dp[r][c].ss);
			r--;
		}

		else {
			if (dp[r][c].ss != '*') {
				ans.pb(dp[r][c].ss);
				r--, c--;
			}
			else {
				if (dp[r - 1][c].ff > dp[r][c - 1].ff) r--;
				else c--;
			}
		}
	}

	reverse(ans.begin(), ans.end());
	cout << ans;

	return 0;
}

Measured memory_bytes: 70656
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
    ll n,m;
    cin >> m >> n;
    ll left=1,right=m;
    for(ll i=0;i<n;i++){
        ll l,r;
        cin >> l >> r;
        left = max(left,l);
        right = min(right,r);
    }
    ll ans = right-left+1;
    if(ans<0)  ans=0;
    cout << ans;
}

Measured memory_bytes: 256
/*input
ABCCABCABCBA
*/

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <math.h>
#include <iomanip>
#include <utility>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

ll MOD = 1000000007;
const int SINF = 1000000009;
const ll INF =  1000000000000000018;

#define sp          cout << " "
#define nl          cout << "\n"
#define inv(a)      powr((a), (MOD - 2))
#define all(c)      (c).begin(),(c).end()
#define rep(i,a,b)  for(ll i = (a); i < (b); i ++)
#define prec(n)     cout << fixed << setprecision(n)
#define PI          3.14159265358979323846264338327951
#define ifalse      ios_base::sync_with_stdio(false), cin.tie(NULL)

template<typename T> void toInt(string s, T &a) { istringstream(s) >> a; }
ll gcd(ll a, ll b) { ll t; while(a) { t = a; a = b%a; b = t; } return b; }
ll sub(ll a, ll b) { a -= b; a = (a + MOD) % MOD; return a; }
ll mul(ll a, ll b) { return ((a % MOD) * (b % MOD)) % MOD; }
ll add(ll a, ll b) { a += b; a %= MOD; return a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }

ll powr(ll a, ll b) {
  ll x = 1LL;
  while(b) {
    if(b & 1) x = mul(x, a);
    a = mul(a, a), b >>= 1;
  }
  return x;
}

bool check(ll n)
{
  if(n == 1) return 0;
  if(n == 2 or n == 3) return 1;
  if(n%2 == 0 or n%3 == 0) return 0;
  for(ll i = 5; i*i <= n; i += 6) if(n%i == 0 or n % (i+2) == 0) return 0;
  return 1;
}

/*********************************START**********************************/
const int N = 100005;

int main()
{
  ifalse;
  string s;
  cin >> s;
  int n = s.length();
  reverse(all(s));
  int cnt = 0;
  bool flag = 0;
  ll ans = 0;
  int i = 1;
  // cout << s, nl;
  while(i < n) {
    if(s[i] == 'A') {
      cnt = 0;
    }
    else {
      if(s[i - 1] == s[i]) {
        cnt = 0;
      }
      else if(s[i - 1] == 'C' and s[i] == 'B') {
        cnt ++;
        i ++;
        while(i < n and s[i] == 'A') {
          ans += cnt;
          i ++;
        }
      }
      else {
        cnt = 0;
      }
    }
    i ++;
  }
  cout << ans, nl;
  return 0;
}

Measured memory_bytes: 720
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;

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

int main() {
    int n;
    cin >> n;
    vector<int> nums(n);
    for(int i = 0; i < n; i++) {
        cin >> nums[i];
    }
    vector<int> l(n);
    vector<int> r(n);
    for(int i = 0; i < n-1; i++) {
        l[i+1] = gcd(l[i], nums[i]);
    }

    for(int i = n-1; i > 0; i--) {
        r[i-1] = gcd(r[i], nums[i]);
    }

    int ans = 0;

    for(int i = 0; i < n; i++) {
        ans = max(gcd(r[i], l[i]), ans);
    }

    cout << ans << endl;
}

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

using namespace std; 
 
int main(void) 
{ 
  	cin.tie(0); 
 	ios::sync_with_stdio(false); 
  
  	long long int a,b,x;

  	cin >> a >> b >> x;

  	if(a==0)
  	{
  		cout << (b/x)+1 << '\n';
  	}
  	else
  	{
  		cout << (b/x) - ((a-1)/x) << '\n';
  	}

 	return 0;
} 

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int y = scan.nextInt();
		for(int i = 0;i <= x; ++i){
			if(i*2 + (x-i)*4 == y){
				System.out.print("Yes");
				return;
			}
		}
		System.out.print("No");
	}
}


Measured memory_bytes: 35788
#include <bits/stdc++.h>
#define N 3010
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define pp pop_back
#define mapiter map<int, int>::iterator
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, n)	for(int i = n - 1; i >= 0; --i)
#define forr1(i, n)	for(int i = n; i >= 1; --i)
#define r0 return 0
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lld long double
#define elif else if
 
const ll inf = 1e12 + 7;
const lld EPS = 0.00000001;
const ll modw = 1e9 + 7;

using namespace std;

lld dp[N][N];
lld a[N];

int main()
{
	barnarnar
	int n;
	cin >> n;
	forn1(i, n)	cin >> a[i];
	dp[1][0] = 1 - a[1];
	dp[1][1] = a[1];
	for(int i = 2; i <= n; i++)
	{
		dp[i][0] = dp[i - 1][0] * (1 - a[i]);
		for(int j = 1; j <= n; j++)
		{
			dp[i][j] = dp[i - 1][j] * (1 - a[i]) + dp[i - 1][j - 1] * a[i];
			//cout << dp[i][j] << ' ';
		}
		//cout << endl;	
	}
	
	lld ans = 0;
	cout << setprecision(15) << fixed;
	for(int i = (n + 1) / 2; i <= n; i++)	ans += dp[n][i];
	cout << ans;
	
	return 0;
}



Measured memory_bytes: 141568
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#define nmax_def 110000
using namespace std;
typedef long long ll;

int main() {
	ll i, j;
	ll N, A[nmax_def], x[nmax_def], AsumOE[nmax_def], xsum = 0;
	cin >> N;
	AsumOE[0] = 0;
	AsumOE[1] = 0;
	for (i = 0; i < N; i++)
	{
		ll a;
		cin >> a;
		A[i] = a;
		AsumOE[i + 2] = AsumOE[i] + a;
		xsum += a;
	}
	for (i = 0; i < N; i++)
	{
		ll sumtmp = 0;
		sumtmp += AsumOE[i];
		sumtmp += AsumOE[N + i % 2];
		sumtmp -= AsumOE[i + 1];
		x[i] = xsum - sumtmp * 2;
		cout << x[i] << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;



int main(){
    int n, k;
    cin >> n >> k;
    if(n%k==0) out(0);
    else out(1);
    }

Measured memory_bytes: 256
<?php

list($a, $b) = explode(' ', trim(fgets(STDIN)));

$as = '';
for($i=0; $i<$b; $i++) {
    $as.=$a;
}

$bs = '';
for($i=0; $i<$a; $i++) {
    $bs.=$b;
}

if (strcmp($as, $bs) < 0) {
    echo "$as\n";
} else {
    echo "$bs\n";
}



Measured memory_bytes: 4856
#include <cstdio>

using namespace std;

bool is_satisfiable(const int balls[], int left_top, int right_top) {
  if (*balls == 0) { return true; }
  return (*balls > left_top &&
          is_satisfiable(balls + 1, *balls, right_top)) ||
         (*balls > right_top &&
          is_satisfiable(balls + 1, left_top, *balls));
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int balls[11];
    for (int j = 0; j < 10; ++j) { scanf("%d", balls + j); }
    balls[10] = 0;
    puts(is_satisfiable(balls, 0, 0) ? "YES" : "NO");
  }

  return 0;
}

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

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

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int H,W,Ch,Cw,Dh,Dw;

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

bool movable_a(vector<vector<char>> &S, int x, int y) {
    if (x<0 || x>=W || y<0 || y>=H) {
        return false;
    }
    else if (S[y][x]=='.') {
        return true;
    }
    else {
        return false;
    }
}

void bfs(vector<vector<char>> &S, vector<vector<int>> &seen) {
    queue<P> que;
    set<P> warp;
    que.push(make_pair(Ch,Cw));
    int cnt = 0;
    while(1) {
        P now = que.front();
        int now_x,now_y;
        now_x = now.second;
        now_y = now.first;
        que.pop();
        rep(i,4) {
            int x,y;
            x = now_x + dx[i];
            y = now_y + dy[i];
            if (movable_a(S, x, y)) {
                if (seen[y][x]==-1) {
                    que.push(make_pair(y,x));
                    seen[y][x] = cnt;
                }
            }
        }
        rep(h,5) {
            rep(w,5) {
                int xx,yy;
                xx = now_x+w-2;
                yy = now_y+h-2;
                if (movable_a(S,xx,yy)) {
                    if (seen[yy][xx]==-1) {
                        warp.insert(make_pair(yy,xx));
                    }
                }
            }
        }
        
        if (que.size()==0) {
            cnt++;
            for (auto p:warp) {
                int xx,yy;
                xx = p.second;
                yy = p.first;
                if (seen[yy][xx]==-1) {
                    que.push(make_pair(yy,xx));
                    seen[yy][xx] = cnt;
                }
            }
            warp.clear();
        }
        //cout << que.size() << endl;
        if (que.size()==0) {
            break;
        }
    }
}

int main(){
    cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
    Ch--,Cw--,Dh--,Dw--;
    vector<vector<char>> S(H,vector<char> (W));
    vector<vector<int>> seen(H,vector<int> (W,-1));

    rep(i,H) {
        string tmp;
        cin >> tmp;
        rep(j,W) {
            S[i][j] = tmp[j];
        }
    }

    bfs(S,seen);
    
    cout << seen[Dh][Dw] << endl;

}


Measured memory_bytes: 9076
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

int main(void) {

    ll X, Y; cin >> X >> Y;

    ll x = X, y = Y, ans = 1;

    while (x * 2 <= y) {
        ans++;
        x *= 2;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
    #include<string>
    using namespace std;
     
    int main(){
    	string s; cin >> s;
    	bool alpha[26] = {0};
    	bool jud = 1;
    	for(int i = 0; i < s.size(); ++i){
    		if(alpha[s[i] - 'a']){
    			jud = 0;
    			break;
    		}
    		alpha[s[i] - 'a'] = 1;
    	}
    	cout << ((jud) ? "yes\n" : "no\n");
    	return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int n;
	cin >> n;
	vector<tuple<long long, long long, long long>> d;
	vector<tuple<long long, long long>> z;
	for (int i = 0; i < n; i++) {
		long long x, y, h;
		cin >> x >> y >> h;
		if (h == 0)
			z.push_back(make_tuple(x, y));
		else
			d.push_back(make_tuple(x, y, h));
	}
	for (long long cx = 0; cx <= 100; cx++) {
		for (long long cy = 0; cy <= 100; cy++) {
			bool ok = true;
			long long H = get<2>(d[0]) + abs(get<0>(d[0]) - cx) + abs(get<1>(d[0]) - cy);
			for (int i = 1; i < d.size(); i++) {
				long long tH = get<2>(d[i]) + abs(get<0>(d[i]) - cx) + abs(get<1>(d[i]) - cy);
				if (H != tH) {
					ok = false;
					break;
				}
			}
			if (!ok)
				continue;
			for (int i = 0; i < z.size(); i++) {
				if ((H - abs(get<0>(z[i])-cx) - abs(get<1>(z[i])-cy)) > 0) {
					ok = false;
					break;
				}
			}
			if (ok) {
				printf("%lld %lld %lld\n", cx, cy, H);
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3692
N = int(input())
V = 0
E = 0
for i in range(N+1):
    V += i * (N-i+1)
for i in range(N-1):
    a, b = map(int, input().split())
    if a > b:
        a, b = b, a
    E += a * (N-b+1)
ans = V - E
print(ans)


Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int D;
    cin >> D;
    vector<int>c(26);
    for(int i = 0; i < 26; i++) {
        cin >> c[i];
    }
    vector<vector<int>>s(D,vector<int>(26));
    for(int i = 0; i < D; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    vector<int>t(D);
    for(int i = 0; i < D; i++) {
        t[i] = rand()%26+1;
    }
    int ans = 0;
    vector<int>Last(26);
    for(int i = 0; i < D; i++) {
        ans+=s[i][t[i]-1];
        Last[t[i]-1] = i+1;
        for(int j = 0; j < 26; j++) {
            ans-=c[j]*(i+1-Last[j]);
        }
    }
    int M = 3000000;
    vector<P>horyuu;
    int cnt = 0;
    for(int i = 0; i < M; i++) {
        int d = rand()%D+1;
        int q = rand()%26+1;
        int ord = ans;
        int X = 0;
        int Y = 0;
        int A = 0;
        int B = 0;
        ans+=s[d-1][q-1]-s[d-1][t[d-1]-1];
        for(int j = 0; j < D; j++) {
            if(t[j] == t[d-1]) {
                if(j == d-1) {
                    Y = j+1;
                }
                else {
                    X = j+1;
                }
                A = j+1;
            }
            if(t[j] == q) {
                Y = j+1;
                B = j+1;
            }
            ans-=c[t[d-1]-1]*(j+1-X)-c[t[d-1]-1]*(j+1-A);
            ans+=c[q-1]*(j+1-B)-c[q-1]*(j+1-Y);
        }
        if(ans >= ord) {
            ord = ans;
            horyuu.push_back({d,q});
            cnt++;
        }
        else {
            ans = ord;
        }
        if(cnt ==  2) {
            cnt = 0;
            t[horyuu[1].first-1] = horyuu[1].second;
            horyuu = {};
        }
    }
    for(int i = 0; i < D; i++) {
        cout << t[i] << "\n";
    }
}



Measured memory_bytes: 3720
#include<iostream>
using namespace std;
int main(){
	long long l,r;
	cin>>l>>r;
	if((l-1)/2019!=r/2019)
	{
		cout<<0;
		return 0;
	}
	int ans=2018*2018;
	for(long long i=l;i<r;i++)
	{
		for(long long k=i+1;k<=r;k++)
		{
			if((k*i)%2019<ans && k!=i)
				ans=(k*i)%2019;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    h = list(input())
    n = len(h)
    count = 0
    isR = True
    posL = 0
    res = [0 for i in range(0, n)]
    for i in range(0, n):
        count += 1
        if isR:
            if h[i] == 'L':
                res[i - 1] = count // 2
                res[i] = count // 2
                if count % 2 == 1:
                    res[i] += 1
                isR = False
                posL = i
        else:
            if h[i] == 'R':
                count = 1
                isR = True
            if h[i] == 'L':
                if (i - posL) % 2 == 0:
                    res[posL] += 1
                else:
                    res[posL - 1] += 1
                isR = False
    print(" ".join(map(str,res)))


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

int main(void) {
    int n;
    std::cin >> n;

    std::vector<int> vec{};
    for (int i = 0; i < n; ++i) {
        int a;
        std::cin >> a;
        vec.push_back(a);
    }

    int q;
    std::cin >> q;

    for (int j = 0; j < q; ++j) {
        int b, e, k;
        std::cin >> b >> e >> k;

        std::cout << std::count(vec.begin() + b, vec.begin() + e, k)
                  << std::endl;
    }
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

vector<ll> pw2(51,1); vector<ll> pw10(19,1);
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll myceil(ll x,ll y){if(x<=y) return 1;else if(x%y==0) return x/y;else return x/y+1;}
vector<ll> divisor(ll x){
	vector<ll> div;
	for(int i=1;i*i<=x;i++){
		if(i*i!=x && x%i==0){
			div.pb(i);
			div.pb(x/i);
		}
		else if(x%i==0) div.pb(i);
	}
	return div;
}
vector<ll> vectorprime(ll x){
	vector<bool> is_prime(x+1);
	vector<ll> prime;
	rep(i,x+1) is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<=x;i++){
		if(is_prime[i]){
			prime.pb(i);
		}
		for(int j=i*2;j<=x;j+=i) is_prime[j]=false;
	}
	return prime;
}

//a,b x
int main(){
	ll N,K; cin>>N>>K;
	vector<ll> x(N);
	vector<ll> y(N);
	rep(i,N) cin>>x[i]>>y[i];
	vector<ll> sx(x);
	vector<ll> sy(y);

	sort(sx.bg,sx.ed);
	sort(sy.bg,sy.ed);
	ll ans=(sx[N-1]-sx[0])*(sy[N-1]-sy[0]);
	for(ll ix=0;ix<N-1;ix++){
		for(ll jx=ix+1;jx<N;jx++){
			for(ll iy=0;iy<N-1;iy++){
				for(ll jy=iy+1;jy<N;jy++){
					ll cnt=0;
					rep(k,N){
						if(sx[ix]<=x[k] && x[k]<=sx[jx] && sy[iy]<=y[k] && y[k]<=sy[jy]) cnt++;
					}
					if(cnt>=K){
						ans=min(ans,(sx[jx]-sx[ix])*(sy[jy]-sy[iy]));
					}
				}
			}
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,ans=0;
	cin>>n;
	if(n>=9){
		ans+=9;
	}else{
		cout<<n;return 0;
	}
	if(n>=999){
		ans+=900;
	} else {
		cout<<ans+max(0,n-100+1);return 0;
	}
	if(n>=99999){
		ans+=90000;
	}else{
		cout<<ans+max(0,n-10000+1);return 0;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
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(); }

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//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) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	
	LL n, a, b; cin >> n >> a >> b;

	LL val = (n) / (a + b);
	LL ret = n - val * (a + b);

	LL ans = val * a + min(ret, a);

	cout <<ans<< endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream> 
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <cctype>
#include <climits>

using namespace std;

using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;

using ll = long long int;

#define mp(a,b) make_pair(a,b)

const int MOD = 1000 * 1000 * 1000 + 7;

bool res() {
	int n;
	cin >> n;
	if (!cin) return false;

	set<int> s;
	bool pos = true;
	for (int i = 0; i < n; ++i) {
		int num;
		cin >> num;

		if (s.find(num) != s.end()) pos = false;
		else s.insert(num);
	}

	if (pos) cout << "YES\n";
	else cout << "NO\n";

	return true;
}

int main() {
	while (res()) {}
	return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
#define x first
#define y second
#define ll long long

using namespace std;

ll n, k, hoabinhhihi;
map<ll, ll> m;

int main(){
    cin >> n >> k;
    hoabinhhihi = 0;
    for (int i = 1; i <= n; i++){
        if ((2*i)%k == 0){
            m[i%k]++;
        } 
    }
    map<ll, ll>::iterator it;
    for (it = m.begin(); it != m.end(); it++){
        if (it->x == 0) hoabinhhihi += it->y * it->y * it->y;
        if (m[k - it->x] > 0){
            hoabinhhihi += it->y * it->y * m[k - it->x];
        }
    }
    cout << hoabinhhihi;
}

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

int main() {
  int n, m, ANS = 0;
  cin >> n >> m;
  vector<int> a(n), ans(n, 1);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < m; i++) {
    int A, b;
    cin >> A >> b;
    if (a.at(A - 1) < a.at(b - 1)) {
      ans.at(A - 1) = 0;
    }
    else if (a.at(A - 1) > a.at(b - 1)) {
      ans.at(b - 1) = 0;
    }
    else {
      ans.at(A - 1) = 0;
      ans.at(b - 1) = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    ANS += ans.at(i);
  }
  cout << ANS << endl;
}

Measured memory_bytes: 4052
N = int(input())
A = list(map(int, input().split()))
#i_list = [a + i + 1 for i, a in enumerate(A)]

ans = 0
mp = {}
for i in range(N):
    i_kou = i + 1 + A[i]
    if i_kou in mp:
        mp[i_kou] += 1
    else:
        mp[i_kou] = 1
    j_kou = i + 1 - A[i]
    if j_kou in mp:
        ans += mp[j_kou]
print(ans)

Measured memory_bytes: 111448
import java.util.Scanner;
public class Main{
		
    public void solve(){
		Scanner sc = new Scanner(System.in);
		int h,m,s;
		int S = sc.nextInt();
		
		h = S / 3600;
		m = (S - h * 3600) / 60;
		s = ((S - h * 3600) - m * 60);
		
			System.out.println(h + ":" + m + ":" + s);
    }
		
		
		
		
	public static void main(String[] args){
		Main obj = new Main();
		obj.solve();
	}
}
				
			
        

Measured memory_bytes: 17324
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int ans = 0;
  int k,s;cin >> k >> s;
  for(int x=0;x<=k;x++){
    int sa = s-x;
    for(int y=0;y<=k;y++){
      int t = sa-y;
      if(t>k||t<0) continue;
      //cout << x << " " << y << " " << t << endl;
      ans++;
    }
  }

  cout << ans << endl;
}


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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    ll x;cin >> x;
    ll now = 100;
    ll counter = 0;
    while(now < x)
    {
        now += now/100;
        counter++;
    }
    cout << counter << endl;

}

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
using namespace std;
int n,k;int a[1007];
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;++i)cin>>a[i];
	sort(a+1,a+n+1);
	int ans=0;
	for(int i=1;i<=k;++i)ans+=a[i];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i > n; --i)
const int MOD = 1000000007;

bool solve() {
  string S; cin >> S;
  if(S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) return false;
  else return true;
}

int main() {
  cout << (solve() ? "Good" : "Bad") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define REP(i, n) for (LL i = 0; i < (LL)(n); i++)
#define REP2(i, n) for (LL i = 1; i <= (LL)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0)
#define vLL(v,n) vector<LL> v(n); REP(i,n)cin>>v[i];
#define vstr(v,n) vector<string> v(n); REP(i,n)REP(i,n)cin>>v[i];
LL INF = 1e9 + 1;
LL MOD = 1e9+7;
  LL a,b,c,d,e,n,m,l,k,r,x,y,z,ans=0,ans2=0;
string s,S,t;
int main() {
ios_base::sync_with_stdio(false);
cin >> n;
cout << n*n*n <<endl;
return 0;
}



Measured memory_bytes: 3216
sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
ans = "U" * y + "R" * x + "D" * y + "L" * x
ans += "L" + "U" * (y+1) + "R" * (x+1) + "D"
ans += "R" + "D" * (y+1) + "L" * (x+1) + "U"
print(ans)

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

int main() {
  char C;
  cin >> C;
  string str = "abcdefghijklmnopqrstuvwxyz";
  for(int i = 0; i < 25; i++){
  	if(str.at(i) == C ){
    cout << str.at(i+1) << endl;
    }
  }
  
}





Measured memory_bytes: 256
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int[] u = new int[N];
    int[] v = new int[N];
    for (int i = 0; i < N; i++) {
      int x = scanner.nextInt();
      int y = scanner.nextInt();
      u[i] = x + y;
      v[i] = x - y;
    }

    int r = Math.abs(u[0] % 2);
    for (int i = 1; i < N; i++) {
      if (Math.abs(u[i] % 2) != r) {
        System.out.println("-1");
        return;
      }
    }
    r = 1 - r;

    int m = 31;
    System.out.println(m + r);
    StringBuilder sb = new StringBuilder();
    if (r > 0) System.out.print("1 ");
    for (int i = 0; i < m; i++) {
      int d = 1 << i;
      sb.append(d);
      if (i < m - 1) sb.append(' ');
    }
    System.out.println(sb.toString());

    long base = (1L << m) - 1 - r;
    char[] d = new char[]{'L', 'D', 'U', 'R'};
    for (int i = 0; i < N; i++) {
      sb.setLength(0);
      if (r > 0) sb.append('R');
      long uu = (u[i] + base) / 2;
      long vv = (v[i] + base) / 2;
      for (int j = 0; j < m; j++) {
        int u1 = (int) Math.abs(uu % 2);
        int v1 = (int) Math.abs(vv % 2);
        sb.append(d[u1 * 2 + v1]);
        uu /= 2;
        vv /= 2;
      }
      if (uu != 0 || vv != 0) throw new IllegalStateException();
      System.out.println(sb.toString());
    }
  }
}


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

int main()
{
  int n;
  cin >> n;
  for(int i = 0; i <= n; i++){
    string s;
    int mcxi[4] = {};
    getline(cin, s);
    for(int j = 0; j < s.size(); j++){
      if(s[j] == 'm'){
	if(j - 1 >= 0)
	  if(s[j - 1] >= '0' && s[j - 1] <= '9')
	    mcxi[0] += s[j - 1] - '0';
	  else 
	    mcxi[0]++;
	else
	  mcxi[0]++;
      }else if(s[j] == 'c'){
	if(j - 1 >= 0)
	  if(s[j - 1] >= '0' && s[j - 1] <= '9')
	    mcxi[1] += s[j - 1] - '0';
	  else 
	    mcxi[1]++;
	else
	  mcxi[1]++;
      }else if(s[j] == 'x'){
	if(j - 1 >= 0)
	  if(s[j - 1] >= '0' && s[j - 1] <= '9')
	    mcxi[2] += s[j - 1] - '0';
	  else 
	    mcxi[2]++;
	else
	  mcxi[2]++;
      }else if(s[j] == 'i'){
	if(j - 1 >= 0)
	  if(s[j - 1] >= '0' && s[j - 1] <= '9')
	    mcxi[3] += s[j - 1] - '0';
	  else 
	    mcxi[3]++;
	else
	  mcxi[3]++;
      }
    }
    for(int j = 3; j > 0; j--){
      if(mcxi[j] >= 10){
	mcxi[j - 1] += mcxi[j] / 10;
	mcxi[j] %= 10;
      }
    }
    if(mcxi[0])
      if(mcxi[0] == 1)
	cout << 'm';
      else
	cout << mcxi[0] << 'm';
    if(mcxi[1])
      if(mcxi[1] == 1)
	cout << 'c';
      else
	cout << mcxi[1] << 'c';
    if(mcxi[2])
      if(mcxi[2] == 1)
	cout << 'x';
      else
	cout << mcxi[2] << 'x';
    if(mcxi[3])
      if(mcxi[3] == 1)
	cout << 'i';
      else
	cout << mcxi[3] << 'i';
    if(i)
      cout << endl;
    fill(mcxi, mcxi + 4, 0);
  }
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
 
#define F first
#define S second 
#define mp make_pair
#define pb push_back
#define pf push_front
#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define debug cerr << "OK\n";
#define ub upper_bound
#define lb lower_bound
#define treap_pair pair<treap*, treap*>
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef set <int> si;
typedef set <ll> sll;
typedef multiset <int> msi;
typedef multiset <ll> msll;
typedef map <int, int> mi;
typedef map <ll, int> mll;
 
const int N = 2e5 + 2;
const int M = 1e5 + 2;
const int mod = 998244353;
const int inf = 1e9;
const ll INF = 1e16;

void data() {
	#ifdef PC
		freopen("a.in", "r", stdin);
		freopen("a.out", "w", stdout);
	#endif
}

string s;

int main() {
	data();
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5])
		printf("Yes");
	else
		printf("No");
}

/*
	Timus: 288481RF
	CodeForces: fractal
*/

Measured memory_bytes: 256
#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 <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
   int N;
   cin >> N;
   int h[N];
   for(int i=0;i<N;i++)cin>>h[i];
   int ans =0;
   for(int i=0; i<N; ){
      if(h[i]==0){ i++;continue; }
      ans++;
      for(int j=i; j<N; j++){
         if(h[j]==0) break;
         h[j]--;
      }
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
from sys import stdin

N, M = [int(x) for x in stdin.readline().rstrip().split()]
KS = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)]
p = [int(x) for x in stdin.readline().rstrip().split()]

k = [KS[l][0] for l in range(M)]
s = [KS[m][1:] for m in range(M)]
cnt = 0


def to_binary(x):
    out = ''
    for l in range(N):
        if x >= 2 ** (N - l - 1):
            out += '1'
            x -= 2 ** (N - l - 1)
        else:
            out += '0'
    return out


for m in range(2 ** N):
    bin_num = to_binary(m)
    for x in range(M):
        swi = 0
        for y in range(k[x]):
            if bin_num[s[x][y] - 1] == '1':
                swi += 1
        if swi % 2 != p[x]:
            break
        if x == M - 1:
            cnt += 1

print(cnt)

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q,K,R,W,H;
string S,T;
ll ans;
ll x[1000000];
ll y[1000000];
ll a[1000000];
ll b[1000000];
ll c[1000000];
ll t[1000000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(int to, int cost) : to(to), cost(cost) {}
};

typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;
int main() {
	cin>>N;
	vector<ll> ast(100);
	vector<ll> aet(100);
	vector<ll> hst(100);
	vector<ll> het(100);
	vector<ll> bst(100);
	vector<ll> bet(100);
	rep(i,0,N){
		ll h,m;
		cin>>h>>m;
		ast[i]=h*60+m;
		cin>>h>>m;
		aet[i]=h*60+m;
		cin>>h>>m;
		hst[i]=h*60+m;
		cin>>h>>m;
		het[i]=h*60+m;
		cin>>h>>m;
		bst[i]=h*60+m;
		cin>>h>>m;
		bet[i]=h*60+m;
	}
	ans=0;
	rep(i,0,N){
		rep(j,0,N){
			rep(k,0,N){
				ll tmp=0;
				rep(l,0,N){
					if((ast[l]<=ast[i] && ast[i]<=aet[l]) &&(hst[l]<=hst[j] && hst[j]<=het[l])&&(bst[l]<=bst[k] && bst[k]<=bet[l])){
						tmp++;
					}
				}
				ans=max(ans,tmp);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3188
/*** akshaykumar99 ***/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>=n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD = 1e9+7;
const long double PI = acos(-1);
const long long INF = INT_MAX;
const long long LINF = LLONG_MAX;
const long long N = 1e5+1;
 
typedef long long ll;
typedef long double ld;  

void test_case()
{
    ll x,n,i,j;
    cin >> x >> n;
    map<ll,ll> vis;
    f(i,0,n)
    {
        ll z;
        cin >> z;
        vis[z] = 1; 
    }
    ll ans = INF,res;
    i = x - 102;
    while(i < x+102)
    {
        if(!vis[i] && abs(i-x) < ans)
        {
            ans = abs(i-x);
            res = i;
        }
        i++;
    }
    cout << res << '\n';

}
 
int32_t main()
{
    IOS(); 
   
    int tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}

Measured memory_bytes: 3628
/*
 * ITP1_4B.c
 *
 *  Created on: 2016/05/28
 *      Author: TakaakiShogaki
 */

#include<stdio.h>
//#include<math.h>

int main(){
	double r,PI;
	PI=3.141592653589;
	scanf("%lf",&r);
    printf("%f %f\n",PI*r*r,2*PI*r);

return 0;
}

Measured memory_bytes: 648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] nk = br.readLine().split(" ");
		int n = Integer.parseInt(nk[0]);
		int k = Integer.parseInt(nk[1]);
		
		int[] a = new int[n];
		int[] w = new int[n];

		for (int i = 0; i < n; i++) {
			String[] input = br.readLine().split(" ");
			w[i] = Integer.parseInt(input[0]);
			a[i] = Integer.parseInt(input[1]);
		}
		
		long ans = solve(n,k,a,w);
		
		System.out.println(ans);
	}

	private static long solve(int n, int w, int[] value, int[] wt) {
		
		long[][] dp = new long[n+1][w+1];
		
		for(int i=1; i<dp.length; i++) {
			for(int j=1; j<dp[0].length; j++) {
				if(wt[i-1]<=j) {
					dp[i][j]=Math.max(value[i-1]+dp[i-1][j-wt[i-1]], dp[i-1][j]);
				}else
					dp[i][j]=dp[i-1][j];
			}
		}
		
		
		return dp[n][w];
	}
}


Measured memory_bytes: 128980
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	while(true){
		int r, c;
		cin >> r >> c;
		if(r == 0 || c == 0){ break; }
		cout << ((r % 2 == 0 || c % 2 == 0) ? "yes" : "no") << endl;
	}
	return 0;
}

Measured memory_bytes: 0
# AGC019A - Ice Tea Store
def main():
    # N is always integer -> choose the best value among 4Q, 2H, S
    Q, H, S, D = list(map(int, input().rstrip().split()))  # 0.25, 0.5, 1, 2
    N = int(input())
    X = min(Q * 4, H * 2, S)
    ans = N // 2 * min(X * 2, D) + N % 2 * X
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> v;
void MAKE(ll a){

    ll res=0;
    while(a!=0){
        res=a-(a/10)*10;
        v.push_back(res);
        a/=10;
    }
    return;
}

int main(){
    ll n;
    cin>>n;
    MAKE(n);
    bool flag=true;
    if(v.size()==1){
        cout<<v.at(0)<<endl;
        return 0;
    }
    for(int i=0;i<v.size()-2;i++){
        if(v.at(i)!=9){
            flag=false;
            break;
        }
    }
    ll ans=0;
    if(v.at(v.size()-1)+v.at(v.size()-2)>9){
        if(flag){
            for(int i=0;i<v.size();i++)ans+=v.at(i);
        }
        else{
            v.at(v.size()-2)--;
            for(int i=v.size()-1;i>=0;i--){
                if(i>=v.size()-2)ans+=v.at(i);
                else ans+=9;
            }
        }
    }
    else{
        ans+=v.at(v.size()-1)-1;
         for(int i=0;i<v.size()-1;i++){
                ans+=9;
            }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256