akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
  int mod=1000000007;
  int n;
  cin >> n;
  int to=n;
  vector<int>a(n);
  rep(i,n){
    cin>>a.at(i);
  }
  long ans=1;
  int fi=-1;
  int se=-1;
  int th=-1;
  rep(i,n){
    int co=0;
    if(a.at(i)==fi+1&&a.at(i)==se+1&&a.at(i)==th+1){
      co=3;
      fi++;
    }
    else if(a.at(i)==fi+1&&a.at(i)==se+1&&a.at(i)!=th+1){
      co=2;
      fi++;
    }
    else if(a.at(i)==fi+1&&a.at(i)!=se+1&&a.at(i)==th+1){
      co=2;
      fi++;
    }
    else if(a.at(i)!=fi+1&&a.at(i)==se+1&&a.at(i)==th+1){
      co=2;
      se++;
    }
    else if(a.at(i)!=fi+1&&a.at(i)!=se+1&&a.at(i)==th+1){
      co=1;
      th++;
    }
    else if(a.at(i)!=fi+1&&a.at(i)==se+1&&a.at(i)!=th+1){
      co=1;
      se++;
    }
    else if(a.at(i)==fi+1&&a.at(i)!=se+1&&a.at(i)!=th+1){
      co=1;
      fi++;
    }
    else{
      ans=0;
      break;
    }
    ans*=co;
    ans%=mod;
  }
  cout<<ans<<endl;  
}

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

typedef pair<int, int> pii;

void solve();

int N,M,Q_;
int D[100010] = {0};
int Q[200010];
int TL[100010] = {0};
int ans = 0;

vector<pii> G[100010];
vector<pii> E;

int main()
{
    scanf("%d%d%d",&N,&M,&Q_);
    E.push_back(make_pair(0,0));
    for(int i = 0; i < M; i++)
    {
        int U,V;
        scanf("%d%d",&U,&V);
        G[U].push_back(make_pair(V,0));
        G[V].push_back(make_pair(U,0));
        E.push_back(make_pair(V,U));
    }
    for(int i = 0; i < Q_; i++)
    {
        scanf("%d",&Q[i]);
    }
    solve();
    return 0;
}

void solve()
{
    queue<pii> que;
    que.push(make_pair(1,1));
    while(que.size())
    {
        pii now = que.front();
        que.pop();
        if(D[now.second] == 0)
        {
            D[now.second] = now.first;
            TL[now.second]++;
            for(int i = 0; i < G[now.second].size(); i++)
            {
                que.push(make_pair(now.first + 1,G[now.second][i].first));
            }
        }
        else if(D[now.second] == now.first)
        {
            TL[now.second]++;
        }
    }
    for(int i = 0; i < Q_; i++)
    {
        if(D[E[Q[i]].first] == D[E[Q[i]].second])
        {
            printf("%d\n",ans);
            continue;
        }
        int mem,txt;
        if(D[E[Q[i]].first] < D[E[Q[i]].second])
        {
            mem = E[Q[i]].second;
            txt = E[Q[i]].first;
        }
        else
        {
            mem = E[Q[i]].first;
            txt = E[Q[i]].second;
        }
        if(TL[txt] <= 0)
        {
            printf("%d\n",ans);
            continue;
        }
        for(int i = 0; i < G[txt].size(); i++)
        {
            if(G[txt][i].first == mem)
            {
                G[txt][i].second = 1;
                break;
            }
        }
        queue<int> que;
        que.push(mem);
        while(que.size())
        {
            int now = que.front();
            que.pop();
            TL[now]--;
            if(TL[now] == 0)
            {
                ans++;
                for(int i = 0; i < G[now].size(); i++)
                {
                    if(D[now] < D[G[now][i].first] && !G[now][i].second)
                    {
                        G[now][i].second = 1;
                        que.push(G[now][i].first);
                    }
                }
            }
        }
        printf("%d\n",ans);
    }
    return;
}

Measured memory_bytes: 15932
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

ll a[222222];
ll b[222222];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	vector<ll> vec;
	for(int i=0;i<n;i++)
	{
		cin>>b[i]; vec.pb(a[i]-b[i]);
	}
	sort(vec.rbegin(),vec.rend());
	int cnt=0; ll sum=0;
	for(int i=0;i<vec.size();i++)
	{
		if(vec[i]<0)
		{
			sum+=abs(vec[i]); cnt++;
		}
	}
	for(int i=0;i<vec.size();i++)
	{
		if(vec[i]>=0)
		{
			if(sum<=0){cout<<cnt<<'\n'; return 0;}
			sum-=vec[i]; cnt++;
		}
	}
	if(sum<=0){cout<<cnt<<'\n';}
	else cout<<-1<<'\n';
}


