akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

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(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll max = x/100;
    ll min = x/105;
    bool flag = false;
    for(int i = min; i <= max ; i++){
        if(i*100 <= x && i*105 >= x){
            flag = true;
        }
    }
    if(flag){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }


    return 0;
}


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

int main() {
  double W, H;
  cin >> W >> H;
  double x, y;
  cin >> x >> y;
  double ans1 = W * H / 2.0;
  int ans2 = 0;
  if (x == W/2 && y == H/2) {ans2 = 1;}
  cout << fixed << setprecision(10) << ans1 << " " << ans2 << endl;
}

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

int main() {
    int N;
    int a[100001];
    cin >>N;
    double counteven1=0;
    double counteven2=0;
    double counteven4=0;
    for(int i=0;i<N;i++){
        cin>>a[i];
        if(a[i]%4==0){
            counteven4++;
        }else if(a[i]%2==0){
            counteven2++;
        }else counteven1++;
    }
    if(counteven2==0&&counteven4+1>=counteven1){
        cout<<"Yes";
    }
    else if(counteven2!=0&&counteven4>=counteven1){
        cout<<"Yes";
    }else cout<<"No";
    return 0;
}


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

int main() {
  string S;
  cin>>S;
  bool frag = true;
  if (S[0] != 'A') frag = false;
  int cnt = 0;
  rep(i, S.size()-1) {
    if (i==0||i==1) continue;
    if (S[i]=='C') cnt++;
  }
  if (cnt!=1) frag = false;
  rep(i, S.size()) {
    if (S[i]=='A') continue;
    if (S[i]=='C') continue;
    if (S[i]<'a'||'z'<S[i]) frag = false;
  }
  if(frag) cout << "AC" << endl;
  else cout << "WA" << endl;
}


