akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

long long modp(long long a, long long p) {
    long long res = a % p;
    if (res < 0) res += p;
    return res;
}

long long dif_modp(long long a, long long b, long long p){
    // a-b mod p
    return modp(a % p - b % p, p);
}

long long mul_modp(long long a, long long b, long long p){
    // a*b mod p
    return ((a % p) * (b % p)) % p;
}

long long modinv(long long a, long long p){
    // a^{-1} = 1/a mod p (拡張Euclidの互除法)
    long long b = p, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= p;
    if (u < 0) u += p;
    return u;
}

long long div_modp(long long a, long long b, long long p){
    // a/b mod p
    return mul_modp(a, modinv(b, p), p);
}

int main(void){
    int n; cin >> n;
    int a[n+1]; REP(i,n+1){ cin >> a[i]; a[i]--;}

    int idx[n]; REP(i,n) idx[i] = -1;

    ll l,r;
    REP(i,n+1){
        if(idx[a[i]] == -1) idx[a[i]] = i;
        else{
            l = idx[a[i]];
            r = n-i;
            break;
        }
    }

    ll nCk = n+1, lrCk=1;
    cout << n << endl;
    for(ll i=1; i<n+1; i++){
        nCk = mul_modp(div_modp(n-i+1, i+1, INF), nCk, INF);
        lrCk = mul_modp(div_modp(l+r-i+1, i, INF), lrCk, INF);
        cout << dif_modp(nCk, lrCk, INF) << endl;
    }
    
    return 0;
}

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

int main(){
	string aweu[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
	
	string kata; cin >> kata;
	int i = 0;
	int beda = 1;
	while(beda){
		if(kata == aweu[i])
			beda = 0;
		else
			i = i+1;
	}
	
	if(!beda){
		i = abs(i-7);
		
		if(i == 0)
			cout << 7 << endl;
		else
			cout << i << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
const main = (input) => {
  const s = Number(input.trim())

  for (let x=0; x<=1000; x++) {
    for (let y=-1000; y<=999; y++) {
      if (x**5 - y**5 === s) return console.log(`${x} ${y}`)
    }
  }
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 33056
#include <bits/stdc++.h>
     
    #define REP(i,n) for(int i=0;i<(int)(n);++i)
    #define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
     
    using namespace std;
    typedef long long ll;
     
    int main(){
        int N;
        cin >> N;
        int h[N];

        int ma = -1;
        REP(i,N) {
            cin >> h[i];
            if (ma < h[i]) ma = h[i];
        }
        int ret = 0;
        for(int i = ma;i > 0;i--){
            bool isCont = false;
            REP(j,N){
                if(h[j] == i){
                    if(!isCont) ret++;
                    h[j]--;
                    isCont = true;
                }else{
                    if(isCont) isCont = false;
                }
            }
        }

        cout << ret << endl;
    	return 0;
    }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		String[] substr = str.split(" ", 0);

		int n1 = Integer.parseInt(substr[0]);
		int n2 = Integer.parseInt(substr[1]);
		int n3 = Integer.parseInt(substr[2]);

		str = scan.nextLine();
		substr = str.split(" ", 0);

		int n4 = Integer.parseInt(substr[0]);
		int n5 = Integer.parseInt(substr[1]);
		int n6 = Integer.parseInt(substr[2]);

		str = scan.nextLine();
		substr = str.split(" ", 0);

		int n7 = Integer.parseInt(substr[0]);
		int n8 = Integer.parseInt(substr[1]);
		int n9 = Integer.parseInt(substr[2]);

		int n = scan.nextInt();

		int [] index = new int[10];
		for (int j=0; j<n; j++) {
			int i = scan.nextInt();
			if (i == n1) index[1]=1;
			if (i == n2) index[2]=1;
			if (i == n3) index[3]=1;
			if (i == n4) index[4]=1;
			if (i == n5) index[5]=1;
			if (i == n6) index[6]=1;
			if (i == n7) index[7]=1;
			if (i == n8) index[8]=1;
			if (i == n9) index[9]=1;
 		}
		scan.close();
		String ans="No";
		if (index[1]==1 && index[2]==1 && index[3]==1) ans="Yes";
		if (index[4]==1 && index[5]==1 && index[6]==1) ans="Yes";
		if (index[7]==1 && index[8]==1 && index[9]==1) ans="Yes";
		if (index[1]==1 && index[4]==1 && index[7]==1) ans="Yes";
		if (index[2]==1 && index[5]==1 && index[8]==1) ans="Yes";
		if (index[3]==1 && index[6]==1 && index[9]==1) ans="Yes";
		if (index[1]==1 && index[5]==1 && index[9]==1) ans="Yes";
		if (index[7]==1 && index[5]==1 && index[3]==1) ans="Yes";

		System.out.println(ans);
	}
}


Measured memory_bytes: 23124
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner number = new Scanner(System.in);
		for(int i = 1;i <= 10000;i++) {
			int a = number.nextInt();
			if(a == 0) break;
			System.out.println("Case " + i + ": " + a);
		}
		
		
		
	}
}



Measured memory_bytes: 45148
n, a, b, c = map(int, input().split())
variables = [a, b, c]
alph = ["A", "B", "C"]
s = [[] for _ in range(n)]
for i in range(n):
	u, v = map(lambda x: alph.index(x) , list(input()))
	s[i] = [u, v]
