akhauriyash/Code-Regression huggingface dataset:
//解説AC
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    int N, K; cin >> N >> K;
    string S; cin >> S;

    // 「1 の個数」「0 の個数」を交互に記録していく
    vector<int> nums;    
    if (S[0] == '0') nums.push_back(0); // 先頭が 0 だったら
    for (int i = 0; i < S.size();) {
        int j = i;
        while (j < S.size() && S[j] == S[i]) ++j; // S[i] の数値がどこまで続くか
        nums.push_back(j - i);
        i = j;
    }

    // 累積和
    vector<int> sums((int)nums.size() + 1, 0);
    for (int i = 0; i < nums.size(); ++i) sums[i+1] = sums[i] + nums[i];

    // 偶数番目の添字から始まる、長さ 2K+1 (以下) の区間の総和のうち、最大値を求める
    int res = 0;
    for (int left = 0; left < sums.size(); left += 2) {
        int right = left + K*2+1;
        if (right >= sums.size()) right = (int)sums.size() - 1;
        res = max(res, sums[right] - sums[left]);
    }
    cout << res << endl;
}

Measured memory_bytes: 1272
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <utility>
#include <set>
#include <bitset>

#define mst(a,b) memset(a,b,sizeof(a))
#define scd(x) scanf("%d", &x)
#define scdd(x,y) scanf("%d%d", &x, &y)
#define scddd(x,y,z) scanf("%d%d%d", &x, &y, &z)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double pi = 2*acos(0.0);
const double eps = 1e-6;
const int mod = 1e9+7;
const int N = 40000+5;
const int M = 10000+5;

int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    //std::ios::sync_with_stdio(false);
    //cin.tie(0);
    ll a, b;
    scanf("%lld%lld", &a, &b);
    int cnt = 0;
    while(a <= b){
        a *= 2;
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int h,w;
	cin>>h>>w;
	vector<vector<char> > a(h,vector<char>(w));
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cin>>a[i][j];
		}
	}

	int ans = 0;
	int cnt = 0;
	queue<P> que;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(a[i][j] == '#'){
				que.push(P(i,j));
				cnt++;
			}
		}
	}

	while(cnt < h*w){
		ans++;
		queue<P> q;
		while(!que.empty()){
			P p = que.front();que.pop();
			for(int i = max(p.first-1,0); i <= min(p.first+1,h-1); i++){
				if(a[i][p.second] == '.'){
					a[i][p.second] = '#';
					q.push(P(i,p.second));
					cnt++;
				}
			}
			for(int i = max(p.second-1,0); i <= min(p.second+1,w-1); i++){
				if(a[p.first][i] == '.'){
					a[p.first][i] = '#';
					q.push(P(p.first,i));
					cnt++;
				}
			}
		}

		while(!q.empty()){
			P p = q.front();q.pop();
			que.push(p);
		}
	}

	cout << ans << endl;

	return 0;
}

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

const int MAX = 200000;
const int MAX2 = 2147483647;

