akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 1;
const ll mo = 1000000007;
auto mod = [](ll modx) {modx%=mo;modx+=mo;modx%=mo;return modx; };
ll mypow(ll a, ll b)
{
  ll res = 1;
  a %= mo;
  while (b)
  {
    if (b & 1)
      res = res * a % mo;
    a = a * a % mo;
    b >>= 1;
  }
  return res;
}
int main()
{
ll n ;
cin >> n ;
ll cnt=0;
vector<pair<ll,ll>> v(n);
map<pair<ll,ll>,ll> m;
rep(i,n){
  ll a , b ;
  cin >> a >> b ;
  v[i].first=a;
  v[i].second=b;
}
rep(i,n){
  if(v[i].first==0&&v[i].second==0){cnt++;continue;}
  ll a=v[i].first/(__gcd(abs(v[i].first),abs(v[i].second))),b=v[i].second/(__gcd(abs(v[i].first),abs(v[i].second)));
  if(a<0){a=-a;b=-b;}
  else if(a==0)b=abs(b);
  m[make_pair(a,b)]++;
  if(b>0)m[make_pair(b,-a)];
  else m[make_pair(-b,a)];
}

for (auto i = m.begin(); i != m.end(); ++i) {
  if(i->first.second>0){
    ans=mod(ans*(mypow(2,i->second)+mypow(2,m[make_pair(i->first.second,-(i->first.first))])-1));
    m[make_pair(i->first.first,i->first.second)]=0;
    m[make_pair(i->first.second,-(i->first.first))]=0;
  }
  else {
    ans=mod(ans*(mypow(2,i->second)+mypow(2,m[make_pair(-(i->first.second),i->first.first)])-1));
    m[make_pair(i->first.first,i->first.second)]=0;
    m[make_pair(-(i->first.second),i->first.first)]=0;
  }
}
cout << mod(ans-1+cnt) << endl;
return 0;
}

Measured memory_bytes: 31312
#include <bits/stdc++.h>
using namespace std; 
#define rep(i, N) for (int i = 0; i < (int)N; i++)

int main(){
int n;
cin >> n;
int p[51];
rep(i,n) cin >> p[i];

int count =0;
rep(i,n){
    if (p[i]!=i+1) count +=1;
}
if(count == 0|| count == 2) cout << "YES"<<endl;
else cout << "NO"<<endl;
}

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

int main() {
    int n,m;
    cin >> n >> m;
    long long mod = (int)1e9 + 7;
    vector<long long>dp(n+1,0);
    vector<bool>broken(n+1,false);
    for(int i = 0;i<m;i++){
        int x;
        cin >> x;
        broken[x] = true;
    }
    if(!broken[1])dp[1] = 1;
    if(!broken[2] && !broken[1])dp[2] = 2;
    else if(!broken[2])dp[2] = 1;
    for(int i = 3;i<=n;i++){
        if(!broken[i]){
          dp[i] = (dp[i-1]%mod + dp[i-2]%mod)%mod;
        }
    }
    cout << dp[n];
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int n; cin >> n;
  V<> h(n); for (int i = 0; i < n; ++i) cin >> h[i];
  V<> dp(n);
  dp[1] = abs(h[0] - h[1]);
  for (int i = 2; i < n; ++i) {
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
  }
  cout << dp.back() << '\n';
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    ll n,cnt=0;cin>>n;
    ll a[n];for(ll i=0;i<n;i++)cin>>a[i],cnt+=(a[i]%2);
    cout<<( cnt ? "first" : "second" );
}




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

