akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

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


struct Combination {

	vector<ll> fact, rfact;

	Combination(ll sz) : fact(sz + 1), rfact(sz + 1) {

		fact[0] = 1;
		for (ll i = 1; i < fact.size(); i++) {
			fact[i] = fact[i - 1] * i % MOD;
		}
		//逆元
		rfact[sz] = inv(fact[sz]);
		for (ll i = sz - 1; i >= 0; i--) {
			rfact[i] = rfact[i + 1] * (i + 1) % MOD;
		}
	}

	ll inv(ll x) {
		//modpow
		return pow(x, MOD - 2);
	}
	ll pow(ll x, ll n) {
		//累乗
		ll ret = 1;
		while (n > 0) {
			if (n & 1) (ret *= x) %= MOD;
			(x *= x) %= MOD;
			n >>= 1;
		}
		return (ret);
	}
	ll P(ll n, ll r) {
		//順列
		if (r < 0 || n < r) return (0);
		return (fact[n] * rfact[n - r] % MOD);
	}

	ll C(ll p, ll q) {
		//組み合わせ
		if (q < 0 || p < q) return (0);
		return (fact[p] * rfact[q] % MOD * rfact[p - q] % MOD);
	}

	ll H(ll n, ll r) {
		//重複組み合わせ
		if (n < 0 || r < 0) return (0);
		return (r == 0 ? 1 : C(n + r - 1, r));
	}
};


/******************************************************************************************/

vector<vector<int> > hoge;

void solve(int n,int total,vector<int> ans) {


	int cnt = 0;
	for (int i = 0; i < ans.size(); i++)
	{
		cnt += ans[i];
	}
	for (int i = n; i >= 1; i--)
	{
		if (cnt + i < total) {
			ans.push_back(i);
			solve(i, total, ans);
			ans.pop_back();
		}
		else if (cnt + i == total) {
			ans.push_back(i);
			hoge.push_back(ans);
			ans.pop_back();
		}
	}
}


int main() {


	int n;
	while (cin >> n, n) {

		vector<int> ans;
		solve(n,n,ans);

		for (int i = 0; i < hoge.size(); i++)
		{
			for (int j = 0; j < hoge[i].size(); j++)
			{
				if (j == 0) {
					cout << hoge[i][j];
				}
				else
				{
					cout << " " << hoge[i][j];
				}
			}
			cout << endl;
		}
		hoge.clear();
	}
	return 0;
}



Measured memory_bytes: 3300
def m():
    n = int(input())
    s = str(input())
    exleft = 0
    exright = 0
    for c in s:
        if c == "(":
            exleft +=1

        elif c == ")":
            if exleft <= 0:
                exright +=1
            else:
                exleft -=1
    return "(" * exright + s + ")" * exleft

print(m())

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int s;
	char t,u;
	for(;~scanf("%d\n",&s),s;puts(""))
	{
		int d[300]={0};
		for(;s;s--)
		{
			scanf("%c %c\n",&t,&u);
			d[t]=u;
		}
		for(scanf("%d\n",&s);s;s--)
		{
			scanf("%c\n",&t);
			printf("%c",d[t]?d[t]:t);
		}
	}
	return 0;
}

Measured memory_bytes: 592
def resolve():
    N = int(input())
    ans = 0
    for i in range(1, N+1, 2):
        tmp = 0
        for j in range(1, N+1):
            if i % j == 0:
                tmp += 1

        if tmp == 8:
            ans += 1
    print(ans)
    return

resolve()

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

