akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <iomanip>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
typedef greater<int> g;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
//vector<int> v;
priority_queue<double, vector<double>, g> v;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    double a;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        //v.push_back(a);
        v.push(a);
    }
    //sort(ALL(v));
    for (int i = 0; i < n - 1; i++)
    {
        double temp = v.top();
        v.pop();
        double temp1 = v.top();
        v.pop();
        double temp2 = double(temp + temp1) / 2;
        v.push(temp2);
    }
    double ans = v.top();
    cout << setprecision(10) << ans << "\n";
}

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

int main()
{
    int t;
    cin>>t;
   
    
    int l=0;
    
    long long s=0;
    
    for(int i=1;i<=t;i++)
    {
        if(i%3!=0 && i%5!=0)
        s+=i;
    }
    cout<<s;
    
    return 0;
}


Measured memory_bytes: 3624
//
//AtCoder Beginner Contest 132
//B - Ordinary Number
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    vector<int> p(n);
    REP(i, n) cin >> p[i];

    int ans = 0;
    REP(i, n-2){
        if (min(p[i],p[i+2])<p[i+1] && p[i+1]<max(p[i],p[i+2])) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	int A[100001];
	int sum = 0;

	cin >> N;
	A[0] = 0;
	for (int i = 1; i <= N; i++) cin >> A[i];

	for (int i = 1; i <= N; i++) sum += abs(A[i] - A[i-1]);
	sum += abs(A[N] - 0);

	for (int i = 1; i < N; i++) {
		int s = sum;
		s -= abs(A[i] - A[i-1]);
		s -= abs(A[i+1] - A[i]);
		s += abs(A[i-1] - A[i+1]);
		cout << s << endl;
	}

	sum -= abs(A[N] - A[N-1]);
	sum -= abs(A[0] - A[N]);
	sum += abs(A[N-1] - A[0]);
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
namespace fdata
{
inline char nextchar()
{
    static const int BS = 1 << 21;
    static char buf[BS], *st, *ed;
    if (st == ed)
        ed = buf + fread(st = buf, 1, BS, stdin);
    return st == ed ? -1 : *st++;
}
#ifdef lky233
#define nextchar getchar
#endif
template <typename Y>
inline void poread(Y &ret)
{
    ret = 0;
    char ch;
    while (!isdigit(ch = nextchar()))
        ;
    do
        ret = ret * 10 + ch - '0';
    while (isdigit(ch = nextchar()));
}
#undef nextcar
} // namespace fdata
using fdata::poread;
const int MAXN = 5e5 + 10;
const int MOD = 1e9 + 7;
#define int long long 
int n, m; 
int tree[MAXN];
inline void add(int x, int d)
{
	for(; x <= n; x += (x & -x))
		tree[x] += d;
}
inline int ask(int x)
{
	register int res = 0;
	for(; x; x -= (x & -x))
		res += tree[x];
	return res;
}
int a[MAXN];
int s[MAXN], suf[MAXN];
int fac[MAXN];
signed main()
{
	poread(n);
	fac[0] = 1;
	for(register int i = 1; i <= n; ++i)
		fac[i] = (long long)fac[i - 1] * i % MOD;
	int m = n;
	for(register int i = 1; i <= n; ++i)
	{
		poread(a[i]);
		if(a[i])
			++s[a[i]], --m;
	}
	for(register int i = 1; i <= n; ++i)
		suf[i] = s[i] = 1 - s[i], s[i] += s[i - 1];
	for(register int i = n; i >= 1; --i)
		suf[i] += suf[i + 1];
	register int sum = 0, cnt = 0;
	register int res = 0;
	for(register int i = n; i >= 1; --i)
	{
		if(a[i])
		{
			sum = (long long)ask(a[i] - 1) * fac[m] % MOD;
			if(cnt)
				sum = (sum + (long long)cnt * s[a[i]] % MOD * fac[m - 1] % MOD) % MOD;
			res = (res + (long long)sum * fac[n - i] % MOD) % MOD;
			add(a[i], 1);
		}
		else
		{
			++cnt;
		}
	}
	cnt = sum = 0;
	for(register int i = 1; i <= n; ++i)
	{
		if(a[i])
		{
			if(cnt)
				res = (res + (long long)sum * suf[a[i]] % MOD * fac[m - 1] % MOD) % MOD;
		}
		else
		{
			sum = (sum + fac[n - i]) % MOD;
			++cnt;
		}
	}
	sum =  (long long)(m * (m - 1) >> 1 ) % MOD, cnt = 0;
	if(m >= 2)	
		for(register int i = 1; i <= n; ++i)
		{
			if(!a[i])
			{
				++cnt;
				res = (res + (long long)sum * (m - cnt) % MOD * fac[m - 2] % MOD * fac[n - i] % MOD);
			}
		}
	res = (res + fac[m]) % MOD;
	cout << res << endl;
}


Measured memory_bytes: 21760
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static int LoadInt() { return int.Parse(Console.ReadLine()); }
        static int[] LoadIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }

        static void Main(string[] args)
        {
            var vals = LoadInt();
            Console.WriteLine(vals * vals * 3);
        }

    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#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--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int days(int y, int m, int d){
    if(m < 3) y--, m += 12;
    return 365 * y + y / 4 - y / 100 + y / 400 + (153 * m + 8) / 5 + d;
}