int main() {

    int h, w;
    cin >> h >> w;

    vector<vector<int>> c(10, vector<int>(10));
    rep(i, 10){
        rep(j, 10){
            cin >> c[i][j];
        }
    }

    vector<vector<int>> a(h, vector<int>(w));
    rep(i, h){
        rep(j, w){
            cin >> a[i][j];
        }
    }

    rep(k, 10){
        rep(i, 10){
            rep(j, 10){
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }

    int ans = 0;
    rep(i, h){
        rep(j, w){
            if(a[i][j] != -1){
                ans += c[a[i][j]][1];
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define hell 1000000007
#define PI 3.14159265358979323846
using namespace std;
ll hcf(ll a,ll b)
{
    if(a%b==0)
        return b;
    else
        return hcf(b,a%b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;

   // cin>>t;
    while(t--)
    {
       ll n,m,i;
       cin>>n>>m;
       ll arr[n+1];
       for(i=0;i<n;i++)
        cin>>arr[i];
       ll p=arr[0];
       for(i=1;i<n;i++)
       {
           ll h=hcf(p,arr[i]);
           ll l=p*arr[i]/h;
           p=l;
       }
       for(i=0;i<n;i++)
       {
           if((p/arr[i])%2==0)
            break;
       }
       if(i<n || p>2*m)
        cout<<0;
       else
       {
           ll ans=2*m/p;
           cout<<(ans+1)/2;
       }
    }
}


Measured memory_bytes: 4388
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <set>
#include <map>


//マクロ
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
#define All(a) (a).begin(),(a).end()
#define RAll(a) (a).rbegin(),(a).rend()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define INFL 1e18
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

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

	int ans=0;
	REP(i, 5) {
		int x;
		cin >> x;
		if (x == 0)ans = i+1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>

using namespace std;
using ll = long long;

pair<int, int> t_dir[2] = {{1, 0}, {0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int w, h;
  while(cin >> w >> h && w && h){
    string ans = "0";
    char s[70][70] = {{}};
    vector<vector<string>> dp(h, vector<string>(w, "0"));
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
        cin >> s[i][j];
        if(s[i][j] > '9') s[i][j] = -1;
      }
    }
    for(int i = h-1; i >= 0; i--){
      for(int j = w-1; j >= 0; j--){
        if(s[i][j] == -1) continue;
        string a{s[i][j]};
        string t;
        for(auto p: t_dir){
          if(is_in_field(i+p.first, j+p.second, h, w)){
            if(s[i+p.first][j+p.second] != -1){
              string u = dp[i+p.first][j+p.second];
              if((t < u && t.length() == u.length()) || t.length() < u.length()) t = u;
            }
          }
        }
        dp[i][j] = a + t;
      }
    }
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
        char c = s[i][j];
        if(c != -1 && c-'0' != 0){
          string t = dp[i][j];
          if((ans < t && ans.length() == t.length()) || ans.length() < t.length()) ans = t;
        }
      }
    }
    cout << ans << endl;
  }
  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}



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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

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

    int K; cin >> K;
    queue<ll> que;
    REPS(i, 1, 9) que.push(i);
    ll x;
    rep(_, K) {
        x = que.front();
        que.pop();
        if (x % 10 != 0) que.push(10 * x + (x % 10) - 1);
        que.push(10 * x + (x % 10));
        if (x % 10 != 9) que.push(10 * x + (x % 10) + 1);
    }

    cout << x << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	ll n, a[100001], w[100001] = {};
	cin >> n;
	rep(i, n) cin >> a[i];
	rep(i, n) {
		w[i + 1] = 2 * a[i];
		a[i + 1] -= a[i];
		a[i] = 0;
	}
	ll tmp = w[n] / 2;
	rep(i, n) {
		w[i] += tmp * (i % 2 ? -1 : 1);
		cout << w[i] << (i + 1 < i_len ? ' ' : '\n');
	}
	return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#include <complex>

using namespace std;

typedef complex<double> Point;

double prod(const Point &v1, const Point &v2) {
    return v1.real()*v2.imag() - v2.real()*v1.imag();
}

bool ccw(const Point &p1, const Point &p2, const Point &p3) {
    return prod(p2-p1, p3-p1) < 0;
}

int main() {
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        Point p1(x1, y1), p2(x2, y2), p3(x3, y3), pp(xp, yp);
        bool f1 = ccw(p1, p2, pp), f2 = ccw(p2, p3, pp), f3 = ccw(p3, p1, pp);
        if(f1 == f2 && f2 == f3) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<string.h>
int cmp(const char*a,const char *b)
{
    return strcmp(a,b);
}
int main()
{

char str[4];
while(scanf("%s",str)!=EOF)
{
    int count=0;
    char *ptr=&str[0];
    while(*ptr!='R' && *ptr!='\0')
        {
         //   printf("%c\n",*ptr);
            ptr++;
        }
    while(*ptr=='R' && *ptr!='\0')
    {
        count++;
ptr++;
    }

printf("%d\n",count);
}
}


Measured memory_bytes: 1732
from sys import stdin

N = int(input())
readline = stdin.readline
A = list(readline().split())

def ncr(n):
    return n*(n-1) // 2

dmemo = {}
for a in A:
    dmemo.setdefault(a, 0)
    dmemo[a] += 1

max_num = 0
cmemo = {}
for dk, dv in dmemo.items():
    if dv not in cmemo:
        val = ncr(dv)
        cmemo[dv] = val
    max_num += cmemo[dv]

for a in A:
    val = dmemo[a]
    a1 = ncr(val)
    a2 = ncr(val-1)
    ans = max_num - a1 + a2
    print(ans)

Measured memory_bytes: 80332
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author bhavy seth
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, InputReader sc, PrintWriter out) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            HashSet<Integer> set = new HashSet<>();
            for (int i = 0; i < k; i++) {
                int d = sc.nextInt();
                for (int j = 0; j < d; j++) {
                    set.add(sc.nextInt());
                }
            }
            out.println(n - set.size());
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

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

using namespace std;

int main(){
	int n; scanf("%d",&n);
	vector<int> ans(n+1);
	for(int x=1;x*x<=n;x++) for(int y=1;y*y<=n;y++) for(int z=1;z*z<=n;z++) {
		int r=x*x+y*y+z*z+x*y+y*z+z*x;
		if(r<=n) ans[r]++;
	}
	rep(i,n) printf("%d\n",ans[i+1]);
	return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm(a, b) (a)/__gcd((a),(b))*(b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

vector<int> Div(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);

            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; ++i) cin >> v[i];
    sort(all(v));

    cout << v[n / 2] - v[n / 2 - 1] << endl;
    return 0;
}


Measured memory_bytes: 640
N = int(input())
S = dict()
for i in range(N):
    s = input()
    if s not in S:
        S[s] = 1
    else:
        S[s] += 1
S = sorted(S.items(), key=lambda x:(x[1],x[0]))
m = S[-1][1]
for i in range(len(S)):
    s = S[i][0]
    if S[i][1] == m:
        print(s)

Measured memory_bytes: 57436
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &&i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())
#define pow2(n) (n * n)
#define int ll
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using p_queue = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-9;
ll mod = static_cast<ll>(1e9 + 7);
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) : F(std::forward<F>(f)) {}
    template <class... Args>
    constexpr decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, std::forward<Args>(args)...); }
};
template <class F>
constexpr decltype(auto) funcs(F &&f) { return FixPoint<F>{std::forward<F>(f)}; }
template <class T>
std::vector<T> vecs(int n, T &&val) { return std::vector<T>(std::forward<int>(n), std::forward<T>(val)); }
template <class... Args>
decltype(auto) vecs(int n, Args &&... args) { return std::vector<decltype(vecs(std::forward<Args>(args)...))>(std::forward<int>(n), vecs(std::forward<Args>(args)...)); }
template <class V, class T>
void fill(V &x, const T &val) { x = val; }
template <class V, class T>
void fill(vector<V> &vec, const T &val) {
    for (auto &&v : vec)
        fill(v, val);
}