Measured memory_bytes: 2680
import numpy as np
s = input()
effects = [1, 10, 9, 12, 3, 4]
mod = 10**9+7

amari = np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
arrays = [np.eye(13, k=i, dtype=np.int64)+np.eye(13, k=i-13, dtype=np.int64) for i in range(13)]
brrays = [sum(arrays[c*effects[i]%13] for c in range(10)) for i in range(6)]
for i, c in enumerate(reversed(s)) :
    if c != "?" :
        c = int(c)
        array = arrays[c*effects[i%6]%13]
        amari = np.dot(amari, array)
    else :
        array = brrays[i%6]
        amari = np.dot(amari, array)%mod

print(amari[5])

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

using namespace std;

int which_max(long long a, long long b, long long c)
{
    if (a <= b && a <= c)
        return 0;
    else if (b <= c && b <= a)
        return 1;
    else
        return 2;
}

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

    int x, y, z, k;
    int ap = 0, bp = 0, cp = 0;
    cin >> x >> y >> z >> k;

    vector<long long> a(x);
    vector<long long> b(y);
    vector<long long> c(z);
    vector<long long> e(x * y);
    vector<long long> f(k * z);

    for (int i = 0; i < x; i++)
        cin >> a[i];
    for (int i = 0; i < y; i++)
        cin >> b[i];
    for (int i = 0; i < z; i++)
        cin >> c[i];

    for (int i = 0; i < x; i++)
    {
        for (int j = 0; j < y; j++)
        {
            e[i * y + j] = a[i] + b[j];
        }
    }
    sort(e.begin(), e.end(), greater<long long>());
    for (int i = 0; i < min(k, x*y); i++)
    {
        for (int j = 0; j < z; j++)
        {
            f[i * z + j] = e[i] + c[j];
        }
    }

    sort(f.begin(), f.end(), greater<long long>());

    for (int i = 0; i < k; i++)
    {
        cout << f[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 31616
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

ll lcm(ll a, ll b) {
	ll c;
	c = a * b / gcd(a, b);
	return c;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;


map<string, int> memo;

using P=pair<int, int>;




/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/

ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}

void comb(vector<vector <long long int> >& v) {
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}


int main() {
	vector<int> cnt(2019);
	cnt[0] = 1;
	string s;
	cin >> s;
	int p = 1, a = 0, ans = 0;
	for (int i = s.size() - 1; i >= 0; i--) {
		a = (a + (s[i] - '0') * p) % 2019;
		ans += cnt[a];
		cnt[a]++;
		p = (p * 10) % 2019;
	}
	cout << ans;
	return 0;
}










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

Measured memory_bytes: 256
from math import atan, degrees, pi
a, b, x = map(int, input().split())
if a*a*b/2 <= x:
    ans = atan((2*a*a*b - 2*x)/a**3)
else:
    ans = pi/2 - atan(2*x/(a*b*b))

print(degrees(ans))

Measured memory_bytes: 3060
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if A > B:
  T = -T

posA = A + V*T
posB = B + W*T


if T <= 0:
  if posA <= posB:
    print('YES')
  else:
    print('NO')
else:
  if posA >= posB:
    print('YES')
  else:
    print('NO')


Measured memory_bytes: 9184
import math
import sys
def mips():
    return map(int,input().split())
def msps():
    return map(str,input().split())
N,K = mips()
res = set()
for i in range(K):
    d = int(input())
    L = [el for el in mips()]
    for el in L:
        res.add(el)
print(N-len(res))

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

int main(){
    int n;cin>>n;
    vector<int> v(n),c(n);
    for(int i=0;i<n;i++)cin>>v[i];
    for(int i=0;i<n;i++)cin>>c[i];
    int x,y,ans=-1000000000;
    for(int i=0;i<(1<<n);i++){
        x=y=0;
        for(int j=0;j<n;j++){
            if(i & (1<<j))x+=v[j];
        }
        for(int j=0;j<n;j++){
            if(i & (1<<j))y+=c[j];
        }
        ans = max(ans, x-y);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define fr first
#define se second

void solve(ll cas){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max({a*d,a*c,b*c,b*d})<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll qu=1;
    // cin>>qu;
    for(ll cas=1;cas<=qu;cas++){
        solve(cas);
    }
}

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

int main(){
  string A, B, C;
  cin >> A >> B >> C;

  if(A.back() == B.front() && B.back() == C.front()){
    printf("%s\n", "YES");
  } else {
    printf("%s\n", "NO");
  }
}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    cout << (n - 2) * 180 << endl;
    return 0;
}


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

struct ans {
  int ans[4];
};
vector<ans> ls;
int h, w, u, d, l, r, cnt = 0;

int mp[505][505] = {0};
int x[4] = {1, 0, -1, 0};
int y[4] = {0, 1, 0, -1};

void solve();

int main() {
  int i, j;
  cin >> h >> w;
  for(i = 0; i < h; ++i)
    for(j = 0; j < w; ++j) cin >> mp[j][i];
  u = 1;
  d = h - 1;
  l = 0;
  r = w - 1;
  solve();
  cout << ls.size() << endl;
  for(i = 0; i < ls.size(); ++i) {
    for(j = 0; j < 4; ++j) {
      cout << ls[i].ans[j] + 1;
      if(j != 3) cout << " ";
    }
    cout << endl;
  }
  return 0;
}

void solve() {
  int nd = 0, nx = 0, ny = 0;
  if(w == 1) ++nd;
  bool ch = 0;
  ans in;
  while(1) {
    ++cnt;
    if(ch) {
      in.ans[2] = ny;
      in.ans[3] = nx;
      ls.push_back(in);
      ++mp[nx][ny];
      ch = 0;
    }
    if(mp[nx][ny] % 2 == 1) {
      in.ans[0] = ny;
      in.ans[1] = nx;
      ch = 1;
    }
    nx += x[nd];
    ny += y[nd];
    if(nd == 0 && nx == r) {
      --r;
      nd = 1;
    }
    if(nd == 1 && ny == d) {
      --d;
      nd = 2;
    }
    if(nd == 2 && nx == l) {
      ++l;
      nd = 3;
    }
    if(nd == 3 && ny == u) {
      ++u;
      nd = 0;
    }
    if(cnt == h * w) break;
  }
}


Measured memory_bytes: 5232
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
using namespace std;
vector<long long> divisor(long long n){//nの約数列挙
    vector<long long> res;
    for(long long i = 1; i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            if(i != n / i) res.push_back(n / i);
        }
    }
    return res;
}
long long gcd(long long x, long long y){
    if(x < y) swap(x, y);
    if( x % y == 0) return y;
    return gcd(y, x % y);
}
int main(){
    int N, K;
    cin >> N >> K;
    vector<long long> A(N);
    long long sum = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    long long g = 0;
    for(int i = 1; i < N; i++){
        if(i == 1) g = gcd(A[i], A[i - 1]);
        else g = gcd(g, A[i]); 
    }
    vector<long long> div = divisor(sum);
    sort(div.begin(), div.end());
    for(int i = 0; i < (int)div.size(); i++){
        long long mosum = 0;
        vector<int> mo;
        if(div[i] > g){
            for(int j = 0; j < N; j++){
                if(A[j] % div[i] != 0) {
                    mo.push_back(A[j] % div[i]);
                }
            }
            sort(mo.begin(), mo.end());
            vector<int> sm(mo.size() + 1, 0), smg(mo.size() + 1, 0);
            for(int j = 1; j < mo.size() + 1; j++){
                sm[j] = sm[j - 1] + mo[j - 1];
                smg[j] = smg[j - 1] + (div[i] - mo[j - 1]);
            }
            for(int j = 0; j < sm.size() + 1; j++){
                if(sm[j] == smg[smg.size() - 1] - smg[j]) {
                    mosum = sm[j];
                    break;
                }
            }
            if(mosum <= K) g = div[i];
        }
    }
    cout << g << endl;
}

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

typedef long long ll;

const ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}

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


    //大した量ではないので，先にfax[i]とifax[i]を全て計算しておく
    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<300000; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }

    long long pai = n/3;
    long long rev = n - (n/3)*3;

    long long ans = 0;

    while(pai > 0){
        ans += comb(pai-1 + rev, rev);
        ans %= M;
        pai --;
        rev += 3;
    }

    cout << ans << endl;

    

}



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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define MAX 100000

