akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <list>
#include <iomanip>
#include <queue>
#include <cmath>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;
typedef pair<ll, ll> p;
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 long long mod = 1e9 + 7;
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);


int main() {
	ll h, w, k;
	cin >> h >> w >> k;

	vector<vector<ll>> s(h, vector<ll>(w));
	vector<ll> b(h, 0);

	char tmp;

	rep(i, h) {
		rep(j, w) {
			cin >> tmp;
			if (tmp == '#') {
				s[i][j] = 1;
				b[i]++;
			}
		}
	}

	vector<vector<ll>> ans(h, vector<ll>(w));
	ll cnt = 0;
	bool flag;

	rep(i, h) {
		if (b[i] == 1) {
			cnt++;
			rep(j, w) {
				ans[i][j] = cnt;
			}
		}	
		if (b[i] > 1) {
			flag = false;
			cnt++;
			rep(j, w) {
				if (s[i][j] == 1) {
					if (flag) cnt++;
					else flag = true;
				}
			ans[i][j] = cnt;
			}
		}
	}

	repl(i, 1, h) {
		if (b[i] == 0) {
			cnt = 0;
			rep(j, w) {
				ans[i][j] = ans[i - 1][j];
				cnt += ans[i - 1][j];
			}
			if (cnt > 0) b[i] = 1;
		}
	}

	for (ll i = h - 2; i >= 0; i--) {
		if (b[i] == 0) {
			rep(j, w) {
				ans[i][j] = ans[i + 1][j];
			}
			b[i] = 1;
		}
	}


	rep(i, h) {
		rep(j, w) {
			cout << ans[i][j] << " ";
		}
		cout << endl;
	}

	return 0;
}

ll gcd(ll a, ll b) {
	if (a % b == 0)return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

Measured memory_bytes: 5060
N=int(input())
p=list(map(int,input().split()))

temp=0
ans=0
for i in range(N):
    if p[i]==i+1:
        temp+=1
    else:
        if temp%2==0:
            ans+=temp//2
        else:
            ans+=temp//2+1
        temp=0

if temp%2==0:
    ans+=temp//2
else:
    ans+=temp//2+1

print(ans)



Measured memory_bytes: 14008
import functools


@functools.lru_cache(maxsize=None)
def rec(l, r):
    # [l, r)
    if l+1 == r:
        return 0
    ret = INF
    for mid in range(l+1, r):
        ret = min(ret, rec(l, mid) + rec(mid, r) + R[l] * R[mid] * C[r-1])
    return ret

INF = 10**9
N = int(input())
R, C = [], []
for i in range(N):
    r, c = map(int, input().split())
    R.append(r), C.append(c)
print(rec(0, N))

Measured memory_bytes: 9276
#include <bits/stdc++.h>
#define isFile 0
#define NAME "taskA"
#define scan 1
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;

#define mp make_pair
#define pb push_back
#define fr first
#define sc second

#define ins insert
#define all(v) v.begin(), v.end()
#define rep(i,a,n) for (int i=a;i<n;i++)
#define bit(n, i) (n >> i) & 1
#define bpc(x) __builtin_popcountll(x)
#define rev(a) reverse(all(a))
#define skip continue
#define read(a) for(auto &i : a) cin >> i
#define print(a) for(auto i : a) cout << i << ' '
#define unique(a) sort(all(a));    a.resize(unique(all(a)) - a.begin())

//                D  R  U   L
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

void faster() {
    if (isFile) {
        freopen(NAME".in", "r", stdin);
        freopen(NAME".out", "w", stdout);
    }
    if (scan) {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    }
}

const ll  INF = 1e18;
const int inf = 2e9;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const ld  PI = acos(-1);
const ld  EPS = 3E-16;
const int ALPHA = 27;
const int N = (int)1e3 + 5;
const int M = 123;

int n, m;
ll dp[N][N];
int a[N][N];

void solve() {
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            char x;
            cin >> x;
            a[i][j] = (x == '.');
        }
    }

    dp[1][1] = 1;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if (i == j && i == 1)
                skip;

            if (a[i][j])
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
        }
    }

    cout << dp[n][m] % MOD << endl;
}

int main() {
    faster();
    int t = 1;
//    cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 12032
//2018.10.24

#include <iostream>
using namespace std;

int main() {

    int n,m,x;
    cin >> n >> m >> x;

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

    int cd = 0, cu = 0;
    for(i=x;i<n+1;i++){
        for(j=0;j<m;j++){
            if(i==a[j])cu++;
        }
    }
    for(i=x;i>=0;i--) {
        for (j = 0; j < m; j++) {
            if (i == a[j])cd++;
        }
    }

    if(cd>cu)cout << cu << endl;
    else cout << cd << endl;
}


Measured memory_bytes: 256
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
p=n1()
m=p[0]
c=1
for i in range(1,n):
    a=p[i]
    if m>=a:
        c+=1
        m=a
print(c)   

Measured memory_bytes: 25716
# 2019-11-23 01:28:44(JST)
import sys
from string import ascii_lowercase as alphabet


def main():
    n, s, k = sys.stdin.read().split()
    n, k = map(int, [n, k])

    c = s[k-1]
    for l in alphabet:
        if l != c:
            s = s.replace(l, '*')
    
    print(s)
    

if __name__ == '__main__':
    main()


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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int i,j,k,n,a[12]={1,6,9,36,81,216,729,1296,6561,7776,46656,59049},w[100001]={0};
	for (i=0;i<12;i++){
		w[a[i]]=1;
	}
	for (i=2;i<=100000;i++){
		if (w[i]!=1){
			int t=1000000000;
			for (j=0;j<12;j++){
				if (a[j]<i){
			    	t=min(t,w[i-a[j]]);	
				}
				else {
					break;
				}
			}
			w[i]=t+1;
		}
	}
	cin>>n;
	cout<<w[n];
	return 0;
}

