akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
const int N=1e5+5, INF=1e9, H=20;
using namespace std;
int n, x[N], l, q, nxt[N][H];
signed main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> x[i];
    }
    x[n+1]=2e9+9;
    cin >> l;
    for(int j = 0; j < H; j++)
    {
        nxt[n+1][j] = nxt[n][j] = n+1;
    }
    for(int i = n-1; i >= 1; i--)
    {
        int nxtt = i;    // last element <= l distance away
        for(int j = H-1; j >= 0; j--)
        {
            int pos = nxtt + (1<<j);
            if(pos>n) continue;
            if(x[pos]<=x[i] + l)
            {
                nxtt = pos;
            }
        }
        nxt[i][0]=nxtt;
        for(int j = 1; j < H; j++)
        {
            nxt[i][j] = nxt[nxt[i][j-1]][j-1];
        }
    }
    /*cout << endl;
    for(int i = 1; i <= n; i++)
    {
        cout << i << ": ";
        for(int j = 0; j < H; j++)
        {
            cout << nxt[i][j] << " ";
        }
        cout << endl;
    }
    cout << endl;*/
    cin >> q;
    for(int i = 0; i < q; i++)
    {
      //  cout << "query: " << i << endl;
        int a, b;
        cin >> a >> b;
        if(a>b) swap(a, b);
        int curr = a;
        int days = 0;
        for(int j = H-1; j >= 0; j--)
        {
         //   cout << curr << " " << j << " " << nxt[curr][j] << endl;
            if(nxt[curr][j] < b)
            {
                curr = nxt[curr][j];
                days += (1<<j);
            }
        }
        cout << days+1 << endl;
    }
}

Measured memory_bytes: 9088
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int INF = 1e9+7;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repab(i,a,b) for(auto i=a;i<(b);i++)
#define rep(i,b) for(auto i=0;i<(b);i++)
#define pb push_back
#define sz(c) int((c).size())

enum {
  FOUR_CARD,
  FULL_HOURSE,
  STRAIGHT,
  THREE_CARD,
  TWO_PAIR,
  ONE_PAIR,
  NULL_HAND,
} hands;

int check(map<int, int> m)
{
  int maxnr = 0;
  int minnr = INF;
  int maxv = 0;
  int minv = INF;
  int maxnr_count = 0;
  tr (m, i) {
    if (maxnr < i->second) {
      maxnr_count=1;
      maxnr = i->second;
    } else if (maxnr == i->second) {
      maxnr_count++;
    }
    minnr = min(minnr, i->second);
    maxv = max(maxv, i->first);
    minv = min(minv, i->first);
  }
  if (maxnr == 4)
    return FOUR_CARD;
  if (maxnr == 3 && minnr == 2)
    return FULL_HOURSE;
  if (minnr == 1 && maxnr == 1) {
    if ((maxv - minv == 4) || (m[10] && m[11] && m[12] && m[13] && m[1]))
      return STRAIGHT;
  }
  if (maxnr == 3)
    return THREE_CARD;
  if (maxnr == 2) {
    if (maxnr_count == 2)
      return TWO_PAIR;
    else
      return ONE_PAIR;
  }

  return NULL_HAND;
}
void phand(map<int, int> m)
{
  vector<string> hand_name = {
    "four card",
    "full house",
    "straight",
    "three card",
    "two pair",
    "one pair",
    "null",
  };
  cout << hand_name[check(m)] << endl;
}

int main(int argc, char **argv)
{
  vi v;
  map<int, int> m;
  char c;
  int x, minval;

  for (;;) {
    v.clear();
    m.clear();
    rep (i, 4) {
      cin >> x;
      cin >> c;
      v.pb(x);
    }
    cin >> x;
    v.pb(x);
    if (cin.eof())
      break;

    rep (i, 5) {
      m[v[i]]++;
    }
    phand(m);
  }
  return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <cassert>
#include <numeric>
#include <random>


using namespace std;
typedef long long ll;

string grid[2048];

vector<int> rows[2048], cols[2048];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> grid[i];
  }
  for (int i = 0; i < n; i++) {
    rows[i].push_back(-1);
    for (int j = 0; j < m; j++) {
      if (grid[i][j] == '#') rows[i].push_back(j);
    }
    rows[i].push_back(m);
  }
  for (int i = 0; i < m; i++) {
    cols[i].push_back(-1);
    for (int j = 0; j < n; j++) {
      if (grid[j][i] == '#') cols[i].push_back(j);
    }
    cols[i].push_back(n);
  }

  int res = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (grid[i][j] == '#') continue;
      auto it = upper_bound(rows[i].begin(), rows[i].end(), j);
      int hi = it - rows[i].begin();
      it--;
      int lo = it - rows[i].begin();
      int aux = 0;
      aux += (rows[i][hi] - rows[i][lo]) - 1;
      it = upper_bound(cols[j].begin(), cols[j].end(), i);
      hi = it - cols[j].begin();
      it--;
      lo = it - cols[j].begin();
      aux += (cols[j][hi] - cols[j][lo]) - 1;
      res = max(res, aux);
    }
  }
  cout << res - 1<< endl;
  return 0;
}


