akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n;
    string s;
    cin >> n >> s;

    vector<ll> v(n);
    REP(i, n) v[i] = s[i]-'0'-1;

    auto check = [&] {
        ll sum = 0;
        REP(i, n) if(v[i]==1) {
            ll a = n-1, b = i, prod = 1;
            while(a > 0 || b > 0) {
                if(a%2 < b%2) prod = 0;
                a /= 2;
                b /= 2;
            }
            sum ^= prod;
        }
        return sum;
    };

    if(check()) {
        cout << 1 << endl;
    } else {
        REP(i, n) if(v[i] == 1) {
            cout << 0 << endl;
            return 0;
        }
        REP(i, n) v[i] /= 2;
        if(check()) cout << 2 << endl;
        else cout << 0 << endl;
    }

    return 0;
}

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

int main(){
    int x,y;
    cin >> x >> y;
    if(x<y) swap(x,y);
    
    int r=x%y;
    while(r!=0){
        x=y;
        y=r;
        r=x%y;
    }
    cout << y << endl;
    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A.at(i);
    sort(A.begin(), A.end());
    
    vector<int> B;
    int now = 0;
    int cnt = 0;
    for(int i = 0; i < N; i++) {
        if(A.at(i)!=now) {
            B.push_back(cnt);
            now = A.at(i);
            cnt = 1;
        }
        else cnt++;
    }
    B.push_back(cnt);
    sort(B.begin(), B.end());
    
    int ans = 0;
    int s = B.size();
    for(int i = 0; i < max(0, s - K); i++) ans += B.at(i);
    cout << ans << endl;
    
}

Measured memory_bytes: 2168
N=int(input())
t1,x1,y1=[0,0,0]
for i in range(N):
  t2,x2,y2=[int(s) for s in input().split()]
  if t2-t1<abs(x2-x1)+abs(y2-y1) or (t2-t1)%2!=(x2+y2-x1-y1)%2:
    print("No")
    break
  else:
    t1,x1,y1==[t2,x2,y2]
else:
  print("Yes")

Measured memory_bytes: 3064
import math
A,B=map(int,input().split())
a1=math.ceil(A/0.08)
a2=math.ceil((A+1)/0.08)-1
b1=math.ceil(B/0.1)
b2=math.ceil((B+1)/0.1)-1

if b2<a1 or a2<b1:
  print(-1)
else:
  print(max(b1,a1))

Measured memory_bytes: 3064
#include <cstdio>
int N, K, l, r, a[1000009], v[1000009], p[1000009];
int main() {
	scanf("%d %d\n", &N, &K);
	for (int i = 0; i < N; i++) {
		char ch = getchar();
		while (48 <= ch && ch <= 57) a[i] = a[i] * 10 + ch - 48, ch = getchar();
	}
	for (int i = 0; i < K; i++) {
		while (l != r && v[r - 1] >= a[i]) r--;
		v[r] = a[i], p[r++] = i;
	}
	for (int i = K; i <= N; i++) {
		printf(i == N ? "%d\n" : "%d ", v[l]);
		if (p[l] == i - K) l++;
		while (l != r && v[r - 1] >= a[i]) r--;
		v[r] = a[i], p[r++] = i;
	}
	return 0;
}


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

#define LL long long
#define RG register

using namespace std;
template<class T> inline void read(T &x) {
	x = 0; RG char c = getchar(); bool f = 0;
	while (c != '-' && (c < '0' || c > '9')) c = getchar(); if (c == '-') c = getchar(), f = 1;
	while (c >= '0' && c <= '9') x = x*10+c-48, c = getchar();
	x = f ? -x : x;
	return ;
}
template<class T> inline void write(T x) {
	if (!x) {putchar(48);return ;}
	if (x < 0) x = -x, putchar('-');
	int len = -1, z[20]; while (x > 0) z[++len] = x%10, x /= 10;
	for (RG int i = len; i >= 0; i--) putchar(z[i]+48);return ;
}

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	int n;
	read(n);
	int ans = 0;
	char lst = '#', c;
	for (int i = 1; i <= n; i++) {
		c = getchar();
		if (c != lst) ans++;
		lst = c;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    int h,m,s;
    h=N/3600;
    m=N-h*3600;
    m=m/60;
    s=N-h*3600;
    s=s-m*60;
    cout<<h<<":"<<m<<":"<<s<<endl;
    return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e5 + 5;
const int inf = 1000000000;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338; // double PI = 4*atan(1);

	 

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	//ifstream cin (".in");
	//ofstream cout (".out");
	int ans[33] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int n;
	cin >> n;
	cout << ans[n-1] << "\n";
	return 0;
 }




Measured memory_bytes: 3540
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////

struct dijksra {

	ll N;
	vector<vector<edge>> g;
	ll s;

	vector<ll> ans;

	dijksra(ll N0, ll s, vector<vector<edge>> g0) {//頂点数、始点、グラフ(頂点は1indexか0index)
		N = N0;
		g = g0;

		ans.assign(N + 1, INF);


		priority_queue<pair<ll, ll>> q;//(-キョリ、頂点)

		ans[s] = 0;
		q.push({ 0,s });

		while (!q.empty()) {
			auto x = q.top();
			q.pop();

			ll dis = -x.first;
			ll v = x.second;

			if (dis > ans[v]) { continue; }


			for (edge e : g[v]) {
				ll w = e.to;
				if (dis + e.d < ans[w]) {
					ans[w] = dis + e.d;
					q.push({ -ans[w], w });
				}
			}


		}
	}