Measured memory_bytes: 640
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pli pair<ll, int> 
#define pdd pair<ld, ld> 
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 1000000007
using namespace std;

ll solve(string &s, int st, int en, int modulo, ll mult, ll dp[][13]){
	if(st > en){
		if(modulo == 5)
		return 1;
		else
		return 0;
	}
	if(dp[en][modulo] != -1)
	return dp[en][modulo];
	ll so = 0;
	if(s[en] != '?'){
		so += solve(s, st, en - 1, (modulo + (s[en] - 48) * mult) % 13, (mult * 10) % 13, dp);
		so %= mod;
	}
	else{
		for(int i = 0; i < 10; i++){
			so += solve(s, st, en - 1, (modulo + i * mult) % 13, (mult * 10) % 13, dp);
			so %= mod;
		}
	}
	return dp[en][modulo] = so;
}

int main(){
    FASTIO
    string s;
    cin >> s;
    int n = s.size();
    ll dp[n][13];
    reset(dp, -1);
    cout << solve(s, 0, n - 1, 0, 1, dp);
    
    return 0;
}

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

int main()
{
	auto gcd = [](int64_t a, int64_t b) {
		while (b)
		{
			int64_t tmp = b;
			b = a % b;
			a = tmp;
		}
		return a;
	};

	int64_t n;
	cin >> n;
	vector<int64_t> as(n);
	for (auto &a : as)
	{
		cin >> a;
	}

	vector<int64_t> gs(n), hs(n);
	gs[0] = as[0];
	hs[n - 1] = as[n - 1];
	for (int64_t i = 1; i < n; i++)
	{
		gs[i] = gcd(gs[i - 1], as[i]);
		hs[n - i - 1] = gcd(hs[n - i], as[n - i - 1]);
	}

	int64_t g = accumulate(as.begin(), as.end(), as[0], gcd);

	int64_t ans = max({g, hs[1], gs[n - 2]});
	for (int64_t i = 1; i < n - 1; i++)
	{
		ans = max(ans, gcd(gs[i - 1], hs[i + 1]));
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;
import java.util.stream.IntStream;

class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		int n=s.nextInt(),m=s.nextInt();
		int[]a=IntStream.range(0,m).map(i->s.nextInt()).sorted().toArray();
		for(int i=m-1;i>0;--i)
			a[i]-=a[i-1];
		System.out.println(IntStream.range(1,m).map(i->a[i]).sorted().limit(Math.max(0,m-n)).sum());
	}
}

Measured memory_bytes: 52944
#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <array>
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <utility>
#include <assert.h>
#include <regex>
using namespace std;

typedef unsigned long long ull;
typedef signed long long ll;
#define INF (1LL << 48)

struct PT { ll x; ll y; };
string to_s(ull x) { return to_string(x); }
string to_s(ll x) { return to_string(x); }
ll to_ll(const string& x) { return stoll(x); }
ull to_ull(const string& x) { return stoull(x); }




int main(int argc, char* argv[])
{
	for (;;) {
		string S;
		cin >> S;
		if (cin.fail()) break;

		S = std::regex_replace(S, std::regex("eraser?"), "");
		S = std::regex_replace(S, std::regex("dream(er)?"), "");
		puts(S.empty() ? "YES" : "NO");
	}

	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N = 1e6;
const double PI = acos(-1.0);
#define Test ll tesnum;tesnum = read();while(tesnum--)
ll read();

int main()
{
    int n;
    cin>>n;
    cout<<n+n*n+n*n*n<<endl;
    return "BT7274", NULL;
}

inline ll read() {
    ll hcy = 0, dia = 1;char boluo = getchar();
    while (!isdigit(boluo)) {if (boluo == '-')dia = -1;boluo = getchar();}
    while (isdigit(boluo)) {hcy = hcy * 10 + boluo - '0';boluo = getchar();}
    return hcy * dia;
}

Measured memory_bytes: 3620
// unolight {{{
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(c) begin(c),end(c)
#define REP(i,n) for ( int i=0; i<(int)(n); i++ )
#define REP1(i,a,b) for ( int i=(int)(a); i<=(int)(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;

void RI() {}

template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}

template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }

// }}}
int MAX_N = 105;
int n;
void input() {
    RI(n);
}

void solve() {
	int bb = 1e9, ans = 0;
	REP(i, n) {
		int b;
		if(i == n-1){
			ans+=bb;
		} else {
			RI(b);
			ans+=min(bb,b); bb=b;
		}
	}
	printf("%d\n", ans);
}

