akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = 2005;
ll low[N][N];

int main(){
  fastIO;
  int n;
  ll x;
  cin >> n >> x;
  ll a[n];
  for(int i = 0 ; i < n ; i ++ ){
    cin >> a[i];
  }
  for(int i = 0 ; i < n; i ++ ){
    low[i][0] = a[i];
    for(int j = 1 ; j < n; j ++ ){
      low[i][j] = min(low[i][j-1], a[(i-j+n) % n]);
    }
  }
  ll res = (ll)1e18;
  ll cur;
  for(int i = 0 ; i < n ; i ++ ){
    cur = i * x;
    for(int j = 0 ; j < n ; j ++ )
      cur += low[j][i];
    res = min(res, cur);
  }
  cout << res;
  return 0;
}

Measured memory_bytes: 31616
"""
高橋君のモンスターは体力が A で攻撃力が B です。 青木君のモンスターは体力が C で攻撃力が D

です。

高橋君→青木君→高橋君→青木君→... の順に攻撃を行います。 攻撃とは、相手のモンスターの体力の値を自分のモンスターの攻撃力のぶんだけ減らすことをいいます。 このことをどちらかのモンスターの体力が 0
以下になるまで続けたとき、 先に自分のモンスターの体力が 0

以下になった方の負け、そうでない方の勝ちです。

高橋君が勝つなら Yes、負けるなら No を出力してください。
"""
a,b,c,d=map(int,input().split())
while a>0 and c>0:
  c-=b
  if c<=0:
    print("Yes")
    exit()
  a-=d
  if a<=0:
    print("No")
    exit()

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

int main(void){
    // Your code here!
    int n;
    int i;
    int d[2];
    int cnt;

    cnt = 0;
    scanf("%d", &n);
    i = 0;
    while (i < n)
    {
        scanf("%d %d", d, d + 1);
        if (d[0] == d[1] && ++cnt == 3)
        {
            printf("Yes");
            return (0);
        }
        if (d[0] != d[1])
            cnt = 0;
        i++;
    }
    printf("No");
    
}


Measured memory_bytes: 1732
#include <cstdio>
#include <cstdlib>
#include <algorithm>

using namespace std;

int x, y;


int main(){
    scanf("%d%d", &x, &y);
    if(x < y) {printf("%d\n", min(y - x, abs(x + y) + 1)); return 0;}
  	if(x == 0 || y == 0) printf("%d\n", abs(x + y) + 1);
    else if(x < 0 && y > 0){
        printf("%d\n", abs(y + x) + 1);
    }
    else if(x > 0 && y < 0){
        printf("%d\n", abs( - y - x) + 1);
    }
    else printf("%d\n", x - y + 2);
}


Measured memory_bytes: 128
n = int(input())
xyh = []
for i in range(n):
    temp = list(map(int,input().split()))
    if temp[2] > 0:
        x,y,h = temp[0],temp[1],temp[2]
    xyh.append(temp)
for i in range(101):
    for j in range(101):
        for k in xyh:
            if k[2] > 0 and k[2]+abs(k[0]-j)+abs(k[1]-i) != h+abs(x-j)+abs(y-i):
                break
            elif k[2]+abs(k[0]-j)+abs(k[1]-i) < h+abs(x-j)+abs(y-i):
                break
        else:
            print(j,i,h+abs(x-j)+abs(y-i))
            exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define deb(x) cout << #x << "-->" << x << endl;
#define deb1a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
    {                             \
        cout << it << " ";        \
    }                             \
    cout << endl;
#define deb2a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
    {                             \
        for (auto it1 : it)       \
        {                         \
            cout << it1 << " ";   \
        }                         \
        cout << endl;             \
    }
    #define mod 1000000007



int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, d, a;
    cin >> n >> d >> a;
    vec x(n), h(n);
    map<int, int> pos;
    fo(i, n)
            cin >>
        x[i]>>h[i];
    
        fo(i,n){
            pos[x[i]] = h[i];
            if(pos[x[i]+2*d+1]==0)
                pos[x[i] + 2 * d + 1] = -1;
        }

        map<int, int> inc;
        int hh = 0;
        int ans = 0;
        for (auto it = pos.begin(); it != pos.end();it++){

            int xx = it->first;
            int yy = it->second;
            hh =hh- inc[xx];
            yy =yy- hh;
            // deb(xx);
            // deb(yy);
            // deb(hh);
            if(yy>0){
                int dval = ceil((yy * 1.0) / a);
                //deb(dval);
                hh += dval*a;
                ans += dval;
               
                inc[xx + 2 * d + 1] =inc[xx + 2 * d + 1]+ (dval*a);
                //pos[xx + 2 * d + 1] = -1;
            }
            




        }
        cout << ans;
}
  

Measured memory_bytes: 53376
#include<bits/stdc++.h>
#include <iomanip>
#include <iostream>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll max(ll a, ll b){
    if(a > b) return a;
    else return b;
}
 
ll min(ll a, ll b){
    if(a < b) return a;
    else return b;
}