int main() {
	static int N, A[MAX];
	cin >> N;
	for (int i = 0;i < N;++ i) cin >> A[i];
	sort(A, A+N);

	int ans = 0;
	for (int i = 1 << 30;i > 1;i >>= 1) {
		for (int j = 0, k = N - 1;j < k;) {
			if (A[j] < 0) {
				++ j;
				continue;
			}
			if (A[k] < 0) {
				-- k;
				continue;
			}
			if (A[j] + A[k] < i) ++ j;
			else if (A[j] + A[k] > i) -- k;
			else {
				A[j] = A[k] = -1;
				++ ans;
			}
		}
	}
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

一番大きい方から貪欲に確定でACという電波を受信した
*/

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cstdlib>

const int N = 2e5 + 7;
inline int min(int a, int b) { return a < b ? a : b; }

int n, ans, a[N];
int mx1, mx2, t1, t2, buc1[N], buc2[N];

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", a + i);
	for (int i = 1; i <= n; i += 2) buc1[a[i]]++;
	for (int i = 1; i <= n; i += 2) if (buc1[a[i]] > mx1) mx1 = buc1[a[i]], t1 = a[i];
	for (int i = 2; i <= n; i += 2) buc2[a[i]]++;
	for (int i = 2; i <= n; i += 2) if (buc2[a[i]] > mx2) mx2 = buc2[a[i]], t2 = a[i];
	if (t1 != t2) ans += n / 2 - mx1 + n / 2 - mx2;
	else
	{
		int mx = 0, t;
		for (int i = 1; i <= n; i += 2) if (buc1[a[i]] <= mx1 && a[i] != t1 && buc1[a[i]] > mx) mx = buc1[a[i]], t = a[i];
		ans = n / 2 - mx + n / 2 - mx2;
		mx = 0, t;
		for (int i = 2; i <= n; i += 2) if (buc2[a[i]] <= mx2 && a[i] != t2 && buc2[a[i]] > mx) mx = buc2[a[i]], t = a[i];
		ans = min(ans, n / 2 - mx1 + n / 2 - mx);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }
int n;
vector<ll> a,sum;
ll dp[410][410];

ll DP(int l,int r){
    if(dp[l][r]>=0) return dp[l][r];
    if(l==r) return dp[l][r]=0;
    ll ret=LINF;
    for(int k=l;k<r;k++){
        chmin(ret,DP(l,k)+DP(k+1,r));
    }
    ret+=sum[r+1]-sum[l];
    return dp[l][r]=ret;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    rep(i,410)rep(j,410) dp[i][j]=-1;

    cin>>n;
    a.resize(n);sum.resize(n+1,0);
    rep(i,n) cin>>a[i];
    rep(i,n) sum[i+1]=sum[i]+a[i];
    cout<<(DP(0,n-1))<<endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll H, W; cin >> H >> W;
  ll N; cin >> N;
  vector<ll> a(N); rep(i, N) cin >> a[i];

  vector<vector<ll>> c(H, vector<ll>(W));
  ll cnt = 0;
  ll cc = 0;
  rep(i, H) rep(j, W) {
    c[i][i%2==0?j:W-j-1] = cc + 1;
    cnt ++;
    if(cnt >= a[cc]) {
      cnt = 0;
      cc ++;
    }
  }

  rep(i, H) {
    rep(j, W) {
      cout << c[i][j] << " ";
    }
    cout << endl;
  }
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3844
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;

#define Endl endl


/*--------------------template--------------------*/


int main() {
    cin >> n;
    vi v(2 * n);
    REP(i, 2 * n) {
        cin >> v[i];
    }
    sort(ALL(v));
    REP(i, 2*n) {
        ans += min(v[i], v[i + 1]);
        i++;
    }
    cout << ans << Endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  bool b = false;
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  for(int i = 0; i < N-1; i++) {
    if(A.at(i) == A.at(i+1)) {
      b = true;
      break;
    }
  }
  if(b == true) {
    cout << "NO" << endl;
  }
  else {
    cout << "YES" << endl;
  }
}


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

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if(c >= a && c <= b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;

int main(void){
	vector< vector<bool> > vb = vector< vector<bool> >( 4, vector<bool>(13, true));
	int n;
	cin >> n;
	for(int i = 0;i < n; ++i){
		char c;
		int x;
		cin >> c >> x;
		switch(c){
		case 'S':
			vb[0][x-1] = false;
			break;
		case 'H':
			vb[1][x-1] = false;
			break;
		case 'C':
			vb[2][x-1] = false;
			break;
		case 'D':
			vb[3][x-1] = false;
			break;
		}
	}
	for(int i = 0;i < 4; ++i){
		for(int j = 0;j < 13; ++j){
			if(vb[i][j]){
				switch(i){
					case 0:
						cout << "S " << (j+1) << endl;
						break;
					case 1:
						cout << "H " << (j+1) << endl;
						break;
					case 2:
						cout << "C " << (j+1) << endl;
						break;
					case 3:
						cout << "D " << (j+1) << endl;
						break;
				}
			}
		}
	}	

	return 0;
}

Measured memory_bytes: 1196
H,W=map(int,input().split())
D=[]
c=[0]*W
n=[]
for i in range(H):
  a=input()
  d=0
  for j in range(W):
    if a[j]==".":
      c[j]+=1
      d+=1
  if d!=W:
    D.append(a)
for x in range(W):
  if c[x]==H:
    n.append(x)
for y in range(len(D)):
  for z in range(W):
    if z not in n:
      print(D[y][z],end="")
  print("")


Measured memory_bytes: 9152
def lscan; gets.split.map(&:to_i); end


L, R = lscan

if L % 2019 == 0 || R % 2019 == 0
  p 0
  exit 0
end

if L / 2019 < R / 2019
  p 0
  exit 0
end

best = 2019
(L..R).to_a.combination(2) do |l, r|
  best = [best, l*r%2019].min
end

p best



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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int func(int n){
    int cnt = 0;
    while(n){
        if(n%2 == 0){
            cnt++;
            n /= 2;
        }
        else{
            break;
        }
    }
    return cnt;
}
int main(){

    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }

    sort(v.rbegin(), v.rend());
    int ans = 0;
    for(int i = 0; i < k; i++){
        ans += v[i];
    }
    cout << ans << endl;
    
    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()
#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  cin >> n;

  if (n == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  } else if (n == 23) {
    cout << "Christmas Eve Eve" << endl;
  } else if (n == 24) {
    cout << "Christmas Eve" << endl;
  } else if (n == 25) {
    cout << "Christmas" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 200000


main(){


  int i,n,rieki,money;
  int a[N];
  
  
  scanf("%d",&n);
  
  for(i = 0; i < n; i++){
    
    scanf("%d",&a[i]);
    
    if(rieki < a[i]-money){
      rieki = a[i] - money;
    }
    
    if(money > a[i]){
       money = a[i];
       }
    
    
    if(i == 0){
      money = a[i];
      rieki = -a[i];
    }
    
  }
  
  printf("%d\n",rieki);
  
  
  
  return 0;
}

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

int main() {
  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  sort(a.begin(), a.end(), greater<ll>());
  ll ans = 0;
  bool frag = true;
  int cnt = 0;
  while (cnt < n-1) {
    if (a[cnt]==a[cnt+1] && frag) {
      ans = a[cnt];
      frag = false;
      cnt+=2;
    }
    if (a[cnt]==a[cnt+1] && !frag) {
      ans *= a[cnt];
      break;
    }
    cnt++;
  }
  cout << ans << endl;
}


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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

typedef long long ll; 
typedef long double ld;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
typedef pair<ll,ll>pi; typedef pair<ll,pi>spi; typedef pair<pi,pi>dpi;

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (206)
ll n,A[MAXN],dp[MAXN][MAXN],mod=1e9+7,ans=1,no[MAXN];
vector<ll> d;
vector<pi> range;
int main(){
	FAST
	cin>>n;
	FOR(i,1,n)cin>>A[i];
	auto qexp=[&](ll x,ll e){
		ll sum = 1;
		while(e){
			if(e&1) sum*=x, sum%=mod;
			x*=x,x%=mod;
			e>>=1;
		}
		return sum;
	};
	auto calc2=[&](ll x){
		return qexp(2,x+1) - 1;
	};
	auto calc=[&](ll x,ll y){
		return (calc2(y) + mod - calc2(x-1))%mod;
	};
	FOR(i,1,n){
		if(A[i]==1) A[i]=0, ans *= 2, ans %= mod;
	}
	FOR(i,1,n)if(A[i]>A[i-1]&&A[i]>A[i+1]){
		ans*=qexp(2,A[i]-max(A[i-1],A[i+1])),ans%=mod;
		A[i]=max(A[i-1],A[i+1]);
	}
	FOR(i,1,n)if(A[i]) d.eb(A[i]),d.eb(A[i]+1);
	d.eb(ll(1e9) + 1);
	d.eb(1);
	d.eb(2);
	sort(all(d)), d.resize(unique(all(d))-d.begin());
	assert(d[0]==1);
	FOR(i,1,siz(d)-1) range.eb(d[i-1]+1,d[i]);
	FOR(j,0,siz(range)-1)if(range[j].s<=A[1]){
		dp[1][j] = calc(A[1]-range[j].s, A[1]-range[j].f) * 2 % mod;
	}
	no[1]=A[1]>0 ? 2 : 1;
	FOR(i,2,n){
		FOR(j,0,siz(range)-1)if(range[j].s<=A[i]){
			dp[i][j] += dp[i-1][j] * qexp(2, max(0ll, A[i]-A[i-1])) % mod, dp[i][j] %= mod;
			if(range[j].f > A[i-1]) dp[i][j] += no[i-1] * 2 % mod * calc(A[i]-range[j].s, A[i]-range[j].f) % mod, dp[i][j] %= mod;
		}
		FOR(k,0,siz(range)-1)if(range[k].f>A[i]){
			no[i] += dp[i-1][k] * (A[i] > 0 ? 2 : 1) % mod, no[i] %= mod;
		}
		no[i] += no[i-1] * (A[i]>0 ? 2 : 1) % mod, no[i] %= mod;
	}
	ll sum = 0;
	FOR(j,0,siz(range)-1) sum += dp[n][j], sum%=mod;
	sum += no[n], sum %= mod;
	sum *= ans, sum %= mod;
	cout<<sum<<'\n';
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void) {
	int X;
	int i;
	if (scanf("%d", &X) != 1) return 1;
	for (i = 0; 100 * i <= X; i++) {
		int kitaeri = X - 100 * i;
		if(0 <= kitaeri && kitaeri <= 5 * i) {
			puts("1");
			return 0;
		}
	}
	puts("0");
	return 0;
}


Measured memory_bytes: 1648
# coding: utf-8
# 79
N=[]

while True:
    try:
        N.append(int(input()))
    except:
        break

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n+ 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

s = primes(max(N))

for k in N:
    A=len([x for x in s if x <= k])
    print(A)



Measured memory_bytes: 16420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define vec(x) vector<x>
#define IINF INT_MAX
#define LLINF LLONG_MAX
ll gcd(ll a,ll b){while(b){ll tmp = a % b;a = b;b = tmp;}return a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
#define rep(x, y) for(int x = 0; x < (y); x++)
#define REP(x, z, y) for(int x = (z); x < (y); x++)
#define all(x) x.begin(), x.end()
#define split_str(str, sp_word) istringstream stream(str); string res; for(int cnt = 0; getline(stream,res,sp_word); cnt++)
#define digit(x) ((int)log10((double)(x)) + 1)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define out(x) for(auto i : x) cout << i << " "; cout << endl;
#define outln(x) for(auto i : x) cout << i << " " << endl;
#define vec_cpy(to,from) copy(all(to),back_inserter(from))
#define ary_cpy(to,from) memcpy(to, from, sizeof from)
#define MOD 1000000007
#define DEBUG true

int main(){
  int d,l; cin >> d >> l;
  cout << d / l + (d % l == 0 ? 0 : d % l) << endl;
  return 0;
}

Measured memory_bytes: 3092
n = int(input())
a = list(map(int, input().split()))
is_even = list(map(lambda x:x%2==0, a))
counter = 0
while is_even.count(False) == 0:
    a = list(map(lambda x:x/2, a))
    counter+=1
    is_even = list(map(lambda x:x%2==0, a))

print(counter)
    


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

bool isSmallAlpha(char c){
	return 'a' <= c && c <= 'z';
}

void encode(std::string& str, int s){
	for(int i=0; i < str.size(); i++){
		if(isSmallAlpha(str[i])){
			str[i] = (str[i] - 'a' + s) % 26 + 'a';
		}
	}
}

int main() {
	std::string s;
	while(std::getline(std::cin, s)){
		for(int i = 0; i < 26; i++){
			encode(s, 1);
			if(s.find("the") != std::string::npos ||
			   s.find("that") != std::string::npos ||
			   s.find("this") != std::string::npos){
				std::cout << s << std::endl;   	
			}
		}
	}
	return 0;
}

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

string s;

int main() {
  cin >> s; int l = s.size();
  int res = 1000000;
  for(char c = 'a'; c <= 'z'; ++c) {
    int n = 0; int k = l;
    for(int i = l - 1; i >= 0; --i) {
      if(s[i] == c) k = i;
      n = max(n, k - i);
    }
    res = min(res, n);
  }
  printf("%d\n", res);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
    int A, B;
    cin >> A >> B;
    if (A * B % 2 == 0)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
    return 0;
}

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

// int/long:		-2147483648 - 2147483648 (-2^31 <= int < 2^31)
// long/long long:	-9223372036854775808 - 9223372036854775807 (-2^63 <= long < 2^63)
#define	INF (1<<29)
//536870912

#define	MOD 1000000007

int	main() {
	int N, M;
	cin >>N >>M;
	vector<int> x(M);
	vector<int> y(M);
	for (int i=0; i<M; i++)
		cin >>x.at(i) >>y.at(i);
	vector<int> B(N+1, 1);
	B.at(1)=-1;
	for (int i=0; i<M; i++) {
		int X=x.at(i);
		int Y=y.at(i);
		if (B.at(X)<0) {
			B.at(X)++;
			B.at(Y)=-abs(B.at(Y))-1;
		} else {
			B.at(X)--;
			if (B.at(Y)<0)
				B.at(Y)--;
			else
				B.at(Y)++;
		}
	}
	int S=0;
	for (int i=1; i<=N; i++)
		if (0>B.at(i))
			S++;
	cout <<S <<endl;
	return 0;
}



Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int ans[31];
int main(){
    int n,m;
    cin >> n >> m;
    int k;
    int a;
    for(int i=0;i<n;i++){
        cin >> k;
        for(int j=0;j<k;j++){
            cin >> a;
            ans[a-1]++;
        }
    }
    int count=0;
    for(int i=0;i<m;i++)if(ans[i]==n)count++;
    cout << count << endl;
}

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

using namespace std;

typedef long long LL;
typedef long double LD;



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

  if (S == "Sunny") {
    cout << "Cloudy";
  }
  else if (S == "Cloudy") {
    cout << "Rainy";
  }
  else {
    cout << "Sunny";
  }

  return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
#define iso ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
using namespace std;
int main()
{ iso
    ll n,s=0,w=0;
    cin>>n;
    vector<ll>vec;
    while(n--)
    {
        ll x;
        cin>>x;
        vec.push_back(x);
        s+=x;
    }

    for(int i=0;i<vec.size();i++)
    {
        s-=vec[i];
        s%=1000000007;
        w+=s%1000000007*(vec[i]%1000000007);
        w%=1000000007;
        while(w<0)
        {
            w+=1000000007;
        }
        w%=1000000007;
    }
    cout<<w<<"\n";

    return 0;
}


Measured memory_bytes: 5308
#include<iostream>
#include<stdio.h>
#include<string>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<stdlib.h>
#include<time.h>
#include<assert.h>
using namespace std;
const int INF=1e9;
int n,d[100];
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&d[i]);
    sort(d,d+n);
    int prev=INF,ans=0;
    for(int i=n-1;i>=0;i--){
        if(d[i]<prev){
            prev=d[i];
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

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

int main()
{
    int K,s;
    scanf("%d%d",&K,&s);
    int i,j,k;
    int nu=0;
    for(j=0;j<=K;j++)
        for(k=0;k<=K;k++)
        {
            i=s-j-k;
            if(i>=0&&i<=K)
                nu++;
        }
    printf("%d",nu);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int64_t MOD=10000007;

int main() {
  vector<int> S={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int N;
  cin>>N;
  cout<<S.at(N-1);
  
  

  
  
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cmath>
#include <functional>
#include <chrono>
#include <cstring>
#include <limits.h>

using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<lint> vl;
typedef pair<lint,lint> pll;


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

    lint a; cin>>a;
    double b; cin>>b;
    lint b100 = int(100*b + 0.5);
    cout<<a*b100/100;

}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long    ll;
typedef pair<ll,ll>  pll;
typedef pair<ll, pair<int, int> > plll;
typedef vector<long long>  vll;
typedef vector<pll>  vp;
typedef long double ld;
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
// #define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007LL
// #define h 998244353
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p)
{
  ll res = 1;
  x = x % p;
  while (y > 0)
  { 
    if (y & 1) 
      res = (res*x) % p;
    y = y>>1;
    x = (x*x) % p;
  } 
  return res; 
} 
const int MAXN = 2e5+5;

// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
const double eps=1e-8;
int dblcmp(double d){if (fabs(d)<eps)return 0;return d>eps?1:-1;}
ll euclid(ll x,ll y,ll a,ll b)
{
  return (a-x)*(a-x)+(b-y)*(b-y);
}
// Constants //
void solve()
{
  ld r;
  cin>>r;
  cout.precision(12);
  cout<<fixed<<M_PI*2*r<<endl;
}
int main()
{ 
  // ios;
  // freopen("inputt.txt", "w", stdout);
  ll t,i;
  t=1;

  while(t--)
    solve();
  return 0;
}

Measured memory_bytes: 3768
#include<bits/stdc++.h>
using namespace std;
typedef struct{
  int parent,left,right;
}node;

node tree[30];
int n;

void preset(int i){
  for(int j=0;j<i;j++)
    tree[j].parent=tree[j].left=tree[j].right=-1;
  return;
}

void preorder(int now){
  
  cout << " " << now;
  if(tree[now].left!=-1)
    preorder(tree[now].left);
  if(tree[now].right!=-1)
    preorder(tree[now].right);
 
  return;
}

void inorder(int now){

  if(tree[now].left!=-1)
    inorder(tree[now].left);
  cout << " " << now;
  if(tree[now].right!=-1)
    inorder(tree[now].right);

  return;
}

void postorder(int now){
  
  if(tree[now].left!=-1)
    postorder(tree[now].left);
  if(tree[now].right!=-1)
    postorder(tree[now].right);
  cout << " " << now;

  return;
}

main()
{

  int id,left,right;
  int root;

  cin >> n;
  preset(n);
  for(int i=0;i<n;i++){
    cin >> id >> left >> right;
    tree[id].left=left;
    tree[id].right=right;
    
    if(left!=-1)
      tree[left].parent=id;
    if(right!=-1)
      tree[right].parent=id;
    
  }

  for(int i=0;i<n;i++){
    if(tree[i].parent==-1)
      root=i;
  }

  cout << "Preorder" << endl;
  preorder(root);
  cout << endl;

  cout << "Inorder" << endl;
  inorder(root);
  cout << endl;

  cout << "Postorder" << endl;
  postorder(root);
  cout << endl;

  return (0);
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define MAX_INT 2100000000
#define rep(i,n) for (i=1;i<=(n);++i)
using namespace std;
typedef long long int ll;
#ifdef COMPILE_IN_VCPP
#include <windows.h>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
	HWND hwndFound;         // This is what is returned to the caller.
	char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated// WindowTitle.
	char pszOldWindowTitle[MY_BUFSIZE]; // Contains original// WindowTitle.
	ULARGE_INTEGER nt;
	nt.QuadPart = GetTickCount64();
	GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
	wsprintf(pszNewWindowTitle, "%d%d/%d", nt.HighPart, nt.LowPart, GetCurrentProcessId());
	SetConsoleTitle(pszNewWindowTitle);
	Sleep(40);
	hwndFound = FindWindow(NULL, pszNewWindowTitle);
	SetConsoleTitle(pszOldWindowTitle);
	return(hwndFound);
}
#endif
ll mod = 1e9 + 7;
ll countr(vector<string> a)
{
	vector<ll> c;
	int n=1;
	ll ans = 0;
	for (int i = 0; i < a.size() - 1; i++)
	{
		if (a[i] != a[i + 1])
		{
			c.push_back(n);
			n = 1;
		}
		else n++;
	}
	c.push_back(n);
	for (int i = 0; i < c.size(); i++)
	{
		ans += c[i] * (c[i]-1) / 2;
		printf("%d\n", c[i]);
	}
	return ans;
}
int main()
{
	int n, a[100 + 10];
	int i, j, k;
	double ans = 0;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> a[i];
		ans += 1 / (double)a[i];
	}
	cout << 1 / ans << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));
//		String[] words = br.readLine().toLowerCase().split(" ");
		String[] words = br.readLine().split(" ");

		int maxlen = 0;
		int maxfreq = 1;
		String lenans = words[0];
		String freqans = words[0];
		HashMap<String, Integer> frequency = new HashMap<>();
		for (int i=0; i < words.length; i++) {
			if (words[i].length() > maxlen) {
				maxlen = words[i].length();
				lenans = words[i];
			}

			Integer n;
//			if ( frequency.containsKey(words[i]) ){
//				int n = frequency.get(words[i]);
//				frequency.replace(words[i], n+1);
//			}
			if (  ( n = frequency.get(words[i]) ) == null  ) {
				frequency.put(words[i], 1);
			} else {
				n++;
				frequency.replace(words[i], n);
				if (n > maxfreq) {
					maxfreq = n;
					freqans = words[i];
				}
			}
		}

		System.out.println(freqans + " " + lenans);
	}

}

Measured memory_bytes: 24084
n = int(input())
A = list(map(int, input().split()))
count = 0
conti = 0
last = None
for _ in A:
    if _ == last:
        conti += 1
        if conti % 2 == 1:
            count += 1
    else:
        conti = 0
    last = _
print(count)


Measured memory_bytes: 2940
from sys import stdin
from collections import defaultdict
from math import sqrt

def main():
    input = stdin.readline

    h = defaultdict(int)
    h[2] = 1
    for i in range(3, 100000, 2):
        for j in range(3, int(sqrt(i)) + 1, 2):
            while i % j == 0:
                h[j] = 1
                i //= j
        if i > 1:
            h[i] = 1
    k = [0] * 100001
    for key in h.keys():
        if (key + 1) / 2 in h and h[(key + 1) / 2] == 1:
            k[key] = 1
    for i in range(1, 100001):
        k[i] += k[i - 1]
    q = int(input())
    for _ in range(q):
        l, r = map(int, input().split())
        print(k[r] - k[l - 1])
main()

Measured memory_bytes: 7904
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>
using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;
const int INF = 1e9;
 
long long gcd(long long x, long long y){
			if (x==0)return y;
      if(y==0)return x;
      if(x<y){
				long long temp = x;
			x = y;
				y = temp;
			}
			long long r = x % y;
				while(r!=0){
					x = y;
					y = r;
				r = x % y;
	    		}
			return y;
	    }

   
int main(){
long long cnt[100001] = {};
int N;
cin >> N;
int ans = 0;
for(int i = 0; i< N; i++){
	long long x;
	cin >> x;
	if(x>100000)ans++;
	else{
		cnt[x]++;
	}
}
for(int i = 0; i <=100000;i++){
	if(cnt[i] != 0 && cnt[i] != i){
		if(cnt[i] > i)ans += cnt[i]-i;
		else ans+= cnt[i];
	}
}
cout << ans << endl;

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int A,B,C,D,E,F;
    cin>>A>>B>>C>>D>>E>>F;
    
    double con=0.0;
    int sumw=100*A,sums=0;
    for(int a=0;a<=30;a++){
        for(int b=0;b<=30;b++){
            for(int c=0;c<=ceil((double)F/C);c++){
                for(int d=0;d<=ceil((double)F/D);d++){
                    int tmpw=100*A*a+100*B*b;
                    int tmps=C*c+D*d;
                    if(tmpw+tmps<=F && tmps*100<=tmpw*E && con<(double)tmps/(tmpw+tmps)){
                        con=(double)tmps/(tmpw+tmps);
                        sumw=tmpw;
                        sums=tmps;
                    }
                }
            }
        }
    }

    cout<<sumw+sums<<" "<<sums<<endl;
}


 

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

using namespace std;

const long long MOD = (long long)1e9 + 7;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }
    sort(rbegin(a), rend(a));
    sort(rbegin(b), rend(b));
    bool f = true;
    for(int i = 1; i < n; i++){
        if(a[i - 1] == a[i]) f = false;
    }
    for(int i = 1; i < m; i++){
        if(b[i - 1] == b[i]) f = false;
    }
    long long mx = n * m;
    if(a[0] != mx || b[0] != mx) f = false;
    if(!f){
        cout << 0 << endl;
        return 0;
    }
    long long ans = 1;
    long long x = 0, y = 0;
    for(int i = mx; i >= 1; i--){
        while(x < n - 1 && a[x + 1] >= i) x++;
        while(y < m - 1 && b[y + 1] >= i) y++;
        if(a[x] != i && b[y] != i){
            ans *= max((x + 1) * (y + 1) - (mx - i), 0LL);
        }else if(a[x] == i && b[y] != i){
            ans *= y + 1;
        }else if(a[x] != i && b[y] == i){
            ans *= x + 1;
        }
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
 int a;
  cin >> a;
  for(int i = 0; i < 3; i++){
  if(a%10==7){
   cout << "Yes" << endl;
    return 0;
  }
    a=a/10;
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3100
#include<iostream>
#include<stack>
using namespace std;
string str;

bool solve(){
  stack<char> st;
  for(int i=0;i<(int)str.size();i++){
    if(str[i]=='(')st.push(str[i]);
    else if(str[i]=='[')st.push(str[i]);
    else if(str[i]==')'){
      if(st.empty())return false;
      if(st.top()!='(')return false;
      st.pop();
    }else if(str[i]==']'){
      if(st.empty())return false;
      if(st.top()!='[')return false;
      st.pop();
    }
  }
  return st.empty();
}

int main(){
  while(1){
    getline(cin,str);
    if(str==".")break;
    if(solve())cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a[ohara],b[ohara],c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,q;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
V g[ohara];
bool vi[ohara];
int ok=0;
V kaeri[ohara];
    
//------ Believe yourself as a genius!!!!!! ------

void dfs(ll moto,ll now,ll dat1[],ll dat_cou){
    if(ok)return;
    if(vi[moto]&&moto==now){
        int akan=0;
        int dat[n+10]={};
        rep(i,dat_cou){
            dat[dat1[i]]=1;
        }
        rep(i,dat_cou){
            ans=dat1[i];
            cnt=0;
            rep(j,Size(g[ans])){
                ll to=g[ans][j];
                if(dat[to]==1)cnt++;
            }
            //if(moto==0)cout<<moto<<" "<<cnt<<"\n";
            if(cnt==1)continue;
            akan=1;
        }
        rep(i,dat_cou){
            ans=dat1[i];
            cnt=0;
            rep(j,Size(kaeri[ans])){
                ll to=kaeri[ans][j];
                if(dat[to]==1)cnt++;
            }
            //if(moto==0)cout<<moto<<" "<<cnt<<"\n";
            if(cnt==1)continue;
            akan=1;
        }
        if(akan)return;
        //出力
        ok=1;
        Cout(dat_cou);
        rep(i,dat_cou){
            ans=dat1[i];
            Cout(ans+1);
        }
        return ;
    }
    if(vi[now])return;
    vi[now]=true;
    dat1[dat_cou]=now;
    rep(i,Size(g[now])){
        ll to=g[now][i];
        dfs(moto,to,dat1,dat_cou+1);
    }
}
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n>>m;
    rep(i,m){
        cin>>a[i]>>b[i];
        a[i]--;b[i]--;
        g[a[i]].p_b(b[i]);
        kaeri[b[i]].p_b(a[i]);
    }
    ll isao[m+10]={};
    rep(i,n){
        rep(j,n)vi[j]=false;
        dfs(i,i,isao,0LL);
    }
    if(!ok)Cout(-1);
    return 0;
}

Measured memory_bytes: 53760
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define FF first
#define SS second
#define f(a,b,c) for(int a=b;a<=c;a++)
#define fd(a,b,c) for(int a=b;a>=c;a--)
#define fspr(X) fixed<<setprecision(X)

const ll MOD=1e9+7;

//bool visited[1001][1001];
//char graph[1000][1000];
//int ans=0;
//bool path=false;
ll power(ll x, ll y , ll z)       // returns (x^y)%z
{
	ll res=1,num=x;
	while(y>0)
	{
		if(y&1)res=(res*num)%z;
		num=(num*num)%z;
		y=y>>1;
	}
	return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    double h,a;cin>>h>>a;
    cout<<ceil(h/a);
}

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

#define for0(i, n) for (ll i = 0; i < (ll)(n); ++i) // 0 based indexing
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (ll i = (ll)(l); i <= (ll)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (ll i = (ll)(n); i >= 1; --i) // reverse 1 based

#define ff first
#define ss second
#define pb push_back

	ll n;
ll func(char x){
	if( (ll)x+n > 'Z' ){
		return (ll) x + n -26;
	}
	return (ll)x + n;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	string s;
	cin >> s;
	for0(i,s.length()){
		s[i] = (char)func(s[i]);
	}
	cout << s <<endl;
	return 0;
}


Measured memory_bytes: 256
M,D = map(int,input().split())

ans = 0
for m in range(M+1):
    for d in range(10,D+1):
        d1,d2 = d // 10,d % 10
        if m == d1 * d2 and d1 >= 2 and d2 >= 2:
            ans += 1

print(ans)


Measured memory_bytes: 2940
import sys
INFTY=sys.maxsize

def readinput():
    n,k=list(map(int,input().split()))
    h=list(map(int,input().split()))
    return n,k,h

def main(n,k,h):
    dp=[INFTY]*n
    dp[0]=0
    for i in range(n):
        for j in range(1,k+1):
            if i+j<n:
                dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))
    return dp[n-1]

if __name__=='__main__':
    n,k,h=readinput()
    ans=main(n,k,h)
    print(ans)


Measured memory_bytes: 84868
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;

int main(){
  int n,k; cin >> n >> k;
  int ans = 1;
  for(int i = 0; i < n; i++) ans = min(ans*2, ans+k);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split())
P = list(map(int,input().split()))
for i in range(N):
    P[i] -= 1
C = list(map(int,input().split()))
ans = max(C)
for i in range(N):
    p = i
    d = []
    while True:
        p = P[p]
        d.append(C[p])
        if p == i:
            break
    #print(d,sum(d))
    val = 0
    for j in range(min(K,len(d))):
        val += d[j]
        ans = max(ans,val)
        #print(val,i,j)



    if K > len(d):
        k = K % len(d)
        val = (K//len(d)) * sum(d)
        ans = max(ans,val)
        for j in range(k):
            val += d[j]
            ans = max(ans,val)

        val = (K//len(d)-1) * sum(d)
        for j in range(len(d)):
            val += d[j]
            ans = max(ans,val)

print(ans)


Measured memory_bytes: 80812
#include <bits/stdc++.h>
using namespace std;
const int N=100000+10;
int n,m,dp[N],up[N];
vector<int> g[N];
int ans=0,pre[N],suf[N];
void dfs1(int u,int p){
    dp[u]=1;
    for(auto v:g[u]){
        if(v==p) continue;
        dfs1(v,u);
        dp[u]=1LL*dp[u]*(dp[v]+1)%m;
    }
    //printf("dp[%d]=%d\n", u,dp[u]);
}
void dfs2(int u,int p){
    vector<int> vec,pre,suf;
    for(auto v:g[u]){
        if(v==p)continue;
        vec.push_back(v);
    }
    pre.resize(vec.size());
    suf.resize(vec.size());
    if(vec.size()){

        pre[0]=(dp[vec[0]]+1);
        for(int i=1;i<vec.size();i++) pre[i]=1LL*pre[i-1]*(dp[vec[i]]+1)%m;
        suf[(int)vec.size()-1]=(dp[vec[(int)vec.size()-1]]+1);

        for(int i=(int)vec.size()-2;i>=0;i--) suf[i]=1LL*suf[i+1]*(dp[vec[i]]+1)%m;

        for(int i=0;i<vec.size();i++){
            up[vec[i]]=1+1LL*(i>=1?pre[i-1]:1)*((i+1<vec.size())?suf[i+1]:1)%m*up[u]%m;
        }
    }
    for(auto v:g[u]){
        if(v==p)continue;
        dfs2(v,u);
    }
}
int main() {
    scanf("%d%d",&n,&m);
    for(int i=1;i<n;i++){
        int x,y; scanf("%d%d",&x,&y);
        g[x].push_back(y); g[y].push_back(x);
    }
    dfs1(1,1); up[1]=1; dfs2(1,1);
    for(int i=1;i<=n;i++){
        printf("%lld\n", 1LL*dp[i]*up[i]%m);
    }
}


Measured memory_bytes: 27904
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

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

    int N, A, B;
    cin >> N >> A >> B;
    if(abs(A-B-1)%2) puts("Alice");
    else puts("Borys");
    return 0;
}

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

int main() {

	std::string a, b;
	std::cin >> a >> b;

	int N = a.length();
	int M = b.length();

	std::sort(a.begin(),a.end());

	std::sort(b.begin(), b.end());
	std::reverse(b.begin(), b.end());

	if (a < b) std::cout << "Yes" << std::endl;
	else std::cout << "No" << std::endl;

}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val Q = sc.nextInt

  // int型でいけるか微妙?
  for (i <- 0 until Q) {
    val a = sc.nextLong
    val b = sc.nextLong
    val m = a * b
    val s :Long = (Math.sqrt(a * b)).toLong

    var ans :Long = 2 * s - 1

    if (s * (s + 1) >= m) {
      ans -= 1
    }
    if (s * s == m & a != b) {
      ans -= 1
    }
    println(ans)
  }
}

Measured memory_bytes: 27456
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

# sys.setrecursionlimit(100000)
input = sys.stdin.buffer.readline
INF = 2**62-1


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


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    b = Counter()
    for a in A:
        b[a] += 1

    return '\n'.join(map(str, [b[i] for i in range(1, N+1)]))


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 44412
#include <cstdio>
#include <tr1/unordered_set>
using namespace std;
int a[50000],b[50000],o[50000];
int main(){
	int H,W,q;
	while(scanf("%d%d%d",&H,&W,&q)&&H){
		int ans = 0;
		for(int i = 0 ; i < q ; i++)
			scanf("%d%d%d",&a[i],&b[i],&o[i]);
		tr1::unordered_set<int> g[2];
		for(int i = q-1 ; i >= 0 ; i--){
			if(!g[a[i]].count(b[i]) && o[i]) ans += (a[i]?H:W) - g[!a[i]].size();
			g[a[i]].insert(b[i]);			
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 0
#include<stdio.h>
int main(){
  int i,j;
  char a[20001]={1,1};
  for(i=2;i*i<20001;i++){
    if(a[i]==0){
      for(j=2;i*j<20001;j++){
	a[i*j]=1;
      }
    }
  }
  int n;
  while(1){
    scanf("%d",&n);
    if(!n)break;
    for(i=n;a[i-2]||a[i];i--);
    printf("%d %d\n",i-2,i);
  }
  return 0;
}
    

Measured memory_bytes: 624
/*ITP1_6_C:Official House*/
#include <iostream>
using namespace std;

int main() 
{
  int count[4][3][10]={0}; 
  int n,b,f,r,v;
  cin >> n;

  for(int i=0;i<n;i++){
    cin >> b >> f >> r >> v;
    count[b-1][f-1][r-1] += v;
  }

  for(int i=0;i<4;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<10;k++){
        cout << " " << count[i][j][k];
      }   
      cout << endl; 
    }   
    if( i!=3 )
      cout << "####################" << endl;
  }

  return 0;
}



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

int main(){
  int n;
  cin >> n;
  int p[n];
  int count=0;
  for (int i=0;i<n;i++) {
    cin >> p[i];
    if (p[i]!=i+1){
      count++;
    }
  }
  if (count==2 || count==0){
    cout << "YES";
  } else {
    cout << "NO";
  }
}


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

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

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

const int MAX_N = (2e+5)+10;
vec nCm(MAX_N+1,0);
vec fact(MAX_N+1,0),fact_inv(MAX_N+1,0);

ll fastpow(ll a, ll pw) {
	ll res = 1;
	while (pw) {
		if (pw & 1) res = res * a % MOD;
		a = a * a % MOD;
		pw >>= 1;
	}
	return res;
}
void makefact(ll n){//MODは素数かつnより大きい
    ll ans = 1;
    fact.at(0) = ans;
    fact_inv.at(0) = ans;
    reps(i,1,n+1){
        (ans *= i)%=MOD;
        fact.at(i) = ans;
        fact_inv.at(i) = fastpow(ans,MOD-2);
    }
    return;
}
void makenCm(ll n){
    rep(i,n+1){
        ll ans = fact.at(n);
        (((ans*=fact_inv.at(n-i))%=MOD)*=fact_inv.at(i))%=MOD;
        nCm.at(i) = ans;
    }
    return;
}


int main() {
    cin>>H>>W>>A>>B;
    makefact(200010);
    if(H - A < W - B){
        swap(H, W);
        swap(A, B);
    }
    vec route(W - B);
    makenCm(H - A + B - 1);
    rep(i, W - B) route.at(i) = nCm.at(i + (H - A) - (W - B));
    /*rep(i, W - B) {
        if(route.at(i) == 0) {
            cout<<i<<endl;
            break;
        }
    }*/
    makenCm(W - B + A - 1);
    rep(i, W - B) (route.at(W - B - 1 - i) *= nCm.at(W - B - i - 1))%=MOD;
    ll ans = 0;
    rep(i, W - B) (ans += route.at(i))%=MOD;
    cout<<ans<<endl;
}

Measured memory_bytes: 5632