int main( int argc, char *argv[] ) {
	input(); solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N, c1, c2(0);
  cin >> N;
  int A[N];
  for(int i(0);i<N;i++) cin >> A[i];
  
  do{
    c1=0;
    for(int i(0);i<N;i++){
      if(A[i]%2==0) c1++;
    }
    if(c1==N){
      for(int i(0);i<N;i++) A[i] /= 2;
      c2++;
    }
  }while(c1==N);
  cout << c2;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) {a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) {a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

long long dp[100010];

int main() {
  int N; cin >> N;
  for (int i = 0; i < 100010; ++i) dp[i] = INF;
  
  dp[0] = 0;
  
  for (int n = 1; n <= 100010; ++n) {
    int power = 1;
    while (power <= n) {
      dp[n] = min(dp[n], dp[n-power] + 1);
      power *= 6;
    }
	power = 1;
    while (power <= n) {
      if (power != 1)
      dp[n] = min(dp[n], dp[n-power] + 1);
      power *= 9;
    }
  }
  
    cout << dp[N] << endl;
    
    return 0;
}

Measured memory_bytes: 1024
n, x = map(int, input().split())
a = list(map(int, input().split()))
if a[0] > x:
    ans = a[0] - x
    a[0] = x
else:
    ans = 0
for i in range(n - 1):
    if a[i] + a[i + 1] > x:
        #print("OK3")
        diff = (a[i] + a[i + 1]) - x
        ans += diff
        a[i + 1] -= diff
    #print(a)

print(ans)

Measured memory_bytes: 14052
import copy
N,M = map(int,input().split())
A = [int(i) for i in input().split()]
A.sort()
A_copy = copy.deepcopy(A)
CB = []
for i in range(M):
    b,c = map(int,input().split())
    CB.append([c,b])
CB.sort(reverse = True)
tmp = 0
for c,b in CB:
    for i in range(b):
        if tmp+i >= N:
            print(sum(A))
            exit()
            
        if A_copy[tmp+i]<c:
            A[tmp+i] = c
        else:
            break
    tmp += b
print(sum(A))


Measured memory_bytes: 26616
def move_a(y,x,count):
    count += 1
    li[x][y] = "#"
    if li[x-1][y] == ".":
        count = move_a(y,x-1,count)
    if li[x+1][y]== ".":
        count = move_a(y,x+1, count)
    if li[x][y-1]== ".":
        count = move_a(y-1,x, count)
    if li[x][y+1]== ".":
        count = move_a(y+1,x, count)
    return count

while True:
    yoko, tate = map(int,raw_input().split())
    if yoko == 0 and tate == 0:
        break
    li = []
    rec_list = []
    count = 0
    li.append(["#"] * (yoko + 2))

    for i in range(tate):
        temp = raw_input()
        temp = "#" + temp +"#"
        li.append(list(temp))
    li.append(["#"]*(yoko+2))
    for i in li:
        if '@' in i:
            a_posx,a_posy = i.index('@'),li.index(i)
    print move_a(a_posx,a_posy,count)

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

int main(){
   std::string S;
   std::cin >> S;
   int nzero = 0;
   for (size_t i=0; i<S.size(); i++){
      if (S.at(i) == '0'){
         nzero++;
      }
   }
   int none = S.size() - nzero;
   std::cout << 2 * std::min(nzero, none) << std::endl;

}



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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

const int V=500*500;

int H,W,N;
// ????????????????????????
int p[V];

// ???????????????1?¬???????
inline int cv(int y, int x)
{
    return y*W+x;
}

// ?¬???????????????????
int f[20][V];

int main()
{
    scanf(" %d %d %d", &H, &W, &N);

    rep(i,H)rep(j,W)
    {
        int r,c;
        scanf(" %d %d", &r, &c);
        f[0][cv(i,j)] = cv(r,c);
    }
    rep(i,N)
    {
        int r,c;
        scanf(" %d %d", &r, &c);
        p[i] = cv(r,c);
    }

    for(int i=1; i<20; ++i)rep(j,V) f[i][j] = f[i-1][f[i-1][j]];

    int l=0,r=H*W+1;
    while(r-l>1)
    {
        int m=(l+r)/2;
        vector<int> ct(V,0);
        rep(i,N)
        {
            int now = p[i];
            rep(j,20)if(m>>j&1) now = f[j][now];

            ++ct[now];
        }

        bool ok=true;
        rep(i,V)if(ct[i]>1) ok=false;

        if(ok) l=m;
        else r=m;
    }

    if(r==H*W+1) r=-1;
    printf("%d\n", r);
    return 0;
}

Measured memory_bytes: 24632
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <functional>
#include <array>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long int ull;
typedef vector<int> vi;
#define rep(i,a,n) for(int i = (a);i < (n);i++)
#define per(i,a,n) for(int i = (a);i > (n);i--)
#define lep(i,a,n) for(int i = (a);i <= (n);i++)
#define pel(i,a,n) for(int i = (a);i >= (n);i--)
#define all(v) (v).begin(),(v).end()
#define clr(a,b) memset((a),(b),sizeof(a))
#define sz size()
#define pb push_back
#define print(x) cout << x << endl
#define INF 1e+9
int a[51],b[51];
int n,m,ans;
int par[100];
int uni_rank[100];

void init(int num){
  lep(i,0,num){
    par[i] = i;
    uni_rank[i] = 0;
  }
}

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

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y)return;
  if(uni_rank[x] < uni_rank[y])par[x] = y;
  else{
    par[y] = x;
    if(uni_rank[x] == uni_rank[y])uni_rank[x]++;
  }
  return;
}