Measured memory_bytes: 39740
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
const ll mod = 1000000007;

ll C[2005][2005];
int main(){
	rep(i,2005)rep(j,i+1){
		if(j==0||j==i) C[i][j]=1;
		else C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
	}
	int n,k; cin >> n >> k;
	repn(i,k){
		ll ans = C[k-1][i-1] * C[n-k+1][i];
		cout << (ans%mod+mod)%mod << endl;
	}
}

Measured memory_bytes: 30208
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

vector<int> operator *(vector<int> a, vector<int> b) {
	int n = b.size();
	vector<int> res(n);
	rep(i, n) res[i] = a[b[i]];
	return res;
}

void operator *=(vector<int> &a, vector<int> b) {
	a = a * b;
}

vector<int> perm_pow(vector<int> base, ll k) {
	int n = base.size();
	vector<int> ans(n);
	rep(i, n) ans[i] = i;
	while (k) {
		if (k & 1) ans *= base;
		base *= base;
		k >>= 1;
	}
	return ans;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n, k;
	cin >> n >> k;
	vector<int> p(n), q(n), pinv(n), qinv(n);
	rep(i, n) {
		cin >> p[i];
		p[i]--;
		pinv[p[i]] = i;
	}
	rep(i, n) {
		cin >> q[i];
		q[i]--;
		qinv[q[i]] = i;
	}
	vector<int> ans = q;
	if (k == 1) ans = p;
	if (k == 3) ans *= pinv;
	else {
		vector<int> x = pinv * qinv * p * q;
		ans *= perm_pow(x, (k - 1) / 6);
		if ((k - 1) % 6 >= 3) ans *= pinv * qinv;
		if (k % 6 == 0) ans *= p;
		if (k % 6 == 3) ans *= pinv;
		if ((k - 2) % 6 >= 3) ans *= p * qinv;
		vector<int> y = pinv * q * p * qinv;
		ans *= perm_pow(y, (k - 2) / 6);
	}
	rep(i, n) cout << ans[i] + 1 << ' ';
	cout << '\n';
}

Measured memory_bytes: 5364
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;
 
 
void solve(){
    int n;
    cin >> n;
    vi a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int cnt = 1;
    int top = a[0];
    for(int i = 1; i < n; i++){
        if(top <= a[i]){
            cnt++;
            top = a[i];
        }
    }
    cout << cnt;
}
 