int main(void){
    int N; cin >> N;
    ll power = 1;
    for(int i = 1; i <= N; i++){
        power = (power * i ) % 1000000007;
    }
    cout << power << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define rep(i,n) for(i=0;i<n;i++)
#define INF 100000000
#define min(a,b) (a<b?a:b)
int main(){
	int i,j,k,n,m,bit,next,cur,r,newCost,ret;
	int land[200][200] , ship[200][200] , R[1000] ,dp[2][200];
	while(scanf("%d%d",&n,&m) && n){
		rep(i,200)rep(j,200)land[i][j] = ship[i][j] = INF;
		rep(i,200)land[i][i] = ship[i][i] = 0;
		
		rep(i,m){
			char t;
			int a,b,c;
			scanf("%d %d %d %c\n",&a,&b,&c,&t);
			a--,b--;
			if(t=='L')land[a][b] = land[b][a] = min(c,land[a][b]);
			else  ship[a][b] = ship[b][a] = min(c,ship[a][b]);
		}
		rep(k,n)rep(i,n)rep(j,n)land[i][j] = min(land[i][j],land[i][k]+land[k][j]);
		rep(k,n)rep(i,n)rep(j,n)ship[i][j] = min(ship[i][j],ship[i][k]+ship[k][j]);
		
		scanf("%d",&r);	
		rep(i,r)scanf("%d",&R[i]) , R[i]--;
		
		rep(j,2)rep(k,200)dp[j][k] = INF;
		dp[0][R[0]] = 0;
		
		
		rep(bit,r-1){
			rep(cur,n){
				rep(next,n){
					newCost = dp[bit%2][cur] + land[R[bit]][cur] + ship[cur][next] + land[next][R[bit+1]];
					dp[(bit+1)%2][next] = min( dp[(bit+1)%2][next],newCost);
				}
				dp[(bit+1)%2][cur] = min(dp[(bit+1)%2][cur],dp[bit%2][cur]+land[R[bit]][R[bit+1]]);
			}
			rep(j,200)dp[bit%2][j] = INF;
		}
		ret = INF;
		rep(i,n)ret = min(dp[(r-1)%2][i],ret);
		printf("%d\n",ret);
	}
	return 0;
}

Measured memory_bytes: 732
#include <bits/stdc++.h>
 
using namespace std;
 
#define li long long int
#define ld double_t
#define mod (li)(1e9+9)
const int MX1=3e5+5;
const int MX2=1e6+5;
const li inf=1e18;
 
li power(li a,li b){li res=1;while(b){if(b%2)res=(res*a)%mod;
a=(a*a)%mod;b/=2;}return res;}
 
li mmi(li a){return power(a,mod-2);}
 
li cntbit(li n){li cnt=0;while(n){n&=(n-1);cnt++;}return cnt;}
 
string s;
vector<int> v;
int n,chk,x,y;
unordered_map<int,int> dp[8005],dp2[8005];
 
int f(int idx,int val){
	if(idx>=n) return val==x;
	if(dp[idx].find(val)!=dp[idx].end()) return dp[idx][val];
	int ans=0;
	ans|=f(idx+2,val+v[idx]);
	if(idx!=0) ans|=f(idx+2,val-v[idx]);
	return dp[idx][val]=ans;
}
 
int g(int idx,int val){
	if(idx>=n) return val==y;
	if(dp2[idx].find(val)!=dp2[idx].end()) return dp2[idx][val];
	int ans=0;
	ans|=g(idx+2,val+v[idx]);
	ans|=g(idx+2,val-v[idx]);
	return dp2[idx][val]=ans;
}
 
void solve(){
	cin>>s;
	int fs=0;
	for(int i=0;i<s.length();i++){
		if(s[i]=='F') fs++;
		else{
			v.push_back(fs);
			fs=0;
		}
	}
	v.push_back(fs);
	n=(int)v.size();
	cin>>x>>y;
	int ans=f(0,0);
	ans+=g(1,0);
	if(ans==2) cout<<"Yes";
	else cout<<"No";
}
 
int main(){
	ios_base::sync_with_stdio(false);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 205056
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


int main() {
	int H, W;
	cin >> H >> W;
	vector<string> S(H);
	for (int i = 0; i < H; i++)cin >> S[i];
	vector<vector<ll>> g(H*W, vector<ll>(H*W, INF));
	for (int i = 0; i < H; i++)for (int j = 0; j < W; j++) {
		for (int k = 0; k < H; k++)for (int s = 0; s < W; s++) {
			if (abs(i - k) + abs(j - s) == 1 && S[i][j] != '#' && S[k][s] != '#') {
				g[i * W + j][k * W + s] = 1;
				g[k * W + s][i * W + j] = 1;
			}
		}
	}
	for (int i = 0; i < H * W; i++)g[i][i] = 0;
	for (int k = 0; k < H * W; k++)for (int i = 0; i < H * W; i++)for (int j = 0; j < H * W; j++) {
		g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
	}
	ll ans = 0;
	for (int i = 0; i < H * W; i++)for (int j = 0; j < H * W; j++) {
		if (g[i][j] >= INF)continue;
		ans = max(g[i][j], ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1536
#include <algorithm>
#include <iostream>
#include <string>
#define MAX_N 1000
#define INF 2000000000
using namespace std;

string eraname[MAX_N];
int erabased[MAX_N], western[MAX_N];
int erafirst[MAX_N];

void search(int y, int n) {
  for (int i = 0; i < n; i++) {
    int temp = y - erafirst[i];
    if (0 < temp && temp <= erabased[i]) {
      cout << eraname[i] << ' ' << temp << endl;
      return;
    }
  }
  cout << "Unknown" << endl;
  return;
}

void init() {
  for (int i = 0; i < MAX_N; i++) {
    eraname[i] = erabased[i] = western[i] = 0;
    erafirst[i] = INF;
  }
}

int main() {
  while (true) {
    int n, q;
    cin >> n >> q;
    if (n == 0 && q == 0) return 0;

    init();

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

    for (int i = 0; i < n; i++) {
      erafirst[i] = western[i] - erabased[i];
    }

    for (int i = 0; i < q; i++) {
      int query;
      cin >> query;

      search(query, n);
    }
  }
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
int v[100001];

int main(){
    
    // 1. 入力情報取得.
    int N;
    scanf("%d", &N);
    map<int, int> me, mo;
    me[100001] = 0, mo[100001] = 0; // dummyデータとして保存.
    for(int i = 0; i < N; i++){
        scanf("%d", &v[i]);
        // 偶数番目, 奇数番目 ごとに, 各整数の出現回数を保存.
        if(i % 2 == 0) me[v[i]]++;
        else           mo[v[i]]++;
    }
    
    // 2. 出現回数の調査.
    // map -> vector に 情報 を 移し替える.
    vector<pair<int, int>> ve, vo;
    for(auto &p : me){
        int f = p.first, s = p.second;
        ve.push_back({-s, f});
    }
    for(auto &p : mo){
        int f = p.first, s = p.second;
        vo.push_back({-s, f});
    }
    
    // 昇順sort.
    sort(ve.begin(), ve.end());
    sort(vo.begin(), vo.end());
    
    // 2-1. 偶数番目, 奇数番目 で, 最大出現数 を 持つ整数が異なる場合.
    if(ve[0].second != vo[0].second){
        printf("%d\n", N + ve[0].first + vo[0].first);
        return 0;
    }
    
    // 2-2. 偶数番目, 奇数番目 で, 最大出現数 を 持つ整数が同じ場合.
    if(ve[0].second == vo[0].second){
        // 偶数番目で, 2番目に大きい整数を選択した場合.
        int v1 = N + ve[1].first + vo[0].first;
        // 奇数番目で, 2番目に大きい整数を選択した場合.
        int v2 = N + ve[0].first + vo[1].first;
        // 大小比較して, 小さい方を出力.
        printf("%d\n", min(v1, v2));
    }
    
    return 0;
    
}

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

typedef   long long  int ll;
typedef  long double ld;
typedef std::vector<ll> vi;
typedef std::vector<std::vector<ll> > vv;

#define MOD 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,b) for(i=a;i<b;i++)
#define mp make_pair
#define pb(x) push_back(x)
#define fi first
#define se second
#define print(vec,a,b) for(ll i=a;i<b;i++) cout<<vec[i]<<" ";cout<<endl;
#define all(a) a.begin(),a.end()
#define input(vec,a,b) for(ll i = a;i<b;i++) cin>>vec[i];
#define ms(a,val) memset(a,val,sizeof(a))
using namespace std;

const int N = 1e5 + 5;


void solve(){
            ll i,j,n,m,k;
            
            
            cin>>n>>k;
            ll a[n];
            ll mincost[N];
            ms(mincost,0);
            input(a,0,n);
            
            fo(i,1,n)
            {
				ll minn = INT_MAX;
				for(j = i-1;j>=0&&j>=i-k;j--)
				{
					//if(i==n-1)
					//cout<<abs(a[i]-a[j])<<endl;
					minn = min(minn,mincost[j]+abs(a[j]-a[i]));//,mincost[i-2]+abs(a[i-2]-a[i]));
					
				}
				mincost[i] = minn;
			}
			//print(mincost,0,n);
             cout<<mincost[n-1]<<endl;
            
    
            
						            









}

int main()
{
    IO;
      ll t=1;
      //cin>>t;


      while(t--)
      {

          solve();
      }
    return 0;
}


Measured memory_bytes: 5188
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	int A[N];
	int index = 0;
	rep(i, N) {
		cin >> A[i];
		if (A[i] == 1) index = i;
	}
	int left = index;
	int right = index;
	int ans = 0;
	while (left > 0) {
		left -= K - 1;
		ans++;
	}
	while (right < N - 1) {
		right += K - 1;
		ans++;
	}
	cout << (N - 1 + K - 2) / (K - 1) << endl;
		

    return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	char a[4],b[4],c[4];
	scanf("%s",a);
	scanf("%s",b);
	scanf("%s",c);
	printf("%c%c%c\n",a[0],b[1],c[2]);
	return 0;
}
		

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    int ans=0;
    if(s[0]=='R'){
        ++ans;
        if(s[1]=='R'){
            ++ans;
            if(s[2]=='R'){
                ++ans;
            }
        }
    }else{
        if(s[1]=='R'){
            ++ans;
            if(s[2]=='R'){
                ++ans;
            }
        }else{
            if(s[2]=='R'){
                ++ans;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}   

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <stdlib.h>
#define ll long long
#define MOD_P 1000000007
using namespace std;

int main()
{
	int n, k, j;
	cin >> n >> k;
	vector<int> dp(n);
	double ratio = 0.0;

	for (int i = 1; i <= n; i++) {
		j = i;
		dp[i - 1] = n;
		while (j < k) {
			j *= 2;
			dp[i - 1] *= 2;
		}
	}

	for (int i = 0; i < n; i++) {
		ratio += 1.0 / (double)dp[i];
	}

	printf("%.12f", ratio);

	return 0;
}

Measured memory_bytes: 640
package main


import (
	"fmt"
)

func main() {
	var a int
	var c []int
	fmt.Scan(&a)

	for i := 0; i < a; i++ {
		var b int
		fmt.Scan(&b)
		c = append(c,b)
	}

	count := 0
	fmt.Println(calc(c, count))
}

func calc(c []int, count int) int{
	for k,v := range c {
		if v % 2 == 0 {
			c[k] = v / 2
			if k == len(c) - 1 {
				count++
				return calc(c, count)
			} else {
				continue
			}
		} else {
			return count
		}
	}
	return count
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {

    Scanner sc = new Scanner(System.in);

    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int divisorCount = 0;
    
    for(int i = a; i <= b; i++){
        if(c % i == 0) divisorCount++;
    }

    System.out.println(divisorCount);
        
    }
}


/*覚えよう！！
  
 今回は無し
　　
*/
   
   
/*前回の内容！！
 
〇import java.util.Arrays;は重要↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 
・Arrays：ソート（並べ変え）や検索など、配列を操作するための機能
 
・並べ変えするとき
　import java.util.Arrays;を上に書く
　class Main内に Arrays.sort(a); と書く　←　このとき()内は配列の変数名
　
〇配列とは、同じ変数名に複数の値を入力できる箱
 
　※イメージ
    前回まで、a = 1, b = 2, c = 3など各変数名は1箱に値を代入できない
    今回の配列はa[0] = 1, a[1] = 2, a[2] = 3 のように変数名aは3つの箱に値を代入できる。
    注意：配列の箱は｢ 0 ｣から開始する
 
 
・複数のif(条件)：かつ｢ && ｣とまたは｢ || ｣の２つを使用する
　※かつ｢ && ｣：「真 && 真 = 真」, 「真 && 偽 = 偽」, 「偽 && 真 = 偽」 ,「偽 && 偽 = 偽」の4つの条件
　　または｢ || ｣：「真 && 真 = 真」, 「真 && 偽 = 真」, 「偽 && 真 = 真」 ,「偽 && 偽 = 偽」の4つの条件
 
 
・関係を比較する：if(条件式)
　例：if(2 < 3) この条件は｢真（成立）｣　→　何か命令があれば実行する
　　　if(5 < 3) この条件は｢偽（不成立）｣　→　何か命令があれば実行しない
　　　
・比較の条件式：等しいか比較｢==｣、等しくないか比較｢!=｣ 
　　　　　　　　大きいか比較｢<｣、小さいか比較｢>｣
　　　　　　　　以上の比較｢<=｣、以下の比較｢>=｣
  
  
・else；ifの条件以外の場合に使用する。
　例：if(雨 == 降っている) System.out.println("傘を持って行く");
　　　else System.out.println("傘を持って行かない");
　
  
・else if：詳細な場合分けしたいときに使用
　例：if(雨 == 降っている) System.out.println("傘を持って行く");
　　　else if(雨 == 午後から降るかも) System.out.println("念のため傘を持って行く");
　　　else System.out.println("傘を持って行かない");
  
 
  
・変数に計算結果を代入する：面積　＝　縦　×　横
　※計算は変数名でも数値でもいける
   
・四則演算：足し算｢＋｣、引き算｢－｣、掛け算｢＊｣、割り算｢／｣
　1 + 2 = 3;
　4 - 3 = 1;
　2 * 5 = 10;
　8 / 2 = 4;
   
・余りの計算：割り算の余り｢％｣
  5 % 3 = 2;
     
     
・printlnの複数表示：｢＋｣を使用
　例：println("Kobe" + "Kagikou"); = KobeKajikou
　　　println("明治 + 20 + "年"); = 明治20年　数値が入ってもOK！
   
   
   
・変数の宣言は｢型｣と｢変数名｣の２つ必要
　例：型＿変数名　→　int x;
　
・キーボードから入力するときは・・・｢ import java.util.Scanner; ｣ と ｢  Scanner sc = new Scanner(System.in) ; ｣が必要
   
・入力するとき・・・変数名 = sc.nextInt(); nextの後は型を書く、頭文字は大文字　
　※  scは変更しても大丈夫しかし全て変更後の文字に統一　例：nyuryoku
   
・println・・・画面に出力するときに使用
   
・文字列の表示・・・"〇〇〇の間に入力"ことが約束
   
*/


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


int main(void){
    int a[3],d;
    cin>>a[0]>>a[1]>>a[2]>>d;
    int count=0;
    for(int i=1;i<3;i++){
        if(abs(a[i]-a[i-1])>d){
            
            count=1;
        }
        if(abs(a[2]-a[0])<=d){
            count=2;
        }
    }
    if(count==0){
        cout<<"Yes"<<endl;
    }else if(count==2){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int N,num = 0;
	cin >> N;
	/*for (int c = 1; c < N; c++) {
		for (int a = 1; a < N; a++) {
			if ((N-c)%a==0) {
				num++;
			}
		}
	}*/
	int m = N-1;
	for (int a = 1; a < N; ) {
		num += m;
		a++;
		m = (N-1) / a;
	}
	cout << num << endl;
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;
string a,b,c;

ll mod(ll a)
{
	if(a<inf)return a;
	else 
	return a%inf;
}
 void test_cases()
{




string s;
cin>>s;
ll index1,index2;
for(ll i=0;i<s.size();i++)
{
	if(s[i]=='A')
	{
		index1=i;
		break;
	}
}
for(ll i=s.size()-1;i>=0;i--)
{
	if(s[i]=='Z')
	{
		index2=i;
		break;
	}
}

cout<<index2-index1+1;
}


int main()
{
    fast;
  ll t;
 // cin>>t;
 t=1;
  while(t--)
  test_cases();

  	
}

		
	
	
	
	


Measured memory_bytes: 3752
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String str = sc.next();
    	sc.close();
    	char[] s = str.toCharArray();
    	boolean flag = true, existC = false;
    	if(s.length < 4 || s.length > 10 || s[0] != 'A')
    		flag = false;
    	for(int i = 1; i < s.length && flag; ++i) {
    		if(s[i] <= 'z' && s[i] >= 'a')
    			continue;
    		else if(s[i] == 'C') {
    			if(!existC && i > 1 && i < s.length-1)
    				existC = true;
    			else
    				flag = false;
    		} else {
				flag = false;
			}
    	}
    	if(flag && existC)
    		System.out.println("AC");
    	else
    		System.out.println("WA");
    }
}

Measured memory_bytes: 21972
#if defined(__GNUC__)
#include <bits/stdc++.h>
// __GNUC__
#else
#include "bits/stdc++.h"
#endif
using namespace std;

#define int long long

#if defined(__GNUC__)
#define __int32 __int32_t
#endif // __GNUC__

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); ++(i))
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); ++(i))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) std::sort(ALL(x))
#define RSORT(x, T) std::sort(ALL(x), greater<T>())
#define REVERCE(x) std::reverce(ALL(x))
#define ACM(x, y) std::accumulate(ALL(x), y)

#define INT_POW(x, y) [](int a, int b) -> int {if(b == 0){return 1;} int c = a; REP(i, b - 1){c *= a;} return c;}(x, y)
#define INT_POWM(x, y, m) [](int a, int b, int m) -> int {if(b == 0){return 1;} int c = a; REP(i, b - 1){c *= a; c %= m;} return c;}(x, y, m)

itn main() {
	std::ios::sync_with_stdio(false);

	int kMod = 1'000'000'007;

	int n;

	cin >> n;

	vector<int> a(n);

	REP(i, n) {
		cin >> a[i];
	}

	SORT(a);

	int check = (n + 1) % 2;

	REP(i, n) {
		if (a[i] != check) {
			cout << 0;
			return 0;
		}
		if (n % 2 != i % 2) {
			check += 2;
		}
	}

	n /= 2;

	int res = INT_POWM(2, n, kMod);

	cout << res;

	return 0;
}


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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2e5 + 5;

typedef pair<int,int>   ii;

struct Edge {
    int v, c;
    Edge(int _v,int _c) : v(_v), c(_c)  {}
};

vector<Edge> E;
vector<int>  g[N];

int addEdge(int u,int v,int c)  {
    g[u].pb(sz(E)); E.pb(v,c);
    g[v].pb(sz(E)); E.pb(u,0);

    return  sz(E) - 1;
}

int S, T;
int d[N];
int p[N];

bool bfs()  {
    for(int i = 0 ; i <= T ; ++i)
        d[i] = -1,
        p[i] = 0;

    queue<int>  q;
    q.push(S);  d[S] = 0;

    while (q.size())    {
        int u = q.front();  q.pop();
        for(int i : g[u])   {
            int v = E[i].v;
            if (E[i].c == 0)    continue;
            if (d[v] < 0)   {
                d[v] = d[u] + 1;
                q.push(v);
            }
        }
    }

    return  d[T] >= 0;
}

int dfs(int u,int F)    {
    if (u == T || F == 0)   return  F;
    for(int &i = p[u] ; i < sz(g[u]) ; ++i)  {
        int j = g[u][i];
        int v = E[j].v;
        if (E[j].c == 0 || d[v] != d[u] + 1)
            continue;
        int res = dfs(v,min(E[j].c,F));
        if (res)    {
            E[j].c -= res;  j ^= 1;
            E[j].c += res;  return  res;
        }
    }
    return  0;
}

int MaxFlow()   {
    while (bfs())
    while (dfs(S,N));

    int ans = 0;

    for(int i : g[T])
        ans += E[i].c;

    return  ans;
}

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

    int R;  cin >> R;
    int C;  cin >> C;

    S = 0;
    T = R + C + 1;

    for(int i = 1 ; i <= R ; ++i)
    for(int j = 1 ; j <= C ; ++j)   {
        char c; cin >> c;

        int u = i;
        int v = j + R;

        if (c == 'S')   addEdge(S,u,N), addEdge(S,v,N);
        if (c == 'T')   addEdge(u,T,N), addEdge(v,T,N);

        if (c == 'o')   addEdge(u,v,1), addEdge(v,u,1);
    }
    int ans = MaxFlow();

    if (ans > R + C)
        ans = -1;

    cout << ans << endl;
}


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

const ll MOD = 998244353;

ll fac[201100], finv[201100], inv[201100];

void init() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<201100;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}


