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

typedef long long ll;

const ll maxn = 1e6 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt" , "r+" , stdin) ; freopen("output.txt" , "w+" , stdout);
#define pb push_back
#define Mp make_pair
#define pll pair<ll, ll>
#define F first
#define S second

ll n;
pll p;
string s[maxn], ans;
vector<pair<pll, ll> > a, b;

pll check(string bs){
	ll x = 0, y = 0;
	for(ll i = 0; i < ll(bs.size()); i++){
		if(bs[i] == '(') x++;
		else x--;
		y = max(y, -x);
	}
	return Mp(x, y);
}

int main(){
	fast_io;
	
	cin >> n;
	for(ll i = 0; i < n; i++){
		cin >> s[i];
		p = check(s[i]);
		if(p.F >= 0){
			a.pb(Mp(Mp(p.S, -p.F), i));
		}
		else{
			b.pb(Mp(Mp(p.S + p.F, -p.S), i));
		}
	}
	sort(a.begin(), a.end());
	for(ll i = 0; i < a.size(); i++){
		ans += s[a[i].S];
	}
	sort(b.begin(), b.end(), greater<pair<pll, ll> >());
	for(ll i = 0; i < b.size(); i++){
		ans += s[b[i].S];
	}
	p = check(ans);
	if(p.F != 0 || p.S != 0) cout << "No";
	else cout << "Yes";
	
	
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if ((i + 1) % 2 == 1 and x % 2 == 1) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3616
void main() {
    writeln(readln.chomp.to!int ^^ 2);
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include "iostream"
#include "string"
using namespace std;

int main(int argc, char const *argv[])
{
	string x;
	int m=0;
	int h=0;
	

	while(cin >> x)
	{
		m=0;
		h=0;
		if (x == "-")
		{
			break;
		}

		cin >> m;

		for(int i=0; i<m; i++)
		{
			cin >> h;
			// cout << "substr = " <<  x.substr(0,h-1);
			x += x.substr(0,h);
			x.erase(0,h);
		}
		cout << x << endl;
	}

	return 0;
}



Measured memory_bytes: 3136
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll
//
//vector<int> G[20];
//
//// 巡回セールスマン問題
//
//signed main(){
//  int v,e;
//  cin>>v>>e;
//
//  for(int i=0; i<e; i++){
//    int a,b;
//    cin>>a>>b;
//    G[a].push_back(b);
//  }
//}























////  最長共通部分列

int dp[1005][1005];

signed main(){
  int n;
  cin>>n;
  for(int i=0; i<n; i++){
    string s1,s2;
    cin>>s1>>s2;
    s1=" "+s1;
    s2=" "+s2;
    int maxl=0;
    for(int i=0; i<=s1.size()-1; i++) for(int j=0; j<=s2.size(); j++) dp[i][j]=0;
    for(int i=1; i<=s1.size()-1; i++){
      for(int j=1; j<=s2.size(); j++){
        if(s1[i]==s2[j]) dp[i][j]=dp[i-1][j-1]+1;
        else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        maxl=max(maxl,dp[i][j]);
      }
    }
    cout<<maxl<<en;
  }
}




Measured memory_bytes: 11040
#include <bits/stdc++.h>
#define int long long
using namespace std;

int n,d[200010],dp[200010],sz[200010];
map<int,int> mp;
vector<pair<int,int> > edges,ans;

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++){cin>>d[i];mp[d[i]]=i;edges.push_back(make_pair(d[i],i));}
	sort(edges.begin(),edges.end());
	reverse(edges.begin(),edges.end());
	for(int i=1;i<=n;i++){sz[i]=1;dp[i]=0;}
	for(int i=0;i<edges.size()-1;i++){
		if(sz[edges[i].second]*2>=n){
			cout<<-1<<endl;
			return 0;
		}
		int need=edges[i].first-(n-2*sz[edges[i].second]);
		if(!mp.count(need)){
			cout<<-1<<endl;
			return 0;
		}
		dp[mp[need]]+=dp[edges[i].second]+sz[edges[i].second];
		sz[mp[need]]+=sz[edges[i].second];
		ans.push_back(make_pair(mp[need],edges[i].second));
	}
	if(dp[edges[edges.size()-1].second]!=edges[edges.size()-1].first){
		cout<<-1<<endl;
		return 0;
	}
	for(int i=0;i<ans.size();i++){
		cout<<ans[i].first<<" "<<ans[i].second<<endl;
	}
	return 0;
}

Measured memory_bytes: 14448
import sys
sys.setrecursionlimit(1000000)
MOD = 10**9 + 7

H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]

dp = [[0 for j in range(W)] for i in range(H)]  # 0-indexed
dp[0][0] = 1

