akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int N,M;
vector<ll> D;
vector<pair<int,int>> edges;
vector<int> g[100010];

#define BL 1
#define WH -1

int main(){
  cin>>N>>M;
  D.resize(N);
  rep(i,N) cin>>D[i];
  map<pair<int,int>,int> mp;
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    if(a>b) swap(a,b);
    mp[mkp(a,b)]=i;
    edges.push_back(mkp(a,b));
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vector<int> ans(M,0);

  vector<pair<ll,int>> v;
  rep(i,N) v.push_back(mkp(D[i],i));
  sort(v.begin(),v.end());

  vector<int> col(N,0);
  vector<int> check(N,0);
  for(int i=0;i<N;i++){
    int now=v[i].second;
    bool ok=false;
    bool exi=false;
    for(auto nex:g[now]){
      if(col[nex]!=0){

        int tar=D[nex];
        if(col[nex]==BL){
          tar=0;
          if(check[nex]==0&&D[now]>D[nex]){
            cout<<-1<<endl;
            return 0;
          }
          check[nex]=1;
        }
        if(D[now]==D[nex]&&col[nex]==WH) continue;
        int a=now,b=nex;
        if(a>b) swap(a,b);
        ans[mp[mkp(a,b)]]=D[now]-tar;
        col[now]=WH;
      }
    }

    if(1){
      if(col[now]==0) col[now]=BL;
      for(auto nex:g[now]){
        if(col[nex]==WH&&D[nex]==D[now]){
          int a=now,b=nex;
          if(a>b) swap(a,b);
          ans[mp[mkp(a,b)]]=D[now];
          check[now]=1;
        }
      }
    }
  }

  for(int i=0;i<N;i++){
    if(col[i]==BL) cout<<'B';
    else cout<<'W';
  }
  cout<<endl;
  for(int i=0;i<M;i++) cout<<ans[i]<<endl;

  return 0;
}


Measured memory_bytes: 26352
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

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

// mod. m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll 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;
    cin >> n;
    if(n%10 == 3){
        cout << "bon" << endl;
    }else if(n%10 == 0 || n%10 == 1 || n%10 == 6 || n%10 == 8){
        cout << "pon" << endl;
    }else{
        cout << "hon" << endl;
    }
}



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

#define ll long long

using namespace std;
const int MX = 100'000 + 5; // check bounds!

int n;
char s[MX];

int main() {
    cin >> n >> s;
    char c = s[0];
    int sol = 1;
    for (int i = 1; i < n; ++i) {
        if (s[i] == c)
            continue;
        c = s[i];
        sol++;
    }

    cout << sol;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
 
  vector<int64_t> L(N + 1);
    if (N == 0) {
      L.at(N) = 2;
    }
     
    if (N == 1) {
      L.at(N) = 1;
    }
    
    else {
      for (int i = 2; i < N + 1; i++) {
        L.at(0) = 2;
        L.at(1) = 1;
        L.at(i) = L.at(i - 1) + L.at(i - 2);
      }
    }
  cout << L.at(N);
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());
		boolean[] bad = new boolean[10];
		st = new StringTokenizer(br.readLine());
		for (int i = 0; i < k; i++) {
			int d = Integer.parseInt(st.nextToken());
			bad[d] = true;
		}
		for (int x = n; ; x++) {
			boolean yes = true;
			for (int y = x; y > 0; y /= 10) {
				int d = y % 10;
				if (bad[d]) {
					yes = false;
					break;
				}
			}
			if (yes) {
				System.out.println(x);
				return;
			}
		}
	}
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <LL,LL>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

LL n,m,s,x,y,z,zz,c[60],d[60],dist[60][3000];
bool vis[60][6000];
vector <pair <LL,pii> > g[60];
multiset <pair <LL,pii> > q;

int main()
{
	cin>>n>>m>>s;
	rep(i,m)
	{
		scanf("%lld%lld%lld%lld",&x,&y,&z,&zz);
		g[x].pb(mpr(y,mpr(z,zz)));
		g[y].pb(mpr(x,mpr(z,zz)));
	}
	repn(i,n) cin>>c[i]>>d[i];
	rep(i,55) rep(j,2995) dist[i][j]=1e18;
	dist[1][min(s,2600LL)]=0;
	q.insert(mpr(0,mpr(1,min(s,2600LL))));
	while(!q.empty())
	{
		pair <LL,pii> p=*q.begin();
		//cout<<p.se.fi<<' '<<p.se.se<<' '<<p.fi<<endl;
		q.erase(q.begin());
		if(vis[p.se.fi][p.se.se]) continue;
		vis[p.se.fi][p.se.se]=true;
		//cnt++;
		if(p.se.se+c[p.se.fi]<=2500)
		if(dist[p.se.fi][p.se.se+c[p.se.fi]]>p.fi+d[p.se.fi])
		{
			dist[p.se.fi][p.se.se+c[p.se.fi]]=p.fi+d[p.se.fi];
			q.insert(mpr(dist[p.se.fi][p.se.se+c[p.se.fi]],mpr(p.se.fi,p.se.se+c[p.se.fi]))); 
		}
		rep(i,g[p.se.fi].size())
		{
			if(p.se.se>=g[p.se.fi][i].se.fi)
			{
				if(dist[g[p.se.fi][i].fi][p.se.se-g[p.se.fi][i].se.fi]>p.fi+g[p.se.fi][i].se.se)
				{
					dist[g[p.se.fi][i].fi][p.se.se-g[p.se.fi][i].se.fi]=p.fi+g[p.se.fi][i].se.se;
					q.insert(mpr(p.fi+g[p.se.fi][i].se.se,mpr(g[p.se.fi][i].fi,p.se.se-g[p.se.fi][i].se.fi)));
				}
			}
		}
	}
	for(int i=2;i<=n;i++)
	{
		LL ans=1e18;
		rep(j,2601) ans=min(ans,dist[i][j]);
		cout<<ans<<endl;
	}
	return 0;
}

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

