akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e6 * 2 + 5;
constexpr double PI = acos(-1);

long long fac[MAX_N], finv[MAX_N], inv[MAX_N];
// テーブルを作る前処理 from: https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX_N; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// factorial
long long fact(int n) {
    if (n == 1) return fac[n] = 1;
    if (fac[n]) return fac[n];
    return fac[n] = (fact(n - 1) * n) % MOD;
}
// コンテナ出力効率化
template <class Type>
void line(const Type &a) {
    int cnt = 0;
    for (const auto &elem : a) {
        if (cnt++) cout << ' ';
        cout << elem;
    }
    cout << '\n';
}

int main() {
    int n;
    cin >> n;
    vl a(n);
    vl dict(n + 1, 0);
    rep(i, n) cin >> a[i];
    rep(i, n) dict[a[i]]++;

    ll sum = 0;
    rep(i, n + 1) {
        sum += dict[i] * (dict[i] - 1) / 2;
    }
    ll ans = 0;
    rep(i, n) {
        ans = sum - (dict[a[i]] - 1);
        out(ans);
    }
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; 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 ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

int main() {
    int a,b,c; cin >> a >> b >> c;
    cout << (b+c-a>=0 ? b+c-a : 0) << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll h, w, m, a, b;
    cin >> h >> w >> m;
    vector<ll> l(h, 0), r(w, 0); //横列, 縦列
    map<P, ll> t;
    rep1(i, m){
        cin >> a >> b;
        a--;
        b--;
        l[a]++;
        r[b]++;
        P p = make_pair(a, b);
        t[p]++;
    }
    ll max_l = *max_element(l.begin(), l.end());
    ll max_r = *max_element(r.begin(), r.end());
    vector<ll> ndx_l, ndx_r; //横列, 縦列
    rep1(i, h) if (l[i] == max_l) ndx_l.push_back(i);
    rep1(i, w) if (r[i] == max_r) ndx_r.push_back(i);
    ll ans = max_l + max_r - 1;
    for (auto x: ndx_l){
        for (auto y: ndx_r){
            P p = make_pair(x, y);
            if (t[p]==0){
                ans = max_l + max_r;
                cout << ans << endl;
                return 0;
            }
        }
    } 
    cout << ans << endl;
    //printf("%.12f", ans);
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int h = in(), w = in();
    vstr s = in(h);

    vint dx{-1, 0, 1, 1, 1, 0, -1, -1};
    vint dy{-1, -1, -1, 0, 1, 1, 1, 0};
    rep(i, h) rep(j, w)
    {
        if (s[i][j] == '#')
        {
            continue;
        }
        int cnt = 0;
        rep(k, dx.size())
        {
            int x = dx[k];
            int y = dy[k];

            if (i + y < 0 || i + y >= h || j + x < 0 || j + x >= w)
                continue;
            if (s[i + y][j + x] == '#')
                ++cnt;
        }
        s[i][j] = '0' + cnt;
    }
    rep(i, h) cout << s[i] << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Long() + add;
        }
        return Array;
    }
}
class Program {
    static Scanner cin = new Scanner();
    static bool[] visited = new bool[55];
    static bool[,] graph = new bool[55, 55]; //隣接行列
    static int N = cin.Int();
    static int M = cin.Int();
  
    static void Main() {
        var a = new int[M];
        var b = new int[M];

        for (int i = 0; i < M; i++) {
            a[i] = cin.Int();
            b[i] = cin.Int();
            graph[a[i], b[i]] = true;
            graph[b[i], a[i]] = true;
        }

        int ans = 0;
        for (int i = 0; i < M; i++) {
            //i番目の道が存在していないときを考える
            graph[a[i], b[i]] = false;
            graph[b[i], a[i]] = false;

            //すべての頂点を未訪問にする
            for (int j = 1; j <= N; j++) {
                visited[j] = false;
            }

            dfs(1);

            bool bridge = false;
            for (int j = 1; j <= N; j++) {
                if (visited[j] == false) bridge = true; //1つでも訪問できない頂点が合ったらグラフは非連結
            }
            if (bridge) ans++;

            //戻しておく
            graph[a[i], b[i]] = true;
            graph[b[i], a[i]] = true;
        }

        Console.WriteLine(ans);
        Console.ReadLine();
    }

    static void dfs(int v) {
        visited[v] = true; //頂点vを訪問済みにする
        for (int i = 1; i <= N; i++) {
            if (graph[v, i] == false) continue; //頂点vと頂点iが隣接していなければ飛ばす
            if (visited[i] == true) continue; //頂点iがすでに訪問済みだったら飛ばす
            dfs(i);
        }
    }
}

Measured memory_bytes: 13268
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x[] = new int[3];
    x[0]=sc.nextInt();
    x[1]=sc.nextInt();
    x[2]=sc.nextInt();
    int n = sc.nextInt();
    Arrays.sort(x);
    System.out.println((int)(x[0]+x[1]+x[2]*Math.pow(2,n)));
  }
  

  
}