void solve() {
    int l, r, d;
    cin >> l >> r >> d;
    cout << r / d - (l - 1) / d << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout.flush();
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

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

    int n;
    cin >> n;
    if (n == 7 || n == 5 || n == 3)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


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

int main()
{
    int h, w;
    cin >> h >> w;
    vector<vector<char>> s(h + 2, vector<char>(w + 2));
    for (int i = 1; i < h + 1; i++)
    {
        for (int j = 1; j < w + 1; j++)
            cin >> s[i][j];
    }
    vector<vector<int>> a((h + 2), vector<int>(w + 2));
    for (int i = 0; i < h + 2; i++)
    {
        for (int j = 0; j < w + 2; j++)
        {
            a[i][j] = 0;
        }
    }
    for (int i = 1; i < h + 1; i++)
    {
        for (int j = 1; j < w + 1; j++)
        {
            if (s[i][j] == '#')
            {
                a[i - 1][j - 1]++;
                a[i][j - 1]++;
                a[i + 1][j - 1]++;
                a[i - 1][j]++;
                a[i + 1][j]++;
                a[i - 1][j + 1]++;
                a[i][j + 1]++;
                a[i + 1][j + 1]++;
            }
        }
    }
    for (int i = 1; i < h + 1; i++)
    {
        for (int j = 1; j < w + 1; j++)
        {
            if (s[i][j] == '#')
            {
                cout << '#';
            }
            else if (s[i][j] == '.')
            {
                cout << a[i][j];
            }
        }
        cout << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// -------------------- I/O -------------------- //
///////////////////////////////////////////////////
// https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords
template<typename T> void outputVec(const std::vector<T>& vec, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	for (auto it = vec.begin(); it != vec.end() - 1; ++it) { std::cout << *it << " "; }
	std::cout << *(vec.end() - 1) << "\n";
}
template<typename T> void outputVal(const T& res, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	std::cout << res << "\n";
}
template<typename T> T inputVal() { T a; std::cin >> a; return a; }
template<typename T> std::vector<T> inputVec(int N) {
	std::vector<T> vec(N);
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
	return vec;
}
template<typename T> void inputVec(std::vector<T>& vec) {
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
}

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
template<class T> inline bool chMin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chMax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////
void MainDp() {
	const int X = inputVal<int>();
	if (X < 100) { cout << "0" << endl; return; }
	if (X < 106) { cout << "1" << endl; return; }

	vector<int> dp(X+1, 0);
	vector<int> goods = { 100,101,102,103,104,105};
	dp[0] = 1;
	for (auto v : goods) dp[v] = 1;

	for (int i = 106; i <= X; ++i) {
		for (auto v : goods) {
			if (dp[i - v] == 1) { dp[i] = 1; break; }
		}
	}
	cout << dp[X] << endl;

}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout << std::fixed << std::setprecision(15);
	MainDp();

	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){

    int n,m,l;
    cin>>n>>m>>l;

    long long x[n][m];
    long long y[m][l];
    long long z[n][l];


    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            z[i][j]=0;
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>x[i][j];
        }
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<l;j++){
            cin>>y[i][j];
        }
    }  
    
    for(int k=0;k<n;k++){
        for(int h=0;h<l;h++){
            for(int j=0;j<m;j++){
                z[k][h]+=x[k][j]*y[j][h];
            }
        }
        
    }  
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            if(j) cout<<" ";
            cout<<z[i][j];
        }
        cout<<endl;
    } 


}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int x, y, n;

