akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
inline int read() {
    int x = 0, f = 1; char c; c = getchar() ;
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f ;
}
typedef long long ll ;
const int maxn = 2e5 + 10, mod = 924844033, g = 5 ;
int n, ginv ;
int head[maxn], to[maxn * 2], nxt[maxn * 2], tot = 1 ;
int sz[maxn], cnt[maxn] ;
int fac[maxn], inv[maxn] ;
int a[4 * maxn], b[4 * maxn] ;
void addEdge (int u, int v) {
    to[++ tot] = v; nxt[tot] = head[u]; head[u] = tot ;
}
void dfs (int v, int fa) {
    sz[v] = 1 ;
    for (int i = head[v]; i; i = nxt[i]) {
        if (to[i] == fa) continue ;
        dfs (to[i], v) ;
        sz[v] += sz[to[i]] ;
    }
    -- cnt[sz[v]]; -- cnt[n - sz[v]] ;
}
ll power (ll x, int y) {
    ll res = 1 ;
    while (y) {
        if (y & 1) res = res * x % mod ;
        x = x * x % mod; y >>= 1 ;
    }
    return res ;
}
void ntt (int a[], int n, int f) {
    for (int i = 0, j = 0; i < n; i ++) {
        if (i > j) swap (a[i], a[j]) ;
        for (int t = n >> 1; (j ^= t) < t; t >>= 1) ;
    }
    for (int i = 2; i <= n; i <<= 1) {
        int wn = power (f ? ginv : g, (mod - 1) / i) ;
        for (int j = 0; j < n; j += i)
            for (int k = 0, w = 1; k < (i >> 1); k ++, w = 1ll * w * wn % mod) {
                ll A = a[j + k], B = 1ll * w * a[j + k + (i >> 1)] % mod ;
                a[j + k] = (A + B) % mod; a[j + k + (i >> 1)] = (A - B + mod) % mod ;
            }
    }
    if (f) {
        int invn = power (n, mod - 2) ;
        for (int i = 0; i < n; i ++) a[i] = 1ll * a[i] * invn % mod ;
    }
}
int main() {
    n = read() ;
    for (int i = 1; i < n; i ++) {
        int u = read(), v = read() ;
        addEdge (u, v); addEdge (v, u) ;
    }
    dfs (1, 0); cnt[n] = n ;
    fac[0] = inv[0] = 1 ;
    for (int i = 1; i <= n; i ++) fac[i] = 1ll * fac[i - 1] * i % mod ;
    inv[n] = power (fac[n], mod - 2) ;
    for (int i = n - 1; i >= 1; i --) inv[i] = 1ll * inv[i + 1] * (i + 1) % mod ;
    for (int i = 0; i <= n; i ++) {
        a[i] = 1ll * cnt[i] * fac[i] % mod ;
        b[i] = inv[n - i] ;
    }
    ginv = power (g, mod - 2) ;
    int N = 1;  for (; N <= 2 * (n + 1); N <<= 1) ;
    ntt (a, N, 0); ntt (b, N, 0) ;
    for (int i = 0; i < N; i ++) a[i] = 1ll * a[i] * b[i] % mod ;
    ntt (a, N, 1) ;
    for (int i = 1; i <= n; i ++)
        printf("%lld\n", 1ll * a[n + i] * inv[i] % mod) ;
    return 0 ;
}


Measured memory_bytes: 23424
#include <bits/stdc++.h>
using namespace std;
typedef long long in;
typedef pair<in,in> ii;
#define F first
#define S second
#define sqr(x) (x)*(x)
#define pb(x) push_back(x)
#define sz(x) (in)x.size()
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,x,y) for(in i=x;i<(y);++i)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

