akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

const ll INF = (ll)1e18;

int main(){
    int N;
    ll C;
    cin >> N >> C;
    vector<ll> x(N+1), v(N+1), vc(N+1);
    x[0] = 0;
    v[0] = 0;
    REP(i, 1, N+1) cin >> x[i] >> v[i];

    vc[0] = v[0];
    REP(i,1, N+1) {
        vc[i] = vc[i-1] + v[i];
    }

    vector<ll> r(N+1);
    r[0] = 0;
    REP(i, 1, N+1) {
        r[i] = max(r[i-1], vc[i] - x[i]);
    }

    vector<ll> l(N+1);
    l[N] = vc[N] - vc[N-1] - (C - x[N]);

    for(int i = N-1; i >= 1; i--) {
        l[i] = max(l[i+1], vc[N] - vc[i-1] - (C - x[i]));
    }

    ll ans = 0;
    rep(i, N+1) {
        ll tmp = vc[i] - x[i];
        if (tmp > ans) ans = tmp;

        if (i < N) {
            tmp = vc[i] - 2*x[i] + l[i+1];
            if ( tmp > ans ) ans = tmp;
        }
    }

    for (int i = N; i >= 1; i--) {
        ll tmp = vc[N] - vc[i-1] - (C - x[i]);
        if (tmp > ans) ans = tmp;

        tmp = vc[N] - vc[i-1] - 2 * (C - x[i]) + r[i-1];
        if (tmp > ans) ans = tmp;
    }

    cout << ans << endl;
}

Measured memory_bytes: 4224
#include<cstdio>
#include<iostream>
using namespace std;
int main(void)
{
	int n,m;
	scanf("%d %d",&n,&m);
	int temp = max(n+m,n-m);
	temp = max(temp,n*m);
	printf("%d",temp);
	return 0;	
} 

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
typedef long long ll;
using vi = vector<int>;

string str;
string stra;
int id = 0;

void pt(vector<int> v){
  for(int r=0;r<v.size();r++){
    cout << v[r];
  }
  cout << endl;
}

vi number(){
  vi res;
  for (;'0'<=stra[id]&&stra[id]<='9'; id++) {
    res.push_back(stra[id] - '0');
  }
  reverse(res.begin(),res.end());
  return res;
}
int solve(){
  stra = str;
  for (int i = 9; i >= 0; i--) {
    id = 0;
    for (int j = 0; j <(int)str.size(); j++) {
      if (str[j] == 'X') {
        stra[j] = i + '0';
      }
    }
    vi a = number();
    if (stra[id] == '+' ) {
      id++;
    }
    vi b = number();

    a.resize(max(b.size() + 1,a.size()+1),0);

    for (int j = 0; j < (int)b.size(); j++) {
      a[j] += b[j];
      if (a[j]>=10) {
        a[j] -= 10;
        a[j+1]++;
      }
    }
    // for (int j = b.size(); j < (int)(a.size()-1); j++) {
    //   if (a[j] >= 10) {
    //     a[j] -= 10;
    //     a[j+1]++;
    //   }
    // }
    for(int j=0;j<(int)a.size()-1;j++){
      if(a[j]>=10){
        a[j]-=10;
        a[j+1]++;
      }
    }

    if(a[a.size()-1]==0){
      a.pop_back();
    }

    //pt(a);
    // int j;
    // int k=0;
    // int l=0;
    // vi ab;
    // for(j=0;j<int(a.size())&&j<int(b.size());j++){
    //   k=0;
    //   if(a[j]+b[j]+l>=10){
    //     k++;
    //     ab.push_back(a[j]+b[j]+l-10);
    //   }
    //   else{
    //     ab.push_back(a[j]+b[j]+l);
    //   }
    //   l=k;
    // }
    // for(;j<int(a.size());j++){
    //   k=0;
    //   if(a[j]+l>=10){
    //     k++;
    //     ab.push_back(a[j]+l-10);
    //   }
    //   else{
    //     ab.push_back(a[j]+l);
    //   }
    //   l=k;
    // }
    // for(;j<int(b.size());j++){
    //   k=0;
    //   if(b[j]+l>=10){
    //     k++;
    //     ab.push_back(b[j]+l-10);
    //   }
    //   else{
    //     ab.push_back(b[j]+l);
    //   }
    //   l=k;
    // }
    // if(l>0){
    //   ab.push_back(l);
    // }
    // a=ab;
    /////////
    if (stra[id] == '=') {
      id++;
    }

    vi c = number();
    if (a.size() != c.size()) {
      continue;
    }
    int flag = 0;
    for (int j = 0; j < (int)a.size(); j++) {
      if (a[j] == c[j]) {
        flag++;
      }
    }
    if (flag ==(int)a.size()) {
      return i;
    }

  }
  return -1;
}
int main(){
  cin >> str;
  while(str.size()){
  int ans = solve();
  if (ans >= 0) {
    cout << ans << endl;
  } else {
    cout << "NA" << endl;
  }
  str="";
  cin >> str;
}
  return 0;
}



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