using namespace std;

template <typename T>
struct Graph{
	vector<vector<pair<T,int> > > edge;
	int size;

	Graph(int v){
		size = v;
		edge.resize(v);
	}

	void add_edge(int s,int e){
		edge[s].push_back(make_pair(1,e));
		edge[e].push_back(make_pair(1,s));
	}

	void add_edge(T d,int s,int e){
		edge[s].push_back(make_pair(d,e));
		edge[e].push_back(make_pair(d,s));
	}

	vector<vector<T> > warshall_floyd(){
	    vector<vector<T> > d(size,vector<T>(size,99999999));
	    d.resize(size);
	    int i,j,k;
	    for(i = 0;i < size;i++) d[i].resize(size);
	    for(i = 0;i < size;i++){
            for(j = 0;j < edge[i].size();j++){
                d[i][edge[i][j].second] = edge[i][j].first;
            }
	    }
	    for(k = 0;k < size;k++){
            for(i = 0;i < size;i++){
                for(j = 0;j < size;j++){
                    if(d[i][j] > d[i][k] + d[k][j]){
                        d[i][j] = d[i][k] + d[k][j];
                    }
                }
            }
	    }
	    return d;
	}
};

int h,w;

int check(char x,char y){
    return x == '.' && y == '.';
}

void solve(){
    int i,j;
    string str;
    cin >> h >> w;
    vector<string> strs(h);
    for(i = 0;i < h;i++) cin >> strs[i];
    Graph<int> g(h*w);
    for(i = 0;i < h;i++){
        for(j = 0;j < w;j++){
            g.add_edge(0,i*w+j,i*w+j);
            if(j < w-1 && strs[i][j] == '.' && strs[i][j+1] == '.'){
                g.add_edge(i*w+j,i*w+j+1);
            }
            if(i < h-1 && strs[i][j] == '.' && strs[i+1][j] == '.'){
                g.add_edge(i*w+j,i*w+w+j);
            }
        }
    }
    vector<vector<int> > res = g.warshall_floyd();
    long long ans = 0;
    for(i = 0;i < res.size();i++){
        for(j = 0;j < res[i].size();j++){
            if(ans < res[i][j] && res[i][j] != 99999999) ans = res[i][j];
        }
    }
    cout << ans << endl;
}

int main(){
    solve();
}


Measured memory_bytes: 896
import sys

def main():
  input = sys.stdin.readline
  N, K = map(int, input().split())
  A = list(map(int, input().split()))
  ans = (N-1)//(K-1)
  if (N-1) % (K-1) != 0:
    ans += 1
  print(ans)


if __name__ == '__main__':
  main()

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