bool same(int x,int y){
  return find(x) == find(y);
}

int main(){
  cin >> n >> m;
  rep(i,0,m){
    cin >> a[i] >> b[i];
  }
  rep(i,0,m){
    int sum = 0;
    init(n);
    rep(j,0,m){
      if(i != j){
        unite(a[j],b[j]);
      }
    }
    lep(j,1,n){
      if(same(1,j) == true){
        sum++;
      }
    }
    if(sum != n)ans++;
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 256
N = int( input())
A = list( map( int, input().split()))
A.sort()
l = -1
r = N-1
while r - l > 1:
    m = (l+r)//2
    now = sum(A[:m+1])
    check = 1
    for i in range(m+1,N):
        if A[i] <= now*2:
            now += A[i]
        else:
            check = 0
            break
    if check == 1:
        r = m
    else:
        l = m
print(N-r)

Measured memory_bytes: 14224
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10 ** 7)

# input & solve
input = sys.stdin.readline
N, Q = map(int, input().split())

to = [[] for _ in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)

ans = [0] * N
for i in range(Q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x

def dfs(v, p=-1):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)

dfs(0)

# output
print(*ans)


Measured memory_bytes: 268432
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<math.h>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
#include<unordered_map>
#include<list>
#include<fstream>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
const ll E=1e18+7;
#define F first
#define S second
#define MK make_pair
const ll MOD=1000000007;



int main(){
    ll n,m;
    cin>>n>>m;
    vector<bool> k(n,true);
    for(int i=0;i<m;i++){
        ll a,b;
        cin>>a>>b;
        k[a]=!k[a];
        k[b]=!k[b];
    }
    for(int i=0;i<n;i++){
        if(!k[i]){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    
    return 0;
}


Measured memory_bytes: 256
input = gets.chomp
a = input.split(" ")[0].to_i
b = input.split(" ")[1].to_i
c = input.split(" ")[2].to_i

if (0 <= a && a <= 100) && (0 <= b && b <= 100) && (0 <= c && c <= 100)
  if a < b && b < c
    puts "Yes"
  else
    puts "No"
  end
else
  return
end



Measured memory_bytes: 6868
#include<stdio.h>


#define N 100
#define MAX 500000

int main(){

  int i,j,l,k,n,p[N+1],m[N+1][N+1];

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d %d",&p[i-1],&p[i]);
  }

  for(i=1;i<=n;i++){
    m[i][i]=0;
  }

  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j = i+l-1;
      m[i][j]=MAX;
      for(k=i;k<=j-1;k++){
	if(m[i][j]>m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]){
	m[i][j]=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
	}
      }
    }
  }

  printf("%d\n",m[1][n]);

  return 0;
}

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

class Square {
public:
    int x, y;
    void setXY(const int nx, const int ny) {
        x = nx;
        y = ny;
    }
};

int main() {
    const int directions[][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}, };
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        Square* squares = new Square [n];
        squares[0].setXY(0, 0);
        for (int i = 1; i < n; i++) {
            int nearby, d;
            cin >> nearby >> d;
            int nx = squares[nearby].x + directions[d][0],
                ny = squares[nearby].y + directions[d][1];
            squares[i].setXY(nx, ny);
        }
        int maxX, maxY, minX, minY;
        maxX = minX = squares[0].x;
        maxY = minY = squares[0].y;
        for (int i = 1; i < n; i++) {
            if (maxX < squares[i].x) {
                maxX = squares[i].x;
            } else if (squares[i].x < minX) {
                minX = squares[i].x;
            }
            if (maxY < squares[i].y) {
                maxY = squares[i].y;
            } else if (squares[i].y < minY) {
                minY = squares[i].y;
            }
        }
        cout << maxX - minX + 1 << " " << maxY - minY + 1 << endl;
        delete[] squares;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

struct Sieve {
    int n;
    vector<int> f, primes;
    Sieve(int n = 1) : n(n), f(n + 1) {
        f[0] = f[1] = -1;
        for (ll i = 2; i <= n; ++i) {
            if (f[i]) continue;
            primes.push_back(i);
            f[i] = i;
            for (ll j = i * i; j <= n; j += i) {
                if (!f[j]) f[j] = i;
            }
        }
    }
    bool isPrime(int x) {
        return f[x] == x;
    }
    vector<int> factorList(int x) {
        vector<int> res;
        while (x != 1) {
            res.push_back(f[x]);
            x /= f[x];
        }
        return res;
    }
    vector<pair<int, int>> factor(int x) {
        vector<int> fl = factorList(x);
        if (fl.size() == 0) return {};
        vector<pair<int, int>> res(1, pair<int, int>(fl[0], 0));
        for (int p : fl) {
            if (res.back().first == p) {
                res.back().second++;
            } else {
                res.emplace_back(p, 1);
            }
        }
        return res;
    }
};