int main(){
   vector<int> v;
   int t;
   int res=0;
   for(int i=0;i<3;i++){
       cin>>t;
       v.push_back(t);
   }
   sort(v.begin(),v.end());
   res+=(v[2]-v[0])/2;
   v[0]+=res*2;
   res+=(v[2]-v[1])/2;
   v[1]+=(v[2]-v[1])/2*2;
   if(v[0]==v[1]&&v[1]==v[2])
   {
       cout<<res<<endl;
   }
   else if(v[0]==v[1])
   {
       cout<<res+1<<endl;
   }
   else
   {
       cout<<res+2<<endl;
   }
    return 0;
}


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

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) (((a) >> (b)) & 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  int D;
  cin >> D;

  if (D == 25) {
    cout << "Christmas" << endl;
  } else if (D == 24) {
    cout << "Christmas Eve" << endl;
  } else if (D == 23) {
    cout << "Christmas Eve Eve" << endl;
  } else {
    cout << "Christmas Eve Eve Eve" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env ruby

def main
    n = gets.chomp.to_i
    a = gets.chomp.split(" ").map(&:to_i)

    ans = 0
    while 1
        a.size.times do |i|
            if a[i]%2 != 0
                puts ans
                return
            else
                a[i] = a[i] / 2
            end
        end
        ans += 1
    end
end

main

Measured memory_bytes: 1788
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 1000;
 
ll table[MAX][MAX];
 
// テーブルを作る前処理
void COMinit() {
    table[0][0] = table[0][1] = 1;
    FOR(i, 1, MAX-1){
      FOR(j, 0, i+1){
        if(j==0) table[i][j] = 1;
        else if(j == i+1) table[i][j] = 1;
        else table[i][j] = table[i-1][j-1]+table[i-1][j];
      }
    }
}
 
// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return table[n-1][k];
}

void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}


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

  vector<ll> so;    //素数を格納
  vector<ll> num(n+1, 0);

  FOR(i, 2, n+1){

    if(num[i]==0){
      ll count = 2;
      while(1){
        if(i*count>n) break;
        num[i*count] = 1;
        count++;
      }
    }
  }
 
  FOR(i, 2, n+1){
    if(num[i]==0) so.push_back(i);
  }
  

  map<ll, ll> m;

  

  FOR(i, 2, n){
    ll count = 0;
    ll x = i;
    //cout<<"i"<<endl;

    while(1){
      if(x==1) break;
      else{
        if(x%so[count]==0){
          x /= so[count];
          m[so[count]]++;
          //cout<<so[count]<<endl;;
        }else count++; 
      }
    }
  }
  //cout<<"c"<<endl;

  ll ans = 1;
  for(auto i=m.begin(); i!=m.end() ;i++){
    //cout<<i->first<<" "<<i->second<<" ";
    ans *= (1+ i->second)%MOD;
    ans = ans%MOD;
    //cout<<ans<<endl;;
  }
  //cout<<endl;

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

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main(void){
int x;
scanf("%d",&x);
if(x==1){printf("1 0");return 0;}
int a,b;
 
for(int i=-1000;i<=1000;i++){
    for(int j=-1000;j<=1000;j++){
            if((long long int)pow(i,5)-(long long int)pow(j,5)==(long long int)x){printf("%d %d\n",i,j); return 0;}
        }
    }
}
 
 


Measured memory_bytes: 2600
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[300];
main()
{
	while(cin>>n,n)
	{
		for(int i=0;i<n;i++)cin>>a[i];
		bool ok[301][301]={};
		for(int i=0;i<n-1;i++)
		{
			if(abs(a[i+1]-a[i])<=1)ok[i][i+2]=1;
		}
		for(int w=2;w<=n;w++)
		{
			for(int i=0;i+w<=n;i++)
			{
				for(int j=1;j<w;j++)
				{
					if(ok[i][i+j]&&ok[i+j][i+w])ok[i][i+w]=1;
				}
				if(!ok[i][i+w])continue;
				if(i>0&&i+w<n&&abs(a[i-1]-a[i+w])<=1)
				{
					ok[i-1][i+w+1]=1;
				}
			}
		}
		int dp[301][301]={};
		for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)if(ok[i][j])dp[i][j]=j-i;
		for(int i=0;i<n;i++)for(int j=i+1;j<=n;j++)
		{
			for(int k=i+1;k<j;k++)dp[i][j]=max(dp[i][j],dp[i][k]+dp[k][j]);
		}
		cout<<dp[0][n]<<endl;
	}
}



Measured memory_bytes: 3540
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const int N = 1e5+5;
int a[N];

int main()

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

    int n, x = 0, ans = 0;
    string s;

    cin >> n >> s;

    for (int i = 0; i < n; i++) {

        if (s[i] == 'I') x++;
        else x--;

        ans = max(ans, x);
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e20);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a>b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a<b ? : a = b; }



int main() {
    int N;
    
    cin >> N;
    v2int S(N, vint(3, 0));
    rep(i, N) {
        int a,b,c;
        cin >> a>>b>>c;
        S[i][0] = a;
        S[i][1] = b;
        S[i][2] = c;
    }

    v2int dp(N, vint(3, 0));
    dp[0][0] = S[0][0];
    dp[0][1] = S[0][1];
    dp[0][2] = S[0][2];
    REP(i, 1, N) {
        REP(j, 0, 3) {
            REP(k, 0, 3) {
                if (k != j)
                    dp[i][j] = max(dp[i][j], dp[i - 1][k] + S[i][j]);
            }
        }
    }
    cout << max(max(dp[N - 1][0], dp[N - 1][1]), dp[N - 1][2]) << endl;

    return 0;
}

Measured memory_bytes: 11136
#include<iostream>

#define MOD 1000000007

