akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll N;
    cin >> N;
    vector<ll> D(N);
    rep(i, N) cin >> D.at(i);
    map<ll, ll> c;
    rep(i, 13){
      c[i] = 0;
    }
    rep(i, N){
        c[D.at(i)]++;
    }
    vector<ll> E(0);
    vector<ll> T(N+1);
    ll p = 0;
    rep(i, 13){
        if(c.at(i) >= 3){
            cout << 0 << endl;
            return 0;
        }
        if(c.at(i) == 1){
          E.push_back(i);
        }
        if(c.at(i) == 2){
          T.at(p) = i;
          T.at(p+1) = 24-i;
          p += 2;
        }
    }
    ll ans = 0;
    T.at(N) = 0;
    rep(i, 1<<(N-p)){
        bitset<26> s(i);
        ll x = INF;
        rep(j, N-p){
          if(s.test(j)){
            T.at(p+j) = 24 - E.at(j);
          }
          else{
            T.at(p+j) = E.at(j);
          }
          if(T.at(p+j) == 24){
            T.at(p+j) = 0;
          }
        }
        rep(j, N+1){
          rep2(k, j+1, N+1){
            ll d = abs(T.at(j) - T.at(k));
            chmin(x, min(d, 24-d));
          }
        }
        if(x == 24){
          x = 0;
        }
        chmax(ans, x);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3588
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAX 100
int p[MAX+1] = {0};
int m[MAX+1][MAX+1] = {0};

int main()
{
	int n;
	int a,b;
	scanf("%d" ,&n);
	for(int i=0; i<n; i++)
	{
		scanf("%d%d", &a, &b);
		if(i == 0) p[0] = a;
		p[i+1] = b;
	}

	for(int l = 2; l <= n; l++)
	{
		for(int i=1; i <= n-l+1; i++)
		{
			int j = i+l-1;
			m[i][j] = (1 << 30);
			for(int k=i; k<j; k++)
				m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]);
		}
	}

	printf("%d\n",m[1][n]);

	return 0;


}


Measured memory_bytes: 2800
import Data.List.Split

main = do
  sc <- getLine
  let lc = map (\x -> read x :: Int) $ splitOn " " sc
  putStrLn $ "a " ++ (gel (lc!!0) (lc!!1)) ++ " b" 

gel a b = case (compare a b) of
            LT -> "<"
            EQ -> "=="
            GT -> ">"


Measured memory_bytes: 3668
n=int(input())
A=list(map(int,input().split()))
a=0
ans=1
if 0 in A:
    ans=0
else:
    for a in range(n):
        ans*=A[a]
        a+=1
        if ans<=10**18:
            continue
        else:
            ans=-1
            break
print(ans)


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

vector<int> make_prime(int n){
  vector<bool> is_prime(n,true);
  vector<int> prime;
  is_prime[0] = is_prime[1] = false;
  for(int i=2;i<n;i++){
    if (is_prime[i])
      for (int j=i * 2; j<n; j+=i)
        is_prime[j] = false;
  }
  for(int i=0;i<n;i++){
    if (is_prime[i])
      prime.push_back(i);
  }
  return prime;
}

int main(){
  int N; cin>>N;
  vector<int> prime = make_prime(55555);
  for(int i=2;i<prime.size();i++){
    if(N == 0) break;
    if(prime[i] % 5 == 1){
      cout<<prime[i]<<" ";
      N--;
    }
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
# 前から順番に後ろに向けてswap
n = int(input())
ps = list(map(int, input().split()))

cnt = 0
for i in range(n-1):
    if i + 1 == ps[i]:
        tmp = ps[i]
        ps[i] = ps[i+1]
        ps[i+1] = tmp
        cnt += 1
# 最後残っていたら直前とswap
if ps[n-1] == n:
    cnt += 1

print(cnt)


Measured memory_bytes: 20540
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll k,t;
cin>>k>>t;
ll a[t]={};
ll ca = 0 ;
for(ll i=0; i<t; i++){
cin>>a[i];
ca+=a[i];}
sort(a,a+t);
ll ma = a[t-1];
ca=ca-ma;
if(ca>=ma){
cout<<0<<endl;}
else{
cout<<ma-ca-1<<endl;}}


Measured memory_bytes: 3644
def main():
    N, K = map(int, input().split(" "))
    result = 0
    for i in range(1, N + 1):
        point = i
        face = 0
        while point < K:
            point *= 2
            face += 1
        result += 0.5 ** face / N
    print(result)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
  int n,T;
  int c,t;
  int ans=10000;
  
  scanf("%d%d",&n,&T);
  for(int i=0;i<n;++i){
    scanf("%d%d",&c,&t);
    if(t<=T&&c<ans){
      ans=c;
    }
  }
  
  if(ans==10000)printf("TLE");
  else printf("%d",ans);
  
  return 0;
}


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

