akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long//
#define rp(i,a,b) for(ll i=a;i<b;i++)
#define r(i,n) for(ll i=0;i<n;i++)
#define rt return
#define db double
#define ldb long double
#define vd void
#define p(x) cout<<(x)<<endl;
#define ce continue;
#define bl bool
#define r0 rt 0;
#define r1 rt 1;
#define elif else if
#define bk break;
#define A p("A")
#define B p("B")
#define C p("C")
#define D p("D")
#define E p("E")
#define F p("F")
#define S(a) sort(a.begin(),a.end());
#define R(a) reverse(a.begin(),a.end());
#define cl cout<<endl;
#define pb(x) push_back(x);
#define str string
using namespace std;
void Cond(int g){if(g)p("YES")else p("NO")rt;}
void cond(int g){if(g)p("Yes")else p("No")rt;}
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)rt b;gcd(b,a%b);}
str su="0123456789";
str m1="abcdefghijklmnopqrstuvwxyz";
str m2="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
map<char,ll>m5;
typedef pair<ll,ll> P;
const ll INF=(ll)1e18+10;
ll t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,t7=0,t8=0,g=0,ans=0;
ll n=0,m=0,k=0,mx=-INF,mn=INF,ct=0;
ll tmp=0,tmp1=0,tmp2=0,tmp3=0,tmp4=0;
ll sum=0,mask=0;
set<P> pst;
set<ll>st,st1,st2;
set<char> cst;
ll powmod(ll a,ll b,ll x){//(a^b)modx
    if(!b)r1
    if(!(b%2)){//B
        ll t=powmod(a,b/2,x);
        rt t*t%x;
    }
    rt ((a)*powmod(a,b-1,x))%x;
}
void di(){m5['a']=0;
    m5['b']=1;
    m5['c']=2;
    m5['d']=3;
    m5['e']=4;
    m5['f']=5;
    m5['g']=6;
    m5['h']=7;
    m5['i']=8;
    m5['j']=9;
    m5['k']=10;
    m5['l']=11;
    m5['m']=12;
    m5['n']=13;
    m5['o']=14;
    m5['p']=15;
    m5['q']=16;
    m5['r']=17;
    m5['s']=18;
    m5['t']=19;
    m5['u']=20;
    m5['v']=21;
    m5['w']=22;
    m5['x']=23;
    m5['y']=24;
    m5['z']=25;
}
map<ll,ll>mp,mp1,mp2,mp3;
typedef std::vector<ll> vl;
typedef pair<ll,ll> P;
typedef pair<ll,P>  P2;
typedef struct edge2{P tos;ll cost;}EDGE2;
typedef struct edge1{ll to,cost;}EDGE;
bl used[(ll)1e9];
const ll M=(ll)1e9+7;
ll fac[1000007],finv[1000007],inv[1000007];
void initcmb(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<1000007;i++){
        fac[i]=fac[i-1]*i%M;
        inv[i]=M-inv[M%i]*(M/i)%M;
        finv[i]=finv[i-1]*inv[i]%M;
    }
}
ll cmb(ll n,ll k){
    if(n<k)return 0;
    if(n<0 || k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%M)%M;
}
db pi=3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196;

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; }
const ll MAX=5+(ll)1e5*3;
vl rui(MAX);

   

vector<vector<EDGE>>G(1e6);


int main(){//swap(ary１,ary２)
    //a.erase(a.begin()+5),a.insert(a.begin()+3,tmp)    ios_base::sync_with_stdio(0); cin.tie(0);
clock_t start = clock();//timecalc
di();


cin>>t1;
t2=(t1)+pow(t1,2)+pow(t1,3);
p(t2)




clock_t end = clock();//
const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;//timecalc
//printf("time %lf[ms]\n", time);//
return 0;
}//main


Measured memory_bytes: 28984
#author : dokueki

import sys
import math
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)
sys.setrecursionlimit(10**7)
mod = 1000000007


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    n = int(sys.stdin.readline())
    print(2*math.pi*n)


if __name__ == "__main__":
    try:
        IOE()
    except:
        pass
    main()


Measured memory_bytes: 62072
import sys
from collections import deque

h,w=map(int,input().split())
ch,cw=map(int,input().split())
ch,cw=ch-1,cw-1
dh,dw=map(int,input().split())
dh,dw=dh-1,dw-1
s=[[*next(sys.stdin)] for _ in range(h)]

c=-1
for i in range(h):
    for j in range(w):
        if s[i][j]!='.':
            continue
        c+=1
        stk=[(i,j)]
        while stk:
            ii,jj=stk.pop()
            s[ii][jj]=c
            for di,dj in (-1,0),(0,1),(1,0),(0,-1):
                ni,nj=ii+di,jj+dj
                if not (0<=ni<h and 0<=nj<w):
                    continue
                if s[ni][nj]!='.':
                    continue
                stk.append((ni,nj))

n=c+1
cc=dc=-1
dirs=[-2,-1,0,1,2]
adj=[{*()} for _ in range(n)]
for i in range(h):
    for j in range(w):
        u=s[i][j]
        if u=='#':
            continue
        if i==ch and j==cw:
            cc=u
        elif i==dh and j==dw:
            dc=u
        for di in dirs:
            for dj in dirs:
                if di==dj==0:
                    continue
                ni,nj=i+di,j+dj
                if not (0<=ni<h and 0<=nj<w):
                    continue
                v=s[ni][nj]
                if v=='#':
                    continue
                if u!=v:
                    adj[u].add(v)
                    adj[v].add(u)