using namespace std;

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

    long ans = 0;

    for(int i=0; i<60; i++){
        long pre = 1;
        long ones = 0;
        for(int j=0; j<N; j++){
            if((A[j] >> i) & 1){
                ones++;
            }
        }
        pre *= ((long)1<<i);
        pre %= MOD;
        pre *= ones;
        pre %= MOD;
        pre *= (N - ones);
        pre %= MOD;
        ans += pre;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using llong = long long;

void input(int& rnStair, vector<int>& rvnFine)
{
  int nFineSiz;
  cin >> rnStair >> nFineSiz;
  rvnFine.resize(rnStair + 1, true);

  for (int i = 0; i < nFineSiz; i++)
  {
    int nFine;
    cin >> nFine;
    rvnFine[ nFine ] = false;
  }
}

llong calcNumOfWays(int nStair, const vector<int>& cnrvnFine)
{
  const llong cnnMod = 1000000007;
  vector<llong> vnDPWays(nStair + 1);
  vnDPWays[0] = 1;

  for (int i = 1; i < vnDPWays.size(); i++)
    if (cnrvnFine[i])
    {
      vnDPWays[i] += vnDPWays[i - 1];
      if (i > 1)
        vnDPWays[i] += vnDPWays[i - 2];

      vnDPWays[i] %= cnnMod;
    }

  return vnDPWays[vnDPWays.size() - 1];
}
  
int main()
{
  int nStair;
  vector<int> vnFine;

  input(nStair, vnFine);
  cout << calcNumOfWays(nStair, vnFine) << endl;

  return 0;
}

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

#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(int i=a ; i<=b ; i++)
#define FORD(i,a,b) for(int i=a ; i>=b ; i--)
#define INF 1000000000
#define ll long long int
#define eps (1e-8)
#define sq(x) ( (x)*(x) )
#define all(x) x.begin(),x.end()
#define flog2(n) 64 - __builtin_clzll(n) - 1
#define popcnt(n) __builtin_popcountll(n)

using namespace std;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

ll d[100005][105][2];
string s;
int n;
int k;
const int K = 1e9 + 7;

ll calc(int i, int r, bool type) {
	if (i == n + 1) {
		if (r == 0) return 1;
		return 0;
	}

	if (d[i][r][type] != -1) {
		return d[i][r][type];
	}

	ll res = 0;

	if (type == 0) {
		FOR (digit, 0, 9) {
			res = (res + calc(i + 1, (r + digit) % k, 0)) % K;
		}
	}
	else {
		FOR (digit, 0, s[i] - '0') {
			bool newType = 0;
			if (digit == s[i] - '0') newType = 1;

			res = (res + calc(i + 1, (r + digit) % k, newType)) % K;
		}
	}

	return d[i][r][type] = res;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    
	cin >> s >> k;
	n = s.length();
	s = '*' + s;

	FOR (i, 1, 100000) {
		FOR (j, 0, 100) {
			FOR (k, 0, 1) d[i][j][k] = -1;
		}
	}

	cout << (calc(1, 0, 1) + K - 1) % K << endl;

    return 0;
}

Measured memory_bytes: 165248
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		int r = kb.nextInt();
		if(n >= 10) {
			System.out.println(r);
			return;
		} 
		int ans = r + 100*(10-n);
		System.out.println(ans);
	}
}


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

const int maxn = 1e5+5;
int N, A[maxn], B[maxn];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> N;
    for (int i = 1; i <= N+1; i++) {
        cin >> A[i];
    }
    for (int i = 1; i <= N; i++) {
        cin >> B[i];
    }
    ll ans = 0;
    for (int i = N; i >= 1; i--) {
        ll d = min(A[i+1],B[i]);
        A[i+1] -= d;
        B[i] -= d;
        ans += d;
        d = min(A[i],B[i]);
        A[i] -= d;
        B[i] -= d;
        ans += d;
    }
    cout << ans << '\n';
}



Measured memory_bytes: 1024
//#define NDEBUG
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
static constexpr double PI = 3.1415926535897932;

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;
using intl32 = std::int_least32_t;
using intl64 = std::int_least64_t;
using uintl32 = std::uint_least32_t;
using uintl64 = std::uint_least64_t;