int main(){
    ll n,m,k;cin>>n>>m>>k;
    ll powm[200010];
    powm[0]=1;
    rep(i,1,200010){
        powm[i]=powm[i-1]*(m-1);
        powm[i]%=MOD;
    }
    ll an=0;
    init();
    rep(i,0,k+1){
        an+=(((m*fac[n-1])%MOD*finv[i])%MOD*finv[n-1-i])%MOD*powm[n-1-i];
        an%=MOD;
    }
    cout<<an<<endl;
}

    









Measured memory_bytes: 9876
N, A, B, C = [int(e) for e in input().split()]
Ls = [int(input()) for _ in range(N)]

INF = 10 **9
def optimal_value(a_step, a_cumA, a_cumB, a_cumC):
    if a_step == N:
        if min(a_cumA, a_cumB, a_cumC) == 0:
            return INF
        return abs(A - a_cumA) + abs(B - a_cumB) + abs(C-a_cumC)
     
    dA = optimal_value(a_step + 1, a_cumA + Ls[a_step], a_cumB, a_cumC)
    if a_cumA > 0:
        dA += 10
    
    dB = optimal_value(a_step + 1, a_cumA, a_cumB + Ls[a_step], a_cumC)
    if a_cumB > 0:
        dB += 10
   
    dC = optimal_value(a_step + 1, a_cumA, a_cumB, a_cumC + Ls[a_step])
    if a_cumC > 0:
        dC += 10
    
    dE = optimal_value(a_step + 1, a_cumA, a_cumB, a_cumC)
    
    return min(dA, dB, dC, dE)

