akhauriyash/Code-Regression huggingface dataset:
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;
#define SORTVL(v) sort(v.begin(), v.end());
#define SORTVL_GR(v) sort(v.begin(), v.end(), greater<LL>());

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a % b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }
// 桁和
LL Ketawa_s(string s) { LL a = 0; FOR(i, 0, s.length())a += s[i] - '0'; return a; }
// 末尾数字で切り上げ
LL CeilLastNumber(LL n) { return ((n + (10 - 1)) / 10) * 10; }
//二項係数 nCk mod pを求める
const LL MAX = 510000, p = 998244353; LL fac[MAX], finv[MAX], inv[MAX];
/* 前処理 */void COM_init() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; FOR(i, 2, MAX) { fac[i] = fac[i - 1] * i % p; inv[i] = p - inv[p % i] * (p / i) % p; finv[i] = finv[i - 1] * inv[i] % p; } }
/* 主処理 */LL 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] % p) % p; }

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int dxx[8] = { 0,1,1,1,0,-1,-1,-1 };
int dyy[8] = { 1,1,0,-1,-1,-1,0,1 };

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

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL N, A, B;
	cin >> N >> A >> B;

	O(min(N * A, B));

	return 0;
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            string[] strB = s.Split(' '), strS = s.Split(' ');


            BubbleSort(strB,n);
            Console.WriteLine( "Stable");

            SelectionSort(strS,n);
            isStable(strB, strS, n);

        }

        static void BubbleSort(string [] str, int n)
        {
            int p1 = 0, p2 = 0;

            for (int i = 0; i < n; i++)
            {
                p1 = p2;
                for (int j = n - 1; j > p1; j--)
                    if (int.Parse(str[j - 1][1].ToString()) > int.Parse(str[j][1].ToString())) { string tmp = str[j]; str[j] = str[j - 1]; str[j - 1] = tmp; p2 = j; }
                if (p1 == p2) break;
            }

            Console.WriteLine(string.Join(" ", str));
        }
         static void SelectionSort(string[] str, int n)
        {
            for (int i = 0; i < n; i++)
            {
                int mini = i;
                for (int j = i + 1; j < n; j++)
                    if (int.Parse(str[j][1].ToString()) < int.Parse(str[mini][1].ToString())) mini = j;
                if (i != mini) { string tmp = str[i]; str[i] = str[mini]; str[mini] = tmp; }
            }
            Console.WriteLine(string.Join(" ", str));
        }

        static void isStable(string [] x, string [] y, int n)
        {
            bool stable = true;

            for(int i=0;i<n;i++)
            {
                if (x[i] != y[i]) stable = false;
            }
            Console.WriteLine(stable?"Stable":"Not stable");
        }
    }
}

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

