akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void){
	int n;
	
	while(1){
		int cnt=0;
		scanf("%d",&n);
        if(n==0)break;	
		while(n!=1){
			if(n%2==0)n/=2;
			else n=n*3+1;
			cnt++;
		
		}
		printf("%d\n",cnt);
	}
	return 0;
}

Measured memory_bytes: 600
import java.io.*;
import java.util.*;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Integer count = 0;
		Scanner s = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		String word = s.next().toLowerCase();
		while(s.hasNext()){
			String input = s.next();
			if(input.equals("END_OF_TEXT")){
				break;
			}
			String[] word_list = input.split(" ");
			for(int i = 0; i < word_list.length; i++){
				String target = word_list[i].toLowerCase();
				if(word.equals(target)){
					count++;
				}
			}
		}
		s.close();
		System.out.println(count);

	}

}

Measured memory_bytes: 19744
/* 
  ╔╗         ╔╗              ╔═══╗                                  
  ║║        ╔╝╚╗             ║╔═╗║                                  
  ║║╔╗╔╗╔══╗╚╗╔╝    ╔══╗     ║╚═╝║╔═╗╔══╗╔══╗╔═╗╔══╗ ╔╗╔╗╔╗╔╗╔══╗╔═╗
╔╗║║║║║║║══╣ ║║     ╚ ╗║     ║╔══╝║╔╝║╔╗║║╔╗║║╔╝╚ ╗║ ║╚╝║║╚╝║║╔╗║║╔╝
║╚╝║║╚╝║╠══║ ║╚╗    ║╚╝╚╗    ║║   ║║ ║╚╝║║╚╝║║║ ║╚╝╚╗║║║║║║║║║║═╣║║ 
╚══╝╚══╝╚══╝ ╚═╝    ╚═══╝    ╚╝   ╚╝ ╚══╝╚═╗║╚╝ ╚═══╝╚╩╩╝╚╩╩╝╚══╝╚╝ 
                                         ╔═╝║                       
                                         ╚══╝                       */


//Header files
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#ifndef ONLINE_JUDGE
#include<Personal/debug.h>
#else
#define debug(x...)
#endif

//Short data-types declaration
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<string> vs;
typedef vector<vector<int> > vii;  
typedef vector<vector<long long> >vll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vbb;

//Macros
#define MK make_pair
#define EB emplace_back
#define PB push_back
#define F first
#define S second
#define rep(i,start,end) for(int i=(int)start;i<(int)end;i++)
#define repr(i,start,end) for(int i=(int)start;i>(int)end;i--)
#define all(x) (x).begin(), (x).end()

//Constants
const int mod = 1e9+7;

//Some useful functions
ll binpow(ll num,ll pow);
inline int mul(int a,int b) {return (a*1ll*b)%mod;}
inline int add(int a,int b) {return (a+0ll+b)%mod;}
inline int sub(int a,int b) {return ((a+0ll-b)%mod+mod)%mod; }
/*------------------------------------------------------Code Starts------------------------------------------------------*/
const int inf=1e9+5;
const int N=2*(1e5)+10;
int n;
ll k;
int a[N];
inline bool check(int sz)
{
	ll r=0;
	rep(i,0,n)
	{
		r+=(a[i]-1)/sz;
	}
	return r<=k;
}
inline void solve()
{
	cin>>n>>k;
	rep(i,0,n) cin>>a[i];
	int l=1,r=inf;
	int ans=inf;
	while(r>=l)
	{
		int mid=l+(r-l)/2;
		if(check(mid)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	cout<<ans<<'\n';
}

int main()
{
	auto start = high_resolution_clock::now();
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	auto stop = high_resolution_clock::now(); 
	auto duration = duration_cast<microseconds>(stop - start); 
	cerr<<duration.count()<<" microseconds\n";
	return 0;
}
/*------------------------------------------------------Code ends------------------------------------------------------*/
ll binpow(ll num,ll pow)
{
	if(pow==0)
		return 1;
	ll val=binpow(num,pow/2);
	val*=val;
	if(pow&1) val*=num;
	return val;
}



Measured memory_bytes: 4312
import java.util.*;

public class Main {

	public static void main(String[] args) {
	
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		do {
			C -= B;
			if(C <= 0) {
				System.out.println("Yes");
				break;
			}
			A -= D;
			if(A <= 0) {
				System.out.println("No");
				break;
			}
		} while(A > 0 || C > 0);
		
	}
	
}

Measured memory_bytes: 35680
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<ll,ll>
#define poly vector<ll>
#define mem(a) memset((a),0,sizeof(a))
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x.size()))
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
ll rnd(){
	ull ans=0;
	For(i,0,4)ans=ans<<15^rand();
	return ans%((ull)1<<63);
}
const int N=200005,mod=998244353;
int n,rt,dep[N],mx[N],fa[N];
ll dp[N][3],jb[3];
vector<int> v[N];
inline void add(ll &a,ll b){
	a=(a+b)%mod;
}
void dfs(int p){
	dep[p]=dep[fa[p]]+1;
	if(dep[p]>dep[rt])rt=p;
	for(auto i:v[p])if(i!=fa[p]){
		fa[i]=p; dfs(i);
	}
}
void solve(int rt,int fa){
	dp[rt][v[rt].size()==1]=1;
	for(auto i:v[rt])if(i!=fa){
		solve(i,rt); mx[rt]=max(mx[rt],mx[i]+1);
	}
	for(auto i:v[rt])if(i!=fa){//分别表示 几个满的 
		if(mx[i]+1!=mx[rt]){
			dp[i][0]+=dp[i][1]+dp[i][2]; dp[i][1]=dp[i][2]=0;
		}
		mem(jb);
		Rep(j,2,0){
			Rep(k,2,0)add(jb[min(2,j+k)],dp[rt][j]*dp[i][k]);
		}
		swap(jb,dp[rt]);
	}
	dp[rt][0]=(dp[rt][0]*3+dp[rt][1]*2+dp[rt][2]*2)%mod;
}
int main(){
	#ifdef Brollan
		freopen("std.in","r",stdin);
	#endif
	n=read(); 
	For(i,1,n-1){
		int s=read(),t=read();
		v[s].pb(t); v[t].pb(s);
	}
	
	dfs(1);
	int t=rt; rt=0; fa[t]=0;
	dfs(t);
	int len=dep[rt];//cerr<<t<<" "<<rt<<" "<<dep[rt]<<endl;
	For(j,1,(len-1)/2)rt=fa[rt];
	if(len%2==0){
		int A=rt,B=fa[rt];
		//cout<<A<<" "<<B<<endl;
		solve(A,B);
		solve(B,A);
		cout<<dp[A][1]*dp[B][1]%mod<<endl;
	}else{
		dp[rt][0]=1;
		for(auto i:v[rt]){
			solve(i,rt); 
			if(mx[i]+1<len/2){dp[i][0]+=dp[i][1]+dp[i][2]; dp[i][1]=dp[i][2]=0;}
			else dp[i][0]+=mod-dp[i][1]+mod-dp[i][2];
			//cout<<dp[i][1]<<" "<<dp[i][0]%mod<<" "<<dp[rt][1]<<endl;
			mem(jb);
			Rep(j,2,0)Rep(k,1,0){
				if(j+k<=2)add(jb[j+k],dp[rt][j]*dp[i][k]);
			}
			swap(jb,dp[rt]);
		}
		cout<<dp[rt][2]<<endl;
	}
}