int main(void) {
  string S;
  cin>>S;
  if (S[0]==S[1] && S[0]==S[2] && S[0]==S[3]) {
    cout<<"No"<<endl;
  }
  else {
    if (S[0]==S[1] && S[2]==S[3]) cout<<"Yes"<<endl;
    else if (S[0]==S[2] && S[1]==S[3]) cout<<"Yes"<<endl;
    else if (S[0]==S[3] && S[1]==S[2]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	int N, P;
	cin >> N >> P;

	string S;
	cin >> S;

	long long result = 0;
	if (P == 2 || P == 5)
	{
		for (int i = 0; i < N; i++)
		{
			if ((S[i] - '0') % P == 0)
			{
				result += (i + 1);
			}
		}
	}
	else
	{
		vector<int> base(N, 1);
		for (int i = N - 1; i >= 1; i--)
		{
			base[i - 1] = (base[i] * 10) % P;
		}

		vector<int> mod_count(P, 0);
		mod_count[0] = 1;

		int mod = 0;
		for (int i = 0; i < N; i++)
		{
			mod = (mod + (S[i] - '0') * base[i]) % P;
			mod_count[mod]++;
		}

		for (long long val : mod_count)
		{
			result += (val * (val - 1)) / 2;
		}
	}

	cout << result;

	return 0;
}

Measured memory_bytes: 1428
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int ans=0;
int main(void){
	int n,d;
	cin>>d>>n;
	if(n==100)n++;
	if(d==0)cout<<n<<endl;
	else if(d==1)cout<<n*100<<endl;
	else cout<<n*10000<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

public class Main {
    public static void main(String[] args) {
        boolean isTrue = true;
        int count = 0;

        Scanner scan = new Scanner(System.in);

        int N = Integer.parseInt(scan.next());

        int[] A = new int[N];
        for(int i=0; i<N; i++)
        {
            A[i] = Integer.parseInt(scan.next());
        }

        scan.close();
        
        while(true)
        {
            for(int i=0; i<N; i++)
            {
                if(A[i]%2 != 0) isTrue = false;
            }

            if(isTrue)
            {
                count++;
                for(int i=0; i<N; i++) A[i] = A[i]/2;
            }
            else
            {
                System.out.println(count);
                break;
            }
        }
    }
}

Measured memory_bytes: 23124
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define repc(i, s, t) for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios_base::fixed);
    cout.precision(12);

    var(int, a, b);
    print(a * b);

    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n);
#define vsort(v) sort(v.begin(),v.end());
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
bool is_uruu(int y) {
        return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
const ll MOD=1e9+7;
//---------------------------------------------------------------------------//

int main(){
        int n,k=1,l=0;
        int a[100001];
        cin>>n;
        for(int i=0; i<n; i++) {
                cin>>a[i];
        }
        sort(a,n);
        if(n%2==1) {
                if(a[0]!=0) {
                        cout<<0<<endl;
                        return 0;
                }
                for(int i=1; i<=(n-1)/2; i++) {
                        for(int j=0; j<=1; j++) {
                                if(a[k++]!=i*2) {
                                        cout<<0<<endl;
                                        return 0;
                                }
                        }
                }
        }
        if(n%2==0) {
                for(int i=0; i<n/2; i++) {
                        for(int j=0; j<=1; j++) {
                                if(a[l++]!=i*2+1) {
                                        cout<<0<<endl;
                                        return 0;
                                }
                        }
                }
        }
        int ans=1;
        for(int i=0; i<n/2; i++) {
                ans*=2;
                ans%=MOD;
        }
        cout<<ans<<endl;
}


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

int main() { 
    long long n, k, s, ans = 0;
    cin >> n >> k >> s;
    
    if(n-k == 0) {
        for(int i = 0; i < n; ++i) {
            cout << s << ' ';
        }
        cout << '\n';
    } else {
        for(int i = 0; i < n; ++i) {
            if(i < k) cout << s << ' ';
            else {
                if(s == 1000000000) {
                    cout << 1 << ' ';
                } else {
                    cout << 1000000000 << ' ';
                }
            }
        }
    }
    cout << '\n';
}


Measured memory_bytes: 1280
import sys
import numpy as np
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    a=[0]*(N-1)
    b=[0]*(N-1)
    for i in range(N-1):
        a[i],b[i]=map(int,input().split())
    a_i=np.argsort(a)
    l=[]
    d={1:0}
    p_color=0
    currentcolor=0
    currentnum=0
    K=0
    for i in a_i:
        if a[i]!=currentnum:
            p_color=d[a[i]]
            currentnum=a[i]
            currentcolor=0
        currentcolor+=1
        if currentcolor == p_color:
            currentcolor+=1
        l.append(currentcolor)
        K=max(K,currentcolor)
        d[b[i]]=currentcolor
    print(K)
    l2=[0]*(N-1)
    for i,ai in enumerate(a_i):
        l2[ai]=l[i]
    for z in l2:
        print(z)
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 31280
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1234567890
#define pii pair<int,int>
#define LL long long
using namespace std;

int main () {
    //clock_t start = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    int a[n+5];
    for (int i=1;i<=n;i++) cin >> a[i];
    int x = 0;
    for (int i=1;i<=n;i++) x ^= a[i];
    for (int i=1;i<=n;i++) {
        cout << (x^a[i]) << " ";
    }
    //cerr << fixed << setprecision(3) << (clock()-start)*1./CLOCKS_PER_SEC << endl;
    return 0;
}

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

//----Macros----//
#define Boost() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define forn(i,n) for(int i = 0; i < int(n); i++)
int cost = 0;

int calc(vector<int> h)
{
	if(h.size() <= 3)
		return abs(h[0]-h[h.size()-1]);
	vector<int> cost(h.size());
	cost[0] = -1;
	cost[1] = abs(h[1]-h[0]);
	cost[2] = abs(h[2]-h[0]);
	for(int i = 3;i < h.size();i++)
	{
		cost[i] = min(abs(h[i]-h[i-1])+cost[i-1],abs(h[i]-h[i-2])+cost[i-2]);
	}
	return cost[h.size()-1];
}

int main()
{
	Boost()
	int n;
	cin >> n;
	vector<int> h(n);
	forn(i,n)
		cin >> h[i];
	cost = calc(h);
	cout << cost << "\n"; 
	return 0;
}


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

#define ll long long
#define rep(i,n) for(int i = 0;i < (n); i++)
#define mod 1000000007
#define ma 1000005

ll gcd(ll, ll);

int main() {
	ll n;
	ll x;
	ll gc = 0;
	bool pc = true;
	cin >> n;
	vector<ll> a(n);
	vector<ll> c(ma);
	rep(i, n) {
		cin >> a[i];
		c[a[i]]++;
	}
	for (ll i = 2; i < ma; i++) {
		int count = 0;
		for (ll j = i; j < ma; j += i) {
			count += c[j];
		}
		if (count > 1) {
			pc = false;
		}
	}
	if (pc) {
		cout << "pairwise coprime" << endl;
		return 0;
	}
	rep(i, n)gc = gcd(gc, a[i]);
	
	if (gc == 1)cout << "setwise coprime" << endl;
	else cout << "not coprime" << endl;
	return 0;
}


ll gcd(ll a, ll b) {
	if (a % b == 0)return b;
	else return gcd(b, a % b);
}

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

int main(){
	int n,tmp;
	string str;
	while(cin >> n && n){
		int x = 1,y = 2,z = 3,tortal = 1;
		for(int i=0;i<n;i++){
			cin >> str;
			if(str == "North"){
				tmp = y;
				y = 7 - x;
				x = tmp;
				tortal += x;
			}
			else if(str == "South"){
				tmp = x;
				x = 7 - y;
				y = tmp;
				tortal += x;
			}
			else if(str == "West"){
				tmp = z;
				z = 7 - x;
				x = tmp;
				tortal += x;
			}
			else if(str == "East"){
				tmp = x;
				x = 7 - z;
				z = tmp;
				tortal += x;
			}
			else if(str == "Right"){
				tmp = z;
				z = 7 - y;
				y = tmp;
				tortal += x;
			}
			else if(str == "Left"){
				tmp = y;
				y = 7 - z;
				z = tmp;
				tortal += x;
			}
		}
		cout << tortal << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <map>
#include <vector>
#define N 200005
#define PII pair<int, int>
using namespace std;

int n, k, l, c, a[N], b[N];
map<PII, int> m;
vector<int> va[N], vb[N];

void f(int p) {
	int i;
	if (a[p]) return;
	a[p] = c;
	for (i = 0; i < va[p].size(); i++) f(va[p][i]);
}

void g(int p) {
	int i;
	if (b[p]) return;
	b[p] = c;
	for (i = 0; i < vb[p].size(); i++) g(vb[p][i]);
}

int main()
{
	int i, t1, t2;
	cin >> n >> k >> l;
	for (i = 0; i < k; i++) {
		scanf("%d %d", &t1, &t2);
		va[t1].push_back(t2), va[t2].push_back(t1);
	}
	for (i = 0; i < l; i++) {
		scanf("%d %d", &t1, &t2);
		vb[t1].push_back(t2), vb[t2].push_back(t1);
	}
	for (i = 1, c = 0; i <= n; i++) if (!a[i]) c++, f(i);
	for (i = 1, c = 0; i <= n; i++)
		if (!b[i])
			c++, g(i);
	for (i = 1; i <= n; i++) m[PII(a[i], b[i])]++;
	for (i = 1; i <= n; i++) {
		if (a[i] == 0 && b[i] == 0) printf("1 ");
		else printf("%d ", m[PII(a[i], b[i])]);
	}
    return 0;
}

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

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

int n;
int A[100010];

int a[100010];

bool check(int n) {
	if (n % 2 == 0) {
		for (int i = 0; i < n; i++) {
			if (A[i] % 2 == 0) return false;
			a[A[i]]++;
		}
		for (int i = 0; i < n; i++) {
			if (a[i] != 2 && a[i] != 0) return false;
		}
	}
	else {
		for (int i = 0; i < n; i++) {
			if (A[i] % 2 == 1) return false;
			a[A[i]]++;
		}
		if (a[0] != 1) return false;
		for (int i = 1; i < n; i++) {
			if (a[i] != 2 && a[i] != 0) return false;
		}
	}

	return true;
}

int main(void){
	cin>>n;
	for (int i = 0; i < n; i++) cin>>A[i];

	if (check(n)) {
		ll ans = 1;
		for (int i = 0; i < n / 2; i++) {
			ans *= 2;
			ans %= MOD;
		}
		printf("%lld\n", ans);
	} else {
		printf("%d\n", 0);
	}
	
	return 0;
}

/*
方針ー
・nが偶数の時、それぞれ報告される値A[i]は奇数でなければならない。かつその奇数は2コずつ現れなければ
ならない。それ以外は達成することができない。
・nが奇数の時、それぞれ報告される値A[i]は偶数でなければならない。かつその偶数は0が1つだけ含まれる。
(真ん中を軸に左右対称に分かれるから)それ以外は達成することができない。

上のチェックを通過するとき、求める総数はnが偶数、奇数ともに 2^n/2 である。
 */

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define fr first
#define sc second
#define ii pair<ll,ll>
#define mp make_pair
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++)
    {
        int x = s[i]-'A';
        x+=n;
        x%=26;
        s[i] = char('A'+x);
    }
    cout<<s;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

	Scanner sc = new Scanner(System.in);

	void run() {

		int n = sc.nextInt();
		int a[][] = new int[n][n];

		long sum = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				a[i][j] = sc.nextInt();
				sum += a[i][j];
			}
		}

		sum /= 2;

		for (int i = 0; i < n; i++) {
			for (int j = i+1; j < n; j++) {
				boolean flag = false;
				for (int k = 0; k < n; k++) {
					if(k == i || k == j){
						continue;
					}
					
					if(a[i][j] > a[i][k] + a[k][j]){
						System.out.println("-1");
						return;
					}
					if(a[i][j] == a[i][k] + a[k][j]){
						flag  =true;
					}
				}
				if(flag){
					sum -= a[i][j];
				}
			}
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 50860
#pragma GCC optimize("O2")
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<unordered_map>
#include<set>
#include<cmath>
#include<climits>
#include<random>
#include <iomanip>
#include <bitset>
#include <iomanip>
using namespace std;
 
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
 
/////////////////////////////////////////////
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
///////////////////////////////
#define int long long

const int mod = 1e9 + 7;

void solve(){
	
	int s;
	cin>>s;
	
	int dp[s + 1];
	memset(dp , 0 , sizeof dp);
	
	dp[0] = 1;
	for(int i = 3 ; i <= s ; ++i){
		
		for(int j = i ; j >= 3 ; --j){
		
			if(i - j >= 0){
				
				dp[i] += dp[i - j];
				dp[i]%=mod;
			}
		}
	}
	// for(int i = 1 ; i <= s ; ++i)
	// 	cout<<dp[i]<<" ";
	// cout<<endl;
	cout<<dp[s]<<endl;
}

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

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <random>

int main(void){
    int n; std::cin >> n;
    std::vector<int> A(n); for(auto& itr : A) std::cin >> itr;
    int res = 0;
    for(int i = 0; i < n; i += 2) if(A[i] % 2 != 0) ++res;
    std::cout << res << '\n';
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;
constexpr int INF = 1000000000;

int64_t calc(const vector<ll> &a, int b) {
  int64_t sum = 0;
  REP(i,a.size()) {
    sum += abs(a[i] - (b + i + 1));
  }
  return sum;
}

int main()
{
  int64_t n;
  cin>>n;
  vector<int64_t> v;
  vector<int64_t> a(n);
  REP(i,n) {
    cin>>a[i];
    v.push_back(a[i] - i - 1);
  }
  sort(ALL(v));
  cout << calc(a, v[n/2]) << endl;
  return 0;
}


Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define Mod 1000000007
#define Val(x) (((long long)x) % Mod)
#define maxn 200005
using namespace std;
int fac[maxn];
int Pow(int a,int n) {
	int ret = 1 , base = a;
	while(n) {
		if(n&1)	ret = Val(ret * base);
		base = Val(base * base);
		n >>= 1;
	}
	return ret;
}
int inv(int val) {
	return Pow(val,Mod-2);
}
int C(int n,int m) {
	return Val(Val(fac[n]*inv(fac[m]))*inv(fac[n-m]));
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	fac[0] = 1;
	for(int i=1;i<maxn;i++)
		fac[i] = Val(fac[i-1] * i);
	int n,k;
	cin >> n >> k;
	k = min(k,n);
	int ans = 0;
	for(int i=0;i<=k;i++)
		ans = Val(C(n,i) * C(i+(n-i-1),n-i-1) + ans);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
int main()
{
    long long i,j,X,m;
    scanf("%lld",&X);
    for(i=68;;i--){
        for(j=i-1;;j--){
            m=i*i*i*i*i-j*j*j*j*j;
            if(m==X){
               printf("%lld %lld\n",i,j);
               return 0;
            }
            else if(m>X)
                break;
        }
    }
    return 0;
}


Measured memory_bytes: 1732
s = input()
N = len(s)
k = "keyence"
K = len(k)
flag = False
if s[N - K:] == k:
    print("YES")
    exit()
if s[:K] == k:
    print("YES")
    exit()

for i in range(1, K):
    if s[:i] == k[:i] and s[N - (K - i):] == k[K - (K - i):]:
        print("YES")
        exit()

print("NO")

Measured memory_bytes: 3064
a, b, c = map(int, input().split())
def formula(x, y, z):
    return abs(x-y)+abs(y-z)

kumi = [ [a,b,c], [b,a,c], [c, a, b], [a,c,b], [b,c,a], [c,b,a]]
print(min([formula(i, j, k) for i,j,k in kumi]))

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

#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))


#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
    cerr << name << " is " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " is " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define debug(...)
#endif


void solve()
{
    int n;
    cin>>n;

    vector<int> items;

    for(int i=0; i<n; i++)
    {
        int item;
        cin>>item;
        items.push_back(item);
    }

    sort(items.begin(),items.end());

    long long res=0;

    for(int i=1; i<=items.back(); i++)
    {

        int lowerbnd=lower_bound(items.begin(),items.end(),i)-items.begin();

        //debug(i,lowerbnd);

        if(lowerbnd==n-lowerbnd)
            res++;
    }

    cout<<res<<endl;


}

int main()
{
    ios_base::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    cout.tie(nullptr);
    cin.tie(nullptr);

    int t = 1;

    while (t--)
    {

        solve();
    }

    return 0;
}


Measured memory_bytes: 892
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	int a[200001];
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}

	vector<int> now(n + 1, 0);
	vector<int> ans;
	for(int i = n; i>= 1; i--){
		int sum = 0;
		for(int j = 2 * i; j <= n; j += i){
			sum += now[j];
		}
		if(sum % 2 != a[i]){
			now[i] = 1;
			ans.push_back(i);
		}
	}
	cout << ans.size() << endl;
	for(int i = 0; i < ans.size(); i++){
		cout << ans[i];
		if(i == ans.size() - 1) cout << endl;
		else cout << " ";
	}
}

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

#define int long long 

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n, s;
    cin >> n >> s;
    auto check = [&] (int b) {
        ll cur = 0;
        ll x = n;
        while (x) {
            cur += x % b;
            x /= b;
        }
        return cur;
    };
    ll val = 1;
    for (ll b = 2; b * b <= n; b++) { 
        if (check(b) == s) {
            cout << b << '\n';
            return 0;
        }
        val = b;
    }
    ll f = n - s;
    if (f < 0) {
        cout << -1 << '\n';
        return 0;
    }
    ll ans = 1e18;
    if (f == 0) {
        cout << n + 1 << '\n';
        return 0;
    }
    auto relax = [&] (ll x) {
        if (x < val) {
            return;
        }
        ll p = f / x;
        ll b = x + 1;
        ll q = s - p;
        if (p >= b || q >= b || p < 0 || q < 0) {
            return;
        }
        if (p * b + q != n) {
            return;
        }
        ans = min(ans, b);
    };
    for (ll i = 1; i * i <= f; i++) {
        if (f % i == 0) {
            relax(i);
            relax(f / i);
        }
    }
    if (ans == 1e18) {
        cout << -1 << '\n';
        return 0;
    }
    cout << ans << '\n';
    return 0;
} 

Measured memory_bytes: 256
using System;

namespace CA {
	class Program {
		static void Main(string[] args) {
			string[] str;
			while (true) {
				str = Console.ReadLine().Split(' ');
				if (str[0] + str[1] == "00") break;
				for(int i = 0; i < int.Parse(str[0]); i++) {
					for(int j = 0; j < int.Parse(str[1]); j++) {
						Console.Write("#");
					}
					Console.WriteLine();
				}
				Console.WriteLine();
			}
		}
	}
}

Measured memory_bytes: 8868
#include<bits/stdc++.h>
#define N 210000
#define pb push_back
using namespace std;
struct node{int y,nex;}a[2*N];
int e[N][2],len,fir[N],n,sa,sb,dep[N],dfn[N],las[N],id,f[N],p[N],tail,d[N],ans;
bool b[N],v[N];
vector<int> A[N];
void ins(int x,int y) { a[++len].y=y;a[len].nex=fir[x];fir[x]=len; }
void dfs(int x,int fa) { f[x]=fa; dfn[x]=++id; dep[x]=dep[fa]+1; for(int k=fir[x];k;k=a[k].nex) { int y=a[k].y; if(y==fa) continue; dfs(y,x); } las[x]=id; }
bool check(int x,int y) { if(dep[x]>dep[y]) swap(x,y); if(dfn[x]<=dfn[y] && las[x]>=dfn[y]) { if(dep[y]-dep[x]>2) return 1; return 0; } if(f[x]==f[y]) return 0; return 1; }
void bfs() {
    v[sa]=1;p[1]=sa;tail=1;
    for(int i=1;i<=tail;i++) { int x=p[i],siz=A[x].size(); for(int k=0;k<siz;k++) { int y=A[x][k]; d[y]=d[x]+1; if(d[y]<dep[y] && v[y]==0) {v[y]=1;p[++tail]=y;} } }
}
int main() {
    scanf("%d%d%d",&n,&sa,&sb); for(int i=1;i<n;i++) scanf("%d%d",&e[i][0],&e[i][1]); for(int i=1;i<n;i++) { int x,y;scanf("%d%d",&x,&y); ins(x,y);ins(y,x); }
    dfs(sb,0); for(int i=1;i<=n;i++) dep[i]--;
    for(int i=1;i<n;i++) { int x=e[i][0],y=e[i][1]; if(check(x,y)) b[x]=b[y]=1; else A[e[i][0]].pb(e[i][1]),A[e[i][1]].pb(e[i][0]); }
    bfs(); for(int i=1;i<=n;i++) { if(v[i] && b[i]) {printf("-1\n");return 0;} if(v[i]) ans=max(ans,dep[i]*2); }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 30336
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int parent[100030];
int find_set(int a)
{
    if(a==parent[a])
        return a;
    else return parent[a]=find_set(parent[a]);
}
void union_f(int a, int b)
{
    a=find_set(a);
    b=find_set(b);
    if(a!=b)
    {
        if(rand()%2)
            swap(a,b);
        parent[b]=a;
    }
}

void make_set(int a)
{
    parent[a]=a;
}
int main()
{
    int n, m;;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        make_set(i);
    for(int i=0;i<m;i++)
    {
        int a, b, c;
        cin>>a>>b>>c;
        union_f(a,b);
    }
    ll count=0;
    bool visited[n+1];
    memset(visited,0,sizeof(visited));
    for(int i=1;i<=n;i++)
    {
        int j=find_set(i);
        if(!visited[j])
        {
            count++;
            visited[j]=true;
        }
    }
    cout<<count<<endl;
}


Measured memory_bytes: 1024
#include<cstdio>
int N,A[200005];
int main(){
	long long Ans=0;
	scanf("%d",&N);
	for(int i=1;i<=N;++i) scanf("%d",A+i);
	int j=0,now=0;
	for(int i=1;i<=N;++i){
		while(j<N&&(A[j+1]&now)==0) ++j, now^=A[j];
		Ans+=(j-i+1);
		now^=A[i];
	}
	printf("%lld\n",Ans);
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int a,b,c,d; cin>>a>>b>>c>>d;
    cout << max(a*b,c*d) << endl;
    return 0;
}

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

int main () {
    int A, B;
    cin >> A >> B;
    
    if (((A % 3 == 1) && (B % 3 == 1)) || ((A % 3 == 2) && (B % 3 == 2))) {
        cout << "Impossible" << endl;
    }
    else cout << "Possible" << endl;

    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

//4
int gcd(int a,int b){return b?gcd(b,a%b):a;}

long long int n,m;

int p[100000],y[100000];
vector<int> yd[100001];

int main(){

ios::sync_with_stdio(false);
cin.tie(0);

cin>>n>>m;

for(int i=0;i<m;i++){
cin>>p[i]>>y[i];
yd[p[i]].push_back(y[i]);
}

for(int i=0;i<n;i++){
sort(yd[i+1].begin(),yd[i+1].end());
}

for(int i=0;i<m;i++){
printf("%012lld\n",(long long int)(p[i])*1000000+
int(lower_bound(yd[p[i]].begin(),yd[p[i]].end(),y[i])-yd[p[i]].begin())+1);
}

}



//cout << fixed << setprecision(5) <<(n*2)*M_PI << endl;



Measured memory_bytes: 7808
# 外接円の中心と半径の自乗
def circumcenter(a,b,c)
  x = (a-b)*c.abs2 + (b-c)*a.abs2 + (c-a)*b.abs2
  y = (a-b)*c.conj + (b-c)*a.conj + (c-a)*b.conj
  z = x / y
  r = (a-z).abs2
  [z,r]
end

# 二点の中心と中心からの距離の自乗
def bisector(a,b)
  z = (a+b) / 2
  r = ((a-b)/2).abs2
  [z,r]
end

# main
n = gets.to_i
a = Array.new(n){ gets.split.map &:to_f }.map{|b| Complex(*b)}
ans = [Float::INFINITY]
EPS = 1e-6
chmin = -> z,r { ans[0] = [ans[0], r].min if a.all?{|v| (v-z).abs2 <= r + EPS}}

# 2点を含む最小円を全探索
a.combination(2) do |s,t|
  z,r = bisector(s,t)
  chmin[z,r]
end

# 3点の外接円を全探索
a.combination(3) do |s,t,u|
  z,r = circumcenter(s,t,u)
  chmin[z,r]
end

puts Math.sqrt(ans[0])




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

int main() {
  int N, i;
  string op;
    cin >> N ;
  
  for(i = 0 ; i < N ;i++){
    cin >> op;
    if(op == "Y"){
        cout << "Four" << endl;
      break;
    } 
    else if (i == N-1) {
    cout << "Three" << endl;
    }
  }
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
//#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")
#define io_init cin.tie(0);ios::sync_with_stdio(0);cout<<setprecision(20)
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


int main() {
	int N;
	cin >> N;
	vector<int> A(N), B(N), C(N);
	for (int i = 0; i < N; i++)cin >> A[i];
	for (int i = 0; i < N; i++)cin >> B[i];
	for (int i = 0; i < N; i++)cin >> C[i];
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		auto i1 = (lower_bound(A.begin(), A.end(), B[i]) - A.begin());
		auto i2 = N - (upper_bound(C.begin(), C.end(), B[i]) - C.begin());
		ans += i1 * i2;
	}
	cout << ans << endl;
}


Measured memory_bytes: 4560
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!{
      n: usize,
    }
    if n%2 == 0 {
        puts!("{}\n", 1.0/2.0);
    } else {
        let b = (n/2+1) as f64;
        puts!("{}\n", b/(n as f64));
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(int argc, char const *argv[])
{
	int m,d;
	scanf("%d %d",&m,&d);
	int count=0;
	for(int i=4;i<=m;i++){
		for(int j=22;j<=d;j++){
			if((j/10>=2)&&(j%10>=2)&&(j/10)*(j%10)==i){
				//printf("%d-%d\n",i,j);
				count++;
			} 
		}
	}
	printf("%d",count );
	
	return 0;

	
}

Measured memory_bytes: 128
#include <stdio.h>
int main(){
	int a[10],i,j,tmp;
	for(i=0;i<10;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<9;i++){
		for(j=i+1;j<10;j++){
			if(a[i]<a[j]){
				tmp=a[i];
				a[i]=a[j];
				a[j]=tmp;
			}
		}
	}
	for(i=0;i<3;i++)
		printf("%d\n",a[i]);
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

#define INF 2e9

#define REP(i,n) for(int i = 0; i < n;++i)
#define REPA(i,a,n) for(int i = a; i < n; ++i)
#define ALL(a) a.begin, a.end()

using namespace std;

int main(void) {

	int N;

	cin >> N;

	vector<int> p(N + 1);

	int pi = 0, pj = 0;

	REP(i, N) {
		cin >> p[i];

		if (p[i] != i + 1) {
			if (pi == 0) {
				pi = i + 1;
			}
			else if (pj == 0) {
				pj = i + 1;
			}
			else {
				cout << "NO\n";
				return 0;
			}
		}
	}

	if (pi == 0) {
		cout << "YES\n";
	}
	else if (pj == 0) {
		cout << "NO\n";
	}
	else if (pi == p[pj-1] && p[pi-1] == pj) {
		cout << "YES\n";
	}
	else {
		cout << "NO\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>

using namespace std;
#define ALL(a) (a).begin(), (a).end()
#define REP(i, n) for (size_t i = 0; i < (n); i++)
#define nvec(T, v, n) vector<T> v(n); REP(i, n) {cin>>(v)[i];}
#define npairs(T1, T2, v, n) vector<pair<T1, T2>> v(n); REP(i, n){cin>>v[i].first>>v[i].second;}
#define ntuples(T1, T2, T3, v, n) vector<tuple<T1, T2, T3>> v(n); REP(i, n){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);}
#define vec2d(T, v, m, n) vector<vector<T>> (v)(m, vector<T>(n))
#define nvec2d(T, v, m, n) vec2d(T, v, m, n); REP(j, m){REP(i, n) {cin>>(v[j])[i];}}

#define min_index(v) size_t( min_element(all(v)) - (v).begin() )
#define max_index(v) size_t( max_element(all(v)) - (v).begin() )
#define min_e(v) *min_element(ALL(v))
#define max_e(v) *max_element(ALL(v))

#define count_le(v, a) size_t( upper_bound(ALL(v), a) - (v).begin() )
#define count_lt(v, a) size_t( lower_bound(ALL(v), a) - (v).begin() )
#define count_ge(v, a) size_t( (v).end() - lower_bound(ALL(v), a) )
#define count_gt(v, a) size_t( (v).end() - upper_bound(ALL(v), a) )

#define order(neq_sl) [](const auto s, const auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) accumulate(ALL(v), 0l)
#define SORT(v) sort(ALL(v))

#define GCD(v) gcd(ALL(v), 0l)

/*template <typename T>
T gcd(T a, T b) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    return gcd(b%a, a);
}
template <typename InputItr, typename T>
T gcd(InputItr first, InputItr last, T init) {
    for (; first != last; ++first) init = gcd(init, *first);
    return init;
}*/

template <typename T>
using vec =vector<T>;

template <typename T>
using vvec =vector<vector<T>>;

int main(){
  string s,t;
  cin>>s>>t;
  int count=0;
  for (size_t i = 0; i < s.length(); i++) {
    if(s[i]!=t[i])count++;
  }
  cout<<count;
}


/* きょむ〜 */


Measured memory_bytes: 3920
#include <bits/stdc++.h>
using namespace std;
const int maxn = 50, inf = 1e9;
bool a[maxn + 10][maxn + 10], b[maxn + 10][maxn + 10];
int t, n, ans, fa[maxn + 10];
vector<int> g[maxn + 10];
int deg[maxn + 10];
bool vis[maxn + 10];

int dfssz(int p, int fa) {
	int ans = 1;
	for (int i = 1; i <= n; ++i)
		if (a[p][i] && i != fa)
			ans += dfssz(i, p);
	return ans;
}

int dfsc(int p, int fa) {
	int ans = 1; vis[p] = 1;
	for (int i = 1; i <= n; ++i)
		if (a[p][i] && b[p][i] && i != fa)
			ans += dfsc(i, p);
	return ans;
}

void dfsA(int p) {
	for (int i = 1; i <= n; ++i)
		if (a[p][i] && i != fa[p]) {
			fa[i] = p; dfsA(i);
		}
}

void dfsB(int p) {
	for (int i = 1; i <= n; ++i)
		if (b[p][i] && i != fa[p]) {
			fa[i] = p; dfsB(i);
		}
}

void init() {
	for (int i = 1; i <= n; ++i) {
		g[i].clear(); deg[i] = 0;
	}
}

void adde(int l, int r) {
	g[l].push_back(r); ++deg[r];
}

bool topo() {
	static queue<int> q;
	int cnt = 0;
	for (int i = 1; i <= n; ++i)
		if (!deg[i]) q.push(i);
	while (!q.empty()) {
		int p = q.front(); q.pop();
		++cnt;
		for (int i = 0; i < (int)g[p].size(); ++i) {
			int e = g[p][i];
			if (!--deg[e]) q.push(e);
		}
	}
	return cnt == n;
}

void chk(int x) {
	if (dfssz(x, 0) < n) return;
	memset(vis, 0, sizeof vis);
	int res = dfsc(x, 0);
	init();
	fa[x] = 0; dfsA(x);
	for (int i = 1; i <= n; ++i)
		if (!vis[i] && !vis[fa[i]]) adde(i, fa[i]);
	fa[x] = 0; dfsB(x);
	for (int i = 1; i <= n; ++i)
		if (!vis[i] && !vis[fa[i]]) adde(fa[i], i);
	if (topo()) ans = min(ans, n - res);
}

int main() {
	scanf("%d", &t);
	while (t--) {
		ans = inf;
		memset(a, 0, sizeof a);
		memset(b, 0, sizeof b);
		scanf("%d", &n);
		for (int i = 1; i < n; ++i) {
			int l, r; scanf("%d%d", &l, &r);
			a[l][r] = a[r][l] = 1;
		}
		for (int i = 1; i < n; ++i) {
			int l, r; scanf("%d%d", &l, &r);
			b[l][r] = b[r][l] = 1;
		}
		for (int i = 1; i <= n; ++i) {
			int to = 0;
			for (int j = 1; j <= n; ++j)
				if (a[i][j]) {
					if (!to) to = j;
					else to = -1;
				}
			if (to == -1) continue;
			a[i][to] = a[to][i] = 0;
			for (int j = 1; j <= n; ++j)
				if (j != i && j != to) {
					a[i][j] = a[j][i] = 1;
					chk(i);
					a[i][j] = a[j][i] = 0;
				}
			a[i][to] = a[to][i] = 1;
		}
		++ans;
		for (int i = 1; i <= n; ++i) chk(i);
		printf("%d\n", ans < inf ? ans : -1);
	}
}


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

int main() {
  string a,b;cin>>a>>b;
  int cnt=0;
  int n=a.size();
  rep(i,n){
    if(a[i]!=b[i])cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 3916
#include <iostream>
#define ll long long
using namespace std;
int arr[100005];
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n, m, maxi=0, maxs=0;
    cin  >> n;
    for(int i=1; i<=n; i++){
        cin >> m;
        arr[m]++;
        arr[m-1]++;
        arr[m+1]++;
        if(maxi<m){
            maxi=m;
        }
    }
    for(int i=1; i<=maxi+1; i++){
        if(maxs<arr[i]){
            maxs=arr[i];
        }
    }
    cout << maxs << endl;
    return 0;
}

Measured memory_bytes: 3796
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    int x; cin >> x;
    cout << ((x==3 || x==5 || x==7) ? "YES" : "NO") << endl; 
}


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

int main() {
	for (int n, m; cin >> n >> m&&n;) {
		vector<int> a(n);
		int ans = 0;
		for (int i = 0; i < n; i++)cin >> a[i];
		for (int i = 0; i < n; i++)for (int j = 0; j < n; j++) {
			if (i == j)continue;
			if (a[i] + a[j] > m)continue;
			ans = max(ans, a[i] + a[j]);
		}
		if (ans == 0)cout << "NONE" << endl;
		else cout << ans << endl;
	}
}

Measured memory_bytes: 3092
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

int main() {
	cout << fixed << setprecision(6);
	for (int x, h; cin >> x >> h&&x;) {
		cout << x*x + sqrt(h*h + x/2.*x/2.)*x / 2. * 4 << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <cassert>

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

uint64_t ret  = 0;
uint64_t OA   = 0;
uint64_t BO   = 0;
uint64_t BOA  = 0;

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

    string s;
    bool back_a  = false;
    bool front_b = false;
    rep(i, N) {
        cin >> s;
        back_a  = s.back()  == 'A';
        front_b = s.front() == 'B';
        if(back_a && front_b) {
            BOA++;
        }
        else if (back_a) {
            OA++;
        } else if (front_b) {
            BO++;
        }
        rep(j, s.size()-1) {
            if(s[j] == 'A' && s[j+1] == 'B') {
                ret++;
            }
        }
    }

#if 0
    cout << "OA " << OA << endl;
    cout << "BO " << BO << endl;
    cout << "BOA " << BOA << endl;
    cout << "ret " << ret << endl;
#endif

    if(OA == 0 && BO == 0) {
        if(BOA > 0)
            ret += (BOA-1);
        cout << ret << endl;
        return 0;
    }

    uint64_t tmp = 0;
    if(OA > BO) {
        tmp = OA - BO;
        ret += BO;
    } else {
        tmp = BO - OA;
        ret += OA;
    }

    ret += BOA;

    cout << ret << endl;
    return 0;
}



Measured memory_bytes: 3164
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std ;
typedef long long ll ;
# define rep (i , n ) for ( int i =0; i < n ; i++)

int ret_cookie(int c)
{
	if (c % 2)
	{
		return c - 1;
	}
	
	return c;
}
int main()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);

	ll A, B;
	int K;

	cin >> A >> B >> K;

	int times = 1;
	while(times <= K)
	{
		if (times % 2)
		{
			A = ret_cookie(A);
			A /= 2;
			B += A; 
		}
		else
		{
			B = ret_cookie(B);
			B = B / 2;
			A += B;
		}
		times++;
	}

	cout << A << " " << B << endl;

	return 0;
}

Measured memory_bytes: 256
from itertools import groupby

def fact(n):
    table = []
    i = 2
    
    while(i*i <= n):
        while(n%i == 0):
            n //=i
            table.append(i)
        i += 1
    if(n > 1):
        table.append(n)
    return table

def main():
    N = int(input())
    P = fact(N)
    ans = 0
    for v, g in groupby(P):
        n = len(list(g))
        for i in range(1, 100000):
            n -= i
            if(n >= 0):
                ans += 1
            else:
                break
    print(ans)
    
main()

Measured memory_bytes: 9204
#include<bits/stdc++.h>
#define ll long long int 
#define ull unsigned long long int
#define loop(i,a,b) for(ll i=a;i<b;++i)
#define loope(i,a,b) for(ll i=a;i<=b;++i)
#define loopr(i,a,b) for(ll i=a;i>=b;--i)
#define loops(i,a,b,step) for(ll i=a;i<b;i+=step)
#define all(a) a.begin(),a.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define V vector
using namespace std;
typedef string str;
ll vis[55][55]={0};
ll inp[55][55];
set<pair<ll,ll>> points,point;

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;     
  
    x = x % p;   
    while (y) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;  
        x = (x*x) % p; 
    } 
    return res; 
} 
 
ll nCrModP(ll n, ll r, ll p) 
{ 
    if (!r) 
      return 1; 
  
	ll fac[n+1]; 
   	fac[0] = 1; 
    for (ll i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%p; 
  
    return (fac[n]* power(fac[r], p-2,p) % p * power(fac[n-r], p-2,p) % p) % p; 
}
void dfs(ll x,ll y,ll k,ll n)
{
    if (x<0 || y<0 || x>n-1 || y>n-1 || inp[x][y]==1 || vis[x][y]==k)
    {
        return ;
    }
    else
    {
        vis[x][y]=k;
        if (k==1)
        {
            points.insert(make_pair(x,y));
        }
        else
        {
            point.insert(make_pair(x,y));            
        }
        dfs(x-1,y,k,n);
        dfs(x,y-1,k,n);
        dfs(x+1,y,k,n);
        dfs(x,y+1,k,n);
    }
    
}
int main ()
{
	FAST;
	//test cases
	ll a,b,c;
    cin>>a>>b>>c;
    if (b*c>=a)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    
}

Measured memory_bytes: 3648