int main() {
    barsik;
    int q = 1;
    //cin >> q;
    while(q--) solve();
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main (String[] args){
	    Scanner scan = new Scanner(System.in);
	    int num = Integer.parseInt(scan.next());
	    // scan.nextLine();

	    //ArrayList<String> colorList = new ArrayList<String>();
	    HashSet<String> colorSet = new HashSet<String>();
	    ArrayList<String> freeList = new  ArrayList<String>();
	    for(int i = 0; i < num; i++){
	    	String rate = checkRate(Integer.parseInt(scan.next()));
	    	if(rate.equals("自由")){
	    		freeList.add(rate);
	    	}else{
	    		colorSet.add(rate);
	    	}
	    }
	    int max = 0;
	    int min = 0;
	    int freeSize = freeList.size();
	    int colorSize = colorSet.size();
	    int nokoriColor = 8 - colorSize;

	    if(colorSize == 0){
	    	min = 1;
	    	max = freeSize;
	    }else{
	    	min = colorSize;
	    	max = freeSize + colorSize;
	    }


        /*
	    if(freeSize > 0){
	    	if(nokoriColor == 8){
	    		max = freeSize;
	    		min = 1;
	    	}
	    	if(freeSize > nokoriColor){
	    		max = 8;
	    		min = colorSize;
	    	}else if(freeSize < nokoriColor){
	    		max = colorSize + freeSize;
	    		min = colorSize;
	    	}else if(freeSize == nokoriColor){
	    		max = colorSize + freeSize;
	    		min = colorSize;
	    	}
	    }else{
	    	max = colorSize;
	    	min = colorSize;
	    }
	    */
	    System.out.println(min + " " + max);
	}

	// どのレートかチェックする
	public static String checkRate(int rateNum){
		String ret = "";
		if(1 <= rateNum && rateNum <= 399){
			ret = "灰色";
		}else if(400 <= rateNum && rateNum <= 799){
			ret = "茶色";
		}else if(800 <= rateNum && rateNum <= 1199){
			ret = "緑色";
		}else if(1200 <= rateNum && rateNum <= 1599){
			ret = "水色";
		}else if(1600 <= rateNum && rateNum <= 1999){
			ret = "青色";
		}else if(2000 <= rateNum && rateNum <= 2399){
			ret = "黄色";
		}else if(2400 <= rateNum && rateNum <= 2799){
			ret = "橙色";
		}else if(2800 <= rateNum && rateNum <= 3199){
			ret = "赤色";
		}else if(3200 <= rateNum){
			ret = "自由";
		}
		return ret;
	}
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

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

  int h = 100, w = 100;
  char grid[101][101];
  rep(i, h) rep(j, w) {
    grid[i][j] = '#';
  }

  auto in = [&](int i, int j) {
    return 0<=i&&i<h&&0<=j&&j<w;
  };

  --b;
  int ly = 0, lx = 0;
  rep(i, 20) {
    if(b <= 0) break;
    int y = 2*i+1, x = 2*i+1;
    ly = y, lx = x;
    if(y >= h || x >= w) continue;
    reps(k, 2*(i-1)+2, h) grid[k][x] = '.';
    --b;
    if(b <= 0) break;
    reps(k, 2*(i-1)+2, w) grid[y][k] = '.';
    b -= 2;
  }
  if(b == -1) grid[0][0] = '.';

  //cout<<b<<endl;
  //cout<<ly<<" "<<lx<<endl;
  rep(i, ly/2) {
    if(b <= 0) break;
    for(int j = 2*i+3; b > 0 && j < w-1; j += 2) {
      //assert(grid[2*i][j] == '#');
      //assert(grid[2*i][j-1] == '#');
      //cout<<2*i<<" "<<j+1<<endl;
      //assert(grid[2*i][j+1] == '#');
      grid[2*i][j] = '.';
      --b;
    }
    //cout<<b<<endl;
  }
  rep(j, w/2) {
    if(b <= 0) break;
    for(int i = 2*j+3; b > 0 && i < h-1; i += 2) {
      grid[i][2*j] = '.';
      --b;
    }
  }
  /*
  rep(i, 10) {
    rep(j, 10) cout << grid[i][j];
    cout << endl;
  }
  */
  const int dy[] = {0, 1, 0, -1};
  const int dx[] = {1, 0, -1, 0};
  if(0) {
    function<void(int, int)> dfs = [&](int y, int x) {
      grid[y][x] = '.';
      rep(i, 4) {
	int ny = y+dy[i], nx = x+dx[i];
	if(in(ny, nx) && grid[ny][nx] == '#') dfs(ny, nx);
      }
    };
    int cnt = 0;
    rep(i, h) rep(j, w) {
      if(grid[i][j] == '#') {
	dfs(i, j);
	++cnt;
      }
    }
    cout << cnt << endl;
  }
  //cout<<ly<<" "<<lx<<endl;
  --a;
  if(grid[1][1] != '.') grid[99][99] = '.';
  //*
  for(int i = 99; a > 0 && i > ly-1; i -= 2) {
    for(int j = 99; a > 0 && j > lx-1; j -= 2) {
      //cout<<i<<" "<<j<<endl;
      if(grid[i][j] == '.') continue;
      //assert(grid[i][j] == '#');
      //assert(grid[i][j-1] == '#');
      //assert(grid[i-1][j] == '#');
      grid[i][j] = '.';
      --a;
      //cout<<a<<endl;
    }
  }
  //*/
  if(0) {
    function<void(int, int)> dfs2 = [&](int y, int x) {
      grid[y][x] = '#';
      rep(i, 4) {
	int ny = y+dy[i], nx = x+dx[i];
	if(in(ny, nx) && grid[ny][nx] == '.') dfs2(ny, nx);
      }
    };
    int cnt = 0;
    rep(i, h) rep(j, w) {
      if(grid[i][j] == '.') {
	dfs2(i, j);
	++cnt;
      }
    }
    cout << cnt << endl;
  }
  cout << h << " " << w << endl;
  rep(i, h) {
    rep(j, w) cout << grid[i][j];
    cout << endl;
  }

  return 0;
}


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

maxy = int(Y /5000)
if maxy >= N:
    maxy = N

flag = False

for x in range(N+1):
    for y in range(maxy+1):
        if N - x - y < 0:
            break
        else:
            z = N - x -y
        if Y == 10000*x + 5000*y + 1000*z:
            print("{} {} {}".format(x,y,z))
            flag = True
            break
    if flag:
        break

if flag == False:
    print("-1 -1 -1")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=998244353;


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();

    ll n;
    cin>>n;
    ll u,v,cnt=0;
    bool ok=false;
    for(ll i=0;i<n;i++){
        cin>>u>>v;
        if(u==v) cnt++;
        else cnt=0;
        if(cnt>=3)
            ok=true;
    }
    if(ok)
        cout<<"Yes";
    else
        cout<<"No";



    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

Measured memory_bytes: 3808
using System;
using System.Diagnostics;
using System.Collections.Generic;

class Myon