Measured memory_bytes: 27192
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner kbd = new Scanner(System.in);
    void run(){
	int n = kbd.nextInt();
	int data = 0;
	while(n>0){
	    if(data>0)
		System.out.println();
	    solve();
	    n--;
	    data++;
	}
    }


    void solve(){
	int[][] field = new int[9][9];
	boolean[][] tf = new boolean[9][9]; // テヲツュツ」テ」ツ?療」ツ??・ツ?・テ・ツ環崚」ツ?古」ツ?陛」ツつ古」ツ?ヲテ」ツ??」ツつ凝」ツ?凝ッツシツ?
	int i, j;
	for(i=0; i<9; i++)	
	    Arrays.fill(tf[i], true);
	for(i=0; i<9; i++){
	    for(j=0; j<9; j++){
		field[i][j] = kbd.nextInt();
	    }
	}
	// テ・ツ?・テ・ツ環崚」ツ?禿」ツ?禿」ツ?セテ」ツ?ァ

	// テ」ツδ?」ツつァテ」ツδε」ツつッテ」ツ?禿」ツ?禿」ツ?凝」ツつ?
	/*
	  1テ」ツ?凝」ツつ?テ」ツ?セテ」ツ?ァテ」ツ??テ」ツ?、テ」ツ?堙」ツ?、テ、ツスツソテ」ツつ湘」ツつ古」ツ?ヲテ」ツ??」ツつ古」ツ?ーtrue
	  ティツカツウテ」ツつ甘」ツ?ェテ」ツ??ヲツ閉ーテ・ツュツ療」ツ?古」ツ?づ」ツつ?= テ・ツ、ツ堙」ツ??ヲツ閉ーテ・ツュツ療」ツ?古」ツ?づ」ツつ凝」ツ?凝」ツつ嘉」ツ??・ツ、ツ堙」ツ??」ツδ榲」ツつケテ」ツつ断alseテ」ツ?ォテ」ツ?凖」ツつ?
	*/

	int[] c; // テ」ツδ?」ツつァテ」ツδε」ツつッテ」ツ?凖」ツつ凝ヲツ閉ーテ・ツュツ療」ツ?ョテ・ツ崢コテ」ツ?セテ」ツつ?
	int[][] x; // テ」ツδ?」ツつァテ」ツδε」ツつッテ、ツクツュテ」ツ?ョテ・ツコツァテヲツィツ?

	// i テ」ツδゥテ」ツつ、テ」ツδウテ」ツδ?」ツつァテ」ツδε」ツつッ
	for(i=0; i<9; i++){
	    c = new int[9];
	    x = new int[9][2];
	    for(j=0; j<9; j++){
		int d = field[i][j]-1; // テ」ツδ榲」ツつケテ」ツ?ォテ」ツ?づ」ツつ凝ヲツ閉ーテ・ツュツ?
		c[d]++;
		if(c[d]>1){
		    tf[i][j] = false;
		    tf[x[d][0]][x[d][1]] = false;
		}
		else{
		    x[d][0] = i;
		    x[d][1] = j;
		}
	    }
	}

	// j テ」ツδゥテ」ツつ、テ」ツδウテ」ツδ?」ツつァテ」ツδε」ツつッ
	for(j=0; j<9; j++){
	    c = new int[9];
	    x = new int[9][2];
	    for(i=0; i<9; i++){
		int d = field[i][j]-1; // テ」ツδ榲」ツつケテ」ツ?ォテ」ツ?づ」ツつ凝ヲツ閉ーテ・ツュツ?
		c[d]++;
		if(c[d]>1){
		    tf[i][j] = false;
		    tf[x[d][0]][x[d][1]] = false;
		}
		else{
		    x[d][0] = i;
		    x[d][1] = j;
		}
	    }
	}

	// テ・ツ崢崚ィツァツ津・ツ個コテ・ツ按?」ツつ甘」ツδ?」ツつァテ」ツδε」ツつッ
	for(int si=0; si<9; si+=3){
	    for(int sj=0; sj<9; sj+=3){
		c = new int[9];
		x = new int[9][2];
		for(i=si; i<si+3; i++){	    
		    for(j=sj; j<sj+3; j++){
			int d = field[i][j]-1; // テ」ツδ榲」ツつケテ」ツ?ォテ」ツ?づ」ツつ凝ヲツ閉ーテ・ツュツ?
			c[d]++;
			if(c[d]>1){
			    tf[i][j] = false;
			    tf[x[d][0]][x[d][1]] = false;
			}
			else{
			    x[d][0] = i;
			    x[d][1] = j;
			    //System.out.println("*"+x[d][0]+" "+x[d][1]+"*");
			}
		    }
		}
		//System.out.println();
	    }
	}
	    
	// ティツ。ツィテァツ、ツコ
	for(i=0; i<9; i++){
	    for(j=0; j<9; j++){
		if(tf[i][j]){
		    System.out.print(" "+field[i][j]);
		}
		else 
		    System.out.print("*"+field[i][j]);
	    }
	    System.out.println();
	}
    }
}
	