que=deque()                
que.append(cc)
vis={cc}
m=-1
ok=0
while que:
    m+=1
    for _ in range(len(que)):
        u=que.popleft()
        if u==dc:
            ok=1
            break
        for v in adj[u]:
            if v in vis:
                continue
            vis.add(v)
            que.append(v)
    if ok:
        break

if ok:
    print(m)
else:
    print(-1)


Measured memory_bytes: 203404
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    int n, a, b;
    int p1 = 0, p2 = 0, p3 = 0;
    int i;
    cin>>n>>a>>b;
    FOR0(i, n)
    {
        int temp;
        cin>>temp;
        if(temp<=a) p1++;
        else if(temp>=a+1&&temp<=b) p2++;
        else if(temp>=b+1) p3++;
    }
    int ans = MIN3(p1, p2, p3);
    cout<<ans;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

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

int main(){
    //１～ｎで、各位の和がＡ～Ｂであるものの総和
    int N, A, B;
    cin >> N >> A >> B;
    int ans = 0;
    int cnt = 0;
    for(int m = 1; m <= N; m++){
        int k=0;
        cnt = m;
        while(true){
            k = k + cnt % 10;
            if(cnt / 10 == 0) break;
            cnt /= 10;
        }
        if(A <= k && k <= B) ans += m;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3616
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<tuple>
#include<cmath>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

struct vec {
  int64_t x, y;
  vec(): x(0), y(0) {}
  vec(int64_t x, int64_t y) : x(x), y(y) {}
  vec operator+(vec const& v) const { return vec(x + v.x, y + v.y); }
  vec operator-(vec const& v) const { return vec(x - v.x, y - v.y); }
  bool operator==(vec const& v) const {
    return x * v.y == y * v.x && x * v.x >= 0 && y * v.y >= 0;
  }

  bool operator<(vec const&v) const {
    if(*this == v) return false;
    if(y > 0 && v.y > 0) {
      if((x > 0 && v.x > 0) || (x < 0 && v.x < 0)) return y * v.x < x * v.y;
      if(x <= 0 && v.x >= 0) return false;
      return true;
    } else if (y < 0 && v.y < 0) {
      if((x < 0 && v.x < 0) || (x > 0 && v.x > 0)) return y * v.x < x * v.y;
      if(x >= 0 && v.x <= 0) return false;
      return true;
    } else if (y > 0 && v.y < 0) return true;
    if (y < 0 && v.y > 0) return false;
    if (y == 0 && x > 0 && (v.y != 0 || (v.y == 0 && v.x < 0))) return true;
    if (y == 0 && x < 0 && v.y < 0) return true;
    if (v.y == 0 && v.x < 0 && y > 0) return true;
    return false;
  }
  friend std::ostream& operator<<(std::ostream &os, const vec &v) {
    return os << "[" << v.x << "," << v.y << "]";
  }
};

int const MAXN = 100;
vec p[MAXN*2];
int N;

int main() {
  std::cout << std::setprecision(15) << std::fixed;
  std::cin >> N;
  int j = 0;
  for(int i = 0; i < N; ++i) {
    int x, y; std::cin >> x >> y;
    if(x == 0 && y == 0) continue;
    p[j++] = vec(x, y);
  }
  N = j;
  if(N < 1) fin(0.0);
  std::sort(p, p+N);
  for(int i = 0; i < N; ++i) p[i+N] = p[i];
  int64_t sum2 = 0, ans2 = 0;
  vec sum;
  j = 0;
  for(int i = 0; i < N; ++i) {
    while(j < i+N) { 
      vec nv = sum + p[j];
      int64_t n2 = nv.x*nv.x + nv.y*nv.y;
      if(n2 <= sum2) break;
      sum = nv; sum2 = n2;
      ans2 = std::max(ans2, sum2);
      ++j;
    }
    sum  = sum - p[i];
    sum2 = sum.x*sum.x + sum.y*sum.y;
    ans2 = std::max(ans2, sum2);
  }
  fin(std::sqrt((double)ans2));
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"LINE %d: (%s) = ",__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
    IOS();
    string ans = "";
    int n;
    cin >> n;
    for (int i=0;i<n;++i) ans += "ACL";
    cout << ans << endl;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int n,k,ans;
int a[1005];
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1);
	for(int i=1;i<=k;i++){
		ans+=a[i];
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
struct edge{
	int to,next,ok;
} e[N];
int n,m,good=1,h[N];
int visited[N],check[N];
void add(int u,int v){
	e[++good]=(edge){v,h[u],0};
	h[u]=good;
}
void dfs(int u,int p){
	visited[u]=++*visited;
	for(int i=h[u];i;i=e[i].next){
		if(i^p^1){
			if(!visited[e[i].to]){
				dfs(e[i].to,i);
				if(check[e[i].to]&1){
					e[i].ok=-1;
					e[i^1].ok=1;
					check[e[i].to]^=1;
				}
				else{
					e[i].ok=1;
					e[i^1].ok=-1;
					check[u]^=1;
				}
			}
			else if(visited[e[i].to]<visited[u]){
				e[i].ok=1;
				e[i^1].ok=-1;
				check[u]^=1;
			}
		}
	}
}
int main(){
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int u,v;
		cin>>u>>v;
		add(u,v);
		add(v,u);
	}
	for(int i=1;i<=n;i++){
		if(!visited[i]) dfs(i,0);
	}
	for(int i=1;i<=n;i++){
		if(check[i]){
			cout<<"-1";
			return 0;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=h[i];j;j=e[j].next){
			if(e[j].ok==1){
				cout<<i<<" "<<e[j].to<<endl;
			}
		}
	}
}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

int euclid(int a, int b)
{
    if (a < b)
        euclid(b, a);
    if (b == 0)
        return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

int next_combination(int sub)
{
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}

signed main()
{
    int n;
    string s[100001];
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> s[i];

    vector<ll> v;
    int m = 0, a = 0, r = 0, c = 0, h = 0;
    for (int i = 0; i < n; i++)
    {
        if ((s[i])[0] == 'M')
            m++;
        else if ((s[i])[0] == 'A')
            a++;
        else if ((s[i])[0] == 'R')
            r++;
        else if ((s[i])[0] == 'C')
            c++;
        else if ((s[i])[0] == 'H')
            h++;
    }

    v.push_back(m);
    v.push_back(a);
    v.push_back(r);
    v.push_back(c);
    v.push_back(h);

    int bit = (1 << 3) - 1;
    ll sum = 0;
    for (; bit < (1 << 5); bit = next_combination(bit))
    {
        ll tmp = 1;
        for (int i = 0; i < 5; i++)
        {
            // cout << v[i] << " ";
            if (bit >> i & 1)
            {
                tmp *= v[i];
            }
        }
        // cout << endl;
        sum += tmp;
    }
    cout << sum << endl;
}


Measured memory_bytes: 6144
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define ll              long long
#define dd              double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define vi              vector<int>
#define vll             vector<long long>
#define vdd             vector<double>
#define vpii            vector<pair<int,int>>
#define vpll            vector<pair<long long,long long>>
#define vvi             vector<vector<int>>
#define vvll            vector<vector<long long>>
#define mii             map<int,int>
#define mll             map<long long,long long>
#define umii            unordered_map<int,int>
#define umll            unordered_map<long long,long long>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep2(i,a,b)     for(int i=a;i<b;i++)
#define rev(i,n)        for(int i=n;i>=0;i--)
#define rev2(i,a,b)     for(int i=a;i>=b;i--)
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf             9e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define wh(x)           int x; cin>>x; while(x--)
#define fio             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl            '\n'
#define all(x)          x.begin(),x.end()
#define d0(x)           cout <<x<<" "
#define d1(x)           cout <<x<<endl
#define d2(x,y)         cout <<x<<" "<<y<<endl
#define d3(x,y,z)       cout <<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w)     cout <<x<<" "<<y<<" "<<z<<" "<<w<<endl
#define read2(x,y)      cin>>x>>y
#define read3(x,y,z)    cin>>x>>y>>z
#define read4(x,y,z,w)  cin>>x>>y>>z>>w
#define read5(x,y,z,w,a)cin>>x>>y>>z>>w>>a
#define sz(a)           (int)a.size()
#define deb(x)          cout <<#x << " is "<<x<<endl;
const ll mod=1e9+7;
const double PI = 3.14159265359;
const ll MOD=998244353;
void i_o()
{
   #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
   #endif
}

int main(){
	fio
  i_o();
  for(int i=1;i<=5;i++){
  	int x;
  	cin>>x;
  	if(x==0){
  		d1(i);
  		return 0;
  	}
  }
  return 0;

}

Measured memory_bytes: 3636
N=int(input())
n=N
ans=0
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)

    return divisors
l=make_divisors(N-1)
r=make_divisors(N)
ans=len(l)-1
for i in range(len(r)):
    N=n
    K=r[i]
    if K==1:
        continue
    while(N%K==0):
        N=N//K
    if N%K==1:
        #print(K)
        ans+=1
print(ans)

Measured memory_bytes: 39152
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
    int N;
    cin >> N;

    long long A[N];
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }

    long long ans = 0;
    long long A_max = A[0];
    for (int i = 1; i < N; i++)
    {
        if (A[i] < A_max)
        {
            ans += A_max - A[i];
        }
        else
        {
            A_max = A[i];
        }
    }

    cout << ans << "\n";
}


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