{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }
    static Scanner cin;

    void calc()
    {
        int N = cin.nextInt();
        int[] A = cin.ArrayInt(N);
        List<int> L = new List<int>();
        for (int i = 0; i < N; i++)
        {
            L.Add(Math.Abs((i) - (N - 1 - i)));
        }
        Array.Sort(A);
        int[] B = L.ToArray();
        Array.Sort(B);

        long ans = 1;
        for (int i = 0; i < N; i++)
        {
            if (A[i] != B[i]) ans = 0;
        }

        Dictionary<int, int> dic = new Dictionary<int, int>();
        foreach (var i in A)
        {
            dic[i] = 0;
        }
        long mod = 1000000007;

        foreach (var i in A)
        {
            dic[i]++;
            ans *= dic[i];
            ans %= mod;
        }

        Console.WriteLine(ans);
    }

}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}




Measured memory_bytes: 24160
N=int(input())

A=input()
B=input()
C=input()

list=[]
for i in range(N):
    a=A[i]
    b=B[i]
    c=C[i]

    if a==b and b==c:
        list.append(0)
    elif (a==b and b!=c) \
        or (a==c and a!=b) \
        or (b==c and a!=c):
        list.append(1)
    elif a!=b and b!=c and c!=a:
        list.append(2)

print(sum(list))

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int x = sc.nextInt();
      	int n = sc.nextInt();
      	int[] p = new int[n];
      	int min = 200;
      	int pos = 0;
      	boolean ans = false;
		for(int i=0;i<n;i++){
          p[i] = sc.nextInt();
        }
      	for(int i=0;i<101+1;i++){
          ans = true;
          for(int j=0;j<n;j++){
            if( p[j] == i ){
              ans = false;
            }
          }
          if( ans ){
            if( Math.abs(x - i) < min ){
              min = Math.abs(x - i);
              pos = i;
            }
          }
        }
      System.out.println(pos);
	}
}

Measured memory_bytes: 27080
N, K = map(int, input().split())
X = list(map(int, input().split()))
INF = float('inf')
ans = INF
l, r = 0, K-1
for i in range(N-K+1):
    a, b = X[l+i], X[r+i]
    A, B = abs(a), abs(b)
    if a*b > 0:
        ans = min(ans, max(A, B))
    else:
        ans = min(ans, A + B + (A if A < B else B))

print(ans)


Measured memory_bytes: 14568
#include <iostream>

using namespace std;

int main()
{
    int n;
    string str;
    cin>>n>>str;
    char x=str[0];
    int num=1;
    for(int i=1;i<n;i++){
        if(x==str[i])
            continue;
        else
        {
            x=str[i];
            num++;
        }
    }
    cout<<num;
    return 0;
}