Measured memory_bytes: 21636
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll A, B, C;
    cin>>A>>B>>C;
    cout<<((C>=A) && (C<=B) ? "Yes" : "No")<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b[10000],i;
	scanf("%d",&a);
	for(i=0;i<a;i++){
		scanf("%d",&b[i]);
	}
	for(i=a-1;i>=0;i--){
	if(i>0)printf("%d ",b[i]);
	else printf("%d",b[i]);
	}
	printf("\n");
	return 0;
}



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

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

typedef pair<int, int> pii;

int main() {
	int ans[100];
	vector<pii> seats; //group_num count
	seats.push_back(pii(-1, 17));
	priority_queue<pii, vector<pii>, greater<pii> > pq; //taisyutu:time, group_num
	queue<int> que; //mati:group_num
	
	
	int cnt = 0, t = 0;
	while (cnt < 100) {
		while (!pq.empty()) {
			pii now = pq.top();
			if (now.first != t) break;
			pq.pop();
			REP(i, seats.size()) if (seats[i].first == now.second) seats[i].first = -1;
		}
		REP(i, seats.size() - 1) {
			if (seats[i].first == seats[i + 1].first) {
				seats[i].second += seats[i + 1].second;
				seats.erase(seats.begin() + i + 1);
				i--;
			}
		}
		
		if (t % 5 == 0 && t / 5 < 100) que.push(t / 5);
		
		while (!que.empty()) {
			int now = que.front();
			int count = now % 5 == 1 ? 5 : 2;
			bool flag = true;
			REP(i, seats.size()) {
				if (seats[i].first == -1 && seats[i].second >= count) {
					if (seats[i].second - count > 0)
						seats.insert(seats.begin() + i + 1, pii(-1, seats[i].second - count));
					seats[i] = pii(now, count);
					pq.push(pii(t + 17*(now % 2) + 3*(now % 3) + 19, now));
					
					ans[now] = t - now * 5;
					cnt++;
					que.pop();
					flag = false;
					break;
				}
			}
			if (flag) break;
		}
		
		t++;
	}
	
	
	int n;
	while (cin >> n) cout << ans[n] << endl;
	return 0;
}

Measured memory_bytes: 1196
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS


#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;

int main() {
	int N;
	int H, M=0;
	int ans = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> H;
		if (M <= H) {
			M = H;
			ans++;
		}
	}
	cout << ans << endl;




	return(0);
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main
{
  
  static int ks[] = {1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};
  //static int lm[] = {0, 2, 4,  4,  8,   8,   16,  16,   32,   32,    64,    64};
  //static int lm[] = {0, 6, 9,  6,  9,   6,    9,   6,    9,    6,     6,     9};
  static int lm[] = {0, 2, 4,  4,  8,   6,    9,   6,    9,    6,     6,     9};
  static int mem[][] = new int[100001][12];

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    int n = Integer.parseInt(r.readLine());
    
    Arrays.sort(ks);
    int ans = search(n, 11);

    System.out.println(ans);

  }
  
  public static int search(int m, int k)
  {
    if(m <= 5)
    {
      return m;
    }
    if(k < 0)
    {
      return 999999;
    }
    if(mem[m][k] > 0)
    {
      return mem[m][k];
    }
    int z = 999999;
    int v = m;
    for(int i = 0; m >= 0 && i < lm[k]; i++)
    {
      z = Math.min(z, i + search(m, k - 1));
      m -= ks[k];
    }
    mem[v][k] = z;
    return z;
  }

}


Measured memory_bytes: 29140
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.abs
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val n = readInteger()
    readIntegerList()
        .mapIndexed { i, v -> Pair(i + 1, v) }
        .sortedBy { it.second }
        .map { it.first }
        .joinToString(" ")
        .let(out::println)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 69616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
const double EPS=1E-8;
////////////////////////////////////////

