akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var current = new DateTime(2018, 1, 1);
            var end = new DateTime(2018, vals[0], vals[1]);
            var result = 0;
            while(current <= end)
            {
                if (current.Day == current.Month) result++;
                current = current.AddDays(1);
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define rep1(i, n) for (int i = 1; i < int(n); ++i)
#define repx(i, x, n) for (int i = int(x); i < int(n); ++i)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define ALL(n) begin(n), end(n)
#define IN(a, x, b) ((a) <= (x) && (x) < (b))
#define OUT(a, x, b) ((x) < (a) || (x) < (b))
typedef long long ll;
typedef long double ld;
const ll INF = 1e18;
const ll MOD = 1000000007;

int main()
{
    int H, W;
    cin >> H >> W;
    rep(i, H)
    {
        string s;
        cin >> s;
        cout << s << endl
             << s << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define ull unsigned long long int
#define forn(i,n)for(ll i=0;i<(n);i++)
#define forn_rev(i,n)for(ll i=(n)-1;i>=0;i--)
#define for1n(i,n) for(ll i=1;i<=(n);i++)
#define ARRAY_SIZE(a) sizeof(a)/sizeof(*a)
#define MOD 1000000007
#define MAXN 1000005
#define PI 3.1415926535897932384626433
#define gcd(a,b) __gcd(a,b)
#define lapsed(t2,t1) chrono::duration_cast<chrono::milliseconds>(t2-t1).count()
#define time Clock::now()
typedef std::chrono::high_resolution_clock Clock;

using namespace std;

ll power(ll x,ll y,ll p)
{
    ll res=1;
    x=x%p;
    if(x==0)
        return 0;
    while(y>0)
    {
        if(y&1)
            res=(res*x)%p;
        y=y>>1;
        x=(x*x)%p;
    }
    return res;
}



int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);

    ll T=1;
    //cin>>T;
    while(T--)
    {
        string s;
        cin>>s;
        cout<<s[0]<<s[1]<<s[2];

    }


    return 0;
}

Measured memory_bytes: 3652
from sys import stdin
N = 8
FREE = -1
NOT_FREE = 1
row = [FREE] * N
col = [FREE] * N
dpos = [FREE] * (2 * N - 1)
dneg = [FREE] * (2 * N - 1)
X = [[False] * N for _ in range(N)]
n = int(stdin.readline())
for _ in range(0, n):
    r, c = map(int, stdin.readline().split())
    X[r][c] = True
def printBoard():
    for i in range(0, N):
        for j in range(0, N):
            if X[i][j] != 0 and row[i] != j: return
    for i in range(0, N):
        for j in range(0, N):
            print("Q" if row[i] == j else ".", end="")
        print("")
def recursive(i):
    if i == N:
        printBoard()
        return
    for j in range(0, N):
        if (NOT_FREE == col[j] or
            NOT_FREE == dpos[i + j] or
            NOT_FREE == dneg[i - j + N - 1]): continue
        row[i] = j
        col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE
        recursive(i + 1)
        row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE
recursive(0)

Measured memory_bytes: 7796
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <cfenv>
#include <cinttypes>
#include <cstdint>
#endif
#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>
#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <forward_list>
#include <initializer_list>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#if __cplusplus >= 201402L
#include <shared_mutex>
#endif

#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;

const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};

ll gcd(ll x,ll y){
    x = x%y;
    return x == 0 ? y : gcd(y,x);
}
ll lcm(ll x, ll y){
    return x*y/gcd(x,y);
}



int main(){
 
    int n;
    cin >> n;
    priority_queue<int> q;
    vector<int> a(n);
    rep(i,n) {
        cin >> a[i];
        q.push(a[i]);
    }
    rep(i,n){
        int t = q.top();
        if(t == a[i]){
            q.pop();
            cout << q.top() << endl;
            q.push(t);
        }else{
            cout << t << endl;
        }
    }

    return 0;
}


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