int di(int a, int b){
    return min(b-a, min(abs(a-x)+abs(b-y)+1, abs(a-y)+abs(b-x)+1));
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    cin>>n>>x>>y;
    vint ans(n, 0);
    for(int i = 1;i<n;i++){
        for(int j = i+1;j<=n;j++){
            ans[di(i, j)] += 1;
        }
    }
    for(int i = 1;i<n;i++){
        cout << ans[i] << endl;
    }
    return 0;
}


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int table[6][20] = {
	{},
	{1, 2},
	{0, 0, 2},
	{0, 0, 0, 4, 6},
	{0, 0, 0, 0, 36, 108, 220, 334, 384},
	{0, 0, 0, 0, 0, 976, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001}
};

const int N = 105;

int G[105];

void init() {
	G[1] = 0;
	for (int n = 2; n < N; ++n) {
		for (int k = 1; ; ++k) {
			if ((1ll << k) - n >= G[k]) {
				G[n] = k;
				break;
			}
		}
	}
}

int getG(long long n) {
	if (n < N) {
		return G[n];
	}
	for (int k = 1; ; ++k) {
		if ((1ll << k) - n >= G[k]) {
			return k;
		}
	}
	return -1;
}

int solve(long long n, long long k) {
	if (n < k) {
		std::swap(n, k);
	}
	if (k < 63 && (1ll << k) - n < n) {
		return solve((1ll << k) - n, k);
	}
	if (k > 5) {
		return 1001;
	}
	return k == 0 ? 1 : table[k][n];
}