int main() {

  int A,B;
  cin >> A >> B;

  int count=0;
  for(int i=A; i<=B; i++)
  {
      int wk1,wk2,wk3,wk4;
      wk1 = i/10000;
      wk2 = i%10;
      wk3 = i%10000/1000;
      wk4 = i%100/10;
      if((wk1==wk2)&&(wk3==wk4))
         count +=1;
  }

  cout << count << endl;
}

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

int main() {
	int n;
	cin >> n;
	int mx = 0;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		mx = max(mx, a[i]);
	}
	sort(begin(a), end(a));
	int r = a[n - 1];
	for (int i = n - 1; i >= 0; i--) {
		if (mx - a[i] <= r) r = a[i];
	}
	cout << mx << ' ' << r;
	return 0;
}

Measured memory_bytes: 3756
import bisect
n = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0
b_memo = [0]
for b in B:
    a = bisect.bisect_left(A, b)
    b_memo.append(b_memo[-1]+a)
for c in C:
    b = bisect.bisect_left(B, c)
    if (b == 0):
        continue
    ans += b_memo[b]
print(ans)
    



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

int main() {
  int n;
  cin >> n;
  int mx = -1;
  int sum = 0;
  while (n--) {
    int x;
    cin >> x;
    sum += x;
    mx = max(mx, x);
  }
  cout << (mx < sum - mx ? "Yes" : "No") << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<map>

using namespace std;

typedef long long ll;
const int Max = 1e5 + 5;
ll n, m, t, k, i, j, p, q, flag, ans;
int a[Max];

int main(){
	while(scanf("%lld", &n) == 1){
		cin >> ans;
		for(i = 0; i < n - 1; i++){
			cin >> m;
			ans = __gcd(ans, m);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
S = int(input())
mod = 10**9 + 7
n = 4000
frac = [1]*(n+1)
finv = [1]*(n+1)
for i in range(n):
    frac[i+1] = (i+1)*frac[i]%mod
finv[-1] = pow(frac[-1],mod-2,mod)
for i in range(1,n+1):
    finv[n-i] = finv[n-i+1]*(n-i+1)%mod
def nCr(n,r):
    if n<0 or r<0 or n<r: return 0
    r = min(r,n-r)
    return frac[n]*finv[n-r]*finv[r]%mod
ans = 0
for i in range(1,S//3+1):
    s = S-3*i
    ans +=nCr(s+i-1,s)
    ans %=mod
print(ans)


Measured memory_bytes: 65084
chomp($n=<>);
chomp($s=<>);
@ary=split/ /,$s;
@ary=sort{$b <=> $a}@ary;
%hash=();
for($i=0;$i<=$#ary;$i++){
	$hash{$ary[$i]}++;
    if($hash{$ary[$i]} == 2){
    	push @area,$ary[$i];
    }elsif($hash{$ary[$i]} == 4){
    	push @area,$ary[$i];
    }
    $length = @area;
    if($length >= 2){
    	break;
    }
}

print $area[0] * $area[1];

Measured memory_bytes: 25532
// skyrim belongs to the nords
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back 
#define sz(a) ((int)(a).size())
#define rep(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define dec(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end() 
#define LOGN 18
#define EPS 1e-8
#define fcin ios_base::sync_with_stdio(false)
using namespace std;
typedef long long ll;
typedef double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;


int main(){
	fcin;
	cin.tie(0);

	int N;
	cin >> N;
	cout << "ABC" << N;

}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include <math.h>
#include<algorithm>
#include<functional>
#define ll long long
#define inf  999999999
#define pa pair<int,int>
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

class Point{
	public:
	double x,y;
	Point(double x=0,double y=0):x(x),y(y) {}
	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
	Point operator * (double a) {return Point(x*a,y*a);}
	Point operator / (double a) {return Point(x/a,y/a);}
	double absv() {return sqrt(norm());}
	double norm() {return x*x+y*y;}
	bool operator < (const Point &p) const{
		return x != p.x ? x<p.x: y<p.y;
	}
	bool operator == (const Point &p) const{
		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
	}
};
typedef Point Vector;

struct Segment{
Point p1,p2;
};


double dot(Vector a,Vector b){
	return a.x*b.x+a.y*b.y;
}
double cross(Vector a,Vector b){
	return a.x*b.y-a.y*b.x;
}

//----------------kokomade temple------------


int main(){
int n;
double a1,a2,a3,a4,a5,a6;
cin>>a1>>a2>>a3>>a4;
cin>>n;
Vector b,s;
Point p,q;
b.x=a3-a1,b.y=a4-a2;
b=b/b.absv();
p.x=a1,p.y=a2;

for(int i=0;i<n;i++){
cin>>a5>>a6;
s.x=a5-a1,s.y=a6-a2;
double l=dot(s,b);
q=p+b*l;
printf("%.10f %.10f\n",q.x,q.y);
}



return 0;
}

Measured memory_bytes: 1248
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
using namespace std;

int main(void)
{
    int h,w;
    char moji = 'A';
    string s;
    cin >> h >> w;
    for(int i = 1;i <= h;i++)
    {
        for(int j = 1;j <= w;j++)
        {
            cin >> s;
            if(s == "snuke"){cout << moji << i; return 0;}
            moji += 1;
        }
        moji = 'A';
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split())) + [0]
b = [abs(a[0])]+[abs(a[i+1]-a[i]) for i in range(n)]
c = [abs(a[1])]+[abs(a[i+2]-a[i]) for i in range(n-1)]

hon = sum(b)

for i in range(n):
    print(hon-b[i]-b[i+1]+c[i])

Measured memory_bytes: 21156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

ll A, B;

int gcd(int x, int y) {
	if (y)return gcd(y, x%y);
	return x;
}

ll lcm(ll x, ll y) {
	return x*y / gcd(x, y);
}

int main() {
	cin >> A >> B;
	cout << lcm(A, B) << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int main()
 {
   int h,w;
   while(cin>>h>>w&&(h||w))
   {
     for(int i=0;i<h;i++)
     {
       for(int j=0;j<w;j++)
       {
         if(i==0) cout<<"#";
         else if(i<h-1) 
         {
           if(j==0||j==w-1) cout<<"#";
           else cout<<".";       
         }        
         else cout<<"#";
       }        
       cout<<endl;
     }
     cout<<endl;
   }
   //while(1);
   return 0;
 }
 

Measured memory_bytes: 3076
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
A = sorted(AB,key=lambda x:x[0])
ans = 0

for i in range(N):
    buy = min(M,A[i][1])
    ans += buy * A[i][0]
    M -= buy
print(ans)

Measured memory_bytes: 29268
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int n;
    scanf("%d",&n);
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    sort(a,a+n);


    ll ans = 0;
    ll flag = 0;
    drep(i,n){
        if(i==0)break;
        if(a[i]==a[i-1]){
            if(flag==0){
                flag = a[i];
                i--;
            }else{
                ans = flag * a[i];
                break;
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>

int main() {
	int a, b, c;
	
	scanf("%d %d %d", &a, &b, &c);
	if(a < b && b < c) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}
}

Measured memory_bytes: 1204
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <climits>
#include <cstdio>
 
#define nl '\n'
 
using namespace std;
 
long long n, m, a, b, t, x, e;

int main(){

    cin >> n >> m;

    vector<pair<long long, long long> > v;

    for(long long i = 0; i < n; i++){
        cin >> a >> b;
        v.push_back(make_pair(a, b));
    }

    sort(v.begin(), v.end());

    while(m > 0){
        if(v[x].second == 0){
            x++;
        }
        t += min(m, v[x].second)*v[x].first;
        e = m;
        m -= min(m, v[x].second);
        v[x].second -= min(e, v[x].second);
    }

    cout << t;



}
 
//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out
 
//Surely this will AC

Measured memory_bytes: 2420
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

int n;
vi res;
signed main(){
    I(n);
    int base = 1;
    while(n){
        if (n % (abs(base) * 2)){
            n -= base;
            res.pb(1);
        } else {
            res.pb(0);
        }
        base *= -2;
    }
    for(auto it = res.rbegin(); it != res.rend(); it++){
        cout << *it;
    }
    if (res.empty()) cout << 0;
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 0;
int a, b, x;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b >> x;
  cout << (a<=x && x<=a+b ? "YES" : "NO") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using ll = long long;
int main(){
  int a,b;
  cin >>a >>b;
  if (a-2*b>0) cout << a-2*b << endl;
  else cout << "0" <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long n,k;
  cin>>n>>k;
  long long h[n+1];
  long long sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
        //sum+=a[i];
    }
    sort(h,h+n,greater<int >());
    for(int i=k;i<n;i++)
    {
        sum+=h[i];
    }
  //long long x=h/a;
    //if(h%a==0)
      //  cout<<x<<endl;
   // else
    //if(sum>=h)
   //cout<<"Yes"<<endl;
  // else
    cout<<sum<<endl;
    //cout<<"No"<<endl;
}


Measured memory_bytes: 1792
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        
        AtCoder problem = new AtCoder(sc);
        problem.solve(out);
        
        out.flush();
    }
    
}

class AtCoder {
    final int K,X;
    AtCoder(FastScanner sc) {
        K = sc.nextInt();
        X = sc.nextInt();
    }

    void solve(PrintWriter out) {
        for (int i = X-K+1; i < K+X; i++) {
            out.print(i + " ");
        }
        out.println();
    }
    
}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {
    
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    
    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }
    
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }
    
    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    
    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 23508
N = int(input())
line = input().split()

MAX = 1000000000000000000

ans = 1

if not '0' in line:
    for l in line:
        if l == 0:
            ans = 0
            break
        if not ans > MAX:
            ans = int(l) * ans

else:
    ans = 0


if ans <= MAX:
    print(ans)
else:
    print(-1)


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

int count_min(int N, vector<int> P){
    int count = 1;
    int min = P.at(0);

    for(int i = 1; i < N; i++){
        if(P.at(i) <= min){
            count++;
            min = P.at(i);
        }
    }
    return count;
}

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    for(int i = 0; i < N; i++){
        cin >> P.at(i);
    }

    cout << count_min(N, P) << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);

    ll n;
    cin >> n;
    if (n%2==1)
    {
        cout << "0 " << endl;
    }
    else
    {
        ll factor=10;
        ll ans=0;
        while (n>=factor)
        {
            ll local=n/factor;
            ans=ans+local;
            factor=factor*5;
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256
# coding: utf-8

def main():
    N, M = map(int, input().split())
    ships = set()
    for _ in range(M):
        a, b = map(int, input().split())
        ships.add((a, b))
        ships.add((b, a))
    for i in range(2, N):
        if (1, i) in ships and (i, N) in ships:
            return "POSSIBLE"
    else:
        return "IMPOSSIBLE"


print(main())


Measured memory_bytes: 60816
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 x = 0;
    while(((x*a)-(x-1))<b){
      if(((x*a)-(x-1))<b){
        x++;
      }else{
        break;
      } 
    }
    System.out.println(x);
  }
}

Measured memory_bytes: 22868
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1000003 ;

int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n)cin >> a[i];
  int ans=0;
  rep(i,n)ans^=a[i];
  if(ans==0)cout << "Yes" << endl;
  else cout << "No" << endl;
return 0;}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define pb push_back
#define N 1000003
#define SZ(a) (int)(a.size())
#define sorta(a) sort(a.begin(),a.end()) 
#define sortrev(a) sort(a.rbegin(),a.rend())
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<b;i++)
#define VI vector<int>
typedef long long LL;
using namespace std;
LL powmod(LL a, LL p, LL mod)
{
	LL ret = 1;while(p){if(p&1)ret = (ret*a)%mod;a=(a*a)%mod;p/=2;}return ret;
}
int pow(int a, int p)
{
	int ret = 1;while(p){if(p&1)ret = (ret*a);a=(a*a);p/=2;}return ret;
}
int n,x,t,y,a,b,i,j,k,p1[N],p2[N];
int main()
{
	cin.sync_with_stdio(0);
	cin.tie(0);
	cin>>t;
	while(t--)
	{
		cin>> a>> b;
		n+=(b-a)+1;
	}
	cout<<n<<endl;
	 return 0;
}



Measured memory_bytes: 256
#[allow(unused_imports)]
use std::io::Write;

// {{{
#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    input! {
        h: usize,
        n: usize,
        a: [usize; n],
    }

    let sum: usize = a.iter().sum();
    if sum >= h {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 6396
#include <cstdio>
int main(){
	int n,x;
	long long sum = 0, curr = 0;
	scanf("%d", &n);
	for(int i=0;i<n;i++){
		scanf("%d", &x);
		if(curr > x){
			sum += curr - x;
		}else{
			curr = x;
		}
	}
	printf("%lld\n", sum);
	return 0;
}


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

int main(){

	int n, ans = 0;
	cin >> n;
	int a[n];
	int min = n + 1;
	for(int i = 0; i < n; ++i){
		cin >> a[i];
		if(a[i] < min){
			ans++;
			min = a[i];
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] W = new int[N];
		for (int i = 0; i < N; i++) {
			W[i] = sc.nextInt();
		}

		int ans = Integer.MAX_VALUE;
		for (int i = 1; i < W.length; i++) {
			int s1 = 0;
			int s2 = 0;
			for (int j = 0; j < i; j++) {
				s1 += W[j];
			}
			for (int z = i; z < W.length; z++) {
				s2 += W[z];
			}
			ans = Math.min(ans, Math.abs(s1 - s2));
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 23892
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int r = 0, sum = 0, xsum = 0;
  ll ans = 0;
  rep(l, n) {
    while (r < n && sum+a[r] == (xsum^a[r])) {
      sum += a[r];
      xsum ^= a[r];
      r++;
    }
    ans += r-l;
    sum -= a[l];
    xsum ^= a[l];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main()
{
	int n, i, tmp;
	int num[10000];
	long sum = 0;

	cin >> n;

	for (i = 0; i < n; i++)
	{
		cin >> num[i];
	}

	for (i = 0; i < n-1; i++)
	{
		if (num[i] < num[i + 1])
    	{
			tmp = num[i + 1];
			num[i + 1] = num[i];
			num[i] = tmp;
		}
	}
	cout << num[n-1] << " ";

	for (i = 0; i < n - 1; i++)
	{
		if (num[i] > num[i + 1])
		{
			tmp = num[i + 1];
			num[i + 1] = num[i];
			num[i] = tmp;
		}
	}

	for (i = 0; i < n; i++)
	{
		sum += num[i];
	}
	cout << num[n-1] << " " << sum << endl;

	return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
using namespace std;

void solve(){
  long long a, b, n, ans = 0; cin >> a >> b >> n;
  if(b == 1){
    cout << ans << endl;
    return;
  }
  long long x = 0, y;
  for(long long i = 1; x < n; i++){
    x = min(b * i - 1, n);
    y = (a * x) / b - a * (x / b);
    ans = max(ans, y);
  }
  cout << ans << endl;
  return;
}

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


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

int main() {
    int a, b;
    int k;
    int ans;
    cin >> a >> b >> k;
    for(int i = 100; i > 0; i--){
        if(a % i == 0 && b % i == 0){
            k--;
            if(k == 0){
                ans = i;
                break;
            }
        }
    }
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
const long long MOD = 1e9+7;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<vector<int>> B(N+1, vector<int>(3, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 3; j++) B[i+1][j] = B[i][j];
        for (int j = 0; j < 3; j++) {
            if (A[i] == B[i][j]){ B[i+1][j]++; break; }
        }
    }
    
    long long ans = 1;
    for (int i = 0; i < N; i++) {
        long long cnt = 0;
        for (int j = 0; j < 3; j++) {
            if (A[i] == B[i][j]) cnt++;
        }
        ans *= cnt;
        ans %= MOD;
    }
    
    cout << ans%MOD << endl;
    return 0;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n;
    cin >> n;
    double r = 380000.0;
    
    double ans = 0;

    rep(i, n) {
        double x;
        string u;
        cin >> x >> u;
        if (u=="BTC") x *= r;
        ans += x;
    }
    
    printf("%.10f", ans);
    return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np
read = sys.stdin.readline


def main(n, k, a):
    for i in np.arange(n, 100000):
        ok = True
        j = i
        while j:
            ok &= j % 10 not in a
            j //= 10
        if ok:
            print(i)
            break


if __name__ == '__main__':
    n, k = np.fromstring(read(), dtype=np.int32, sep=' ')
    a = np.fromstring(read(), dtype=np.int32, sep=' ')
    main(n, k, a)


Measured memory_bytes: 27432
n = int(input())
x = list(map(int, input().split()))

xav = sum(x) / n
if xav % 1 >= 0.5:
    xav = xav//1 +1
else:
    xav = xav//1
    
ans = 0

for i in range(n):
    ans += (x[i] - xav)**2

print(int(ans))

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

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

	for (int i = 1; i < 10; i++){
		for (int j = 1; j < 10; j++){
			if(i*j==n){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}

	cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int D_MIN=1000000001;
int n,k,diff_min=D_MIN;
int main(){
  scanf("%d %d",&n,&k);
  int h[n];
  for(int i=0;i<n;++i){
    scanf("%d",&h[i]);
  }
  sort(h,h+n);
  for(int i=0;i<=(n-1)-(k-1);++i){
    diff_min=min(diff_min,h[i+(k-1)]-h[i]);
  }
  printf("%d",diff_min);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, N, K, i;
  cin >> N >> K ;
  a = 1;
 
  for (i = 0;i < N;i++){
  if(a + K <= a * 2){
    a += K;
  } 
    else{
      a *= 2;
    }
    if(i == N - 1 ){
    cout << a <<endl;
    }
  }
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a = vector<int>(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int c = 0;
    for (int i = 1; i < a.size() - 1; i++) {
        if (max(max(a[i - 1], a[i]), a[i + 1]) == a[i]) {
            continue;
        }
        if (min(min(a[i - 1], a[i]), a[i + 1]) == a[i]) {
            continue;
        }
        c++;
    }
    cout << c << endl;

    return 0;
}

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

int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if(x-r<0 || y-r<0 || x+r>W || y+r>H){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}


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

int main(int argc, char const *argv[]) {
    int people[4][3][10] = {};
    
    int n;
    cin >> n;

    for (int i = 0; i < n; i++) {
        int b, f, r, v;
        cin >> b >> f >> r >> v;
        people[b-1][f-1][r-1] += v;
    }

    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++) {
                cout << ' ' << people[i][j][k];
            }
            cout << endl;
        }
        if (i != 3) {
            cout << "####################" << endl;
        }
    }


    return 0;
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int A,B,C;
	cin>>A>>B>>C;
	if(A==B)
	{
		cout<<C<<endl;
	}
	if(A==C)
	{
		cout<<B<<endl;
	}
	if(B==C)
	{
		cout<<A<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#define pb push_back
using namespace std;
typedef pair<int,int> pii;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
long long masu[444][444];
long long mita[444][444];
long long  siro,kuro;
int h,w;

void dfs(int x,int y){
  if(x==0||y==0||x==h+1||y==w+1) return;
  if(mita[x][y]) return;
  mita[x][y]=1;

  if(masu[x][y]==1) kuro++;
  else siro++;
  
  if(masu[x][y]==1){
    for(int i=0;i<4;i++){
      if(masu[x+dx[i]][y+dy[i]]==0)dfs(x+dx[i],y+dy[i]);
    }
  }
  else{
    for(int i=0;i<4;i++){
      if(masu[x+dx[i]][y+dy[i]]==1)dfs(x+dx[i],y+dy[i]);
    }
  }
}

int main(){


  cin>>h>>w;
  string s;
  for(int i=0;i<h;i++){
    cin>>s;
    for(int j=0;j<s.size();j++){
      if(s[j]=='#') masu[i+1][j+1]=1;
    }
  }
  long long  res=0;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      kuro=siro=0;
      dfs(i,j);
      res+=kuro*siro;
      //printf("%d %d : %d %d\n",i,j,kuro,siro);
    }
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdlib>
#include <climits>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;


int N;
int A[100010];

int main (int argc, char const *argv[])
{
  cin >> N;
  for (size_t i = 1; i <= N; i++)
    cin >> A[i];
  int ans = 0;
  for (size_t i = 1; i <= N; i++)
    if (A[A[i]]==i) ++ans;
  cout << ans/2 << endl;
  return 0;
}


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

int main() {
  ll n, a, b; cin >> n >> a >> b;
  if((b - a) % 2 == 0) cout << (b - a) / 2 << '\n';
  else cout << min(min(b - 1, n - a), min(a + (b - a - 1) / 2, n - b + 1 + (n - (a + n - b + 1)) / 2)) << '\n';
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split(' ')))
correct_p = [i + 1 for i in range(n)]
ctr = 0

for i in range(n):
    if p[i] != correct_p[i]:
        ctr += 1
        if ctr > 2:
            break

if ctr <= 2:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int sx = in.nextInt();
        int sy = in.nextInt();
        int tx = in.nextInt();
        int ty = in.nextInt();

        int dx = Math.abs(tx - sx);
        int dy = Math.abs(ty - sy);

        System.out.print(repeat('U', dy));
        System.out.print(repeat('R', dx));

        System.out.print(repeat('D', dy));
        System.out.print(repeat('L', dx));

        System.out.print('L');
        System.out.print(repeat('U', dy + 1));
        System.out.print(repeat('R', dx + 1));
        System.out.print('D');

        System.out.print('R');
        System.out.print(repeat('D', dy + 1));
        System.out.print(repeat('L', dx + 1));
        System.out.print('U');
    }
//UUURRRDDDLLLLUUUURRRRDRDDDDLLLLU
//UURRURRDDDLLDLLULUUURRURRDDDLLDL
    private static String repeat(char c, int times) {
        char[] repeat = new char[times];
        Arrays.fill(repeat, c);
        return new String(repeat);
    }
}


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

int main() {
  int H,W;
  cin >> H >> W;
  
  while (H != 0 || W != 0){ 
    for (int i = 0; i < W; i++) {
      cout << '#';
      if (i == W - 1){
        cout << endl;
      }
    }
  
    for (int j = 0; j < H - 2; j++) {
      for (int i = 0; i < W; i++) {
        if (i == 0 ){
          cout << '#';
        }
        else if (i > 0 && i < W - 1){
          cout << '.';
        }
        else if (i == W - 1){
          cout << '#' << endl;
        }
      }
    }
  
    for (int i = 0; i < W; i++) {
      cout << '#';
      if (i == W - 1){
        cout << endl << endl;
      }
    }
    
    cin >> H >> W;
  }
}
  
  


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int a=0;
  int s=S.size();
  if(S.at(0)=='A'){a++;}
  for(int i=2;i<s-1;i++){
    if(S.at(i)=='C'){
      a++;
      break;}
  }
  int b=0;
  for(int i=1;i<s;i++){
    if(S.at(i)<='Z'){b++;}
  }
  if(b==1){a++;}
  if(a==3){cout << "AC" << endl;}
  else{cout << "WA" << endl;}
}

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


// 最大公約数を求める
// 計算量O(logn)
template<class T>
T gcd(T a, T b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

// 最小公倍数を求める
// 計算量O(logn)
template<class T>
T lcm(T a, T b){
    return a/gcd(a,b)*b;
}

// 素数判定
// 計算量O(√n)
template<class T>
bool isPrime(T n){
    if(n < 2) return false;
    for(long long i = 2; i*i <= n; ++i) if(n % i == 0) return false;
    return true;
}

// 素数列挙
// nまでの素数をEratosthenesの篩で列挙する
// 計算量O(nloglogn)
template<class T>
vector<T> prime_list(T n){
    vector<T> ret;
    vector<T> isPrime(n+1,1);
    isPrime[0] = isPrime[1] = 0;
    for(long long i = 2; i <= n; ++i){
        if(isPrime[i] == 0) continue;
        ret.push_back(i);
        for(long long j = i*i; j <= n; j += i) isPrime[j] = 0;
    }
    return ret;
    // return isPrime;  // 状況によってはこっちを返す
}

// 素因数分解
// nを素因数分解してmapに記録
// 計算量O(√nlogn),必要ならmapではなくvectorにすると計算量を落とせる
template<class T>
map<T,int> prime_factor(T n){
    map<T,int> ret;
    if(n <= 0){
        cout << "Prime_factor Error" << "\n";
        return ret;
    }
    for(long long i = 2; i*i <= n; ++i){
        while(n%i== 0){
            ++ret[i];
            n /= i;
        }
    }
    if(n != 1) ret[n]++;
    return ret;
}


// 関数名：pow
// 概要：modつき指数関数
// 第一引数a：指数の底
// 第二引数b：指数
// 第三引数mod：法となる値
// 戻り値：a^b(m mod)
// 計算量O(log b)
template<class T>
T pow(T a, int b){
    if(b == 0) return 1;
    if(b%2){
        T ret = pow(a,(b-1)/2); 
        return ret*ret*a;
    }else{
        T ret = pow(a,b/2);
        return ret*ret;
    }
}

template<class T>
T pow(long long a, long long b, T mod){
    if(b == 0) return 1;
    if(b % 2 == 0){
        T d = pow(a,b/2,mod);
        return (d*d)%mod;
    }else return a%mod*pow(a,b-1,mod)%mod;
}

//関数名：comb
//概要：二項係数
//第一引数n：組み合わせの全体
//第二引数r：何個取り出すか
//第三引数mod：法となる値
//戻り値：nCr(m mod)
// 計算量O(r), 第三引数まで指定するとO(rlogmod)
template<class T>
T comb(T n, T r){
    if(r > n) return 0;
    if(n == r || r == 0) return 1;
    T ret = 1;
    for(T i = 1; i <= r; ++i){
        ret *= n--;
        ret /= i;
    }
    return ret;
}

template<class T>
T comb(long long n,long long r,T mod){
    if(r > n) return 0;
    if(n == r || r == 0) return 1;
    long long fact1 = 1,fact2 = 1;
    for(long long i = n; i >= n-r+1; --i) fact1 = fact1*i%mod;
    for(long long i = r; i >= 1; --i) fact2 = fact2*i%mod;
    return fact1*pow(fact2,mod-2,mod)%mod;
}


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

    const ll MOD = 1000000007;

    ll s; cin >> s;
    if(s < 3){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0LL;
    for(ll k = 1; 3*k <= s; ++k){
        ans += comb(s-2*k-1, k-1, MOD);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main(){
  double d,z,s;
  cin>>d>>z>>s;
  if(d/s<=z){
    cout<<"Yes"<<'\n';
  }
  if(d/s>z){
    cout<<"No"<<'\n';
  }
  return(0);
}

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

typedef long long ll;

const int MAXN = 1e5 + 10;

ll n;
char ans[MAXN];

int main() {
    cin >> n;
    int cur = 0;
    while (n) {
        ans[cur++] = (n - 1) % 26 + 'a';
        n = (n - 1) / 26;
    }
    reverse(ans, ans + cur);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3648
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int M = Integer.parseInt(sc.next());
        int amin = Integer.MAX_VALUE;
        int bmin = Integer.MAX_VALUE;
        int[] a = new int[A];
        int[] b = new int[B];
        int normalmin = 0;
        for(int i=0; i<A; i++) {
            a[i] = Integer.parseInt(sc.next());
            if(amin > a[i]) amin = a[i];
        }
        for(int i=0; i<B; i++) {
            b[i] = Integer.parseInt(sc.next());
            if(bmin > b[i]) bmin = b[i];
        }
        normalmin = amin + bmin;
        int ans = normalmin;
        for(int i=0; i<M; i++) {
            int x = Integer.parseInt(sc.next());
            int y = Integer.parseInt(sc.next());
            int c = Integer.parseInt(sc.next());
            if(a[x-1]+b[y-1]-c < ans) ans = a[x-1]+b[y-1]-c;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 65444
#include <stdio.h>
#include <string.h>
int main (){
	char a[11],b[11],c[11];
	scanf("%s %s %s",&a,&b,&c);
	
	if (a [strlen(a)-1] == b [0] && b [strlen(b)-1] == c [0]){
		printf("YES");
	}
	else {
		printf("NO");
	}
}

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

#define rep(i, s, n) for (Int i = s; i < (Int)(n); i++)
#define rrep(i, n, s) for (Int i = n - 1; i >= s; i--)
#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).end()
 
double EPS = 1e-10;
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int n, m;
    cin >> n >> m;
    vector<Int> a(n);
    rep(i, 0, n) cin >> a[i];
    sort(all(a), greater<Int>());
    double sum = (double)accumulate(all(a), 0LL);
    rep(i, 0, m) {
        double x = a[i];
        if (x < sum / (4.0 * (double)m)) {
            dump("No");
            return 0;
        }
    }
    dump("Yes");
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
from heapq import *
sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    HS = list(map(int, input().split()))
    ans = 0
    pool = []

    for h in HS:
        if len(pool) == 0:
            pool.append(h)
        else:
            if h <= pool[-1]:
                pool.append(h)
            else:
                ans = max(ans, len(pool)-1)
                pool = [h]
    ans = max(ans, len(pool)-1)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 14636
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>

using namespace std;

#define MAX_TASK_SIZE 100000

struct Task {
    char name[100];
    int time;
};

Task* Q[MAX_TASK_SIZE+1];
int head, tail, n;

int elaps = 0;

void enqueue(Task* x) {
    Q[tail] = x;
    tail = (tail + 1) % MAX_TASK_SIZE;
}

Task* dequeue() {
    Task* task = Q[head];
    head = (head + 1) % MAX_TASK_SIZE;
    return task;
}

bool isEmpty() {
    return head == tail;
}

void update (int dt) {

    Task* t = dequeue();
    if (t->time > dt) {
        t->time -= dt;
        elaps += dt;
        enqueue(t);
    }
    else {
        elaps += t->time;
        printf("%s %d\n", t->name, elaps);
    }
}

void execute (int dt) {
    while (!isEmpty()) {
        update(dt);
    }
}

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

    head = 1;
    tail = 1;
    for ( int i = 1; i <= n; i++) {
        char c[100];
        int t;
        scanf("%s", c);
        scanf("%d", &t);
        Task* task = new Task;
        strcpy(task->name, c);
        task->time = t;
        enqueue(task);
    }

    execute(q);

    return 0;
}

Measured memory_bytes: 9364