akhauriyash/Code-Regression huggingface dataset:
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
#define inf 1e9
using namespace std;

inline void down(int &x,const int &y){if(x>y)x=y;}
const int maxn = 410000;
const int mod = 2333333;

int n;
char str[maxn];
int f[maxn];
struct edge{int y,c,nex;}a[mod]; int len,fir[mod];
inline void link(const int x,const int y,const int c){a[++len]=(edge){y,c,fir[x]};fir[x]=len;}

void ins(const int x,const int ff)
{
	int cc=x%mod;
	for(int k=fir[cc],y=a[k].y;k;k=a[k].nex,y=a[k].y)
	{
		if(a[k].y==x) { down(a[k].c,ff); return; }
	}
	link(cc,x,ff);
}
int fi(const int x)
{
	int cc=x%mod;
	for(int k=fir[cc],y=a[k].y;k;k=a[k].nex)
		if(a[k].y==x) return a[k].c;
	return inf;
}


int main()
{
	scanf("%s",str+1); n=strlen(str+1);
	f[0]=1; ins(0,0);
	int now=0;
	for(int i=1;i<=n;i++)
	{
		f[i]=inf;
		now^=1<<str[i]-'a';
		int mn=n+1;
		for(int j=0;j<26;j++) down(mn,fi(now^1<<j));
		down(mn,fi(now));
		f[i]=mn+1;
		ins(now,f[i]);
	}
	printf("%d\n",f[n]);
	
	return 0;
}


Measured memory_bytes: 15104
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int N = 1010;

//head