Measured memory_bytes: 256
S=input()
x=0
if len(S)%2==1:
 for i in range(len(S)//2+1):
  if S[2*i]=='L':
   x= x+1
  else:
   x= x
else:
 for i in range(len(S)//2):
  if S[2*i]=='L':
    x= x+1
  else:
    x= x

for j in range(len(S)//2):  
  if S[2*j+1]=='R':
   x= x+1
  else:
   x= x
    
if x==0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include <cstdio>
typedef long long int64;
static const int MAXN = 1e6 + 4;
static const int MODULUS = 1e9 + 7;
#define _  %  MODULUS
#define __ %= MODULUS

int n;
int64 f[MAXN] = { 0 };

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

    f[0] = 1;
    f[1] = n;
    int64 sum = (f[0] + f[1])_;
    for (int i = 2; i <= n; ++i) {
        (f[i] += sum - f[i - 2] + MODULUS)__;
        (f[i] += (int64)(n - i + 1) * n + (int64)(n - 1) * (i - 2))__;
        (sum += f[i])__;
    }

    //for (int i = 0; i <= n; ++i) printf("%lld%c", f[i], i == n ? '\n' : ' ');
    printf("%lld\n", f[n]);
    return 0;
}


Measured memory_bytes: 7936
/**
 * Created by hiramekun at 20:55 on 2020-05-17.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    string n;
    cin >> n;
    if (n.back() == '2' || n.back() == '4' || n.back() == '5' || n.back() == '7' || n.back() == '9') {
        cout << "hon" << '\n';
    } else if (n.back() == '3') {
        cout << "bon" << '\n';
    } else {
        cout << "pon" << '\n';
    }
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 3628
def countString(word, text):
    counter = 0
    for t in text:
        if t == word:
            counter += 1
    print(counter)

if __name__ == '__main__':
    w = input()
    mojiretsu = []
    while True:
        s = input()
        if s == "END_OF_TEXT":
            break
        moji = s.lower().split()
        for m in moji:
            mojiretsu.append(m)
    countString(w, mojiretsu)


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


void solve(long long N, long long K){
    long long a = N % K;
    cout << min(abs(a-K), abs(a)) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 256
str = input()
S = list(str)

ans = 0
num = 0

for i in range(len(S)):
  if S[i] == "A" or S[i] == "G" or S[i] == "T" or S[i] == "C":
    num = 1
    for j in range(i+1,len(S)):
      if S[j] == "A" or S[j] == "G" or S[j] == "T" or S[j] == "C":
        num = num + 1
      else :
        break
  if ans < num :
    ans = num
  num = 0
  
print(ans)

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

Measured memory_bytes: 596
def pop_when_x():
    S1.pop(0)
    S2.pop(0)
    global left_state
    left_state = "X"


def pop_when_y():
    S1.pop(0)
    S1.pop(0)
    S2.pop(0)
    S2.pop(0)
    global left_state
    left_state = "Y"


if __name__ == '__main__':
    N = int(input())
    S1 = list(input())
    S2 = list(input())

    if S1[0] == S2[0]:
        cases = 3
        left_state = "X"
        pop_when_x()
    else:
        cases = 6
        left_state = "Y"
        pop_when_y()

    while len(S1) != 0:
        # print("".join(S1))
        # print("".join(S2))
        # print(cases)
        if S1[0] == S2[0]:
            state = "X"
        else:
            state = "Y"
        # print("left_state:" + left_state)
        # print("state:" + state)
        if left_state == "X" and state == "X":
            cases *= 2
            pop_when_x()
        elif left_state == "X" and state == "Y":
            cases *= 2
            pop_when_y()
        elif left_state == "Y" and state == "X":
            cases *= 1
            pop_when_x()
        elif left_state == "Y" and state == "Y":
            cases *= 3
            pop_when_y()

    print(cases % 1000000007)


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

namespace AOJ
{
  class Program
  {
    static void Main()
    {
      var stack = new Stack<int>();
      foreach (var i in ReadNumbers())
      {
        if (i == 0)
          Console.WriteLine(stack.Pop());
        else
          stack.Push(i);
      }
    }

    static IEnumerable<int> ReadNumbers()
    {
      string line;
      while (!string.IsNullOrEmpty(line = Console.ReadLine()))
        yield return int.Parse(line);
    }
  }
}

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

int main() {
  int n, a, f = 1;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> a;
    if(a % 2 == 0 && a % 3 && a % 5)
      f = 0;
  }
  if(f)
    cout << "APPROVED\n";
  else
    cout << "DENIED\n";
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

int main() {
  int N, K;
  cin >> N >> K;

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

  rep(i, N - K) { cout << (a[K + i] > a[i] ? "Yes" : "No") << "\n"; }
  return 0;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll a, b;
    cin >> a >> b;

    if (a <= b) {
        cout << a << endl;
    } else {
        cout << a-1 << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>

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

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


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

  int x,n;
  cin >> x >> n;
  set<int> s;
  rep(i,n){
    int p;
    cin >> p;
    s.insert(p);
  }
  
  int cdif = 100000;
  int ans = 1000;
  for(int i = -10; i< 110; i++){
    if(abs(i-x) < cdif && s.count(i)==0){
      ans = i;
      cdif = abs(i-x);
    }
  }
  cout << ans << endl;
  
  return 0;
    

}


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

using namespace std;

vector<int> func(vector<int> a, int k, int sign=1) {
	int n = a.size();
	for (int i = 0; i < n; ++i) { a[i] *= sign; }

	vector<int> ret;
	deque<int> que;
	int l = 0, r = 0;
	while (r < n) {
		while (!que.empty() && a[que.back()] >= a[r]) { que.pop_back(); }
		que.push_back(r++);

		if (r < k) { continue; }
		ret.push_back(a[que.front()]);
		if (que.front() == l++) { que.pop_front(); }
	}
	for (int i = 0; i < ret.size(); ++i) { ret[i] *= sign; }
	return ret;
}

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> a(N);
	for (int i = 0; i < N; ++i) { cin >> a[i]; }

	auto min_a = func(a, K);
	auto max_a = func(a, K, -1);

	int ans = 1;
	for (int i = 1; i + K <= N; ++i) {
		if (min_a[i-1] != a[i-1] || max_a[i] != a[i+K-1]) {
			++ans;
		}
	}

	int cnt = 1;
	int x = 0;
	for (int i = 1; i < a.size(); ++i) {
		if (a[i-1] < a[i]) { ++cnt; }
		else {
			if (cnt >= K) { ++x; }
			cnt = 1;
		}
	}
	if (cnt >= K) { ++x; }
	ans -= max(x - 1, 0);
	cout << ans << endl;

	return 0;
}


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

int main(){
    string w;
    cin >> w;
    bool check = true;
    for(int i=0; i < w.size(); i++){
        if(count(w.begin(), w.end(), w.at(i)) % 2 != 0){
            check = false;
            break;
        }
    }

    if(check){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3588
/*
Stay away from
               ,----..                                                             ,---.-,
  ,----..     /   /   \                   ,---,     ,---,                 ,---,   '   ,'  '.
 /   /   \   /   .     :         ,---. ,`--.' |   .'  .' `\            ,`--.' |  /   /      \
|   :     : .   /   ;.  \       /__./| |   :  : ,---.'     \          /    /  : .   ;  ,/.  :
.   |  ;. /.   ;   /  ` ;  ,---.;  ; | :   |  ' |   |  .`\  |        :    |.' ' '   |  | :  ;
.   ; /--` ;   |  ; \ ; | /___/ \  | | |   :  | :   : |  '  |        `----':  | '   |  ./   :
;   | ;    |   :  | ; | ' \   ;  \ ' | '   '  ; |   ' '  ;  :           '   ' ; |   :       ,
|   : |    .   |  ' ' ' :  \   \  \: | |   |  | '   | ;  .  |  ---      |   | |  \   \      |
.   | '___ '   ;  \; /  |   ;   \  ' . '   :  ; |   | :  |  '           '   : ;   `---`---  ;
'   ; : .'| \   \  ',  /     \   \   ' |   |  ' '   : | /  ;            |   | '      |   |  |
'   | '/  :  ;   :    /       \   `  ; '   :  | |   | '` ,/             '   : |      '   :  ;
|   :    /    \   \ .'         :   \ | ;   |.'  ;   :  .'               ;   |.'      |   |  '
 \   \ .'      `---`            '---"  '---'    |   ,.'                 '---'        ;   |.'
  `---`                                         '---'                                '---'

to save your life.
*/
#define   ll                long long
#define   pb                push_back
#define   ff                first
#define   ss                second
#define   srt(v)            sort(v.begin(),v.end())
#define   inf               2000000000000000
#define   mxn               200000
#define   pi                acos(-1)
#define   MOD               1000000007
#define   db(x)             printf("### VALUE: (%lld) ###\n",(ll)x)
#include  <bits/stdc++.h>
using namespace std;

vector<int> g[mxn];
int dp[mxn];
int solve(int u)
{
    if(g[u].size() == 0){
        return 0;
    }
    if(dp[u] != -1) return dp[u];
    int ret = 0;
    for(int i = 0;i < g[u].size(); i++){
        ret = max(ret,1 + solve(g[u][i]));
    }

    return  dp[u] = ret;
}
int main()
{
    int n,m;
    cin >> n >> m;
    memset(dp,-1,sizeof dp);
    for(int i = 1;i <= m;i++){
        int x,y;
        cin >> x >> y;
        g[x].pb(y);
    }
    int x = 0;
    for(int i = 1;i <= n;i++){
        x = max(x,solve(i));
    }
    cout << x << endl;

}
/*
".....but the truth is that you can increase it slightly."
Day 16.

*/




Measured memory_bytes: 10880
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC147A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, d;
            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);
            d = a + b + c;
            if (d >= 22)
                Console.WriteLine("bust");
            else
                Console.WriteLine("win");

            Console.ReadKey();
        }
    }
}



Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,a,b;
    int p[100];
    cin>>n>>a>>b;
    for(int k=0;k<n;k++){
        cin>>p[k];
    }
    int ans=0;
    int ca=0;
    int cb=0;
    int cc=0;
    for(int k=0;k<n;k++){
        if(p[k]<=a)ca++;
        else if(a+1 <= p[k] && p[k] <= b)cb++;
        else if(b+1 <= p[k] )cc++;
        //else while(1);
    }
    cout<<min(ca,min(cb,cc))<<endl;
}

