akhauriyash/Code-Regression huggingface dataset:
require 'prime'
A,B,C = gets.split.map(&:to_i)
def _divisors(primes, k)
  Enumerator.new do |y|
    if primes.size == k
      y << 1
    else
      p, e = primes[k]
      _divisors(primes, k + 1).each {|d|
        (e + 1).times {|e1|
          y << p ** e1 * d
        }
      }
    end
  end
end
def divisors(n)
  _divisors(Prime.prime_division(n), 0).to_a.sort
end
if A == B && C == 1
  puts A
else
  puts ((divisors(A).sort & divisors(B).sort).reverse[C - 1] || 1)
end


Measured memory_bytes: 2044
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def calc(N):
    return sum(int(x) for x in str(N))


def main():
    # sys.stdin = open("sample.txt")
    N, K = Scanner.map_int()
    A = Scanner.map_int()
    ans = 0
    for i in range(N):
        c = 0
        for j in range(i):
            if A[i] > A[j]:
                c += 1
        ans += ((K - 1) * (K) // 2) * c
        ans %= MOD
        c = 0
        for j in range(i+1, N):
            if A[i] > A[j]:
                c += 1
        ans += (K * (K + 1) // 2) * c
        ans %= MOD
    print(ans)
    return


if __name__ == "__main__":
    main()


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

class Solve {
private:
	std::string str;
	int abcd[4], result{};

	void calcResult(int char_i)
	{
		if (char_i == 4)
		{
			int num{};
			for (int i{}; i < 4; i++)
				num += abcd[i] << i;
			int str_i{};
			result += calcFormula(str, str_i) << num;
			return;
		}
		abcd[char_i] = 0;
		calcResult(char_i + 1);
		abcd[char_i] = 1;
		calcResult(char_i + 1);
		return;
	}

	int calcFormula(std::string& str, int& str_i)
	{
		str_i++;
		switch (str[str_i - 1])
		{
		case '-': return 1 - calcFormula(str, str_i);
		case '1': return 1;
		case '0': return 0;
		case '(':
		{
			int left{calcFormula(str, str_i)};
			int ope{str[str_i] == '*'};
			str_i++;
			int right{calcFormula(str, str_i)};
			str_i++;
			if (ope) return left & right;
			else return left ^ right;
		}
		default:
			return abcd[str[str_i - 1] - 'a'];
		}
	}

	
	std::vector<bool> appeared;
	std::vector<std::vector<int>> minLength;
	bool add(int num)
	{
		if (appeared[num]) return false;
		appeared[num] = true;
		minLength.back().push_back(num);
		return num == result;
	}

public:
	bool is_last_query{};
	Solve()
	{
		std::cin >> str;
		if (str == ".")
		{
			is_last_query = true;
			return;
		}
		calcResult(0);

		appeared.resize(1 << 16);
		minLength.resize(2);
		if (add(0))
		{
			puts("1");
			return;
		}
		if (add((1 << 16) - 1))
		{
			puts("1");
			return;
		}
		for (int i{}; i < 4; i++)
		{
			int num{};
			for (int j{}; j < 16; j++)
				if (j >> i & 1)
					num += 1 << j;
			if (add(num))
			{
				puts("1");
				return;
			}
		}

		for (int len{2}; len < (int)str.size(); len++)
		{
			minLength.push_back({});
			for (auto& e: minLength[len - 1])
			{
				if (add((1 << 16) - 1 - e))
				{
					printf("%d\n", len);
					return;
				}
			}
			for (int left{1}; left + 1 + 3 <= len; left++)
			{
				for (auto& e: minLength[left])
					for (auto& f: minLength[len - left - 3])
					{
						if (add(e & f))
						{
							printf("%d\n", len);
							return;
						}
						if (add(e ^ f))
						{
							printf("%d\n", len);
							return;
						}
					}
			}
		}
		printf("%d\n", str.size());
	}
};

int main()
{
	while (!Solve().is_last_query);

	return 0;
}


Measured memory_bytes: 3332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1000000007;

int main(){
    ll N, M;
    cin>>N>>M;
    vector<ll> S(3000), T(3000);
    for(ll i=0; i<N; i++){
        cin>>S[i];
    }
    for(ll i=0; i<M; i++){
        cin>>T[i];
    }
    vector<vector<ll>> dp(N+1, vector<ll>(M+1, 0));
    for(ll i=0; i<N+1; i++){
        dp[i][0]=1;
    }
    for(int i=0; i<M+1; i++){
        dp[0][i]=1;
    }
    for(ll i=1; i<=N; i++){
        for(ll j=1; j<=M; j++){
            dp[i][j]=dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1];
          	dp[i][j]+=MOD;
            dp[i][j]%=MOD;
            if(S[i-1]==T[j-1]){
                dp[i][j]+=dp[i-1][j-1];
              	dp[i][j]+=MOD;
                dp[i][j]%=MOD;
              	//cout<<"!";
            }
          	//cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
        }
    }
    cout<<dp[N][M]<<endl;
  	return 0;
}

Measured memory_bytes: 31616
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void){
  int n,i,d[100005];
  
  cin >> n;
  for (i=0;i<n;i++) cin >> d[i];
  
  sort(d,d+n);
  
  cout << d[n/2]-d[n/2-1] << endl;
  
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#define REP(i, n) for (int i = 0; i < n; i++)

using namespace std;
using ll = long long int;

int main(void) {
    int n; cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    bool t = true;
    sort(a.begin(), a.end());
    for (auto itr = a.begin(); itr != a.end(); itr++) {
        if (*itr == *(itr + 1)) t = false;
    }
    t ? cout << "YES" << endl: cout << "NO" << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

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

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

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
int main(){
  ll N;  ll K;
  cin>>N>>K;
  vector<int> v(N);
  rep(i,0,N){
    cin >> v[i];
    v[i]--;
  }
  set<int> used;
  vector<int> path;
  int now = 0;
  while(used.count(now)==0){
    path.pb(now);
    used.insert(now);
    now = v[now];
  }
  int s = find(path.begin(), path.end(), now) - path.begin();
  int r = (int)path.size() - s;
  if(K < s){
    cout << path[K]+1 << endl;
  }else{
    cout << path[((K-s)%r + s)%path.size()]+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 13908
// I am Nothing, You Are Nothing!
// Krishna is Everything ...
// Jai Shree Krishna

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 3e2 + 5, mod = 1e9 + 7;

double dp[N][N][N];
int n;

double solve(int x, int y, int z) {
	if (x == 0 and y == 0 and z == 0)
		return 0;
	if (dp[x][y][z] > -0.9)
		return dp[x][y][z];

	double ans = n;
	if (x > 0)
		ans += x * solve(x - 1, y, z);
	if (y > 0)
		ans += y * solve(x + 1, y - 1, z);
	if (z > 0)
		ans += z * solve(x, y + 1, z - 1);
	ans /= x + y + z;
	return dp[x][y][z] = ans;
}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cin >> n;
	int a[4] = {0};

	int sushis;
	for (int i = 0; i < n; i++) {
		cin >> sushis;
		a[sushis]++;
	}
	memset(dp, -1, sizeof dp);
	cout << fixed << setprecision(10) << solve(a[1], a[2], a[3]) << endl;

	return 0;
}


Measured memory_bytes: 225376
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0

for i in range(N):
    A = list(map(int, input().split()))
    ttl = C
    for j in range(M):
        ttl += A[j] * B[j]
    if ttl > 0:
        ans += 1

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[200005]={0};
ll n;
int main(void)
{
	scanf("%lld",&n);
	for(ll i=0;i<n-1;i++)
	{
		ll m;
		scanf("%lld",&m);
		a[m]++;
	}
	for(ll i=1;i<=n;i++)
	{
		printf("%lld\n",a[i]);
	}
}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;

vector<int> to[200005];
vector<int> ans;

void dfs(int v, int p = -1)
{
  for (int u : to[v])
  {
    if (u == p)
      continue;
    ans[u] += ans[v];
    dfs(u, v);
  }
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, Q;
  cin >> N >> Q;
  ans.resize(N, 0);
  for (int i = 0; i < N - 1; i++)
  {
    int a, b;
    cin >> a >> b;
    a--, b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  for (int i = 0; i < Q; i++)
  {
    int p, x;
    cin >> p >> x;
    p--;
    ans[p] += x;
  }
  dfs(0);
  for (int i = 0; i < N; i++)
  {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}


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

void print(vector<unsigned> v) {
  for (unsigned i = 0; i < v.size() - 1; i++) {
    cout << v[i] << " ";
  }
  cout << v[v.size() - 1] << endl;
}

int main() {
  unsigned N;
  cin >> N;
  vector<unsigned> A(N);
  for (unsigned n = 0; n < N; n++) {
    cin >> A[n];
  }
  print(A);
  for (unsigned n = 1; n < N; n++) {
    unsigned v = A[n];
    signed m = n - 1;
    while (m >= 0 && A[m] > v) {
      A[m + 1] = A[m];
      m--;
    }
    A[m + 1] = v;
    print(A);
  }
  return 0;
}

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

using usize = ::std::size_t;
using u64 = ::std::uint_least64_t;

static constexpr u64 Inf = ::std::numeric_limits<u64>::max() / 2;


int main(int argc, char *argv[])
{
    
 
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    u64 L, R, d;
    cin >> L >> R >> d;
    cout << R/d - (L-1)/d << endl;
    
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int A,B,C,D,E,F;
bool dp_w[100000];
bool dp_s[10000];

int main() {

	cin >> A >> B >> C >> D >> E >> F;

	for (int i = 0; i < 10000; i += A * 100) dp_w[i] = true;
	for (int i = 10000 - 1; i >= 0; i--) {
		if (dp_w[i]) {
			for (int j = 1; i + j * B * 100 < 10000; j++) {
				dp_w[i + j * B * 100] = true;
			}
		}	
	}

	for (int i = 0; i < 10000; i += C) dp_s[i] = true;
	for (int i = 10000 - 1; i >= 0; i--) {
		if (dp_s[i]) {
			for (int j = 1; i + j * D < 10000; j++) {
				dp_s[i + j * D] = true;
			}
		}
	}

	double noudo = -1.0;
	double max_n = (double) E / ((double) E + 100.0);
	int ans_s = 0;
	int ans_w = 0;

	for (int i = 1; i <= F; i++) {
		if (dp_w[i]) {
			for (int j = 0; j <= i; j++) {
				if (dp_s[j]) {
					double nt = (double) j / ((double) i + (double) j);
					if (noudo < nt && nt <= max_n + 1.0e-8 && j + i <= F) {
						noudo = nt;
						ans_w = i;
						ans_s = j;
					}
				}
			}
		}
	}

	cout << ans_w + ans_s << " " << ans_s << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i(a); i <= (b); ++i)

#define gc getchar()
struct Reader {
	template <class T> inline operator T() {
		T w; char c, p = 0;
		for(; !isdigit(c = gc); c == '-' && (p = 1));
		for(w = c & 15; isdigit(c = gc); w = w * 10 + (c & 15));
		return p ? -w : w;
	}
}rd;

template <class T> inline bool smin(T&x, const T&y) { return y < x ? x = y, 1 : 0; }
template <class T> inline bool smax(T&x, const T&y) { return x < y ? x = y, 1 : 0; }

typedef long long ll;

const int N(1e5 + 5);
int n, m, d[N], f[N];
std::vector<int> g[N];
int main() {
	n = rd, m = rd;
	while(m--) {
		int x = rd, y = rd;
		g[x].push_back(y);
		++d[y];
	}
	static int q[N], l, r;
	REP(i, 1, n) if(!d[i]) q[++r] = i;
	l = 1;
	int ans = 0, x;
	while(l <= r) {
		smax(ans, f[x = q[l++]]);
		for (int y : g[x]) {
			smax(f[y], f[x] + 1);
			if (!--d[y]) q[++r] = y;
		}
	}
	std::cout << ans;	
	return 0;
}



Measured memory_bytes: 6912
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using vi = vector<int>;

int main(void){
    int n, cnt = 0;
    cin >> n;
    vi L(n);
    for(int &l : L) cin >> l;
    if(n < 3) goto SKIP;
    sort(L.begin(), L.end());
    for(int i=0; i<n-2; i++){
        for(int j=i+1; j<n-1; j++){
            if(L[i] == L[j]) continue;
            for(int k=j+1; k<n; k++){
                if(L[j] == L[k]) continue;
                if(L[k] == L[i]) continue;
                if(L[k]<L[i]+L[j]) cnt++;
            }
        }
    }
SKIP:
    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 3684
#include <stdio.h>
#include <string.h>

int jump[100];
char source[100][20];

int visited[101];

void tansaku(int pos,int cost,int N) {
	if(visited[pos]>=0 && visited[pos]<=cost)return;
	visited[pos]=cost;
	if(jump[pos]==0) {
		if(pos<N)tansaku(pos+1,cost,N);
	} else {
		tansaku(jump[pos]-1,cost,N);
		if(pos<N)tansaku(pos+1,cost+1,N);
	}
}

int main(void) {
	int N,i,j,k;
	char buffer[100];
	int groupid;
	scanf("%d",&N);
	for(i=0;i<N;i++) {
		scanf("%s",buffer);
		if(strcmp(buffer,"goto")==0) {
			jump[i]=1;
			scanf("%s",source[i]);
			source[i][strlen(source[i])-1]=0;
		} else {
			jump[i]=0;
			strcpy(source[i],buffer);
			source[i][strlen(source[i])-1]=0;
		}
	}
	for(i=0;i<N;i++) {
		if(jump[i]) {
			for(j=0;j<N;j++) {
				if(i==j)continue;
				if(jump[j]==0 && strcmp(source[i],source[j])==0) {
					jump[i]=j+1;
					break;
				}
			}
		}
	}
	for(i=0;i<=N;i++)visited[i]=-1;
	tansaku(0,0,N);
	printf("%d\n",visited[N]);
	return 0;
}

Measured memory_bytes: 620
N, K = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf')]*N
dp[0] = 0
for i in range(N-1):
    for j in range(i, min(i+K+1, N)):
        dp[j] = min(dp[j], dp[i]+abs(h[j]-h[i]))
print(dp[N-1])


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){
    
    int n;
    cin >> n;
    int ans = 1000 - n % 1000;
    if(ans == 1000) ans = 0;
    cout << ans << endl;
}

Measured memory_bytes: 3508
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
		 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
	    public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        int N = sc.nextInt();	
	        int M = sc.nextInt();
	        long[] H = new long[N];
	        for(int i=0;i<N;i++) {
	        	H[i] = Long.parseLong(sc.next());
	        }
	        for(long i=0;i<N;i++)list.add(new ArrayList<Integer>());
	        for(int i=0;i<M;i++) {
	        	int a=sc.nextInt()-1;
	        	int b=sc.nextInt()-1;
	        	list.get(a).add(b);
	        	list.get(b).add(a);
	        }
        	
        	
	        long ans=0;
	        for(int i=0;i<N;i++) {
	        	boolean highest=true;
	        	for(int k:list.get(i)) {
	        		if(H[k]>=H[i])highest=false;
	        	}
	        	if(highest==true)ans++;
	        }
	        System.out.println(ans);
	        
	    }
	}

Measured memory_bytes: 76500
#include <map>
#include <set>
#include <list>
#include <cstdio>
#include <cmath>
#include <deque>
#include <stack>
#include <bitset>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define fr first
#define sc second
#define mp make_pair
#define foreach(c, it) for(typeof(c) it = (c).begin(); it != (c).end(); it++)

typedef long long int64;
typedef pair< int, int > iP;
typedef pair< iP, int > iiP;

const int INF = 2 << 28;
const double EPS = 1e-10;

int main() {
    
    int N, W, H, w, h;
    while(cin >> N, N) {
        int mas[1001][1001] = { 0 };
        cin >> W >> H;
        for(int i = 0; i < N; i++) {
            int x, y; cin >> x >> y;
            mas[--y][--x] = 1;
        }
        cin >> w >> h;
    
        int ans = 0;
        for(int i = 0; i < H; i++) {
            for(int j = 0; j < W; j++) {
                int cnt = 0;
                for(int k = i; k < i + h; k++) {
                    for(int l = j; l < j + w; l++) {
                        if(mas[k][l]) cnt++;
                    }
                }
                ans = max(cnt, ans);
            }
        }
         cout << ans << endl;
    }
}

Measured memory_bytes: 5080
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;

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

const double EPS = 1e-8;
const double INF = 1e12;
const double PI = 3.1415926535;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

L bisector(P a, P b) {
  P A = (a+b)*P(0.5,0);
  return L(A, A+(b-a)*P(0, PI/2));
}

typedef vector<P> G;

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]; // same line

  return m[0] + B / A * (m[1] - m[0]);
}


G convex_cut(const G& g, const L& l) {
  G Q;
  for (int i = 0; i < g.size(); ++i) {
    P A = g[i], B = g[(i+1)%g.size()];
    if (ccw(l[0], l[1], A) != -1) Q.push_back(A);
    if (ccw(l[0], l[1], A)*ccw(l[0], l[1], B) < 0)
      Q.push_back(crosspoint(L(A, B), l));
  }
  return Q;
}

double area2(const G& g) {
  double A = 0;
  for (int i = 0; i < g.size(); ++i) {
    A += cross(g[i], g[(i+1)%g.size()]);
  }
  return A;
}

int main() {
  int ax,ay,bx,by,cx,cy;
  int nn = 0;
  while(cin>>ax>>ay>>bx>>by>>cx>>cy,ax) {
    P p1(ax,ay),p2(bx,by),p3(cx,cy);

    G g;
    g.push_back(P(0,0));
    g.push_back(P(10000,0));
    g.push_back(P(10000,10000));
    g.push_back(P(0,10000));
    
    g = convex_cut(g, bisector(p1,p2));
    g = convex_cut(g, bisector(p1,p3));
    
    // FOR(it, g) cout << *it << " ";
    //  cout << endl;
    printf("%d %.6f\n",++nn,area2(g) / (10000LL*10000*2));
  }
}

Measured memory_bytes: 0
#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
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;
	}
};

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