vector<pair<int, ll>> e[MAX];
vector<ll> x(MAX, 0);
vector<bool> b(MAX, false);
bool ok=true;

void dfs(int s){
	b[s]=true;
	for(int i=0; i<e[s].size(); i++){
		int r=e[s][i].first;
		ll d=e[s][i].second;
		if(b[r]){
			if(x[r]-x[s]!=d){
				ok=false;
			}
		}else{
			x[r]=x[s]+d;
			dfs(r);
		}
	}
	return;
}

int main(){
	int n, m;
	cin >> n >> m;
	tuple<int, int, ll> v[m];
	for(int i=0; i<m; i++){
		int l, r;
		ll d;
		cin >> l >> r >> d;
		l--; r--;
		e[l].push_back(make_pair(r, d));
		e[r].push_back(make_pair(l, -d));
	}

	for(int i=0; i<n; i++){
		if(!b[i]){
			dfs(i);
		}
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

ll r,c,k;
ll table[3000][3000];
ll dp[3000][3000][4];

int main(){
    cin >> r >> c >> k;
    for(ll i=0;i<k;i++){
        ll n,m,l;
        cin >> n >> m >> l;
        n--;
        m--;
        table[n][m]=l;
    }
    dp[0][0][1]=max(dp[0][0][1],dp[0][0][0]+table[0][0]);
    for(ll i=0;i<r;i++){
        for(ll j=0;j<c;j++){
            if(j+1<c){
                dp[i][j+1][3]=max({dp[i][j+1][3],dp[i][j][3],dp[i][j][2]+table[i][j+1]});
                dp[i][j+1][2]=max({dp[i][j+1][2],dp[i][j][2],dp[i][j][1]+table[i][j+1]});
                dp[i][j+1][1]=max({dp[i][j+1][1],dp[i][j][1],dp[i][j][0]+table[i][j+1]});
                dp[i][j+1][0]=max(dp[i][j+1][0],dp[i][j][0]);
            }
            if(i+1<r){
                for(ll k=0;k<4;k++){
                    dp[i+1][j][0]=max(dp[i][j][k],dp[i+1][j][0]);
                }
                dp[i+1][j][1]=max(dp[i+1][j][1],dp[i+1][j][0]+table[i+1][j]);
            }
        }
    }
    ll res=0;
    for(ll k=0;k<4;k++){
        res=max(res,dp[r-1][c-1][k]);
    }
    cout << res << endl;
    return 0;
}

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

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

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    swap(a,b);
    swap(a,c);
    printf("%d %d %d\n",a,b,c);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int r = sc.nextInt();
		int d = sc.nextInt();
		int x = sc.nextInt();

		// 計算
		int result = x;
		for(int i = 1; i <= 10; i++){
		    result = result * r - d;
		    System.out.println(result);
		}
		
		// 出力
		//System.out.println(result);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
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;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    int h,w,a,b;
    cin >>h >> w >> a >> b;
    REP(i,b){
        REP(i,a) cout << 1;
        REP(i,w-a) cout << 0;
        cout << endl;
    }
    REP(i,h-b){
        REP(i,a)cout << 0;
        REP(i,w-a) cout << 1;
        cout << endl;
    }
}

Measured memory_bytes: 1280
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
	int a,b,c,v;
	String s = buf.readLine();
	String[] strlAry =s.split(" ");
	for(int i=0;i<strlAry.length;i++){
	}
	a= Integer.parseInt(strlAry[0]);
	b= Integer.parseInt(strlAry[1]);
	c= Integer.parseInt(strlAry[2]);

	if(a<b){
		if(b<c){
			System.out.println(a+" "+b+" "+c);
		}
		else{
			System.out.println(c+" "+a+" "+b);
		}
	}
	else if(b<c){
		if(c<a){
			System.out.println(b+" "+c+" "+a);
		}
		else{
			System.out.println(b+" "+a+" "+c);
		}
	}
	else{
		if(a<c){
			System.out.println(a+" "+c+" "+b);
		}
		else{
			System.out.println(c+" "+b+" "+a);
		}
	}
	}
}

