akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>

using namespace std;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<int>;


bool solve()
{
	int N, M;
	cin >> N >> M;

	if (N == 0)return false;

	vec MaxV(M);

	int ans = 0;

	for (int i = 0; i < N; ++i)
	{
		int d, v;
		cin >> d >> v;
		--d;

		ans -= MaxV[d];
		MaxV[d] = max(MaxV[d], v);
		ans += MaxV[d];
	}

	cout << ans << endl;

	return true;
}


int main()
{
	while(solve());

	return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long int
#define MOD 10000007
#define M 1e18
		
void solve() {
	char c;
	cin >> c;
	if(c == tolower(c)) {
		cout << 'a' << endl;
	} else {
		cout << 'A' << endl;
	}
}

int32_t main() {
	IOS;
	solve();
	return 0;
}


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

#define endl '\n'
#define rep(i,n)       for(int i=0; i<n; i++)
#define clr(arr)       memset(arr, 0, sizeof arr)
#define all(x)         x.begin(), x.end()
const int MOD = 1e9 + 7;

#ifdef SMIT
template<class F, class S> ostream& operator<<(ostream &out, const pair<F, S> &p)
{
	return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out)
{
	out << '{';
	for (auto i = x.begin(); i != x.end(); i++)
		out << *i << (i == prev(x.end()) ? "" : ", ");
	return out << '}';
}
void dmp() {}
template<class T, class... Args> void dmp(T &&x, Args... args)
{
	cerr << x << ";  "; dmp(args...);
}
struct Nl {~Nl() {cerr << '\n';}};
#define debug(x...) cerr << (strcmp(#x, "") ? #x ":  " : ""), dmp(x), Nl(), cerr << ""
#else
#define debug(...) {}
#endif
// Yes you CAN



int n, d, x, y, cnt;
bool ok(int x, int y, int d)
{
	int dist = ceil(sqrt(1.0 * x * x + 1.0 * y * y));
	return dist <= d;
}
void solve()
{
// #define TEST
	cnt = 0;
	cin >> n >> d;
	while (n--)
	{
		cin >> x >> y;
		cnt += ok(x, y, d);
	}
	cout << cnt << endl;
}

int32_t main()
{
#ifdef SMIT
	// freopen("/home/smit/Desktop/in.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(false); cin.tie(nullptr);

	int t = 1;
#ifdef TEST
	cin >> t;
#endif
	while (t--)
		solve();
}

Measured memory_bytes: 3692
#include<iostream>
using namespace std;
int main(){
    char a;
    cin>>a;
    if(a=='a'){
        cout<<"b";
    }
    if(a=='b'){
        cout<<"c";
    }if(a=='c'){
        cout<<"d";
    }if(a=='d'){
        cout<<"e";
    }if(a=='e'){
        cout<<"f";
    }if(a=='f'){
        cout<<"g";
    }if(a=='g'){
        cout<<"h";
    }if(a=='h'){
        cout<<"i";
    }if(a=='i'){
        cout<<"j";
    }if(a=='j'){
        cout<<"k";
    }if(a=='k'){
        cout<<"l";
    }if(a=='l'){
        cout<<"m";
    }if(a=='m'){
        cout<<"n";
    }if(a=='n'){
        cout<<"o";
    }if(a=='o'){
        cout<<"p";
    }if(a=='p'){
        cout<<"q";
    }if(a=='q'){
        cout<<"r";
    }if(a=='r'){
        cout<<"s";
    }if(a=='s'){
        cout<<"t";
    }if(a=='t'){
        cout<<"u";
    }if(a=='u'){
        cout<<"v";
    }if(a=='v'){
        cout<<"w";
    }if(a=='w'){
        cout<<"x";
    }if(a=='x'){
        cout<<"y";
    }if(a=='y'){
        cout<<"z";
    }
    
}










Measured memory_bytes: 888
#include <cstdio>
#include <cmath>

char memo[1000003] = { 2, 2, 1, 1 };

bool is_prime(int n) {
  if (!memo[n]) {
    if (n%2 == 0) memo[n] = 2;
    else {
      for (int i=3;i<=sqrt(n);i+=2) {
        if (n%i == 0) {
          memo[n] = 2;
          break;
        }
      }
      if (!memo[n]) memo[n] = 1;
    }
  }
  return (memo[n] == 1);
}

int main() {
  int a, d, n;
  while (true) {
    scanf("%d %d %d", &a, &d, &n);
    if (a == 0 && d == 0 && n == 0) break;
    int x = a, cnt = 1;
    do {
      while (!is_prime(x)) x += d;
      x += d;
    } while (cnt++ < n);
    printf("%d\n", x-d);
  }
  return 0;
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    vector<ll> rui(n, 0LL);
    rui[0] = a[0];
    for (ll i = 0; i < n - 1; i++)
    {
        rui[i + 1] = rui[i] + a[i + 1];
    }
    ll ans = LLINF;
    for (ll i = 2; i < n - 1; i++)
    {
        // left:[0,i), right:[i,n)
        ll left = rui[i - 1];
        ll right = rui[n - 1] - rui[i - 1];
        // cout << left << ' ' << right << endl;
        ll left_b = lower_bound(ALL(rui), left / 2) - rui.begin();
        ll right_b = lower_bound(ALL(rui), left + right / 2) - rui.begin();
        // cout << "dbg:" << left_b - rui.begin() << ' ' << right_b - rui.begin() << endl;
        for (ll j = left_b - 1; j <= left_b + 1; j++)
        {
            for (ll k = right_b - 1; k <= right_b + 1; k++)
            {

                if (0 < j && j < i && i < k && k < n)
                {
                    vector<ll> kouho;
                    kouho.push_back(rui[j - 1]);
                    kouho.push_back(rui[i - 1] - rui[j - 1]);
                    kouho.push_back(rui[k - 1] - rui[i - 1]);
                    kouho.push_back(rui[n - 1] - rui[k - 1]);
                    sort(ALL(kouho));
                    chmin(ans, kouho.back() - kouho.front());
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3456
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

int main(void) {
    cout << std::fixed << std::setprecision(10);
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
    cout << n * 800 - (n / 15) * 200 << endl;

    return 0;
}


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

using namespace std;
using int64 = long long int;

constexpr int MaxN = 100 + 10;
bool B[MaxN][MaxN];
int dist[MaxN][MaxN];

struct State
{
	int x, y, cost;

	bool operator<(const State &s) const
	{
		return cost > s.cost;
	}
};

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

	for (int i = 0; i < h; i++)
	{
		string s;
		cin >> s;

		for (int j = 0; j < s.length(); j++)
		{
			B[i][j] = s[j] == '.';
		}
	}

	priority_queue<State> q;
	int initialCost = B[0][0] ? 0 : 1;
	q.push({ 0, 0, initialCost });
	fill((int *) dist, (int *) dist + sizeof(dist) / sizeof(int), 1 << 20);
	dist[0][0] = initialCost;

	while (!q.empty())
	{
		State s = q.top();
		q.pop();

		if (s.cost > dist[s.x][s.y])
		{
			continue;
		}

		static int dx[] = { 1, 0 };
		static int dy[] = { 0, 1 };
		for (int i = 0; i < 2; i++)
		{
			int nx = s.x + dx[i], ny = s.y + dy[i];
			if (nx >= h || ny >= w)
			{
				continue;
			}

			int nextCost = s.cost;
			if (!B[nx][ny] && B[s.x][s.y])
			{
				nextCost++;
			}

			if (dist[nx][ny] > nextCost)
			{
				dist[nx][ny] = nextCost;
				q.push({ nx, ny, nextCost });
			}
		}
	}

	int ans = dist[h - 1][w - 1];
	cout << ans << endl;
}

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

struct StronglyConnectedComponent {
	const int V;
	vector<vector<int>> G, revG;
	vector<int> id;
	StronglyConnectedComponent(const int V) :
		V(V),
		G(vector<vector<int>>(V, vector<int>())),
		revG(vector<vector<int>>(V, vector<int>())),
		id(vector<int>(V))
		{}
	void addEdge(int from, int to) {
		G[from].push_back(to);
		revG[to].push_back(from);
	}
	void build() {
		vector<bool> used(V, false);
		stack<int> st;
		for(int from = 0; from < V; ++from) {
			if(not used[from]) {
				dfs(from, used, st);
			}
		}
		int num = 0;
		while(st.size()) {
			int from = st.top();
			st.pop();
			if(used[from]) {
				revdfs(from, num, used);
				++num;
			}
		}
	}
	void dfs(int from, vector<bool> &used, stack<int> &st) {
		used[from] = true;
		for(int to : G[from]) {
			if(not used[to]) {
				dfs(to, used, st);
			}
		}
		st.push(from);
	}
	void revdfs(int from, int num, vector<bool> &used) {
		used[from] = false;
		id[from] = num;
		for(int to : revG[from]) {
			if(used[to]) {
				revdfs(to, num, used);
			}
		}
	}
	int get(int x) {
		return id[x];
	}
};

struct TwoSatisfiability {
	const int V;
	vector<bool> pos;
	StronglyConnectedComponent scc;
	TwoSatisfiability(const int V) :
		V(V),
		pos(vector<bool>(2 * V)),
		scc(StronglyConnectedComponent(2 * V))
		{}
	inline int NOT(int A) {
		return (A + V) % (2 * V);
	}
	// A -> B <=> not B -> not A
	inline void addIF(int A, bool Apos, int B, bool Bpos) {
		if(not Apos) A = NOT(A);
		if(not Bpos) B = NOT(B);
		scc.addEdge(A, B); // A -> B
		scc.addEdge(NOT(B), NOT(A)); // not B -> not A
	}
	// A <=> (not A -> A)
	void addUNARY(int A, bool Apos) {
		addIF(A, not Apos, A, Apos); // not A -> A
	}
	// A or B <=> not A -> B
	void addOR(int A, bool Apos, int B, bool Bpos) {
		addIF(A, not Apos, B, not Bpos); // not A -> B
	}
	// not(A and B) => A -> not B
	void addNAND(int A, bool Apos, int B, bool Bpos) {
		addIF(A, Apos, B, not Bpos); // A -> not B
	}
	// A xor B <=> not(A and B) and not(not A and not B)
	void addXOR(int A, bool Apos, int B, bool Bpos) {
		addNAND(A, Apos, B, Bpos); // not(A and B)
		addNAND(A, not Apos, B, not Bpos); // not(not A and not B)
	}
	// not(A xor B) <=> A xor not B
	void addXNOR(int A, bool Apos, int B, bool Bpos) {
		addXOR(A, Apos, B, not Bpos); // A xor not B
	}
	bool solve() {
		scc.build();
		for(int i = 0; i < V; ++i) {
			if(scc.get(i) == scc.get(i + V)) {
				return false;
			}
			pos[i] = (scc.get(i) > scc.get(i + V));
		}
		return true;
	}
	bool get(int x) {
		return pos[x];
	}
};

int main() {
	int n; cin >> n;
	++n;
	int d[n]; for(int i = 0; i < n; ++i) cin >> d[i];
	d[n - 1] = 0;
	for(int s = 24; s >= 0; --s) {
		TwoSatisfiability sat(n);
		for(int i = 0; i < n; ++i) {
			for(int j = i + 1; j < n; ++j) {
				for(int mask = 0; mask < (1 << 2); ++mask) {
					bool ipos = mask & 1;
					bool jpos = (mask >> 1) & 1;
					int ii = (ipos ? d[i] : 24 - d[i]);
					int jj = (jpos ? d[j] : 24 - d[j]);
					if(min(abs(ii - jj), 24 - abs(ii - jj)) < s) {
						sat.addNAND(i, ipos, j, jpos);
					}
				}
			}
		}
		if(sat.solve()) {
			cout << s << '\n';
			return 0;
		}
	}
	
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;
char S[150];
char S1[150];


int main(void){
 vector<int> A(3,0);

 for(int i=0; i<=2; i++)cin>>A[i];
 sort(A.begin(),A.end());
 std::cout<<abs(A[1]-A[0])+abs(A[2]-A[1])<<std::endl; 

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
const int maxn=210;
int n,k,pri[10000010],linker[maxn],a[maxn],b[maxn];
bool mark[10000010],vis[maxn];
vector<int> v[maxn];
void pre()
{
	n=10000000;
	mark[1]=true;
	for (int i=2;i<=n;i++)
	{
		if (!mark[i])
		{
			pri[k++]=i;
			//cerr<<i<<endl;
		}
		for (int j=0;j<k;j++)
		{
			int m=i*pri[j];
			if (m>n)
			{
				break;
			}
			mark[m]=true;
			if (i%pri[j]==0)
			{
				break;
			}
		}
	}
}
bool dfs(int x)
{
	for (int i=0;i<v[x].size();i++)
	{
		int y=v[x][i];
		if (vis[y])
		{
			continue;
		}
		vis[y]=true;
		if (linker[y]==-1 || dfs(linker[y]))
		{
			linker[y]=x;
			return true;
		}
	}
	return false;
}
int main()
{
	pre();
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	int k=0;
	b[++k]=a[1]-1;
	for (int i=2;i<=n;i++)
	{
		if (a[i]!=a[i-1]+1)
		{
			b[++k]=a[i-1];
			b[++k]=a[i]-1;
		}
	}
	b[++k]=a[n];
	n=k;
	/*
	if (n>200)
	{
		return 0;
	}
	*/
	for (int i=1;i<=n;i++)
	{
		linker[i]=-1;
		//cerr<<b[i]<<endl;
		for (int j=i+1;j<=n;j++)
		{
			/*
			if (abs(b[i]-b[j])>10000000)
			{
				return 0;
			}
			*/
			if ((b[i]+b[j])&1 && !mark[abs(b[i]-b[j])])
			{
				//cerr<<i<<" "<<j<<" "<<abs(b[i]-b[j])<<" "<<mark[9]<<endl;
				if (b[i]&1)
				{
					v[i].pb(j);
				}
				else
				{
					v[j].pb(i);
				}
			}
		}
	}
	int s=0;
	for (int i=1;i<=n;i++)
	{
		if (!(b[i]&1))
		{
			continue;
		}
		memset(vis,false,sizeof(vis));
		if (dfs(i))
		{
			s++;
		}
	}
	int s1=0,s2=0;
	for (int i=1;i<=n;i++)
	{
		if (b[i]&1)
		{
			s1++;
		}
		else
		{
			s2++;
		}
	}
	int ans=s+((s1-s)/2+(s2-s)/2)*2+((s1-s)&1)*3;
	cout<<ans<<endl;
	return 0;
}


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

 using namespace std;

 int main() {
   int N, M, i, j, k, l;
   bool match;
   string ans;
   cin >> N >> M;

   vector<vector<char>> A(N, vector<char>(N));
   vector<vector<char>> B(M, vector<char>(M));

   for (i = 0; i < N; i++) {
     for (j = 0; j < N; j++) {
       cin >> A.at(i).at(j);
     }
   }

   for (i = 0; i < M; i++) {
     for (j = 0; j < M; j++) {
       cin >> B.at(i).at(j);
     }
   }

   ans = "No";

   for (i = 0; i < N - M + 1; i++) {
     for (j = 0; j < N - M + 1; j++) {
       match = true;
       for (k = 0; k < M; k++) {
         for (l = 0; l < M; l++) {
           if (A.at(i + k).at(j + l) != B.at(k).at(l)) {
             match = false;
           }
         }
       }
       if (match == true) ans = "Yes";
     }
   }
   cout << ans << endl;

 }


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

using namespace std;

int main()
{
    int a[3];
    int cc[8];
    for (int i=0; i<8; i++)
        cc[i]=0;
    for (int i=0; i<3; i++)
    {
        cin>>a[i];
        if (a[i]==5)
            cc[5]++;
        else if (a[i]==7)
            cc[7]++;
    }
    if (cc[5]==2 && cc[7]==1)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
}



Measured memory_bytes: 256
Public Class Main
    Public Shared Sub Main(ByVal args() As String)
        Dim N As Integer
        N = console.ReadLine()
        Dim A() As Integer
        A = Array.ConvertAll(Of String, Integer)(Split(Console.ReadLine()), AddressOf Integer.Parse)
        Dim flg As Boolean = True
        For Each Ai As Integer In A
            If Ai Mod 2 = 0 Then
                If (Ai Mod 3 <> 0) AndAlso (Ai Mod 5 <> 0) Then
                    flg = False
                    Exit For
                End If
            End If
        Next
        console.WriteLine(If(flg, "APPROVED", "DENIED"))
    End Sub
End Class


Measured memory_bytes: 13536
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  string S;
  cin >> S;
  bool is_ok = false;
  if (S[2] == S[3] && S[4] == S[5])
    is_ok = true;
  printYesNo(is_ok);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define TYPE int
#define INF 9223372036854775807

int main() {
	int N, K;
	long long ans = INF, tmp = -1;
	scanf("%d%d", &N, &K);
	int *X = (int*)malloc(sizeof(int)*N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &X[i]);
	}

	for (int i = 0; i <= N - K; i++)//先頭から長さK全探索
	{
		tmp = (long long)X[i + K - 1] - X[i];
		if (abs(X[i + K - 1]) <= abs(X[i]))
		{
			tmp += (long long)abs(X[i + K - 1]);
		}
		else
		{
			tmp += (long long)abs(X[i]);
		}
		if (tmp < ans)
		{
			ans = tmp;
		}
	}
	printf("%lld\n", ans);

	return 0;
}

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

int main() {
  char c;
  cin >> c;
  if (c  ==  'a'  || c  ==  'i'  || c  ==   'u'  || c  ==  'e'  || c  ==   'o'){
cout << "vowel" << endl;
}
  else {
cout << "consonant" << endl;
}
}


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

int main(){
  string S;
  cin >> S;
  int N = S.size();
  string rS = S;
  reverse(rS.begin(),rS.end());
  
  if(S!=rS){
    cout << "No" << endl;
    return 0;
  }
  for(int i=0;i<N/2;i++){
    if(S[i]!=rS[N/2+i+1] || rS[i]!=S[N/2+i+1]){
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll A, B;
ll t;
ll ret = 0;

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

void input() {
  IN(A);
  IN(B);
}

void solve() {
  ll G = gcd(A, B);
  ll GG = G;
  for (ll i = 2; i*i <= G; i++) {
    if (GG % i != 0) continue;
    bool update = false;
    while (GG % i == 0) {
      update = true;
      GG /= i;
    }
    if (update) ret++;
  }
  if (GG > 1) ret++;
  ret++; //1
  PRINT(ret);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int N;
	scanf("%d",&N);
	char S[1000],T[1000];
	scanf("%s %s",S,T);
	char ans[1000] = "\n";
	for(int i=0;i<N;i++){
		ans[i*2]=S[i];
		ans[i*2+1]=T[i];
	}
	
	printf("%s\n",ans);
	return 0;
}

Measured memory_bytes: 128
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI()
    prod_sum = 0
    prod_a = 1
    for a in A:
        prod_a *= a
    for a in A:
        prod_sum += (prod_a/a)
    ans = prod_a/prod_sum
    print(ans)
main()



Measured memory_bytes: 66924
#include<iostream>
#include<string>
using namespace std;
int main(void){
  int n,y;
  string str,ans;
  string s="abcdefghijklmnopqrstuvwxyz";
  cin >> n;
  getline(cin,str);
  for(int i=0;i<n;i++){
    getline(cin,str);
    for(int a=0;a<=100;a++){
      for(int b=0;b<=100;b++){
	ans.clear();
	for(int i=0;i<str.size();i++){
	  if(str[i]==' '){
	    ans+=' ';
	    continue;
	  }
	  for(int j=0;;j++){
	    if(str[i]==s[j]){
	      y=j;
	      break;
	    }
	  }
	  ans+=s[((a*y)+b)%26];
	}
	if(ans.find("that")==-1 && ans.find("this")==-1) continue;
	cout << ans << endl;
	goto lbl;
      }
    }
  lbl:;
  }
}


Measured memory_bytes: 1220
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		double rate = Math.ceil((double) N / 1.08);
		int ans = (int) rate;
		if (Math.floor(ans * 1.08) == N) {
			System.out.println(ans);
		} else {
			System.out.println(":(");
		}
		in.close();
	}
}

Measured memory_bytes: 22996
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            //System.Threading.Thread.Sleep(3000);
        }
 
        public void Solve(ConsoleInput cin)
        {
            char[] list = cin.Read.ToCharArray();
 
            Console.WriteLine( list.Count(x => x == 'o') * 100 + 700);
        }
    }
 
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long num) { var ret = new string[num]; for (long i = 0; i < num; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long num) { var ret = new int[num]; for (long i = 0; i < num; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long num) { var ret = new long[num]; for (long i = 0; i < num; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

int n;

double d(int x1,int y1,int x2,int y2)
{
    return sqrt(pow(x1-x2,2)+pow(y1-y2,2));
}

int fact(int i)
{
    if(i==1)return 1;
    return i*fact(i-1);
}

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

    vi v(s.size()+1);
    v[0]=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='<')v[i+1]=v[i]+1;
    }

    rep(i,s.size())
    {
        //cout<<v[i]<<s[i];
    }
    //cout<<v[s.size()]<<endl;

    for(int i=s.size()-1;i>=0;i--)
    {
        if(s[i]=='>' && v[i]<=v[i+1])v[i]=v[i+1]+1;
    }


    rep(i,s.size())
    {
        //cout<<v[i]<<s[i];
    }
    //cout<<v[s.size()]<<endl;

    ll ans=0;
    each(it,v)ans+=it;
    cout<<ans<<endl;
}


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

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

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 0) {
            if (s[i] == 'p') {
                ans--;
            }
        } else {
            if (s[i] == 'g') {
                ans++;
            }
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S, T;
  cin >> S >> T;
  int count = 0;
  for(int i = 0; i < 3; i++) {
    if (S.at(i) == T.at(i)) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t a,b,c;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> a>>b>>c;
	out << a * b / 2 << endl;

	return 0;
}
#endif


Measured memory_bytes: 384
// by newbiechd
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>

// DELETE the debugging information!
#define debug(x) std::cerr << #x << " = " << (x) << std::endl

const int N_MAX = 100003;
int a[N_MAX];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int odd[2], cntOdd = 0;
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &a[i]);
    if (a[i] & 1) {
      if (cntOdd > 1) {
        printf("Impossible\n");
        return 0;
      }
      odd[cntOdd] = i;
      ++cntOdd;
    }
  }
  if (m == 1) {
    if (n > 1)
      printf("%d\n2\n%d 1\n", n, n - 1);
    else
      printf("1\n1\n1\n");
    return 0;
  }
  if (m == 2) {
    if (a[1] > 1)
      printf("%d %d\n2\n%d %d\n", a[1], a[2], a[1] - 1, a[2] + 1);
    else
      printf("%d %d\n1\n%d\n", a[1], a[2], n);
    return 0;
  }
  
  if (cntOdd > 0) {
    std::swap(a[1], a[odd[0]]);
  }
  if (cntOdd > 1) {
    std::swap(a[m], a[odd[1]]);
  }
  for (int i = 1; i <= m; ++i)
    printf("%d ", a[i]);
  printf("\n%d\n", m - (a[1] == 1));
  if (a[1] > 1)
    printf("%d ", a[1] - 1);
  for (int i = 2; i < m; ++i)
    printf("%d ", a[i]);
  printf("%d\n", a[m] + 1);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll a[114514],b[114514];
int main(){
	ll n;
	cin>>n;
	for(int i=0;i<=n;i++)cin>>a[i];
	b[n]=a[n];
	for(int i=n-1;i>=0;i--){
		b[i]=a[i];
		b[i]+=b[i+1];
	}
	ll ans=1,num=1;
	if(a[0]==0){
		for(int i=1;i<=n;i++){
			num=min(2*num,b[i]);
			ans+=num;
			num-=a[i];
			if(num<0||(i!=n&&num==0)){
				cout<<-1;
				return 0;
			}
		}
		cout<<ans;
	}else if(a[0]==1)cout<<(n==0?1:-1);
	else cout<<-1;
	return 0;
}


Measured memory_bytes: 5188
#include <stdio.h>



int main(void){
	long long int ans = -9999999999;
	int i,j,k;
	int n;
	scanf("%d\n",&n);
	int f[100];
	int p[100][11];
	int kari;
	for(i=0;i<n;i++){
		f[i]=0;
		for(j=0;j<10;j++){
			f[i]*=2;
			scanf("%d",&kari);
			f[i]+=kari;
		
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<11;j++){
			scanf("%d",&p[i][j]);
		}

	}

	for(i=1;i<2*2*2*2*2*2*2*2*2*2;i++){
		int pp = 0;
		for(j=0 ;j<n;j++){
			int c = i&f[j];
			int kosu = 0;
			for(k=0;k<10;k++){
				kosu += c%2;
				c/=2;
			}
			pp += p[j][kosu];
		}
		if(ans<pp){
			ans = pp;
		}
	}

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

Measured memory_bytes: 128
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        x: Chars,
    };
    let mut c = 0;
    let mut s = 0;
    for &x_i in x.iter() {
        match x_i {
            'S' => {
                s += 1;
            }
            'T' => {
                if s > 0 {
                    s -= 1;
                    c += 2;
                }
            }
            _ => unreachable!(),
        }
    }
    let ans = x.len() - c;
    println!("{}", ans);
}


Measured memory_bytes: 2976
#include<bits/stdc++.h>
using namespace std;
using P = pair<int,int>;
int main(){
  int H, W, M;
  cin >> H >> W >> M;
  
  vector<int> h(H,0);
  vector<int> w(W,0);
  set<P> S;
  
  for(int i=0; i<M; i++){
    int x, y;
    cin >> x >> y;
    x--; y--;
    h[x]++;
    w[y]++;
    P add = {x,y};
    S.insert(add);
  }
  
  int HMAX = 0;
  int WMAX = 0;
  
  for(int i=0; i<H; i++){
    HMAX = max(HMAX,h[i]);
  }
  for(int i=0; i<W; i++){
    WMAX = max(WMAX,w[i]);
  }
      
  vector<int> MH(0);
  vector<int> MW(0);
  
  for(int i=0; i<H; i++){
    if(h[i] == HMAX){
      MH.push_back(i);
    }
  }
  for(int i=0; i<W; i++){
    if(w[i] == WMAX){
      MW.push_back(i);
    }
  }
  
  for(int i=0; i<MH.size(); i++){
    for(int j=0; j<MW.size(); j++){
      P check = {MH[i], MW[j]};
      if(!S.count(check)){
        cout << HMAX + WMAX << endl;
        return 0;
      }
    }
    if(i == MH.size() -1){
      cout << HMAX + WMAX - 1 << endl;
    }
  }
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll, int> ii;
typedef pair <ii,int> iii;

const ll inf = 1e17;
const ll mod = 1e9 + 7;
const int N = 100005;

/*
	X = A3 ^ A4 ... ^ AN
	S = A1 + A2
	encontrar a,b : a <= A1 | a+b = S | a^b = X | a : max

	a + b = (a ^ b) + 2*(a & b)
	-> a & b = ((a + b) - (a ^ b))/2
	->a & b = (S - X)/2 = D

	garantindo que D&X == 0
	se o iésimo bit de X esta ligado, acenda o iésimo
	bit de a, ou de b
*/

ll v[N];

void solve(){
	int n;
	cin >> n;
	ll X = 0;
	for(int i = 0; i < n; i++){
		cin >> v[i];
		if(i >= 2)X ^= v[i];
	}
	ll S = (v[0] + v[1]);
	ll D = (S - X)>>1, a = D, b = D;
	if(X > S or (D&X)>0){
		cout << -1 << endl;
		return ;
	}
	for(int i = 60; i >= 0; i--){
		ll temp = (1LL<<i);
		if(temp&X){
			if(a + temp <= v[0]){
				a += temp;
			}else{
				b += temp;
			}
		}
	}
	if(a <= v[0] and min(a,b) > 0 and (a^b) == X and (a+b) == S){
		cout << v[0] - a << endl;
	} else {
		cout << -1 << endl;
	}
}

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


Measured memory_bytes: 3636
def main():
    n, a, b = map(int, input().split())
    if a > b:
        a = n - a + 1
        b = n - b + 1
    if (b - a) % 2 == 0:
        print("Alice")
    else:
        print("Borys")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define N 3
using namespace std;
typedef unsigned long long ull;
bool im[1010][1010],pa[110][110];
int w,h,p,ans;
vector<ull> used;

void ppp(){
 ull a=0;
 ull roll[1001][1001]={};
 for(int i=0;i<p;i++)
   for(int j=0;j<p;j++)a=a*N+pa[i][j];
 for(int i=0;i<used.size();i++)
   if(used[i]==a)return;
 used.push_back(a);
 for(int j=0;j<h;j++){
   ull b=0,g=1;
   for(int i=0;i<p;i++)b=b*N+im[j][i],g*=N;
   roll[j][p-1]=b;
   for(int i=p;i<w;i++){
     b=b*N+im[j][i]-im[j][i-p]*g;
     roll[j][i]=b;
   }
 }
 for(int j=p-1;j<w;j++){
   ull b=0,g=1,n=1;
   for(int i=0;i<p;i++)n*=N;
   for(int i=0;i<p;i++)b=b*n+roll[i][j],g*=n;
   if(b==a)ans++;
   for(int i=p;i<h;i++){
     b=b*n+roll[i][j]-roll[i-p][j]*g; 
     if(b==a)ans++;
   }
 }
}

void ch(){
 bool npa[110][110];
 for(int i=0;i<p;i++)
   for(int j=0;j<p;j++)npa[i][j]=pa[j][p-i-1];
 for(int i=0;i<p;i++)
   for(int j=0;j<p;j++)pa[i][j]=npa[i][j];
}

void ch1(){
 for(int i=0;i<p;i++)
   for(int j=0;j<p/2;j++)swap(pa[i][j],pa[i][p-j-1]);
}

int main(){
 int D[256];
 for(int i='A';i<='Z';i++)D[i]=i-'A';
 for(int i='a';i<='z';i++)D[i]=i-'a'+26;
 for(int i='0';i<='9';i++)D[i]=i-'0'+52;
 D['+']=62,D['/']=63;
 while(cin>>w>>h>>p,w){
   string s;
   used.clear();
   for(int i=0;i<h;i++){
     cin>>s;
     for(int j=0;j<s.size();j++){
	int t=D[s[j]];
	int a=6;
	while(a--)im[i][j*6+a]=t%2,t/=2;
     }
   }
   for(int i=0;i<p;i++){
     cin>>s;
     for(int j=0;j<s.size();j++){
	int t=D[s[j]];
	int a=6;
	while(a--)pa[i][j*6+a]=t%2,t/=2;
     }
   }
   ans=0;
    for(int i=0;i<4;i++){
     ppp();
     ch1();
     ppp();
     ch1();
     ch();
   }
   cout<<ans<<endl;
 }
 return 0;
}

Measured memory_bytes: 10056
#include <iostream>
#include <cstdio>
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define all(x) (x).begin(), (x).end()

#ifdef LOCAL
#define dbg(x) cerr << #x " = " << x << endl;
#define idbg(x) #x " = " << x
#include "pretty_print.h"
#else
#define dbg(x)
#define idbg(x) ""
#endif

#ifdef _WIN32
#  define LLD "%I64d"
#else
#  define LLD "%lld"
#endif

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

template <typename T> T sqr(T x) { return x * x; }
template <typename T> T abs(T x) { return x < 0? -x : x; }
template <typename T> T gcd(T a, T b) { return b? gcd(b, a % b) : a; }
template <typename T> bool chmin(T &x, const T& y) { if (x > y) { x = y; return true; } return false; }
template <typename T> bool chmax(T &x, const T& y) { if (x < y) { x = y; return true; } return false; }


int main(int /* argc */, char** /* argv */)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef LOCAL
    assert(freopen("inp", "r", stdin));
    assert(freopen("out", "w", stdout));
    #endif

    string s;
    int k;
    while (cin >> s >> k) {
        map<pair<int, int>, ll> f;
        f[{1, 0}] = 1;

        for (auto& c : s) {
            int digit = c - '0';
            map<pair<int, int>, ll> g;
            for (auto& it : f) {
                int prefix = it.first.first;
                int cnt = it.first.second;
                for (int i = 0; i <= (prefix? digit : 9); ++i) {
                    int p = prefix && digit == i;
                    int m = i? cnt + 1 : cnt;
                    if (m > k) {
                        continue;
                    }
                    g[{p, m}] += it.second;
                }
            }
            f.swap(g);
        }
        ll ans = 0;
        for (auto& it : f) {
            if (it.first.second == k) {
                ans += it.second;
            }
        }
        cout << ans << endl;
    }

    cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    
    public static void main(String[] args){
	Scanner sc =new Scanner(System.in);
	int w = sc.nextInt();
	int det=100000;
	for(;w>0;w--){
	    det*=1.05;
	    if(det%1000!=0){
		det=((det/1000)+1)*1000;
	    }
	}
	System.out.println(det);
    }
}

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

int main() { 
	int a,b,c;
	cin >> a >> b >> c;

	cout << c << " " << a << " " << b << endl;
}


Measured memory_bytes: 256
_ = input()
A = [*map(int, input().split())]
C = [0] * (1000001)
for a in A: C[a] += 1
from functools import reduce
from math import gcd
t = any(sum(C[i::i]) > 1 for i in range(2, 1000001))
t += reduce(gcd, A) > 1
print(['pairwise','setwise','not'][t], 'coprime')


Measured memory_bytes: 127372
#include <stdio.h>
#include <math.h>
int main() {int N;double x1,x2,y1,y2,r1,r2;while (scanf("%d",&N)!=EOF) {if (!N) return 0;while (N--) {scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&r1,&x2,&y2,&r2);double a1=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));if (fabs(r1-r2)>a1) {if (r1>r2) puts("2"); else if (r1<r2) puts("-2"); else puts("1");} else {(a1<=r1+r2)?puts("1"):puts("0");}}}}