Measured memory_bytes: 3264
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define maxn 500010
#define mod 1000000007
struct cv{
    int x,y;
}hf;
vector<cv>b[610];
int n,m;
double ans,dp[610];
double res[610];
bool vis[610];
void sol(int x){
    if(x==n){
        dp[n]=0;
        vis[n]=1;
        return;
    }
    double sum=0;
    int cnt=0;
    for(auto i:b[x]){
        if(i.y)
            continue;
        cnt++;
        if(!vis[i.x])
            sol(i.x);
        sum+=dp[i.x];
    }
    vis[x]=1;
    dp[x]=sum/cnt+1;
}/**/
int main(){
    scanf("%d%d",&n,&m);
    int l,r;
    for(int i=0;i<m;i++){
        scanf("%d%d",&l,&r);
        hf.x=r,hf.y=0;
        b[l].push_back(hf);
    }
    sol(1);
    ans=dp[1];
    memcpy(res,dp,sizeof(dp));
    for(int i=1;i<n;i++){
        if(b[i].size()>1){
            double mx=0;
            int tmp = 0;
            memset(dp,0,sizeof(dp));
            memset(vis,0,sizeof(vis));
            for(int j=0;j<b[i].size();j++){
                if(mx<res[b[i][j].x]){
                    mx=res[b[i][j].x];
                    tmp=j;
                }
            }
            b[i][tmp].y=1;
            sol(1);
            ans=min(ans,dp[1]);
            b[i][tmp].y=0;
        }
    }
    printf("%.10lf\n",ans);
    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>

int main(void)
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i < 10; i++)
    {
        if (n / i < 10 && n / i > 0)
        {
            if (n % i == 0)
            {
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#import sys
#input = sys.stdin.readline
from collections import Counter
def main():
    N = int( input())
    A = list( map( int, input().split()))
    CA = Counter(A)
    d = dict()
    if len(CA) > 3:
        print("No")
        return
    if len(CA) == 1:
        if CA[0] == N:
            print("Yes")
            return
        else:
            print("No")
            return
    if len(CA) == 2:
        for c in CA:
            if c != 0:
                t = c
        if N%3 == 0 and CA[t]== CA[0]*2:
            print("Yes")
        else:
            print("No")
        return
    ans = "Yes"
    s = 0
    for c in CA:
        s ^= c
        if CA[c] != N//3:
            ans = "No"
    if s != 0:
        ans = "No"
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 14468
// doot diddly donger cuckerino Hahahahahah

#include<bits/stdc++.h>

using namespace std;

typedef long long int LL;
typedef unsigned int UINT;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<string, int> PSI;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef tuple<int,int,int> TPL;
typedef priority_queue<int> pqueue;
typedef priority_queue<int,VI,greater<int>> pdqueue;

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

#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define endl "\n"
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define F first
#define S second
#define SZ(x)           (x).size()
#define MAX(a, b)      ((a)>(b)?(a):(b))
#define MIN(a, b)      ((a)<(b)?(a):(b))
#define ALL(a)         std::begin(a), std::end(a)
#define Fill(n, x)      memset(n,x,sizeof n);
#define IN_REP         int _t; cin >> _t ; while(_t--)
#define IOS            ios::sync_with_stdio(false);cin.tie(NULL)
#define FOR(i, a, b)    for(int i=(a);i<(b);i++)
#define REP(i, n)       FOR(i,0,n)
#define FORR(i, n)      for(int i=(n);i>=0;i--)
#define EPS (double) 1e-9
#define MOD (1000*1000*1000 + 7)
#define INF 1011111111
#define LLINF 1000111000111000111LL
#define MAXN 5000007

int main() {
    IOS;
    int n,a,b;
    cin >> n >>a>>b;
    if(n == 1)cout<<"Hello World" << endl;
    else cout << a+b << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		long K = sc.nextLong();
		
		Map<Integer, Long> map = new HashMap<>(N);
		for (int i = 0; i < N; i++) {
			int a = sc.nextInt();
			long b = sc.nextLong();
			
			if (!map.containsKey(a)) {
				map.put(a, b);
			} else {
				long val = map.get(a);
				val += b;
				map.put(a, val);
			}
		}
		
		for (int i = 0; i <= 100_000; i++) {
			if (map.containsKey(i)) {
				K -= map.get(i);
			}
			
			if (K <= 0) {
				System.out.println(i);
				return;
			}
		}
	}
}


Measured memory_bytes: 90148
from queue import Queue

n = int(input())
shogens = []

for people_index in range(n):
    this_shogens = []
    shogen_num = int(input())
    for _ in range(shogen_num):
        this_shogens.append(tuple(map(int, input().split())))

    shogens.append(this_shogens)

def make_pattern(number):
    pattern = [0 for _ in range(n)]
    index = 0
    while True:
        if number == 0:
            break
        else:
            pattern[index] = number % 2
            number //= 2
            index += 1
    return pattern


def ok(pattern):
    hantei = [None for _ in range(n)]
    seen_list = []
    q = Queue()
    ret = True
    for people_index in range(len(pattern)):
        if pattern[people_index] == 1:
            q.put(people_index)
            hantei[people_index] = 1

    while True:
        if q.empty():
            break
        else:
            people_index = q.get()
            if people_index in seen_list:
                continue
            else:
                seen_list.append(people_index)

            this_shogens = shogens[people_index]

            for this_shogen in this_shogens:
                people_sareta_index = this_shogen[0]-1
                shogen = this_shogen[1]

                if shogen == 1 and (people_sareta_index not in seen_list):
                    q.put(people_sareta_index)

                if hantei[people_sareta_index] == None:
                    hantei[people_sareta_index] = shogen

                if shogen != hantei[people_sareta_index]:
                    ret = False
                    break

    return ret

def main():
    max_num = 0
    num_list = []
    for value in range(pow(2, n)-1, -1, -1):
        pattern = make_pattern(value)

        shojiki_count = 0
        for p in pattern:
            if p == 1:
                shojiki_count += 1

        if not shojiki_count in num_list:
            if ok(pattern):
                max_num = max(max_num, shojiki_count)
                num_list.append(shojiki_count)

    print(max_num)
main()

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  st s, t;
  cin >> s >> t;
  sort(all(s));
  sort(all(t), greater<char>());
  cout << (s < t ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int y = (n%10);
  if(y==2 or y==4 or y==5 or y==7 or y==9){
    cout<<"hon";
  }
  else if(y==0 or y==1 or y==6 or y==8){
    cout<<"pon";
  }
  else if(y==3){
    cout<<"bon";
  }
  return 0;
}
    

Measured memory_bytes: 3620
import java.util.*;
class  Main
{
    public static void main (String[] args) 
    {
       Scanner sc =new Scanner(System.in); 
       System.out.println();
       int r=sc.nextInt();
       double c=0.0d;
       c=2*3.14*r;
       System.out.println(c);
       
    }
}

Measured memory_bytes: 35888
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;

int main(){
  ll n;cin>>n;
  vvll g(n);
  vll cnt(n,-1),cnt2(n,-1);
  rep(i,0,n-1){
    ll a,b;cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  queue<ll> q;
  q.push(0);
  cnt[0]=0;
  while(!q.empty()){
    ll tmp=q.front();
    q.pop();
    for(auto u:g[tmp]){
      
      if(cnt[u]!=-1)continue;
      cnt[u]=cnt[tmp]+1;
      q.push(u);
    }
  }
  queue<ll> q2;
  q2.push(n-1);
  cnt2[n-1]=0;
  while(!q2.empty()){
    ll tmp=q2.front();
    q2.pop();
    for(auto u:g[tmp]){
      if(cnt2[u]!=-1)continue;
      cnt2[u]=cnt2[tmp]+1;
      q2.push(u);
    }
  }
  ll f=0,s=0;
  rep(i,0,n){
    if(cnt[i]<=cnt2[i]){
      f++;
    }
    else{
      s++;
    }
  }
  if(s>=f){cout<<"Snuke"<<endl;}
  else{cout<<"Fennec"<<endl;}
}



Measured memory_bytes: 10856
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        Console.WriteLine(Console.ReadLine().Zip(Console.ReadLine(), (x, y) => x == y ? 0 : 1).Sum());
    }
}


Measured memory_bytes: 27876
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Contest
{
    class Program
    {
        static int Main(string[] args)
        {
            new Program().Process();

            return 0;
        }

        private CommonInput cin;

        private void Process()
        {
            this.cin = new CommonInput();

            int a, b, c, d, e, f;
            double x, y;
            string s;

            while (true)
            {
                s = cin.GetLine();

                if (s == null)
                    break;

                a = int.Parse(s);
                b = cin.GetInt();
                c = cin.GetInt();
                d = cin.GetInt();
                e = cin.GetInt();
                f = cin.GetInt();

                x = (double)(c * e - f * b) / (a * e - d * b);
                y = (double)(c * d - f * a) / (b * d - e * a);

                Console.WriteLine("{0:0.000} {1:0.000}", x, y);
            }
        }
    }

    public class CommonInput
    {
        public CommonInput()
        {
            this._s = new string[0];
            this._i = 0;
        }

        private string[] _s;
        private int _i;
        private char[] _sep = { ' ' };

        public string GetLine()
        {
            if (this._i < this._s.Length)
                return this._s[this._i++];

            string line;
            this._i = 0;
            do
            {
                line = Console.ReadLine();
            } while (line == "");

            if (line == null)
                return null;

            this._s = line.Split(this._sep, StringSplitOptions.RemoveEmptyEntries);

            return this._s[this._i++];
        }

        public int GetInt()
        {
            return int.Parse(this.GetLine());
        }

        public long GetLong()
        {
            return long.Parse(this.GetLine());
        }

        public double GetDouble()
        {
            return double.Parse(this.GetLine());
        }
    }
}

Measured memory_bytes: 5800
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>

using namespace std;
#define ALL(x)			(x).begin(),(x).end()
#define REP(i, n)		for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)	for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF				(int)2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)		(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)		(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)	((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)		(!IsOdd((x)))						
#define M_PI			3.14159265358979323846
typedef long long		ll;
typedef pair<ll, ll>	P;
typedef vector<ll>		VLL;
typedef vector<VLL>		VVLL;
typedef vector<VVLL>	VVVLL;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// 枝定義
struct Edge
{
	int from;
	int	to;
	int	dist;
	Edge(){}
	Edge(int from, int to, int dist): from(from), to(to), dist(dist){}
};

// ワーシャルフロイド
template<class T>
class WarshallFloyd
{
public:
	// distList[i][j] = iからjまでの最短距離
	vector<vector<T>> distList;

public:
	WarshallFloyd(int nodeNum, const vector<Edge> &edgeList)
	{
		distList.resize(nodeNum, vector<T>(edgeList.size(), (T)1e9));
		for (auto edgeOne : edgeList) {
			distList[edgeOne.from][edgeOne.to] = edgeOne.dist;
		}

		for (int nodeCnt = 0; nodeCnt < nodeNum; nodeCnt++) {
			for (int i = 0; i < nodeNum; i++) {
				for (int j = 0; j < nodeNum; j++) {
					distList[i][j] = min(distList[i][j], distList[i][nodeCnt] + distList[nodeCnt][j]);
				}
			}
		}
	}
};

int main()
{
	// 入力
	int H, W;
	cin >> H >> W;
	
	vector<Edge> edgeList;
	REP(i, 10) {
		REP(j, 10) {
			int a;
			cin >> a;
			edgeList.emplace_back(Edge(i, j, a));
		}
	}

	VVLL wallVal(H, VLL(W));
	REP(i, H) {
		REP(j, W) {
			cin >> wallVal[i][j];
		}
	}

	// ワーシャルフロイド
	WarshallFloyd<int> res(10, edgeList);

	ll ans = 0;
	REP(i, H) {
		REP(j, W) {
			int val = wallVal[i][j];
			if (val != -1 && val != 1) {
				ans += res.distList[val][1];
			}
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main(void){
	int n,m;
	scanf("%d%d",&n ,&m);
	int a[m];
	int i;
	for(i=0;i<m;i++){
		scanf("%d",&a[i]);
		n = n - a[i];
	}
	if(n<0){
		n = -1;
	}
	printf("%d\n",n);
    return 0; 
}


Measured memory_bytes: 1764
n = int(raw_input())
lst = []
btn = []
for i in range(0, n):
	lst.append(True)
	btn.append(int(raw_input()))
tmp = 0
cnt = 0
while lst[tmp]:
	lst[tmp] = False
	if tmp == 1:
		break
	elif lst[btn[tmp]-1]:
		cnt += 1
	else:
		cnt = -1
	tmp = btn[tmp]-1

print cnt


Measured memory_bytes: 9772
//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

#define MAXN 100000

int n, k;

int input() {
	if (scanf("%d %d", &n, &k) < 0) return 0;
	return 1;
}

void init() {
}

long solve() {
	long ans = 0;
	for (int b=1; b<=n; b++) {
		int p = n/b, r = n%b;
		long d = long(p) * max(0, b-k) + max(0, r-k+1);
		ans += d;
	}
	if (k==0) ans-=n;
	return ans;
}

void output(long ans) {
	printf("%ld\n", ans);
}

void cleanup() {
}

int main() {
	//int ca; scanf("%d", &ca);
	while (input()) {
		init();
		output(solve());
		cleanup();
		//break;
	}
}





Measured memory_bytes: 128
'''
Created on Mar 21, 2013

@author: wukc
'''

import sys
w=int(sys.stdin.readline())
n=int(sys.stdin.readline())
a=[i for i in range(w+1)]

for i in range(n):
    l=sys.stdin.readline()
    x,y=map(int,l.split(","))
    a[x],a[y]=a[y],a[x]
    
print("\n".join(map(str,a[1:])))
    

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<queue<int>> ans(N);
  rep(i, M){
    int x;
    string s;
    cin >> x >> s;
    x--;
    if(s == "AC") ans.at(x).push(1);
    else ans.at(x).push(0);
  }
  int num1 = 0, num2 = 0;
  rep(i, N){
    int counter = 0;
    while(!ans.at(i).empty()){
      int x = ans.at(i).front();
      ans.at(i).pop();
      if(x == 1){
        num1++;
        num2 += counter;
        break;
      }
      else {
        counter++;
      }
    }
  }
  cout << num1 << ' ' << num2 << endl;
}

Measured memory_bytes: 67456
#include<stdio.h>

int main(void)
{
	int a,b,H,W;

	while(1)
	{
		scanf("%d %d",&H,&W);
		if((H==0)&&(W==0))
		{
			break;
		}
		else
		{
			for(a=0;a<H;a++)
			{
				for(b=0;b<W;b++)
				{
					printf("#");
				}
				printf("\n");
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
//const ll MOD = 1000000007;
const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

void solve(){
    string S, T;
    cin >> S >> T;
    S += S;
    REP(i, T.size()){
        if(S.substr(i,(int)T.size()) == T){
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,m;
    cin >> n >> m;
    int ans[n]={}; int a; 
    for(int i=0;i<2*m;i++){
  	cin >> a;
        for(int j=0;j<n;j++){
          if(a-1==j) ans[j]++;
}
}
for(int i=0;i<n;i++) cout << ans[i] << endl;
    return 0;
}


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

using namespace std;

void b_roller_coaster(void) {
	int n, k;

	cin >> n >> k;

	vector<int> h(n);

	for (int i = 0; i < n; i++)cin >> h[i];

	int ans = 0;

	for (int i = 0; i < n; i++) {
		if (h[i] >= k) ans++;
	}

	cout << ans << endl;
}

int main()
{
    b_roller_coaster();

    return 0;
}

Measured memory_bytes: 3588
using System;
using System.Collections;

namespace teisyutusensei
{
    class Program
    {
        static void Main(string[] args)
        {
            ////?????????????????????

            string dmmy = Console.ReadLine();

            string[] dmmySP = new string[2];

            char del = ' ';

            dmmySP = dmmy.Split(del);

            int n = int.Parse(dmmySP[0]);
            int qtime = int.Parse(dmmySP[1]);

            Queue QBox = new Queue();
            Queue QtimeBox = new Queue();

            for (int i = 0; i < n; i++)
            {
                string dmmy2 = Console.ReadLine();
                string[] dmmySP2 = new string[2];

                dmmySP2 = dmmy2.Split(del);

                string name = dmmySP2[0];
                QBox.Enqueue(name);

                int time = int.Parse(dmmySP2[1]);
                QtimeBox.Enqueue(time);
            }

            int Atime = 0;
            int totaltime = 0;
            int count =0;
            string Aname;

            while(count!=n)
            {
                Atime = (int)QtimeBox.Dequeue();
                Aname = (string)QBox.Dequeue();

                if(Atime<=qtime)
                {
                    totaltime = totaltime+Atime;
                    Console.WriteLine(Aname + " " + totaltime);
                    count++;

                }
                if(Atime>qtime)
                {
                    Atime = Atime - qtime;
                    QBox.Enqueue(Aname);
                    QtimeBox.Enqueue(Atime);
                    totaltime = totaltime + qtime;
                }
            }
            Console.ReadLine();

        }
    }

}

Measured memory_bytes: 12348
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch

#include<bits/stdc++.h>

using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define inf INT_MAX/3
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 3.141592653589793
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
int b[10000005];
int ord[1000000];

int main()
{
    ios_base::sync_with_stdio(0);
    //ll n,c,cnt=0,prev;
    int n,cnt=0,A=0;
    cin >> n;

    for (int i=0; i<n-1;i++)
    {
        cin>>b[i];
    }
    A+=b[0]+b[n-2];
    for (int i=0;i<n-2;i++)
    {
        A+=min(b[i],b[i+1]);
    }
    cout<<A<<endl;
}



Measured memory_bytes: 2304
#include <iostream>
#include <string>

using namespace std;

int n;
char field[1000][1000];

int dp[1000][1000];

void solve() {
	fill(dp[0], dp[1000], 0);
	for (int i = 0; i < n; i++) {
		if (field[0][i] == '.') dp[0][i] = 1;
		if (field[i][0] == '.') dp[i][0] = 1;
	}

	int max = 0;
	for(int y = 1; y < n; y++)
		for (int x = 1; x < n; x++) {
			if (field[y][x] == '*') {
				dp[y][x] = 0;
				continue;
			}
			int min = dp[y - 1][x - 1];
			if (min > dp[y][x - 1]) min = dp[y][x - 1];
			if (min > dp[y-1][x]) min = dp[y-1][x];
			dp[y][x] = min+1;
			if (dp[y][x] > max) max = dp[y][x];
		}

	cout << max << endl;
}

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

	while (cin >> n, n) {
		for (int y = 0; y < n; y++)
			for (int x = 0; x < n; x++)
				cin >> field[y][x];
		solve();
	}

}

Measured memory_bytes: 6080
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int n, m, x;
int c[15];
int a[15][15];

int dfs(int v, int cost, vint &skill) {
    if (v == n) {
        bool ok = true;
        rep(i,skill.size()) {
            if (skill[i] < x) ok = false;
        }
        if (ok) return cost;
        else return inf;
    }
    vint skill_add = skill;
    rep(i,skill.size()) skill_add[i] += a[v][i];
    return min(dfs(v+1,cost,skill),dfs(v+1,cost+c[v],skill_add));
}

int main() {
    cin >> n >> m >> x;
    rep(i,n) {
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }
    vint skill(m,0);
    if (dfs(0,0,skill) == inf) cout << -1 << endl;
    else cout << dfs(0,0,skill) << endl;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
        int a = getInt();
        int b = getInt();

        if((a + 1) / 2 >= b) {
            print("YES");
        } else {
            print("NO");
        }
    }

    public static int getInt() {
        return scan.nextInt();
    }

    public static String getLine() {
        return scan.nextLine();
    }

    public static int toInt(String str) {
        return Integer.parseInt(str);
    }

    public static long toLong(String str) {
        return Long.parseLong(str);
    }

    public static void print(String str) {
        System.out.println(str);
    }
}


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

int main()
{
	int i = 1, n = 0;
	cin >> n;
	while(++i<=n){
		int x = i;

		if (x % 3 == 0) {
			cout << ' ' << i;
		}
		else {
			while (x > 0) {
				if (x % 10 == 3) {
					cout << ' ' << i;
					break;
				}
				else {
					x /= 10;
				}
			}
		}
	}
	cout << endl;
}

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

int main() {
  long long c = 100;
  long long x;
  cin >> x;
  
  long long count =0;
  
  for(long long i=0; i<1000000000000000000; i++){
    count++;
    c += c / 100;
    if(c >= x)
      break;
  }
  cout << count  << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>

using namespace std;

int main() {
    int k, x;
    cin >> k >> x;
    
    for (int i=(x-k)+1; i<=(x+k)-1; i++)
        printf("%d%c", i, i==(x+k)-1?'\n':' ');
}


Measured memory_bytes: 888
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define co(x) cout << (x) << "\n"
#define pb push_back
#define Never
#define To

using namespace std;

int main(){

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

	int A, P;

	cin >> A >> P;

	cout << ( A * 3 + P ) / 2 << endl;

	Never To return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char s[1000001];
long long a=0,b=0;
int main()
{
	cin>>s;
	a=strlen(s);
	for (int i=0,j=strlen(s)-1;i<j;i++,j--)
	{
		if (s[i]==s[j])
		b++;
	}
	if (b==(a+2)/2)
	cout<<"Second";
	else
	{
	if (s[0]==s[strlen(s)-1])
	{
		a=a-1;
		if (a%2==0)
		cout<<"Second";
		else
		cout<<"First";
	}
	else
	{
	if (a%2==0)
	cout<<"Second";
	else
	cout<<"First";	
	}
	}
	return 0;
}

Measured memory_bytes: 384