print(optimal_value(0,0,0,0))


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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;


void solve(long long X, long long Y, long long Z){
	cout << Z << " " << X << " " << Y << endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    long long Z;
    scanf("%lld",&Z);
    solve(X, Y, Z);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = (1<<30);
 
int main() {
  int a[4];
  cin >> a[0] >> a[1] >> a[2];
  sort(a,a+3);

  cout << abs(a[2]-a[1]) + abs(a[1]-a[0]) << endl;
}

Measured memory_bytes: 3596
#define _CRT_SECURE_NO_WARNINGS
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream &operator << (ostream &os, const vector<T> &);
template<size_t n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, const tuple<T...> &){}
template<size_t n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream &os, const tuple<T...> &t){
    os << (n == 0 ? "" : " ") << get<n>(t); _ot<n+1>(os, t);
}
template<class...T> ostream &operator << (ostream &os, const tuple<T...> &t){
    _ot<0>(os, t); return os;
}
template<class T, class U> ostream & operator << (ostream &os, const pair<T,U> &p){
    return os << "(" << p.first << ", " << p.second << ") ";
}
template<class T> ostream &operator << (ostream &os, const vector<T> &v){
    for(size_t i = 0; i < v.size(); i++) os << v[i] << (i + 1 == v.size() ? "" : ", "); return os;
}
#ifdef DEBUG
#define dump(...) (cerr << #__VA_ARGS__ << " = " << make_tuple(__VA_ARGS__) \
                   << " (L : " << __LINE__ << ")" << endl)