# print(s)

can_do = True
ans = []
for i in range(n):
	u, v = s[i][0], s[i][1]
	if variables[u] + variables[v] == 0:
		can_do = False
	elif variables[v] == 0:
			variables[u] -= 1
			variables[v] += 1
			ans.append(alph[v])
	elif variables[u] == 0:
			variables[v] -= 1
			variables[u] += 1
			ans.append(alph[u])
	else:
		# both are > 0
		if i == n-1:
			# do whatever you want
			variables[u] -= 1
			variables[v] += 1
			ans.append(alph[v])
		else:
			# need to think about next step
			if variables[u] > 0 and variables[v] > 0:
				next_u, next_v = s[i+1][0], s[i+1][1]
				if variables[next_u] + variables[next_v] >= 2:
					# can subsctact and whatever
					if variables[u] < variables[v]:
						u, v = v, u
					variables[u] -= 1
					variables[v] += 1
					ans.append(alph[v])
				else:
					# need to sponsor
					common = list( {u, v}.intersection({next_u, next_v}) )[0]
					# print("common", common)
					not_common = u + v - common
					variables[common] += 1
					variables[not_common] -= 1
					ans.append(alph[common])

if can_do:
	print("Yes")
	for item in ans:
		print(item)
else:
	print("No")





Measured memory_bytes: 88488
# http://www.geocities.jp/m_hiroi/light/pyalgo65.html

def memoize(f):
    table = {}
    def func(*args):
        if not args in table:
            table[args] = f(*args)
        return table[args]
    return func

@memoize
def tsp(p, v):
    if (1 << point_size) - 1 == v:
        return distance_table[p][0]
    else:
        return min(distance_table[p][x] + tsp(x, v | (1 << x)) for x in range(point_size) if not (v & (1 << x)))

from sys import stdin
from collections import defaultdict
from math import isinf

readline = stdin.readline

point_size, e = map(int, readline().split())
distance_table = [[float('inf')] * point_size for _ in range(point_size)]
for _ in range(e):
    s, t, d = map(int, readline().split())
    distance_table[s][t] = d
ans = tsp(0,1)
print(-1 if isinf(ans) else ans)

Measured memory_bytes: 28696
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>

#define BIT(a) (1 << (a))

using namespace std;

long long MOD = 1000000007;


long long mod_pow(long long x, long long n){
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

double dp[505][505];
double a[505];

int main(void){
	// input
	int N, M;
	cin >> N >> M;
	for (int i = 1; i <= N; i++){
		cin >> a[i];
	}
	for (int i = 2; i <= N; i++){
		a[i] += a[i-1];
	}

	// dp init
	for (int i = 0; i < 505; i++){
		for (int j = 0; j < 505; j++){
			dp[i][j] = -1;
		}
	}
	for (int i = 1; i <= N; i++){
		dp[i][1] = a[i]/i;
	}

	for (int i = 2; i <= N; i++){
		for (int len = 1; len < i; len++){
			for (int j = 2; j <= i; j++){
				if (dp[i][j] < dp[i-len][j-1] + (a[i] - a[i-len])/(len)){
					dp[i][j] = dp[i-len][j-1] + (a[i] - a[i-len])/(len);
				}
			}
		}
	}
	printf("%f\n", dp[N][M]);
	return 0;
}




Measured memory_bytes: 5284
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)     for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = m; i < (int)(n); i++)
#define MOD 1000000007
#define Graph vector<vector<int>>
#define lint int64_t