Measured memory_bytes: 16896
#include <cstdlib>
#include <iterator>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <functional>
using namespace std;

int main() {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    transform(s1.begin(), s1.end(), s1.begin(), ::toupper);
    transform(s2.begin(), s2.end(), s2.begin(), ::toupper);
    transform(s3.begin(), s3.end(), s3.begin(), ::toupper);
    cout << s1[0] << s2[0] << s3[0] << endl;
}


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

using namespace std;

int nC2(int n){
    if(n <= 0)return 0;
    return n * (n - 1 ) / 2;
}

int main() {
    int n , m; scanf("%d %d", &n, &m);
    printf("%d\n", nC2(n)  + nC2(m));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <iostream>
//#include <vector>
//#include <string>
//#include <iomanip>
//#include <ctime>


using namespace std;

#define pb push_back
#define mp make_pair
#define eb emplace_back


typedef long long ll;
typedef long double ld;


const ll inf = 2e9;
const ll base = 998244353;
ll mod = 1e9 + 7;



int main() {
//    srand(time(NULL));
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
//    std::random_device rd;
//    std::mt19937 g(rd());
    auto start = clock();


    int n; cin >> n;
    map<string, int> cnt;
    int last = 0;
    for (int i = 0; i < n; ++i) {
        string s; int t; cin >> s >> t;
        cnt[s] = last + t;
        last += t;
    }
    string s; cin >> s;
    cout << last - cnt[s] << endl;

    std::cerr << double(clock() - start) / CLOCKS_PER_SEC << std::endl;
    return 0;
}

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

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

#define f first
#define s second
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define forn(i, n) for(register int i=0; i<n; i++)
#define Forn(i, n) for(register int i=1; i<=n; i++)
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define Foreach(it, a) for(__typeof((a).rbegin()) it=(a).rbegin(); it!=(a).rend(); it++)

inline int in()
{
    char c=getchar();
    int neg=1, x=0;
    while(!isdigit(c)) (c=='-')?neg=-1, c=getchar():c=getchar();
    while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48), c=getchar();
    return neg*x;
}
inline int lcm(int a, int b){return a*b/__gcd(a, b);}