Measured memory_bytes: 256
/**Bismillahir Rahmanir Rahim**/


#include<bits/stdc++.h>
using namespace std;
#define ll long long

#define pb push_back
#define io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define clr(v) v.clear()
vector<ll>v;
pair<ll,ll>p;
map<ll,ll>mp;
set<ll>st;
deque<ll>dq;
priority_queue<ll>pq;
#define f(i,b) for(i=0;i<b;i++)
#define f1(i,b) for(i=1;i<=b;i++)
#define fr(i,b)for(i=b-1;i>=0;i--)
ll mn=INT_MAX,mx=INT_MIN;
ll n,m,tc,i,j,tmp,sum,cn,ans,res,pos,flag,l,x,k,dif;

string s,str;


ll a[200007],b[200007];
int main()
{

   io;
ll n,m;
cin>>n;
if(n%2==0)cout<<n;
else cout<<n*2;
return 0;
}





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

//ifstream fin("date.in");
//ofstream gout("date.out");

const int NMax = 1e6 + 5;
const int mod = 1e9 + 7;



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

	char m[3][4];
	char n[3][4];

	string l1;
	string l2;

	cin >> l1;

	for(int i = 0; i < 3; ++i) {
		m[1][i + 1] = l1[i];
	}

	cin >> l2;
	for(int i = 0; i < 3; ++i) {
		m[2][i + 1] = l2[i];
	}

	n[1][1] = m[2][3];
	n[1][2] = m[2][2];
	n[1][3] = m[2][1];
	n[2][1] = m[1][3];
	n[2][2] = m[1][2];
	n[2][3] = m[1][1];

	for(int i = 1; i <= 2; ++i) {
		for(int j = 1; j <= 3; ++j) {
			if(m[i][j] != n[i][j]) {
				cout << "NO";
				return 0;
			}
		}
	}
	cout << "YES";
	return 0;
}

