akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
struct Data
{
	int a;
	int id;
}A[100005];
int n,a[100005],b[100005];
bool cmp(Data a,Data b)
{
	return a.a<b.a;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)scanf("%d",&b[i]);
	for(int i=1;i<=n;i++)A[i].a=b[i],A[i].id=a[i];
	sort(A+1,A+n+1,cmp);
	for(int i=1;i<=n;i++)b[i]=A[i].a,a[i]=A[i].id;
	for(int i=1;i<=n;i++)A[i].a=a[i],A[i].id=i;
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(A+1,A+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		if(a[i]>b[i])
		{
			printf("No\n");
			return 0;
		}
	}
	for(int i=2;i<=n;i++)
	{
		if(b[i-1]>=a[i])
		{
			printf("Yes\n");
			return 0;
		}
	}
	int now=0;
	for(int i=1;i<=n;i++)
	{
		if(A[i].a!=A[i-1].a)now++;
		a[A[i].id]=now;
	}
	if(now!=n)
	{
		printf("Yes\n");
		return 0;
	}
	int cnt=1;
	int x=a[1];
	while(x!=1)cnt++,x=a[x];
	if(cnt!=n)
	{
		printf("Yes\n");
		return 0;
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long int ll;
#define forn(i,p,n); for(long long i=p;i<n;++i)
#define rofn(i,p,n); for(long long i=p;i>n;--i)
#define pb push_back
#define pi pair
#define ff first
#define ss second
#define vi vector
#define ump unordered_map
ll m =  1e9+7;
void solve(){
	ll n;
	cin >> n;
	ll count = 0;
	forn(i,1,n){
		count += (n-1)/i;
	}
	cout<<count;
}
int main()
{
	fast;
	// int test;
	// cin >> test;
	// while(test--){
		solve();
	// 	cout<<"\n";
	// }
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    string s;
    cin >> s;
    int n = s.size();
    int tmp = n;
    for(int i = 1; i < n; i++) {
        if (s[i-1] != s[i]) tmp = min(max(i, n-i), tmp);
    }
    cout << tmp << endl;
    return 0;
}


Measured memory_bytes: 3764
#include<bits/stdc++.h>
#define ll long long
#define fill(a,k) memset(a,k,sizeof(a))

using namespace std;


int main(){

    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    // #endif    
        int n;
        cin >> n;

        int a=0,w=0,t=0,r=0;
        
       while(n--){
           string s;
           cin >> s;

           if(s == "AC")a++;
           else if(s == "WA")w++;
           else if(s == "TLE")t++;
           else if(s == "RE")r++;
       }

       cout << "AC x " << a << endl;
       cout << "WA x " << w << endl;
       cout << "TLE x " << t << endl;
       cout << "RE x " << r << endl;
}    


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n) + 1;
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  vector<ll> cnt(10010, 0);
  ll N; cin >> N;
  ll ans = 0;
  ll ri = sqrt(N);
  rep1(x, ri) {
    rep1(y, ri) {
      rep1(z, ri) {
	ans = x * x + y * y + z * z + x * y + y * z + z * x;
	if(ans <= N) {
	  cnt[ans] ++;
	  
	}
      }
    }
  }
  rep1(i, N) {
    cout << cnt[i] << "\n";
  }
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3724
#include <iostream>
#include <string>

using namespace std;

int n;
string str;

string check(int now, char c, char last, char before, char start){
    if(now == n - 1){
        if(c != last){
            return "";
        }
        if(str[now] == 'o'){
            if((before == start && c == 'S') || (before != start && c == 'W')){
                return string(1, c);
            }else{
                return "";
            }
        }else{
            if((before != start && c == 'S') || (before == start && c == 'W')){
                return string(1, c);
            }else{
                return "";
            }
        }
    }
    if(now == 0){
        string res = "";
        if(str[now] == 'o'){
            if(c == 'S'){
                res = c + check(now + 1, 'S', 'S', c, start);
                if(res.size() < n){
                    res = c + check(now + 1, 'W', 'W', c, start);
                }
            }else{
                res = c + check(now + 1, 'W', 'S', c, start);
                if(res.size() < n){
                    res = c + check(now + 1, 'S', 'W', c, start);
                }
            }
        }else{
            if(c == 'W'){
                res = c + check(now + 1, 'S', 'S', c, start);
                if(res.size() < n){
                    res = c + check(now + 1, 'W', 'W', c, start);
                }
            }else{
                res = c + check(now + 1, 'W', 'S', c, start);
                if(res.size() < n){
                    res = c + check(now + 1, 'S', 'W', c, start);
                }
            } 
        }
        return res;
    }
    if(str[now] == 'o'){
        if(c == 'S'){
            return c + check(now + 1, before, last, c, start);
        }else if(before == 'S'){
            return c + check(now + 1, 'W', last, c, start);
        }else{
            return c + check(now + 1, 'S', last, c, start);
        }
    }else{
        if(c == 'W'){
            return c + check(now + 1, before, last, c, start);
        }else if(before == 'S'){
            return c + check(now + 1, 'W', last, c, start);
        }else{
            return c + check(now + 1, 'S', last, c, start);
        }
    }
}