for i in range(H):
    for j in range(W):
        if i != H-1 and a[i+1][j] != '#':
            dp[i+1][j] += dp[i][j]
            dp[i+1][j] %= MOD
        if j != W-1 and a[i][j+1] != '#':
            dp[i][j+1] += dp[i][j]
            dp[i][j+1] %= MOD

print(dp[H-1][W-1] % MOD)


Measured memory_bytes: 52368
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
#define PI 3.14159265358979323846264338327950L;
const int INF2 = 1001001001;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};

const int MAX_N = 110000;

int memo[MAX_N];

int rec(int n) {
	if (n == 0)return 0;
	if (memo[n] != -1)return memo[n];

	int res = n;

	for (int pow6 = 1; pow6 <= n; pow6 *= 6)res = min(res, rec(n - pow6) + 1);

	for (int pow9 = 1; pow9 <= n; pow9 *= 9)res = min(res, rec(n - pow9) + 1);

	return memo[n] = res;
}

int calc(int x) {
	int ret = 0;
	while (x % 2 == 0) {
		x /= 2;
		ret++;
	}

	return ret;
}

int a[12][12];
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);


	string s, t;
	cin >> s >> t;
	bool ans = false;

	rep(i, 0, s.size()) {
		if (s == t) {
			ans = true;
		}

		s = s.back() + s.substr(0, s.size() - 1);
	}
	
	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	/*
	vector<int> data(s);
	rep(i, 0, s) {
		cin >> data[i];

	}
	/*int min = 1;
	rep(i, 0, s) {

		min = lcm(min, data[i]);
	}

	min -= 1;

	int ans = 0;

	rep(i, 0, s) {

		ans += data[i] - 1;;
	}

	cout << ans << endl; */


}
	

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

using namespace std;

class Solution {
public:

};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    string s;
    cin >> s;
    int n = s.length();
    bool ok = true;

    vector<string> S{"RUD", "LUD"};
    for (int i = 0; i < n; ++i) {
        if (S[i & 0x1].find(s[i]) == string::npos) {
            ok = false;
            break;
        }
    }
    if (ok) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 256
# coding : utf-8

import numpy as np

a, b, x = list(map( lambda x:int(x), input().split(" ") ))

#傾けたあとの水面が「底面」か「側面」かの判定
lim_x = float(a*a*b) / 2.0

# 「側面」
if( x >= lim_x ):
    #空白部分
    x_non = float(a*a*b - x)
    #
    tmp_b = float(2*x_non) / float(a*a)
    #
    r = np.sqrt(a*a+tmp_b*tmp_b)
    #
    tmp_a = a
    #tmp_b = tmp_b
    tmp_c = r
    cos_sita = (tmp_a**2+tmp_c**2-tmp_b**2) / (2*tmp_a*tmp_c)
    
    sita = np.arccos(cos_sita)
    
    print(np.rad2deg(sita))
# 「底面」
elif( x < lim_x ):
    #傾けたときの水面と地面の距離
    a_x = (2.0 * x) / ( a * b )
    # 相似比
    scale = a_x / np.sqrt(b*b + a_x*a_x)
    
    under_a = a_x * scale
    under_b = b * scale
    
    #余弦定理
    tmp_a = a_x
    tmp_b = under_b
    tmp_c = under_a
    cos_sita = (tmp_a**2+tmp_c**2-tmp_b**2) / (2*tmp_a*tmp_c)
    
    sita = np.arccos(cos_sita)
    
    print(np.rad2deg(sita))



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

long long inf = pow(2,63);

int main(){
  long long T;
  cin >> T;
  for(int t=0;t<T;t++){
    long long N,A,B,C,D;
    cin >> N >> A >> B >> C >> D;
    
    queue<long long> Q;
    Q.push(N);
    map<long long,long long> M;
    M[N] = 0;
    while(!Q.empty()){
      long long x = Q.front();
      Q.pop();
      if(x==0) continue;
      long long c = M[x];
      
      vector<pair<long long,long long>> V(0);
      V.push_back(make_pair(x/2,A+(x%2)*D));
      if(x%2!=0) V.push_back(make_pair(x/2+1,A+(x%2)*D));
      V.push_back(make_pair(x/3,B+(x%3)*D));
      if(x%3!=0) V.push_back(make_pair(x/3+1,B+(3-(x%3))*D));
      V.push_back(make_pair(x/5,C+(x%5)*D));
      if(x%5!=0) V.push_back(make_pair(x/5+1,C+(5-(x%5))*D));
      if(x<inf/D) V.push_back(make_pair(0,x*D));
      
      for(int i=0;i<V.size();i++){
        long long newx = V[i].first, coin = V[i].second;
        if(M.count(newx)){
          if(coin+c<M[newx]){
            M[newx] = coin+c;
            Q.push(newx);
          }
        }
        else{
          M[newx] = coin+c;
          Q.push(newx);
        }
      }
    }
    
    cout << M[0] << endl;
  }
  return 0;
}