template<class T>bool bmaxi(T&a, const T&b) { if (b<a)return 0;a = b;return 1; }
template<class T>bool bmini(T&a, const T&b) { if (a<b)return 0;a = b;return 1; }
template<class T>bool nmaxi(T&a, const T&b) { if (a<b) { a = b;return 1; }return 0; }
template<class T>bool nmini(T&a, const T&b) { if (b<a) { a = b;return 1; }return 0; }
template<typename T>auto scan(T&d)->typename std::enable_if<std::is_same<T, std::string
>::value>::type {
	d.clear();int c = fgetc(stdin);while (c<'a' || 'z'<c)c = fgetc(stdin);
	while ('a' <= c&&c <= 'z') { d.push_back(c);c = fgetc(stdin); }
}
template <typename T>auto scan(T&d)->
typename std::enable_if<std::is_same<T, double>::value>::type {
	scanf("%lf", &d);
}
template <typename T>auto scan(T&d)->typename std::enable_if<std::is_signed<T>::value
	== std::is_same<T, std::string>::value>::type {
	d = 0;int c = fgetc(stdin);
	while (c<'0' || '9'<c)c = fgetc(stdin);while ('0' <= c&&c <= '9') { d = d * 10 + c - '0';c = fgetc(stdin); }
}
template <typename T>auto scan(T&d)->typename std::enable_if<std::is_signed<T>::value
	!= std::is_same<T, double>::value>::type {
	d = 0;int c = fgetc(stdin);bool f = 0;while (c<'0' || '9'<c)
	{
		if (c == '-')f = 1;c = fgetc(stdin);
	}while ('0' <= c&&c <= '9') { d = d * 10 + c - '0';c = fgetc(stdin); }if (f)d = -d;
}
template<typename F, typename...R>void scan(F&f, R&...r) { scan(f);scan(r...); }



int main(void) {
	std::string s[3];
	scan(s[0], s[1], s[2]);
	printf("%c%c%c\n", s[0][0], s[1][1], s[2][2]);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
 int n,m,i,j,a[10000],key,dem=0;
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
  scanf("%d",&a[i]);
 }
 scanf("%d",&m);
 for(i=0;i<m;i++)
 {
  scanf("%d",&key);
   for(j=0;j<n;j++)
    {
     if(a[j]==key){
    dem++;
    break;
    }
   }
 }
 printf("%d\n",dem);
 return 0;
}

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

int main() {
    vector<string> s(3);
    cin >> s[0] >> s[1] >> s[2];
    vector<int> pos(3, 0);
    int now = 0;
    while (true) {
        if (pos[now] < s[now].size()) {
            now = s[now][pos[now]++] - 'a';
        } else {
            cout << (char)(now + 'A') << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
using namespace std;

typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int n; cin >> n;
    if(n >= 30) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

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

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

ll dp[101][30];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    dp[0][0] = 1;

    for (int i = 0; i < n - 1; i++)
    {
        for (int j = 0; j <= 20; j++)
        {
            if (0 <= j + a[i] && j + a[i] <= 20)
            {
                dp[i + 1][j + a[i]] += dp[i][j];
            }
            if (i != 0 && j - a[i] >= 0 && j - a[i] <= 20)
            {
                dp[i + 1][j - a[i]] += dp[i][j];
            }
        }
    }
    cout << dp[n - 1][a[n - 1]] << endl;
}


Measured memory_bytes: 3184
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, K;
  cin >> N >> K;

  vector<int> A(N+1);
  REP(i, N) cin >> A[i];

  vector<int> B(N+1);


  auto f = [&](){
    REP(i, N+1) B[i] = 0;
    REP(i, N){
      B[max(0ll, i-A[i])]++;
      B[min(N, i+A[i]+1)]--;
    }
    REP(i, N){
      B[i+1] += B[i];
    }
    REP(i, N){
      if(A[i] != B[i]){
        A = B;
        return true;
      }
    }
    return false;
  };
  
  REP(i, K){
    if(!f()) break;
  }

  REP(i, N){
    cout << A[i]; SPBR(i, N);
  }

  return 0;
}

Measured memory_bytes: 6368
import java.util.Scanner;

public class Main {
	static long INF = 10_000_000_000L;
	static int Max_N=110;
	static int Max_V=100100;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		long W = Integer.parseInt(sc.next());
		long[] weight = new long [Max_N];
		long[] value = new long[Max_N];
		long[][] dp = new long[Max_N][Max_V];

		for (int i = 0; i < n; i++) {
			weight[i] = Long.parseLong(sc.next());
			value[i] = Long.parseLong(sc.next());
		}
		sc.close();
	    // 初期化
		for (int i = 0; i < Max_N; i++) {
			for (int j = 0; j < Max_V; j++) {
				dp[i][j] = INF;
			}
		}
	    // 初期条件
	    dp[0][0] = 0;

		for (int i = 0; i < n; i++) {
	        for (int sum_v = 0; sum_v < Max_V; sum_v++) {
	            // i 番目の品物を選ぶ場合
	            if (sum_v - value[i] >= 0) {
	                dp[i+1][sum_v]=Math.min(dp[i+1][sum_v], dp[i][(int) (sum_v - value[i])] + weight[i]);
	            }
	            // i 番目の品物を選ばない場合
	            dp[i+1][sum_v] = Math.min(dp[i+1][sum_v], dp[i][sum_v]);
	        }
	    }
		long res = 0;
		for(int sum_v=0;sum_v<Max_V;sum_v++) {
			if(dp[n][sum_v]<=W)res=sum_v;
		}
		System.out.println(res);
	}

}