int main() {
    int N;
    cin >> N;
    Sieve sieve(N);

    map<int,ll> mp;
    for (int i = 1; i <= N; ++i) {
        for (auto [e0, e1] : sieve.factor(i)) {
            mp[e0]+=e1;
        }
    }

    ll ans = 1;
    for(auto [f,s]:mp){
        ans*=(s+1);
        ans%=((ll)1e9+7);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <string>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define f first
#define s second
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define eb emplace_back
#define in insert
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define FOR(i, n, x) for(int i = x; i < n; i++)
#define OUT(a, e) FOR(i, e, 0) cout << a[i] << ' '
#define OUTV(a) for(auto i : a) cout << i << ' ';
#define maxim(a, n, mx) FOR(i, n, x)mx = max(mx, a[i]);

using namespace std;
vector<ll> pr;

int main()
{
    int n; cin >> n;
    cout << (n - 1) / 2;
	return 0;
}
/*
3 1000000000000000000 1000000000000000000 1000000000000000000
*/


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

#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)

template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }

using namespace std;

int main(int argc, char** argv) 
{
#ifdef HOME
	if(IsDebuggerPresent())
	{
		freopen("../in.txt", "rb", stdin);
		freopen("../out.txt", "wb", stdout);
	}
#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout << fixed;
	constexpr uint32_t mod = 1e9 + 7;
	uint32_t N;
	string s;
	cin >> N >> s;
	vector<uint32_t> dp(N), dp2(N);
	dp[0] = 1;
	function<void(uint32_t&, uint32_t)> addMod = [&mod](uint32_t& a, uint32_t b) {
		a = a + b;
		if (a >= mod)
			a -= mod;
	};
	forn(i, s.length())
	{
		fill(all(dp2), 0);
		uint32_t su = 0;
		if (s[i] == '<')
		{
			fore(j, 0, i)
			{
				addMod(su, dp[j]);
				dp2[j+1] = su;
			}
		}
		else
		{
			ford(j, i+1)
			{
				addMod(su, dp[j]);
				dp2[j] = su;
			}
		}
		dp.swap(dp2);
	}
	uint32_t ans = 0;
	for (auto d : dp)
		addMod(ans, d);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n,m = gets.chomp.split(' ').map(&:to_i)

a = gets.chomp.split(' ').map(&:to_i)

homework = 0
b = a.length

for i in 0...b do
  if(homework > n)
    break
  else
    homework += a[i]
  end
end

if(homework > n)
x = -1
else
x = n - homework
end

puts x


Measured memory_bytes: 14696
//============================================================================
// Name        : KeisanTest.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int a,b;
	string op;
	while(1){
		cin>>a>>op>>b;
		if(op=="+"){
			cout<<a+b<<endl;
		}
		else if(op=="-"){
			cout<<a-b<<endl;
		}
		else if(op=="*"){
			cout<<a*b<<endl;
		}
		else if(op=="/"){
			cout<<a/b<<endl;
		}
		if(op=="?")break;
	}

}



Measured memory_bytes: 3132
sente=input()
n=len(sente)
nt=int((n-1)/2)
nb=int((n+3)/2)
#print(nt,nb)
#print(sente[nb:n])
if sente == sente[::-1]:
    if sente[0:nt] == sente[0:nt][::-1]:
        #print(sente[0:nt])
       
        if sente[nb-1:n]==sente[nb-1:n][::-1]:
            #print(sente[nb-1:n])

            print('Yes')
        else:
            print('No')
            
    else:
        print('No')
        
else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <utility>

using namespace std;
using ll = long long int;

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

	vector<int> ue(N+1),sita(N+1);
	for (int i = 1; i <= N; i++) {
		int x; cin >> x;
		ue[i] = ue[i - 1] + x;
	}
	for (int i = 1; i <= N; i++) {
		int x; cin >> x;
		sita[i] = sita[i - 1] + x;
	}
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		ans = max(ans, ue[i] + sita[N] - sita[i - 1]);
	}

	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define ll long long