	ll d(ll t) {//sからtまでの最短距離を出力
		return ans[t];
	}


};



int main() {
	
	ll n, m, s, t;
	cin >> n >> m >> s >> t;

	vector<vector<edge>> gyen(n + 1);
	vector<vector<edge>> gsnu(n + 1);

	repn(i, m) {
		ll u, v, a, b;
		cin >> u >> v >> a >> b;
		gyen[u].push_back({ i,u,v,a });
		gyen[v].push_back({ i,v,u,a });

		gsnu[u].push_back({ i,u,v,b });
		gsnu[v].push_back({ i,v,u,b });
	}

	dijksra dyen(n, s, gyen);
	dijksra dsnu(n, t, gsnu);

	vector<ll> cost(n + 1);

	repn(i, n) {
		cost[i] = 1e15 - dyen.d(i) - dsnu.d(i);
	}

	vector<ll> ans(n + 2,0);

	for (ll i = n; i >= 1; i--) {
		ans[i] = max(ans[i + 1], cost[i]);
	}

	repn(i, n) {
		cout << ans[i] << endl;
	}


	system("PAUSE");
}


Measured memory_bytes: 57276
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    H, W = map(int, input().split())
    S = [[s for s in input()] for _ in range(H)]

    hori = [[0 for _ in range(W)] for _ in range(H)]
    for i in range(H):
        cnt = 0
        for j in range(W):
            if S[i][j] == '.':
                cnt += 1
                hori[i][j] = cnt
            else:
                cnt = 0
        res = 0
        for j in range(W - 1, -1, -1):
            if S[i][j] == '.':
                res = max(res, hori[i][j])
                hori[i][j] = res
            else:
                res = 0

    vert = [[0 for _ in range(W)] for _ in range(H)]
    for i in range(W):
        cnt = 0
        for j in range(H):
            if S[j][i] == '.':
                cnt += 1
                vert[j][i] = cnt
            else:
                cnt = 0
        res = 0
        for j in range(H - 1, -1, -1):
            if S[j][i] == '.':
                res = max(res, vert[j][i])
                vert[j][i] = res
            else:
                res = 0

    ans = 0
    for i in range(H):
        for j in range(W):
            if S[i][j] == '.':
                ans = max(ans, hori[i][j] + vert[i][j] - 1)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 248324
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int A,B,C,X,Y;
	cin>>A>>B>>C>>X>>Y;
	LL ans = LINF;
	for(int i=0;i<=max(X,Y);++i){
		LL res = i*2*C;
		res += max(0,X-i)*A + max(0,Y-i)*B;
		ans = min(ans,res);
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
/*input
1
11 26
26 24 26 17 13 10 2 3 8 21 20

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
#define PI 3.14159265
#define endl '\n'
#define debug(x) cout << #x << " = " << x << endl;
#define MAX 100001

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(ll a, ll b) {a += b; if (a < 0) a += mod; return a;}
inline int sub(ll a, ll b) {a -= b; if (a < 0) a += mod; return a;}
inline int mul(ll a, ll b) {return (a * 1ll * b) % mod;}
inline int pwr(ll x, ll y) {
    int ans = 1 % mod;
    while (y) {
        if (y & 1) ans = mul(ans, x);
        x = mul(x, x);
        y >>= 1;
    }
    return ans;
}
inline int inv(int a) {return pwr(a, mod - 2);}

int Q ;
long long int L , R , DP[65][2] , A[65][2];
void pre(){
    DP[0][0] = DP[0][1] = 1 ;
    for(int i=1;i<=64;i++){
        DP[i][0] = (DP[i-1][0]+DP[i-1][1]) ;
        DP[i][1] = (DP[i-1][0]+DP[i-1][1]) ;
    }
}

void solve(){
    long long sum = 0 ;
    for(int i=63;i>=0;i--){
        A[i][0] += sum ;
        if(L & (1LL << i)){
            A[i][0] += (L - DP[i][0]) ;
            sum += (DP[i][0]/2) ;
            L -= DP[i][0] ;
        }
    }
    R ++ ;
    sum = 0 ;
    for(int i=63;i>=0;i--){
        A[i][1] += sum ;
        if(R & (1LL << i)){
            A[i][1] += (R - DP[i][1]) ;
            sum += (DP[i][1]/2) ;
            R -= DP[i][1] ;
        }
    }
    sum = 0 ;
    for(int i=63;i>=0;i--){
        A[i][1] -= A[i][0] ;
        A[i][1] %= 2 ;
        if(A[i][1])
            sum += (1LL << i) ;
    }
    cout << sum << endl ;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    pre() ;
    cin >> L >> R;
    solve();
    

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
 
int main(){
  ll N,P; cin>>N>>P;
  if(N==1LL){
    cout<<P<<endl;
    return 0;
  }
  if(P==1LL||P<=N){
    cout<<1<<endl;
    return 0;
  }
  
  map<ll,ll> mp;
  ll tmp=P;
  for(ll i=2;i*i<=tmp;i++){
    while(tmp%i==0){
      mp[i]++;
      tmp/=i;
    }
  }
  if(tmp!=1LL) mp[tmp]++;
  ll ans=1LL;
  for(auto m:mp){
    if(m.second>=N){
      ans*=pow(m.first,(m.second/N));
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import itertools
import math
 
a = int(input())
cnt = 0
ans = [0]*100000
l = list(range(1,int(math.sqrt(a))))
 
for x,y,z in itertools.product(l, repeat=3):
    ans[x*x+y*y+z*z+x*y+y*z+z*x]+=1

for i in range(1,a+1):
    print(ans[i])

Measured memory_bytes: 9876
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPP(i,m,n) for(ll i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

long long gcd(ll m, ll n) {
  if(m < n) swap(m, n);
  if(n == 0) return abs(m);
  else return gcd(n, m % n);
}

int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    string S,T;
    cin >> S >> T;
    ll g = gcd(N,M);
    bool flag = 1;
    REP(i,g){
        if(S[i*N/g] != T[i*M/g]){
            flag = 0;
        }
    }
    if(!flag){
        cout << -1 << endl;
    }
    else cout << N*M/g << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long int li;


int main(void){
    ll ans=0;
    ll a,b,c;
    cin >> a >> b >> c;
    ans = a*b/2;
        cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define D(x) cerr << #x << " = " << (x) << '\n'
using ll = long long;

const int mod = 1e9 + 7;

ll add(ll x, ll y) {
	return (x + y) % mod;
}

void add_self(ll &x, ll y) {
	x += y; x %= mod;
}

ll sub(ll x, ll y) {
	return (x - y + mod) % mod;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, k;
	cin >> n >> k;
	vector<ll> a(n + 1);
	vector<vector<ll>> dp(n + 1, vector<ll>(k + 1));
	for(int i = 1; i <= n; ++ i) cin >> a[i];
	dp[0][0] = 1;
	for(int i = 1; i <= n; ++ i) {
		for(int j = 1; j <= k; ++ j) add_self(dp[i - 1][j], dp[i - 1][j - 1]);
		for(int j = 0; j <= k; ++ j) {
			dp[i][j] = sub(dp[i - 1][j], (j > a[i] ? dp[i - 1][j - a[i] - 1]:0));
		}
	}
	cout << dp[n][k] << '\n';
}


Measured memory_bytes: 80256
k, n = map(int, input().split())
a = list(map(int, input().split()))
distances = [0] * n
for i in range(n - 1):
  distances[i] = a[i + 1] - a[i]
distances[n - 1] = k - a[n - 1] + a[0]
print(k - max(distances))


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

int main() {
	string a = "-+";
	string S;
	int plus = 0;
	int minus = 0;
	cin >> S;

	for (int i = 0; i <= 3; i++) {
		if (S[i] == a[1]) {
			plus++;
		}
		else {
			minus++;
		}
	}
	cout << plus - minus;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}


const int MAX_N = 200000 + 10;
ll A[MAX_N];
ll S[MAX_N];

const ll INF = 1LL << 61;

int main2() {
  int N = nextInt();
  REP(i, N) A[i] = nextInt();
  ll ans = INF;
  S[0] = 0;
  REP(i, N) S[i+1] = S[i] + A[i];
  for (int i = 1; i < N; i++) {
    ll val = abs(S[i] - (S[N] - S[i]));
    chmin(ans, val);
  }
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
typedef long long int ll;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
 
using namespace std;

// {{{ Modint
// using mint = modint<1000000007>;
// mint x = 2;
// std::cout << x.a << std::endl;
template <std::int64_t M>
class modint {
 public:
  int64_t a;

  explicit constexpr modint(const int64_t x = 0) noexcept :
    a((x % M + M) % M) {}
  constexpr int64_t &value() noexcept { return a; }
  constexpr const int64_t &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= M) {
      a -= M;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += M;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % M;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    int64_t exp = M - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
  constexpr modint pow(ll t) const {
    if (!t) return modint(1);
    modint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
};
// }}}
using mint = modint<1000000007>;

ll N, K;
signed main() {
  cin >> N >> K;
  mint ans(0);
  for (ll k = K; k <= N+1; k++) {
    ll mi = (k-1) * k / 2;
    ll ma = (N + N - k +1) * k / 2;
    // cout << k << " " << mi << "-" << ma << endl;
    auto t = mint(ma-mi+1);
    ans += t;
  }
  cout << ans.value() << endl;
  return 0;
}


Measured memory_bytes: 3640
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 int main()
 {
   int N;
   stack<int> mystack;
   while(cin>>N)
   {
     if(N!=0) mystack.push(N);
     else
     {
       int m=mystack.top();
       mystack.pop();
       cout<<m<<endl;    
     }               
   }
   //while(1);      
   return 0;    
 }

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

int main(){
    int X;
    cin >> X;
    if(400<=X&&X<=599){
        cout << 8;
    }
    else if(600<=X&&X<=799){
        cout << 7;
    }
    else if(800<=X&&X<=999){
        cout << 6;
    }
    else if(1000<=X&&X<=1199){
        cout << 5;
    }
    else if(1200<=X&&X<=1399){
        cout << 4;
    }
    else if(1400<=X&&X<=1599){
        cout << 3;
    }
    else if(1600<=X&&X<=1799){
        cout << 2;
    }
    else if(1800<=X&&X<=1999){
        cout << 1;
    }
}

Measured memory_bytes: 3592
int m,n,em[500],en[500];
char gm[500][500],gn[500][500],vm[500],vn[500];
char C[1000][1000], visited[1000];
int P[1000];
int h(x,y){return y?h(y,x%y):x;}
int g(x,y){return x>y?h(x,y):h(y,x);}

int matchm(s){
  int i=0;
  for(;i<n;i++)
    if(gm[s][i]&&!vn[i]){
      vn[i]=1;
      if(en[i]<0||matchn(en[i]))return em[s]=i,en[i]=s,1;
    }
  return 0;
}

int matchn(s){
  int i=0;
  for(;i<m;i++)
    if(gn[s][i]&&!vm[i]){
      vm[i]=1;
      if(em[i]<0||matchm(em[i]))return en[s]=i,em[i]=s,1;
    }
  return 0;
}

int match(int src){
  int i;
  for (i=/*(src >= m) ? 0 :*/ m; i</*src >= m ? m :*/ m+n; i++)
    if(C[src][i]&&!visited[i]){
      visited[i] = 1;
//if(P[i]>=0)printf("%d %d %d %d\n",P[i]>=m?2:1,src,i,P[i]);
      if(P[i]<0||match(P[i]))return P[src] = i, P[i] = src, 1;
    }
  return 0;
}