int main(){
	long long int N, i, ans=0;
	cin >> N;
	
	for(i=1; i<=N; i++){
		if(i%3!=0 && i%5!=0)	ans += i;
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int a[51]={0,1,2,12,84,770,8340,106400,1546888,25343766,461133960,232367169,627905865,632459808,928262728,919805769,382796331,887217496,639768068,869694124,205875097,205589953,487772376,239955313,998339621,31622834,902930073,146839084,449786840,982224660,865803735,21834818,721531716,26008837,471774471,69010090,700009308,776938882,645550477,526939604,142728157,654489641,128201240,185493259,789721045,977049419,589149550,700648836,25087729,874433491,352791804}; 
int main() 
{
  int n;
  scanf("%d",&n);
  printf("%d",a[n]);
  return 0;
}

Measured memory_bytes: 256
//namespace problems {
//    vector<string> solve(string str) {
//        if (str.size() == 1) return {str};
//        int z = 0;
//        int e = 0;
//        for (auto &c: str) {
//            if (c == '1') e++;
//            else z++;
//        }
//        if (e != z) return {str};
//        return {str.substr(0,1), str.substr(1,str.size()-1)};
//    }
//}
//
//#include <iostream>
//#include <vector>
//#include <complex>
//
//using std::cin;
//using std::cout;
//using std::endl;
//using std::vector;
//using std::string;
#include <complex>
#include <iostream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <functional>
#include <iterator>
#include <tuple>
#include <set>

using namespace std;

int main() {
    int a,b;
    cin >> a >> b;
    
    if (b * 2 >= a) cout << 0 << endl;
    else cout << a - b * 2 <<endl;
    
     return 0;
}

Measured memory_bytes: 256
S = input()

n_i_to_j_mod = [0] * (2019+1) # 2019で割った余りがiになるようなSの部分連続文字列の個数
i_to_end_mod = [0] * (len(S)+1) # S[-i:](Sの後方i文字)を2019で割ったときの余り

for i in range(1, len(S)+1):
    if i == 1:
        i_to_end_mod[1] = int(S[-1]) % 2019
    else:
        i_to_end_mod[i] = (i_to_end_mod[i-1] + int(S[-i]) * pow(10, i-1, 2019)) % 2019
    n_i_to_j_mod[i_to_end_mod[i]] += 1

ans = n_i_to_j_mod[0] + (n_i_to_j_mod[0] * (n_i_to_j_mod[0]-1))//2
for i in range(1, 2019):
    if n_i_to_j_mod[i] >= 2:
        ans += (n_i_to_j_mod[i] * (n_i_to_j_mod[i]-1)) // 2
print(ans)

Measured memory_bytes: 16500
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class d{
    public static void Main(){
        string[] str = Console.ReadLine().Split(' ');
        long n = long.Parse(str[0]);
        long k = long.Parse(str[1]);
        long[] p = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
        long[] c = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
        var circle = new Dictionary<List<long>, List<long>>();
        for(long i=0; i<n; i++){
            long cur = i;
            List<long> cost = new List<long>();
            bool[] already = new bool[n];
            List<long> path = new List<long>();
            long bef = 0;
            while(!already[cur]){
                already[cur] = true;
                path.Add(cur);
                cur = p[cur]-1;
                cost.Add(c[cur] + bef);
                bef = cost[cost.Count-1];
            }
            circle[path] = cost;
        }
        long ans = Int64.MinValue;
        long temp = k;
        foreach(var list in circle){
            long comp = 0;
            var tag = list.Value;
            if(list.Key.Count > k){
                comp = tag.Take((int)k).Max();
            }
            else if(list.Key.Count == k){
                comp = tag.Max();
            }
            else{
                if(tag[tag.Count-1] < 0){
                    comp = tag.Max();
                }
                else{
                    k--;
                    long count = (k/tag.Count);
                    k -= tag.Count*count;
                    k++;
                    comp = (tag[tag.Count-1]*count) + tag.Take((int)k).Max();
                }
            }
            if(ans < comp){
                ans = comp;
            }
            k = temp;
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 777396
#define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z)
a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;){float s=0,t=0,z=.02,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define vi vector < ll  int >
#define CLR(a) memset((a),0,sizeof(a))
#define mp make_pair
#define hell 1000000007
using namespace std;

/*
vector < int > tree(400005);

void buildtree (vector < int > v,int node,int start,int fin)
  {
      if(start==fin)
      {
          tree[node]=v[start];
          return;
      }
      int mid=(start+fin)/2;
      buildtree(v,2*node,start,mid);
      buildtree(v,2*node+1,mid+1,fin);
      tree[node]=tree[2*node]+tree[2*node+1];
  }

 int sum (int node,int tl,int tr,int l , int r)
   {
       if(l>r) return 0;
       if(l==tl and r==tr) return tree[node];
       int mid=(tl+tr)/2;
       return sum(2*node,tl,mid,l,min(r,mid))+sum(2*node+1,mid+1,tr,max(l,mid+1),r);
   }

  void update(int node,int tl , int tr,int pos,int val)
    {
        if(tl==tr) {tree[node]=val; return;}
        int mid=(tl+tr)/2;
        if(pos<=mid)
              update(2*node,tl,mid,pos,val);
        else
            update(2*node+1,mid+1,tr,pos,val);
        tree[node]=tree[2*node]+tree[2*node+1];

    } */

bool check(string &st,int f,int s,int l,int n,char c)
{
    ll k = 0;
    for(int i=0;i<l;i++)
    {
        if(st[(i+s)%n]==c)
            k++;
    }
    if(k>=f)    return true;
    return false;
}
int LS(vector < int > &v,int i,int c)
 {
     int n=v.size();
     vector < int > vp;
     int k=i;
     for(i;i<n;i++) vp.pb(v[i]);
    n=vp.size();
    int lis[n];
    lis[0] = 1;
     if(c==1) return 1;
     for ( i = 1; i < n; i++ )
    {
        lis[i] = 1;
        for (int j = 0; j < i; j++ )
            if ( vp[i] > vp[j] && lis[i] < lis[j] + 1)
                lis[i] = lis[j] + 1; {if(lis[i]==c) return i;}
    }
    //rep(i,0,n) cout<<lis[i]<<" ";
   // cout<<endl;
    return 0;
 }

 void solve()
{
ll int i,j=0,r=200,p,q,k=100005,d,y=1,h,flag=1,n,m=0,a=hell,b=hell,id,h1,h2,a1,b1,a2,w,x,ans=0,l;
//vector < pair < int , pair < int , int > > >vp(n);s
string s;
    cin>>s;
    n=s.size();
   rep(i,0,n)
   {
       if(i%2==1 and (s[i]=='R')){cout<<"No"; return;}
       if(i%2==0 and s[i]=='L') {cout<<"No"; return;}
   }
    cout<<"Yes";

}


signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
   //cin>>t;
    while(t--)
    solve();
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#define ordered_set tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define deb(x) cout << #x << " --> " << x << endl;
#define deb1a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
        cout << it << " ";        \
    cout << endl;
#define deb2a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
    {                             \
        for (auto it1 : it)       \
        {                         \
            cout << it1 << " ";   \
        }                         \
        cout << endl;             \
    }
#define deb3a(v)                               \
    cout << #v << "-->" << endl;               \
    for (auto it : v)                          \
    {                                          \
        cout << it.fi << " " << it.se << endl; \
    }
#define mod 1000000007
#define so(v) sort(v.begin(), v.end())
#define fi first
#define se second
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int mI(int a, int m)
{
    return power(a, m - 2, m);
}
vector<vector<int>> dir = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};

int n, m;
vector<vec> g;
vec vis;
vec val;
void bg()
{
    cin >> n >> m;
    g.resize(n);
    vis.resize(n, 0);
    val.resize(n, 0);
    int x, y;
    fo(i, m)
    {
        cin >> x >> y;
        x--;
        y--;
        g[x].pb(y);
        g[y].pb(x);
    }
    // fo(i, n)
    // {
    //     cin >> val[i];
    // }
}
int sum = 0;
int c = 0;
void dfs(int i)
{

    c++;
    //sum += val[i];
    for (auto it : g[i])
    {
        if (vis[it] == 0)
        {
            vis[it] = 1;
            dfs(it);
        }
    }
}

void solve()
{
    bg();
    //vector<pair<int, int>> ans;
    int ans = 0;
    fo(i, n)
    {
        if (vis[i] == 0)
        {
            vis[i] = 1;

            sum = 0;
            c = 0;
            dfs(i);
            ans = max(ans, c);
           // ans.pb({sum, c});
        }
    }
    //so(ans);
    cout << ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    srand(time(0));

    // FILE *fin = freopen("ip.txt","r",stdin);
    // FILE *fout = freopen("op.txt","w",stdout);
    int t = 1, nn = 1;
    //cin >> t;
    while (t--)
    {
        // cout << "Case #" << nn << ":"
        //      << " ";
        // nn++;
        solve();
    }
}

Measured memory_bytes: 23456
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int a[3];
	int ans=0;
	cin>>a[0]>>a[1]>>a[2];
	
	if (a[0] % 2==a[1] % 2 && a[1] % 2==a[2] % 2)
	{
		sort(a,a+3);
		ans=(a[1]-a[0])/2+(a[2]-a[1]);
	}
	else
	{
		int t;
		int l;
		if (a[0] % 2== a[2] % 2)
		{
			t=a[1];
			a[1]=a[2];
			a[2]=t;
		}
		else if (a[1] % 2==a[2] % 2)
		{
			t=a[0];
			a[0]=a[2];
			a[2]=t;
			
		}
		
		ans++;
		a[0]++;
		a[1]++;
		sort(a,a+3);
		ans+=(a[1]-a[0])/2+(a[2]-a[1]);
	}
	cout<<ans;
	return 0;

} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define F(n) for(ll i=0;i<n;i++)
#define Fab(a,b) for(ll i=a;i<b;i++)
//*max_element(a, a + n)
//cin.ignore(numeric_limits<streamsize>::max(), '\n');


ll t,n;


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

#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    
    cin>>n;ll ans = 0;
    F(n+1){
        if(i%3!=0 && i%5!=0)
            ans += i;
    }
    cout<<ans;
    return 0;
}
  



Measured memory_bytes: 3584
#include <iostream>
using namespace std;
int main(void){
    long long int n,m,z=2;
    cin >> n >> m;
    for(int i=1;i<m;i++){
        z*=2;
    }
    long long int ans=(m*1900+(n-m)*100)*z;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
const ll mo=1000000007;
string ans="No";
ll dp[0][0];

int main()
{
ll a,b,c;
cin >> a>>b>>c;

if(a<c&&c<b)ans="Yes";
if(a>c&&c>b)ans="Yes";
cout << ans << endl;
return 0;
}








Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
using namespace std;
using ll = long long;

signed main() {
    IO;
    int n;
    cin >> n;
    map<string, int> m;
    for(int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        ++m[s];
    } 
    cout << "AC x " << m["AC"] << "\n";
    cout << "WA x " << m["WA"] << "\n";
    cout << "TLE x " << m["TLE"] << "\n";
    cout << "RE x " << m["RE"] << "\n";
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>

using namespace std;

int main(){
  int n;
  string s;
  cin >> n >> s;
  int count = 0;
  int max = 0;
  
  for(int i = 0; i < n; i++){
    if(s[i] == 'I') count++;
    else count--;
    if(max < count) max = count;
  }
  
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
struct person{
    int left,safe,right;
};
person mem[200000];
int main(){
    int N,M,Q;
    cin>>N>>M>>Q;
    for(int i=0;i<N;i++){
        mem[i].safe=1;
        mem[i].left=i-1;
        mem[i].right=i+1;
    }
    mem[0].left=N-1;
    mem[N-1].right=0;
    int batton=0;
    for(int i=0;i<M;i++){
        int a;
        cin>>a;
        for(int j=0;j<a;j++){
            if(a%2==0)batton=mem[batton].right;
            else batton=mem[batton].left;
        }
        mem[batton].safe=0;
        mem[mem[batton].left].right=mem[batton].right;
        mem[mem[batton].right].left=mem[batton].left;
        batton=mem[batton].right;
    }
    for(int i=0;i<Q;i++){
        int a;
        cin>>a;
        cout<<mem[a].safe<<endl;
    }
    return 0;
}

Measured memory_bytes: 3504
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef pair<int,int> P;

int main() {
    int i,j,p,q,temp;
    long long int t=0;
    int flag=0;
    int n;
    string s;
    long long int x,y;
    cin>>n;
    temp=n;
    while(n!=0){
        flag=flag+n%10;
        n/=10;
    }

if(temp%flag==0){cout<<"Yes";}
else{cout<<"No";}
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#include<queue>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
typedef long long ll;
typedef pair<int,int> P;
int ceil(int a,int b){// a以上でbの倍数の最小値を出力//
    return (a+b-1)/b*b;
}
int stoii(string s){//stoi関数の代用 文字列を数値として読み取りint型に変換//
    return atoi(s.c_str());
}
int dp[110][110];
int main(){
	int n;
	while(cin>>n&&n){
		vector<int> v(n,0);
		rep(i,n) cin>>v[i];
		sort(v.begin(),v.end());
		ll min=1000000;
		rep(i,n-1){
			if(v[i+1]-v[i]<min) min=v[i+1]-v[i];
		}	
		cout<<min<<endl;
	}
}	


Measured memory_bytes: 3136
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt[3] = { 0 };
	rep(i, n) {
		if (s[i] == 'R') cnt[0]++;
		if (s[i] == 'G') cnt[1]++;
		if (s[i] == 'B') cnt[2]++;
	}
	ll ans = 1;
	rep(i, 3) ans *= cnt[i];
	rep(j,n){
		rep(i,j ) {
			int k = 2 * j - i;
			if (k < n) {
				if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) {
					ans--;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include<string.h>
#include <algorithm>
#include<math.h>
#include<vector>
#include <queue>
#include <deque> 
#define ll long long
#define M 1000000007 
#define MM 998244353
using namespace std;
 
int main()
{
	int n, ans = 0;

	cin >> n;

	int v[n], c[n];

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

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

	for (int i = 0; i < n; i++)
	{
		if (v[i] > c[i])
		{
			ans = ans + v[i] - c[i];
		}
	}

	cout << ans;

    return 0;
}

Measured memory_bytes: 3584
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int g = sc.nextInt();
        int b = sc.nextInt();
        solve(r,g,b);
    }
    static void solve(int r, int g, int b){
        if(judge(r,g,b)){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
    static boolean judge(int r, int g, int b){
        int tmp = g*10+b;
        if(tmp%4==0)return true;
        return false;
    }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    long long sum_a = 0;
    long long sum_A = 0;
    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
        sum_a += A.at(i);
        if(i%2==0) sum_A += A.at(i);
    }
    
    int a = sum_A - sum_a/2;
    cout << 2*a;
    for(int i = 0; i < N-1; i++) {
        cout << " " << 2*(A.at(i) - a);
        a = A.at(i) - a;
    }
    cout << endl;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
int main(){
    int n ;
    cin >> n ;
    vector<int> vec (n);
    int t;
    rep(i, n-1){
        cin >> t ;
        vec[t - 1]++ ;
    }
    for(int k : vec){
        cout << k << endl;
    }
}


Measured memory_bytes: 4052
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll H,W;
ll a[510][510];

int main(){
    cin>>H>>W;
    for(ll i=0;i<H;i++){
        for(ll j=0;j<W;j++){
            cin>>a[i][j];
        }
    }
    ll nowH=0,nowW=0;
    bool isMoving=false;
    struct Output{
        ll preH,preW;
        ll nowH,nowW;
    };
    vector<Output> outV;
    while(nowH<H){
        if(a[nowH][nowW]%2==1){
            isMoving = !isMoving;
        }
        ll preH=nowH,preW=nowW;
        if(nowH%2==0){
            nowW++;
            if(nowW>=W){
                nowW=W-1;
                nowH++;
            }
        }else{
            nowW--;
            if(nowW<0){
                nowW=0;
                nowH++;
            }
        }
        if(nowH<H && isMoving){
            outV.push_back(Output{preH,preW,nowH,nowW});
        }
    }
    cout<<outV.size()<<endl;
    for(auto o:outV){
        cout<<o.preH+1<<" "<<o.preW+1<<" "<<o.nowH+1<<" "<<o.nowW+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 8432
def input
n = gets.strip.to_i
ws = n.times.map{ gets.strip }
return [n, ws]
end

def yes_or_no(n, ws)
        if ws.group_by{|x| x}.values.map{|wg| wg.size != 1 }.any?
        return  "No"
        end

        if ws.each_cons(2).map{|a, b| a[-1] == b[0]}.all?
        return  "Yes"
        end

        return "No"
end

puts yes_or_no(*input())

Measured memory_bytes: 1788
#include<iostream>
#include<iomanip>

using namespace std;
const double PI = 3.141592653589;

int main() {
	double r;
	cin >> r;

	cout << fixed << setprecision(6) << r * r * PI  << " " << fixed << setprecision(6) << 2 * r * PI << endl;
}


Measured memory_bytes: 3280
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
#n, m = map(int, input().split())
s = input()
t = input()
#s,t = input().split()
#a = [int(input()) for _ in range(n)]
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

ans = 0

for ch1,ch2 in zip(s,t):
    if ch1 != ch2:
        ans += 1
        
print(ans)

Measured memory_bytes: 9396
using System;

namespace AtCoder_Beginner_Contest_051_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string moto = Console.ReadLine();
            string a1 = moto.Substring(0, 5);
            string a2 = moto.Substring(6, 7);
            string a3 = moto.Substring(14, 5);
            Console.WriteLine(a1 + " " + a2 + " " + a3);
        }
    }
}


Measured memory_bytes: 2776
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>
#include <functional>
#include <queue>

#define int long long
int inf = (1LL <<  62);
using namespace std;

signed main(){
    int n[3];
    for(int i = 0; i < 3; i++){
        cin >> n[i];
    }
    sort(n, n + 3);
    cout << n[0] + n[1];
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
using namespace std;

vector<int>c[5001];
bool g[5001]{};
vector<int>s;
void saiki(int a) {
	g[a] = true;
	for (int i : c[a]) {
		if (g[i])continue;
		saiki(i);
	}
	s.push_back(a);
	cout << a << endl;
}
int main() {
	int a, b; cin >> a >> b;
	for (int d = 0; d < b; d++) {
		int e, f; scanf("%d%d", &e, &f);
		c[f].push_back(e);
	}
	for (int h = 1; h <= a; h++) {
		if (!g[h])saiki(h);
	}
	bool p = false;
	for (int u = 0; u < s.size()-1; u++) {
		if (find(c[s[u + 1]].begin(), c[s[u + 1]].end(), s[u]) == c[s[u + 1]].end())p = true;
	}
	cout << p << endl;
}

Measured memory_bytes: 3800
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <climits>

using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

typedef long long LL;
typedef vector<int> VI;

int main() {
  int N;
  cin >> N;
  VI d(N);
  REP(i, N) {
    cin >> d[i];
  }
  sort(d.begin(), d.end());
  cout << d[N/2] - d[N/2 - 1] << endl;
  return 0;
}


Measured memory_bytes: 640
const INF: i64 = 1 << 50;
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let n = sc.read();
    let a: Vec<i64> = sc.vec(n);
    let mut graph = vec![vec![]; n];
    for _ in 1..n {
        let u = sc.read::<usize>() - 1;
        let v = sc.read::<usize>() - 1;
        graph[v].push(u);
        graph[u].push(v);
    }

    let mut min_dp = vec![vec![]; n];
    let mut power_dp = vec![vec![]; n];
    dfs(0, 0, &a, &graph, &mut min_dp, &mut power_dp);
    for i in 0..n {
        if min_dp[0][i] < 0 || power_dp[0][i] < INF {
            println!("{}", i);
            return;
        }
    }
}

fn dfs(
    v: usize,
    p: usize,
    a: &Vec<i64>,
    graph: &Vec<Vec<usize>>,
    min_dp: &mut Vec<Vec<i64>>,
    power_dp: &mut Vec<Vec<i64>>,
) {
    min_dp[v].push(a[v]);
    power_dp[v].push(if a[v] > 0 { a[v] } else { INF });
    for &child in graph[v].iter() {
        if p == child {
            continue;
        }
        dfs(child, v, a, graph, min_dp, power_dp);
        power_dp[v] = connect(&power_dp[v], &power_dp[child], &min_dp[child], true);
        min_dp[v] = connect(&min_dp[v], &power_dp[child], &min_dp[child], false);
    }
}

fn connect(dp: &Vec<i64>, power: &Vec<i64>, min: &Vec<i64>, is_power: bool) -> Vec<i64> {
    let mut next = vec![INF; power.len() + dp.len() + 1];
    for parent_cut in 0..dp.len() {
        for child_cut in 0..power.len() {
            let total_cut = parent_cut + child_cut;
            if !is_power {
                chmin(&mut next[total_cut], dp[parent_cut] + min[child_cut]);
            }
            if power[child_cut] < INF {
                chmin(&mut next[total_cut], dp[parent_cut] + power[child_cut]);
            }
            if power[child_cut] < INF || min[child_cut] < 0 {
                chmin(&mut next[total_cut + 1], dp[parent_cut]);
            }
        }
    }
    next
}

fn chmin<T: Ord>(a: &mut T, b: T) {
    if *a > b {
        *a = b;
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 408572
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = 1;
		int x = 1;
		while(n != 0){
			n = sc.nextInt();
			if(n != 0){
				System.out.println("Case " + x + ": " + n);
				x += 1;
			}
		}
	}
}

Measured memory_bytes: 41464
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b && a!=c || a==c && a!=b || b==c && b!=a){
		cout<<"Yes";
	}
	else cout<<"No";
	return 0;
} 

Measured memory_bytes: 256
n = int(input())
li = set(list("MARCH"))

name_li = set()
name = dict()

for i in range(n):
    s = input()
    if s[0] in li:
        name.setdefault(s[0], 0)
        name[s[0]] += 1
        name_li.add(s[0])

import itertools
c_list = list(itertools.combinations(name_li, 3))

ans = 0

for i in c_list:
    ans += name[i[0]] * name[i[1]] * name[i[2]]
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n=0;
    int i=0;
    int j=0;
    long S[101];
    int T1=0;
    int T2=0;
    int minj=0;
    
    int count=0;
    cin>>n;
    for (i=1;i<=n;i++)
    {
        cin>>S[i];
        
    }
    
    for (i=1;i<=n;i++)
    {
        minj=i;
        for (j=i;j<=n;j++)
        {
            if (S[j]<S[minj])
            {
                minj=j;
                
                
            }
                
        }
        if(S[i]!=S[minj])
        {
            T1=S[i];
            T2=S[minj];
            S[i]=T2;
            S[minj]=T1;
            count++;
        }    
    }
    
    for (i=1;i<n;i++)
    {
        
        cout<<S[i]<<" ";
    }
    cout<<S[n]<<endl;
    cout<<count<<endl;
}



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

using namespace std;

int main(){
	string s, t;
	cin >> s >> t;
	int v = min(s.size(), t.size());
	int cnt = 0;
	for(int i = 0; i < v; i++){
		if(s[i] != t[i]) cnt++;
	}
	cout << cnt << endl;
}



Measured memory_bytes: 3840
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll mod = 1000000007;
const ll Mod = 998244353;
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p = mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n, k;
int a[200000];
H b[200000];
vector<int>e[200000];
int c[200000];
signed main() {
	cin >> n >> k;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		if (i > 1) e[a[i]].push_back(i);
		if (i > 1 && i == a[i]) ans++;
		if (i == 1 && i != a[i]) {
			ans++;
			a[i] = 1;
		}
		b[i].y = i;
		b[i].x = Inf;
	}
	queue<int>q;
	b[1].x = 0;
	int m = 1;
	q.push(1);
	while (!q.empty()) {
		int t = q.front(); q.pop();
		for (int i = 0; i < e[t].size(); i++) {
			if (b[e[t][i]].x > b[t].x + 1) {
				b[e[t][i]].x = b[t].x + 1;
				q.push(e[t][i]);
				m++;
			}
		}
	}
	sort(b + 1, b + n + 1);
	for (int i = m; i > 1; i--) {
		int t = b[i].y;
		c[t]++;
		if (c[t] == k && a[t] != 1) {
			c[t] = 0;
			ans++;
		}
		c[a[t]] = max(c[a[t]], c[t]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;
using P = pair<int, int>;

ll modnum = 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() {

    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    map<ll, ll> mp;
    rep(i, n) mp[a[i]]++;

    ll sum = 0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        if(itr->second > 1) sum += (itr->second * (itr->second-1))/2;
    }

    rep(i, n) {
        ll ans = sum;
        if(mp[a[i]] > 1) {
            ans -= (mp[a[i]] * (mp[a[i]]-1))/2;
            if(mp[a[i]] > 2) {
                ans += ((mp[a[i]]-1) * (mp[a[i]]-2))/2;
            }
        }
        cout << ans << endl;


    }



    return 0;
}


Measured memory_bytes: 11008
# -*- coding: utf-8 -*-
"""
Created on Sat May  2 00:21:08 2020

@author: Kanaru Sato
"""
import sys
sys.setrecursionlimit(10 ** 6)

N = int(input())
h = list(map(int, input().split()))
memo = [-1]*N
memo[0] = 0
memo[1] = abs(h[1]-h[0])

#topdown
def cost(n):
    if n <= 1 or memo[n] >= 0:
        return memo[n]
    else:
        memo[n] = min(cost(n-2)+abs(h[n]-h[n-2]),cost(n-1)+abs(h[n]-h[n-1]))
        return memo[n]

print(cost(N-1))

Measured memory_bytes: 51328
#include <stdio.h>

int n,A[50];
int solve(int i,int m){
  int res;
  if(m==0) return 1;
  if(i>=n) return 0;
  res=solve(i+1,m)||solve(i+1,m-A[i]);
  return res;
}

int main(){
  int q,M,i;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&M);
    if(solve(0,M)) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

Measured memory_bytes: 580
//NAME-ADITYYA OJHA
                                               /*
                                                      GURU(MENTOR)-AARADHYA
                                               */
/*
 *     Heart beats fast
 *         Colors and promises
 *             How to be brave
 *                 How can I love when I am afraid to fall...
                                             (courtesy-amnesiac_dusk)
 */

#include <bits/stdc++.h>
#define ll long long int
#define forin for(int i=0;i<n;i++)
#define pb push_back
#define vx vector<ll> x
#define vy  vector<ll> y
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define  f   first
#define  s   second
#define mod 1000000007



using namespace std;

//check for corner cases(for n==1)
// check for int overflow
// run on some sample cases before submitting

int main()
{
  fast;
   char a;
   cin>>a;
   if(isupper(a))
    cout<<'A'<<endl;
    else
        cout<<'a'<<endl;



}


Measured memory_bytes: 3604
S = input()

mae = int(S[0:2])
ushiro = int(S[2:4])

if ushiro > 0 and ushiro < 13:
    if mae > 0 and mae < 13:
        print('AMBIGUOUS')
    else:
        print('YYMM')
elif mae > 0 and mae < 13:
    print('MMYY')
else:
    print('NA')

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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll D, E;
    while (cin >> D >> E, D || E) {
        double ans = linf;
        rep(x, D+1) {
            ll y = D - x;
            chmin(ans, abs(sqrt(x * x + y * y)-E));
        }
        cout << fixed << setprecision(10) << ans << endl;
    }
}

Measured memory_bytes: 3228
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == '1') {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = [[]] * K
d = [0] * K
for i in range(2 * K):
    if i % 2:
        A[i // 2] = list(map(int, input().split()))
    else:
        d[i // 2] = int(input())
print(N - len(set([flatten for inner in A for flatten in inner])))


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

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s, t; cin >> s >> t;
    vector<int > v;
    for (int i = 0; i < s.size(); i++) if (s[i] != t[i]) v.push_back(i);
    int ans = v.size();
    cout << ans << '\n';
    return 0;
}


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

int main(){
    int n, s[3];
    cin >> n >> s[0] >> s[1] >> s[2];
    int l[n];
    for(int i = 0; i < n; i++) cin >> l[i];
    int res = 1e9;
    int bit[3] = {};
    for(bit[0] = 1; bit[0] < (1 << n); bit[0]++){
        for(bit[1] = 1; bit[1] < (1 << n); bit[1]++){
            if(bit[1] & bit[0]) continue;
            for(bit[2] = 1; bit[2] < (1 << n); bit[2]++){
                if(bit[2] & bit[0]) continue;
                if(bit[2] & bit[1]) continue;
                int sum[3] = {}, num[3] = {};
                for(int i = 0; i < n; i++){
                    for(int j = 0; j < 3; j++){
                        if(bit[j] >> i & 1){
                            sum[j] += l[i];
                            num[j]++;
                        }
                    }
                }
                int score = 0;
                for(int i = 0; i < 3; i++){
                    score += abs(sum[i] - s[i]);
                    score += (num[i] - 1) * 10;
                }
                res = min(res, score);
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int i=0;
		int data[]=new int[10000];
		while(true){
			int x=sc.nextInt();

			if(x==0)	break;
			else{
				data[i]=x;
				i++;
			}
		}

		for(int j=0;j<i;j++)	System.out.println("Case "+(j+1)+": "+data[j]);
	}
}

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


using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;




int main() {

	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;

	VI p(a);
	VI q(b);
	VI r(c);
	REP(i, a)cin >> p[i];
	REP(i, b)cin >> q[i];
	REP(i, c)cin >> r[i];
	sort(ALL(p));
	sort(ALL(q));
	sort(ALL(r));
	reverse(ALL(p));
	reverse(ALL(q));
	reverse(ALL(r));
	
	priority_queue<int> pp;
	priority_queue<int> rr;

	REP(i, x)pp.push(p[i]);
	REP(i, y)pp.push(q[i]);
	REP(i, c)pp.push(r[i]);

	ll ans = 0;

	REP(i, x + y) {
		if (rr.empty()) {
			ans += pp.top();
			pp.pop();
		}
		else {
			if (pp.top() < rr.top()) {
				ans += rr.top();
				rr.pop();
			}
			else {
				ans += pp.top();
				pp.pop();
			}
		}
	}
	cout << ans << endl;


}



Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
  int n;
  cin >> n;
  int inp = 0;
  int it = 0;
  int f = 0;
  rep(i, n){
    cin >> inp;
    if(i == 0) it = inp -1;
    if(it < inp){
      it = inp -1;
    }else if(it == inp){
      it = inp;
    }else if(it > inp){
      f = 1;
      break;
    }
  }
  if(f == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

const int N = 1e5 + 10;
int n, ans, m, a;
multiset<int> ST;
multiset<int>::iterator it;

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

    ans = 1;

    scanf("%d", &a);
    ST.insert(a);

    for(int i=2; i<=n; i++){
        scanf("%d", &a);
        if(a <= *ST.begin()){
            ST.insert(a);
            ans++;
        } else {
            it = ST.lower_bound(a);
            it--;
            ST.erase(it);
            ST.insert(a);
        }

    }

    printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 4992