Measured memory_bytes: 4516
#include <stdio.h>

int main(void)
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);

	if (a + b == c || a + c == b || b + c == a){
		printf("Yes");
	}
	else{
		printf("No");
	}




	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <numeric>
#include <tuple>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <unordered_map>
#include <type_traits>
#include <map>
#include <cstdio>
#include <string>

using namespace std;
using str = string;

#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define get cin>>
#define put cout<<

int gcd_euclid(int u, int v) {
  int r;
  while (0 != v) {
    r = u % v; u = v; v = r; /* swap */
  }
  return u;
}

// 最大公約数算出
int calc_gcd(const vector<int> vec){
	int gcd = *min_element(vec.begin(), vec.end());
	for (const int ele: vec){
		gcd = gcd_euclid(gcd,ele);
	}
	return gcd;
}

// 最小公倍数
int calc_lcm(const vector<int> vec) {
	int tmp = 1;
	for (const int ele: vec){
		tmp *= ele;
	}
	int gcd = calc_gcd(vec);
	return tmp/gcd;
}

std::string join(const std::vector<std::string>& v, const char* delim = 0) {
  std::string s;
  if (!v.empty()) {
    s += v[0];
    for (decltype(v.size()) i = 1, c = v.size(); i < c; ++i) {
      if (delim) s += delim;
      s += v[i];
    }
  }
  return s;
}

// nが奇数、偶数の場合の場合分け
// n & 1 ? odd : even

// distinctはsortしてunique + erase
// https://qiita.com/ysk24ok/items/30ae72f4f1060b088588
//sort(vec.begin(), vec.end());
//vec.erase(unique(vec.begin(), vec.end()), vec.end());


void run() {
	int n, h, w; get n >> h >> w;

	put (n - h + 1) * (n - w + 1);
}

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


Measured memory_bytes: 256
solve :: [Int] -> Int
solve (d:n:_) =
    (filter (\x -> div100 d x) [1..1010000]) !! (n - 1)

div100 :: Int -> Int -> Bool -- bが100で丁度a回割り切れるか
div100 a b = b `mod` 100^a == 0 && b `mod` 100^(a + 1) > 0

main :: IO ()
main = do
    n <- fmap (read :: String -> Int) . words <$> getLine
    (putStrLn . show . solve) n

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

using namespace std;
#define X first
#define Y second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define debug(x) cerr << #x << " = " << (x) << endl;
template<typename T>
ostream& operator<<(ostream& o, vector<T>& v) {
    for (auto& x : v) o << x << ' ';
    return o;
}

int main(){
    std::ios_base::sync_with_stdio(false); cin.tie(0);
    int n;
    ll D;
    cin >> n >> D;
    vector<ll> arr(n), dist_from(n), ans(n), behind(n+1);
    for (int i = 0; i < n; i++) cin >> arr[i];

    ll d = D;
    for (int i = 0; i < n; i++){
        dist_from[i] = d;
        d = min(d, abs(d - arr[i]));
    }

    ll lo = 1;
    behind[n] = 1;
    for (int i = n-1; i >= 0; i--){
        if (arr[i] <= lo) lo += arr[i];
        else if (arr[i] - lo < lo) lo += arr[i];

        behind[i] = lo;
    }

    // debug(dist_from);
    // debug(behind);
    int q; cin >> q;
    while (q--){
        int i; cin >> i; i--;
        if (dist_from[i] >= behind[i+1]) cout << "YES" << "\n";
        else cout << "NO" << "\n";
    }

}


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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    int n;
    cin >> n;
    set<string> s;
    rep(i, n)
    {
        string a;
        cin >> a;
        s.insert(a);
    }
    if (s.size() == 3)
        c("Three");
    if (s.size() == 4)
        c("Four");
    return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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