ll calc(ll x){
    ll res=0;
    while(x>0){
        res+=x%10;
        x/=10;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    
    vector<ll>s;
    rep(i,1,9)s.pb(i);
    rep(i,1,999){
        rep(j,1,15){
            ll t=(i+1)*(ll)pow(10,j)-1;
            s.pb(t);
        }
    }
    sort(s.begin(),s.end());
    s.erase(unique(s.begin(),s.end()),s.end());
    int n=s.size();
    double t[n];
    rep(i,0,n-1){
        t[i]=(double)s[i]/(double)calc(s[i]);
    }
    bool a[n];memset(a,true,sizeof(a));
    for(int i=0;i<=n-1;i++){
        for(int j=i+1;j<=n-1;j++){
            if(t[j]<t[i])a[i]=false;
        }
    }
    vector<ll>ans;
    rep(i,0,n-1){
        if(a[i])ans.pb(s[i]);
    }
    int k;cin>>k;
    rep(i,0,k-1)cout<<ans[i]<<endl;
    
    return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

typedef long long ll;

int main(){
	string str;

	map<string,string> encode;
	map<string,string> decode;

	encode[" "] = "101";
	encode["'"] = "000000";
	encode[","] = "000011";
	encode["-"] = "10010001";
	encode["."] = "010001";

	encode["?"] = "000001";
	encode["A"] = "100101";
	encode["B"] = "10011010";
	encode["C"] = "0101";
	encode["D"] = "0001";
	encode["E"] = "110";
	encode["F"] = "01001";
	encode["G"] = "10011011";

	encode["H"] = "010000";
	encode["I"] = "0111";
    encode["J"] = "10011000";
	encode["K"] = "0110";
	encode["L"] = "00100";
	encode["M"] = "10011001";
	encode["N"] = "10011110";

	encode["O"] = "00101";
	encode["P"] = "111";
	encode["Q"] = "10011111";
	encode["R"] = "1000";
	encode["S"] = "00110";
	encode["T"] = "00111";
	encode["U"] = "10011100";

	encode["V"] = "10011101";
	encode["W"] = "000010";
	encode["X"] = "10010010";
	encode["Y"] = "10010011";
	encode["Z"] = "10010000";

	decode["00000"] = "A";
	decode["00001"] = "B";
	decode["00010"] = "C";
	decode["00011"] = "D";
	decode["00100"] = "E";
	decode["00101"] = "F";
	decode["00110"] = "G";

	decode["00111"] = "H";
	decode["01000"] = "I";
	decode["01001"] = "J";
	decode["01010"] = "K";
	decode["01011"] = "L";
	decode["01100"] = "M";
	decode["01101"] = "N";

	decode["01110"] = "O";
	decode["01111"] = "P";
	decode["10000"] = "Q";
	decode["10001"] = "R";
	decode["10010"] = "S";
	decode["10011"] = "T";
	decode["10100"] = "U";

	decode["10101"] = "V";
	decode["10110"] = "W";
	decode["10111"] = "X";
	decode["11000"] = "Y";
	decode["11001"] = "Z";

	decode["11010"] = " ";
	decode["11011"] = ".";
	decode["11100"] = ",";
	decode["11101"] = "-";
	decode["11110"] = "'";
	decode["11111"] = "?";

	while(getline(cin,str)){

		string enc="";
		for(int i=0;i<str.size();i++){
			enc+=encode[str.substr(i,1)];
		}

		enc+="0000";

		string dec="";
		for(int i=0;i+5<=enc.size();i+=5){
			dec+=decode[enc.substr(i,5)];
		}

		cout << dec << endl;
	}

}

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

#define int long long
#define DEBUG 0
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
using pii = pair<int, int>; using vi = vector<int>;
static const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
static const int MOD = (int)(1e9 + 7);

int m, n;
//??¬?£?????????????????????????
bool f(vector<int> &w, int a) {
	int cnt = 1;
	int tmp = 0;
	for (int i = 0; i < w.size(); i++) {
		if (w[i] > a)return false;
		if (tmp + w[i] > a) {
			cnt += 1;
			tmp = 0;
		}
		tmp += w[i];
	}
	if (cnt > m)return false;
	return true;
}

signed main() {
	for (; cin >> m >> n&&m;) {
		vector<int> w(n);
		rep(i, 0, n)cin >> w[i];

		int L = 0, R = 1500001;
		rep(i, 0, 22) {
			int MID = (L + R) / 2;
			if (f(w, MID))R = MID;
			else L = MID;
		}
		cout << R << endl;
	}
	return 0;
}

Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>

 int max(int a,  int b){
  if(a>b) return a;
  else return b;
}

int main(void){
  int i, N, count, H, W, M;
  int bomb_h[300001], bomb_w[300001];
  int num_h[300001], num_w[300001];
  int index_h ,index_w;

  for(i=0; i<300001; i++){
    num_h[i]=0;
    num_w[i]=0;
  }

  scanf("%d %d %d", &H, &W, &M);
//  printf("%d\n", N);
  for(i=0; i<M; i++){
    scanf("%d %d", &bomb_h[i], &bomb_w[i]);
  //h行，w列の爆弾の数を加えていく。
    num_h[bomb_h[i]]++;
    num_w[bomb_w[i]]++;
 //   printf("%d %d\n", bomb_h[i], bomb_w[i]);
 //   bombif[bomb_h[i]][bomb_w[i]]=1;
  }


  int num_h_max=0;
  int num_w_max=0; 
  for(i=1; i<=H; i++){
    num_h_max=max(num_h_max, num_h[i]);
  }
  for(i=1; i<=W; i++){
//    printf("%d ", num_w[i]);
    num_w_max=max(num_w_max, num_w[i]);
  }
 // printf("\n");
//   printf("%d %d\n", num_h_max, num_w_max);
  
  index_h=0;
  index_w=0;
  for(i=1; i<=H; i++){
    if(num_h[i]==num_h_max){
      index_h++;
    }
  }
  for(i=1; i<=W; i++){
    if(num_w[i]==num_w_max){
      index_w++;
    }
  }
//   printf("%d %d\n", index_h, index_w);
  long long int index=index_h*index_w; //最大数爆破できるマスの数をチェック
//  printf("%lld\n", index);
  int index_bomb=0;
  for(i=0; i<M; i++){
    if((num_h[bomb_h[i]]==num_h_max && num_w[bomb_w[i]]==num_w_max)){
      index_bomb++;
    }
  }

  if(index_bomb==index) printf("%d", num_h_max+num_w_max-1);
  else printf("%d", num_h_max+num_w_max);

  return 0;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;


int main() {
    int k; cin >> k;
    string ans ="";
    for(int i = 0; i < k; i++){
        ans += "ACL";
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3540
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt(), a = scanner.nextInt(), b = scanner.nextInt();
		if((n * a) > b){
			System.out.println(b);
		}else if((n * a) <= b){
			System.out.println(n * a);
		}
	}

}


Measured memory_bytes: 21972
n=int(input())
h=list(map(int,input().split()))
tmp=h[0]
for i in range(1,n):
    if h[i] - tmp ==0:
        tmp = h[i]
    elif h[i] -tmp >= 1:
        tmp = h[i] -1
    else:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 14228
#include<bits/stdc++.h>
#define int long long
#define inf 0x3f3f3f3f3f3f3f
using namespace std;
int n,num[1000005],a[1000005],GcD,cnt,prim[1000005],vis[1000005];
bool flag=1;
void init()
{
	for (int i=2;i<1000005;i++)
	{
		if (!vis[i]) prim[++cnt]=i;
		for (int j=1;j<=cnt&&i*prim[j]<1000005;j++)
		{
			vis[i*prim[j]]=1;
			if (i%prim[j]==0) break;
		}
	}
}
void solve(int x)
{
	if (!vis[x])
	{
		num[x]++;
		return;
	}
	for (int i=1;i<=cnt;i++) if (x%prim[i]==0) 
	{
		num[prim[i]]++;
		while (x%prim[i]==0) x/=prim[i];
		solve(x);
		break;
	}
}
void otpt()
{
	if (flag==1) cout<<"pairwise coprime"<<endl;
	else if (GcD==1) cout<<"setwise coprime"<<endl;
	else cout<<"not coprime"<<endl;
}
signed main()
{
	init();
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	GcD=a[1];
	for (int i=1;i<=n;i++) GcD=__gcd(GcD,a[i]);
	for (int i=1;i<=n;i++) solve(a[i]);
	for (int i=2;i<1000005;i++) if (num[i]>1) flag=0;
	otpt();
	return 0;
}


Measured memory_bytes: 27640
N,C=map(int,input().split())
xv=[list(map(int,input().split())) for _ in range(N)]

l=[0]*N
l[0]=xv[0][1]
for i in range(1,N):
  l[i]=l[i-1]+xv[i][1]
for i in range(N):
  l[i]-=xv[i][0]

r=[0]*N
r[0]=xv[N-1][1]
for i in reversed(range(N-1)):
  r[N-1-i]=r[N-1-i-1]+xv[i][1]
for i in reversed(range(N)):
  r[N-1-i]-=C-xv[i][0]
  
ans=max(max(l),max(r))

lm=[0]*N
lm[0]=l[0]
for i in range(1,N):
  lm[i]=max(lm[i-1],l[i])
  
rm=[0]*N
rm[0]=r[0]
for i in range(1,N):
  rm[i]=max(rm[i-1],r[i])

for i in range(N-1):
  ans=max(ans,l[i]-xv[i][0]+rm[N-1-i-1])
for i in range(N-1):
  ans=max(ans,r[i]-C+xv[N-1-i][0]+lm[N-1-i-1])
  
print(max(ans,0))



Measured memory_bytes: 39796
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

int main(){
int n, x[100],y[100];
cin >>n;
for(int i=0; i<n; i++)cin >>x[i];
for(int i=0; i<n; i++)cin >>y[i];
double d[4];
for(int i=0; i<4; i++) d[i]=0.0;
for(int p=1; p<=3; p++){
for(int i=0; i<n; i++){
d[p]+=pow(fabs(x[i]-y[i]),p);
}
d[p]=pow(d[p],1.0/p);
}
for(int i=0; i<n; i++){
d[0]=(d[0]<fabs(x[i]-y[i])?fabs(x[i]-y[i]):d[0]);
}
printf("%lf\n",d[1]);
printf("%lf\n",d[2]);
printf("%lf\n",d[3]);
printf("%lf\n",d[0]);

return 0;
}

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

void solved()
{
    int a,b,c,d;
    cin >> a >>b >> c >> d; 
    while(true)
    {
        c -= b;
        if(c <= 0)
        {
            cout <<"Yes";
            return ;
        }
        a -= d;
        if(a <= 0)
        {
            cout <<"No";
            return ;
        }
        
    }
}

int main()
{
#ifdef ONLINE_JUEDGE
    ios::sycn_with_stdio(false);cin.tie(0);cout.tie(0);
#endif
    int t = 1;
    //cin >> t;
    while(t--)
    {
        solved();
    }



#ifndef ONLINE_JUEDGE
    system("pause");
#endif 
    return 0;
}

Measured memory_bytes: 3700
x, y = map(int, input().split())

d = abs(abs(y) - abs(x))

if (x > 0 and y < 0) or (x < 0 and y > 0):
    d += 1
elif x > y:
    if x == 0 or y == 0:
        d += 1
    else:
        d += 2

print(d)


Measured memory_bytes: 9068
////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

namespace my {
/*汎用*/
template <typename T>
void input_vec(vector<T> &a, ll n) {
  if (!a.empty()) {
    cout << "error in input_vec" << endl;
    exit(1);
  }
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
}
template <typename T>
void input_set(set<T> &a, ll n) {
  if (!a.empty()) {
    cout << "error in input_set" << endl;
    exit(1);
  }
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.insert(tmp);
  }
}

char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }

/*整数*/
ll gcd(ll a, ll b) {  // O( log(max(a,b)) )
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
ll lcm(ll a, ll b) { return a * (b / my::gcd(a, b)); }  // O( log(max(a,b)) )
ll modinv(ll n, ll mod) {                               // O( log(max(n,mod)) )
  if (mod < 0 || my::gcd(n, mod) != 1) {
    cout << "error in modinv" << endl;
    exit(1);
  }
  n %= mod;
  if (n < 0) n += mod;
  ll a = mod, b = n, x = 1, y = 0;
  while (b != 0) {
    ll q = a / b, r = a % b;
    a = b;
    b = r;
    y -= q * x;
    swap(x, y);
  }
  y %= mod;
  if (y < 0) y += mod;
  return y;
}

bool isPrime(ll n) {  // O( sqrt(n) )
  bool flag = true;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      flag = false;
      break;
    }
  }
  return flag;
}
vector<pair<ll, ll>> primeFac(ll n) {  // O( sqrt(n) )
  vector<pair<ll, ll>> ret;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0) continue;
    ll exp = 0;
    while (n % i == 0) {
      n /= i;
      exp++;
    }
    ret.push_back(make_pair(i, exp));
  }
  if (n != 1) ret.push_back(make_pair(n, 1));
  return ret;
}
}  // namespace my
////////////////////////////////////////////////

