akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n, long long modvalue) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2, modvalue);
        return t * t % modvalue;
    } else {
        return modpow(m, n - 1, modvalue) * m % modvalue;
    }
}

long long moddiv(long long a, long long b, ll modvalue) { return (a * modpow(b, mod - 2, modvalue)) % modvalue; }

const ll INF = 1LL << 60;

string change_binary(long long a) {
    string ret;
    for (int i = 31; i >= 0; i--) {
        ret += (a >> i & 1) + '0';
    }
    return ret;
}

ll nCkmod(ll n, ll k, ll modvalue) {
    ll numera = 1;
    for (int i = n; i > n - k; i--) {
        numera *= i;
        numera %= modvalue;
    }
    ll denomi = 1;
    REP(i, k) {
        denomi *= (i + 1);
        denomi %= modvalue;
    }
    return moddiv(numera, denomi, modvalue);
}

map<ll, ll> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
vector<ll> dijkstra(vector<vector<P>> graph, ll s) {
    vector<ll> ans(graph.size(), -1);
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.push({0, s});
    while (pq.size() > 0) {
        ll cur1 = 0;
        ll cur2 = 0;
        if (ans[pq.top().second] != -1) {
            pq.pop();
        } else {
            cur1 = pq.top().first;
            cur2 = pq.top().second;
            pq.pop();
            ans[cur2] = cur1;
            for (ll i = 0; i < graph[cur2].size(); i++) {
                pq.push({cur1 + graph[cur2][i].first, graph[cur2][i].second});
            }
        }
    }
    return ans;
}
vector<string> maze;
ll h, w;
bool check(ll y, ll x) {
    if (x < 0 || x >= w || y < 0 || y >= h || maze[y][x] == '#') {
        return false;
    }
    return true;
}
double p;
long double f(long double x) { return x + p / (pow(2, x / 1.5)); }
ll gcd(ll a, ll b) {
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}
int main() {
    ll n;
    cin >> n;
    vector<ll> as(n);
    ll sum = 0;
    REP(i, n) {
        cin >> as[i];
        sum += as[i];
    }
    ll nowsum = 0;
    ll small = 100000000000;
    REP(i, n - 1) {
        nowsum += as[i];
        if (abs(sum - 2 * nowsum) < small) {
            small = abs(sum - 2 * nowsum);
        }
    }
    cout << small << endl;
}

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

bool getdis(vector<int> A,vector<int> B,int N){
  int sum =0;
  for(int i=0;i<N;i++){
    sum += (A.at(i)-B.at(i))*(A.at(i)-B.at(i));
  }
  bool TF =false;
  for(int i =0;i<=sqrt(sum);i++){
    if(i*i == sum){
      TF = true;
      break;
    }
  }
  return TF;
}
  
int main(){
  int N,D;
  cin >>N>>D;
  vector<vector<int>> X(N,vector<int>(D));
  for(int i=0;i<N;i++){
    for(int j=0;j<D;j++){
      cin >>X.at(i).at(j);
    }
  }
  int count =0;
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      if(getdis(X.at(i),X.at(j),D)){
        count ++;
      }
    }
  }
  cout <<count<<endl;
}


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

int main()
{
    int n,i;
    cin>>n;
    int arr[n+10];
    double sum=0.0;
    for(i=0; i<n; i++)
    {
        cin>>arr[i];
        sum = sum+(1.0/double(arr[i]));
    }
    printf("%.10lf",1.0/sum);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int N, i, j, ans = 1;
    scanf("%d", &N);
    char S[N];
    for (i = 0; i < N; i++) {
        scanf("%s", S);
    }
    for (j = 0; j < N - 1; j++) {
        if (S[j] != S[j + 1]) {
            ans ++;
        }
    }
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 256
use proconio::input;


fn solve(x: i32, a: i32) {
    if x < a {
        println!("0");
    }
    else {
        println!("10");
    }
}


fn main() {
    input! {
        x: i32,
        a: i32,
    }

    solve(x, a);
}


Measured memory_bytes: 2112
import java.util.Scanner;

public class Main {

	public static double coin(int point, int border){
		int count = 0;

		while(point < border){
			point *= 2;
			count++;
		}

		return 1.0 / (double)Math.pow(2, count);
	}

	public static double dice(int num, int border){
		double winRate= 0.0;

		for(int i = 1; i <= num; i++){
			winRate += 1.0 / (double)num * coin(i, border);
		}

		return winRate;
	}

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

		// input
		int num = scan.nextInt();
		int border = scan.nextInt();

		// check
		double winRate = dice(num, border);

		// answer
		System.out.println(winRate);
	}
}



Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
int main() {
	long long int n,a,b,c,d,e;
	cin>>n>>a>>b>>c>>d>>e;
	cout<<max({(n-1)/a,(n-1)/b,(n-1)/c,(n-1)/d,(n-1)/e})+5<<endl;
	return 0;
}