Measured memory_bytes: 23636
#include<iostream>
#include<cstdio>
using namespace std;
const int N=5005;
const int MOD=1000000007;
int n,a,b;
long long f[N][2];
long long g[N];
long long dp[N][2];
long long ksm(long long a,long long b)
{
	long long res=1;
	while(b)
	{
		if(b&1) res=res*a%MOD;
		a=a*a%MOD,b>>=1;
	}
	return res;
}
int main()
{
	scanf("%d%d%d",&n,&a,&b);
	if(a>b) swap(a,b);
	if(b==1)
	{
		printf("%lld",ksm(2,n));
		return 0;
	}
	f[0][0]=f[0][1]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<i;j++)
			f[i][1]=(f[i][1]+f[j][0])%MOD;
		for(int j=0;j+a<=i;j++)
			f[i][0]=(f[i][0]+f[j][1])%MOD;
	}
	g[0]=1;
	for(int i=1;i<=n;i++)
		g[i]=(f[i][0]+f[i][1])%MOD;
	long long ans=0;
	for(int i=1;i<n;i++)
	{
		if(i<a) dp[i][0]=(dp[i][0]+1)%MOD;
		for(int j=max(i-a+1,1);j<i;j++)
			dp[i][0]=(dp[i][0]+dp[j][1])%MOD;
		if(i<b) dp[i][1]=(dp[i][1]+g[i-1])%MOD;
		for(int j=max(i-b+1,1);j<i;j++)
			dp[i][1]=(dp[i][1]+dp[j][0]*(i-j==1?1:g[i-j-2])%MOD)%MOD;
		if(i+b-1>=n) ans=(ans+dp[i][0]*g[n-i-1]%MOD)%MOD;
		if(i+a-1>=n) ans=(ans+dp[i][1])%MOD;
	}
	printf("%lld",(ksm(2,n)-ans+MOD)%MOD);
	return 0;
}

Measured memory_bytes: 3976
using System;
using System.Linq;

class ITP1
{
    static void Main()
    {
        for (; ; )
        {
        var a = Console.ReadLine();
        int b = int.Parse(a.Split(' ')[0]);
        int c = int.Parse(a.Split(' ')[1]);
            if (b == 0 && c == 0) { break; }
            for (int i = 0; i < b; i++)
            {
                for (int j = 0; j < c; j++)
                {
                    if ((i %2==0&&j%2==1)||(i%2==1&&j%2==0))
                    {
                        Console.Write('.');
                    }
                    else
                    {
                        Console.Write('#');
                    }
                }
                Console.Write('\n');
            }
            Console.Write('\n');
        }
    }
}

Measured memory_bytes: 5292
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll=long long;
using P=pair<int,int>;