int main() {
	
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i, n){
		cin >> h.at(i);
	}
	
	for(int i=n-1; i>0; i--){
		if(h.at(i) < h.at(i-1)){
			h.at(i-1)--;
		}
		if(h.at(i) < h.at(i-1)){
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main()
{
	int i, q[5 + 1], t, a[5 + 1], t2 = 10, n, min;

	for (i = 0; i < 5; i++) {
		scanf("%d", &q[i]);
		a[i] = (t = (q[i] % 10)) == 0 ? q[i] : q[i] + 10 - t;
		if (t > 0) {
			if (t2 > t) {
				n = i;
				t2 = t;
			}
		}
	}

	min = q[n];
	for (i = 0; i < 5; i++) {
		if (i != n) {
			min += a[i];
		}
	}

	printf("%d", min);

	return 0;
}


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

// 定義
typedef long long         ll;
typedef pair<ll, ll>      P;
#define ALL(x)            (x).begin(),(x).end()
#define REP(i, n)         for(ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)     for(ll i = m ; i < (ll)n ; ++i)
#define VL                vector<ll>
#define VVL               vector<vector<ll>>
#define VVVL              vector<vector<vector<ll>>>
#define VC                vector<char>
#define VVC               vector<vector<char>>
#define INF               (ll)2e9
#define INF_LL            1LL<<60
//#define MOD             998244353
#define MOD               1000000007

ll Ceil(ll val, ll div)   { return (val + div - 1) / div; }
ll CeilN(ll val, ll div)  { return Ceil(val, div) * div; }
ll FloorN(ll x, ll n)     { return (x - x % n); }
bool IsOdd(ll x)          { return ((x & 1) == 1); }
bool IsEven(ll x)         { return ((x & 1) == 0); }
template<class T> bool chmax(T& a, T b) { if (a <= b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }

void Solve()
{
	ll N;
	cin >> N;
	VL D1(N), D2(N);
	REP(i, N) cin >> D1[i] >> D2[i];

	ll cnt = 0;
	ll ans = 0;
	REP(i, N) {
		if (D1[i] == D2[i]) {
			cnt++;
			chmax(ans, cnt);
		} else {
			cnt = 0;
		}
	}

	string ans1 = ans < 3 ? "No" : "Yes";
	cout << ans1 << endl;
}

// メインs
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Solve();
	return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    LL H, W;
    cin >> H >> W;

    LL res = LINF;
    for(int i = 1; i < H; ++i) {
        LL a = i * W;
        LL tmp = (H - i) * W;
        LL b, c;
        if(H - i != 1) {
            b = (H - i) / 2 * W;
            c = tmp - b;
        }
        res = min(res, max({a, b, c}) - min({a, b, c}));

        b = W / 2 * (H - i);
        c = tmp - b;
        res = min(res, max({a, b, c}) - min({a, b, c}));
    }

    for(int i = 1; i < W; ++i) {
        LL a = H * i;
        LL tmp = (W - i) * H;
        LL b, c;
        if(W - i != 1) {
            b = (W - i) / 2 * H;
            c = tmp - b;
        }
        res = min(res, max({a, b, c}) - min({a, b, c}));

        b = H / 2 * (W - i);
        c = tmp - b;
        res = min(res, max({a, b, c}) - min({a, b, c}));
    }
    cout << res << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == -1)
            return 0;
        if(n == 0){
            cout << 0 << endl;
            continue;
        }

        string ret;
        while(n > 0){
            ret += (n & 3) + '0';
            n >>= 2;
        }
        reverse(ret.begin(), ret.end());
        cout << ret << endl;
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
using namespace std;

int main(){

    int n, m;
    cin >> n >> m;

    vector<int> from(n+1);
    vector<int> to(n+1);

    int a, b;
    for(int i = 0; i < m; i++){
        cin >> a >> b;
        if(a == 1){
            from[b] = 1;
        }
        if(b == n){
            to[a] = 1;
        }
    }

    for(int i = 0; i <= n; i++){
        if(from[i] && to[i]){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    
    cout << "IMPOSSIBLE" << endl;


}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007


int main() {

  int N;
  cin >> N;

  vector<string> S(N);
  vector<int> T(N);
  for(int i = 0;i < N;i++) cin >> S.at(i) >> T.at(i);

  string X;
  cin >> X;

  long long ans = 0;
  bool plus = false;
  for(int i = 0;i < N;i++) {
    if(plus) ans += T.at(i);
    if(X == S.at(i)) plus = true;
  }

  cout << ans << endl;

}


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (b % 2 == 0) return (pow(a * a, b / 2, m) % m); else return (pow(a * a, b / 2) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};
const ll MAX_N = 1e5;
ll N;
ll a[MAX_N];
bool c[MAX_N];
int main(){
  cin >> N;
  REP(i, N) cin >> a[i];
  ll ans = 1;
  ll sign = 0;
  REP(i, N - 1){
    if(a[i] < a[i + 1]){
      if(sign == 0) sign = 1;
      else if (sign == -1){
        ans++;
        sign = 0;
      }
    }
    else if (a[i] > a[i + 1]){
      if(sign == 0) sign = -1;
      else if (sign == 1){
        ans++;
        sign = 0;
      }
    }
  }
  cout << ans << endl;

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
struct mzls
{
	int v,t;
}a[100005];
bool operator<(mzls a1,mzls b1)
{
	return a1.v==b1.v?a1.t>b1.t:a1.v>b1.v;
}
int n,m,la[100005];
bool f[100005];
inline int Find(int x)
{
	if(x<0)
		return x;
	return la[x]==la[100003]?x:la[x]=Find(la[x]);
}
int main()
{
	memset(la,-0x3f,sizeof(la));
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&a[i].t,&a[i].v);
	}
	long long ans=0;
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
		int x=m-a[i].t;
		if(x<0)
			continue;
		x=Find(x);
		if(x<0)
			continue;
		la[x]=x-1,ans+=a[i].v;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 1408
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
main() {
  int N; cin>>N;
  vector<int> xs(N);
  for(auto& x:xs) cin>>x;
  sort(xs.begin(), xs.end());
  for(int i=1; i<N-1; ++i) xs[i]+=xs[i-1];
  puts(xs[N-1] < xs[N-2] ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main() {
	/*int X, A;
	cin >> X >> A;
	if (X < A) { cout << 0; }
	else {
		cout << 10;
	}*/


	/*int N, X, ans = 1, L, D = 0;
	cin >> N >> X;
	rep(i, N) {
		cin >> L;
		D += L;
		if (D <= X) {
			ans++;
		}
	}
	cout << ans;*/


	long double W, H, x, y;
	cin >> W >> H >> x >> y;
	cout << setprecision(10) << W * H / 2 << " ";
	if (x == W / 2 && y == H / 2) {
		cout << 1;
	}
	else {
		cout << 0;
	}
	return 0;
}

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

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var a = vals[0];
        var b = vals[1];

        var ans = Math.Max(a - b * 2, 0);

        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13396
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, K, C = mapint()
S = list(input())
r_S = S[::-1]

pos = [10**18]*N
neg = [10**18]*N
ok = 0
cnt = 0
for i in range(N):
    if S[i]=='o':
        if ok<=i:
            pos[i] = cnt + 1
            cnt += 1
            ok = i + C + 1

    else:
        pass
ok = 0
cnt = 0
for i in range(N):
    if r_S[i]=='o':
        if ok<=i:
            neg[i] = cnt + 1
            cnt += 1
            ok = i + C + 1

    else:
        pass

ans = []
neg = neg[::-1]

for i in range(N):
    if pos[i]+neg[i]-1==K:
        ans.append(i)
for a in ans:
    print(a+1)

Measured memory_bytes: 102108
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
 
int main()
{
    int n, a[100], ans = 0, tmp, cnt;

    std::cin >> n;
    for(int i = 0;i < n;i++){
        std::cin >> a[i];
    }
    while(1){
        cnt = 0;
        for(int i = 0;i < n - 1;i++){
            if(a[i] < a[i + 1]){
                tmp = a[i];
                a[i] = a[i + 1];
                a[i + 1] = tmp;

                cnt++;
            }
        }
        if(cnt == 0){
            break;
        }
    }

    for(int i = 0;i < n;i++){
        if(i % 2 == 0){
            ans += a[i];
        }
        else{
            ans -= a[i];
        }
    }

    std::cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	char l[3][3],s[9],m;
	int i;
	while(scanf("%s",s)!=EOF){
		l[0][0]=s[0];
		l[0][1]=s[1];
		l[0][2]=s[2];
		l[1][0]=s[3];
		l[1][1]=s[4];
		l[1][2]=s[5];
		l[2][0]=s[6];
		l[2][1]=s[7];
		l[2][2]=s[8];
		m='d';
		for(i=0;i<3;i++){
			if(l[i][0]=='o'&&l[i][1]=='o'&&l[i][2]=='o'){
				m='o';
			}else if(l[i][0]=='x'&&l[i][1]=='x'&&l[i][2]=='x'){
				m='x';
			}
		}
		for(i=0;i<3;i++){
			if(l[0][i]=='o'&&l[1][i]=='o'&&l[2][i]=='o'){
				m='o';
			}else if(l[0][i]=='x'&&l[1][i]=='x'&&l[2][i]=='x'){
				m='x';
			}
		}
		if(l[0][0]=='o'&&l[1][1]=='o'&&l[2][2]=='o'){
			m='o';
		}
		if(l[0][0]=='x'&&l[1][1]=='x'&&l[2][2]=='x'){
			m='x';
		}
		if(l[2][0]=='o'&&l[1][1]=='o'&&l[0][2]=='o'){
			m='o';
		}
		if(l[2][0]=='x'&&l[1][1]=='x'&&l[0][2]=='x'){
			m='x';
		}
		printf("%c\n",m);
	}
	return 0;
}

Measured memory_bytes: 540
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  string y;
  y = "Y";
  string num;
  num = "Three";
  string color;
  for (int i = 0; i < n; i++) {
    cin >> color;
    if (color == y){
      num = "Four";
      break;
    }
    }
 cout << num << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

bool isPalindrome(string s) {
  string t = s;
  reverse(t.begin(), t.end());
  return s == t;
}

int main() {
  string S;
  cin >> S;
  bool bl = true;
  if (!isPalindrome(S)) bl = false;
  string T = S.substr(0, sz(S)/2);
  if (!isPalindrome(T)) bl = false;
  puts(bl ? "Yes" : "No");
  return 0;
}

Measured memory_bytes: 3572
/*

    author : s@if

*/

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define 		NIL 			-1
#define		 	fi	 		    first
#define 		sec 			second
#define 		MAX 			INT_MAX
#define			INF 			99999999
#define 		ll 			    long long
#define 		PI 			    acos(-1.0)
#define			MOD 			1000000007
#define 		PLL 			pair<ll,ll>
#define 		PII			    pair<int,int>
#define 		ull 			unsigned long long
#define 		For(i,a,b) 		for(int i=a;i<=(int)b;i++)
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> new_data_set;

//*find_by_order(k)  gives the kth element;
//order_of_key(item)   gives the index(number of element strictly less than item) of item;


inline int in() {int x; scanf("%d", &x); return x; }
bool Check(int N , int pos)	{	return (bool) (N & (1<<pos));}
int Set(int N, int pos) {	return N = N | (1<<pos);}

int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hr[]={-2,-2,-1,+1,+2,+2,-1,+1};
int hc[]={+1,-1,+2,+2,-1,+1,-2,-2};
int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};

const int MAXN = (int)1e5+9;

int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */

    int i,j,k,l,m,n,p,q,x,y,u,v,r,tc,t;

    n = in();

    printf("%d\n", n*n);

    return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)


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

using namespace std;

int main()
{
  int H,W;
  cin >> H >> W;
  char a[H][W];

  for(int i=0;i<H;i++)
    {
      string tmp;      
      cin >> tmp;
      for(int j=0;j<W;j++)
	a[i][j] = tmp[j];
    }


  for(int i=0;i<H;i++)
    {
      bool flg = false;
      for(int j=0;j<W;j++)
	{
	  if( a[i][j] == '#')
	    {
	      flg = true;
	      break;
	    }
	}
      if(!flg)
	{
	  for(int j=0;j<W;j++)
	    a[i][j] = 0;
	}
    }

    for(int j=0;j<W;j++)
    {
      bool flg = false;
      for(int i=0;i<H;i++)
	{
	  if( a[i][j] == '#')
	    {
	      flg = true;
	      break;
	    }
	}
      if(!flg)
	{
	  for(int i=0;i<H;i++)
	    a[i][j] = 0;
	}
    }

  for(int i=0;i<H;i++)
    {
      bool flg=false;
      for(int j=0;j<W;j++)
	{
	  if(a[i][j] != 0)
	    {
	      flg = true;
	      cout << a[i][j];
	    }
	}
      if(flg)
	cout << endl;
    }
      
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=105;
//i_am_noob
int a,b;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> a >> b;
	print1((a-1)*(b-1));
	return 0;
}

Measured memory_bytes: 256
//...START BY DOING WHAT IS NECESSARY, THEN WHAT IS POSSIBLE AND SUDDENLY YOU ARE DOING THE IMPOSSIBLE... 
// ................. WORK UNTILL YOUR IDOLS BECOME YOUR RIVALS................................

#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define pb emplace_back
#define f first
#define mp make_pair
#define s second
#define delrep  a.erase(unique(a.begin(),a.end()),a.end());
#define all(a)  (a).begin(),(a).end()
#define sz(x)   (int)x.size()
#define lll __int64
const int N=1000;
const int mod=998244353;
using namespace std;
int get_second( pair<int, int> i ){ return i.second; }  
int trail_zero(int n){while (n % 10 == 0) n /= 10 ; return n;}
typedef long long ll;
map<ll,ll> m11;
multiset<ll> s1;
map<pair<ll,ll>,ll> m1;
vector<pair<int,int>>v;
vector<int>ans;
map<char,int>m4;
map<char,int>m5;
char s111[N];
ll p2[N],p3[N];
//ll h[N];
ll n,k,m,x,y,ans1=INT_MAX;
bool check(int a,int b) { if(a>=0 || a<n) return true; if(b>=0 || b<m) return true; else return false;}
int dx[]={0,-1,0,1};
int dy[]={1,0,-1,0};
// char s[500][500];
vector<vector<ll>> adj(N);
vector<ll> vis(N),in(N),out(N),cnt(N);
vector<ll>ansx;
map<ll,ll>mx;
bool used[111][11];
void dfs( ll x, ll y )
{
    if( x<1 || x>10000 || used[x][y] || y>10000 ) return;
    if( x==m ) ans1=min(ans1, y);
    used[x][y]=1;
    dfs( x-1, y+1 );
    dfs( x*2, y+1 );
}
vector<pair<int, int>> e(100002), o(100002);
bool prime_check(ll a)
{
    if(a == 2)
        return true;
    for(ll i=2;i<=sqrt(a);i++)
    {
        if(a%i)
            continue;
        return false;
    }
    return true;
}
int smallest_divisor(ll a)
{
  for(int i=2;i*i<=a;i++)
  {
    if(a%i==0) return i;
  }
  return a;
}
 
int main()
{
  ll n,ans=0,ans2=0; cin>>n; ll a[n]; for(int i=0;i<n;i++) { cin>>a[i]; a[i]-=(i+1); }
  sort(a,a+n);
  for(int i=0;i<n;i++) ans+=abs(a[i]-a[n/2]);
  for(int i=0;i<n;i++) ans2+=abs(a[i]-a[n/2-1]);
  cout<<min(ans,ans2);
  return 0;
}
 



Measured memory_bytes: 3456
#include<iostream>
using namespace std;
main()
{
  int t[4],n[4];
  for(int i=0;i<4;i++){
    cin>> t[i]>> n[i];
  }
  for(int i=0;i<4;i++){
    if(t[i]==1){
      cout<< 6000*n[i]<< endl;
    } else if(t[i]==2){
      cout<< 4000*n[i]<< endl;
    } else if(t[i]==3){
      cout<< 3000*n[i]<< endl;
    } else {
      cout<< 2000*n[i]<< endl;
    }
  }
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <cstdio>
#define rep(i,n) for(int i=0;i < n;i++)

using namespace std;

int p[10][10];
int cnt = 0,Max = 0;
void ink(int x,int y){
  if(0<=x && x < 10&& 0<=y && y<10)p[x][y]++;
}

int main(){

    rep(i,10)rep(j,10){
      p[i][j] = 0;
    }
    int x,y,size;
  while(~scanf("%d,%d,%d",&x,&y,&size)){

    if(size == 1){
      ink(x,y);
      ink(x+1,y);
      ink(x-1,y);
      ink(x,y+1);
      ink(x,y-1);
    }else  if(size == 2){
      ink(x,y);
      ink(x+1,y);
      ink(x-1,y);
      ink(x,y+1);
      ink(x,y-1);
      ink(x+1,y+1);
      ink(x-1,y+1);
      ink(x-1,y-1);
      ink(x+1,y-1);
    }else  if(size == 3){
      ink(x,y);
      ink(x+1,y);
      ink(x-1,y);
      ink(x,y+1);
      ink(x,y-1);
      ink(x+1,y+1);
      ink(x-1,y+1);
      ink(x-1,y-1);
      ink(x+1,y-1);
      ink(x+2,y);
      ink(x-2,y);
      ink(x,y+2);
      ink(x,y-2);
    }
    cnt =0;
    Max = -10000000;
    rep(i,10)rep(j,10){
      if(p[i][j]==0)cnt++;
      Max = max(Max,p[i][j]);
    }
    
  }
  cout << cnt <<"\n" << Max << endl;
  
  return 0;
}

Measured memory_bytes: 1212
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

#define SORT(c) sort((c).begin(),(c).end())
#define DSORT(c, type) sort(ALL(c), greater<type>())

#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SUM(v) accumulate(ALL(v), 0)
#define AVE(v) SUM(v) / (v).size()
// 入力eと同じ値の要素の数
#define COUNT(v, e) count(ALL(v), e)

using namespace std;


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

  string s;
  cin >> s;

  bool mtop = false, mbottom = false;
  if(int(s[0]-'0') * 10 + int(s[1]-'0') > 0 and int(s[0]-'0') * 10 + int(s[1]-'0') < 13) {
    mtop = true;
  }

  if(int(s[2]-'0') * 10 + int(s[3]-'0') > 0 and int(s[2]-'0') * 10 + int(s[3]-'0') < 13) {
    mbottom = true;
  }

  if(mtop and !mbottom)
    cout << "MMYY\n";
  else if(!mtop and mbottom)
    cout << "YYMM\n";
  else if(mtop and mbottom)
    cout << "AMBIGUOUS\n";
  else
    cout << "NA\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b)
{
    if (a % b == 0 || b % a == 0) return min(a, b);
    if (a < b) swap(a, b);
    if (a == 1 || b == 1) return 1;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b)
{
    return a / gcd(a, b) * b;
}
int main() {
    long long n, l = 1;
    cin >> n;
    long long t[n];
    for (long long i = 0; i < n; i++) 
    {
        cin >> t[i];
        l = lcm(l, t[i]);
    }
    cout << l;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int , int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18 


int main (){
    int n ; 
    cin >> n ;
    int ans = 0 ;
    for(int i = 1; i <= n ; i++){
        if(i%2 == 1){
            int num = 0 ;
            for(int j = 1; j <= i ; j++ ){
                if(i % j == 0){
                    num += 1 ;
                }
            }
            if(num == 8){
                ans++ ;
            }
        }
    }
    cout << ans << endl ;
}


Measured memory_bytes: 3556
// AtCoder Regular Contest 069
// D - Menagerie

#include <cstdio>
#define MAX_N 100000
using namespace std;
typedef long long int ll;


int N;
bool s[MAX_N];
bool ans[MAX_N];

int main() {

  char c;

  scanf("%d", &N);
  scanf("%*c");
  for (int i = 0; i < N; i++) {
    scanf("%c", &c);
    s[i] = (c == 'o');
  }

  for (int j0 = 0; j0 < 2; j0++) {
    for (int j1 = 0; j1 < 2; j1++) {
      ans[0] = j0;
      ans[1] = j1;
      for (int i = 2; i < N; i++) {
        ans[i] = (ans[i - 2] != (ans[i - 1] != s[i - 1]));
      }
      if (
        ans[0] == (ans[N - 2] != (ans[N - 1] != s[N - 1])) &&
        ans[1] == (ans[N - 1] != (ans[0] != s[0]))
      ) {
        for (int i = 0; i < N; i++) {
          printf("%c", ans[i] ? 'S' : 'W');
        }
        printf("\n");
        return 0;
      }
    }
  }

  printf("-1\n");

  return 0;

}




Measured memory_bytes: 512
x = gets.to_i
primeNumbers = []

(2...Math.sqrt(x).ceil).each do |i|
  judge = true
  primeNumbers.each do |n|
    if i % n == 0
      judge = false
      break
    end
  end
  primeNumbers.push(i) if judge
end

while true
  judge = true
  primeNumbers.each do |n|
    if x % n == 0
      judge = false
      break
    end
  end

  if judge
    puts x
    exit
  end
  x += 1
end

Measured memory_bytes: 14360
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int a, b, x;
  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;
 
int main() {
    int n,m;
    cin >> n >> m;
    vector<int> ac(n),pena(n);
    for(int i = 0;i<m;++i){
        int p;
        string s;
        cin >> p >> s;
        --p;
        if(ac[p])continue;
        if(s == "AC"){
            ac[p] = 1;
        }else{
            pena[p]++;
        }
    }
    int AC = 0,PENA = 0;
    for(int i = 0;i<n;++i){
        AC += ac[i];
        if(ac[i]) PENA += pena[i];
    }
    cout << AC << " " << PENA << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

typedef unsigned long long int ll;

int main(void){
  ll A,B,N;
  cin >> A >> B >> N;
  //あまり
  ll z = A%B;
  ll aim = N;
  if(B <= N){
    aim = B-1;
  }
  ll nthen = aim;
  cout << (A*nthen)/B - A * (nthen/B) << endl;
  return 0;
}


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

#define sqr(A) ((A) * (A))
#define F first
#define S second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;

const int N = 1e5 + 20;
int a[N], n, m, ans;
bool in[N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	fill(a, a + N, 1);
	cin >> n >> m;
	in[1] = 1;
	for (int i = 0, x, y; i < m; i++) {
		cin >> x >> y;
		a[x]--;
		a[y]++;
		in[y] |= in[x];
		in[x] &= (a[x] > 0);
	}
	ans = n;
	for (int i = 1; i <= n; i++)
		if (!a[i] || !in[i])
			ans--;
	cout << ans << endl;
}

Measured memory_bytes: 768
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math
N,K=map(int,input().split())
S=input()
if N==1:
    print(0)
    exit()

_K=K
_S=list(S)

pre=_S[0]
flag=0
for i in range(1,N):

        if (_K>0 or flag==1 )and pre!=_S[i]:
            flag=1
            _S[i]=pre
        elif pre==_S[i] and flag==1:
            _K-=1
            flag=0

count=0
if _S[0]=="R" and _S[1]=="R":
    count+=1
if _S[-1]=="L" and _S[-2]=="L":
    count+=1

for i in range(1,N-1):
    if _S[i-1]=="L" and _S[i]=="L"  or _S[i]=="R" and _S[i+1]=="R":
        count+=1

print(count)


Measured memory_bytes: 49392
#include <stdio.h>
#include <string.h>

int main (int argc,char **argv)
{
	int a = 0,b = 0;
	float x = 0.0;

	scanf("%d%d",&a,&b);

	x = (a + b) /2;

	if ((a + b) % 2 != 0 )
	{
		printf("%.0f\n",x+1);
	}

	else
	{
		printf("%.0f\n",x);
	}	

	return 0;
}

Measured memory_bytes: 128
n = input()
if n[-1] == '2' or n[-1] == '4' or n[-1] == '5' or n[-1] == '7' or n[-1] == '9':
  print('hon')
elif n[-1] == '0' or n[-1] == '1' or n[-1] == '6' or n[-1] == '8':
  print('pon')
elif n[-1] == '3':
  print('bon')

Measured memory_bytes: 61596
n,x=map(int,input().split())
a=list(map(int,input().split()))
count=0
for i in range(n):
    if a[i]>x:
        count+=a[i]-x
        a[i]=x
for i in range(1,n):
    if a[i]+a[i-1]>x:
        count+=a[i]+a[i-1]-x
        a[i]=x-a[i-1]
print(count)     

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

int main(){
  string s;
  cin >> s;
  if(s.at(0) == s.at(3) && s.at(1) == s.at(2) && s.at(0) != s.at(1)){
    cout << "Yes" << endl;
    return 0;
  }

  if(s.at(1) == s.at(3) && s.at(0) == s.at(2) && s.at(0) != s.at(3)){
    cout << "Yes" << endl;
    return 0;
  }

  if(s.at(0) == s.at(1) && s.at(2) == s.at(3) && s.at(0) != s.at(3)){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}


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

int main() {
    char b;
    cin >> b;
    if (b == 'A') {
        cout << 'T' << endl;
    } else if(b == 'T') {
        cout << 'A' << endl;
    } else if (b == 'C') {
        cout << 'G' << endl;
    } else {
        cout << 'C' << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <queue>
#include <assert.h>
#include <cmath>
using namespace std;
using ll = long long;
const ll mxw = 20005;
const ll mxn = 3003;
ll N;

struct Box
{
	ll w, s, v;
};

bool cmp(const Box b1, const Box b2) {
	return (b1.w+b1.s)<(b2.w+b2.s);
}

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

	vector<Box> Boxes;
	cin>>N;
	for(ll i=1; i<=N; i++) {
		ll w, s, v;
		cin>>w>>s>>v;
		Box b; b.w = w; b.s =s; b.v = v;
		Boxes.emplace_back(b);
	}

	sort(Boxes.begin(),Boxes.end(), cmp);

	vector<ll> dp (mxw, 0ll);
	for(auto x:Boxes) {
		vector<ll> new_dp(mxw, 0ll);
		for(ll j=0; j<mxw; j++) {
			if(j-x.w<0) new_dp[j] = dp[j];
			else if(j-x.w>x.s) new_dp[j] = dp[j];
			else new_dp[j] = max(dp[j-x.w]+x.v, dp[j]);
		}
		dp = new_dp;
	}

	ll ans = 0ll;
	for(ll i=0; i<mxw; i++) if(dp[i]>ans) ans = dp[i];
	cout << ans << '\n';

	return 0;
}

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

int main()
{
    int N, C;
    vector<vector<int>> D(30, vector<int>(30));
    vector<vector<int>> t(3,  vector<int>(30));

    cin >> N >> C;
    for( int i = 0; i < C; ++i ){
        for( int j = 0; j < C; ++j ){
            cin >> D[i][j];
        }
    }
    for( int i = 0; i < N; ++i ){
        for( int j = 0; j < N; ++j ){
            int X;
            cin >> X;
            t[(i+j)%3][X-1]++;
        }
    }

    // どの3つの文字を使うか全探索
    int ans = 1e+9;
    for( int i = 0; i < C; ++i ){
        for( int j = 0; j < C; ++j ){
            if( i != j ){
                for( int k = 0; k < C; ++k ){
                    if( i != k && j != k ){
                        int tmp = 0;
                        for( int l = 0; l < C; ++l ) tmp += D[l][i]*t[0][l];
                        for( int l = 0; l < C; ++l ) tmp += D[l][j]*t[1][l];
                        for( int l = 0; l < C; ++l ) tmp += D[l][k]*t[2][l];
                        ans = min( ans, tmp );
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//ABC166 A

#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = s; i < (int)(n); i++)
const lint mod = 1000000007;


lint ans = 0;
lint a,b,n;
string s;


int main() {
  cin >> s;

/*   rep(i,n){
    scanf("%s",&s[i]);
  } */
  
  if(s == "ABC") printf("ARC\n");
  else printf("ABC\n");

  //printf("%lld\n",ans);
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll a[100001];
ll ans[100001];
int main()
{   
	ll i,n;
	scanf("%lld",&n);
	for(i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	ans[n]=0;
	ans[n-1]=abs(a[n]-a[n-1]);
    for(i=n-2;i>=1;i--)
       ans[i]=min(abs(a[i]-a[i+1])+ans[i+1],abs(a[i]-a[i+2])+ans[i+2]);
	printf("%lld\n",ans[1]);
	return 0;
}

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

int main()
{
  	int i, j, k, l;
  	string sa, sb, sc;
  	cin >> sa >> sb >> sc;
  	i = 0; j = 0; k = 0; l = 0;
  	while (i >= 0 && j >= 0 && k >= 0) {
        if (l == 0) {
            if (i == (int) sa.size()) {
                cout << "A\n";
                return 0;
            }
            l = sa[i] - 'a';
            i++;
        }
        else if (l == 1) {
            if (j == (int) sb.size()) {
                cout << "B\n";
                return 0;
            }
            l = sb[j] - 'a';
            j++;
        }
        else if (l == 2) {
            if (k == (int) sc.size()) {
                cout << "C\n";
                return 0;
            }
            l = sc[k] - 'a';
            k++;
        }
  	}
 	return 0;
}


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

int main(){
    int N;
    cin >> N;
    int d[N];
    for(int i=0;i<N;i++)
        cin >> d[i];

    int ans = 0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            ans += d[i]*d[j];
        }
    }

    cout << ans << endl;

}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,true):false;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,true):false;}

int nextInt() {
  int x; scanf("%d", &x); return x;
}

ll ten[20];

ll rec(int K, ll D, bool first) {
  if (K == 0) {
    // cout << "ok " << K << " " << D << endl;
    return D == 0 ? 1 : 0;
  }
  if (K == 1) {
    if (D != 0) return 0;
    if (first) return 9;
    else return 10;
  }
  ll res = 0;

  for (int d0 = -9; d0 <= 9; d0++) {
    ll nextD = D - (-d0*ten[K-1] + d0*ten[0]);
    if (nextD % 10 != 0) continue;
    nextD /= 10;
    int c = d0 <= 0 ? (10 + d0 - first) : (10 - d0);
    // cout << K << " " << D << " " << d0 << " " << c << endl;
    res += c * rec(K - 2, nextD, false);
  }
  return res;
}

ll solve(int K, ll D) {
  return rec(K, D, true);
}

int main2() {
  ll D = nextInt();
  ll ans = 0;
  for (int K = 1; K <= 18; K++) {
    ans += solve(K, D);
  }

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

int main() {
  ten[0] = 1;
  REP(i, 19) ten[i+1] = ten[i] * 10;
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}


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


int main(){
    string s;
    string ss = "";
    while (cin >> s){
	string::size_type t = s.find("apple");
	if (t != string::npos) s.replace(t, 5, "peach");
	else {
	    t = s.find("peach");
	    if (t != string::npos) s.replace(t, 5, "apple");
	}
	ss += s + " ";
    }
    ss.erase(ss.end()-1);
    cout << ss << endl;
}

Measured memory_bytes: 0
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for i in range(Q):
    b, c = list(map(int, input().split()))
    B.append(b)
    C.append(c)

max_num = max(max(A), max(B), max(C))

NUM = [0] * (max_num + 1)

num_list = []

for a in A:
    NUM[a] += 1

total = sum(A)

for i in range(Q):

    total += (C[i] - B[i]) * NUM[B[i]]
    NUM[B[i]], NUM[C[i]] = 0, NUM[B[i]] + NUM[C[i]]

    print(total)


Measured memory_bytes: 88888
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int n = sc.nextInt();
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = sc.nextInt();
		
		int m = sc.nextInt();
		for (int i=0; i<m; i++) {
			int L = sc.nextInt(); int R = sc.nextInt(); int target = sc.nextInt();
			int num = 0;
			for (int j=L; j<R; j++) {
				if (ar[j] == target) num++;
			}
			System.out.println(num);
		}
		
	}
}


Measured memory_bytes: 36296
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

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

	int h = 42;
	int w = 100;
	vector<vector<char> > grid(h, vector<char>(w, '.'));
	rep (i, h){
		rep (j, w){
			if (i >= h / 2){
				grid[i][j] = '#';
			} // end if
		} // end rep
	} // end rep		
	--A, --B;
	while(A > 0){
		for (int i = h / 2 + 1; i < h; i += 2){
			for (int j = 1; j < w; j += 2){
				grid[i][j] = '.';
				--A;
				if (A == 0) break; 
			} // end if
			if (A == 0) break;
		} // endf or
	} // end while
	
	while(B > 0){
		for (int i = 1; i < h / 2; i += 2){
			for (int j = 1;j < w; j += 2){
				grid[i][j] = '#';
				--B;
				if (B == 0) break;
			} // end for
			if (B == 0) break;
		} // end for
	} // end while

	cout << h << ' ' << w << endl;
	rep (i, h){
		rep (j, w){
			cout << grid[i][j];
		} // end rep
		cout << endl;
	} // end rep
						
	return 0;
}

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

#define ARC(i, a, b) for(int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)

template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<class T> T anti(const T &a, const T &b){ return a == -1 || b == -1 ? -1 : ant(a, b); }
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<class T> T onti(const T &a, const T &b){ return a == -1 ? b : b == -1 ? a : ont(a, b);}
template<class T> T &th(T &a, const T &b, T (*fnc)(const T &, const T &)){ return a = fnc(a, b); }

int table[420][420];

int n, ma, mb;
int a, b, c;
int ans = -1;

int main(){
	RC(i, 420) RC(j, 420) table[i][j] = -1;
	table[0][0] = 0;
	scanf("%d%d%d", &n, &ma, &mb);
	RC(i, n){
		scanf("%d%d%d", &a, &b, &c);
		RCH(i, 400) RCH(j, 400) if(table[i][j] != -1){
			th(table[i + a][j + b], table[i][j] + c, onti);
		}
	}

	// RC(i, 40){ RC(j, 40) printf("%d ", table[i][j]); putchar('\n'); }

	ARC(i, 1, 40) if(table[ma * i][mb * i] != -1) {
		th(ans, table[ma * i][mb * i], onti);
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 896
MOD = 998244353
io = STDIN
n=io.gets.to_i
D=io.gets.split.map(&:to_i)
d_cnt=Array.new(D.max+1,0)
D.each do |d|
  d_cnt[d]+=1
end
def calc(d_cnt)
  rtn=1
  d_cnt.each_cons(2) do |a,b|
    rtn*=a**b 
    rtn%=MOD
  end
  rtn
end
if D[0]!=0 || d_cnt[0]!=1 || d_cnt.include?(0)
  puts 0
else
  puts calc(d_cnt)
end


Measured memory_bytes: 8844
import itertools

N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = 10**11
for obj in itertools.combinations(range(1,N), K-1):
	tmp = A[0]
	cnt = 1
	i = 0
	cost = 0
	for j in range(1,N):
		if j == obj[i]:
			cost += max(0, tmp-A[j]+1)
			tmp = max(tmp+1, A[j])
			i += 1
			cnt += 1
			if cnt == K:
				break
		
		else:
			if A[j] > tmp:
				cnt += 1
				tmp = A[j]

			if cnt == K:
				break

	ans = min(ans, cost)

print(ans)

Measured memory_bytes: 3064
while(True):
	H,W=list(map(int,input().split()))
	if H==0 and W==0:
		break
	top=""
	for i in range(W):
		top+="#"
	top+="\n"
	mid="#"
	for i in range(W-2):
		mid+="."
	mid+="#\n"
	s=top
	for i in range(H-2):
		s+=mid
	s+=top
	print(s)

Measured memory_bytes: 7608
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int A, B, C;
    io.read(A, B, C);
    map<int, int> mp;
    mp[A]++;
    mp[B]++;
    mp[C]++;
    for(auto i = mp.begin(); i != mp.end(); i++){
        if(i->second == 1){
            cout << i->first;
            break;
        }
    }
    return 0;
}

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

#define _u(i,a,b) for(int i=a;i<=b;++i)
#define _d(i,a,b) for(int i=a;i>=b;--i)
#define endl "\n"
#define ii pair<int,int>
#define fi first
#define se second
#define ll long long
#define FIO() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FI(task) freopen(task".inp","r",stdin)
#define FO(task) freopen(task".out","w",stdout)

using namespace std;

const int N = 1e5+7;
const int M = 1e9+7;

ll f[107][N], a[N];
int n, k;

#define task "test"

int main(){
    FIO();
    //FI(task);
    ///FO(task);

    cin >>n >> k;
    _u(i,1,n) cin >> a[i];
    _u(i,0,n) f[i][0] = 1;
    _u(i,1,n) _u(j,1,k){
        f[i][j] = (f[i][j-1] + f[i-1][j] - (j>=a[i]+1?f[i-1][j-a[i]-1]:0)) % M;
        if(f[i][j] < 0) f[i][j] += M;
    }
    cout << f[n][k];
    return 0;
}


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

using namespace std;

#define allof(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



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

    vector<int> primes;
    for(int a = 2; a <= 55555; a++){
        bool is_prime = true;
        for(int b = 2; b * b <= a; b++){
            if(a % b == 0){
                is_prime = false;
            }
        }
        if(a % 5 == 1 && is_prime){
            primes.push_back(a);
        }
    }

    int N;
    cin >> N;
    for(int a = 0; a < N; a++){
        cout << primes[a] << " ";
    }
}


Measured memory_bytes: 256
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int n,m,i,j,k,x,y;(n=s.nextInt())>0;){int[]a=new int[m=n+s.nextInt()],r={0,0};for(i=x=0;i<m;)x+=a[i++]=s.nextInt();for(r[0]=x,i=0;i<n;++i)for(j=n;j<m;++j){for(k=y=0;k<n;++k)y+=a[k!=i?k:j];if(y*2==x&&r[0]+r[1]>a[i]+a[j])r=new int[]{a[i],a[j]};}System.out.println(r[0]<x?r[0]+" "+r[1]:-1);}}}

Measured memory_bytes: 12000
from itertools import accumulate
def is_prime(n):
    is_prime = [True for i in range(n)]
    is_prime[0] = False
    for i in range(2, n + 1):
        if is_prime[i - 1]:
            j = i * 2
            while j <= n:
                is_prime[j - 1] = False
                j += i
    prime = [i for i in range(1, n + 1) if is_prime[i - 1]]
    return is_prime, prime
q = int(input())
l = [0]*q
r = [0]*q
for i in range(q):
    l[i], r[i] = list(map(int, input().split()))
is_prime, prime = is_prime(max(r))
like2017 = [0] * (max(r) + 1)
for i in range(0, max(r) + 1):
    if (i % 2 == 1):
        if (is_prime[i-1] and is_prime[(i+1)//2-1]):
            like2017[i] = 1
like2017 = [0] + like2017
like2017 = list(accumulate(like2017))
for i in range(q):
    print(like2017[r[i] + 1] - like2017[l[i]])

Measured memory_bytes: 16040