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

using namespace std;

int main(){
    string s;

    cin >> s;

    long long n = s.size();
    vector<long long> v(n + 1);
    long long j;
    for(long long i = 0; i < n; i++){
        if(s[i] == '<'){
            j = i;
            v[j] = 0;
            while(i < n && s[i] == '<'){
                // cout << "Inside " << i << " " << v[j] << endl;
                v[j + 1] = v[j] + 1;
                // cout << "next: " << v[j + 1] << endl;
                i++;
                j++;
            }
            i--;
        }
    }

    j = n - 1;
    // cout << "Here" << endl;
    for(long long i = n- 1; i >= 0; i--){
        if(s[i] == '>'){
            j = i;
            v[j + 1] = 0;
            while(i >= 0 && s[i] == '>'){
                v[j] = max(v[j], v[j + 1] + 1);
                i--;
                j--;
            }
            i++;
        }
    }

    long long sum = 0;
    for(long long i = 0; i <= n; i++){
        // cout << v[i] << " ";
        sum += v[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 4740
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n;
string s, t;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n >> s >> t;
    rep(i, n, 2*n) {
        string subS = s.substr(i - n, 2 * n - i);
        string subT = t.substr(0, 2 * n - i);
        if (subS == subT) {
            cout << i << endl;
            return 0;
        }
    }
    cout << 2*n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
using namespace std;
typedef long long LL;

int main(void) {
	int n, i, j;
	LL ans , aa = 1;
	cin >> n;
	ans = pow(3, n);
	vector<int> a(n);
	for (i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] % 2 == 0) {
			aa *= 2;
		} else {
			aa *= 1;
		}
	}
	cout << ans - aa << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    char a[51];
    int i,t,count=0;
    scanf("%d",&t);
    getchar();
    gets(a);
    for(i=0;i<t-2;i++)
    {
        if(a[i]=='A'&&a[i+1]=='B'&&a[i+2]=='C')
        {
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 128
from math import ceil


def main(A=None, B=None, C=None, D=None):
    if not A:
        A, B, C, D = map(int, input().split())
    t = ceil(A/D)
    a = ceil(C/B)
    if t >= a:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    # main(10, 9, 10, 10)
    # main(46, 4, 40, 5)
    main()


Measured memory_bytes: 9112
local n,m,q=io.read("n","n","n")
local a,b,c,d={},{},{},{}
for i=1,q do
    a[i],b[i],c[i],d[i]=io.read("n","n","n","n")
end

local t={}
for i=1,10 do
    t[i]={}
end
for i=1,m do
    table.insert(t[1],{i})
end

for i=1,n-1 do
    for j,_ in pairs(t[i]) do
        local x=t[i][j]
        local p=x[#x]
        for k=p,m do
            local U={}
            for l=1,#x do
                U[l]=x[l]
            end
            table.insert(U,k)
            table.insert(t[i+1],U)
        end
    end
end

local answer=0
for _,T in pairs(t[n]) do
    local total=0
    for i=1,q do
        if T[b[i]]-T[a[i]]==c[i] then
            total=total+d[i]
        end
    end
    answer=math.max(answer,total)
end
print(answer)

Measured memory_bytes: 35120
A, B, C, D = map(int,input().split())

#a c b dなら　b-c
#a c d bなら　d-c
#c a d bなら　d-a
#c a b dなら　b-a

an = [A, B, C, D]
an.sort()

if an == [A, C, B, D]:
    print((B - C))
elif an == [A, C, D, B]:
    print((D - C))
elif an == [C, A, D, B]:
    print((D - A))
elif an == [C, A, B, D]:
    print((B - A))
else:
    print('0')

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

int main(void) {
	int  A,res = 0;
	for (int i = 0; i < 3;i++) {
		cin >> A;
		res += A;
	}
	if (res >= 22) {
		cout << "bust" << endl;
	}
	else {
		cout << "win" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <numeric>
#include <math.h>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    long double a,b; cin >> a >> b;
    long double d=a*b;
    ll dd=d;
    cout << dd << endl;
}

Measured memory_bytes: 3744
import java.util.Scanner;

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

    String s = sc.nextLine();
    char[] chars = s.toCharArray();

    int result = 0;
    if (chars[0] == '1') {
      result++;
    }
    if (chars[1] == '1') {
      result++;
    }
    if (chars[2] == '1') {
      result++;
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 21588
def main():
    n = int(input())
    ww = list(map(int, input().split()))
    s1 = ww[0]
    s2 = sum(ww[1:])
    res = abs(s1 - s2)
    for w in ww[1:-1]:
        s1 += w
        s2 -= w
        res = min(res, abs(s1 - s2))
    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <cmath>
#include <iostream>
#include <numeric>
#include <random>
#include <set>
#include <unordered_set>
#include <vector>
#include <list>
#include <functional>

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

using namespace std;

#define LOCAL 1

#if LOCAL
#define pv(val) cerr << #val << " = " << (val) << endl
#define pvn(name, val) cerr << name << " = " << (val) << endl
#define pl cerr << '@' << __LINE__ << endl
#else
#define pv(val)
#define pvn(name, val)
#define pl
#endif

template <class T>
ostream& operator<<(ostream& os, vector<T> const& vec) {
  if (vec.empty()) {
    os << "{}";
  } else {
    os << '{';
    for (size_t i = 0; i < vec.size() - 1; i++) os << vec[i] << ", ";
    os << vec.back() << '}';
  }
  return os;
}

template <class T, size_t S>
ostream& operator<<(ostream& os, array<T, S> const& arr) {
  if (arr.empty()) {
    os << "{}";
  } else {
    os << '{';
    for (size_t i = 0; i < arr.size() - 1; i++) os << arr[i] << ", ";
    os << arr.back() << '}';
  }
  return os;
}

template <class T, class U>
ostream& operator<<(ostream& os, pair<T, U> const& p){
  os << '(' << p.first << ", " << p.second << ')';
  return os;
}

template<class T, class U>
pair<T, U> operator+(pair<T, U> const& lhs, pair<T, U> const& rhs){
  return {lhs.first + rhs.first, lhs.second + rhs.second};
}

template<class T, class U>
pair<T, U> operator-(pair<T, U> const& lhs, pair<T, U> const& rhs){
  return {lhs.first - rhs.first, lhs.second - rhs.second};
}

template<class T, class U>
U lowerBound(function<T(U)> f, T const& val, U l, U r){
  while(l < r){
    auto m = l + (r - l) / 2;
    auto fm = f(m);
    if(fm < val){
      l = m;
    }else{
      r = m;
    }

  }
}

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};


int main(void) {
  int N, M;
  cin >> N >> M;
  vector<int> p(N);
  rep(i, N) cin >> p[i];

  UnionFind uf(N);

  rep(i, M){
    int x, y;
    cin >> x >> y;
    uf.unionSet(x - 1, y - 1);
  }
  int ans = 0;
  rep(i, N){
    if(uf.findSet(i, p[i] - 1)) ans++;
  }
  cout << ans << endl;


  return 0;
}


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

int main() {
  int l, r, d; cin >> l >> r >> d;
  int ans = 0;
  for (int i = l; i<=r; i++) {
    if (i % d == 0) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
struct segtree{
private:
  int siz;
  vector<ll> node,lazy;
  ll seg_inf;
public:
  segtree(ll n){
    siz=1;
    while(siz<=n) siz*=2;
    node.resize(siz*2-1,0);
    lazy.resize(siz*2-1,0);
    seg_inf=17441744174417;
  }
  void eval(ll k){
    node[k]+=lazy[k];
    if(k<siz-1){
      lazy[2*k+1]+=lazy[k];
      lazy[2*k+2]+=lazy[k];
    }
    lazy[k]=0;
  }
  void plus(ll a,ll b,ll x,ll k,ll l,ll r){
    eval(k);
    if(r<=a||b<=l) return;
    if(a<=l&&r<=b){
      lazy[k]+=x;
      eval(k);
    }
    else{
      plus(a,b,x,2*k+1,l,(l+r)/2);
      plus(a,b,x,2*k+2,(l+r)/2,r);
      node[k]=min(node[2*k+1],node[2*k+2]);
    }
  }
  void add(ll a,ll b,ll x){
    plus(a,b,x,0,0,siz);
  }
  ll get_min(ll a,ll b,ll k,ll l,ll r){
    eval(k);
    if(r<=a||b<=l) return seg_inf;
    if(a<=l&&r<=b) return node[k];
    else return min(get_min(a,b,2*k+1,l,(l+r)/2),get_min(a,b,2*k+2,(l+r)/2,r));
  }
  ll min_q(ll s,ll t){
    return get_min(s,t,0,0,siz);
  }
  void debug(int f){
    if(f==0){
      cout<<"node:";
      for(int i=0;i<node.size();i++) cout<<node[i]<<" ";
    }
    else{
      cout<<"lazy:";
      for(int i=0;i<lazy.size();i++) cout<<lazy[i]<<" ";
    }
    cout<<endl;
  }
};
int main(){
  ll n,d,a;
  cin>>n>>d>>a;
  vector<P> comp;
  vector<P> vec;
  for(int i=1;i<=n;i++){
    ll x,h;
    cin>>x>>h;
    vec.push_back(P(x,h));
  }
  vec.push_back(P(1744174417441744,0));
  sort(vec.begin(),vec.end());

  ll ans=0;
  segtree seg(n+5);
  for(int i=0;i<n;i++){
    ll xi=vec[i].first,hi=vec[i].second;
    seg.add(i,i+1,hi);

    ll bonb=xi+d;

    ll lb=lower_bound(vec.begin(),vec.end(),P(bonb-d,0))-vec.begin();
    ll rb=lower_bound(vec.begin(),vec.end(),P(bonb+d+1,0))-vec.begin();

  //  cout<<xi<<" "<<hi<<" "<<bonb<<" "<<lb<<" "<<rb<<" "<<seg.min_q(i,i+1)<<endl;
    if(seg.min_q(i,i+1)>0){
      ll mns=seg.min_q(i,i+1);
      mns+=(a-1);
      mns/=a;

      seg.add(lb,rb,-mns*a);
      ans+=mns;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 12524
#include<bits/stdc++.h>
using namespace std;
int main() {
  double w,h,x,y;
  cin >> w >> h >> x >> y;
  cout << fixed << setprecision(10) << w*h/2 << " ";
  cout << (x*2==w&&y*2==h?1:0) << endl;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int H, W, K;
	cin >> H >> W >> K;

	string smap[6];
	rep(i, 0, H)
	{
		cin >> smap[i];
	}

	int ans = 0;
	rep(i, 0, 1 << H)rep(j, 0, 1 << W)
	{
		int cnt = 0;
		rep(y, 0, H)rep(x, 0, W)
		{
			int yf = (i >> y) & 1;
			int xf = (j >> x) & 1;
			if (xf + yf == 0 && smap[y][x] == '#')
			{
				cnt++;
			}
		}
		if (cnt == K)ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxN = 1e3+7;
const int maxV = 90010;
//const int INF = 1e9+9;
//const ll INF = (1ll)<<60;
const int INF = 2e9+9;
const int MOD = 1e9+7;

int a[maxN];
int p[maxN];
vector<int> c[maxN];
int costs[maxN], cur[maxN];

int main()
{
	int T;
	scanf("%d",&T);
	int ans = (T-2)*180;
	cout<<ans<<endl; 
	
	return 0;
}

Measured memory_bytes: 256
using System;


class AOJ
{

    public static void Main()
    {
        while (true)
        {

            string s = Console.ReadLine();
            if (s == null) break;

            double v = double.Parse(s);

            double y = Math.Pow(v, 2) / 19.6;

            Console.WriteLine(Math.Ceiling((y + 5) / 5));
        }
    }
}

Measured memory_bytes: 17988
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll N;cin>>N;
    vector<ll> H(N);
    REP(i,N)cin>>H[i];
    if(H[0]>=1)H[0]-=1;
    REPS(i,N-1){
        if(H[i-1]<H[i])H[i]-=1;
    }
    bool OK=true;
    REPS(i,N-1){
        if(H[i-1]<=H[i])continue;
        else{
            //cout<<i<<"\n\n";
            OK=false;
            break;
        }
    }
    //REP(i,N)cout<<H[i]<<" ";
    if(OK)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}

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

#include <bits/stdc++.h>

using namespace std;

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

void d_err() {
    cerr << endl;
}

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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

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

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll a, b, c;
    cin >> a >> b >> c;

    ll t = c - a - b;
    
    if (t > 0 && t * t > 4 * a * b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
class UnionFind{
private:
	vector<int> Parent;
public:
	UnionFind(int N){rep(i,N) Parent.push_back(-1);}
	int root(int A){
		if(Parent[A]<0) return A;
		else return root(Parent[A]);
	}
	int size(int A){return -Parent[root(A)];}
	bool connect(int A,int B);
};

signed main(){
    int N,T;
    cin>>N>>T;
    vector<int> A(N);
    rep(i,N) cin>>A[i];
    int MA=0,MI=1<<28,L=0,count=0;
    for(int i=N-1;i>0;i--){
    	if(A[i]<A[i+1]){
    		 MI=A[i];
    		 if(L==MA-MI) count++;
    		 else if(L<MA-MI){
    		 	L=MA-MI;
    		 	count=1;
    		 }
       	}
    	if(A[i]>MA) MA=A[i];
    }
    if(L==MA-A[0]) count++;
    else if(L<MA-A[0]){
    	L=MA-A[0];
    	count=1;
    }
    cout<<count<<endl;
}

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

int main(){
  int a, b;
  cin>>a>>b;
  int ans;
  if((a+b)%2==0){
    ans=(a+b)/2;
  }
  else{
    ans=(a+b+1)/2;
  }
  cout<<ans<<endl;
}

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

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int s; cin >> s;
    set<int> dict;
    int ans = 1;
    while(dict.find(s) == dict.end()){
        dict.insert(s);
        if(s % 2) s = 3 * s + 1;
        else s /= 2 ;
        ans++;
    }
    cout << ans << "\n";
    return 0;        
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int i,j,k,n,m;
void read(int &x){
	char c;x=0;int b=1;do{c=getchar();if(c==45)b=-1;}while(c>57||c<48);
	do x=x*10+c-48,c=getchar();while(c<=57&&c>=48);x*=b;
}
void read(ll &x){
	char c;x=0;int b=1;do{c=getchar();if(c==45)b=-1;}while(c>57||c<48);
	do x=x*10+c-48,c=getchar();while(c<=57&&c>=48);x*=b;
}
int main() {
	cin>>n>>m;
	if(n>9 || m>9)cout<<-1<<endl;
	else cout<<n*m<<endl;
	//cerr << 1.0*clock()/CLOCKS_PER_SEC << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var k,a,b int
  	fmt.Scan(&k, &a,&b)

  for i := b; i >= a; i-- {
		if i%k == 0 {
          fmt.Println("OK")
          return
		}
	}
  fmt.Println("NG")

}


Measured memory_bytes: 1756
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll;
#define rep(i, a, b) for (int i = a; i <= b; ++ i)
const ll inf = 1000000000000000007LL;
using namespace std;
int n, a[200005];
int main() {
	scanf("%d", &n);
	rep(i, 1, n) scanf("%d", &a[i]);
	sort(a + 1, a + n + 1);
	int tot = 0;
	rep(i, 2, n) tot += (a[i] == a[i - 1]);
	if (tot & 1) printf("%d\n", n - tot - 1);
		else printf("%d\n", n - tot);
	return 0;
}

Measured memory_bytes: 640
#pragma target("avx")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define rep(i,b,e) for(ll i=b; i<e; i++)
#define be(vec) vec.begin(),vec.end()
#define print(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define scan(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int h, w;
	scanf("%d %d", &h, &w);
	rep(i, 0, w+2) putchar('#');
	puts("");
	rep(i, 0, h){
		putchar('#');
		char s[w+1];
		scanf("%s", s);
		printf("%s", s);
		puts("#");
	}
	rep(i, 0, w+2) putchar('#');
	puts("");
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int gcd(int a,int b){
  if(a<b)return gcd(b,a);
  if(b==0)return a;
  return gcd(b,a%b);
}
int main(){
  int n,i,j,k;
  char s[300],c[300];
  scanf("%d\n",&n);
  while(n--){
    fgets(s,257,stdin);//printf("%s",s);
    for(j=1;1;j++){
      if(gcd(26,j)-1)continue;//printf("%d\n",j);
      for(k=0;k<26;k++){
	for(i=0;s[i];i++){
	  if('a'<=s[i]&&s[i]<='z')c[i]=((s[i]-'a')*j+k)%26+'a';
	  else c[i]=s[i];
	}
	c[i]=0;
	if(strstr(c,"this")||strstr(c,"that"))break;
      }
      if(k-26)break;
    }
    printf("%s",c);
  }
  return 0;
}
  

Measured memory_bytes: 612
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define sortv(v) sort(v.begin(),v.end());
#define sorta(a,n) sort(a,a+n);
#define arrayin(a,n) for(int i=0;i<n;i++) cin>>a[i];
#define arrayout(a,n) for(int i=0;i<n;i++) cout<<" ";cout<<"\n";
#define INF INT_MAX //Infinity
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define MOD 1000000007
#define fi first
#define se second
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<pair<int,int>>
#define viii vector<tuple<int,int,int>>
#define mii map<int,int>
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define nl "\n"
ulli poW(lli x,ulli y)
{
	//this function only returns correct values upto the order of ~10^18
	//use pow of math to obtain greater answers
	lli temp;
	if(y==0)
		return 1;
	temp=poW(x,y/2);
	if(y%2==0)
		return temp*temp;
	else return x*temp*temp;
}

int bSearch(int low,int high,int a[],int sh)
{
	//function for searching till where is a sh<=
	while(low<high)
	{
		int mid=low+(high-low+1)/2;
		if(a[mid]>sh)
			high=mid-1;
		if(a[mid]<=sh)
			low=mid;
	}
	return low;
}

int main()
{
    fio;
	int n;
	cin>>n;
	int min=INF;
	int max=-1;
	REP(i,n)
	{
		int x;
		cin>>x;
		if(x>max)
			max=x;
		if (x<min)
			min=x;
	}
	cout<<max-min<<endl;
}

Measured memory_bytes: 256
a= int(input())
b= int(input())

if a==1 and b==2:
    print('3')
elif a==2 and b==1:
    print('3')

elif a==2 and b==3:
    print('1')
elif a==3 and b==2:
    print('1')

elif a==1 and b==3:
    print('2')    
elif a==3 and b==1:
    print('2')

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin>>a>>b;
    for (int i=0;i<b+2;i++){
        cout<<'#';
    }
    cout<<endl;
    for(int i=0;i<a;i++){
        cout<<'#';
        string s;
        cin>>s;
        cout<<s;
        cout<<'#'<<endl;
    }
    for(int i=0;i<b+2;i++){
        cout<<"#";
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <math.h>
 
using namespace std;
 
int main(){
    int n;
    cin >> n;
    double** p = new double*[2];
    for (int i = 0; i < 2; i++)
        p[i] = new double[n];
    for (int i = 0; i < 2; i++)
        for (int j = 0; j < n; j++)
            cin >> p[i][j];
    double a = 0;
    for (int i = 1; i < 4; i++){
        for (int j = 0; j < n; j++)
            a += pow(fabs(p[0][j] - p[1][j]), i);
        cout << fixed << setprecision(8) << pow(a, 1.0 / i) << "\n";
        a = 0;
    }
    double d = 0;
    for (int i = 0; i < n; i++){
        double tmp = fabs(1.0 * p[0][i] - p[1][i]);
        d = d < tmp ? tmp : d;
    }
    cout << d << "\n";
}

Measured memory_bytes: 1356
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
int kaijo(int n){
	int ans=1;
	for(int i=2;i<=n;i++){
		ans*=i;
		ans%=MOD;
	}
	return ans;
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
	return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
}
int p,q,r;
signed main(){
	cin>>p>>q>>r;
	cout<<p+q+r-max({p,q,r})<<endl;
	return 0;
}


Measured memory_bytes: 256
n=gets.to_i
h=gets.split.map(&:to_i)

cnt = 0
prev = h[0]
ans = 0
h[1..-1].each_with_index do |hi, i|
  if prev >= hi
    prev = hi
    cnt += 1
  else
    ans = [ans, cnt].max
    cnt = 0
    prev = hi
  end
end
ans = [ans, cnt].max
p ans

Measured memory_bytes: 11012
#include <iostream>
#include <queue>

int main()
{
    int k;
    std::cin >> k;

    std::queue<long long> que;
    for (long long i = 1; i < 10; ++i) que.push(i);

    while (k > 1)
    {
        long long tmp = que.front();
        long long mod = tmp % 10;
        if (mod % 10 != 0) que.push(tmp * 10 + (mod - 1));
        que.push(tmp * 10 + mod);
        if (mod % 10 != 9) que.push(tmp * 10 + (mod + 1));

        que.pop();
        --k;
    }

    std::cout << que.front() << std::endl;

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>

int main() {
	char ch;
	int ans = 0;
	for (int i = 0; i < 4; i++) {
		std::cin >> ch;
		if (ch == '+') {
			ans++;
		} else {
			ans--;
		}
	}
	std::cout << ans << std::endl;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int N, K;
	cin >> N >> K;

	int ans = 1e9;
	for(int i = 0; i <= N; i++){
		int s = 1;
		for(int j = 0; j < i; j++){
			s *= 2;
		}
		s += K * (N - i);
		ans = min(ans, s);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
/**
 * C - Five Transportations
 * https://atcoder.jp/contests/abc123/tasks/abc123_c
 **/
#include<iostream>
#include<algorithm>

using namespace std;

const int TOWN_NUM = 6;

int main() {
    long N;
    cin >> N;
    long max_cost = 1000000000000001;
    for(int i=0; i<5; i++) {
        long tmp;
        cin >> tmp;
        max_cost = min(max_cost, tmp);
    }
    cout << (long)4 + ((N+max_cost-1)/max_cost) << endl;
    return 0;
}

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

int main(){
  long long X;
  cin >> X;
  
  long long now = 100;
  for(int i=1;;i++){
    now += now/100;
    if(now>=X){
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3600
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

int n, a[200001], b[200001];

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

	LL ans = 0;
	set< LL > index = { -1,n };
	for(int i=1;i<=n;i++){
		auto R = index.upper_bound(b[i]);
		auto L = R; 
		--L;
		index.insert(b[i]);
		ans += ((*R) - b[i]) * (b[i] - (*L)) * i;
	}
	cout << ans << endl;
}

Measured memory_bytes: 11136
n, m, x = map(int, input().split())
a = list(map(int, input().split()))

ans1 = 0
ans2 = 0

for i in range(n + 1):
    if i in a:
        if i < x:
            ans1 += 1
        elif i > x:
            ans2 += 1


if ans1 <= ans2:
    print(ans1)
else:
    print(ans2)


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <vector>
#define N 200005
using namespace std;

int n, cnt, la, mx, h[N], d[N];
vector<int> a[N];
void f(int p, int q) {
	int i, t;
	cnt++;
	h[p] = h[q] + 1;
	if (h[p] > mx){
		mx = h[p];
		la = p;
	}
	for (i = 0; i < a[p].size(); i++) {
		t = a[p][i];
		if (t == q) continue;
		f(t, p);
	}
}

int main()
{
	int i, t1, t2;
	cin >> n;
	for (i = 0; i < n - 1; i++) {
		scanf("%d %d", &t1, &t2);
		a[t1].push_back(t2);
		a[t2].push_back(t1);
	}
	f(1, 0);
	cnt = 0;
	f(la, 0);
	d[0] = 2;
	d[1] = 1;
	d[2] = 2;
	for (i = 3; i <= mx; i++) {
		if (d[i - 2] == 2 || d[i - 1] == 2) d[i] = 1;
		else d[i] = 2;
	}
	cout << (d[mx] == 1 ? "First" : "Second") << endl;
    return 0;
}


Measured memory_bytes: 22144
import java.lang.StringBuilder

fun main(arr:Array<String>) {
    val pointCount = readLine()!!.toInt()
    val points = readLine()!!.split(" ").map { it.toInt() }
    val move = points.indices.map { 0L }.toMutableList()
    move[0] = Math.abs(points[0]).toLong()
    for(i in (1 until pointCount)) {
        move[i] = move[i-1] + Math.abs(points[i-1] - points[i])
    }
    val ans = StringBuilder()
    (0 until pointCount).forEach {
        if(it == 0) {
            ans.appendln(move.last() - move[1] + Math.abs(points[1]) + Math.abs(points.last()) )
        } else if(it == pointCount - 1) {
            ans.appendln(move[move.lastIndex - 1] + Math.abs(points[points.lastIndex - 1]))
        } else {
            ans.appendln(move[it-1] + move.last() - move[it+1] + Math.abs(points[it-1] - points[it+1]) + Math.abs(points.last()))
        }
    }
    print(ans.toString())
}


Measured memory_bytes: 60016
#include<stdio.h>
int main(void){
	int judge=0;
	char S[20]={'\0'};
	char s[20]="2019/04/30";
	scanf("%s",S);
	for(int i=1;i<10;i++){
		if(S[0]<'2' || (S[0]=='2' && S[i]<s[i])){
			printf("Heisei\n");
			return 0;
		}else if(S[0]=='2' && S[i]==s[i]){
			continue;
		}else{
			printf("TBD\n");
			return 0;
		}
	}
	printf("Heisei\n");
	return 0;
}

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


public class Main {
    public static boolean checkPalindrom(String S,int start, int end){
        boolean isPalindrome=true;
        for (int i=start,j=end;i<j;i++,j--){
            if (S.charAt(i)!=S.charAt(j)){
                isPalindrome=false;
                break;
            }
        }
        return isPalindrome;
    }
    public static void main (String[]args)throws IOException {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        int N = S.length();
        boolean isPalindrome1=true;
        boolean isPalindrome2=true;
        boolean isPalindrome3=true;
        isPalindrome1=checkPalindrom(S,0,N-1);
        isPalindrome2=checkPalindrom(S,0,((N-1)/2)-1);
        isPalindrome3=checkPalindrom(S,((((N+3)/2)))-1,N-1);
        System.out.println(isPalindrome1&&isPalindrome2&&isPalindrome3? "Yes":"No");
    }
}


Measured memory_bytes: 21844
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;i--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);i--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;i--)
#define repn0(i,m,n) for(i=(m);i<=(n);++i)
#define repnd0(i,m,n) for(i=(n)-1;i>=(m);i--)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define SS stringstream
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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



int main() {
	int a,b;
	int aa,bb;
	int aaa,bbb;
	IL{
		cin>>a>>b;
		if(a==0&&b==0)break;
		aa=bb=0;
		aaa=bbb=0;
		repn(i,2,a){
			if(a%i==0){
				aa+=aaa;
				aaa=i;
				while(a%i==0){
					a/=i;
				}
			}
		}
		repn(i,2,b){
			if(b%i==0){
				bb+=bbb;
				bbb=i;
				while(b%i==0){
					b/=i;
				}
			}
		}
//debug<<aa<<" "<<aaa<<" "<<bb<<" "<<bbb<<endl;
		if(aaa-aa>bbb-bb)cout<<"a"<<endl;
		else cout<<"b"<<endl;
	}
	return 0;
}

Measured memory_bytes: 860
#include <iostream>
#include <cstring>
#include <cmath> 
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;  
bool a=false,b=false,c=false; 
int main()  
{ 
string s;
cin>>s;
for(int i=0;i<3;i++){
    if(s[i]=='a')a=true;
    if(s[i]=='b')b=true;
    if(s[i]=='c')c=true;
    }
//    if(s[i]=='a'||s[i]=='b'||s[i]=='c')cnt++;}
if(a&b&c)cout<<"Yes"<<endl;
else cout<<"No"<<endl;


    system("pause");
    return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	string s;
	cin >> s;
	for(int i = 0; i < s.length() - 1; i++){
		if(s.at(i) == 'A' && s.at(i+1) == 'C'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}

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

using ll = long long;
const int INF = 1e9+7;

void solve()
{
	string s;cin >> s;
	string t;cin >> t;
	int count = 0;
	for(int i= 0;i<(int) s.length();++i)
	{
		if(s[i]!=t[i])
			count++;
	}
	cout << count << '\n';

}

int main()
{
	int t=1;
	//int t;cin >> t;
	while(t--) solve();
}	


Measured memory_bytes: 3916
#include "bits/stdc++.h"
#pragma warning(disable:4996)
using namespace std;
const int N = 1e5 + 5;
int arr[N];
int dp[N];
int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
	}
	dp[0] = 0;
	dp[1] = abs(arr[0] - arr[1]);
	for(int i = 2; i < n;i++){
		dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp[i - 2] + abs(arr[i] - arr[i - 2]));
	}
	
	cout << dp[n - 1];
}

Measured memory_bytes: 1024
n,m = map(int, input().split())
a = []
b = []

for i in range(n):
    a.append(input())
for j in range(m):
    b.append(input())

# 考え：同じ文字列の並びがあるか各行、各列で見る
# 方針：画像の左上から各行ごとに先頭からAとBの文字列を比較していきマッチするかどうかを調べる

"""ボツ案
a_pix = []
b_pix = []
a_temp = []
b_temp = []

judge = ''

for i in a:
    for i_pix in i:
        a_temp.append(i_pix)
    a_pix.append(a_temp)
    a_temp = []

for j in b:
    for j_pix in j:
        b_temp.append(j_pix)
    b_pix.append(b_temp)
    b_temp = []

# print(a_pix)
# print(b_pix)
"""

for i in range(n-m+1):
    for j in range(n-m+1):


        judge = 'Yes'
        for k in range(m):
            for l in range(m):
                # 横にずらして文字列を比較
                if a[i+k][j+l] != b[k][l]:
                    judge = 'No'

        if judge == 'Yes':
            print('Yes')
            exit()

print('No')

Measured memory_bytes: 9012
import sys


def solve(inp):
    (N, M) = map(int, inp.readline().split(' '))
    AB = [list(map(int, inp.readline().split(' '))) for i in range(M)]

    roads = [0 for i in range(N)]
    for ab in AB:
        roads[ab[0] - 1] += 1
        roads[ab[1] - 1] += 1

    for i in range(N):
        print(roads[i])

    return ""


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int y[4] = { 1867,1911,1925,1988 };
char c[4] = { 'M','T','S','H' };
int main() {
	int k, x;
	cin >> k >> x;
	if (k == 0) {
		for (int i = 3; i >= 0; i--) if (x - y[i] > 0) {
			cout << c[i] << x - y[i] << endl;
			return 0;
		}
	}
	else {
		k--;
		cout << y[k] + x << endl;
	}
	return 0;
}


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

int main(){
  string s;
  cin >> s;
  int n = (int)s.length();
  int ary[n];
  for(int i=0;i<n-2;++i) ary[i]=stoi(s.substr(i,3));
//  for(int i=0;i<n-2;++i) cout << ary[i] << endl;
  int ans=753;
  for(int i=0;i<n-2;++i){
    if(ans > abs(753-ary[i])) ans = abs(753-ary[i]);
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cctype>
using namespace std;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 1e2+5;
int n, c[N], p, q, h, ans = 1;
int main()
{
    n = read(), p = n-1, q = 0;
    for(int i = 1; i <= n; ++i) 
    {
        int d = read(); ++c[d];
        p = min(d, p); q = max(d, q);
    }
    if(c[q] == 1||(c[p] != 1&&!(q&1))||(c[p] != 2&&(q&1))) ans = 0;
    if(p != (q-1)/2+1) ans = 0;
    for(int i = p+1; i < q; ++i) if(c[i] <= 1) ans = 0;
    puts(ans?"Possible":"Impossible");
    return 0;
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    W,H,x,y = mi()

    ans = '{:.10f}'.format(W*H/2)
    ans2 = 1 if x==W/2 and y==H/2 else 0
    print(ans,ans2)
    




if __name__ == "__main__":
    main()

Measured memory_bytes: 62008
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n; cin >> n;
  string s; cin >> s;
  if(n%2==0 && s.substr(0, n/2) == s.substr(n/2, n/2)) cout << "Yes";
  else cout << "No";
  cout << "\n";
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace CompetitiveProgCsLib
{
	public static class MainProg
	{
		static string R => Console.ReadLine();
		static int RI => int.Parse(R);
		static double RD => double.Parse(R);
		static int[] RIs => R.Split(' ').Select(int.Parse).ToArray();
		static double[] RDs => R.Split(' ').Select(double.Parse).ToArray();
		static void Out(object obj) => Console.WriteLine(obj);
		static void OutLine<T>(IEnumerable<T> obj, string separateChar) => Out(String.Join(separateChar, obj));
		static void Outb(bool b) => Out(b ? "Yes" : "No");
		static void OutB(bool b) => Out(b ? "YES" : "NO");
		static bool IsIn(int y, int x, int h, int w) => 0 <= x && x < w && 0 <= y && y < h;
		static T MIN<T>(params T[] args) => args.Min();
		static T MAX<T>(params T[] args) => args.Max();
		
		public static void Main(string[] args)
		{
			var n = RI;
			var s = R;
			int count = 0;
			var stack = new Stack<char>();
			for(int i = 0;i < s.Length;i++)
			{
				if (s[i] == '#') stack.Push('#');
				else if(s[i] == '.')
				{
					if(stack.Count != 0)
					{
						stack.Pop();
						count++;
					}
				}
			}
			Out(count);
		}
	}
}

Measured memory_bytes: 12768
#include<stdio.h>
int main()
{

    for(;;){
            int h,w,x,y;
       scanf("%d %d",&h,&w);
       if(h == 0 & w == 0){
        return 0;
       }
            for(y = 0; y < h; y++){
            for(x = 0; x < w; x++){
                printf("#");
            }
        printf("\n");

       }
    printf("\n");
    }
    return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
#include<chrono>
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define mt make_tuple
#define tc  ll t; cin>>t; while(t--)
#define io ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define F first
#define S second
#define vi vector<ll>
#define pii pair<ll,ll>
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define vii vector<pair<ll,ll>>
ll gcd(ll n,ll m)
{
    if(n==0)
            return m;
    return gcd(m%n,n);
}
bool ifprime(ll n)
{
if(n==1)
return false;
    ll i;
for(i=2;i*i<=n;i++)
{
if(n%i==0)
return false;
 
}
return true;
}
void disp(vi v)
{
    for(auto u:v)
    cout<<u<<" ";
    cout<<"\n";
}
void remleadzero(vector<int> &v)
{
    vector<int> u;
    int i=0;
    while(v[i]==0)
        i++;
    while(i<v.size())
    {
        u.push_back(v[i]);
        i++;
    }
    v=u;
}
#define mod 1000000007LL
/*
void myscanf(long long *n)
{
    register long long c=getchar_unlocked();
    *n=0;
    for(;(c<48 ||c>57);c=getchar_unlocked())
        ;
    for(;(c>47 && c<58);c=getchar_unlocked())
    {
        *n=(*n<<1)+(*n<<3)+(c&15);
    }
 
}
void fastscan(long long &number)
{
    bool negative = false;
    register long long c;
 
    number = 0;
 
    c = getchar_unlocked();
    if (c=='-')
    {
 
        negative = true;
 
        c = getchar_unlocked();
    }
 
 
    for (; (c>47 && c<58); c=getchar_unlocked())
        number = number *10 + c - 48;
 
 
    if (negative)
        number *= -1;
}
*/
ll fast_expo(ll n,ll m, ll md)
{
    ll a=1;
    while(m>0)
    {
        if(m&1) a=(a*n)%md;
        n=(n*n)%md;
        m/=2;
    }
    return a%md;
}
long long sqroot(long long n){
    long double N = n;
    N = sqrtl(N);
    long long sq = N-2;
    sq = max(sq,0LL);
    while(sq*sq<n){
        sq++;
    } 
    if((sq*sq)==n)
        return sq;
    return -1;
}

int main()
{
    io;
    ll h,n;
    cin>>h>>n;
    ll s=0;
    ll a[n];
    for(auto &u:a){cin>>u;s+=u;}
    if(s>=h)
        cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  long double ans=0.0;
  int n;
  cin>>n;
  vector<long double> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    ans+=1.0/a[i];
  }
  cout<<1.0/ans<<endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/
#include <bits/stdc++.h>
using namespace std;

long long GCD(long long x, long long y) {
    if (y == 0) return x;
    return GCD(y, x%y);
}

int main() {
    int N;
    long long K;
    cin >> N >> K;
    long long ma = 0, g = 0;
    for (int i = 0; i < N; ++i) {
        long long a; cin >> a;
        ma = max(ma, a);
        g = GCD(g, a);
    }
    if (K <= ma && K % g == 0) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

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

int main() {
	int R;
    cin >> R;
    if(R<1200){
      cout << "ABC" << endl;
    }
    else if(R<2800){
      cout << "ARC" << endl;
    }
    else{
      cout << "AGC" << endl;
    }
}


Measured memory_bytes: 256
#include"iostream"

using namespace std;

int main()
{
	int n;
	int a[100000];
	cin >> n;
	int m;
	int atc=0;
	int end = 1;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int min = 1000000000;
	while (end) {
		for (int i = 0; i < n; i++) {
			if ((min > a[i]) && (a[i] != 0)) {
				min = a[i];
				m = i;
			}
		}
		for (int i = 0; i < n; i++) {
			if (i != m) {
				a[i] = a[i] % min;
				
				if (a[i] == 0&&n>1) {
					n -= 1;

					if (n == 1) {
						atc = m;
						cout <<  a[atc] << endl;
						end = 0;
					}
				}
			}
		}

	}
}

Measured memory_bytes: 640
type bs_tree = Nil | Node of node and
     node = {
         key:int;
         mutable left:bs_tree;
         mutable right:bs_tree
       };;

let new_node key = {key=key;left=Nil;right=Nil};;

let insert t z =
  let rec loop y = function
      Nil -> y
    | Node x ->
       if z.key < x.key then
         loop (Node x) (x.left)
       else
         loop (Node x) (x.right)
  in
  let y = loop t t in
  match y with
    Nil -> (Node z)
  | Node y ->
     if z.key < y.key then
       y.left <- (Node z)
     else
       y.right <- (Node z)
    ;t
;;

let rec print_in = function
    Nil -> ()
  | Node x ->
     print_in (x.left);
     Printf.printf " %d" x.key;
     print_in (x.right)
;;

let rec print_pre = function
    Nil -> ()
  | Node x ->
     Printf.printf " %d" x.key;
     print_pre (x.left);print_pre (x.right)
;;

let () =
  let n = read_int () in
  let rec read t = function
      0 -> ()
    | i ->
       let com = Scanf.scanf "%s" (fun x -> x) in
       if com = "insert" then begin
           let arg = Scanf.scanf " %d\n" (fun x -> x) in
           let z = new_node arg in
           read (insert t z) (i-1)
         end
       else if com = "print" then begin
           let _ = Scanf.scanf "%s\n" (fun x -> x) in
           print_in t;print_newline ();
           print_pre t;print_newline ();
           read t (i-1)
         end
       else ()
  in read Nil n
;;

Measured memory_bytes: 28328