ll powll(ll a, ll x) {
	if (x == 0) return 1;
	ll ret = a;
	repi(i, 1, x) {
		ret *= a;
	}
	return ret;
}

int main() {
	ll n, k;
	cin >> n >> k;
	ll ans = k*powll(k - 1, n - 1);
	wrln(ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
 
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};
mint ans;
ll N,K;
vector<vector<ll>> G(100005);
vector<ll> memo(100005);
mint dfs(ll v, ll st){
    ll tmp = K-1;
    if(st == -1){
        tmp = K;
    }
    for(auto& u:G[v]){
        if(memo[u]!=0)continue;
        memo[u] = 1;
        tmp--;
        ans *= tmp;
        dfs(u,0);
    }
    return 0;
}

int main(){
    cin >> N >> K;
    ll a,b;
    rep(i,N-1){
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    //どっかをrootとする。
    memo[0] = 1;
    ans = K;
    dfs(0,-1);
    //ans /= K-2;
    //ans *= K-1;
    cout << ans << endl;
}

Measured memory_bytes: 12912
/* 2013 0903 1649
と思ったけど、やっぱりSTL（Standard Template Library）
使うのやめて、 new deleteで動的に作って、リストみたいにポインタで管理して
行くことにする。
!（iteratorのアドレスはちょいちょい変わっちゃうらしいので,ポインタみたいに
ずっと所持っていうのは無理っぽい気がすると思ったので）

iteratorはポインタっぽいけど、使うのはやっぱりSTLに対してで、　
今回のだと、別にvectorに入れる必要もないし要らないかな。

木（リスト）は「頭付き」にしない。
rootになるやつのparentをnullにして、探査とかは、(nill!=parent)を毎回入れればいいだろう。

*/



/*2013 0903 1648
ALDS1_8-A Binary Search Tree I の Template in C 見たら、
リストで実装してて、leftとrightにはポインタ入れてたので

//自分の実装でもIDとか要素持たせないで、iterator使う。
//これで、idとvector添え字そろえるsortとか、findでid探したりとかが要らなくなる。

*/

/*
二分木は、子が一つしかなくても、それが右の子か左の子かラベル付けされていなければならないようだ。

詳しくは、IDEONE「子の左右を区別しない版 AOJ Algorithms and Data Structures I - Tree - Tree Walk(不正解である)」
ALDS1_7_C: Tree Walk test cace 6より
等を参照。
a
*/

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>


using namespace std;

class Binary_Search_Tree
{

public:
	//int id;  //idはなくす。　全部添え字で管理　そうしないと配列内でidに対してfindしないといけなくなり、実行時間増えるので
	//bstなら、idでなくkeyて名前にしとこうか...面倒なのでやっぱりいい。

	int key;
	Binary_Search_Tree *parent; 
	//int degree;
	Binary_Search_Tree *left;
	Binary_Search_Tree *right; 

	Binary_Search_Tree()
    {
        parent = left = right = NULL;
    }

};

//最後に同じところでキーの大小比較を二回やるので無駄なように思えるが、多分これが一番すっきりしていて早いのだろう。
void TREE_INSERT(Binary_Search_Tree *&T, Binary_Search_Tree *z){
	Binary_Search_Tree *y, *x;

	y=NULL;
	x=T;
	while(x!=NULL){
		y=x;
		if(z->key < x->key) x=x->left;
		else x=x->right;
	}
	z->parent = y;
	if(y==NULL) T=z; //if T is empty
	else{ 
		if(z->key < y->key) y->left=z;
		else y->right=z;
	}
}



void Preorder(Binary_Search_Tree *node){

	cout << " " << node->key;
	if(node->left!=NULL) Preorder(node->left);
	if(node->right!=NULL) Preorder(node->right);
}

void Inorder(Binary_Search_Tree *node){

	if(node->left!=NULL) Inorder(node->left);
	cout << " " << node->key;
	if(node->right!=NULL) Inorder(node->right);
}

void Postorder(Binary_Search_Tree *node){

	if(node->left!=NULL) Postorder(node->left);
	if(node->right!=NULL) Postorder(node->right);
	cout << " " << node->key;
}




int main() {
	int i,j;
	int n;
	string s_buf;
	Binary_Search_Tree *bst=NULL; //in root address 
	vector<int> out_buf;

	//input
	// 標準入力をファイルに変更////////////////////////////////////////////////////////
    //FILE* fp_in = freopen("\\\\k1300\\k1300\\s1350010\\.windows\\Desktop\\input_data.txt", "r", stdin);
	/////////////////////////////////////////////////////////////////////////////////////
	cin >> n;
	for(i=0; i<n; i++){
		Binary_Search_Tree *buf;
		buf = new Binary_Search_Tree;

		cin >> s_buf;
		if(s_buf=="insert"){
			cin >> buf->key;
			TREE_INSERT(bst, buf);
		}
		else if(s_buf=="print"){
			Inorder(bst);
			cout << endl;

			Preorder(bst);
			cout << endl;
		}

	}
	// ファイルを閉じる//////////////////////////////////////////////////////////////////
    //fclose(fp_in);
	/////////////////////////////////////////////////////////////////////////////////////

	
	return 0;
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    double x1,y1,x2,y2;
    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);

    printf("%f\n",sqrt(pow(x2- x1, 2) +pow(y2 -y1, 2)));
    
    
    return 0;
}

Measured memory_bytes: 652
#include <stdio.h>

int main(void)
{
   int d,n,p;

   scanf("%d%d",&d,&n);

   switch(d){
      case 0:
         p=1;
         break;
      case 1:
         p=100;
         break;
      case 2:
         p=10000;
         break;
   }
   if(n==100)
      n++;

   p*=n;

   printf("%d",p);

   return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <stack>
#include <utility>
#include <vector>
#include <math.h>

#define rep(i, n) for (auto i = 0; i < (n); i++)
#define MOD 1e9 + 7
typedef long long ll;

using namespace std;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  char c[h][w];
  rep(i, h) rep(j, w) cin >> c[i][j];
  int ans = 0;
  for (int rmask = 0; rmask < (1 << h) - 1; rmask++) {
    for (int cmask = 0; cmask < (1 << w) - 1; cmask++) {
      int black = 0;
      for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
          if (((rmask >> i) & 1) == 0 && ((cmask >> j) & 1) == 0 && c[i][j] == '#')
            black++;
        }
      }
      if (black == k) ans++;
    }
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3160
/*..................................
manojeet24
....................................*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fl(i,a,b) for(int i=a;i<b;i++)
#define flr(i,a,b) for(int i=a;i>b;i--)
#define INF INT_MAX
int dp[100005],h[100005],k;
int solve(int n)
{
    if(dp[n]!=INF)
        return dp[n];
    if(n<=0)
    {
        dp[n]=0;return dp[n];
    }
    if(n==1)
    {
        dp[n]=abs(h[1]-h[0]);
        return dp[n];
    }
    for(int i=1;i<=k && i<=n;i++)
        dp[n]=min(abs(h[n]-h[n-i])+solve(n-i),dp[n]);
    return dp[n];

}
int main()
{
    int n;
    cin>>n>>k;
   //a int h[n];
    fl(i,0,n)
    {
        cin>>h[i];
    }
    fl(i,0,n)
        dp[i]=INF;
    solve(n-1);
    cout<<dp[n-1];
}



Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 100000000000000

int main(){
	ll n;cin>>n;//頂点数
	map<pair<int,int>,int> dist;//頂点間距離
	vector<vector<int>> G(n);//隣接行列

	for(int i=0;i<n-1;i++){//辺と距離について
		ll a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
		dist[make_pair(a,b)]=dist[make_pair(b,a)]=c;
		dist[make_pair(i,i)]=0;
	}

	ll q,k;cin>>q>>k;//頂点kを必ず経由
	k--;

	queue<ll> que;
	que.push(k);//kから各頂点への最短距離を知りたい

	vector<bool> visit(n,false);
	vector<ll> distance_from_k(n,0);
	visit[k]=true;

	while(que.size()!=0){
		ll now=que.front();
		que.pop();
		visit[now]=true;

		for(auto next:G[now]){
			if(visit[next]) continue;
			
			distance_from_k[next]=distance_from_k[now]+dist[make_pair(now,next)];
			que.push(next);
		}
	}
	
	vector<pair<int,int>> want(q); 
	for(int i=0;i<q;i++){
		ll x,y;cin>>x>>y;
		x--;y--;
		want[i]=make_pair(x,y);
	}

	for(int i=0;i<q;i++){
		cout<<distance_from_k[want[i].first]+distance_from_k[want[i].second]<<endl;
	}

	return 0;
}

Measured memory_bytes: 30388
from collections import deque

if __name__ == '__main__':
    s = input()
    s1 = deque()
    s2 = deque()
    summ = 0
    for i, c in enumerate(s):
        if c == '\\':
            s1.append(i)
        elif s[i] == '/' and len(s1) > 0:
            j = s1.pop()
            summ += i-j
            a = i-j
            while len(s2) > 0 and s2[-1][0] > j:
                a+= s2.pop()[1]
            s2.append([j, a])
    
    ans = []
    while len(s2) > 0:
        ans.append(s2.pop()[1])
    ans.reverse()
    print(sum(ans))
    counter = len(ans)
    ans.insert(0, counter)
    a = list(map(str, ans))
    print(' '.join(a))


Measured memory_bytes: 6556
#!/usr/bin/env python3
import sys

def calc(A, b):
    c = 0
    for i, x in enumerate(A):
        c += abs(x - (b + (i+1)))
    return c

def solve(N, A):
    B = []
    for i, a in enumerate(A):
        B.append(a - (i+1))
    return calc(A, sorted(B)[N // 2])

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

if __name__ == '__main__':
    main()


Measured memory_bytes: 37512
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

ll A, B, N;
ll f(ll x){
  return (A*x/B)-A*(x/B);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> A >> B >> N;
  ll leftOK = 1, rightNG = N+1;
  ll mid = (leftOK + rightNG)/2;
  ll ans = 0, maxa = 0;
  while(rightNG - leftOK > 1){
    ans = f(mid);
    if(ans >= maxa){
      leftOK = mid;
      maxa = ans;
    }else{
      rightNG = mid;
    }
    mid = (leftOK + rightNG)/2;
  }
  cout << f(leftOK) << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long ans = a * c;

    if( a >= 0 ){
        if( c >= 0) {
            ans = b * d;
        } else{
            if(d > 0){
                ans = b * d;
            }else{
                ans = a * d;
            }
        }
    }else{
        if(b >= 0){
            if(c > 0){
                ans = b * d;
            }else{
                ans = max(a*c, b*d);
            }
        }else{
            if(c > 0){
                ans = b * c;
            }else {
                ans = a * c;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3624
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	vector<int> items = {100, 101, 102, 103, 104, 105};
	vector<bool> kp(100001, 0);
	kp[0] = 1;
	for(int i=0;i<=100000;i++) {
		for(int x : items) {
			if(i + x <= 100000 && kp[i]) kp[i+x] = 1;
		}
	}
	int n;
	cin >> n;
	cout << kp[n];
	return 0;
}


Measured memory_bytes: 256
////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

vector<LL> M, C;
const int N = 2e5;
LL dp[N + 5];
LL h[N + 5];

int pos = 0;

LL query(LL x) {
	if(pos > M.size()) pos = M.size() - 1;
	while(pos + 1 != M.size() && M[pos] * x + C[pos] >= M[pos + 1] * x + C[pos + 1]) pos++;
	return M[pos] * x + C[pos];
}

bool bad(int i1,int i2,int i3) {
	LL m13 = M[i1] - M[i3];
	LL c13 = C[i3] - C[i1];
	LL m12 = M[i1] - M[i2];
	LL c12 = C[i2] - C[i1];
	return c13 * m12 < c12 * m13;
}

void update(LL m,LL c) {
	M.PB(m), C.PB(c);
	while(M.size() >= 3 && bad(M.size() - 3, M.size() - 2,M.size() - 1)) {
		M.erase(M.end() - 2);
		C.erase(C.end() - 2);
	}
}

void hora(int tc) {
	int n;
	LL c;
	cin>>n>>c;
	for(int i = 1;i <= n;i++) cin>>h[i];
	M.PB(h[1] * -2);
	C.PB(h[1] * h[1]);
	for(int i = 2;i <= n;i++) {
		dp[i] = query(h[i]) + h[i] * h[i] + c;
		update(h[i] * -2, dp[i] + h[i] * h[i]);
	}
	cout<<dp[n]<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}



Measured memory_bytes: 6756
l, r = map(int, input().split())
tmp = 2019*(l//2019)
l -= tmp
r -= tmp
if r >= 2019:
  print(0)
else:
  m = 2020
  for i in range(l, r):
    for j in range(i+1, r+1):
      if m > i*j%2019:
        m = i*j%2019
  print(m)

Measured memory_bytes: 40556
using System; //Console, IComparable
using System.IO; //StreamWriter 
using System.Linq; //Select(), Where(), OrderBy(), Count()
using System.Collections.Generic; //List<T>
using System.Reflection; //PropertyInfo[], GetProperties[]
using static System.Console; 
using static NNN.CInput;

namespace NNN {
    public class CRun{
        private static class gv{
            public static string s = "";
        }
    
        public void build(){            
            gv.s = ReadLine();
        }
        
        private bool string_reverse_chk(string s) {
            var rev_s = new string(s.Reverse().ToArray());
            if (rev_s == s) return true;
            return false;
        }
    
        public void solve(){ StreamWriter so = new StreamWriter(Console.OpenStandardOutput());
            
            string ans = "No";
            
            do {
                int slen = gv.s.Length;
                var reversed_s = new string(gv.s.Reverse().ToArray());
                
                // con1
                if (gv.s != reversed_s) break;
                
                // con2
                var cut_1 = gv.s.Substring(0, (slen -1)/2);
                var cut_2 = reversed_s.Substring(0, (slen -1)/2);
                if (!this.string_reverse_chk(cut_1)) break;
                if (!this.string_reverse_chk(cut_2)) break;
                
                // con3
                var cut_3 = gv.s.Substring((slen +3)/2 -1 );
                var cut_4 = reversed_s.Substring((slen +3)/2 -1 );
                if (!this.string_reverse_chk(cut_3)) break;
                if (!this.string_reverse_chk(cut_4)) break;
                
                ans = "Yes";
            } while (false);
            
            WriteLine(ans);
        }
    }

    class Program { 
        static void Main() { 
            var run = new CRun();
            run.build();
            run.solve();
        } 
    }

    public static class CInput{
        public static string _string{get{return Console.ReadLine();}}
        public static string[] _stringa{get{return (Console.ReadLine().Split());}}
        public static int _int{get{return int.Parse(Console.ReadLine());}}
        public static int[] _inta{get{return Console.ReadLine().Split().Select(x=>int.Parse(x)).ToArray();}}
        public static long _long{get{return long.Parse(Console.ReadLine());}}
        public static long[] _longa{get{return Console.ReadLine().Split().Select(x=>long.Parse(x)).ToArray();}}    
    }
}


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

int main()
{
    int n;
    cin >> n;
    bool Adj[n][n] = {};
    for (int i = 0; i < n; i++)
    {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++)
        {
            int v;
            cin >> v;
            Adj[u - 1][v - 1] = 1;
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cout << Adj[i][j];
            if (j != n - 1)
            {
                cout << " ";
            }
        }
        cout << endl;
    }
    return 0;
}


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

int main() {
	int N;
  	cin >> N;
  	vector<int> card(N);
  	for(int i = 0; i < N; i++) {
    cin >> card.at(i);
    }
  	sort(card.begin(), card.end());
  	reverse(card.begin(), card.end());
  	int alice, bob;
  	alice = 0;
  	bob = 0;
  	for(int i = 0; i < N; i++) {
    if(i % 2 == 0) {
    alice += card.at(i);
    }
    else {
    bob += card.at(i);
    }
    }
  cout << alice - bob << endl;
}


Measured memory_bytes: 256
#include "stdio.h"
int main(void)
{
	int num[10000],i,j,k,tmp;
	for(i=0;;i++){
		scanf("%d",&num[i]);
		if(i%2 != 0){
			if(num[i]==0 && num[i-1]==0){
				tmp = i;
				break;
			}
		}
	}
	for(i=0;i<tmp-1;i++){
		for(j=0;j<num[i];j++){
			for(k=0;k<num[i+1];k++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
		i++;
	}
	return 0;
}


Measured memory_bytes: 580
package main

import "fmt"

func main() {
	var input string
	var pre rune
	isGood := true

	fmt.Scan(&input)

	for _, v := range input {
		if pre != v {
			pre = v
		} else {
			isGood = false
			break
		}
	}

	if isGood {
		fmt.Println("Good")
	} else {
		fmt.Println("Bad")
	}
}


Measured memory_bytes: 512
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

struct data_t
{
	int x, y, h;
	auto get()const
	{
		return std::make_tuple(h, x, y);
	}
	bool operator<(data_t const& rhs)
	{
		return get() < rhs.get();
	}
};

void Main()
{
	int N;
	std::cin >> N;
	std::vector<data_t> data(N);
	for (auto& d : data)
	{
		std::cin >> d.x >> d.y >> d.h;
	}
	boost::sort(data);

	for (auto x : boost::irange(0, 101))
	{
		for (auto y : boost::irange(0, 101))
		{
			auto&& last = data.back();
			auto h = last.h + std::abs(x - last.x) + std::abs(y - last.y);
			bool f = true;
			for (auto&& d : data)
			{
				if (std::max(0, h - std::abs(x - d.x) - std::abs(y - d.y)) != d.h)
				{
					f = false;
					break;
				}
			}
			if (f)
			{
				boost::copy(std::array<int, 3>{ x, y, h }, std::ostream_iterator<int>(std::cout, " "));
				return;
			}
		}
	}
}

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

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

void solve(vector<int>& b) {
  int N = b.size();
  vector<int> ret(N);
  REP(i, N) {
    int pos = -1;
    REP(j, N - i) {
      if(j == b[j]) pos = j;
    }
    if(pos == -1) {
      cout << -1 << endl;
      return;
    }
    ret[N - 1 - i] = pos + 1;
    b.erase(b.begin() + pos);
  }

  REP(i, N) cout << ret[i] << endl;
}

int main(){
  int N;
  cin >> N;
  vector<int> b(N);
  REP(i, N) {
    cin >> b[i]; --b[i];
  }

  solve(b);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
const int MAXN = 50;
const int inf = 1 << 30;
VEC<VEC<LL>> X;
VEC<VEC<LL>> Y;
void show(VEC<VEC<int>> M) {
  REP(i, 0, M.size()) { DUMP(M[i]); }
}

int main() {
  LL N;
  cin >> N;
  if (N == 1 || N == 2) {
    cout << 1 << endl;
    return 0;
  }
  X = MATINIT(LL, N, N, inf);
  Y = MATINIT(LL, N, N, inf);
  REP(i, 0, N) {
    X[i][i] = 0;
    Y[i][i] = 0;
  }
  VEC<pair<LL, LL>> C(N);

  VEC<LL> x(N), y(N);
  REP(i, 0, N) {
    std::cin >> x[i] >> y[i];
    C[i].first = x[i];
    C[i].second = y[i];
  }
  sort(ALL(C));
  queue<pair<LL, LL>> Q;
  REP(i, 0, N) {
    REP(j, 0, N) {
      if (i == j) continue;
      X[i][j] = x[j] - x[i];
      Y[i][j] = y[j] - y[i];
      Q.push({X[i][j], Y[i][j]});
    }
  }
  LL count = 0;
  while (!Q.empty()) {
    LL p = Q.front().first;
    LL q = Q.front().second;
    Q.pop();
    // DUMP("begin, i,j,p,q", i, j, p, q);
    LL cnt = 0;
    VEC<bool> used(N, false);
    REP(i, 0, N) {
      LL x = C[i].first;
      LL y = C[i].second;
      REP(j, 0, N) {
        if (used[j]) continue;
        LL nx = C[j].first;
        LL ny = C[j].second;
        if (nx - x == p && ny - y == q) {
          cnt++;
          used[j] = 1;
        }
      }
      count = max(count, cnt);
    }
  }
  cout << N - count << endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int gcd_core(int a, int b) {
  if (b == 0) { return a; }
  else { return gcd_core(b, a % b); } }
int main () {
  long long ans = 0;
  int a;
  cin >> a;
  for (int i = 1; i <= a; i++) {
    for (int j = 1; j <= a; j++) {
      for (int k = 1; k <= a; k++) {
        ans += gcd(gcd(i, j), k);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3596