int main(){
    IOS;
    in n; cin >> n;
    queue<string> q;
    q.push("");
    while(n){
        string s = q.front(); q.pop();
        rep(i,0,10){
            if(sz(s) == 0 and i>0){
                char c = '0'+i;
                string r = s;
                r+=c;
                q.push(r);
                n--;
                if(n==0){
                    cout << r << '\n';
                    return 0;
                }
            }
            else{
                if(abs(s[sz(s)-1]-'0'-i)<=1){
                    char c = '0'+i;
                    string r = s;
                    r+=c;
                    q.push(r);
                    n--;
                    if(n==0){
                        cout << r << '\n';
                        return 0;
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 4864
#include<stdio.h>
int main(void) {
    int i, n, j, l, k, m, a[100], v, key;
    scanf("%d", &n);
    
    for(i=0;i<n;i++){
             scanf("%d",&a[i]);
                     }

    for ( i = 0; i < n; i++ ) {
        v = a[i];
        j = i - 1;
       
        for(j;j>=0&&a[j]>v;j--){
                                a[j+1]=a[j];
                                                              
                                }
        a[j + 1] = v;
        printf("%d", a[0]);
        for ( l = 1; l < n; l++ ) printf(" %d", a[l]);
        printf("\n");
    }
 
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    int r;cin>>r;
    cout<<3*r*r<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST std::ios::sync_with_stdio(false);
#define endl '\n'
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MAX_N 10000
#define Mem(a,b) memset(a,b,sizeof(a))
#define FREI freopen("in.txt","r",stdin)
#define FREO freopen("out.txt","w",stdout)
using namespace std;
const ll mod=1e9+7;
char str[100];
int main()
{
   cin>>str;
   int len=strlen(str);
   for(int i=0;i<len-8;i++)
      cout<<str[i];
   cout<<endl;
    return 0;
}


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

int main() {
    int A, B, K; cin >> A >> B >> K;
    if (B - A < 2 * K) {
        for (int i = A; i <= B; i++) {
            cout << i << endl;
        }
    } else {
        for (int i = A; i < A+K; i++) {
            cout << i << endl;
        }
        for (int i = B-K+1; i <= B; i++) {
            cout << i << endl;
        }
    }
}

Measured memory_bytes: 3616
#include <iostream>
#include <utility>
#include <cstdio>

using namespace std;

int main(void) {

    int N;
    cin >> N;

    int *a = new int[N];
    for (int i = N-1; i >= 0; --i) {
        cin >> a[i];
    }

    if (N != 0) {
        for (int i = 0; i < N - 1; ++i) {
            printf("%d ", a[i]);
        }
        printf("%d\n", a[N-1]);
    }

    delete[] a;
    return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define CHMIN(a,b) (a)=min((a),(b))
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

int n,m;
int s,t;

vector<pair<int,pii>> g[252], rg[252];
int dist[252];

vi g2[252];
int cap[252][252];

int main(){
  scanf("%d%d",&n,&m);
  scanf("%d%d",&s,&t);
  --s;--t;
  REP(i,m){
    int u,v,d,c;
    scanf("%d%d%d%d",&u,&v,&d,&c);
    --u;--v;
    g[u].push_back(make_pair(v,pii(d,c)));
    rg[v].push_back(make_pair(u,pii(d,c)));
  }
  REP(i,n)dist[i] = 1252521;
  priority_queue<pii> Q;
  Q.push(pii(-0, s));
  dist[s] = 0;
  while(!Q.empty()){
    pii P = Q.top(); Q.pop();
    int p = P.second;
    if(dist[p] != -P.first)continue;
    for(pair<int,pii> PP : g[p]){
      int to = PP.first;
      int cost = PP.second.first;
      if(dist[to] > dist[p]+cost){
        dist[to] = dist[p]+cost;
        Q.push(pii(-dist[to],to));
      }
    }
  }
  vector<bool> used(n,false);
  queue<int> QQ;
  QQ.push(t);
  used[t] = true;
  while(!QQ.empty()){
    int p = QQ.front(); QQ.pop();
    for(pair<int,pii> PP : rg[p]){
      int from = PP.first;
      int cost = PP.second.first;
      int capa = PP.second.second;
      if(dist[from] + cost == dist[p]){
        if(!used[from]){
          used[from] = true;
          QQ.push(from);
        }
        cap[from][p] = capa;
        g2[from].push_back(p);
        g2[p].push_back(from);
      }
    }
  }
  // REP(i,n){REP(j,n)printf("%d",cap[i][j]);puts("");}
  // ford-fulkerson
  int ans = 0;
  while(true){
    vector<bool> used(n,false);
    vi bef(n,-1);
    stack<int> S;
    S.push(s);
    used[s] = true;
    while(!S.empty()){
      int p = S.top(); S.pop();
      // printf("p:%d\n",p);
      for(int to : g2[p])if(cap[p][to]>0 && !used[to]){
        used[to] = true;
        bef[to] = p;
        S.push(to);
        // printf("to:%d\n",to);
      }
    }
    if(!used[t])break;
    ans++;
    int cur = t;
    while(cur != s){
      int b = bef[cur];
      cap[b][cur]--;
      cap[cur][b]++;
      cur = b;
    }
  }
  printf("%d\n",ans);
  return 0;
}



Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int a[3];

    cin >> a[0] >> a[1] >> a[2];

    sort(a, a+3);

    cout << a[0]+a[1] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#include <numeric>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
	ll N;
	cin >> N;
	ll ans[N];
	ans[0]=2;
	ans[1]=1;
	for(ll i=2;i<=N;i++){
		ans[i] = ans[i-2]+ans[i-1];
	}
	cout << ans[N] << endl;
}

Measured memory_bytes: 256
var a:array[1..50] of longint;
    n,i,j,tmp:longint;

function check:boolean;
var i:longint;
begin
	for i:=1 to n - 1 do if a[i] > a[i+1] then exit(false);
	exit(true);
end;

begin
	readln(n);
	for i:=1 to n do read(a[i]);
	if check then write('YES')
	else
	  begin
			i:=1;
			while (i < n) and (a[i] < a[i+1]) do inc(i);
			j:=n;
			while (j > 1) and (a[j] > a[j-1]) do dec(j);
			if i < j then 
			  begin
			    tmp:=a[i]; a[i]:=a[j]; a[j]:=tmp;
			  end;
			if check then write('YES') else write('NO');
		end;
end.

Measured memory_bytes: 128
/*
ID: jerrywcy
LINK:
LANG: C++
STATUS:
*/
#include <bits/stdc++.h>

#define init(array,x) memset(array,x,sizeof(array))

using namespace std;

typedef long long ll;

const int inf=0x3f3f3f3f;

struct edge{int u,v,nxt;}g[400010];

int n,q;
int head[200010],tot;
int val[200010];

void add(int u,int v){g[++tot]={u,v,head[u]};head[u]=tot;}

int read(){
    int f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

void down(int u,int fa,int d){
//    cout<<u<<' '<<fa<<' '<<d<<endl;
    val[u]+=d;
    for (int i=head[u];i;i=g[i].nxt){
        int v=g[i].v;
        if (v!=fa){
            down(v,u,val[u]);
        }
    }
}

int main()
{
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
    n=read();q=read();
    for (int i=1;i<n;i++){
        int u=read(),v=read();
        add(u,v);add(v,u);
    }

    while (q--){
        int p=read(),x=read();
        val[p]+=x;
    }

    down(1,0,0);

    for (int i=1;i<=n;i++)printf("%d ",val[i]);

	return 0;
}


Measured memory_bytes: 18048
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    cout<<setprecision(16);
    ll n,k;
    cin>>n>>k;
    vector<double> v(n,0);
    rep(i,n){
        cin>>v[i];
    }
    ll l = 1;
    ll r = 1e9;

    rep(ii,1000){
        ll mid = (l+r)/2.0;
        ll sum = 0;
        bool f= true;

        rep(i,n){
            ll c = v[i];
            if(mid!=0) {
                sum += (c / mid);

                if (c % mid == 0)sum--;

            }else{
                f=false;
            }
        }

        if(sum>k&&f){
            l=mid+1;
        }else{
            r=mid;
        }

    }



    cout<<r<<endl;






    return 0;
}


Measured memory_bytes: 4836
#include <iostream>
#include <cmath>
#include <string>

int main(int argc, char *argv[])
{
    int w,h,x,y,r;
    std::cin >> w >> h >> x >> y >> r;

    std::string judge = "Yes";

    if(x - r < 0)judge = "No";
    else if(x + r > w)judge = "No";
    else if(y - r < 0)judge = "No";
    else if(y + r > h)judge = "No";

    std::cout << judge << std::endl;
    return 0;
}

Measured memory_bytes: 3148
def 解():
    iN = int(input())
    iLim = int(iN**0.5) + 1

    iMinMax = len(str(iN))
    for i in range(iLim+1,0,-1):
        if iN % i == 0:
            iMax = len(str(max(i,iN//i)))
            if iMinMax < iMax :
                print(iMinMax)
                exit()
            else:
                iMinMax = iMax
    print(iMinMax)
解()


Measured memory_bytes: 3444
from itertools import product
from collections import Counter 

def main():
    n = int(input())
    v = list(map(int, input().split()))

    vo = Counter(v[::2])
    vo[-1] = 0
    vo = vo.most_common(2)
    ve = Counter(v[1::2])
    ve[-2] = 0
    ve = ve.most_common(2)

    ans = n
    for (k1, v1), (k2, v2) in product(ve, vo):
        if k1 == k2:
            continue
        ans = min(ans, n - v1 - v2)

    print(ans)

main()

Measured memory_bytes: 15472
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define forn(i,x,y) for(int i=x;i<y;++i)
#define fornr(i,x,y) for(long long i=x;i>=y;--i)
#define testcase int _t; cin >> _t; while(_t--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAXN = 2e5;


int main()
{
	ios_base :: sync_with_stdio(false);
  	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n,weight;
	cin >> n >> weight;
	vector<int> w(n+1), cost(n+1);
	forn(i,0,n)
		cin >> w[i+1] >> cost[i+1];
	ll dp[n+1][weight+1]; // максимальная стоимость которую можно набрать из первых i вещей с весом меньше чем j
	/*
		dp[i][j] = 
		{
		max(	dp[i-1][j],
				dp[i-1][j-w[i]] + cost[i]
			)
		}

   */
	forn(i,0,n+1){
		forn(j,0,weight+1){
			if(i == 0){
				dp[i][j] = 0; continue;
			}
			if(j == 0){
				dp[i][j] = 0; continue;
			}
			if(j-w[i] < 0){
				dp[i][j] = dp[i-1][j]; continue;
			}
   			dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + cost[i]);
		}
	}
	/*forn(i,1,n+1){
		forn(j,1,weight+1){
			cout << dp[i][j] << " ";
		}
		cout << '\n';
	}*/
//	cout << '\n';
	cout << dp[n][weight];  	
  	return 0;
}

 	/* 















 	*/


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


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

int main() {
    int n;
    string s;
    cin >> n >> s;
    int count = 1;
    REP(i,n-1){
        if(s[i+1] == s[i]) continue;
        else count++;
    }
    cout << count << endl;
}
 

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  for(int i=0;i<n;i++){
    cin >> h[i];
  }
  bool can=true;
  if(n==1){
    cout << "Yes" << endl;
  }
  else{
    int c=h[0];
    for(int i=1;i<n;i++){
      if(c-h[i]>=2){
        can=false;
        break;
      }
      c=max(c,h[i]);
    }
    if(can){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}

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

int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> V(N);
  for (int i = 0, x, y; cin >> x >> y; i++) V.at(i) = {x, y};
  
  sort(V.begin(), V.end());
  
  int cnt = 0;
  long double sum = 0;
  do {
    for (int i = 0; i + 1 < N; i++) {
      sum += hypot(V.at(i).first - V.at(i + 1).first, V.at(i).second - V.at(i + 1).second);
    }
    cnt++;
  } while (next_permutation(V.begin(), V.end()));

  cout << fixed << setprecision(6) << sum / cnt << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI = acos(-1.0), EPS = 1e-6;
const long long inf = 2e12 + 12;
const int MAXN = 100005, MAXM = 1003, Mod = 1000000007 , MAXLog = 20;



int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(9), cout << fixed;

    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long ans = b - a + 1;
    long long s = (a - 1) / c;
    long long e = b / c;
    long long diff = e - s;

    ans -= diff;

    s = (a - 1) / d;
    e = b / d;
    diff = e - s;

    ans -= diff;

    long long lcm = 1LL * c * d / __gcd(c, d);
    s = (a - 1) / lcm;
    e = b / lcm;
    diff = e - s;

    ans += diff;




    cout << ans << '\n';

    return 0;
}

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

int main()
 {
 	string s;
	 cin>>s;
	 if(s=="Sunny")
	 	cout<<"Cloudy"<<endl;
	else if(s=="Cloudy")
		cout<<"Rainy"<<endl;
	else if(s=="Rainy")
		cout<<"Sunny"<<endl;	  	
 	return 0;
}
 	
 					

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;


string str;

int main(){

cin >> str;

size_t size = str.length();
  
//cout << size << "\n";
  
int sum = 0;


for(int i =0; i<(int)size; i++)
{
    //cout << ((int)str[i] -48) << "\n";
  	sum += ((int)str[i] -48);
   
    sum %=9;
}

  //cout << sum << "\n";

if(sum ==0)
{
    cout << "Yes";
}else
{
    cout << "No";
}
    return  0;
}




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

int main(){
	// sengen
	long long a,b;
	// nyuryoku
	cin >> a >> b;
	long long sum = a+b;
	// keisan
	if(sum % 2 != 0){
		cout << "IMPOSSIBLE";
	}else{
		cout << sum/2;
	}
	// syutsuryoku
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
int main(){
    string w;
    map<char,int> m;
    cin>>w;
    int n=w.size();
    int ans=0;
    for(int i=0;i<n;i++){
        m[w[i]]++;
    }
    char dif='b'-'a';
    for(int i=0;i<26;i++){
        if (m['a'+i*dif]%2==1){cout<<"No"<<endl;exit(0);}
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
def inverse(a, mod):
    while(a < 0):
        a += mod
    a %= mod
    p = mod
    ya = 0
    yp = 1
    while (a > 0):
        n = p // a
        r = p % a
        yr = ya - n * yp
        ya = yp
        yp = yr
        p = a
        a = r
    return ya % mod if ya >= 0 else ya + mod

mod = 1000000007

n, m, k = map(int, input().split())

inv = 1
for i in range(1, k-1):
    inv = inv * i % mod
inv = inverse(inv, mod)

combination = inv
for i in range(n*m-k+1, n*m-1):
    combination = combination * i % mod


xn = n * (n + 1) * (n - 1) // 6 % mod * m % mod * m % mod
yn = m * (m + 1) * (m - 1) // 6 % mod * n % mod * n % mod
ans = (xn + yn) * combination % mod
print(ans)



Measured memory_bytes: 63684
N = int(input())
S = input()
key = 0
Count = []
cnt = 0
for i in range(N - 1):
    for j in range(i + 1):
        for k in range(j):
            if j == 0:
                break
            if S[j] == S[k]:
                #print(j, k, end = " ")
                key = 1
                break
            
        if key == 0:
            for k in range(i + 1, N):
               if S[j] == S[k]:
                    cnt += 1
                    #print(S[j], end = " ")
                    break

        key = 0
            
    Count.append(cnt)
    #print()
    cnt = 0

print(max(Count))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    string s;
    cin >> N >> s;

    char pre;
    for (int i = 0; i < N; i++) {
        if (i == 0) pre = s[0]; 
        else if (s[i] == pre) {
            pre = s[i];
            s[i] = '-';
        }
        else if (s[i] != pre) {
            pre = s[i];
        }
    }

    int count = 0;

    for (int i = 0; i < N; i++) {
        if (s[i] != '-') count ++;
    }

    cout << count << endl;
    return 0;    
}

Measured memory_bytes: 512
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main(){
    input!{
        r:usize,
        d: usize,
        x:usize,
    }
    let mut before = x;
    for j in 0..10 {
        before = before * r - d;
        println!("{}",before);
    }
}

Measured memory_bytes: 4352
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
using namespace std;

int main(void){
        int i,j,c;
        int n,k;
        int d[110];
        int a[110][110];
        bool b[110];

        scanf("%d%d",&n,&k);
        for(i=1;i<=k;i++){
                scanf("%d",&d[i]);
                for(j=1;j<=d[i];j++){
                        scanf("%d",&a[i][j]);
                }
        }
        c=0;
        for(i=1;i<=n;i++){
                b[i]=false;
        }
        for(i=1;i<=k;i++){
                for(j=1;j<=d[i];j++){
                       b[a[i][j]]=true;
                }
        }
        for(i=1;i<=n;i++){
                if(b[i]==false){
                        c++;
                }
        }
        printf("%d\n",c);
        return 0;
                

}



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

int main(int argc, char const *argv[])
{
	string s[2]; {
		cin >> s[0];
		cin >> s[1];
	}

	if (s[0][0] == s[1][2] && s[0][1] == s[1][1] && s[0][2] == s[1][0]) printf("YES\n");
	else printf("NO\n");

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;

int32_t main() {

    fast
    int n,x,t;
    cin>>n>>x>>t;

    int times=(n+x-1)/x;
    times=t*times;
    cout<<times<<endl;



    return 0;
}



Measured memory_bytes: 3648
package main

import (
	"bytes"
	"fmt"
	"io"
	"os"
	"strings"
)

func main() {
	if false {
		test()
	} else {
		solve(os.Stdin, os.Stdout)
	}
}

func solve(r io.Reader, w io.Writer) {
	var n int // number of participants
	var m int // number of languages
	fmt.Fscanln(r, &n, &m)
	// planet: paticipant -> lang -> bool
	planet := make(map[int]map[int]bool)
	for i := 0; i < n; i++ {
		planet[i] = make(map[int]bool)
		var langs int
		fmt.Fscan(r, &langs)
		for j := 0; j < langs; j++ {
			var lang int
			fmt.Fscan(r, &lang)
			planet[i][lang-1] = true
		}
	}

	if communicatable(planet, n, m) {
		fmt.Fprintln(w, "YES")
	} else {
		fmt.Fprintln(w, "NO")
	}
}

func communicatable(planet map[int]map[int]bool, n, m int) bool {
	g := make(map[int][]int)
	for p, langs := range planet {
		g[p] = make([]int, 0, len(langs))
		for l := range langs {
			langi := n + l
			g[p] = append(g[p], langi)
			g[langi] = append(g[langi], p)
		}
	}

	seen := make([]bool, n+m)
	traverse(g, 0, seen)
	for i := 0; i < n; i++ {
		if !seen[i] {
			return false
		}
	}
	return true
}

func traverse(g map[int][]int, i int, seen []bool) {
	seen[i] = true
	for _, v := range g[i] {
		if !seen[v] {
			traverse(g, v, seen)
		}
	}
}

func test() {
	tests := []struct {
		in   string
		want string
	}{
		{
			in: `4 6
3 1 2 3
2 4 2
2 4 6
1 6`,
			want: `YES
`,
		},
		{
			in: `4 4
2 1 2
2 1 2
1 3
2 4 3`,
			want: `NO
`,
		},
	}
	for i, tt := range tests {
		fmt.Printf("=== TEST %d\n", i)
		buf := new(bytes.Buffer)
		solve(strings.NewReader(tt.in), buf)
		if got := buf.String(); got != tt.want {
			fmt.Printf("%d: got %v, want %v\n", i, got, tt.want)
		}
	}
}


Measured memory_bytes: 40448
def compress_array(array)
  hash = {}
  array.map { |e|
    if hash[e].nil?
      hash[e] = 1
    else
      hash[e] += 1
    end
  }
  hash
end

_n = gets
ds = gets.split.map(&:to_i)
_m = gets
ts = gets.split.map(&:to_i)
flag = true
hash_ds = compress_array(ds)
hash_ts = compress_array(ts)

hash_ts.each do |key, value|
  if hash_ds[key].nil? || value > hash_ds[key]
    flag = false
    break
  end
end
puts flag ? "YES" : "NO"


Measured memory_bytes: 56576
#include <bits/stdc++.h>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include<math.h>
using namespace std;

int main(void){
    int x1, y1, x2, y2;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
//差分
    int a, b;
    
    a =x2 - x1;
    b = y2 - y1;

    int x3, y3;
    x3 = x2 -b;
    y3 = y2 +a;

    int x4, y4;
    x4 = x1 - b;
    y4 = y1 + a;

    printf("%d %d %d %d", x3, y3, x4, y4);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define ff first 
#define ss second
#define mod 1000000007
#define lim 200005
#define nfs_mw ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

ll BIT[lim] = {};
void upd(int in, ll val)
{
	for(int i=in; i<lim; i += i&(-i))
		BIT[i] = max(BIT[i], val);
}
ll qr(int in)
{
	ll ret = 0;
	for(int i=in-1; i; i ^= i&(-i))
		ret = max(ret, BIT[i]);
	return ret;
}

int main()
{
	nfs_mw;
	int i,j,n,h[lim],a[lim];
	cin>>n; ll ans = 0;
	for(i=1; i<=n; i++) cin>>h[i];
	for(i=1; i<=n; i++) cin>>a[i];
	for(i=1; i<=n; i++) {
		ll here = qr(h[i]) + a[i];
		ans = max(ans, here);
		upd(h[i], here);
	}
	cout<<ans;
}

Measured memory_bytes: 3328
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <set>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
using namespace std;

int main()
{
    int n;
    while(cin>>n){
        int flag=0;
        for(int i=0;i<=25;i++){
            for(int j=0;j<=14;j++){
                if(4*i+7*j==n){
                    flag=1;
                    break;
                }
            }
        }
        if(flag) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using P = pair<int, int>;
int main()
{
  string s;
  cin >> s;
  bool a = false;
  bool b = false;
  rep(i,3){
    if(s.at(i) == 'A') a = true;
    if(s.at(i) == 'B') b = true;
  }
  string ans = "No";
  if(a && b) ans = "Yes";
  cout << ans << endl;
return 0;
}

Measured memory_bytes: 3628
N = gets.to_i

h = []
N.times do |i|
  x_i, u_i = gets.split.map(&:to_s)
  h << {"#{u_i}": x_i.to_f }
end

t = h.flat_map(&:to_a).each_with_object(Hash.new(0)) {|(k, v), h| h[k] += v}
puts t[:JPY] + t[:BTC]*380000

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

int main(){
    map<long long,int> m;
    map<long long,int> ::reverse_iterator i;
    int a=0;
    long long n,x;
    long long *c;
    long long h[2]={};

    scanf("%lld",&n);

    for(int i=0;i<n;i++){
        scanf("%lld",&x);
        m[x]++;
    }

    for(i = m.rbegin(); i!= m.rend(); i++){
        if(i->second >=4 && a==0){
            h[0]=h[1]= i->first;
            break;
        }
        if(i->second >=2){
            i->second -= 2;
            h[a] = i->first;
            a++;
            if(a==2) break;
        }
        //cout << m[x] << " " << x <<" " << h[a] << ":" << a << endl;
    }
    printf("%lld",h[0]*h[1]*1ll);
}


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


int gcd(int a,int b) {
    int c=a%b;
    while (c>0) {
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}


int main() {
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i=0;i<n;i++) cin >> a[i];
    int g=a[0];
    for (int i=1;i<n;i++) g=gcd(g,a[i]);
    sort(a.begin(),a.end());
    if (k%g==0 && k<=a[n-1]) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}
    
    

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <iostream>
#include <string>
using namespace std;

int main(int argc, char *argv[]) {
	while (true) {
		string buf;
		getline(cin, buf);
		// end
		if (buf == "END OF INPUT") break;
		
		buf[buf.size()]=' ';
		for (int i = 0; i < buf.size(); i++) {
			for (int j = 0; j < buf.size(); j++) {
				if (buf[i+j] == ' ') {
					printf("%d", j);
					i+=j;
					break;
				}
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define NIL -1
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using P =pair<int,int>;

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const ll mod=1000000007;

int main(){
    int n;
    cin>>n;
    double t,a;
    cin>>t>>a;
    int ans=0;
    double diff=10000;
    rep(i,n){
        double h;
        cin>>h;
        double temp=abs(a-(t-h*0.006));
        if(diff>temp){
            diff=temp;
            ans=i+1;
        }
    }
    cout<<ans<<endl;
}
        



Measured memory_bytes: 3728
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll A,B,C;
	while(cin>>A>>B>>C) {
		swap(A, B);
		swap(A, C);
		cout<<A<<" "<<B<<" "<<C<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

#define c(n) (n % 10 == 0 ? n : (n / 10) * 10 + 10)

int main()
{
	int T[5], m = 10,  index = 0, ans = 0;

	rep(i, 5) cin >> T[i];
	rep(i, 5) {
		if (T[i] % 10 != 0 && T[i] % 10 < m) {
			m = T[i] % 10;
			index = i;
		}
	}

	rep(i, 5) {
		if (i == index) ans += T[i];
		else ans += c(T[i]);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int n;
  cin >> n;
  int a[n], max = 0;
  int x[100000] = {};
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    x[a[i]]++;
    if (max < a[i]) max = a[i];
  }
  if (max < 3) max = 3;
  ll ans = 0;
  for (int i = 1; i < max; i++) {
    if (ans < x[i - 1] + x[i] + x[i + 1]) ans = x[i - 1] + x[i] + x[i + 1];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	string s;
	cin >> s;
	rep(i,3) if(s[i] == s[i+1]){
		cout << "Bad" << endl;
		return 0;
	}
	cout << "Good" << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

typedef long double ld;
const ld eps = 1e-9, pi = acos(-1.0);
ld solve(){
    ld res = 0;
    ld A,B; cin >> A >> B;
    res = 4.0/3.0*pi*pow(max(A,B),3);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(12) << solve() << endl;
    return 0;
}



Measured memory_bytes: 3480
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x) scanf("%d",&x)
#define sc(x) scanf(" %c",&x)
#define sll(x) scanf("%I64d",&x)
#define f(i,n,k) for(int i=k;i<n;i++)
#define pi(x) printf("%d\n",x);
#define pll(x) printf("%I64d ",x);
int main()
{
    int k,n;
    si(k);
    si(n);
    int arr[n+5];
    f(i,n,0)
    {
        si(arr[i]);
    }
    int maxx;
    maxx=arr[0]+k-arr[n-1];
    f(i,n-1,0)
    {
        maxx=max(maxx,arr[i+1]-arr[i]);
    }
    pi(k-maxx);
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        long A;
        long B;
        long C;

        try (Scanner sc = new Scanner(System.in)) {
            A = sc.nextLong();
            B = sc.nextLong();
            C = sc.nextLong();
        }
        if(C < (A -B )){
            System.out.println(0);
        }else{
            System.out.println(C -(A-B));
        }
        return;
    }
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    int N;
    cin >> N;
	for (long long int i = -2000; i <= 2000; i++) {
		for (long long int j = -2000; j <= 2000; j++) {
			if (i*i*i*i*i - j * j*j*j*j == N) {
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
    return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

class  Point{
    double x;
    double y;

    Point(){}

    Point(double x, double y){
        this.x = x;
        this.y = y;
    }
}

public class Main {

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

        Point p1 = new Point(0, 0);
        Point p2 = new Point(100, 0);

        System.out.println(String.format("%.8f", p1.x) + " " + String.format("%.8f", p1.y));
        koch(n, p1, p2);
        System.out.println(String.format("%.8f", p2.x) + " " + String.format("%.8f", p2.y));
    }

    private static void koch(int n, Point p1, Point p2) {

        if (n == 0){
            return;
        }

        // ?°??§??????¬????????§???
        double th = Math.PI * 60.0 / 180.0;

        Point s = new Point();
        Point t = new Point();
        Point u = new Point();

        s.x = (2*p1.x + p2.x) / 3;
        s.y = (2*p1.y + p2.y) / 3;

        t.x = (p1.x + 2*p2.x) / 3;
        t.y = (p1.y + 2*p2.y) / 3;

        u.x = (t.x - s.x) * Math.cos(th) - (t.y - s.y) * Math.sin(th) + s.x;
        u.y = (t.x - s.x) * Math.sin(th) + (t.y - s.y) * Math.cos(th) + s.y;

        koch(n-1, p1, s);
        System.out.println(String.format("%.8f", s.x) + " " + String.format("%.8f", s.y));
        koch(n-1, s, u);
        System.out.println(String.format("%.8f", u.x) + " " + String.format("%.8f", u.y));
        koch(n-1, u, t);
        System.out.println(String.format("%.8f", t.x) + " " + String.format("%.8f", t.y));
        koch(n-1, t, p2);
    }
}

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

int main() {
int A ;
  cin >>A;
  char O;
  cin >>O;
  int B;
  cin >>B;
  if(O=='+'){
    cout <<A+B;
  }
  else {
    cout <<A-B;
  }
  

}
 

Measured memory_bytes: 256
using System;
using System.IO;
using System.Text;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

namespace SubmitCS
{
    class Program
    {
        // Change standard input(when run on local machine)
        [Conditional("ON_LOCAL_ENV")]
        static void SetStandardInput()
        {
            var input_stream = new StreamReader("StandardInput.txt", Encoding.UTF8);
            Console.SetIn(input_stream);
        }

        // Read all lines from standard input
        static List<string> ReadLines()
        {
            return ReadLines(10000);
        }
        static List<string> ReadLines(int max_lines)
        {
            var lines = new List<string>();

            for(int i = 0 ; i < max_lines ; i++)
            {
                string line = Console.ReadLine();
                if (line == null)
                    break;
                else
                    lines.Add(line);
            }

            return lines;
        }

        static void Main(string[] args)
        {
            SetStandardInput();
            Algorithm();
        }

        static void Algorithm()
        {
            double x = double.Parse(Console.ReadLine());

            double num = 100.0;
            int year = 0;
            while(true)
            {
                num = Math.Truncate(num * 1.01);
                year++;
                if(x <= num)
                    break;
            }

            Console.WriteLine(year);
        }
    }
}


Measured memory_bytes: 27448
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
q = gets.chomp.to_i
m = gets.chomp.split(" ").map(&:to_i)

sum = Array.new
a.each_with_index{ |ai,idx|
	if idx == 0
		sum[0] = ai
	else
		sum.concat(sum.map{|s| s+ai})
		sum.push(ai)
	end
}
sum.uniq!

m.each{ |mi|
	if sum.include?(mi)
		puts "yes"
	else
		puts "no"
	end
}

Measured memory_bytes: 24916
# include <iostream>
# include <algorithm>
# include <string>
using namespace std;
 
int main()
{
  	string s;
  	cin >> s;
  	string s1 = s;
  	reverse(s.begin(),s.end());
  	if(s1 != s)
    {
    	cout << "No" << endl;
      	return 0;
    }
  	int n = s.size();
  	int t = (n-1)/2-1;
   	string it="";
  	for(int i=0;i<=t;i++)
    {
    	it += s[i];
    }  
   	string it1 = it;
  reverse(it.begin(),it.end());
  	if(it1 != it)
    {
      cout << "No" << endl;
    }
  else
  {
    cout<<"Yes"<<endl;
  }
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	vector<int> a(n);
	for( auto &k : a ) cin >> k;
	int ans = inf;
	for( int t = 1; t < n; ++t ){
		int suma = 0, sumb = 0;
		for( int i = 0; i < t; ++i ) suma += a[i];
		for( int i = t; i < n; ++i ) sumb += a[i];
		ans = min(ans, abs(sumb-suma));	
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);

    int i,j;

    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= m; j++)
        {
            if(i * (m - j) + j * (n - i) == k)break;
        }
        if(j != m + 1)break;
    }
    printf(i != n + 1 ? "Yes" : "No" );
}

Measured memory_bytes: 128
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  char c[2][5];
  scanf("%s", c[0]);
  scanf("%s", c[1]);
  bool check = true;
  for (int i=0; i<3; i++) {
    if (c[0][i] != c[1][2-i])
      check = false;
  }
  if (check)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using ll = long long;
using ull = unsigned long long;
ull mod = 1e9 + 7;
using namespace std;


int main(){

    bool flag = false;
    int N; cin >> N;
    for(int i = 1; i <= 9; ++i){
        if(N % i == 0){
            if((N / i) <= 9)flag = true;
        }
    }
    if(flag)cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define REV(i, a) for (int i = (a); i >= 0; --i)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (3e15)

using namespace std;

int N;
string S;

int A[100005];  // 1: S, 2: W

void solve() {
    REP(i, N) {
        char c = S[i];
        int n1 = i > 0 ? i - 1 : N - 1;  // 隣1
        int n2 = i < N - 1 ? i + 1 : 0;  // 隣2

        if (c == 'o') {
            if (A[i] == 1) {
                A[n2] = A[n1];
            } else {
                A[n2] = A[n1] == 1 ? 2 : 1;
            }
        } else {
            if (A[i] == 1) {
                A[n2] = A[n1] == 1 ? 2 : 1;
            } else {
                A[n2] = A[n1];
            }
        }
    }
}

void output() {
    REP(i, N) {
        if (A[i] == 1) {
            cout << "S";
        } else {
            cout << "W";
        }
    }
    cout << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> N;
    cin >> S;
    CLR(A);

    A[0] = 1;
    A[N - 1] = 1;
    solve();
    if (A[0] == 1 && A[N - 1] == 1) {
        output();
        return 0;
    }

    A[0] = 1;
    A[N - 1] = 2;
    solve();
    if (A[0] == 1 && A[N - 1] == 2) {
        output();
        return 0;
    }

    A[0] = 2;
    A[N - 1] = 1;
    solve();
    if (A[0] == 2 && A[N - 1] == 1) {
        output();
        return 0;
    }

    A[0] = 2;
    A[N - 1] = 2;
    solve();
    if (A[0] == 2 && A[N - 1] == 2) {
        output();
        return 0;
    }

    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 1360
#include <bits/stdc++.h>
#include <vector>
#include <string>
using namespace std;
#define FL(i,a,b) for(int i = a;i<b;i++)
typedef vector<int> vi;

const int inf = numeric_limits<int>::max();


int main(){
    int s,w;
    scanf("%d %d",&s,&w);
    if(w>=s){
        printf("%s","unsafe");
    }
    else{
        printf("%s","safe");
    }
}

















Measured memory_bytes: 3808
x,k,d = [int(i) for i in input().split()]
x = abs(x)
ans = x%d

if k*d > x:
    k = k-x//d
    if k%2 == 0:
        ans = x % d
    elif k%2 == 1:
        ans = d - x%d
else:
    ans = x - k*d
print(ans)

Measured memory_bytes: 9212
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define FOR0(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)

int abs(int n)
{
    if (n >= 0)
        return n;
    else
        return -n;
}

int main()
{
    int N;
    cin >> N;
    string s;
    cin >> s;
    int r = 0, b = 0;
    FOR0(i, s.size())
    {
        if (s.at(i) == 'R')
        {
            r++;
        }
        else
        {
            b++;
        }
    }
    if (r > b)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256