akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <string>
using namespace std;

int n, a[100000];

void exit(string str){
	puts(str.c_str());
	exit(0);
}

int main(){
	scanf("%d", &n);

	long long sum=0;
	for(int i=0; i<n; i++){
		scanf("%d", &a[i]);
		sum+=a[i];
	}
	if(n==1) exit("YES");

	long long p = n*1ll*(n+1)/2;
	if(sum%p!=0) exit("NO");
	int x = sum/p;

	for(int i=0, j=1; i<n; i++, j++){
		if(a[i]<x || a[i]>x*1ll*n) exit("NO");
		j%=n;
		int diff = a[j]-a[i];
        int dmn = diff%n;
        if(dmn<0) dmn+=n;
        if(dmn != x%n) exit("NO");
	}
	exit("YES");
	return 0;
}


Measured memory_bytes: 640
import java.util.*;
import java.util.Arrays;
class Main {
    public static void main(String[] args) {
       
       Scanner scner = new Scanner(System.in);

        int n = scner.nextInt();
        int[] S = new int[n];
        for (int i=0; i<n; i++) {
            S[i] = scner.nextInt();
        }

        int q = scner.nextInt();
        int T = 0;
     
        int num = seSearch(S, T, q, scner);
        System.out.println(num);
       }

    public static int seSearch(int[] a, int b, int f,Scanner c){
     int solve = 0;
     for (int i=0; i<f; ++i){
      b = c.nextInt();
     if (Arrays.binarySearch(a,b) >= 0) {
                solve++;
            }
        
        
    
}
    return solve;

 } 
     }


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

void fnInput(vector<int>& rvnSeqB)
{
  int nSeqBSiz;
  cin >> nSeqBSiz;
  rvnSeqB.resize(nSeqBSiz - 1);

  for (int& rnSeqB : rvnSeqB)
    cin >> rnSeqB;
}
  
int fnMaxValueGet(const vector<int>& cnrvnSeqB)
{
  vector<int> vnSeqA(cnrvnSeqB.size() + 1, 100001);

  for (int i = 0; i < cnrvnSeqB.size(); i++)
  {
    if (cnrvnSeqB[i] < vnSeqA[i])
      vnSeqA[i] = cnrvnSeqB[i];
    if (cnrvnSeqB[i] < vnSeqA[i + 1])
      vnSeqA[i + 1] = cnrvnSeqB[i];
  }

  int nSum = accumulate(begin(vnSeqA), end(vnSeqA), 0);
  return nSum;
}
  