main(){
  int b[500],r[500],i,j,t;
  for(;scanf("%d%d",&m,&n),m|n;printf("%d\n",t)){
    memset(&gm,0,sizeof(gm));
    memset(&gn,0,sizeof(gn));
    memset(&C,0,sizeof(C));
    memset(&em,0xff,sizeof(em));
    memset(&en,0xff,sizeof(en));
    memset(&P,0xff,sizeof(P));
    for(t=i=0;i<m;i++)scanf("%d",b+i);
    for(i=0;i<n;i++)scanf("%d",r+i);
    for(i=0;i<m;i++)for(j=0;j<n;j++)C[i][j+m] = C[j+m][i]=gm[i][j]=gn[j][i]=g(b[i],r[j])>=2;
    for(i=0;i<m;i++)memset(&vm,0,sizeof(vm)),memset(&vn,0,sizeof(vn)),memset(&visited,0,sizeof(visited)),t+=match(i);
  }
  return 0;
}

Measured memory_bytes: 1896
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    while(cin>>str)
    {
        if(str=="ABC")
        {
            cout<<"ARC"<<endl;
        }
        else if(str=="ARC")
        {
            cout<<"ABC"<<endl;
        }
    }
}


Measured memory_bytes: 3536
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<stdio.h>
using namespace std;
typedef long long ll;
int input(){
  int x;
  cin>>x;
  return x;
}
int abs(int x){
  if(x>=0){
    return x;
  }else{
    return -x;
  }
}
int gcd(int x, int y){
	if(x<y){
    return gcd(y,x);
  }
  if(y==0){
    return x;
  }
  return gcd(y,x%y);
}
int moji(char in)
{
    int ans = (int)in-(int)'a'+1;
    if((in < 1) || (in > 26)){
        ans = 100;
    }
    return ans;
}