Measured memory_bytes: 0
#include <iostream>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;

int main(void)
{
	int N; cin >> N;
	vector<int> C(N - 1), S(N - 1), F(N - 1);
	rep(i, 0, N - 1)cin >> C[i] >> S[i] >> F[i];

	rep(i, 0, N) {
		int T = 0;
		rep(j, i, N - 1) {
			if (T <= S[j])T = S[j];
			else {
				int k = (T - S[j] + F[j] - 1) / F[j];
				T = k * F[j] + S[j];
			}
			T += C[j];
		}
		cout << T << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Rushia_mywife ios::sync_with_stdio(0);cin.tie(0);
#define rep(i,head,n) for(int i=(head);i<n;i++)
#define int long long
#define F first
#define S second
#define pb push_back
#define p2(n) (1<<(n))
#define lg2(n) __lg(n)
using namespace std;
using ll = long long;
using pii = pair<long long,long long>;
using ld = long double;
mt19937 mt_rand(time(0));
const int mod = 1000000007;
const int hnum = 998244353;
const ld PI = acos(-1);

string s,t;
int n,m;

int check(int l,int r){
    int res = 0;
    rep(i,l,r)
        res += s[i]!=t[i-l];
    return res;
}

void solve(){
    cin >> s >> t;
    int mn = 100000;
    n = s.size();
    m = t.size();
    rep(i,0,n-m+1)
        mn = min(mn,check(i,i+m));
    cout << mn << '\n';
}

signed main(){
    Rushia_mywife
    //int t; cin >> t;
    //while(t--)
    solve();
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll tot = 0, even = 0;
    rep(i, n) {
        tot += a[i];
        if (i % 2 == 0) even += a[i];
    }
    vector<ll> ans(n, -1);
    ans[0] = even * 2 - tot;
    rep(i, n - 1) {
        ans[i + 1] = a[i] * 2 - ans[i];
    }
    rep(i, n) printf("%lld%s", ans[i], (i == (n - 1)) ? "\n" : " ");
    return 0;
}


Measured memory_bytes: 2944
///https://www.youtube.com/watch?v=UdxHOcigDZY
#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define dbug printf("I am here\n");
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int maxn = 2e5+100;

const ll inf = 1e18;
string str[100];
int dx[] = {0 , 1, -1, 0};
int dy[] = {1 , 0, 0 ,-1};
bool border(int x , int y){
    if(x >= 0 and x < 100 and y >= 0 and y < 100)return true;
    else return false;
}

bool valid(char ch , int x , int y){
    for(int i = 0; i<4; i++){
        int xx = dx[i] + x;
        int yy = dy[i] + y;
        if(border(xx , yy) and str[xx][yy] == ch)return false;
    }
    return true;
}


int main()
{
    int n , m;
    cin >> n >> m;
    for(int i = 0; i<50; i++){
        for(int j = 0; j<100; j++)str[i].push_back('#');
    }
    for(int i = 50; i<100; i++){
        for(int j = 0; j<100; j++)str[i].push_back('.');
    }
    n--;m--;
    cout << 100 << " " << 100 << endl;
    for(int i = 1; i<49; i+=2){
        for(int j = 1; j<99; j+=2){
            if(valid('.',i,j) and n>0){
                str[i][j] = '.';
                n--;
            }
        }
    }
    for(int i = 51; i<99; i+=2){
        for(int j = 1; j<99; j+=2){
            if(valid('#' , i , j) and m>0){
                str[i][j] = '#';
                m--;
            }
        }
    }
    for(int i = 0; i<100; i++)cout << str[i] << endl;



}
/*



*/



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
int n;
vector<pair<long long, long long> > p;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    p.resize(n);
    long long minf=-(1e17+1000);
    long long maxf(1e17+1000);
    for(int i=0; i<n; i++)
    {
        cin>>p[i].F>>p[i].S;
        /*if(i==0)
        {
            minf=p[i].F;
            maxf=p[i].F;
        }
        else
        {
            minf=min(minf, p[i].F);
            maxf=max(maxf, p[i].F);
        }*/
    }
    int h=0;
    while((1ll<<(h))<maxf-minf) h++;
    maxf=minf+(1ll<<(h))-1;
    long long start=minf;
    while(h>0)
    {
        long long mmf=maxf-(1ll<<(h-1));
        long long ox=mmf;
        long long oy=minf-mmf;
        long long ox2=ox+1;
        long long oy2=oy-1;
        int parity=0;
        for(int i=0; i<n; i++)
        {
            if(p[i].F<=ox && p[i].F+p[i].S>=ox+oy)
            {
                long long z1=p[i].S-oy;
                long long z2=ox-p[i].F;
                bool odd=true;
                while(z1>0 && z2>0)
                {
                    if(z2%2==1 && z1%2==0)
                    {
                        odd=false;
                        break;
                    }
                    z1/=2;
                    z2/=2;
                }
                if(odd)
                {
                    parity++;
                }
            }
            else if(p[i].S<=oy2 && p[i].F+p[i].S>=ox2+oy2)
            {
                long long z1=p[i].F-ox2;
                long long z2=oy2-p[i].S;
                bool odd=true;
                while(z1>0 && z2>0)
                {
                    if(z2%2==1 && z1%2==0)
                    {
                        odd=false;
                        break;
                    }
                    z1/=2;
                    z2/=2;
                }
                if(odd)
                {
                    parity++;
                }
            }
        }
        if(parity%2==1)
        {
            maxf-=(1ll<<(h-1));
        }
        else
        {
            minf+=(1ll<<(h-1));
        }
        h--;
    }
    cout<<minf<<endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define double long double
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) begin(v), end(v)
#define allg(v) begin(v), end(v), greater<int>()



signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  string s;
  int a, b, c;
  
  cin >> a >> b >> c;
  
  bool i = false;
  if(a==b and b!=c) i = true;
  if(b == c and c != a) i = true;
  if(c==a and a!=b) i = true;
  
  cout << (i ?"Yes" :"No") << "\n";
  
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc157/tasks/abc157_e
# セグメント木
# 各文字をビットに対応させる(セグ木を26本持っても良い)
import sys
read = sys.stdin.readline


def read_a_int():
    return int(read())


class SegmentTree:
    def __init__(self, ls: list, segfunc, identity_element):
        '''
        セグ木 (下書き)
        一次元のリストlsを受け取り初期化する。O(len(ls))
        区間のルールはsegfuncによって定義される
        identity elementは単位元。e.g., 最小値を求めたい→inf, 和→0, 積→1, gcd→0
        [単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85%83)
        '''
        self.ide = identity_element
        self.func = segfunc
        n = len(ls)
        self.num = 2 ** (n - 1).bit_length()  # n以上の最小の2のべき乗
        self.tree = [self.ide] * (2 * self.num - 1)  # −1はぴったりに作るためだけど気にしないでいい
        for i, l in enumerate(ls):  # 木の葉に代入
            self.tree[i + self.num - 1] = l
        for i in range(self.num - 2, -1, -1):  # 子を束ねて親を更新
            self.tree[i] = segfunc(self.tree[2 * i + 1], self.tree[2 * i + 2])

    def update(self, i, x):
        '''
        i番目の要素をxに変更する(木の中間ノードも更新する) O(logN)
        '''
        i += self.num - 1
        self.tree[i] = x
        while i:  # 木を更新
            i = (i - 1) // 2
            self.tree[i] = self.func(self.tree[i * 2 + 1],
                                     self.tree[i * 2 + 2])

    def query(self, l, r):
        '''
        区間[l,r)に対するクエリをO(logN)で処理する。例えばその区間の最小値、最大値、gcdなど
        '''
        if r <= l:
            return ValueError('invalid index (l,rがありえないよ)')
        l += self.num - 1
        r += self.num - 2  # ここで半開区間でなく[l,r]で以下を処理する
        res = self.ide
        while r - l > 1:  # 右から寄りながら結果を結合していくイメージ
            if l & 1 == 0:
                res = self.func(res, self.tree[l])
            if r & 1 == 1:
                res = self.func(res, self.tree[r])
                r -= 1
            l = l // 2  # 親の一つ右に移動
            r = (r - 1) // 2  # 親の一つ左に移動
        if l == r:
            res = self.func(res, self.tree[l])
        else:
            res = self.func(res, self.tree[l])
            res = self.func(res, self.tree[r])
        return res


def segfunc(x, y):
    # 処理したい内容
    return x | y


def moji_to_bit(a):
    return 1 << (ord(a) - ord('a'))


def bit_to_sum(n):
    return sum([(n >> i) & 1 for i in range(n.bit_length())])


N = read_a_int()
S = read()[:-1]
S_bit = [moji_to_bit(s) for s in S]

# build segment tree
st = SegmentTree(S_bit, segfunc, 0)

Q = read_a_int()
for q in range(Q):
    com, a, b = read().split()
    if int(com) == 1:
        i, c = int(a) - 1, b
        st.update(i, moji_to_bit(c))
    else:
        l, r = int(a) - 1, int(b)
        print(bit_to_sum(st.query(l, r)))


Measured memory_bytes: 90260
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

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

Measured memory_bytes: 3640
fn main() {
    let v = read_vec::<usize>();
    let n = v[0];
    let k = v[1];
    let _ = read_vec::<u32>();
    if n == k {
        println!("{}", 1);
    } else {
        println!("{}", ((n - 1) + (k - 1) - 1) / (k - 1));
    }
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vb = vector<bool>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define mp make_pair
#define pb push_back
#define has(c, i) ((c).find(i) != end(c))
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for (ll i=ll(b)-1; i >= a; i--)

const ll mod = 1000000007;

int main() {
  cout << fixed << setprecision(8);

  ll H, W;
  cin >> H >> W;

  vector<vb> m(H, vb(W));

  FOR(i,0,H) {
    FOR(j, 0, W) {
      char c;
      cin >> c;
      m[i][j] = c == '.';
    }
  }

  vvl res(H, vl(W));

  res[0][0] = 1;
  
  FOR(i,0,H) {
    FOR(j,0,W) {
      if(!m[i][j])
	continue;
      
      if(i > 0) {
	res[i][j] += res[i-1][j];
	res[i][j] %= mod;
      }
      if(j > 0) {
	res[i][j] += res[i][j-1];
	res[i][j] %= mod;
      }
    }
  }

  cout << res[H-1][W-1] << endl;
}


Measured memory_bytes: 8320
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7ll;

ll x,y;
int ans;

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>x>>y;

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

cout<<ans<<endl;

}



Measured memory_bytes: 256
#include <stdio.h> 
 
  
   int main(){ 
     int h, w; 
     int i, j; 
     while(1){ 
         scanf("%d %d ", &h, &w); 
         if(h==0&&w==0)break; 
         for(i=0;i<h;i++){ 
             for(j=0;j<w;j++){ 
                 printf("#"); 
             } 
             printf("\n"); 
         } 
         printf("\n"); 
     } 
 
 
     return 0; 
 } 



Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 
    long long int l,r;
    cin >> l >> r;
    long long int ans = 2019;
 
    for(long long int i = l; i < r; ++i){
        for(long long int j = i+1; j<= r && j < l + 2019; ++j){
            ans = min((i*j)%2019, ans);
            if(ans == 0)break;
        }
    }
 
    cout << ans << endl;
 
 
}

Measured memory_bytes: 256