int main() {
  int n;
  cin >> n;
  if (n == 0)
    cout << 1 << endl;
  else
    cout << 0 << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
long double coins[3005];
int n;
long double dp[3005][3005][3];

int main(){
   
    cin >> n;
    for(int i=1;i<=n;i++) cin >> coins[i];
    
    
    for(int i=n;i>=0;i--){
        for(int j=n;j>=0;j--){
            for(int k=1;k>=0;k--){
                if(i==n){
                    if(j<=(n/2)) dp[i][j][k]=0;
                    else if(k==1) dp[i][j][k]=coins[i];
                    else dp[i][j][k]=1-coins[i];
                }
                
                else{
                    long double t1,t2;
                    if(i==0){
                        t1=dp[i+1][j][0];
                        t2=dp[i+1][j+1][1];
                    }
                    else if(k==1){
                        t1=dp[i+1][j][0]*coins[i];
                        t2=dp[i+1][j+1][1]*coins[i];
                    }
                    else{
                        t1=dp[i+1][j][0]*(1-coins[i]);
                        t2=dp[i+1][j+1][1]*(1-coins[i]);
                    }
                    dp[i][j][k]=t1+t2;
                }
            }
        }
    }
    printf("%0.12Lf\n",dp[0][0][0]);
}

Measured memory_bytes: 426308
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// get a integer
		int N = sc.nextInt();
		int K = sc.nextInt();
		
		System.out.println(Main.possibleWaystoPaint(N, K));
		sc.close();
	}
	
	static int possibleWaystoPaint(int N, int K) {
		int result = K;
		for (int i = 0; i < N-1; i++)
			result *= (K-1);
		return result;
	}

}