int main(){
    cin >> n;
    cin >> str;
    string s = check(0, 'S', '_', '_', 'S');
    if(s.size() < n){
        s = check(0, 'W', '_', '_', 'W');
        if(s.size() < n){
            cout << "-1\n";
            return 0;
        }
    }
    cout << s << "\n";
}

Measured memory_bytes: 22784
namespace Coder {
  class Scanner {
    private buffer: string = '';
    private stdinQueue: any = [];

    constructor() {
      process.stdin.resume();
      process.stdin.setEncoding('utf8');
      process.stdin.on(
        'data',
        (chunk): void => {
          this.buffer += chunk;
          while (this.stdinQueue.length > 0) {
            const i = this.buffer.indexOf('\n');
            if (i < 0) {
              break;
            }
            let line = this.buffer.substr(0, i);
            if (line.endsWith('\r')) {
              line = line.slice(0, -1);
            }
            this.buffer = this.buffer.substr(i + 1);
            this.stdinQueue.shift()(line);
          }
        },
      );
    }
    public getLine(): Promise<string> {
      return new Promise((resolve, reject) => {
        const i = this.buffer.indexOf('\n');
        if (i >= 0 && this.stdinQueue.length === 0) {
          let line = this.buffer.substr(0, i);
          if (line.endsWith('\r')) {
            line = line.slice(0, -1);
          }
          this.buffer = this.buffer.substr(i + 1);
          resolve(line);
        } else {
          this.stdinQueue.push(resolve);
        }
      });
    }

    public close(): void {
      process.stdin.pause();
    }
  }

  async function slove() {
    const sc = new Scanner();
    const [A, B, C, D]: number[] = (await sc.getLine())
      .split(' ')
      .map((x) => +x);
    const t = A + B;
    const s = C + D;
    if (t > s) {
      console.log('Left');
    } else if (t === s) {
      console.log('Balanced');
    } else {
      console.log('Right');
    }
    sc.close();
  }

  slove();
}


