akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
 
long long Merge(int A[],int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int i,j,k;
  int L[n1+1],R[n2+1];
  long long res=0;
  for(i=0;i<n1;i++)L[i]=A[left+i];
  for(i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=1000000001;
  R[n2]=1000000001;
   
  i=j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }else{
      A[k]=R[j];
      j++;
      res+= (long long)n1- (long long)i;
    }
  }
  return res;
}
 
long long Merge_Sort(int A[],int left,int right){
  int mid;
  long long res=0;
  if(left+1<right){
    mid=(left+right)/2;
 
    res+=Merge_Sort(A,left,mid);
    res+=Merge_Sort(A,mid,right);
    res+=Merge(A,left,mid,right);
     
  }
  return res;
}
 
int main(){
  int i,n,S[200000];
  long long x;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&S[i]);
 
  x=Merge_Sort(S,0,n);
  printf("%ld\n",x);
  return 0;
}




Measured memory_bytes: 3412
function Main(input) {
    input = input.split(" ");
    var N = input[0];
    var D = input[1];
    var c2 = 0; 
    while (N > 0){
        N = N - (D * 2 + 1)
        c2++
    }
    console.log(c2)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define int long long
using std::map;
const int MAXN=200005;
int n,i,ans,a[MAXN];
map<int,int> m;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
    	if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
inline void print(int x)
{
    if (x<0)
        putchar('-'),x=-x;
    if (x>9)
        print(x/10);
    putchar(x%10+'0');
}
signed main(void)
{
	read(n);
	for (i=1;i<=n;i++)
		read(a[i]);
	for (i=1;i<=n;i++)
	{
		ans+=m[i-a[i]];
		m[a[i]+i]++;
	}
	print(ans);
	return 0;
} 

Measured memory_bytes: 27876
#include <stdio.h>

int main(){
    int s;scanf("%d",&s);
    int i=1;
    while(1){
        if(s==1||s==2||s==4) break;
        else{
            s=(s%2)?3*s+1:s/2;
        }   
        i++;
    }   
    printf("%d",i+3);
    return 0;
}  

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

template <typename T>
struct BIT {
  std::vector<T> dat[2];

  BIT(int n) { init(n); }
  void init(int n) {
    dat[0].assign(n + 1, 0);
    dat[1].assign(n + 1, 0);
  }

  inline void sub_add(int p, int a, T x) {
    for (int i = a, n = dat[p].size(); i < n; i += i & -i)
      dat[p][i] = dat[p][i] + x;
  }

  inline void add(int a, int b, T x) {
    sub_add(0, a, x * -(a - 1));
    sub_add(1, a, x);
    sub_add(0, b, x * (b - 1));
    sub_add(1, b, -x);
  }

  inline T sub_sum(int p, int a) {
    T ret{};
    for (int i = a; i > 0; i -= i & -i) {
      ret += dat[p][i];
    }
    return ret;
  }

  // partial sum of [from,to) (1-origin).
  inline T sum(int from, int to) {
    return sub_sum(0, to - 1) + sub_sum(1, to - 1) * (to - 1) -
           sub_sum(0, from - 1) - sub_sum(1, from - 1) * (from - 1);
  }
};

#define ALL(x) begin(x), end(x)

int main() {
  ll N, D, A;
  cin >> N >> D >> A;
  vector<pair<ll, ll>> X;
  X.reserve(N);
  for (int i = 0; i != N; ++i) {
    ll x;
    ll h;
    cin >> x >> h;
    X.emplace_back(x, h);
  }

  sort(ALL(X));
  BIT<ll> bit(N + 2);
  for (auto i = 0; i != N; ++i) {
    bit.add(i + 1, i + 2, X[i].second);
  }

  ll cnt{};
  for (auto i = 0; i != N; ++i) {
    auto hp = bit.sum(i + 1, i + 2);
    if (hp <= 0) continue;
    const ll nhits = (hp - 1) / A + 1;
    auto bound =
        upper_bound(ALL(X), X[i].first + 2 * D,
                    [](ll a, pair<ll, ll> &b) { return a < b.first; }) -
        X.begin();
    bit.add(i + 1, bound+1, -nhits * A); // bit is 1-origin
    cnt += nhits;
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 6528
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        string input = ReadLine();

        int count = 0;

        int currentCount = 0;
        bool IsStarted = false;

        for (int i = 0; i < input.Length; i++)
        {
            if (Check(input[i]))
            {
                if (!IsStarted)
                {
                    IsStarted = true;
                    ++currentCount;
                }
                else
                {
                    ++currentCount;
                }
            }
            else
            {
                if (IsStarted)
                {
                    if (count < currentCount)
                    {
                        count = currentCount;
                    }
                    IsStarted = false;
                    currentCount = 0;
                }
            }
        }

        if (IsStarted)
        {
            if (count < currentCount)
            {
                count = currentCount;
            }
        }

        WriteLine(count);
        ReadKey();
    }

    static bool Check(char c)
    {
        if (c == 'A' || c == 'C' || c == 'G' || c == 'T')
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}

static class MyUtil
{
    public static int[] ReadIntArray()
    {
        return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    }

    /// <summary>
    /// <see cref="IEnumerable{T}"/>の各要素を並べてコンソールに出力します。各要素の間には半角スペースが一つ入ります。
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="ts"></param>
    public static void WriteToConsole<T>(this IEnumerable<T> ts)
    {
        StringBuilder stringBuilder = new StringBuilder();
        foreach (T t in ts)
        {
            stringBuilder.Append(t.ToString());
            stringBuilder.Append(" ");
        }
        stringBuilder.Remove(stringBuilder.Length - 1, 1);
        Console.WriteLine(stringBuilder.ToString());
    }
}


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

#define ll long long
#define ull unsigned ll

#define vi vector <int>
#define ii pair <int, int>
#define vii vector <ii>
#define vll vector <ll>
#define vull vector <ull>
#define INFL 9e18
#define INF 2e9
#define EPS 1e-9
#define pb push_back
#define emp emplace_back
#define PI acos(-1.0)
#define endl "\n"
#define mp make_pair
#define DEBUG 0

int main ()

{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    double r;
    cin >> r;
    
    cout << 2*PI*r << endl;
    
    return 0;
}

Measured memory_bytes: 3804
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
int main(){
	int n,a,ans=0;
	while(cin >> n){
		rep(i,10){
			rep(j,10){
				rep(k,10){
					a=n-i-j-k;
					if(a>=0 && a<10){
						ans++;
					}
				}
			}
		}
		cout << ans << endl;
		ans = 0;
	}
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

ll h, w;
ll d[51][51];
string s[51];
void dfs(ll i, ll j) {
	if (s[i][j] == '.') {
		// down
		if (i + 1 < h && s[i + 1][j] == '.') {
			if (d[i + 1][j] > d[i][j] + 1) {
				d[i + 1][j] = d[i][j] + 1;
				dfs(i + 1, j);
			}
		}
		// up
		if (i - 1 >= 0 && s[i - 1][j] == '.') {
			if (d[i - 1][j] > d[i][j] + 1) {
				d[i - 1][j] = d[i][j] + 1;
				dfs(i - 1, j);
			}
		}
		// right
		if (j + 1 < w && s[i][j + 1] == '.') {
			if (d[i][j + 1] > d[i][j] + 1) {
				d[i][j + 1] = d[i][j] + 1;
				dfs(i, j + 1);
			}
		}
		// left
		if (j - 1 >= 0 && s[i][j - 1] == '.') {
			if (d[i][j - 1] > d[i][j] + 1) {
				d[i][j - 1] = d[i][j] + 1;
				dfs(i, j - 1);
			}
		}
	}
}

void solve_abc088() {
	ll ans = 0;

	cin >> h >> w;

	ll b = 0;
	rep(i, h) {
		cin >> s[i];
		rep(j, s[i].size()) {
			if (s[i][j] == '#') b++;
		}
	}

	rep(i, 51)rep(j, 51) d[i][j] = INF;
	d[0][0] = 0;

	dfs(0, 0);

	if (d[h - 1][w - 1] == INF) {
		ans = -1;
	}
	else {
		ans = h * w - (d[h - 1][w - 1] + 1) - b;
	}

	cout << ans << "\n";
}

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

	solve_abc088();

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl

const ll INF=1e11+7;
const ll N = 10001;
ll n,a[N],ans=0;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	vector <ll> v;
	FOR(i,0,n){
		ll k;
		cin>>k;
		v.pb(k);
	}
	a[0]=1;
	FOR(j,0,n){
		FOR(i,0,N){
			ll k=N-1-i;
			if(a[k]==1){
				a[k+v[j]]=1;
				if((k+v[j]>ans)&&(k+v[j])%10!=0)ans=(k+v[j]);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
N, M =map(int, input().split())
H=list(map(int, input().split()))

A=[True]*N

for i in range(M):
	a, b = map(int, input().split())

	if H[a-1]>H[b-1]:
		A[b-1]=False
	elif H[a-1]==H[b-1]:
		A[a-1]=False
		A[b-1]=False
	elif H[a-1]<H[b-1]:
		A[a-1]=False

print(sum(A))




Measured memory_bytes: 86324
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////

int main() {
	ll x, ans = 1;
	rd(x);

	for (ll i = 2; i*i <= x; i++) {
		ll t = i;
		while (1) {
			if (t*i <= x) {
				t *= i;
				ans = max(ans, t);
			}
			else break;
		}
	}

	wrln(ans);

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast","unroll-loops")
#pragma GCC push_options
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cdouble;
// typedef mp::cpp_int cint;
template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
template<typename T>using pqueue =__gnu_pbds::priority_queue<T, greater<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
#define MOD 1000000007LL
//#define MOD 998244353LL
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(lint i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(lint i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(lint i=0;i<lint(n);++i)
#define repi(i,a,b) for(lint i=lint(a);i<(lint)(b);++i)
#define rrep(i,n) for(lint i=lint(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(lint i=lint(b)-1;i>=lint(a);--i)
#define irep(i) for(lint i=0;;++i)
#define all(n) begin(n),end(n)
#define dist(a,b,c,d) sqrt(pow(a-c,2)+pow(b-d,2))
inline lint gcd(lint A,lint B){return B?gcd(B,A%B):A;}
inline lint lcm(lint A,lint B){return A/gcd(A,B)*B;}
// inline cint cgcd(cint A,cint B){return B?cgcd(B,A%B):A;}
// inline cint clcm(cint A,cint B){return A/cgcd(A,B)*B;}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={1,0,-1,0,1,1,-1,-1};
const vector<lint> dy={0,1,0,-1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[&](auto f,auto... args){return f(f,args...);};

int main(){
    lint a,b,x;
    cin>>a>>b>>x;
    if(a==0){
        cout<<b/x+1<<endl;
    }else{
        cout<<b/x-(a-1)/x<<endl;
    }
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("unswitch-loops")
#pragma GCC optimize("fast-math")

#pragma GCC target("sse2")
#pragma GCC target("sse3")
#pragma GCC target("ssse3")
#pragma GCC target("sse4.1")
#pragma GCC target("sse4.2")
#pragma GCC target("avx")
#pragma GCC target("popcnt")
#pragma GCC target("abm")
#pragma GCC target("mmx")
#pragma GCC target("tune=native")
#include <iostream>
#include <vector>
#define int long long
using namespace std;
int mod = 1e9 + 7;
int powp(int a, int p) {
	if (p == 0)
		return 1;
	else if (p & 1)
		return powp(a, p - 1) * a % mod;
	else {
		int ans = powp(a, p >> 1);
		return ans * ans % mod;
	}
}
int f(int x) {
	int ans = 0;
	while (x) {
		++ans;
		x /= 10;
	}
	return ans;
}
int len(int l, int r) {
	return max(0ll, r - l + 1);
}
signed main() {
	int s;
	cin >> s;
	int sum = 0;
	int r = 0;
	int ans = 0;
	int lenl = 0;
	int lenr = 0;
	int powl = 1;
	int powr = 1;
	for (int l = 1; l < (int)1e7; ++l)  {
		sum -= f(l - 1);
		while (sum < s) {
			++r;
			if (r == powr) {
				++lenr;
				powr *= 10;
			}
			sum += f(r);
		}
		if (sum == s)
			++ans;
		if (l == powl) {
			++lenl;
			powl *= 10;
		}
		
	}

	for (int n = 8; n <= s / 2; ++n) {
		// n * a + (n + 1) * b = S
		// a = -S
		// b = S
		// a' = -S + (n + 1) * k
		// b' = S - n * k
		//
		// a' > 0
		// -S + (n + 1) * k > 0
		// S < (n + 1) * k
		//
		// b' > 0
		// S - n * k > 0
		// S > n * k
		//

		int l = s / (n + 1) + 1;
		int r = (s - 1) / n;

		ans = (ans + r - l + 1);
		if (ans >= mod)
			ans -= mod;
	}
	//cout.precision(40);
	//cout << (double)clock() / CLOCKS_PER_SEC << endl;
	vector<int> divs;
	for (int n = 1; n * n <= s; ++n) {
		if (s % n == 0) {
			if (n >= 8)
				divs.push_back(n);
			if (s / n >= 8)
				divs.push_back(s / n);
			if (n * n == s && n >= 8)
				divs.pop_back();
		}
	}
	for (int n : divs) {
		if (s % n == 0) {
			int cnt = powp(10, n - 1) * 9 % mod;
			int l = s / n;
			ans = (ans + cnt - l + 1);
			if (ans < 0)
				ans += mod;
			if (ans >= mod)
				ans -= mod;
		}
	}
	//cout << (double)clock() / CLOCKS_PER_SEC << endl;
	cout << ans;
	return 0;
}

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


int main(){

  int a,b;
  cin >> a >> b;

  if( a < b ){
    cout << "a < b" << endl;;
  }
  if( a > b ){
    cout << "a > b" << endl;;  
  }
  if(a == b){
    cout << "a == b" << endl;;
  }

}

Measured memory_bytes: 1156
#include <stdio.h>
#include <stdlib.h>

int **A, *H;

void insert(int t, int x)
{
  int tmp;
  A[t][H[t]] = x;
  H[t]++;
  int i=H[t]-1;
  int parent = (i-1)/2;

  if (H[t]<1) return;
  while (parent>=0 && A[t][parent]<A[t][i]) {
    tmp = A[t][parent];
    A[t][parent] = A[t][i];
    A[t][i] = tmp;
    tmp = i;
    i = parent;
    parent = (i-1)/2;
  }
}

void maxHeapify(int t, int i) {
  int largest, tmp;
  int l = (i+1)*2-1;
  int r = (i+1)*2;
  if (l < H[t] && A[t][l] > A[t][i]) {
    largest = l;
  } else {
    largest = i;
  }
  if (r < H[t] && A[t][r] > A[t][largest])
    largest = r;

  if (largest != i) {
    tmp = A[t][i];
    A[t][i] =  A[t][largest];
    A[t][largest] = tmp;
    maxHeapify(t, largest);
  }
}

int deleteMax(int t)
{
  if (H[t]<0) return -1;
  int val = A[t][0];
  A[t][0]=A[t][H[t]-1];
  maxHeapify(t, 0);
  H[t]--;
  return val;
}


int main() {
  int i,  n, q, nq, t, x;
  fscanf(stdin, "%d %d", &n, &nq);
  A = (int**)malloc(sizeof(int*)*n);
  H = (int*)malloc(sizeof(int)*nq);
  for (i=0; i<n; i++) {
    A[i] = (int*)malloc(sizeof(int)*nq);
    H[i]=0;
  }

  for (i=0; i<nq; i++) {
    fscanf(stdin, "%d %d", &q, &t);
    switch (q) {
    case 0:
      fscanf(stdin, "%d", &x);
      insert(t, x);
      break;
    case 1:
      if (H[t]>0)
	printf("%d\n", A[t][0]);
      break;
    case 2:
      if (H[t]>0)
	deleteMax(t);
    }
  }
  return 0;
}



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

using namespace std;
using ll = long long;

// GCD(最大公約数)
ll GCD(ll a, ll b){ return (b == 0) ? a : GCD(b, a%b); }

// LCM(最小公倍数)
ll LCM(ll a, ll b){ return a / GCD(a, b) * b; }

int main() {
	ll a, b, c, d;
	ll ac, bc, lcm;
	
	cin >> a >> b >> c >> d;
	--a;
	lcm = LCM(c, d);
	ac = (ll)(a/c) - (ll)(a/lcm) + (ll)(a/d);
	bc = (ll)(b/c) - (ll)(b/lcm) + (ll)(b/d);
	
	cout << b - a - (bc - ac) << '\n';
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

long long int lucas(int n) {
  vector<long long int> dp(n + 1);
  dp[0] = 2;
  dp[1] = 1;
  for (int i = 2; i <= n; ++i) {
    dp[i] = dp[i - 1] + dp[i - 2];
  }
  return dp[n];
}

int main() {
  int n; cin >> n;
  printf("%lld\n", lucas(n));
  return 0;
}

Measured memory_bytes: 256
N = int(input())
Llist = [int(x) for x in input().split()]
sortedList = sorted(Llist, reverse=True)
sumL = 0
for i,x in enumerate(sortedList):
    if i == 0:
        continue
    sumL = sumL + x
if sortedList[0] < sumL:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,m,ans;

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n >> m;
	if(n == 1)
		ans += 300000;
	else if(n==2)
		ans += 200000;
	else if(n==3)
		ans += 100000;
	if(m == 1)
		ans += 300000;
	else if(m==2)
		ans += 200000;
	else if(m==3)
		ans += 100000;
 
	if(n == 1 && m == 1) ans += 400000;

	cout << ans << endl;


}

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

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<int>> mat(h);
    rep(i,h){
        string s;
        cin >> s;
        rep(j,s.size()){
            if(s.at(j) == '.') mat.at(i).push_back(1);
            else mat.at(i).push_back(0);
        }
    }

    vector<vector<int>> hs(h),vd(h);
    rep(i,h){
        vector<int> v1(w), v2(w);
        hs.at(i) = v1;
        vd.at(i) = v2;
    }

    rep(i,h){
        int j = 0;
        int st_idx = 0;
        int lcnt = 0;
        while(j<w){
            if(mat.at(i).at(j) == 0){
                for(int k =st_idx;k<j;k++){
                    hs.at(i).at(k) = lcnt;
                }
                lcnt = 0;
                st_idx = j+1;
            }
            else {
                lcnt++;
            }
            j++;
        }
        for(int k =st_idx;k<j;k++){
            hs.at(i).at(k) = lcnt;
        }
    }
    rep(i,w){
        int j = 0;
        int st_idx = 0;
        int lcnt = 0;
        while(j<h){
            if(mat.at(j).at(i) == 0){
                for(int k =st_idx;k<j;k++){
                    vd.at(k).at(i) = lcnt;
                }
                lcnt = 0;
                st_idx = j+1;
            }
            else {
                lcnt++;
            }
            j++;
        }
        for(int k =st_idx;k<j;k++){
            vd.at(k).at(i) = lcnt;
        }
    }
    // rep(i,h){
    //     rep(j,w){
    //         cout << hs.at(i).at(j) << " ";
    //     }
    //     cout << endl;
    // }
    // cout << endl;
    // rep(i,h){
    //     rep(j,w){
    //         cout << vd.at(i).at(j) << " ";
    //     }
    //     cout << endl;
    // }

    int res = 0;
    rep(i,h){
        rep(j,w){
            res = max(res, vd.at(i).at(j) + hs.at(i).at(j) - 1);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 47744
package main

import "fmt"

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	ans := 0
	for i := 1; i <= n; i++ {
		v := i
		s := 0
		for v > 0 {
			s += v % 10
			v /= 10
		}
		if s >= a && s <= b {
			ans += i
		}
	}
	fmt.Println(ans)
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << endl
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n,m;
    cin >> n >> m;
    vector<vector<int32>> s(n);
    REP(i,m){
        int32 k;
        cin >> k;
        REP(j,k){
            int32 tmp;
            cin >> tmp;
            tmp--;
            s[tmp].pb(i);
        }
    }
    vector<int32> p(m);
    REP(i,m)cin >> p[i];
    int32 ans = 0;
    for(int32 mask = 0; mask < (1 << n); mask++){
        vector<int32> cnt(m,0);
        REP(i,n){
            if(mask & (1 << i)){
                REP(j,s[i].size()){
                    cnt[s[i][j]]++;
                }
            }
        }
        bool flg = true;
        REP(i,m){
            if(cnt[i] % 2 != p[i]){
                flg = false;
                break;
            }
        }
        if(flg)ans++;
    }
    ANS(ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    string z;
    cin>>z;
    
    if(z=="Sunny"){
        cout<<"Cloudy\n";
    }
    else if(z=="Cloudy"){
        cout<<"Rainy\n";
    }
    else if(z=="Rainy"){
        cout<<"Sunny\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int a,b;
	while(cin>>a>>b,a+b){
		double out=inf;
		rep(i,a){
			int x=i,y=a-x;
			double t=abs(hypot(x,y)-b);
			if(out>t)out=t;
		}
		cout<<shosu(9)<<out<<endl;
	}
}

Measured memory_bytes: 1248
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
total = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      total = 500*a + 100*b +50*c
      if total == X:
        count += 1
print(count)

Measured memory_bytes: 3064
bilding = [[[0 for x in range(10)] for x in range(3)]for x in range(4)] 
n = int(input())
for k in range(n):
    b, f, r, v = map(int, raw_input().split())
    bilding[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        print(" "+" ".join(map(str, bilding[b][f])))
    if b < 3:
        print("#"*20)

Measured memory_bytes: 6424
import java.util.Scanner;

public class Main {
	static long sum = 0;
	static String S;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		sc.close();
		int l = S.length();
		int[]bit = new int[l - 1];
		bitRec(0, l - 1, bit);
		System.out.println(sum);

	}
	static void bitRec(int k, int n, int[]bit) {
		if(k == n) {
			long t = 0;
			int id = 0;
			for(int i = 0; i <= n; i++) {
				if(i == n) {
					t += Long.parseLong(S.substring(id, n + 1));
					break;
				}
				if(bit[i] == 1) {
					t += Long.parseLong(S.substring(id, i + 1));
					id = i + 1;
				}
			}
			sum += t;
			return;
		}
		bitRec(k + 1, n, bit);
		bit[k] = 1;
		bitRec(k + 1, n, bit);
		bit[k] = 0;
	}
}


Measured memory_bytes: 21840
# =map(int,input().split())
S=input()
count=0
for i in range(len(S)):
    if i % 2== 0:#奇数の時
        if S[i]=="R" or S[i]=="U" or S[i]=="D":
            count+=0
        else:
            count+=1
    else:
        if S[i]=="L" or S[i]=="U" or S[i]=="D":
            count+=0
        else:
            count+=1
           
if count==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
/* Coached by rainboy */
#include <stdio.h>

#define A 100000

int main() {
	static char used[A + 1];
	int n, k;

	scanf("%d", &n);
	k = 0;
	while (n--) {
		int a;

		scanf("%d", &a);
		if (!used[a]) {
			k++;
			used[a] = 1;
		}
	}
	printf("%d\n", k % 2 == 0 ? k - 1 : k);
	return 0;
}

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

int main() {
    string s;
    cin >> s;

    bool a = true;
    for (int i = 0; i < s.size()-1; i++) {
        if (s[i] == s[i+1]) a = false;
    }
    if(a) cout << "Good" << endl;
    else cout << "Bad" << endl;
    
    return 0;
}

Measured memory_bytes: 3648
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
c = Counter(s)
key = ['AC', 'WA', 'TLE', 'RE']
for i in key:
    for j, k in c.items():
        if i==j:
            print(i, 'x', k)
            break
    else:
        print(i, 'x', 0)

Measured memory_bytes: 16536
import numpy as np

def Rally(n, array):
    min_ = max(np.array(array)*10**7)
    for i in range(1,max(np.array(array)+1)):
        if min_ > sum((np.array(array)-i)**2):
            min_ = sum((np.array(array)-i)**2)
    return min_

n = int(input())
array = list(map(int,input().split()))
print(Rally(n, array))

Measured memory_bytes: 27016
// RK's Template
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long int ll;
typedef long double ld; 
typedef unsigned long long ull;

int main(){
	int n;
	int k=0; 
	cin >> n;
	int ar[n];
	for(int i=0; i<n; i++){
		cin >> ar[i];
	}
	while(true){
		for(int i=0; i<n; i++){
			if(ar[i] % 2 == 0){
				ar[i] = ar[i] / 2; 
				k++; 
			}else{
				cout << round(k/n) << endl;
				return 0;
			}
		}
	}
	cout << k/n<< endl;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc061/tasks/abc061_a
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a <= c && c <= b ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.next();
        char[] c = str.toCharArray();
        
        // WRWWRWRR
        // WRが一つもないまでの最小回数
        
        // 操作1: 任意のi, jを入れ替え
        // 操作2: iを選んで色反転
        
        // WRRRRR Wを買えるのがいい
        // WWWWRR Rをかえるのがいい
        
        // WRがないとは？
        // RRRRWWWWWWWWということ
        // Rが0個以上Wが0個以上
        
        // WRWWRWRR ans=3
        // ぶつかるまで左はじ右端からWRを数えたらOK？
        
        int l = 0;
        int r = n-1;
        int count = 0;
        while (true) {
            if (l == r) break;
            if (l > r) break;
            
            while (c[l] != 'W') {
                l++;
                if (l == n-1) break;
            }
            
            while (c[r] != 'R') {
                r--;
                if (r == 0) break;
            }
            
            // System.out.println(l + " " + r);
            
            if (l < r) {
                count++;
                l++;
                r--;
            } else {
                break;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 40868
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.C_Challenge
{
    class ABC_084
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            var cs = new int[n - 1];
            var ss = new int[n - 1];
            var fs = new int[n - 1];
            for (int i = 0; i < n - 1; i++)
            {
                int[] input = ReadInts();
                cs[i] = input[0];
                ss[i] = input[1];
                fs[i] = input[2];
            }
            for (int i = 0; i < n; i++)
            {
                long time = 0;
                for(int j = i; j < n; j++)
                {
                    if (j == n - 1)
                    {
                        Console.WriteLine(time);
                    }
                    else
                    {
                        if (time <= ss[j])
                        {
                            time = ss[j];
                        }
                        else if (time % fs[j] != 0)
                        {
                            time = (time / fs[j] + 1) * fs[j];
                        }
                        time += cs[j];
                    }
                }
            }
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

int a[maxn];
pii_ op[maxn];
int main()
{
    fastio();
    int n,m;cin>>n>>m;
    rep(i,1,n) cin>>a[i];
    sort(a+1,a+n+1);
    rep(i,1,m){
        cin>>op[i].se>>op[i].fi;
    }
    sort(op+1,op+m+1);
    int pos = 1;ll ans = 0;
    int flag = 0;
    per(i,m,1){
        int k = op[i].fi,s = op[i].se;
        rep(j,0,s-1){
            if(pos+j > n || a[pos+j]>=k) {flag = 1;break;}
            a[pos+j] = k;
        }
        pos += s;
        if(flag) break;
    }
    rep(i,1,n) ans += a[i];
    cout<<ans<<endl;
    return 0;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int cnt = 0;
	REP(i, s.size()) {
		if (s[i] == 'p')cnt--;
	}
	cnt += s.size() / 2;
	cout << cnt << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a;
    cin>>a;
    a=2*a;
    int s[a];
    for(int i=0;i<a;i++){
        cin>>s[i];
    }
    sort(s,s+a);
    int sum=0;
    for(int i=0;i<a;i+=2){
        sum+=s[i];
    }
    cout<<sum<<'\n';
}


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

int main(){
  int n , l;cin >> n >> l;
  int ans = 0;
  int mina = 1e+9;  
  for(int i = 0; i < n; ++i){
    ans +=l + i;
    if(abs(l+i) < abs(mina))mina = l+i;
  }
  cout << ans - mina << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] m = new char[h][];
		for(int i=0;i<h;i++) {
			m[i] = sc.next().toCharArray();
		}
		int ans = 0;
		for(int i=1;i<h;i++) {
			LOOP: for(int j=0;j<w;j++) {
				if (m[i][j] != '-') continue;
				if (j > 0 && m[i][j-1] != '-') continue;
				if (j < w - 1 && m[i][j+1] != '-') continue;
				for(int i1=-1;i1<=1;i1++) {
					for(int j1=-1;j1<=1;j1++) {
						int i2 = i + i1;
						int j2 = j + j1;
						if (i2 < 0 || i2 >= h || j2 < 0 || j2 >= w) continue;
						if (m[i2][j2] == 'x') continue LOOP;
					}
				}
				ans++;
			}
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 27556
import itertools,math,numpy as np
def I(): return int(input())
def LI(): return list(map(int,input().split()))
N = I()
xy = np.array([LI() for _ in range(N)])
sum_norm = 0
dict_norm = {}
for a in itertools.permutations(range(N)):
    for i in range(len(a)-1):
        vector = tuple(xy[a[i+1]]-xy[a[i]])
        if not vector in dict_norm:
            dict_norm[vector] = np.linalg.norm(vector)
        sum_norm += dict_norm[vector]
print(sum_norm/math.factorial(N))


Measured memory_bytes: 14496
h,w=map(int,input().split())
a=[list(map(int,input().split())) for i in range(h)]
b=[list(map(int,input().split())) for i in range(h)]
dp=[[[0]*(80*(h+w+1)+1) for i in range(w)] for j in range(h)]
dp[0][0][abs(a[0][0]-b[0][0])]=1
for i in range(h):
  for j in range(w):
    c=abs(a[i][j]-b[i][j])
    if i!=0 or j!=0:
      for k in range(80*(i+j+1)+1):
        dp[i][j][k]=dp[i-1][j][abs(k-c)]|dp[i-1][j][k+c]|dp[i][j-1][abs(k-c)]|dp[i][j-1][k+c]
for i in range(80*(h+w+1)+1):
  if dp[h-1][w-1][i]==1:
    print(i)
    break

Measured memory_bytes: 679048
N, X, Y = map(int, input().split())

g = [[]  for i in range(N)]
for i in range(N):
    u = i
    v = i + 1
    if v < N:
        g[u].append(v)
        g[v].append(u)

g[X - 1].append(Y - 1)
g[Y - 1].append(X - 1)

from collections import deque
dis = [[float('Inf')] * N for _ in range(N)]
count = [0] * (N - 1)
def bfs(i):
    d = [False] * N
    que = deque()
    #for j in g[i]:
    que.append(i)
    d[i] = True
    dis[i][i] = 0
    pre = i
    while que:
        p = que.popleft()

        for k in g[p]:
            if d[k]:
                continue
            else:
                d[k] = True
                que.append(k)
                dis[i][k] = dis[i][p] + 1
                dis[k][i] = dis[i][p] + 1
                count[dis[i][k] - 1] += 1 
                #count[dis[k][i] - 1] += 1
        pre = p

for i in range(N):
    bfs(i)

for i in range(N - 1):
    print(count[i] // 2)


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

#define LL long long
using namespace std;

string a[105];
int cmp(string a,string b){
    return a + b < b + a;
}
int main(){
    int n,l;
    cin >> n >> l;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a,a+n);
    string ans = "";
    for(int i = 0; i < n; i++) ans += a[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

using namespace std;

int main(){
    int h,w;
    cin>>h>>w;
    char temp;
    for(int i=0;i<w+2;i++){
        printf("#");
    }
    printf("\n");
    for(int i=0;i<h;i++){
        printf("#");
        for(int j=0;j<w;j++){
            cin>>temp;
            printf("%c",temp);
        }
        printf("#\n");
    }
     for(int i=0;i<w+2;i++){
        printf("#");
    }
    printf("\n");
    
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
vector<string>p,tmp,in;
void turn(){
	tmp=vector<string>(p[0].size(),"");
	rep(i,p[0].size())rep(j,p.size())
		tmp[i]+=p[j][p[0].size()-i-1];
	p=tmp;
}
int f(){
	int co=0;
	rep(i,tmp.size()){
		bool h=true;
		rep(j,tmp[i].size())if(tmp[i][j]!='#')h=false;
		if(h)co++;
	}
	return co;
}
int main(){
	int q;
	cin>>q;
	while(q--){
		int n,m;
		cin>>n>>m;
		p=vector<string>(n);
		rep(i,n)cin>>p[i];
		int nx=inf,ny=inf,mx=-inf,my=-inf;
		rep(i,n)rep(j,m)if(p[i][j]=='#'){
			nx=min(nx,i);mx=max(mx,i);
			ny=min(ny,j);my=max(my,j);
		}
		if(nx==inf)return -1;
		tmp=vector<string>(0);
		loop(i,nx,mx+1){
			tmp.pb(p[i].substr(ny,my-ny+1));
		}
		p=tmp;
		cin>>n>>m;
		in=vector<string>(n);
		rep(i,n)cin>>in[i];
		tmp=in;
		int out=f();
		bool H=false;
		rep(w,4){
			turn();
			int aa=p.size(),bb=p[0].size();
			if(n-aa+1<=0||m-bb+1<=0)continue;
			rep(i,n-p.size()+1)rep(j,m-p[0].size()+1){
				tmp=in;
				bool h=true;
				rep(k,p.size())rep(l,p[0].size()){
					if(p[k][l]=='#'&&in[i+k][j+l]=='#')h=false;
					else if(p[k][l]=='#')tmp[i+k][j+l]='#';
				}
				if(!h)continue;
				out=max(out,f());
				H=true;				
			}
		}
		if(H)cout<<out<<endl;
		else cout<<-1<<endl;
	}
}

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

int main(){
  int S;
  cin>>S;
  string ans;
  if(S/100>=1&&S/100<=12&&S%100>=1&&S%100<=12){
    ans = "AMBIGUOUS";
  }
  else if(S/100>=1&&S/100<=12){
    ans = "MMYY";
  }
  else if(S%100>=1&&S%100<=12){
    ans = "YYMM";
  }
  else{
    ans = "NA";
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

void Main(){

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

  char dp[H+2][W+2];

  rep(i,H+2){
    rep(j,W+2){
      dp[i][j]='.';
    }
  }

  reps(i,1,H+1){
    reps(j,1,W+1){
      cin>>dp[i][j];
    }
  }

  reps(i,1,H+1){
    reps(j,1,W+1){
      if(dp[i][j]=='#' and dp[i+1][j]=='.' and dp[i-1][j]=='.' and dp[i][j+1]=='.' and dp[i][j-1]=='.'){
        cout<< "No"<<"\n";
        return;
      }
    }
  }

  cout<< "Yes"<<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	char s[3];
	scanf("%s",&s);
	int n=strlen(s);
	if(n==2)
	for(int i=0;i<n;i++)
	printf("%c",s[i]);
	if(n==3)
	for(int i=n-1;i>=0;i--)
	printf("%c",s[i]);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	Main m = new Main();
	m.answer();
    }

    private Scanner scan = new Scanner(System.in);
    private String s;

    public Main() {
	s = scan.next();
	scan.close();
    }

    public final void answer() {
	StringBuilder str = new StringBuilder();
	str.append(s.charAt(0));
	str.append(s.length()-2);
	str.append(s.charAt(s.length()-1));

	System.out.println(str.toString());
    }
}


Measured memory_bytes: 23764
r=j=x=1
M=10**9+7
`sed 1d`.split.map{x=$*[k=_1.to_i]||x+1
($*[k]=$.+=1).pow M-2,M}.map{p (-j+r=r*$.*_1%M)%M
$.-=1
j=j*_1%M*x-=1}

Measured memory_bytes: 26524
#include <iostream>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <vector>
using namespace std;

#define EPS 1e-9
#define P complex<double>
#define L vector<P>
#define pb push_back
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define y1 Y1

int N,x1,y1,x2,y2,X,Y;

double cross(const P &a,const P &b){
    return imag(conj(a)*b);
}

P crosspoint(const L &l, const L &m) {
    double A = cross(l[1] - l[0], m[1] - m[0]);
    double B = cross(l[1] - l[0], l[1] - m[0]);
    if (abs(A) < EPS && abs(B) < EPS) return m[0];
    if (abs(A) < EPS) assert(false);
    return m[0] + B / A * (m[1] - m[0]);
}

bool online(int x1,int y1,int x2,int y2){
    return x1==x2 || y1==y2 || labs(x1-x2)==labs(y1-y2);
}

int main(){
	cin>>N;
    rep(tc,N){
        cin>>x1>>y1>>x2>>y2>>X>>Y;
        
        if(x1==X && y1==Y || x2==X && y2==Y){
            cout<<0<<endl;
            continue;
        }
        
        if(online(x1,y1,X,Y) && online(x2,y2,X,Y)){
            cout<<1<<endl;
            continue;
        }
        
        if(online(x1,y1,X,Y) || online(x2,y2,X,Y)){
            cout<<2<<endl;
            continue;
        }
        
        if(online(x1,y1,x2,y2)){
            cout<<3<<endl;
            continue;
        }
        
        P a(x1,y1),b(x2,y2);
        L l[4],m[4];
        l[0].pb(a); l[0].pb(a+P(1,0));
        l[1].pb(a); l[1].pb(a+P(1,1));
        l[2].pb(a); l[2].pb(a+P(0,1));
        l[3].pb(a); l[3].pb(a+P(-1,1));
        m[0].pb(b); m[0].pb(b+P(1,0));
        m[1].pb(b); m[1].pb(b+P(1,1));
        m[2].pb(b); m[2].pb(b+P(0,1));
        m[3].pb(b); m[3].pb(b+P(-1,1));
        
        rep(i,4)rep(j,4)if(i!=j){
            P p=crosspoint(l[i],m[j]);
            double x=p.real(), y=p.imag();
            int xx=floor(x+EPS), yy=floor(y+EPS);
            if(x-xx > 0.4)continue;
            if(online(xx,yy,X,Y)){
                cout<<3<<endl;
                goto end;
            }
        }
        
        cout<<4<<endl;
    end:;
    }
}

Measured memory_bytes: 0
n = int(input())
ans = ["1:","2:","3:","4:","5:","6:"]
for i in range(n):
    num = float(input())
    if num < 165.0:
        ans[0] = ans[0] + "*"
    elif num < 170.0:
        ans[1] = ans[1] + "*"
    elif num < 175.0:
        ans[2] = ans[2] + "*"
    elif num < 180.0:
        ans[3] = ans[3] + "*"
    elif num < 185.0:
        ans[4] = ans[4] + "*"
    else:
        ans[5] = ans[5] + "*"
for k in range(len(ans)):
    print(ans[k])

Measured memory_bytes: 7520
my $s= <STDIN>;
my ($k,$N) = split(/ /,$s);
my $mod = 10**9+7;
my $sum =0;
my @del;
for(my $i=0;$i<$N;$i++){$del[$i] = 0;}
for(my $i=$N;$i>0;$i--){
 my $count = int($N /$i);
 $del[$i] = &powmod($count,$k,$mod);
 for(my $j=2;$j<=$count;$j++){
    $del[$i]= $del[$i] - $del[$i*$j];
 }
 $sum = ($sum + $i*$del[$i])%$mod;
 #print "i$i del$del[$i] $sum\n";
}
print "$sum";
exit;

sub powmod{
   my ($a,$b,$m) = @_;
   if($b==1){return $a;}
   my $c = powmod(($a*$a)%$m,int($b/2),$m);
   if($b%2){
     $c = ($c*$a)%$m;
   }
   return $c;
}


Measured memory_bytes: 7928
#include "bits/stdc++.h"
using namespace std;
int main(){
	int n;
	cin>>n;
	char S[n+1];
	for(int i=0;i<n;i++)cin>>S[i];

	int cost=0;
	for(int i=1;i<n;i++){
		if(S[i] == 'E') cost++;
	}

	int ans=cost;
	for(int i=1;i<n;i++){
		//if(S[i-1] == 'E') cost++;
		if(S[i-1] == 'W') cost++;
		if(S[i] == 'E') cost--;
		//if(S[i] == 'W') cost++;

		ans = min(ans, cost);
	}

	cout<< ans <<endl;

	return 0;
}

Measured memory_bytes: 768
loop do
  n = gets.strip.to_i
  break if n == 0

  mtx = n.times.map{gets.strip.split(' ').map(&:to_i)}

  shortests = (0...n).map{|y| mtx[y].min}
  tallests  = (0...n).map{|x| (0...n).map{|y| mtx[y][x]}.max}

  h = 0

  for y in (0...n)
    sv = shortests[y]
    for x in (0...n)
      if sv == tallests[x] && mtx[y][x] == sv
        h = sv
        break
      end
    end
  end

  puts h
end

Measured memory_bytes: 6120
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    int a,b,t,sum=0;
    cin>>a>>b>>t;
    for(int i=a;i<=t;i+=a)
    {
        sum+=b;
    }
    cout<<sum<<'\n';
    return 0;
}


Measured memory_bytes: 256