using namespace std;
int n,x,a[51];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    int poz=1;
    double x=a[1];
    for(int i=2;i<=n;i++)
        x=(x+a[i])/2;
    cout<<x;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define double long double
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n,m;cin>>n>>m;
    vector<ll>a(n);
    vector<ll>b(m);
    rep(i,n){
        cin>>a[i];
    }
    rep(i,m){
        cin>>b[i];
    }
    sort(all(a));
    sort(all(b));
    bool f=0;
    rep(i,n-1){
        if(a[i]==a[i+1])f=1;
    }
    rep(i,m-1){
        if(b[i]==b[i+1])f=1;
    }
    if(f){
        cout<<0<<endl;
        return 0;
    }
    ll now=n*m,cnt=0;
    ll ans=1;
    while(now>=1&&ans){
        auto itr1=lower_bound(all(a),now);
        auto itr2=lower_bound(all(b),now);
        if(*itr1==now){
            if(*itr2==now){
                cnt++;
            }
            else{
                ans*=max(0LL,(ll)(b.end()-itr2));
                cnt++;
            }
        }else{
            if(*itr2==now){
                ans*=max(0LL,(ll)(a.end()-itr1));
                cnt++;
            }else{
                ans*=max(0LL,(ll)(a.end()-itr1)*(b.end()-itr2)-cnt);
                cnt++;
            }
        }
        ans%=inf;
        now--;
    }
    cout<<ans<<endl;
}

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