int main() {
  int N;
  cin>>N;
  int A[N];
  for(int i=0;i<N;i++){
    cin>>A[i];
    
    
  }
  sort(A,A+N);


  int sum=0;
  int x=1;
  for(int i=0;i<N-1;i++){
    if(A[i]==A[i+1]){
      x++;
    }else{
      if(x%2==1){
        sum++;
        x=1;
      }else{
        x=1;
      }
    }
    if(i==N-2&&x%2==1){
      sum++;
    }
  }
  
  cout<<sum<<endl;

  
 
  




  


  





  

  
  
  


  
  


  

  




  
  
}

  

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

#define ll long long
#define ld long double
#define mod 1000000007LL
#define eps 1e-13
#define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define endl '\n'
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mp make_pair
#define F first
#define S second
#define pb(x) push_back(x)
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define foi(i,a,n) for(i = (a); i <= (n); i++)
#define pd(x) cout<<x
#define sd(x) cin>>x
#define nl cout<<endl
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0)
#define gcd __gcd
#define clr(x) memset(x,0,sizeof(x))
#define all(a) (a).begin(), (a).end()
#define foreach(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define sz(a) (int)((a).size())
//int a[25]= { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
//int dw[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
//int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
//ll fibonacci[2][2] = {{0,1},{1,1}};
//ll identity[2][2] = {{1,0},{0,1}};
ll i,j,k;

int main() {
	ll n;
	cin>>n;
	vll v(n), temp(n+1,0);
	fo(i,0,n) cin>>v[i];
	fo(i,0,n) temp[v[i]] = temp[v[i]-1] + 1;
	ll maxx = 0;
	fo(i,1,n+1) maxx = max(maxx,temp[i]);
	cout<<(n - maxx)<<endl;
	return 0;
}

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

typedef struct{
    double x;
    double y;
} Vec;

void koch(Vec a, Vec b, int n) {
    Vec s, t, u;
    double rad = M_PI * 60.0 / 180.0;
    if (n == 0) return;

    s.x = (2 * a.x + b.x) / 3.0;
    s.y = (2 * a.y + b.y) / 3.0;
    t.x = (a.x + 2 * b.x) / 3.0;
    t.y = (a.y + 2 * b.y) / 3.0;

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

    koch(a, s, n-1);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(s, u, n-1);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(u, t,n-1);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(t, b,n-1);
}

int main() {
    Vec a, b;
    int n;

    scanf("%d", &n);

    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    printf("%.8f %.8f\n", a.x, a.y);
    koch(a, b, n);
    printf("%.8f %.8f\n", b.x, b.y);
    return 0;
}



Measured memory_bytes: 2124
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

double L;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> L;
	cout << fixed << setprecision(6) << L / 3 * L / 3 * L / 3;
}

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

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

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> renga;
    int res = 0;
    int idx = 1;
    REP(i, N) {
        ll tmp; cin >> tmp;
        renga.push_back(tmp);
    }
    for (auto x: renga) {
        if (x == idx) {
            idx++;
        }
        else {
            res++;
        }
    }
    if (res == N) res = -1;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 2420
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    a = list(map(int, input().split()))
    s, m = 0, 10**18
    flag = 1
    for x in a:
        s += abs(x)
        flag ^= (x<0)
        m = min(m, abs(x))

    if flag or (0 in a):
        print(s)
    else:
        print(s-2*m)
        
    
    