string t;
int cnt;

int main()
{
    cin>>t;
    foreach(it, t) cnt+=*it=='o';
    if(cnt+(15-t.size())>=8) puts("YES");
    else puts("NO");
    return 0;
}

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

long long N, A[1 << 18], maxn = -(1LL << 60);

long long solve(int pos) {
	if ((N - 1) % pos == 0) {
		vector<long long> E;
		for (int i = 0; i <= N - 1; i += pos) E.push_back(A[i]);

		int cl = 0, cr = E.size() - 1; long long val = 0, maxv = -(1LL << 60);
		while (cl < cr) {
			val += E[cl] + E[cr]; cl++; cr--;
			maxv = max(maxv, val);
		}
		return maxv;
	}
	else {
		long long B = (N - 1) % pos;
		vector<long long> E1, E2;
		for (int i = 0; i <= N - 1; i += pos) E1.push_back(A[i]);
		for (int i = B; i <= N - 1; i += pos) E2.push_back(A[i]);

		long long val = 0, maxv = 0;
		for (int i = 0; i < (int)E1.size() - 1; i++) val += E1[i];
		for (int i = 1; i < (int)E2.size(); i++) val += E2[i];
		maxv = val;

		for (int i = 0; i < (int)E1.size() - 1; i++) {
			val -= E1[E1.size() - 2 - i];
			val -= E2[i + 1];
			maxv = max(maxv, val);
		}
		return maxv;
	}
}

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

	// A - B を全探索
	for (int i = 1; i <= N; i++) {
		long long val = solve(i);
		maxn = max(maxn, val);
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 2312
import std.stdio, std.string, std.array, std.algorithm, std.conv, std.typecons, std.numeric, std.math;

void main()
{
    for (;;) {
        auto H = readln.chomp.to!int;
        if (H == 0) return;

        int[][] MAP;
        MAP.length = H;
        foreach (i; 0..H) MAP[i] = readln.split.to!(int[]);

        auto changed = true;
        int r;
        while (changed) {
            foreach (i; 0..H) {
                foreach_reverse (l; 3..6) {
                    foreach (x; 0..6-l) {
                        foreach (j; x+1..x+l) if (MAP[i][x] != MAP[i][j]) goto ng;
                        r += MAP[i][x] * l;
                        foreach (j; x..x+l) MAP[i][j] = 0;
                        goto ok;
                        ng:
                    }
                }
                ok:
            }
            changed = false;
            foreach_reverse (i; 0..H) {
                foreach (j; 0..5) {
                    if (MAP[i][j] == 0) {
                        foreach_reverse (k; 0..i) if (MAP[k][j] > 0) {
                            changed = true;
                            MAP[i][j] = MAP[k][j];
                            MAP[k][j] = 0;
                            break;
                        }
                    }
                }
            }
        }
        writeln(r);
    }
}


Measured memory_bytes: 3104
#include <iostream>

using namespace std;

int main(){

   int n;

   cin >> n;

   int a[n];

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

   for(int i = n ; i > 0; i--){
      if(i != n){
         cout << " ";
      }
      cout << a[i - 1];
   }

   cout << endl;

   return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<Pll> p(N);
    rep(i,N){
        ll x,l; cin >> x >> l;
        p[i]={x-l,x+l};
    }
    sort(all(p));
    int cnt=0;
    priority_queue<int> pq;
    rep(i,N){
        if (!pq.empty()&&pq.top()<=p[i].first) pq.pop();
        pq.push(p[i].second);
        if (pq.size()>1) pq.pop(),++cnt;
    }
    cout << N-cnt << endl;
}

Measured memory_bytes: 1792
from collections import deque
r, c = map(int, input().split())
 
orig_maze = [[val for val in list(input())] for _ in range(r)]

maze = [[None for _ in range(c+2)] for _ in range(r+2)]
for r_index in range(r+2):
  for c_index in range(c+2):
    if r_index == 0 or r_index == r+1 or c_index == 0 or c_index == c+1:
      maze[r_index][c_index] = "#"
    else:
      maze[r_index][c_index] = orig_maze[r_index-1][c_index-1]
      
def wfs(queue):
    finish_dist = None
    max_way = 0
    while len(queue) > 0:
        a = queue.popleft()
        y = a[0]
        x = a[1]
        count = a[2]
        if checked_maze[y][x]:
            continue
        
        checked_maze[y][x] = True
        if not maze[y][x] == "#":
            max_way = count
            count += 1
            queue.append((a[0]+1, a[1], count))
            queue.append((a[0]-1, a[1], count))
            queue.append((a[0], a[1]+1, count))
            queue.append((a[0], a[1]-1, count))

    return max_way 
 
if __name__ == "__main__":
    result = 0
    
    for s_y in range(1, r+1):
      for s_x in range(1, c+1):
        checked_maze = [[None for _ in range(c+2)] for _ in range(r+2)]
        que = deque()
        checked_maze[s_y][s_x]= 0
        que.append((s_y, s_x, 0))
        finish_dist = wfs(que)
        result = max(result,finish_dist)
    print(result)

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

int main(){
   
      ll a,b,c,x,r,tmp,n; 
      cin >> a>>b;
      x=a*b;
      if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
  /* 最小公倍数を出力 */
  cout << x/b << endl;
 
  
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
typedef vector<int> vit;
typedef vector<vit> vitt;
typedef vector<lld> vlt;
typedef vector<vlt> vltt;
typedef vector<pi> vpit;
typedef vector<vpit> vpitt;
typedef long double ld;
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mk(a,b) make_pair(a,b)
bool isrange(int y,int x,int n,int m){
	 if(0<=y&&y<n&&0<=x&&x<m) return true;
	 return false;
}
int dy[4] = {1,0,-1,0},dx[4]={0,1,0,-1},ddy[8] = {1,0,-1,0,1,1,-1,-1},ddx[8] = {0,1,0,-1,1,-1,1,-1};
lld dp[3333][3333][4];
lld arr[3333][3333];
int main(void){
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	for(int e=0;e<k;e++){
		int x,y;
		lld c;
		scanf("%d%d%lld",&y,&x,&c);
		y--;x--;
		arr[y][x] = c;
	}
	for(int e=0;e<n;e++){
		for(int p=0;p<m;p++){
			if(arr[e][p]) dp[e][p][1] = arr[e][p];
			if(e){
				lld mm = 0;
				for(int q=0;q<=3;q++) mm = max(mm,dp[e-1][p][q]);
				dp[e][p][0] = max(dp[e][p][0],mm);
				if(arr[e][p]) dp[e][p][1] = max(dp[e][p][1],mm+arr[e][p]);
			}
			if(p){
				for(int q=0;q<=3;q++){
					lld vv = dp[e][p-1][q];
					dp[e][p][q] = max(dp[e][p][q],vv);
				}
				if(arr[e][p]){
					for(int q=0;q<3;q++){
						lld vv = dp[e][p-1][q] + arr[e][p];
						dp[e][p][q+1] = max(dp[e][p][q+1],vv);
					}
				}
			}
		}
	}
	lld ans = 0;
	for(int e=0;e<=3;e++) ans = max(ans,dp[n-1][m-1][e]);
	printf("%lld",ans);
	return 0;
}


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

int f(int n) {
  if (n % 2 == 0) {
    return n / 2;
  } else {
    return 3 * n + 1;
  }
}

int main() {
  int s, i, a = 0, b = 0;
  cin >> s;

  if (s != 1 && s != 2) {
    for (i = 1; i <= 1000000; i++) {
      if (s == 4 && a == 0) {
        a = i;
      }
      s = f(s);
      if (s == 4 && a != 0) {
        b = i + 1;
        break;
      }
    }
  } else if (s == 1) {
    for (i = 1; i <= 1000000; i++) {
      if (s == 1 && a == 0) {
        a = i;
      }
      s = f(s);
      if (s == 1 && a != 0) {
        b = i + 1;
        break;
      }
    }
  } else {
    for (i = 1; i <= 1000000; i++) {
      if (s == 2 && a == 0) {
        a = i;
      }
      s = f(s);
      if (s == 2 && a != 0) {
        b = i + 1;
        break;
      }
    }
  }
  cout << b << "\n";
  return 0;
}

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

using namespace std;
using ll = long long;


int main()
{
    map<int,int> mp;
    for(int i = 0; i < 3; i++){
        int a, b; cin >> a >> b; mp[a]++; mp[b]++;
    }
    int cn1 = 0, cn2 = 0;
    for(auto i : mp) {
        cn1 += i.second == 1;
        cn2 += i.second == 2;
    }
    cout << (cn1 == 2 && cn2 == 2 ? "YES" : "NO") << endl;
}

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

using namespace std;

int arr[200005], pos[200005];
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> arr[i];
        pos[arr[i]] = i;
    }
    set <int> s;
    long long res = 0;
    s.insert(0);
    s.insert(n + 1);
    for (int i = 1; i <= n; i++) {
        auto x = s.lower_bound(pos[i]);
        int l, r;
        r = *x;
        l = *(--x);
        res += 1LL * i * (r - pos[i]) * (pos[i] - l);
        s.insert(pos[i]);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#define N 10001
using namespace std;
int main(){
  int n,prime[N],cnt,i,j;
  for(i=0;i<N;i++) prime[i]=1;
  prime[0]=prime[1]=0;
  for(i=0;i<N;i++){
    if(prime[i]==1){
      for(j=i*2;j<N;j+=i){
	prime[j]=0;
      }
    }
  }
  while(cin >> n){
    cnt=0;
    for(i=1,j=n;i<=n;i++,j--){
      if(prime[i]==1&&prime[j]==1) cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}

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

YES = "Yes"  # type: str
NO = "No"  # type: str


def is_multi_line(S: str):
    if len(set(S)) != 1:
        return True
    else:
        return False


def main():
    S = input()  # type: str
    print(YES if is_multi_line(S) else NO)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
/**
*    created: 02.07.2020 00:01:55
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const int MOD = 1000000007;
// const int MOD = 998244353;
const long double pi = acos(-1.0);
const int INF = 1LL << 60;

signed main() {

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

    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;

    if (s.size() != a + b + 1) {
        cout << "No" << endl;
        return 0;
    }

    auto ctoi = [&] (char c) {
        if (c >= '0' && c <= '9') return c - '0';
	    return -1;
    };
    
    rep(i,a) {
        if (ctoi(s[i]) == -1) {
            cout << "No" << endl;
            return 0;
        }
    }

    if (s[a] != '-') {
        cout << "No" << endl;
        return 0;
    }

    rep2(i,a+1,a+b) {
        if (ctoi(s[i]) == -1) {
            cout << "No" << endl;
            return 0;
        }
    }
    
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
 
//long long
using ll = long long;
 
// pair<int, int>
using PII = pair<int, int>;
 
//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
 
//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()
 
//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
 
//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
 
// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}
 
// a = max(a, b), a = min(a, b)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
// 階乗(MODをとる)
ll pow_mod(ll num, ll pow, ll mod) {
    ll prod = 1;
    num %= mod;
    while (pow > 0) {
        if (pow & 1) prod = prod * num % mod;
        num = num * num % mod;
        pow >>= 1;
    }
    return prod;
}
 
 
 
// 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度)
// COMinit()
// COM(x, y)
// とコンビで使う
 
// テーブルを作る前処理
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
 
int main(){
  ll N;
  cin >> N;
  vector<ll>a(N);
  map<ll, ll>mp;
  REP(i, N) {
    cin >> a[i];
    mp[a[i]]++;
  }
  
  ll sum = 0;
  for(auto x : mp){
    REP(i, x.second) sum += i;
  }
 
  REP(i, N){
    ll ans = sum - (mp[a[i]] - 1);
    print(ans);
  }
return 0;
 
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }eni(!=) cerr  << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
} sim dor(rge<c> d) { *this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
#define err(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll=long long;
using vi=vector<int>;



int main() {
    ios::sync_with_stdio(false) , cin.tie(0);
    string s, t;
    cin >> s >> t;
    int n = sz(s) , m = sz(t);
    vector < vi > dp(n + 1, vi(m + 1));
    for(int i = 0; i <=n; i++)
    for(int j = 0; j <=m; j++){
        if(i==0 || j==0)continue;
        if(s[i - 1]==t[j - 1]){
            dp[i][j] = 1 + dp[i - 1][j - 1];
        }
        else{
            dp[i][j] =  max( dp[i - 1][j] , dp[i][j - 1] );
        }
    }
//    cerr << dp[n][m] << '\n';
    string answer = "";
    int i = n , j = m;
    while(i > 0 && j > 0){
        if(s[i - 1]== t[j - 1])
            answer.push_back(s[i - 1]) , i-- , j--;
        else{
            if( dp[i - 1][j] > dp[i][j - 1] )i--;
            else j--;
        }
    }
    reverse(answer.begin() , answer.end());
    cout << answer << '\n';

    return 0;
}



Measured memory_bytes: 37120
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)

const int INF = 100000000;

using namespace std;


int main() {
	string s;
	cin >> s;
	cin >> s;
	cout << "A" << s[0] << "C" << endl;

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        cnt = 0
        for dx in range(-1, 2):
            for dy in range(-1, 2):
                if 0 <= i + dy < H and 0 <= j + dx < W and S[i + dy][j + dx] == '#':
                    cnt += 1
        S[i][j] = str(cnt)

for si in S:
    print(''.join(si))


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;
const ll MOD = 1e9 + 7;


int main() {
    int n; cin >> n;
    V<int> v(n + 1);
    int sum = 0;
    for(int i = 1; i <= n; i++){
        int a; cin >> a;
        v[i] = a;
        sum += a;
    }

    if(v[0] == 1 && sum % 2 != 0){
        cout << -1 << endl;
        return 0;
    }

    V<int> ans(n + 1, 0);
    int cnt = 0;
    for(int i = n; i > 0; i--){
        int sum = 0, j = i;
        while(j <= n){
            sum += ans[j];
            j += i;
        }
        if((v[i] && sum % 2 == 0) || (v[i] == 0 && sum % 2 != 0)){
            ans[i]++;
            cnt++;
        }
    }

    V<int> ans2;
    for(int i = 1; i <= n; i++){
        if(ans[i]) ans2.push_back(i);
    }
    cout << cnt << endl;
    for(int i = 0; i < (int)ans2.size(); i++){
        if(i != (int)ans2.size() - 1) cout << ans2[i] << " ";
        else cout << ans2[i] << endl;
    }
}


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int a,b,x;
  cin >> a >> b >> x;
  if(a<=x && x<=a+b) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	A := make([][]int, 2)
	A[0] = sc.NextIntArray()
	A[1] = sc.NextIntArray()

	dp := make([][]int, 2)
	for i := 0; i < 2; i++ {
		dp[i] = make([]int, N)
	}
	dp[0][0] = A[0][0]
	for i := 1; i < N; i++ {
		dp[0][i] = dp[0][i-1] + A[0][i]
	}
	dp[1][0] = dp[0][0] + A[1][0]
	for i := 1; i < N; i++ {
		dp[1][i] = max(dp[0][i], dp[1][i-1]) + A[1][i]
	}

	fmt.Println(dp[1][N-1])
}

func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

using namespace std;

// Header files, namespaces,
// macros as defined above
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>


#define f first
#define s second
#define db long double
#define pb push_back
#define sz(c) (c).size()
#define all(c) (c).begin(),(c).end()

typedef long long ll;
typedef pair <int , int> ii;
typedef pair <ii , int> iii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <iii> viii;
typedef vector <vi> vvi;
typedef vector <vii> vvii;

const ll mod = 1e9+7;
const int MAXN = 1e4+5;
const int MAXK = 1e2+5;
const db eps = 1e-13;

int memo[MAXN][MAXK], n , k;
string num;
int dp( int pos , int sum , int d , bool ok ) {

    if( !ok && (d > (num[pos]-48)) )
        return 0;

    if( pos == (n-1) ) {
        return sum==0;
    }


    ok |= (d < (num[pos]-48));
    int &res = memo[pos][sum];

    if( ok && res != -1 )
        return res;

    res = 0;

    for( int dig = 0; dig < 10 ; dig++ ) {
        res = ( res + dp( pos+1, (sum + dig)%k , dig , ok ) ) % mod;
    }

    return res;
}


int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
    cout<<setprecision(11)<<fixed;
    memset( memo , -1 , sizeof memo );
    cin>>num;
    n = sz(num);
    cin>>k;

    int ans = 0;
    for( int dig = 0 ; dig < 10 ; dig++ )
        ans = ( ans + dp( 0 , dig%k , dig , false ) )%mod;
    cout<<( ans - 1 + mod ) % mod<<"\n";
}
/*
10
8 5
10 8
6 5
1 5
4 8
2 10
3 6
9 2
1 7
*/

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

int gcd(int a, int b){
    if(b == 0)
        return a;
    return gcd(b , a%b);
    
}

int main(void){
    int x, y;
    cin >> x >> y;
    cout << gcd(x,y) << endl;
    return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int; //任意長整数 
using Real32 = mp::number<mp::cpp_dec_float<32>>;
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
using Rat = boost::rational<Bint>;//有理数*/
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
  int n,m,ans;
  cin>>n>>m;
  ans=pow(2,m)*(100*n+1800*m);
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 10;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif 


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


    int X, Y, Z, K; cin >> X >> Y >> Z >> K;
    vl A(X); REP(i, X) cin >> A[i];
    vl B(Y); REP(i, Y) cin >> B[i];
    vl C(Z); REP(i, Z) cin >> C[i];
    sort(A.begin(), A.end(), greater<ll>());
    sort(B.begin(), B.end(), greater<ll>());
    sort(C.begin(), C.end(), greater<ll>());

    vl ans;
    REP(i,X) {
        if ((i + 1) > K) break;
        REP(j,Y) {
            if ((i + 1) * (j + 1) > K) break;
            REP(k,Z) {
                if ((i + 1) * (j + 1) * (k + 1) > K) break;

                ans.push_back(A[i] + B[j] + C[k]);                    
            }
        }
    }
    sort(ans.begin(), ans.end(), greater<ll>());

    REP(i,K) cout << ans[i] << endl;    

    return 0;
}

Measured memory_bytes: 1404