Measured memory_bytes: 127316
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a[50][3],b[50],num;
	char c[50];
	for(int i=0;i<50;i++){
		cin >> a[i][0] >> a[i][1] >> a[i][2];
		if(a[i][0]==-1 && a[i][1]==-1 && a[i][2]==-1) break;
		b[i]=a[i][0]+a[i][1];
		if(a[i][0]==-1 || a[i][1]==-1) c[i]='F';
		else if(b[i]>=80) c[i]='A';
		else if(b[i]>=65) c[i]='B';
		else if(b[i]>=50) c[i]='C';
		else if(b[i]>=30){
			c[i]='D';
			if(a[i][2]>=50) c[i]='C';
		}else c[i]='F';
		cout << c[i] << endl;
	}
}
		


Measured memory_bytes: 3084
num_input = int(input())

arr = [int(s) for s in input().split(' ')]

meet_cond = 0
for i in range(0, num_input-3+1):
    x, y, z = arr[i], arr[i+1], arr[i+2]

    if min(x, y, z) == y or max(x, y, z) == y:
        pass
    else:
        meet_cond += 1

print(meet_cond)


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader reader =  new BufferedReader(new InputStreamReader(System.in));

		while(true){

			String mes = reader.readLine();

			if(mes.equals("END OF INPUT"))	break;

			String[]	lists = mes.split((" "));

			for(String len : lists) System.out.print(len.length());
			System.out.println();
		}
	}
}

Measured memory_bytes: 9696
#include <bits/stdc++.h>
#define int long long
using namespace std;

int a[123456];

int32_t main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (int i = 1; i < n; ++i)
		a[i] += a[i - 1];
	int x, ans[2];
	ans[0] = x = 0;
	for (int i = 0; i < n; ++i) {
		if (i % 2) {
			if (a[i] + x >= 0)
				ans[0] += a[i] + x + 1, x -= a[i] + x + 1;
		} else {
			if (a[i] + x <= 0)
				ans[0] += - a[i] - x + 1, x += - a[i] - x + 1;
		}
	}
	ans[1] = x = 0;
	for (int i = 0; i < n; ++i) {
		if (i % 2 - 1) {
			if (a[i] + x >= 0)
				ans[1] += a[i] + x + 1, x -= a[i] + x + 1;
		} else {
			if (a[i] + x <= 0)
				ans[1] += - a[i] - x + 1, x += - a[i] - x + 1;
		}
	}
	cout << min(ans[0], ans[1]) << '\n';
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;
const LL mm = 1e9+7;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
  fio();
  int n,k; cin>>n>>k;
  vector<LL> pr(n+5,0),su(n+5,0);
  pr[0] = 0;
  for(LL i=1;i<=n;i++){
  	pr[i] = pr[i-1]+i;
  }
  su[n+1]= 0;
  for(LL i=n;i>=0;i--){
  	su[i] = su[i+1]+i;
  }
  LL an = 0;
  for(int i=k-1;i<=n;i++){
  	an =  (an - pr[i] + su[n-(i)] + 1LL)%mm;
  	an = (an+mm)%mm;
  	//cout<<pr[i]<<" "<<su[n+1-(i)]<<endl;
  }
  cout<<an%mm<<endl;
  return 0;
}



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

vector<int>to[105];
int main(){
  int n;
  cin>>n;
  rep(i,n){
    int u,k;
    cin>>u>>k;
    --u;
    rep(j,k){
      int v;
      cin>>v;
      --v;
      to[u].push_back(v);
      //to[v].push_back(u);
    }
  }
  queue<int>q;
  vector<int>dist(n,-1);
  dist[0]=0;
  q.push(0);
  while(!q.empty()){
    int v=q.front();q.pop();
    for(int u:to[v]){
      if(dist[u]!=-1)continue;
      dist[u]=dist[v]+1;
      q.push(u);
    }
  }
  rep(i,n)cout<<i+1<<" "<<dist[i]<<endl;
  return 0;
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
#define int long long
#define MOD 1e9+7
typedef pair<int,int> P;
typedef pair<int,P> PP;

signed main(){
  int n,k;
  cin>>n>>k;
  int ans=0;
  for(int i=1;i<n;i++){
    ans+=ans/(k-1)+1;
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3108
// A - HEX

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	char X, Y;
	cin >> X >> Y;

	string ans;
	if (X < Y) ans = "<";
	else if (X > Y) ans = ">";
	else ans = "=";

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10 ** 6)

class UnionFind(object):
    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]
        self.components = n

    def find(self, x):
        if self.parent[x] == x:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            elif self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.parent[y] = x
            self.size[x] += self.size[y]
            self.components -= 1

    def isSame(self, x, y):
        return self.find(x) == self.find(y)

    def getSize(self, x):
        return self.size(self.find(x))

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

edge = [] * M
uf = UnionFind(N)

for _ in range(M):
    x, y, _ = list(map(int, input().split()))
    uf.union(x-1, y-1)

print(uf.components)


Measured memory_bytes: 77472
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};