bool accept(const string& s) {
	if (s[0] != 'A') return false;
	int n = s.length(), k;
	for (k = 0; k < n; k++)
		if (s[k] == 'C') break;
	if (!(k >= 2 && k < n-1)) return false;
	for (int i = 1; i < n; i++) {
		if (i == k) continue;
		if (!('a' <= s[i] && s[i] <= 'z')) return false;
	}
	return true;
}

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	string s;
	cin >> s;
	if (accept(s))
		puts("AC");
	else
		puts("WA");
}


Measured memory_bytes: 256
n,m=map(int,input().split())
k=[0]*m
a=[0]*m
ans=["x"]*n

for i in range(m):
  k[i],a[i]=map(int,input().split())
  if k[i]==1 and n>2 and a[i]==0:
    print(-1)
    exit()
  
for i in range(m):
  for j in range(m):
    if k[i]==k[j]:
      if a[i]!=a[j]:
        print(-1)
        exit()
        
for i in range(m):
  ans[k[i]-1]=str(a[i])
  
Ans=""
for i in range(n):
  if ans[i]=="x":
    if i==0 and n>=2:
      ans[i]="1"
    else:
      ans[i]="0"
  Ans+=ans[i]

if Ans=="0"*n and n>2:
  print(-1)
  exit()
        
print(int(Ans))


Measured memory_bytes: 3064
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

int ask(int y1, int x1, int y2, int x2)
{
	printf("? %d %d %d %d\n", y1, x1, y2 - 1, x2 - 1);
	fflush(stdout);
	int a;
	scanf("%d", &a);
	return a;
}

int score(int q)
{
	if (q > 2500) return 0;
	if (q >= 930) return max((int)(1e-8 + 125 - 3.2 * sqrt(q - 920)), 40);
	if (q >= 880) return (int)(1e-8 + 288 - 22 * sqrt(q - 870));
	return min(2860 - 3 * q, 300);
}

int H, W, N, K;
int C[50][50];

void solve(int y1, int x1, int y2, int x2, int cnt)
{
	if (y2 - y1 == 1 && x2 - x1 == 1) {
		C[y1][x1] = cnt;
		return;
	}
	if (cnt == 0) return;
	if ((y2 - y1) * (x2 - x1) == cnt) {
		for (int i = y1; i < y2; ++i) {
			for (int j = x1; j < x2; ++j) {
				C[i][j] = 1;
			}
		}
		return;
	}

	if (y2 - y1 > 1) {
		int ym = (y2 + y1) / 2;
		int a = ask(y1, x1, ym, x2);
		solve(y1, x1, ym, x2, a);
		solve(ym, x1, y2, x2, cnt - a);
	} else {
		int xm = (x2 + x1) / 2;
		int a = ask(y1, x1, y2, xm);
		solve(y1, x1, y2, xm, a);
		solve(y1, xm, y2, x2, cnt - a);
	}
}

int main()
{
	scanf("%d%d%d%d", &H, &W, &N, &K);
	solve(0, 0, H, W, N);

	int ret = 0;
	int pw = 1;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			ret += C[i][j] * pw;
			ret %= K;
			pw = pw * 2 % K;
		}
	}
	printf("! %d\n", ret);
	return 0;
}


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

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
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(){
	while(1){	
		int V[4],Move[51],Money[51];
		double dp[101][5100] = {0}; // dp[i][j] := i????????????????????§???????????????????????????????????????j???????¢????
		int x,y,z;
		cin >> x >> y >> z;
		if(x == 0 && y == 0 && z == 0) break;
		REP(i,51){
			Money[i] = 0; Move[i] = 0;
		}
		REP(i,x) cin >> V[i];
		REP(i,z){
			int n,e,a;
			cin >> n >> e >> a;
			if(e == 1) Move[n] = a;
			else if(e == 2) Money[n] = a;
			else if(e == 3) Money[n] = -1 * a;
		}
		dp[0][0] = 1.0;
		REP(pos,y){
			REP(mny,5100){
				REP(k,x){
					if(dp[pos][mny] == 0) continue;
					int nexpos = pos + V[k];
					if(nexpos > y) nexpos = y;
					int nexmny = mny;
					if(Move[nexpos] != 0){
						nexpos += Move[nexpos];
						if(nexpos > y) nexpos = y;
					}else if(Money[nexpos] != 0){
						nexmny += Money[nexpos];
						nexmny = max(0, nexmny);
					}
					dp[nexpos][nexmny] += (double)dp[pos][mny]/((double)x);
				}
			}
		}
		double ans = 0;
		REP(i,5001){
			//if(dp[y][i] != 0) cout << i << " : " << dp[y][i] << " ";
			ans += (double)i * dp[y][i];
		} 
		cout << (int)ans << endl;
	}	
}