int main() {
  int y1,y2,m1,m2,d1,d2;
  while(cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2) {
    if(y1<0 || m1<0 || d1<0 || y2<0 || m2<0 || d2<0) break;
    int D1=days(y1,m1,d1);
    int D2=days(y2,m2,d2);
    pr(D2-D1);
  }
  return 0;
}


Measured memory_bytes: 1160
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int x;
    cin>>x;
    int d=(2000-x-1)/200;
    cout<<d+1;
}

Measured memory_bytes: 3684
from itertools import accumulate
mod=1000000007
n=int(input())
S=input()
Flag=[0]*(2*n)
for i,s in enumerate(S):
    if i%2:
        Flag[i]=int(s=='W')
    else:
        Flag[i]=int(s=='B')
Acc=list(accumulate(Flag))
if Acc[-1]!=n:
    print(0)
    exit()
#Acc_rev=[0]*(2*n)
#Acc_rev[-1]=Flag[-1]^1
#for i in reversed(range(2*n-1)):
#    Acc_rev[i]=Acc_rev[i+1]+(Flag[i]^1)
ans=1
cnt=0
#print(Flag)
#print(Acc)
#print(Acc_rev)
for i,f in enumerate(Flag):
    if f:
        if i==2*n-1:
            ans=0
    else:
        tmp=Acc[i]-cnt
        ans*=tmp
        ans%=mod
        cnt+=1
for i in range(1,n+1):
    ans*=i
    ans%=mod
print(ans)

Measured memory_bytes: 56940
#include <stdio.h>

int x , y ;

int main () {
	
	scanf("%d %d",&x , &y);
	
	for (int i=1;x!=0 || y!=0;i++) {
		
		if (x>y) {
			
			printf ("%d %d\n" , y , x);
			
		}	else {
			
			printf ("%d %d\n" , x , y);
		}
		
		scanf("%d %d",&x , &y);
		
	}
}

	
	


	


	


	




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

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

int main() {
  int x;
  cin >> x;
  ll ans = 0;
  ans = pow(x, 3);
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3288
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = System.Console.ReadLine().Trim();
            decimal iL = decimal.Parse(sS);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            decimal iSd = iL / 3M;
            decimal iVl = iSd * iSd * iSd;

            // 出力
            System.Console.WriteLine("{0}", iVl.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


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

int main(int argc, char *argv[]) {
	int a,b,c;
	int flag = 0;
	int i = 0;
	scanf("%d %d",&a,&b);
	int tmp = b;
	while(tmp){
		i++;
		tmp/=10;
	}
	
	double d = pow(10,i);
	c = a*((int)d) + b;
	int j;
	for(j=1;j<=((int)sqrt((double)c))+1;j++){
		if(c==j*j)
		{
		 flag=1;
		 break;
		}
	}
	if(flag) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define V vector<long long>
#define VV vector<vector<long long>>
#define VVV vector<vector<vector<long long>>>
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0;(i)<(n);++(i))
using namespace std;

int main() {
    ll n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2<<endl;
}


Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split();
        int n = int.Parse(str[0]);
        int k = int.Parse(str[1]);
        str = Console.ReadLine().Split();
        char[] d = new char[k];        
        for (int i=0;i< k; i++)
        {
            d[i] = Convert.ToChar(str[i]);
        }

        bool check = false;
        while (!check)
        {
            bool dislike = false;
            string amount = Convert.ToString(n);
            for(int i=0;i<amount.Length;i++)
            {
                if (dislike) break;
                for (int j = 0; j < k; j++)
                {
                    if (amount[i] == d[j]) dislike = true;
                    if (dislike) break;
                }
            }
            if (!dislike) check = true;
            n++;
        }
        Console.WriteLine(n-1);
    }
}


