akhauriyash/Code-Regression huggingface dataset:
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"


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

	int a,b,c;
	cin>>a>>b>>c;
	cout<<max(0ll,c-a+b)<<endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define Rep(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SMALLPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const int inf=1000000007;
const int mod=1000000007;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}
int main(){
  int n;cin>>n;
  //vvi g(n,vi(n));
  vvi v(n);
  rep(i,n){
    string s;cin>>s;
    /*rep(j,n){
      if(s[j]=='0')g[i][j]=0;
      else g[i][j]=1;
    }*/
    rep(j,n){
      if(s[j]=='1')v[i].push_back(j);
    }
  }
  //rep(i,n)rep(j,n)if(g[i][j])v[i].push_back(j);
  int ans=-1;
  rep(k,n){
    vi r(n),l(n);
    l[k]=1;
    r[k]=1;
    queue<int> q;
    q.push(k);
    int m=-1;
    while(!q.empty()){
      bool b=false;
      int a=q.front();
      q.pop();
      for(int x:v[a]){
        if(r[x]==1&&(l[x]!=l[a]-1&&l[x]!=l[a]+1)){
          b=true;
          m=-1;
          break;
        }
        if(r[x]==0){
          q.push(x);
          r[x]=1;
          l[x]=l[a]+1;
          chmax(m,l[x]);
        }
      }
      if(b)break;
    }
    chmax(ans,m);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
// inputに入力データ全体が入る
function Main(input) {
	var args = input.split(" ");
	var N = parseInt(args[0],10);
	var sum = parseInt(args[1],10);
	var output = "";

	double_loop:
	for(var x = 0;x <= N;x++){
		for(var y = 0;y<= N - x;y++){
			z = N-x-y;
			if(10000*x+5000*y+1000*z == sum){
				output = `${x} ${y} ${z}`;
				break double_loop;
			}
		}
		output = "-1 -1 -1";
	}
	//出力
	console.log(output);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<stdio.h>
int main(void)
{
	int D,L,a,b;
	scanf("%d %d",&D,&L);
	a=D%L;
	b=D/L;
	if(D%L==0){
	printf("%d\n",b);
	}
else{
printf("%d\n",a+b);
}
return 0;
}	



Measured memory_bytes: 2756
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    ll n, k; cin>>n>>k;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];

    vector<ll> rcnt(n, 0), lcnt(n, 0);
    // 右にあり、小さい
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(a[i] > a[j]) rcnt[i]++;
        }
    }

    // 左にあり、小さい
    for(int i=0; i<n; i++){
        for(int j=0; j<i; j++){
            if(a[j] < a[i]) lcnt[i]++;
        }
    }

    ll ans = 0;
    for(int i=0; i<n; i++){
        ll A = rcnt[i];
        ll d = rcnt[i] + lcnt[i];
        if(k % 2 == 0){
            (ans += k / 2 * (2LL * A + ((k - 1) * d) % MOD)) %= MOD;
        }
        else{
            (ans += k * (A + ((k / 2) * d) % MOD)) %= MOD;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define yorn(f) puts((f)?"Yes":"No")
ll n, m;
//ld ;
//string s;

int main() {
  cin >> n >> m;
  ll a[n];
  ll total = 0;
  for(ll i=0; i<n; i++){
    ll tempa = 0;
    cin >> tempa;
    total +=tempa;
    a[i] = tempa;
  }
  ll threshold = total / (4 * m);
  if(total % (4 * m) == 0) threshold -= 1;
  for(ll i=0; i<n; i++){
    if(a[i]>threshold) m -= 1;
  }
  yorn(m<=0);
  return 0;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
using ll = long long;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((int)(x).size())
#define MSG(a) cout << #a << " " << a << endl;

int main()
{
    int n, r;
    cin >> n >> r;
    if (n < 10) {
        cout << 100 * (10 - n) + r << endl;
    } else {
        cout << r << endl;
    }
    return 0;
}


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

int main(){
  int a,b,c,x,y;cin>>a>>b>>c>>x>>y;c*=2;
  cout<<min(a*x+b*y,c*min(x,y)+abs(x-y)*min((x>y?a:b),c));
}

Measured memory_bytes: 256
l=[]
while True:
  e = list(map(int,input().split()))
  if e==[-1, -1, -1]:
    break
  l.append(e)

for i in range(0, len(l)):
  t = l[i]
  if t[0] == -1 or t[1] == -1:
    print("F")
  elif t[0] + t[1] >= 80:
    print("A")
  elif t[0] + t[1] >= 65 and t[0] + t[1] < 80:
    print("B")
  elif t[0] + t[1] >= 50 and t[0] + t[1] < 65:
    print("C")
  elif t[0] + t[1] >= 30 and t[0] + t[1] < 50:
    if t[2] >= 50:
      print("C")
    else:
      print("D")
  else:
    print("F")


Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef vector<int> vec;
int main(){
  int n,memo=0; cin>>n;
  vec a(n);
  rep(i,n){cin>>a[i];memo=memo^a[i];}
  rep(i,n)a[i]=a[i]^memo;
  rep(i,n)cout<<a[i]<<" ";
}

Measured memory_bytes: 4044
import math
import sys

a,b = map(int,input().split())

A = math.floor(a / 0.08)
B = math.floor(b / 0.10)

for i in range(1,1251):
    if math.floor(i * 0.08) == a and math.floor(i * 0.10) == b:
        print(i)
        sys.exit()
print('-1')


Measured memory_bytes: 38512
#include<bits/stdc++.h>
#define $$ long long int
#define pb push_back
#define db pop_back
#define q2(n) (n%2)==0
#define vp vector<pair <$$,$$> >
#define vctr vector<$$>
#define in(a) scanf("%lld",&a)
#define out(a) printf("%lld ",a)
#define loop(i,m,p) for ($$ i = m; i < p; ++i)
#define loopn(i,m,p) for ($$ i = p-1; i >=m; --i)

using namespace std;

int main()
{
  $$ a,b,t;
  cin>>a>>b>>t;
  $$ tot=(t/a)*b;
  cout<<tot<<endl;


  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  ll n;
  cin >> n;
  ll a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  ll mn = min({a, b, c, d, e});
  ll ans = (n-1+mn)/mn;
  ans += 4;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


A, P = read_ints()
P += 3 * A
print(P//2)


Measured memory_bytes: 3064
import math

#x>yとする
def gcd(x, y):
    rem = x%y
    if rem == 0:
        return y
    else:
        return gcd(y,rem)

def lcm(x,y):
    return (x*y)//gcd(x,y)

A,B,C,D = map(int,input().split())
A = A - 1
l = lcm(D,C)
underA = A- A//C - A//D + A//l
underB = B- B//C - B//D + B//l
        
print(underB-underA)

Measured memory_bytes: 38256
#include<iostream>
#include<queue>
#include<string.h>
using namespace std;
struct l{
	int tx;
	int ty;
	int kx;
	int ky;
	int cnt;
};
queue<l> p;
bool ps[50][50][50][50]={};
int main(){
	int x,y,tlx,tly,klx,kly,d[50][50],i,j,cl,tmx[4]={0,1,0,-1},tmy[4]={-1,0,1,0},kmx[4]={0,-1,0,1},kmy[4]={1,0,-1,0},k,z;
	l v;
	while(1){
		cin>>x>>y;
		if(x==0&&y==0)break;
		cin>>tlx>>tly;
		cin>>klx>>kly;
		for(i=0;i<y;i++){
			for(j=0;j<x;j++){
				cin>>d[i][j];
			}
		}
		memset(ps,0,sizeof(ps));
		v.tx=tlx-1;
		v.ty=tly-1;
		v.kx=klx-1;
		v.ky=kly-1;
		v.cnt=0;
		p.push(v);
		while(1){
			tlx=p.front().tx;
			tly=p.front().ty;
			klx=p.front().kx;
			kly=p.front().ky;
			cl=p.front().cnt;
			p.pop();
			if(tlx==klx&&tly==kly||cl>=100){
				while(!p.empty()){
					p.pop();
				}
				break;
			}
			if(ps[tlx][tly][klx][kly]){
				if (!p.empty())
					continue;
				else
					break;
			}
			else{
				ps[tlx][tly][klx][kly]=true;
			}
			for(i=0;i<4;i++){
				if(d[tly+tmy[i]][tlx+tmx[i]]==0&&(tlx+tmx[i])>=0&&(tlx+tmx[i])<x&&(tly+tmy[i])>=0&&(tly+tmy[i])<y){
					v.tx=tlx+tmx[i];
					v.ty=tly+tmy[i];
				}
				else{
					v.tx=tlx;
					v.ty=tly;
				}
				if(d[kly+kmy[i]][klx+kmx[i]]==0&&(klx+kmx[i])>=0&&(klx+kmx[i])<x&&(kly+kmy[i])>=0&&(kly+kmy[i])<y){
					v.kx=klx+kmx[i];
					v.ky=kly+kmy[i];
				}
				else{
					v.kx=klx;
					v.ky=kly;
				}
				v.cnt=cl+1;
				p.push(v);
			}
			
		}
		if(tlx==klx&&tly==kly&&cl!=0){
			cout<<cl<<endl;
		}
		else{
			cout<<"NA"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 8388
#include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  ll d, c[26], s[365][26], t[365], ans = 0, m, x, y;
  set<ll> se[26];
  cin >> d;
  for (int i = 0; i < 26; i++) {
    cin >> c[i];
    se[i].insert(0);
  }
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s[i][j];
    }
  }
  for (int i = 0; i < d; i++) {
    cin >> t[i];
    t[i]--;
    se[t[i]].insert(i + 1);
    ans += s[i][t[i]];
    for (int j = 0; j < 26; j++) {
      ans -= (i + 1 - *se[j].rbegin()) * c[j];
    }
  }
  for (int i = 0; i < 26; i++) {
    se[i].insert(d + 1);
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    y--;
    ans += s[x - 1][y] - s[x - 1][t[x - 1]];
    set<ll>::iterator it = se[t[x - 1]].find(x);
    it--;
    ll z = *se[t[x - 1]].upper_bound(x);
    ans -= c[t[x - 1]] * (z - x) * (x - *it);
    se[t[x - 1]].erase(x);
    t[x - 1] = y;
    it = se[y].lower_bound(x);
    it--;
    ans += c[y] * (*se[y].lower_bound(x) - x) * (x - *it);
    cout << ans << endl;
    se[y].insert(x);
  }
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, b;
ll a[55];
ll c[55];
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> n;
	for (ll i = 0; i < n; i++){
		cin >> a[i];
		c[i] = a[i];
	}
	sort(c, c+n);
	for (ll i = 0; i < n; i++){
		if (a[i] != c[i]){
			b += 1;
			}
		}
		if (b == 2 || b == 0){cout << "YES";
		}else{
			
cout << "NO";			
}
}

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

using namespace std;


int main()
{
	int N, K, Q;
	cin >> N >> K >> Q;

	vector<int> point(N);
	for (int i = 0; i < N; i++) {
		point[i] = K - Q;
	}

	for (int i = 0; i < Q; i++) {
		int A;
		cin >> A;
		point[A - 1]++;
	}

	for (int i = 0; i < N; i++) {
		if (0 < point[i]) {
			cout << "Yes\n";
		} else {
			cout << "No\n";
		}
	}

	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;



const int n = 6;
double p[n], q[n];

double getAns(double x)
{
	double ans = 0;
	for (int i = 0; i < n; i++)
	{
		if (p[i] * x + q[i] * (1. - x) == 0) continue;
		ans += max(p[i] * x, q[i] * (1. - x) ) / (p[i] * x + q[i] * (1. - x) ) * (p[i] * x + q[i] * (1. - x) );
	}
	eprintf("%.10lf\n", ans);
	return ans;
}

int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	for (int i = 0; i < n; i++)
	{
		scanf("%lf", &p[i] );
		p[i] /= 100;
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%lf", &q[i] );
		q[i] /= 100;
	}
	double l = 0, r = 1;
	for (int it = 0; it < 200; it++)
	{
		double m1 = (2 * l + r) / 3;
		double m2 = (l + 2 * r) / 3;
	
		double a1 = getAns(m1);
		double a2 = getAns(m2);
		
		if (a1 < a2)
			r = m2;
		else
			l = m1;
	}
	eprintf("l = %.5lf\n", l);
	printf("%.10lf\n", getAns(l) );



	return 0;
}



Measured memory_bytes: 384
#include <cstdio>
#include <iostream>

using namespace std;

int main() {
  int r, c;
  cin >> r >> c;
  int t[101][101] = {0};

  for (int i = 0; i < r; ++i) {
    for (int j = 0; j < c; ++j) {
      cin >> t[i][j];

      t[i][c] += t[i][j];
      t[r][j] += t[i][j];
      t[r][c] += t[i][j];
    }
  }

  for (int i = 0; i <= r; ++i) {
    for (int j = 0; j <= c; ++j) {
      if (j > 0) printf(" ");
      printf("%d", t[i][j]);
    }
    printf("\n");
  }
  return 0;
}

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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int) 1e9 + 7;
bool sum (string s) {
	long long res = 0;
	int i = 0;
	while (s.size() > 0) {
		res += s[i] - '0';
		s.erase(s.begin());
	}
	if (res % 9 == 0) return true;
	return false;
}
void solve() {
	string n;
	cin >> n;
	if (sum(n)) cout << "Yes\n";
	else cout << "No\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt = 1;
	//cin >> tt;
	while (tt--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 3740
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let x: usize = iterator.next().unwrap().parse().unwrap();

    let mut sum = 0;
    for i in 1..x + 1 {
        sum += i;
        if sum >= x {
            return i.to_string();
        }
    }

    return String::new();
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() 
{
    ll h,w;
    cin>>h>>w;
    if(h==1 || w==1)
    {
        cout<<"1";
        return 0;
    }
    cout<<(h*w+(ll)1)/2;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main (void){
        char S[4];
        int a=0,b=0;
        scanf("%s\n",S );
        if (S[0]=='0'&&S[1]!='0') {
          a=1;
        }
        if (S[0]=='1'&&(S[1]=='0'||S[1]=='1'||S[1]=='2')) {
          a=1;
        }
        if (S[2]=='0'&&S[3]!='0') {
          b=1;
        }
        if (S[2]=='1'&&(S[3]=='0'||S[3]=='1'||S[3]=='2')) {
          b=1;
        }
if (a+b==0) {
  printf("NA\n");
}else if(a*b==1) {
  printf("AMBIGUOUS\n");
}else if(a==1){
  printf("MMYY\n");
}else{
  printf("YYMM\n");
}


        return 0;
}


Measured memory_bytes: 128
N = int(input())
S = list(map(int, input()))

next = [[-1] * 10 for _ in range(N + 1)]
for i in range(N - 1, -1, -1):
    for j in range(10):
        next[i][j] = next[i + 1][j]
    next[i][S[i]] = i

c = 0
for i in range(10):
    p0 = next[0][i]
    if p0 < 0 or p0 > N - 3:
        continue
    for j in range(10):
        p1 = next[p0 + 1][j]
        if p1 < 0 or p1 > N - 2:
            continue
        for k in range(10):
            p2 = next[p1 + 1][k]
            if p2 > 0:
                c += 1
print(c)

Measured memory_bytes: 45936
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;

int main()
{
	while (true){
		char num[4];
		int ans;
		for (int i = 0; i < 4; i++){
			cin >> num[i];
		}
		if (num[0] == num[1] && num[1] == num[2] && num[2] == num[3]){
			if (num[0] == '0') break;
			cout << "NA" << endl;
			continue;
		}
		for (ans = 0; num[0] != '6' || num[1] != '1' || num[2] != '7' || num[3] != '4'; ans++){
			char num2[4], num3[4];
			for (int i = 0; i < 4; i++){
				num2[i] = num[i];
			}
			sort(num, num + 4);
			sort(num2, num2 + 4, greater<char>());
			for (int i = 3; i >= 0; i--){
				if (num2[i] - num[i] < 0){
					num2[i] += 10;
					num2[i - 1]--;
				}
				num3[i] = num2[i] - num[i] + '0';
			}
			for (int i = 0; i < 4; i++){
				num[i] = num3[i];
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
while True:
    n, x = map(int, input().split())
    if n==0 and x==0:
        break
    
    cnt = 0
    for i1 in range(1, n+1):
        for i2 in range(i1+1, n+1):
            for i3 in range(i2+1, n+1):
                if i1 + i2 + i3 == x:
                    cnt += 1
    
    print(cnt)


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

using namespace std;

int main() {
	int WH[30][2];
	int W, H;
	int N = 0;
	while (cin >> W >> H) {
		if (W == 0 && H == 0) break;
		WH[N][0] = W;
		WH[N][1] = H;
		N++;
	}
	for (int i = 0; i < N; i++) {
		for (int h = 0; h < WH[i][0]; h++) {
			for (int w = 0; w < WH[i][1]; w++) {
				if (h == 0 || h == WH[i][0] - 1 || w == 0 || w == WH[i][1] - 1) {
					cout << "#";
				}
				else {
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3080
X, K ,D = map(int, input().split())

M = int(abs(X)/D)

if abs(abs(X) - D*M) <  abs(abs(X) - D*(M+1)): cand = M
else: cand = M + 1

if cand == M:
    if M <= K and (K-M)%2 == 0: print(abs(abs(X) - D*M))
    elif M <= K and (K-M)%2 == 1: 
        if M + 1 <= K: print(min(abs(abs(X) - D*(M-1)), abs(abs(X) - D*(M+1))))
        else: print(abs(abs(X) - D*(M-1)))
    else: print(abs(abs(X) - D*K))

if cand == M + 1:
    if M + 1 <= K and (K-(M + 1))%2 == 0: print(abs(abs(X) - D*(M+1)))
    elif M + 1 <= K and (K-(M+1))%2 == 1: 
        if M + 2 <= K: print(min(abs(abs(X) - D*(M)), abs(abs(X) - D*(M+2))))
        else: print(abs(abs(X) - D*(M)))
    else: print(abs(abs(X) - D*K))

Measured memory_bytes: 9260
#include<cstdio>
#include<cctype>
#include<cstring>
inline int getint() {
	register char ch;
	register bool neg=false;
	while(!isdigit(ch=getchar())) if(ch=='-') neg=true;
	register int x=ch^'0';
	while(isdigit(ch=getchar())) x=(((x<<2)+x)<<1)+(ch^'0');
	return neg?-x:x;
}
const int N=10001,M=20001;
char s[N];
int op[N]={1};
bool f[2][M],tmp[M];
int main() {
	scanf("%s",s);
	const int x=getint(),y=getint();
	op[1]=s[0]=='F';
	for(register int i=1;s[i];i++) {
		if(s[i]=='T'&&s[i-1]=='T') op[++op[0]]=0;
		if(s[i]=='F') {
			if(s[i-1]=='T') op[0]++;
			op[op[0]]++;
		}
	}
	f[0][N]=f[1][N]=true;
	for(register int i=1;i<=op[0];i++) {
		memset(tmp,0,sizeof tmp);
		for(register int j=0;j<M-op[i];j++) tmp[j+op[i]]|=f[i&1][j];
		if(i!=1) for(register int j=op[i];j<M;j++) tmp[j-op[i]]|=f[i&1][j];
		memcpy(f[i&1],tmp,sizeof tmp);
	}
	puts(f[0][N+y]&&f[1][N+x]?"Yes":"No");
	return 0;
}

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

using namespace std;

string abc = "abcdefghijklmnopqrstuvwxyz";

int main() {
    string s;
    while (getline(cin, s)) {
        for (int i=0; i<26; ++i) {
            string ns = "";
            bool ok = false;
            for (int j=0; j<(int)s.size(); ++j) {
                if (s[j] == '.' || s[j] == ' ') {
                    ns += s[j];
                } else {
                    ns += abc[(s[j] - 'a' + i) % 26];
                    if (0 <= j-2 && ns.substr(j-2) == "the")  ok = true;
                    if (0 <= j-3 && ns.substr(j-3) == "this") ok = true;
                    if (0 <= j-3 && ns.substr(j-3) == "that") ok = true;
                }
            }
            if (ok) {
                cout << ns << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1192
#include <iostream>
using namespace std;
int main()
{  int W,H,x,y,r;
cin >>W>>H>>x>>y>>r;
if (x>=W||y>=H||r>(W-x)||r>(H-y)||x<0||y<0)
    cout <<"No"<<endl;
else cout<<"Yes"<<endl ;

return 0;
}



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

int main(){
    int N, T, currT, pastT;
    int total = 0;

    cin >> N >> T;
    
    for(int i=0; i<N; i++){
        cin >> currT;

        if(i!=0 && currT-pastT<T){
            total += currT-pastT;
        }else{
            total += T;
        }
        pastT = currT;
    }
    
    cout << total << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <deque>
#include <stack>

int N;
std::string S;

int main(void){
    std::cin >> N;
    std::cin >> S;

    std::stack<char> st;
    std::deque<char> deq;

    for(auto it=S.begin(), _END=S.end(); it != _END; ++it){
        if(*it == ')'){
            if(st.empty()){
                deq.push_front('(');
            }else{
                st.pop();
            }
            deq.push_back(')');
        }else{
            deq.push_back('(');
            st.push('(');
        }
    }
    while(!deq.empty()){
        std::cout << deq.front();
        deq.pop_front();
    }
    for(int i=0; i<st.size(); ++i){
        std::cout << ')';
    }
    std::cout << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX_N 100000
using namespace std;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, m, p[MAX_N+5];
int main() {
	read(n), read(m); int ans = 0x7f7f7f7f;
	for (int i = 1; i <= n; i++) read(p[i]);
	for (int l = 1, r = m; r <= n; l++, r++)
		if (p[l] < 0 && p[r] > 0)
			ans = min(ans, p[r]-2*p[l]), 
			ans = min(ans, 2*p[r]-p[l]);
		else if (p[r] <= 0) ans = min(ans, -p[l]);
		else ans = min(ans, p[r]);
	return printf("%d\n", ans), 0;
}


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

int main( void )
{
  int N, L;
  cin >> N >> L;
  vector<string> S( N );

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

  sort( S.begin(), S.end() );

  for( int i = 0; i < N; i++ )
    cout << S.at( i );
  cout << endl;
}

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

#include<algorithm>
#define int long long
#define str(a) to_string(a)
#define pb push_back
#define mp make_pair
#define SORT(c) sort(c.begin(),c.end())
#define max_heap priority_queue<int>
#define min_heap priority_queue< int,vector<int>, greater<int> >
#define mod 1000000007
#define setbits(x) __builtin_popcount(x)
#define ps(x,y) fixed<<setprecision(y)<<x
#define start(t) int x;cin>>x;while(x--)
#define inf LLONG_MAX
#define sync ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define N 1000001


int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	string a, b; cin >> a >> b;
	int count = 0;
	for (int i = 0; i < a.length(); i++) {
		if (a[i] != b[i])
			count += 1;
	}
	cout << count << endl;
}


Measured memory_bytes: 3804
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int main(){
    int K,X;//,C,D,X,Y,N,L,M,P,Q;
    int ans = 0;
    cin>>K>>X;
    for(int i = max(-1000000,X-K+1); i<min(X+K,1000000);i++){
        cout<<i<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
  int i=0;
  char S[200001];
  long long a=0,d=1LL,x=0,count[2019]={1LL};
  i=scanf("%s",S);i=strlen(S);
  while(i--){x=(x+(S[i]-'0')*d)%2019;a+=count[x]++;d=d*10%2019;}
  return printf("%lld\n",a),0;
}

Measured memory_bytes: 1920
#include <iostream>

using namespace std;

int getGcd(int a, int b)
{
	int r;
	if (a < b) return getGcd(b, a);

	while (r = a % b) {
		a = b;
		b = r;
	}

	return b;
}

int main()
{
	int N, X;
	int gcd;
	
	cin >> N >> X;

	int* x = new int[N];
	int* diff = new int[N];
	for (int i = 0; i < N; i++) {
		cin >> x[i];
		diff[i] = abs(X - x[i]);
	}

	if (N > 1) {
		gcd = getGcd(diff[0], diff[1]);
	}
	else gcd = diff[0];

	for (int i = 2; i < N; i++) {
		gcd = getGcd(gcd, diff[i]);
	}

	cout << gcd << endl;

	delete[] x, diff;

	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main (){
	int x,j,l,s=9999;
	cin>>x;
	if(x==1){cout<<x;return 0;}
	for(int i=2;i*i<=x;i++){
		for(j=i;j*i<=x;j=j*i){
		}
		if(x-j<s) s=x-j;
	}
	l=x-s;
	cout<<l;
	return 0;
}

Measured memory_bytes: 256
#最初の2匹を割り当てることで解答文字列ansは一意に決まる。
#最初に[SW][WS][SS][WW]の4通りで決めウチすることで円環の接続点を見比べることができる
#脳死で4パターン同じ処理をコピペ。

N=int(input())
S=input()

def solve(n,s):

#[SW]の場合
  ans="SW"
  if s[0]=="o":
    ch="W"
  else:
    ch="S"
  for i in range(1,n):
    if (ans[-1]=="S" and s[i]=="o") or (ans[-1]=="W" and s[i]=="x") :
      ans = ans + ans[-2]
    elif ans[-1]=="S" and s[i]=="x" and ans[-2]=="S":
      ans = ans + "W"
    elif ans[-1]=="S" and s[i]=="x" and ans[-2]=="W":
      ans = ans + "S"
    elif ans[-1]=="W" and s[i]=="o" and ans[-2]=="S":
      ans = ans + "W"
    else:
      ans = ans + "S"
  if ans[-2]==ch and ans[-1]==ans[0]:
    return ans[:-1]

#[WS]の場合
  ans="WS"
  if s[0]=="o":
    ch="W"
  else:
    ch="S"
    
  for i in range(1,n):
    if (ans[-1]=="S" and s[i]=="o") or (ans[-1]=="W" and s[i]=="x") :
      ans = ans + ans[-2]
    elif ans[-1]=="S" and s[i]=="x" and ans[-2]=="S":
      ans = ans + "W"
    elif ans[-1]=="S" and s[i]=="x" and ans[-2]=="W":
      ans = ans + "S"
    elif ans[-1]=="W" and s[i]=="o" and ans[-2]=="S":
      ans = ans + "W"
    else:
      ans = ans + "S"
  if ans[-2]==ch and ans[-1]==ans[0]:
    return ans[:-1]
  
#[SS]の場合
  ans="SS"
  if s[0]=="o":
    ch="S"
  else:
    ch="W"
    
  for i in range(1,n):
    if (ans[-1]=="S" and s[i]=="o") or (ans[-1]=="W" and s[i]=="x") :
      ans = ans + ans[-2]
    elif ans[-1]=="S" and s[i]=="x" and ans[-2]=="S":
      ans = ans + "W"
    elif ans[-1]=="S" and s[i]=="x" and ans[-2]=="W":
      ans = ans + "S"
    elif ans[-1]=="W" and s[i]=="o" and ans[-2]=="S":
      ans = ans + "W"
    else:
      ans = ans + "S"
  if ans[-2]==ch and ans[-1]==ans[0]:
    return ans[:-1]
  
#[WW]の場合
  ans="WW"
  if s[0]=="o":
    ch="S"
  else:
    ch="W"
    
  for i in range(1,n):
    if (ans[-1]=="S" and s[i]=="o") or (ans[-1]=="W" and s[i]=="x") :
      ans = ans + ans[-2]
    elif ans[-1]=="S" and s[i]=="x" and ans[-2]=="S":
      ans = ans + "W"
    elif ans[-1]=="S" and s[i]=="x" and ans[-2]=="W":
      ans = ans + "S"
    elif ans[-1]=="W" and s[i]=="o" and ans[-2]=="S":
      ans = ans + "W"
    else:
      ans = ans + "S"
  if ans[-2]==ch and ans[-1]==ans[0]:
    return ans[:-1]
  
  return -1

print(solve(N,S))

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

int main(){
    int r, c;
    cin >> r >> c;

    int g[101][101];
    fill(g[0], g[101], 0);
    for(int i = 0; i < r; i++){
        for(int j = 0; j < c; j++){
            int t;
            cin >> t;
            g[i][j] = t;   
            g[i][c] += t;
            g[r][j] += t;        
        }
    }
    for(int i = 0; i < c; i++){
        g[r][c] += g[r][i];
    }

    int d[101];
    fill(d, d, 0);
    for(int i = 0; i < r+1; i++){
        for(int j = 0; j < c+1; j++){
            if(j)
                cout << " ";
            cout << g[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

ll a[200010];
ll b[200010];

void solve(){

    ll n;
    cin >> n;
    rep(i,200010){
        a[i]=0;
        b[i]=0;
    }
    rep(i,n-1){
        cin >> a[i+1];
        a[i+1]--;
        b[a[i+1]]++;
    }

    rep(i,n){
        cout << b[i] << endl;
    }


}

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


Measured memory_bytes: 6776
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10000000)

def search(values,hp,vp,item):
	if not (0<=hp<len(values)): return
	if not (0<=vp<len(values[hp])): return
	if item!=values[hp][vp]: return
	values[hp][vp]=True
	search(values,hp-1,vp,item)
	search(values,hp+1,vp,item)
	search(values,hp,vp-1,item)
	search(values,hp,vp+1,item)

def solve(values):
	count,valid_items=0,set(['@','#','*'])
	for i in range(len(values)):
		for j in range(len(values[i])):
			if values[i][j] in valid_items:
				search(values,i,j,values[i][j])
				count+=1
	return count

def main():
	line,values=input().strip(),list()
	while line!='0 0':
		H,W = list(map(int,line.split(' ')))
		value = list()
		for _ in range(H):
			value.append(list(x for x in input().strip()))
		values.append(value)
		line = input().strip()
	for value in values:
		print(solve(value))

if __name__=='__main__':
	main()

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

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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;}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    int n; cin >> n;
    vector<int> lis(n);
    REP(i, 0, n){cin >> lis[i];}
    int c = 1, ans = 0;
    REP(i, 0, n){
        if(lis[i] != c){
            ans++;
        }else{
            c++;
        }
    }
    if(ans == n){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll n,k,a[200005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k;
    rep(i,0,n)
        cin>>a[i];
    sort(a, a + n); 
    ll product = 1; 
    if (a[n - 1] == 0 && (k & 1)) 
    {
        cout<<0<<"\n";
        return 0;
    } 
    if (a[n - 1] <= 0 && (k & 1)) { 
        for (ll i = n - 1; i >= n - k; i--) 
        {
            product *= a[i];
            product%=M;
            product=(product+M)%M;
        } 
        cout<<product<<"\n";
        return 0;
    } 
    ll i = 0; 
    ll j = n - 1; 
    if (k & 1) { 
        product *= a[j]; 
        product%=M;
        product=(product+M)%M;
        j--; 
        k--; 
    } 
    k >>= 1; 
    for (ll itr = 0; itr < k; itr++) { 
        ll left_product = a[i] * a[i + 1]; 
        ll right_product = a[j] * a[j - 1]; 
        if (left_product > right_product) { 
            left_product%=M;
            left_product=(left_product+M)%M;
            product *= left_product; 
            i += 2; 
        } 
        else { 
            right_product%=M;
            right_product=(right_product+M)%M;
            product *= right_product; 
            j -= 2; 
        } 
        product%=M;
        product=(product+M)%M;
    } 
  
    cout<<product;


}


Measured memory_bytes: 5160
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn lcm(a: i64, b: i64) -> Option<i64> {
    let g = gcd(a, b);
    (a / g).checked_mul(b)
}

fn main() {
    input! {
        n: usize,
        m: i64,
        mut a: [i64; n],
    }

    let ans = solve(&mut a, m, 1);

    println!("{}", ans);
}

fn solve(a: &mut [i64], m: i64, div: i64) -> i64 {
    for r in a.iter_mut() {
        *r /= 2;
    }

    if a.iter().all(|&x| x % 2 == 0) {
        solve(a, m, div * 2)
    } else if a.iter().all(|&x| x % 2 != 0) {
        let mut l = 1;
        for &x in a.iter() {
            if let Some(s) = lcm(l, x) {
                l = s;
            } else {
                return 0;
            }
        }
        let up = m - l * div;
        if up < 0 {
            0
        } else {
            1 + up / (l * div * 2)
        }
    } else {
        0
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define lPair pair<ll,ll>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int main(){
    int a,b; cin >> a >> b;
    string s; cin >> s;
    bool flg = true;
    for(int i = 0; i < s.size(); i++){
        if(i == a){
            if(s[i] != '-') flg = false;
        } else if(s[i] == '-'){
            flg = false;
        }
    }
    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;
}




Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#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 K;
  cin >> K;
  rep(i, K) cout << "ACL";
  cout<<endl;
  return 0;
}


Measured memory_bytes: 3528
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	vector<int> in(3);
	cin >> in[0] >> in[1] >> in[2];
	sort(in.begin(), in.end());

	cout << in[2] * 10 + in[0] + in[1] << "\n";

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
MOD = 10**9+7
N, K = map(int, input().split())


def acc(x):
    return x*(x+1)//2


ans = 1
for k in range(K, N+1):
    l = acc(k-1) % MOD
    u = (acc(N)-acc(N-k)) % MOD
    n = (u-l+1) % MOD
    ans = (ans + n) % MOD
print(ans)


Measured memory_bytes: 9212
c={
    'S':[0]*13,
    'H':[0]*13,
    'C':[0]*13,
    'D':[0]*13
}
n=int(input())
for _ in range(n):
    s,num=input().split()
    c[s][int(num)-1]=1
for i in["S","H","C","D"]:
    for j in range(13):
        if c[i][j]==0:
            print(i,j+1)


Measured memory_bytes: 5596
#include<iostream>
#include<random>
#include<cstdlib>
#include<vector>
#include<string>

//#include "D:\Code\C++\Headers\zle_STL.h"
//#include "D:\Code\C++\Headers\zle_OLD.h"

#define ll long long

using namespace std;

int main() {
	int N;
	cin >> N;
	string each;
	int ac = 0;
	int wa = 0;
	int tle = 0;
	int re = 0;
	for (int c = 0; c < N; c++) {
		cin >> each;
		if (each == "AC") {
			ac++;
		}
		else if (each == "WA") {
			wa++;
		}
		else if (each == "TLE") {
			tle++;
		}
		else if (each == "RE") {
			re++;
		}
	}
	cout << "AC x " << ac<<endl;
	cout << "WA x " << wa << endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;
	return 0;
}





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

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pp;
typedef pair<ll,pair<ll,ll> > ppp;

#define mk make_pair
#define all(a) (a).begin(), (a).end()
#define pb(a) push_back(a)
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define parr(A,n) for(int xxx=0;xxx<n;xxx++){cout<<A[xxx]<<" ";}cout << "\n";
#define MOD 1000000007
#define endl "\n"
inline ll power(ll x, ll y)
{
    ll res = 1;x = x % MOD;
    while (y > 0){if (y & 1) res = (res*x) % MOD;y = y>>1;x = (x*x) % MOD;}
    return res%MOD;
}
inline ll sum(ll a, ll b){b = ((b%MOD) + MOD)%MOD;a = ((a%MOD) + MOD)%MOD;return ((a+b)%MOD + MOD)%MOD;}
inline ll mul(ll a, ll b){return ((a*b)%MOD + MOD)%MOD;}
typedef struct node{
    node *next[2];
    int count[2];
    node(){
        next[0] = NULL;
        next[1] = NULL;
        count[0] = count[1] = 0;
    }
}node;

void add(node *root, ll num){
    node *temp = root;
    for(ll i=0;i<32;i++){
        ll ind = num & (1 << (31-i));
        ind = ind >> (31-i);
        if(temp->next[ind]==NULL){
            temp->next[ind] = new node();
            
        }
        temp->count[ind]++;
        temp = temp->next[ind];
    }
}

ll eval(node *root, ll num, ll k){
    ll ans = 0;
    node *temp = root;
    for(ll i=0;i<32;i++){
        ll ind = (num & (1 << (31-i)));
        ind = ind >> (31-i);
        ll tar = (k & (1 << (31-i)));
        tar = tar >> (31-i);
        if(tar==1){
        	if(ind == 0){
        		ans+=temp->count[0];
        		if(temp->next[1])
        			temp = temp->next[1];
        		else return ans;
        	}
        	else{
        		ans+=temp->count[1];
        		if(temp->next[0])
        			temp = temp->next[0];
        		else return ans;	
        	}
        }
        else{
        	if(ind == 0){
        		if(temp->next[0])
        			temp = temp->next[0];
        		else return ans;
        	}
        	else{
        		if(temp->next[1])
        			temp = temp->next[1];
        		else return ans;	
        	}	
        }
    }
    return ans;
}

ll solve(vector<int> a, int k) {
    int n = a.size();
    node *root = new node();
    add(root,0);
    ll ans = 0;
    ll curr = 0;
    for(int i=0;i<n;i++){
        curr = curr^a[i];
        ll temp = eval(root,curr,k);
        // cout << temp << endl;
        ans += temp;
        add(root,curr);
    }
    return ans;
}
int main() {
	ll a,b;
	cin >> a >> b;
	if(a*b%2!=0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}


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

int main(void){
    int n = 0;
    long long int a[200001] = {0};
    long long int ans = 0;

    scanf("%d", &n);

    for(int i = 0; i < n; i++){
        scanf("%lld", &a[i]);
    }

    if(n > 1){
        for(int i = 1; i < n; i++){
            if(a[i] <= a[i-1]){
                ans += a[i-1] - a[i];
                a[i] += a[i-1] - a[i];
//                printf("%lld %lld sum = %lld\n", a[i-1], a[i], ans);
            }
        }
    }
    printf("%lld\n", ans);

    return 0;

} 


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

int main(){
  int N;
  cin >> N;
  vector<int> A(N), B(N), C(N);
  for(int i = 0; i < N; ++i) cin >> A[i], --A[i];
  for(int i = 0; i < N; ++i) cin >> B[i];
  for(int i = 0; i < N-1; ++i) cin >> C[i];
  int ans = 0;
  for(int i = 0; i < N; ++i){
    ans += B[A[i]];
    if(i+1 < N and A[i]+1 == A[i+1])
      ans += C[A[i]];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2019-12-08 20:08:37
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<class T> ostream& operator<<(ostream& os, vector<T>& _) { os << '{'; for (T& x : _) { os << x; if (&x != &_.back()) os << ','; } os << '}'; return os; }
template<class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

using pli = pair<int64, int>;

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

  int n, k; cin >> n >> k;
  priority_queue<pli> pq;
  map<int, int> mp;

  for (int i = 0; i < n; ++i) {
    int t; int64 d; cin >> t >> d;
    pq.emplace(d, t);
  }

  priority_queue<pli, vector<pli>, greater<pli>> pq2;

  int64 sum = 0;
  int cnt = 0;

  for (int i = 0; i < k; ++i) {
    pli top = pq.top(); pq.pop();
    pq2.emplace(top);
    ++mp[top.second];
    sum += top.first;
    if (mp[top.second] == 1) {
      ++cnt;
    }
  }

  int64 ans = sum + static_cast<int64>(cnt) * static_cast<int64>(cnt);

  for (int i = 0; i < k; ++i) {
    if (pq.empty()) {
      cout << ans << endl;
      return 0;
    }
    while (!pq2.empty() && mp[pq2.top().second] == 1) {
      pq2.pop();
    }
    while (!pq.empty() && mp[pq.top().second] > 0) {
      pq.pop();
    }
    if (pq.empty() || pq2.empty()) {
      cout << ans << endl;
      return 0;
    }
    pli next = pq.top(); pq.pop();
    pli rm = pq2.top(); pq2.pop();
    sum -= rm.first; sum += next.first;
    pq2.emplace(next);
    --mp[rm.second]; ++mp[next.second];
    ++cnt;
    ans = max(ans, sum + static_cast<int64>(cnt) * static_cast<int64>(cnt));
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = {sc.nextInt(), sc.nextInt(), sc.nextInt()};
        Arrays.sort(arr);
        System.out.println(arr[2] * 10 + arr[1] + arr[0]);

    }
}

Measured memory_bytes: 22996