using namespace std;
const int N = 3e5 + 5;
const int mod = 1e9 + 7;
int n, ans, ord, p[N], dep[N], cnt[N];
int fa[N][20], loc[N], s[N], st;
vector<int> G[N], V[N], E[N];
void dfs(int x) {
	loc[x] = ++ord;
	for (int i = 0; i < G[x].size(); i++) {
		int u = G[x][i];
		dep[u] = dep[x] + 1;
		dfs(u);
	}
}
ll Pow(ll a, int x) {
	ll res = 1;
	while (x) {
		if (x & 1) {
			res = res * a % mod;
		}
		a = a * a % mod;
		x >>= 1;
	} 
	return res;
}
bool cmp(int i, int j) {
	return loc[i] < loc[j];
}
int getlca(int x, int y) {
	//if (x == n + 1 || y == n + 1) return n + 1;
	if (dep[x] < dep[y]) swap(x, y);
	for (int i = 19; i >= 0; i--) {
		if (dep[fa[x][i]] >= dep[y]) {
			x = fa[x][i];
		}
	}
	if (x == y) return x;
	for (int i = 19; i >= 0; i--) {
		if (fa[x][i] != fa[y][i]) {
			x = fa[x][i];
			y = fa[y][i];
		}
	}
	return fa[x][0];
}
pair<int, int> val[N];
pair<int, int> cal(int x) {
	if (E[x].size() == 0) return val[x] = mk(1, 1);
	pair<int, int> res = mk(0, 0);
	int tmp = 1, tmp1 = 1, tot = 1;
	for (int i = 0; i < E[x].size(); i++) {
		//tmp = cal(E[x][i]);
		//tmp1.second = ((ll)res.first * tmp.second + (ll)res.second * tmp.first) % mod;
		//tmp1.first = ((ll)res.first * tmp.first + (ll)res.second * tmp.second) % mod;
		//res = tmp1;
		cal(E[x][i]);
		tmp = (ll)tmp * val[E[x][i]].first % mod;
		tmp1 = (ll)tmp1 * val[E[x][i]].second % mod;
		tot = (ll)tot * (val[E[x][i]].first + val[E[x][i]].second) % mod;
	}
	for (int i = 0; i < E[x].size(); i++) {
		res.second += Pow(val[E[x][i]].first, mod - 2) * tmp % mod * val[E[x][i]].second % mod;
		res.second %= mod;
	}
	res.first = (tot + mod - res.second) % mod;
	return val[x] = res;
}
void clear(int x) {  
	for (int i = 0; i < E[x].size(); i++)
		clear(E[x][i]);
	E[x].clear();
}
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		scanf("%d", p + i);
		fa[i][0] = p[i];
		G[p[i]].push_back(i);	
	}
	dfs(0);
	for (int i = 0; i <= n; i++) {
		cnt[dep[i]]++;
		V[dep[i]].push_back(i);
	}
	for (int i = 1; i < 20; i++) {
		for (int j = 0; j <= n; j++) {
			fa[j][i] = fa[fa[j][i - 1]][i - 1];
		}
	}
	ans = Pow(2, n);
	for (int i = 1; i <= n; i++) {
		if (V[i].size() == 0) continue;
		sort(V[i].begin(), V[i].end(), cmp);
		st = 0;
		s[st++] = 0; // root 		
		for (int j = 0; j < V[i].size(); j++) {
			int x = V[i][j];  
			int lca = getlca(x, s[st - 1]);
			while (st > 1 && loc[lca] < loc[s[st - 2]]) {
				--st;
				//addedge(s[st - 1], s[st]);
				E[s[st - 1]].push_back(s[st]);
				//cout << s[st - 1] << "/" << s[st] << endl;
			}
			if (s[st - 1] != lca) {
				--st;
				//addedge(lca, s[st]);
				E[lca].push_back(s[st]);
				//cout << lca << "/" << s[st] << endl;
				if (s[st - 1] != lca) s[st++] = lca;
			}
			s[st++] = x;
		}
		while (st > 1) {
			--st;
			//addedge(s[st - 1], s[st]);
			E[s[st - 1]].push_back(s[st]);
			//cout << s[st - 1] << "/" << s[st] << endl;
		}
		pair<int, int> tmp = cal(0);
		(ans += (ll)tmp.second * Pow(2, n + 1 - cnt[i]) % mod) %= mod;
		clear(0);
		//cout << ans << endl << endl;
	}
	cout << ans;
}

Measured memory_bytes: 67456
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    set<int> s;
    rep(i, n){
        int e; cin >> e;
        s.insert(e);
    }
    cout << s.size() << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// const ll INF = 1LL <<60;
// const int INF = 10000;

//最大公約数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

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

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}

long long modpow(long long res,long long a, long long n, long long mod) {
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
// ここから開始
int main(){
    int x,y;
    cin>>x>>y;
    vector<pair<int,int> > p;
    for(int i = 0; i < 1e6+1; i++){
      int j = ((x+y)/3-i);
      if(0<=j&&j<=1e6&&(x+y)%3==0&&i+2*j==x&&2*i+j==y){
        // cout<<i<<" "<<j<<endl;
        p.push_back(make_pair(i,j));
      }
    }
    ll sum = 0;
    COMinit();
    for(int i = 0; i < p.size(); i++){
      int x = p[i].first;
      int y = p[i].second;
      sum+=COM(x+y,y);
      sum%=MOD;
    }
    cout<<sum<<endl;
    return 0;
}



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


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    ll k, n; 
    cin>>k>>n;
    vector<ll> dist(2*n+5, 0);
    for(ll i = 1; i<=n; i++){
        cin>>dist[i];
        dist[n+i] = k+dist[i];
    }
    
    ll ans = 2*k + 5;
    for(ll i = 1, j = n; j<=2*n; i++, j++){
        ans = min(dist[j]-dist[i], ans);
    }
    cout<<ans<<"\n";
    return 0;
}

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

using namespace std;

using ll = long long;