Measured memory_bytes: 5208
#include <iostream>
using namespace std;
 
int main() {
    int n, N=1;
    bool isOdd = false;
    cin >> n;
    for(int i=0; N<n ; i++){
      N=N*2;
    }
    if (n == 1) cout << 1 << endl;
    else if (n == N) cout << N << endl;
    else cout << N/2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,X,x;cin>>N>>X;
    vector<int> l(N);
    for(int i=0;i<N;i++){
        cin>>x;
        l.at(i)=abs(x-X);
    }
    sort(l.begin(),l.end());
    
    int a,b=l.at(0),c,p;
    for(int i=0;i<N-1;i++){
        a=b;b=l.at(i+1);c=1;
        while(c>0){
            p=b/a;
            c=b-p*a;
            b=a;
            a=c;
        }
    }
    cout<<b<<endl;
}

Measured memory_bytes: 640
def printAns( A ):
    n = len(A)
    for i in range(1, n-1):
        print( str( A[i] ), end=" ")
    print( str( A[n-1] ) )

def main():
    n = int( input() )
    A = [0]
    list = [int(x) for x in input().split()]
    A.extend(list)
    B = []
    C = []
    k = max(A)

    for i in range(k + 1):
        C.append(0)

    for i in range(n+1):
        B.append(0)

    for j in range(1, n+1):
        C[ A[j] ] += 1

    for i in range(1, k+1):
        C[i] = C[i] + C[i-1]

    for j in reversed(range(n+1)):
        B[ C[ A[j] ] ] = A[j]
        C[ A[j] ] -= 1

    printAns(B)

if __name__ == "__main__":
    main()



Measured memory_bytes: 224224
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
    for (auto& e:t) fill_v(e, v);
}

typedef pair<int, int> P;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    vector<int> l(N + 1), r(N + 1);
    REP(i, N) {
        l[i + 1] = gcd(l[i], A[i]);
    }
    REV(i, N - 1, 1) {
        r[i - 1] = gcd(r[i], A[i]);
    }

    int res = -1;
    REP(i, N) {
        if (i == 0) {
            res = max(res, r[i]);
        } else if (i == N - 1) {
            res = max(res, l[i]);
        } else {
            res = max(res, gcd(l[i], r[i]));
        }
    }
    cout << res << endl;


    return 0;
}


Measured memory_bytes: 2560
S = input()
l = [0]*len(S)