Measured memory_bytes: 9684
import heapq
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

X, Y, Z, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A = sorted(A, reverse=True)
B = sorted(B, reverse=True)
C = sorted(C, reverse=True)


def calc(x, y, z):
    return [-A[x]-B[y]-C[z], x, y, z]


def solve1(A, B, C, X, Y, Z, k):
    Q = []
    Q.append(calc(0, 0, 0))

    ans = []
    # dict
    memo = {(0, 0, 0): True}
    for _ in range(k):
        e, x, y, z = heapq.heappop(Q)
        ans.append(-e)
        if x+1 < X and (x+1, y, z) not in memo:
            heapq.heappush(Q, calc(x+1, y, z))
            memo[(x+1, y, z)] = True
        if y+1 < Y and (x, y+1, z) not in memo:
            heapq.heappush(Q, calc(x, y+1, z))
            memo[(x, y+1, z)] = True

        if z+1 < Z and (x, y, z+1) not in memo:
            heapq.heappush(Q, calc(x, y, z+1))
            memo[(x, y, z+1)] = True

    print("\n".join(map(str, ans[:k])))


solve1(A, B, C, X, Y, Z, k)


Measured memory_bytes: 5168
from collections import defaultdict
import heapq

n, m = map(int, input().split())
dct = defaultdict(list)

for i in range(n):
    a, b = map(int, input().split())
    dct[a].append(-b)

h = []
res = 0

for i in range(1, m + 1):
    if dct[i]:
        for item in dct[i]:
            heapq.heappush(h, item)
    if h:
        res += heapq.heappop(h)

print(-res)


Measured memory_bytes: 27676
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip> // setprecisionを使用するのに必要 cout << fixed << setprecision(15) << p でpを小数点以下15桁表示
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
#define DIV0 1000000007
typedef long long ll;
#define fin(ans) cout << (ans) << '\n'
/*

*/
int main()
{   
    string S,T;
    cin >> S >> T;
    //fin(S.length());
    //何文字一致するか調べる
    int fit = 0;
    int temp;
    REP(i,S.length()){
        REP(j,S.length()){
            if(S.length() < j + T.length()){
                break;
            }
            temp = 0;
            REP(k,T.length()){
                if(S[j+k] == T[k]) temp++;
            }
            if(fit < temp) fit = temp;
        }
    }
    fin(T.length()-fit);
    return 0;
}

Measured memory_bytes: 3200
import collections

x = collections.deque(input())
n = int(input())
rev = False

for i in range(n):
    y = input().split()
    if len(y) == 1:
      rev = not rev
    elif rev:
      if int(y[1]) == 2:
          x.appendleft(y[2])
      else:
          x.append(y[2])
    else:
      if int(y[1]) == 2:
          x.append(y[2])
      else:
          x.appendleft(y[2])

if rev:
  x.reverse()

print("".join(x))

Measured memory_bytes: 8820
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{	
	int n[3] = {1,0,0};
	char k[3];
	while(cin>>k){
		if(k[0]=='A'){
			if(k[2]=='B'){
				swap( n[0], n[1] );
			}else{
				swap( n[0], n[2] );
			}
		}
		if(k[0]=='B'){
			if(k[2]=='A'){
				swap( n[1], n[0]);
			}else{
				swap( n[1], n[2]);
			}
		}
		if(k[0]=='C'){
			if(k[2]=='A'){
				swap( n[2], n[0]);
			}else{
				swap( n[2], n[1]);
			}
		}
		
	}
		if(n[0]==1) cout<<'A'<<endl;
		else if(n[1]==1) cout<<'B'<<endl;
		else cout<<'C'<<endl;
		
	return 0;
}

Measured memory_bytes: 1128
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstdlib>
using namespace std;
int main(){
	int a[2] = {0};
	for(int i = 0; i < 2; i++){
		for(int j = 0; j < 4; j++){
			int b;
			scanf("%d",&b);
			a[i] += b;
		}
	}
	printf("%d\n",max(a[0],a[1]));
	return 0;
}

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

using namespace std;