#else
#define dump(...)
#endif
#define all(c) begin(c), end(c)
#define range(i,a,b) for(int i = a; i < (int)(b); i++)
#define rep(i,b) range(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using ll = long long;
// #define int ll
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
void fastios(){ ios_base::sync_with_stdio(0); cin.tie(0); }
int const mod = 1000000007;
auto const inf = numeric_limits<int>::max()/8;


using Weight = int;
using Capacity = int;
struct Edge {
    int src, dst; Weight weight;
    Edge(int s, int d, int w) : src(s), dst(d), weight(w) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;


Weight travelingSalesman(const Graph &g){
    int n = g.size();
    Matrix dp(1<<n, Array(n, inf));
    dp[0][0] = 0;
    for(int S = 0; S < 1<<n; S++){
        for(auto &es : g){
            for(auto &e : es){
                int u = e.src, v = e.dst; auto w = e.weight;
                if(~S >> v & 1) dp[S|1<<v][v] = min(dp[S|1<<v][v], dp[S][u] + w);
            }
        }
    }
    return dp[(1<<n)-1][0];
}

int main(){
    fastios();
    int n,m;
    while(cin >> n >> m){
        Graph g(n);
        rep(i,m){
            int a,b,c;
            cin >> a >> b >> c;
            g[a].eb(a,b,c);
        }
        int ans = travelingSalesman(g);
        cout << (ans==inf ? -1 : ans) << '\n';
    }
}

Measured memory_bytes: 6220
#!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor

def possible_list(n, m):
    mlist = list(range(1, m+1))
    for comb in combinations_with_replacement(mlist, n):
        comb = sorted(comb)
        yield comb

def main():
    N, M, Q = map(int, input().split())
    constraints = []
    for i in range(Q):
        a, b, c, d = map(int, input().split())
        constraints.append((a, b, c, d))

