akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

struct trie {
	struct node {
		int son[2];
		bool bl;
	};
	vector<node> T;
	int sz;
	node n0;

	trie() {
		n0.son[0] =n0.son[1] =-1;
		n0.bl =false;
		sz =1;
		T.resize(1000000,n0);
	}

	void put(string &S) {
		int akt =0;
		for(int i =0; i < (int)S.length(); i++) {
			if(T[akt].son[S[i]-'0'] == -1)
				T[akt].son[S[i]-'0'] =sz++;
			akt =T[akt].son[S[i]-'0'];
		}
		T[akt].bl =true;
	}

	int zeroes(cat X) {
		if(X == 0) return 0;
		int ret =0;
		while(X%2 == 0) {
			ret++;
			X /=2;
		}
		return ret+1;
	}

	int SG(int akt, cat L, int dep =0) {
		if(T[akt].bl) return 0;
		int ret =0;
		for(int i =0; i < 2; i++) {
			if(T[akt].son[i] == -1) ret ^=zeroes(L-dep);
			else ret ^=SG(T[akt].son[i],L,dep+1);
		}
		return ret;
	}
};

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cat L;
	cin >> N >> L;
	trie T;
	for(int i =0; i < N; i++) {
		string S;
		cin >> S;
		T.put(S);
	}

	if(T.SG(0,L) == 0) cout << "Bob\n";
	else cout << "Alice\n";
	return 0;
}

// look at my code
// my code is amazing


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

typedef pair<int,int> pi;
typedef vector<int> vi;
 
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define pb push_back

template<typename T> void max_self(T &a, T b) { a = max(a,b); return;}
template<typename T> void min_self(T &a, T b) { a = min(a,b); return;}
 
const int nax = 1e5 + 5;
const int mod = 1e9 + 7;

int modExpo(int a,int b,int c){
	if(b == 0) return 1;
	int answer = 1;
	while(b){
		if(b & 1) answer = ((answer % c) * (a % c)) % c;
		a = ((a % c) * (a % c)) % c;
		b /= 2; 
	}
	
	return answer;
}

signed main(){
	
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int t = 1;
	//cin >> t;
	while(t--){
		string s,t;
		cin >> s >> t;
		
		int ans = 0;
		int n = (int)s.size();
		for(int i = 0; i < n; ++i){
			if(s[i] == t[i]) continue;
			++ans;
		}		
		
		cout << ans << "\n";
	}
    
    return 0;
}


Measured memory_bytes: 3792
#include <bits/stdc++.h>
#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 _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;


bool f[110];

int main() {
  ll n, k; cin >> n >> k;
  rep(i, 0, k){
    ll d; cin >> d;
    rep(j, 0, d){
      ll a; cin >> a;
      f[a] = true;
    }
  }

  ll cnt = 0;
  Rep(i, 1, n) if(f[i]) cnt++;
  cout << n-cnt << endl;

  return 0;
}


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