if __name__ == '__main__':
    main()

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

int main(){
  int x;
  cin >> x;
  
  int k=0;
  
  while(k==0){
    int i=x;
    for(int j=2;j<x;j++){
      while(i%j==0)
        i/=j;
    }
    if(i==x)
      k=i;
    x++;
  }
  cout << k << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    int n = sc.nextInt();

    for (int i = 1; i <= 9; i++) {
      for (int j = 1; j <= 9; j++) {
        if (i * j == n) {
          System.out.println("Yes");
          return;
        }
      }
    }
    System.out.println("No");
  }
}


Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

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

=================================================================

解説=============================================================

================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N,M; cin >> N >> M;
    ll ans = 0;
    ans += min(N,M/2);
    
    M -= min(N,M/2)*2;
    ans += M/4;
    cout << ans << endl;
	return 0;
}


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

int main(){
	int n,k;
	string s;
	cin >> n >> k;
	cin >> s;
	if (s[k-1]=='A'){
		s[k-1]='a';
	}else if(s[k-1]=='B'){
		s[k-1]='b';
	}else{
		s[k-1]='c';
	}
	cout << s;
	return 0;
}

Measured memory_bytes: 256
class UnionFind :
    def __init__(self, size) :
        self.parent = list(range(size))
        self.height = [0] * size
        self.size = [1] * size
        self.component = size

    def root(self, index) :
        if self.parent[index] == index :  # 根の場合
            return index
        rootIndex = self.root(self.parent[index])  # 葉の場合親の根を取得
        self.parent[index] = rootIndex  # 親の付け直し
        return rootIndex

    def union(self, index1, index2) :  # 結合
        root1 = self.root(index1)
        root2 = self.root(index2)

        if root1 == root2 :  # 連結されている場合
            return

        self.component -= 1  # 連結成分を減らす

        if self.height[root1] < self.height[root2] :
            self.parent[root1] = root2  # root2に結合
            self.size[root2] += self.size[root1]
        else :
            self.parent[root2] = root1  # root1に結合
            self.size[root1] += self.size[root2]
            if self.height[root1] == self.height[root2] :
                self.height[root1] += 1
        return

    def isSameRoot(self, index1, index2) :
        return self.root(index1) == self.root(index2)

    def sizeOfSameRoot(self, index) :
        return self.size[self.root(index)]

    def getComponent(self) :
        return self.component

N, M = map(int, input().split())

tree = UnionFind(N + M)

for i in range(N):
    L = tuple(map(int, input().split()))
    for l in L[1:]:
        tree.union(i, N + l - 1)

V = set()
for i in range(N):
    V.add(tree.root(i))

print('YES' if len(V) == 1 else 'NO')

Measured memory_bytes: 14068
#include <iostream>
int main(){
  int n, c[501], s[501], f[501], a[501]={}, i=0,j, t;
  std::cin>>n;
  while(std::cin>>c[i]>>s[i]>>f[i])i++;
  for(i=0;i<n-1;++i){
    t=0;
    j=i;
    while(j<n-1){
      if(t>=s[j]&&t%f[j]==0){t+=c[j];++j;}
      else ++t;
    }
    a[i] = t;
  }
  for(i=0;i<n;++i)std::cout<<a[i]<<"\n";
}


Measured memory_bytes: 256
#!/usr/bin/ruby
# encoding: utf-8

N = gets.to_i
S = gets.chomp

# 累積和の配列
ruiW = Array.new(N+1,0) # 白石の累積和
ruiB = Array.new(N+1,0) # 黒石の累積和

(0..N-1).each do |i|
  if S[i] == '.' then
    ruiW[i+1] = ruiW[i] + 1
  elsif
    ruiW[i+1] = ruiW[i]
  end
end

(0..N-1).each do |i|
  if S[i] == '#' then
    ruiB[i+1] = ruiB[i] + 1
  elsif
    ruiB[i+1] = ruiB[i]
  end
end

#puts "ruiB = #{ruiB}"
#puts "ruiW = #{ruiW}"

numB = 0
numW = 0
ans = 1000000
tmp = 1000000

(0..N).each do |i|
  numB = ruiB[i] 
  numW = ruiW[N] - ruiW[i] 
#  puts "numB = #{numB}"
#  puts "numW = #{numW}"
  tmp = numB + numW 
  if ans >= tmp then
    ans = tmp
  end
end

puts ans


Measured memory_bytes: 7292
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)


int RPN(vector<char> v){
	stack<int> num;
	rep(i,v.size()){
		if(isdigit(v[i])){
			num.push(v[i]-'0');
		}else{
			if(num.size()<2) throw -1;
			int a,b;
			a = num.top(),num.pop();
			b = num.top();num.pop();
			if(v[i]=='+')num.push(a+b);
			if(v[i]=='-')num.push(a-b);
			if(v[i]=='*')num.push(a*b);
		}
	}
	if(num.size()!=1)throw -1;
	
	return num.top();
}

void printRPN(vector<char> v){
	stack<string> num;
	rep(i,v.size()){
		if(isdigit(v[i])){
			num.push(string(1,v[i]));
		}else{
			string a,b;
			a = num.top(),num.pop();
			b = num.top();num.pop();
			if(v[i]=='+')num.push("("+a+"+"+b+")");
			if(v[i]=='-')num.push("("+a+"-"+b+")");
			if(v[i]=='*')num.push("("+a+"*"+b+")");
		}
	}
	cout<<num.top()<<endl;
}