    maxvalue = 0
    for l in possible_list(N, M):
        total = 0
        for a, b, c, d in constraints:
            if l[b-1] - l[a-1] == c:
                total += d
        if total > maxvalue:
            maxvalue = total

    print(maxvalue)


if __name__ == '__main__':
    main()

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

int main()
{
    int x, y;
    cin >> x >> y;
    int ans = x + y / 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3524
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=2e6+500;
int n;char st[N];
int nxt[N];
int main()
{
    scanf("%d",&n);
    scanf("%s",st+1);scanf("%s",st+n+1);
    for(int i=1;i<=n;i++)swap(st[i],st[i+n]);
    int j=0;
    for(int i=2;i<=2*n;i++)
    {
        while(j&&st[j+1]!=st[i])j=nxt[j];
        if(st[j+1]==st[i])++j;
        nxt[i]=j;
    }
    int t=nxt[2*n];while(t>n)t=nxt[t];
    cout<<2*n-t<<endl;
}

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

int main() {
	int n, m;
	cin >> n >> m;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<pair<int, int>> sub;
	for (int i = 0, b, c; i < m; i++) {
		cin >> b >> c;
		sub.emplace_back(c, b);
	}
	sort(a, a + n, [](int a, int b) {
		return a > b;
	});
	sort(sub.begin(), sub.end(), [](auto &a, auto &b) {
		return a.first > b.first;
	});

	int a_index = 0, sub_index = 0, count = 0, num;
	long long sum = 0;
	while (count < n) {
		if (sub_index >= m || a[a_index] > sub[sub_index].first) {
			sum += a[a_index];
			a_index++;
			count++;
		} else {
			num = min(n - count, sub[sub_index].second);
			count += num;
			sum += (long long) sub[sub_index].first * num;
			sub_index++;
		}
	}
	cout << sum << endl;
}


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

const int MAXN = 200005;

int n, a[MAXN];

int main(){
	scanf("%d", &n);
	
	long long res = 0;
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
		
		if(i > 0){
			res += max(0, a[i - 1] - a[i]);
			a[i] = max(a[i], a[i - 1]);
		}
	}
	printf("%lld\n", res);
	
	return 0;
}


Measured memory_bytes: 4576
#include <bits/stdc++.h>
#include <limits>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define fi(i, n) for( int i=0 ; i<n ; i++ )
#define f(i, a, b) for( int i=a ; i<b ; i++ )
#define vi vector<int>
#define pb push_back
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
ll fact(ll n)
{
    ll ans = 1e14;
    for(ll i = 1; i<=sqrt(n); i++)
    {
        if(n%i==0)
        {
            ll sol = (i - 1) + (n/i - 1);
            ans = min(ans,sol);
        }
    }
    return ans;
}
int visited[200000] = {0};
vector<vector<int> > v(200000);
int dfs(int x)
{
    int ans = 0;
    if(visited[x]==0)
    {
        visited[x] = 1;
        ans++;
        int a = v[x].size();
        for(int j = 0;j<a;j++)
        {
            int data = v[x][j];
            ans = ans + dfs(data);
        }
    }
    return ans;
}
int main()
{
    ll n;
    cin>>n;
    ll arr[n];
    cin>>arr[0];
    ll ans = 0;
    f(i,1,n)
    {
        cin>>arr[i];
        if(arr[i]<arr[i - 1])
        {
            ans += arr[i - 1] - arr[i];
            arr[i] = arr[i - 1];
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 9492
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <string.h>
#include <string>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin >> s;
    for (int i=0; i<s.length(); i++) {
        char c = s[i];
        for (int j=i+1; j<s.length(); j++) {
            if (c == s[j]) {
                cout << "no" << '\n';
                return 0;
            }
        }
    }
    cout << "yes" << '\n';
    return 0;
}

Measured memory_bytes: 3488
//お勉強中
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const ll mask30 = (1ll << 30) - 1;
const ll mask31 = (1ll << 31) - 1;
const ll RHmod = (1ll << 61) - 1;
ll RHmul(ll A, ll B) {
	ll A1 = A >> 31;
	ll A2 = A & mask31;
	ll B1 = B >> 31;
	ll B2 = B & mask31;
	ll ret = 2 * A1 * B1 + A2 * B2 + ((A1 * B2 + A2 * B1 & mask30) << 31) + (A1 * B2 + A2 * B1 >> 30);
	return ret % RHmod;
}
ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % RHmod;
		A = A * A % RHmod;
		B >>= 1;
	}
	return kotae;
}

const ll len = 5000;
ll POW[len + 1], IPOW[len + 1], RH[len + 1];
ll RHcalc(int i, int j) {
	ll kari = (RH[j] - RH[i] + RHmod) % RHmod;
	return RHmul(kari, IPOW[i]);
}

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