int h, w;
string s[N];
int di[] = {0, 1, 0, -1};
int dj[] = {1, 0, -1, 0};
inline bool able(int i, int j) {return i >= 0 and j >= 0 and i < h and j < w;}
queue<P> q;
int dist[N][N];
int ans;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> h >> w;
  rep(i, h) cin >> s[i];

  memset(dist, -1, sizeof(dist));
  rep(i, h) rep(j, w) if(s[i][j] == '#') {
    dist[i][j] = 0;
    q.emplace(i, j);
  }

  while(!q.empty()) {
    int i, j;
    tie(i, j) = q.front();
    q.pop();
    rep(k, 4) {
      int ni = i+di[k];
      int nj = j+dj[k];
      if(able(ni, nj) and dist[ni][nj] == -1) {
        dist[ni][nj] = dist[i][j] + 1;
        q.emplace(ni, nj);
        chmax(ans, dist[ni][nj]);
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 16344
/**
 * Knapsack problem
 */

import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int W = sc.nextInt();

        // w = weights, v = values
        int[] w = new int[N];
        int[] v = new int[N];

        for (int i = 0; i < N; i++) {
            w[i] = sc.nextInt();
            v[i] = sc.nextInt();
        }

        sc.close();

        long[] dp = new long[1000000];

        for (int i = 0; i < N; i++) {
            for (int j = W; j >= 0; j--) {
                if (j + w[i] <= W) {
                    dp[j + w[i]] = Math.max(dp[j + w[i]], dp[j] + v[i]);
                }
            }
        }

        long res = 0;
        for (int i = 0; i <= W; i++) {
            res = Math.max(dp[i], res);
        }

        System.out.println(res);
    }
}

Measured memory_bytes: 31956
#include<stdio.h>
int main(){
  int data,i,j,l,k,sum,Y,M,D,en[1000],flag=0;
  scanf("%d",&data);
  for(i=0;i<data;i++){
    sum=0;
    scanf("%d%d%d",&Y,&M,&D);
    for(l=1;l<=Y;l++){
      if(l%3==0){
	if(l!=Y)
	  sum+=20*10;
	if(l==Y)
	  for(k=1;k<M;k++)
	    sum+=20;
      }else{
	if(l!=Y)
	  for(j=1;j<=10;j++){ 
	    if(j%2==0)sum+=19;
	    else sum+=20;
	  }
	if(l==Y)
	  for(k=1;k<M;k++){
	    if(k%2==0)sum+=19;
	    else sum+=20;	    
	  }}}
    sum+=D;
    en[i]=sum;
    flag++;
  }for(i=0;i<flag;i++)
     printf("%d\n",196471-en[i]);
  return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<vector>
#include<string>

using ll = long long;

int main(){
    int n;
    std::cin >> n;
    std::vector<ll> a(n);
    std::cin >> a[0];
    ll sum = a[0];
    for(int i = 1; i < n; i++){
        std::cin >> a[i];
        sum = sum ^ a[i];
    }

    for(int i = 0; i < n; i++){
        ll ans = sum ^ a[i];
        std::cout << ans << std::endl;
    }

    return 0;
}


Measured memory_bytes: 4716
$N=<>;/ /,push@
$`,$' for<>;map$q[$_]+=$q[$i]/@$i,@{$i=$_}for++$q[1]..$N;while(--$N){$s=$~=0;$s+=$_,$~=$_>$~?$_:$~for@e[@$N];$e[$N]=1+$s/@$N;$a<($t=$q[$N]*=$#$N&&($s-$~)/$#$N-$s/@$N)or$a=$t}print"@e"+$a

Measured memory_bytes: 42368
#include <bits/stdc++.h>
#define rep(it,beg,end) for(__typeof(beg) it=beg,a=end;it!=a;it+=(beg<=a?1:-1))
using namespace std;
#define ll long long
#define pb emplace_back
#define mp make_pair
inline void read(ll &n) {
	char c;n=0;ll x=1;
	while (!isdigit(c=fgetc(stdin))&&c!='-');
	if (c=='-') x=-1, c=fgetc(stdin);
	while (isdigit(c)) n=n*10+c-'0',c=fgetc(stdin);
	n*=x;
}
inline void read(int &n) {ll x;read(x);n=x;}
template <typename T1,typename T2>
inline void read(T1 &a,T2 &b) {read(a);read(b);}
template <typename T1,typename T2,typename T3>
inline void read(T1 &a,T2 &b,T3 &c) {read(a);read(b);read(c);}
template <typename T1,typename T2,typename T3,typename T4>
inline void read(T1 &a,T2 &b,T3 &c,T4 &d) {read(a);read(b);read(c);read(d);}
// -------------------- Standard Template --------------------
int n,arr[100005],Swap[100005];
int main() {
	read(n);
	rep(i,0,n) read(arr[i]);
	int ans=0;
	rep(i,0,n) {
		if (arr[i]==i+1) {
			if (i&&Swap[i-1]==1) Swap[i]=-1;
			else Swap[i]=1,ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define per(i,n) for (int i=n-1; i>=0; --i)
#define all(a) a.begin(), a.end()
using namespace std;
using ll = long long;
using P  = pair<int,int>;
using vi = vector<int>;
using vv = vector<vi>;
const int mod = 998244353;
//ABC174F

struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x-= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if(t&1) a *= *this;
        return a;
    }
    
    //modが素数の場合
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};


//Fenwick tree (Binary Indexed Tree, BIT)

template<typename T>
struct BIT{
    int n;
    vector<T> d;
    BIT(int n=0): n(n), d(n+1) {}
    void add(int i, T x=1){//場所i(0-indexed)にxを足す
        for(i++; i<=n; i+= i&-i){
            d[i] += x;
        }
    }
    T sum(int i){//場所i以下(0-indexed)の和
        T x = 0;
        for(i++; i; i -= i&-i){
            x += d[i];
        }
        return x;
    }
};

int main(){
    int n,k;
    cin >> n >> k;
    
    vector<P> lr(k);
    rep(i,k)cin>>lr[i].first>>lr[i].second;
    sort(all(lr));
    
    BIT<mint> bit(n);
    bit.add(0,1);
    
    for(int i=1; i<n; i++){
        for(int j=0; j<k; j++){
            if(lr[j].first>i)break;
            int q = i-lr[j].first;
            bit.add(i, bit.sum(q));
            if(i<=lr[j].second)break;
            int p = i-lr[j].second-1;
            bit.add(i, bit.sum(p)*(-1));
        }
    }
    
    mint ans = bit.sum(n-1) - bit.sum(n-2);
    
    cout<<ans.x<<endl;
    
    return 0;
}

Measured memory_bytes: 4840
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

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

string s;

int main()
{
	cin >> s;

	int ope = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'A') {
			if (s[i + 1] == 'C') {
				ope++;
			}
		}
	}
	if (ope != 0)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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

int main(){
  int n;
  cin >> n;
  
  if (n<10){
    cout << n;
  }
  else if(n<100){
    cout << 9;
  }
  else if(n<1000){
    cout << 9+(n-99);
  }
  else if(n<10000){
    cout << 9+900;
  }
  else if(n< 100000){
    cout << 9+900+(n-9999);
  }
  else{
    cout << 9+900+90000;
  }
  return 0;
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
 

  for(int i = 0; i < N; i++) cin >> S[i];

  map<string,int> m;
  for(int i = 0; i < N; i++){
    m[S[i]] += 1;
  }

  sort(S.begin(),S.end());
  int max = 0;
 for(int i = 0; i < N; i++){
   if(max < m[S[i]]) max = m[S[i]];
 }
  map<string,int> p;
 for(int i = 0; i < N; i++){
   if(max == m[S[i]] && p[S[i]] == 0){ cout << S[i] << endl; p[S[i]] = 1; }
 }

 

  return 0;
}





Measured memory_bytes: 39296
#include <stdio.h>
#include <math.h>

int main(void)
{
    int i,n;
        double x,mean,poi[1010]={0};
    
    while(1){
        x=0;
        scanf("%d",&n);
        if(n!=0){
        for(i=0;i<n;i++){
            scanf("%lf",&poi[i]);
            x+=poi[i];
        }
        mean=x/n;
        x=0;
        for(i=0;i<n;i++){
            x+=pow(poi[i]-mean,2);
        }
        mean=sqrt(x/n);
        printf("%f\n",mean);
        }else break;
    }
    return 0;
}


Measured memory_bytes: 2144
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	priority_queue<int> Q;
	int N, M;
	cin >> N >> M;
	REP(i, N) {
		int A;
		cin >> A;
		Q.push(A);
	}

	REP(i, M) {
		int a = Q.top();
		Q.pop();
		Q.push(a / 2);
	}
	ll ans = 0;
	
	REP(i, N) {
		int a = Q.top();
		Q.pop();
		// cout << a << endl;
		ans += a;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 892
import heapq
N, M = map(int, input().split())
H = [[] for _ in range(M)]
for _ in range(N):
  A, B = map(int, input().split())
  if A <= M:
    H[A - 1].append(-B)
Q = []
c = 0
for d in range(M):
  for b in H[d]:
    heapq.heappush(Q, b)
  if Q:
    c -= heapq.heappop(Q)
print(c)

Measured memory_bytes: 17604
using System;

class Prog{
    static void Main(){
        var n = int.Parse(Console.ReadLine());
        int ac = 0;
        int wa = 0;
        int tle = 0;
        int re = 0;
        for(int i = 0;i<n;i++){
            var a = Console.ReadLine();
            if(a == "AC"){
                ac++;
            }else if(a == "WA"){
                wa++;
            }else if(a == "TLE"){
                tle++;
            }else{
                re++;
            }
        }
        Console.WriteLine("AC x "+ac);
        Console.WriteLine("WA x "+wa);
        Console.WriteLine("TLE x "+tle);
        Console.WriteLine("RE x "+re);
    }
}

Measured memory_bytes: 30584
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
using namespace std;
#define lowbit(x) ((x)&(-x))
#define INF 0x3f3f3f3f
#define mem(a,b) memset(a,b,sizeof(a))
#define	GE() printf(">----------\n")
#define	IN() freopen("in.txt","r",stdin)
#define	OUT() freopen("out.txt","w",stdout)
#define MP pair<int, int>
typedef long long LL;
const int mod=1000000007;
const int inf=0x3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-8;
const int maxn=105;

int main()
{
    int x;
    scanf("%d", &x);
    if(x/100==x%10)printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
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;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////
const int MAX = 510000;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main() {
	COMinit();
	int N,K; cin >> N >> K;
	ll ans;
	rep(i,K)
	{
		if(K-i<0 || N-K+1 < i+1){ans = 0;}
		else if(K-i == 0){ans = COM(N-K+1,i+1);}
		else {ans = COM(N-K+1,i+1) * COM(K-1,i);}
		ans = ans % MOD;
		cout << ans << endl;
	}
}

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

#define ld			long double
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define sd(t) 		scanf("%d",&(t))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define hii 		cout << "hii" << endl
#define okay 		cout << "okay" << endl
#define hey 		cout << "hey" << endl

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


const int N = 2e5+10;
int arr[N];
vector<int> adj[N];
int dp[N];
int brr[N]; 
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("jjj.txt", "w", stdout);
	#endif
}

clock_t time_p=clock();
void starboy1299()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}


void solve()
{	
	int n, k;
	cin >> n >> k;
	rep(i, 0, n){
		cin >> arr[i];
	}

	memset(dp, -1, sizeof(dp));

	dp[0] = 0;
	dp[1] = abs(arr[1]-arr[0]);


	for(int i=2; i<n; i++){
		dp[i] = dp[i-1] + abs(arr[i-1]-arr[i]);
		for(int j = k; j > 0; j--){
			if(i-j < 0) continue;
			dp[i] = min(dp[i], dp[i-j] + abs(arr[i]-arr[i-j]));
		}
	}

	cout << dp[n-1] << endl;
}		


int32_t main(){
	// fast();
    int t = 1;
    // cin>> t;
    while(t--)
    solve();
	// starboy1299();
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,x,y,z;
    cin>>a>>b;
    if(a<b){
        x=abs(a-b);
        y=abs(x-b);
        cout<<min(x,y);
    }
    if(a>b){
        x=a%b;
        y=abs(x-b);
        cout<<min(x,y);
    }
    if(a==b)
    {
        cout<<0;
    }
}


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

int main(){
  string s,t;
  char c;
  int ans=0;
  cin>>s;
  c=s[0];
  for(int i=1;i<s.size();i++)
    if(s[i]!=c)c=s[i],ans++;
  cout<<ans<<endl;
  return 0;
}


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

int main(){
int x;
cin>>x;
bool prime=false;

while (true)
{
  for (int j = 2; j*j < x; j++)
  {
    if (x%j==0)
    {
        prime=true;
        break;
    }
    else
    {
        prime=false;
    }
    
  }
  if (prime)
  {
      x++;
  }
  else
  {
      break;
  }
  
  
     
}

cout<<x<<endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        while (n != 0) {
            for (int x = 0; n > x; x++) {
                int a = scanner.nextInt();
                int b = scanner.nextInt();
                int c = scanner.nextInt();
                if (a == 100 || b == 100 | c == 100 || (a + b + c) / 3 >= 80 || (a + b) / 2 >= 90) {
                    System.out.println("A");
                } else if ((a + b + c) / 3 >= 70 || (a + b + c) / 3 >= 50 && a >= 80 || b >= 80) {
                    System.out.println("B");
                } else {
                    System.out.println("C");
                }
            }
            n = scanner.nextInt();
        }
    }
}



Measured memory_bytes: 38300
#include <stdio.h>
#include <math.h>

int main(void) {
    int num, i;
    int hh, mm;
    double torad, diff;
    
    scanf("%d", &num);
    
    for(i = 0; i < num; i++) {
        scanf("%d %*c %d", &hh, &mm);
        
        torad = (hh * 30) + (0.5 * mm);
        
        diff = fabs(torad - ((mm / 5.0) * 30));
        
        if(diff > 180)
            diff = 360 - diff;
        
        if(diff >= 0 && diff < 30)
            puts("alert");
        else if(diff >= 90 && diff <= 180)
            puts("safe");
        else
            puts("warning");
        
    }
    
    return(0);
}

Measured memory_bytes: 584
using System;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            string[] input = Console.ReadLine().Split();
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);

            if (A == B)
            {
                Console.WriteLine(A+B);
            }
            else
            {
                int max = Math.Max(A,B);
                Console.WriteLine(max * 2 - 1);
            }
        }
    }
}


Measured memory_bytes: 13140
#include "bits/stdc++.h"
using namespace std;

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

    long long A, B, C;
    for (long long i = 1; i <= 3500; i++) {
        for (long long j = 1; j <= 3500; j++) {
            long long test1 = 4 * i * j - N * (i + j);
            long long test2 = N * i * j;
            if (test1 > 0 && test2 > 0 && test2 % test1 == 0) {
                A = i;
                B = j;
                C = test2 / test1;
            }
        }
    }

    cout << A << " " << B << " " << C << endl;
}

Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long k = Long.parseLong(sc.next());
        Map<Integer, Long> map = new TreeMap<>();
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(sc.next());
            long b = Long.parseLong(sc.next());
            if (map.containsKey(a)) {
                long num = map.get(a) + b;
                map.put(a, num);
            } else {
                map.put(a, b);
            }
        }
        long temp = k;
        for (Map.Entry<Integer, Long> e : map.entrySet()) {
            temp = temp - e.getValue();
            if (temp <= 0) {
                System.out.println(e.getKey());
                return;
            }
        }
    }
}

Measured memory_bytes: 66544
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int[] x = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
		}
		Arrays.sort(x);
		long min = 100000000;
		for (int i = x[0]; i <= x[n - 1]; i++) {
			long tmp = 0;
			for (int j = 0; j < n; j++) {
				tmp += (x[j] - i) * (x[j] - i);
			}
			min = Math.min(min, tmp);
		}
		System.out.println(min);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 21076
#include <stdio.h>
#include <stdint.h>

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

  long long i, sum = 0;
  for(i=1; i<=N; i++){
    if(i%3==0 || i%5==0){
      continue;
    }else{
      sum += i;
    }
  }
  
  printf("%ld", sum);
  
  return 0;
}



Measured memory_bytes: 1708
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

constexpr ll mod = 1000000007LL;

// aのb乗を求める.
ll modpow(ll a, ll b) {
	if (a > mod) a %= mod;
	if (b == 0LL) return 1LL;
	ll tmp = modpow(a, b / 2);
	if (b & 1LL)
		return tmp * tmp % mod * a % mod;
	return tmp * tmp % mod;
}

// aの逆元を求める.
ll inverse(ll a) {
	return modpow(a, mod - 2);
}

// kの階乗を計算する.(sgnを0以外に設定すると逆元を返す)
ll fact(ll k, int sgn = 0) {
	static vector<ll> fac(2, 1LL);
	static vector<ll> inv(2, 1LL);
	static vector<ll> finv(2, 1LL);
	static ll nx = 2LL;
	while (nx <= k) {
		fac.push_back(fac[nx - 1] * nx % mod);
		inv.push_back(mod - inv[mod % nx] * (mod / nx) % mod);
		finv.push_back(finv[nx - 1] * inv[nx] % mod);
		++nx;
	}
	if (sgn == 0)
		return fac[k];
	return finv[k];
}

int main(void){
	int N, M; cin >> N >> M;
	ll res = 0;
	for (int k = 0; k <= N; ++k){
		ll tmp = ((k % 2 == 0 ? 1 : -1) * fact(M - k) + mod) % mod;
		tmp *= fact(M - N, 1) * fact(N - k, 1) % mod * fact(k, 1) % mod;
		tmp %= mod;
		res = (res + tmp) % mod;
	}
	res = res * fact(N) % mod;
	res *= fact(M) * fact(M - N, 1) % mod;
	res %= mod;
	cout << res << endl;
	return 0;
}

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

int N;
vector<string> ans;

void dfs(int s,int m,string now){
    if (s==N){ans.emplace_back(now); return;}
    for (int i=0;i<m;++i){
        if (i!=m-1) dfs(s+1,m,now+(char)('a'+i));
        else dfs(s+1,m+1,now+(char)('a'+i));
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    dfs(0,1,"");
    sort(ans.begin(),ans.end());
    for (string x:ans) cout << x << '\n';
}

Measured memory_bytes: 7796
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int x[1000];
  int sum=0;
  rep(i,n){cin>>x[i];sum+=x[i];}
  sort(x,x+n);
  sum=x[0]+x[n-1];
  sum/=2;
  cout<<max(sum-x[0],x[n-1]-sum)<<endl;
  return 0;
}



Measured memory_bytes: 3164
#include<bits/stdc++.h>
#define REP(i,n) for(int i=1;i<=n;i++)
using namespace std;
int main(){
    int N,ans;
    cin>>N;
    ans=N;
    for(;;){
        if(ans%2==0){
            printf("%d\n",ans);
            return 0;
        }
        ans+=N;
    }
}

Measured memory_bytes: 256
A, B = map(int, input().split())
S = input()

count = 0
for s in S:
    if s == '-':
        break
    else:
        count += 1

S_list = []
for s in S:
    S_list.append(s)

hy_count = S_list.count('-')

if count == A and hy_count == 1:
    print('Yes')
else:
    print('No')


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

using namespace std;

int main(){
  int Q; cin >> Q;
  for(int q=0;q<Q;++q){
	string s1, s2; cin >> s1 >> s2;
	int dp[1001][1001];
	fill((int*)dp, (int*)dp+1001*1001, 0);

	for(int i=0;i<s1.size();++i)
	  for(int j=0;j<s2.size();++j){
		if(s1[i] == s2[j]) dp[i+1][j+1] = 1 + dp[i][j];
		else dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
	  }

	cout << dp[s1.size()][s2.size()] << endl;
  }
}

Measured memory_bytes: 5128
n = int(input())
p = [int(i) for i in input().split()]
ret = 0
for i in range(len(p) - 2):
	if p[i] > p[i+1] and p[i+1] > p[i+2]:
		ret += 1
	elif p[i+2] > p[i+1] and p[i+1] > p[i]:
		ret += 1
print (ret)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define N 10000000
#define M 17
using namespace std;
typedef long long LL;
LL ten[M+1];
vector<LL> a;
long double S(LL n)
{
	int ans = 0;
	while(n>0)
	{
		ans += n%10;
		n /= 10;
	}
	return ans;
}
long double f(LL x)
{
	return x/S(x);
}
vector<LL> snukes;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ten[0] = 1;
	for(int n = 1; n <= M; n++)
		ten[n] = ten[n-1]*10LL;

	for(int nine_count = 0; nine_count <= M; nine_count++)
		for(LL x = 0; x < ten[min(4,18-nine_count)]; x++)
			if(x%10!=9)
				a.push_back(x*ten[nine_count]+ten[nine_count]-1LL);
	sort(a.begin(),a.end());

	long double best = 1e18;
	for(int i = a.size()-1; i >=0; i--)
		if(f(a[i]) <= best)
		{
			//cout<<f(a[i])<<endl;
			snukes.push_back(a[i]);
			best = f(a[i]);
		}

	reverse(snukes.begin(),snukes.end());

	int k; cin >> k;
	for(int i = 0; i < k; i++)
		cout<<snukes[i]<<endl;

	return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
    double h,ans;
    vector<double> mh;
    while(cin>>h)
    {
        mh.push_back(h);
    }
    sort(mh.begin(),mh.end(),greater<double>());
    cout<<*mh.begin()-*(mh.end()-1)<<endl;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

#define VECIN(t,c,num) vector<t> c(num);REP(i,num){c[i]=in<t>();}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class ElapsedTime{
	chrono::system_clock::time_point start;
public:
	ElapsedTime():start(chrono::system_clock::now()){}
	~ElapsedTime(){
		chrono::system_clock::time_point end = chrono::system_clock::now();
		double time = static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0);
		cout << "Elapsed Time: " << time << " msec" << endl;
	}
};

vector<ll> enum_prime(ll N){
	deque<bool> is_prime(N+1,true);
	vector<ll> P;
	for(ll i=2;i<=N;i++){
		if(is_prime[i]){
			for(ll j=i*i;j<=N;j+=i){
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

vector<ll> prime_factor(ll n){
	ll sn = sqrt(n)+1;
	auto prime_list = enum_prime(sn);
	vector<ll> res;
	for(int i=0,ei=prime_list.size();i<ei;i++){
		ll v = prime_list[i];
		if(v*v>n) break;
		while(!(n%v)){
			n /= v;
			res.push_back(v);
		}
	}
	if(n>1){
		res.push_back(n);
	}

	return res;
}

class Combination{
	vector<ll> fac,finv,inv;
public:
	Combination(ll N){
		fac.resize(N+1);
		finv.resize(N+1);
		inv.resize(N+1);
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for(int i=2;i<=N;i++){
			fac[i] = fac[i-1] * i % atcoder_mod;
			inv[i] = atcoder_mod - inv[atcoder_mod%i] * (atcoder_mod/i) % atcoder_mod;
			finv[i] = finv[i-1] * inv[i] % atcoder_mod;
		}
	}
	ll Caluclation(ll n,ll r){
		if(n < r) return 0;
		if (n < 0 || r < 0) return 0;
		return fac[n] * (finv[r] * finv[n-r] % atcoder_mod) % atcoder_mod;
	}
};

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

	ll N=in<ll>(),W=in<ll>();
	auto res = prime_factor(W);
	vector<ll> unires,prime_count;
	unique_copy(ALL(res),back_inserter(unires));
	prime_count.resize(unires.size());
	for(int i=0;i<prime_count.size();i++){
		prime_count[i] = count(ALL(res),unires[i]);
	}

	ll num = 1;
	if(!prime_count.empty()){
		Combination comb(*max_element(ALL(prime_count))+N-1);
		for(int i=0;i<prime_count.size();i++){
			num *= comb.Caluclation(prime_count[i]+N-1,prime_count[i]);
			num %= atcoder_mod;
		}
	}
	out(num);

	return 0;
}


Measured memory_bytes: 2688
import collections
import fractions
N,M=map(int,input().split())
AB=sorted([list(map(int,input().split())) for i in range(N)],key=lambda x:x[0])
hon=0
yen=0
abidx=0
while M>hon:
    hon,yen=min(M-hon,AB[abidx][1])+hon,AB[abidx][0]*min(M-hon,AB[abidx][1])+yen
    abidx+=1
print(yen)


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

int main(){
    int x,y; cin >> x >> y;
    bool yes_or_no = false;

    for(int i=0; i<=x; i++){
        if(2*i + 4*(x-i) == y) yes_or_no = true;
    }

    if(yes_or_no) cout << "Yes";
    else cout << "No";
    cout << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int N, M;
    int ans=0;
    cin >> N >> M ;
    for (int i=2; i<=N*2; i+=2){
        for(int j=2; j<=N*2; j+=2){
            if((i+j)%2==0 && i<j){
                ans++;
            }
        }
    }
    for(int i=1; i<=M*2-1; i+=2){
        for(int j=1; j<=M*2-1; j+=2){
            if((i+j)%2==0 && i<j){
                ans++;
            }
        }
    }
    cout << ans << endl;
    
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n;

int main(){
    cin >> n;
    // vector<P> vp;
    // rep(i,n)FOR(j,i+1,n)vp.push_back(P(i,j));
    // cout << vp.size() << endl;
    // rep(i,(1LL << (n*(n-1) / 2))){
    //     vector<ll> cnt(n,0);
    //     rep(j,n*(n-1)/2){
    //         if(i & (1LL << j)){
    //             ll a = vp[j].first;
    //             ll b = vp[j].second;
    //             cnt[a] += (b+1);
    //             cnt[b] += (a+1);
    //         }
    //     }
    //     bool f = true;
    //     // cout << i << ":";
    //     // rep(i,n)cout << cnt[i] << " ";
    //     // cout << endl;
    //     rep(i,n-1)if(cnt[i+1] != cnt[i])f = false;
    //     if(f){
    //         rep(j,n*(n-1)/2){
    //             if(i & (1LL << j)){
    //                 ll a = vp[j].first;
    //                 ll b = vp[j].second;
    //                 cout << a+1 << " " << b+1 << endl;
    //             }
    //         }
    //     }
    // }
    vector<P> ans;
    FOR(i,1,n - n % 2 + 1){
        FOR(j,i+1,n - n % 2 + 1){
            if(j != n - n % 2-i+1)ans.push_back(P(i,j));
        }
    }
    if(n%2){
        FOR(i,1,n - n % 2 + 1){
            ans.push_back(P(i,n));
        }
    }
    cout << ans.size() << endl;
    rep(i,ans.size()){
        cout << ans[i].first << " " << ans[i].second << endl;
    }
}

Measured memory_bytes: 512
def main():
  n = int(input())
  #s = input()
  #s = input().split()
  t,a = list(map(int,input().split()))
  h = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = t - h[0]*0.006
  count = 1
  lis = []
  
  for i in range(1,len(h)):
    hi = t - h[i]*0.006
    if abs(a - hi) < abs(a - ans):
      ans = hi
      count = i + 1
  print(count)
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 3064
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    PrintWriter out = new PrintWriter(System.out);

    public void run() {
    	Scanner sc = new Scanner(System.in);
    	int n, k;

    	n = sc.nextInt();
    	k = sc.nextInt();

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

//    	for (int i : input) {
//			out.println(i);
//		}
//    	int[] input = {5,1,3,2,4,1,1,2,3,4};
//    	int a = 3;
    	Integer[] nums = new Integer[200100];
    	Arrays.fill(nums, 0);
    	for (int i : input) {
			nums[i]++;
		}

    	Arrays.sort(nums, Comparator.reverseOrder());


    	int count = 0;
    	for (int i = k; i < nums.length; i++) {
			count += nums[i];
		}
    	out.println(count);
        out.flush();
    }

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

}

Measured memory_bytes: 88664
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

s=input()
t=input()
ans=0
for i in range(3):
    if s[i]==t[i]:
        ans+=1
print(ans)

Measured memory_bytes: 10200
#include <iostream>
#include <vector>
#include <algorithm>
#include<string>
using namespace std;

int main() {
	vector<int> e(4, 0);
	string ans = "no";
	for (int i = 0; i < 4; i++) {
		int temp;
		cin >> temp;
		e[i] = temp;
	}
	sort(e.begin(), e.end());

	if (e[0] == e[1]) {
		if (e[2] == e[3]) {
			ans = "yes";
		}
	}
	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,k;
  cin>>n>>k;
  vector<ll> a(n),b(n+1,0),c(n+1,0);
  for(ll i=0;i<n;i++) cin>>a[i];
  for(ll i=0;i<n;i++){
    b[i+1]=b[i]+(a[i]>0?a[i]:0);
    c[i+1]=c[i]+a[i];
  }
  ll ans=0,tmp=0;
  for(int i=0;i<=n-k;i++){
    tmp=b[n]-b[i+k]+b[i];
    ans=max(ans,tmp);
    tmp+=c[i+k]-c[i];
    ans=max(ans,tmp);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define maxn 10010
typedef long long ll;
typedef long double ld;
const ll inF=1e18;
int a,b,c,d;
int main(){
    cin >> a >> b >> c >> d;
    while (true){
        c-=b;
        if (c<=0){
                cout << "Yes"<< endl;
                exit(0);
        }
        a-=d;
        if (a<=0){
                cout << "No"<< endl;
                exit(0);
        }
    }
}



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

int main() {
    int s, a, b;
    
    scanf("%d", &s);
    a = s / 100;
    b = s % 100;
    
    if ((a >= 1) && (a <= 12) && (b >= 1) && (b <= 12)) {
        cout << "AMBIGUOUS" << endl;
    }
    else if ((a >= 1) && (a <= 12)) {
        cout << "MMYY" << endl;
    }
    else if ((b >= 1) && (b <= 12)) {
        cout << "YYMM" << endl;
    }
    else {
        cout << "NA" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int num[3];
    int tmp,i,p,q;
    for(i = 0; i < 3; i++){
    scanf("%d",&num[i]);
    }
    for(p = 0; p < 2; p++){
        for(q = p + 1; q < 3; q++){
            if(num[p] > num[q]){
                tmp = num[p];
                num[p] = num[q];
                num[q] = tmp;
            }
        }
    }
    for(i = 0; i < 2; i++){
        printf("%d ",num[i]);
    }
    
    printf("%d\n", num[2]);
   
    return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <cmath>
#include <cassert>
using namespace std;

using ll = long long;

ll f(ll b, ll n) {
	if(b > n) {
		return n;
	} else {
		return f(b, n / b) + n % b;
	}
}

int main() {
	ll n, s;
	cin >> n >> s;
	
	ll i = 2;
	for(; i * i <= n; ++i) {
		if(f(i, n) == s) {
			cout << i << endl;
			return 0;
		}
	}
	
	ll a = n - s;
	
	if(a < 0) {
		cout << -1 << endl;
		return 0;
	} else if(a == 0) {
		cout << n + 1 << endl;
		return 0;
	}
	
	const ll inf = 1LL << 60;
	ll ans = inf;
	
	for(; i >= 1; --i) {
		if(a % i != 0) {
			continue;
		}
		
		ll b = a / i + 1;
		
		if(f(b, n) == s) {
			ans = min(ans, b);
		}
	}
	
	if(ans != inf) {
		cout << ans << endl; 
	} else {
		cout << -1 << endl;
	}
	
	return 0;
}

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

int n,m,a[N];

bool cmp(int x,int y){
	return x%2>y%2;
}

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-')  f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	n=read();m=read();
	for (int i=1;i<=m;i++) a[i]=read();
	sort(a+1,a+m+1,cmp);
	if (a[3]%2){
		printf("Impossible\n");
		return 0;
	}
	if (a[2]%2) swap(a[2],a[m]);
	for (int i=1;i<=m;i++)
		printf((i!=m)?"%d ":"%d\n",a[i]);
	if (m==1){
		if (a[1]==1) printf("1\n1\n");
		else printf("2\n%d 1\n",a[1]-1);
	}
	else {
		a[1]++;a[m]--;if (!a[m]) m--;
		printf("%d\n",m);
		for (int i=1;i<=m;i++)
			printf((i!=m)?"%d ":"%d\n",a[i]);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define check(x) cout << #x << " : " << (x) << endl
#define all(v) v.begin(),v.end() 
#define allr(v) v.rbegin(),v.rend() 
//#define endl '\n'  
typedef  long long ll; 
typedef  unsigned long long ull; 
typedef vector< ll > edge; 
typedef pair< ll , ll > mypair;
typedef priority_queue <ll> max_heap;
typedef priority_queue <mypair, vector<mypair>, greater<mypair> > min_heap;
const ll mod=1e9+7;
const ll inf=1e15;
const ll N=700+10;

int main()
{
	boost;
	ll x,a;
	cin>>x>>a;
	if(x<a) cout<<"0";
	else cout<<"10";
  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a,b,sum=1,k,num;
bool flag;
int main() {
    
   cin>>a>>b;
   k=b;
   while(k>0)
   {
      sum=sum*10;
      k=k/10;
   }
   
   num=sum*a+b;
   for(int i=1;i*i<=num;i++)
   {
       if(i*i==num)
       {
           printf("Yes");
           flag=true;
           break;
       }
       else
       {
           flag=false;
       }
   }
   if(flag==false)
   {
       printf("No");
   }
}

    
    
    
       

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

int main() {
    string n; cin >> n;
    for(int i=0; i<n.size(); i++){
        if(n.at(i)=='1'){
            n.at(i)='9';
        }
        else{
            n.at(i)='1';
        }
    }

    cout << n << endl; 

}

Measured memory_bytes: 256
import java.io.PrintWriter

fun main(args: Array<String>) {
    // 入力
    val pw = PrintWriter(System.out)
    //入手
    val a = readLine()
    val b = readLine()
    if (b != null) {
        if (a == b.substring(0, b.length-1)) {
            pw.println("Yes")
        } else {
            pw.println("No")
        }
    }
    pw.flush()
}

Measured memory_bytes: 34508
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc132_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  vector<int> c(N);
  rep(i, N) { cin >> c[i]; }

  ll ans = 0;
  repi(i, 1, N - 1) {
    if ((c[i-1] <= c[i] && c[i] <= c[i+1]) || (c[i-1] >= c[i] && c[i] >= c[i+1])) {
      ans++;
    }
  }

  cout << ans << endl;
}

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e20;
const int INF = 1e9;
const double EPS = 0.000000001;
struct edge {ll to, cost; };
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

bool pC(const P& pair1, const P& pair2) {
    return pair1.second > pair2.second;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.size();
  VVL dp(n+1, VL(4));
  ll ans;
  char abc[3] = {'A', 'B', 'C'};
  dp[n][3] = 1;
  REP(j, 3){
    dp[n-1][j] = 0;
  }
  for(int i = n-1; i >= 0; i--){
    if(s[i] == '?') dp[i][3] = 3 * dp[i+1][3] % MOD;
    else dp[i][3] = dp[i+1][3] % MOD;
  }
  for(int i = n-1; i >= 0; i--){
    for(int j = 2; j >= 0; j--){
      int a, b;
      if(s[i] == '?') a = 3;
      else a = 1;
      if(s[i] == '?' || s[i] == abc[j]) b = 1;
      else b = 0;
      dp[i][j] = a * dp[i+1][j] % MOD + b * dp[i+1][j+1] % MOD;
    }
  }
  ans = dp[0][0] % MOD;
  out(ans);
  return 0;
}


Measured memory_bytes: 7376
#include <stdio.h>

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

    switch(n%10) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
          puts("hon");
          break;
        case 0:
        case 1:
        case 6:
        case 8:
          puts("pon");
          break;
        case 3:
          puts("bon");
          break;
    }
    return 0;
}

Measured memory_bytes: 2088
#include <bits/stdc++.h>
#define pb push_back
#define l first
#define r second
#define int long long
#define pi pair<int, int>

using namespace std;

const int maxn = 200001, mod = 998244353;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n; cin >> n;
    int s1 = 0, s2 = 0;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        s1 += x * x;
        s2 += x;
    }
    int ans = 1e18;
    for (int i = 0; i <= 100; i++)
        ans = min(ans, s1 - 2 * s2 * i + n * i * i);
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>
#include <vector>
#include <iomanip>

using namespace std;

int main(void) {
  int N, A, B;
  cin >> N >> A >> B;
  cout << min(A, B) << " " << max(0, A + B - N) << endl;
  return 0;
}


Measured memory_bytes: 256