int main(){
    lint N;
    cin >> N;
    
    vector<lint> Ai(N);

    bool minus_odd = false;
    lint sum = 0;
    lint min_x = pow(10,9);
    rep(i,N){
        lint ai;
        cin >> ai;
        Ai.at(i) = ai;
        sum += abs(ai);
        if(ai < 0) minus_odd = !minus_odd;

        min_x = min(min_x,abs(ai));
    }


    
    lint ans = 0;
    if(minus_odd){
        ans = sum - (min_x * 2);
    }else{
        ans = sum;
    }

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


Measured memory_bytes: 1024
#組み合わせ個数
def choose(n, r, mod)
  return 0 if not (0 <= r and r <= n)
  return 1 if r == 0 or r == n
  fact2(n, r, mod) * inverse(fact(r, mod) % mod, mod) % mod
end
#階乗(MODあり)
@fact = [1]
def fact(n, mod)
  if n > @fact.size then
    f = @fact[-1]
    (@fact.size+1..n).each{|i|
      f = (f * i) % mod
      @fact << f
    }
  end
  @fact[n-1]
end
def fact2(n, r, mod)
  f = 1
  n.downto(n-r+1){|i|
    f = (f * i) % mod
  }
  f
end

#逆元(MODあり)
def inverse(x, mod)
  pow(x, mod-2, mod)
end
#べき乗(MODあり)(繰り返し２乗法)
def pow(x, n, mod)
  ans = 1
  while n > 0
    ans = ans * x % mod if n.odd?
    x = x * x % mod
    n >>= 1
  end
  ans
end

N, A, B = gets.chomp.split(" ").map(&:to_i)
MOD = 10 ** 9 + 7

ans = pow(2, N, MOD) - choose(N, A, MOD) - choose(N, B, MOD) - 1
ans += MOD if ans < 0
ans += MOD if ans < 0

puts ans


Measured memory_bytes: 3452
# 2019-11-13 01:53:22(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    s = sys.stdin.readline().rstrip()
    first, second = int(s[:2]), int(s[2:])
    if 1 <= first <= 12:
        if 1 <= second <= 12:
            ans = 'AMBIGUOUS'
        else:
            ans = 'MMYY'
    else:
        if 1 <= second <= 12:
            ans = 'YYMM'
        else:
            ans = 'NA'
    print(ans)



if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#include <chrono>
//#pragma GCC optimize("Ofast")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
typedef pair<ll, ll> P;
const ll INF = (1LL<<60);

template <unsigned long long mod > class modint{
public:
    ll x;
    constexpr modint(){x = 0;}
    constexpr modint(ll _x) : x((_x < 0 ? ((_x += (LLONG_MAX / mod) * mod) < 0 ? _x + (LLONG_MAX / mod) * mod : _x) : _x)%mod){}
    constexpr modint operator-(){
        return x == 0 ? 0 : mod - x;
    }
    constexpr modint& operator+=(const modint& a){
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr modint operator+(const modint& a) const{
        return modint(*this) += a;
    }
    constexpr modint& operator-=(const modint& a){
        if((x -= a.x) < 0) x += mod;
        return *this;
    }
    constexpr modint operator-(const modint& a) const{
        return modint(*this) -= a;
    }
    constexpr modint& operator*=(const modint& a){
        (x *= a.x)%=mod;
        return *this;
    }
    constexpr modint operator*(const modint& a) const{
        return modint(*this) *= a;
    }
    constexpr modint pow(unsigned long long pw) const{
        modint res(1), comp(*this);
        while(pw){
            if(pw&1) res *= comp;
            comp *= comp;
            pw >>= 1;
        }
        return res;
    }
    //以下、modが素数のときのみ
    constexpr modint inv() const{
        return modint(*this).pow(mod - 2);
    }
    constexpr modint& operator/=(const modint &a){
        (x *= a.inv().x)%=mod;
        return *this;
    }
    constexpr modint operator/(const modint &a) const{
        return modint(*this) /= a;
    }
};
#define mod2 1000000007
using mint = modint<mod2>;

ostream& operator<<(ostream& os, const mint& a){
    os << a.x;
    return os;
}
using vm = vector<mint>;
int main() {
    cin>>N;
    mint res(10);
    res = res.pow(N);
    res -= mint(9).pow(N) * 2;
    res += mint(8).pow(N);
    cout<<res<<endl;
}

Measured memory_bytes: 3632
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    void solve(Scanner in, PrintWriter out) {
        String s = in.next();
        out.println((s.endsWith("s") ? s + "es" : s + "s"));
    }

    public static void main(String[] args) {
        try(Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
        }
    }
}


Measured memory_bytes: 38484
#include <cstdio>
#include <cassert>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>

#include <unordered_set>

using namespace std;

typedef long long ll;

#define SIZE 200010


int main(){
  int n, a[SIZE];

  scanf("%d", &n);

  for(int i=0;i<n;i++){
    scanf("%d", a+i);
  }

  int ans = 0;
  
  for(int i=2;i<n-1;i++){
    if(a[i-2] < a[i-1] && a[i-1] < a[i]){
      if(a[i+1] > a[i-1]){
        swap(a[i-1], a[i]);
        ans++;
      }else{
        swap(a[i], a[i+1]);
        ans++;
      }
    }else if(a[i-2] > a[i-1] && a[i-1] > a[i]){
      if(a[i+1] < a[i-1]){
        swap(a[i-1], a[i]);
        ans++;
      }else{
        swap(a[i], a[i+1]);
        ans++;
      }
    }
  }

  if(n >= 3){
    if(a[n-3] < a[n-2] && a[n-2] < a[n-1]) ans++;
    if(a[n-3] > a[n-2] && a[n-2] > a[n-1]) ans++;
  }

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

}




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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; string S; cin >> N >> S;
    vector<int> cntb(N+1,0),cntw(N+1,0);
    for (int i=0;i<N;++i) cntb[i+1]=cntb[i]+(S[i]=='#');
    for (int i=N-1;i>=0;--i) cntw[i]=cntw[i+1]+(S[i]=='.');
    int ans=N;
    for (int i=0;i<=N;++i) ans=min(ans,cntb[i]+cntw[i]);
    cout << ans << '\n';
}

Measured memory_bytes: 2196
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> > 
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	int n, i, j;
	cin >> n;
	int arr[n];
	fo(i, 0, n)
	cin >> arr[i];
	int ans = inf;
	int st = *min_element(arr, arr + n);
	int en = *max_element(arr, arr + n);
	foe(i, st, en){
		int x = i, sum = 0;
		fo(j, 0, n)
		sum += (x - arr[j]) * (x - arr[j]);
		ans = min(ans, sum);
	}
	cout << ans;
}

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

