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

using namespace std;
using ll = long long;
using pint = pair<int, int>;

int main() {
	string S;
	cin >> S;

	string ans = "WA";

	vector<int> up;
	for (int i = 0; i < S.size(); ++i) {
		if ('a' > S[i] || S[i] > 'z') {
			up.push_back(i);
		}
	}

	if (up.size() == 2 && up[0] == 0 && S[up[0]] == 'A') {
		if (2 <= up[1] && up[1] <= S.size() - 2 && S[up[1]] == 'C') {
			ans = "AC";
		}
	}

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


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

int main()
{
  int n, y;
  cin >> n >> y;
  for(int i = 0; i <= n; ++i){
    for(int j = 0; j <= n; ++j){
      if(n < i + j){
        continue;
      }
      int sum = i * 10000 + j * 5000 + (n - i - j) * 1000;
      if(sum == y){
        cout << i << " " << j << " " << n - i - j << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
  return 0;
}


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

int main() {
    int N;
    std::cin >> N;

    for (int i = 1; i <= 100000; ++i) {
        if ((i * i) > N) {
            std::cout << (i-1) * (i-1) << std::endl;
            return 0;
        }
    }

    return 0;
}


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

int main(){
    long long N, x;
    cin >> N >> x;
    long long all = 2 * N - 1;
    long long mid = (all + 1) / 2;
    set<long long> use;
    for(long long i = 1; i <= all; i++)use.insert(i);
    if(N == 2){
        if(x == 2){
            cout << "Yes" << '\n';
            for(long long i = 1; i <= all; i++){
                cout << i << '\n';
            }
        }else{
            cout << "No" << '\n';
        }
    }else if(x == 1 || x == all){//3 <= N
        cout << "No" << '\n';
    }else{
        cout << "Yes" << '\n';
        vector<long long> ans(all, -1);
        if(x == 2){
            ans[mid - 2] = x + 1;
            ans[mid - 1] = x;
            ans[mid] = x - 1;
            ans[mid + 1] = x + 2;
            use.erase(x + 1);
            use.erase(x);
            use.erase(x - 1);
            use.erase(x + 2);
            for(long long i = 0; i < all; i++){
                if(ans[i] != -1)continue;
                ans[i] = *rbegin(use);
                use.erase(ans[i]);
            }
            for(auto a : ans){
                cout << a << '\n';
            }
        }else{
            ans[mid - 2] = x - 1;
            ans[mid - 1] = x;
            ans[mid] = x + 1;
            ans[mid + 1] = x - 2;
            use.erase(x - 1);
            use.erase(x);
            use.erase(x + 1);
            use.erase(x - 2);
            for(long long i = 0; i < all; i++){
                if(ans[i] != -1)continue;
                ans[i] = *rbegin(use);
                use.erase(ans[i]);
            }
            for(auto a : ans){
                cout << a << '\n';
            }
        }
    }
    return 0;
}

Measured memory_bytes: 12416
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main()
{
    long long x, y, z, a;
    cin >> x >> y;
    a = max(x,y);
    for(int i = 1; i < a; i++)
    {
        if(abs(x-i) == abs(y-i))
        {
            cout << i;
            return 0;
        }
    }
    cout << "IMPOSSIBLE";
}


Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <unordered_set>

using namespace std;

int main() {
    int n = 8, q = 3;
    string s;
    
    cin >> n >> q;
    cin >> s;
    
    vector<int> l(q, 0);
    vector<int> r(q, 0);

    for(int i = 0; i < q; ++i) {
        cin >> l[i] >> r[i];
    }
    
    vector<int> ac(n, 0);
    for(int i = 1; i < n; ++i) {
        ac[i] = ac[i - 1];
        if(s[i - 1] == 'A' && s[i] == 'C') {
            ac[i] += 1;
        }
    }
    
    for(int i = 0; i < q; ++i) {
        if(l[i] == 1) {
            cout << ac[r[i] - 1] << endl;
        } else {
            cout << (ac[r[i] - 1] - ac[l[i] - 1]) << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 2304
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
#define PI             acos(-1.0)
#define IOS            ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ms(a,b)         memset(a, b, sizeof(a))
#define filein      freopen("input.txt", "r", stdin);
#define fileout     freopen("output.txt", "w", stdout);
#define debug       cout<<"Hello, i am in here."<<endl;
#define bit_cnt(mask) __builtin_popcountll(mask)
#define ll long long int
#define dst(u,v,x,y) sqrt((x*1.0-u*1.0)*(x*1.0-u*1.0)+(y*1.0-v*1.0)*(y*1.0-v*1.0))
using namespace std;
const int MOD = (int)1e9+7;
/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N | (1<<pos);}
//int reset(int N,int pos){return N= N & ~(1<<pos);}
//bool check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/
void solve()
{
  string S;
  string T;
  cin>>S>>T;
  int lenS=S.size();
  int lenT=T.size();
  int result=INT_MAX;
  for(int i=0;i<=lenS-lenT;i++)
  {
      int temp=0;
      for(int j=0;j<lenT;j++)
      {
          if(S[j+i]!=T[j])temp++;
      }
      //cout<<temp<<endl;
      result=min(result,temp);
  }
  cout<<result<<endl;
}
int  main()
{
    IOS
        solve();
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;

#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())

using namespace std;
class UnionFind{

public:

    vector<int> Parent;


    //コンストラクタ
    UnionFind(int N){
        Parent = vector<int>(N,-1);

    }
    
    //aの根を返す
    int root(int a){
        if(Parent[a] < 0) return a;
        return Parent[a] = root(Parent[a]);
    }

    //自分のいる木の頂点の数を返す関数
    int size(int a){
        return -Parent[root(a)];
    }

    //二つの木が同じ場合はtrueを返す
    bool sameTree(int a,int b){
        int ra = root(a);
        int rb = root(b);
        return ra == rb;
    }

    //異なる二つの木を結合する
    void unite(int a, int b){
        int ra = root(a);
        int rb = root(b);
        if(ra == rb) return;

        if(size(ra) < size(rb))swap(ra,rb);

        Parent[ra] += Parent[rb];
        Parent[rb] = ra;
    }

};

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

    int N,M;
    cin >> N >> M;
    vector<int> A(M),B(M);

    for(int i = 0; i < M;i++){
        cin >> A[i] >> B[i];
        //配列を用意しているのは0-Nまでだからそこの位置に合わせている
        A[i]--;
        B[i]--;
    }

    vector<long long> ans(M);
    //引き始めの初期値はNC2を採用(Nこの中から2個を選択する繋げからからそのパターン通り存在)
	ans[M - 1] = (ll)N * (N - 1) / 2;

    UnionFind Uni(N);
    for(int i = M-1; i > 0;--i){
        ans[i-1] = ans[i];
        if(!Uni.sameTree(A[i],B[i])){
            ans[i-1] -= (ll)Uni.size(A[i])*Uni.size(B[i]);
            Uni.unite(A[i],B[i]);
        }
    }
    for (int i = 0; i < M; i++)
	{
		cout << ans[i] << endl;
	}
    
    return 0;
}



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

void solve()
{
	int i,j,k,n,m=0;
	cin>>n;
	vector <vector <int>> v(n,vector <int> (4));
	vector <vector <int>> dp(n,vector <int> (4,0));
	for(i=0;i<n;i++)
	{
		for(j=0;j<3;j++)
			cin>>v[i][j];
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<3;j++)
			dp[i][j]=v[i][j];
	}
	for(i=1;i<n;i++)
	{
		for(j=0;j<3;j++)
		{
		    m=0;
			for(k=0;k<3;k++)
			{
				if(k!=j)
				{
					if(dp[i-1][k]>m)
						m=dp[i-1][k];
				}
			}
			dp[i][j]+=m;
		}
	}
	m=0;
	for(j=0;j<3;j++)
	{
		if(dp[n-1][j]>m)
			m=dp[n-1][j];
	}
	cout<<m<<"\n";

}


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

Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF (1LL<<61 + 1<<29)
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
void _INPUT_IMPL_() {};
template <class T, class... Args> void _INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; _INPUT_IMPL_(args...); }
void _OUTPUT_IMPL_() {};
template <class T, class... Args> void _OUTPUT_IMPL_(T dest, Args... args) { cout<< dest << (sizeof...(Args)?" ":""); _OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; _INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define out(...) _OUTPUT_IMPL_(__VA_ARGS__)

int main() {
	bool a, b;
	char c;
	cin >> c; a = c == 'D';
	cin >> c; b = c == 'D';
	out(a^b?'D':'H');
}

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

using namespace std;

int main(){
   int n,i,w;
   vector<int>d;

   cin>>n;
   for(i=0;i<n;i++){
     cin>>w;
    d.push_back(w);
   }
   sort(d.begin(),d.end());


   int a,b,x=1;
   for(i=0;i<n;i++){
     // a=d[i]-'0';
      //b=d[i+1]-'0';
      if(d[i]<d[i+1])
         x++;
    }
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
//	#ifndef ONLINE_JUDGE
  //  	freopen("input.txt", "r", stdin);
  //  	freopen("output.txt", "w", stdout);
	//#endif
	int n;
	cin>>n;
	vip v(n);
	rep(i,n){
		cin>>v[i].fi>>v[i].sec;
	}
	int ans = 0;
	sort(all(v));
	int max1 = v[0].fi + v[0].sec;
	repa(i,1,n){
		if(max1 > v[i].fi - v[i].sec){
			max1 = min(v[i].fi + v[i].sec,max1);
			ans++;
		}
		else{
			max1 = max(v[i].fi+v[i].sec,max1);
		}
	}
	cout<<n-ans;
	return 0;
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

template <typename T> struct DisjointSet {
    vector<T> rank, p;
    void link(T x, T y) {
        if (rank[x] > rank[y]) {
            p[y] = x;
        } else {
            p[x] = y;
            if (rank[x] == rank[y]) { rank[y]++; }
        }
    }
    DisjointSet() {}
    DisjointSet(const DisjointSet& tree) : rank(tree.rank), p(tree.p) {}
    DisjointSet(T size) : rank(size, 0), p(size, 0) {
        rep(i, 0, size) { make_set(i); }
    }
    void make_set(T x) {
        p[x] = x;
        rank[x] = 0;
    }
    bool same(T x, T y) { return find_set(x) == find_set(y); }
    void unite(T x, T y) { link(find_set(x), find_set(y)); }
    T find_set(T x) {
        if (x != p[x]) {
            p[x] = find_set(p[x]);
            rank[x] = 1;
        }
        return p[x];
    }
    int get_size() {
        set<int> s;
        for (int i : p) { s.insert(find_set(i)); }
        return s.size();
    }
};

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

    int n, m;
    cin >> n >> m;

    DisjointSet<int> tree(n);

    rep(i, 0, m) {
        int x, y, z;
        cin >> x >> y >> z;
        tree.unite(x - 1, y - 1);
    }

    cout << tree.get_size() << endl;
    return 0;
}

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

int main(){
  int m, f, r;
  while(1){
    cin >> m >> f >> r;
    if(m == -1 && f==-1 && r==-1){
      break;
    }
    if(m==-1 || f==-1){
       cout << "F" << endl;
    }else{
      if(m+f >= 80){
         cout << "A" << endl;
      }else if(m+f >= 65){
         cout << "B" << endl;
      }else if(m+f >= 50){
         cout << "C" << endl;
      }else if(m+f >= 30){
         if(r >= 50){
           cout << "C" << endl;
         }else{
           cout << "D" << endl;
         }
      }else{
         cout << "F" << endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N;
  cin >> N;
  vector<double> x(N),y(N);
  rep(i,N) cin >> x[i] >> y[i];
  
  double sum=0;
  rep(i,N-1) {
    rep2(j,i,N) sum+=pow((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]),0.5);
  }
  sum=sum*2/N;
  
  cout << fixed << setprecision(10);
  cout << sum << endl;
}

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

int main() {
  char turn = 'a';
  string a, b, c;
  string ans = "";
  cin >> a >> b >> c;
  while(true){
    if(turn == 'a'){
      if(a.size() == 0){
        ans = "A";
        break;
      }else {
        turn = a[0];
        a.erase(0, 1);
      }
    }else if(turn == 'b'){
      if(b.size() == 0){
        ans = "B";
        break;
      }else {
        turn = b[0];
        b.erase(0, 1);
      }
    }else {
      if(c.size() == 0){
        ans = "C";
        break;
      }else {
        turn = c[0];
        c.erase(0, 1);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
while True:
    m,f,r = map(int,input().split())
    if m == f == r == -1:
        break
    if m == -1 or f == -1:
        print('F')
        continue
    if m + f >= 80:
        print('A')
        continue
    if m + f >= 65:
        print('B')
        continue
    if m + f >= 50 or (65 > m + f >= 30 and r >= 50):
        print('C')
        continue
    if m + f >= 30:
        print('D')
        continue
    if m + f < 30:
        print('F')



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

int main(){
  long long int i,x,j4,j5,kari,hantei,kotae=0;
  cin>>x;
  j4=pow(x,0.25);
  j5=pow(x,0.2);
  for(i=1;i<j5;i++){
    kari=x-pow(i,5);
    hantei=pow(kari,0.2);
    if(kari==pow(hantei,5)){
      cout<<i<<" "<<hantei*(-1);
      return 0;
    }
  }
  for(i=j5;i<=j4;i++){
    kari=pow(i,5)-x;
    hantei=pow(kari,0.2);
    if(kari==pow(hantei,5)){
      cout<<i<<" "<<hantei;
      return 0;
    }
  }
}

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

int main(){
  int a,b,c,x,counter=0;
  std::cin >> a>>b>>c>>x;
  for (int i = 0; i <= a; i++) {
    /* code */
    for (int j = 0; j <= b; j++) {
      /* code */
      for (int k = 0; k <= c; k++) {
        /* code */
        if(500*i+100*j+50*k==x)counter++;
      }
    }
  }
  std::cout << counter << std::endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()
c = [ord(x) for x in s]
d = [x + n for x in c]
e = [x % 26 for x in d]

keys = [13,14,15,16,17,18,19,20,21,22,23,24,25,0,1,2,3,4,5,6,7,8,9,10,11,12]
values = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
d = {k: v for k, v in zip(keys, values)}

ans = []
for x in e:
    ans.append(d[x])

print(''.join(ans))

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

int m2mod(int a){
  return abs(a%2);
}

int main(){
  int n;
  cin >> n;
  if(n==0){
    cout << 0;
    return 0;
  }
  string s;
  while(n!=1){
    s.push_back(m2mod(n)+'0');
    n = (n-m2mod(n))/(-2);
  }
  s.push_back('1');
  reverse(s.begin(), s.end());
  cout << s;
  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 ll = long long;
using P = pair<int,int>;

int main(){
	ll h, w;
	cin >> h >> w;
	ll ans = 100000000000000000;
	if(h%3 == 0){
		ans = 0;
	}else{
		ans = w;
	}
	if(w%3 == 0){
		ans = 0;
	}else{
		ans = min(ans, h);
	}
	if(w%3 != 0){
		ll a0 = w/3;
		ll a1 = w/3+1;
		if(h%2 == 0){
			ll s0_0 = h*a0;
			ll s1_0 = (w-a0)*h/2;
			ll s2_0 = (w-a0)*(h-h/2);
			ll mi_0 = min(min(s0_0, s1_0), s2_0);
			ll ma_0 = max(max(s0_0, s1_0), s2_0);
			if(ans > ma_0 - mi_0) ans = ma_0 - mi_0;
			ll s0_1 = h*a1;
			ll s1_1 = (w-a1)*h/2;
			ll s2_1 = (w-a1)*(h-h/2);
			ll mi_1 = min(min(s0_1, s1_1), s2_1);
			ll ma_1 = max(max(s0_1, s1_1), s2_1);
			if(ans > ma_1 - mi_1) ans = ma_1 - mi_1;
		}else{
			ll b0 = h/2;
			ll b1 = h/2+1;
			ll s0_0 = h*a0;
			ll s1_0 = (w-a0)*b0;
			ll s2_0 = (w-a0)*(h-b0);
			ll mi_0 = min(min(s0_0, s1_0), s2_0);
			ll ma_0 = max(max(s0_0, s1_0), s2_0);
			if(ans > ma_0 - mi_0) ans = ma_0 - mi_0;
			ll s0_1 = h*a1;
			ll s1_1 = (w-a1)*b0;
			ll s2_1 = (w-a1)*(h-b0);
			ll mi_1 = min(min(s0_1, s1_1), s2_1);
			ll ma_1 = max(max(s0_1, s1_1), s2_1);
			if(ans > ma_1 - mi_1) ans = ma_1 - mi_1;
			ll s0_2 = h*a0;
			ll s1_2 = (w-a0)*b1;
			ll s2_2 = (w-a0)*(h-b1);
			ll mi_2 = min(min(s0_2, s1_2), s2_2);
			ll ma_2 = max(max(s0_2, s1_2), s2_2);
			if(ans > ma_2 - mi_2) ans = ma_2 - mi_2;
			ll s0_3 = h*a1;
			ll s1_3 = (w-a1)*b1;
			ll s2_3 = (w-a1)*(h-b1);
			ll mi_3 = min(min(s0_3, s1_3), s2_3);
			ll ma_3 = max(max(s0_3, s1_3), s2_3);
			if(ans > ma_3 - mi_3) ans = ma_3 - mi_3;
		}
	}
	swap(h, w);
	if(w%3 != 0){
		ll a0 = w/3;
		ll a1 = w/3+1;
		if(h%2 == 0){
			ll s0_0 = h*a0;
			ll s1_0 = (w-a0)*h/2;
			ll s2_0 = (w-a0)*(h-h/2);
			ll mi_0 = min(min(s0_0, s1_0), s2_0);
			ll ma_0 = max(max(s0_0, s1_0), s2_0);
			if(ans > ma_0 - mi_0) ans = ma_0 - mi_0;
			ll s0_1 = h*a1;
			ll s1_1 = (w-a1)*h/2;
			ll s2_1 = (w-a1)*(h-h/2);
			ll mi_1 = min(min(s0_1, s1_1), s2_1);
			ll ma_1 = max(max(s0_1, s1_1), s2_1);
			if(ans > ma_1 - mi_1) ans = ma_1 - mi_1;
		}else{
			ll b0 = h/2;
			ll b1 = h/2+1;
			ll s0_0 = h*a0;
			ll s1_0 = (w-a0)*b0;
			ll s2_0 = (w-a0)*(h-b0);
			ll mi_0 = min(min(s0_0, s1_0), s2_0);
			ll ma_0 = max(max(s0_0, s1_0), s2_0);
			if(ans > ma_0 - mi_0) ans = ma_0 - mi_0;
			ll s0_1 = h*a1;
			ll s1_1 = (w-a1)*b0;
			ll s2_1 = (w-a1)*(h-b0);
			ll mi_1 = min(min(s0_1, s1_1), s2_1);
			ll ma_1 = max(max(s0_1, s1_1), s2_1);
			if(ans > ma_1 - mi_1) ans = ma_1 - mi_1;
			ll s0_2 = h*a0;
			ll s1_2 = (w-a0)*b1;
			ll s2_2 = (w-a0)*(h-b1);
			ll mi_2 = min(min(s0_2, s1_2), s2_2);
			ll ma_2 = max(max(s0_2, s1_2), s2_2);
			if(ans > ma_2 - mi_2) ans = ma_2 - mi_2;
			ll s0_3 = h*a1;
			ll s1_3 = (w-a1)*b1;
			ll s2_3 = (w-a1)*(h-b1);
			ll mi_3 = min(min(s0_3, s1_3), s2_3);
			ll ma_3 = max(max(s0_3, s1_3), s2_3);
			if(ans > ma_3 - mi_3) ans = ma_3 - mi_3;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,a2,a3;
	scanf("%d%d%d",&a,&a2,&a3);
	printf("%d",max(a,max(a2,a3))-min(a,min(a2,a3)));
	return 0;
}

Measured memory_bytes: 256
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
#define BIGP   1000000007
#define INF_I  std::numeric_limits<ll>::max()
#define INF_F  std::numeric_limits<float>::infinity()
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //
    ll N, R;
    cin >> N >> R;
    if (10 <= N)
    {
        cout << R;
    }
    else
    {
        cout << R + 100 * (10 - N);
    }
    return 0;
}

Measured memory_bytes: 3120
import java.util.Scanner;

public class Main {

	static Scanner in = new Scanner(System.in);
	
	public static void main(String[] args) {
		final int N = in.nextInt();
		
		for (int i = 0; i < N; i++) {
			solve();
		}
	}
	
	public static void solve() {
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		
		if (c*c == a*a + b*b ||
			b*b == a*a + c*c ||
			a*a == b*b + c*c) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		
	}
}

Measured memory_bytes: 23396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout << (a) << endl;
#define all(v) v.begin(), v.end()


const ll mod = 1e9+7;
struct mint {
  ll x;
  mint(ll x=0) : x((x%mod+mod)%mod) {}
  mint &operator+=(const mint &p) { if((x += p.x) >= mod) x -= mod; return *this; }
  mint &operator-=(const mint &p) { if((x += mod - p.x) >= mod) x -= mod; return *this; }
  mint &operator*=(const mint &p) { x = x * p.x % mod; return *this; }
  mint &operator/=(const mint &p) { *this *= p.inverse(); return *this; }
  mint operator-() const { return mint(-x); }
  mint operator+(const mint &p) const { return mint(*this) += p; }
  mint operator-(const mint &p) const { return mint(*this) -= p; }
  mint operator*(const mint &p) const { return mint(*this) *= p; }
  mint operator/(const mint &p) const { return mint(*this) /= p; }
  bool operator==(const mint &p) const { return x == p.x; }
  bool operator!=(const mint &p) const { return x != p.x; }
  mint inverse() const {
    ll a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return mint(u);
  }
  mint pow(ll n) const {
    mint ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream &operator<<(ostream &os, const mint &p) { return os << p.x; }
  friend istream &operator>>(istream &is, mint &a) {
    ll t;
    is >> t;
    a = mint(t);
    return (is);
  }
};


int main() {
  int N, K; ll a;
  cin >> N >> K;
  vector<ll> m, p;
  rep(i, N) {
    cin >> a;
    if (a>=0)
      p.push_back(a);
    else
      m.push_back(-a);
  }
  sort(all(p)); reverse(all(p));
  sort(all(m)); reverse(all(m));
  int idp = 0, idm = 0, ps = p.size(), ms = m.size();
  mint ans = 1;
  if (K%2 && ps == 0) {
    rep1(i, K) {
      ans *= -m[ms-i];
    }
    print(ans);
    return 0;
  }
  if (K%2) {
    ans *= p[0];
    idp++;
  }
  while (idp+idm<K) {
    if (idp<ps-1) {
      ll vp = p[idp]*p[idp+1];
      if (idm<ms-1) {
        ll vm = m[idm]*m[idm+1];
        if (vp > vm) {
          ans *= vp%mod;
          idp += 2;
        } else {
          ans *= vm%mod;
          idm += 2;
        }
      } else {
        ans *= vp%mod;
        idp += 2;
      }
    } else {
      if (idm<ms-1) {
        ll vm = m[idm]*m[idm+1];
        ans *= vm%mod;
        idm += 2;
      } else {
        ans *= p[idp];
        ans *= -m[idm];
        idp++; idm++;
      }
    }
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 5484
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;
const auto MOD = 1000000007;
const int INF = 1e9;
const long long LINF = 1e18;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef vector<int> VI;
typedef vector<long long> VLL;


int n, m,a,b,c;
string s,t;

int main() {
	cin >> n;
	VI h(n);
	for (int i = 0; i < n; i++)
	{
		cin >> h[i];
	}
	VI ans(n,0);
	ans[0] = 0;
	int ret = 0;
	for (int i = 1; i < n; i++)
	{
		if (h[i] <= h[i - 1]) {
			ans[i] = ans[i-1] + 1;
		}
		else {
			ans[i] = 0;
		}
		if (ans[i] > ret)ret = ans[i];
	}
	cout << ret << endl;
}


Measured memory_bytes: 1024
"use strict";
const combi = function(n){
    return n*(n-1)/2
}

const main = arg => {
    const input = arg.trim().split("\n");

    const N = parseInt(input[0].split(" ")[0]);
    const A = input[1].split(" ").map(n => parseInt(n));

    let m = {}
    for(let i = 0; i<A.length; i++){
        if(!m[A[i]]) m[A[i]] = 1
        else m[A[i]]++
    }
    let orgCnt = 0
    let keys = Object.keys(m)
    for(let i = 0; i<keys.length; i++){
        orgCnt = orgCnt + combi(m[keys[i]])
    }

    for(let i = 0; i<A.length; i++){
        let num = m[A[i]]
        const diff = combi(num) - combi(num-1)
        console.log(orgCnt-diff)
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 53524
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = k; i < (int)(n); i++)
#define repd(i, n) for (int i = n-1; i >= 0; i--)
#define rrepd(i, k, n) for (int i = n-1; i >= (int)(k); i--)
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
//V,Pは大文字i,l,bは小文字
using ll = long long;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vl = vector<ll>;
using VVl = vector<Vl>;
using Vb = vector<bool>;
using VVb = vector<Vb>;
using P = pair<int,int>;
using Pll = pair<ll, ll>;
const ll mod = 1000000007;
const ll inf = 1000000000000;//10の12乗
// GCD, LCM
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
    int n,x;
    cin >> n >> x;
    int ans;
    rep(i,n){
        int a;
        cin >> a;
        int d=abs(x-a);
        if(i!=0){
            ans=gcd(ans,d);
        }

        else ans=d;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
n = gets.chomp.to_i
count = Hash.new(0)
ans = 0
n.times do
    str = gets.chomp.split("").sort.join("")
    count[str] += 1
end
count.each do |key, value|
    if value >= 2
        ans += (value * (value - 1)) / 2
    end
end
puts ans

Measured memory_bytes: 18428
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin >> n;
    double ans=0;
    rep(i,n)
    {
        double x;string s;
        cin >> x >> s;
        if(s=="JPY")ans+=x;
        else ans+=x*380000.0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long int X,Y;
    cin >> X >> Y;
 
    
    if ((X*4) >= Y && (X*2) <= Y && Y % 2 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  
  	return 0;
}


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

#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(long long i=0;i<(n);i++)

int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int ans = 0;
  int r = 10;
  if(a % 10 > 0) {
    r = a % 10;
  }
  if(b % 10 > 0) {
    r = min(r, b % 10);
  }
  if(c % 10 > 0) {
    r = min(r, c % 10);
  }
  if(d % 10 > 0) {
    r = min(r, d % 10);
  }
  if(e % 10 > 0) {
    r = min(r, e % 10);
  }
  ans += ((a + 9) / 10) * 10;
  ans += ((b + 9) / 10) * 10;
  ans += ((c + 9) / 10) * 10;
  ans += ((d + 9) / 10) * 10;
  ans += ((e + 9) / 10) * 10;
  ans -= 10 - r;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector> 
#include <math.h> 
using namespace std;

int main(void) {
    string n; cin >> n;
    if (n == "A") {
        cout << 'T' << endl;
    } else if (n == "T") {
        cout << 'A' << endl;
    } else if (n == "G") {
        cout << 'C' << endl;
    } else {
        cout << 'G' << endl;
    }
}


Measured memory_bytes: 3612
s = gets.chomp
i = 0
while i < s.size
  if s[i, 5] == 'dream'
    if s[i, 7] == 'dreamer'
      if s[i + 7] == 'a'
        i += 5
      else
        i += 7
      end
    else
      i += 5
    end
  elsif s[i, 6] == 'eraser'
    i += 6
  elsif s[i, 5] == 'erase'
    i += 5
  else
    puts 'NO'
    exit
  end
end
puts 'YES'


Measured memory_bytes: 1916
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a < b && b < c && a < c) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if ((a+b)%2!=0)
	{
		cout<<"IMPOSSIBLE"<<endl;
		return 0;
	}
	cout<<(a+b)/2<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
const int INF = 1<<30;
const long long LINF = 1e18;
const int EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fr first
#define sc second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<ll,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
struct edge{
	int to;
	ll cost;
	edge(){}
	edge(int to,ll cost){
		this->to = to;
		this->cost = cost;
	}
	bool operator<(const edge &a)const{
		return cost > a.cost;
	}
};
vector < edge > G[100050];
int main(){
	int N,M,C;
	scanf("%d%d%d",&N,&M,&C);

	rep(i,M){
		int a,b;
		ll d;
		scanf("%d%d%lld",&a,&b,&d);
		--a;--b;
		G[a].PB(edge(b,d));
		G[b].PB(edge(a,d));
	}

	priority_queue < edge > Q;
	Q.push(edge(0,0));

	Pii memo[100050];

	rep(i,N+10){
		memo[i].fr = LINF;
		memo[i].sc = INF;
	}

	while(!Q.empty()){
		edge e = Q.top();Q.pop();

		if(memo[e.to].fr != LINF)continue;
		memo[e.to].fr = e.cost;
		memo[e.to].sc = e.to;

		rep(i,G[e.to].size()){
			Q.push(edge(G[e.to][i].to,e.cost + G[e.to][i].cost));
		}
	}


	sort(memo,memo+N);reverse(memo,memo+N);

	ll sum = 0;
	ll ans = LINF;

	bool visited[100050] = {false};

	rep(i,N){

		//printf("%lld %d -> ",memo[i].fr,memo[i].sc);
		ans = min(sum + memo[i].fr * C,ans);
		visited[memo[i].sc] = true;
		rep(j,G[memo[i].sc].size()){
			if(visited[G[memo[i].sc][j].to])continue;
			sum += G[memo[i].sc][j].cost;
		}
		//printf("[%lld %lld]\n",sum,memo[i].fr);
	}


	printf("%lld\n",ans);


	return 0;
}

Measured memory_bytes: 21288
#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++)
typedef long long ll;

ll memo[10][10];

int updown(int n){
	int a,first;
  	first=n%10;//一の位の数。
  	while(true){
  		if(n/10==0){
        	a=n;break;
        }
      	n/=10;
    }
  	memo[a][first]++;
}

int main() {
    
  	rep(i,10){rep(j,10){memo[i][j]=0;}}
  	int N;
  	cin >>N;
  	for(int i=1;i<=N;i++){
     	updown(i); 
    }
  ll ans=0;
  for(int i=1;i<=9;i++){
  	for(int j=1;j<=9;j++){
      ans+=memo[i][j]*memo[j][i];
    }
  }
   cout<<ans<<endl;
    
    
    
}


Measured memory_bytes: 256
s1 = str(input())
s2 = str(input())

def levenshtein_distance(a: str, b: str):
    m = len(a)
    n = len(b)
    ld = [[m + n for j in range(n + 1)] for i in range(m + 1)]
    for i in range(m + 1):
        ld[i][0] = i
    for j in range(n + 1):
        ld[0][j] = j
    for i in range(1, m + 1):
        for j in range(1, n + 1):
            if a[i-1] == b[j-1]:
                ld[i][j] = min(ld[i-1][j]+1, ld[i][j-1]+1, ld[i-1][j-1])
            else:
                ld[i][j] = min(ld[i-1][j]+1, ld[i][j-1]+1, ld[i-1][j-1]+1)
    return ld[m][n]

print(levenshtein_distance(s1, s2))


Measured memory_bytes: 46272
n = int(input())
sorts =['S', 'H', 'C', 'D']
All = [[i, j] for i in sorts for j in range(1, 14)]
Exist = []
for i in range(n):
  e = list(map(str, input().split()))
  e[1] = int(e[1])
  Exist.append(e)
Rest = []
for i in All:
  if not (i in Exist):
    Rest.append(i)

Rest_S = [x for x in Rest if x[0] == 'S']
Rest_H = [x for x in Rest if x[0] == 'H']
Rest_C = [x for x in Rest if x[0] == 'C']
Rest_D = [x for x in Rest if x[0] == 'D']  
  
Rest_S_R = [x[1] for x in Rest_S]  
Rest_H_R = [x[1] for x in Rest_H]  
Rest_C_R = [x[1] for x in Rest_C]  
Rest_D_R = [x[1] for x in Rest_D]  
while True:
  if Rest_S ==[]:
    break
  else:
    k = ['S',min(Rest_S_R)]
    print(' '.join(map(str,k)))
    Rest_S.remove(k)
    Rest_S_R = [x[1] for x in Rest_S]
while True:
  if Rest_H ==[]:
    break
  else:
    k = ['H',min(Rest_H_R)]
    print(' '.join(map(str,k)))
    Rest_H.remove(k)
    Rest_H_R = [x[1] for x in Rest_H]
while True:
  if Rest_C ==[]:
    break
  else:
    k = ['C',min(Rest_C_R)]
    print(' '.join(map(str,k)))
    Rest_C.remove(k)
    Rest_C_R = [x[1] for x in Rest_C] 
while True:
  if Rest_D ==[]:
    break
  else:
    k = ['D',min(Rest_D_R)]
    print(' '.join(map(str,k)))
    Rest_D.remove(k)
    Rest_D_R = [x[1] for x in Rest_D] 




Measured memory_bytes: 5628
#include <math.h>
#include <utility>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main(){
	int n;
	int m;
	int l;
	cin >> n >> m >> l;
	vector<int> p;
	vector<int> t;
	vector<int> v;
	int a;
	for ( int i = 0; i < n; i++ ) {
		cin >> a;
		p.push_back(a);
		cin >> a;
		t.push_back(a);
		cin >> a;
		v.push_back(a);
	}
	long long int c[51][51] = {0};
	for ( int i = 0; i <= m; i++ ) {
		for ( int j = 0; j <= i; j++ ) {
			if ( j == 0 || j == i ) {
				c[i][j] = 1;
			}else {
				c[i][j] = c[i-1][j-1] + c[i-1][j];
			}
		}
	}
	double goaltime;
	double pro;
	double s;
	for ( int i = 0; i < n; i++ ) {
		s = 0.00;
		if ( v[i] == 0 ) {
			cout << fixed << s << endl;
			continue;
		}
		for ( int x = 0; x <= m; x++ ) {
			goaltime = double(l) / v[i] + t[i] * x;
			pro = pow( 0.01*p[i] , x ) * pow( 1.00 - 0.01*p[i] , m - x ) * c[m][x];
			for ( int j = 0; j < n; j++ ) {
				if ( i == j ) continue;
				if ( v[j] == 0 ) {
					continue;
				}
				double g;
				g = goaltime - double(l) / v[j];
				int y;
				if ( t[j] == 0 ) {
					if ( g >= 0 ) y = m + 1;
				}else {
					y = (int)g / t[j] + 1;
				}
				if ( g < 0 ) y = 0;
				if ( y > m ) {
					pro = 0.00;
					break;
				}
				double z = 0.00;
				for ( y; y <= m; y++ ) {
					z += pow( 0.01*p[j] , y ) * pow( 1.00 - 0.01*p[j] , m - y ) * c[m][y];
				}
				pro = pro * z;
			}
			s += pro;
		}
		cout << fixed << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1412
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  i64 N, i;
  cin >> N;
  vector<pi> X(N);
  REP(0, N, i) {
    i64 x, l;
    cin >> x >> l;
    X[i].second = x - l;
    X[i].first = x + l;
  }
  sort(all(X));

  vi ans(N, 0);
  ans[0] = 1;
  REP(1, N, i) {
    i64 L = X[i].second;
    auto it = lower_bound(X.begin(), X.begin() + i, pi(L+1, 0));
    i64 candidate = 1;
    if(it != X.begin()) {
      candidate = ans[it - X.begin() - 1] + 1;
    }
    //cout << i << " " << L << " " << X[i].first <<  " " << (it - X.begin()) << " " << candidate << endl;
    ans[i] = max(ans[i-1], candidate);
  }
  cout << ans[N-1] << endl;

  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    FASTINOUT;
    ll a,b,n;
    cin>>a>>b>>n;
    ll x=min(b-1,n);
    cout<<a*x/b-a*(x/b);
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
  int kazu = 0;
  cin >> kazu;
  string iro;
  cin >> iro;
  char ima;
  int kotae = 0;
  kotae = 1;
  ima = iro[0];
  for(int i = 0;i <= kazu - 1;i++){
    if(iro[i] != ima){
      kotae++;
    }
    ima = iro[i];
  }
  cout << kotae << endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 1000000000
#define MOD 1000000007
#define ll long long int
using namespace std;
int main(){
  string s; cin>>s;
  int dp[100][2] = {}; // 上からんんけためか、smaller flag
  dp[0][1] = -99999;
  for(int i=1;i<=s.size();i++){
    int now = s[i-1] - '0';
    dp[i][0] = dp[i-1][0] + now;
    if(now != 0)
    dp[i][1] = max((dp[i-1][1] + 9),dp[i-1][0] + now -1);
    else dp[i][1] = dp[i-1][1] + 9;

  }

cout<<max(dp[s.size()][1],dp[s.size()][0])<<endl;
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline


N, Q = map(int, input().split())
S = input().rstrip()
count_AC = [0]*N

have_A = False
count = 0
for i in range(N):
    if S[i] == 'A':
        have_A = True

    elif have_A:
        if S[i] == 'C':
            count += 1
            have_A = False
        else:
            have_A = False
    count_AC[i] = count

for i in range(Q):
    l, r = map(int, input().split())
    ans = count_AC[r-1] - count_AC[l-1]
    print(ans)


Measured memory_bytes: 6532
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<numeric>
#include<string>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const ll MOD = 1000000007;
 
using namespace std;

int main()
{
    string S;   cin >> S;
    if(S.substr(0,3) == "RRR")  cout << 3;
    else if(S.substr(0,2) == "RR" || S.substr(1,2) == "RR") cout << 2;
    else if(S.substr(0,3) == "SSS") cout << 0;
    else cout << 1;
}


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

int main(){
	int n, ball;cin >> n;
	stack<int> r, l;
	while(n--){
		r.push(0);l.push(0);
		bool f = false;
		
		for(int i = 0;i < 10;i++){
			cin >> ball;
			if(f)continue;
			if(r.top() < ball)r.push(ball);
			else if(l.top() < ball)l.push(ball);
			else f = true;
		}
		
		while(!r.empty())r.pop();
		while(!l.empty())l.pop();
		if(!f)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define pi acos(-1)
#define valid(x , y) x >= 1 && x <= 8 && y >= 1 && y <= 8
#define pb push_back
#define pll pair <ll, ll>
#define pii <pair<ll , ll>
#define mp make_pair
#define M (1e9 + 7)
#define sl1(t) scanf("%lld" , &t)
#define si1(t) scanf("%d" , &t)
#define sl3(t , u , v) scanf("%lld %lld %lld" , &t , &u , &v)
#define si3(t , u , v) scanf("%d %d %d" , &t , &u , &v)
#define sl2(t , u) scanf("%lld %lld" , &t , &u)
#define si2(t , u) scanf("%d %d" , &t , &u)
#define el printf("\n")
#define sp printf(" ")
#define pri(t) printf("%d " ,t)
#define prl(t) printf("%lld " , t)
#define pc(x) printf("Case %lld: " , x)
//int dx[] = {1 , -1  , 0 , 0 , 1 , -1 , 1 , -1};
//int dy[] = {0 , 0 , 1 , -1 , -1 , 1 , 1 , -1};

vector<ll>v[200005];
ll vis[200005];

ll cnt = 0;
ll cnt2 = 0;

void dfs(ll n)
{
    if(vis[n] != 0)return;
    vis[n] = cnt;
    cnt2++;
    for(ll i = 0 ; i < v[n].size() ; i++){
        dfs(v[n][i]);
    }
}

int main()
{
    //ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    ///*
    #ifndef ONLINE_JUDGE
    freopen("input.cpp", "r" , stdin);
    //freopen("output.txt" , "w" , stdout);
    #endif // ONLINE_JUDGE
    //*/
    ll n;cin >> n;
    ll sr = sqrt(n);
    ll num = 1;
    for(ll i = sr + 2 ; i >= 1 ; i--){
        if(n % i == 0){
            num = i;
            break;
        }
    }
    cout << num + (n / num) - 2 << endl;
    return 0;
}


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

int sw,a[100010],n;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		if(a[i]==i+1){
			swap(a[i],a[i+1]);
			sw++;
		}
	}
	cout<<sw<<"\n";
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,x,t;
    cin >> n >> x >> t;
    cout << ((n-1)/x + 1)* t << endl;

    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<climits>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005

using namespace std;

int solve(){
    string s;
    cin>>s;
	if(s=="Sunny")cout<<"Cloudy"<<endl;
	else if(s=="Cloudy")cout<<"Rainy"<<endl;
	else cout<<"Sunny"<<endl;
	return 0;
}
int main(){
    waste;
    int t;
    //cin>>t;
    t=1;
    while(t--){
       	solve();
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(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 fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	int n, m;
	char c;
	cin >> n >> m;
	vvi a(n, vi(n, 0));
	vvi b(m, vi(m, 0));
	rep(i, n) {
		rep(j, n) {
			cin >> c;
			a[i][j] = (c == '.' ? 1 : 0);
		}
	}
	rep(i, m) {
		rep(j, m) {
			cin >> c;
			b[i][j] = (c == '.' ? 1 : 0);
		}
	}
	rep(i, (n - m) + 1) {
		rep(j, (n - m) + 1) {
			bool s = true;
			rep(k, m) {
				rep(l, m) {
					if (a[k + i][l + j] != b[k][l]) s = false;
				}
			}
			if (s) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    
    int a,b;
    
    scanf("%d %d",&a,&b);
    
    if(a==1)a=14;
    if(b==1)b=14;
    
    if(a>b)printf("Alice\n");
    else if(a<b)printf("Bob\n");
    else printf("Draw\n");
    
    return 0;
}

Measured memory_bytes: 128
import sys
from collections import Counter
input = sys.stdin.readline
N, K = map(int, input().split())
if N == 1:
  print(K)
  exit(0)
elif N == 2:
  print(K * (K - 1))
  exit(0)
mod = 10 ** 9 + 7
e = [[] for _ in range(N + 1)]
for _ in range(N - 1):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)

s = [1]
vis = [0] * (N + 1)
order = []
parent = [0] * (N + 1)
children = [0] * (N + 1)
while len(s):
  x = s.pop()
  vis[x] = 1
  order.append(x)
  for y in e[x]:
    if vis[y]: continue
    s.append(y)
    parent[y] = x
    children[x] += 1
cs = Counter()
cr = children[1]
for y in range(2, N + 1): cs[children[y]] += 1
#print(cs, cr)
res = [0] * (K + 1)
l = 0
csmx = 0
if len(cs): csmx = max(cs.keys())

for c in range(K + 1):
  if c <= 1 and (cr > 0): continue
  if c <= 2 and (len(cs) > 0): continue
  if c - 1 >= cr and (c - 2 >= csmx):
    l = c
    break
if l == 0:
  print(0)
  exit(0)

class Factorial:
  def __init__(self, n, mod):
    self.f = [1]
    for i in range(1, n + 1):
      self.f.append(self.f[-1] * i % mod)
    self.i = [pow(self.f[-1], mod - 2, mod)]
    for i in range(1, n + 1)[: : -1]:
      self.i.append(self.i[-1] * i % mod)
    self.i.reverse()
  def factorial(self, i):
    return self.f[i]
  def ifactorial(self, i):
    return self.i[i]
  def combi(self, n, k):
    return self.f[n] * self.i[n - k] % mod * self.i[k] % mod

f = Factorial(K, mod)
smcs = sum(cs.values())
res[l] = f.factorial(l) * f.ifactorial(l - cr - 1) % mod
for k, v in cs.items():
  res[l] *= pow(f.factorial(l - 2) * f.ifactorial(l - k - 2) % mod, v, mod)
  res[l] %= mod
#print(res)
revs = [0] * (K + 1)
for i in range(K + 1): revs[i] = pow(i, mod - 2, mod)
for i in range(l, K):
  res[i + 1] = res[i] * pow(i - 1, smcs, mod) % mod
  res[i + 1] *= (i + 1) * revs[i - cr] % mod
  res[i + 1] %= mod
  for k, v in cs.items():
    res[i + 1] *= pow(revs[i - k - 1], v, mod)
    res[i + 1] %= mod
#print(res)
print(res[K])
"""
for _ in range(Q):
  x = int(input())
  print(res[x])
"""


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

using namespace std;

int main(){
  string S, RS;
  assert(cin >> S);
  RS = S;
  reverse(RS.begin(), RS.end());
  if(RS == S){
    int N = (int)  S.size();
    for(int i = 0, j = ((N + 3) / 2) - 1; i < (N - 1) / 2; i++){
      if(S[i] != S[j]){
        cout << "No" << '\n';
        return 0;
      }
      j++;
    }
    cout << "Yes" << '\n';
  }else{
    cout << "No" << '\n';
  }
  return 0;
}


Measured memory_bytes: 256