Measured memory_bytes: 5192
#include <iostream>
#include <string>

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  string s;
  cin >> n >> s;

  int ans = 1;
  for (int i = 1; i < n; i++) {
    if (s[i] != s[i - 1]) {
      ans++;
    }
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 512
//
//  main.c
//  ITP1_7_D
//
//  Created by k16031kk on 2018/05/26.
//  Copyright © 2018年 AIT. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int n, m, l, a, b;
    scanf("%d %d %d", &n, &m, &l);
    
    int A[n][m], B[m][l];
    long C[n][l];
    for(int i=0; i<n; i++) {
        for(int j=0; j<m; j++) {
            A[i][j]=0;
            scanf("%d", &a);
            A[i][j]=a;
        }
    }
    
    for(int i=0; i<m; i++) {
        for(int j=0; j<l; j++) {
            B[i][j]=0;
            scanf("%d", &b);
            B[i][j]=b;
        }
    }
    for(int i=0; i<n; i++) {
        for(int j=0; j<l; j++) {
            C[i][j]=0;
            for(int k=0; k<m; k++)  {
                C[i][j]+=A[i][k]*B[k][j];
            }
            if(j!=0) printf(" ");
            printf("%ld", C[i][j]);
        }
        printf("\n");
    }
    
    return 0;
}



Measured memory_bytes: 2100
N = int(input())
A = list(input())
B = list(input())
C = list(input())
cnt = 0

for i in range(N):
  if A[i] == B[i] == C[i]:
    cnt += 0
  elif A[i] == B[i] or B[i] == C[i] or C[i] == A[i]:
    cnt += 1
  else:
    cnt += 2

print(cnt)

Measured memory_bytes: 3064
import java.util.*;
import java.io.*;
import java.util.zip.Adler32;

public class Main {
    static Pair[]dp;
    static int[]a;
    static Pair dp(int i){
        if (i==0){
            return new Pair(0,-1);
        }
        if (dp[i]!=null)
            return dp[i];
        Pair sol = new Pair(i,-1);

        for (int j =0;j<18;j++){
            if ((i&1<<j)!=0){
                sol=maxmize(sol,dp(i^(1<<j)));
            }
        }
        return dp[i]=sol;
    }
    static Pair max(Pair x,Pair y){
        if (x.a==y.a)
        if (x.b>y.b)
            return x;
        return y;
    }
    static Pair maxmize(Pair x,Pair y){
        TreeSet<Integer>ts = new TreeSet<>((m,mm)->a[mm]==a[m]?m-mm:a[mm]-a[m]);
        ts.add(x.a);
        ts.add(y.a);
        if (x.b!=-1)ts.add(x.b);
        if (y.b!=-1)ts.add(y.b);
        return new Pair(ts.pollFirst(),ts.pollFirst());
    }
    static ArrayList<int[]>[]adj;
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);;
        int n = sc.nextInt();
        a = new int[1<<n];
        dp= new Pair[1<<n];
        for (int i =0;i<1<<n;i++)a[i]=sc.nextInt();
        int[] ans = new int[1<<n];
        for (int i =1;i<1<<n;i++){
            Pair s = dp(i);
            ans[i]=a[s.a]+a[s.b] ;
            ans[i]=Math.max(ans[i],ans[i-1]);
            pw.println(ans[i]);
        }

        pw.flush();
    }
    static class Pair{
        int a,b;
        public Pair(int x ,int y){
            a=x;
            b=y;
        }

        @Override
        public Pair clone() {
            return new Pair(a,b);
        }
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] nextIntArr(int n) throws IOException {
            int[] arr = new int[n];
            for (int i = 0; i < arr.length; i++)
                arr[i] = nextInt();
            return arr;
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}