Measured memory_bytes: 256
num=[]
while True:
    try:
        s=list(str(input()))
        i=0
        while True:
            if i>=len(s):
                break
            if s[i].isnumeric()==True:
                try:
                    if s[i+1].isnumeric()==True:
                        try:
                            if s[i+2].isnumeric()==True:
                                try:
                                    if s[i+3].isnumeric()==True:
                                        try:
                                            if s[i+4].isnumeric()==True:
                                                num.append(int(s[i]+s[i+1]+s[i+2]+s[i+3]+s[i+4]))
                                                i+=5
                                            else:
                                                num.append(int(s[i]+s[i+1]+s[i+2]+s[i+3]))
                                                i+=4
                                        except IndexError:
                                            num.append(int(s[i]+s[i+1]+s[i+2]+s[i+3]))
                                            i+=4
                                    else:
                                        num.append(int(s[i]+s[i+1]+s[i+2]))
                                        i+=3
                                except IndexError:
                                    num.append(int(s[i]+s[i+1]+s[i+2]))
                                    i+=3
                            else:
                                num.append(int(s[i]+s[i+1]))
                                i+=2
                        except IndexError:
                            num.append(int(s[i]+s[i+1]))
                            i+=2
                    else:
                        num.append(int(s[i]))
                        i+=1
                except IndexError:
                    num.append(int(s[i]))
                    i+=1
            else:
                i+=1
    except EOFError:
        break
print(sum(num))


Measured memory_bytes: 5616
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair < llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗を1000000007で割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, b / 2);
	tmp *= tmp;
	tmp %= 1000000007;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= 1000000007;
	}
	return tmp;
}