int main() 
{
	ll n, m; cin >> n >> m;
	vector<ll> dp(n, 0);
	for (ll i = 0; i < m; i++)
	{
		ll e; cin >> e;
		dp[e - 1] = 1;
	}
	dp[0] = (dp[0] ? 0 : 1);
	dp[1] = (dp[1] ? 0 : dp[0] + 1);
	for (ll i = 2; i < n; i++)
		if (dp[i])
			dp[i] = 0;
		else
			dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007;
	cout << dp[n - 1];
	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
const int NMAX = 100000;
struct energizante
{
  long long pret;
  int nrmax;
};
bool cmp(energizante a, energizante b)
{
  return a.pret < b.pret;
}
energizante v[NMAX + 1];
int main()
{
  int n , m;
  long long sum = 0;
  scanf("%d%d" , &n , &m);
  for(int i = 1; i <= n ; i ++)
    scanf("%lld%d" , &v[i].pret , &v[i].nrmax);
  sort(v + 1 , v + n + 1 , cmp);
  int i = 1;
  while(m)
  {
    sum += v[i].pret * min(v[i].nrmax , m);
    m = max(0 , m - v[i].nrmax);
    i ++;
  }
  printf("%lld" , sum);
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

bool ispalim(string s) {
	int n = s.length(), i, j, k;
	for (i = 0; i < n; i++) {
		if (s[i] != s[n - 1 - i]) return false;
	}
	return true;
}

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

	string s, s1, s2;
	cin >> s;
	int n = s.length(), i, j, k;
	s1 = s.substr(0, (n - 1) / 2);
	s2 = s.substr((n + 1) / 2);

	if (ispalim(s) && (ispalim(s1) && (ispalim(s2)))) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}


Measured memory_bytes: 256
N = gets.to_i
A = gets.split(" ")
B = gets.split(" ")
C = gets.split(" ")

score = 0
a_before = -1
A.each do |a|
  a = a.to_i
  score = score + B[a-1].to_i

  if a == a_before + 1
    score = score + C[a-2].to_i
  end 
  a_before = a
end

puts score

Measured memory_bytes: 1788
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int l=sc.nextInt();
		int min=Integer.MAX_VALUE;
		int sum=0;
		for(int i=0; i<n; i++){
			sum+=l+i;
			if(Math.abs(l+i)<Math.abs(min)){
				min=l+i;
			}
		}
		System.out.println(sum-min);
	}
}


Measured memory_bytes: 21972
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}

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

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

const double EPS = 1e-10;

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

	REP(i, str.size()) {
		str[i] = ((str[i]-'A')+23)%26+'A';
	}

	cout << str << endl;

	return 0;
}

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