int main(){
    int A,B,C;cin >> A >> B >> C;
    int a = A-B;
    cout<<max(0, C-a)<<endl;
}


Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H,W,A,B;
    cin >> H >> W >> A >> B;
    ll ans[1010][1010];
    rep(i,0,H){
        rep(j,0,W){
            if(i < B){
                ans[i][j] = 0;
            }else{
                ans[i][j] = 1;
            }
        }
    }
    rep(j,0,W){
        rep(i,0,H){
            if(j < A){
                if(ans[i][j] == 1){
                    ans[i][j] = 0;
                }else{
                    ans[i][j] = 1;
                }
            }
        }
    }
    rep(i,0,H){
        rep(j,0,W){
            cout << ans[i][j];
        }
        cout << endl;
    }
    
    
}

Measured memory_bytes: 9088
a = list(map(int, input().split()))

i = 0
if i == 0:
    r = 0
    if a[0]==1 and a[1] == 1:
        r += 400000
    if a[1] ==1:
        r += 300000
    elif a[1] == 2:
        r += 200000
    elif a[1] == 3:
        r += 100000
    if a[0] ==1:
        r += 300000
    elif a[0] == 2:
        r += 200000
    elif a[0] == 3:
        r += 100000
    print(r)

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

using namespace std;
using ll = long long;
using ld = long double;