Measured memory_bytes: 256
N=int(input())
txy=[[0,0,0]]
for i in range(0,N):
    tmp=input().split()
    tmp=[int(s) for s in tmp]
    txy.append(tmp)
cnt=0
for i in range(0,N):
    d=abs(txy[i][1]-txy[i+1][1])+abs(txy[i][2]-txy[i+1][2])
    t=txy[i+1][0]-txy[i][0]
    if d <= t and (t-d)%2==0:
        cnt+=1
    else:
        break
if cnt==N:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 21156
#include<bits/stdc++.h>
using namespace std;
int a[110];
int main()
{
    int n,s=0;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=1;i<n;i++)
    {
        int l=1;
        while(a[i]==a[i-1])
        {
            l++;
            i++;
        }
        s+=l/2;
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <chrono>
//#pragma GCC optimize("Ofast")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
typedef pair<ll, ll> P;
const ll INF = (1LL<<60);

class BIT{
        ll n;
  		vector<ll> bitree;
    public:
    	BIT(unsigned long _n) : bitree(_n + 1, 0){
          n = _n;
        }
    	void add(ll id, ll x){
          while(id <= n){
            bitree[id] += x;
            id += id & -id;
          }
          return;
        }
    	ll sum(ll id){
          ll temp = 0;
          while(id > 0){
            temp += bitree[id];
            id -= id & -id;
          }
          return temp;
        }
  };

int main() {
    cin>>N;
    vec x(N), y(N), ord(N), ans(N);
    rep(i,N){
        cin>>x[i]>>y[i];
        --x[i];
        ord[x[i]] = i;
    }
    BIT bit(N + 10);
    int temp_num(0);
    rep(i, N){
        ++temp_num;
        int id = ord[i];
        bit.add(y[id], 1);
        //reps(j, 1, 5) cout<<bit.sum(j) - bit.sum(j - 1)<<" \n"[j == 4];
        if(bit.sum(N - 1 - i) == 0){
            reps(j, i + 1 - temp_num, i + 1) ans[ord[j]] = temp_num;
            temp_num = 0;
        }
    }
    rep(i, N) cout<<ans[i]<<endl;
}


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

def solve(N: int, A: "List[int]"):
    A = sorted(a - i for i, a in enumerate(A))
    m = A[N//2]
    return sum(abs(a-m) for a in A)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 41560
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		if (n == 2) {
			System.out.println(Math.max(a[0], a[1]));
			return;
		}

		long ans = Long.MIN_VALUE;
		long[][] dp = new long[n][3];
		dp[0][0] = a[0];
		dp[1][0] = a[0];
		dp[2][0] = a[0] + a[2];
		dp[1][1] = a[1];
		dp[2][1] = a[1];
		dp[2][2] = a[2];
		for (int i = 3; i < n; i++) {
			if (i % 2 == 0) {
				dp[i][0] = dp[i - 2][0] + a[i];
				dp[i][1] = dp[i - 1][1];
				dp[i][2] = Math.max(dp[i - 2][2], dp[i - 3][1]) + a[i];
			} else {
				dp[i][0] = dp[i - 1][0];
				dp[i][1] = Math.max(dp[i - 2][1], dp[i - 3][0]) + a[i];
				dp[i][2] = dp[i - 1][2];
			}
		}
//		for (int i = 0; i < dp.length; i++) {
//			for (int j = 0; j < dp[i].length; j++) {
//				System.out.print(dp[i][j] + "\t");
//			}
//			System.out.println();
//		}
		if (n % 2 == 0) {
			ans = Math.max(ans, dp[n - 2][0]);
			ans = Math.max(ans, dp[n - 1][1]);
		} else {
			ans = Math.max(ans, dp[n - 3][0]);
			ans = Math.max(ans, dp[n - 2][1]);
			ans = Math.max(ans, dp[n - 1][2]);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 71944
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	srand(time(NULL));
	std::chrono::system_clock::time_point start = std::chrono::system_clock::now();
	int nowtime=0;
	int TIMEMAX=2950;
	nowtime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - start).count();
	int D,c[27],s[366][27];
	int t[27];
	vpint vc;
	scan(D);
	rep(i,26){
		scan(c[i]);
		vc.push_back({-c[i],i});
	}
	sort(ALL(vc));
	rep(i,D){
		int smax=0,smaxj=0;
		rep(j,26){
			scan(s[i][j]);
			if(smax<s[i][j]){
				smax=s[i][j];
				smaxj=j;
			}
		}
		t[i]=smaxj;
	}
	int nowi=0;
	rep(i,D){
		prin(vc[nowi].second+1);
		nowi=(nowi+1)%5;
	}
	return 0;
}


Measured memory_bytes: 3616
N,K = [int(i) for i in input().rstrip().split()]
H = [int(i) for i in input().rstrip().split()]
H = [H[0]]*K + H
C = [0]*K
for i,h in enumerate(H):
    if i < K: continue
    c = [C[-1-j]+abs(H[i-j-1]-h) for j in range(K)]
    C += [min(c)]
print(C[-1])

Measured memory_bytes: 59488
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
Int mod = 1e9+7;

int main() {
    Int n, k;
    cin >> n >> k;
    double res = 0.0;
    for (Int i = 1; i <= n; i++)  {
        double add = 1.0 / (double)n;
        Int p = i;
        Int cnt = 0;
        while (k > p) {
            p *= 2;
            cnt++;
        }
        add *= 1.0 / pow(2.0, cnt);
        res += add;
    }
    printf("%.12lf\n", res);
    return 0;
}

Measured memory_bytes: 256
n, q = map(int, input().split())
s = list(input())
LR = [tuple(int(x) for x in input().split()) for _ in range(q)]

dp = [0] * (n + 1)

for i in range(1, n):
    if s[i-1] == 'A' and s[i] == 'C':
        dp[i+1] = dp[i] + 1
    else:
        dp[i+1] = dp[i]

for L, R in LR:
    print(dp[R] - dp[L])

Measured memory_bytes: 20452
box=[list(input()) for i in range(int(input()))]
count=0
ans_box={}
for i in range(len(box)):
    line=sorted(box[i])
    line="".join(line)
    if line in ans_box:
        ans_box[line] +=1
    elif line not in ans_box:
        ans_box[line]=0

for v,m in ans_box.items():
    if m>=1:
        for i in range(m+1):
            count +=i

print(count)

Measured memory_bytes: 39040
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)                                                                             
#define seg_size 524288
int main() {
	string s;
	cin >> s;
	string wow;
	for (int i = 0;i < s.length();++i) {
		if (s[i] != 'x') {
			wow.push_back(s[i]);
		}
	}
	if (wow.length() != 0) {
		for (int i = 0;i < wow.size() / 2;++i) {
			if (wow[i] != wow[wow.size() - i-1]) {
				cout << "-1" << endl;
				return 0;
			}
		}
	}
	//can do
	long long cnt = 0;
	vector<long long> geko;
	int now_itr = 0;
	for (int i = 0;i < s.length();++i) {
		if (now_itr != wow.size()&&s[i] == wow[now_itr]) {
			geko.push_back(cnt);
			now_itr++;
			cnt = 0;
		}
		else {
			cnt++;
		}
	}
	geko.push_back(cnt);
	long long ans = 0;
	for (int i = 0;i < geko.size() / 2;++i) {
		ans += abs(geko[i] - geko[geko.size()-i-1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1724
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];
int ans[MAXN];

bool visited[MAXN];

void dfs(int here,int val)
{
    visited[here] = true;

    int there;

    val+=A[here];

    ans[here] = val;

    for(int i=0;i<graph[here].size();i++)
    {
        there = graph[here][i];
        if(visited[there])continue;
        dfs(there,ans[here]);
    }
    return;
}

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;

    cin>>n>>q;

    graph = vector<vector<int> > (n+1);

    for(int i=1;i<n;i++)
    {
        cin>>x>>y;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }

    for(int i=0;i<q;i++){
        cin>>a>>b;
        A[a]+=b;
    }

    dfs(1,0);

    for(int i=1;i<=n;i++)
        cout<<ans[i]<<" ";

    return 0;
}


Measured memory_bytes: 21120
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    long N = lread();
    auto S = sread();
    auto T = sread();
    outer: foreach_reverse (i; 0 .. N + 1)
    {
        foreach (j; 0 .. i)
        {
            if (S[N - i + j] != T[j])
                continue outer;
        }
        writeln(2 * N - i);
        return;
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

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

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

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    Int N;
    string S;
    vector<vector<Int>> neri;

    bool check(int x, int y, int z) {
        auto pt = neri[x].begin();
        if (pt == neri[x].end()) return false;

        pt = upper_bound(neri[y].begin(), neri[y].end(), *pt);
        if (pt == neri[y].end()) return false;

        pt = upper_bound(neri[z].begin(), neri[z].end(), *pt);
        if (pt == neri[z].end()) return false;

        return true;
    }

    void solve() {
        cin >> N;
        cin >> S;
        neri.resize(10);

        for (int i = 0; i < N; ++i) {
            neri[S[i] - '0'].push_back(i);
        }

        Int ans = 0;
        for (int x = 0; x <= 9; ++x) {
            for (int y = 0; y <= 9; ++y) {
                for (int z = 0; z <= 9; ++z) {
                    if (check(x, y, z)) {
//                        cerr << x << y << z << endl;
                        ans++;
                    }
                }
            }
        }
        cout << ans << endl;

    }

};


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

    Solve().solve();


    return 0;
}


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

const static int WHITE = 0;
const static int GRAY = 1;

std::vector<int> color, indeg, ans;
std::vector<std::vector<int>> earray;
int v;
std::queue<int> q;

void bfs(int u){
    q.push(u);
    while(!q.empty()){
        int node = q.front();
        q.pop();
        ans.push_back(node);
        for(int i = 0; i < earray[node].size(); i++){
            indeg[ earray[node][i] ]--;
            if(indeg[ earray[node][i] ] == 0 && color[ earray[node][i] ] == WHITE){
                color[ earray[node][i] ] = GRAY;
                q.push(earray[node][i]);
            }
        }
    }
}

void topologicalSort(){
    for(int i = 0; i < v; i++){
        if(indeg[i] == 0 && color[i] == WHITE){
            bfs(i);
        }
    }
}

int main(void){
    
    int e, s, t;
    
    std::cin >> v >> e;
    color.resize(v);
    indeg.resize(v);
    earray.resize(v);

    for(int i = 0; i < v; i++){
        indeg[i] = 0;
    }

    for(int i = 0; i < e; i++){
        std::cin >> s >> t;
        earray[s].push_back(t);       
    }

    for(int i = 0; i < v; i++){
        for(int j = 0; j < earray[i].size(); j++){
            indeg[ earray[i][j] ]++;
        }
    }

    topologicalSort();

    for(int i = 0; i < v; i++){
        std::cout << ans[i] << std::endl;
    }

    return 0;

}


Measured memory_bytes: 3588
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

int main() {
  const int max_n = 15;
  const int64 inf = 1e8;

  int V, E;
  cin >> V >> E;
  int s, t, d;
  // vector<int> s(E), t(E), d(E);
  vector<vector<int>> D(V, vector<int>(V, inf));
  for (int i = 0; i < E; i++) {
    cin >> s >> t >> d;
    D[s][t] = d;
  }
  // debug(D);

  vector<vector<int64>> dp((1 << max_n), vector<int64>(max_n, inf));
  // debug(dp);

  dp[(1 << V) - 1][0] = 0;

  for (int64 tmp = (1 << V) - 2; tmp >= 0; tmp--) {
    bitset<max_n> S(tmp);
    for (int v = 0; v < V; v++) {
      if (!S.test(v) && v != 0) continue;
      for (int u = 0; u < V; u++) {
        if (!S.test(u)) {
          dp[tmp][v] = min(dp[tmp][v], dp[tmp | (1 << u)][u] + D[v][u]);
          // debug(dp[tmp][v]);
        }
      }
    }
  }
  int64 ans = dp[0][0];
  if (ans == inf) ans = -1;
  cout << ans << endl;
}


Measured memory_bytes: 7636
#include <iostream>

using namespace std;

int main() {
	int N;
	cin >> N;
	int a[200002];
	for(int i = 0; i < N; i++){
		cin >> a[i];
	}
	int l = 0, r = 1;
	long ct = 0;
	int nowbs = a[0];
	while(l != N || r != N){
		if(r < N && (nowbs | a[r]) == nowbs + a[r]){
			ct += r - l;
			nowbs ^= a[r];
			r++;
		}else{
			ct++;
			nowbs ^= a[l];
			l++;
		}
	}
	cout << ct << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;

ll N;

int main(){
    cin>>N;

    ll ans=0;
    repn(i,N){
        ll n=N/i;
        ans+=i*n*(n+1)/2;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
const long double eps = 1e-10;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; ll w; cin >> n >> w;
    VL wei(n); VI val(n);
    int Max = 0;
    FOR(i, 0, n) {
        cin >> wei[i] >> val[i];
        Max += val[i];
    }

    auto dp = defvec<ll>(LLINF, n + 1, Max + 1);
    dp[0][0] = 0;
    FOR(i, 0, n)eFOR(j, 0, Max - val[i]) {
        chmin(dp[i + 1][j], dp[i][j]);
        chmin(dp[i + 1][j + val[i]], dp[i][j] + wei[i]);
    }

    erFOR(i, 0, Max)if (dp[n][i] <= w) {
        cout << i << "\n";
        return 0;
    }
}


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

using namespace std;

int main() {
  long long n;
  cin >> n;
  int ans = 0;
  int cnt = 0;
  while (n >= 10) {
    ans += (int)(n % 10);
    ++cnt;
    n /= 10;
  }
  ans += (int)n;
  ans = max(ans, (int)((n - 1) + 9 * cnt));
  cout << ans << endl;
}


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

ll n;
vector<ll>v;

bool count(ll num){
    ll tmp = num * 10;
    ll a;
    bool three=false,five=false,seven=false;
    for(int i=1;i<=log10(num)+1;i++){
        tmp = tmp/10;
        a = tmp % 10;
        // cout << a << endl;
        if(a == 3){
            three = true;
        }else if(a == 5){
            five = true;
        }else if(a == 7){
            seven = true;
        }
    }
    // cout << num << ' '<< (three and five and seven) << endl;
    return (three and five and seven);
}

void sft(ll num, ll i){
    if (num <= n){
        // cout << num << endl;
        v.push_back(num);
        sft(num + 3 * pow(10,i),i+1);
        sft(num + 5 * pow(10,i),i+1);
        sft(num + 7 * pow(10,i),i+1);
    }
}
 
int main(void){
    cin >> n;
    sft(0,0);

    ll cnt=0;
    for(ll i=0;i<v.size();i++){
        if(count(v[i])){
            cnt++;
        }
    }

    // for(ll i=0;i<sizeof(v);i++){
    //     cout << v[i] << endl;
    // }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
using namespace std;
typedef long long LL;

int main() {
	int t, i, j, k;
	int a, b, c ,F=0;
	
	cin >> a >> b;

	F = (a - 1)*(b - 1);

	cout << F << endl;
	return 0;
}

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

int main(){
  int N, X, x;
  vector<int> m;
  cin >> N >> X;
  
  for(int i=0; i<N; i++){
    cin >> x;
    m.push_back(x);
  }
  
  sort(m.begin(),m.end());
  int sum = accumulate(m.begin(), m.end(), 0);
  X -= sum;
  if(X<0){
    cout << 0 << endl;
    return 0;
  }
  
  cout << X/m[0] + N << endl;
  return 0;
  
  
  
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    while(1)
    {
        int H,W;
        cin>>H>>W;
        if(H==0 && W==0) break;
        int u;
        for(u=1;u<=H;u++)//横単位で考える
        {
            if(u==1||u==H)
            {
                int v;
                for(v=0;v<W;v++)
                {
                    cout<<"#";
                }
            }
            else
            {
                int v;
                for(v=1;v<=W;v++)
                {
                    if(v==1||v==W)
                    {
                        cout<<"#";
                    }
                    else
                    {
                        cout<<".";
                    }
                }
            }
            cout<<endl;
        }
        cout<<endl;
    }
}


Measured memory_bytes: 3068
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>
#include<map>

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1e9 + 7)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl


typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

void solve() {

	int n, m, x, y;
	cin >> n >> m >> x >> y;

	vi xi(n);
	vi yi(m);

	REP(i, n) {
		cin >> xi[i];
	}
	REP(i, m) {
		cin >> yi[i];
	}

	sort(ALL(xi));
	sort(ALL(yi));

	bool warFlag = (xi[n-1] < y && yi[0] > x && xi[n-1] < yi[0]);

	if (warFlag) {
		out<string>("No War");
	}
	else {
		out<string>("War");
	}

	return;

}

int main() {

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

	solve();

	return 0;

}

Measured memory_bytes: 256
#[allow(dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        mut s: chars
    }
    let s2 = s.split_off(2);
    let f = |c10: char, c1: char| {
        let i10 = c10.to_string().parse::<u64>().expect("c10 error");
        let i1 = c1.to_string().parse::<u64>().expect("c10 error");
        i10 * 10 + i1
    };

    let v1 = f(s[0], s[1]);
    let v2 = f(s2[0], s2[1]);

    let is_month = |m| 1 <= m && m <= 12;
    let result = match (is_month(v1), is_month(v2)) {
        (true, true) => "AMBIGUOUS",
        (true, false) => "MMYY",
        (false, true) => "YYMM",
        (false, false) => "NA",
    };
    println!("{}", result);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define inf 1000000007
#define mod 1000000007
//#pragma GCC optimize(2)
//#define int long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
template <typename T> void write(T x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,r;
	cin>>n>>r;
	if(n>=10)
		cout<<r<<endl;
	else
		cout<<r+100*(10-n)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n, k;
    cin >> n >> k;
    int ans = 1;
    REP(i,n) {
        if (ans < k) ans += ans;
        else ans += k;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,K;
	scan(N>>K);
	prin(N-K+1);
	return 0;
}


Measured memory_bytes: 256
Score_Alice, Score_Bob = map(int, input().split())

if Score_Alice == 1 and Score_Bob == 1:
  print('Draw')
elif Score_Alice == 1 and Score_Bob != 1:
  print('Alice')
elif Score_Alice != 1 and Score_Bob == 1:
  print('Bob')
else:
  if Score_Alice > Score_Bob:
    print('Alice')
  elif Score_Alice < Score_Bob:
    print('Bob')
  else:
    print('Draw')

Measured memory_bytes: 3060
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);String x;for(long t,v;(t=s.nextInt())>0;System.out.print(x.isEmpty()?"NA\n":x)){List<String>l=new ArrayList<String>();Map<String,Long> m=new HashMap<String,Long>();for(;t-->0;){if(!l.contains(x=s.next())){l.add(x);v=0;}else v=m.get(x);m.put(x,s.nextLong()*s.nextLong()+v);}x="";for(String y:l)if(m.get(y)>999999)x+=y+"\n";}}}

Measured memory_bytes: 13000