	int N;
	cin >> N;
	string S;
	cin >> S;


	POW[0] = 1;
	rep(i, len) POW[i + 1] = RHmul(POW[i], 30);
	IPOW[len] = modpow(POW[len], RHmod - 2);
	rep(i, len) IPOW[len - i - 1] = RHmul(IPOW[len - i], 30);
	RH[0] = 0;
	rep(i, N) RH[i + 1] = (RH[i] + RHmul(POW[i], S[i] - 'a' + 1)) % RHmod;


	int L = 0;
	int R = N / 2 + 1;
	while (L + 1 < R) {
		int H = (L + R) / 2;

		int OK = 0;
		set<ll> ST;
		for (int i = 0; i <= N - 2 * H; i++) {
			ST.insert(RHcalc(i, i + H));
			if (ST.find(RHcalc(i + H, i + 2 * H)) != ST.end()) {
				OK = 1;
				break;
			}
		}

		if (OK) L = H;
		else R = H;
	}

	co(L);


	Would you please return 0;
}

Measured memory_bytes: 640
/*à¥à¥*/
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different.
Change variable names or change some Data structres or anything just make sure MOSS do not
Detect Anything.
Yours Faithfully
Shobhit Yadav */

/* I do not fear this new challenge. Rather like a true warrior I will rise to meet it. 
                                       -Prince Vegeta  */

 /* â€œStrength is the only thing that matters in this world. Everything else is just a delusion for the weak.â€ â€“ Vegeta */

#include<bits/stdc++.h>
using namespace std;
#define ll long long 



ll A,B;
/*ll freq[200005];*/
void solve(){
   /*memset(freq,0,sizeof(freq));*/
   string s,t;
   cin>>s>>t;
   string a = t+s;

   cout<<a<<'\n';


}



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

  return 0;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
const int MOD = 1000000007;

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

  string s; cin >> s;
  int n = s.length();
  vector<long long> ans(n+1, 0), a(n+1, 0), ab(n+1, 0);
  long long pattern = 1;
  REP(i, n) {
    if (s[i] == 'A') {
      ans[i+1] = ans[i];
      a[i+1] = (pattern + a[i]) % MOD;
      ab[i+1] = ab[i];
    } else if (s[i] == 'B') {
      ans[i+1] = ans[i];
      a[i+1] = a[i];
      ab[i+1] = (ab[i] + a[i]) % MOD;
    } else if (s[i] == 'C') {
      ans[i+1] = (ans[i] + ab[i]) % MOD;
      a[i+1] = a[i];
      ab[i+1] = ab[i];
    } else {
      ans[i+1] = (ans[i] * 3 % MOD + ab[i]) % MOD;
      a[i+1] = (a[i] * 3 % MOD + pattern) % MOD;
      ab[i+1] = (ab[i] * 3 % MOD + a[i]) % MOD;
      (pattern *= 3) %= MOD;
    }
  }
  cout << ans[n] << '\n';
  return 0;
}


Measured memory_bytes: 2896
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)

signed main(){

	lli n;
	cin>>n;
	vector<lli> a(n);
	
	lli cnt=0;
	REP(i,0,n){
		cin>>a[i];
		if(a[i]<0)cnt++;
	}

	lli sum=0;
	lli minA = INF;
	lli flag=cnt%2;

	REP(i,0,n){
		sum += abs(a[i]);
		minA = min(minA,abs(a[i]));
	}

	if(flag)sum -= 2*minA;
	cout<<sum<<endl;

	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	static StringBuffer buf = new StringBuffer();
    public static void main (String args[]){
    	Scanner sc = new Scanner(System.in);
    	int X = sc.nextInt();
    	int H = sc.nextInt();
    	int x = sc.nextInt();
    	int y = sc.nextInt();
    	int r = sc.nextInt();
    	int count = 0;
    	if(x<0){
    		count = 3;
    	}

    	if(y<0){
    		count = 3;
    	}


    	if(x+r<=X){
    	    count++;
    	}
    	if(y+r<=H){
    	    count++;
    	}

    	if(count == 2){
    	    System.out.println("Yes");
    	}else{
    	    System.out.println("No");
    	}



    }
}

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

using namespace std;

char letter[] = {"zabcdefghijklmnopqrstuvwxy"};
long long n;
stack <char> s;
int main()
{
	cin >> n;
	while(n)
	{
		int now = (n % 26); 
		s.push(letter[now]);
		if(now == 0)
		{
			n -= 26;
		}
		n /= 26;
	}
	while(!s.empty())
	{
		char now = s.top();
		printf("%c", now);
		s.pop();
	}
	return 0;
}