left,right,bol = 0,0,0
for i in range(len(S)):
    if bol == 0:
        if S[i] == "R":
            left += 1
        else:
            bol = 1
            right += 1
            j = i
    else:
        if S[i] == "L":
            right += 1
        else:
            l[j-1] = -(-left//2) + right//2
            l[j] = left//2 + -(-right//2)
            left,right,bol = 1,0,0

l[j-1] = -(-left//2) + right//2
l[j] = left//2 + -(-right//2)
print(*l)

Measured memory_bytes: 10772
#include <iostream>
using namespace std;
int main() {
    string in;
    int alp[26]={},i;
    while (cin>>in) {
        for (i=0;i<in.size();i++) {
            if ('a' <= in[i] && in[i] <= 'z') alp[in[i]-'a']++;
            if ('A' <= in[i] && in[i] <= 'Z') alp[in[i]-'A']++;
        }
    }
    for (i=0;i<26;i++) {
        cout << (char)('a'+i) << " : " << alp[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3220
#include <iostream>

int main() {
  int A, B;
  std::cin >> A >> B;
  
  if (B == 1) {
    std::cout << 0 << std::endl;
    return 0;
  }
  
  int ans = 1;
  int num = A;
  
  while (num < B) {
    num += A - 1;
    ++ans;
  }
  
  std::cout << ans << std::endl;
}

Measured memory_bytes: 256
# by the authority of GOD    author: manhar singh sachdev #

import os,sys
from io import BytesIO, IOBase

def main():
    n = int(input())
    arr = list(map(int,input().split()))
    maxi = arr[0]
    ans = 0
    for i in range(1,n):
        if arr[i] < maxi:
            ans += maxi-arr[i]
        maxi = max(maxi,arr[i])
    print(ans)

#Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == '__main__':
    main()

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

using namespace std;

void SelectSort(int x[], int N);
void BubbleSort(int x[], int N);
void InsertSort(int x[], int N, int num);
void ShellSort(int x[], int N);
void Trace(int x[], int N);
void Trace2(int x[], int N);

int gCount = 0;

int main() {
    int N;

    cin >> N;

    int x[N];

    for (int i = 0; i < N; i++) {
        cin >> x[i];
    }
    //SelectSort(x, N);
    //BubbleSort(x, N);
    ShellSort(x, N);
    Trace2(x, N);
    //cout << gCount << endl;

    return 0;
}


void SelectSort(int x[], int N) {
    int min;

    for (int i = 0; i < N - 1; i++) {
        min = i;
        for (int j = i; j < N; j++) {
            if (x[min] > x[j]) {
                min = j;
            }
        }
        if (i != min) {
            gCount++;
            swap(x[min], x[i]);
        }
    }
}

void BubbleSort(int x[], int N) {
    for (int i = 0; i < N - 1; i++) {
        for (int j = N - 1; j > i; j--) {
            if (x[j - 1] > x[j]) {
                swap(x[j - 1], x[j]);
                gCount++;
            }
        }
        //Trace(x, N);
    }
}

void ShellSort(int x[], int N) {
     vector<int> g;

     int s = 1, i;
     do {
         g.push_back(s);
         s = s * 3 + 1;
     } while(s < N);
     cout << g.size() << endl;
     for(i = g.size() - 1; i > 0; i--) {
         cout << g[i] << " ";
     }
     cout << g[i] << endl;
     for(i = g.size() - 1; i >= 0; i--) {
         InsertSort(x, N, g[i]);
     }
     cout << gCount << endl;
}

void InsertSort(int x[], int N, int num) {
    for (int i = num; i < N; i++) {
        int v = x[i];
        int j = i - num;
        while (j >= 0 && x[j] > v) {
            x[j + num] = x[j];
            j = j - num;
            gCount++;
        }
        // cout << j + num << endl;
        x[j + num] = v;
        // cout << i << endl;
    }
}

void Trace (int x[], int N) {
    int i;
    for (i = 0; i < N - 1; i++) {
        cout << x[i] << " ";
    }
    cout << x[i] << endl;
}

void Trace2 (int x[], int N) {
    int i;
    for (i = 0; i < N; i++) {
        cout << x[i] << endl;
    }
}

Measured memory_bytes: 6992
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	string s;
	cin>>n>>s;
	vector<int> forward(n, 0);
	vector<int> backward(n, 0);
	if(s[0] == 'W'){
		forward[0] = 1;
	}
	if(s[n - 1] == 'E'){
		backward[n - 1] = 1;
	}
	for(int i = 1; i < n; ++i){
		if(s[i] == 'W'){
			forward[i] = forward[i - 1] + 1;
		}
		else {
			forward[i] = forward[i - 1];
		}
	}
	for(int i = n - 2; i >= 0; i--){
		if(s[i] == 'E'){
			backward[i] = backward[i + 1] + 1;
		}
		else{
			backward[i] = backward[i + 1];
		}
	}
	int res = n + 1;;
	for(int i = 0; i < n; ++i){
		int l = forward[i];
		int r = backward[i];
		res = min(res, l + r - 1);
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<LL> VI;
typedef vector<VI> VVI;
typedef pair<LL, LL> PII;
typedef vector<string> VS;
inline LL toInt(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();}
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x,c) for(auto x: (c))
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define STABLE_SORT(c) stable_sort(ALL(c))
#define STABLE_RSORT(c) stable_sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)), (c).end());
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define dump(x)  cerr << #x << " = " << (x) << endl;


int main() {
    LL N, K;
    string S;
    cin >> N >> K;
    cin >> S;
    S[K - 1] = tolower(S[K - 1]);
    cout << S << endl;
	
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
        int num[15000];
        int i = 0;
        
        do {
                i++;
                scanf("%d", &num[i]);
        } while (num[i] != 0);

        for (i = 1; num[i] != 0; i++) {
                printf("Case %d: %d\n", i, num[i]);
        }
        return 0;
}

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

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

int N;
int e[300300];

signed main() {
    cin >> N;
    rep(i, N) {
        char c;
        cin >> c;
        if (c == 'E') {
            e[i] = (i ? e[i - 1] : 0) + 1;
        } else {
            e[i] = (i ? e[i - 1] : 0);
        }
    }
    int ans = 99999999999;
    rep(i, N) {
        int a = i - (i ? e[i - 1] : 0) + e[N - 1] - e[i];
        ans = min(ans, a);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 32768);
		PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		solve(reader, writer);
		reader.close();
		writer.close();
	}

	private static void solve(BufferedReader reader, PrintWriter writer) throws IOException {
		String s = reader.readLine();
		if (isPalindrome(s) && isPalindrome(s.substring(0, s.length() / 2))
				&& isPalindrome(s.substring(s.length() / 2 + 1, s.length()))) {
			writer.println("Yes");
		} else {
			writer.println("No");
		}

	}

	private static boolean isPalindrome(String s) {
		for (int i = 0; i <= s.length() / 2; i++) {
			if (s.charAt(i) != s.charAt(s.length() - 1 - i))
				return false;
		}
		return true;
	}
}


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

int main() {
	// your code goes here
	int i, j, n, k, s;
	cin>>k>>s;
	int ans=0;
	for(i=0; i<=k; ++i)
		for(j=0; j<=k; ++j)
			if(s-i-j>=0 && s-i-j<=k)	ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

  char s[6];
  int i;
  for(i = 0; i < 6; i++){
    scanf("%s", &s[i]);
  }
  if(s[2] == s[3] && s[4] == s[5]){
  	printf("Yes");
  }else{
  	printf("No");
  }
  
  return 0;
}

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

using namespace std;
 
/// ----------------------------- (Debug) ------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i));}
sim, class b dor(pair < b, c > d) {ris << "(" << d.first << ", " << d.second << ")";}
sim dor(rge<c> d) {*this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
vector<char*> tokenizer(const char* args) {
	char *token = new char[111]; strcpy(token, args); token = strtok(token, ", ");
	vector<char*> v({token});
	while(token = strtok(NULL,", ")) v.push_back(token);
	return reverse(v.begin(), v.end()), v;
}
void debugg(vector<char*> args) { cerr << "\b\b "; }
template <typename Head, typename... Tail>
void debugg(vector<char*> args, Head H, Tail... T) {
	debug() << " [" << args.back() << ": " << H << "] ";
	args.pop_back(); debugg(args, T...);
}
#define harg(...) #__VA_ARGS__
#ifndef ONLINE_JUDGE
#define dbg(...) { debugg(tokenizer(harg(__VA_ARGS__, \b\t-->Line)), __VA_ARGS__, __LINE__); cerr << endl;}
#else
#define dbg(...) { }
#endif
/// -----------------------------------------------------------------------
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi; 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define print(x) cout << x << "\n";
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
#define spa <<" "<<
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
ll mod=998244353;
const int MX=0x3f3f3f3f;

int main(){
	IOS;
	int n,i;
	cin>>n;
	string s;
	map<string,int> mp;
	REP(i,1,n){
		cin>>s;
		mp[s]++;
	}
	cout<<"AC x "<<mp["AC"]<<"\n";
	cout<<"WA x "<<mp["WA"]<<"\n";
	cout<<"TLE x "<<mp["TLE"]<<"\n";
	cout<<"RE x "<<mp["RE"]<<"\n";
	return 0;
}

Measured memory_bytes: 3676
#include <iostream>
#include <map>

using namespace std;

int main() {
	int h, w, n;
	cin >> h >> w >> n;

	map<pair<int, int>, int> cnt;
	while (n--) {
		int a, b;
		cin >> a >> b;
		a--; b--;

		for (int i = -1; i <= 1; i++)
			for (int j = -1; j <= 1; j++)
				if (a + i - 1 >= 0 && a + i + 1 < h && b + j - 1 >= 0 && b + j + 1 < w)
					cnt[make_pair(a + i, b + j)]++;
	}

	long long ans[10] = {(long long)(h - 2) * (w - 2)};
	for (auto& elem : cnt) {
		ans[0]--;
		ans[elem.second]++;
	}

	for (int i = 0; i < 10; i++)
		cout << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 56448
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int i = 0; i <n; i++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;

using namespace std;
int main(){
    int n,m;std::cin >> n>>m;
    std::cout << n+m/2 << std::endl;
}


Measured memory_bytes: 256
// garnab27
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define ll int64_t
#define F first
#define S second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
ll modex(ll a,int b,ll p){ll res=1;a%=p;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b>>=1;}return res;}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};

int a[10];

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

	for(int i=0;i<4;i++){
		int b;
		cin>>b;
		a[b]++;
	}

	if(a[1] && a[9] && a[7] && a[4]) cout<<"YES";
	else cout<<"NO";


	return 0;
}

Measured memory_bytes: 256
from itertools import*;n=input();c=[0,0,6,36,150,540,1806,5796,18150];print(sum(c[:len(n)-1])+len(list(a for a in product(["3","5","7"],repeat=len(n))if len(set(a))==3 and int("".join(a))<=int(n))))

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

void solve();

signed main () {
    cout.precision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif
    int t = 1; 
    // cin >> t;
    int tt = t;
    while (t--) { 
        solve();
    }
    return 0;
}
const int N = 405;
int best[N][N];
int pref[N];
int arr[N];
const int inf = 1e18;
int get_sum(int l,int r) {
	return pref[r] - pref[l - 1];
}
void solve() {	
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n; ++j) {
			best[i][j] = inf;
		}
	}
	pref[0] = 0;
	for (int i = 1; i <= n; ++i)
		cin >> arr[i], best[i][i] = 0, pref[i] = pref[i - 1] + arr[i];
	for (int l = 2; l <= n; ++l) {
		for (int i = 1; i <= n; ++i) {
			int r = (i + l - 1);
			if (r > n)
				break;
			for (int mid = i; mid < r; ++mid) {
				best[i][r] = min(best[i][r], best[i][mid] + best[mid + 1][r] + get_sum(i, r));
			}
		}
	}
	cout << best[1][n];
}     


Measured memory_bytes: 1536
///usr/bin/g++ -O2 $0 -o ${0%.cpp} && echo "----------" && ./${0%.cpp}; exit;
#include <bits/stdc++.h>
using namespace std;

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

int n; 

int main(int argc, char const *argv[]) {
    scanf("%d", &n);
    vector<int> v(n + 1, 1e9); 

    for(int i = 0; i < n; ++i) {
        int a; scanf("%d", &a);
        *upper_bound(v.begin(), v.end(), -a) = -a; 
    }

    int ans = lower_bound(v.begin(), v.end(), 1e9) - v.begin(); 

    printf("%d\n", ans);
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int a;
  cin >> a;
  cout << a+a*a+a*a*a << endl;
  return 0;
}

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

using namespace std;

int n, m;

long long ans, ll = 1;

int main () {
	ios::sync_with_stdio(0), cin.tie(0);
	cin >> n >> m;
	if (n == 1 || m == 1) {
		cout << 1;
		return 0;
	}
	ans = (ll * n) * m;
	ans /= 2;
	if (n % 2 != 0 && m % 2 != 0)
		ans++;
	cout << ans;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeSet;

import javax.swing.*;

import static java.util.Arrays.binarySearch;
import static java.util.Arrays.copyOfRange;
import static java.util.Arrays.sort;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    private static int mod = 998244353;


    public void solve(int testNumber, InputReader in, PrintWriter out) {
        String s = in.next();
        if (s.equals("ABC")) {
            out.println("ARC");
        } else {
            out.println("ABC");
        }
    }



}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

}


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