int w[2], h[2], l[2][500][500], sx[2], sy[2], r;
int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };
int ans[2][100001], d[250000];
bool vis[500][500], used[500][500];
list<P>que[250000];
int compress(int k) {
	vector<int>x;
	rep(i, h[k])rep(j, w[k])x.push_back(l[k][i][j]);
	sort(x.begin(), x.end());
	x.erase(unique(x.begin(), x.end()), x.end());
	rep(i, x.size())d[i] = x[i];
	rep(i, h[k])rep(j, w[k])
		l[k][i][j] = lower_bound(x.begin(), x.end(), l[k][i][j]) - x.begin();
	return x.size();
}
void solve(int k) {
	ans[k][0] = 0;
	queue<P>Q;
	int n = compress(k);
	rep(i, n)que[i].clear();
	memset(vis, 0, sizeof(vis));
	memset(used, 0, sizeof(used));
	Q.push(P(sx[k], sy[k]));
	vis[sx[k]][sy[k]] = true;
	int cnt = 0, Max = 0;
	while (1) {
		while (!Q.empty()) {
			P p = Q.front(); Q.pop();
			if (used[p.first][p.second])continue;
			used[p.first][p.second] = true;
			cnt++; if (cnt >= r)break;
			rep(i, 4) {
				int nx = p.first + dx[i], ny = p.second + dy[i];
				if (0 <= nx&&nx < h[k] && 0 <= ny&&ny < w[k] && !vis[nx][ny]) {
					vis[nx][ny] = true;
					if (l[k][nx][ny] <= Max)Q.push(P(nx, ny));
					else que[l[k][nx][ny]].push_back(P(nx, ny));
				}
			}
		}
		ans[k][cnt] = min(ans[k][cnt], d[Max]);
		for (int i = Max; i < n; i++) {
			if (!que[i].empty()) {
				Max = i;
				for (P p : que[i])Q.push(p);
				que[i].clear();
				break;
			}
		}
		if (cnt >= r || Q.empty())break;
	}
	for (int i = r - 1; i >= 1; i--)ans[k][i] = min(ans[k][i], ans[k][i + 1]);
}
int main() {
	while (scanf("%d", &r), r) {
		rep(k, 2) {
			scanf("%d%d%d%d", &w[k], &h[k], &sy[k], &sx[k]); sx[k]--; sy[k]--;
			rep(i, h[k])rep(j, w[k])scanf("%d", &l[k][i][j]);
		}
		fill(ans[0], ans[2], INT_MAX);
		rep(k, 2)solve(k);
		int Min = INT_MAX;
		for (int i = 0; i <= r; i++) {
			if (ans[0][i] == INT_MAX || ans[1][r - i] == INT_MAX)continue;
			Min = min(Min, ans[0][i] + ans[1][r - i]);
		}
		printf("%d\n", Min);
	}
}

Measured memory_bytes: 13156
Public Class Main
    Public Shared Sub Main(ByVal args() As String)
        Dim H, N As Integer
        Dim arr(2) As String
        arr = Split(Console.ReadLine())
        H = arr(0) : N = arr(1)
        Dim A() As Integer = Array.ConvertAll(Of String, Integer) _
            (Split(Console.ReadLine()), AddressOf Integer.Parse)
        Dim accum As Integer = 0
        For Each Ai As Integer In A
            accum += Ai
        Next
        Console.WriteLine(If(accum < H, "No", "Yes"))
    End Sub
End Class


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

#define sswap(x, y) { x+=y; y=x-y; x-=y; }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

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

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	int s;
	cin >> s;
	int d = s / 100;
	int m = s % 100;
	if (((d == 0) || (d > 12)) && ((m == 0) || (m > 12)))
		cout << "NA" << ende;
	else if ((d > 0) && (m > 0) && (d < 13) && (m < 13))
		cout << "AMBIGUOUS" << ende;
	else if ((d > 0) && (d < 13))
		cout << "MMYY" << ende;
	else
		cout << "YYMM" << ende;
  return 0;
}


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

int main(){
  int N;
  string S;
  cin >> N >> S;
  for(int i=0; i<S.size(); ++i){
    S.at(i) += N;
    if(S.at(i) > 'Z') S.at(i) -= 26;
  }
  cout << S << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n, h;
  cin >> n >> h;
  int ma = 0;
  vector<int> bs(n);
  rep(i,0,n) {
    int a, b;
    cin >> a >> b;
    ma = max(ma, a);
    bs[i] = b;
  }
  sort(rall(bs));
  int ans = 0;
  rep(i,0,n) {
    if (bs[i] < ma) break;
    ans++;
    h -= bs[i];
    if (h <= 0) {
      cout << ans << endl;
      return 0;
    }
  }
  ans += dup(h, ma);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3696
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <cstdio>
#include <float.h>
#include <ctype.h>
 using namespace std;
 int main(void) {
        int a, b, c, d, e, f, g, h, i, j, k, l, m, o, p, q, r, s, t, u, v, w, x, y, z;
        scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
        f = a * e;
        if (e<=c) {
            g = b;
        }
        else {
            h = e - c;
            g = h*d+b;
        }
        if (f < g) {
            printf("%d\n", f);
        }
        else if(g<f){
            printf("%d\n", g);
        }
        return 0;
 }




Measured memory_bytes: 3208
#include<cstdio>
#include<cstring>
#include<string>
#include<map>
using namespace std;
map <string ,int> ml;
int n,m;
char t[105][106],s[105][105];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{scanf("%s",s[i]);ml[s[i]]++;}
	scanf("%d",&m);
	for(int i=1;i<=m;i++)
	{scanf("%s",&t[i]);ml[t[i]]--;}
	int max_n=0;
	for(int i=1;i<=m;i++)
	{
		if(ml[t[i]]>max_n) max_n=ml[t[i]];
	}
	for(int i=1;i<=n;i++)
	{
		if(ml[s[i]]>max_n) max_n=ml[s[i]];
	}
	printf("%d",max_n);
}

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