int main() {
	long long n;
	read(n);
	init();
	int ans = solve(n, getG(n));
	ans += n == 4;
	ans += (n == 7) * 2;
	if (ans > 1000) {
		print(-1);
	} else {
		print(ans);
	}
}

Measured memory_bytes: 3668
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<cstring>
using namespace std;
#define llg long long 
#define yyj(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout);
llg x;
int main()
{
	//yyj("A");
	cin>>x;
	x*=2;
	llg l=1,r=1e9,ans,mid;
	while (l<=r)
	{
		mid=(l+r)>>1;
		llg val=mid*mid+mid;
		if (val>=x) {r=mid-1,ans=mid;} else l=mid+1;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111


	//tourist version

	void solve(){

		
		ini(n);
		vi morty(n);
		FOR(i,0,n){
			in(morty[i]);
		}
		if(morty[0] != 0)return out(-1);
		FOR(i,1,n)if(morty[i]-morty[i-1]>1)return out(-1);
		set<int> set1;
		int tmp = 0;
		int rick = 0;
		for(int i = n-1;i>=0;i--){
			tmp++;
			set1.insert(morty[i]+tmp);
			if(!set1.empty() and *set1.begin()-tmp == 0)set1.erase(set1.begin());
			rick+=set1.size();		
		}
		out(rick);







	}	























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


Measured memory_bytes: 6528
MOD = 1000000007
N, K = [int(x) for x in input().split()]
A_list = [int(x) for x in input().split()]
sorted_A_list = sorted(A_list)
ans = 0
for i, A in enumerate(A_list):
    n = sorted_A_list.index(A)
    tmp = ((K * (K-1) * n)//2) % MOD
    for a in A_list[i+1:]:
        tmp += K * (A > a)
    ans = (ans+tmp) % MOD
print(ans)


Measured memory_bytes: 41948
/*
    Stay motivated and keep working hard
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll N, W, maxsum;
const ll INF = 1e15 + 7;
ll dp[107][100007]; // dp[N][V] - min wt for N items equal to value V
// if this min weight is <= W and V is as max as possible that is our answer
ll wt[107], val[107];
bool vis[107][100007];
ll recur(ll n, ll v){
    // base case
    if(v <= 0){
        return 0;
    }
    if(n == 0){
        return INF;
    }
    if(vis[n][v]){
        return dp[n][v];
    }
    vis[n][v] = 1;
    return dp[n][v] = min(dp[n][v], min(recur(n-1, v), wt[n-1] + recur(n-1, v-val[n-1])));
    // if(v >= val[n]){
    //     return dp[n][v] = min(dp[n][v], min(recur(n+1, v), wt[n] + recur(n+1, v-val[n])));
    // }
    // else{
    //     return dp[n][v] = min(dp[n][v], recur(n+1, v));
    // }
}
int main(){

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

    cin >> N >> W;
    for(ll i=0;i<N;i++){
        cin >> wt[i] >> val[i];
        maxsum += val[i];
    }
    for(ll i=0;i<=N;i++){
        for(ll j=0;j<=maxsum;j++){
            dp[i][j] = INF;
        }
    }
    // recur(0, maxsum);
    bool flag = false;
    for(ll V = maxsum; V >= 0; V--){
        if(recur(N, V) <= W){
            cout << V << "\n";
            flag = true;
            break;
        }
    }
    if(!flag){
        cout << "0\n";
    }
    // for(ll i=0;i<=N;i++){
    //     for(ll j=0;j<=maxsum;j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << "\n";
    // }


    return 0;
}


Measured memory_bytes: 90240
#include <cstdio>
#include <iostream>
#include <utility>
#include <algorithm>

using namespace std;

int main(void) {
  int n;
  scanf("%d", &n);

  int l[2 * n];

  for(int i = 0; i < 2 * n; i++) {
    scanf("%d", &l[i]);
  }
  sort(l, l+(2 * n));

  int ans = 0;
  for(int i = 0; i < 2 * n; i += 2) {
    ans += l[i];
  }

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

Measured memory_bytes: 256
def nyu():
    N,K = map(int,input().split())
    A = [list(map(int,input().split())) for _ in range(N)]
    A.sort()
    return N,K,A

def kansu(N,K,A):
    
    sum = 0
    ans = -1


    for a in range(len(A)):
        sum += A[a][1]
#        print(sum,A[a][1])
        if (K <= sum):
            ans = A[a][0]
            break
    print(ans)




N,K,A = nyu()
kansu(N,K,A)

Measured memory_bytes: 27876
a=int(input())
for i in range(1,a+1):
    if i%3 ==0:
        print(" %d" %i, end="")
    else:
        x=i
        while (x):
            if x % 10 == 3:
                print(" %d"%i, end="")
                break
            else:
                x//=10
print()



Measured memory_bytes: 5868
#include <stdio.h>

int main()
{
	long long c[7], t[5], N, min;
	int i;
	scanf("%lld", &N);
	for (i = 0; i < 5; i++)
		scanf("%lld", &t[i]);
	min = t[0];
	for (i = 1; i < 5; i++)
		if (min > t[i])
			min = t[i];

	printf("%lld\n", (N-1)/min + 5);
}

Measured memory_bytes: 128
function Main(input) {
    var input = input.split(' ');
    var A = parseInt(input[0], 10);
    var B = parseInt(input[1], 10);
    var cnt = 0;
    for(a = 1; a <= 9; a++) {
        for(b = 0; b <= 9; b++)  {
            for(c = 0; c <= 9; c++) {
                var x = 10001 * a + 1010 * b + 100 * c;
                if (A <= x && x <= B) {
                    cnt++;
                }
            }
        }
    }
    console.log(cnt);
    }
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
    int N, W;
    cin>>N>>W;
    int w[N];
    long v[N];
    for(int i=0;i<N;++i){
        cin>>w[i]>>v[i];
    }
    long DP[N][W+1];
    for(int i=0;i<N;++i){
        DP[i][0] = 0;
    }
    for(int i=0;i<=W;++i){
        if(w[0]<=i){
            DP[0][i] = v[0];
        }
        else DP[0][i] = 0;
    }
    for(int i=1;i<=W;++i){
        for(int j=1;j<N;++j){
            if(w[j]<=i){
                DP[j][i] = max(DP[j-1][i], DP[j-1][i-w[j]] + v[j]);
            }
            else DP[j][i] = DP[j-1][i];
        }
    }
    cout<<DP[N-1][W]<<endl;
}


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

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define FORE( i, m, n ) FOR( i, m , n + 1 )
#define REP( i, n )     FOR( i, 0, n )
#define REPE( i, n )	FOR( i, 0, n + 1 )
#define REPR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()             
#define MP( a, b )		make_pair( (a), (b) )
#define fi				first
#define se				second

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

int gcd( int a, int b ) {
	if( a % b == 0 ) return b;
	else			 gcd( b, a % b );
}

signed main() {
	string s; cin >> s;
	REPR( i, s.size() - 1 ) {
		cout << s[i];
	}
	cout << endl;
}


Measured memory_bytes: 3196
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()
}

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()
}

fn main() {
    let v = read_vec::<u32>();
    let r = v[0];
    let d = v[1];
    let x2000 = v[2];

    let mut x = x2000;
    for _i in 1..11 {
        x = r * x - d;
        println!("{}", x);
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;



int main(void) {
	int n;
	int a[1001];
	bool flag = false;

	cin >> n;
	FOR(i, 1, n) {
		cin >> a[i];
	}
	FOR(i, 1, n) {
		FOR(t, i + 1, n) {
			if (abs(a[i] - a[t]) % (n - 1) == 0) {
				cout << a[i] << " " << a[t] << endl;
				flag = true;
			}
			if (flag) {
				break;
			}
		}
		if (flag) {
			break;
		}
	}


	return 0;
}


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

using namespace std;

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i, n){
    int v;
    cin >> v;
    a[v - 1] = i;
  }
  multiset<int> b;
  b.insert(-1);
  b.insert(-1);
  b.insert(n);
  b.insert(n);
  uint64_t r = 0;
  REP(i, n){
    int j = n - 1 - i;
    int x = a[j];
    auto it = b.upper_bound(x);
    int r1 = *it;
    int r2 = *++it;
    --it;
    int l1 = *--it;
    int l2 = *--it;
    b.insert(x);
    uint64_t v = j + 1;
    if(l1 >= 0){
      r += v * (l1 - l2) * (r1 - x);
    }
    if(r1 < n){
      r += v * (x - l1) * (r2 - r1);
    }
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void ABC100(void);
void ABC101(void);
void ABC102(void);
void ABC103(void);
void ABC104(void);
void ABC105(void);
void ABC106(void);
void ABC107(void);
void ABC108(void);
void ABC109(void);

int main(void){
    ABC103();
}

void ABC103(){
    int i,ans=0,n;
    string s,t;
    cin>>s>>t;
    n=s.length();
    for(i=0;i<n;i++){
        if(t==(s.substr(i,n)+s.substr(0,i)))ans=1;
    }
    if(ans)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

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

    int n;
    cin >> n;
    priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>, greater<pair<int, pair<int, int>>>> q;
    vector<pair<int, int>> xV, yV;
    vector<int> c[n];
    int p[n];
    long long ans = 0;

    for (int i = 0; i < n; i++)
        c[i].push_back(i), p[i] = i;

    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        xV.push_back({x, i});
        yV.push_back({y, i});
    }
    sort(xV.begin(), xV.end());
    sort(yV.begin(), yV.end());

    for (int i = 1; i < n; i++) {
        q.push({xV[i].first - xV[i - 1].first, {xV[i - 1].second, xV[i].second}});
        q.push({yV[i].first - yV[i - 1].first, {yV[i - 1].second, yV[i].second}});
    }

    while (true) {
        int cur, a, b;
        cur = q.top().first;
        a = q.top().second.first;
        b = q.top().second.second;
        q.pop();

        if (p[a] != p[b]) {
            if (c[p[a]].size() > c[p[b]].size())
                swap(a, b);

            vector<int> v, empty;
            v = c[p[a]];
            c[p[a]].swap(empty);

            for (int x : v)
                p[x] = p[b], c[p[b]].push_back(x);
            ans += cur;

            if (c[p[b]].size() == n)
                break;
        }
    }
    cout << ans << '\n';
}

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

namespace id_0535cs
{
    public class BreakingIce
    {
        int[,] _board;
        int[] _di = { 1, -1, 0, 0 };
        int[] _dj = { 0, 0, 1, -1 };
        int _maxMoves = 0;

        public BreakingIce(int[,] givenBoard)
        {
            _board = givenBoard;
        }

        public int StartSolve()
        {
            for (var i = 0; i < _board.GetLength(0); i++)
            {
                for (var j = 0; j < _board.GetLength(1); j++)
                {
                    if (_board[i, j] == 1)
                    {
                        Solve(i, j, 1);
                    }
                }
            }
            return _maxMoves;
        }

        public void Solve(int i, int j, int moves)
        {
            if (_board[i + 1, j] == 0 &&
                _board[i - 1, j] == 0 &&
                _board[i, j + 1] == 0 &&
                _board[i, j - 1] == 0)
            {
                _maxMoves = Math.Max(_maxMoves, moves);
                return;
            }
            _board[i, j] = 0;
            foreach (var x in Enumerable.Range(0, 4))
            {
                if (_board[i + _di[x], j + _dj[x]] == 1)
                {
                    Solve(i + _di[x], j + _dj[x], moves + 1);
                }
            }
            _board[i, j] = 1;
            return;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var m = int.Parse(Console.ReadLine());
                var n = int.Parse(Console.ReadLine());
                if (m == 0 && n == 0)
                {
                    return;
                }
                int[,] board = new int[n + 2, m + 2];
                for (int i = 1; i < n + 1; i++)
                {
                    var tmp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                    for (int j = 1; j < m + 1; j++)
                    {
                        board[i, j] = tmp[j - 1];
                    }
                }
                var x = new BreakingIce(board);
                Console.WriteLine(x.StartSolve());

            }
        }
    }

}



Measured memory_bytes: 9712
#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main() {                                            
	int A, B;
	cin >> A >> B;

	for (int i = 0; i <= 1e6; i++) {
	 	int first = i * 8 / 100;
		int second = i / 10;
		if (first == A && second == B) return cout << i, 0;
	}

	cout << -1 << '\n';
}


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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int a, b;
	cin>>a>>b;
	cout<<(a&1 && b&1 ? "Yes" : "No")<<'\n';
	return 0;
}


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


def solve(L: int):
    sL = "{:b}".format(L)
    N = len(sL)
    M = 2 * (N - 1) + sL.count("1") - 1
    print(N, M)
    for i in range(N - 1):
        print(i + 1, i + 2, 0)
        print(i + 1, i + 2, 2 ** i)
    for i, c in enumerate(reversed(sL[1:])):
        if c == "0":
            continue
        print(i + 1, N, int(sL[:-i - 1], 2) * 2 ** (i + 1))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    solve(L)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

int n, m;
int r;
vector<int> e[100010];
vector<int> topo;
// bool used[100010];
int in[100010];
int parent[100010];

void init() {

}

// void dfs(int i) {
//   if (used[i]) return;
//   used[i] = true;
//   REP(j, SZ(e[i])) dfs(e[i][j]);
//   topo.push_back(i);
// }
//
// void makeTopo() {
//   topo.clear();
//   REP(i, n) dfs(i);
//   reverse(ALL(topo));
// }

void input() {
  REP(i, 100010) {
    e[i].clear();
    parent[i] = -1;
    in[i] = 0;
  }
  cin >> n >> m;
  REP(i, n+m-1) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    e[a].push_back(b);
    in[b]++;
  }
  queue<int> q;
  REP(i, n) if (in[i] == 0) q.push(i);
  while(SZ(q)) {
    int i = q.front();
    topo.push_back(i);
    q.pop();
    REP(j, SZ(e[i])) {
      in[e[i][j]]--;
      if (in[e[i][j]] == 0) {
        q.push(e[i][j]);
        parent[e[i][j]] = i;
      }
    }
  }
  // REP(i, n) {
  //   REP(j, SZ(e[topo[i]])) {
  //     parent[e[topo[i]][j]] = topo[i];
  //   }
  // }
  REP(i, n) cout << parent[i] + 1 << endl;
}

void solve() {

}

int main() {
	init();
	input();
	solve();
	return 0;
}


Measured memory_bytes: 7544
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <set>
#include <string>
#include <cmath>
#include <vector>
#include <map>
using namespace std;

typedef long long ll;

int main()
{
	string s;
	cin >> s;
	ll ans = 0;
	int cnt = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'B')cnt++;
		if (s[i] == 'W')ans += 1LL*cnt;
	}
	


	
	cout << ans;
}
	

Measured memory_bytes: 640
#include<stdio.h>
int main()
{
	int a,b;
	char op;
	for(int i=1;;i++)
	{
		scanf("%d %c %d",&a,&op,&b);
		if(op=='?')break;
		if(op=='+') printf("%d\n",a+b);
		if(op=='-') printf("%d\n",a-b);
		if(op=='*') printf("%d\n",a*b);
		if(op=='/') printf("%d\n",a/b);
	}
	return 0;
}

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

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

ll a, b, c;
string s, t;
int main(){
	cin >> s;
	if(s == "Sunny"){
		p("Cloudy");
	}else if(s == "Cloudy"){
		p("Rainy");
	}else{
		p("Sunny");
	}
	return 0;
}

Measured memory_bytes: 764
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define rep(i,n) for(i=0;i<n;i++)
#define PI 3.14159265358979323846264338327950L
int main(){
    char a[3];
    int i;
    scanf("%s",a);
    rep(i,3){
        if(a[i]=='7') break;
    }
    if(i==3) printf("No");
    else printf("Yes");
    return 0;
}

Measured memory_bytes: 1724