int main()
{
  vector<int> vnSeqB;

  fnInput(vnSeqB);
  cout << fnMaxValueGet(vnSeqB) << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using pll=pair<ll,ll>;
using plll=pair<ll,pll>;
using graph=vector<vector<int>>;

const ll MOD=1000000007;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

ll abs1(ll a){
  if(a>=0)return a;
  else return -a;
}

ll pow1(ll a,ll b,ll p=LLONG_MAX){
  ll ret=1;
  while(b!=0){
    if((b&1)==1){
      ret*=a;
    }
    a*=a;
    if(a>=p)a%=p;
    b=b>>1;
  }
  return ret;
}

int digit(ll a,ll b){
  int i=0;
  while(a!=0){
    a/=b;
    i++;
  }
  return i;
}

ll gcd1(ll a,ll b){
  if(a==0 && b==0)return 0;
  ll n;
  while(a%b!=0){
    n=a%b;
    a=b;
    b=n;
  }
  return b;
}

ll solveLinear(ll n,ll m,ll c){
  if(n==0 && m==0)return 0;
  ll a[100],b[100];
  a[0]=n;b[0]=m;
  int i=1;
  while(b[i-1]!=0){
    a[i]=b[i-1];
    b[i]=a[i-1]%b[i-1];
    i++;
  }
  n=i;
  if(c%a[n-1]!=0){
    return 0;
  }
  ll x=c/a[n-1],y=0;
  for(i=1;i<n;i++){
    ll cnt=x;
    x=y;
    y=cnt-(a[n-i-1]/b[n-i-1])*y;
  }
  return x;
}

ll modRev(ll a,ll p=MOD){
  a%=p;
  ll n=solveLinear(a,p,1);
  n%=p;
  if(n<0)return n+p;
  return n;
}

ll fact(ll n,ll p=MOD){
  if(n<0)return 0;
  int i;
  ll ret=1;
  for(i=0;i<n;i++){
    ret=ret*(i+1);
    if(ret>=p)ret%=p;
  }
  return ret;
}

ll perm(ll n,ll k,ll p=MOD){
  if(n<0 || k<0 || n<k)return 0;
  int i;
  ll ret=1;
  for(i=0;i<k;i++){
    ret=ret*(n-i);
    if(ret>=p)ret%=p;
  }
  return ret;
}

ll binom(ll n,ll k,ll p=MOD){
  if(n<0 || k<0 || n<k)return 0;
  int i;
  ll ret=1,fact=1;
  for(i=0;i<k;i++){
    ret=ret*(n-i);
    fact*=i+1;
    if(ret>=p)ret%=p;
    if(fact>=p)fact%=p;
  }
  return (ret*modRev(fact))%p;
}

void pushHeap(vector<int>& h,int n){
  int i=h.size();
  h.push_back(n);
  while(i!=0 && h[(i-1)/2]<h[i]){
    swap(h[i],h[(i-1)/2]);
    i=(i-1)/2;
  }
  h[i]=n;
}

int popHeap(vector<int>& h){
  int n=h.size()-1;
  if(n==-1)return 0;
  int i,ret=h[0];
  swap(h[0],h[n]);
  h.pop_back();
  for(i=0;i<n;){
    int j=2*i+1;
    if(j>=n)break;
    if(j!=n-1 && h[j]<h[j+1])j++;
    if(h[i]<h[j]){
      swap(h[i],h[j]);
    }
    i=j;
  }
  return ret;
}

vector<int> ver;
void dfs(const graph &g,int v){
  ver[v]=1;
  for(auto i:g[v]){
    if(ver[i]!=1)continue;
    dfs(g,i);
  }
}

int bis(vector<int> v,int key){
  int left=-1,right=v.size();
  while(abs1(right-left)>1){
    int mid=left+(right-left)/2;
    if(v[mid]<=key)left=mid;
    else right=mid;
  }
  return left;
}

int main(){
  int i,j,k,cnt=0;
  int n;
  cin>>n;
  int ed=2;
  cnt=2;
  for(i=3;i<n;i++){
    if(i%2==0)cnt+=2;
    ed+=cnt;
  }
  vector<pll> v;
  v.push_back(pll(1,3));
  v.push_back(pll(2,3));
  for(i=3;i<n;i++){
    if(i%2==1){
      for(j=0;j<v.size();j++){
        v[j].first++;v[j].second++;
      }
      for(j=2;j<=i;j++){
        v.push_back(pll(1,j));
      }
    }else{
      for(j=1;j<=i;j++){
        v.push_back(pll(j,i+1));
      }
    }
  }
  cout<<ed<<endl;
  sort(v.begin(),v.end());
  for(i=0;i<v.size();i++){
    cout<<v[i].first<<" "<<v[i].second<<endl;
  }
}


Measured memory_bytes: 512
N, M = map(int, input().split())

AB = []
for _ in range(M):
    a, b = map(int, input().split())
    AB.append((a, b))
AB = sorted(AB, key=lambda x: (x[1], x[0]))

ans = 1
D = AB[0][1]
for i in range(1, M):
    if AB[i][0] >= D:
        ans += 1
        D = AB[i][1]
print(ans)


Measured memory_bytes: 58840
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace  std;
int table[10][10];
bool range(int x, int y)
{
	if (x < 0 || y < 0 || x >= 10 || y >= 10)return false;
	return true;
}
void draw(int x,int y,int s)
{
	if (s == 1)
	{
		int dx[] = { 0,0, 1, 0, -1 };
		int dy[] = { 0,1, 0, -1, 0 };
		for (int i = 0; i < 5; i++)
		{
			int nx = dx[i] + x;
			int ny = dy[i] + y;
			if (range(nx, ny))
			{
				table[ny][nx]++;
			}
		}
	}
	else if (s == 2)
	{
		int dx[] = { 0, -1, 0, 1, 1, 1, 0, -1, -1 };
		int dy[] = { 0, -1, -1, -1, 0, 1, 1, 1, 0 };
		for (int i = 0; i < 9; i++)
		{
			int nx = dx[i] + x;
			int ny = dy[i] + y;
			if (range(nx, ny))
			{
				table[ny][nx]++;
			}
		}
	}
	else if (s == 3)
	{
		int dx[] = { 0, -1, 0, 1, 1, 1, 0, -1, -1, 0, 2, 0, -2 };
		int dy[] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, -2, 0, 2, 0 };
		for (int i = 0; i < 13; i++)
		{
			int nx = dx[i] + x;
			int ny = dy[i] + y;
			if (range(nx, ny))
			{
				table[ny][nx]++;
			}
		}
	}
}
int main()
{
	int x = 0, y = 0, size = 0;
	int count = 0;
	int Max = 0;
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			table[i][j] = 0;
		}
	}
	string s;
	while (cin >> s)
	{
		x = s[0] - '0';
		y = s[2] - '0';
		size = s[4] - '0';
		draw(x, y, size);
	}
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			if (table[i][j] == 0)count++;
			Max = max(Max, table[i][j]);
		}
	}
	cout << count << endl;
	cout << Max << endl;
	return 0;
}

Measured memory_bytes: 1180
import java.util.*;

public class Main {

    int H, W;
    boolean[][] rg, bg, pg;

    void run() {

        Scanner sc = new Scanner(System.in);

        H = sc.nextInt();
        W = sc.nextInt();

        rg = new boolean[H][W];
        bg = new boolean[H][W];
        pg = new boolean[H][W];


        for (int h = 0; h < H; h++) {
            if (h % 2 == 0) {
                for (int w = 0; w < W; w++) rg[h][w] = true;
            } else {
                for (int w = 0; w < W; w++) bg[h][w] = true;
            }
            bg[h][W - 1] = rg[h][0] = true;
            rg[h][W - 1] = bg[h][0] = false;
        }

        for (int h = 0; h < H; h++) {
            String l = sc.next();
            for (int w = 0; w < W; w++) {
                if (l.charAt(w) == '#') bg[h][w] = rg[h][w] = true;
                pg[h][w] = bg[h][w] & rg[h][w];
            }
        }
        printBoard(rg);

        System.out.println();

        printBoard(bg);
    }