int main(){
	vector<char> v(4);
	while(cin>>v[0]>>v[1]>>v[2]>>v[3]){
		if(v[0]=='0'&&v[1]=='0'&&v[2]=='0'&&v[3]=='0')break;
		rep(plus,4){
			rep(minus,4){
				rep(mul,4){
					vector<char> tmp=v;
					if(plus+minus+mul!=3)continue;
					rep(i,plus)tmp.pb('+');
					rep(i,minus)tmp.pb('-');
					rep(i,mul)tmp.pb('*');
					
					sort(all(tmp));
					do{
						int res;
						try{
							res = RPN(tmp);
						}catch(int e){continue;}
						
						if(res==10){
							printRPN(tmp);
							goto next;
						}
					}while(next_permutation(all(tmp)));
				}
			}
		}
		cout<<0<<endl;
	next:;
	}
}

Measured memory_bytes: 3144
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin >> a >> b;
    if((a==1|| b==1)&& (a==2 || b==2))
     cout << 3;
    else if((a==2|| b==2)&& (a==3 || b==3))
                      cout << 1;
    else cout << 2;
}


Measured memory_bytes: 256
N, K = list(map(int, input().split()))

ls = []

def multiply(ls):
    result = []
    for i in range(len(ls)):
        result.append(pow(N, -1) * ls[i])
    return result

if N < K:
    for i in range(1, N + 1):
        p = i
        cnt = 0
        while p < K:
            p *= 2
            cnt += 1
        ls.append(pow(2, -cnt))
    print(sum(multiply(ls)))
else:
    for i in range(1, K):
        p = i
        cnt = 0
        while p < K:
            p *= 2
            cnt += 1
        ls.append(pow(2, -cnt))
    print(sum(multiply(ls)) + (N - K + 1) / N)