int main(void){
    int N, A, B;
    cin >> N >> A >> B;
    int sum = 0;
    string s;
    int check = 0;
    int i;

    for(i = 1; i <= N; i++){
        s = to_string(i);
        for(int j = 0; j < s.length(); j++)
            check += (s[j] - '0');
        if(check >= A && check <= B)
            sum += i;
        check = 0;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<set>
#include<queue>
#include<cmath>

using namespace std;
#define LL long long

LL N,K,mod=1000000007ll,ans=0ll,sum[222222]={};

int main() {
	cin>>N>>K;
	for(int i=1;i<N+2;i++)sum[i]=sum[i-1]+i-1;
	for(int i=K;i<=N+1;i++){
		LL tmp=i*N-2ll*sum[i]+1ll;
		ans=(ans+tmp)%mod;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 5156
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
#define MAX 100010
int main(){
	int n, m;
  cin >> n >> m;
  ll h[MAX], ma[MAX];
  for(int i=1;i<=n;i++) {
    cin >> h[i];
    ma[i] = 0;
  }
  for(int i=1;i<=m;i++){
    int a, b;
    cin >> a >> b;
    ma[a] = max(ma[a], h[b]);
    ma[b] = max(ma[b], h[a]);
  }
  int ans = 0;
  for(int i = 1; i <= n; i++){
    ans += h[i]>ma[i];
   //cout << ma[i] << endl;;
  }

   cout << ans << endl;
}

Measured memory_bytes: 5204
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>

using namespace std;

int n, k;


int main()
{
	scanf("%d%d", &n, &k);
	int limit;
	limit = n / 2 + n % 2;
	
	if (limit >= k)
		printf("YES\n");
	else
		printf("NO\n");

	return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCode
{
    class Class1
    {
        static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            string S = Console.ReadLine();
            int[] Before = new int[S.Length];
            string SAfter = null;

            for(int i=0; i<S.Length; i++)
            {
                Before[i] = S[i] + N;
                for (int j = 0; j < 999; j++)
                {
                    if (Before[i] > 90)
                    {
                        Before[i] = Before[i] - 26;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            for (int i = 0; i < S.Length; i++)
            {
                SAfter += Convert.ToChar(Before[i]);
            }

            Console.WriteLine(SAfter);

        }
        

       
    }
    
}

Measured memory_bytes: 34900
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
vector<int> vt;
int n, m, k;
void dfs(int x, int depth) {
	if (depth ==0)return;
	if (x - m >= depth) {
		for (int i = x - m + 1; i <= x;i++)
			vt.push_back(i);
		dfs(x - m, depth - 1);
	}
	else {
		for (int i = depth; i <= x; i++)
			vt.push_back(i);
		dfs(depth - 1, depth - 1);
	}
}
int main()
{
	scanf("%d %d %d", &n, &m, &k);
	int ch = n / m;
	if (n%m)ch++;
	if (n+1 < m + k) {
		puts("-1");
		return 0;
	}
	if (k < ch) {
		puts("-1");
		return 0;
	}
	dfs(n, k);
	for (int i = 0; i < vt.size(); i++)
		printf("%d ", vt[i]);
}

Measured memory_bytes: 12404
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

void bubble(int L[], int n) {
  for(int i = 0; i < n; i++) {
    for(int j = n-1; j >= i+1; j--) {
      if(L[j] < L[j-1]) swap(L[j],L[j-1]);
    }
  }
}

int main() {
  int n,L[110];
  cin >> n;

  for(int i = 0; i < n; i++)
    cin >> L[i];

  bubble(L,n);

  int sum = 0;
  
  for(int i = 0; i < n; i++) {
    for(int j = i+1; j < n; j++) {
      for(int k = j+1; k < n; k++) {
        if(L[i] != L[j] & L[j] != L[k] & L[i]+L[j] > L[k])
          sum++;
      }
    }
  }
  cout << sum << endl;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto& ai:a) cin >> ai;

    deque<int> b(1,a[0]);
    rep2(i,1,n) {
        auto itr = lower_bound(b.begin(), b.end(), a[i]);
        if(itr == b.begin()) b.push_front(a[i]);
        else *(--itr) = a[i];
    }
    
    cout << b.size() << endl;
    return 0;
}

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

using namespace std;

int main(){
    int W, H, N;
    cin >> W >> H >> N;
    vector<int> x(N), y(N), a(N);
    for(int i = 0; i < N; i++){
        cin >> x[i] >> y[i] >> a[i];
    }
    // 白:1　黒:0
    vector< vector<int> > sq(W, vector<int>(H, 1));

    for (int i = 0; i < N; i++)
    {
        switch (a[i])
        {
        case 1:
            for (int j = 0; j < x[i]; j++)
            {
                for (int k = 0; k < H; k++)
                {
                    sq[j][k] = 0;
                }
            }
            break;
        case 2:
            for (int j = x[i]; j < W; j++)
            {
                for (int k = 0; k < H; k++)
                {
                    sq[j][k] = 0;
                }
            }
            break;
        case 3:
            for (int j = 0; j < W; j++){
                for (int k = 0; k < y[i]; k++){
                    sq[j][k] = 0;
                }
            }
                break;
        case 4:
            for (int j = 0; j < W; j++){
                for (int k = y[i]; k < H; k++){
                    sq[j][k] = 0;
                }
            }
            break;
        default:
            break;
        }
    }

    int x_min = W, x_max = -1;
    int y_min = H, y_max = -1;

    for (int i = 0; i < W; i++)
    {
        for (int j = 0; j < H; j++){
            if(sq[i][j] == 1){
                if(i < x_min)
                    x_min = i;
                if(i > x_max)
                    x_max = i;
                break;
            }
        }
    }

    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            if (sq[j][i] == 1)
            {
                if(i < y_min)
                    y_min = i;
                if (i > y_max)
                    y_max = i;
                break;
            }
        }
    }

    int area;
    if(x_min == W || x_max == -1 || y_min == H || y_max == -1)
        area = 0;
    else 
        area = (x_max - x_min + 1) * (y_max - y_min + 1);

    cout << area << endl;
    
}

Measured memory_bytes: 256
S = input()
N = len(S)
N1 = int(((N-1)/2)-1)
N2 = int(((N + 3)/2)-1)
A = S[:N1+1]
B = S[N2:]
BB = B[::-1]
C = 0
n = len(A)
nn = int(n/2)
nnn = int((n-1)/2)

if A == BB:
  C += 1
  
if n%2 == 0:
  AA = A[nn:]
  if A[:nn] == AA[::-1]:
    C += 1
elif n%2 ==1:
  AAA = A[nnn+1:]
  if A[:nnn] == AAA[::-1]:
    C += 1
    
if C == 2:
  print('Yes')
else:
  print('No')




Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;
const double PI = 3.14159265358979323846;

int main() {
  string s;
  cin >> s;
  int res = (int)s.size();
  for (char c: s) {
    int tmp = 0;
    for (int i=0; i<s.size();) {
      int j = i;
      while (j<s.size()&&!((s[j]==c)^(s[i]==c))) j++;
      if (s[i]!=c) tmp = max(tmp, j-i);
      i = j;
    }
    res = min(res, tmp);
  }
  cout << res << endl;
  return 0;
}

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

row = [False] * h # 行
col = [False] * w # 列

for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            row[i] = True
            col[j] = True

for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end = '')
        print()

Measured memory_bytes: 9188
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

using ll = long long;
using ull = unsigned long long;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}


// TODO: write
int main() {
  ll x;cin>>x;
  for(ll i = -2000;i < 2000;++i){
    for(ll j = -2000;j < 2000;++j){
      if(power(i,5ll) - power(j,5ll) == x){
        cout<<i<<" "<<j<<endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,cnt = 0;
    cin >> n;
    int arr[n];
    for(int i=0; i <n ; ++i){
        cin >> arr[i];
    }
    for( int k=1; k < n-1; ++k){
        if((arr[k]<arr[k+1]&&arr[k]>arr[k-1]) || (arr[k]>arr[k+1]&&arr[k]<arr[k-1])){
            ++cnt;
        }
    }
    cout<< cnt;
    return 0;
}


Measured memory_bytes: 256
from queue import deque

N = int(input())
*b, = map(int, input().split())

res = True
for i, v in enumerate(b):
	if i + 1 < v:
		res = False
		break

if res:
	l = list(b)
	ans = []
	while l:
		for i in range(len(l), 0, -1):
			if i == l[i-1]:
				ans.append(i)
				del l[i-1]
				break
	for v in reversed(ans):
		print(v)
else:
	print(-1)

Measured memory_bytes: 3952
#include <bits/stdc++.h>
#define int long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define For(i,n)  for(int i=0;i<n;i++)
#define MOD 1000000007
#define MAX 100005
#define MAX2 10000
#define endl '\n'
#define Sort(v) sort(v.begin(), v.end())
using namespace std;
void show(int a[MAX], int n)
{
    For(i,n)
        cout<<a[i]<<" ";
    cout<<"\n";
}

void show1(int a[MAX2][MAX2], int r, int c)
{
    For(i,r)
    {
        For(j,c)
        {
            cout<<a[i][j]<<" ";
        }
        cout<<endl;
    }
}



bool check(vi a ,int k)
{
    For(i,a.size())
    {
        if (a[i] == k)
            return true;
    }
    return false;
}

int32_t main()
{
    int t,n,sum = 0,c,ok,mul = 1;
    cin>>t;
    if (t == 1)
        cout<<0<<endl;
    else
        cout<<1<<endl;
}



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

int main(){
  int x, n, a, b, i, j, judge=0;
  scanf("%d %d", &x, &n);
  int p[n];

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

  i=x;
  while(1){
    for(j=0; j<n; j++){
      if(i==p[j]){
        judge=1;
        break;
      }
    }
    if(judge==0){
      a=i;
      break;
    }
    judge=0;
    i--;
  }

  i=x;
  while(1){
    for(j=0; j<n; j++){
      if(i==p[j]){
        judge=1;
        break;
      }
    }
    if(judge==0){
      b=i;
      break;
    }
    judge=0;
    i++;
  }

  if(fabs(x-a)<=fabs(b-x))
    printf("%d\n", a);
  else
    printf("%d\n", b);

  return 0;
}


Measured memory_bytes: 1724