int main() {
	int m, d;
	cin >> m >> d;
	int ans = 0;
	rep(i, d + 1) {
		int d1 = i / 10, d2 = i % 10;
		if (d1 < 2 || d2 < 2)continue;
		if (d1 * d2 <= m)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 200000
#define MOD2 1000000007
#define FOR(i,a,b) for(int i = (a);i<(b);i++)
#define ROF(i,a,b) for(int i = (a);i>(b);i--)
using namespace std;

long long int n;
long long int a[INF],b[INF];
long long int q_a[INF][2],q_b[INF][2];
long long int ans,k;

long long int num(long long int a,long long int b,long long int c,long long int d){
	if(a==1&&b==1){
		if(c==d)return 1;
		return 0;
	}
	if(a==1&&b==2){
		if(c<=d)return 1;
		return 0;
	}
	if(a==2&&b==1){
		if(d<=c)return 1;
		return 0;
	}
	if(a==2&&b==2){
		return fminl(c,d);
	}
}

int solve(void){
	q_a[0][0]=1;
	q_a[0][1]=a[0];
	FOR(i,1,n){
		if(a[i-1]>a[i])return 0;
		if(a[i-1]==a[i]){
			q_a[i][0]=2;
			q_a[i][1]=a[i];
		}
		else{
			q_a[i][0]=1;
			q_a[i][1]=a[i];
		}
	}

	q_b[n-1][0]=1;
	q_b[n-1][1]=b[n-1];
	ROF(i,n-2,-1){
		if(b[i+1]>b[i])return 0;
		if(b[i+1]==b[i]){
			q_b[i][0]=2;
			q_b[i][1]=b[i];
		}
		else{
			q_b[i][0]=1;
			q_b[i][1]=b[i];
		}
	}
	
	long long int t=1;
	FOR(i,0,n){
		t=t*num(q_a[i][0],q_b[i][0],q_a[i][1],q_b[i][1]);
		t=t%MOD2;
	}
	return t;
	}
	

int main(){
	cin>>n;
	FOR(i,0,n){
		cin>>a[i];
	}
	FOR(i,0,n){
		cin>>b[i];
	}
	
	k=solve();
	cout<<k<<endl;
}

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

using namespace std;

using ll = long long int;
using vi = vector<int>;
#define f(n) for(int i = 0; i < n; i++)
#define fj(n) for(int j = 0; j < n; j++)
#define fk(n) for(int k = 0; k < n; k++)
#define ci(n) cin >> n;
#define ic(n) int n; cin >> n;
#define lc(n) int n; cin >> n;
#define all(a) a.begin(), a.end()
#define pri(a, n) for(int i = 0; i < n; i++) cout << a[i] << " "; cout << "\n";
#define sc(a, n) int a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];
#define scl(a, n) ll a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];
#define pb push_back
#define eb emplace_back
#define int long long
const int inf = 2e18, maxn = 200000;

void solve(int ci)
{
    char c;
    cin >> c;
    if(c >= 'A' && c <= 'Z') cout << "A";
    else cout << "a";
}


main()
{
    //cout << atan2(0, -1);
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t = 1;
    //cin >> t;
    f(t) solve(i + 1);
}


Measured memory_bytes: 3648
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
const long long MAX = (ll)1e5+100;

set<ll> GetYakusu(ll a) {
   set<ll> ret;
   ll max = ceil(sqrt(a));
   for (ll i = 1; i <= max;i++) {
      if (a%i==0) {
         ret.insert(i);
         ret.insert(abs(a/i));
      }
   }
   return ret;
}

int main(void) {
   ll N;
   cin>>N;
   auto ret = GetYakusu(N);
   ll ans = 0;
   for (auto el: ret) {
      ll m = el-1;
      ll a = N/el;
      if (a<m) ans += m;
   }
   cout<<ans<<endl;



   return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
  ll n;
  ll y;
  cin >> n >> y;
  ll sum;
  rep(i,n+1){
    rep(j,n+1-i){
      sum = 10000*i + 5000*j + 1000*(n-i-j);
      if(sum == y){
        cout << i << " " << j << " " << n-i-j;
        break;
      }
    }
    if(sum == y){
      break;
    }
  }
  if(sum != y){
    cout << -1 << " " << -1 << " " << -1;
  }
 return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn.{readInt,readLine}

object Main {
  def search(a:Array[Int],value:Int) = {
    def scan(l:Int,r:Int):Boolean = {
      val mid = (l+r)/2
      if(a(mid) == value) true
      else if(l>=r) false
      else if(a(mid)<value) scan(mid+1,r)
      else scan(l,mid-1)
    }
    scan(0,a.length-1)
  }

  def main(args:Array[String]) = {
    readInt
    val s = readLine.split(" ").map(_.toInt).toArray
    readInt
    val t = readLine.split(" ").map(_.toInt).toArray
    println(t.count(i=> search(s,i) ))
  }
}

Measured memory_bytes: 71484
// abc146_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

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

    string alphabets = "abcdefghijklmnopqrstuvwxyz";

    string ans;
    REP(i, S.size()){
        char x = S[i];
        x += N;
        if (x > 'Z') x -= 26;
        ans += x;
    }

    print(ans);



    return 0;
}


Measured memory_bytes: 256
a,b,c,d = input()
op=['+','-']
ans=''
for i in range(2):
  for j in range(2):
    for k in range(2):
      if eval(a+op[i]+b+op[j]+c+op[k]+d) == 7:
        ans=a+op[i]+b+op[j]+c+op[k]+d+"=7"
print(ans)

Measured memory_bytes: 8960
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


bool dp[100005];

void solve() {
    int N, K; cin >> N >> K;
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];

    for (int i = 0; i <= K; i++) {
        for (int j = 0; j < N; j++) {
            if (i - a[j] >= 0) dp[i] |= !dp[i - a[j]];
        }
    }

    cout << (dp[K] ? "First" : "Second") << endl;
}


int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3736
#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

int main(){
    int N;
    cin >> N;
    map<string,int> mp;
    vector<string> S(N);
    rep(i,N){
        cin >> S[i];
        mp[S[i]]++;
    }
    int cnt = 0;
    rep(i,N){
        cnt = max(cnt,mp[S[i]]);
    }
    vector<string> ans;
    rep(i,N){
        if(mp[S[i]]==cnt){
            ans.push_back(S[i]);
            mp[S[i]]=0;
        }
    }
    sort(ans.begin(),ans.end());
    rep(i,ans.size()){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 33440
#include <iostream>
using namespace std;
int X, Y, S;
int solve() {
	int maximum = 0;
	for (int i = 1; i < S; i++) {
		for (int j = S; j >= i; j--) {
			if ((int)(i*(100 + X) / 100) + (int)(j*(100 + X) / 100) == S) {
				if ((int)(i*(100 + Y) / 100) + (int)(j*(100 + Y) / 100) > maximum) {
					maximum = (int)(i*(100 + Y) / 100) + (int)(j*(100 + Y) / 100);
				}
			}
		}

		
	}
	return maximum;
}
int main(){
	 while (cin >> X >> Y >> S && X > 0) {
		 cout << solve() << endl;
		
	}
	
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int m[51][51];
void del(int a,int b){
	m[a][b]=0;
	if(m[a-1][b]==1)del(a-1,b);
	if(m[a][b-1]==1)del(a,b-1);
	if(m[a+1][b]==1)del(a+1,b);
	if(m[a][b+1]==1)del(a,b+1);
	if(m[a-1][b-1]==1)del(a-1,b-1);
	if(m[a-1][b+1]==1)del(a-1,b+1);
	if(m[a+1][b-1]==1)del(a+1,b-1);
	if(m[a+1][b+1]==1)del(a+1,b+1);
}
int main(){
	int a,b,i,j,w,q;
	while(cin>>a>>b,a!=0&&b!=0){
		int c=0;
		for(i=0;i<b;i++)for(j=0;j<a;j++)cin>>m[i][j];
        for(i=0;i<b;i++)for(j=0;j<a;j++)if(m[i][j]==1){del(i,j);c++;}
        	cout<<c<<endl;
    }
}

Measured memory_bytes: 1420
#include<iostream>
#include<string>
using namespace std;
int main(){
   long A,B,K,i;
   cin >> A >> B >> K;
   if(B-A<2*K){
     for(i=A;i<B;i++){
       cout << i << "\n";
     }
     cout << B;
   }else{
     for(i=0;i<K;i++){
       cout << A+i << "\n";
     }
     for(i=0;i<K-1;i++){
       cout << B-K+1+i << "\n";
     }
     cout << B;
   }
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
const ll mod = (ll)10e9+7;
const int INF = 0x3f3f3f3f;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    ll a=1, b=1;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        long double ca, cb;
        cin >> ca >> cb;
        if((long double)a/ca>(long double)b/cb)
        {
            a = ca*ceil((long double)a/ca);
            b = a*cb/ca;
        }
        else
        {
            b = cb*ceil((long double)b/cb);
            a = b*ca/cb;
        }
    }
    cout << a+b;
}

//TODO: 46


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    string s; cin >> s;
    vint accum_w(n+1,0), accum_b(n+1,0);
    REP(i,n+1) {
        accum_w[i] = accum_w[i-1];
        accum_b[i] = accum_b[i-1];
        if (s[i-1] == '.') accum_w[i]++;
        if (s[i-1] == '#') accum_b[i]++;
    }
    int ans = inf;
    rep(i,n+1) {
        ans = min(ans,accum_b[i]+accum_w[n]-accum_w[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5240
#include<bits/stdc++.h>
using namespace std;
const int N=3e3+10,mod=998244353;
int n,s,v,dp[N],ans;
int main(){
	scanf("%d%d",&n,&s);
	for(int i=1;i<=n;++i){
		scanf("%d",&v);
		for(int j=s;j>v;--j){//从原有的合法序列l,r属于[L,R-1] 补一个R 
			dp[j]=(dp[j]+dp[j-v])%mod; 
		}
		dp[v]=(dp[v]+i)%mod;//r=R l从1到r取共i种 
		ans=(ans+dp[s])%mod;
	}
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define fi first
#define sc second
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define MAX(x, y, z) max(x, max(y, z))
#define MIN(x, y, z) min(x, min(y, z))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll N;
  cin >> N;
  ll ans = 0;

  vll A(N);
  ll m = INF;
  rep(i, N) {
    cin >> A[i];
    ans += A[i];
    if (A[i] % 10 != 0 && A[i] < m) {
      m = A[i];
    }
  }
  if (m == INF) {
    COUT(0);
  } else {
    if (ans % 10 == 0) {
      COUT(ans - m);
    } else {
      COUT(ans);
    }
  }

  return 0;
}

Measured memory_bytes: 3680
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<string>
//#include<queue>
//#include<cmath>
//#include<algorithm>
//#define debug1 cout<<"?"<<endl;
//#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
typedef long long ll;
const int maxn=3e5+9;
const double pi=acos(-1);
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
const double ep=1e-7;
using namespace std;
int main()
{
	int n,ju=0,x;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d",&x);
		if(x&1||x%10==0)continue;
		int sum=0;
		while(x)sum+=x%10,x/=10;
		if(sum%3)ju=1;
	}
	if(ju)puts("DENIED");
	else puts("APPROVED");
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    int n,l;
    cin>>n>>l;
    string str[n],temp;
    for(int i=0;i<n;i++){
        cin>>str[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n-1;j++){
            if(str[j]>str[j+1]){
                temp = str[j+1];
                str[j+1] = str[j];
                str[j]=temp;
            }
        }
    }
    for(int i=0;i<n;i++){
        cout<<str[i];
    }
}

Measured memory_bytes: 3112
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
using namespace std;

#define ll long long int

const int MOD = 1000000007;

int max(int a, int b) {

	if (a > b)return a;
	else return b;

}
int main() {

	string S, ans;
	int ssize;

	cin >> S;
	ssize = S.size();

	for (int i = 0; i < ssize; i++) {

		if (S[i] == '0')ans.push_back('0');
		else if (S[i] == '1')ans.push_back('1');
		else if (ans.size() != 0)ans.erase(ans.begin() + ans.size() - 1);

	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, U b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, U b){ return b > a ? a = b, true : false; }

const ll MOD = 1e9 + 7;

ll n;
vector<ll> v;
ll exp(ll a, ll b){
    if(b == 0) return 1;
    ll tmp = exp(a, b/2);
    tmp *= tmp; tmp %= MOD;
    if(b & 1) tmp *= a;
    return tmp%MOD;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    v.assign(n, 0);
    ll sum = 0;
    for(int i = 0; i < n; ++i){
        cin >> v[i]; sum += v[i];
        sum %= MOD;
    }
    ll res = sum * sum;
    for(int i = 0; i < n; ++i){
        res -= (v[i] * v[i])%MOD;
        res = ((res%MOD) + MOD)%MOD;
    }
    cout << (res * exp(2, MOD - 2))%MOD;
    return 0;
}

Measured memory_bytes: 4784
n, m = map(int, input().split())
c = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    c[a - 1] += 1
    c[b - 1] += 1
for i in range(n):
    if c[i] % 2:
        print('NO')
        exit(0)
print('YES')

Measured memory_bytes: 3828
#include<stdio.h>

int main (void)
{
    long long N;
    long long h[100000];
    long long i;
    char c;
    long long max=0;
    int count=0;
    int flag=0;

    scanf("%lld",&N);
    scanf("%c",&c);

//    printf("N get\n");

    for(i=0;i<N;i++){
        scanf("%lld",&h[i]);
        scanf("%c",&c);
    }


//    printf("f n cal\n");
    for(i=N-2;0<=i;i--){
        count++;

        if(h[i]<=h[i+1]){
            continue;
        }

        h[i]-=1;

        if(h[i]>h[i+1]){
            flag=1;
            break;
        }
    }

    if(flag==0){
        printf("Yes");
    }else{
        printf("No");
    }


    return 0;
}

Measured memory_bytes: 896
s1 = input()

l1 = list(s1)

f1 = 0
t1 = 0
t2 = 1
t3 = 0

r1 = [0] * len(s1)

for i1 in range(len(s1)):
    if f1 == 0:
        if l1[i1] == "R":
            t1 += 1
        elif i1 == len(s1) - 1:
            if t1 == t2:
                r1[i1] = t1
                r1[i1 - 1] = t1
            elif (t1 != t2) and ((t1 + t2) % 2) == 0:
                r1[i1] = (t1 + t2) // 2
                r1[i1 - 1] = (t1 + t2) // 2
            elif t1 > t2:
                if t1 % 2 == 0:
                    r1[i1] = ((t1 + t2) // 2) + 1
                    r1[i1 - 1] = (t1 + t2) // 2
                else:
                    r1[i1] = (t1 + t2) // 2
                    r1[i1 - 1] = ((t1 + t2) // 2) + 1 
            else:
                if t2 % 2 == 0:
                    r1[i1] = (t1 + t2) // 2
                    r1[i1 - 1] = ((t1 + t2) // 2) + 1  
                else:
                    r1[i1] = ((t1 + t2) // 2) + 1
                    r1[i1 - 1] = (t1 + t2) // 2
        else:
            t3 = i1
            f1 = 1
    else:
        if l1[i1] == "L" and i1 != len(s1) - 1:
            t2 += 1

        else:
            if i1 == len(s1) - 1:
                t2 += 1

            if t1 == t2:
                r1[t3] = t1
                r1[t3 - 1] = t1
            elif (t1 != t2) and ((t1 + t2) % 2) == 0:
                r1[t3] = (t1 + t2) // 2
                r1[t3 - 1] = (t1 + t2) // 2
            elif t1 > t2:
                if t1 % 2 == 0:
                    r1[t3] = ((t1 + t2) // 2) + 1
                    r1[t3 - 1] = (t1 + t2) // 2
                else:
                    r1[t3] = (t1 + t2) // 2
                    r1[t3 - 1] = ((t1 + t2) // 2) + 1 
            else:
                if t2 % 2 == 0:
                    r1[t3] = (t1 + t2) // 2
                    r1[t3 - 1] = ((t1 + t2) // 2) + 1  
                else:
                    r1[t3] = ((t1 + t2) // 2) + 1
                    r1[t3 - 1] = (t1 + t2) // 2
            t1 = 1
            t2 = 1
            f1 = 0

rt1 = ""

for i2 in range(len(s1)):
    if i2 == len(s1) - 1:
        rt1 += str(r1[i2])
    else:
        rt1 += str(r1[i2]) + " "

print(rt1)

Measured memory_bytes: 5620
#include<bits/stdc++.h>
using namespace std;
bool check(int x,int y,int z)
{
	set<int> s;
	s.insert(x);
	s.insert(y);
	s.insert(z);
	if(s.size()==3)
	return true;
	return false;
}
int main()
{
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		
	}
	sort(arr,arr+n);
	int count=0;
	for(int i=0;i<n-2;i++)
	{
		for(int j=i+1;j<n-1;j++)
		{
			for(int k=j+1;k<n;k++)
			{
				if(arr[i]+arr[j]>arr[k] && check(arr[i],arr[j],arr[k]))
				{
					count++;
				}
			}
		}
	}
	cout<<count<<endl;
}

Measured memory_bytes: 3548
#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 pb push_back

#define N 100010
int n;
int a[N];
ll b[N];
ll S;

void end() {
	puts ("NO");
	exit(0);
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i ++) {
		cin >> a[i];
		S += a[i];
	}
	if (S%((ll)n*(n+1)/2) != 0) end();
	S /= ((ll)n*(n+1)/2);
	for (int i = 0; i < n; i ++) {
		int x = a[i];
		int y = a[(i+1)%n];
		if ((x-y+S)%n != 0) end();
		ll l = (x-y+S)/n;
		ll r = S-l;
		if (l < 0 || r < 0) end();
		b[i] = l;
	}
	ll T = 0;
	for (int i = 0; i < n; i ++) T += b[i];
	if (T != S) end();
	ll U = 0;
	for (int i = 0; i < n; i ++) U += b[i]*(n-i);
	for (int i = 0; i < n; i ++) {
		if (U != a[i]) end();
		U += T;
		U -= b[i]*n;
	}
	puts ("YES");
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

namespace Doubling {
    using NODE_TYPE = int;
    using COST_TYPE = long long;
    // d[i][0]はあらかじめ計算しておく！, iはトポロジカルソート後のidx
    void preCalc(vector<vector<NODE_TYPE>>& d) {
        int n = d.size();
        int m = d[0].size();
        REP(j, 1, m) rep(i, n) {
            d[i][j] = d[d[i][j-1]][j-1];
        }
    }
    // 頂点uからcostでいける頂点を求める
    NODE_TYPE getNode(NODE_TYPE u, COST_TYPE cost, const vector<vector<NODE_TYPE>>& d) {
        assert(false);
        return -1;
    }
    // 頂点uから頂点vまでのコストを求める
    COST_TYPE getCost(NODE_TYPE u, NODE_TYPE v, const vector<vector<NODE_TYPE>>& d) {
        if(u >= v) assert(false);
        int n = d.size();
        int m = d[0].size();
        int cur = u;
        COST_TYPE ret = 0;
        while(cur < v) {
            if(d[cur][0] >= v) {
                ret += 1;
                break;
            }
            int j = lower_bound(all(d[cur]), v) - d[cur].begin() - 1;
            cur = d[cur][j];
            ret+= COST_TYPE(1) << j;
        }
        return ret;
    }
};

int main(){
    int N;
    cin >> N;
    vi x(N);
    rep(i, N) cin >> x[i];
    int L, Q;
    cin >> L >> Q;
    vi a(Q), b(Q);
    rep(i, Q) cin >> a[i] >> b[i], --a[i], --b[i];

    vector<vi> d(N, vi(62, -1));
    rep(i, N) {
        d[i][0] = upper_bound(all(x), x[i]+L) - x.begin() - 1;
    }
    Doubling::preCalc(d);
    rep(i, Q) {
        if(a[i] > b[i]) swap(a[i], b[i]);
        cout << Doubling::getCost(a[i], b[i], d) << endl;
    }
    return 0;
}

Measured memory_bytes: 29312
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

int main(int argc, char const *argv[])
{
    int w, h, n;
    cin >> w >> h >> n;
    int board[h][w];
    rep(i, h) rep(j, w) board[i][j] = 0;
    rep(i, n)
    {
        int x, y, a;
        cin >> x >> y >> a;
        rep(ii, h) rep(jj, w)
        {
            if (a == 1 && jj < x)
            {
                board[ii][jj] = 1;
            }
            else if (a == 2 && jj >= x)
            {
                board[ii][jj] = 1;
            }
            else if (a == 3 && ii < y)
            {
                board[ii][jj] = 1;
            }
            else if (a == 4 && ii >= y)
            {
                board[ii][jj] = 1;
            }
        }
    }
    int ans = 0;
    rep(i, h)
    {
        rep(j, w)
        {
            if (board[i][j] == 0)
            {
                ans++;
            }
            cerr << board[i][j];
        }
        cerr << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int a[100001];
int main(void)
{
	int n,k,sum,max=0,i,j;
	while(1){
		scanf("%d%d",&n,&k);
		if(n==0&&k==0) break;
		for(i=1;i<=n;i++){
			scanf("%d",&a[i]);
		}
		for(i=1;i<=n;i++){
			sum=0;
			if(i+k<=n){
				for(j=i;j<i+k;j++){
					sum+=a[j];
				}
				if(max<sum){
					max=sum;
				}
			}
		}
		printf("%d\n",max);
	}
	return 0;
}

Measured memory_bytes: 2968
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

vi adj[200001];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    for (int i = 0; i < adj[1].size(); ++i)
    {
        int x = adj[1][i];
        for (int j = 0; j < adj[x].size(); ++j)
            if (adj[x][j] == n)
                return cout << "POSSIBLE", 0;
    }
    cout << "IMPOSSIBLE";
}


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

string S;
string target = "keyence";

int main(){
  cin >> S;
  bool ret = false;

  for(int i = 0; i <= 7; i++){
    int cnt = 0;
    bool tmp = true;
    for(int j = 0; j < S.length(); j++){
      if(j - i >= 0 && j - i < S.length() - 7){
	continue;
      }
      if(S[j] != target[cnt]){
	tmp = false;
	break;
      }
      cnt++;
    }
    if(tmp){
      ret = true;
    }
  }

  //ret = ret || (S == target);
  
  if(ret){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<queue>
using namespace std;
typedef long long  LL;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define F first
#define S second
inline int read(){
	int x = 0; char ch = getchar(); bool positive = 1;
	for (; !isdigit(ch); ch = getchar())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = getchar())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
#include<string>
string s,ch;
int ans,zs[100005];
#define DEBUG 0
int main(){
	cin>>s;
	for(int i=0;i<s.length();i++)if(s[i]!='x')ch+=s[i]; else zs[ch.length()]++;
	for(int i=0;i<ch.length()/2;i++)if(ch[i]!=ch[ch.length()-i-1]){
		puts("-1"); return 0;
	}
	for(int i=0;i<(ch.length()+1)/2;i++){
		ans+=abs(zs[i]-zs[ch.length()-i]);
	}
	writeln(ans);
}


Measured memory_bytes: 888
n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans -= 1

print(ans)

Measured memory_bytes: 9064
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni(), m = in.ni();
        PriorityQueue<Integer> que = new PriorityQueue<>();
        for (int i = 1; i*i <= m; i++) {
            if(m%i==0){
                if(i>=n)que.add(i);
                if(i!=m/i&&m/i>=n) que.add(m/i);
            }
        }
        out.println(m/que.poll());
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 21332
#include <iostream>
using namespace std;
int main(void){
    int E,Y;
    cin>>E>>Y;
    if(E==0) {
        if(1868<=Y&&Y<=1911)   cout<<"M"<<Y-1867;
        if(1912<=Y&&Y<=1925)   cout<<"T"<<Y-1911;
        if(1926<=Y&&Y<=1988)   cout<<"S"<<Y-1925;
        if(1989<=Y&&Y<=2016)   cout<<"H"<<Y-1988;
    }
    if(E==1) cout<<1867+Y;
    if(E==2) cout<<1911+Y;
    if(E==3) cout<<1925+Y;
    if(E==4) cout<<1988+Y;
    cout<<endl;
}


Measured memory_bytes: 3096
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001

#define VMAX 10000

int main(){
  unsigned short *A,*B;
  int C[VMAX+1];
  int n,i,j;
  scanf("%d",&n);

  A=malloc(sizeof(short)*(n+1));
  B=malloc(sizeof(short)*(n+1));
for(i=0;i<=VMAX;i++)   C[i]=0;
 

  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }

  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];

  for(j=1;j<=n;j++) {
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }

  for(i=1;i<=n;i++){

    
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }

  printf("\n");
  return 0;
}



Measured memory_bytes: 9620
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    r, g, b, n = map(int, input().split())
    ans = 0
    rgb = sorted([r,g,b], reverse=True)
    if rgb[1] == 1 and rgb[2] == 1:
        for i in range(n//rgb[0]+1):
            ans += (n-i*rgb[0]+1)
        print(ans)
        exit()
    for i in range(n//rgb[0]+1):
        for j in range((n-i*rgb[0])//rgb[1]+1):
            if (n-i*rgb[0]-j*rgb[1])%rgb[2]==0:
                ans+=1
    print(ans)


Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
    int w,h,x,y,r;
    scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
    if(x-r<0 || x+r>w || y-r<0 || y+r>h){
        printf("No\n");

    }else {
        printf("Yes\n");
    }

}



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

flag = 1 #逆の隣接要素が存在する
cnt = 0
while flag :
	flag = 0
	for j in reversed(range(1,N)):
		if A[j]<A[j-1]:
			v = A[j]
			A[j] = A[j-1]
			A[j-1] = v
			flag = 1
			cnt += 1
print(" ".join(list(map(str,A))
))
print(cnt)


Measured memory_bytes: 5600
# B Tap Dance
s = input()
S = len(s)
for i in range(S):
    if i % 2:  # 奇数
        if s[i] == "R":
            print("No")
            exit()
    else:
        if s[i]  == "L":
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 9084
N=int(input())
W=list(map(int, input().split()))

D=[0]*N
abD=[0]*N
D[0]=sum(W)
abD[0]=D[0]
for x in range(N-1):
    D[x+1]=D[x]-2*W[x]
    abD[x+1]=abs(D[x+1])
print(min(abD))

Measured memory_bytes: 3064
// In the name of Almighty ALLAH
/* 
   code from :::::::::::::::::::::
   ******************************* R E S H A D ********************************
*/     

#include <bits/stdc++.h>

#define ll               long long
#define db               double
#define Pi               2*acos(0.0)
#define pb(a)            push_back(a)
#define VI               vector <int>
#define CIN              ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ull              unsigned long long
#define all(a)           a.begin(),a.end()
#define loop(i,n)        for(int i=0;i<n;i++)
#define loop1(i,n)       for(int i=1;i<=n;i++)
#define TEST_CASE(t)     for(int z=1;z<=t;z++)
// 90 degree = acos(x)*180/acos(0.0)

using namespace std;

int main() {
    
    CIN;
    
    string s;
    cin >> s;
    int cnt=0;
    
    if(s[0]=='Y' && s[1]=='A' && s[2]=='K' && s[3]=='I') ++cnt;
    
    if(cnt==1) cout << "Yes" << endl;
    else cout << "No" << endl;

    
    
    
	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 2e5 + 9, M = 3e3 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const ll inf = 1e18;

ll dp[M][M], pre[M][M];

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  int n;
  string str;
  cin >> n >> str;
  str = "$$" + str;
  for (int i = 1; i <= n; ++i) {
    dp[1][i] = 1;
    pre[1][i] += pre[1][i-1] + 1;
    pre[1][i] %= MOD;
  }
  for (int i = 2; i <= n; ++i) {
    for (int j = 1; j <= i; ++j) { // greatest element
      int L, R;
      if(str[i] == '>') {
        L = j, R = i - 1;
      } else {
        L = 1, R = j - 1;
      }
      if(L <= R)
        dp[i][j] = ((dp[i][j] % MOD) + ((((pre[i-1][R] - pre[i-1][L-1]) % MOD) + MOD) % MOD)) % MOD;
//      for(; L <= R; ++L)
//        dp[i][j] += dp[i-1][L];
    }
    for (int j = 1; j <= n; ++j)
      pre[i][j] = ((dp[i][j] % MOD) + (pre[i][j-1] % MOD)) % MOD;
  }
  ll ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += dp[n][i];
    ans %= MOD;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 141568
#include<stdio.h>
#include<string.h>
int main()
{
	char C[50];
	int i,j,f=0;gets(C);j=strlen(C);
	for(i=0;i<j&&C[i]!='A';i++);
	for(j=j-1;j>=0&&C[j]!='Z';j--);
	if(i>j)puts("-1");
	else 
	{
		for(;i<=j;i++)
			if((!f&&C[i]=='A')||(f&&C[i]=='Z'))
				putchar(C[i]),f=!f;
		puts("");
	}
	return 0;
}

Measured memory_bytes: 524
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    double R; cin >> R;
    cout << setprecision(12) << R * 2.0 * 3.14159265359 << endl;
}


Measured memory_bytes: 3776
import sys
sys.setrecursionlimit(10 ** 9)

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M, P = lr()
graph = [lr() for _ in range(M)]

def bellmanford(s, g):
    dist = [float('inf')] * (N+1)
    dist[s] = 0
    for i in range(2 * N):
        for a, b, c in graph:
            if dist[b] > dist[a] - c + P:
                dist[b] = dist[a] - c + P
                if i >= N:
                    dist[b] = -float("inf")
 
    if dist[g] == -float("inf"):
        return -1
    else:
        return max(-dist[g], 0)

answer = bellmanford(1, N)
print(answer)
# 


Measured memory_bytes: 46428
#include <bits/stdc++.h>
using namespace std;
long long n;
int m,ans;
int main()
{
	scanf("%lld",&n);
	m=ceil(sqrt(n));
	for (int i=2;i<=m;i++)
		if (!(n%i))
		{
			int cnt=0;
			while (!(n%i)) cnt++,n/=i;
			int tmp=floor(sqrt(cnt*2))-1;
			while ((tmp+1)*(tmp+2)<=cnt*2) tmp++;
			ans+=tmp;
		}
	if (n>1) ans++;
	printf("%d\n",ans);
	return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    for(int i = 0; i < 1e9 + 7; ++i){
        int p = abs(a - i), q = abs(b - i);
        if(p == q){
            cout << i;
            return 0;
        }
    }
    cout << "IMPOSSIBLE";
    return 0;
}

Measured memory_bytes: 256