int main()
{
    string s;
    int k,f=0;
    cin>>s;
    for( int i = 0; i < s.length() ; i++)
    {
        if ( s[i] =='A')
        {
            f = 1;
            for ( int j = i ; j < s.length() ; j++)
            {
                if(s[j] == 'Z')
                    k=j;
            }
        }
        if ( f == 1)
        {
            cout<<k-i+1<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define yes cout<<"Yes"<<endl;
#define no cout<<"No"<<endl;
#define ll long long int
using namespace std;
int main()
{
    ll tc;
    ll a,b,c,n,x,y,z,cnt=0,sum=0;
    string str,str1,str2;
    int flag;
    cin>>str>>str1>>str2;

    cout<<str[0]<<str1[0]<<str2[0]<<endl;
}


Measured memory_bytes: 3568
n,m = map(int, input().split())
key = []
tmp = 0
for i in range(m):
    a,b = map(int, input().split())
    c = 0
    for i in map(int, input().split()):
        c += 1<<(i-1)
    key.append((a,c))
    tmp |= c
   
inf = float('INF')
flag = False
opened = 2**n
if tmp != opened -1:
    print(-1)
    exit()
dp = [inf for i in range(opened)]
dp[0] = 0
for a,c in key:
    for i in range(opened):
        if dp[i] + a < dp[i | c]:
            dp[i | c] = dp[i] + a

print(dp[opened-1] if dp[opened-1] else -1)
# print(dp)

Measured memory_bytes: 3284
s = input()
n = len(s)

def palindrome(i):
    if i == i[::-1]:
        return True

s_1 = s[:int((n-2)/2+1)]
s_2 = s[int((n+2)/2):]

if palindrome(s) and palindrome(s_1) and palindrome(s_2):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var str = ReadLine();
        var dp = new long[str.Length+1, 2];
        dp[0, 1] = 1;
        for (var i = 1; i <= str.Length; i++)
        {
            if (i > 1 && str[i - 2] == '1')
            {
                dp[i - 1, 0] += dp[i - 2, 1];
                dp[i - 1, 0] %= Input.MOD;
            }
            dp[i, 0] += dp[i - 1, 0] * 3;
            dp[i, 0] %= Input.MOD;
            if (str[i - 1] == '1')
                dp[i, 1] += 2 * dp[i - 1, 1] % Input.MOD;
            else dp[i, 1] += dp[i - 1, 1];
        }
        WriteLine((dp[str.Length, 0] + dp[str.Length, 1] + (str.Last()=='1'?dp[str.Length - 1, 1]:0)) % Input.MOD);
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public static long numL => ToInt64(read);
    public static char[][] gred(int h)
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[] ar1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => num).ToArray();
    public static long[] arL1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
    public static string[] strs(int n)
        => Enumerable.Repeat(0, n).Select(_ => read).ToArray();
    public static int[][] ar2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
    public static long[][] arL2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public static string[] Make<T1, T2>(out T1 v1, out T2 v2)
    {
        var r = read.Split(' ');
        v1 = getValue<T1>(r[0]);
        v2 = getValue<T2>(r[1]);
        return r;
    }
    public static string[] Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3)
    {
        var r = Make(out v1, out v2);
        v3 = getValue<T3>(r[2]);
        return r;
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public const int MOD = 1000000007;
}


Measured memory_bytes: 13232
# -*- coding: utf-8 -*-
a,b = map(int,input().split())

def gcd(a,b):
    x = max(a,b)
    y = min(a,b)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z


def lcm(a,b):
    return a * b // gcd(a,b)

ans = lcm(a,b)
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
using namespace std;
typedef long long ll;
int main(){
  int n,m;
  cin >> n;
  vector<string> blue(n);
  for(int i = 0;i <= n - 1;i++){
    cin >> blue[i];
  }
  cin >> m;
  vector<string> red(m);
  for(int j = 0;j <= m - 1;j++){
    cin >> red[j];
  }
  int res = 0;
  res = INT_MIN;
  for(int i = 0;i <= n - 1;i++){
    int count = 0;
    for(int j = 0;j <= n - 1;j++){
      if(blue[i] == blue[j])count++;
    }
    for(int j = 0;j <= m - 1;j++){
      if(blue[i] == red[j])count--;
    }
    res = max(res,count);
  }
  if(res < 0)res = 0;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

struct SummedAreaTable{
  static const int SIZE_N = 55;
  static const int SIZE_M = 55;
  int n, m;
  int I[SIZE_N][SIZE_M];
public:
  int table[SIZE_N][SIZE_M];
  SummedAreaTable(int n_, int m_){
    n = n_;
    m = m_;
  }
  void init(){
    for(int y=0; y<n; y++){
      for(int x=0; x<m; x++){
        I[y][x] = table[y][x];
        if(y-1>=0) I[y][x] += I[y-1][x];
        if(x-1>=0) I[y][x] += I[y][x-1];
        if(x-1>=0 && y-1>=0) I[y][x] -= I[y-1][x-1];
      }
    }
  }
  int sum(int y, int x){
    if(y < 0 || x < 0) return 0;
    return I[y][x];
  }
};

int main(){
  int N, K;
  cin >> N >> K;
  map<int,int> nx, ny;
  vector<int> vx, vy;
  rep(i,N){
    int x, y;
    cin >> x >> y;
    vx.push_back(x);
    vy.push_back(y);
    nx[x] = 1;
    ny[y] = 1;
  }
  vector<int> tx, ty;
  map<int,int> sx, sy;
  FOR(it,nx){
    sx[it->first] = tx.size();
    tx.push_back(it->first);
  }
  FOR(it,ny){
    sy[it->first] = ty.size();
    ty.push_back(it->first);
  }

  while(tx.size() < 55) tx.push_back(1000000005);
  while(ty.size() < 55) ty.push_back(1000000005);

  SummedAreaTable sat(52,52);
  rep(i,55){
    rep(j,55){
      sat.table[i][j] = 0;
    }
  }
  rep(i,N){
    sat.table[sy[vy[i]]][sx[vx[i]]]= 1;
  }
  sat.init();

  ll ret = 9111111111111111111LL;
  rep(i,52){
    rep(j,52){
      rep(yy,i){
        rep(xx,j){
          int a = sat.sum(i,j);
          int b = sat.sum(yy-1,xx-1);
          int c = sat.sum(i,xx-1);
          int d = sat.sum(yy-1,j);
          int num = a - d - c + b;
          if(num >= K){
            ll tmp = tx[j] - tx[xx];
            tmp *= ty[i] - ty[yy];
            //cout << num << " " << tx[j] << " " << tx[xx] << " " << ty[i] << " " << ty[yy] << " " << tmp << endl;
            ret = min(ret, tmp);
          }
        }
      }
    }
  }
  
  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
	vector<int> v1;
	int a;
	while(cin>>a){
		if(a==0){
			a=v1.back();
			v1.pop_back();
			cout<<a<<endl;
		}else{
			v1.push_back(a);
		}
	}
	return 0;
}

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

int main(){
	int d;
	while(cin >> d){
		int n = 600 / d;
		long ans = 0; 
		for(int i = 1; i < n; i++){
			ans += d * ( i * d * i * d );
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
let alph = Array.make 26 0 ;;

let insert c =
  let code = Char.code c in
  let x = (code - 97) in
  if 97 <= code && code <= 122 then
    begin alph.(x) <- alph.(x) + 1 end ;;

let rec f () =
  try
    let s = read_line() in
    String.iter (fun x -> Char.lowercase x |> insert) s;
    f()
  with
    End_of_file ->
    Array.iteri (fun i x -> print_char (Char.chr (i + 97)); print_string " : "; print_endline (string_of_int x)) alph;;

f();;


Measured memory_bytes: 2224