Measured memory_bytes: 77376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
 	
  	int k,x;
  	cin >> k >> x;
  	if(k*500>=x) Yes
    No
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	long long int a[7];
	for(int i=0; i<7; i++){
		scanf("%lld",&a[i]);
	}
	long long int ans=0;
	ans+=a[1]+(long long int)(a[0]/2)*2+(long long int)(a[3]/2)*2+(long long int)(a[4]/2)*2;
	int tmp=a[0]%2+a[3]%2+a[4]%2;
	if(tmp==3){
		ans+=3;
	}
	else if(tmp==2 && (a[0]>0 && a[3]>0 && a[4]>0)){
		ans++;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Int32;

class Program
{
    static void Main(string[] args)
    {
        label:
        WriteLine(hoge() ? "Yes" : "No");
    }

    static bool hoge()
    {
        var sp = ReadLine().Split();
        var array = new string[Parse(sp[0])];
        for (int i = 0; i < array.Length; ++i)
        {
            array[i] = ReadLine();
        }
        for(int i = 0; i < array.Length; ++i)
        {
            var line = array[i];
            for(int j = 0; j < line.Length; ++j)
            {
                if (line[j] == '.') continue;
                if (0 < j && line[j - 1] == '#') continue;
                if (j + 1 < line.Length && line[j + 1] == '#')
                {
                    ++j;
                    continue;
                }
                if (0 < i && array[i - 1][j] == '#') continue;
                if (i + 1 < array.Length && array[i + 1][j] == '#') continue;
                return false;
            }
        }
        return true;
    }
}


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

int main()
{
    int N;
    cin >> N;
    int answer = 0;

    for(int c = 1; c <= N; c+= 2)
    {
        int numofdivisors = 0;
        for (int X = 1; X <= c; ++X)
        {
            if(c % X == 0)
            {
                ++numofdivisors;
            }
        }
        if (numofdivisors == 8)
        {
            answer++;
        }
    }
    cout << answer << endl;
}

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

#define i64 int64_t

int main()
{
	i64 N, K;
  
  	cin >> N >> K;
  
  	if(N < K)N+=K;
  	
  	i64 result1,result2;
  
  	result1 = N % K;
    result2 = K - result1;
  	if(result1 < result2)cout << result1;
  	else cout << result2;
}

Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef unsigned long long ll;

int main()
{
  long double x, y;
  cin >> x >> y;
  if(x > y) cout << "GREATER" << endl;
  else if (x == y) cout << "EQUAL" << endl;
  else cout << "LESS" << endl;
}

Measured memory_bytes: 256
//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

inline void print(string name,int *arr,int len){
	rep(i,1,len) printf("%s[%d]=%d\n",name.c_str(),i,arr[i]);puts("");
}
inline void print(string name,int a){
	printf("%s=%d\n",name.c_str(),a);puts("");
}

typedef long long ll;
const int INF=1<<30;

struct Node{
	int u,d;
	Node(int u=0,int d=0):u(u),d(d){}	
};

queue<int>q;

const int maxn=2500+10;
const int maxm=5000+10;

struct Edge{int u,v,w;Edge(int u=0,int v=0,int w=0):u(u),v(v),w(w){}};
struct Graph{
	int first[maxn],nxt[maxm],ecnt;
	Edge e[maxm];
	void add_edge(int u,int v,int w){
		nxt[ecnt]=first[u];first[u]=ecnt;e[ecnt++]=Edge(u,v,w);	
	}
	void clear(){memset(first,-1,sizeof first);ecnt=0;}
}g1,g2;

ll val[maxn];
int vis[maxn];
bool inq[maxn];
int ok[maxn];

int main()
{
	g1.clear();g2.clear();
	int n,m,p;cin>>n>>m>>p;
	rep(i,1,m)
	{
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		g1.add_edge(u,v,w-p);
		g2.add_edge(v,u,w-p);
	}
	
	q.push(n);
	while(!q.empty())
	{
		int u=q.front();q.pop();
		ok[u]=1;
		for(int i=g2.first[u];i!=-1;i=g2.nxt[i])
		{
			int v=g2.e[i].v;
			if(!ok[v]) q.push(v),ok[v]=1;
		}
	}
	
	rep(i,1,n) val[i]=-1ll<<60;
	val[1]=0;q.push(1);inq[1]=1;
	while(!q.empty())
	{
		int u=q.front();q.pop();
		inq[u]=0;
		for(int i=g1.first[u];i!=-1;i=g1.nxt[i])
		{
			int v=g1.e[i].v;
			if(!ok[v]) continue;
			if(val[v] < val[u]+g1.e[i].w)
			{
				val[v]=val[u]+g1.e[i].w;
				if(!inq[v])
				{
					if(++vis[v]>10*n){
						cout<<-1<<endl;
						return 0;
					}
					q.push(v);
				}
			}
		}
	}
	cout<<max(0ll,val[n])<<endl;
	return 0;
}


Measured memory_bytes: 13972
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define dcout cout<<fixed<<setprecision(20)
#define Accepted_MAGIC cin.tie(0);ios::sync_with_stdio(false)

// typedef long long ll;
using Real = long double;
#define int long long

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 998244353;
constexpr Real eps = 1e-9, pi = acos(-1);

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,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;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

signed main(void){
  Accepted_MAGIC;
  
  string S; cin >> S;
  if(S[2] == S[3] and S[4] == S[5]){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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


int main(){
    int n;
    cin>>n;
    int a=0,b=0,c=0;
    for(int i = 0 ; i < n ; i++){
        int p,q,r;//p is max happiness acheived if i do a today
        int t1,t2,t3;
        cin>>t1>>t2>>t3;
        p=max(b,c)+t1;
        q=max(a,c)+t2;
        r=max(a,b)+t3;
        a=p;b=q;c=r;
    }
    cout<<max(a,max(b,c));
}


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

int main() {
	int n;cin>>n;
	string s;cin>>s;
	for(int i = 0 ; i < s.size() ; i++){
		if(s[i] + n <= 'Z')cout<<(char)(s[i] + n);
		else cout<<(char)(s[i] + n - 'Z' + 'A' - 1);
	}
	
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"regexp"
)

func main() {
	var input string
	fmt.Scanf("%s", &input)
	r := regexp.MustCompile(`([0-1])([0-1])([0-1])`)
	results := r.FindAllStringSubmatch(input, -1)
	counter := 0
	for i, res := range results[0] {
		if i != 0 {
			if res == "1" {
				counter += 1
			}
		}
	}
	fmt.Printf("%d\n", counter)
}

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

typedef int64_t i64;

 
int main()
{
  int n,q, k;
	string s;
  cin >> n >> s >> q;
 
  while (q--) {
    cin >> k;
    i64 r = 0, dc = 0, mc = 0, mdc = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == 'D') {
        dc++;
      } else if (s[i] == 'M') {
        mc++;
        mdc += dc;
      } else if (s[i] == 'C') {
        r += mdc;
      }
 
      if (i >= k-1) {
        if (s[i-k+1] == 'D') {
          dc--;
          mdc -= mc;
        } else if (s[i-k+1] == 'M') {
          mc--;
        }
      }
    }
    cout << r << endl;
  }
 
  return 0;
}

Measured memory_bytes: 1412
import java.util.*;

public class Main {
    public static void main(String[] args)  {
        Scanner scan = new Scanner(System.in);
        int[][] c = new int [3][3];
        for (int i = 0;i < 3; ++i){
            for (int k = 0;k < 3; ++k){
                c[i][k] = Integer.parseInt(scan.next());
            }
        }

        int[] x = new int [3];
        int[] y = new int [3];

        for (int i = 0;i < 3; ++i){
            y[i] = c[0][i]-x[0];
        }

        for (int i = 0;i < 3; ++i){
            x[i] = c[i][0]-y[0];
        }

        for (int i = 0;i < 3; ++i){
            for (int k = 0;k < 3; ++k){
                if (c[i][k] != x[i]+y[k]){
                    System.out.println("No");
                    return;
                }
            }
        }

        System.out.print("Yes");
    }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define PI acos(-1.0)
using namespace std;
int mod=1e9+7;
char s[1005][1005];
int h, w;
ll dp[1005][1005];
ll DP(int i, int j)
{
   // cout<<i<<" "<<j<<endl;
    if(i>=h || j>=w) return 0;
    if(i==h-1 && j==w-1) return 1;
    if(dp[i][j]!=-1) return dp[i][j];
    ll ans=0;
    if(s[i][j+1]=='.')
        ans=(ans+DP(i, j+1))%mod;
    if(s[i+1][j]=='.')
        ans=(ans+DP(i+1, j))%mod;
    return dp[i][j]=ans;
}
int main()
{
    memset(dp, -1, sizeof(dp));
    scanf("%d%d", &h, &w);
    for(int i=0; i<h; i++)
    {
        scanf("%s",s[i]);
    }
    ll ans=DP(0, 0);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 9216
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

vector<int> digitlist(int x){
  vector<int> a;
  while(x!=0){
    int now = x%10;
    x = x/10;
    a.push_back(now);
  }
  return a;
}

int main(){
    int n,k;
    cin >> n >> k;
    
    
    for(int i=-n+1; i<=n-1; i++) cout << k+i << " ";
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
int main(void)
{
	long long n, a[100000] = {}, count = 0, start = 0;
	std::cin >> n;
	for(int i = 0; i != n; i++){
		std::cin >> a[i];
		if(i > 0 && 
			(a[i - 1] - a[start]) * (a[i] - a[i - 1]) < 0){
			count++;
			start = i;
		}
	}
	std::cout << count + 1 << std::endl;
	return 0;
}

Measured memory_bytes: 1024
import sys
import math

input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = (int(input())) % 10
if n in [2, 4, 5, 7, 9]:
    print("hon")
elif n in [0, 1, 6, 8]:
    print("pon")
else:
    print("bon")

Measured memory_bytes: 61832
#include<stdio.h>
#include<string.h>
void quicksort(int*,char *,int,int);
int partition(int *,char *,int,int);
int main(){
	int i,j,f=0,n,count=0;
	char g;
	scanf("%d",&n);
	int N[n],M[n];
	char T[n],Y[n],B[n];
	for(i=0;i<n;i++){
		scanf("%c%c %d",&g,&T[i],&N[i]);
		M[i]=N[i];
		Y[i]=T[i];
		}
	quicksort(N,T,0,n-1);
	
	for(i=0;i<n;i++){
		if(i==0){
			for(j=0;j<n;j++){
				if(N[i]==M[j]) {
					B[count]=Y[j];
					count++;
					}
			}
		}
		else if(N[i-1]<N[i]){
			for(j=0;j<n;j++){
				if(N[i]==M[j]) {
					B[count]=Y[j];
					count++;
					}
			}
		}
	}
	
	for(i=0;i<n;i++){
		//printf("%c ",B[i]);
		if(B[i]==T[i]) f++;
		}
		//printf("\n");
		if(f!=n) printf("Not stable\n");
	if(f==n) printf("Stable\n");
	for(i=0;i<n;i++){
		printf("%c %d\n",T[i],N[i]);
	}
	return 0;
}

void quicksort(int *a,char *t,int p,int r){
	int q;
	int i;
	if(p<r){
	q = partition(a,t,p, r);
   	quicksort(a,t,p,q-1);
   	quicksort(a,t,q+1,r);
   		}
}
int partition(int *a,char *t,int p,int r){
	int x,i,j,k;
	char v;
	x=a[r];
	i=p-1;
	for(j=p;j<r;j++){
		if(a[j]<=x){
			i=i+1;
			k=a[i];
			a[i]=a[j];
			a[j]=k;
			v=t[i];
			t[i]=t[j];
			t[j]=v;

		}
	}
	v=t[r];
	t[r]=t[i+1];
	t[i+1]=v;

	a[r]=a[i+1];
	a[i+1]=x;
	return i+1;
}


Measured memory_bytes: 2800
#include <iostream>
#include <memory.h>
#include <vector>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()

int const N = 500001;
int n, v[N], vs[N], f ;
vector<int> g[N], sec;
ll k; 

void go(int i){
     vs[i] = 1; 
     sec.push_back(i);
     for(auto u: g[i]){
         if(vs[u] == 2){continue;}
         if(vs[u] == 1){f = u; return;} 
         if(!vs[u])go(u);
     }
     vs[i] = 2;
}

int main(){
    scanf("%d%lld", &n, &k);
    for(int i = 1; i<=n; ++i){
        scanf("%d", v+i);
        g[i].push_back(v[i]);
    }
    go(1);
    int rem = 0, f0 = 0;
    vector<int>al;
    for(auto i: sec){
         if(i == f){f0 = 1;}
         if(!f0)++rem; 
         if(f0)al.push_back(i);
    }
    if(k < rem){printf("%d\n", sec[k]);return 0;}
    k -= rem; 
    k %= al.size();
    printf("%d\n", al[k]);
}


Measured memory_bytes: 33684
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 10e9;

void SplittingPile(){

	int n;
	cin >> n;
	ll t[200010];
	cin >> t[0];
	for (size_t i = 1; i < n; i++)
	{
		int at;
		cin >> at;
		t[i] = t[i - 1] + at;
	}
	ll res = 10e10;
	for (size_t i = 0; i < n - 1; i++)
	{
		ll snu = t[i];
		ll ara = t[n - 1] - t[i];
		res = min(res, abs(snu - ara));
	}

	cout << res << endl;

}

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



Measured memory_bytes: 1792
use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).ok();
    let mut stack : Vec<i32> = Vec::new();
    for x in input.trim().split(' ') {
        match x {
            "+" => {
                let a = stack.pop().unwrap();
                let b = stack.pop().unwrap();
                stack.push(b + a);
            },
            "-" => {
                let a = stack.pop().unwrap();
                let b = stack.pop().unwrap();
                stack.push(b - a);
            },
            "*" => {
                let a = stack.pop().unwrap();
                let b = stack.pop().unwrap();
                stack.push(b * a);
            },
            _ => {
                stack.push(x.parse::<i32>().unwrap());
            }
        }
    }
    println!("{}", stack.pop().unwrap());
}



Measured memory_bytes: 5032
#include <bits/stdc++.h>
#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
using namespace std;
const ll INF=1ll<<32;
int main(){
 ll v,e;
 cin>>v>>e;
 ll G[v][v];
 rep(i,v){
   rep(j,v){
     G[i][j]=INF;
     if(i==j)G[i][j]=0;
   }
 }

rep(i,e){
  ll s,t,d;
  cin>>s>>t>>d;
  G[s][t]=d;
}

 rep(k,v){
   rep(i,v){
     rep(j,v){
       if(G[i][k]!=INF&&G[k][j]!=INF){
       G[i][j]=min(G[i][j],G[i][k]+G[k][j]);
       }
     }
   }
 }

rep(i,v){
  rep(j,v){
    if(G[i][j]+G[j][i]<0){
      cout<<"NEGATIVE CYCLE"<<endl;
      return 0;
    }
  }
}

 rep(i,v){
   rep(j,v){
     if(G[i][j]==INF){cout<<"INF";}
     else cout<<G[i][j];
     
     if(j==v-1){
       cout<<endl;
     }
     else cout<<' ';
   }
 }
}


Measured memory_bytes: 3172
#include<iostream>

using namespace std;

int gcd(long long int a, long long int b)
{
	if(b == 0)
		return a;
	return gcd(b, a % b);
}
int main()
{
    long long int a, b;
    cin >> a >> b;
    long long int num = gcd(a, b);
    cout << a*b / num << endl;
}

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

int main() {
	int n,a;
	int min = 1000000;
	int max = -1000000;
	long sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		sum += a;
		if (a <= min) {
			min = a;
		}
		if (a >= max) {
			max = a;
		}
	}
	cout << min << " " << max << " " << sum << endl;
	return 0;
}


Measured memory_bytes: 3120
#include<iostream>
#include<string>

using namespace std;

int main() {
	string s;
	cin >> s;
	int i, j, count = 0;
	if (s.size() % 2 != 0) {
		cout << "No" << endl;
		return 0;
	}
	for (i = 0;i < s.size();++i) {
		for (j = 0;j < s.size() - i;++j) {
			if (i == s.size() - 1) {
				cout << "No" << endl;
				return 0;
			}
			if (s[i] == s[i + j]) {
				count++;
				if(j!=0){
                  s.erase(s.begin() + (i + j));
                  --j;
                }
			}
		}
		if (count % 2 != 0) {
			cout << "No" << endl;
			return 0;
		}
		count = 0;
	}cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,x,ans=0;
	cin>>a>>b>>c>>x;
	for(int i=0;i<=a;i++)
	{
		for(int j=0;j<=b;j++)
		{
			for(int k=0;k<=c;k++)
			{
				if(i*500+j*100+k*50==x)
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import math
import copy




def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:

            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l

a=nCast(input().split())


def func():
    a.sort()
    return int(a[0]*a[1]*0.5)
print(func()) 







Measured memory_bytes: 3696
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a,b;
	cin>>a>>b;
	ll ans;
	if(a>=13){
		ans=b;
	}else if (a>=6){
		ans=b/2;
	}else{
		ans=0;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 764
R, G,B,N = map(int, input().split())
l=[R, G, B]

l.reverse()
r_max=N//l[0]
g_max=N//l[1]
RR=l[0]
GG=l[1]
BB=l[2]
ans=0
for r in range(r_max+1):
    res=N-r*RR
    for g in range(g_max+1):
        x=res-GG*g
        if x<0:
            break
        if x%BB==0:
            ans+=1
            
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;


int main()
{
	string S;
	cin >> S;

	int n = 10 * (int)(S[0] - '0') + (int)(S[1] - '0');
	int m = 10 * (int)(S[2] - '0') + (int)(S[3] - '0');

	bool f1 = n > 0 && n < 13;
	bool f2 = m > 0 && m < 13;

	if (f1 && f2)
	{
		cout << "AMBIGUOUS" << endl;
	}
	else if (f1)
	{
		cout << "MMYY" << endl;
	}
	else if (f2)
	{
		cout << "YYMM" << endl;
	}
	else
	{
		cout << "NA" << endl;
	}

	return 0;
}

Measured memory_bytes: 256