int main(){
	long long n,x,t;
	cin >> n >> x >> t;
	if(n < x){
		cout << t << endl;
	}
	else{
		int temp = 1,ans,check=0;
		while(n > check){
			check += x;
			ans = temp*t;
			temp++;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h> 
#define ll long long
using namespace std;
vector<ll> A;
void topological_sort(ll n, vector<ll> my_vec[],  int isVisited[])
{
	isVisited[n]=1;
	for(ll i=0;i<my_vec[n].size();i++)
	{
		if(isVisited[my_vec[n][i]]==0)
		{
			topological_sort(my_vec[n][i],my_vec,isVisited);
		}
		
	}
	A.push_back(n);

} 
int main()
{
	ll n,m;
	cin>>n>>m;
	ll a,b;
	vector<ll> my_vec[n+1];
	for(ll i=0;i<m;i++)
	{
		cin>>a>>b;
		my_vec[a].push_back(b);
	} 
/*	for(int i=0;i<n;i++)
	{
		cout<<i<<" : ";
		for(int j=0;j<my_vec[i].size();j++)
		{
			cout<<my_vec[i][j]<<" ";
		}
		cout<<endl;
	}
*/
	int isVisited[n+1];
	for(ll i=0;i<=n;i++)
	{
		isVisited[i]=0;
	}
	for(ll i=1;i<=n;i++)
	{
		if(isVisited[i]==0)
		{
			topological_sort(i,my_vec,isVisited);
		}
	}
	ll B[A.size()];
	for(ll i=A.size()-1;i>=0;i--)
	{
		B[A.size()-i-1]=A[i];
	}
	ll S[n+1];
	for(ll i=0;i<=n;i++)
	{
		S[i]=0;
	}
	for(ll i=0;i<A.size();i++)
	{
		ll t=B[i];
		for(ll j=0;j<my_vec[t].size();j++)
		{
			S[my_vec[t][j]]=max(S[my_vec[t][j]],S[t]+1);
		}
	}
	ll m1=S[0];
	for(ll i=0;i<=n;i++)
	{
		m1=max(S[i],m1);
	}
	cout<<m1<<endl;
	return 0;
}


Measured memory_bytes: 9336
def main():
	# n,k = map(int,input().split())
	n = int(input())
	# s = str(input())
	h = list(map(int,input().split()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	# s = list(s)
	ans = 0
	dp = [0] * n
	if n == 1:
		print(0)
	elif n == 2:
		if h[0] >= h[1]:
			print(1)
		else:
			print(0)
	else:
		if h[0] >= h[1]:
			dp[0] = 1
		for i in range(1,n-1):
			if h[i] >= h[i+1]:
				dp[i] = dp[i-1] + 1
			else:
				dp[i] = 0
		print(max(dp))

	





if __name__ == '__main__':
	main()

Measured memory_bytes: 63856
N = int(input())
S = input()
count_e = [0] * N
count_w = [0] * N
for i in range(N-1):
    if S[i] == "W":
        count_w[i+1] = count_w[i] + 1
    else:
        count_w[i+1] = count_w[i]

    if S[N-i-1] == "E":
        count_e[i+1] = count_e[i] + 1
    else:
        count_e[i+1] = count_e[i]

count_e = count_e[::-1]
ans = float('inf')
for i in range(N):
    ans = min(ans, count_w[i] + count_e[i])
print(ans)

Measured memory_bytes: 19968
def resolve():
	n = int(input())
	a = list(map(int, input().split()))
	m = sum(a)
	cnt = 0
	ans = float('inf')
	for i in range(len(a) - 1):
		cnt = cnt + a[i]
		ans = min(ans, abs(m - cnt*2))
	print(ans)
resolve()

Measured memory_bytes: 76752
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
int H, W, N;
int Sr, Sc;
string S, T;

int main(){
    cin >> H >> W >> N;
    cin >> Sr >> Sc;
    cin >> S >> T;

    int xmin=1, xmax=H;
    int ymin=1, ymax=W;
    for(int i=N-1; i>=0; i--){
        if(T[i]=='U') xmax = min(H, xmax+1);
        else if(T[i]=='D') xmin = max(1, xmin-1);
        if(T[i]=='L') ymax = min(W, ymax+1);
        else if(T[i]=='R') ymin = max(1, ymin-1);
        // cout << xmin << " " <<  xmax << " " << ymin << " " << ymax << endl;

        if(S[i]=='U') xmin++;
        else if(S[i]=='D') xmax--;
        if(S[i]=='L') ymin++;
        else if(S[i]=='R') ymax--;
        // cout << xmin << " " <<  xmax << " " << ymin << " " << ymax << endl;
        if(xmin>xmax || ymin>ymax){
            cout << "NO" << endl;
            return 0;
        }
    }

    if(xmin<=Sr && Sr<=xmax && ymin<=Sc && Sc<=ymax) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 776
import sys
def main():
    input = sys.stdin.readline
    N = int(input())
    S = [list(input().rstrip()) for _ in range(N)]

    color = [-1] * N
    color[0] = 0
    stack = [0]
    while stack:
        v = stack.pop()
        for to in range(N):
            if S[v][to] == '0': continue
            if color[to] >= 0:
                if color[to] == color[v]:
                    print(-1)
                    exit()
                continue
            stack.append(to)
            color[to] = color[v]^1

    D = [[10**9] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if i == j: D[i][j] = 0
            elif S[i][j] == '1': D[i][j] = 1
    for k in range(N):
        for i in range(N):
            for j in range(N):
                D[i][j] = min(D[i][j], D[i][k] + D[k][j])
    print(max(max(d) for d in D) + 1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 42096
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    ll n,T;
    cin>>n>>T;
    ll c, t;
    ll ans=10000;
    bool bl=false;;
    for(ll i=0;i<n;++i){
        cin>>c>>t;
        if(t>T){
            continue;
        }
        ans=min(ans, c);
        bl=true;
    }
    if(bl==false){
        cout<<"TLE"<<endl;
    }else{
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        
        while(true){
            int h = scanner.nextInt();
            int w = scanner.nextInt();
            
            if(h==0 && w ==0) break;
            
            for (int i=1;i<=h;i++) {
                for (int j=1;j<=w;j++) {
                    if(i==1 || i==h){
                        System.out.print("#");
                    } else if(j !=1 && j != w){
                        System.out.print(".");
                    } else {
                        System.out.print("#");
                    }
                }
                System.out.println("");
            }
            System.out.println("");
        }
    }
}



Measured memory_bytes: 34356
#include <cstring>
#include <iostream>
#include <vector>
#include <tuple>

using namespace std;

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

const int INF = 1001001001;
vector<int> to[2505];
vector<int> ot[2505];

bool ok1[2505]; // 頂点1から到達できたらtrue
bool okN[2505]; // 頂点nに到達できたらtrue
bool ok[2505]; // ok1 & okN

void dfs(int v) {
  if (ok1[v]) return;
  ok1[v] = true;
  for (int u : to[v]) dfs(u);
}

void rdfs(int v) {
  if (okN[v]) return;
  okN[v] = true;
  for (int u : ot[v]) rdfs(u);
}

int main() {
  int n, m, p;
  vector<tuple<int, int, int>> edges;
  cin >> n >> m >> p;
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    c = c -p;
    c = -c;
    edges.emplace_back(a, b, c);
    to[a].push_back(b);
    ot[b].push_back(a);
  }

  dfs(0);
  rdfs(n-1);
  for (int i = 0; i <= n; ++i) {
    ok[i] = ok1[i] & okN[i];
  }

  {
    vector<int> dist(n, INF);
    dist[0] = 0;
    bool upd = true;
    int step = 0;
    while (upd) {
      upd = false;
      for (int i = 0; i < m; ++i) {
        int a, b, c;
        tie(a, b, c) = edges[i];
        if (!ok[a]) continue;
        if (!ok[b]) continue;
        int nc = dist[a] + c;
        if (nc < dist[b]) {
          upd = true;
          dist[b] = nc;
        }
      }
      step++;
      if (step > n) {
        puts("-1");
        return 0;
      }
    }
    int ans = -dist[n-1];
    ans = max(ans, 0);
    cout << ans << endl;
  }
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;

bool is_kaibun(const string &str, i32 s, i32 e) {
    while (s <= e) {
        if (str[s] != str[e]) return false;
        s++, e--;
    }

    return true;
}

int main() {
    string s;
    cin >> s;
    i32 n = s.size();

    cout << (is_kaibun(s, 0, (n-3) / 2) && is_kaibun(s, (n+1) / 2, n-1) && is_kaibun(s, 0, n-1) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        @SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
        // 複数行の読み込み
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        int mod = (int) ((c+0.5) / a);
        
        System.out.println(mod*b);
    }
}

Measured memory_bytes: 21716
<?php 
  fscanf(STDIN, "%d", $n);
  $a = explode(' ',trim(fgets(STDIN)));
  $num = 1;
  if(array_search(0, $a)){
  	echo '0';
    return;
  }
  foreach ($a as $value) {
    // code...
    $num *= intval($value);
    if ($num > 10 ** 18) {
    // code...
    echo '-1';
    return;
  }
  }
  echo $num;

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

using namespace std;

long long a,b,c,n;

int main()
{
    cin >> n;
    a = n/100;
    b = n/10 % 10;
    c = n%10;
    if(a==1) cout<<9;
    else cout<<1;

    if(b==1) cout<<9;
    else cout<<1;

    if(c==1) cout<<9;
    else cout<<1;


    return 0;
}


Measured memory_bytes: 3504
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


void solve(long long N, long long K){
    if (N%K == 0){
        cout << 0 << "\n";
    } else {
        cout << 1 << "\n";
    }
}

int main(){

    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  	int N, K;
  	cin >> N >> K;
  	int temp1, temp2, firs, las;
  	int max1 = -1;
  	cin >> temp1;
  	firs = temp1;
  	while (cin>>temp2) {
    	las = temp2;
      	max1 = max(temp2-temp1, max1);
      	temp1 = temp2;
    }
  	int ans = N - max(max1, N-las+firs);
  	cout << ans << endl;
	return 0;
}

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

const int maxn = 1e6+5;

int main()
{
    string a, b;
    cin >> a >> b;
    int n, m;
    cin >> n >> m;
    string c; cin >> c;
    if(c == a) cout << n-1 << ' ' << m << endl;
    else if(c == b) cout << n << ' ' << m-1 << endl;
    else cout << n << ' ' << m << endl;
}


Measured memory_bytes: 256
import itertools
n,m = map(int,(input().split()))
sw =[list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
result = 0

for i in itertools.product([0, 1], repeat=n):
    onof = True
    for j in range(m):
        counter = 0
        for k in sw[j][1:]:
            counter += i[k-1]
        if counter % 2 != p[j]:
            onof = False
            break
    if onof:
        result += 1
print(result)
    


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

void solve() {
    ll N, K; cin >> N >> K;
    vector<ll> a(N);
    for(int i = 0; i < N; ++i){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    ll ans = 0;
    for(int i = 0; i < K; ++i) ans += a[i];
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 3624
#pragma GCC optimize(2)
#pragma GCC optimize(3)   
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector < ll > vl;
typedef vector < vl > vvl;
typedef pair < ll, ll > pll;
typedef vector < pair < ll, ll > > vpll;
#define kill freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(c) c.begin(), c.end()
#define go(c,it) for(auto it=(c).begin(); it!=(c).end(); it++)
#define fi first
#define se second
#define MOD 998244353
#define Boost() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD1 1000000007
ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;}a=(a*a)%MOD;b>>=1;}return res;}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
#define oo 100000000000000000
const ll dx[]={-1,0,1, 0,-1,1, 1,-1};
const ll dy[]={ 0,1,0,-1, 1,1,-1,-1};

void solve(){
   ll r,g,b,k;
   cin>>r>>g>>b>>k;
   while(k>0&&g<=r){
       g*=2LL;
       k--;
   }
   if(g<=r){
       cout<<"No\n";
   }else{
       while(b<=g&&k>0){
           b*=2LL;
           k--;
       }
       if(b<=g){
           cout<<"No\n";
       }else{
           cout<<"Yes\n";
       }
   }
}

int main(){
    Boost();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; ++i)
const int INF = 1 << 30;
using namespace std;

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

  int n, l; cin >> n >> l;
  vector<int> taste(n);
  int allTaste = 0;
  rep(i, n) {
    taste[i] = l + i;
    allTaste += taste[i];
  }

  int minTaste = INF;
  rep(i, n) minTaste = min(minTaste, abs(taste[i]));
  int ans = allTaste - minTaste;
  if(allTaste < 0) ans = allTaste + minTaste;
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0; i<(N); i++)
#define pb push_back
typedef long long ll;
const ll mod=1e9+7;

ll N,M;
ll A[100005];
ll mada[100005];
ll ans;
vector<vector<ll> > vv(100005);

void dfs(ll x){
	if(mada[x]) return;
	mada[x]=1;
	rep(i,vv[x].size()){
		ll y=vv[x][i];
		dfs(y);
	}
	return;
}

int main(){ 

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

cin>>N>>M;

rep(i,M){
	ll x,y,z;
	cin>>x>>y>>z;
	x--; y--;
	vv[x].pb(y);
	vv[y].pb(x);
}

rep(i,N){
	if(mada[i]==0){
		ans++;
		dfs(i);
	}
}

cout<<ans<<endl;

}


Measured memory_bytes: 9600