akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descsort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void)
{
    int k;
    cin>>k;
    string s;
    rep(i,0,k)s+="ACL";
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

Int f(Int a) { return a*a*a*a*a; }

int main() {
	Int X;
	cin >> X;

	vector<Int> v;
	for (Int i = 0; f(i) < 1e16; ++i) {
		v.push_back(i);
	}

	for (int i = 0; i < v.size(); ++i) {
		for (int j = 0; j < v.size(); ++j) {
			if (f(v[i]) + f(v[j]) == X) {
				cout << v[i] << " " << -v[j] << endl;
				return 0;
			}
			if (f(v[i]) - f(v[j]) == X) {
				cout << v[i] << " " << v[j] << endl;
				return 0;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 3660
import java.util.ArrayList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	@SuppressWarnings("unchecked")
	private void run() {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			if ((n | m) == 0)
				break;
			List<Edge>[] lists = new ArrayList[n];
			for (int i = 0; i < n; i++) {
				lists[i] = new ArrayList<Edge>();
			}
			for (int i = 0; i < m; i++) {
				int from = scanner.nextInt() - 1;
				int to = scanner.nextInt() - 1;
				int cost = scanner.nextInt();
				lists[from].add(new Edge(to, cost));
				lists[to].add(new Edge(from, cost));
			}
			int g = n - 1;
			PriorityQueue<Edge> pq = new PriorityQueue<Edge>();
			pq.offer(new Edge(0, 0, 2));
			boolean[][] b = new boolean[3][n];
			while (!pq.isEmpty()) {
				Edge edge = pq.poll();
				if (edge.to == g && edge.ticket != 1) {
					System.out.println(edge.cost);
					break;
				}
				if (b[edge.ticket][edge.to])
					continue;
				b[edge.ticket][edge.to] = true;

				for (Edge e : lists[edge.to]) {
					if (edge.ticket == 1) {
						pq.offer(new Edge(e.to, edge.cost, 0));
					} else {
						if (edge.ticket == 2) {
							pq.offer(new Edge(e.to, edge.cost, 1));
						}
						pq.offer(new Edge(e.to, edge.cost + e.cost, edge.ticket));
					}
				}
			}
		}
	}

	class Edge implements Comparable<Edge> {
		int to, cost, ticket;

		public Edge(int to, int cost, int ticket) {
			super();
			this.to = to;
			this.cost = cost;
			this.ticket = ticket;
		}

		public Edge(int to, int cost) {
			super();
			this.to = to;
			this.cost = cost;
		}

		@Override
		public String toString() {
			return "Edge [to=" + to + ", cost=" + cost + ", ticket=" + ticket
					+ "]";
		}

		@Override
		public int compareTo(Edge o) {
			if (this.cost == o.cost)
				return o.to - this.to;
			return this.cost - o.cost;
		}

	}
}

Measured memory_bytes: 33648
def main():
    md = 998244353
    s = input()
    n = len(s)
    if s.count(s[0]) == n:
        print(1)
        exit()
    if n == 2:
        print(2)
        exit()
    if n == 3:
        if s[0] == s[-1]:
            print(7)
        elif s[0] == s[1] or s[1] == s[2]:
            print(6)
        else:
            print(3)
        exit()
    ord0 = ord("a")
    a = [ord(c) - ord0 for c in s]
    r = sum(a) % 3
    dp = [[[[0] * 3 for _ in range(2)] for _ in range(3)] for _ in range(n)]
    for m in range(3):
        dp[0][m][0][m] = 1
    # print(a)
    # print(dp)
    for i in range(n - 1):
        for j in range(3):
            for k in range(2):
                for m in range(3):
                    pre = dp[i][j][k][m]  # iけた j余り k連続有無 m前の位
                    for nm in range(3):
                        nj = (j + nm) % 3
                        if nm == m:
                            dp[i + 1][nj][1][nm] = (dp[i + 1][nj][1][nm] + pre) % md
                        else:
                            dp[i + 1][nj][k][nm] = (dp[i + 1][nj][k][nm] + pre) % md
    d = 1
    for c0, c1 in zip(s, s[1:]):
        if c0 == c1:
            d = 0
            break
    print((sum(dp[n - 1][r][1]) + d) % md)

main()


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

int main() {
	int n;
	while(cin >> n) {
		int ans=0;
		for(int i=0; i<=9; i++) {
			for(int j=0; j<=9; j++) {
				for(int l=0; l<=9; l++) {
					if(n-(i+j+l) <= 9 && n-(i+j+l) >= 0) ans++;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int n,k;
	cin >> n >> k;
	cout << ((n%k)?1:0) << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L


int Z_algo(string s) {
    int n = s.length();
    vector<int> z(n);
    int L = 0, R = 0;
    for (int i = 1; i < n; i++) {
        if (i > R) {
            L = R = i;
            while (R < n && s[R - L] == s[R]) R++;
            z[i] = R - L; R--;
        }
        else {
            int k = i - L;
            if (z[k] < R-i + 1) z[i] = z[k];
            else {
                L = i;
                while (R < n && s[R - L] == s[R]) R++;
                z[i] = R - L; R--;
            }
        }
    }
    int mx = 0;
    for (int i = 0; i < n; i++) mx = max(mx, min(i,z[i]));
    return mx;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n-1);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int i = 0; i < n - 1; i++) cin >> c[i];
    int last = INT_MAX;
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        if (last == a[i] -1) {
            sum += c[last-1];
        }
        sum += b[a[i]-1];
        last = a[i];
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 3568
import math
import itertools
import sys

N = int(input())
N_copy = N

if N == 1:
    print(0)
    sys.exit(0)


def prime_factors(n):
    # https://codereview.stackexchange.com/a/121869
    # i ranges over 2 and odd numbers 3, 5, 7, ...
    # returns each prime as many times as it divides n
    """Find prime factorization of n"""
    for i in itertools.chain([2], itertools.count(3, 2)):
        if n <= 1:
            break
        while n % i == 0:
            n //= i
            yield i

primes = {}

for p in range(2, int(math.sqrt(N))+1):
    while N % p == 0:
        N //= p
        if p in primes:
            primes[p] += 1
        else:
            primes[p] = 1

def find_k(E):
    k = 1
    while k**2 + k <= 2*E:
        k += 1
    return k-1

total = 0

# for p in range(2, N+1):
#     E = 0
#     while N % p == 0:
#         N //= p
#         E += 1
#     total += find_k(E)

# print(total)

for p in primes:
    total += find_k(primes[p])


prod = 1
for p in primes:
    prod *= p ** primes[p]

# print(prod)

if prod != N_copy:
    print(total + 1)
else:
    print(total)

# print(primes)
# if not primes:
#     print(1)
# else:
#     print(total)

Measured memory_bytes: 9248
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
#define MAX 5100000
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; }
using namespace std;

int main(){
  int K;
  cin>>K;
  queue<ll> que;
  for(int i=1; i<10; ++i) que.push(i);
  for(int i=0; i<K-1; ++i){
    ll s=que.front();
    que.pop();
    for(int j=-1; j<=1; ++j){
      ll add=(s%10)+j;
      if(add>=0 && add<=9) que.push(s*10+add);
    }
  }
  cout<<que.front()<<endl;
}

Measured memory_bytes: 5148
#include <iostream>
#include <cstdio>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <vector>
#include <memory.h>
#include <algorithm>
#define case        printf("Case %d: ",++tc);
#define read        freopen("tst.txt","r",stdin)
#define write       freopen("out.txt","w",stdout)
typedef long long ll;
using namespace std;
#define pi acos(-1)
#define mx 10002
const ll P = 7+1e9;
string s;
ll n,dp[mx][2][101];

ll fn(ll pos,bool fl,ll rem,ll x = 0){
    if(pos==s.size())   return rem==0;

    ll &ans = dp[pos][fl][rem];
    if(ans!=-1) return ans;
    ans = 0;
    ll lmt = 9;
    if(fl)  lmt = s[pos] - '0';
    for(ll i = 0; i<=lmt; i++){
        bool F = fl;
        if(i<lmt)   F = false;
        ans = (ans+fn(pos+1,F,(rem+i)%n,x*10+i))%P;
    }
    return ans;
}

main(){
int t,tc = 0;

memset(dp,-1,sizeof dp);
cin>>s>>n;
ll ans = fn(0,1,0) - 1;
printf("%lld\n",(ans+P)%P);

return 0;
}



Measured memory_bytes: 16896
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;

typedef struct point{
  int x;
  int y;
  int h;
} PT;

int main(){
  int N, p1, p2;
  PT in[100] = {{0}}, ans = {0};

  cin >> N;
  for(int i = 0; i < N; ++i){
    cin >> in[i].x >> in[i].y >> in[i].h;
  }

  
  for(int i = 0; i < N - 1; ++i){
    for(int j = i + 1; j < N; ++j){
      if((in[i].h == 0 && in[j].h - abs(in[i].x - in[j].x) - abs(in[i].y - in[j].y) < 0) ||
         (in[j].h == 0 && in[i].h - abs(in[i].x - in[j].x) - abs(in[i].y - in[j].y) < 0)) continue;
      int h = (abs(in[i].x - in[j].x) + abs(in[i].y - in[j].y) + abs(in[i].h - in[j].h)) / 2 + min(in[i].h, in[j].h);
      if(ans.h < h) ans.h = h, p1 = i, p2 = j;
    }
  }

  for(int x = min(in[p1].x, in[p2].x); x <= max(in[p1].x, in[p2].x); ++x){
      if(in[p1].y + ( (ans.h - in[p1].h) - abs(x - in[p1].x) ) == in[p2].y - ( (ans.h - in[p2].h) - abs(x - in[p2].x) )){
        ans.x = x;
        ans.y = in[p1].y + ( (ans.h - in[p1].h) - abs(x - in[p1].x) );
      }else if( in[p1].y - ( (ans.h - in[p1].h) - abs(x - in[p1].x) ) == in[p2].y + ( (ans.h - in[p2].h) - abs(x - in[p2].x) )){
        ans.x = x;
        ans.y =  in[p1].y - ( (ans.h - in[p1].h) - abs(x - in[p1].x) );
      }else{
        continue;
      }
      if(ans.y < 0 || ans.y > 100) continue;

      int i;
      for(i = 0; i < N; ++i){
        if(in[i].h != max(ans.h - abs(in[i].x - ans.x) - abs(in[i].y - ans.y), 0)){
          break;
        }
      }
      if(i == N) break;
  }
  cout << ans.x << " " << ans.y << " " << ans.h << endl;

  return 0;
}

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

int main(){
	// sengen
	LL n;
	// nyuryoku
	cin >> n;
	LL a[n];
	for(LL i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a,a+n,greater<LL>());
	LL ans = 0;
	if(n == 2){
		ans += a[0];
		cout << ans;
		return 0;
	}
	LL conf[n] = {};
	LL j = 1;
	for(LL i=0;i<n;i++){
		if(i < (n+1)/2){
			if(i == 0){
				conf[i] = a[i];
			}else{
				ans += conf[i-1];
				conf[i] = min(conf[i-1],a[i]);
				conf[i+1] = conf[i];
			}
		}else{
			ans += conf[j];
			j++;
		}
	}
	// keisan
	cout << ans;
	// syutsuryoku
}

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

bool Rule1(vector<string> vec) {
  
  for (int i = 0; i < vec.size() - 1; i++) {
    char backChar = vec[i].back();
    char frontChar = vec[i + 1].front();
    if (backChar != frontChar) return false;
  }
  
  return true;
  
}

bool Rule2(vector<string> vec) {
  
  sort(vec.begin(), vec.end());
  
  for (int i = 0; i < vec.size() - 1; i++) {
    if (vec[i] == vec[i + 1]) return false;
  }
  
  return true;
  
}

int main() {
  
  int N; cin >> N; vector<string> vec(N);
  
  for (int i = 0; i < N; i++) cin >> vec[i];
  
  if (Rule1(vec) && Rule2(vec)) cout << "Yes" << endl;
  
  else cout << "No" << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define vi vector <int>
#define vl vector <ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d",x)
#define plld(x) printf("%lld",x)
#define pds(x) printf("%d ",x)
#define pllds(x) printf("%lld ",x)
#define pdn(x) printf("%d\n",x)
#define plldn(x) printf("%lld\n",x)
#define INF 2e9
#define INFLL 4e18
#define spn setprecision
#define fr(x,a,b,c) for(int x = a; x <= b; x+=c)
using namespace std;
ll multiply(ll num1, ll num2, ll mod) { // with mod > 1e9
	ll ans = 0;
	num1 %= mod;
	num2 %= mod;
	while (num2) {
		if (num2&1) {
			ans += num1;
			ans %= mod;
		}
		num1 *= 2;
		num1 %= mod;
		num2 /= 2;
	}
	return ans;
}
ll powmod2(ll base,ll exponent,ll mod){ // with mod > 1e9
	ll ans = 1;
	while (exponent) {
		if (exponent&1) {
			ans = multiply(ans, base, mod);
		}
		base = multiply(base, base, mod);
		exponent /= 2;
	}
	return ans;
}
ll powmod(ll base,ll exponent,ll mod){ // with mod < 1e9
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
const int upperlimit = 1e6+100;
const int mod = 1e9+7;
int arr[upperlimit];
int main() {
	int n,x;
	sd(n);sd(x);
	for(int i = 1; i <= n; i++){
		sd(arr[i]);
	}
	sort(arr+1,arr+n+1);
	int cnt=0;
	for(int i = 1; i <= n; i++){
		x-=arr[i];
		if(x<0){
			break;
		}
		cnt++;
	}
	if((cnt==n)&&(x>0)) cnt--;
	pd(cnt);
	return 0;
}

Measured memory_bytes: 256
import collections
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]


def factorize_all(n):
    factorizations = [None] * (n + 1)
    factorizations[0] = dict()
    factorizations[1] = dict()
    for p in range(2, n + 1):
        if factorizations[p] is None:
            for k in range(1, n // p + 1):
                if factorizations[k] is None:
                    continue
                fs = factorizations[k].copy()
                if p in fs:
                    fs[p] += 1
                else:
                    fs[p] = 1
                factorizations[k * p] = fs
    return factorizations


MOD = 10**9 + 7

n = ri()
ls = ril()
if n == 1:
    print(1)
    exit()

factorizations = factorize_all(max(ls))

lcm = collections.Counter()
for x in ls:
    counter = factorizations[x]
    for p, k in counter.items():
        lcm[p] = max(lcm[p], k)
lcm_val = 1
for p, k in lcm.items():
    lcm_val *= pow(p, k, MOD)
    lcm_val %= MOD

res = 0
for x in ls:
    res += lcm_val * pow(x, MOD - 2, MOD)
    res %= MOD
print(res)

Measured memory_bytes: 313068
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define int long long
int INF = 1e9+7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int H,W;
void bfs(vector<string> &S,int X,int Y,vector<vector<int>> &ok,int &cnt) {
    queue<P> que;
    que.push(make_pair(X,Y));
    while(!que.empty()) {
        int x = que.front().first;
        int y = que.front().second;
        que.pop();
        cnt = max(cnt,ok[x][y]);
        for(int i = 0; i < 4; i++) {
            int nx = x+dx[i];
            int ny = y+dy[i];
            if(!(nx < 0 || nx >= H || ny < 0 || ny >= W)) {
                if(S[nx][ny] == '.') {
                    if(ok[nx][ny] == -1) {
                        ok[nx][ny] = ok[x][y]+1;
                        que.push(make_pair(nx,ny));
                    }
                }
            }
        }
    }
    return;
}
signed main() {
    cin >> H >> W;
    vector<string>S(H);
    for(int i = 0; i < H; i++) {
        cin >> S[i];
    }
    int ans = 0;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            if(S[i][j] == '.') {
                int cnt = 0;
                vector<vector<int>>ok(H,vector<int>(W,-1));
                ok[i][j] = 0;
                bfs(S,i,j,ok,cnt);
                ans = max(ans,cnt);
            }
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
import scala.collection.mutable.ListBuffer
import scala.io.StdIn

object Main extends App {

  // presentation error !!
  var temp = Array(-1, -1)
  val buff = new ListBuffer[(Int, Int)]
  while(temp(0) != 0 && temp(1) != 0){
    temp = StdIn.readLine().split(' ').map(_.toInt)
    buff += ((temp(0), temp(1)))
  }

  val result = buff.dropRight(1).map { case (h, w) =>
    (0 until h).map { _ =>
      Array.fill(w)("#").mkString("")
    }.mkString(f"%n")
  }
  println(result.mkString(f"%n%n"))
  println("")
}


Measured memory_bytes: 47012
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using P = pair<int, int>;
using MATRIX = vector< vector<ll> >;
template <class T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <class T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

struct UnionFind {
  vector<int> size, par;
  UnionFind(int n) {
    size.resize(n, 0);
    par.resize(n, 0);
    for(int i = 0; i < n; i++) {
      maketree(i);
    }
  }

  void maketree(int x) {
    par[x] = x;
    size[x] = 1;
  }

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

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    if(size[rx] < size[ry]) par[rx] = ry;
    else {
      par[ry] = rx;
      if(size[rx] == size[ry]) size[rx]++;
    }
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

int main() {
  int N, M;
  cin >> N >> M;
  UnionFind tree(N);
  rep(i, M) {
    int x, y, z;
    cin >> x >> y >> z;
    x--;y--;
    tree.unite(x, y);
  }
  int ans = 0;
  rep(i, N) {
    if(tree.root(i) == i) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4040
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using G = vector<vector<int>>;
int CONS = 1e5;
ll INF = 1001001001ll; 
    
int main(){
    int n, w;
    cin >> n >> w;
    vector<P> ob(n);
    int sum = 0;
    rep(i,n){
        ll w, v;
        cin >> w >> v;
        sum += v;
        ob[i] = P(w, v);
    }

    vector<ll> dp(CONS, INF);
    dp[0] = 0;
    rep(i,n){
        vector<ll> p(CONS,INF);
        swap(dp,p);
        rep(j,CONS){
            dp[j] = min(dp[j], p[j]);
            dp[j+ob[i].second] = min(dp[j+ob[i].second], p[j] + ob[i].first);
        }
    }

    for(int i=sum; i>=0; i--){
        if(dp[i]<=w){
            cout << i << endl;
            break;
        }
    }


    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        if (n == 1) {
            System.out.println("Yes");
            return;
        }

        int[] list = new int[n];
        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        for (int i = 1; i < n; i++) {
            if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
}


Measured memory_bytes: 50812
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const double pi = 3.14159265358979;
using vl = vector<ll>;
# define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((ll)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((ll)(n)); i>0; --i)
# define all(x) (x).begin(), (x).end()

ll H1,H2,M1,M2,K;

ll Main() {
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    
    ll min1 = H1*60+M1;
    ll min2 = H2*60+M2;
    
    ll diff = min2-min1-K;

    cout << diff << endl;
    return 0;
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ll long long
#define llu unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define PI 3.14159265
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define deb(x) cerr << ">> " << #x << " : " << x << "\n"
#define endl '\n'
#define ff first
#define ss second
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / __gcd(a, b)
#define DESYNC ios::sync_with_stdio(0); cin.tie(0);
#define print(a) for(auto x : a) cout << x << " "; cout << endl;

using namespace std;

const ll inf = 1e18 + 42;

const ll M = 998244353;

ll power(ll x, ll y) {
	if (y == 0) return 1;
	if (y & 1) return (x * power(x, y - 1));
	ll t = power(x, y / 2);
	return (t * t);
}

const ll MAX = 2e5 + 5;

// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

void ahShitHereWeGoAgain()
{
	string t;
	cin >> t;
	for(ll i = 0; i < t.size(); i++)
	{
		if(t[i] == '?')
			t[i] = 'D';
	}
	cout << t << endl;
}

int main()
{
	DESYNC	
	ll t = 1;
	// cin >> t;
	while (t--)
		ahShitHereWeGoAgain();
	return 0;
}



Measured memory_bytes: 3768
#include<stdio.h>
int main(void){
    int count[4][3][10]={0},n=0,b,f,r,v,i;
    char sikiri[20];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %d %d %d",&b,&f,&r,&v);
        if(v>=0){
            count[b-1][f-1][r-1]+=v;
        }else{
            count[b-1][f-1][r-1]+=v;
        }
    }
    for(i=0;i<20;i++){
        sikiri[i]='#';
    }
    for(b=0;b<4;b++){
        for(f=0;f<3;f++){
            for(r=0;r<10;r++){
                printf(" %d",count[b][f][r]);
            }
            printf("\n");
        }
        if(b<3){
            for(i=0;i<20;i++){
                printf("%c",sikiri[i]);
                if(i==19){
                    printf("\n");
                }
            }
        }
    }
    return 0;
}



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

int main() {
    int h, w;
    cin >> h >> w;
    
    vector<string> strings(h);
    int maxLength = 0;
    
    for (int i=0; i<h; i++) {
        cin >> strings.at(i);
        maxLength = max(maxLength, int(strings.at(i).size()));
    }
    
    
    for (int i=0; i<maxLength+2; i++) {
        cout << "#";
    }
    cout << endl;
    
    for (int i=0; i<h; i++) {
        cout << "#" << strings.at(i) << "#" << endl;
    }


    for (int i=0; i<maxLength+2; i++) {
        cout << "#";
    }
    cout << endl;
}


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

const int M = 998244353;
void add(ll &x, ll y) { x = (x+y)%M; }

int main () {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  
  int n, s;
  cin >> n >> s;
  vector<ll> a(n);
  for (ll &x : a) cin >> x;
  vector<ll> q(s+1);
  ll ans = 0;
  rep(i, n) {
    add(q[0], 1);
    // q[0] = (q[0] + 1)%M;
    //-----
    vector<ll> q2(s+1);
    rep(j, s+1) {
      add(q2[j], q[j]);
      // q2[j] = (q2[j]+q[j])%M;
      // if (j + a[i] <= s) q2[j+a[i]] = (q2[j+a[i]]+q[j])%M;
      if (j + a[i] <= s) add(q2[j+a[i]], q[j]);
    }
    q = q2;
    //-----
    add(ans, q[s]);
    // ans = (ans + q[s])%M;
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
	int x,n,h[101],r[100],s[99],i,j,flg;
	while(1){
		flg=0;
		scanf("%d",&n);
		if(n==0)break;
		for(i=0;i<n+1;i++){
			scanf("%d",&h[i]);
		}
		for(i=0;i<n+1;i++){
			for(j=0;j<n;j++){
				if(j>=i){
					r[j]=h[j+1];
				}
				else{
					r[j]=h[j];
				}
			}
			for(j=0;j<n-1;j++){
				s[j]=r[j+1]-r[j];
			}
			for(j=0;j<n-2;j++){
				if(s[j]!=s[j+1]){
					flg=0;
					break;
					}
				if(s[j]==s[j+1]){
					flg=1;
				}
			}
			if(flg==1){
				x=h[i];
				i=1000;
			}
		}
		printf("%d\n",x);
	}
	return 0;
}

Measured memory_bytes: 1028
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String ans ="x";
    for(int i = 0; i < S.length()-1; i++){
     ans += "x";
    }
    System.out.println(ans);
}
}


Measured memory_bytes: 21712
import java.util.*;
public class Main {
	public static int n;
	public static int s;
	public static int [] num ={0,1,2,3,4,5,6,7,8,9};
    public static void main(String[] args) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
        while (scan.hasNext()){
        n=scan.nextInt();
        s=scan.nextInt();
        if((n|s)==0)break;
        System.out.println(conv(0,0,0));
        }
      

  }
    public static int conv(int k,int i,int sum){
    	//System.out.println(k+" "+i+" "+sum);
    	
    	if(sum > s)return 0;
    	if(k==n){
    		if(s ==sum)return 1;
    	}
    	if(i>9)return 0;
    	return conv(k,i+1,sum)+conv(k+1,i+1,sum+num[i]);
    }
  }

Measured memory_bytes: 11000
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;
int MOD = 1000000007;

signed main(){
    int n,t;
    cin >> n >> t;
    map<int,int> m;

    int min = INF;
    //int mx =  0;
    rep(i,n){
        int a;
        cin >> a;
        if(min >= a || i == 0){
            min = a;
            //mx = a;
        }else{
            //mx = max(a,mx);
            m[a-min]++;
        }
    }
    int ans = 0;
    int M = 0;
    for(auto x:m){
        if(M < x.fi){
            M = x.fi;
            ans = x.se;
        }
    }
    cout << ans << endl;
    

    return 0;   
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://arc060.contest.atcoder.jp/tasks/arc060_a

Measured memory_bytes: 6528
n = int(input())
coins = [1]
for i in range(1,7):
    if 6**i <= n:
        coins.append(6**i)
    if 9**i <= n:
        coins.append(9**i)
coins.reverse()
dp = [10**5]*(n+1)

def f(i):
    #print(i)
    if i==0:
        return 0
    if dp[i] != 10**5:
        return dp[i]
    candidates = [f(i-coin)+1 for coin in coins if i-coin >= 0]
    dp[i] = min(candidates)
    return dp[i]

print(f(n))

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string btos(bool ans){
  return (ans?"APPROVED":"DENIED");
}
int main() {
  int n;cin>>n;
  bool ans=true;
  rep(i,n){
    int a;cin>>a;
    if(a%2==0){
      if(a%3!=0&&a%5!=0){
        ans=false;
        break;
      }
    }
  }
  cout << btos(ans)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int K = 1E9 + 7;
int dp[3000 + 1][3000 + 1][2];

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

  dp[0][0][1] = 1;
  for (int i = 1; i <= n; ++i) {
    dp[0][i][0] = 1;
  }

  for (int i = 0; i < m; ++i) {
    for (int j = 0; j <= n; ++j) {
      for (int k = 0; k < 2; ++k) {
        int cur = dp[i][j][k];
        if (j > 0) {
          // red, red
          dp[i + 1][j - 1][k | (j == 1)] += cur;
          dp[i + 1][j - 1][k | (j == 1)] %= K;

          // red, blue
          dp[i + 1][j][k | (j == 1)] += cur;
          dp[i + 1][j][k | (j == 1)] %= K;
        }

        if (j < n) {
          // blue, blue
          dp[i + 1][j + 1][k] += cur;
          dp[i + 1][j + 1][k] %= K;

          // blue, red
          dp[i + 1][j][k] += cur;
          dp[i + 1][j][k] %= K;
        }


      }
    }
  }

  int sum = 0;
  for (int i = 0; i <= n; ++i) {
    sum += (dp[m][i][1]);
    sum = sum % K;
  }
  cout << sum << endl;
}

Measured memory_bytes: 70656
#!/usr/bin/env python3

import sys


INIT_VAL = 2 ** 31 - 1
REC_LIMIT = 100000


class SegmentTree4RMQ(object):

    def __init__(self, num_elems, init_val=sys.maxsize):
        self.num_elems = 1
        while self.num_elems < num_elems:
            self.num_elems *= 2
        self.data = [init_val for _ in range(self.num_elems * 2 - 1)]

    def update(self, k, a):
        k += self.num_elems - 1
        self.data[k] = a
        while k > 0:
            k = (k - 1) // 2
            self.data[k] = min(self.data[k * 2 + 1], self.data[k * 2 + 2])

    def rec(self, start, end, k, left, right):
        if right <= start or end <= left:
            return sys.maxsize
        elif start <= left and right <= end:
            return self.data[k]
        else:
            vl = self.rec(start, end, k * 2 + 1, left, (left + right) // 2)
            vr = self.rec(start, end, k * 2 + 2, (left + right) // 2, right)
            return min(vl, vr)

    def query(self, start, end):
        return self.rec(start, end, 0, 0, self.num_elems)


def main():
    sys.setrecursionlimit(REC_LIMIT)
    n, q = map(int, input().split())
    st = SegmentTree4RMQ(n, INIT_VAL)
    for _ in range(q):
        c, x, y = map(int, input().split())
        if c == 0:
            st.update(x, y)
        elif c == 1:
            print(st.query(x, y + 1))


if __name__ == '__main__':
    main()

Measured memory_bytes: 11060
def func():
    n=int(input())
    A=[int(s) for s in input().split()]
    B=[int(s) for s in input().split()]
    two=0
    one=0
    for i in range(0,len(A)) :
        if A[i] > B[i] : 
            one+=A[i]-B[i]
        elif A[i] < B[i] :
            two+=(B[i]-A[i])//2
            one+=(B[i]-A[i])%2
            two+=(B[i]-A[i])%2
    if two-one >= 0 :
        print("Yes")
    else :
        print("No")


func()


Measured memory_bytes: 4596
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node{
  struct node *left;
  struct node *right;
  struct node *parent;
  int key;
};
struct node *T;
void Insert(int);
void Inorder(struct node*);
void Preorder(struct node*);
int Find(int);
void Free(struct node*);
int main(){
  int num, i, key;
  char com[6];
  T = (struct node *)malloc(sizeof(struct node) * 1);
  T->parent = T->left = T->right = NULL;
  T->key = -1;
  scanf("%d",&num);
  for(i=0; i<num; i++){
    scanf("%s",&com);
    if(strcmp(com,"insert") == 0){
      scanf("%d",&key);
      Insert(key);
    }
    else if(strcmp(com,"print") == 0){
      Inorder(T);
      printf("\n");
      Preorder(T);
      printf("\n");
    }
    else if(strcmp(com,"find") == 0){
      scanf("%d",&key);
      Find(key) ? printf("yes\n") : printf("no\n");
    }
  }
  Free(T);
  return 0;
}

void Inorder(struct node* X){
  if(X != NULL){
    Inorder(X->left);
    printf(" %d",X->key);
    Inorder(X->right);
  }
}

void Preorder(struct node* X){
  if(X != NULL){
    printf(" %d",X->key);
    Preorder(X->left);
    Preorder(X->right);
  }
}

void Free(struct node* X){
  if(X != NULL){
    Free(X->left);
    Free(X->right);
    free(X);
  }
}

void Insert(int key){
  struct node *x, *y, *S;
  if(T->key == -1){
    T->key = key;
    return;
  }
  S = (struct node *)malloc(sizeof(struct node) * 1);
  S->key = key;
  S->parent = S->left = S->right = NULL;
  x = T;
  while(x != NULL){
    y = x;
    if(key < x->key)
      x = x->left;
    else
      x = x->right;
  }
  S->parent = y;
  if(S->key < y->key)
    y->left = S;
  else
    y->right = S;
}

int Find(int key){
  struct node *X;
  for(X=T; X != NULL;){
    if(X->key > key)
      X = X->left;
    else if(X->key < key)
      X = X->right;
    else return 1;
  }
  return 0;
}


Measured memory_bytes: 20460
while 1:
    n = int(input())
    if n == 0:
        break
    l = [[ 0 for i in range(n)] for j in range(n)]

    i = n//2 + 1
    j = n//2
    l[i][j] = '   1'
    c = 2
    d = '{: >4}'.format(c)


    for x in range(n**2 - 1):
        i = (i + 1) % n
        j = (j + 1) % n
        while l[i][j] != 0:
            i = (i + 1) % n
            j = (j - 1) % n
        l[i][j] = d
        c += 1
        d = '{: >4}'.format(c)

    for s in range(n):
        print(*l[s],sep="")



Measured memory_bytes: 5640
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  [a, b] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  print $ (a + b - 3) `div` (a - 1)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 3804
#include<stdio.h>
int main()
{
    int A[100][100],B[100][100],C[100][100],m,n,i,j,k,sum=0;
    scanf("%d %d",&n,&m);
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            scanf("%d",&A[i][j]);
        }
    }
    for(i=0;i<m;i++)
    {
        scanf("%d",&B[i][0]);
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<1;j++)
        {
            sum=0;
            for(k=0;k<m;k++)
            {
                sum+=A[i][k]*B[k][j];
            }
            C[i][j]=sum;
        }
    }
    for(i=0;i<n;i++)
    {
        printf("%d\n",C[i][0]);
    }
    return 0;
}



Measured memory_bytes: 2128
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<numeric>
using namespace std;

int main(void)
{
	int N;
	cin >> N;

	vector<int> a(N);
	for(int i=0; i<N; i++)
		cin >> a[i];

	vector<int> cnt(N, 0);
	for(int i=0; i<N; i++){
		while(a[i]%2 == 0){
			cnt[i]++;
			a[i] /= 2;
		}
	}

	cout << accumulate(cnt.begin(), cnt.end(), 0) << endl;

	return 0;
}


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

int N, W;
vector<int> v, w;
vector<vector<int>> dp;

/*
int dfs(int pos, int cap) {
	if (pos == N) return 0;
	if (dp[pos][cap] != -1) return dp[pos][cap];
	int& res = dp[pos][cap];
	if (w[pos] > cap) res = dfs(pos+1, cap);
	else res = max(dfs(pos+1, cap), dfs(pos, cap-w[pos])+v[pos]);
	return res;
}
*/

int main() {
	cin>>N>>W;
	v.resize(N); w.resize(N);
	for (auto i = 0; i < N; i++)
		cin>>v[i]>>w[i];
	dp = vector<vector<int>>(N+1, vector<int>(W+1,0));
	for (auto i = N-1; i >= 0; i--) {
		for (auto j = 0; j <= W; j++) {
			if (w[i] > j) dp[i][j] = dp[i+1][j];
			else dp[i][j] = max(dp[i+1][j], dp[i][j-w[i]]+v[i]);
		}
	}
	cout << dp[0][W] << endl;
	return 0;
}

Measured memory_bytes: 4960
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    vector<int> c(n);
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    for(int i = 0; i < n; i++){
        cin >> c[i];
    }
    for(int i = 0; i < n; i++){
        a[i] = v[i] - c[i];
    }
    sort(a.begin(), a.end(), greater<int>());
    int result = 0;
    for(int i = 0; i < n; i++){
        if(a[i] < 0){
            break;
        }
        result += a[i];
    }
    cout << result << endl;
}

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

int main()
{
    int n;
    cin >> n;
    long long num = 0;
    for (int i = 1; i <= n; i++)
    {
        if (i % 3 != 0 && i % 5 != 0)
        {
            num += i;
        }
    }
    cout << num << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N, A);
  print(N * N - A);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/arc098_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;
  string S;
  cin >> S;

  int E = 0, W = 0;
  vector<int> e(N, 0);
  vector<int> w(N, 0);
  E = e[0] = S[0] == 'E';
  W = w[0] = S[0] == 'W';
  repi(i, 1, N) {
    if (S[i] == 'E') {
      E++;
      e[i] = e[i - 1] + 1;
      w[i] = w[i - 1];
    } else {
      W++;
      e[i] = e[i - 1];
      w[i] = w[i - 1] + 1;
    }
  }

  ll ans = LINF;
  rep(i, N) {
    ll re = E - e[i];
    ll lw = w[i];
    if (S[i] == 'W') lw--;
    ans = min(ans, lw + re);
  }

  cout << ans << endl;
}

Measured memory_bytes: 6040
n = int(input())
a = [tuple(map(int, input().split())) for _ in range(n)]

s, t = 1, 1
for i in range(0, n):

    j = max((s+a[i][0]-1)//a[i][0], (t+a[i][1]-1)//a[i][1])
    s, t = a[i][0]*j, a[i][1]*j

print(s+t)



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

long memo[110000];

const int MOD = 1000000007;

long func(int a){
	if(memo[a] != 0) return memo[a];
	if(a == 1) return memo[a] = 1;
	memo[a-1] = func(a - 1) % MOD;
	return memo[a] = a * memo[a-1] % MOD;
}

int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	long ans = 0;
	if(abs(n - m) > 1) printf("0\n");
	else{
		if(n == m) {
			ans = func(n) * func(m) * 2 % MOD;
		}else{
			ans = func(n) * func(m) % MOD;
		}
		printf("%ld\n", ans);
	}
}


Measured memory_bytes: 4096
import java.awt.Point;
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.util.Collection;


 
public class Main{
	
        static final Scanner sc=new Scanner(System.in);
        
        
        
        
        
        
        public static void main(String[]args){
                int H=sc.nextInt();
                int W=sc.nextInt();
                String[]moji=new String[H];
                for(int i=0;i<H;i++){
                        String a=sc.next();
                        boolean x=true;
                        for(int j=0;j<W;j++){
                                if(a.charAt(j)=='#'){
                                        x=false;
                                        break;
                                }
                        }
                        if(x){
                                i--;
                                H--;
                        }else{
                        moji[i]=a;}
                }
                for(int i=0;i<W;i++){
                        boolean xx=true;
                        for(int j=0;j<H;j++){
                                if(moji[j].charAt(i)=='#'){
                                        xx=false;
                                        break;
                                }

                        }
                        if(xx){
                                for(int j=0;j<H;j++){
                                        moji[j]=moji[j].substring(0,i)+moji[j].substring(i+1,W);
                                        
                                }
                                i--;
                                W--;

                                
                        }
                }
                for(int i=0;i<H;i++){
                        System.out.println(moji[i]);
                }
                




                
                


                
        }
        
        
        

		
	
}


Measured memory_bytes: 24276
#include<bits/stdc++.h>
using namespace std;
int main(){
  char X,Y;
  cin>>X>>Y;
  char S=max(X,Y);
  if(X==Y){
    cout<<'='<<endl;
  }
  else if(S==X){
    cout<<'>'<<endl;
  }
  else {
    cout<<'<'<<endl;
  }
}

Measured memory_bytes: 256
n, q = gets.split.map(&:to_i)
queue = []
n.times do
  name, time = gets.chomp.split
  queue << [name, time.to_i]
end
t = 0

while (x = queue.shift)
  if x[1] <= q
    t += x[1]
    puts "#{x[0]} #{t}"
  else
    t += q
    queue << [x[0], x[1] - q]
  end
end


Measured memory_bytes: 13580
#include <cstdio>
#include <iostream>
#include <utility>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
	long long N;
	cin >> N;
	
	int m = 100000000;

	for (int i = 1; i <= sqrt(N); i++){
		if (N % i == 0)
		{
			int A = i;
			int B = N / A;
			int t1 = 0;
			int t2 = 0;
			do{
				t1++;
			} while ((A /= 10) != 0);
			do{
				t2++;
			} while ((B /= 10) != 0);
			int t = max(t1, t2);
			m = t < m ? t : m;
		}
	}

	cout << m << endl;

	return 0;
}

Measured memory_bytes: 256
switch :: Int -> Int -> [a] -> [a]
switch p c l = middle ++ top ++ bottom
  where
    top = take (p - 1) l
    middle = take c $ drop (p - 1) l
    bottom = drop (p + c - 1) l

switches :: [Int] -> [Int] -> [Int]
switches [] l = l
switches (p:c:xs) l = switches xs (switch p c l)

ans :: [Int] -> String
ans [0,0] = ""
ans (n:r:xs) = (show . head $ switches ops [n,n-1..1]) ++ "\n" ++ (ans lsx)
  where
    ops = take (2 * r) xs
    lsx = drop (2 * r) xs

rInt :: String -> Int
rInt str = read str :: Int 

main = do
  input <- getContents
  let i = concat $ map ((map rInt) . words) $ lines input
  putStrLn . init . ans $ i

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
string s;
cin>>s;
cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;
}

Measured memory_bytes: 3596
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<tgmath.h>
#include<stdbool.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

ll a, b, v, w, t;

int main(){
    scanf("%lld%lld%lld%lld%lld", &a, &v, &b, &w, &t);
    a = llabs(a - b);
    v -= w;
    if(v<=0){
        puts("NO");
        return 0;
    }
    if(0 < a/v && (a+v-1)/v <= t){
        puts("YES");
        return 0;
    }
    puts("NO");
    return 0;
}


Measured memory_bytes: 1664
N = int(input())
P = [int(input()) for i in range(N)]
P = sorted(P)
Pnagasa = len(P)

Counter = 0

if sum(P)%10==0:
	for i in range (0, Pnagasa):
		if Counter == Pnagasa-1:
			if P[i]%10==0:
				print(int(0))
			else:
				print(int(P[i]))
		elif P[i]%10==0:
			Counter+=1
		else:
			print(int(sum(P)-P[i]))
			exit()
else:
	print(int(sum(P)))

Measured memory_bytes: 3064
import java.util.*;
 import java.math.BigInteger;
public class Main
{
	static int ans[];
	public static  void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		String n=sc.nextLine();
		int d=(int)n.charAt(n.length()-1)-(int)'0';
		if(d==2 || d==4 || d==5 || d==7 || d==9){System.out.println("hon");}
		else if(d==3){System.out.println("bon");}
		else{System.out.println("pon");}
		

	}
	
	// static int dfs4(int dp[], ArrayList<Pair>arr, int state, int gg[], int i, int x, int cost)

	// {
	// 	if(i==arr.size()){for(int j=0;j<gg.length;j++){if(gg[j]<x){return Integer.MAX_VALUE;}}return cost;}
	// 	if(dp[state]!=0){return dp[state];}
	// 	int a=dfs4(dp,arr,state,gg,i+1,x,cost);
	// 	int aa[]=new int[gg.length];
	// 	System.arraycopy(gg,0,aa,0,aa.length);
	// 	for(int j=0;j<arr.get(i).b.size();j++)
	// 	{
	// 		aa[j]+=arr.get(i).b.get(j);
	// 	}
	// 	// System.out.println(Arrays.toString(aa));
	// 	state=state+(int)Math.pow(2,i);
	// 	int b=dfs4(dp,arr,state,aa,i+1,x,cost+arr.get(i).a);
	// 	dp[state]=Math.min(a,b);
	// 	return Math.min(a,b);
	// }
	// static long get3(double n, int steps)
	// {
	// 	if(n<1){return Integer.MAX_VALUE;}
	// 	if(n==1){return steps;}

	// 	System.out.println(n);
	// 	return get3(n/2.0-1,steps+1);
	// }
	// static String get(long a, long b)
	// {long y=1;
	// 	while(true)
	// 	{

	// 		long z=y-a;
	// 		long q=get2(y,z);
	// 		// System
	// 		if(q==b){return y+" "+z;}
	// 		else if(q>b){return "-1";}
	// 		y+=1;
	// 	}
	// 	// return "-1";
	// }
	// static long get2(long y, long z)
	// {
	// 	return (long)(Math.pow(y,4)+Math.pow(y,3)*z+Math.pow(y,2)*Math.pow(z,2)+y*Math.pow(z,3)+Math.pow(z,4));
	// }
	// static void get(ArrayList<ArrayList<Integer>>arr, int i , int p,int val[], int arr1[], int len)
	// {
	// 	for(int j=0;j<arr.get(i).size();j++)
	// 	{
	// 		if(ans[arr.get(i).get(j)]==0 && arr.get(i).get(j)!=p){
	// 		if(val[arr.get(i).get(j)]>arr1[len-1])
	// 		{
	// 			arr1[len]=val[arr.get(i).get(j)];
	// 			ans[arr.get(i).get(j)]=len+1;
	// 			get(arr,arr.get(i).get(j),i,val,arr1,len+1);
				
	// 		}
	// 		else
	// 		{
	// 			int index=bin(arr1, val[arr.get(i).get(j)], len-1);
	// 			ans[arr.get(i).get(j)]=len;
	// 			// int g=arr1[index];
	// 			arr1[index]=val[arr.get(i).get(j)];
	// 			get(arr,arr.get(i).get(j),i,val,arr1,len);
	// 			// arr1[index]=g;
	// 		}}

	// 	}
	// }
	// static int bin(int arr[], int val, int len)
	// {
	// 	if(arr[0]>=val){return 0;}
	// 	int l=0;
	// 	int r=len;
	// 	while (r - l > 1) { 
 //            int m = l + (r - l) / 2; 
 //            if (arr[m] >= val) 
 //                r = m; 
 //            else
 //                l = m; 
 //        } 
  
 //        return r; 
	// 	// return l;
	// }
	
	

}
class Pair
{
	int a;
int b;
	Pair(int e,int  f){
		a=e;
		b=f;
		
	}
}



	


Measured memory_bytes: 35732
#include <stdio.h>
int main(void)
{
int W,H,x,y,r;
scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
 if(x>=r&&y>=r&&x<=W-r&&y<=H-r){
printf("Yes\n");
}else{
printf("No\n");
}
 return 0;
}

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

int top, S[1000];

void push(int x)
{
	S[++top] = x;
}

int pop(){
	top--;
	return S[top+1];
}


int main(void){
	int a, b, x;
	top = 0;
	char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
    	a = pop();
    	b = pop();
    	push(a+b);
    } else if ( s[0] == '-' ){
    	a = pop();
    	b = pop();
    	push(b-a);
    } else if ( s[0] == '*' ){
    	a = pop();
    	b = pop();
    	push(a*b);
    } else {
      x = atoi(s);
    	push(x);
    }
  }
	printf("%d\n", pop());

  return 0;
}


Measured memory_bytes: 2092