void solve() {
	int N, M, K; cin >> N >> M >> K;
    modint res=0;
    rep1(i, N){
        res = modint(res + modint((N-i)%mod*M%mod*M%mod*i)*comb(N*M-2, K-2));
    }
    rep1(i, M){
        res = modint(res + modint((M-i)%mod*N%mod*N%mod*i)*comb(N*M-2, K-2));
    }

    cout << modint(res) << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 50 + 5;
const int mod = 1e9 + 7;

int f[maxn][maxn][maxn * maxn];
int n , k;
void add(int &x ,int y){
    x += y;if(x>=mod)x-=mod;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    cin >> n >> k;
    f[0][0][0] = 1;
    for(int i = 0 ; i < n ; ++i){
        for(int j = 0 ; j <= n ; ++j){
            for(int k = 0 ; k <= n * n ; ++k){
                if(f[i][j][k] == 0)continue;
                add(f[i + 1][j][k + 2 * j] , (ll)f[i][j][k] * (2 * j + 1) % mod);
                add(f[i + 1][j + 1][k + 2 * (j + 1)] , f[i][j][k]);
                if(j >= 0){
                    add(f[i + 1][j - 1][k + 2 * (j - 1)] , (ll)f[i][j][k] * j * j % mod);
                }
            }
        }
    }
    cout << f[n][0][k];
}


Measured memory_bytes: 33024
import numpy as np

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

A=[0 for _ in range(N)]
B=[0 for _ in range(N)]
C=[0 for _ in range(N)]

for i in range(M):
    p,S = input().split()
    p = int(p)-1
    if S == "AC":
        A[p] = 1
        C[p] = B[p]
    elif A[p]==0:
        B[p] += 1
    
A = np.array(A)
C = np.array(C)
print(np.sum(A), np.sum(C))


Measured memory_bytes: 15844
N = int(input())
S = list(input())
n = len(S)
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(n):
    id = alphabet.index(S[i])
    if id + N <= 25:
        S[i] = alphabet[id+N]
    else:

        S[i] = alphabet[(id+N)-26]

print("".join(S))


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

int main() {
    int s;
    cin >> s;
    int A = s / 100;
    int B = s % 100;
    string t;
    // cin >> s;
    // cout << a + b + c << " " << s << endl;
    if(A>0&&A<13&&B>0&&B<13) t= "AMBIGUOUS";
    else if((A>12||A==0)&&B>0&&B<13) t="YYMM";
    else if(A>0&&A<13&&(B>12||B==0)) t="MMYY";
    else t="NA";

    cout << t << endl;


}

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

int main()
{
	int k;
	string s;
	cin >> k >> s;

	if (k < s.size())
	{
		cout << s.substr(0, k) << "..." << endl;
	}
	else
	{
		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    string s; cin >> s;
    ll ans = 0;
    rep(i, s.size()-1) if(s[i] != s[i+1]) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3756
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
	int r, g, b;
	cin >> r >> g >> b;
	if ((10 * g + b) % 4 == 0)
		cout << "YES" << "\n";
	else
		cout << "NO" << "\n";
}

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

using namespace std;

int solve(int64_t n, int64_t t, std::vector<int64_t> hs) {
  int ret;
  int64_t diff = INT64_MAX;
  for (int i = 0; i < n; ++i) {
    int64_t const average = abs(t - hs[i] * 6);
    if (average < diff) {
      diff = average;
      ret = i + 1;
    }
  }
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t n;
  std::cin >> n;
  int64_t t;
  std::cin >> t;
  t *= 1000;
  int64_t a;
  std::cin >> a;
  a *= 1000;
  t -= a;
  std::vector<int64_t> hs(n);
  for (int i = 0; i < n; i++) {
    std::cin >> hs[i];
  }
  auto const res = solve(n, t, std::move(hs));
  std::cout << res << std::endl;
  return 0;
}


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

long long calc(long long x) {
    stringstream ss;
    ss << x;
    string S = ss.str();
    int N = S.size();

    long long dp[20][11][2] = {0};
    dp[1][10][1] = 1;
    for (int j = 1; j < S[0]-'0'; ++j) dp[1][j][1] = 1;
    dp[1][S[0]-'0'][0] = 1;
    for (int i = 1; i < N; ++i) {
        // from j = 10
        dp[i+1][10][1] += dp[i][10][0] + dp[i][10][1];
        for (int add = 1; add < 10; ++add)
            dp[i+1][add][1] += dp[i][10][0] + dp[i][10][1];

        // from j = 0 ~ 9
        for (int j = 0; j < 10; ++j) {
            for (int k = -1; k <= 1; ++k) {
                int add = j + k;
                if (add < 0 || add > 9) continue;

                dp[i+1][add][1] += dp[i][j][1];
                if (add < S[i]-'0') 
                    dp[i+1][add][1] += dp[i][j][0];
                else if (add == S[i]-'0')
                    dp[i+1][add][0] += dp[i][j][0];
            }
        }
    }
    long long res = 0;
    for (int j = 0; j < 10; ++j) res += dp[N][j][0] + dp[N][j][1];
    return res;
}

int main() {
    int K;
    cin >> K;
    long long left = 0, right = 1LL<<50;
    while (right - left > 1) {
        long long x = (left + right) / 2;
        if (calc(x) >= K) right = x;
        else left = x;
    }
    cout << right << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	ll l, r;
	cin >> l >> r;
	if (r - l > 2019)r = l + 2019;
	//int ans = 2020;
	int ans = ((l % 2019LL) * (l + 1) % 2019LL) % 2019LL;
	for (int i = l; i < r; i++) {
		for (int j = i + 1; j <= r; j++) {
			ans = min(ans, ((i % 2019) * (j % 2019)) % 2019);
		}
	}
	cout << ans << endl;
	return 0;
}



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


int main(void){
    // Your code here!
    int N = 0;
    
    cin >> N;
    
    unsigned long long	 sum = 0;

    for (int i = 1; i <= N; i++) {
        if ((i % 3 == 0) || (i % 5 == 0)) {
        } else {
            sum += i;
        }
    }
    cout << sum << endl;
    
    return 0;
    
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (int i = 2; i < MAX; 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;}

int main() {
  int n;
  cin>>n;
  string s;
  cin>>s;
  int ans=1;
  for(int i=1;i<n;i++){
    if(s[i]!=s[i-1]) ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3744
import math


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    N = m*p+q = m*q+q = q*(m+1)   q < m
    N%m = (m*p+q)%m = q%m = q = N/m = (m*p+q)/m = p

    3*2+2
    7*1+1
    """
    N = read_int()
    answer = 0
    for q in range(1, math.ceil(math.sqrt(N))):
        if N%q == 0 and q < N//q-1:
            answer += N//q-1
    return answer



if __name__ == '__main__':
    print(solve())


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) ((int)(a).size())
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define trav(it, a) for(auto& it : a)
#define allin(it, a) for(auto it : a)
#define read(v, a, b) for(int i=(a); i<(b); i++) scanf("%d", &v[i]);
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end()
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define db(x) cerr << #x << " == " << x << endl

const int maxn = 1e5 + 100;

// In this one we need to do a top sort with bfs and then do a max dp over it

int n, m;

vi g[maxn], top;

int dp[maxn], grau[maxn];

void bfs(){
	queue<int> q;
	
	rep(i,0,n)
		if(grau[i] == 0)
			q.push(i);
	
	while(!q.empty()){
		int u = q.front();
		q.pop();
		
		top.pb(u);
		for(auto v : g[u]){
			grau[v]--;
			if(!grau[v])
				q.push(v);
		}
	}
}

int main(){
	scanf("%d %d", &n, &m);
	
	rep(i,0,m){
		int u, v; scanf("%d %d", &u, &v);
		u--, v--;
		g[u].pb(v);
		grau[v]++;
	}
	
	bfs();
	
	trav(u, top)
		for(auto v : g[u])
			dp[v] = max(dp[v], dp[u] + 1);
	
	printf("%d\n", *max_element(dp, dp+n));
}


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

int main() {
	
	int n;

	cin >> n;

	int a[100];

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

	for (int i = n-1; i >= 0; i--) {
		cout << a[i];
		if (i != 0) {
			cout << " ";
		}
		else {
			cout << endl;
		}
	}

	return 0;
}


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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n;
  vector<int> a;
  Solver(LL n) : n(n), a(n){};

  void solve() {
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    vector<int> cnt;
    int tmpcnt = 1;
    for (int i = 1; i < n; ++i) {
      if (a[i] == a[i - 1]) {
        tmpcnt++;
      } else {
        cnt.push_back(tmpcnt);
        tmpcnt = 1;
      }
    }
    cnt.push_back(tmpcnt);
    int ans = 0;
    for (auto x : cnt) {
      ans += (x / 2);
    }
    cout << ans << "\n";
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0;
  std::cin >> n;

  Problem::Solver sol(n);
  sol.solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, ma, mb;
    cin >> n >> ma >> mb;
    int dp[10 * n + 3][10 * n + 3];
    for(int i = 0; i <= 10 * n; i++){
        for(int j = 0; j <= 10 * n; j++){
            dp[i][j] = 1e9;
        }
    }
    dp[0][0] = 0;
    for(int i = 1; i <= n; i++){
        int a, b, c;
        cin >> a >> b >> c;
        for(int j = 10 * n - a; j >= 0; j--){
            for(int k = 10 * n - b; k >= 0; k--){
                dp[j + a][k + b] = min(dp[j + a][k + b], dp[j][k] + c);
            }
        }
    }
    int k = 1, ans = 1e9;
    while(1 == 1){
        if(ma * k >= 10 * n || mb * k >= 10 * n){
            break;
        }
        ans = min(ans, dp[ma * k][mb * k]);
        k++;
    }
    if(ans == 1e9){
        cout << "-1";
    }
    else{
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 4184
import numpy as np

N, K, Q=list(map(int,input().split()))
points = K * np.ones(N)
A_list = np.zeros(Q)

for i in range(Q):
    A = int(input()) - 1
    A_list[i] = A

points = points - Q
for i in A_list:
    points[int(i)] += 1

for i in range(N):
    if points[i] > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 14780
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        String str = sc.next();
        char[] c = str.toCharArray();
        int[] array = new int[n];
        for (int i = 0; i < n-1; i++) {
            if (c[i] == 'A' && c[i+1] == 'C') {
                array[i+1]++;
            }
        }
        
        int[] sum = new int[n+1];
        for (int i = 1; i <= n; i++) {
            sum[i] = sum[i-1] + array[i-1];
        }
        // System.out.println(Arrays.toString(sum));
        
        while (q-- > 0) {
            int i = sc.nextInt();
            int j = sc.nextInt();
            // System.out.println(i + " " + j);
            System.out.println(sum[j] - sum[i]);
        }
    }
}

Measured memory_bytes: 90152
using System;

namespace _20190324_01 {
    class Program {
        static void Main(string[] args) {
            var c = Console.ReadLine();
            switch (c) {
                case "A":
                    Console.WriteLine("T");
                    return;
                case "T":
                    Console.WriteLine("A");
                    return;
                case "C":
                    Console.WriteLine("G");
                    return;
                case "G":
                    Console.WriteLine("C");
                    return;
                default:
                    break;
            }
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD 1000000007
void bulk(){}template<class H,class...T>void bulk(H&h,T&...t){cin>>h;bulk(t...);}
#define get(...) int __VA_ARGS__; bulk(__VA_ARGS__);

int digsum(int n){if(n<10)return n; return n%10+digsum(n/10);}

int main(){
	get(n,a,b);
	int ans=0;
	range(i,1,n+1){
	    int d=digsum(i);
	    if(a<=d&&d<=b)ans+=i;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

int A, B, K;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> A >> B >> K;

  int n = A > B ? A : B;

  int cnt = 0;
  for (int i = n; i >= 1; i--) {
    if (A % i == 0 && B % i == 0) {
      cnt++;
    }

    if (cnt == K) {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include<map>
#include<cstring>
#include<iomanip>
#include <string>
#include <vector>	
#include<unordered_map>
#include<unordered_set>
using namespace std;


typedef long long unsigned llu;
typedef long double ld;
#define ll long long
#define PI 3.14159265358979323846
#define For(i, a, b) for (int i = a, sz = (int)b; i < sz; i++)
#define rFor(i, a, b, c) for (int i = (a); i >= (b); i -= (c))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fill(a, b) memset(a, b, sizeof(a))
#define IO ios_base::sync_with_stdio(false), cin.tie(0),cout.tie(0)
const ll mod = 1000000007;
const ll inf = 1000000000009;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);}

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdoutn
int main()
{	
  IO;
 	double d{},t{},s{};
  cin>>d>>t>>s;
  double x=d/s;
  if(x<=t)cout<<"Yes\n";
  else cout<<"No\n";
  //system("pause");
  return 0;
}

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

int main(){
	char a[8][8];
	while(cin >> a[0][0] >> a[0][1] >> a[0][2] >> a[0][3] >> a[0][4] >> a[0][5] >> a[0][6] >> a[0][7]){
		int p, q;
		for(int i = 1; i < 8; i++){
			for(int j = 0; j < 8; j++){
				cin >> a[i][j];
			}
		}
		for(int i = 0; i < 8; i++){
			for(int j = 0; j < 8; j++){
				if(a[i][j] == '1'){
					p = i;
					q = j;
					goto LABEL;
				}
			}
		}
		LABEL:
		if(a[p][q+2] == '1'){
			cout << "C" << endl;
		}
		else if(a[p+2][q] == '1'){
			cout << "B" << endl;
		}
		else if(a[p+2][q+1] == '1'){
			cout << "F" << endl;
		}
		else if(a[p+1][q+2] == '1'){
			cout << "E" << endl;
		}
		else if(a[p+1][q+1] == '1'){
			cout << "A" << endl;
		}
		else if(a[p][q+1] == '1'){
			cout << "G" << endl;
		}
		else{
			cout << "D" << endl;
		}
	}
}

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

using namespace std;

int main(){
    long long one, zero, minus_one;
    cin >> one >> zero >> minus_one;

    long long K;
    cin >> K;

    long long res =0;

    long long a = one+zero;

    if( K <= one){
        res = K;
    }else if( one< K && K <=(one+zero) ){
        res = one;
    }else if( (one+zero) < K && K <= (one+zero+minus_one))
    {
        long long amari = K - (one+zero);
        res = one - amari;
    }else{
        res = one - minus_one;
    }

    cout << res << endl;
}

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

int N, Q, s[1000000];
vector< int > Student;
multiset< int > Leader;

char Query[10];
int a;

main()
{
  scanf("%d %d", &N, &Q);
  Student.resize(N);
  for(int i = 0; i < N; ++i) {
    scanf("%d", &Student[i]);
    s[i] = Student[i];
  }
  sort(Student.begin(), Student.end());
  while(Q--) {
    scanf("%s %d", &Query, &a);
    if(Query[0] == 'A') { // "ADD"
      Leader.insert(s[--a]);
    } else if(Query[0] == 'R') { // "REMOVE"
      Leader.erase(Leader.find(s[--a]));
    } else { // "CHECK"
      int Lower = 0, Upper = 1 << 30;
      while(Lower < Upper) {
        int Mid = Lower + Upper >> 1, Lost = 0;
        vector< int >::iterator last = Student.begin();
        for(multiset< int >::iterator it = Leader.begin(); it != Leader.end() && last != Student.end(); ++it) {
          Lost += lower_bound(last, Student.end(), *it - Mid) - last;
          last = upper_bound(last, Student.end(), *it);
        }
        Lost += Student.end() - last;
        if(Lost <= a) Upper = Mid;
        else Lower = Mid + 1;
      }
      if(Lower == 1 << 30) cout << "NA" << endl;
      else cout << Lower << endl;
    }
  }
}

Measured memory_bytes: 8864
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;

int main()
 {
 	int n,i,r,s=0,c;
 	cin>>n;
 	for(i=1;i<=n;i++)
 	{
	 	c=0;
 	     r=i;
        while(r>0)
 		{
 				r=r/10;
 				c++;
	    }
		if(c%2!=0)
			s++;
	}
	cout<<s<<endl;
 }

Measured memory_bytes: 3648
package main

import "fmt"

func main() {
	var s string
	fmt.Scanln(&s)

	modN := int64(1000000000 + 7)
	mod := func(n int64) int64 {
		return n % modN
	}

	dp := make([][]int64, len(s)+1)
	dp[0] = []int64{1, 0, 0, 0}
	var pattern int64
	for i := 0; i < len(s); i++ {
		if s[i] == '?' {
			pattern = 3
		} else {
			pattern = 1
		}

		dp[i+1] = []int64{
			mod(dp[i][0] * pattern),
			mod(dp[i][1] * pattern),
			mod(dp[i][2] * pattern),
			mod(dp[i][3] * pattern),
		}

		for _, j := range transitions(s[i]) {
			dp[i+1][j] = mod(dp[i+1][j] + dp[i][j-1])
		}
	}

	fmt.Println(dp[len(s)][3])
}

func transitions(c byte) []int64 {
	switch c {
	case 'A':
		return []int64{1}
	case 'B':
		return []int64{2}
	case 'C':
		return []int64{3}
	case '?':
		return []int64{1, 2, 3}
	}
	panic("unexpected char")
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

#define next nxt

int n;
string s[555];
vector<int> next[33];
bool vis[33];
int sch;

bool dfs(int v){
	vis[v]=true;
	bool res=true;
	rep(i,next[v].size()){
		int nv=next[v][i];
		if(nv==sch)res=false;
		if(vis[nv])continue;
		if(!dfs(nv))res=false;
	}
	return res;
}

int main(){
	cin.sync_with_stdio(false);
	while(1){
		cin>>n;
		if(n==0)break;
		rep(i,n)cin>>s[i];
		rep(i,33)next[i].clear();
		bool ok=true;
		rep(i,n-1){
			int j=0;
			while(j<min(s[i].length(),s[i+1].length())&&s[i][j]==s[i+1][j])j++;
			if(j==s[i].length())continue;
			if(j==s[i+1].length()){
				ok=false;
				break;
			}
			if(!exist(next[s[i][j]-'a'],s[i+1][j]-'a'))next[s[i][j]-'a'].pb(s[i+1][j]-'a');
		}
		rep(i,33){
			memset(vis,0,sizeof(vis));
			sch=i;
			if(!dfs(i)){
				ok=false;
				//dbg(i);
			}
		}
		if(!ok)cout<<"no"<<endl;
		else cout<<"yes"<<endl;
	}
	return 0;
}

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

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

  vector<int> A(N);
  float threshold = 0;
  
  for(int i=0; i<N; i++){
    cin >> A[i];
    threshold += A[i];
  }
  threshold = threshold / (4*M);
  sort(A.rbegin(), A.rend());

  bool result = true;
  for(int i=0; i<M; i++){
    if(A[i] < threshold)
      result = false;
  }
  if(result){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
/*
    Mbak Rose Dong
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,j,k,x,m,curr;
	cin >> n >> x;
	if(n < x)
        cout << "0";
    else
        cout << "10";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i))
using namespace std;
template <class T>
void setmax(T &a, T const &b) {
    if (a < b) a = b;
}

template <class T>
void setmin(T &a, T const &b) {
    if (a > b) a = b;
}

template <typename T, typename X>
auto vectors(T a, X x) { return vector<T>(x, a); }

template <typename T, typename X, typename Y, typename... Zs>
auto vectors(T a, X x, Y y, Zs... zs) {
    auto cont = vectors(a, y, zs...);
    return vector<decltype(cont)>(x, cont);
}

template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

bool IsValid(VV<long long> &G) {
    int N = G.size();
    repeat(k, N) {
        repeat(i, N) {
            repeat(j, N) {
                if (G[i][j] > G[i][k] + G[k][j]) {
                    return false;
                }
            }
        }
    }
    return true;
}

int main() {
    int N;
    cin >> N;
    auto A = vectors(0LL, N, N);
    repeat(i, N) {
        repeat(j, N) {
            cin >> A[i][j];
        }
    }
    if (!IsValid(A)) {
        cout << -1 << endl;
    } else {
        const int INF = 1e9 + 7;
        repeat(k, N) {
            repeat(i, N) {
                repeat(j, N) {
                    if (i == j || j == k || k == i) continue;
                    if (A[i][j] == A[i][k] + A[k][j]) {
                        A[i][j] = A[j][i] = INF;
                    }
                }
            }
        }
        /* 
        repeat(i, N) {
            repeat(j, N) {
                if (A[i][j] == INF) {
                    cout << "INF"
                         << "\t";
                } else {
                    cout << A[i][j] << "\t";
                }
            }
            cout << endl;
        }
 */
        long long res = 0;
        repeat(i, N) {
            repeat(j, N) {
                if (A[i][j] != INF) {
                    res += A[i][j];
                }
            }
        }
        cout << res / 2 << endl;
    }
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  long long sum=0;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  sort(A.rbegin(),A.rend());
  for(int i=1;i<N;i++){
    sum+=A.at(i/2);
  }
  cout << sum << endl;
}

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

int main() {
 
  string s;
  cin >> s;
  
  int ans = 0;
  int tmp = s.size() / 2;
  int n = s.size() - 1;
  for(int i = 0; i < tmp; i++) {
    if(s.at(i) != s.at(n)) {
      ans++;
    }
    n--;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, M, A, B, X, Y;
	string S, T;
	cin >> N;
	cout << (1000 - N % 1000) % 1000 << endl;

	return 0;
}



Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


signed main(){
	int n; cin>>n;
	int k=-1;
	if(n==1){
		cout<<"Yes"<<endl<<2<<endl;
		rep(i,2) cout<<1 SP 1<<endl;
		return 0;
	}
	for(int i=1; i<=n; i++){
		if(i*(i-1)/2==n) k=i;
	}
	if(k==-1) return cout<<"No"<<endl,0;
	cout<<"Yes"<<endl<<k<<endl;
	int a[k-1];
	int t=1;

	cout<<k-1<<' ';
	reps(i,k-1){
		a[i-1]=t;
		cout<<a[i-1]<<' ';
		t+=i;
	}

	cout<<endl<<k-1<<' ';

	reps(i,k-2){
		int f=a[i];
		rep(j,i+1){
			cout<<f<<' ';
			f++;
		}
		f--;
		int add=i;
		rep(j,k-1-i-1){
			f+=add+1;
			cout<<f<<" ";
			add++;
		}
		cout<<endl<<k-1<<' ';
	}



	int f=1;

	reps(i,k-1){
		cout<<f<<' ';
		f+=i+1;
	}
	cout<<endl;

	return 0;
}


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

// data types
#define ll long long int
#define ld long double

//funtion macros


// stl
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define ilp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))

#define mod 1000000007

// utility functions
ll max(ll a, ll b)
{
    if(a>b)return a;
    return b;
}

ll min(ll a, ll b)
{
	if(a<b)return a;
    return b;
}

ll power(ll x, ll y, ll m=mod)
{
	if(y<0)
    {
		x = power(x,m-2);
		y = -y;
	}
	ll ans=1;
	x = x % m;
	while(y)
    {
		if(y&1) ans = (ans*x)%m;
		y=y/2;
		x=(x*x)%m;
	}
	return ans;
}

bool poss(ll c, ll arr[],ll pos,ll v, ll m, ll n, ll p)
{
    if(pos>(arr[n-c]+m))
    {
        return 0;
    }
    else if(pos==arr[n-c])
    {
        return 1;
    }
    else
    {
        ll cnt = 0;
        cnt = (p-1)*m;
        lp(i,0,n-p+1)
        {
            cnt += min((arr[n-c]+m-arr[i]),m);
        }
        if(cnt>=v*m)
        {
            return 1;
        }
        else
        {
            return 0;
        }
        
    }
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n,m,v,p,i;
    cin >> n >> m >> v >> p;
    ll arr[n];
    lp(i,0,n)
    {
        cin >> arr[i];
    }
    sort(arr,arr+n);
    ll pos = arr[n-p];
    ll min = p, max = n,avg,res=p;
    while(min<=max)
    {
        avg = min + (max-min)/2;
        if(poss(avg,arr,pos,v,m,n,p))
        {
            res = avg;
            min = avg+1;
        }
        else
        {
            max = avg-1;
        }        
    }
    cout << res << "\n";
	return 0;
}

Measured memory_bytes: 1024