int main(){
    ll n; cin>>n;
    set<int> st;
    rep(i,n){
        ll a; cin>>a;
        st.insert(a);
    }
    if(st.size()==n) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


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

using ll = long long;

struct segtree {
	
	vector <int> tree;
	int size;
	
	void init (int n) {
		size = 1;
		while (size < n) {
			size <<= 1;
		}
		tree.assign(size<<1, 0);
	}
	
	int son (int v, int num) {
		return (v<<1)+(num-1);
	}
	
	void set (int v, int lv, int rv, int i, int x) {
		if (lv == rv) {
			tree[v] = x;
			return;
		}
		int mid = (lv+rv)>>1;
		if (mid >= i) {
			set (son(v, 1), lv, mid, i, x);
		} else {
			set (son(v, 2), mid+1, rv, i, x);
		}
		tree[v] = tree[son(v, 1)] + tree[son(v, 2)];
	}
	
	void set (int i, int x) {
		set (1, 1, size, i, x);
	}
	
	int get (int v, int lv, int rv, int l, int r) {
		if (lv > r || rv < l || l > r || lv > rv) {
			return 0;
		}
		if (lv >= l && rv <= r) {
			return tree[v];
		}
		int mid = (lv+rv)>>1;
		int sum1 = get(son(v, 1), lv, mid, l, min(r, mid));
		int sum2 = get(son(v, 2), mid+1, rv, max(mid+1, l), r);
		return (sum1+sum2);
	}
	
	int get (int l, int r) {
		return get (1, 1, size, l, r);
	}
	
};

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, k, ans = 0;
	bool zero = 0;
	segtree t;
	cin >> n >> k;
	vector <int> a(n+1);
	t.init(n);
	for (int i=1; i<=n; i++) {
		cin >> a[i];
		a[i] ++;
	}
	ll cnt = 0;
	for (int i=1; i<=n; i++) {
		if (i > k) {
			t.set(a[i-k], 0);
		}
		int cur = t.get(a[i]+1, n);
		int del = 0;
		if (i > k) {
			del = t.get(1, a[i-k]-1);
		}
		cnt += cur-del;
		if (!cnt && i >= k) {
			zero = 1;
		}
		if ((del || cur || i == k) && i >= k && cnt) {
			ans ++;
		}
		//cout << cnt << " " << cur << " " << del << " " << ans << "\n";
		t.set(a[i], 1);
	}
	cout << ans+zero;
	return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>

#define pb(e) push_back(e)
#define rep(i, n) for (int i = 0; i < n; ++i)

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;

const int INF = 1 << 29;
const int MAX_N = 8;
const int MAX_M = 30;

double dp[MAX_M][1 << MAX_N];

int main ( void )
{
	int n, m, p, a, b;
	while (cin >> n >> m >> p >> a >> b, n|m|p|a|b) {
		VVI E(m, VI(m, -1));
		VI t(n);
		for (int i = 0; i < n; ++i) { cin >> t[i]; }
		for (int i = 0; i < p; ++i) {
			int x, y, z;
			cin >> x >> y >> z;
			E[x-1][y-1] = E[y-1][x-1] = z;
		}
		rep (i, m) rep (j, 1 << n) dp[i][j] = INF;

		double ans = INF;
		dp[a-1][(1 << n) - 1] = 0;
		for (int k = (1 << n) - 1; k >= 0; --k) {
			ans = min(ans, dp[b-1][k]);
			rep (i, m) {
				rep (j, m) {
					if (E[i][j] == -1) { continue; }
					rep (l, n) {
						int s = 1 << l;
						if (k & s) {
							dp[j][k & ~s] = min(dp[j][k & ~s], dp[i][k] + E[i][j] / (double)t[l]);
						}
					}
				}
			}
		}
		if (ans == INF) {
			printf("Impossible\n");
		}
		else {
			printf("%.7f\n", ans);
		}
	}
	return 0;
}

Measured memory_bytes: 1312
#include <stdio.h>
#include <string.h>

char O[55];
char E[55];

int main(){

	scanf("%s",O);
	scanf("%s",E);

	int len_O=strlen(O);
	int len_E=strlen(E);

	int i,j,k;

	i=0;
	j=0;
	k=0;

	while(1){
		if(i%2==0){
		printf("%c",O[j]);
		j++;
		if(j==len_O){break;}
		}
		else{
		printf("%c",E[k]);
		k++;
		}
		i++;
	}

	if(len_O==len_E){
		printf("%c\n",E[len_E-1]);
	}
	else{
	printf("\n");
	}

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> card(N);
  rep(i,N){
    cin >> card.at(i);
  }
  sort(card.begin(),card.end());
  reverse(card.begin(),card.end());
  int i = 0;
  int countA = 0;
  int countB = 0;
  while(i < N){
    countA += card.at(i);
    i++;
    if(i<N){
      countB += card.at(i);
      i++;
    }
  }
  cout << countA - countB << endl;
}
    

Measured memory_bytes: 256
//
// Created by yamunaku on 2019/07/20.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> box(n,0);
    perl(i,1,n+1){
        int sum=0;
        for(int j=i-1;j<n;j+=i){
            sum+=box[j];
        }
        if(sum%2!=a[i-1]) box[i-1]=1;
    }
    int m=0;
    rep(i,n){
        m+=box[i];
    }
    cout << m << endl;
    rep(i,n){
        if(box[i]) cout << i+1 << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 2432
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

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

    sort(S.begin(),S.end());
    sort(T.rbegin(),T.rend());

    for(int i=0;i<min(S.size(),T.size());++i){ 
        if(S[i]<T[i]){
            cout<<"Yes"<<endl;
            return 0;
        }else if(S[i]>T[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(S.size()<T.size()){
        cout<<"Yes"<<endl;
        return 0;    
    }
    cout<<"No"<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;

int n, m, rest[N];
vector<int> query[N];
priority_queue<int, vector<int>, greater<int> > heap;

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; ++i) {
		int l, r;
		scanf("%d%d", &l, &r);
		query[l].push_back(r);
	}
	int l = 0;
	for (int i = 0; i <= m; ++i)
		for (int _i = 0; _i < query[i].size(); ++_i) {
			int x = query[i][_i];
			if (l < i) {
				heap.push(x);
				++l;
				continue;
			}
			if (heap.empty() || x <= heap.top()) ++rest[x];
			else {
				++rest[heap.top()];
				heap.pop();
				heap.push(x);
			}
		}
	int r = m + 1, ans = rest[m + 1];
	for (int i = m; i; --i)
		while (rest[i]) {
			if (i < r && l + 1 < r) --r;
			else ++ans;
			--rest[i];
		}
	printf("%d\n", ans);
}

Measured memory_bytes: 10108
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int[] a = new int[5];
		int index = 0;
		
		for(int i = 0; i < 5; i++) {
			a[i] = stdIn.nextInt();
			if(a[i]==0) {
				index = i;
			}
		}
		
		System.out.println(index+1);
		
		
		
		
	}

}


Measured memory_bytes: 35680
import java.util.Scanner;

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

        int numAnimals = sc.nextInt();
        int numFeet = sc.nextInt();

        int maxFeet = 4 * numAnimals;
        int minFeet = 2 * numAnimals;

        if(minFeet <= numFeet && numFeet <= maxFeet && numFeet % 2 == 0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35588
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
	
	if(a < 10)
		System.out.println(a);
	else if(a < 100)
		System.out.println(9);
	else if(a < 1000)
		System.out.println(a - 90);
	else if(a < 10000)
		System.out.println(909);
	else if(a < 100000)
		System.out.println(a - 9090);
	else
		System.out.println(90909);
	
  }
	
}

Measured memory_bytes: 21716
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public static void Main(string[] args)
	{
		string s = Console.ReadLine();
		
		
		int b = int.Parse(s.Substring(0,2));
		int c = int.Parse(s.Substring(2,2));
		if(b<=12&&c<=12&&b>=1&&c>=1)
		{
		Console.WriteLine("AMBIGUOUS");
		
		}else if((b>12||b<1)&&c<=12&&c>=1)
		{
			Console.WriteLine("YYMM");
		}else if((c>12||c<1)&&b<=12&&b>=1)
		{
			Console.WriteLine("MMYY");
		}else{
			Console.WriteLine("NA");
		}
	}

	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}


}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl
const ll INF = 1000000007;