using namespace std;

int ACGT_length(string str) {
    for (int i = 0; i < str.length(); i++) {
        if (str[i] != 'A' && str[i] != 'C' && str[i] != 'G' && str[i] != 'T') {
            return -1;
        }
    }
    return str.length(); 
}

int main(void) {
    string str;
    cin >> str;

    int max_length = 0;
    for (int i = 0; i < str.length(); i++) {
        for (int j = 0; i + j <= str.length(); j++) {
            string substr = str.substr(i, j);
            max_length = max(max_length, ACGT_length(substr));
        }
    }

    cout << max_length << endl;

    return 0;
}


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

using namespace std;

int main()

{

    int i,j,k,l,x=0,m;

   char s[1000001];

    int c[26]={0};

    cin>>s;

    l=strlen(s);

    for(i=0;i<l;i++)
    {

            j=s[i]-'a';
            c[j]++;

    }

    for(i=0;i<26;i++)
    {
        if(c[i]==0)
        {
            m=i;
            x=1;//<<endl;
            break;
        }



    }
    if(x)
        printf("%c\n",i+'a');
    else
         cout<<"None\n";
    return 0;
}


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

using namespace std;

int main()
{
    long long i,j;
    while (scanf("%lld%lld",&i,&j)!=EOF)
    {
        if (i==1&&j==1)
            printf("1\n");
        else if (i==1||j==1)
            if (i+j-1>2)
                printf("%lld\n",i+j-3);
            else
                printf("0\n");
        else if (i==2||j==2)
            printf("0\n");
        else
            printf("%lld\n",(i-2)*(j-2));
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  vector<bool> primes(100007,true);
  primes[0]=false;
  primes[1]=false;
  for(ll i=2;i*i<100007;i++){
      if(!primes[i])continue;
      for(ll j=2;i*j<100007;j++){
          primes[i*j]=false;
      }
  }
  ll q;
  cin>>q;
  vl a(100007,0);
  for(ll i=3;i<100007;i++){
      if(i%2==1&&primes[i]&&primes[(i+1)/2]){
          a[i]=a[i-1]+1;
      }
      else{
          a[i]=a[i-1];
      }
  }
  rep(i,q){
      ll l,r;
      cin>>l>>r;
      ll ans=a[r]-a[l-1];
      print(ans);
  }
}


Measured memory_bytes: 4052
x=int(input())
lists=[0 for i in range(100010)]
lists[100]=1
lists[101]=1
lists[102]=1
lists[103]=1
lists[104]=1
lists[105]=1
for i in range(106,100001):
    if lists[i-105]==1 or lists[i-104]==1 or lists[i-103]==1 or lists[i-102]==1 or lists[i-101]==1 or lists[i-100]==1:
        lists[i]=1
    else:
        pass
print(lists[x])

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

int n[33]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main(){
	int k;
	cin>>k;
	cout<<n[k-1]<<endl;
	return 0;
}

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

namespace AtTest.Virtual
{
    class ARC093_D
    {
        static void Main(string[] args)
        {
            Method(args);
            ReadLine();
        }

        static void Method(string[] args)
        {
            int[] ab = ReadInts();
            int a = ab[0];
            int b = ab[1];
            bool[,] grid = new bool[100, 100];//white true
            for(int i = 0; i < 100; i++)
            {
                for(int j = 0; j < 100; j++)
                {
                    if (i < 50) grid[i, j] = false;
                    else grid[i, j] = true;
                }
            }
            for(int i = 1; i < 50; i+=2)
            {
                for(int j = 1; j < 100; j+=2)
                {
                    if (a == 1) break;
                    grid[i, j] = true;
                    a--;
                }
            }
            for (int i = 51; i < 100; i+=2)
            {
                for (int j = 1; j < 100; j+=2)
                {
                    if (b == 1) break;

                    grid[i, j] = false;
                    b--;
                }
            }

            WriteLine("100 100");
            for (int i = 0; i < 100; i++)
            {
                for(int j = 0; j < 100; j++)
                {
                    Write(grid[i, j] ? '.' : '#');
                }
                WriteLine();
            }
        }

        private static string Read() { return ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11200
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <numeric>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N, cnt = 0, ans = 0, tmp = 0;

int main(){
    string s;
    cin >> s;
    cout << "ABC" + s << endl;
    return 0;
    
}

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



int main() {
  int64_t R,G,B,N;
  cin>>R>>G>>B>>N;
  
  int64_t K=0;
  for(int r=0;r*R<=N;r++){
    for(int g=0;g*G<=N-r*R;g++){
      if(N-r*R-g*G==0){
        K++;
      }
      else{
        if((N-r*R-g*G)%B==0){
          K++;
        }
      }
    }
  }
  cout<<K<<endl;
    
}

Measured memory_bytes: 3496
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
int main(){
	int N; cin >> N;
	cout << N*(N+1)/2 << endl; 
}


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

int main() {
	int N,Q;
	string S;
	cin >> N>>Q >>S;
	vector<int>Memo;
	for (int n = 0;n<N-1;++n) {
		if ('A' == S[n]&&'C' ==S[n + 1]) {
			Memo.push_back(n + 1);
		}
	}
	for (int n = 0;n<Q;++n) {
		int l, r;
		cin >> l >> r; 
		cout << lower_bound(Memo.begin(), Memo.end(), r) - lower_bound(Memo.begin(), Memo.end(), l) << endl;
	}
}


Measured memory_bytes: 3896
n,k=map(int,input().split())
x=(n-1)*(n-2)//2
if x<k:
    print(-1)
else:
    print(-k+x+n-1)
    for i in range(n-1):
        print(1,i+2)
    co=-k+x
    for i in range(3,n+1):
        for j in range(2,i):
            if co==0:
                break
            print(i,j)
            co-=1
        if co==0:
            break
    

Measured memory_bytes: 3628
"use strict";

main(require("fs").readFileSync("/dev/stdin", "utf8"));

function main(input) {
  const s = new Set(input.split(""));

  const alphabet = {};
  "abcdefghijklmnopqrstuvwxyz".split("").forEach(c => alphabet[c] = true);

  s.forEach(c => alphabet[c] = false);

  const char = Object.keys(alphabet).find(c => alphabet[c]);

  const ans = char === undefined ? 'None' : char;
  console.log(ans);
}

Measured memory_bytes: 15152
#ifdef __unix__
#include <bits/stdc++.h>
#else
#include <iostream>
#include <algorithm>
#include <math.h>
#include <functional>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <unordered_set>
#include <stack>
#endif


#define fastIO ios_base::sync_with_stdio(0), cin.tie(NULL)
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl '\n'
#define mkp make_pair
/*#define NUMTOSTR(x)  (unsigned char)((x) + 48);*/
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long  ull;
using namespace std;
int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if (a + b + c < 22) cout << "win";
	else cout << "bust";
	
	return 0;
}


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

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define RepG(i,u) for(int i=head[u];~i;i=e[i].next)

typedef long long ll;

const int N=1e5+5;

template<typename T> void read(T &x){
   x=0;int f=1;
   char c=getchar();
   for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
   for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
    x*=f;
}

# define int long long

int x;
int wuc[N];

signed main()
{
    read(x);
    Rep(i,1,3000)wuc[i]=i*i*i*i*i;
    Rep(i,0,3000)
        Rep(j,0,3000)
            if(wuc[i]+wuc[j]==x)return printf("%lld %lld\n",i,-j),0;
    Rep(i,0,3000)
        Rep(j,0,3000)
            if(wuc[i]-wuc[j]==x)return printf("%lld %lld\n",i,j),0;
    return 0;
}

Measured memory_bytes: 3744
n, q = [int(s) for s in input().split()]
bit = [0] * (n+1)

def add(a, w):
    x = a
    while x <= n:
        bit[x] += w
        x += (x & -x)


def sum(a):
    ret = 0
    x = a
    while x > 0:
        ret += bit[x]
        x -= (x & -x)
    return ret


for _ in range(q):
    com, x_i, y_i = [int(s) for s in input().split()]
    if com == 0:
        add(x_i,y_i)
        
    else:
        ans = sum(y_i) - sum(x_i-1)
        print(ans)



Measured memory_bytes: 7932
#include <iostream>

using namespace std;

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if (a + b > c + d) {
    cout << "Left" << endl;
  }
  else if (a + b < c + d) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
n = $stdin.gets.chomp.to_i
arr = $stdin.gets.chomp.split(" ")
arr.map! do |a_j|
    a_j.to_i
end

ans = 0

for i in 0..n-2
    for j in i + 1..n-1
        ans += arr[i]*arr[j]
    end
end 

puts ans

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int n, m;

int main(){
    scanf("%d %d", &n, &m);
    if(n < m) printf("a < b\n");
    else if(n > m) printf("a > b\n");
    else printf("a == b\n");
    return 0;
}


Measured memory_bytes: 3148
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N = II()
    p_li = LI()

    ans = 0
    skip_next = False
    for i, p in enumerate(p_li):
        if skip_next:
            skip_next = False
            continue
        if p == (i+1):
            ans += 1
            skip_next = True
    print(ans)

main()

Measured memory_bytes: 13876
mod=10**9+7
def inv(x):
    if x==0:
        raise ValueError("Div 0")
    (nowx,lastx) = (0,1)
    (nowy,lasty) = (1,0)
    a=x;b=mod
    while b!=0:
        q=a//b
        (a,b)=(b,a%b)
        (nowx,lastx)=(lastx-q*nowx,nowx)
        (nowy,lasty)=(lasty-q*nowy,nowy)
    return (a*lastx)%mod
N,M,K=map(int,input().split())
X=sum([d*(N-d)*M*M for d in range(N)])
Y=sum([d*(M-d)*N*N for d in range(M)])
ans=X+Y
for i in range(1,K-1):
    ans*=(N*M-1-i)
    ans%=mod
    ans*=inv(i)
    ans%=mod
print(ans)


Measured memory_bytes: 12440
#include<iostream>
#include<string.h>
#include<math.h>
#include<algorithm>

using namespace std;

int main() {
	string s, ss;
	cin >> s >> ss;
	int cnt = 0;
	if (s[0] == ss[0]) {
		cnt++;
	}
	if (s[1] == ss[1]) {
		cnt++;
	}
	if (s[2] == ss[2]) {
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int w, h, n;
	cin >> w >> h >> n;
	vector<pair<int, int> > bug;
	for(int i = 0; i < n; i++){
		int x, y;
		cin >> x >> y;
		if(x != 0 && y != 0) bug.push_back(pair<int, int>(x, y));
	}
	sort(bug.begin(), bug.end());
	int siz = bug.size();
	if(siz == 0) cout << 0 << endl;
	else {
		int mx = bug[siz - 1].second, mn = bug[siz - 1].first;
		for(int i = siz - 1; i >= 0; i--){
			pair<int, int> p = bug[i];
			mn = min(mn, p.first + mx);
			mx = max(mx, p.second);
		}
		mn = min(mn, mx);
		cout << mn << endl;
	}
	return 0;
}


Measured memory_bytes: 3816
#include<bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LL long long
#define LD long double
#define REP(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define RREP(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define int LL
#define PR(arr,a,b) REP(unique,a,b) cout<<arr[unique]<<" \n"[unique==b] 
#define V(x) int x;cin>>x
#define V2(a,b) int a,b;cin>>a>>b
#define V3(a,b,c) int a,b,c;cin>>a>>b>>c
#define SC(arr,a,b) REP(unique,a,b) cin>>arr[unique]
using namespace std;

typedef pair<int,int> PII;
typedef pair<int,PII> PIII;
typedef vector<int> VI;

const int MX = 1e6+1;
const int MOD = 1e9+7;

void pre();


signed main()
{
   // pre();
   ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
    V3(a,b,q);
    int s[a],t[b],x[q];
    SC(s,0,a-1);
    SC(t,0,b-1);
    SC(x,0,q-1);

    REP(i,0,q-1)
    {
        int rs = 1e15;
        if(s[a-1]>= x[i])
            rs = *lower_bound(s,s+a,x[i]) - x[i];
        int rt = 1e15;
        if(t[b-1]>=x[i])
            rt = *lower_bound(t,t+b,x[i]) - x[i];
        int ls = 1e15;
        if(s[0]<=x[i])
            ls = x[i] - s[upper_bound(s,s+a,x[i])-s-1];
        int lt = 1e15;
        if(t[0]<=x[i])
            lt = x[i] - t[upper_bound(t,t+b,x[i])-t-1];

       
        int possible[4] = {
            max(rs,rt), max(ls,lt), (2*(ls+rt)-max(ls,rt)), (2*(rs+lt)-max(rs,lt))
        };
        cout<<*min_element(possible,possible+4)<<"\n";
    }
    return 0;
}


void pre()
{
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    

}

Measured memory_bytes: 3712
n, m = map(int, input().split())  # n: num problem, m: num submit
lst = [input().split() for i in range(m)]

ac = [False] * n
wa = [0] * n

for i in range(m):
    p_i = int(lst[i][0])
    s_i = lst[i][1]
    if s_i == 'AC':
        ac[p_i-1] = True
    else:
        if ac[p_i-1] is False:
            wa[p_i-1] += 1

num_ac = 0
pnlt = 0
for i in range(n):
    if ac[i]:
        num_ac += 1
        pnlt += wa[i]
print(num_ac, pnlt)


Measured memory_bytes: 33696
import java.util.Scanner;

/*
問題文
いろはちゃんは、人気の日本製ゲーム「ÅtCoder」で遊びたい猫のすぬけ君のために日本語を教えることにしました。

日本語で鉛筆を数えるときには、助数詞として数の後ろに「本」がつきます。この助数詞はどんな数につくかで異なる読み方をします。
具体的には、999 以下の正の整数 N について、「N 本」と言うときの「本」の読みは
・N の 1 の位が2,4,5,7,9 のとき hon
・N の 1 の位が 0,1,6,8 のとき pon
・N の 1 の位が 3 のとき bon
です。

N が与えられるので、「N 本」と言うときの「本」の読みを出力してください。

制約
N は 999 以下の正の整数

*/

public class Main {
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        String n = sc.next();

        String temp = n.substring(n.length() - 1);

        String match = "[0168]{1}";
        if (temp.equals("3")) {
            System.out.println("bon");
        } else if (temp.matches(match)) {
            System.out.println("pon");
        } else {
            System.out.println("hon");
        }
    }
}

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

typedef long long ll;
typedef pair<int,int> ii;
#define fore(i,a,b) for(int i=a,ggdem=b;i<ggdem;i++)
#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define fst first
#define snd second
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)(a).size())

int main() {FIN;
    int n,a;
    cin>>n;
    map<int,int>m;
    vector<int>val;
    fore(i,0,n)cin>>a,m[a]++,val.pb(a);
    sort(val.begin(),val.end(),greater<int>());
    int res=0;
    for(int i:val) {
        int x=31-__builtin_clz(i);
        int need=1<<(x+1);
        //cout<<i<<" : "<<need<<" "<<need-i<<endl;
        if(i==need-i) {
            if(m[i]>1)m[i]-=2,res++;
        } else {
            if(m[i] && m[need-i]) {
                m[i]--;
                m[need-i]--;
                res++;
            }
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 19828
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
/*
ll vis[100005]={0};
ll par[100005]={0};
//map<ll,ll> mp;
ll ma=0;
void dfs(vector<ll> v1[],int x)
{
    
    vis[x]=1;
        for(auto i : v1[x])
        {
            if(vis[i]==0)
                dfs(v1,i);
        }
        
    return ;
}*/
int main()
{
    ll a,b,c,d,e,x,t,n,m,count;
    //ll ma=-1;
    t=1;
    //cin>>t;
    string s1;
    //vector<ll> ev,od;
    //map<char,ll> mp;
    set <char> se;
    while(t--)
    {
        
        cin>>s1;
        for(int i=0;i<s1.size();i++)
        {
            se.insert(s1[i]);
        }
        if(se.size()==2) cout<<"Yes";
        else cout<<"No";
        
        
    }
    return 0;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  string s; cin >> s;
  map<char, bool> sel;
  for(int i=0;i<(int)(s.size());++i) {
    sel[s[i]] = true;
  }
  if(sel['W'] != sel['E'] || sel['N'] != sel['S']) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6+100;
const int mod = 1e9+7;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f3f;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
inline bool read(ll &num) {
    char in;bool IsN=false;
    in=getchar();
    if(in==EOF) return false;
    while(in!='-'&&(in<'0'||in>'9')) in=getchar();
    if(in=='-'){ IsN=true;num=0;}
    else num=in-'0';
    while(in=getchar(),in>='0'&&in<='9'){
            num*=10,num+=in-'0';
    } 
    if(IsN) num=-num;
    return true;
}
int num[N];
int main(){
    int n,k,q,x;
    cin>>n>>k>>q;
    rep(i,1,q){
        cin>>x;
        num[x]++;
    }
    rep(i,1,n){
        num[i]=q-num[i];
    }
    rep(i,1,n){
        if(k-num[i]>0){
            puts("Yes");
        }else{
            puts("No");
        }
    }
    return 0;
}

Measured memory_bytes: 1024
using System.Linq;
using System.Collections.Generic;
using System;

namespace Wandbox
{
    class Program
    {
        static void Main(string[] args)
        {
            var c = int.Parse(Console.ReadLine());
            if (c == 0)
                return;
            var l = Console.ReadLine().Split(' ').Select(x => double.Parse(x));
            var avg = l.Average();
            Console.WriteLine(Math.Sqrt(l.Select(x => (x - avg) * (x - avg)).Average()));
            Main(args);
        }
    }
}



Measured memory_bytes: 9656
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	double a, v, b, w, t;
	scanf("%lf %lf %lf %lf %lf", &a, &v, &b, &w, &t);
	if(v-w<=0) puts("NO");
	else if(labs(a-b) / (v-w) <= t) puts("YES");
	else puts("NO");
	return 0;
}



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

using namespace std;

typedef long long ll;

const int N = 1e5 + 7;
vector <int> g[N];
bool u[N];
bool cn[N];

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#else
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#endif
    int n, m, a, b;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < m; i++)
    {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back(v);
        g[v].push_back(u);
        a = u, b = v;
    }
    u[a] = u[b] = cn[a] = cn[b] = 1;
    deque <int> ans;
    ans.push_back(a);
    ans.push_back(b);
    while (cn[a] || cn[b])
    {
        if (cn[a])
        {
            cn[a] = 0;
            for (auto to : g[a])
            {
                if (!u[to])
                {
                    u[to] = cn[to] = 1;
                    a = to;
                    ans.push_front(a);
                    break;
                }
            }
        }
        if (cn[b])
        {
            cn[b] = 0;
            for (auto to : g[b])
            {
                if (!u[to])
                {
                    u[to] = cn[to] = 1;
                    b = to;
                    ans.push_back(b);
                    break;
                }
            }
        }
    }
    cout << ans.size() << '\n';
    for (int i = 0; i < (int) ans.size(); i++)
    {
        cout << ans[i] << ' ';
    }
    puts("");
}


Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	string res = "";
	for(int i=0;i<n;i++)
	{
		res += s[i];
		res += t[i];
	}
	cout<<res<<"\n";
	return;
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

#ifdef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	while(T--)
	solve(T);

#ifdef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <fstream>
#include <unordered_map>

using namespace std;

ifstream fin("../data.txt");

int n, a, x, sum;
long long dp[51][51][2501];
long long ans;
vector<int> v;

int main() {

  cin >> n >> a;
  for (int p = 0; p < n; p++) {
    cin >> x;
    sum += x;
    v.push_back(x);
  }

  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= n; j++)
      for (int k = 0; k <= sum; k++) {
        dp[i+1][j][k] = dp[i][j][k];
        if (k - v[i] >= 0 && j > 0) {
          dp[i+1][j][k] += dp[i][j-1][k-v[i]];
        }
      }

  for (int i = 1; i <= n; i++) {
    if (a*i > 2500) break;
    ans += dp[n][i][a*i];
  }

  cout << ans;

  return 0;
}


Measured memory_bytes: 53280