int main() {
  int n,d;
  cin >> n >> d;

  if(n % (2 * d + 1) == 0){
    cout << n / (2 * d + 1) <<endl;
  }
  else{
    cout << (n / (2 * d + 1)) + 1 <<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N;cin>>N;
    string s;
    cin>>s;
    int p[10]={};
    vector<bool> can(1000,false);
    vector<bool> used1(10,false),used2(10,false);
    REP(i,N) p[s[i]-'0']=i;
    REP(i,N){
        if(used1[s[i]-'0']) continue;
        used2.assign(10,false);
        rep(j,i+1,N){
            if(used2[s[j]-'0']) continue;
            REP(k,10){
                if(p[k]>j) can[(s[i]-'0')*100+(s[j]-'0')*10+k]=true;
            }
            used2[s[j]-'0']=true;
        }
        used1[s[i]-'0']=true;
    }
    int ans=0;
    REP(i,1000) if(can[i]) ans++;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	string s0,s1;
	cin >> s0 >> s1;
	for(int i=0;i<n;i++){
		cout << s0[i] << s1[i];
	}
	cout << "\n";
	return 0;
}

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

using namespace std;

int main()
{
    string str1,str2;
    int len;

    getline(cin,str1);
    getline(cin,str2);

    len= str1.length();

    str1+=str1;

    if (str1.find(str2)!=-1){
        cout <<"Yes" <<endl;
    }
    else{
        cout << "No" <<endl;
    }

    return 0;
}



Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
void insertionSort(int *a, int N);

int main(){
    int N;
    cin >> N;
    int a[N];
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    insertionSort(a,N);
}
void insertionSort(int *a, int N){
    //大きさNの配列aを挿入ソートし各ステップを出力していく関数
    for(int i = 1; i < N; i++){
        for(int k = 0; k < N; k++){
            cout << a[k];
            if(k != N-1) cout << " ";
            else cout << endl;
        }
        int work = a[i];
        int j = i-1;
        while(j >= 0 && a[j] > work){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = work;
    }
    for(int k = 0; k < N; k++){
            cout << a[k];
            if(k != N-1) cout << " ";
            else cout << endl;
        }
}


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

int main() {
  ll k,t;
  cin >> k >> t;
  vector<ll> a(t);
  ll max_cake;
  for(ll i=0;i<t;i++) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());
  if(a[0]<=(k+1)/2) {
    cout << 0 << endl;
  }
  else {
    ll ans=a[0]-(k+1)/2;
    ans=ans*2;
    if(k%2==0) {
      ans--;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

ll N, M, A[100001], seg[400004] = { 0 }, tmp[400004] = { 0 };
void pull(int n) { seg[n] = seg[n << 1] + seg[n << 1 | 1]; }
void push(int l, int r, int n) {
	seg[n] += (r - l + 1) * tmp[n];
	if (l != r) tmp[n << 1] += tmp[n], tmp[n << 1 | 1] += tmp[n];
	tmp[n] = 0;
}
void update(int a, int b, int v, int l = 1, int r = -1, int n = 1) {
	if (r == -1) r = M;
	push(l, r, n);
	if (l > b || r < a) return;
	if (l >= a && r <= b) {
		tmp[n] += v;
		push(l, r, n);
	}
	else {
		int m = (l + r) >> 1;
		update(a, b, v, l, m, n << 1), update(a, b, v, m + 1, r, n << 1 | 1);
		pull(n);
	}
}
ll query(int a, int b, int l = 1, int r = -1, int n = 1) {
	if (r == -1) r = M;
	if (a > b || l > b || r < a) return 0;
	push(l, r, n);
	if (l >= a && r <= b) return seg[n];
	int m = (l + r) >> 1;
	return query(a, b, l, m, n << 1) + query(a, b, m + 1, r, n << 1 | 1);
}

int main() {
	cin >> N >> M;
	for (int i = 0; i < N; ++i) cin >> A[i];

	ll cnt = 0, sum = 0;
	for (int i = 1; i < N; ++i) {
		if (A[i - 1] < A[i]) {
			sum += A[i] - A[i - 1];
			update(A[i - 1] + 1, A[i] - 1, 1);
			update(A[i], A[i], -(A[i] - A[i - 1] - 1));
		}
		else {
			cnt += M - A[i - 1];
			sum += A[i] - A[i - 1] + M; 
			update(A[i - 1] + 1, M, 1);
			update(1, A[i] - 1, 1);
			update(A[i], A[i], -(A[i] - A[i - 1] + M - 1));
		}
	}
	ll ans = cnt;
	for (int i = 1; i <= M; ++i) {
		cnt += query(i, i);
		ans = max(cnt, ans);
	}
	cout << sum - ans << '\n';
}

Measured memory_bytes: 7168
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
#define N 100005

pair<int, int> in[N], tmp[N];

int per[N];
bool vis[N];

void solve() {
	int n; scanf(" %d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d ", &in[i].second);
	}
	for (int i = 1; i <= n; ++i) {
		scanf("%d ", &in[i].first);
	}
	sort(in + 1, in + n + 1);
	for (int i = 1; i <= n; ++i) {
		tmp[i].first = in[i].second; tmp[i].second = i;
	}
	sort(tmp + 1, tmp + n + 1);
	
	for (int i = 1; i <= n; ++i) {
		if (tmp[i].first > in[i].first) {
			printf("No\n");
			return;
		}
		per[i] = tmp[i].second;
	}
	int mini = 2e9;
	for (int i = n; i >= 1; --i) {
		if (mini <= in[i].first) {
			printf("Yes\n");
			return;
		}
		mini = min(mini, in[per[i]].second);
	}
	int numCycle = 0;
	for (int i = 1; i <= n && numCycle<2; ++i) {
		if (!vis[i]) {
			int node = i;
			while (!vis[node]) {
				vis[node] = true;
				node = per[node];
			}
			++numCycle;
		}
	}
	if (numCycle == 1) {
		printf("No\n");
	}
	else {
		printf("Yes\n");
	}
}
int main() {
	//freopen("input.txt", "r", stdin);
	solve();
	return 0;
}

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


typedef long long int ll;
using namespace std;
template <typename T> void print(T vec) {for(auto d: vec) cout<<d<<' ';cout<<'\n';}
template<typename T> void print2D(T mat) {for(auto vec:mat) print(vec);}


ll n, W;
vector<ll> weight(n), value(n);




ll knapSack(ll W, ll n, vector<ll> &dp) {
    ll V = accumulate(value.begin(), value.end(), 0);
    dp.resize(V + 1, 1e13);
    dp[0] = 0;
    for(int i = 0; i < n; i++) {
        for(int j = V; j >= value[i]; j--) {
            dp[j] = min(dp[j], dp[j - value[i]] + weight[i]);
        }
    }
    int i = 0;
    for(; dp[V] > W; V--) {
        // cout<<(dp[V] <= W)<<'\n';
        continue;
    }
    return V;
}

int main() {
    
    cin>>n>>W;
    weight.resize(n);
    value.resize(n);
    vector<ll> dp;
    for(int i = 0; i< n;i++) {
        cin>>weight[i]>>value[i];
    }
    // cout<<func(W, value, weight, n);
    cout<<knapSack(W, n, dp)<<'\n';
    
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int a, b;
    cin >> a >> b;
    vector<int> v(3);
    v[0] = a + b;
    v[1] = a - b;
    v[2] = a * b;
    sort(v.begin(), v.end());
    cout << v[2] << endl;
    return 0;
}


Measured memory_bytes: 256
// C++(GCC 9.2.1)
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const int INF = 2020202020;
int dp[404][404]; // タイプA が a[g], タイプB が b[g] の 場合における 最小価格[円] を 保存.

int main() {
    
    // 1. 入力情報取得.
    int N, Ma, Mb;
    scanf("%d %d %d", &N, &Ma, &Mb);
    
    // 2. dp更新.
    rep(i, N){
        int ca, cb, cc;
        scanf("%d %d %d", &ca, &cb, &cc);
        repr(a, 403, 0){
            repr(b, 403, 0){
                int na = a + ca;
                int nb = b + cb;
                if(na > 403 || nb > 403) continue;
                if(!dp[na][nb] && na == ca && nb == cb) dp[na][nb] = cc;
                // 同じ組み合わせが含まれる場合があるので注意(※以下のロジックを追加).
                // -> subtask_1_09.txt における 5 4 73 と 5 4 7
                if(dp[na][nb] && na == ca && nb == cb) dp[na][nb] = min(dp[na][nb], cc);
                if(dp[a][b]){
                    if(dp[na][nb]) dp[na][nb] = min(dp[na][nb], dp[a][b] + cc);
                    else           dp[na][nb] = dp[a][b] + cc;
                }
            }
        }
    }
    
    // 3. 物質C を 生成するための最小予算は？
    int ans = INF;
    rep(i, N + 1){
        int a = Ma * i;
        int b = Mb * i;
        if(a > 400 || b > 400) break;
        if(dp[a][b]) ans = min(ans, dp[a][b]);
    }
    
    // 4. 出力.
    if(ans == INF) ans = -1;
    printf("%d\n", ans);
    return 0;
    
}

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

#define ll long long int
#define str string
ll MOD = 1000000007,INFL = 1ll << 60,INF = 1 << 30;
double Y[10000000] = {}, X[10000000] = {};
str Si[100];
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
vector <ll> v;
double a = 0,b = 0,n = 0, max = INF;
long double sum = 0;
str S,Sa;
bool ans = false;

int main(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        //Code Line
        cin >> n;
        for(int i = 0;i < n;i++){
          cin >> X[i] >> Si[i];
        }
        for(int i = 0;i < n;i++){
          if(Si[i][0] == 'J')sum += X[i];
          else if(Si[i][0] == 'B')sum += X[i] * 380000;
        }
        cout << sum << endl;
        //Code Line
        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define T 1001
#define M 1000000007
#define E e[x][i]
#define S e[x].size()
using namespace std;
typedef long long ll;
ll func(int);
int N,s,t;
string n[T];
vector<int> e[T];
 
main(){
  cin>>N;
  for(int i=0;i<N;i++) cin>>n[i];
  for(int i=0;i<N-1;i++) cin>>s>>t,e[s-1].push_back(t-1);
  cout<<func(0)%M<<endl;
}

ll func(int x){
  ll res=0;
  if(!e[x].size()){
    if(n[x]=="E") return 1;
    return 2;
  }
  if(n[x][0]=='E'){
    res++;
    for(int i=0;i<S;i++) res*=func(E);
    if(n[x]=="E?") res++;
  }
  else if(n[x][0]=='A'){
    for(int i=0;i<S;i++) res+=func(E);
    if(n[x]=="A?") res++;
  }else{
    res++;
    for(int i=0;i<S;i++) res*=(1+func(E));
    if(n[x]=="R") res--;
  }
  return res%M;
}

Measured memory_bytes: 1356
from itertools import accumulate
from fractions import gcd
def lcm_(x,y):
    return x*y//gcd(x,y)
def lcm(numbers):
    return list(accumulate(numbers,lcm_))
n=int(input())
A=[int(i) for i in input().split()]
L=lcm(A)[-1]-1
f=0
for i in A:
    f+=L%i

print(f)

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
bool f[33];

signed main(){
    cin>>N;

    int X=0;
    rep(i,N){
        int a;cin>>a;
        X^=a;
        int k=0;
        while(!(a>>k&1))k++;
        f[k]=true;
    }


    int cnt=0;
    for(int i=30;i>=0;i--){
        if(!(X>>i)&1)continue;
        if(!f[i]){
            cout<<-1<<endl;
            return 0;
        }
        X^=(1<<(i+1))-1;
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


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

namespace ABC146B
{
    class Program
    {
        static void Main(string[] args)
        {
            var solver = new Solver(Cin.Int(),Cin.String());

            Console.WriteLine(solver.Solve());
        }
    }

    class Solver
    {
        public int N;
        public string S;
        public Solver(int n, string s)
        {
            N = n;
            S = s;
        }

        public IConvertible Solve()
        {
            int[] ss = new int[S.Length];
            for (int i = 0; i < S.Length; i++)
            {
                ss[i] = S[i] + N;
                if (ss[i] > 90)
                {
                    ss[i] -= 26;
                }
            }

            return new String(ss.Select(i => (char)i).ToArray());
        }
    }

    internal static class Cin
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(String());
        }

        public static int[] IArr()
        {
            return Split().Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(String());
        }

        public static long[] LArr()
        {
            return Split().Select(long.Parse).ToArray();
        }

        public static double Double()
        {
            return double.Parse(String());
        }

        public static double[] DArr()
        {
            return Split().Select(double.Parse).ToArray();
        }

        private static IEnumerable<String> Split()
        {
            return String().Split(' ');
        }
    }
}

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

int main() {
    int n, m, a;
    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        cin >> a;
        n -= a;
        if (n < 0) {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << n << endl;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

const int MAX_N = 2010;
int A[MAX_N];
int cannot[MAX_N];

int main2() {
  int N = nextInt();
  int K = nextInt();
  int Q = nextInt();

  REP(i, N) A[i] = nextInt();

  int ans = 1001001001;
  REP(yi, N) {
    CLR(cannot, 0);
    int Y = A[yi]; // Y 未満のものは取れない
    for (int i = 0; i < N; i++) {
      if (A[i] < Y) {
        cannot[i] = 1;
      }
    }
    vector<int> use;
    vector<int> part;
    for (int i = 0; i < N; i++) {
      if (!cannot[i]) {
        part.push_back(A[i]);
      } else {
        sort(ALL(part));
        for (int i = 0; i < (int)part.size()-(K-1); i++) {
          use.push_back(part[i]);
        }
        part.clear();
      }
    }
    if (part.size() > 0) {
      sort(ALL(part));
      for (int i = 0; i < (int)part.size()-(K-1); i++) {
        use.push_back(part[i]);
      }
    }
    sort(ALL(use));
    if ((int)use.size() >= Q) {
      chmin(ans, use[Q-1]-use[0]);
    }
  }

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

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr double INF = std::numeric_limits<double>::max();
#define int long long int

void solve() {
  int W, H, x, y;
  cin >> W >> H >> x >> y;

  if (x <= W / 2) {
    x = W - x;
  }

  if (y <= H / 2) {
    y = H - y;
  }

  if (W > H) {
    swap(W, H);
    swap(x, y);
  }

  double ans = 0;
  int a = 0;

  ans = H * W / 2.0;
  if (H == y * 2 && W == x * 2) {
    a = 1;
  }
  printf("%lf %lld\n", ans, a);
}

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
#define MOD 1000000007
using namespace std;

int main() {
	int n, m;
	cin >> n;
	vector<int>T(n);
	REP(i, n) {
		cin >> T[i];
	}
	cin >> m;
	vector<int>p(m), x(m);
	REP(i, m) {
		cin >> p[i] >> x[i];
	}
	REP(i,m){
		int time = 0;
		REP(j, n) {
			if (j == p[i] - 1) {
				time += x[i];
			}
			else {
				time += T[j];
			}
		}
		cout << time << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
 
int main(){
  
  int l,r,d;
  cin>>l>>r>>d;
  int count=0;
  for(int i=0;i<=r-l;i++){
    if((l+i)%d==0){
      count++;
    }
  }
  cout<<count<<endl;
  
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int main () {
  int N, K, Q;
  cin >> N >> K >> Q;
  int p[100000];
  int j[100000];
  for (int i = 0; i< N; i++) {
    p[i] = K - Q;
  }
  for (int i = 0; i < Q; i++) {
    int h;
    cin >> h;
    p[h - 1] += 1;
  }
  for (int i = 0; i < N; i++) {
    if (p[i] > 0) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
}

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



int MOD=1000000007;
int main() {
	long long N,S=0,sum=0;
	cin >> N; 
	long long A[N+10];
	for (int i=1; i<=N; i++){
	cin >> A[i]; S+=A[i];
	}
	long long mi=S;
	for (int i=1; i<=N; i++) {
		sum+=A[i];
		mi=min(mi,abs(sum-(S-sum)));
	}
	cout << mi << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
#define N 1299710
using namespace std;

int main(){
  int pn[N]={},n,f,st,end,fst;
  pn[0]=1,pn[1]=1;
  for(int i=2;i<sqrt(N);i++)
    for(int j=2;j*i<N;j++)
      if(pn[i]==0) pn[i*j]=1;
  while(1){
  cin>>n;
  if(n==0) break;
  st=0,end=0,f=0,fst=0;
  while(1){
    if(f==1 || pn[n]==0) break;
    st=0,end=0;
    for(int i=fst;i<N;i++){
           if(i==n) f=1;
      if(pn[i]==0 && st==0) st=i;
      if(pn[i]==0 && st!=i) end=i;
        if(st>0 && end>0){
	fst=end;
	break;
      }
    }
  }
     cout<<end-st<<endl;      
  }
  return 0;
}

Measured memory_bytes: 6244
import java.io.*;
import java.util.*;

public class Main {
  public static void main(String[] args) {
    FastScanner fs = new FastScanner();
    int N = fs.nextInt();
    String S = fs.next();
    System.out.println(S.substring(0, N / 2).compareTo(S.substring(N / 2)) == 0 ? "Yes" : "No");
  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte())
    return buffer[ptr++];
    else
    return -1;
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  public boolean hasNext() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr]))
    ptr++;
    return hasNextByte();
  }

  public String next() {
    if (!hasNext())
    throw new NoSuchElementException();
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public long nextLong() {
    if (!hasNext())
    throw new NoSuchElementException();
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
      throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public int nextInt() {
    long nl = nextLong();
    if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
    throw new NumberFormatException();
    return (int) nl;
  }

  public double nextDouble() {
    return Double.parseDouble(next());
  }
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    string s;
    cin >> s;
    bool mark[26];
    memset(mark, 0, sizeof mark);
    forn(i, sz(s)) mark[s[i] - 'a'] = 1;
    forn(i, 26) {
        if (!mark[i]) {
            char x = i + 'a';
            cout << x << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

using P = pair<ll, ll>;
const int V = 100010;
vector<P> G[V]; // pair<辺の距離, 行き先の頂点> (隣接リスト)
ll dist[V]; // dist[i]はsから頂点iへの最短距離が入る
bool used[V];
void dijkstra(ll s) { // s: 始点
    fill_n(dist, V, 1000000000000000);
    fill_n(used, V, false);
    priority_queue<P, vector<P>, greater<P>> q; // 値が小さい順に取り出されるpriority_queue
    q.push(P(0, s));
    while(!q.empty()) {
        ll d, t; // d: sからの距離 t: 行き先
        tie(d, t) = q.top(); q.pop();
        if (used[t]) continue; // 既に探索済か
        used[t] = true; dist[t] = d;
        for(P e: G[t]){
            if(dist[e.second] <= d+e.first) continue;
            q.push(P(d+e.first, e.second));
        }
    }
}

int main(){
    int N;
    cin >> N;
    N--;
    rep(i, N){
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        G[a].push_back(make_pair(c, b));
        G[b].push_back(make_pair(c, a));
    }
    int Q, K;
    cin >> Q >> K;
    K--;
    vector<int> x(Q), y(Q);
    rep(i, Q){
        cin >> x[i] >> y[i];
        x[i]--; y[i]--;
    }

    dijkstra(K);
    for(int i = 0; i < Q; i++){
        cout << dist[x[i]] + dist[y[i]] << endl;
    }

    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<vector<int>> tree(n, vector<int>());
  rep(i, n-1){
    int a, b;
    cin >> a >> b;
    a--; b--;
    tree.at(a).push_back(b);
    tree.at(b).push_back(a);
  }
  vector<int> c(n);
  rep(i, n) cin >> c.at(i);
  sort(ALL(c), greater<int>());
  ll sum = 0;
  vector<int> ans(n, -1);
  int index = 1;
  ans.at(0) = c.at(0);
  queue<int> q;
  q.push(0);
  while(!q.empty()){
    auto i = q.front(); q.pop();
    for(int nx : tree.at(i)){
      if(ans.at(nx) != -1) continue;
      ans.at(nx) = c.at(index);
      sum += ans.at(nx);
      index++;
      q.push(nx);
    }
  }
  cout << sum << endl;
  rep(i, n){
    if(i != 0) cout << " ";
    cout << ans.at(i);
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N; cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  
  int M = 0;
  rep(i, N) {
    M = (M^a[i]);
  }
  rep(i, N) {
    cout << (M^a[i]) << " ";
  }
  cout << endl;
  

}

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

void ccp(vector<int>& c, int n, int m){
  sort(c.begin(), c.end());
  vector<vector<int> > t(m, vector<int>(n + 1));
  for(int i = 0; i < m; i++){
    t[i][0] = 0;
  }
  for(int j = 0; j <= n; j++){
    t[0][j] = j;
  }
  for(int i = 1; i < m; i++){
    for(int j = 0; j <= n; j++){
      if(j - c[i] < 0) t[i][j] = t[i - 1][j];
      else t[i][j] = min(t[i - 1][j], t[i][j - c[i]] + 1);
    }
  }
  cout << t[m - 1][n] << endl;
  return;
}

void kp(vector<int>& v, vector<int>& w, int N, int W){
  vector<pair<int, int> > k(N);
  for(int i = 0; i < N; i++){
    k[i].second = v[i];
    k[i].first = w[i];
  }
  sort(k.begin(), k.end());
  vector<vector<int> > t(N, vector<int>(W + 1));
  for(int i = 0; i < N; i++){
    t[i][0] = 0;
  }
  for(int i = 0; i <= W; i++){
    if(i >= k[0].first) t[0][i] = k[0].second;
    else t[0][i] = 0;
  }
  for(int i = 1; i < N; i++){
    for(int j = 0; j <= W; j++){
      if(j - k[i].first < 0) t[i][j] = t[i - 1][j];
      else t[i][j] = max(t[i - 1][j], t[i - 1][j - k[i].first] + k[i].second);
    }
  }
  cout << t[N - 1][W] << endl;
}

void solve(){
  int N, W; cin >> N >> W;
  vector<int> v(N), w(N);
  for(int i = 0; i < N; i++){
    cin >> v[i] >> w[i];
  }
  kp(v, w, N, W);
}

int main(){
  solve();
  return 0;
}



Measured memory_bytes: 6792
#include <stdio.h>

int main(void) {
  int x, f[1010], i, j;
  for(i = 0; i <= 1000; ++i) f[i] = 0;
  f[1] = 1;
  for(i = 2; i <= 40; ++i) {
    int n = i * i;
    while(n <= 1000) {
      f[n] = 1;
      n *= i;
    }
  }
  scanf("%d", &x);
  for(i = x; i >= 1; --i) {
    if(f[i]) {
      printf("%d", i);
      return 0;
    }
  }
  return 0;
}

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

using namespace std;

int main()
{
	int x;
	cin >> x;
	int a = x / 500;
	int b = (x % 500) / 5;
	int ans = a * 1000 + b * 5;
	cout << ans;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n;
    cin >> n;
    vi v(n), c(n);
    for(int i=0; i<n; i++){
        cin >> v.at(i);
    }
    for(int i=0; i<n; i++){
        cin >> c.at(i);
    }
    int64_t res = 0;
    for(int i=0; i<n; i++){
        if(v.at(i) > c.at(i)){
            res += v.at(i) - c.at(i);
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
import java.util.List;
import java.util.ArrayList;
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Integer> l = new ArrayList<Integer>();
    while(sc.hasNext()) {
      Integer i = sc.nextInt();
      if(i == 0) {
        System.out.println(l.get(l.size()-1)); 
	l.remove(l.size()-1);
      }
      else {
        l.add(i);
      }
    } 
  }
}

Measured memory_bytes: 26056
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	int nx= 0, ny = 0, nt = 0;
	cin >> N;
	REP(i, N){
		int t, x, y;
		cin >> t >> x >> y;
		int a = abs(nx-x)+abs(ny-y);
		if(a > t-nt || (t-nt-a)%2){
			cout << "No" << endl;
			return 0;
		}
		nx = x; ny = y; nt = t;
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 256
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const s = input[0][0];

  return `${s[0]}${s.length - 2}${s[s.length - 1]}`;
};

console.log(main(read()));


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int64_t N, Y;
  cin >> N >> Y;
  for (int i = 0; i < N + 1; i++) {
    for (int j = 0; j < N + 1; j++) {
      int k = N - i - j;
      if (k < 0) continue;
      if (10000 * i + 5000 * j + 1000 * k == Y) {
        cout << i << ' ' << j << ' ' << k << '\n';
        return 0;
      }
    }
  }
  cout << -1 << ' ' << -1 << ' ' << -1 << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int i;
    long long int count = 0,a,k;
    scanf("%lld",&k);
    a = 0;
    if( k % 2 == 0 || k % 5 == 0)
    {
        printf("-1");
        return 0;
    }
    
    while(1)
    {
        count++;
        a = (a * 10 + 7) % k;
        if(a  == 0)
        {
            printf("%lld\n",count);
            return 0;
        }
        
    }
    
    
    return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }



int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout << fixed;
  
	bitset<64> b(0);
	int q;
	cin >> q;
	while(q--){
		int op;
		cin >> op;
		if(op <= 3){
			int i;
			cin >> i;
			if(op == 0)
				cout << b[i] << '\n';
			else if(op == 1)
				b[i] = 1;
			else if(op == 2)
				b[i] = 0;
			else
				b[i] = 1 - b[i];
		}else if(op == 4){
			bool ok = true;
			for(int i = 0; i < 64; i++)ok &= b[i];
			cout << ok << '\n';
		}else if(op == 5){
			bool ok = false;
			for(int i = 0; i < 64; i++)ok |= b[i];
			cout << ok << '\n';
		}else if(op == 6){
			bool ok = false;
			for(int i = 0; i < 64; i++)ok |= b[i];
			cout << !ok << '\n';
		}else if(op == 7){
			int ans = 0;
			for(int i = 0; i < 64; i++)if(b[i])ans++;
			cout << ans << '\n';
		}else{
			cout << b.to_ulong() << '\n';
		}
	}	
    return 0;
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
int main(int argc, char const *argv[])
{
	ll a,b;
	cin >> a >> b;
	if(a>0){
		printf("Positive\n");
		return 0;
	}else if(a==0 || b==0 || (a<0 && b>0)){
		printf("Zero\n");
		return 0;
	}else{
		int cnt = abs(b-a);
		if(cnt%2==0){
			printf("Negative\n");
		}else{
			printf("Positive\n");
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	string s;
	cin>>s;
	int ans=0,res=0;
	for(int i=0;i<=2;i++)
	{
		if(s[i]=='R')
		{
			ans++;
			res=max(res,ans);
		}
		else ans=0;
	}
	cout<< res <<endl; 
	return 0;
}

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

using namespace std;
const int maxn = 1010;
const int mod = 1e9+7;

int n, m;
char niz[maxn][maxn];
int dp[maxn][maxn];

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++)
		scanf("%s", niz+i);
		
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (niz[i][j] == '#' || (i == 0 && j == 0)) continue;
			int a = 0;
			if (i > 0) a = dp[i - 1][j];
			int b = 0;
			if (j > 0) b = dp[i][j - 1];
			dp[i][j] = a + b, dp[i][j] %= mod;
		}
	}
	printf("%d", dp[n - 1][m - 1]);
	return 0;
}


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

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

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

const int N = 444;

int n,m;
bool in[N][N], good[N];
vector<pii> e;

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

    cin >> n >> m;
    e.resize(m);
    forn(i,m) cin >> e[i].first >> e[i].second;
    reverse(all(e));

    forsn(u,1,n+1) {
        good[u] = 1;
        in[u][u] = 1;
        for (auto xy : e) {
            int x,y; tie(x,y) = xy;
            if (in[u][x] != in[u][y]) {
                if (in[u][x] > in[u][y]) swap(x,y);
                in[u][x] = 1;
            }
            else if (in[u][x]) {
                good[u] = 0;
                break;
            }
        }
    }

    int ans = 0;
    forsn(v,1,n+1) if (good[v]) 
    forsn(u,1,v) if (good[u]) {
        bool ok = 1;
        forsn(w,1,n+1) if (in[u][w] && in[v][w]) {
            ok = 0;
            break;
        }
        //if (ok) cerr << u << ' ' << v << endl;
        ans += ok;
    }
    cout << ans << endl;



    return 0;
}


Measured memory_bytes: 1280
#python3

def main():
    n, m = map(int, input().split())
    a = [input() for _ in range(n)]
    b = [input() for _ in range(m)]
    flag = False

    for i in range(n-m+1):
        for j in range(n-m+1):
            na = []
            for l in a[i:i+m]:
                na.append(l[j:j+m])
                if na == b:
                    flag = True
                

    if flag:
        print('Yes')
    else:
        print('No')
main()


Measured memory_bytes: 3064
#!/usr/bin/env python3
import sys
import collections
from itertools import groupby

def solve(N: int, s: "List[str]"):
    s = [sorted(s[i]) for i in range(N)]
    s.sort()
    group = groupby(s)
    answer = 0
    for _, group in group:
        a = len(list(group))
        answer += int(a*(a-1)/2) if a > 1 else 0
    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 32448
N,x = map(int,input().split())
a = list(map(int,input().split()))

def calc(A,x):
  res = 0
  for i in range(len(A)-1):
    if A[i] + A[i+1] > x:
      if A[i] < x:
        res += A[i+1] - (x - A[i])
        A[i+1] = x - A[i]
      else:
        res += A[i] - x + A[i+1]
        A[i] = x
        A[i+1] = 0
  return res

ar = a[::-1]
print(min(calc(a,x),calc(ar,x)))


Measured memory_bytes: 64068
N=int(input())
*A,=sorted(map(int,input().split()))

def f(x):
 for i in range(x,N,2):
  if A[i-1]!=i or A[i]!=i:
    return False
 return True   
    
a=True
if N%2==0:a=f(1)
else:
 if A[0]!=0:a=False
 else:a=f(2)
print(2**(N//2)%(10**9+7) if a else 0)

Measured memory_bytes: 20496
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;cin >> s;
    for(int i=0;i<s.size();i++){
        int p=s[i]-'A';
        cout << char('A'+(p+23)%26);
    }
    cout << endl;
}


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

namespace _0154
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                int m = RInt();
                if (m == 0) break;

                SortedList<int,int> cards = new SortedList<int, int>();
                for (int i = 0 ; i < m ; i++)
                {
                    int[] items = RIntAr();
                     cards.Add(items[0],items[1]);
                }

                int[,] dp = new int[cards.Count() + 1, 1001];
                dp[0, 0] = 1;

                for (int i = 0 ; i < cards.Count() ; i++)
                {
                    for (int j = 0 ; j <= 1000 ; j++)
                    {
                        for (int k = 0 ; k <= cards.ElementAt(i).Value ; k++)
                        {
                            if (j + k * cards.ElementAt(i).Key > 1000) continue;
                            dp[i + 1, j + k * cards.ElementAt(i).Key] += dp[i, j];
                        }
                    }
                }

                int n = RInt();
                for (int i = 0 ; i < n ; i++)
                {
                    Console.WriteLine(dp[cards.Count(), RInt()]);
                }
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 20700
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pl;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;
int main(){
    string s;
    int n,ans = 0;
    cin>>n>>s;
    rep(i,1000){
        string num = to_string(i);
        while(num.size() < 3) num = "0" + num;
        int index = 0;
        rep(j,n){
            if(s[j] == num[index])index++;
            if(index > 2){
                ans++;
                break;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
 
int main(){
	int tem;
	vector<int> v1;
	for(int i=0;i<5;i++)
		cin >> tem,v1.push_back(tem);
	sort(v1.begin(),v1.end(),greater<int>());
	for(int i=0;i<5;i++)
		cout << (i?" ":"")<< v1[i] ;
	cout << endl;
    return 0;
}

Measured memory_bytes: 1216
n, m = map(int, (input().split()))
tpl_lst = [tuple(map(int, input().split())) for _ in range(m)]

tpl_lst = sorted(tpl_lst, key = lambda x: x[1])

count = 0
last_removed = 0
for tpl in tpl_lst:
    if tpl[0] > last_removed:
        last_removed = tpl[1] - 1
        count += 1
print(count)

Measured memory_bytes: 19016
def pf(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n = int(input())
from collections import Counter 
b = Counter(pf(n))

ans = 0
for i in b:
    a = b[i]
    for i in range(1,30):
        a -= i
        if a < 0:
            break
        ans += 1
        
print(ans)

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

float absss(float a){return (a>=0)?a:-a;}

int main() {
    int n, f = 0;
    cin >> n;
    float a[n],sum = 0.0, ff = 101.0, b;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    sum /= n;
    for(int i = 0; i < n; i++){
        b = absss(a[i] - sum);
        if(b < ff){ff = b; f = i;}
    }
    cout << f << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);

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

  sort(all(a));
  ll minn = a[0];
  ll maxx = a.back();

  ll G = a[0];
  for (int i = 0; i < n; i++) {
    G = __gcd(a[i], G);
  }

  string ans = "IMPOSSIBLE";
  if (k <= maxx && k % G == 0) {
    ans = "POSSIBLE";
  }

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 1024
Var S:String;
    n1,n2:Longint;
Begin
    Readln(S);
    Val(Copy(S,1,2),n1); Val(Copy(S,3,2),n2);
    If (n1<=12) and (n1>0) and (n2<=12) and (n2>0) then writeln('AMBIGUOUS')
    Else begin
        If (n1<=12) and (n1>0) then writeln('MMYY')
        Else if (n2<=12) and (n2>0) then writeln('YYMM')
        Else writeln('NA');
    End;
End.

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
  char a[3];
  int i;
  scanf("%s",a);
  for(i=0;i<2;i++)
    if(a[i]=='9'){
      printf("Yes\n");
      return 0;
    }
  printf("No\n");
}

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

int main(){
   	ios::sync_with_stdio(false);
	cin.tie(0);
    string s;
    int a = 0, b = 0;
	cin >> s;
	for (auto c : s){
        if (c == 'A') a+= 1;
        else b += 1;
    }
    if (a != 3 && b != 3) cout << "Yes";
    else cout << "No";
	return 0;
}

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

using namespace std;

int N, M;
int A[1050], B[1050];
set<int> SA, SB;

long long int MOD = 1000000007;

int check_A[1000006], check_B[1000006];
int num_A[1000006], num_B[1000006];

vector<int> VA, VB;

int main(void) {

	cin >> N >> M;

	long long int ans=0;

	for (int i = 1; i <= N; i++) {
		cin >> A[i]; SA.insert(A[i]);
	}
	if (SA.size() != N) { cout << 0 << endl; return 0; }

	
	for (int i = 1; i <= M; i++) {
		cin >> B[i];
		SB.insert(B[i]);
	}
	if (SB.size() != M) { cout << 0 << endl; return 0; }


	for (int i = 1; i <= N; i++) {
		VA.push_back(A[i]);
	}
	sort(VA.begin(), VA.end());

	for (int i = 1; i <= M; i++) {
		VB.push_back(B[i]);
	}
	sort(VB.begin(), VB.end());

	for (int x = 1; x <= N*M; x++) {
		auto it1 = upper_bound(VA.begin(), VA.end(), x);
		auto it2 = lower_bound(VA.begin(), VA.end(), x);
		check_A[x] = it1 - it2;
		num_A[x] = VA.end() - it2;
	}

	for (int x = 1; x <= N*M; x++) {
		auto it1 = upper_bound(VB.begin(), VB.end(), x);
		auto it2 = lower_bound(VB.begin(), VB.end(), x);
		check_B[x] = it1 - it2;
		num_B[x] = VB.end() - it2;
	}

	ans = 1;
	for (int x = N*M; x >= 1; x--) {
		if ((check_A[x]==1) && (check_B[x] == 1)) { ans *= 1; }
		else if (check_A[x]==1) {
			ans *= num_B[x];
			ans %= MOD;
		}
		else if (check_B[x]==1) {
			ans *= num_A[x];
			ans %= MOD;
		}
		else {
			ans *= (num_A[x]*num_B[x] - N*M + x);
			ans %= MOD;
		}
	}

	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 16000
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　|   _　 _l  
　 　　　／` ミ＿x ノ   Zzz..
　　 　 /　 　 　 |   コード見ちゃだめ！！
　　　 /　 ヽ　　  ﾉ
　 　 │　　|　|  |   
　／￣|　　 |　|  |
　| (￣ヽ＿_ヽ_)_ _)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) reverse((a).begin(),(a).end())
#define REP(i, n) for(int i = 0; i < n; i++)
const int MOD = 1e9+7;
typedef long long ll;

int main() {
	long long N, A, B, C, D, E;
	cin >> N >> A >> B >> C >> D >> E;
	cout << max({ (N - 1) / A, (N - 1) / B, (N - 1) / C, (N - 1) / D, (N - 1) / E }) + 5 << endl;
	return 0;
}


Measured memory_bytes: 256