    void printBoard(boolean[][] b) {
        for (int h = 0; h < H; h++) {
            for (int w = 0; w < W; w++) System.out.print(b[h][w] ? '#' : '.');
            System.out.println();
        }
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}

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

std::vector<ll> Eratosthenes(ll N )
{
    std::vector<bool> is_prime( N + 1 );
    for( int i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;
    }
    std::vector<ll> P;
    for( int i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( int j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}

ll gcd(ll a, ll b){
    ll r;
    while(r=a%b){
        a = b;
        b = r;
    }
    return b;
}


int main(){
    int M = 1001001;
    vector<ll> sosu;
    sosu = Eratosthenes(M);
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    map<ll,int> mp;
    bool flg = false;
    rep(i,N){
        if(flg) break;
        if(A[i]==1) continue;
        if(binary_search(sosu.begin(),sosu.end(),A[i])){
            if(mp[A[i]]>0){
                flg = true;
                break;
            }
            mp[A[i]] = 1;
        }else{
            for(int j=0;sosu[j]<=A[i];j++){
                if(A[i]%sosu[j]==0){
                    if(mp[sosu[j]]>0){
                        flg = true;
                        break;
                    }
                    mp[sosu[j]] = 1;
                }
            }
        }
    }
    if(!flg){
        cout << "pairwise coprime" << endl;
    }else{
        ll tm = A[0];
        rep(i,N){
            tm = gcd(tm,A[i]);
        }
        if(tm==1){
            cout << "setwise coprime" << endl;
        }else{
            cout << "not coprime" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 12076
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A <= C && C <= B) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define M 100005
int n,q,i,x,y,h[M],nx[M<<1],r[M<<1],c[M],v[M],tot,s,d,l,si[M],son[M],top[M],dep[M],fa[M],ans[M],cc[M],cs[M];
void add(int x,int y) {
	r[++tot]=y,nx[tot]=h[x],h[x]=tot;
}
struct node {
	int x,c,d,id;
} w;
vector<node>a[M],b[M];
void dfs(int x,int f) {
	si[x]=1,fa[x]=f;
	for(int i=h[x]; i!=-1; i=nx[i])
		if(r[i]!=f) {
			for(int j=0; j<a[r[i]].size(); j++)
				if(a[r[i]][j].x==x) {
					c[r[i]]=a[r[i]][j].c,v[r[i]]=a[r[i]][j].d;
					break;
				}
			dep[r[i]]=dep[x]+v[r[i]],dfs(r[i],x),si[x]+=si[r[i]];
			if(si[r[i]]>si[son[x]])son[x]=r[i];
		}
}
void rdfs(int x,int f) {
	if(son[x])top[son[x]]=top[x],rdfs(son[x],x);
	for(int i=h[x]; i!=-1; i=nx[i])
		if(r[i]!=f&&r[i]!=son[x])top[r[i]]=r[i],rdfs(r[i],x);
}
int lca(int x,int y) {
	while(top[x]!=top[y])
		if(dep[top[x]]<dep[top[y]])y=fa[top[y]];
		else x=fa[top[x]];
	return dep[x]>dep[y]?y:x;
}
void redfs(int x,int f) {
	for(int i=0; i<b[x].size(); i++)
		ans[b[x][i].id]+=b[x][i].x*(cc[b[x][i].c]*b[x][i].d-cs[b[x][i].c]);
	for(int i=h[x]; i!=-1; i=nx[i])
		if(r[i]!=f)cc[c[r[i]]]++,cs[c[r[i]]]+=v[r[i]],redfs(r[i],x),cc[c[r[i]]]--,cs[c[r[i]]]-=v[r[i]];
}
int main() {
	scanf("%d%d",&n,&q),memset(h,-1,sizeof(h));
	for(i=1; i<n; i++)scanf("%d%d%d%d",&x,&y,&s,&d),add(x,y),add(y,x),a[x].push_back((node)<%y,s,d%>),a[y].push_back((node)<%x,s,d%>);
	dfs(1,0),rdfs(1,0);
	for(i=1; i<=q; i++)scanf("%d%d%d%d",&s,&d,&x,&y),l=lca(x,y),ans[i]=dep[x]+dep[y]-2*dep[l],w=(node)<%1,s,d,i%>,b[x].push_back(w),b[y].push_back(w),w.x=-2,b[l].push_back(w);
	redfs(1,0);
	for(i=1; i<=q; i++)printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 26996
use proconio::input;

// use std::cmp::*;
// use std::collections::*;
// use proconio::marker::Chars;

fn main() {
    input! {
        // s: String
        // n: isize
        a:i64,
        b:i64,
        c:i64,
    }
    let mut ans = if a+b==c || a+c==b || a==b+c{
        "Yes"
    }else{
        "No"
    };
    println!("{}",ans);
}


Measured memory_bytes: 2148
// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"8 3
ACACTACG
3 7
2 3
1 8
"# => r#"2
0
3
"#,
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        n: usize,
        q: usize,
        s: chars,
        lr: [(usize, usize); q],
    }

    let mut ans:String = "".to_string();

    let mut t = vec![0; n];
    for i in 0..n-1 {
        t[i + 1] = t[i] + if s[i] == 'A' && s[i + 1] == 'C' { 1 } else { 0 };
    }
    // println!("{:?}", t);

    for i in 0..q {
        // println!("l({})={}, r({})={}", lr[i].0, t[lr[i].0-1], lr[i].1, t[lr[i].1-1]);
        ans.push_str(&format!("{}\n", t[lr[i].1-1] - t[lr[i].0-1]));
    }

    ans.to_string()
}

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

int main(){
    int array[3];
    cin>>array[0]>>array[1]>>array[2];
    int tmp;
    if(array[0]>array[1]){
        tmp=array[0];
        array[0]=array[1];
        array[1]=tmp;
    }
    if(array[1]>array[2]){
        tmp=array[1];
        array[1]=array[2];
        array[2]=tmp;
    }
    if(array[0]>array[1]){
        tmp=array[0];
        array[0]=array[1];
        array[1]=tmp;
    }
    cout<<array[0]<<" "<<array[1]<<" "<<array[2]<<endl;
    return 0;
}


Measured memory_bytes: 3092
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  int result = 0, n = 0, ph = 0;
  F0R(i, N) {
    int h;
    cin >> h;
    if (h <= ph) {
      n++;
    }
    else {
      chmax(result, n);
      n = 0;
    }
    ph = h;
  }
  chmax(result, n);
  cout << result;
}
#endif


Measured memory_bytes: 256
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <math.h>
using namespace std;

#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



signed main() {
	int a,n;
	cin >> n;
	vector<int>vec(n,0);
	rep(i, n-1) {
		cin >> a;
		vec[a - 1]++;
	}
	rep(i, n) {
		cout << vec[i] << endl;
	}
}



Measured memory_bytes: 4772
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 200005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;



int main() {
  int n,a,b;
  scanf("%d%d%d",&n,&a,&b);
  puts((b-a)%2?"Borys":"Alice");
  return 0;
}






















Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define debug(x)   cerr<<#x<<": "<<x<<endl;
#define all(x)     (x).begin() , (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl       '\n'
#define MAX        1000000
typedef long long int ll;
using namespace std;


const ll mod = 1e9+7;
const double eps = 1e-9;




void solve(){
    string s;
    cin>>s;
    int n = (int)s.size();
    ll ans=0;
    for(int i=0;i<n;i++) {
        for(int k=4;k<=n-i;k++) {
            string tt = s.substr(i,k);
            ll test = stol(tt);
            ans += ((test % 2019)==0);
        }
    }
    cout<<ans;
}

void sec() {
    int a , b, c, d;
    cin>>a>>b>>c>>d;
    int first = a/d + (a%d > 0);
    int second = c/b + (c%b > 0);
    if(first >= second) {
        cout<<"Yes";
    }
    else cout<<"No";
}





int main(){
    fastio
    int test=1;
    while(test--)
        sec(); 
    return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>

int main(void){
	
	int a[10001],n,i,min,max;
	long sum;
	
	sum=0;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		if(i==0){
			min=a[i];
			max=a[i];
		}
		else if(min>a[i]){
			min=a[i];
		}
		else if(max<a[i]){
			max=a[i];
		}
		sum+=(long)a[i];
	}
	printf("%d %d %ld\n",min,max,sum);
	
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(void)
{
	int a,b,c,d,p,x,y;
	scanf("%d %d %d %d %d",&a,&b,&c,&d,&p);
	x=a*p;
	if(p<c)	{
	y=b;
	}
	else	{
	y=(p-c)*d+b;
	}
	//printf("x=%d y=%d\n",x,y);
	if(y<x)	{
	printf("%d\n",y);
	}
	else	{
	printf("%d\n",x);
	}
	return 0;
}


Measured memory_bytes: 2756
N = int(input())
a = input().split()
for i in range(N):
    a[i] = int(a[i])

a.sort(reverse = True)
alice = 0
bob = 0
for i in range(N):
    if i % 2 == 0:
        alice += a[i]
    else:
        bob += a[i]
print(alice-bob)

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

#define lli long long int
#define ld long double
#define DEFO(n) lli n = 0;
#define MAX(n) lli n = 9000000000000000000;
#define MIN(n) lli n = 9000000000000000000;
#define MAX_D(n) ld n = 4500;
#define MIN_D(n) ld n = -4500;
#define LLI(n) \
  lli n;       \
  cin >> n;
#define LD(n) \
  ld n;       \
  cin > n;
#define LLIV(a, n)            \
  vector<lli> a(n);           \
  for (lli i = 0; i < n; i++) \
  {                           \
    cin >> a.at(i);           \
  };
#define LLIV2(a, b, n)         \
  vector<lli> a(n), b(n);      \
  for (lli i = 0; i < n; i++)  \
  {                            \
    cin >> a.at(i) >> b.at(i); \
  };
#define LLIV3(a, b, c, n)         \
  vector<lli> a(n), b(n), c(n);      \
  for (lli i = 0; i < n; i++)  \
  {                            \
    cin >> a.at(i) >> b.at(i) >> c.at(i); \
  };
#define LDV(a, n)             \
  vector<ld> a(n);            \
  for (lli i = 0; i < n; i++) \
  {                           \
    cin >> a.at(i);           \
  };
#define STR(n) \
  string n;    \
  cin >> n;
#define STRV(a, n)             \
  vector<string> a(n);            \
  for (lli i = 0; i < n; i++) \
  {                           \
    cin >> a.at(i);           \
  };
#define SUM(n) accumulate(n.begin(), n.end(), 0);
#define SORT(n) sort(n.begin(), n.end());
#define REVE(n) reverse(n.begin(), n.end());
#define yes              \
  cout << "Yes" << endl; \
  return 0;
#define no              \
  cout << "No" << endl; \
  return 0;
#define none            \
  cout << "None" << endl; \
  return 0;
#define C45(n) (n + 1) / 2
#define OUT(n) cout << n << endl;
#define SRC(n, c)                    \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    if (s.at(i) == c)                \
    {                                \
      n++;                           \
    }                                \
  };
//こぴー
/*#define ZISYO(s, S)                  \
  for (lli i = 0; i < s.size(); i++) \
  {                                  \
    S.at(i) = s.at(i);               \
  }                                  \
  Sort(S) Reve(S) for (lli i = 0; i < s.size(); i++) { s.at(i) = S.at(i); };
*/

//素数
bool IsPrime(lli num)
{
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  long double sqrtNum = sqrt(num);
  for (lli i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)
      return false;
  }
  return true;
}
//各桁の和
lli KSum(lli n)
{
  lli sum = 0;
  if (n < 0)
    return 0;
  while (n > 0)
  {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

//数値反転
bool KReve(lli n)
{
  int reverse = 0;
  int remaind;
  int tmp = n;
  while (tmp != 0)
  {
    remaind = tmp % 10;
    reverse = reverse * 10 + remaind;
    tmp /= 10;
  }
  if (reverse == n)
    return true;
  else
    return false;
}

int main(void)
{
  ios::sync_with_stdio(false);
  LLI(N) LLI(R)
  if(N<10) {
    N=100*(10-N);
    R+=N;
  }
  OUT(R)
}


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


int main(){
  int n;cin>>n;
  vector<string> word(n);
  bool same_word = false;
  bool same_digit = true;
  for(int i=0;i<n;++i) cin>>word[i];
  for(int i=0;i<n;++i){
    for(int j=0;j<n;++j){
      if(word[i] == word[j] && i!=j){
        same_word = true;
        break;
      }
    }
    if(same_word) break;
  }
  if(same_word){
    cout<<"No"<<endl;
  }else{
    for(int i=1;i<n;++i){
      if(word[i-1][word[i-1].size()-1] != word[i][0]){
        same_digit =false;
        break;
      }
    }
    if(same_digit) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

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

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

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

const int MAXN = 1e5 + 5;
int n;
int arr[3][MAXN];
int memo[4][MAXN];
int dp(int prev, int i) {
  int &res = memo[prev][i];
  if (res != -1) return res;
  if (i == n) return res = 0;
  res = 0;
  for (int c = 0; c < 3; c++) {
    if (prev == c) continue;
    res = max(res, dp(c, i+1) + arr[c][i]);
  }
  return res;
}

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

    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> arr[0][i] >> arr[1][i] >> arr[2][i];
    }
    memset(memo, -1, sizeof memo);
    cout << dp(3, 0) << endl;
}


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

using namespace std;
typedef vector<int> vi;

int N, P;
vector<vi> ds, cs;

void dfs(int i, int j) {
	int d = ds[i][j]+cs[i][j];
	if(i > 0 && d < ds[i-1][j]) {
		ds[i-1][j] = d;
		dfs(i-1, j);
	}
	if(i+1 < N && d < ds[i+1][j]) {
		ds[i+1][j] = d;
		dfs(i+1, j);
	}
	if(j > 0 && d < ds[i][j-1]) {
		ds[i][j-1] = d;
		dfs(i, j-1);
	}
	if(j+1 < N && d < ds[i][j+1]) {
		ds[i][j+1] = d;
		dfs(i, j+1);
	}
}

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

	cin >> N;
	ds.assign(N, vi(N));
	cs.assign(N, vi(N, 1));
	for(int i = 0; i < N; ++i)
		for(int j = 0; j < N; ++j)
			ds[i][j] = min(i, min(j, min(N-1-i, N-1-j)));
	int res = 0;
	for(int n = 0; n < N*N; ++n) {
		cin >> P; --P;
		int i = P/N, j = P%N;
		res += ds[i][j];
		cs[i][j] = 0;
		dfs(i, j);
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 27808
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
#define fin {cout<<-1<<endl;return 0;}
//template
//main
signed main(){
  int N;cin>>N;
  typedef pair<int,int> P;
  set<P> s;
  s.insert(P(-LINF,0));
  while(N--){
    int a;cin>>a;
    P p=*--s.lower_bound(P(a,N));
    if(p.first>=0)s.erase(p);
    s.insert(P(a,N));
  }
  cout<<s.size()-1<<endl;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define NIL -1
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<vector<char>>;
using P =pair<int,int>;

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const ll mod=1000000007;

int main(){
    double  a,b,x;
    cin>>a>>b>>x;
    double s=x/a;
    double rad=0;
    if(s>=a*b/2){
        double h=(a*b-s)*2/a;
        rad=atan2(h,a);
    }else{
        double w=s*2/b;
        rad=atan2(b,w);
    }
    double PI=acos(-1);
    double deg=rad/(2*PI)*360;
    printf("%.10f\n",deg);
    return 0;
}

Measured memory_bytes: 4144
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val N = sc.nextLong()

    def solve(): Int = {
      val L = N.toString.length

      def dfs0(i: Int): Int =
        if (i < L - 3)
          dfs0(i+1) + dfs1(i+1, 0, false, false, false)
        else 0

      def dfs1(i: Int, count: Int, seven: Boolean, five: Boolean, three: Boolean): Int =
        if (i < L)
          dfs1(i+1, count + 7 * Math.pow(10, L - i - 1).toInt, true, five, three) +
          dfs1(i+1, count + 5 * Math.pow(10, L - i - 1).toInt, seven, true, three) +
          dfs1(i+1, count + 3 * Math.pow(10, L - i - 1).toInt, seven, five, true)
        else if (seven && five && three && count <= N) 1
        else 0

      val head = N.toString.head.toInt
      if (head >= 7)
        dfs1(1, 7 * Math.pow(10, L - 1).toInt, true, false, false) +
        dfs1(1, 5 * Math.pow(10, L - 1).toInt, false, true, false) +
        dfs1(1, 3 * Math.pow(10, L - 1).toInt, false, false, true) + dfs0(0)
      else if (head >= 5)
        dfs1(1, 5 * Math.pow(10, L - 1).toInt, false, true, false) +
        dfs1(1, 3 * Math.pow(10, L - 1).toInt, false, false, true) + dfs0(0)
      else if (head >= 3)
        dfs1(1, 3 * Math.pow(10, L - 1).toInt, false, false, true) + dfs0(0)
      else dfs0(0)
    }

    println(solve())
  }

}


Measured memory_bytes: 27300
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;
long long int MOD = 1000000007;

#define MAX_V 1000

struct edge{
	long long int to, cap, rev; // 行き先、容量、逆辺
};

vector<edge> G[MAX_V] = {};
bool used[MAX_V];

// from から to へ向かう容量 cap の辺を張る
void add_edge(long long int from, long long int to, long long int cap){
	G[from].push_back((edge){to, cap, G[to].size()});
	G[to].push_back((edge){from, cap, G[from].size() - 1}); // 無向辺
}

// 増加パスを dfs で探す
long long int dfs(int v, int t, long long int f){
	if(v == t){
		return f;
	}
	used[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		edge &e = G[v][i];
		if(!used[e.to] && e.cap > 0){
			long long int d = dfs(e.to, t, min(f, e.cap));
			if(d > 0){
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

// s から t への最大流を求める
long long int max_flow(int s, int t){
	long long int flow = 0;
	while(true){
		fill(used, used + MAX_V, 0);
		long long int f = dfs(s, t, INF);
		if(f == 0){
			return flow;
		}
		flow += f;
	}
}

int main(){
	int N, M, S, T;
	cin >> N >> M;
	map<P, int> m;
	for(int i = 0; i < M; i++){
		P p;
		cin >> p.first >> p.second;
		p.first--;
		p.second--;
		m[p] = i + 1;
		add_edge(p.first, p.second, 1);
	}
	cin >> S >> T;
	S--;
	T--;
	long long int F = max_flow(S, T);
	
	vector<int> vec;
	for(int i = 0; i < N; i++){
		for(int j = 0; j < G[i].size(); j++){
			int u = i;
			int v = G[i][j].to;
			P p = make_pair(v, u);
			if(G[i][j].cap == 0 && m.find(p) != m.end()){
				vec.push_back(m[p]);
			}
		}
	}
	cout << F << endl;
	
	cout << vec.size() << endl;
	
	sort(vec.begin(), vec.end());
	
	for(int i = 0; i < vec.size(); i++){
		cout << vec[i] << endl;
	}
	
	return 0;
}



Measured memory_bytes: 3332
def gcd(a,b):
    if a%b == 0:
        return b
    else:
        return gcd(b, a%b)
ans = 1
def fact(n):
    global ans
    p = 2
    while p**2 <= n:
        flag = False
        while n%p == 0:
            flag = True
            n /= p
        p += 1
        if flag:
            ans += 1
    if n!= 1:
        ans += 1
a,b = map(int, input().split())
g = gcd(a,b)
fact(g)
print(ans)

Measured memory_bytes: 62840
n = int(input())
t = [[0, 0, 0]]
for i in range(n):
    t.append(list(map(int, input().split())))
for i in range(0, n):
    time = t[i+1][0] - t[i][0]
    move = t[i+1][1] + t[i+1][2] - (t[i][1] + t[i][2])
    if(move > time or move%2 != time%2):
        print("No")
        exit()
print("Yes")

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

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var N = sc.nextInt();
        var p = sc.ArrayInt(N);
        Array.Sort(p);
        Array.Reverse(p);
        var ans = 0;
        for (int i = 0; i < N; i++) {
            if (i == 0) {
                ans += p[i] / 2;
            } else {
                ans += p[i];
            }

        }
        WriteLine(ans);
    }
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


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

using namespace std;

typedef long long int Int;

int main(void)
{
    int m = 0;
    int n,x = 0;
    string s;
    cin>>n;
    cin>>s;

    for(int i = 0;i < n;i++)
    {
	if(s[i] == 'D')
	{
	    x--;
	} else {
	    x++;
	}

	m = max(m,x);
    }

    cout<<m<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
using namespace std;
 
int main(){
    char str[20001];
    int m,tmp,length;
    while(true){
        scanf("%s",str);
        if(str[0] == '-') break;
        length = 0;
        for(int k = 0; str[k] != '\0';k++) length++;
        scanf("%d",&m);
        int index = 0;
        for(int i = 0; i < m; i++){
            scanf("%d",&tmp);
            for(int j = 0; j < tmp; j++){
                str[index+length] = str[index];
                index++;
            }
        }
        for(int p = 0; p < length; p++){
            printf("%c",str[index+p]);
        }
        printf("\n");
    }
}


Measured memory_bytes: 2616
import java.util.Scanner;

public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);


		int n = sc.nextInt();
		int w_max = sc.nextInt();
		int[] w = new int[n+1];
		long[] v = new long[n+1];
		long[][] dp = new long[n+1][w_max+1];
		for(int i=1;i<=n;i++)
		{
			w[i] = sc.nextInt();
			v[i] = sc.nextLong();
		}
		for(int i=0;i<=n;i++)
		{
			dp[i][0]=0;
		}
		for(int i=0;i<=w_max;i++)
		{
			dp[0][i]=0;
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=w_max;j++)
			{
				if(w[i]<=j)
				{
					dp[i][j]=Math.max(v[i]+dp[i-1][j-w[i]], dp[i-1][j]); 
				}
				else
				{
					dp[i][j]=dp[i-1][j];
				}
			}
		}

		System.out.println(dp[n][w_max]);





	}
}

Measured memory_bytes: 126932
<?php
$n = fgets(STDIN, 4096);
for ($a=1; $a<=$n-1 ;$a++)
{
  preg_match_all("([0-9])", $n-$a, $m);
  preg_match_all("([0-9])", $a, $o);
  $array[] = array_sum($o[0]) + array_sum($m[0]);
}
echo min($array);die();

Measured memory_bytes: 10744
class Card:
	def __init__(self, m, n, o):
		self.m = m
		self.n = n
		self.o = o
	def __str__(self):
		return str(self.m + ' ' + str(self.n))
	
def swap(a, i, j):
	tmp = a[i]
	a[i] = a[j]
	a[j] = tmp

def partition(a, f, c):
	x = a[c].n
	i = f - 1
	for j in range(f, c):
		if a[j].n <= x:
			i += 1
			swap(a, i, j)
	swap(a, i + 1, c)
	return i + 1

def quick_sort(a, f, c):
	if (f < c):
		q = partition(a, f, c)
		quick_sort(a, f, q - 1)
		quick_sort(a, q + 1, c)

def check_stability(a):
	for i in range(1, len(a)):
		c1 = a[i-1]
		c2 = a[i]
		if (c1.n == c2.n and c1.o > c2.o):
			return False
	return True
		
n = int(input())
cards = []
for i in range(n):
	m, num = map(str, input().split())
	cards.append(Card(m, int(num), i))

quick_sort(cards, 0, n - 1)
if (check_stability(cards) == True):
	print('Stable')
else:
	print('Not stable')
for i in range(n):
	print(cards[i])



Measured memory_bytes: 29656
#include <cstdio>

using namespace std;

int n;

int main() {
	scanf("%d", &n);
	if (n & 1) {
		printf("%d\n", (n - 1) * n / 2 - (n / 2));
		for (int i = 1; i < n; i++) {
			for (int j = i + 1; j <= n; j++) {
				if (i + j == n) continue;
				printf("%d %d\n", i, j);
			}
		}
	} else {
		printf("%d\n", (n - 1) * n / 2 - (n / 2));
		for (int i = 1; i <= n; i++) {
			for (int j = i + 1; j <= n; j++) {
				if (i + j == n + 1) continue;
				printf("%d %d\n", i, j);
			}
		}
	}
	return 0-0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
  int a, b, c, d;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  while(a > 0 && c > 0) {
    c-=b;
    if(c > 0) a-= d;
  }
  if(c <= 0) printf("Yes\n");
  else printf("No\n");
}

Measured memory_bytes: 1660
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cmath>
#include<string>
using namespace std;

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

    string s;
    cin >> s;
    for(int i=0;i<s.size();i++){
            s[i] = s[i] + n;
            if(s[i]>'Z'){
                s[i] = 64 + (s[i]-'Z');
            }
    }
    cout << s << endl;
    return 0;
}



Measured memory_bytes: 3516
buf[300000];char*p=buf,*q;
i,j;in[2];
a[101],b[101];
main(){
	read(0,buf,11000);
	for(;*p>10;p+=1);
	p+=1;
	q=p;
	for(;*p;p+=1)
	{
		a[i]|=*p=='#';
		b[j]|=*p=='#';
		j+=1;
		if(*p==10)b[j-1]=1,i+=1,j=0;
	}
	i=j=0;
	for(;*q;q+=1)
	{
		a[i]&&b[j]&&putchar_unlocked(*q);
		j+=1;
		if(*q==10)i+=1,j=0;
	}
}


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

string S[100005];

int main()
{
    ll N;
    cin >> N;
    ll s = 0;
    ll a = 0, b = 0, ab = 0;
    REP(i, N)
    {
        cin >> S[i];
        int n = S[i].length();
        REP(j, n - 1)
        {
            if (S[i][j] == 'A' && S[i][j + 1] == 'B')
                s++;
        }
        if (S[i][0] == 'B' && S[i][n - 1] == 'A')
            ab++;
        else if (S[i][0] == 'B')
            b++;
        else if (S[i][n - 1] == 'A')
            a++;
    }
    if (ab > 0)
    {
        s += ab - 1;
        if (a > 0)
        {
            s++;
            a--;
        }
        if (b > 0)
        {
            b--;
            s++;
        }
    }
    s += std::min(a, b);

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 1536
def main():
    import sys
    input = sys.stdin.readline

    H, W = map(int, input().split())
    grid_p = []
    for _ in range(H):
        grid_p.append(input().rstrip('\n'))

    grid_r = [['.'] * W for _ in range(H)]
    grid_b = [['.'] * W for _ in range(H)]
    for w in range(W):
        grid_r[0][w] = '#'
        grid_b[-1][w] = '#'
    for h in range(1, H-1):
        for w in range(W):
            if w%2:
                grid_r[h][w] = '#'
            else:
                grid_b[h][w] = '#'
    for h in range(H):
        for w in range(W):
            if grid_p[h][w] == '#':
                grid_r[h][w] = '#'
                grid_b[h][w] = '#'

    [print(''.join(line)) for line in grid_r]
    print('')
    [print(''.join(line)) for line in grid_b]

    '''
    ans = [['.'] * W for _ in range(H)]
    for h in range(H):
        for w in range(W):
            if grid_r[h][w] == grid_b[h][w] == '#':
                ans[h][w] = '#'
    print('')
    [print(''.join(line)) for line in ans]
    '''


if __name__ == '__main__':
    main()


Measured memory_bytes: 45808
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define eb emplace_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vl> vvl;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 1e3+5;
const lli INF = 1e18;
const lli MOD = 1e9+7;

bool mm[N];
vi primes(1,2);
ld nk[N][N];
void sieve(){
	for(int i = 4; i<N; i+=2)mm[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!mm[i])for(int j = i*i; j<N; j+=i)mm[j]=1;
	for(int i = 3; i<N; i+=2)if(!mm[i])primes.pb(i);
}

void pascal(){
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

// ---- コーディングはここから！ ('-')7


int main(){_
	int n,k; cin>>n>>k;
	vl x,y;
	int z = 0;
	fore(i,0,n){
		lli a; cin>>a;
		if(a<0)x.pb(abs(a));
		if(a>0)y.pb(a);
		if(a==0)z++;
	}
	auto impar = [&](){
		fore(i,0,sz(y))x.pb(y[i]);
		fore(i,0,z)x.pb(0);
		sort(all(x));
		lli res = 1;
		fore(i,1,k) res = (res*x[i])%	MOD;
		res=(res*(MOD-x[0])%MOD)%MOD;
		return res;
	};
	auto solve = [&](){
		if(k>sz(x)+sz(y))return 0LL;
		if(sz(y)==0 and k&1)return impar();
		int a = 0, b = k&1;
		lli prod = 1,aux;
		sort(all(x),greater<lli>());
		sort(all(y),greater<lli>());
		fore(i,0,k/2){
			if(a>=sz(x)-1 and b>=sz(y)-1)return impar();
			if(a>=sz(x)-1){
				aux = (y[b]*y[b+1])%MOD;
				b+=2;
				prod = (prod *aux)%MOD;
				continue;
			}
			if(b>=sz(y)-1){
				lli aux = (x[a]*x[a+1])%MOD;
				prod = (prod *aux)%MOD;
				a+=2;
				continue;
			}
			lli aux = 1;
			if(x[a]*x[a+1]>y[b]*y[b+1]){
				aux = (x[a]*x[a+1])%MOD;
				a+=2;
			}
			else{
				aux = (y[b]*y[b+1])%MOD;
				b+=2;
			}
			prod = (prod *aux)%MOD;
		}
		if(k&1)prod = (prod * y[0])%MOD;
		return prod;
	};
	cout<<solve()<<ENDL;





}


Measured memory_bytes: 6204
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    static int N;
    static HashMap<String, Long> m;

    private static void init() {
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();

        scanner.nextLine();

        long cnt = 0;
        m = new HashMap<>();
        for(int i = 0; i < N; i++) {
            String line = scanner.nextLine();
            ArrayList<Character> list = new ArrayList<>();
            for(int j = 0; j < 10; j++) {
                list.add(line.charAt(j));
            }
            Collections.sort(list);
            StringBuilder sb = new StringBuilder();
            for(Character c: list) {
                sb.append(c);
            }
            String srt = sb.toString();
            if(m.containsKey(srt)) {
                cnt += m.get(srt);
                m.put(srt, m.get(srt) + 1);
            } else {
                m.put(srt, (long) 1);
            }
        }

        System.out.println(cnt);
        scanner.close();
    }


    public static void main(String args[]) {
        init();
    }
}


Measured memory_bytes: 178136
import java.util.Scanner;

public class Main {
	static Process[] stack;
	static int firstPointer = 0;
	static int lastPointer;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int processNum = sc.nextInt();
		int quanTime = sc.nextInt();
		stack  = new Process[processNum + 1];
		for(int i = 0; i < processNum; i++) {
			Process process = new Process(sc.next(), sc.nextInt());
			stack[i] = process;
		}
		sc.close();
		lastPointer = processNum - 1;
		int time = 0;
		Process[] answerProcesses = new Process[processNum];
		int answerProcessesIndex = 0;
		while(stack[firstPointer] != null) {
			Process process = dequene();
			int processTime = process.time;
			if(processTime <= quanTime) {
				time += processTime;
				process.time = time;
				answerProcesses[answerProcessesIndex] = process;
				answerProcessesIndex++;
			} else {
				time += quanTime;
				process.time -= quanTime;
				enquene(process);
			}
		}
		for(Process process: answerProcesses) {
			System.out.println(process.name + " " + process.time);
		}
	}
	public static void enquene(Process process) {
		if(lastPointer == stack.length - 1) {
			lastPointer = 0;
		} else {
			lastPointer++;
		}
		stack[lastPointer] = process;
	}
	public static Process dequene() {
		Process process = stack[firstPointer];
		stack[firstPointer] = null;
		if(firstPointer == stack.length - 1) {
			firstPointer = 0;
		} else {
			firstPointer++;
		}
		return process;
	}
}
class Process {
	String name;
	int time;
	public Process(String name, int time) {
		this.name = name;
		this.time = time;
	}
}

Measured memory_bytes: 75560
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

C = A.copy()
for i in range(N):
  if C[i] < B[i]:
    if C[i] + C[i + 1] < B[i]:
      C[i], C[i + 1] = 0, 0
    else:
      C[i + 1] -= B[i] - C[i]
      C[i] = 0
  else:
    C[i] -= B[i]

print(sum(A) - sum(C))

Measured memory_bytes: 18624