akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;
using Grid = vector<vector<char>>;

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

    ll h, w;
    cin >> h >> w;
    Grid g(h);
    
    char buf;
    rep(i,0,h)
    {
        rep(j,0,w)
            cin >> buf, g[i].push_back(buf);
    }

    bool ans(true);

    rep(i,1,h-1)
    {
        rep(j,1,w-1)
        { 
            if (g[i][j] == '#')
            {            
                bool p(false);
                p = (g[i+1][j] == '#') 
                || (g[i-1][j] == '#')
                || (g[i][j-1] == '#')
                || (g[i][j+1] == '#');
                ans &= p;
            }
        }
    }

    if (ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


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

using namespace std;

#define MAX 200
#define INF INT_MAX
typedef pair<string,int> P;
typedef vector<string> Vec;

int N;
vector<P> vec;

int cost(Vec v){
  int res = 0;
  for(int i = 0 ; i < (int)v.size() ; i++){
    for(int j = 0 ; j < N ; j++){
      if(vec[j].first == v[i]){
        res += vec[j].second;
        break;
      }
    }
  }
  return res;
}

int main(){
  int M, K;

  while(cin >> N, N){
    map<string,Vec> mp;
    P in; 

    vec.clear();
    for(int i = 0 ; i < N ; i++){
      cin >> in.first >> in.second;
      vec.push_back(in);
    }

    string str, s, item;
    cin >> M;
    for(int i = 0 ; i < M ; i++){
      cin >> str >> K;
      for(int j = 0 ; j < K ; j++){
        cin >> s;
        mp[str].push_back(s);
      }
    }    

    map<string,Vec>::iterator it;
    for(int i = 0 ; i < 3 ; i++){
      for(it = mp.begin() ; it != mp.end() ; ++it){
        for(int j = 0 ; j < N ; j++){
          if(vec[j].first == it->first){
            vec[j].second = min(vec[j].second, cost(it->second));
          }
        }
      }
    }
    cin >> item;
    int ans = INF;
    for(int i = 0 ; i < N ; i++){
      if(vec[i].first == item){
        ans = vec[i].second;
        break;
      }
    }
  
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <string.h>
#include<algorithm>
#include <numeric>      // std::accumulate
#include <iomanip>      // std::setprecision


using namespace std;
#define ll           long long
#define all(v)       (v).begin() , (v).end()
#define v           vector <int>
#define vi           vector <ll>
#define vii          vector <pair<ll,ll>>
#define ii           pair<ll,ll>
#define sz(v)	     ((int)((v).size()))
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb           push_back
#define pf           push_front
#define F            first
#define S            second
#define EPS			 1e-9
#define endl         "\n"
#define IOS          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const double PI = 3.14159265358979323846;

bool cmp(const pair<int, int>& a, const pair<int, int>& b)
{
    return (a.second < b.second);
}

int gcd(int a, int b) 
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
long long power(ll n, ll k) 
{
    if (k == 0) return 1;
    ll sq = (power(n, k / 2));
    sq = (sq * sq);
    if (k % 2 == 1)
        sq = (sq * n);
    return sq;
}
bool isPrime(int n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    if (n % 2 == 0 || n % 3 == 0) return false;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}
string to_binary(int x) 
{
    string s;
    while (x > 0) 
    {
        s += (x % 2 ? '1' : '0');
        x /= 2;
    }
    reverse(s.begin(), s.end());
    return s;
}
bool isPerfect(ll x)
{
    if (x < 1) 
        return false;
    ll root(round(sqrt(x)));
    return x == root * root;
}
void solve()
{
    int n, k;
    cin >> n >> k;
    
    v kind(n);

    lp(i, 0, n)
        cin >> kind[i];

    sort(all(kind));
    int ans = 0;
    lp(i , 0 , k)
    {
        ans += kind[i];
    }

    cout << ans << "\n";

}

int main()
{
    IOS;    
    
    int tt;
    tt = 1;
    // cin >> tt;
    while (tt--)
    {
        solve();
    }
    
}
       

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

typedef long long ll;

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int k, n, m, s;
    cin>>n>>m;

    vector<vector<int> > bulb(m, vector<int>());
    vector<int> p(m);

    for (int i=0;i<m;++i){
        cin>>k;
        while (k--){
            cin>>s;
            s--;
            bulb[i].emplace_back(s);
        }
    }
    for (int i=0;i<m;++i) cin>>p[i];

    int ans = 0;
    for (int mask = 0; mask<(1<<n);++mask){
        bool isValid = true;
        for (int i=0;i<m;++i){

            int cnt = 0;
            for (auto b : bulb[i]){
                if (mask&(1<<b)) cnt++;
            }
            if (cnt%2 != p[i]){
                isValid = false;
                break;
            }
        }
        if (isValid) ans++;
    }

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

Measured memory_bytes: 256
N = gets.to_i
A = N.times.map { gets.to_i }

ans = A[0] - 1
cur = 2

1.upto(N - 1) do |i|
  a = A[i]

  if cur == a
    cur += 1

    ans += a / cur
  elsif a % cur == 0
    ans += (a - (2 * cur)) / cur + 1
  else
    ans += a / cur
  end
end

puts ans


Measured memory_bytes: 2996
#include<iostream>
#include<vector>
#include<cmath>
#include <numeric>
#include<climits>
#include<cfloat>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>

using namespace std;

typedef pair<int,bool> Pair;

int main(){

	int N;
	int INPUT;
	long long MIN = 1000000001;
	long long H[100001];
	bool res = true;
	
	cin >> N;
	
	H[0] = -1;
	
	
	for(int i = 1;i <= N;++i){
		
		cin >> INPUT;
		H[i] = INPUT;

	}

	for(int i = 1;i <= N;++i){

		if(H[i-1] <=H[i] - 1) H[i] = H[i] -1;
		else if(H[i-1] <=H[i]) continue;
		
	}
	
	for(int i = 1;i <= N;++i)	if(H[i-1]>H[i]) res = false; 
	
	if(res) cout << "Yes" << endl;
	else cout << "No" << endl;
	
  return 0;

}


Measured memory_bytes: 1024
import sys
input = sys.stdin.readline


def main():
    X = int(input())

    Y = 100
    i = 1
    while True:
        Y = int(Y * 1.01)
        if Y >= X:
            ans = i
            break
        i += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9172
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  xs <- getc $ solve . split toInt
  mapM_ putStrLn xs

solve :: [Int] -> String
solve [y,m,d]
  | g == "pre-meiji" = g
  | g == "meiji" = g ++ " " ++ show (y - 1867) ++ " " ++ show m ++ " " ++ show d
  | g == "taisho" = g ++ " " ++ show (y - 1911) ++ " " ++ show m ++ " " ++ show d
  | g == "showa" = g ++ " " ++ show (y - 1925) ++ " " ++ show m ++ " " ++ show d
  | otherwise = g ++ " " ++ show (y - 1988) ++ " " ++ show m ++ " " ++ show d
  where
    g = gengo y m d

gengo y m d
  | y < 1868 = "pre-meiji"
  | y == 1868 && m < 9 = "pre-meiji"
  | y == 1868 && m == 9 && d < 8 = "pre-meiji"
  | y < 1912 = "meiji"
  | y == 1912 && m < 7 = "meiji"
  | y == 1912 && m == 7 && d < 30 = "meiji"
  | y < 1926 = "taisho"
  | y == 1926 && m < 12 = "taisho"
  | y == 1926 && m == 12 && d < 25 = "taisho"
  | y < 1989 = "showa"
  | y == 1989 && m == 1 && d < 8 = "showa"
  | otherwise = "heisei"

toInt :: String -> Int
toInt s = read s

split :: (String -> a) -> String -> [a]
split f = map f . words

getc :: (String -> a) -> IO [a]
getc f = map f . lines <$> getContents

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

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

  vector<int> vec(M);
  for (int i = 0; i < M; i++) {
  cin >> vec.at(i);
  }
  
  int left = 0;
  for (int i = 0; i < M; i++) {
    if (vec.at(i) < X) {
      left++;
    }
  }
  
  int right = 0;
  for (int i = 0; i < M; i++) {
    if (vec.at(i) > X) {
      right++;
    }
  }
  
  if (left > right) {
    cout << right << endl;
  }
  
  else {
    cout << left << endl;
  }

}

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

using namespace std;

int gcd(int a, int b) {
    if(min(a, b) == 0) {
        return a;
    }
    return gcd(b, a % b);
}

int gcd(int a, int b, int c) {
    return gcd(gcd(a, b), c);
}

int main() {
    int K;
    cin >> K;
    long long int ans = 0;
    for(int i = 1; i <= K; i++) {
        for(int j = 1; j <= K; j++) {
            for(int k = 1; k <= K; k++) {
                ans += gcd(i, j, k);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;
int gcd(ll a, ll b) { return (b % a == 0) ? a : gcd(b - a * (b / a), a); }
ll dp[105][100005];
int main()
{
	ll i,j,k,t,n,w;
	cin>>n>>w;
	ll p[n+1],q[n+1];
	for(i=1;i<=n;i++){cin>>p[i]>>q[i];}
	for(i=1;i<=n;i++)
	{
	    for(j=1;j<=w;j++)
	    {
	    	if(p[i]<=j)
	    	{
	dp[i][j]=max(q[i]+dp[i-1][j-p[i]],dp[i-1][j]);
	    	}
	    	else
	    	{
	    		dp[i][j]=dp[i-1][j];
	    	}
	    }
	}
	cout<<dp[n][w]<<endl;
	return 0;
}

Measured memory_bytes: 81652
#include <bits/stdc++.h>
#define MOD 1000000007
// #define MOD 998244353
#define ll long long
#define db double
#define endl "\n"
#define INF 1000000000000000000
#define INF1 1000000000
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define RAND mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define pb push_back
#define mp make_pair
#define debx cout<<" X "<<endl;
#define deby cout<<" Y "<<endl;
#define debz cout<<" Z "<<endl;
#define deb(x) cout << '>' << #x << ':' << x << endl;
using namespace std;
 
ll mpow(ll a, ll b){
    if(!b)
        return 1;
    ll temp=mpow(a,b/2);
    temp=(temp*temp)%MOD;
    if(b%2)
        return (a*temp)%MOD;
    return temp;
}
ll _pow(ll a, ll b){
    if(!b)
        return 1;
    ll temp=mpow(a,b/2);
    temp=(temp*temp);
    if(b%2)
        return (a*temp);
    return temp;
}
ll mod_in(ll n){
    return mpow(n,MOD-2);
}
ll cl(ll a, ll b){
    if(a%b)
        return 1+a/b;
    return a/b;
}
ll dig(ll n){
    if(!n)
        return 0;
    return 1 + dig(n/10);
}
int main(){
    fastio
    ll n ;
    cin>>n ;
    pair<ll,ll> pr[n+5] ;
    for(ll i=0 ; i<n ; i++){
        ll x, l ;
        cin>>x>>l ;
        pr[i] = mp(x-l,x+l) ;
    }
    sort(pr,pr+n) ;
    ll minn = -INF ;
    ll ans = 0 ;
    for(ll i=0 ; i<n ; i++){
        if(minn<=pr[i].first){
            minn = pr[i].second ;
        }
        else{
            ans++ ;
            minn = min(minn, pr[i].second) ;
        }
    }
    cout<<n-ans ;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

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

    int c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,any=0;
    for (int i = 0; i < n; i++) {
        int a = 0;
        cin >> a;
        if (a < 400) {
            c1 = 1;
        } else if (a < 800) {
            c2 = 1;
        } else if (a < 1200) {
            c3 = 1;
        } else if (a < 1600) {
            c4 = 1;
        } else if (a < 2000) {
            c5 = 1;
        } else if (a < 2400) {
            c6 = 1;
        } else if (a < 2800) {
            c7 = 1;
        } else if (a < 3200) {
            c8 = 1;
        } else {
            any++;
        }
    }

    int min = c1+c2+c3+c4+c5+c6+c7+c8;
    int max = min + any;

    if (min == 0 && any > 0) {
        min = 1;
        max = any;
    }
/*
レート 1-399：灰色
レート 400-799：茶色
レート 800-1199：緑色
レート 1200-1599：水色
レート 1600-1999：青色
レート 2000-2399：黄色
レート 2400-2799：橙色
レート 2800-3199：赤色
*/

    cout << min << " " << max << endl;

    return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
int p[210000];
int q[210000];
int main(){
	int a;long long b;
	scanf("%d%lld",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%d",p+i);
	}
	for(int i=0;i<a;i++){
		scanf("%d",q+i);
	}
	std::sort(p,p+a);
	std::sort(q,q+a);
	reverse(q,q+a);
	long long left=-1;
	long long right=1100000000000LL;
	while(left+1<right){
		long long M=(left+right)/2;
		long long cur=0;
		for(int i=0;i<a;i++){
			long long t=M/q[i];
			if(t<p[i])cur+=p[i]-t;
		}
		if(cur<=b){
			right=M;
		}else left=M;
	}
	printf("%lld\n",right);
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	int N, K;
	cin >> N >> K;
	cout << N - K + 1 << endl;
}


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

int main()
{
  int N;
  cin >> N;
  map<string,int> s;
  vector<int>    t(N);
  int total =0;
  rep(i,N){
    string a;
    int b;
    cin >> a >> b;
    total += b;
    s[a] = i;
    t[i] = total;
  }
  string x;
  cin >> x;
  int k = s[x];
  int ans = t[N-1]-t[k];
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
using namespace std;
#define ll long long
//{{{ read()
inline ll read(){
	register ll x=0,f=1;
	register char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')	f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')	x=x*10+(ch^48),ch=getchar();
	return x*f;
}
//}}}
const int P=1e9+7;
const int N=2e5+5;
typedef pair<ll,ll> pi;
ll fsp(ll x,int y){
	ll ans=1;
	while(y){
		if(y&1)	ans=ans*x%P;
		x=x*x%P,y>>=1;
	}
	return ans;
}
ll gcd(ll a,ll b){
	while(b){
		ll t=b;
		b=a%b,a=t;
	}
	return a;
}
int n;
ll a[N],b[N];
map<pi,int>ma;
int cnt,cnt2,cnt3;
int main(){
	n=read();
	for(int i=1;i<=n;i++){
		a[i]=read(),b[i]=read();
		if(!a[i]||!b[i]){
			if(a[i]==0&&b[i]==0) ++cnt;
			else	if(a[i]==0)	++cnt2;
			else	if(b[i]==0)	++cnt3;
			--i,--n;
			continue;
		}
		ll g=gcd(abs(a[i]),abs(b[i]));
		if(b[i]<0)	b[i]=-b[i],a[i]=-a[i];
		a[i]/=g,b[i]/=g,ma[pi(a[i],b[i])]++;
	}
	ll ans=(fsp(2,cnt2)+fsp(2,cnt3)-1)%P;
	for(int i=1;i<=n;i++){
		if(!ma[pi(a[i],b[i])])	continue;

		ll x=-b[i],y=a[i];
		if(y<0)	y=-y,x=-x;

		ans=(ans*(fsp(2,ma[pi(a[i],b[i])])+fsp(2,ma[pi(x,y)])-1))%P;
		ma[pi(a[i],b[i])]=ma[pi(x,y)]=0;
	}
	cout<<(ans+cnt-1+P)%P;
	return 0;
}


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

int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    if (abs(x - a) < abs(x - b))
    {
        cout << "A" << endl;
    }
    else
    {
        cout << "B" << endl;
    }
}


Measured memory_bytes: 256
n,m,x=map(int,input().split())
ca=[list(map(int,input().split())) for _ in range(n)]
ans=10**9
for i in range(2**n):
  cnt=[0]*m
  kari=0
  for j in range(n):
    if (i>>j)&1:
      for k in range(m):
        cnt[k]+=ca[j][k+1]
      kari+=ca[j][0]
    else:
      pass
  if min(cnt)>=x:
    ans=min(ans,kari)
if ans==10**9:
  print(-1)
else:
  print(ans)

Measured memory_bytes: 9220
a[210][9],x,j,n,k;main(i){for(;~scanf("%d",&x);j>2?j=1,++i:++j)!n?n=x:--a[a[i][j]=x][j+3];for(;n/++k;printf("%d\n",i))for(i=0,j=4;--j;)i+=!~a[x=a[k][j]][j+3]*x;}

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


int main() {
  
  int N,K;
  
  cin>>N>>K;
  
  vector<int> H(N);
for (int i = 0; i < N; i++) {
  cin >> H.at(i);
}
  sort(H.begin(), H.end());
  
  long sw=0;
  
  for (int i = 0; i < N-K; i++) {
  sw=sw+H.at(i);
}
  
  cout<<sw<<endl;
  
  
}




Measured memory_bytes: 1024
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    print('APPROVED' if all([a % 3 == 0 or a % 5 == 0 for a in A if a % 2 == 0]) else 'DENIED')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3832
# coding: utf-8

H, W = list(map(int, input().split(' ')))
intersections = [list(map(int, input().split(' '))) for i in range(H)]

min_score = float('inf')
for h in range(H):
    for w in range(W):
        score = 0
        not_min_flag = False
        for _h in range(H):
            if _h == h: continue
            for _w in range(W):
                if _w == w: continue
                score += intersections[_h][_w] * min(abs(h - _h), abs(w - _w))
                if score > min_score:
                    not_min_flag = True
                    break
            if not_min_flag: break
        if score < min_score: min_score = score

print(min_score)


Measured memory_bytes: 5624
#include <cstdio>
#include <cstring>
#include <algorithm>

#define ll long long
#define inf 0x3f3f3f3f 
#define il inline 
#define in1(a) read(a)
#define in2(a,b) in1(a),in1(b)
#define in3(a,b,c) in2(a,b),in1(c)
#define in4(a,b,c,d) in2(a,b),in2(c,d)

inline void read( int &x ){
    x = 0 ; int f = 1 ; char c = getchar() ;
    while( c < '0' || c > '9' ) {
        if( c == '-' ) f = -1 ;
        c = getchar() ;
    }
    while( c >= '0' && c <= '9' ) {
        x = (x << 1) + (x << 3) + c - 48 ;
        c = getchar() ;
    }
    x *= f ;
}

inline void readl( ll &x ){
    x = 0 ; ll f = 1 ; char c = getchar() ;
    while( c < '0' || c > '9' ) {
        if( c == '-' ) f = -1 ;
        c = getchar() ;
    }
    while( c >= '0' && c <= '9' ) {
        x = (x << 1) + (x << 3) + c - 48 ;
        c = getchar() ;
    }
    x *= f ;
}

using namespace std ;

#define N 100010

int a[ N ] , n , m ; 

int main(){
	in2(n,m);
	for(int i = 1;i<=n;i++){
		in1(a[i]);
	}
	sort(a+1,a+n+1);
	int ans = 0; 
	for(int i=1;i<=n;i++){
		if(m-a[i]>=0)m-=a[i];
		else return printf("%d",i-1),0;
	} 
	printf("%d\n",n-(m>0));
}


Measured memory_bytes: 128
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

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

    int n;
    cin >> n;

    int ans = (n + 1) / 2 - 1;
    cout << ans << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,l[11],v1,v2,mi,ll[12];
  double zi,ha,haha;
  while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&l[0],&l[1],&l[2],&l[3],&l[4],&l[5],&l[6],&l[7],&l[8],&l[9],&v1,&v2) != EOF){
    mi = 0;
    ll[0] = 0;
    for(i=0;i<10;i++){
      mi += l[i];
      ll[i+1] = ll[i]+l[i]; 
    }
    zi = (double)mi/(double)(v1+v2);
    ha = zi*(double)v1;
    haha = zi*(double)v2;
 
    for(i=0;i<=9;i++){
      if(ll[i] <= ha && ha <= ll[i+1]){
	printf("%d\n",i+1);
	break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 596
// Package main provides
//
// File:  b.go
// Author: ymiyamoto
//
// Created on Thu Jan  3 17:24:32 2019
//
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var N, A, B int
	fmt.Scan(&N, &A, &B)

	ans := 0
	for i := 1; i <= N; i++ {
		s := strconv.Itoa(i)

		sum := 0
		for i := range s {
			sum += int(s[i] - '0')
		}
		if A <= sum && sum <= B {
			ans += i
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long double ld;

ld x[3],y[3];


ld heron(ld a,ld b,ld c)
{
ld s = (a + b + c) / 2;
return sqrt(s * (s - a) * (s - b) * (s - c));
}


int main()
{
	cout << fixed << setprecision(10);
for(int i = 0;i < 3;i++) cin >> x[i] >> y[i];
ld a,b,c;
{
	int i = 0;

	a = sqrt((x[i] - x[(i + 1) % 3]) * (x[i] - x[(i + 1) % 3]) + (y[i] - y[(i + 1) % 3]) * (y[i] - y[(i + 1) % 3]));
	i++;
	b = sqrt((x[i] - x[(i + 1) % 3]) * (x[i] - x[(i + 1) % 3]) + (y[i] - y[(i + 1) % 3]) * (y[i] - y[(i + 1) % 3]));
	i++;
	c = sqrt((x[i] - x[(i + 1) % 3]) * (x[i] - x[(i + 1) % 3]) + (y[i] - y[(i + 1) % 3]) * (y[i] - y[(i + 1) % 3]));
}
ld R = 2 * heron(a,b,c) / (a + b + c);
ld ma = max(a,max(b,c));
cout << ma / (ma / R + 2.0) << endl;
return 0;
}

Measured memory_bytes: 256
# coding: utf-8

N = int(input())
alphabets = 'abcdefghij'

def dfs(s, mx):
    if len(s) == N:
        print("".join(s))
    else:
        t = min(len(set(s))+1,len(s)+1)
        for c in range(t):
            dfs(s + [alphabets[c]], c)

if __name__ == "__main__":
    dfs([], 0)


Measured memory_bytes: 4412
#include <stdio.h>
#include <iostream>
using namespace std;
 
int main(){
    int a, n;
    int MAX = -1000001, MIN = 1000000;
    long long int SUM =0; 
    scanf("%d", &n);
    for(int i=0;i<n;i++){
        scanf("%d", &a);
        SUM += a;
        MAX = max(MAX, a);
        MIN = min(MIN, a);
    }
    printf("%d %d %lld\n",MIN, MAX, SUM);
}


Measured memory_bytes: 3232
#include<iostream>
#include <algorithm>
using namespace std;
int main(){
	int n,a,b,c,d;
    cin >> n;

	int A[1000];
	int B[1000]; 


	for (int i=0; i<n; i++){
		A[i] = 0;
		B[i] = 0;
	}


	for(int i=0; i<n*(n-1)/2; i++){
		cin >> a >> b >> c >> d;
		if( c > d ){
			A[a-1] += 3;
			B[a-1] += 3;
		}
		else if( c < d ){
			A[b-1] += 3;
			B[b-1] += 3;
		}
		else{
			A[a-1] ++;
			A[b-1] ++;
			B[a-1] ++;
			B[b-1] ++;
		}
	}

	sort(A,A+1000);
	reverse(A,A+1000);

	int x = 0;

	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			x++;
			if(B[i] == A[j]){
				cout << x << endl;
				x = 0;
				break;
			}
			
		}
	}

	return 0;
}



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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

ll q, l, r;
bool isprime[100001];

signed main() {
  cin >> q;
	rep(i, 100000) isprime[i] = true;
  isprime[0] = isprime[1] = false;
  for(int i = 2; i < (ll)sqrt(100001); i++) {
    if(isprime[i]) {
      ll j = i + i;
      while(j <= 100000) {
        isprime[j] = false;
        j += i;
      }
    }
  }
  ll dp[100001] = {0};
  for(int i = 2; i <= 100000; i++) {
    if (isprime[i] && isprime[(i + 1) / 2]) dp[i] = 1;
    dp[i] += dp[i - 1];
  }

  rep(i, q) {
    cin >> l >> r;
    cout << dp[r] - dp[l - 1] << endl;
  }
	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h,w;
    cin >> h >> w;
    char a[h+2][w+2];
    int mod = pow(10,9)+7;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin >> a[i][j];
            //cout << a[i][j];
        }
        //cout << endl;
    }
    int dp[h+2][w+2];
    for(int i=0;i<=h;i++)
    {
        for(int j=0;j<=w;j++)
        {
            if(i==1 && j==1)
            {
                dp[i][j]=1;
            }
            else if(i==0 || j==0)
            {
                dp[i][j]=0;
            }
            else if(a[i-1][j-1]=='.')
            {
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
            }
            else
            {
                dp[i][j]=0;
            }
        }
    }
    cout << dp[h][w]%mod << endl;
    return 0;
}

Measured memory_bytes: 5120
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<unordered_map>
#include<string>
#define LL long long
#define li i<<1
#define ri i<<1|1
using namespace std;
inline LL read()
{
    char c=getchar();LL x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}
const int maxn=2e5+5;
LL n,a[maxn],ans;
bool cmp(LL a,LL b){
	return a>b;
}
int main()
{
	n=read();
	for(int i=1;i<=n;++i)
		a[i]=read();
	sort(a+1,a+n+1,cmp);
	LL times=n-1,p=1;
	while(times){
		if(p==1){
			ans+=a[p];
			--times;
		}else{
			if(times>=2){
				ans+=2*a[p];
				times-=2; 
			}else{
				ans+=a[p];
				times=0;
			}
		}
		++p;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 5220
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;

ll AN(ll A, ll N){
  if (N == 0){
    return 1;
  }else{
    if (N % 2 == 0){
      return AN((A * A) % nmax, N / 2);
    }else{
      return (A * AN((A * A) % nmax, N / 2)) % nmax;
    }
  }
}

int main(){

  string L; cin >> L;

  int N = L.length();

  ll DP[N], ans[N];
  for (int i = 0; i < N; i++){
    DP[i] = 0;
  }
  DP[0] = 3;
  ll cnt = 1;
  for (int i = 1; i < N; i++){
    int now = L[i] - '0';
    if (now == 1){
      DP[i] = DP[i - 1] * 3;
      cnt++;
    }else{
      DP[i] =  DP[i - 1] * 3 - AN(2, cnt + 1);
    }
    DP[i] += nmax;
    DP[i] %= nmax;
  }
  
  cout << DP[N - 1] << endl;
  

  return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define fast ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define F(i,a,b) for(int i= (int)(a); i<(int)(b);i++)
#define FI(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define what_is(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pii pair<int,int>
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
const int N = 1e6+7 ;
string s ;

int main(){fast ;
	int n,k ;
	cin >> s ;
	int cnt = 0 , mx = 0 ;
	for(auto x : s){
		if(x == 'A' or x == 'T' or x == 'G' or x == 'C'){
			cnt++ ;
		}
		else cnt = 0 ;
		mx = max(mx , cnt ) ;
	}
	cout << mx << endl ;
}




Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;
class Main {
  	public static void main(String[] args)throws IOException{
		Scanner scan = new Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();
		
		int nt = str1.length();
		int np = str2.length();
		
		if(nt < np) return;
		
		for(int i = 0; i < nt - np + 1; i++){
			//?????????????????????????????????????????????????????????????????????
			if(str1.charAt(i) == str2.charAt(0)){
				if(str1.substring(i, np + i).equals(str2)){
					System.out.println(i);
				}
			}
		}
		
		return;
	}
}  

Measured memory_bytes: 26224
N = int(input())


def judge(N):
    i = 0
    while True:
        if 4 * i > N:
            break
        j = 0
        while True:
            if 4 * i + 7 * j == N:
                return "Yes"
            elif 4 * i + 7 * j > N:
                break
            else:
                j += 1
        i += 1
    return "No"


print(judge(N))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    string s;
    cin >> s;
    bool res = false;
    rep(i, 3){
        if(s[i] != s[0]) res = true;
    }
    if(res) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadInts();
            if (input[1]<input[2])
            {
                if (input[2] - input[1] > input[0])
                {
                    WriteLine("dangerous");
                }
                else
                {
                    WriteLine("safe");
                }
            }
            else
            {
                WriteLine("delicious");
            }
        }

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


Measured memory_bytes: 11092
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x3f3f3f3f
using namespace std;

long long a[5], ans;

int main()
{
	int n;
	char s[11];
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%s", s);
		if (s[0] == 'M') ++a[0];
		if (s[0] == 'A') ++a[1];
		if (s[0] == 'R') ++a[2];
		if (s[0] == 'C') ++a[3];
		if (s[0] == 'H') ++a[4];
	}   
	for (int i = 0; i <= 2; i++)
		for (int j = i + 1; j <= 3; j++)
			for (int k = j + 1; k <= 4; k++)
				ans += a[i] * a[j] * a[k];
	printf("%lld", ans);
	return 0;
}

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

using namespace std;

int main() {
	int n,m;
	while (cin >> n >> m && n != 0 && m != 0) {
		vector<int> s(n);
		for (int i = 0; i < n; ++i) cin >> s[i];
		int max = 0;
		
		for(int i=0;i<n;++i)
			for(int j=i+1;j<n;++j)
				if((max<(s[i]+s[j]))&&(m>=(s[i]+s[j])))
					max = s[i]+s[j];
		
		if (max == 0) cout << "NONE" << endl;
		else cout << max << endl;
	}
	return 0;
}


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  int c5=0,c7=0;
  cin>>a>>b>>c;
  if(a==5)
  {
    c5++;
  }
  if(a==7)
  {
    c7++;
  }
  if(b==5)
  {
    c5++;
  }
  if(b==7)
  {
    c7++;
  }
  if(c==5)
  {
    c5++;
  }
  if(c==7)
  {
    c7++;
  }
  if(c5==2 && c7==1)
  {
    cout<<"YES";
  }
  else
  {
    cout<<"NO";
  }
  return 0;
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }
typedef long long ll;

const long long INF = 1LL << 60;

int main()
{
    int A, B;
    cin >> A >> B;

    if (B % A == 0) {
        cout << A + B << endl;
    }
    else {
        cout << B - A << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


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

	cin >> N;
	vector<int>num(N);
	int l = INT_MAX;
	int r = 0;
	for (int i = 0; i < N; i++) {
		cin >> num[i];
		l = min(l, num[i]);
		r = max(r, num[i]);
	}
	if (r - l > 1) {
		cout << "No\n";
		return 0;
	}
	if (r == l) {
		if (r * 2 <= N||r+1==N) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
		return 0;
	}
	for (int i = 0; i < N; i++) {
		if (num[i] == l) {
			K++;
		}
	}
	if (K + (N - K) / 2 >= r&&K+1<=r) {
		cout << "Yes\n";
		return 0;
	}
	cout << "No\n";
	return 0;
}

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

#define INF 1e9
using namespace std;
typedef long long ll;

int main() {

    int n, k; cin >> n >> k;

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int x; cin >> x;

        ans += 2 * min(x, k-x);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
int main() {
	int n = 0,ans = 0,d = 0;
	int kotae = 0;
	int dokomade = 1;
	int a[100][2] = {};
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> a[i][0];
	}
	for (int j = 0; j < n; j++) {
		std::cin >> a[j][1];
	}

	for (int c = 0; c < n; c++) {
		for (d = 0; d < dokomade; d++) {
			ans += a[d][0];
		}
		for (int e = d-1; e < n; e++) {
			ans += a[e][1];
		}
		dokomade++;
		if (kotae < ans) {
			kotae = ans;
		}
		ans = 0;
	}
	std::cout << kotae << std::endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
#define ll long long int

int main()
{
  int n;
  cin>>n;
  ll res;
  if(n==0)
  {
      cout<<0;
      
  }
  else
  {
      res=((n/500)*1000)+((n%500)/5)*5;
      cout<<res;
  }
}


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

int main()
{
    string s;
    cin >> s;
    stack<string> st1,st2;
    for(long long int i=0;i<s.length();i++)
    {
        string x;
        x.push_back(s[i]);
        st1.push(x);
    }
    st2.push(st1.top());
    st1.pop();
    while(!st1.empty())
    {
        if(st2.top()!=st1.top())
        {
            st2.push(st1.top());
            st1.pop();
        }
        else
        {
            string z=st1.top();
            st1.pop();
            if(st1.empty()==false)
            {
                while(z==st2.top())
                {
                    z+=st1.top();
                    st1.pop();
                }
                st2.push(z);
            }
            else
            {
                string l=st2.top();
                st2.pop();
                l+=z;
                st2.push(l);
            }
        }
    }
    cout << st2.size() << endl;
}

Measured memory_bytes: 11524
N = int(input())
S = list(input())

alphabet = ["A", "B", "C", "D", "E", "F", "G",
            "H", "I", "J", "K", "L", "M", "N",
            "O", "P", "Q", "R", "S", "T", "U",
            "V", "W", "X", "Y", "Z"]

for i in range(len(S)):
    for j in range(len(alphabet)):
        if S[i] == alphabet[j]:
            S[i] = j

for i in range(len(S)):
    if S[i]+N > 25:
        S[i] = alphabet[S[i]+N-26]
    else:
        S[i] = alphabet[S[i]+N]

for i in range(len(S)):
    print(S[i], end="")


Measured memory_bytes: 4596
#include<iostream>
#include<stdio.h>
using namespace std;

int main()
{
	int m, f, r;

	while (1) {
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1) break;
		else if (m == -1 || f == -1) printf("F\n");
		else if (m + f >= 80) printf("A\n");
		else if (m + f >= 65) printf("B\n");
		else if (m + f >= 50) printf("C\n");
		else if (m + f >= 30) {
			if (r >= 50) printf("C\n");
			else printf("D\n");
		}
		else printf("F\n");
	}
	return 0;
}

Measured memory_bytes: 3012
#include<iostream>
#include<cmath>

using namespace std;

int main()
{
	int n,m;
	int X,Y;
	int xc[100],yc[100];

	cin >> n >> m >> X >> Y;

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

	int zl = -101,zr = 101;

	for(int i=0;i<n;i++)
	{
		zl = max(zl,xc[i]);
	}

	for(int i=0;i<m;i++)
	{
		zr = min(zr,yc[i]);
	}

	//cout << zl << " " << zr << endl;

	if(zr <= zl)
	{
		cout << "War" << endl;
		return 0;
	}

	if(zl <= X || zr > Y)
	{
		cout << "War" << endl;
		return 0;
	}

	cout << "No War" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

lli body(lli a, lli b){
	return (a-b)*(a-b);
}
int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	lli n;
	cin >> n;
	vector<lli> p(n);
	lli cnt=0;
	lli min = INF;

	rep(i,n){
		cin >> p[i];
		if(p[i] <= min){
			min = p[i];
			cnt++;
		}
	}
	cout << cnt << endl;
 	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int a, b; std::cin >> a >> b;
  std::cout << std::max({
    a + b,
    a - b,
    a * b
  }) << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

typedef long long ll;

int max(int a, int b){
  if(a > b) return a;
  else return b;
}
int min(int a, int b){
  if(a < b) return a;
  else return b;
}

int sort(const void *a ,const void *b){
  return *(int*)a - *(int*)b;
}

int main(){
  int n,ans=0,now=0;
  scanf("%d",&n);
  int a[n];
  for(int i = 0; i < n; ++i){
    scanf("%d",a+i);
  }

  for(int i = 0; i < n; ++i){
    if(now < a[i]){
      ans += a[i] -now;
      now = a[i];
    }
    else now = a[i];
  }

  printf("%d",ans);
  return 0;

}


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

int main() {
	int X, ans = 0;

	cin >> X;

	if (X <= 3) {
		cout << 1 << endl;
		return 0;
	}

	for (int i = 2; i <= X; i++) {
		for (int j = 2; j <= X; j++) {
			for (int k = j; k <= i;) {
				k *= j;
				if (k == i) {
					if (ans < i)ans = i;
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1e11;

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

  ll ans = -INF;
  int mn = min(n, k);
  for (int i = 0; i <= mn; ++i) {
    for (int j = 0; i + j <= mn; ++j) {
      int cnt = k - i - j;
      ll val = 0;
      vector<ll> a;
      for (int l = 0; l < i; ++l) val += v[l], a.push_back(v[l]);
      for (int l = 0; l < j; ++l)
        val += v[n - 1 - l], a.push_back(v[n - 1 - l]);
      sort(a.begin(), a.end());
      for (int l = 0; l < cnt && l < a.size() && a[l] < 0; ++l) val -= a[l];
      ans = max(ans, val);
    }
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

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

    char c; cin >> c;
    if(c<='Z' && c>='A') cout<<'A'<<endl;
    else cout<<'a'<<endl;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<iomanip>
using namespace std;

int main(void) {
	double n, k, ans = 0;
	cin >> n >> k;

	for (int i = 1; i <= n; i++) {
		double a = (double)i, b = 0;
		while (a < k) {
			a = a * 2;
			b++;
		}
		ans += 1 / (n * pow(2, b));
	}
	cout << setprecision(10) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
// ABC 149-B
// 2019.12.29 bal4u

#include <stdio.h>

typedef long long ll;

int main()
{
	ll A, B, K;
	
	scanf("%lld%lld%lld", &A, &B, &K);
	if (A > K) A -= K;
	else {
		K -= A, A = 0;
		if (B > K) B -= K;
		else B = 0;
	}
	printf("%lld %lld\n", A, B);
	return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e17+7;


int main(){
	//ios_base::sync_with_stdio(false);
	ll N, A[200005];

	cin >> N;
	rep(i,N) cin >> A[i];

	ll ans[2];
	rep(k,2){
		ll l=0, r=INF;
		while(r-l > 1){
			ll m = (l+r) / 2ll;
			ll res = m;
			rep(i,N) res -= res % A[i];
			if(res == 2){
				(k?l:r) = m;
			}else{
				(res>2?r:l) = m;
			}
		}
		if( k == 0 ) ans[k] = r;
		else ans[k] = l;
	}

	if(ans[0] > ans[1]) cout << -1 << endl;
	else cout << ans[0] << " " << ans[1] << endl;

	return 0;
}


Measured memory_bytes: 1024
package main
 
import (
	"fmt"
)
 
func main() {
	var a, b int
	fmt.Scan(&a, &b)
	if a == b {
		fmt.Println("Draw")
	} else if a == 1 {
		fmt.Println("Alice")
	} else if b == 1 {
		fmt.Println("Bob")
	} else if a > b {
		fmt.Println("Alice")
	} else if b > a {
		fmt.Println("Bob")
	}
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n , m , X , Y ;
  cin >> n >> m >> X >> Y ;
  int MAX_X = X ;
  int MIN_Y = Y ;
  string ans = "War";
  
  rep(i,n){
    int c ;
    cin >> c ;
    MAX_X = max(MAX_X,c);
  }
  
  rep(i,m){
    int c ;
    cin >> c ;
    MIN_Y = min(MIN_Y,c);
  }
  
  if(MAX_X < MIN_Y)
    ans = "No War";
  
  cout << ans ;
  


}


Measured memory_bytes: 256