int main(){
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int M = max(max(a, b),c);
  int sum = a + b + c -M;
  int ans = pow(2,k)*M + sum;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <map>
#include <algorithm>

using namespace std; using ll=long long; const int INF=1e2; using P=pair<int,int>;

int main() {
  ll n,W; cin>>n>>W;
  ll w[n], v[n]; for(int i=0;i<n;i++) cin>>w[i]>>v[i];
  ll an=0, w0=w[0];
  vector<ll> s[4];

  for(int i=0;i<n;i++) {
    s[w[i]-w0].push_back(v[i]);
  }

  for(int i=0;i<4;i++) {
    sort(s[i].begin(), s[i].end(), greater<ll>());
    s[i].insert(s[i].begin(), 0);
    for(int j=1;j<s[i].size();j++) {
      s[i][j] += s[i][j-1];
    }
  }

  int s0 = s[0].size(), s1 = s[1].size(), s2 = s[2].size(), s3 = s[3].size();

  for(int i=0;i<s0;i++) {
    ll ww0 = w0 * i;
    ll vv0 = s[0][i];
    for(int j=0;j<s1;j++) {
      ll ww1 = (w0+1) * j;
      ll vv1 = s[1][j];
      for(int k=0;k<s2;k++) {
        ll ww2 = (w0+2) * k;
        ll vv2 = s[2][k];
        for(int l=0;l<s3;l++) {
          ll ww3 = (w0+3) * l;
          ll vv3 = s[3][l];

          if (ww0 + ww1 + ww2 + ww3 <= W) {
            an = max(an, vv0 + vv1 + vv2 + vv3);
          }
        }
      }
    }
  }
  cout<<an<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
using namespace std;

int main() {

	int N;
	int K;

	cin >> N >> K;

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

	int ans = (N - 1) / (K - 1);
	if ((N - 1) % (K - 1) != 0) {
		ans += 1;
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define MAX 100005
#define INF (1LL<<60)

vector<int> G[MAX];
int n,m,k,s,p,q,x,y,a[MAX];
ll d[MAX];

void dijkstra(ll si,ll costA,ll costB){
  priority_queue< P , vector<P> , greater<P> > Q;
  for(int i=0;i<=n;i++)d[i]=INF;
  d[si]=0;
  Q.push(P(0,si));
  while(!Q.empty()){
    P p=Q.top();Q.pop();
    ll cost=p.first,pos=p.second;
    for(int i=0;i<(int)G[pos].size();i++){
      int to=G[pos][i];
      ll ncost=cost;
      if(a[to]==2)continue;
      if(a[to]==1)ncost+=costA;
      if(a[to]==0)ncost+=costB;
      if(to==n-1)ncost=cost;
      if(ncost<d[to]){
        d[to]=ncost;
        Q.push(P(ncost,to));
      }
    }
  }
}

int main(){
  cin>>n>>m>>k>>s>>p>>q;
  for(int i=0;i<k;i++){
    cin>>x;
    x--;
    G[n].push_back(x);
  }
  for(int i=0;i<m;i++){
    cin>>x>>y;
    x--,y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  dijkstra(n,1,1);
  for(int i=0;i<n;i++){
    if(d[i]<=s+1)a[i]=1;
    if(d[i]==1)a[i]=2;
  }
  dijkstra(0,q,p);
  cout<<d[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 9144
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
 
int main() {
    double L;
    cin >> L;
    double ans = 0.0;
    double a,b,c;

    printf("%.30f\n",(L*L*L)/27);


 
}

Measured memory_bytes: 256
N = input()
A = [None]*2
A[0] = map(int, raw_input().split())
A[1] = map(int, raw_input().split())
T = [[0]*2 for _ in range(N)]
T[0][0] = A[0][0]
T[0][1] = A[1][0]+A[0][0]
for i in range(1,N):
  T[i][0] = T[i-1][0]+A[0][i]
  T[i][1] = max(T[i-1][1],T[i-1][0]+A[0][i])+A[1][i]
print T[N-1][1]


Measured memory_bytes: 2692
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <math.h>
#include <stack>
using namespace std;
typedef long long ll;

ll to_num(string s){
	ll res=0;
	if(s[0]=='-'){
		for(int i=1;i<s.size();i++){
			res*=10;
			res+=(s[i]-'0');
		}
		res*=-1;
	}else{
		for(int i=0;i<s.size();i++){
			res*=10;
			res+=(s[i]-'0');
		}
	}
	return res;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		int n; cin >> n;
		if(n==0)break;
		vector<string> s(n);
		vector<int> a(n);
		int l=-2e9;
		int r=2e9;
		bool ok=1;
		for(int i=0;i<n;i++){
			cin >> s[i];
			if(s[i][0]=='x'){
				a[i]=-2e9;
			}else{
				a[i]=to_num(s[i]);
			}
		}
		for(int i=0;i<n-1;i++){
			if(a[i]==-2e9){
				if(a[i+1]==-2e9)ok=0;
				else if(i%2==0){
					r=min(r,a[i+1]-1);
				}else{
					l=max(l,a[i+1]+1);
				}
			}
		}
		for(int i=n-1;i>0;i--){
			if(a[i]==-2e9){
				if(a[i-1]==-2e9)ok=0;
				else if(i%2==0){
					r=min(r,a[i-1]-1);
				}else{
					l=max(l,a[i-1]+1);
				}
			}
		}
		for(int i=0;i<n-1;i++){
			if(a[i]!=-2e9&&a[i+1]!=-2e9){
				if(i%2==0){
					if(a[i]>=a[i+1])ok=0;
				}else{
					if(a[i]<=a[i+1])ok=0;
				}
			}
		}
		if(ok){
			if(r>l)printf("ambiguous\n");
			else if(l==r)printf("%d\n",r );
			else printf("none\n");
		}else printf("none\n");
	}
}


Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
#define rep(i, n) for(int i = 0; i < n; i++)
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int main(){
    ll n; cin >> n;
    ll a[n];
    rep(i, n){
        cin >> a[i];
    }
    sort(a,a+n);
    ll ans1 = 0, ans2 = 0;
    if(n == 2){
        cout << max(a[0], a[1]) << " " << min(a[0],a[1]) << endl;
        return 0;
    }
    for(int i = n-1; i >= 0; i--){
        if(a[i] <= a[n-1]/2){
            ans2 = i;
            break;
        }
    }
    if(a[ans2] > a[n-1] - a[ans2+1]) cout << a[n-1] << " " << a[ans2] << endl;
    else cout << a[n-1] << " " << a[ans2+1] << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)

/*int main(){//B
    string S;
    cin>>S;
    rep(i,0,S.size()){
        if(i%2==0){
            if(S[i]!='R'&&S[i]!='U'&&S[i]!='D') {
                cout<<"No"<<endl;
                return 0;
            }
        }
        if(i%2!=0){
            if(S[i]!='L'&&S[i]!='U'&&S[i]!='D'){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}*/

int main(){
    int N,K,Q;
    cin>>N>>K>>Q;
    vector<int> A(N,K-Q);
    //vector<int> B(Q);
    int c=N;
    rep(i,0,Q){
        int b; 
        cin>>b;
        A[b-1]++;
    }
    rep(i,0,N) {if(A[i]>0) cout<<"Yes"<<endl;
                else cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Linq;
class p
{
  static void Main()
  {
    string[] ipt = Console.ReadLine().Split(' ');
    int K = int.Parse(ipt[0]);
    int N = int.Parse(ipt[1]);
    ipt = Console.ReadLine().Split(' ');
    int[] arr = new int[N];
    for (int i = 0; i < N; i++) {
      arr[i] = int.Parse(ipt[i]);
    }
    
    int maxDist = int.MinValue;
    for (int i = 0; i < N; i++) {
      if (i < N - 1) {
        maxDist = Math.Max(maxDist, arr[i + 1] - arr[i]);
      } else {
        maxDist = Math.Max(maxDist, (K - arr[i]) + arr[0]);
      }
    }
    Console.WriteLine(K - maxDist);
  }
}

Measured memory_bytes: 34652
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A.at(i);
    sort(begin(A), end(A));
    auto last = unique(begin(A), end(A));
    A.erase(last, end(A));
    if (A.size() == N) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 1024
#include <stdio.h>
int main()
{
  int m,n,target[1000],game[1000][1000],score[1000]={0};
  int i,j;
  scanf("%d",&m);
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&target[i]);
  }  
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      scanf("%d",&game[i][j]);
    }
  }
  
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      if(target[i]==game[i][j])  score[j]=score[j]+1;
      else score[target[i]]=score[target[i]]+1;
    }
  }
  for(j=1;j<=m;j++){
    printf("%d\n",score[j]);
  }
  return 0;
}

Measured memory_bytes: 2668
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,tune=native")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("trapv")
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
const int mod = 1000000007;
const ll inf = 1e18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
using ld = double;
using vec = complex<ld>;
#define x real()
#define y imag()
ld dot(vec a, vec b) {
	return (conj(a)*b).x;
}
ld cross(vec a, vec b) {
	return (conj(a)*b).y;
}
istream& operator>>(istream& in, vec &v) {
	ld a, b;
	in >> a >> b;
	v = vec(a, b);
	return in;
}
bool cw(vector<pair<vec, int>> &hull, vec &v) {
	int n = hull.size();
	if(n < 2) return true;
	return cross(hull[n-1].first-hull[n-2].first, v-hull[n-1].first)<=0;
}
ld ans[100100];
int main() { //DINIC ORZ
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	vector<pair<vec, int>> v;
	v.resize(n);
	int _T = 0;
	for(auto &i : v) {
		cin >> i.first;
		i.second = ++_T;
	}
	for(auto &i : v) {
		if(i.first.x < v.back().first.x || (i.first.x == v.back().first.x&&i.first.y<v.back().first.y))
			swap(v.back(), i);
	}
	vector<pair<vec, int>> hull {v.back()};
	v.pop_back();
	sort(all(v), [&](const pair<vec, int> &a, const pair<vec, int> &b) {
		if(fabs(cross(a.first-hull[0].first, b.first-hull[0].first))<1e-9)
			return abs(a.first-hull[0].first) < abs(b.first-hull[0].first);
		return cross(a.first-hull[0].first, b.first-hull[0].first) < 0;
	});
	for(auto i : v) {
		while(!cw(hull, i.first)) hull.pop_back();
		hull.pb(i);
	}
	for(int i = 0; i < hull.size(); i++) {
		vec l = (i?hull[i-1]:hull.back()).first;
		vec r = (i+1<hull.size()?hull[i+1]:hull[0]).first;
//		cout << hull[i].first << "\n";
//		cout << hull[i].first << " " << l << " " << r << "\n";
		l-=hull[i].first,	r-=hull[i].first;
		ld angle = M_PI - acos(((dot(l, r)/abs(l))/abs(r)));
//		cout << hull[i].first << " " << l << " " << r << "\n";
//		cout << dot(l, r) << "\n";
		ans[hull[i].second] = angle/(2*M_PI);
	}
	cout << fixed << setprecision(15);
	for(int i = 1; i <=n; i++) cout << ans[i] << "\n";
}



Measured memory_bytes: 512
N,M=map(int,input().split())
A=list(map(int,input().split()))
l=[]
for i in range(M):
    B,C=map(int,input().split())
    l.append((B,C))
A.sort()
l.sort(key=lambda x:x[1],reverse=True)

t=0
for bc in l:
    if t>=N or A[t]>=bc[1]:
        break
    for i in range(bc[0]):
        if t>=N or A[t]>=bc[1]:
            break
        A[t]=bc[1]
        t+=1

print(sum(A))

Measured memory_bytes: 22520
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

#define rep(X,Y) for(int (X) = 0; (X) < (Y) ; ++(X))
#define all(X) (X).begin,(X).end
#define reps(i,j,k) for(inti=(j); i <= (k); ++(i))
#define szh size()
#define in(i,j,k) ((i) >= (j) && (i) <= (k))

using namespace std;

typedef pair<int,int> pii;

template<class S,class T>ostream& operator<<(ostream &os,const pair<S,T> &t){return os<<"("<<t.X<<","<<t.Y<<")";}

int walls[2][33][33],
  dx[]={1,0,-1,0},dy[]={0,1,0,-1},
  wtype[4]={0,1,0,1},wx[]={0,0,-1,0},wy[]={0,0,0,-1},
  dist[33][33];
const int INF=1e9;

int main(){
  int n,m;
  while(cin>>m>>n,m){
    memset(walls,0,sizeof(walls));
    fill(dist[0],dist[0]+33*33,INF);
    rep(i,n-1)rep(t,2)rep(j,m-1+t)
      cin>>walls[t][i][j];
    rep(j,m-1)
      cin>>walls[0][n-1][j];
    queue<pii> que;
    que.emplace(0,0);
    dist[0][0]=1;
    while(!que.empty()){
      pii cur=que.front(); que.pop();
      //cout<<cur<<endl;
      rep(d,4){
	pii nxt=cur;
	int nd=dist[cur.Y][cur.X]+1;
	nxt.X+=dx[d]; nxt.Y+=dy[d];
	if(nxt.X<0 || m<=nxt.X || nxt.Y<0 || n<=nxt.Y) continue;
	//cout<<nxt<<endl;
	if(walls[wtype[d]][cur.Y+wy[d]][cur.X+wx[d]]) continue;
	//cout<<nxt<<"!"<<endl;
	if(dist[nxt.Y][nxt.X]>nd){
	  dist[nxt.Y][nxt.X]=nd;
	  que.push(nxt);
	}
      }
    }
    cout<<(dist[n-1][m-1]==INF?0:dist[n-1][m-1])<<endl;
  }
  return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl;

typedef long long ll;
const ll INF = 99999999999999;
const ll MOD = 1000000007;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll number1, ll number2)
{
    return number1 * number2 / gcd(number1, number2);
}
template <class T>
bool contain(const std::string &s, const T &v)
{
    // contain(to_string(N), '3')
    return s.find(v) != std::string::npos;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
        return c - '0';
    return 0;
}
using namespace std;

void transpose(vector<vector<char>> &b)
{
    if (b.size() == 0)
        return;

    vector<vector<char>> trans_vec(b[0].size(), vector<char>());

    for (int i = 0; i < b.size(); i++)
    {
        for (int j = 0; j < b[i].size(); j++)
        {
            trans_vec[j].push_back(b[i][j]);
        }
    }

    b = trans_vec; // <--- reassign here
}

// C++ゆるさねえリスト
// accumulate(all(a), 0LL);

int main()
{

    ll n;
    string s;

    cin >> n >> s;
    rep(i, s.size())
    {
        if (s[i] + n > 'Z')
        {
            s[i] = 'A' + (s[i] + n - 'Z') - 1;
        }
        else
        {
            s[i] += n;
        }
    }
    rep(i, s.size())
    {
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
<?php
$b = array_fill(1,100,0);
while(fscanf(STDIN,'%d',$a)) {
    if(is_null($a)) {
        break;
    }
    $b[$a]++;
}
$max = max($b);
foreach($b as $c => $d) {
    if($max === $d) {
        echo $c . PHP_EOL;
    }
}


Measured memory_bytes: 9264
N,Q=map(int,input().split())
S=input()
l_li=[]
r_li=[]

for i in range(Q):
  l,r=map(int,input().split())
  l_li.append(l)
  r_li.append(r)

count=[0]*(N+1)#0桁目も入る
for i in range(N):#DPっぽく解いていく
  if i+1<N and S[i]=="A" and S[i+1]=="C":
    count[i+1]=count[i]+1
  else:
    count[i+1] = count[i]
for i in range(Q):
  print(count[r_li[i]-1]-count[l_li[i]-1])

Measured memory_bytes: 64984
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s, t;
  cin >> s >> t;
  vector<char> d(26);
  vector<char> dd(26);

  for(int i = 0; i < s.size(); i++)
  {
    int a = s[i] - 'a';
    if(d[a] == 0)
    {
      d[a] = t[i];
    }
    else if(d[a] != t[i])
    {
      cout << "No" << endl;
      return 0;
    }
  }
  for(int i = 0; i < t.size(); i++)
  {
    int a = t[i] - 'a';
    if(dd[a] == 0)
    {
      dd[a] = s[i];
    }
    else if(dd[a] != s[i])
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 776
N = int(input())
Li = []
for i in range(N):
  s, p = input().split()
  Li.append([s, int(p), i+1])
Li = sorted(Li, key=lambda x: x[1], reverse = True)
Li = sorted(Li, key=lambda x: x[0])

for i in range(N):
  print (Li[i][2]) 


Measured memory_bytes: 3060
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 a, b;
  std::cin >> a >> b;
  if (a * b <= 0) {
    std::cout << "Zero" << std::endl;
  } else {
    if (std::max<i64>(std::min<i64>(-1, b) - a + 1, 0) % 2 == 1) {
      std::cout << "Negative" << std::endl;
    } else {
      std::cout << "Positive" << std::endl;
    }
  }
  return 0;
}

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

using namespace std;

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

int main() {
  size_t A, B;
  cin >> A >> B;

  if (A < B)  {
    for (size_t i = 0; i < B; i++) {
      cout << A;
    }
    cout << endl;
  } else {
    for (size_t i = 0; i < A; i++) {
      cout << B;
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
n=int(input())
S=[list(input())for i in range(n)]
A_cnt=0
B_cnt=0
AB_cnt=0
for s in S:
        if s[0]=="B" and s[-1]=="A":
                AB_cnt+=1
        elif s[-1]=="A":
                A_cnt+=1
        elif s[0]=="B":
                B_cnt+=1
cnt=0
for i in range(n):
        for j in range(len(S[i])-1):
                if S[i][j]=="A" and S[i][j+1]=="B":
                        cnt+=1
if A_cnt==B_cnt==0 and 0<AB_cnt:
        print(AB_cnt-1+cnt)
else:
        print(cnt+min(A_cnt+AB_cnt,B_cnt+AB_cnt))


Measured memory_bytes: 4596
#include <stdio.h>

int main()
{
	const long long mod = 1000000007;
	int N,K;
	scanf ("%d %d",&N,&K);
	long long pw[101] = {1,};
	for (int i=1;i<=N;i++) pw[i] = pw[i-1] * (K + 1) % mod;

	long long ans = N * K * (K + 1) / 2 * pw[N-1] % mod;
	long long prv[8000] = {1,};
	for (int i=N;i>=1;i--){
		long long nxt[8000] = {0,};
		for (int k=0;k<=K;k++){
			for (int j=0;j<8000;j++) if (prv[j]){
				int v = (j + k) / i;
				if (k > i) v = 0;
				ans = (ans + mod - pw[i-1] * v % mod * prv[j] % mod) % mod;
				nxt[j+v] = (nxt[j+v] + prv[j]) % mod;
			}
		}
		for (int j=0;j<8000;j++) prv[j] = nxt[j];
	}

	printf ("%lld\n",ans);

	return 0;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var p = Console.ReadLine();

            s += s;

            Console.WriteLine($"{(s.Contains(p) ? "Yes" : "No")}");
        }
    }
}



Measured memory_bytes: 17952
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  ll a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  ll m=2*max(x,y);
  ll ans=(ll)INF*INF;
  rep(i,m+1){
    ll t=c*i;
    ll p=max(0LL,x-i/2);
    ll q=max(0LL,y-i/2);
    ans=min(ans,t+p*a+q*b);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[";
    for (int i = 0; i < v.size(); ++i) {
        if(i) os << ",";
        os << v[i];
    }
    return os << "]";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
    return os << "(" << p.first << "," << p.second << ")";
}

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    vector<vector<int>> G(n);
    for (int i = 0; i < n-1; ++i) {
        int a, b;
        scanf("%d %d", &a, &b);
        G[a-1].emplace_back(b-1);
        G[b-1].emplace_back(a-1);
    }
    deque<int> Q;
    vector<int> num(n);
    {
        stack<int> s;
        int cnt = 0;
        vector<int> visited(n, 0);
        s.emplace(0);
        while(!s.empty()){
            int a = s.top(); s.pop();
            visited[a]++;
            num[a] = cnt++;
            Q.emplace_front(a);
            for (auto &&i : G[a]) {
                if(!visited[i]) s.emplace(i);
            }
        }
    }
    auto dp = make_v(2, n, n, INF<ll>);
    vector<int> sz(n, 1);
    while(!Q.empty()){
        int x = Q.front(); Q.pop_front();
        dp[v[x] < 0][x][0] = v[x];
        for (auto &&i : G[x]) {
            if(num[i] < num[x]) continue;
            auto tmp = make_v(2, sz[i]+sz[x], INF<ll>);
            for (int j = 0; j < sz[x]; ++j) {
                for (int k = 0; k < sz[i]; ++k) {
                    for (int a = 0; a < 2; ++a) {
                        if(dp[a][x][j] == INF<ll>) continue;
                        if(dp[0][i][k] != INF<ll>) tmp[a][j+k] = min(tmp[a][j+k], dp[a][x][j]+dp[0][i][k]);
                        if(dp[1][i][k] != INF<ll>) tmp[1][j+k] = min(tmp[1][j+k], dp[a][x][j]+dp[1][i][k]);
                        if(dp[0][i][k] != INF<ll>) tmp[a][j+k+1] = min(tmp[a][j+k+1], dp[a][x][j]);
                        if(dp[1][i][k] < 0) tmp[a][j+k+1] = min(tmp[a][j+k+1], dp[a][x][j]);
                    }
                }
            }
            sz[x] += sz[i];
            for (int j = 0; j < sz[x]; ++j) {
                for (int a = 0; a < 2; ++a) {
                    dp[a][x][j] = tmp[a][j];
                }
            }
        }
    }
    int ans = INF<int>;
    for (int i = 0; i < n; ++i) {
        if(dp[0][0][i] != INF<ll>) ans = min(ans, i);
        if(dp[1][0][i] < 0) ans = min(ans, i);
    }
    cout << ans << "\n";
    return 0;
}


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


int main(){

 int a, b, c, k ;

 cin >> a >> b >> c >> k;

 int xa = min(a,k);
 int ans = xa;
 k -= xa;

 int xb = min(b,k);
 k -= xb;

 int xc = min(c,k);

 ans -=  xc;

 cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3576
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <bitset>
#include <random>
#include <stack>
#include <deque>
typedef long long LL;
using namespace std;
typedef std::pair<int, int> pii;
typedef std::pair<LL, LL> pll;

int main() {
    int N, M;
    scanf("%d %d", &N, &M);
    if (N % 2) {
        for (int i = 0; i < M; i++) {
            printf("%d %d\n", i + 1, N - i);
        }
     } else {
        int hf = (N - 1) / 2;
        for (int i = 0; i < min(hf, M); i++) {
            int a = hf - i, b = hf + i + 1;
            if (i * 2 >= hf) b++;
            printf("%d %d\n", a, b);
        }
    }
    return 0;
}


Measured memory_bytes: 3828
#!/usr/bin/env python3
import sys


def solve(N: int, Q: int, S: str, l: "List[int]", r: "List[int]"):
    mem = [0 for i in range(N)]
    for i in range(1,len(S)):
        if S[i] == "C" and S[i - 1] == "A":
            mem[i] = mem[i-1]+1
        else:
            mem[i] = mem[i-1]
    for i in range(Q):
        start = l[i] - 1
        end = r[i] - 1
        print(mem[end] - mem[start])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    l = [int()] * (Q)  # type: "List[int]" 
    r = [int()] * (Q)  # type: "List[int]" 
    for i in range(Q):
        l[i] = int(next(tokens))
        r[i] = int(next(tokens))
    solve(N, Q, S, l, r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14148
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

int main(void) {
	int A, B;
	cin >> A >> B;

	string S;
	cin >> S;

	for (int i = 0; i < S.size(); i++) {
		if (i != A and ('0' > S[i] or '9' < S[i])) {
			cout << "No" << endl;
			return 0;
		}

		if (i == A and S[i] != '-') {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

x=min(A,B,C,D,E)
if x<N:
    if N%x==0:
        print(N//x+4)
    else:
        print(N//x+5)
else:
    print(5)


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

int main() {
	//入力
	string S;
	cin >> S;

	//処理
	// A <-> T C <-> G

	string before = "ATCG";
	string after = "TAGC";

	char ans = 'A';

	for (int i = 0; i < before.size(); i++)
	{
		if (S[0] == before[i]) ans = after[i];
	}

	//出力
	cout << ans << endl;
}



Measured memory_bytes: 256
import fractions

#inp = [int(i) for i in input().split()]
inp = int(input())

task = []
for e in range(inp):
    task.append([int(i) for i in input().split()])

so = sorted(task,key=lambda x:x[1])
ti = 0

for dd in so:
    ti = dd[0] + ti
    if ti <= dd[1]:
        pass
    else:
        print('No')
        exit()

print('Yes')

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

int main(){
    string s;
	cin >> s;
	int ans = 700;
    if(s[0] == 'o') ans += 100;
    if(s[1] == 'o') ans += 100;
    if(s[2] == 'o') ans += 100;

    cout << ans << endl;
}

Measured memory_bytes: 256
/*
      author : Nishikawa
      created: 06.08.2020 22:16:25
*/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;


int main(){
    int x,y;
    cin >> x >> y;
    if( (y-2*x)>=0 && (4*x-y)>=0 && (y-2*x)%2==0 && (4*x-y)%2==0)
        cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3608
N,K=map(int,input().split())
ruiseki=[0 for i in range(N+2)]
#左からi（0,1,2,...）個めの数までの和
for i in range(1,N+2):
  ruiseki[i]=ruiseki[i-1]+i+1

ans=0  
for i in range(K,N+2):
  ans=(ruiseki[-1]-ruiseki[-1-i]-ruiseki[i]+1+ans)%(10**9+7)
print(ans)

Measured memory_bytes: 19360