akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

#define eN 1000

using namespace std;

bool check(int e1, int e2, int e3){
	if (((e1*e1)+(e2*e2)) == (e3*e3)){
		return true;
	}
	else{
		return false;
	}
}

int main(void){
	int N;
	cin >> N;
	vector<bool> result;

	for (int i=0; i<N; ++i){
		int e1, e2, e3;
		vector<int> len;
		cin >> e1 >> e2 >> e3;
		len.push_back(e1);
		len.push_back(e2);
		len.push_back(e3);
		sort(len.begin(), len.end());
		result.push_back(check(len[0],len[1],len[2]));
	}
	vector<bool>::iterator res = result.begin();

	while (res != result.end()){
		if (*res == true){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
		++res;
	}
	return 0;
}

Measured memory_bytes: 1212
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define DEBUG(x) cerr << (#x) << ": " << (x) << endl
#define DEBUG_VEC(v)            \
    cerr << #v << ": ";         \
    REP(__i, (v).size())        \
    cerr << ((v)[__i]) << ", "; \
    cerr << endl

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;


const int INF = 1e9;
int N, A, B, C;
vi l;


// a is accumulated sum of sticks for A
// analogously b for B, c for C
int dfs(int depth, int a, int b, int c) {
    if (depth == N)
        if (a > 0 and b > 0 and c > 0)
            return abs(a - A) + abs(b - B) + abs(c - C) - 30;
        else
            return INF;
    
    int res0 = dfs(depth + 1, a, b, c);
    int res1 = dfs(depth + 1, a + l[depth], b, c) + 10;
    int res2 = dfs(depth + 1, a, b + l[depth], c) + 10;
    int res3 = dfs(depth + 1, a, b, c + l[depth]) + 10;
    return min({res0, res1, res2, res3});
}

int main()
{
    ios::sync_with_stdio(false);
    cin >> N >> A >> B >> C;
    l.resize(N);
    REP(i, N) cin >> l[i];

    cout << dfs(0, 0, 0, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	Yes(a < b && b < c);
	return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);

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

    int n, k, r, s, p;
    cin >> n >> k >> r >> s >> p;
    string v;
    cin >> v;
    v = " " + v;

    int score = 0;
    for(int i = 1; i <= k; i ++) {
        char last = 0, cnt = 0;
        for(int j = i; j <= n; j += k) {
            if(v[j] == last)
                cnt ++;
            else {
                cnt = 1;
                last = v[j];
            }

            if(cnt % 2) {
                if(v[j] == 'r')
                    score += p;
                if(v[j] == 's')
                    score += r;
                if(v[j] == 'p')
                    score += s;
            }
        }
    }

    cout << score;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=200005;
//i_am_noob
int n,a[20],b[20],c[20],ans=0;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	rep(n) cin >> a[i];
	rep(n) cin >> b[i];
	rep(n-1) cin >> c[i];
	rep(n){
		ans+=b[a[i]-1];
		if(i>0) if(a[i-1]+1==a[i]) ans+=c[a[i-1]-1];
	}
	print1(ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

ul gcd(ul a, ul b) {
  if (a<b) swap(a, b);
  while (a%b!=0) {
    a%=b;
    swap(a, b);
  }
  return b;
}

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  ul n, x1;
  cin >> n >> x1;
  vector< ul > x(n);
  for (ul i=0; i<n; ++i) {
    ul xi;
    cin >> xi;
    if (xi>x1) x[i] = xi-x1;
    else x[i] = x1-xi;
  }
  ul d = x[0];
  for (ul i=1; i<n; ++i) {
    d = gcd(d, x[i]);
  }
  cout << d << endl;
  return 0;
}


Measured memory_bytes: 1024
n = int(input())
a = [int(i) for i in input().split()]
c = 0

while True:

    for i in range(len(a)):
        if a[i] % 2 == 0:
            a[i] = int(a[i] / 2)
        else:
            print(c)
            exit()
    c += 1



Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main()
{
    int k,s,z;
    cin>>k>>s;
    int c=0;
    for(int i=0;i<=k;i++){
    for(int j=0;j<=k;j++){
    	z=s-i-j;
    	if(s==(i+j+z))
    if(z>=0&&z<=k)
    c+=1;
    }}
    cout<<c;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;
int main(void)
{
	int n,a=0;
	char w[10],r[100][21],cpy[21],tem;
	cin >> w;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> r[i];
		strcpy(cpy,r[i]);
		strcat(r[i],cpy);
		if(tem=strstr(r[i],w) != NULL){
			a++;
		}
	}
	cout << a << endl;
	
	return 0;
}

Measured memory_bytes: 3080
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<cctype>
#include<iomanip>
#include<string>
#include<utility>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<algorithm>
using namespace std;
#define true false
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define pq priority_queue
#define rep(i,n) for (int i=0;i<n;++i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define INF 1e15
#define init(x) memset(x,0,sizeof(x))

//  code begin here
ll n,c,ans=0;
ll v[100005],x[100005],vs[100005];
int main()
{
	ios::sync_with_stdio(true);
    cin>>n>>c;
	for (int i=1;i<=n;++i) cin>>x[i]>>v[i];
	ll cur=-INF,pos;
	for (int i=1;i<=n;++i){
		vs[i]=vs[i-1]+v[i];
		if (vs[i]-x[i]>cur){cur=vs[i]-x[i];pos=i;}
	}
	ans=max(ans,cur);
	ll bestadd=0;//best addition
	for (int i=n;i>pos;--i) bestadd=max(bestadd,vs[n]-vs[i-1]-2*(c-x[i]));
	for (int i=pos;i>0;--i){
		ans=max(ans,vs[i]-x[i]+bestadd);
		bestadd=max(bestadd,vs[n]-vs[i-1]-2*(c-x[i]));
	}
	for (int i=1;i<=n;++i) x[i]=c-x[i];
	reverse(x+1,x+n+1);reverse(v+1,v+n+1);reverse(vs+1,vs+n+1);
	cur=-INF;
	for (int i=1;i<=n;++i){
		vs[i]=vs[i-1]+v[i];
		if (vs[i]-x[i]>cur){cur=vs[i]-x[i];pos=i;}
	}
	ans=max(ans,cur);
	bestadd=0;//best addition
	for (int i=n;i>pos;--i) bestadd=max(bestadd,vs[n]-vs[i-1]-2*(c-x[i]));
	for (int i=pos;i>0;--i){
		ans=max(ans,vs[i]-x[i]+bestadd);
		bestadd=max(bestadd,vs[n]-vs[i-1]-2*(c-x[i]));
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 2560
A, B, C = map(int, input().split())
K = int(input())
L = []
for i in range(K+1):
    for j in range(K+1):
        if i+j > K:
            break
        if A*(2**i) < B*(2**j) < C*(2**(K-i-j)):
            L.append('Yes')
            break

if len(L)==0:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 9176
#include <stdio.h>
#include <iostream>
#include <math.h>
#define eps 1e-9
using namespace std;
int main()
{
    double a,b,c,d,e,f,x,y;
    while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF)
    {
        x=(b*f-e*c)/(b*d-e*a);
        y=(c-a*x)/b;
        printf("%.3lf %.3lf\n",x+eps,y+eps);
    }
    return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
int m,d;
int main(){
  cin>>m>>d;
  int ans=0;
  for(int i=2;i<=9;i++)
    for(int j=2;j<=9;j++)if(i*10+j<=d&&i*j<=m)ans++;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long A, V;
  cin >> A >> V;
  long long B, W;
  cin >> B >> W;
  long long T;
  cin >> T;
  if (W >= V){
    cout << "NO" << endl;
  } else {
    if (T * (V - W) >= abs(B - A)){
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main()
{
	int a, b;
	char op;

	cin >> a >> op >> b;

	switch (op)
	{
	case '+':
		cout << a + b << endl;
		break;
	case '-':
		cout << a - b << endl;
		break;
	default:
		break;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#define ll long long
#define fr(i,p,n) for(ll i=p;i<n;i++)
#define fr1(i,p,n) for(ll i=p;i>=n;i--)
#define FAST ios::sync_with_stdio(0);
#define sz(v) (ll)v.size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979323846
#define mod 1000000007
#define mod1 998244353
#define precise cout << std::setprecision(12) << std::fixed;
#define endl "\n"
using namespace std;

ll dp[100005];
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    FAST
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        ll a[n];
        fr(i,0,n) cin>>a[i];
        sort(a,a+n);
        dp[0]=2;
        fr(i,1,k+1)
        {
            int cnt1=0,cnt2=0;
            fr(j,0,n)
            {
                if(a[j]>i) break;
                if(dp[i-a[j]]==2) cnt2++;
                else cnt1++;
            }
            if(cnt2==0) dp[i]=2;
            else dp[i]=1;
        }
        if(dp[k]==1) cout<<"First"<<endl;
        else cout<<"Second"<<endl;
    }
    return 0;
}


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

using namespace std;

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

bool p[1000001];
bool b[1000001];

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

	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	
	sort(a.begin(),a.end());
	
	for(int i=1;i<=1000000;i++) p[i] = true, b[i] = true;

	int ans = 0;
	
	for(int i=0;i<n;i++){
		if(i>0 && a[i-1]==a[i]){
			b[a[i]] = false;
			continue;
		} 
		int t = a[i];
		if(p[t]){
			for(int j=2*t;j<=1000000;j+=t){
				p[j] = false;
			}
		}
	}
	
	for(int i=0;i<n;i++) if(p[a[i]] && b[a[i]]) ans++;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5888
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int  ans=0;
		int  X= sc.nextInt();
		int  A= sc.nextInt();
		if(X<A){
			System.out.println(ans);}
		else{ans=10;	
			System.out.println(ans);}
		}
}


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

int main(){
    int N, C; cin >> N >> C;
    vector<int> s(N), t(N), c(N);
    rep(i, N) cin >> s[i] >> t[i]  >> c[i], c[i]--;
    //cout << "yesea" << endl;
/*     vector<P> B, E;
    rep(i, N){
        B.push_back({s[i], c[i]});
        E.push_back({t[i], c[i]});
    } */

    multiset<P> S[31];
    rep(i, N){
        int chanel = c[i];
        //cout << "yye" << endl;
        // 存在した時
        if(S[chanel].find(make_pair(s[i], 2)) != S[chanel].end()){
            auto it = S[chanel].find(make_pair(s[i], 2));
            //cout << "hey";
            S[chanel].erase(it);
        }else{
            //cout << "x" << endl;
            S[c[i]].insert({s[i], 1});
        }
        //cout << "t";
        if(S[c[i]].find({t[i], 1}) != S[c[i]].end()) S[c[i]].erase(S[c[i]].find({t[i], 1}));
        else S[c[i]].insert({t[i], 2});
    }
    //cout << "yes" << endl;

    multiset<P> T;
    rep(i, C){
        for(auto e: S[i]){
            T.insert(e);
        }
    }
    //for(auto e: T) cout << e.first << " " << e.second << endl;

    int ans = 0, cnt = 0;
    for(auto e: T){
        if(e.second == 1) cnt++;
        else cnt--;
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 20224
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(ll j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

signed main(){
    ll n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    ll diff = b-a;
    repp(m,n){
        if(c*m-d*(n-1-m) <= diff && diff <= -c*(n-1-m)+d*m){
            cout << "YES";
            return 0;
        }
    }
    cout << "NO";
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int n;
char a[500], b[500];

int main() {
	scanf("%d %s %s", &n, a+1, b+1);
	int i;
	
	for(i=1; i<=n; i++) {
		putchar(a[i]);
		putchar(b[i]);
	}	
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>
#include<stack>
#include<queue>
#include<iostream>
using namespace std;
int main(void)
{
	int t,n,i,j,s,f,sum;
	while(1) {
		cin >> t;
		if(t==0) break;
		cin >> n;
		sum=0;
		for(i=0;i<n;i++) {
			cin >> s >> f;
			sum+=f-s;
		}
		if(sum>=t) cout << "OK" << endl;
		else cout << t-sum << endl;
	}
	exit(0);
}
	

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

int compare_int(const void *a, const void *b){
    return *(int*)a - *(int*)b;
}

int main(void){

    int N,i,j,k,L[2001],s,ans=0,top,under;

    scanf("%d",&N);
    for(i = 0;i < N;i++){
        scanf("%d",&L[i]);
    }

    qsort(L,N,sizeof(int),compare_int);

    for(i = 0;i < N - 2;i++){
        for(j = i + 1;j < N - 1;j++){
            top = N;
            under = j + 1;
            while(under != top){
                int mid = (top + under)/2;
                if(L[mid] < L[i] + L[j]){
                    under = mid + 1;
                }else{
                    top = mid;
                }
            }
            ans += top - j - 1;
        }
    }

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

Measured memory_bytes: 128
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        var mk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var m = mk[0];
        var k = mk[1];
        if (m == 1)
        {
            if (k == 0)
            {
                Console.WriteLine("0 0 1 1");
            }
            else
            {
                Console.WriteLine(-1);
            }
            return;
        }
        if (k >= 1 << m)
        {
            Console.WriteLine(-1);
            return;
        }
        var v = Enumerable.Range(0, (1 << m)).Where(x => x != k).ToArray();
        List<int> res = new List<int>();
        res.Add(k);
        res.AddRange(v);
        res.Add(k);
        res.AddRange(v.Reverse());
        Console.WriteLine(string.Join(" ", res));
    }
}


Measured memory_bytes: 32600
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
 
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
 
using namespace std;
 
typedef long long ll;

int main(int argc, char const *argv[])
{
  int a,b;
  cin >> a >> b;
  if (a*b%2==0) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = input()
b = input()
MOD = 1000000007

ans = 1
if a[0] == b[0]:
    ans *= 3
    tate = 1
    skip = 0
    for x, y in zip(a[1:], b[1:]):
        if skip:
            skip = 0
            continue
        if x == y:
            now_tate = 1
        else:
            now_tate = 0
            skip = 1

        if tate:
            ans *= 2
        else:
            if now_tate:
                ans *= 1
            else:
                ans *= 3
        tate = now_tate
        ans = ans % MOD
else:
    ans *= 6
    tate = 0
    skip = 0
    for x, y in zip(a[2:], b[2:]):
        if skip:
            skip = 0
            continue
        if x == y:
            now_tate = 1
        else:
            now_tate = 0
            skip = 1

        if tate:
            ans *= 2
        else:
            if now_tate:
                ans *= 1
            else:
                ans *= 3
        tate = now_tate
        ans = ans % MOD
print(ans % MOD)


Measured memory_bytes: 3064
#pragma GCC optimize "-O3"
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<int,int>
#define twol pair<ll,ll>
#define four pair<two,two>
#define pb push_back
#define mk make_pair
#define y1 y1922
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
#define nn 1000003
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define vi vector<int>
#define vll vector<ll>
#define vtwo vector<two>
#define ALL(container) (container).begin(), (container).end()
#define sz(container) (int)(container.size())
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mid(a,b) (a+b>>1)
#define minN 0
#define maxN 10000000
#define na(x) ((x)<P?(x):(x)-P)
#define ab(a) (-(a)<(a)?(a):-(a))
#define FAST std::ios::sync_with_stdio(false)
#define xRand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rnd rng
#define IT iterator
typedef
tree<
  int,// aq pair<int,int> shegidzlia
  null_type,
  less/*_equal*/<int>,// aqac
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;
// '_equal' mashin ginda roca multiset gchirdeba
template<class key, class value,class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
ordered_map<int, int> my_map;
inline int rin(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
inline int bin(){
	int x=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x;
}
ll n,dp[16900004],a[20][20];
ll u,DP[16900004];
int main(){FAST;xRand;
cin>>n;
for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
		cin>>a[i][j];
	}
}
for(int i=0;i<(1<<n);i++){
	for(int j=0;j<n;j++){
		if(i&(1<<j)){
			for(int k=0;k<n;k++){
				if(i&(1<<k)){
					dp[i]+=a[j][k];
				}
			}
		}
	}
	dp[i]/=2;
	DP[i]=dp[i];
}
for(int i=0;i<n;i++){
	for (int m=0; m<(1<<n); ++m){
		u=0;
		for (int s=m; s; s=(s-1)&m){
			u=0;
			u=dp[s];
			DP[m]=max(DP[m],u+DP[m-s]);
		}
	}
}
cout<<DP[(1<<n)-1]<<endl;
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/






Measured memory_bytes: 2944
a, b, k = map(int,input().split())
c = b - a + 1
if k > c:
  for i in range(a, b+1):
    print(i)
else:
  l = list(range(a, a+k))
  l1 = list(range(b-k+1, b+1))
  l2 = l + l1
  l3 = set(l2)
  l4 = sorted(l3)
  for i in l4:
    print(i)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<vector>
typedef long long ll;
using namespace std;
const int inf=0x3f3f3f3f;
const int mod=998244353;
const int maxn=1e6+5;

const ll UP=3234566667;

ll dv[20];

vector<ll>vec;
void dfs(ll num,int dig,int fir)
{
    if(fir<0)return;
    if(fir>9)return;
    if(fir)vec.push_back(num);
    if(num>UP||dig>10)return;
    dfs(num+dv[dig+1]*fir,dig+1,fir);
    dfs(num+dv[dig+1]*(fir-1),dig+1,fir-1);
    dfs(num+dv[dig+1]*(fir+1),dig+1,fir+1);
}

int main()
{
    dv[1]=1;for(int i=2;i<=12;i++)dv[i]=dv[i-1]*10;
    for(int i=0;i<=9;i++)dfs(i,1,i);
    sort(vec.begin(),vec.end());
    int n;
    scanf("%d",&n);
    printf("%lld\n",vec[n-1]);
}

Measured memory_bytes: 6512
var main = function(input){
input = input.split(' ')
  var D = parseInt(input[0]);
  var N = parseInt(input[1]);
  var A = 1;
  var Ans;
  if(D === 0){
  Ans = A*N;
} else if(D === 1){
  Ans = A*100*N;
} else if(D === 2){
  Ans = A*10000*N;
}
  if(N === 100){
    Ans = Ans/N;
    Ans = Ans*(N+1);
  }
  console.log(Ans);
    return 0;
}
main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 7372
X = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
Y = 'DEFGHIJKLMNOPQRSTUVWXYZABC'
text = list(input())
clist = []
for i in range(len(text)):
    c = Y.find(text[i])
    clist.append(X[c])
print(''.join(clist))


Measured memory_bytes: 5576
H,W = map(int,input().split())
cmin = H*W
if H%3==0 or W%3==0:
    ans = 0
else:
    for i in range(H-1):
        s1 = W*(i+1)
        t = H-i-1
        s2 = W*(t//2)
        s3 = W*(t-t//2)
        d = max(abs(s1-s2),abs(s2-s3),abs(s3-s1))
        cmin = min(cmin,d)
        t1 = W//2
        s2 = t*t1
        s3 = t*(W-t1)
        d = max(abs(s1-s2),abs(s2-s3),abs(s3-s1))
        cmin = min(cmin,d)
    for j in range(W-1):
        s1 = H*(j+1)
        t = W-j-1
        s2 = H*(t//2)
        s3 = H*(t-t//2)
        d = max(abs(s1-s2),abs(s2-s3),abs(s3-s1))
        cmin = min(cmin,d)
        t1 = H//2
        s2 = t*t1
        s3 = t*(H-t1)
        d = max(abs(s1-s2),abs(s2-s3),abs(s3-s1))
        cmin = min(cmin,d)
    ans = cmin
print(ans)

Measured memory_bytes: 73784
using System;
class Program{
	static void Main(){
		const int mod=1000000007;
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		long[] x=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long[] y=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long ans=0,w=0,v=0;
		for(int i=1;i<s[0];i++){
			ans=(ans+((x[i]-x[i-1])%mod)*i+w)%mod;
			w=(w+((x[i]-x[i-1])%mod)*i)%mod;
		}
		v=ans;
		ans=(ans*(y[1]-y[0]))%mod;
		w=ans;
		for(int i=2;i<s[1];i++){
			ans=(ans+((((y[i]-y[i-1])%mod)*v)%mod)*i+w)%mod;
			w=(w+((((y[i]-y[i-1])%mod)*v)%mod)*i)%mod;
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 33956
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
 
struct trie{
    int next[26],cnt;
    bool flag;
    trie():flag(false){
    	cnt=0;
        for (int i=0; i<26; i++)
            next[i]=0;
    }
} tr[1000005];
int n,m,root,ip,len,k;
char ch[5005];
string ans;
 
inline void build(int now)
{
    len=strlen(ch);
    int cur=root;
    int id;
    int cen=0;
    for (int i=now-1; i<len; i++)
    {
        if (cen>5) break;
        id=ch[i]-'a';
        if (tr[cur].next[id]==0) {
            tr[cur].next[id]=++ip;
        }
        cur=tr[cur].next[id];
        cen++;
    }
    tr[cur].flag=true;
}
 
void dfs(int x)
{
    int cur=x;
    tr[cur].cnt=1;
    for (int i=0; i<26; i++)
    {
        if (tr[cur].next[i])
        {
            dfs(tr[cur].next[i]);
            tr[cur].cnt+=tr[tr[cur].next[i]].cnt;
        }
    }
}
 
inline void find(int kth)
{
    int cur=root;
    while (kth)
    {
        for (int i=0; i<26; i++)
        { 
            if (tr[cur].next[i])
            {
                if (tr[tr[cur].next[i]].cnt>=kth)
                {
                    cur=tr[cur].next[i];
                    kth--;
                    ans+=i+'a';
                    break;
                }
                else {
                    kth-=tr[tr[cur].next[i]].cnt;
                }
            }
        }
    }
}
 
int main()
{
    scanf("%s",ch);
    n=strlen(ch);
    for (int i=1; i<=n; i++)
        build(i);
    dfs(root);
         
    scanf("%d",&k);
    find(k);
     
    cout<<ans;
     
    return 0;
}

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

typedef long long int ll;
typedef long double ld;

#define Pb push_back
#define Mp make_pair

#define ff first
#define ss second

#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))

#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define db1(x) cout<<#x<<" : "<<x<<endl;
#define db2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define db3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;

void solve()
{
   int n,k;
   cin >> n >> k;
   int a[n];
   for(int i=0;i<n;i++)
   {
      cin >> a[i];
   }
   sort(a,a+n);
   ll sum = 0;
   for(int i=0;i<k;i++)
   {
      sum += a[i];
   }
   cout << sum;
}

signed main()
{
  IOS;
  //freopen("input.txt", "rt", stdin);
  //freopen("output.txt", "wt", stdout);
  int t=1;
  //cin >> t;
  while(t--)
  {
    solve();
  }
  return 0;
}
/*==============================================================================================================================================================*/


Measured memory_bytes: 3640
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		double b = sc.nextDouble();
		long bb = (long)(b*100.0+0.5);
		
		long ans = (a*bb)/100;
		
		System.out.println(ans);
		sc.close();
	}

}

Measured memory_bytes: 37344
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

#include <map>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    map<string, int> m;
    m["SUN"] = 7;
    m["MON"] = 6;
    m["TUE"] = 5;
    m["WED"] = 4;
    m["THU"] = 3;
    m["FRI"] = 2;
    m["SAT"] = 1;
    cout << m[s] << endl;

    return 0;
}


Measured memory_bytes: 256
import bisect
from itertools import accumulate
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if sum(B) > sum(A):
    print(-1)
else:
    donor = []
    acceptance = []
    for a, b in zip(A, B):
        if a > b:
            donor.append(a-b)
        elif a < b:
            acceptance.append(b-a)
    donor.sort(reverse=True)

    ans = len(acceptance)
    ans += bisect.bisect_left([0]+list(accumulate(donor)), sum(acceptance))
    print(ans)


Measured memory_bytes: 24696
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

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

int main()
{
	int n;
	double sum = 0;
	double temp;

	cin >> n;
	REP(i, n) {
		cin >> temp;
		sum += temp;
	}
	cout << (int)(sum/n) << endl;
	return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define LOG1(a)    cerr<< #a << " = " << (a) << "\n"
#define LOG2(a, b) cerr<< #a << " = " << (a) << ", " << #b << " = " << (b) << "\n"
#define endl "\n"
#define sz(a) (int)(a.size())
#define all(a) a.begin(), a.end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll INF = 1e18;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int nax = 1000000 + 10;

int n, arr[nax];
int main()
{
    ios::sync_with_stdio(0);
    ll a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    ll mini = INF;
    for(ll i = 0; i <= 10000000; i++)
    {
        ll cur = c * i;
        ll left = i / 2;
        ll aleft = max(0LL, x - left);
        cur += (a * aleft);
        ll bleft = max(0LL, y - left);
        cur += (bleft * b);
        mini = min(mini, cur);
    }
    cout << mini;
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main implements Runnable {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Thread(null, new Main(), "", 128 * 1024 * 1024).start();
    }

    public void run() {
        int n = sc.nextInt(), hp = sc.nextInt();
        int[] dmgA = new int[n];
        Integer[] dmgB = new Integer[n];
        int maxA = 0;
        long sumB = 0;
        for (int i = 0; i < n; i++) {
            dmgA[i] = sc.nextInt();
            dmgB[i] = sc.nextInt();
            maxA = Math.max(maxA, dmgA[i]);
        }
        int count = 0;
        Arrays.sort(dmgB, Collections.reverseOrder());
        for (int i = 0; i < n; i++) {
            if (maxA < dmgB[i] && sumB < hp) {
                sumB += dmgB[i];
                count++;
            }
        }
        if (sumB < hp) {
            hp -= sumB;
            int aCount = hp / maxA;
            count += aCount;
            hp -= aCount * maxA;
            if (hp > 0) {
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 82920
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const ull M=1000000007;

int main()
{
    ull n,m,x;
    cin>>n>>m;
    if(n>m) swap(n,m);
    x=(m-n<2);
    for(ull i=1;i<=n;i++)x*=i,x%=M;
    x=(x*x)%M;
    if(n==m) x*=2;
    else x*=m;
    cout<<x%M<<endl;

    return 0;
}



Measured memory_bytes: 384
#include<stdio.h>
#define SMAX 100000
#define TMAX 50000
#define FOUND 1
#define NOT_FOUND 0

int search(int *, int, int);

int main(){
  int n, q, cnt = 0;
  int s[SMAX], t[TMAX];
  int i;

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

  scanf("%d", &q);
  for(i=0;i<q;i++){
    scanf("%d", &t[i]);
    cnt += search(s, t[i], n);
    //printf("%d\n", search(s, t[i], n));
  }

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

int search(int *s, int key, int n){
  int mid, left, right;
  left = 0;
  right = n;
  while(left < right){
    mid = (left + right) / 2;
    if(s[mid] == key) return FOUND;
    else if(s[mid] > key) right = mid;
    else left = mid + 1;
  }
  return NOT_FOUND;
}



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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 4e5 + 5;
const int inf = 2e9;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  //cout << fixed << setprecision(6);
  int n;
  cin>>n;
  vector<int> dp(n,inf),v(n);
  
  for (int i=0; i<n; i++) cin>>v[i];
  
  dp[0]=0;
  for (int i=0; i<n; i++) {
    if (i+1<n) dp[i+1] = min(dp[i+1], abs(v[i+1]-v[i])+dp[i]);
    if (i+2<n) dp[i+2] = min(dp[i+2], abs(v[i+2]-v[i])+dp[i]);
  }

  out(dp[n-1]);

  return 0;
  //try using ll
  //ur outputting the answer incorrectly
  //try something simpler
  //read the prompt more carefully
  //challenge your assumptions
}


Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

public class Main
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String s;
		while((s=br.readLine())!=null && !s.isEmpty())
		{
			int[] l = new int[10];
			int[] v = new int[2];
			for (int i = 0; i < 10; i++) {
				l[i] = Integer.parseInt(s.split(",")[i]);
			}
			for (int i = 10; i < 12; i++) {
				v[i-10] = Integer.parseInt(s.split(",")[i]);
			}
			System.out.println(calc(l,v));
		}
	}
	private static int calc(int[] l, int[] v)
	{
		double sum_l=0.0;
		double intersection;
		for (int i = 0; i < l.length; i++) {
			sum_l+=l[i];
		}
		
		intersection = sum_l/(v[0]+v[1]) * v[0];
		int count=0;
		for(int i=0; intersection>0; i++){
			intersection -= l[i];
			count = i;
		}
		return count+1;
	}
}

Measured memory_bytes: 9680
using System;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Numerics;

namespace ConsoleApplication1
{
    class Program
    {
        static long[] dx = new long[] { -1, 0, 1, 0 };
        static long[] dy = new long[] { 0, 1, 0, -1 };

        static void Main(string[] args)
        {
            var str = Console.ReadLine().Split();
            var a = Int32.Parse(str[0]);
            var b = Int32.Parse(str[1]);

            if (a > 0 && b > 0)
            {
                Console.WriteLine("Positive");
            }
            else if ( (a <= 0 && b >= 0) || (a >= 0 && b <= 0))
            {
                Console.WriteLine("Zero");
            }
            else
            {
                Console.WriteLine(Math.Abs(a - b) % 2 == 0 ? "Negative" : "Positive");
            }
        }
    }
}

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

using namespace std;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define debug(x) cerr << #x << ":" << x << endl;
#define debug2(x) for(auto a : x) cerr << a << " "; cerr << endl;
#define debug3(x) rep(i, sizeof(x)) cerr << x[i] << " "; cerr << endl;

vector<pii> around = {MP(1, 0), MP(-1, 0), MP(0, 1), MP(0, -1)};

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

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    if (k % 2 == 0) {
        ll ans = (n / k)*(n / k)*(n / k);
        k /= 2;
        ans += CEIL((n / k), 2) * CEIL((n / k), 2) * CEIL((n / k), 2);
        cout << ans << endl;
    } else {
        ll ans = (n / k) * (n / k)*(n / k);
        cout << ans << endl;
    }



    return 0;
}



Measured memory_bytes: 256
<?php
//$N = trim(fgets(STDIN));
list($H,$W) =  explode(" ",trim(fgets(STDIN)));
//$A =  explode(" ",trim(fgets(STDIN)));

$dx = array(-1,0,1,0);
$dy = array(0,-1,0,1);
for($i=0;$i<$H;$i++) {
  $S[] =  explode(" ",trim(fgets(STDIN)));
}
$ans = 0;
for($i=0;$i<$H;$i++) {
  for($j=0;$j<$W;$j++) {
    if (S_get($i,$j)=="#") continue;
    $q = array();
    $dist = array();
    $q[] = new PairIJ($i,$j);
    $dist[$i][$j]=0;
    while(!empty($q)) {
      $wk = array_shift($q);
      for($k=0;$k<4;$k++) {
        $ni = $wk->I + $dx[$k];
        $nj = $wk->J + $dy[$k];
        $wks = S_get($ni,$nj);
        if ($wks===false) continue;
        if ($wks=="#") continue;
        if (isset($dist[$ni][$nj])) continue;
        $dist[$ni][$nj]=$dist[$wk->I][$wk->J]+1;
        $q[] = new PairIJ($ni,$nj);
      }
    }
    for($si=0;$si<$H;$si++) {
      for($sj=0;$sj<$W;$sj++) {
        if (!isset($dist[$si][$sj])) continue;
        $ans = max($ans,$dist[$si][$sj]);
      }
    }
  }
}
printf("%d\n",$ans);


function S_get($y,$x)
{
  global $S,$W,$H;
  if (!isset($S[$y])) return false;
  $line = $S[$y][0];
  if (!isset($line[$x])) return false;
  return $line[$x];
}

Class pairIJ {
  public $I;
  public $J;
  public function __construct($i,$j)
  {
    $this->I = $i;
    $this->J = $j;
  }
}


Measured memory_bytes: 4728
/// In The Name Of God

#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)

#define Kazakhstan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define nl '\n'
#define ioi exit(0);

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

const int N = (int)5e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

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

using namespace std;


int main() {
	#ifdef wws
		freopen ("in.txt", "r", stdin);
	#endif
	char c;
	cin >> c;
	cout << (isupper(c) ? 'A' : 'a');
	ioi
}


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

using namespace std;

typedef long long ll;

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

    int n;cin>>n;
    ll l;cin>>l;
    std::vector<ll> v(n);
    ll idx;
    bool flag=false;
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    for(int i=0;i<n-1;i++){
        if(v[i]+v[i+1]>=l){
            idx=i;
            flag=true;
            break;
        }
    }
    if(flag){
        cout<<"Possible"<<endl;
        for(int i=0;i<idx;i++){
            cout<<i+1<<endl;
        }
        for(int i=n-2;i>idx;i--){
            cout<<i+1<<endl;
        }
        cout<<idx+1<<endl;
    }
    else cout<<"Impossible"<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
typedef long long ll;
int n,k,i,j;
char c[105];
ll ans;
int main(){
	scanf("%s%d",c+1,&k);n=strlen(c+1);
	for(i=2;i<=n;++i)if(c[i]!=c[1])break;
	if(i>n){printf("%lld\n",1ll*n*k>>1);return 0;}
	for(i=1;i<=n;i=j){
		for(j=i;c[j]==c[i];++j);
		if(j>n){
			for(j=1;c[j]==c[i];++j);
			ans+=1ll*(k-1)*(n-i+j>>1)+(n-i+1>>1)-1ll*(k-1)*(j-1>>1);break;
		}
		ans+=1ll*k*(j-i>>1);
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main(){
  
  string s, t;
  
  cin >> s >> t;
  
  for(int i = 0;i < t.size();i++){
    if(s == t){
      cout << "Yes" << endl;
      return 0;
    }
    rotate(s.begin(), s.end() - 1, s.end());
  }
  cout << "No" << endl;
  
  return 0;
}

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


int main() {
	for (int n = 1; n >0; n++) {
		int a,b;
		cin >> a>>b;
		if (a==0&&b == 0)break;
		if (a > b) {
			int t = b;
			b = a;
			a = t;
		}
		cout << a << " " << b << endl;
	}
	return 0;
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int n,k;cin>>n>>k;
    VI a(n);
    int idx=0;
    REP(i,n){
        cin>>a[i];
        if(a[i]==1){
            idx=i;
        }
    }
    LL result=1;
    int now = k-1;
    while(now < idx){
        now += k-1;
        result++;
    }
    while(now<n-1){
        now += k-1;
        result++;
    }
    cout<<result<<endl;

	return;
}

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

Measured memory_bytes: 640
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

#define MAX_NODE 100

struct Vertex {
    int i;                      /* vertex id */
    int degree;                
    int adj[MAX_NODE + 1];      /* 1 ~ MAX_NODE */
};

static void VertexInitialize(struct Vertex* V, int index) {
    memset(V, 0x00, sizeof(struct Vertex));
    
    V->i = index;
    V->degree = 0;

    return;
}

static void VertexInvalidate(struct Vertex* V) {
    V->i = 0;

    return;
}

static void VertexAddEdge(struct Vertex* V, int v) {
    V->adj[v] = 1;
    V->degree++;

    return;
}

struct Graph {
    int num;
    struct Vertex vertex[MAX_NODE + 1]; /* 1 ~ MAX_NODE */
};

static void GraphInitialize(struct Graph* G) {
    int i;

    G->num = 0;
    for ( i = 0; i <= MAX_NODE; i++ ) {
        VertexInvalidate(&G->vertex[i]);
    }

    return;
}

static void GraphAddEdge(struct Graph* G, int v, int w) {
    VertexAddEdge(&G->vertex[v], w);

    return;
}

static void GraphAddVertex(struct Graph* G, struct Vertex* V) {

    memcpy(&G->vertex[V->i], V, sizeof(struct Vertex));
    G->num++;

    GraphAddEdge(G, 0, V->i);

    return;
}

struct DFS {
    int discovered[MAX_NODE + 1];
    int finished[MAX_NODE + 1];
};

static void DFSInitialize(struct DFS *dfs) {
    memset(dfs, 0x00, sizeof(struct DFS));

    return;
}

static int DFSProcess(struct DFS* dfs, const struct Graph* G, int v, int time) {
    int i;

    dfs->discovered[v] = time++;

    for ( i = 1; i <= G->num; i++ ) {
        if ( G->vertex[v].adj[i] && !dfs->discovered[i] ) {
            time = DFSProcess(dfs, G, i, time);
        }
    }

    dfs->finished[v] = time++;
    
    return time;
}

static void DFS(struct DFS* dfs, const struct Graph* G, int s) {
    int time = 0;
    
    DFSInitialize(dfs);

    time = DFSProcess(dfs, G, s, time);

    return;
}

static void DFSResult(const struct DFS* dfs, const struct Graph* G) {
    int i;

    for ( i = 1; i <= G->num; i++ ) {
        printf("%d %d %d\n", i, dfs->discovered[i], dfs->finished[i]);
    }

    return;
}


int main(int argc, char* argv[]) {
    struct Graph G;
    struct DFS dfs;
    int n;
    int i, j;

    GraphInitialize(&G);

    scanf("%d\n", &n);
    for ( i = 0; i < n; i++ ) {
        struct Vertex V;
        int u, k;
        
        scanf("%d %d", &u, &k);

        VertexInitialize(&V, u);
        GraphAddVertex(&G, &V);
    
        for ( j = 0; j < k; j++ ) {
            int v;
            scanf("%d", &v);

            GraphAddEdge(&G, u, v);
        }
        fgetc(stdin);           /* newline */
    }

    DFS(&dfs, &G, 0);

    DFSResult(&dfs, &G);
        
    return 0;
}




Measured memory_bytes: 2096