akhauriyash/Code-Regression huggingface dataset:
import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint
N, K = map(int, input().split())

1行のstring
S, T = input().split()

1行の整数配列
P = list(map(int,input().split()))

改行あり
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

N行M列の初期化
dp = [[INF] * M for i in range(N)]

'''

"""""""""""""""""""""""""""""""""
 最大公約数 O()
"""""""""""""""""""""""""""""""""
# fractions.gcd(a,b)
def gcd(a, b):
    return fractions.gcd(a, b)

"""""""""""""""""""""""""""""""""
 最小公倍数 O()
"""""""""""""""""""""""""""""""""
def lcm(a,b):
    return (a*b) // fractions.gcd(a,b)


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


twice = 1
while True:
    if A[0] % (twice*2) == 0:
        twice*=2
    else:
        break

for a in A:
    if a%twice != 0:
        print(0)
        sys.exit()
    elif a%(twice*2) == 0:
        print(0)
        sys.exit()


half = 1
for a in A:
    half = lcm(half, a//2)

ans = (M//half + 1) // 2
print(int(ans))





Measured memory_bytes: 90344
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a,b,i=0,j,c=0;
    cin >> n >> a >> b;
    if(n*a<b)
    {
        cout << n*a << endl;
    }
    else
    {
        cout << b << endl; 
    }

    
    return 0;

}


Measured memory_bytes: 3624
import sys
from itertools import permutations 
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
P = [x for x in input().split()]
Q = [x for x in input().split()]

p = "".join(P)
q = "".join(Q)

arr = []
perm = permutations(sorted(Q))
for x in perm:
   arr.append("".join(str(y) for y in x))

print(abs(arr.index(p) - arr.index(q)))

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

int main(){
	char* date[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
	int months[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int m,d;
	while( cin >> m >> d, m ){
		int day=0;
		for( int i=0; i<m-1; i++ ){
			day += months[i];
		}
		day += d;
		cout << date[day%7] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll n,p,ans=1;
map<ll,ll>o;
ll pw(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1)res*=x;
        x*=x;
        y>>=1;
    }
    return res;
}
int main(void){
    cin>>n>>p;
    for(ll i=2;i*i<=p;i++){
        while(p%i==0){
            p/=i;
            o[i]++;
        }
    }
    if(p!=1)o[p]++;
    for(auto it=o.begin();it!=o.end();it++)ans*=(pw(it->F,(it->S)/n));
    printf("%lld\n",ans);
}


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

int main() {
  int A,B,C,K;
  cin >> A >> B >> C >> K;
 
  if(A>=K) cout<<K<<endl;
  else if(K<=A+B) cout<<A<<endl;
  else cout<<2*A+B-K<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int n,k;cin >> n >> k;
	int cnt = 0;
	for(int i = 0; i < n; i++){
		int h;cin >> h;
		if(h >= k)cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
use proconio::{input, fastout};
use std::cmp::max;

#[fastout]
fn main() {
    input! {
        S: String,
    }
    let mut cnt = 0;
    let mut ans = 0;

    for s in S.chars() {
        if s == 'R' {
            cnt += 1;
            ans = max(ans, cnt);
        } else {
            cnt = 0;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2168
fun main(arg: Array<String>) {
    val S = next()
    val N = S.length - 1
    var ans = 0L
    for (b in 0 until 1.shl(N)) {
        val P = BooleanArray(N + 1)
        for (n in 0 until N) {
            if (b.shr(n).and(1) == 1) P[n] = true
        }
        val Ex = StringBuilder()
        for (n in 0 until N + 1) {
            Ex.append(S[n])
            if (P[n]) Ex.append('+')
        }
        ans += eval(Ex.toString())
    }
    println(ans)
}
fun eval(S: String): Long {
    var nums = 0L
    var num = 0L
    for (c in S) {
        if (c in '0'..'9') num = num * 10 + (c - '0')
        else {
            nums += num
            num = 0L
        }
    }
    if (num > 0) nums += num
    return nums
}
fun next() = readLine()!!


Measured memory_bytes: 33788
X,N = list(map(int,input().split()))
if N == 0:
    print(X)
    exit()
p = list(map(int,input().split()))
p.sort()
# print(p)

for i in range(100):
    # print(i)
    # print
    if X-i not in p:
        print(X-i)
        exit()
    if X+i not in p:
        print(X+i)
        exit()

Measured memory_bytes: 9192
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e12;
using Graph = vector<vector<int>>;

signed main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  vector<int> B(M);
  vector<pair<int, int>> K(M);
  for( int i = 0; i < M; i++ ){
    cin >> A[i] >> B[i];
    int bit = 0;
    for( int j = 0; j < B[i]; j++ ){
      int C;
      cin >> C;
      C--;
      bit |= 1<<C;
    }
    K[i] = {bit, A[i]};
  }

  //bitで開けられる宝箱を表す
  vector<int> dp(1<<N, INF);
  dp[0] = 0;
  for( int i = 0; i < 1<<N; i++ ){
    for( int j = 0; j < M; j++ ){
      int s = i | K[j].first;
      dp[s] = min(dp[s], dp[i]+K[j].second);
    }
  }

  if( dp.back() >= INF ) cout << -1 << endl;
  else cout << dp.back() << endl;

}


Measured memory_bytes: 3672
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const LL N = 1000000007;

LL n,a[405];
LL pre[405] = {0};
LL dp[405][405] = {0};

int main(){
	memset(dp,0x3f,sizeof(dp));
	scanf("%lld",&n);
	for(LL i = 1;i <= n;i ++){
		scanf("%lld",&a[i]);
		dp[i][i] = 0;
		pre[i] = pre[i - 1] + a[i];
	}
	for(LL l = 1;l < n;l ++){
		for(LL i = 1;i < n;i ++){
			LL j = i + l; if(j > n) break;
			for(LL k = i;k < j;k ++) dp[i][j] = min(dp[i][j],dp[i][k] + dp[k + 1][j] + pre[j] - pre[i - 1]);
		}
	}
	printf("%lld\n",dp[1][n]);
	return 0;
	//
}

Measured memory_bytes: 1536
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i =0;i<(int)(n);i++)
typedef long long ll;
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	cout << (3 * a + b) / 2 << endl;
	return 0;
}

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

using namespace std;

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define FORi(i,a,b) for(int i=int(a);i<=int(b);i++)
#define FOR(i,n) FORi(i,1,n)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;
using pii=pair<int, int>;
using pdd=pair<double, double>;
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto& p: c) os << p << " ";
	return os<<']';
}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}


template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}


constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;
constexpr int maxw=31;
constexpr int maxn=100000;
int N, K;
vector<pii> ing;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	while(cin>>N>>K) {
		ll ma=0;
		ing.clear();
		rep(i, N) {
			int a, b;
			cin>>a>>b;
			if((K|a)==K) ma+=b;
			if(a>K) continue;
			ing.push_back({a,b});
		}

		int tmpk = K;
		vi bitpos;
		int cnt = 0;
		while(tmpk) {
			if(tmpk&1) bitpos.push_back(cnt);
			cnt++;
			tmpk>>=1;
		}

		for(int i:bitpos) {
			tmpk = K;
			tmpk -= (1<<i);
			tmpk |= ((1<<i)-1);
			ll ji = 0;
			for(auto p: ing) if((tmpk|p.first)==tmpk) ji+=p.second;
			ma = max(ma, ji);
		}
		cout << ma << endl;
	}

	return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    int a,b,c; cin>>a>>b>>c;
    cout<<(a+b)*c/2<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;
#define pb push_back
#define N 200001
#define ll long long
#define int long long
#define pi pair<int , int>
#define pip pair<pi ,int>
#define mp make_pair
#define f first
#define s second
#define mod 998244353
int32_t main(){
   ios_base::sync_with_stdio(false);
      cin.tie(NULL);
    cout.tie(NULL);


////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//                int php[4000] , cdc[8000], cdm[8000];
//                for(int j=0;j<5;j++){
//for(int i=0;i<2000;i++)php[i/10]=1;
//for(int i=0;i<2000;i++)php[i/10]=1;
//for(int i=0;i<2000;i++)php[i/10]=1;
//for(int i=0;i<2000;i++)php[i/10]=1;
//for(int i=0;i<2000;i++)php[i/10]=1;
//for(int i=0;i<2000;i++)php[i/10]=1;
//                }
//
// vector<int> ab;
// vector<int> ab1(1000);
// vector<int> ab2;
// vector<int> ab3;
// vector<int> ab4;
// vector<int> ab5;
// string abcd="bdcccebcaca kjbcbsnklnslknvksn  nidcldklcnlsn";
// string abcd1="bdcccebcaca kjbcbsnklnslknvksn  nidcldklcnlsn cbcksknlsnv";
// string abcd2="bdcccebcaca kjbcbsnklnslknvksn  nidcldklcnlsn kjeaebbaekcmaekes";
//
//
// char abcde[1000];
// int mfch=0;
// int abcdefg[1000];
// int abcg[1000];
// int abcfg[1000];

////////////////////////////////////////////////////////////////////////////////////////////////////////



//    ll t;
//    cin>>t;
//    while(t--)
        {
   int l ,d , r;
   cin>>l>>r>>d;
   int ans= r/d - l/d;
   if(l%d==0)ans++;
   cout<<ans<<endl;
    }

}




Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main() {
    int N, L; cin >> N >> L;
    int m = INF;
    int sum = 0;
    int val = 0;
    for(int i=0; i<N; i++){
        sum += L + i;
        if(m > abs(L+i)){
            m = abs(L+i);
            val = L + i;
        }
    }
    
    cout << sum - val << endl;
    return 0;
    
}


Measured memory_bytes: 256
def main():
    a,b = map(int,input().split())
    lst = calc_task(a,b)
    answer = 0
    if len(lst) == 0:
        answer = -1
    else:
        answer = lst[0]
    print(answer)

def calc_task(a,b):
    return [n for n in range(1,2000) if ((n * 8 // 100)==a and (n * 10 // 100)==b)]



if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;

const long long MOD = 1000000007;

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

	int n;
	ll d, a;
	cin >> n >> d >> a;
	pll* xh;
	xh = new pll[n];
	rep(i, n) cin >> xh[i].first >> xh[i].second;
	rep(i, n) {
		ll p = xh[i].second / a;
		if (xh[i].second%a) ++p;

		xh[i].second = p;
	}
	sort(xh, xh + n);


	ll ans = 0;
	ll sum = 0;
	queue<pll> que;
	rep(i, n) {
		while (!que.empty()) {
			if (que.front().first < xh[i].first) {
				sum -= que.front().second;
				que.pop();
			}
			else break;
		}

		if (xh[i].second > sum) {
			que.push(pll(xh[i].first + d + d, xh[i].second - sum));
			ans += xh[i].second - sum;
			sum = xh[i].second;
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 4992
#include <stdio.h>
int main(){
  int a,b,f;
  scanf("%d%d",&a,&b);
  if(b==0)f=0;
  if(b>0){
    if(a>0)f=1;
    else f=0;
  }else if((b-a)%2)f=1;
  else f=-1;
  puts(f==0?"Zero":f==1?"Positive":"Negative");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define  clr(v,val)      memset(v,val,sizeof(v))
#define    lcm(a,b)                ((a*b)/(__gcd(a,b)))
typedef  long long     ll ;
typedef  unsigned long long     ull ;
const double eps= (1e-9);
using namespace std;
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
ll setBit1(ll num, ll idx) {return num | (1ll<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
const int N=500000+5,mod=1e9+7;
int a[200000+9];
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }

    sort(a,a+n);
    ll ans=0;
    int lim=n-1;
    for(int i=n-1;i>=0&&lim>0;i--){

        ans+=a[i];
        lim--;
        if(lim>0&&i!=n-1) ans+=a[i],lim--;
    }
    cout<<ans<<"\n";
}


















































































































Measured memory_bytes: 4356
m=998244353
M=6**8
f=[1]*M
g=[1]*M
h=[1]*M
h[0]=0
for i in range(2,M):
	f[i]=f[i-1]*i%m
	h[i]=m-h[m%i]*(m//i)%m
	g[i]=g[i-1]*h[i]%m
A,B=map(int,input().split())
if A<B:A,B=B,A
a=0
b=1
for j in range(1,B+1):
	a+=b*f[A+B-j]*g[B-j]
	b=b*2%m
print((a*f[B]*g[A+B]+A)%m)

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

long long mod = 1e9+7;

int main(){
    double w,h,x,y;
    cin>>w>>h>>x>>y;
    cout<<fixed<<setprecision(6)<<w*h/2.0<<' ';
    if(w/2 == x && h/2 == y){
        cout<<1;
    }
    else cout<<0;
}

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

class Program
{
    static void Main()
    {
        var X = int.Parse(ReadLine());
        var a = 0;
        for (int i = 1; i <= 32; i++)
        {
            for (int j = 2; j <= 10; j++)
            {
                var b = (int)Pow(i, j);
                if (b > a && b <= X)
                {
                    a = b;
                }
            }
        }
        WriteLine(a);
    }
    static long Pow(long x, int n, int m = (int)1e9 + 7)
    {
        var res = 1L;
        while (n != 0)
        {
            if ((n & 1) != 0) res = res * x % m;
            x = x * x % m;
            n >>= 1;
        }
        return res;
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>
#include <set>
#include <iomanip>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef std::numeric_limits<double> dbl;
const long long int LL_INF=1LL<<60;

vector<string> split(const string& input, char delimiter)
{
    stringstream stream(input);
    
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

//#define DEBUG

ll A, B, C, D, E, M, N, K, Q, W, H, T, X, Y;

bool reached[1000000];

int main()
{
    cin >> N;
    vector<int> button(N);
    for (auto& b : button)
        cin >> b;

    for (int i = 0; i < 1000000; ++i) {
        reached[i] = false;
    }
    
    int next = 0;
    int cnt = 0;
    while (true) {
        if (reached[next]) {
            cout << -1 << endl;
            return 0;
        } else {
            reached[next] = true;
        }
        next = button[next]-1;
        cnt++;
        if (next == 1) {
            cout << cnt << endl;
            return 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 1664
#include<cstdio>
#include<algorithm>
#include<cstring>
#define MN 100005
using namespace std;
int n,num,rd[MN],head[MN],bx[MN],pd[MN];bool ac;
struct edge{int to,next;}g[MN<<1];
void ins(int u,int v){g[++num].next=head[u];head[u]=num;g[num].to=v;}
void dfs(int u,int ff){
	bx[u]=0,pd[u]=1;
	for(int i=head[u];i;i=g[i].next)if(g[i].to!=ff)dfs(g[i].to,u),bx[u]|=pd[g[i].to],pd[u]&=bx[g[i].to];
}
void dfs2(int u,int ff,int fx,int fy){
	int sufx[rd[u]+2],sufy[rd[u]+2],prex[rd[u]+2],prey[rd[u]+2],now[rd[u]+2],tt=0;if(pd[u]&fx)ac=1;
	for(int i=head[u];i;i=g[i].next)if(g[i].to!=ff)now[++tt]=g[i].to;sufx[tt+1]=prex[0]=1,sufy[tt+1]=prey[0]=0;
	for(int i=1;i<=tt;i++)prex[i]=prex[i-1]&bx[now[i]],prey[i]=prey[i-1]|pd[now[i]];
	for(int i=tt;i>=1;i--)sufx[i]=sufx[i+1]&bx[now[i]],sufy[i]=sufy[i+1]|pd[now[i]];
	for(int i=1;i<=tt;i++)dfs2(now[i],u,fy|prey[i-1]|sufy[i+1],fx&prex[i-1]&sufx[i+1]);
}
int main(){
	scanf("%d",&n);int x,y;
	for(int i=1;i<n;i++)scanf("%d%d",&x,&y),ins(x,y),ins(y,x),rd[x]++,rd[y]++;dfs(1,1);dfs2(1,1,1,0);printf("%s\n",ac?"First":"Second");
}

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

int main()
{
   int n,x,k,q,cnt[100006];
   cin>>n>>k>>q;
   memset(cnt,0,sizeof cnt);
   for(int i=0;i<q;i++){ 
           cin>>x;
           cnt[x]++;
   } 
   for(int i=1;i<=n;i++){ 
            if( k-(q-cnt[i])>0 )cout<<"Yes"<<"\n";
            else cout<<"No"<<"\n";
   } 
   
           
           
    return 0;
}


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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define endl '\n'

int main()
{
    
    int n,m;
    cin>>n>>m;
    ffor(i,0,max(n,m)) cout<<min(n,m);
      
    
    return 0;
}



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

using namespace std;

#define pb push_back
#define mp make_pair
#define lli long long int
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define mii map<lli,lli>
#define msi map<string,lli>
#define pii pair<lli,lli> 
#define vi vector<lli> 
#define vvi vector< vector<lli> >
#define sz(x) (lli)x.size()
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX1 998244353
#define MAX2 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define input(data,n,command) for(lli i=0;i<n;i++){lli tmp;cin>>tmp;data.pb(tmp);command}
#define sort_asc(a) sort(a.begin(),a.end());
//#define sort_desc(a) sort(a.begin(),a.end(),greater<lli>());
#define display(a) for(lli i = 0 ;i<a.size();i++){cout<<a[i]<<" ";} cout<<endl;
#define rep(i,a,b) for(lli i = a;i < b;i++)
#define endl "\n"

//Written By MUDIT BHARDWAJ...
/*--------------------------------------------------------------------*/
//vector<pair<lli,lli>>adj[300010];

lli solve()
{
    //start from here
    string s;
    cin>>s;
    lli sum = 0;
    rep(i,0,sz(s))
    {
        lli z = s[i] - '0';
        sum += z;
        sum = sum%9;
    }
    if(sum == 0)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    return 0;
}

int main()
{
    ios
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    lli T=1;
    //cin>>T;
    while(T--)
    {
        solve();
    }
    return 0;
}
/*-----------------------------------------------------------------------*/

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

using namespace std;
int main()
{
    string s;
    cin>>s;
    string ans = "";
    int n = s.length();
    for(int i=0;i<n;i++)
    {
        if(s[i]=='0' || s[i]=='1')
        {
            ans +=s[i];
        }
        else
        {
            if(ans.length()==0)
            {
                ans = "";
            }
            else
            {
                int k = ans.length();
                k--;
                string temp ="";
                for(int i=0;i<k;i++)
                {
                    temp +=ans[i];
                }
                ans = temp;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3636
#include<stdio.h>

int main(){
  long long n = 0;
  long long m = 0;
  long long result = 0;
  scanf("%lld %lld",&n,&m);
  if(n==1){
    if(m==1){
      result = 1;
    }else if(m==2){
      result = 0;
    }else{
      result = m-2;
    }
  }else if(n==2){
    result = 0;
  }else{
    if(m==1){
     result = n-2;
    }else if(m==2){
      result = 0;
    }else{
      result = (n-2)*(m-2);
    }
  }
  printf("%lld",result);
  return 0;
}
             

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

using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	if(a <= 0 && b >= 0){
		cout << "Zero" << endl;
	} else{
		if(a >= 0){
			cout << "Positive" << endl;
		} else {
			int m = b-a+1;
			if(m%2==0){
				cout << "Positive" << endl;
			} else {
				cout << "Negative" << endl;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#define neko 100010
#define heko 410
#define qwq return printf("YES"),0; 
#define orz return printf("NO"),0; 
#define f(i,a,b) for(register int i=(a);i<=(b);i=-(~i))
static int n,H;
typedef int arr[heko];
arr fa,book,dgi,dgo,out;
namespace IO
{
	const unsigned int bufsize=1<<16,outsize=1<<24;
	static char ch[bufsize],*S=ch,*T=ch;
	inline char getc()
	{return ((S==T)&&(T=(S=ch)+fread(ch,1,bufsize,stdin),S==T)?0:*S++);}
	static char Out[outsize],*nowp=Out;
	inline void flush(){fwrite(Out,1,nowp-Out,stdout);nowp=Out;}
	template<typename T>
		void read(T &x)
		{
			char c=getc();x=0;
			for(;!isdigit(c);c=getc());
			for(;isdigit(c);x=(x<<1)+(x<<3)+(c^'0'),c=getc());
		}
	template<typename T>
		void write(T x,char c='\n')
		{
			if(!x)*nowp++='0';
			static unsigned int stk[50],tp=0;
			for(;x;x/=10)stk[++tp]=x%10;
			for(;tp;*nowp++=stk[tp--]^'0');*nowp++=c;
		}
}
int find(int x){return fa[x]^x?fa[x]=find(fa[x]):x;}
int main()
{
	using namespace IO;
	int x,y,z,o,X,Y;
	read(n),read(H);
	f(i,0,400)fa[i]=i;
	f(i,1,n)
	{
		read(x),read(y),read(z),read(o);
		if(z==0)X=200+x;
		else X=200-z;
		if(o==0)Y=200-y;
		else Y=200+o;
		book[X]=book[Y]=1;
		++dgi[Y],++dgo[X];
		fa[find(Y)]=find(X);

	}
	f(i,0,200)if(dgi[i]<dgo[i])orz;
	f(i,201,400)if(dgi[i]>dgo[i])orz;
	f(i,0,400)out[find(i)]|=(dgi[i]^dgo[i]);
	f(i,0,400)if(fa[i]==i&&book[i]&&!out[fa[i]])orz;
	qwq;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
S = input()
T = []

g = S[0]
cnt = 0
for s in S:
    if s == g:
        cnt += 1
    else:
        T.append(cnt)
        cnt = 1
        g = s
else:
    T.append(cnt)


print(N - max(1, len(T) - 2 * K))


Measured memory_bytes: 3956
#                         author:  kagemeka 
#                         created: 2019-11-06 12:47:30(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics

def main():
    n, *txy = (int(x) for x in sys.stdin.read().split())
    t, x, y = [0], [0], [0]
    for i in range(0, n * 3, 3):
        t.append(txy[i])
        x.append(txy[i+1])
        y.append(txy[i+2])
    for i in range(n):
        dt = t[i+1] - t[i]
        distx = abs(x[i+1] - x[i])
        disty = abs(y[i+1] - y[i])
        if dt - (distx + disty) >= 0 and (dt - (distx + disty)) % 2 == 0:
            continue
        else:
            ans = 'No'        
            break
    else:
        ans = 'Yes'
    
    print(ans)

if __name__ == "__main__":
    # execute only if run as a script
    main()


Measured memory_bytes: 26632
#include <iostream>
#include <vector>

int main()
{
  int n;
  std::cin >> n;
  std::string S;
  std::cin >> S;
  int count = 0;
  for (int i = 0; i < 10; i++)
  {
    for (int j = 0; j < 10; j++)
    {
      for (int k = 0; k < 10; k++)
      {
        bool i_clear = false;
        bool j_clear = false;
        bool k_clear = false;
        for (const auto& s: S)
        {
           if(s - '0' == i&& !i_clear && !j_clear && !k_clear)
           {
             i_clear = true;
             continue;
           }
           if(s - '0' == j && i_clear&&!j_clear&&!k_clear)
           {
             j_clear = true;
             continue;
           }
           if(s - '0' == k && i_clear && j_clear&&!k_clear)
           {
             k_clear = true;
             continue;
           }
        }
        if(i_clear&& j_clear&&k_clear)
        {
          count ++;
        }

      }

    }

  }
  std::cout << count << std::endl;
}


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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair



int main() {
  int h, w, k;
  cin >> h >> w >> k;
  k--;
  vll dp(h + 1, vl(w));
  dp[0][0] = 1;
  rep (i, h) {
    rep (j, w) { 
      rep (k, 1 << (w - 1)) {
        bool flag = true;
        rep (l, w - 2) {
          int mask1 = 1 << l, mask2 = 1 << (l + 1);
          if ((k & mask1) && (k & mask2)) {
            flag = false;
            break;
          }
        }
        if (!flag) continue;
        flag = false;
        if (j != 0) {
          int mask = 1 << (j - 1);
          if (k & mask) {
            dp[i + 1][j - 1] += dp[i][j];
            dp[i + 1][j - 1] %= MOD;
            flag = true;
          }
        }
        if (j != w - 1) {
          int mask = 1 << j;
          if (k & mask) {
            dp[i + 1][j + 1] += dp[i][j];
            dp[i + 1][j + 1] %= MOD;
            flag = true;
          }
        }
        if (!flag) {
          dp[i + 1][j] += dp[i][j];
          dp[i + 1][j] %= MOD;
        }
      }
    }
  }
  cout << dp[h][k] << endl;
}
        
    
  
  


Measured memory_bytes: 256
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  ll a,b,c=0,d=0,e=0,f,g;cin>>a>>f>>g;
  rep(i,a){
    cin>>b;
    if(b<=f)c++;
    else if(b<=g)e++;
    else d++;
  }
  cout<<min({c,d,e});
}



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

int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<int>> job(m+1);
    for(int i=0;i<n;++i){
        int a,b;
        cin>>a>>b;
        if(a>m) continue;
        job[a].push_back(b);
    }

    priority_queue<int> pq;
    int res=0;
    for(int i=0;i<=m;++i){
        for(auto v:job[i]) pq.push(v);
        if(pq.empty()) continue;
        res+=pq.top();
        pq.pop();
    }
    
    cout<<res<<endl;
}

Measured memory_bytes: 8280
S = input()

flag = 1
while len(S):
    if S[:7] == 'dreamer':
        if S[5:11] == 'eraser':
            S = S[11:]
        elif S[5:10] == 'erase':
            S = S[10:]
        else:
            S = S[7:]
    elif S[:6] == 'eraser':
        S = S[6:]
    elif S[:5] == 'dream' or S[:5] == 'erase':
        S = S[5:]
    else:
        flag = 0
        break

if flag:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
s = input()
n = len(s)

for i in range(n-1):
    if s[i] == s[i+1]:
        print(i+1,i+2)
        exit()

for i in range(n-2):
    if s[i] == s[i+2]:
        print(i+1,i+3)
        exit()

print(-1,-1)


Measured memory_bytes: 9160
def obj(t):
    return t**2 + t

import math
X = int(input())

s = 0
e = 2e9
m = math.floor((s + e) / 2.0)

while(True):
    if (obj(m) < (2 * X)):
        s = m
    else:
        e = m
    if ((e - s) <= 1):
        print(e)
        break
    m = math.floor((s + e) / 2.0)


Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	int a, b;
	cin >> a >> b;
	if (a * b % 2 == 1)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import string

N = int(input().split()[0])
S = input()

s_list = list(string.ascii_uppercase + string.ascii_uppercase)
r = ""
for c in list(S):
    n = s_list.index(c)
    r += s_list[n + N]

ans = r
print(ans)


Measured memory_bytes: 3960
K = int(input())
if K%2==0 or K%5==0:
  print(-1)
elif K == (1 or 7):
  print(1)
else:
  mod = 7 % K
  mod_plus = mod
  i = 0
  while mod != 0:
    i += 1
    mod_plus = (mod_plus*10) % K
    mod = (mod + mod_plus) % K
  print(i+1)

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

int main() {
  int N;
  cin >> N;
  
  int count = 0;
  
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      if (i * j == N) {
        count++;
      }
    }
  }
  if (count >= 1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3640
/*
	% D a l a o
			--InterestingLSY
*/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define pb push_back
#define mp make_pair
#define INF 9999999
#define LINF 9999999999999999
#define uint unsigned int
#define msn(a,v) memset(a,v,sizeof(a))
#define ms(a) msn(a,0)
#define NONE -1
#define ll long long
#define ull unsigned ll
#define uchar unsigned char
#define sint short int
#define usint unsigned sint
#define lb lower_bound
#define ub upper_bound
using namespace std;
#define MAXN 100010

int n,D,a,b;

/*****************************************/
class Dot{
public:
	int x;int y;int id;
	void read(int i){
		scanf("%d %d",&x,&y);
		id = i;
	}
	void rotate(){
		int xx = x+y, yy = x-y;
		x = xx; y = yy;
	}
	void chg(){
		swap(x,y);
	}
}; Dot dot[MAXN];
Dot getdot(int x,int y,int id){
	Dot d1;
	d1.x = x; d1.y = y; d1.id = id;
	return d1;
}
bool operator<(Dot d1,Dot d2){
	if(d1.x != d2.x) return d1.x < d2.x;
	if(d1.y != d2.y) return d1.y < d2.y;
	return d1.id < d2.id;
}
/*****************************************/
int dsu[MAXN];
void init(){
	for(int i = 1;i <= n;i++)
		dsu[i] = i;
}
int getfa(int pos){
	if(dsu[pos] == pos) return pos;
	dsu[pos] = getfa(dsu[pos]);
	return dsu[pos];
}
void unite(int a,int b){
	a = getfa(a); b = getfa(b);
	dsu[a] = b;
}
int same(int a,int b){
	return getfa(a) == getfa(b);
}
/*****************************************/
int s(int v){
	if(v) return INF;
	return v;
}
int du[MAXN];
void getdu(){
	ms(du);
	for(int j = 0;j < 2;j++){
		sort(dot,dot+n);
		for(int i = 0;i < n;i++)
			du[dot[i].id] += 
				(lb(dot,dot+n,getdot(dot[i].x-D,dot[i].y+D,s(!j)))-dot)
										-
				(lb(dot,dot+n,getdot(dot[i].x-D,dot[i].y-D,s(j)))-dot)
										+
				(lb(dot,dot+n,getdot(dot[i].x+D,dot[i].y+D,s(!j)))-dot)
										-
				(lb(dot,dot+n,getdot(dot[i].x+D,dot[i].y-D,s(j)))-dot)
			;
		if(j == 1) return;
		for(int i = 0;i < n;i++) dot[i].chg();
	}
}
void getlian(){
	init();
	int sum[MAXN];
	for(int j = 0;j < 2;j++){
	    ms(sum);
	    sort(dot,dot+n);
		for(int i = 0;i < n;i++){
		    int u = lb(dot,dot+n,getdot(dot[i].x-D,dot[i].y-D,0))-dot;
		    int d = lb(dot,dot+n,getdot(dot[i].x-D,dot[i].y+D,INF))-dot;
		    if(u == d) continue;
		    unite(dot[u].id,dot[i].id);
		    sum[u]++; sum[d-1]--;
		}
		for(int i = 0;i < n;i++){
		    if(i) sum[i] += sum[i-1];
		    if(sum[i]) unite(dot[i].id,dot[i+1].id);
		}
		if(j == 1) return;
		for(int i = 0;i < n;i++) dot[i].chg();
	}
}
/************************************************
		所 有 数 组 下 标 都 从 0 开 始 
************************************************/
int main(){
	//freopen("E.txt","r",stdin);
	
	scanf("%d %d %d",&n,&a,&b);
	for(int i = 0;i < n;i++)
		dot[i].read(i);
	
	a--;b--;
	D = abs( dot[a].x - dot[b].x )  +  abs( dot[a].y - dot[b].y );
	
	for(int i = 0;i < n;i++)
		dot[i].rotate();
		
	getdu();
	getlian();
	
	ll ans = 0;
	for(int i = 0;i < n;i++)
		if(same(i,a))
			ans += du[i];
	ans /= 2;
	
	printf("%lld\n",ans);
	
	return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
//#define int long long
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define mi(N) int N; cin >> N;
#define ms(s) string s; cin >> s;
#define md(d) double d; cin >> d;
#define mv(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

template<typename T>
void say(vector<T> s, char r) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << r << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("yes");
	else say("no");
}

void Yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}

void Yay(bool b) {
	if (b)say("Yay!");
	else say(":(");
}

template<typename T>
void maxi(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T& a, T b) {
	a = min(a, b);
}

void exact_say(double x) {
	cout << setprecision(numeric_limits<double>::max_digits10) << x << endl;
}

template<typename T>
vector<vector<T>> fill_vector(int h, int w, T val) {
	vector<vector<T>> ret;
	vector<T> v(w, val);
	rep(h)ret.push_back(v);
	return ret;
}

signed main() {
	mi(n);
	ll sum = 0;
	int cnt = 0;
	int Min = INT_MAX;
	rep(n) {
		mi(a);
		sum += abs(a);
		mini(Min, abs(a));
		cnt += a < 0;
	}
	if (cnt % 2 == 1)sum -= 2 * Min;
	say(sum);
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << -1; return;}

void solve() {
    char a, b, c, d;
    cin >> a >> b >> c >> d;
    int x = (a - '0') * 10 + b - '0', y = (c - '0') * 10 + d - '0';
    bool f1 = x > 0 && x <= 12, f2 = y > 0 && y <= 12;
    if (f1 && f2)
        cout << "AMBIGUOUS";
    else if (f1)
        cout << "MMYY";
    else if (f2)
        cout << "YYMM";
    else
        cout << "NA";
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int arr[100005];

int main(){

    int n,k,i,x,y,ans=INT_MAX,temp;
    cin>>n>>k;
    for(i=1; i<=n; i++)cin>>arr[i];
    for(i=k; i<=n; i++){
        if(arr[i-k+1]>0){
            temp=arr[i];
            ans=min(ans,temp);
        }
        else if(arr[i]<0){
            temp=abs(arr[i-k+1]);
            ans=min(ans,temp);
        }
        else{
            x=abs(arr[i-k+1]);
            y=arr[i];
            temp=max(x,y)+min(x,y)*2;
            ans=min(ans,temp);
        }
        ///cout<<i<<' '<<ans<<endl;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

void main_()
{
    ll N;
    cin >> N;

    unordered_map<ll, ll> m;
    ll ans = N;
    for (ll i = 0; i < N; ++i) {
        ll a;
        cin >> a;
        m[a]++;
        if (m[a] == a) {
            ans -= a;
        }
    }

    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 4260
s = input()

ans = []
rl = []
for i in range(len(s)):
    if s[i] == "R" and s[i+1] == "L":
        ans.append(1)
        r = i
    elif s[i-1] == "R" and s[i] == "L":
        ans.append(1)
        rl.append([r,i])
    else:
        ans.append(0)

t = s.split("RL")
for i, v in enumerate(t):
    if v == "":
        continue
    le = len(v)
    for j, w in enumerate(v):
        if w == "R":
            if (le-j)%2 == 1:
                ans[rl[i][1]] += 1
            else:
                ans[rl[i][0]] += 1
        else:
            if j%2 == 0:
                ans[rl[i-1][0]] += 1
            else:
                ans[rl[i-1][1]] += 1
print(*ans)

Measured memory_bytes: 56304
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	g := make([][]int, n+1)
	for i := 0; i < n; i++ {
		var u,k int
		fmt.Scan(&u)
		fmt.Scan(&k)
		g[u] = make([]int, k)
		for j := 0; j < k; j++ {
			fmt.Scan(&g[u][j])
		}
	}

	d := make([]int, n+1)
	f := make([]int, n+1)
	t := 1
	for i := 1; i <= n; i++ {
		t = dfs(&g, &d, &f, i, t)
	}

	for i := 1; i <= n; i++ {
		fmt.Printf("%d %d %d\n", i, d[i], f[i])
	}
}

func dfs(g *[][]int, d *[]int, f *[]int, id int, t int) int {
	if (*d)[id] > 0 {
		return t
	}
	(*d)[id] = t
	t += 1
	for i := 0; i < len((*g)[id]); i++ {
		t = dfs(g, d, f, (*g)[id][i], t)
	}
	(*f)[id] = t
	return t+1
}



Measured memory_bytes: 1168
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
const int MOD = 1000000007;


typedef long long int ll; 
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

void floatOutPutSetup(){
    cout << fixed;
    cout << setprecision(10);
}

int solve(int m,int nmin,int nmax) {
    vector<int> p(m,0);
    vector<int> s;
    rep(i,m)cin>>p[i];
    sort(p.rbegin(),p.rend());//降順ソート
    rep(i,nmax-nmin+1) s.push_back(p[nmin+i-1]-p[nmin+i]);
    
    Pii ans;
    ans = make_pair(0,0);

    rep(i,nmax-nmin+1){
        if(s[i]>=ans.second) ans = make_pair(i,s[i]);
    }
    return nmin+ans.first;
}

int main(){
    int m,nmin,nmax;
    cin >>m>>nmin>>nmax;
    while (m!=0){
        cout<<solve(m,nmin,nmax)<<endl;
        cin>>m>>nmin>>nmax;
    }
    
}


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

int maxGCD(vector <int>v)
{
    int i;
    int vmax = 0;
    for(i=0; i < v.size();i++)
    {
        vmax = max(v[i], vmax);
    }
    vector <int> count(vmax+5,0);
    for(i=0;i<v.size(); i++)
    {
       count[v[i]]++;
    }
    for(i = vmax; i >=1; i--)
    {
        int j = i;
        int cnt = 0;
        while(j<=vmax)
        {
            if(count[j]>=2)
                return j;
            if(count[j] == 1)
                cnt++;
            j= j + i;
            if(cnt == 2)
                return i;

        }
    }
}
int gcd(int x, int y)
{
    while(y)
    {
        int c =  x % y;
        x = y;
        y = c;
    }
    return x;
}
int gcdV(vector <int>v)
{
    int i;
    int x = v[0];
    int y = v[1];
    x = gcd(x, y);
    for(i=2; i <v.size();i++)
    {
        y = v[i];
        x = gcd(x, y);
    }
    return x;
}

int main()
{

    int n, x;
    vector <int>v;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        v.push_back(x);
    }
    if(maxGCD(v) == 1)
        cout<<"pairwise coprime"<<"\n";
    else if(gcdV(v) == 1)
        cout<<"setwise coprime"<<"\n";
    else
        cout<<"not coprime"<<"\n";


    return 0;
}

Measured memory_bytes: 15016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, n) for (ll i = a; i < n; i++)

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<vector<int>>s(m);
    REP(i,m){
        int k;
        cin >> k;
        s[i].resize(k,0);
        REP(j,k){
            cin >> s[i][j];
        }
    }
    vector<int>p(m,0);
    REP(i,m) cin >> p[i];
    int cnt= 0;
    //bit全探索
    for(int i=0; i<(1<<n); i++){
        int light[n]= {0}; //組み合わせを保存
        for(int j=0; j<n; j++){
            if(i & 1<<j){
                light[j]= 1;
            }
        }
        //この組み合わせでf==1のままならcnt++
        int f= 1;
        //電球 m個について考える
        REP(j,m){
            // 電球jが光るかどうか
            int cc= 0; //スイッチカウント
            REP(k,s[j].size()){ //スイッチ
                //添字に気をつける
                if(light[s[j][k]-1]==1) cc++;
            }
            if(cc%2!=p[j]){
                f= 0;
                break;
            }
            if(f==0) break;
        }
        if(f) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int N, M;
	cin >> N >> M;

	int ans = N*M;


	cout << ans << endl;
	return 0;
}

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

using namespace std;
using ll = long long;

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

  if (N == 1) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = N * (N - 1) / 2;
  cout << ans << endl;
  return 0;
}

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

using namespace std;

const int N = 1e3 + 3;
const int MOD = 1e9 + 7;

int n, m;
char a[N][N];
int dp[N][N];

int main()
{
//    freopen("input.inp", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            cin >> a[i][j];
    dp[1][1] = 1;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
        {
            if (i + 1 <= n && a[i + 1][j] == '.')
                dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD;
            if (j + 1 <= m && a[i][j + 1] == '.')
                dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % MOD;
        }
    cout << dp[n][m];
    return 0;
}


Measured memory_bytes: 5120