Measured memory_bytes: 11596
#include <bits/stdc++.h>
#define ll long long
using namespace std;
inline int read()
{int x=0;
char c=getchar();
while (c<'0'||c>'9') c=getchar();
while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
return x;
}
int n,m,head[100005],nxt[200005],v[200005],tot=0;
int a[100005],minn=1279753568,mpos=-1;
bool vis[100005];
ll ans=0;
inline void add(int a,int b)
{tot++;nxt[tot]=head[a];head[a]=tot;v[tot]=b;}
void dfs(int pos,int f)
{vis[pos]=1;
if (a[pos]<minn) {minn=a[pos];mpos=pos;}
for (int i=head[pos];i;i=nxt[i])
{if (v[i]==f) continue;
dfs(v[i],pos);
}
}
int main (){
	int i,x,y;
	n=read();m=read();
	if ((n-1-m)*2>n) {puts("Impossible");return 0;}
	int o=(n-1-m)*2;
	for (i=1;i<=n;i++) a[i]=read();
	for (i=1;i<=m;i++)
	{x=read()+1;y=read()+1;
	add(x,y);add(y,x);
	}
	for (i=1;i<=n;i++)
	{if ((!vis[i])&&o)
	{minn=1279753568;mpos=-1;
	dfs(i,0);
	ans+=minn;o--;
	a[mpos]=1279753568;
	}
	}
	sort(a+1,a+n+1);
	for (i=1;i<=o;i++) ans+=a[i];
	printf ("%lld\n",ans);
	return 0;
}
	
	
	
	


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double
#define mod 1000000007

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x,n;
    cin>>x>>n;
    set<ll> s;
    REP(i,n){
        ll t;
        cin>>t;
        s.insert(t);
    }
    ll maxx=LONG_MAX;
    ll ans;
    for(ll i=-100;i<=200;i++){
        if(s.count(i)){
            continue;
        }
        ll diff=abs(i-x);
        if(diff<maxx){
            maxx=diff;
            ans=i;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;
const int MOD = 1000000007;
int a[maxn] , sum[maxn];
int main()
{
  int n , m;
  scanf("%d%d",&n,&m);
  int one = 0 , two = 0;
  for(int i = 0 ; i < m ; i++)
  {
    scanf("%d",&a[i]);
    if(a[i] == 1) one ++;
    if(a[i] == 2) two++;
  }
  if(one && two) sum[1] = 0 , sum[2] = 0;
  else if(one) sum[1] = 0 ,sum[2] = 1;
  else if(two) sum[1] = 1,sum[2] = 0;
  else sum[1] = 1, sum[2] = 2;
  int t = 0;
  for(int i = 0 ; i < m ; i++)
  {
    if(a[i] > 2) {t = i; break;}
  }
  //cout<<t<<endl;
  for(int i = 3 ; i <= n ; i++)
  {
    if(i == a[t]) sum[i] = 0, t++;
    else sum[i] = (sum[i-1] + sum[i-2]) % MOD;
  }
  cout<<sum[n]<<endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <stdlib.h>
#include<ctype.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
int main()
{
	int N,M;
	scanf("%d %d",&N,&M);
	
	int A[N];
	int sum=0;
	for(int i=0; i<N; i++) {
		scanf("%d",&A[i]);
		sum+=A[i];
	}
	
	qsort(A, N, sizeof(int), compare_int);	
	
	for(int i=0; i<M; i++) {
		if(A[N-1-i] * 4*M < sum  ) {
			printf("No");
			return 0;
		}
	}
	printf("Yes");
		
	
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<string> vs;

typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

ll n,A,B,C;
vll l;

ll dfs(ll a,ll b,ll c,ll cnt){
	if(cnt==n){
		if(min({a,b,c})>0) return abs(A-a)+abs(B-b)+abs(C-c)-30;
		else return INF;
	}
	ll plusa=dfs(a+l[cnt],b,c,cnt+1)+10;
	ll plusb=dfs(a,b+l[cnt],c,cnt+1)+10;
	ll plusc=dfs(a,b,c+l[cnt],cnt+1)+10;
	ll non=dfs(a,b,c,cnt+1);
	return min({plusa,plusb,plusc,non});
}

int main()
{
	cin >> n >> A >> B >> C;
	l.resize(n);
	rep(i,n) cin >> l[i];
	cout << dfs(0,0,0,0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int a[1000006], tag[1000006];
int read(){
    int cnt = 0;
    char ch = getchar();
    while (ch < '0' || '9' < ch)
        ch = getchar();
    while ('0' <= ch && ch <= '9'){
        cnt = cnt * 10 + ch - '0';
        ch = getchar();
    }
    return cnt;
}
int main(){
    int n = read(), l = read();
    for (int i = 1; i <= n; ++ i)
        a[i] = read();
    for (int i = 1; i < n; ++ i)
        if (a[i] + a[i + 1] >= l){
            cout << "Possible" << endl;
            for (int j = 1; j < i; ++ j)
                cout << j << endl;
            for (int j = n - 1; j > i; -- j)
                cout << j << endl;
            cout << i << endl;
            return 0;
        }
    cout << "Impossible" << endl;
    return 0;
}


Measured memory_bytes: 4864
#include<iostream>
#include<string>
int board[100][100] = { -1 };
char b;
bool first = true;
int firstnum=0;
int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int H,W;
	std::cin >>H>>W;
	for (int i = 0; i < H; i++){
		for (int j = 0; j < W; j++){
			std::cin >> b;
			if (b == 'c'){
				board[i][j] = 0;
				if (first == true){
					firstnum = j;
					first = false;
				}
				firstnum = j;
			}
			else{
				if (first == false){
					board[i][j] = j - firstnum;
				}
				else{
					board[i][j] = -1;
				}
			}
		}
		first = true;
		firstnum = 0;
	}
	for (int i = 0; i < H; i++){
		for (int j = 0; j < W; j++){
			if (j == W - 1){
				std::cout << board[i][j] << "\n";
			}
			else{
				std::cout << board[i][j] << " ";
			}
		}
	}
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
int A,B;int a[5000],b[5000];
short dp[5001][5001];
int main(){
    scanf("%d%d",&A,&B);
    REP(i,A)
        scanf("%d",a + i);
    REP(i,B)
        scanf("%d",b + i);

    bool f = false;
    REP(i,A){
        f = (f || a[i] == b[0]);
        dp[0][i] = f;
    }
    f = false;
    REP(i,B){
        dp[i][0] = (a[0] == b[i]);
    }
    FOR(i,1,B){
        FOR(j,1,A){
            dp[i][j] = dp[i][j - 1];
            if(a[j] == b[i])
                dp[i][j] = max((short)(dp[i - 1][j - 1] + 1),dp[i][j]);
        }
    }
    short maxi = 0;
    REP(i,B)
        REP(j,A)
            maxi = max(maxi,dp[i][j]);
    printf("%d\n",maxi);
    return 0;
}

Measured memory_bytes: 52108
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

struct Color{
  double L,a,b;
};

double dist(Color C1, Color C2){
  return SQ(C1.L-C2.L) + SQ(C1.a-C2.a) + SQ(C1.b-C2.b);
}

int main(){
  int N,M;
  Color c[32];
  cin >> N >> M;
  rep(i,N) cin >> c[i].L >> c[i].a >> c[i].b;
  double res = 0;
  for(int i=0;i<1<<N;i++){
    vector<int>v;
    rep(j,N){
      if((i>>j)&1) v.push_back(j);
    }
    if(v.size()!=M) continue;
    double sum=0;
    rep(k,M) for(int l=k+1;l<M;l++){
      sum += dist(c[v[k]], c[v[l]]);
    }
    res = max(res, sum);
  }

  cout << fixed << setprecision(20) << res << endl;
  return 0;
}

Measured memory_bytes: 1312
def levenshtein(s1, s2):
    n, m = len(s1), len(s2)
    dp = [[0] * (m+1) for _ in range(n+1)]
    
    for i in range(n+1):
        dp[i][0] = i
    
    for j in range(m+1):
        dp[0][j] = j

    for i in range(1, n+1):
        for j in range(1, m+1):
            cost = 0 if s1[i-1] == s2[j-1] else 1
            dp[i][j] = min(dp[i-1][j] + 1, dp[i][j-1]+1, dp[i-1][j-1] + cost)
            
    return dp[n][m]

s1 = input()
s2 = input()

print(levenshtein(s1, s2))

Measured memory_bytes: 44852
#include <bits/stdc++.h>
using namespace std;
#define rep(shoki,i,n) for(int i=shoki; i<n; i++)
#define _GLIBCXX_DEBUG
int main(){
    int n; cin>>n;
    bool able = false;
    rep(0,i,30){
        rep(0,j,30){
            int total = i*4 + j*7;
            if(total==n){
                able = true;
                break;
            }
        }
        if(able) break;
    }
    if(able) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
def HW(H,W):
    if H%2 == 0 or W%2 == 0:
        return [H*W//2]*2
    else:
        A = min((H+1)//2*W-(H-1)//2*W,(W+1)//2*H-(W-1)//2*H)
        if A == (H+1)//2*W-(H-1)/2*W:
            return [(H+1)//2*W,(H-1)//2*W]
        else:
            return [(W+1)//2*H,(W-1)//2*H]
Ans = H*W
for i in range(1,H):
    A1 = W*i
    S = HW(H-i,W)
    S.append(A1)
    Ans = min(Ans,abs(max(S)-min(S)))
for j in range(1,W):
    A1 = H*j
    S = HW(H,W-j)
    S.append(A1)
    Ans = min(Ans,abs(max(S)-min(S)))
print(Ans)

Measured memory_bytes: 9264
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = sc.nextInt();
    int t = sc.nextInt();
    int ans = 0;
    ans += n / x;
    if (n % x != 0) {
      ans++;
    }
    System.out.println(ans * t);
    sc.close();
  }
}


Measured memory_bytes: 35712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
double pi = acos(-1.0);
const double EPS=1e-9;
#define MOD ll(1e9L+7)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define t() ll tt;cin>>tt;while(tt--) 
#define t2() ll tt2; cin>>tt2; for(ll tti=1;tti<=tt2;tti++)
#define printcj "Case #"<<tti<<": "
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cout << #x << " = " << x << "   " << #y << " = " << y << "=>";
#define debugarray(arr,n,x) { cout << "[" ; for(ll i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"] , "<<#x<<" = "<<x<<'\n';}

int main()
{
    fastio;
    int n;
    cin>>n;
    vector<ll>a(n),pre(n);
    vector<vector<ll>>dp(n,vector<ll>(n));
    
    cin>>a[0];
    pre[0]=a[0];
    for(ll i=1;i<n;i++){
        cin>>a[i];
        pre[i] =a[i]+pre[i-1];
    }

    //dp[i][j] = minimum total cost of combining interval [i,x] and [x+1,j] into [i,j]
    // dp[i][j] = min(dp[i][x]+dp[x+1][j]) + sum_of_interval[i,j]

    for(ll i=n-1;i>=0;i--)
    {
        dp[i][i] = 0; //base case
        for(ll j=i+1;j<n;j++)
        {
            dp[i][j] = LLONG_MAX;
            for(ll x=i;x<j;x++)  dp[i][j] = min(dp[i][j],dp[i][x] + dp[x+1][j]);
            dp[i][j] += pre[j] - (i?pre[i-1]:0); //current combining cost;
        }
    }
    cout<<dp[0][n-1];



    
}


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

using namespace std;

int main()
{
  int e;
  while(cin >> e, e){
    int ans = 1 << 30;
    for(int z = 0; z * z * z <= e; z++){
      int y = floor(sqrt(e - z*z*z));
      ans = min(ans, e - y*y - z*z*z + y + z);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  ll x;
  cin >> x;
  ll ans = (x/500) *1000;
  ans+= ((x % 500) / 5) * 5;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
 #include<vector>
 #include<math.h>
 // #include <ext/pb_ds/tree_policy.hpp>
 // #include <ext/pb_ds/assoc_container.hpp>
 // #include<chrono>
 using namespace std;
 // using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define int         long long 
 #define vii        vector<int>
 #define big        1e18


  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
   
    #endif
}

int clc(int a)
{
  int vl = (int)sqrt(1+8*a)-1;
  return vl/2;
}

void solve()
{

int n;
cin >> n ;

int wy=0;

for(int i=2;i*i<=n;i++)
if(n%i==0)
{
  int cn=0;
  while(n%i==0)
  {
    cn++;
    n/=i;
  }
  wy += clc(cn);
}
 
 if(n>1)
 {
  wy++;
 } 
 cout<<wy<<endl;

}

int32_t main()
{
  pr_init();
  fastio;
  
  
  solve();
  
 }


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

string L;
ll dp[(1 << 17)][2];

int main()
{
    cin >> L;
    int N = L.size();
    dp[0][0] = 1;
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            int d = j ? 1 : L[i] - '0';
            for (int k = 0; k <= d; k++)
            {
                (dp[i + 1][j || (k < d)] += dp[i][j] * (k ? 2 : 1)) %= mod;
            }
        }
    }
    cout << (dp[N][0] + dp[N][1]) % mod << endl;
}

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

bool isSolid(int nElement)
{
	int nRoot = sqrt(nElement);
	for (int i = 2; i <= nRoot; ++i)
	{
		if (nElement%i == 0)
		{
			return false;
		}
	}
	return true;
}


int main()
{
	int nIn = 0;
	cin >> nIn;
	int nElement = 0;
	int nCount = 0;
	while (nIn--)
	{
		cin >> nElement;
		if (isSolid(nElement))
		{
			nCount += 1;
		}
	}
	cout << nCount << endl;
	//system("pause");
	return 0;
}


Measured memory_bytes: 3136
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
using namespace std;
int main() {
    char S;
    int count[26] = {};
    while(cin >> S){
        S = tolower(S);
        int num = S - 'a';
        count[num]++;
    }
    for(int i = 0; i < 26; ++i){
        cout << (char)('a' + i) << " : " << count[i] << endl; 
    }
    return 0;
}


Measured memory_bytes: 3060
import sys
from collections import defaultdict

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    N, K = map(int, input().split())
    d = defaultdict(int)

    for i in range(N):
        a, b = map(int, input().split())
        d[a] += b

    # print(d)

    for i in range(1, 10 ** 5 + 1):
        K -= min(K, d[i])
        if K <= 0:
            ans = i
            break

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 21700
// ================
// Himanshu Lal
// MNIT Jaipur
// ================
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define TEZ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define INF 1e18
#define vi vector<pair<ll,ll>>
#define ff first
#define ss second
#define mp map<ll,ll>
#define test ll t; cin>>t; while(t--)
#define srt(v) sort(v.begin(),v.end())
double pi=acos(-1);
void OJ(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
}
int main(){
    TEZ;
    string s;
    cin>>s;
    if(s=="ABC")
        cout<<"ARC";
    else
        cout<<"ABC";
}

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int H,W;
vector<vector<char>> board;
vector<vector<bool>> check;

const vector<int> dy = {-1,0,0,1};
const vector<int> dx = {0,-1,1,0};

void dfs(int y, int x) {
    check[y][x] = true;
    rep(i,4) {
        int ny = y + dy[i];
        int nx = x + dx[i];
        if (board[ny][nx] != '#' && !check[ny][nx]) dfs(ny,nx);
    }
    return;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    while(true) {
        cin >> W >> H;
        if (W == 0 && H == 0) break;
        board.assign(H+2, vector<char>(W+2,'#'));
        rep(i,H) rep(j,W) cin >> board[i+1][j+1];
      
        int sy,sx;
        rep(i,H) {
            rep(j,W) {
                if (board[i+1][j+1] == '@') {
                    sy = i+1;
                    sx = j+1;
                }
            }
        }

        check.assign(H+2, vector<bool>(W+2,false));
        dfs(sy,sx);

        int count = 0;
        rep(i,H) rep (j,W) if (check[i+1][j+1]) count++;
        cout << count << endl;
    }
}



Measured memory_bytes: 3148
#include<stdio.h>
int main(){
  int i,j,count=0,n,q,key,l,r,mid;
  int a[100000],b[100000];
  scanf("%d",&n);
  for(i=0;i<n;i++){
  scanf("%d",&a[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&b[i]);
}
for(j=0;j<q;j++){
  key=b[j];
  a[n]=key;
  l=0;
  r=n;
while(l<=r){
  mid=(l+r)/2;
  if(a[mid]==key){
    count++;
    break;
  }
  else if(a[mid]<key){
    l=mid+1;
  }
  else{
    r=mid-1;
  }
}
}
printf("%d\n",count);
return 0;
}



Measured memory_bytes: 2420
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main()
{
	long long q;
	cin>>q;
	vector<int> v;
	while(q--)
	{
		long long a,b,ans = 0;
		cin>>a>>b;
		if(a > b)
		{
			swap(a,b);
		}
		if(a == b || a == (b - 1))
		{
			ans = 2 * (a - 1);
		}
		else
		{
			long long x = floor(sqrt(a * b));
			if(x * x == a * b)
			{
				x--;
			}
			if(x * (x + 1) >= a * b)
			{
				ans = 2 * (x - 1);
			}
			else
			{
				ans = 2 * x - 1;
			}
		}
		v.push_back(ans);
	}
	for(int i = 0;i < v.size(); ++i)
	{
		printf("%d\n",v[i]);
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000000
#define MAX 200001
#define MOD 1000000007

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

int main(){
    int N, M;
    int sum = 0;
    cin >> N >> M;
    vector<int> A(N);
    rep(i,N){
        cin >> A[i];
        sum += A[i];
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());
    int flag = 1;
    if(A[M-1] * 4 * M < sum) flag = 0;
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

void dfs(int node, vector<vector<int>>& edges, vector<int>& visited, vector<int>& in_degree, vector<int>& dist){
	visited[node] = true;
	for(int k = 0; k < edges[node].size();k++){
		in_degree[edges[node][k]]--;
		dist[edges[node][k]] = max(dist[edges[node][k]], dist[node] + 1);
		if(in_degree[edges[node][k]] == 0)
			dfs(edges[node][k] ,edges, visited, in_degree,dist);
	}
}

int main(){
	int n,m;
	cin>>n>>m;
	vector<vector<int>> edges(n+1);
	vector<int> in_degree(n+1);
	vector<int> dist(n+1);
	vector<int> visited(n+1);

	for(int i = 0; i < m; i++){
		int a,b;
		scanf("%d%d",&a,&b);
		edges[a].push_back(b);
		in_degree[b]++;
	}
	for(int node = 1; node <= n; node++){
		if(visited[node] == false && in_degree[node] == 0)
			dfs(node, edges, visited, in_degree, dist);
	}

	int answer = 0;
	for(int i = 1; i <= n; i++){
		answer = max(answer, dist[i]);
	}
	cout<<answer<<endl;
	return 0;
}

Measured memory_bytes: 14720
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<vector>
#include<set>
#include<queue>
using namespace std;
int a[50][50],d,n,ans;
int main(){
  cin>>n>>d;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=d;j++){cin>>a[i][j];}}
  for(int i=1;i<n;i++){
    for(int j=i+1;j<=n;j++){
      	int res=0;
      	for(int k=1;k<=d;k++)res+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
      	int pp=sqrt(res);
      	if(pp*pp==res)ans++;
    }}
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void print() { cout << "\n"; }
template <class T> void print(const T &x) { cout << x << "\n"; }
template <class T, class... Args> void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
template <class T> void printVector(const vector<T> &v) {
    for(const T &x : v) {
        cout << x << " ";
    }
    cout << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k;
    string s;
    cin >> k >> s;
    if(s.size() <= k) {
        print(s);
    } else {
        string t = s.substr(0, k);
        t += "...";
        print(t);
    }
}

Measured memory_bytes: 3552
#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main() {
  int count = 0;
  string w;
  string t;
  cin >> w;
  
  while (1) {
    cin >> t;
    if (t == "END_OF_TEXT")
      break;
    for (int i = 0; i < t.length(); i++) {
      t[i] = tolower(t[i]);
    }
    if (w == t) {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
 
ll min(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    else return b;
}
 
int main() {
    ll n;cin>>n;
    ll m;cin>>m;
    ll a[m];
    ll dp[n+1];
    for(ll i=0;i<m;i++){
        cin>>a[i];
        dp[a[i]]=-1;
    }
    dp[0]=1;
    ll x;x=1000000007;
    if(a[0]!=1){
        dp[1]=1;
    }
    for(ll i=2;i<=n;i++){
        if(dp[i]!=-1){
            dp[i]=(max(dp[i-1],0)+max(dp[i-2],0))%x;
        }
    }
    cout<<dp[n]<<endl;
    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    map<string, int> se;
    ll n;
    cin >> n;
    ll cnt = 0;
    string s;
    rep(i, 0, n) {
        cin >> s;
        sort(s.begin(), s.end());
        cnt += se[s];
        se[s]++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>
#include <iomanip>

using namespace std;

int main(){

    int T, X;
    cin >> T >> X;
    double ans = (double)T / X;

    cout << setprecision(8) << ans << endl;

    return 0;
}

Measured memory_bytes: 3772
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>

using namespace std;

int main()
{
	string s;
	cin >> s;
	sort(s.begin(),s.end());
	bool flag=true;
	if(s[0]!=s[1])flag=false;
	if(s[1]==s[2])flag=false;
	if(s[2]!=s[3])flag=false;

	cout << (flag ? "Yes" : "No") << endl;




}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define dbg(x) { cerr<<"> "<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif

const int inf = INT_MAX;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    int n, k;
    cin >> n >> k;
    int c = 0;
    for (int i = 0; i < n; i++) {
    	int a;
    	cin >> a;
    	if (a >= k) c++;

    }
    cout << c << endl;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

const lint INF=1LL<<61;

const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};

int n;
vector<lint> x,y;
vector<int> d;

lint fx(lint t){
	lint xl=INF,xr=-INF;
	rep(i,n){
		xl=min(xl,x[i]+t*dx[d[i]]);
		xr=max(xr,x[i]+t*dx[d[i]]);
	}
	return xr-xl;
}

lint fy(lint t){
	lint yl=INF,yr=-INF;
	rep(i,n){
		yl=min(yl,y[i]+t*dy[d[i]]);
		yr=max(yr,y[i]+t*dy[d[i]]);
	}
	return yr-yl;
}

int main(){
	scanf("%d",&n);
	x.resize(n);
	y.resize(n);
	d.resize(n);
	rep(i,n){
		char c; scanf("%lld%lld %c",&x[i],&y[i],&c);
		x[i]*=2;
		y[i]*=2;
		if     (c=='R') d[i]=0;
		else if(c=='U') d[i]=1;
		else if(c=='L') d[i]=2;
		else            d[i]=3;
	}
// rep(t,10){ printf("fx(%d) = %lld\n",t,fx(t)); }puts("");

	vector<lint> T={0,INF};
	lint lo,hi;
	lo=0; hi=INF;
	while(hi-lo>1){
		lint mi1=(2*lo+hi+1)/3,mi2=(lo+2*hi)/3;
		if(fx(mi1)<=fx(mi2)) hi=mi2;
		else                 lo=mi1;
	}
	T.emplace_back(lo);
// printf("t = %lld\n",lo);

	lo=0; hi=INF;
	while(hi-lo>1){
		lint mi1=(2*lo+hi+1)/3,mi2=(lo+2*hi)/3;
		if(fx(mi1)<fx(mi2)) hi=mi2;
		else                lo=mi1;
	}
	T.emplace_back(lo);
// printf("t = %lld\n",lo);

	lo=0; hi=INF;
	while(hi-lo>1){
		lint mi1=(2*lo+hi+1)/3,mi2=(lo+2*hi)/3;
		if(fy(mi1)<=fy(mi2)) hi=mi2;
		else                 lo=mi1;
	}
	T.emplace_back(lo);
//printf("t = %lld\n",lo);

	lo=0; hi=INF;
	while(hi-lo>1){
		lint mi1=(2*lo+hi+1)/3,mi2=(lo+2*hi)/3;
		if(fy(mi1)<fy(mi2)) hi=mi2;
		else                lo=mi1;
	}
	T.emplace_back(lo);
	sort(T.begin(),T.end());
//printf("t = %lld\n",lo);

	double ans=1e77;
	rep(i,(int)T.size()-1){
		lo=T[i]; hi=T[i+1];
		while(hi-lo>1){
			lint mi1=(2*lo+hi+1)/3,mi2=(lo+2*hi)/3;
			double x1=fx(mi1);
			double x2=fx(mi2);
			double y1=fy(mi1);
			double y2=fy(mi2);
			if(x1*y1<x2*y2) hi=mi2;
			else            lo=mi1;
		}
		ans=min(ans,1.*fx(lo)*fy(lo));
		ans=min(ans,1.*fx(hi)*fy(hi));
//		printf("%.15f\n",min(1.*fx(lo)*fy(lo),1.*fx(hi)*fy(hi)));
	}
	ans/=4;
	printf("%.15f\n",ans);

	return 0;
}


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

int main(){
int n,k;
std::cin >> n>>k;
int d[10]={};
int num;
for (int i = 0; i < k; i++){
  std::cin >> num;
  d[num]++;
}

int ans = n;
bool ch=false;
do {

  bool ch=[&]{
    int chnum=ans;
    while (chnum) {
      if(d[chnum%10]==1){return false;}
      chnum/=10;
    }
    return true;
  }();

  if(ch==true)break;
  else ans++;

} while(1);

std::cout <<ans << '\n';

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <climits>
#include <cmath>
#include <cstring>
#include <cassert>
#include <chrono>
#include <random>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
using namespace std;

#define pb push_back
#define fst first
#define snd second

#ifdef QLEG_DEBUG
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << '{'; string sep; for (const auto& x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream& os, const pair<A, B>& p) { return os << '(' << p.first << ", " << p.second << ')'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll, ll>;
template<typename T> using min_queue=priority_queue<T,vector<T>,greater<T>>;

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

  string s; cin>>s;

  if (s.back() == 's') s += "es"; else s += "s";
  cout << s << '\n';

}


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

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

    vector<ll> plus,minus;
    rep(i,n){
        if(a[i]>=0) plus.push_back(a[i]);
        else minus.push_back(a[i]);
    }
    sort(all(plus));
    reverse(all(plus));
    sort(all(minus));
    if(minus.empty()) minus.push_back(plus.back()), plus.pop_back();
    if(plus.empty()) plus.push_back(minus.back()), minus.pop_back();

    vector<pair<ll,ll>> res;
    ll cur=minus[0];
    for(int i=0;i+1<plus.size();i++){
        res.push_back({cur,plus[i]});
        cur-=plus[i];
    }
    res.push_back({plus.back(),cur});
    cur=plus.back()-cur;
    for(int i=1;i<minus.size();i++){
        res.push_back({cur,minus[i]});
        cur-=minus[i];
    }

    cout<<cur<<endl;
    rep(i,res.size()) cout<<res[i].first<<" "<<res[i].second<<endl;
}



Measured memory_bytes: 5872
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

constexpr int MAXN = 1e5 + 42, MOD = 998244353;

ll open[4][4];

int main() {
  int N;
  string S;
  cin >> N >> S;
  ll res = 1;
  for (int i = 1; i <= N; i++) {
    res *= i;
    res %= MOD;
  }
  for (char c : S) {
    int x = (c == 'R' ? 2 : c == 'B') + 1;
    int can = 0;
    int ok1 = 0, ok2 = 0;
    for (int i = 1; i <= 3; i++) {
      for (int j = 1; j <= 3; j++) {
        if (i != x && j != x && open[i][j]) {
          can += open[i][j];
          ok1 = i;
          ok2 = j;
        }
      }
    }
    if (can) {
      res *= can;
      res %= MOD;
      open[ok1][ok2]--;
      continue;
    }
    for (int i = 1; i <= 3; i++) {
      if (i != x && open[i][0]) {
        can += open[i][0];
        ok1 = i;
      }
    }
    if (can) {
      res *= can;
      res %= MOD;
      open[ok1][0]--;
      open[ok1][x]++;
    } else {
      open[x][0]++;
    }
  }

  cout << res << endl;

  return 0;
}


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


int main(){
  int X;
  cin >> X;
  vector<bool> is_prime(10000000, true);
  is_prime[0] = false;
  is_prime[1] = false;
  for(int ii=2; ; ii++){
    if(!is_prime[ii]) continue;
    if(ii>=X){
      cout << ii << endl;
      return 0;
    }
    for(int jj=ii+ii; jj<10000000; jj+=ii) is_prime[jj] = false;
  }
  return 0;
}

Measured memory_bytes: 1408
N = int(input())
t_list = [0]
x_list = [0]
y_list = [0]
for i in range(N):
    t, x, y = map(int, input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)
result = 'Yes'
for i in range(N + 1):
    if i == 0:
        pass
    else:
        d_t = t_list[i] - t_list[i-1]
        d_x = x_list[i] - x_list[i-1]
        d_y = y_list[i] - y_list[i-1]
        if d_t >= d_x + d_y:
            if (d_t - (d_x + d_y)) % 2 == 0:
                pass
            else:
                result = 'No'
        else:
            result = 'No'
print(result)

Measured memory_bytes: 11764
N = int(input())
h = list(map(int, input().split())) + [float("inf")]

dp = [0] * N + [float("inf")]
for i in range(N-1)[::-1]:
    dp[i] = min(abs(h[i+1] - h[i]) + dp[i+1],
                abs(h[i+2] - h[i]) + dp[i+2])

print(dp[0])

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

int main(void){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    queue<int> qu;
    vector<int> d(n,-1);
    d[0] = 0;
    qu.push(0);
    while(qu.size()) {
        int cur = qu.front();
        qu.pop();
        for(int to : g[cur]) {
            if (d[to] != -1) continue;
            d[to] = cur;
            qu.push(to);
        }
    }
    cout << "Yes" << endl;
    rep1(i,n-1){
        cout << d[i] + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 10068
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1e9 + 7;

int main(void)
{
    int n;
    int a;
    int i;
    bool flag = true;

    cin >> n;

    rep(i, 0, n)
    {
        cin >> a;
        if (a % 2 == 0)
        {
            if (a % 3 == 0 || a % 5 == 0)
            {
            }
            else
            {
                flag = false;
            }
        }
    }

    if (flag)
    {
        cout << "APPROVED" << endl;
    }
    else
    {
        cout << "DENIED" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    int pronadjen = 0;
    for (int i = 1; i <= 9; i++){
        for (int j = 1; j <= 9; j++){
            if (i * j == n)
                pronadjen = 1;
        }
    }
    if (pronadjen == 1)
        cout << "Yes";
    else
        cout << "No";
}


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

int main() {
    string a;
    cin >>a;
    rep(i,a.size()){
        if(a.at(i)=='9')
            cout<<1;
        else
        {
            cout<<9;
        }
    }
    cout<<endl;
}




Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextWord() string {
	sc.Scan()
	str := sc.Text()
	return str
}

func nextInt() int {
	i, e := strconv.Atoi(nextWord())
	if e != nil {
		panic(e)
	}
	return i
}

func main(){
	sc.Split(bufio.ScanWords)
	a := nextInt()
	ans := 0
	if a > 99999 {
		ans = 90000 + 900 + 9
	} else if a > 9999 {
		ans = a - 10000 + 1 + 900 + 9
	} else if a > 999 {
		ans = 900 + 9
	} else if a > 99 {
		ans = a - 100 + 1 + 9
	} else if a > 9 {
		ans = 9
	} else {
		ans = a
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
import java.util.Scanner;

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

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

    long total = 0;
    for (long i = k; i <= n + 1; i++) {
      total += i * n - i * (i - 1) + 1;
    }

    System.out.println(total % ((int)Math.pow(10, 9) + 7));
  }
}


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

int main() {
	int n,m;cin>>n>>m;
	vector<int> a(m),b(m);
	vector<int> c(n);
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i];
		a[i]--;
		b[i]--;
		c[a[i]]++;
		c[b[i]]++;
	}
	for(int i=0;i<n;i++){
		if(c[i]%2){
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;




	return 0;
}


Measured memory_bytes: 1408
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for i in range(0, min(A, X // 500) + 1):
    XX = X - 500 * i
    for j in range(0, min(B, XX // 100) + 1):
        XXX = XX - 100 * j
        if XXX // 50 <= C:
            ans += 1
print(ans)


Measured memory_bytes: 8908
using System;
class Program{
	static void Main(){
		int n=int.Parse(Console.ReadLine());
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		int ans=0;
		for(int i=0;i<n-1;i++){
			if(s[i]==i+1){
				int v=s[i];
				s[i]=s[i+1];
				s[i+1]=v;
				i++;
				ans++;
			}
		}
		if(s[n-1]==n){
			int v=s[n-1];
			s[n-1]=s[n-2];
			s[n-2]=v;
			ans++;
		}
		Console.WriteLine("{0}",ans);
	}
}

Measured memory_bytes: 18912