int main(){
  string s,p;
  int n;
  cin >> s;
  n = s.size();  
  for (int i = 0; i < n; i++){
    if (s.at(i) == '0'){
      p = p +'0';
    }
    else if(s.at(i) == '1') {
      p = p + '1';
    }
    else if(!p.empty()){
      p = p.erase(p.size()-1);
    }
  }
  
  cout << p << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<queue>
using namespace std;
 
typedef long long i64;
#define put(n) cout<<(n)<<"\n"
#define FOR(i,num,N) for(int(i)=(num);(i)<(N);(i)++)
#define RFOR(i,num,N) for(int (i)=(num);(i)>=(N);(i)--)
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()
 
int main(){
    int N,Y; cin>>N>>Y;
    int yukichi = -1;
    int higuchi = -1;
    int noguti = -1;
    
    for(int i=0;i<=N;i++){
        int x = 10000*i;
        for(int j=0;j<=N-i;j++){
            int y = 5000*j;
            int z = 1000*(N-i-j);
            if(x+y+z == Y){
                yukichi = i;
                higuchi = j;
                noguti = N-i-j;
            }
           
        }
    }
    
    cout<<yukichi<<" "<<higuchi<<" "<<noguti<<endl;
    
}

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

int main(){
  int n,i;
  cin>>n;
  tuple<string,int,int>t[n];
  for(i=0;i<n;i++){
    string s;
    int p;
    cin>>s>>p;
    t[i]=make_tuple(s,-p,i);
  }
  sort(t,t+n);
  for(i=0;i<n;i++){
    cout<<get<2>(t[i])+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
static const int MAX = 1000000007;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
    int n, a, b;
    long long ans = 1, c = 1;
    cin >> n >> a >> b;

    int j = n;
    while(j > 0){
        if(j > 30){
            ans *= 1024 * 1024 * 1024 % MAX;
            ans = ans % MAX;
            j -= 30;
        }
        else{
            ans *= 2;
            j--;
        }
    }
    ans--;

    for(int i = n; i > n-a; i--){
        c = (c * i) % MAX;
    }
    long long d = c;
    for(int i = n-a; i > n-b; i--){
        d = (d * i) % MAX;
    }
    long long e = 1;
    for(int i = 1; i <= a; i++){
        e = (e * modinv(i, MAX)) % MAX;
    }
    c = (c*e) % MAX;

    for(int i = a+1; i <= b; i++){
        e = (e * modinv(i, MAX)) % MAX;
    }
    d = (d*e) % MAX;

    ans = (ans - c - d) % MAX;
    if(ans < 0)ans += MAX;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define    common(a,b)      SORT(a), SORT(b), a.erase(set_intersection(all(a),all(b),a.begin()),a.end())
#define    uncommon(a,b)    SORT(a), SORT(b), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end())
#define    minv(v)         *min_element(all(v))
#define    maxv(v)         *max_element(all(v))
#define    SORT(v)          sort(all(v))
#define    REV(x)           reverse(x.begin(),x.end())
#define    all(x)           x.begin(), x.end()
#define    rev(v)           reverse(all(v))
#define    unq(v)           sort(all(v)),v.erase(unique(all(v)),v.end())
#define    fr(i,x,n)        for(int i=x;i<n;i++)
#define    trav(a,x)        for (auto &a: x)
#define    sz(x)            (ll)(x).size()
#define    ll               long long int
#define    pb               push_back
#define    in               insert
#define    gcd(a, b)        __gcd(a, b)
#define    lcm(a, b)        ((a)*((b)/gcd(a,b)))
#define    w(t)              cin>>t;while(t--)
const ll mod = 1000000007;
const double pi = acos(-1.0);
/*bool isprime(int x)
{
    if(x==0 or x==1)return false;
    for(int i=2; i*i<=x; i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}*/
/*ll power(ll n,ll b,ll mod)
{
    ll res=1;
    while(b)
    {
        if(b%2)res=((n%mod)*(res%mod))%mod,b--;
        else n=((n%mod)*(n%mod))%mod,b/=2;
    }
    return res;
}*/
string str[]= {"YES","NO"};
bool cmp(int a,int b)
{
    return to_string(a)+to_string(b)>to_string(b)+to_string(a);
}
int main()
{
    _ios
    //ll z;
    // w(z)
    //{
    ll n,a,b,c,d,e,y,cn=0,cn1=0,cn2=0,sm=0,sm1=0,sm2=0,mx=0,mxx=0,mn=INT_MAX,i,j,k;
    string s,ss,sss;
    set<ll>st;
    bool f=true,ff=true;
    //cin>>a>>b>>c;
    
    cin>>a;
    ll ar[a];
    fr(i,0,a)cin>>ar[i];
    fr(i,0,a-2)
    {
        fr(j,i+1,a-1)
        {
            if(ar[i]==ar[j])continue;
            else
            {
                fr(k,j+1,a)
                {
                    if(ar[j]==ar[k] or ar[i]==ar[k])continue;else
                    {
                        if(ar[i]+ar[j]>ar[k] and ar[i]+ar[k]>ar[j] and ar[j]+ar[k]>ar[i])cn++;
                    }
                }
            }
        }
    }
    cout<<cn<<endl;
    /*if(a%2==0 and sqrt(a)*sqrt(a)!=a)
       cout<<min(a%2,a/2)<<endl;
      else
          cout<<max(a%2,a/2+1)<<endl;*/
    // }
    return 0;
}


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

int main(){
    ll h,n;
    cin>>h>>n;
    vector<pair<ll,ll>> v(n);
    ll maxa=0;
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        v[i]=make_pair(a, b);
        maxa=max(maxa,a);
    }
    V dp(h+maxa+1,1e9);
    dp[0]=0;
    rep(i,h+maxa+1){
        rep(j,n){
            if(i+v[j].first>h+maxa)continue;
            dp[i+v[j].first]=min(dp[i+v[j].first],dp[i]+v[j].second);
        }
    }
    ll ans=1e9;
    for(ll i=h;i<=h+maxa;i++){
        ans=min(ans,dp[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

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

void YN(bool ans){
    if(ans)cout<<"Yes"<<endl;
    else cout <<"No"<<endl;
    return;
}

int main(){
    string S;
    cin>>S;
    bool ans = false;
    rep(i,0,3){
        if(S[i] == '7')ans = true;
    }
    YN(ans);
    return 0;
}

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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 1000000000000000000;
double PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

int main(){
  ll N,X;
  cin >> N >> X;
  vector<ll> ans(2*N-1);
  for(int i = 0;i < 2 * N - 1;i++){
    ans[i] = i + 1;
  }
  if(X == 1 || X == 2 * N - 1){
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  if(N == 2){
    cout << 1 << endl;
    cout << 2 << endl;
    cout << 3 << endl;
  }else{
    if(X == 2){
      swap(ans[N],ans[1]);
      swap(ans[N-1],ans[0]);
    }else{
      swap(ans[N],ans[X]);
      swap(ans[N-2],ans[X-2]);
      swap(ans[N-1],ans[X-1]);
      
      swap(ans[N+1],ans[X-3]);
    }
    for(int i = 0;i < 2 * N - 1;i++){
      cout << ans[i] << endl;
    }
  }
}

Measured memory_bytes: 3072
#include <iostream>
#include <algorithm>
using namespace std;
#define REP(i,n)    for(int i = 0; i < (int)n; i++)

int main(){
    int ans = 0;
    int n;
    cin >> n;
    int a[n], b[n];
    REP(i,n-1)
        cin >> b[i];
    a[0] = b[0];
    ans += a[0];
    REP(i,n-2){
        a[i + 1] = min(b[i],b[i+1]);
        ans += a[i + 1];
    }
    ans += b[n - 2];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

n = INT()
a = LIST()
b = Counter(a)
c = sorted(list(set(a)), reverse=True)
ans = []
for i in c:
    if b[i] >= 2:
        ans.append(i)
    if b[i] >= 4:
        ans.append(i)
    if len(ans) >= 2:
        break
debug(ans)
if len(ans) >= 2:
    print(ans[0] * ans[1])
else:
    print(0)

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

int main(){
    string a, b;
    cin >> a >> b;

    if(a == "H"){
        if(b == "H"){
            cout << "H" << endl;
        } else if(b == "D"){
            cout << "D" << endl;
        }
    } else if(a == "D"){
        if(b == "H"){
            cout << "D" << endl;
        } else if(b == "D"){
            cout << "H" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <utility>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S, T; cin >> S; cin >> T;
  for (int i = 0; i < S.length(); i++) {
    int s = 0;
    for (int j = 0; j < S.length(); j++) {
      s += (S[(i+j)%S.length()] == T[j]);
    }
    if (s == S.length()) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,K;
  cin>>N>>K;
  bool CAN[10];
  REP(i,10) CAN[i]=false;
  REP(i,K){
    ll a;
    cin>>a;
    CAN[a]=true;
  }
  
  for(ll i=N; i<=11*N; ++i){
    ll it=i;
    bool can=true;
    while(it>0){
      if(CAN[it%10]==true) can=false;
      it/=10;
    }
    if(can){
      co(i);
      return 0;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3636
// ConsoleApplication2.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;




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

	sort(a.begin(), a.end(), greater<int>());

	for (int i = 0; i < N; i++) {
		if (i % 2 == 0) {
			alice += a[i];
		}
		else {
			bob += a[i];
		}
	}

	cout << alice - bob << endl;
	
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

const int mod = 1000000007;

struct mint {
    long long x;
    mint(long long x=0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n) : fact(n+1), ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i] * i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n-k];
    }
};
// combination c(max);
// mint c(n, k)

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

    int x, y;
    cin >> x >> y;
    int z = x+y;
    mint ans = 0;
    combination c(z/3);
    if (z % 3 == 0 && y <= 2*x && x <= 2*y) ans = c(z/3, x-z/3);
    cout << ans << endl;
}


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

int main()
{
  char S[120];
  cin >> S;
  char T[120];
  cin >> T;
  char rotation[120];
  int len = strlen(S);
  bool res = false;
  for(int i=0;i<len;i++)
  {
    if(S[i] == T[0])
    {
      int k = i;
      for(int j=0;j<len;j++)
      {
        if(T[j] == S[k]) res = true;
        else
        {
          res = false;
          break;
        }
        k++;
        if(len <= k)
        {
          k=0;
        }
      }
      if(res == true) break;
    }
  }
if(res == true) cout << "Yes" << endl;
else cout << "No" << endl;
}


Measured memory_bytes: 256
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	s = input()
	ii = (len(s) == len(list(set(list(s)))))
	return 'yes' if ii else 'no'
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 38256
def main():
    h,w,k = map(int,input().split())
    maze = [['.' for j in range(6)] for i in range(6)]


    for i in range(h):
        line = list(input())
        for j in range(w):
            maze[i][j] = line[j]
    
    # print(maze)

    ver = [0 for i in range(6)]
    hor = [0 for i in range(6)]
    horver = [[0 for i in range(6)] for j in range(6)]
    total = 0
    for i in range(6):
        for j in range(6):
            if maze[i][j] == '#':
                ver[j] += 1
                hor[i] += 1
                horver[i][j] = 1
                total += 1
    # print(ver,hor,horver)

    ans = 0
    for bit in range(2**(h+w)):
        tmp = total
        valid_hor = []
        for i in range(h):
            if (bit >> i & 1) == 1:
                valid_hor.append(i)
                tmp -= hor[i] 
        
        for j in range(h,h+w):
            if (bit >> j & 1) == 1:
                tmp -= ver[j-h]
                for i in valid_hor:
                    tmp += horver[i][j-h]
    
        if tmp == k:
            ans += 1

    print(ans)
    return 

if __name__ == '__main__':
    main()

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

struct Node{
    int key;
    Node *lch,*rch;
    Node(int key):key(key),lch(nullptr),rch(nullptr){}
};

class BinarySearchTree
{
 private:
    Node* root;
 public:
    BinarySearchTree():root(nullptr){}
    void insert(int key){
        if(root==nullptr) root=new Node(key);
        else root=insert(root,key);
    }
    Node* insert(Node* cur,int key){
        if(cur==nullptr) return new Node(key);

        if(key<cur->key) cur->lch=insert(cur->lch,key);
        else cur->rch=insert(cur->rch,key);
        return cur;
    }
    Node* find(int key){
        Node* cur=root;
        while(cur!=nullptr and key!=cur->key){
            if(key<cur->key) cur=cur->lch; else cur=cur->rch;
        }
        return cur;
    }
    void print();
    void inorder(Node*);
    void preorder(Node*);
};

void BinarySearchTree::print(){
    assert(root!=nullptr);
    inorder(root); puts("");
    preorder(root); puts("");
}
void BinarySearchTree::inorder(Node* node){
    if(node->lch!=nullptr) inorder(node->lch);
    printf(" %d",node->key);
    if(node->rch!=nullptr) inorder(node->rch);
}
void BinarySearchTree::preorder(Node* node){
    printf(" %d",node->key);
    if(node->lch!=nullptr) preorder(node->lch);
    if(node->rch!=nullptr) preorder(node->rch);
}

int main()
{
    BinarySearchTree tree;
    int Q; cin>>Q;
    while(Q--){
        string s; cin>>s;
        if(s=="print") tree.print();
        else{
            int x; cin>>x;
            if(s=="insert") tree.insert(x);
            else cout<<(tree.find(x)!=nullptr? "yes":"no")<<endl;
        }
    }
    return 0;
}


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

using namespace std;

int power(int a, int b)
{
	int x = 1;

	for (int i = 0; i < b; i++)
	{
		x *= a;
	}

	return x;
}

int main()
{
	int R, C;

	while (true)
	{
		cin >> R >> C;

		if (R == 0 && C == 0) { break; }

		vector<vector<int> > a(R, vector<int>(C));

		for (int i = 0; i < R; i++)
			for (int j = 0; j < C; j++)
				cin >> a[i][j];

		vector<vector<int> > a2;

		int sum, sum2, max_ = 0;

		for (int i = 0; i < power(2, R); i++)
		{
			sum = 0;

			a2 = a;

			for (int j = 0; j < R; j++)
			{
				if ((i / power(2, j)) % 2 == 1)
				{
					for (int k = 0; k < C; k++)
					{
						if (a2[j][k] == 0)
						{
							a2[j][k] = 1;
						}
						else if (a2[j][k] == 1)
						{
							a2[j][k] = 0;
						}
					}
				}
			}

			for (int j = 0; j < C; j++)
			{
				sum2 = 0;

				for (int k = 0; k < R; k++)
				{
					if (a2[k][j] == 0)
					{
						sum2++;
					}
				}

				sum2 = max(sum2, R - sum2);

				sum += sum2;
			}

			max_ = max(max_, sum);
		}

		cout << max_ << endl;
	}

	return 0;
}

// Time : O ( 2 ^ (R + 1) * R * C )

Measured memory_bytes: 3704
using System;
using System.Collections.Generic;

class Program {
    static void Main(string[] args){
      string[] s = Console.ReadLine().Split(' ');
      int a = int.Parse(s[0]);
      int b = int.Parse(s[1]);
      int c = 0;
      if(b<10){
        c = 10*a+b;
      } else if(b<100){
        c = 100*a + b;
      } else {
        c = 1000*a+b;
      }
      bool f = false;
      for(int k = 0;k<100*100;k++){
        if(k*k==c) f = true;
      }
      if(f){
        Console.Write("Yes");
      } else {
        Console.Write("No");
      }
    }
  }


Measured memory_bytes: 13140
from collections import Counter

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

MAX = 10 ** 6 + 10
multiples = [0] * MAX

for a in list(set(A)):
    for j in range(a * 2, MAX, a):
        multiples[j] = 1

d = Counter(A)
dup = [k for k, v in d.items() if v > 1]
for i in dup:
    multiples[i] = 1

ans = 0
for i in A:
    if multiples[i] == 0:
        ans += 1
print(ans)


Measured memory_bytes: 47600
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
char s[1050];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%s",s);
		int now=0;
		int cnt=0;
		int l=0,r=0;
		deque<char> ans;
		int sz=strlen(s);
		bool fir=true;
		while(cnt<sz)
		{
			if(fir)
			{
				fir=false;
				ans.push_front(s[0]);
				if(s[1]=='-')now++;
				else now--;
				cnt+=3;
				continue;
			}
			if(now>r)
			{
				ans.push_back(s[cnt]);
				//cout << "push back " << s[cnt] << endl;
				r=now;
			}
			if(now<l)
			{
				ans.push_front(s[cnt]);
				//cout << "push front " << s[cnt] << endl;
				l=now;
			}
			if(cnt+1==sz)break;
			if(s[cnt+1]=='-')now++;
			else now--;
			cnt+=3;
		}
		for(deque<char>::iterator it=ans.begin();it!=ans.end();it++)
		{
			cout << *it;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] array = new int[n];
      int sum = 0;
      int max = 0;
      for(int i = 0;i < n;i++){
      	array[i] = sc.nextInt();
        sum += array[i];
      }
      for(int i = 0;i < n;i++){
      	max = Math.max(array[i],max);
      }
      if(max < sum-max){
      	System.out.println("Yes");
      }else{
      	System.out.println("No");
      }
    }
}


Measured memory_bytes: 23124
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
int a,b,c,d,e;
cin>>e;
a=e/1000;
b=e/100%10;
c=e%100/10;
d=e%10;
if (a+b+c+d==7) {cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;return 0;}
if (a+b+c-d==7) {cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;return 0;}
if (a+b-c+d==7) {cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;return 0;}
if (a-b+c+d==7) {cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;return 0;}
if (a+b-c-d==7) {cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;return 0;}
if (a-b-c+d==7) {cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;return 0;}
if (a-b+c-d==7) {cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;return 0;}
if (a-b-c-d==7) {cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;return 0;}
}

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

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;


int main()
{
	FAST;
	int n,k;
	cin >> n >> k;
	
	int ans = 0;
	while(n--)
	{
		int temp;
		cin >> temp;

		ans += 2*min(abs(k-temp) , temp);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i < (int)vec.size(); ++i) {
        os << vec[i] << (i + 1 == (int)vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
void dump_func() {
    cerr << "\n";
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail) {
    cerr << head;
    if (sizeof...(Tail) == 0) {
        cerr << " ";
    } else {
        cerr << ", ";
    }
    dump_func(std::move(tail)...);
}
#define dump(...) cerr << "[" << to_string(__LINE__) << "]"        \
                       << "    " << string(#__VA_ARGS__) << " = ", \
                  dump_func(__VA_ARGS__)

using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<double>;
using VVI = vector<VI>;
using VVL = vector<VL>;
using PI = pair<int, int>;
using PL = pair<ll, ll>;
using VPI = vector<PI>;
using VPL = vector<PL>;
using VS = vector<string>;

#define ln '\n'
#define REP(t, n) for (int t = 0; t < (n); ++t)
#define FOR(t, a, b) for (int t = (a); t <= (b); ++t)
#define FORR(t, a, b) for (int t = (a); t >= (b); --t)
#define ALL(c) (c).begin(), (c).end()
#define CAUTO const auto&

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

    int n, min, ans = 0;
    cin >> n;
    min = n;
    REP(i, n) {
        int temp;
        cin >> temp;
        if (temp <= min) {
            min = temp;
            ans++;
        }
    }
    cout << ans << ln;

    return 0;
}


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

#define rep(i,n) for (int i = 0; i< (n); ++i)
#define vvec(m,n) vector<vector<int>> (int(m), vector<int>(n))
#define ALL(a) (a).begin(), (a).end()

using ll = long long;

int main(){
    int D;
    cin >> D;
    if(D==22)cout << "Christmas Eve Eve Eve" << endl;
    else if(D==23)cout << "Christmas Eve Eve" << endl;
    else if(D==24)cout << "Christmas Eve" << endl;
    else if (D==25)cout << "Christmas" << endl;
}

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

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

const int N = 3e3+10 , mod = 998244353;

int dp[N][N];

int pw(int x , int y){
   int ret = 1;
   for( ; y ; y /= 2){
      if(y & 1)
         ret = 1ll * ret * x  % mod;
      x = 1ll * x * x % mod;
   }
   return ret;
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int a , b , c , d;
   cin >> a >> b >> c >> d;
   dp[a][b] = 1;
   for(int i = a ; i <= c ; i++)
      for(int j = b ; j <= d ; j++){
         if(i == a && j == b)
            continue;
         dp[i][j] = ((1ll * dp[i - 1][j] * j + 1ll * dp[i][j - 1] * i) % mod - 1ll * dp[i - 1][j - 1] * (i - 1) * (j - 1) % mod + mod) % mod;
         //cout << i << " " << j << " " << dp[i][j] << endl;
      }
   cout << dp[c][d];
   return 0;
}


Measured memory_bytes: 38924
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  ll a,b;
  cin >> a >> b;
  if(((a+b)%2)==0) cout << (a+b)/2 << endl;
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <queue>
#include <deque>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <bitset>

#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x, y) memset(x, y, sizeof(x))
#define pb push_back
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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 (a > b) {
      a = b;
      return 1;
   }
   return 0;
}

using namespace std;
using ll = long long;

const int kInf = 2e9;
const ll kLInf = 2e18;

int gcd (int a, int b) {
   return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
   cout << fixed << setprecision(10);
   string S;
   cin >> S;
   REP(i, SZ(S)) {
      if (i%2) {
         if (S[i] == 'L' || S[i] == 'U' || S[i] == 'D') {
            continue;
         }
      } else {
         if (S[i] == 'R' || S[i] == 'U' || S[i] == 'D') {
         continue;
         }
      }
      cout << "No" << endl;
      return 0;
   }
   cout << "Yes" << endl;
   return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
ll gcd(ll a,ll b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
ll lcm(ll a,ll b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

// 10進数から2進数
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}









int main() {
  ll n;
  cin >> n;
  ll t = n;
  ll sum = 0;
  while (n > 0) {
    sum += n%10;
    n /= 10;
  }
  //cout << n << endl;
  if (t % sum == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}


Measured memory_bytes: 3724
N, Y = map(int, input().split())
ans = -1, -1, -1

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        if z <= 2000 and \
                x*10000 + y*5000 + z*1000 == Y:
            ans = x, y, z
            break
    else:
        continue
    break

print(*ans)



Measured memory_bytes: 3060
import java.util.*

fun main(args: Array<String>) {
    val N = readLine()?.toInt() ?: 0
    var prevTern = listOf(0, 0, 0)
    var eachTern: ArrayList<List<Int>> = arrayListOf()
    for (n in 0 until N) {
        eachTern.add(readLine()!!.split(" ").map(String::toInt))
    }
    var result = "Yes"
    for (e in eachTern) {
        val timeDiff = e[0] - prevTern[0]
        val xDiff = Math.abs(e[1] - prevTern[1])
        val yDiff = Math.abs(e[2] - prevTern[2])
        if (timeDiff < (xDiff + yDiff)) {
            result = "No"
            break
        }
        if ((timeDiff % 2 != 0 && (xDiff + yDiff) % 2 == 0) ||
            (timeDiff % 2 == 0 && (xDiff + yDiff) % 2 != 0)) {
            result = "No"
            break
        }
        prevTern = e
    }
    print(result)
}

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

bool isprime(int n){
    double rootn = sqrt(n);
    if (n < 2){
        return false;
    }
    else if (n == 2){
        return true;
    }
    else if (n % 2 == 0){
        return false;
    }
    else{
        for(int i = 3; i <= rootn; i += 2){
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }
}

// 空のベクトルを二つ渡す。N (>=2) 以下の素数を primes に順番に入れる。
void prime_vectors(int N, vector<int>& primes, vector<bool>& is_prime){
    primes = {};
    is_prime = {};
    for(int i=0; i<=N; i++){
        is_prime.push_back(true);
    }

    primes.push_back(2);
    for(int j=4; j<=N; j+=2){
        is_prime[j] = false;
    }

    int i;
    for(i=3; i*i<=N; i+=2){
        if(!is_prime[i]) continue;
        primes.push_back(i);
        for(int j=2*i; j<=N; j+=i){
            is_prime[j] = false;
        }
    }

    for(; i<=N; i+=2){
        if(is_prime[i]){
            primes.push_back(i);
        }
    }
}

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int n;
    cin >> n;
    vector<int> s(n);
    for(int i=0; i<n; i++){
        cin >> s[i];
    }
    int q;
    cin >> q;
    vector<int> t(q);
    for(int i=0; i<q; i++){
        cin >> t[i];
    }

    int cnt = 0;
    for(int i=0; i<q; i++){    
        int left = 0, right = n-1;
        if(s[0] == t[i]){
            cnt++;
            continue;
        }
        while(right - left > 1){
            int mid = (left + right)/2;
            if(s[mid] < t[i]){
                left = mid;
            }
            else{
                right = mid;
            }
        }
        if(s[right] == t[i]){
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3748
def main():
    s = input()
    max_len = -1
    idx_a, idx_z = [], []
    for i in range(len(s)):
        if s[i] == 'A':
            idx_a.append(i)
        if s[i] == 'Z':
            idx_z.append(i)
    print(max(idx_z)-min(idx_a)+1)


if __name__ == "__main__":
    main()

Measured memory_bytes: 11204
int main(int argc, const char * argv[]) {
    int A,B,C;
    scanf("%d",&A);
    scanf("%d",&B);
    scanf("%d",&C);
    if((A==5&&B==5) && (C==7)){
        printf("YES");
    }
    
    else if((A==5&&C==5) &&(B==7)){
        printf("YES");
    }
    
    else if((B==5&&C==5) && (A==7)){
        printf("YES");
    }
    
    else {
        printf("NO");
    }
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		sc.close();

		int ans = C - (A - B);

		if(ans<0) {
			ans = 0;
		}
		System.out.println(ans);
	}
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    vector<int>c;
    int d;vector<vector<int>>s;
    vector<int>last;
    auto calc=[&](int t,int day){
        int k=0;
        k+=s[day][t];
        last[t]=day+1;
        for (int j = 0; j < 26; ++j)k-=c[j]*(day+1-last[j]);
        return k;
    };
    cin >>d;
    c.resize(26);
    for (int i = 0; i <26; ++i) cin >>c[i];
    s.assign(d,vector<int>(26));
    for (int i = 0; i < d; ++i)for (int j = 0; j < 26; ++j) cin >>s[i][j];
    int score=0;
    last.assign(26,0);
    vector<int>t(d);
    for (int day = 0; day < d; ++day) {
        int now=-INF;
        for (int i = 0; i < 26; ++i) {
           if(now<calc(i,day)){
               now=calc(i,day);
//               if(day==3&&)
               t[day]=i+1;
           }
        }
        score+=now;
    }
    for (int i = 0; i < d; ++i) {
        cout<<t[i]<<endl;
    }
//    cout <<score<<endl;
    return 0;
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define MAX 1e6
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set


int main() 
{
	ll n;
	cin>>n;
	ll arr[n+1] = {0};
	REP(i,0,n-1){
		ll x;
		cin>>x;
		arr[x]++;
	}
	REP(i,1,n+1){
		cout<<arr[i]<<endl;
	}
	return 0;
}  


Measured memory_bytes: 5192
#include<stdio.h>
int main(void){
    double a,b,c,d,e,f;
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)>0){
            f=(f-c/a*d)/(e-b/a*d);
            c=c/a-f*b/a;
            printf("%.3f %.3f\n",c,f);
    }
    return 0;
}

Measured memory_bytes: 652
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
const int MAX_N=1e5+1;
int p[MAX_N];
bool is[MAX_N];
int main()
{     int n,m,i,j,k=0;
      scanf("%d",&n);
      for(i=1;i<=n;i++){
      	scanf("%d",&p[i]);
      	if(p[i]==i)is[i]=true,k++;
      }
      for(i=1;i<=n;i++)
         if(is[i]){
         	if(is[i-1])k--,is[i]=is[i-1]=false;
         	  else if(is[i+1])k--,is[i]=is[i+1]=false;
         }
      cout<<k<<endl;
	  return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
#define int LL
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;

}

LL exp(LL a, LL b){
    LL res = 1;
    LL sum = a;
    while(b){
        if(b&1)res = (res * sum);
        sum = (sum * sum);
        b>>=1;
    }
    return res;
}

PII operator+(const PII &a, const PII &b){
    return PII(a.first + b.first, a.second + b.second);
}

PII operator-(const PII &a, const PII &b){
    return PII(a.first - b.first, a.second - b.second);
}
bool operator==(const PII &a, const PII &b){
    return (a.first == b.first) && (a.second == b.second);
}

int N, M;
vector<int> S, T;
vector<vector<int>> dp;
int func(int i, int j){
    if(i == N or j == M)return 0;
    if(dp[i][j] >= 0)return dp[i][j];
    int res = 0;
    if(S[i] == T[j]){
        res = 1 + func(i + 1, j + 1);
    }
    res = (res + func(i, j + 1))%MOD;
    res = (res + func(i + 1, j))%MOD;
    res = (res - func(i + 1, j + 1) + MOD) % MOD;
    return dp[i][j] = res;
}
signed main(){
    cin >> N >> M;
    S.resize(N);
    T.resize(M);
    REP(i, N)cin >> S[i];
    REP(i, M)cin >> T[i];
    dp.resize(N, vector<int>(M, -1));
    cout << func(0, 0) + 1 << endl;
    return 0;
}


Measured memory_bytes: 32000