void solve() {
  int a, b;
  cin >> a >> b;

  if (a <= 9 && b <= 9) {
    cout << a * b << endl;
  } else {
    cout << -1 << endl;
  }
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


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

namespace test
{

    class Program
    {
        static int[] primeArray = new int[1000000];

        static void Main(string[] args)
        {
            SetPrime();

            List<int> list = new List<int>();
            string input;
            while ((input = Console.ReadLine()) != null)
            {
                int n = int.Parse(input);

                while (true)
                {
                    if (primeArray[n] != 0)
                    {
                        list.Add(primeArray[n]);
                        break;
                    }
                    else if(n<=1)
                    {
                        list.Add(0);
                        break;
                    }

                    n--;
                }

            }

            foreach (int a in list)
            {
                Console.WriteLine(a);
            }

        }


        static void SetPrime()
        {
            primeArray[2] = 1;
            int primeNum = 2;
            
            List<int> serchList = new List<int>();
            for (int i = 3; i <= 1000000; i+=2)
            {
                serchList.Add(i);
            }

            List<int> tmpList = new List<int>();
            while (true)
            {
                int prime = serchList[0];
                primeArray[prime] = primeNum;
                primeNum++;

                if (prime > Math.Sqrt(serchList[serchList.Count - 1]))
                {
                    break;
                }

                for (int k = 0; k < serchList.Count; k++)
                {
                    if (serchList[k] % prime != 0)
                    {
                        tmpList.Add(serchList[k]);
                    }
                }

                serchList = new List<int>(tmpList);
                tmpList.Clear();
            }

            for (int j = 1; j < serchList.Count; j++)
            {
                primeArray[serchList[j]] = primeNum;
                primeNum++;
            }

        }

    }
        
}

Measured memory_bytes: 21304
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>
using namespace std;

int main(int argc, const char * argv[]) {
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, x; cin >> n >> x;
    
    int pos = 0;
    int ans = 1;
    while (pos <= x && ans < n + 1) {
        int l; cin >> l;
        pos += l;
        if (pos <= x) ans++;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h> 
#include <vector>
#include <algorithm>
#include <iomanip>      // std::setprecision
#include <map>

using namespace std;

int main()
{

	double N, sol = 0;
	std::vector<std::pair<int, int>> coordinates;
	std::cin >> N;
	for (int i = 0; i < N; i++)
	{
		int x,y;
		std::cin >> x >> y;
		coordinates.push_back(std::make_pair(x, y));
	}
	double s = 0;
	std::vector<int> fact;
	for (int x = 0; x < N; ++x)
	{
		for (int y = 0; y < N; ++y)
		{
			if (y != x)
			{
				s += sqrt( (double)(pow((coordinates[x].first - coordinates[y].first), 2) + pow((coordinates[x].second - coordinates[y].second), 2)));
			}			
		}
	}

	sol = s/(double)N;

	std::cout << std::setprecision(10) << sol << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

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

using ll = long long int;
using pll = pair<ll, ll>;

ll N;

struct R { ll to, w; };
vector< vector<R> > RS;

const ll MAXN = 100001;
int C[MAXN];

std::queue<ll> Q;

int main()
{
    cin >> N;

    RS.assign(N, vector<R>());

    ll u, v, w;
    R r;

    rep(i, N - 1)
    {
        cin >> u >> v >> w;
        --u;
        --v;

        r.to = u;
        r.w  = w;
        RS[v].push_back(r);

        r.to = v;
        r.w  = w;
        RS[u].push_back(r);
    }

    fill(C, C + N, -1);

    Q.push(0);
    C[0] = 0;

    while(!Q.empty())
    {
        const ll index = Q.front();
        Q.pop();

        for (ll i=0,n=RS[index].size();i<n;++i)
        {
            const R& r = RS[index][i];
            if (C[r.to] != -1) { continue; }

            C[r.to] = (r.w % 2) == 0 ? C[index] : 1 - C[index];

            Q.push(r.to);
        }
    }

    rep(i, N)
    {
        cout << C[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 8320
#include<iostream>
using namespace std;
string s,t;
int N;
main()
{
	cin>>N;
	bool head=true;
	while(true)
	{
		bool now=false;
		for(int r=0;r<4;r++)
		{
			if(head)
			{
				cout<<(r&1?'#':'.')<<s<<endl;
				cout<<(r&2?'#':'.')<<t<<endl;
			}
			else
			{
				cout<<s<<(r&1?'#':'.')<<endl;
				cout<<t<<(r&2?'#':'.')<<endl;
			}
			string ans;cin>>ans;
			if(ans=="end")return 0;
			if(ans=="T")
			{
				now=true;
				if(head)
				{
					s=(r&1?"#":".")+s;
					t=(r&2?"#":".")+t;
				}
				else
				{
					s+=r&1?'#':'.';
					t+=r&2?'#':'.';
				}
				break;
			}
		}
		if(!now)head=!head;
	}
}


Measured memory_bytes: 724
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

const ll INF = 1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n);
	ll mx = -INF, mi = INF;
	int mxp = -1, mip = -1;
	rep(i,n){
		cin >> a[i];
		if(mx < a[i]){
			mx = a[i];
			mxp = i;
		}
		if(mi > a[i]){
			mi = a[i];
			mip = i;
		}
	}
	cout << 2 * (n-1) << endl;
	if(llabs(mx) > llabs(mi)){
		for(int i = 1; i < n; ++i){
			a[i] += mx * 2;
			mx = a[i];
			cout << mxp + 1 << " " << i + 1 << endl;
			cout << mxp + 1 << " " << i + 1 << endl;
			mxp = i;
		}
	}
	else{
		for(int i = n-2; i >= 0; --i){
			a[i] += mi * 2;
			mi = a[i];
			cout << mip + 1 << " " << i + 1 << endl;
			cout << mip + 1 << " " << i + 1 << endl;
			mip = i;
		}
	}
	return 0;
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    char c; cin >> c;
    if('a' <= c  && c <= 'z') cout << "a" << endl;
    else cout << "A" << endl;
    return 0;
}


Measured memory_bytes: 3632
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let r: usize = read().unwrap();
    println!("{}", r * r);
}

Measured memory_bytes: 4352
def primes_upto(m):
    _l = list(range(2, m+1))
    primes=[]
    while _l:
        p = _l[0]
        primes.append(p)
        _l=[n for n in _l if n%p]
    return primes

primes = primes_upto(55555)
A = [p for p in primes if p%5==1]

N=int(input())
print(' '.join([str(a) for a in A[:N]]))

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

int main() {
  int n;
  cin >> n;
  vector <int> d(n+1);
  for(int i; i<n; i++){
    cin >> d.at(i);
  }
  sort(d.begin(), d.end());
  int l;
  for(int i; i<n; i++){
    if(d.at(i)==d.at(i+1)){
      continue;
    }
    l++;
  }
  cout << l << endl;
}



Measured memory_bytes: 256
STR = input()
Q = int(input())
for _ in range(Q):
    com = input().split()
    if com[0] == 'print':
        a, b = int(com[1]), int(com[2])
        print(STR[a:b + 1])
    if com[0] == 'reverse':
        a, b = int(com[1]), int(com[2])
        STR = STR[:a] + STR[a:b + 1][::-1] + STR[b + 1:]
    if com[0] == 'replace':
        a, b, alt = int(com[1]), int(com[2]), com[3]
        STR = STR[:a] + alt + STR[b + 1:]


Measured memory_bytes: 5616
#include <bits/stdc++.h>
#define rep(a, b, c) for(int a = (b); a <= (c); ++ a)
#define per(a, b, c) for(int a = (b); a >= (c); -- a)
using namespace std;
template <class T> void rd(T &x){
  x = 0; int f = 1; char ch = getchar();
  while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); }
  while(ch >= '0' && ch <= '9') x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
  x *= f;
}

int n, k;

int main(){
  rd(n), rd(k);
  printf("%d\n", n - k + 1);
  return 0;
}


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

int main(void){
    int N, flag=0, count=0;
    cin >> N;
    for(int i=0; i<N; i++){
        int j, k;
        cin >> j >> k;
        if(j!=k){
            count=0;
        }else{
            count++;
            if(count==3){
                flag=1;
            }
        }
    }

    if(flag==1){
            cout << "Yes" << endl;
    }else{
            cout << "No" << endl;
    }

    return 0;

}

Measured memory_bytes: 3596
#include<iostream>
#include<string.h>
using namespace std;

int main()
{

  long long A,B,C,K;
  cin >> A >> B >> C >> K;
  
  if(K<=A)
  {
    cout << K;
    return 0;
  }
  K = K -A;
  if(K <= B)
  {
    cout << A;
    return 0;
  }
  K = K -B;
  cout << A -K;
  
  return 0;
}

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

int main () {
  int a, b;
  cin >> a >> b;

  cout << (((a & 1) && (b & 1)) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<string>
#include<vector>
#include<queue>

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

using namespace std;

typedef pair<int,int> pii;

int main(){
	int n,a,b,c,d,r[100];
	scanf("%d",&n);
	rep(i,n)r[i]=0;
	rep(i,(n-1)*n/2){
		scanf("%d%d%d%d",&a,&b,&c,&d);
		a--;b--;
		if(c==d){
			r[a]++;
			r[b]++;
		}else if(c>d) r[a]+=3;
		else r[b]+=3;
	}
	vector<pii> v;
	rep(i,n)v.push_back(pii(r[i],i));
	sort(v.rbegin(),v.rend());
	int cnt = 0;
	rep(i,n){
		if(i>0 && v[i].first==v[i-1].first)cnt++;
		else cnt=0;
		r[v[i].second]=i+1-cnt;
	}
	rep(i,n)
		printf("%d\n",r[i]);
	return 0;
}

Measured memory_bytes: 1040
#include <cstdio>
#include <algorithm>
#include <set>
using namespace std;
set<int> s1, s2;
int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 0; i < m; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        if(a > b) swap(a, b);
        if(a == 1) s1.insert(b);
        else if(b == n) s2.insert(a);
    }
    int ok = 0;
    for(set<int>::iterator it = s1.begin(); it != s1.end(); it++) {
        if(s2.count(*it)) { ok = 1; break; }
    }
    if(ok) printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");
    return 0;
}


Measured memory_bytes: 9600
time = [int(input()) for i in range(5)]
m = 0
ans = []
for i in time:
    if i%10 == 0:
        m += i
    else:
        m += ((i//10)+1)*10
for i in time:
    if i%10 != 0:
        k = m - ((i//10)+1)*10+i
        ans.append(k)
    else:
        ans.append(m)
print(min(ans))

Measured memory_bytes: 3060
// 基本テンプレート

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

signed main() {
    int N; cin >> N;
    map<int, int> m;
    rep(i,0,N) {
        int p; cin >> p;
        m[p]++;
    }

    bool ok = true;
    int M; cin >> M;
    rep(i,0,M) {
        int p; cin >> p;
        if(m[p] < 1) ok = false;
        else m[p]--;
    }

    cout << (ok ? "YES" : "NO") << endl;
    return 0;
}

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

int main() {
  const double pi=3.14159265358979;
  int a=0;
  int b=0;
  int h=0;
  int m=0;
  int time=0;
  double dif=0,sa=0,ans=0;
  cin >> a;
  cin >>b ;
  cin >>h;
  cin  >> m;
  time = h*60 + m;
  dif= time*5.5;
  
  int difa = dif;
  sa = dif -difa; 
  
  difa = difa % 360;
  
  dif= difa+sa;
  if(dif > 180){dif = 360-dif;}
  double kakudo=0;
  kakudo = (dif/180)*pi;
  
  ans= a*a+b*b-2*a*b*cos(kakudo);
  
  long double fans;
  fans = sqrt(ans);
  
  cout << fixed << setprecision(12);
  cout << fans << endl;
}


Measured memory_bytes: 4164
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
using namespace std;
#define eps 0.000001
#define LONG_INF 10000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 65536*16
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int a, b;
	cin >> a >> b;
	if (b % a == 0) {
		cout << a + b << endl;
	}
	else {
		cout << b - a << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1e9 + 7
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
int main() {
    int n;
    string ss;
    cin >> n;
    cin >> ss;
    if(n & 1) {
        cout << "No";
        return 0;
    }
    string mid = ss.substr(0, n / 2);
    string nd = ss.substr(n / 2, n / 2);
    // << mid << nd;
    if(mid == nd)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 256