Measured memory_bytes: 3584
// https://ei1333.github.io/luzhiled/
// http://beet-aizu.hatenablog.com/entry/2017/01/04/113233
// http://www.prefield.com/algorithm/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vd = vector<ld>;
using vs = vector<string>;
using vb = vector<bool>;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;
using Graph = vector<vector<ll>>;
const ll INF = 1LL << 60;
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
#define tl 1'000'000'007
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REREP(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
#define REFOR(i, n, a) for (ll i = n; i >= a; i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define debug cout << "line : " << __LINE__ << " debug" << endl;
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ind(...) long double __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << endl;} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#define in1(A) REP(i,A.size()) in(A[i]);
#define in2(A,B) REP(i,A.size()) in(A[i],B[i]);
#define in3(s,t,u) REP(i,sz(s)){in(s[i] , t[i] , u[i]);}
#define in4(s,t,u,v) REP(i,sz(s)){in(s[i] , t[i] , u[i] , v[i]);}
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
struct Point{ ld x,y; };
ld dist(Point a, Point b){return sqrt(abs(a.x-b.x)*abs(a.x-b.x)+abs(a.y-b.y)*abs(a.y-b.y));} // ２点間の距離 
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b;} 
ll fact(ll n){ if(n < 2) return 1; return (n * fact(n-1))%tl; } //階乗
inline ll updiv(ll a,ll b){ return (a + b - 1) / b; } //切り上げ
template<typename T,typename U>ll ceil(T a,U b){return (a + b - 1) / b;}
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
//-------------------------------------------------------------------------------------------------
int main(){
    init();
    inl(a,b,c);
    
    
    if(c>a+b) out(((powl(c-(a+b),2)-4*a*b>0)?"Yes":"No"));
    else out("No");
}

Measured memory_bytes: 256
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(e,r){function t(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=[],n=!0,o=!1,u=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw u}}return t}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}e.exports=function(e){for(var r=t(e[0].split(" ").map(function(e){return Number(e)}),2),n=r[0],o=r[1],u=e[1].split(" ").map(function(e){return Number(e)}),i=-1,l=0;l<n-1;l++)if(u[l]+u[l+1]>=o){i=l;break}if(-1!=i){for(var f=[],a=0;a<i;a++)f.push(a+1);for(var c=n-1;c>i;c--)f.push(c);console.log("Possible");for(var s=0,p=f;s<p.length;s++){var d=p[s];console.log(d)}}else console.log("Impossible")}},function(e,r){e.exports=require("fs")}]);

Measured memory_bytes: 34156
#include <bits/stdc++.h>
using namespace std;
typedef pair<char,int> Pair;

void BubbleSort(vector<Pair> &v){
  Pair tmp;
  for(int i=0;i<v.size();i++){
    for(int j=v.size()-1;j>i;j--){
      if(v.at(j).second < v.at(j-1).second){
        tmp=v.at(j);
        v.at(j)=v.at(j-1);
        v.at(j-1)=tmp;
      }
    }
  }
}

void SelectionSort(vector<Pair> &v){
  int minj;
  Pair tmp;
  for(int i=0;i<v.size();i++){
    minj=i;
    for(int j=i;j<v.size();j++){
      if(v.at(j).second < v.at(minj).second){
        minj=j;
      }
    }
    tmp=v.at(i);
    v.at(i)=v.at(minj);
    v.at(minj)=tmp;
  }
}

int main ()
{
  int N;
  vector<Pair> v;
  cin >> N;
  char c;
  int n;
  for(int i=0;i<N;i++){
    cin >> c >> n;
    v.push_back(Pair(c,n));
  }
  vector<Pair> vs=v;
  BubbleSort(v);
  SelectionSort(vs);
  for(int i=0;i<N;i++){
    cout << v.at(i).first << v.at(i).second ;
    if(i==N-1) cout << endl << "Stable" << endl;
    else cout << " ";
  }
  for(int i=0;i<N;i++){
    cout << vs.at(i).first << vs.at(i).second ;
    if(i==N-1 && v==vs) cout << endl << "Stable" << endl;
    else if(i==N-1) cout << endl << "Not stable" << endl;
    else  cout << " ";
  }
  
  return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rea(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
/* END OF TEMPLATE */

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vvll c(n, vll(26, 0));
    vs s(n);
    rep(i, n){
        cin >> s[i];
        rep(j, SZ(s[i])){
            c[i][s[i][j]-'a']++;
        }
    }
    vll cmin(26, INF);
    rep(i, 26){
        rep(j, n){
            cmin[i] = min(cmin[i], c[j][i]);
        }
    }
    string ans = "";
    rep(i, 26){
        ans += string(cmin[i], 'a'+i);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){

  int A, B;
  int ans=0;
  cin >> A >> B;

  for(int i=A; i<=B; i++){
    if(i%10==(i/10000)%10 && (i/10)%10==(i/1000)%10) ans++;
  }

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


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

const int N = 250000;
int a[N];

signed main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    reverse(a, a + n);
    int ans = a[0];
    for (int i = 1; i < n / 2; i++) ans += a[i] * 2;
    if (n % 2) ans += a[n / 2];
    cout << ans;
}


Measured memory_bytes: 5196
#include <stdio.h>


int main(int argc, char* argv[])
{
	int a, b;
	char temp[10];

	fgets(temp, sizeof(temp), stdin);
	sscanf(temp, "%d %d", &a,&b);

	if (a > b) {
		printf("a > b\n");
	}
	else if (a < b) {
		printf("a < b\n");
	}
	else {
		printf("a == b\n");
	}

	return 0;
}

Measured memory_bytes: 2644
#include<bits/stdc++.h>
using namespace std;
inline void read(int& x)
{
	x = 0; char c = getchar();
	while (!isdigit(c)) c = getchar();
	while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
}
int a, n;
int main()
{
	read(n);
	for (int i = 1; i <= n; ++i)
	{
		read(a);
		if (a & 1) continue;
		if (a % 3 && a % 5)
		{
			puts("DENIED");
			return 0;
		}
	}
	puts("APPROVED");
	return 0;
}

Measured memory_bytes: 256