Measured memory_bytes: 40048
import numpy as np
n = int(input())
v = list(map(int,input().split()))
cntnumeven = [0 for _ in range(10**5+1)]
cntnumodd = [0 for _ in range(10**5+1)]
veven = [v[2*i+1] for i in range(n//2)]
vodd = [v[2*i] for i in range(n//2)]
# for i in v:


for i in vodd:
    cntnumodd[i] += 1

for i in veven:
    cntnumeven[i] += 1
if np.argmax(cntnumeven) == np.argmax(cntnumodd):
    cntnumeven.sort(reverse=True)
    cntnumodd.sort(reverse=True)
    print(min(n - cntnumeven[1] - cntnumodd[0],n - cntnumeven[0] - cntnumodd[1]))
else:
    print(n - max(cntnumodd) - max(cntnumeven))

Measured memory_bytes: 29720
#include <stdio.h>
#include <stdlib.h>

#define MAX 100000

int partition(int*, int, int);

int main() {
  int i, al, index;
  int *array;

  array = malloc(sizeof(int)*MAX);
  
  scanf("%d", &al);
  for(i=0 ; i < al ; i++) { scanf("%d", &array[i]); }

  index = partition(array, 0, al-1);
  
  for(i=0 ; i < index ; i++) {
    printf("%d", array[i]);
    if(i != al-1) { printf(" "); }
  }

  printf("[%d]", array[index]);
  if(i != al-1) { printf(" "); }
  
  for(i=index+1 ; i < al ; i++) {
    printf("%d", array[i]);
    if(i != al-1) { printf(" "); }
  }
  printf("\n");
  
  return 0;
}

int partition(int *A, int p, int r) {
  int i, j, x, temp;

  x = A[r];
  i = p-1;

  for(j=p ; j < r ; j++){
    if(A[j] <= x) {
      i = i+1;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }

  temp = A[i+1];
  A[i+1] = A[r];
  A[r] = temp;

  return i+1;
}




Measured memory_bytes: 2104
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = list(map(int,readline().split()))
a.sort()
if a[0] == a[-1]:
  if n > 1:
    print(0)
  else:
    print(1)
  exit()

if a[0] == 1:
  if a[0] == a[1]:
    print(0)
  else:
    print(1)
  exit()
  
def divisorize(fct):
    b, e = fct.pop()
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]

def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct
 
 
def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a
    
s = set()
if a[0] < a[1]:
  ans = 1
else:
  ans = 0
s.add(a[0])
for nm,i in enumerate(a[1:]):
  c = set()
  fct = factorize(i)
  for div in divisorize(fct):
      c.add(num(div))
  if c&s == set() and ((nm < n-2 and a[nm+2] != i) or nm == n-2):
    ans += 1
  s.add(i)

print(ans)

Measured memory_bytes: 125800
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define mod 1000000007 //998244353
#define pb push_back
#define endd '\n'
#define ll long long 
#define mk make_pair 
#define fi first
#define all(a) a.begin(),a.end()
#define test ll int t,o;cin>>o;for(t=1;t<=o;t++)
#define goog(q,aao) cout<<"Case #"<<q<<": "<<aao<<'\n'
#define co(a) cout<<a<<'\n'
#define coo(a,b) cout<<a<<" "<<b<<'\n'
#define cooo(a,b,c) cout<<a<<" "<<b<<" "<<c<<'\n'
#define take_arr ll i,j,k,n;mul_itr;set_itr;cin>>n;ll arr[n];loop(i,n)cin>>arr[i]
#define take ll i,j,k,n;mul_itr;set_itr;cin>>n
#define print(arr,n) for(ll w=0;w<n;w++)cout<<arr[w]<<" ";cout<<'\n'
#define printdou(arr,n,m) for(ll w=0;w<n;w++){ for(ll o=0;o<m;o++){cout<<arr[w][o]<<" "; }cout<<endd;}
#define dis(w) loop(i,w.size())cout<<w[i]<<" ";cout<<'\n'
#define mem(b,q)  memset(b,q , sizeof(b))
#define set_itr set<ll>:: iterator sitr ,sit
#define mul_itr multiset<ll>:: iterator itr,it
#define se second
#define pii pair<int,int>
#define iterate(s,d) for(d=s.begin();d!=s.end();++d)
#define pll pair<long long,long long>
#define vll vector<ll>
#define vpll vector< pair<ll,ll> >
#define vppll vector < pair<ll, pair<ll,ll> > >
#define trace(x) cout<<#x<<": "<<x<<" "<<endl
#define trace2(x,y) cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x,y,z) cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a,b,c,d) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define loop1(i,a,n) for(i=a;i<n; i++) 
#define loop(i,n) for( i=0;i<n;i++)
#define loop2(n,m) for(int p=0;p<n;p++)for(int q=0;q<m;q++)
#define loop3(n,m,l) for(int i=0;i<n;i++)for(int j=0;j<m;j++)for(int k=0;k<l;k++)
#define checkbit(n, b) ((n >> b) & 1)
#define setbits(x) __builtin_popcount(x)  // returns no of set bits in x 
#define maxx 10e18
using namespace std;
ll max(int a,ll b){ return max((ll)a,b);}
ll min(int a,ll b){ return min((ll)a,b);} 
ll min(ll a,int b){ return min(a,(ll)b);}
ll max(ll a,int b){ return max(a,(ll)b);}
// NOTE :
// maxx=*max_element(a,a+n); 
// m=(m-1+n)%n;     move anti-clockwise 

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

//int32_t main(){
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   ll i,j,k,n, sum=0;
   cin>>n;
   loop(i,n)
   {
   	loop(j,n)
   	{
   		loop(k,n)
   		{
   			sum+= __gcd(i+1, __gcd(j+1,k+1));
		   }
	   }
   }
   cout<<sum;
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

int main( void ) {
	int n, sum, elmNum[ 9 ] = { 5, 3, 3, 3, 3, 3, 4, 3, 4 };
	char ch[ 9 ][ 6 ] = { ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz" }, key, tmp;

	scanf( "%d%*c", &n );
	while ( n-- ) {
		while ( ( key = getchar() ) != '\n' ) {
			if ( key == '0' )
				continue;

			for ( sum = 0; ( tmp = getchar() ) != '0'; sum++ ) ;

			putchar( ch[ key - '1' ][ sum % elmNum[ key - '1' ] ] );
		}

		putchar( '\n' );
	}

	return 0;
}

Measured memory_bytes: 568
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <set>
#include <vector>
#include <cmath>
#include <bitset>
#include <functional>
#include <limits>
#include <map>
using namespace std;

typedef long long ll;
#define rep1(i, n) for(ll i = 1; i <=(ll)(n); i++)
#define rep0(i, n) for(ll i = 0; i <=(ll)(n); i++)

ll pow(ll a, ll n) { //compute a^n with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}

ll pow(ll a, ll n, ll mod) { //compute a^n (mod mod) with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

# define n 100000

int main(){
    ll q;;
    cin >> q;
    bool isPrime[n+1];
    rep1(i,n){
        if(i % 2 == 0) isPrime[i] = false;
        else isPrime[i] = true;
        if(i == 1) isPrime[i] = false;
        if(i == 2) isPrime[i] = true;
    }

    ll sum[n+1] = {0};
    ll tmp_sum = 0;
    for(ll i = 3; i <= 1e5; i += 2){
        if(isPrime[i] == true){
            for(ll j = 2; j*i <= 1e5; j++) isPrime[j*i] = false;
            if(isPrime[(i+1)/2] == true){
                tmp_sum++;
            }
        }
        sum[i] = tmp_sum;
    }

    rep1(i,q){
        ll l,r;
        cin >> l >> r;
        if(l == 1) cout << sum[r] << endl; 
        else cout << sum[r] - sum[l-2] << endl;
    }
    return 0;
}

Measured memory_bytes: 4000
#include <bits/stdc++.h>
#define maxn 3002
using namespace std;
typedef long long LL;

int n;
int ar[maxn];
LL dp[maxn][maxn];

int main() {
	scanf("%d",&n);
	for( int i = 1 ; i <= n ; i++ )
		scanf("%d",&ar[i]);
	for( int len = 1 ; len <= n ; len++ )
		for( int i = 1 ; i <= n-len+1 ; i++ ) {
			int j = i+len-1;
			dp[i][j] = max( ar[i]-dp[i+1][j] , ar[j]-dp[i][j-1] );
		}
	printf("%lld\n",dp[1][n]);
	return 0;
}


Measured memory_bytes: 70016
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import math
def prime_number(start, end):
    ##追加
    if start < 3:
        return 2
    if start % 2 == 0:
        start = start + 1
    else:
        start = start

    ##1つずつスキップしてrangeを設定
    for i in range(start, end+1, 2):
        prime = True
        if i == 1:
            prime = False
            continue
        for j in range(2, math.floor(math.sqrt(i))+1):
            if i%j == 0:
                prime = False
                break
        if prime:
            return i

n = int(input())
print(prime_number(n, 1000000))

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if((a!=b)||(c!=b)){
        if(a==b||b==c||a==c) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>

#include <cmath>
#include <string>

#include <algorithm>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

int arr[105];
long dp[105][100005]; // dp[i][j]: distribute j-1 candies to first i people
long pref[105][100005];

const long MOD = 1000000007;

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

	int n, k;
	cin >> n >> k;
	for (int i = 1; i < n+1; i++) cin >> arr[i];

	for (int i = 0; i < n+1; i++) {
		pref[i][0] = 0;
		dp[i][1] = 1;
		pref[i][1] = 1;
	}

	for (int i = 2; i < k+2; i++) {
		dp[0][i] = 0;
		pref[0][i] = 1;
	}

	for (int i = 1; i < n+1; i++) {
		for (int j = 2; j < k+2; j++) {
			dp[i][j] = pref[i-1][j] - pref[i-1][max(0, j - arr[i] - 1)];
			dp[i][j] %= MOD;
			pref[i][j] = pref[i][j-1] + dp[i][j];
			pref[i][j] %= MOD;
		}
	}

	cout << (dp[n][k+1] + MOD) % MOD << endl;

	return 0;
}


Measured memory_bytes: 160128
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>

using namespace std;
static const int MAX = 100;

void insertionSort(int T[], int n) {
	for (int i = 1; i < n; i++) {
		int v = T[i];
		int j = i - 1;
		while ((j >= 0) && (T[j] > v)) {
			T[j + 1] = T[j];
			j--;
		}
		T[j + 1] = v;
		for (int ct = 0; ct < n - 1; ct++) cout << T[ct] << ' ';
		cout << T[n - 1] << endl;
	}
}

int main()
{
	int n;
	cin >> n;
	int A[MAX];
	std::string readbuff;
	cin.get();
	getline(cin, readbuff);
	stringstream ss(readbuff);
	string str;
	for (int i = 0; i < n; i++) {
		getline(ss, str, ' ');
		A[i] = stoi(str);
	}
	for (int ct = 0; ct < n - 1; ct++) cout << A[ct] << ' ';
	cout << A[n - 1] << endl;
	insertionSort(A, n);
	return 0;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int main() {
  int N, M;
  cin >> N >> M;
  typedef pair<int, int> P;
  vector<P> ba(M);
  rep(i, M) cin >> ba[i].se >> ba[i].fi;
  sort(all(ba));

  int prev_cut_point = 0;
  int ans = 0;
  rep(i, M) {
    if (prev_cut_point > ba[i].se) continue;
    ans++;
    prev_cut_point = ba[i].fi;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef int64_t i64;

int main()
{
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  
  if(b - a <= k && c - a <= k && d - a <= k && e - a <= k && c - b <= k && d - b <= k && e - b <= k && d - c <= k && e - c <= k && e - d <= k){
      cout << "Yay!" << endl;
  }else{
      cout << ":(" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
//BISMILLAHIR RAHMANIR RAHIM
//SOTO MEAW
//SOTO SONDESH
#include<bits/stdc++.h>

#define ls ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define __ <<" "<<
#define loop(m,n) for(m=0;m<n;m++)
#define rloop(m,n) for(m=n-1;m>=0;m--)
#define case(z) "Case " << z++ << ": "
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define quit return 0

using namespace std;

bool isprime(int n)
{
    for (int i = 2; i <= n/2; i++)
    {
        if (n % i == 0)
            return false;
    }
    return true;
}

void showmyDS(set<int> ds)
{
    set<int> ::iterator it;
    for (it=ds.begin();it!=ds.end();it++)
    {
        cout << *it << endl ;
    }
    cout << endl;
}
int main()
{
    ls
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //int t,l=1;cin>>t;while(t>0){
        vector<char>s;
        int j;
        string s1;
        cin>>s1;
        loop(j,s1.size()) s.push_back(s1[j]);
        int n,i,c=0;
        cin>>n;
        char a[n];
        int p,index[255];
        memset(index,0,sizeof(index));
        loop(i,n)
        {
            cin>>a[i];
            p=(int)a[i];
            index[p]=1;
        }
        loop(i,s.size())
        {
            p=(int)s[i];
            if(c==1)
                p=48;
again:
            if(index[p]==1 && p==57)
            {
                if(i!=0)
                    p=48;
                else
                    p=49;
                s.push_back('0');
                c=1;
            }
            if(index[p]==1)
            {
                p++;
                c=1;
                goto again;
            }
            else
            {
                cout<<(char)p;
            }
        }
        cout<<endl;
    //t--;}

    quit;
}


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

int main() {
    int x;
    cin >> x;
    bool isPrime = false;
    while(true){
        //素数判定(2は例外)
        if(x==2) isPrime = true;
        //素数判定(偶数は処理しない)
        if(x % 2 != 0){
            for(int i = 3; i <= x; i += 2){
                if(x != i && x % i == 0) break;
                if(x == i) isPrime = true;
            }
        }
        if(isPrime == true) break;
        //素数でなければカウントアップ
        x++;
    }
    cout << x << endl;
}

Measured memory_bytes: 256
import sys
INF = 10**9
sys.setrecursionlimit(INF)


def main():
    n, k, *da = map(int, open(0).read().split())

    is_have_list = set()

    for _ in range(k):
        d = da.pop(0)
        for _ in range(d):
            is_have_list.add(da.pop(0))

    ans = n - len(is_have_list)
    print(ans)
    return(ans)


if __name__ == '__main__':
    main()


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

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

	int a, b;
	a = N / 10;
	b = N - a * 10;
	if (a == 9 || b == 9) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}

Measured memory_bytes: 256