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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int main(){
    ll n,k;cin>>n>>k;
    map<ll,ll>a,c;
    vl b(n);
    rep(i,n){
        cin>>b[i];b[i]--;
        a[i]=b[i];
    }
    ll x=0,cnt=0,s;
    while(true){
        c[x]++;
        if(c[x]==2){
            s=x;
            break;
        }
        x=a[x];
        cnt++;
        if(cnt==k){
            cout<<x+1<<endl;
            return 0;
        }
    }
    ll y=0,cnt1=0,r;
    while(true){
        if(y==s){
            r=cnt-cnt1;
            break;
        }
        y=a[y];
        cnt1++;
    }
    k-=cnt1;
    k=k%r;
    while(k>0){
        s=a[s];
        k--;
    }
    cout<<s+1<<endl;
}


Measured memory_bytes: 27104
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
using namespace std;

int main()
{
	string S;
	string Alpha = "abcdefghijklmnopqrstuvwxyz";

	cin >> S;

	sort(S.begin(), S.end());
	int count = 0;

	int i;
	for (i = 0; i < 32; i++)
	{
		count = 0;
		for (int j = 0; j < S.size(); j++)
		{
			if (S[j] == Alpha[i])
			{
				count++;
				break;
			}
		}
		if (count == 0)
			break;
	}

	if (i == 26)
		cout << "None"<< endl;
	else
		cout << Alpha[i] << endl;

	return 0;
}



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

int main() {
    string s, t; cin >> s >> t;

    int idx = -1;
    REP(i, 0, s.size() - t.size() + 1) {
        bool ok = true;
        REP(j, 0, t.size()) {
            if (s[i + j] != '?' && s[i + j] != t[j]) {
                ok = false;
                break;
            }
        }
        if (ok) idx = i;
    }

    if (idx == -1) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

    REP(i, 0, t.size()) s[i + idx] = t[i];

    REP(i, 0, s.size()) {
        if (s[i] == '?') s[i] = 'a';
    }

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
a= input()
n = len(a)
if n>1:
    for i in range(n-1):
        if a[i]==a[i+1]:
            print(i+1,i+2)
            exit()
if n>2:
    check = [0 for _ in range(26)]
    check[ord(a[0])-ord('a')]+=1
    check[ord(a[1])-ord('a')] += 1
    check[ord(a[2]) - ord('a')] += 1
    if check[ord(a[2]) - ord('a')] >=2:
        print(1,3)
        exit()
    for i in range(3,n):
        check[ord(a[i-3]) - ord('a')] -= 1
        next = ord(a[i]) - ord('a')
        check[next] += 1
        if check[next]>=2:
            print(i-1,i+1)
            exit()
print(-1,-1)

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

#define ll long long
#define MAX 1e18
int main() {
	
	int n,W;
	cin >> n >> W;
	
	ll int weight[n+1],value[n+1];
	
	ll int sum=0;
	
	for(int i=1;i<=n;i++)
	{
		cin >> weight[i] >> value[i];
		sum+=value[i];
	}
	
	
	
	
	ll int dp[n+1][sum+1];
	
	memset(dp,0,sizeof dp);
	
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=sum;j++)
		{
			if(j==0)
			{
				dp[i][j]=0;
			}
			else if(i==0)
			{
				dp[i][j]=MAX;
			}
			else
			{
				dp[i][j]=min(dp[i-1][j],weight[i]+dp[i-1][max(0ll,j-value[i])]);
			}
		}
	}
	
	for(int i=sum;i>=0;i--)
	{
		if(dp[n][i]<=W)
		{
			cout << i << endl;
			break;
		}
	}
	
	return 0;
}

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

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    int n, m;
    cin >> n >> m;
    cout << (n-1) * (m-1) << endl;
    return 0;
}

Measured memory_bytes: 768
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

n = gif
s = []
rep n do
  s << gsf
end

m = gif
t = []
rep m do
  t << gsf
end
list = (s + t).uniq
mx = 0
list.each do |l|
  mx = max mx,s.count(l)-t.count(l)
end
puts mx


Measured memory_bytes: 2300
import numpy as np
n,m=map(int,input().split())
A=list(map(int,input().split()))
A=sorted(A)
A=np.array(A, dtype=np.int64)
BC=[]
for _ in range(m):
    b,c=map(int,input().split())
    BC.append((b,c))
BC=sorted(BC,reverse=True, key=lambda x:x[1])
D=[]
cnt=0
for i in range(m):
    b,c=BC[i]
    cnt+=b
    D+=[c]*b
    if cnt>=n:
        break
if cnt>=n:
    D=D[:n]
else:
    D+=[0]*(n-cnt)
D=np.array(D, dtype=np.int64)

A=np.maximum(A,D)
print(np.sum(A))

Measured memory_bytes: 29148
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	string s;
  cin>>s;
  cout<<s[0]<<s.size()-2<<s.back()<<endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
template<class T> ostream& operator<<(ostream& os, vector<T> const& v){
    rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" ");
    return os;
}

template<class T, class U>
ostream & operator<<(ostream& os, pair<T,U> p){
    return os << "(" << p.first << " " << p.second << ")";
}

int x1[100010];
int x2[100010];
int y1_[100010];
int y2[100010];

int main(){
    int N,W,H;
    while(cin >> N >> W >> H && N){
        rep(i,N){
            int x,y,w; cin >> x >> y >> w;
            tie(x1[i],x2[i]) = mp(max(0,x-w),min(W,x+w));
            tie(y1_[i],y2[i]) = mp(max(0,y-w),min(H,y+w));
        }

        auto chk = [N](int * l, int * r, int ww){
            static int sum[100010];
            memset(sum,0,sizeof(sum));
            rep(i,N){
                sum[l[i]]++;
                sum[r[i]]--;
            }
            bool ok = true;
            int t = 0;
            rep(i,ww){
                t+=sum[i];
                if(t==0) ok = false;
            }
            return ok;
        };

        bool flg = chk(x1,x2,W) || chk(y1_,y2,H);
        puts(flg ? "Yes" : "No");
    }
}

Measured memory_bytes: 3068
/*************************************************************************
    > File Name: 1_1_D-2.cpp
    > Author: Wqr_
    > Mail: xueduanwei@126.com 
    > Created Time: Mon Oct 22 19:09:53 2018
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    int in[n];
    for(int i = 0; i < n; i++){
        cin >> in[i];
    }
    int maxv = -2000000000;
    int minv = in[0];
    for(int i = 1; i < n; i++){
        maxv = max(maxv, in[i] - minv);
        minv = min(minv, in[i]);
    }
    cout << maxv << endl;
    return 0;
}



Measured memory_bytes: 3868
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //string[] str = Console.ReadLine().Split(' ');
            //int n = int.Parse(Console.ReadLine());

            string str = Console.ReadLine();
            if (str == "ABC") Console.WriteLine("ARC");
            else Console.WriteLine("ABC");

            //ここまで
        }

        static long Max(long a, long b)
        {
            if (a > b) return a;
            else return b;
        }


    }

}


Measured memory_bytes: 25800
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>
#include <numeric>
#include <bitset>
#include <set>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define INPUT(x) scanf("%d",&x)
#define PUT(x) printf("%d",x)
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)
#define SP_END (i != n - 1 ? ' ' : '\n') ;

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };
const int disLD[3] = { 0,1,0 };

const char disC[4] = { 'U','D','R','L' };
const char disY[4] = { -1,1,0,0 };
const char disX[4] = { 0,0,1,-1 };

//最大公約数
ll gcd(ll a, ll b) {
	if (a%b == 0)
		return b;
	return gcd(b, a%b);
}

map<string, int> strs;

int main(void)
{

	ll N,M,answer = 0;
	cin >> N;

	FOR(i, N) {
		string s;
		cin >> s;
		strs[s]++;
	}

	cin >> M;

	FOR(i, M) {
		string t;
		cin >> t;
		strs[t]--;
	}

	for (const auto & t : strs) {
		answer = max(answer,(ll)t.second);
	}

	cout << answer << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define INF 0x3f3f3f3f
using namespace std;
int n,m,b[21],c,ans;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m>>c;
	for (int i=0;i<m;++i) cin>>b[i];
	for (int i=0;i<n;++i)
	{
		int a[21];
		ll sum=c;
		for (int j=0;j<m;++j) cin>>a[j],sum+=a[j]*b[j];
		if (sum>0) ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int N, A, x[51];
long long int memo[51][51][2501], ans;

// dp[j][k][s] := x[0],...,x[j]からk枚選んでx[i]の合計をsにするような選び方の総数
long long int dp(int j, int k, int s)
{
	if (memo[j][k][s] != -1) { return memo[j][k][s]; }
	if (j == 0 && k == 0 && s == 0)
	{
		return memo[j][k][s] = 1;
	}
	if (j >= 1 && s < x[j])
	{
		return memo[j][k][s] = dp(j - 1, k, s);
	}
	if (j >= 1 && k >= 1 && s >= x[j])
	{
		return memo[j][k][s] = (dp(j - 1, k, s) + dp(j - 1, k - 1, s - x[j]));
	}
	if (j == 0 && k == 1 && s == x[j])
	{
		return memo[j][k][s] = 1;
	}
	else
	{
		return memo[j][k][s] = 0;
	}
}

int main(void)
{
	scanf("%d%d", &N, &A);
	for (int i = 0; i < N; ++i) { scanf("%d", &x[i]); }

	memset(memo, -1, sizeof(memo));
	for (int k = 1; k <= N; ++k)
	{
		ans += dp(N - 1, k, k*A);
	}

	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 51072
#include <stdio.h>
int main(int argc, char const *argv[])
{
  int a,b,c,wa,seki;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  wa=a+b+c;
  seki=a*b*c;
  if(wa=17 && seki==175){
    printf("YES");
    return (0);
  }else{
    printf("NO");
    return (0);
  }
}

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

int main() {
   int n, k;
   cin >> n >> k;
   vector<int> h(n);
   rep(i, n) {
      cin >> h.at(i);
   }

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

    ll sum = 0;
   rep(i, n-k) {
       sum += h.at(i);
   }
   cout << sum << endl;
}

Measured memory_bytes: 1024
# =int(input())
x,y=map(int,input().split())
if x==1 and y==1:
    print(1000000)
else:
    res=0
    if x==1:
        res+=300000
    if x==2:
        res+=200000
    if x==3:
        res+=100000
    if y==1:
        res+=300000
    if y==2:
        res+=200000
    if y==3:
        res+=100000
    print(res)


Measured memory_bytes: 38384
import Data.List
main=getContents>>=mapM_ print.(\(x:_:xs)->map (h x) xs).map(map(read::String->Int).words).lines
  where h [a,b,c,d,e,f] x
          |i x s=a
          |i x t=b
          |i x u=c
          |i x(r u)=d
          |i x(r t)=e
          |i x(r s)=f
          where  i=isInfixOf
                 r=reverse
                 s=[b,c,e,d,b]
                 t=[a,d,f,c,a]
                 u=[a,b,f,e,a]

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

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

int main(){
  int n,k; cin >> n >> k;
  vector<int> v(n); cin >> v;
  vector<bool> dp(k+1,false);
  for(int i = 0; i <= k; ++i){
    for(int e : v){
      if(e <= i && (!dp[i-e])) dp[i] = true;
    }
  }
  cout << (dp[k] ? "First" : "Second") << endl;
  return 0;
}


Measured memory_bytes: 256
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define  mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    string o,e;cin>>o>>e;
    int i=0;
    while(i<o.length()||i<e.length()){
        if(i<o.length())
            cout<<o[i];
        if(i<e.length())
            cout<<e[i];
        i++;
    }
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#if 0
date +%Y.%m.%d

题解先咕着。
#endif
#include <cstdio>
#include <algorithm>
#include <vector>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 100005;
int head[maxn], nxt[maxn];

int dfs(int u) {
	std::vector<int> ve;
	for(int i = head[u]; i; i = nxt[i])
		ve.push_back(dfs(i));
	std::sort(ve.begin(), ve.end());

	int res = 0;
	for(int x : ve)
		res = std::max(x, res) + 1;
	return res;
}

int main() {
	int n = read;
	for(int i = 2; i <= n; i ++) {
		int f = read;
		nxt[i] = head[f];
		head[f] = i;
	}

	printf("%d\n", dfs(1));
}


Measured memory_bytes: 8832
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	ll N;
	cin >> N;
	double ans = 0;
	REP(i,N){
		double x;string u;cin>>x>>u;
		if (u=="JPY") ans += x;
		else ans += x * 380000;
	}
	
	//出力
	printf("%.6f\n", ans);
}


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

const int a[] = {1,3,5,7,8,10,12};
const int b[] = {4,6,9,11};
const int c[] = {2};

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

    int x,y;
    cin >> x >> y;
    int ch[100] = {};
    for(int i = 0; i < 7; i++) ch[a[i]] = 1;
    for(int i = 0; i < 4; i++) ch[b[i]] = 2;
    for(int i = 0; i < 1; i++) ch[c[i]] = 3;
    cout << (ch[x] == ch[y] ? "Yes" : "No") << endl;    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int[] dum = new int[n];

        int firstDum = 0;

        for (int i = 0; i < n; i++) {
            dum[i] = scanner.nextInt();

            if (i % 2 == 0) {
                firstDum += dum[i];
            } else {
                firstDum -= dum[i];
            }
        }

        System.out.print(firstDum);
        int dum2 = firstDum;
        for (int i = 0; i < n - 1; i++) {
            dum2 = 2*(dum[i] - dum2 / 2);
            System.out.print(" " + dum2);
        }
    }
}


Measured memory_bytes: 64108
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <string>
#define pb push_back
#define mod 1000000007
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long int ll;

int main(void){
  ll a,b,c;
  cin>>a>>b>>c;
  if(a%2==1 || b%2==1 || c%2==1) cout<<0<<endl;
  else if(a==b&&b==c) cout<<-1<<endl;
  else{
    ll res=0;
    while(a%2==0 && b%2==0 && c%2==0){
      ll x,y,z;
      x=b/2+c/2;
      y=a/2+c/2;
      z=a/2+b/2;
      a=x;b=y;c=z;
      res++;
    }
    cout<<res<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
bool isFound(vector<int> num,int s)
{
    int min = 0;
    int max = num.size();
    while (min <= max)
    {
        int mid = (min + max) / 2;
        if (num[mid] == s)
        {
            return true;
        }
        else if (num[mid] < s)
        {
            min = mid + 1;
        }
        else
        {
            max = mid - 1;
        }
    }
    return false;
}
int main()
{
    int n,s;
    cin >> s>>n;
    if(n==0)
    {
        cout << s<<"\n";
        return 0;
    }
    vector<int> num(n);
    for(int i = 0; i<n;i++)
    {
        cin >> num[i];
    }
    sort(num.begin(),num.end());
    int i = 0;
    while(true)
    {
        if(!isFound(num,s-i))
        {
            cout <<s-i<<"\n";
            return 0;
        }
        if(!isFound(num,s+i))
        {
            cout <<s+i<<"\n";
            return 0;
        }
        i++;
    }
    

}

Measured memory_bytes: 3632
import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

uf_t = numba.types.UniTuple(i8[:], 2)


@njit((uf_t, i8), cache=True)
def find_root(uf, x):
    root = uf[0]
    while root[x] != x:
        root[x] = root[root[x]]
        x = root[x]
    return x


@njit((uf_t, i8, i8), cache=True)
def merge(uf, x, y):
    root, size = uf
    x, y = find_root(uf, x), find_root(uf, y)
    if x == y:
        return False
    if size[x] < size[y]:
        x, y = y, x
    size[x] += size[y]
    root[y] = root[x]
    return True

@njit((i8[:], ), cache=True)
def build(raw_data):
    bit = raw_data.copy()
    for i in range(len(bit)):
        j = i + (i & (-i))
        if j < len(bit):
            bit[j] += bit[i]
    return bit


@njit((i8[:], i8), cache=True)
def get_sum(bit, i):
    s = 0
    while i:
        s += bit[i]
        i -= i & -i
    return s


@njit((i8[:], i8, i8), cache=True)
def add(bit, i, x):
    while i < len(bit):
        bit[i] += x
        i += i & -i


@njit((i8[:], i8), cache=True)
def find_kth_element(bit, k):
    N = len(bit)
    x, sx = 0, 0
    dx = 1
    while 2 * dx < N:
        dx *= 2
    while dx:
        y = x + dx
        if y < N:
            sy = sx + bit[y]
            if sy < k:
                x, sx = y, sy
        dx //= 2
    return x + 1

@njit((i8[:], ), cache=True)
def main(XY):
    N = len(XY) // 2
    root = np.arange(N + 1, dtype=np.int64)
    size = np.ones_like(root)
    uf = (root, size)

    XtoY = np.zeros(N + 1, np.int64)
    YtoX = np.zeros(N + 1, np.int64)
    for i in range(0, N + N, 2):
        x, y = XY[i:i + 2]
        XtoY[x] = y
        YtoX[y] = x

    # 残してある y 座標集合を bit で管理
    bit_raw = np.ones(N + 1, np.int64)
    bit_raw[0] = 0
    bit = build(bit_raw)
    rest_Y = np.ones(N + 1, np.int64)
    rest_Y_cnt = N
    for x in range(1, N + 1):
        y = XtoY[x]
        if not rest_Y[y]:
            continue
        k = get_sum(bit, y)
        largest_x = x
        for i in range(k + 1, rest_Y_cnt + 1):
            y1 = find_kth_element(bit, i)
            x1 = YtoX[y1]
            merge(uf, x, x1)
            largest_x = max(largest_x, x1)
        for i in range(k + 1, rest_Y_cnt + 1):
            y1 = find_kth_element(bit, k + 1)
            x1 = YtoX[y1]
            if x1 != largest_x:
                rest_Y[y1] = 0
                rest_Y_cnt -= 1
                add(bit, y1, -1)
        rest_Y[y] = 0
        rest_Y_cnt -= 1
        add(bit, y, -1)
    for i in range(0, N + N, 2):
        x, y = XY[i:i + 2]
        rx = find_root(uf, x)
        print(size[rx])

N = int(readline())
XY = np.array(read().split(), np.int64)

main(XY)

Measured memory_bytes: 135068
#coding: utf-8

S = str(input())
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

for i in range(2):
    for j in range(2):
        for k in range(2):
            A = int(S[0])
            B = int(S[1])
            C = int(S[2])
            D = int(S[3])

            B *= (-1) ** i
            C *= (-1) ** j
            D *= (-1) ** k
            if(A + B + C + D == 7):
                shiki = ''
                shiki += str(A)
                if(B<0):
                    shiki += str(B)
                else:
                    shiki += '+' + str(B)

                if(C<0):
                    shiki += str(C)
                else:
                    shiki += '+' + str(C)

                if(D<0):
                    shiki += str(D)
                else:
                    shiki += '+' + str(D)
                shiki += '=7'
                print(shiki)
                exit()

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        switch (s) {
            case  "SUN":
                System.out.println(7);
                return;
            case  "MON":
                System.out.println(6);
                return;
            case  "TUE":
                System.out.println(5);
                return;
            case  "WED":
                System.out.println(4);
                return;
            case  "THU":
                System.out.println(3);
                return;
                case  "FRI":
                System.out.println(2);
                return;
                case  "SAT":
                System.out.println(1);
                return;

        }
    }

}

Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
  int n;
  string s, t;
  cin >> n >> s >> t;
  int len = 0;
  string ans = s;
  for(int i = 0; i <= n; i++) {
    string tmp = s;
    if(i > 0){
      for(int j = n - i; j < n; j++){
        tmp += t[j];
      }
    }
    //cout << tmp << '\n';
    bool ok = false;
    for(int j = n - 1; j >= 0; j--) {
      if(t[j] == tmp[j + i]){
        ok = true;
        continue;
      }else{
        ok = false;
        break;
      }
    }
    if(ok){
      cout << tmp.length() << endl;
      return 0;
    }
  }
  
  return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int P[201010];
int C[201010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	for(i=2;i<=N;i++) {
		cin>>P[i];
		C[P[i]]++;
	}
	FOR(i,N) cout<<C[i+1]<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 5188
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <tgmath.h>
#define MOD 1000000007
using namespace std;
#define INT_MAX 2147000000
#define LONG_MAX 9223372036854775806

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    int a,b;
    cin >>a >> b;
    if(a<10&&b<10)cout << a*b << endl;
    else cout <<  -1 <<endl;
    return 0;
}

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

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s : &str = &read::<String>();  // &str型
    let t = &read::<String>();

    let mut count = 0;

    for i in 0..s.len()
    {
        // eprintln!("({}): {:x}, {:x}", i, s.as_bytes()[i], t.as_bytes()[i]);

        if s.as_bytes()[i] != t.as_bytes()[i]
        {
            count+=1;
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 2576
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
  int n;
  vector<int> ans;
  while(cin >> n,n){
    vector<int> c1(n,0),c2(n,0),c3(n,0),c4(n,0),c5(n,0);
    int point = 0;
    for(int i = n - 1;i >= 0;i--)cin >> c1[i] >> c2[i] >> c3[i] >> c4[i] >> c5[i];
    bool flag = 1;
    while(flag){
      flag = 0;
      for(int i = n - 1;i >= 0;i--){
        if((c1[i]||c2[i]||c3[i]||c4[i]||c5[i]) && c3[i] != 0){
          if(c1[i] == c2[i] && c1[i] == c3[i] && c1[i] == c4[i] && c1[i] == c5[i]){
            point += 5*c3[i];
            c1.erase(c1.begin()+i);
            c1.push_back(0);
            c2.erase(c2.begin()+i);
            c2.push_back(0);
            c3.erase(c3.begin()+i);
            c3.push_back(0);
            c4.erase(c4.begin()+i);
            c4.push_back(0);
            c5.erase(c5.begin()+i);
            c5.push_back(0);
            flag = 1;
          }
          else if(c1[i] == c2[i] && c1[i] == c3[i] && c1[i] == c4[i]){
            point += 4*c3[i];
            c1.erase(c1.begin()+i);
            c1.push_back(0);
            c2.erase(c2.begin()+i);
            c2.push_back(0);
            c3.erase(c3.begin()+i);
            c3.push_back(0);
            c4.erase(c4.begin()+i);
            c4.push_back(0);
            flag = 1;
          }
          else if(c2[i] == c3[i] && c2[i] == c4[i] && c2[i] == c5[i]){
            point += 4*c3[i];
            c2.erase(c2.begin()+i);
            c2.push_back(0);
            c3.erase(c3.begin()+i);
            c3.push_back(0);
            c4.erase(c4.begin()+i);
            c4.push_back(0);
            c5.erase(c5.begin()+i);
            c5.push_back(0);
            flag = 1;
          }
          else if(c1[i] == c2[i] && c1[i] == c3[i]){
            point += 3*c3[i];
            c1.erase(c1.begin()+i);
            c1.push_back(0);
            c2.erase(c2.begin()+i);
            c2.push_back(0);
            c3.erase(c3.begin()+i);
            c3.push_back(0);
            flag = 1;
          }
          else if(c2[i] == c3[i] && c2[i] == c4[i]){
            point += 3*c3[i];
            c2.erase(c2.begin()+i);
            c2.push_back(0);
            c3.erase(c3.begin()+i);
            c3.push_back(0);
            c4.erase(c4.begin()+i);
            c4.push_back(0);
            flag = 1;
          }
          else if(c3[i] == c4[i] && c3[i] == c5[i]){
            point += 3*c3[i];
            c3.erase(c3.begin()+i);
            c3.push_back(0);
            c4.erase(c4.begin()+i);
            c4.push_back(0);
            c5.erase(c5.begin()+i);
            c5.push_back(0);
            flag = 1;
          }
        }
      }
    }
    ans.push_back(point);
  }
  for(int i = 0;i < ans.size();i++)cout << ans[i] << endl;
}



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

int main()
{
    string x;
    int a = 0;
    cin >> x;
    for (int i = 0, j = x.size() - 1; i < j; i++, j--) {
        if (x[i] != x[j]) a++;
    }
    cout << a << "\n";
}


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

int main(int argc, char *argv[])
{
    int a, b, C;
    cin >> a >> b >> C;

    double S = (a * b * sin(M_PI * C / 180.0)) / 2.0;
    double L = sqrt(a * a + b * b - 2 * a * b * cos(M_PI * C / 180.0)) + a + b;
    double h = 2.0 * S / a;
    cout << fixed << setprecision(8) << S << endl << L << endl << h << endl;

    return 0;
}


Measured memory_bytes: 3480
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Atcoder
{
    class aaaa
    {
        static void Main(string[] args)
        {
            string[] rawinput = Console.ReadLine().Split(' ');

            int A = int.Parse(rawinput[0]);int B = int.Parse(rawinput[1]);int C = int.Parse(rawinput[2]);

            if ((A + B) >= C){
                Console.WriteLine("Yes");
            }else{
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 13140
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

int gcd(int x, int y)
{
	return (x) ? (gcd(y%x, x)) : (y);
}

int main()
{
	int s, n, a, d = 0;
	scanf("%d%d", &n, &s);
	for(int i=1; i<=n; i++)
	{
		scanf("%d", &a);
		d = gcd(d, abs(a-s));
	}
	printf("%d\n", d);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
using namespace std;

#define r(a) for(int a=0;a<10;a++)

int N,x[15],y[15],s[15],c[10][10];

bool paint(int i,int j,int s,int x,bool v){
    if(s==1)
        for(int p=i-1;p<=i+1;p++)
            for(int q=j-1;q<=j+1;q++){
                if(abs(p-i)+abs(q-j)==2)continue;
                if(!v){ if(!c[p][q])return 0; }
                else c[p][q]+=x;
            }
    if(s==2)
        for(int p=i;p<=i+2;p++)
            for(int q=j;q<=j+2;q++){
                if(!v){ if(!c[p][q])return 0; }
                else c[p][q]+=x;
            }
    if(s==3)
        for(int p=i-2;p<=i+2;p++)
            for(int q=j-2;q<=j+2;q++){
                if(abs(p-i)+abs(q-j)>2)continue;
                if(!v){ if(!c[p][q])return 0; }
                else c[p][q]+=x;
            }
    return 1;
}
bool dfs(int n){
    if(n==N){
        r(i)r(j)
            if(c[i][j])return 0;
        for(int i=0;i<n;i++)
            cout<<x[i]<<" "<<y[i]<<" "<<s[i]<<endl;
        return 1;
    }
    r(i)r(j){
        if(!c[i][j])continue;
        if(j>0&&j<9&&i<8)
            if(paint(i+1,j,1,0,0)){
                paint(i+1,j,1,-1,1);
                x[n]=j,y[n]=i+1,s[n]=1;
                if(dfs(n+1))return 1;
                paint(i+1, j, 1, 1,1);
            }
        if(i<8&&j<8)
            if(paint(i,j,2,0,0)){
                paint(i,j,2,-1,1);
                x[n]=j+1,y[n]=i+1,s[n]=2;
                if(dfs(n+1))return 1;
                paint(i, j, 2, 1,1);
            }
        if(j>1&&j<8&&i<6)
            if(paint(i+2,j,3,0,0)){
                paint(i+2,j,3,-1,1);
                x[n]=j,y[n]=i+2,s[n]=3;
                if(dfs(n+1))return 1;
                paint(i+2, j, 3, 1,1);
            }
        return 0;
    }
}
int main(){
    cin>>N;
    r(a)r(b)cin>>c[a][b];
    dfs(0);
}

Measured memory_bytes: 1168
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>

typedef long long ll;
typedef unsigned long long ull;
const ll LINF = 1e18;
const int INF = 1e8;

using namespace std;


//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用

char toChar(int a)
{
	char c = a + 48;
	return c;
}
bool notFinish = true;

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

	int tmp;
	cin >> tmp;

	vector<int> a(4);
	a[3] = tmp % 10;
	tmp /= 10;
	a[2] = tmp % 10;
	tmp /= 10;
	a[1] = tmp % 10;
	tmp /= 10;
	a[0] = tmp;

	string op;
	for (int bit = 0; bit < (1 << 3); bit++)
	{
		op = "";
		op.push_back(toChar(a[0]));
		int ans = a[0];

		for (int i = 0; i < 3; i++)
		{
			if ((bit >> i) % 2 == 0)
			{
				ans += a[i + 1];
				op.push_back('+');
				op.push_back(toChar(a[i + 1]));
			}
			else
			{
				ans -= a[i + 1];
				op.push_back('-');
				op.push_back(toChar(a[i + 1]));
			}
		}
		if (ans == 7)
		{
			break;
		}
	}

	cout << op << "=7" << endl;

}

Measured memory_bytes: 256
import itertools
from math import ceil
from decimal import Decimal

N = input()
N = int(N)
lasta,lastb = 1,1
temp = []
for _ in range(N):
    temp.append(list(map(int,input().split(" "))))


for hoge in temp:
    a,b = hoge
    diffa = ceil(Decimal(lasta)/Decimal(a))
    diffb = ceil(Decimal(lastb)/Decimal(b))
    diff = max(diffa,diffb)
    lasta,lastb = a*diff,b*diff
print(lasta+lastb)

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

bool isPrime(const ll n)
{
    if (n < 2) return false;
    if (n == 2) return true;

    bool flag = true;
    for (ll i = 2; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            flag = false;
            break;
        }
    }

    return flag;
}

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

    const ll MAXP = 55555;
    vector<ll> primeVec;
    REP(i, MAXP)
    {
        if(isPrime(i)) 
        {
            primeVec.push_back(i);
        }
    }
    vector<ll> ans;
    REPV(it, primeVec)
    {
        if (*it % 5 == 1)
        {
            ans.push_back(*it);
        }
    }
    REP(i, N)
    {
        cout << ans[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 3632
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

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

    List<Integer> sunukes = new ArrayList<>();
    int[] treat = new int[n];

    int count = 0;

    for (int i = 0; i < k; i++) {
      int d = sc.nextInt();
      for (int j = 0; j < d; j++) {
        sunukes.add(sc.nextInt());
      }
    }
    for (int sunuke : sunukes) {
      treat[sunuke - 1] = 1;
    }

    for (int num : treat) {
      if (num == 0) {
        count++;
      }
    }  

    System.out.println(count);

  }
}


Measured memory_bytes: 46384
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)

	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	y := getNextInt(scanner)

	fmt.Fprintln(writer, solve(n, y))
	writer.Flush()
}

func solve(n, y int) string {
	a := 0
	for i := 10000*n - y; i >= 0; i -= 5000 {
		if i%9000 == 0 && n-a-i/9000 >= 0 && a >= 0 && i/9000 >= 0 {
			return fmt.Sprintf("%d %d %d", n-a-i/9000, a, i/9000)
		}
		a++
	}
	return "-1 -1 -1"
}


Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
count = 0
roop = True

while roop == True:
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] /= 2
        else:
            roop = False
            break
            
    if roop == True:
        count += 1
print(count)



    

Measured memory_bytes: 9204
using System;
namespace _1{
    class program
    {
  
        static void Main()
        {
            string[] s = Console.ReadLine().Split();
            int a, b, c;
            a = int.Parse(s[0]);
            b = int.Parse(s[1]);
            c = int.Parse(s[2]);
            if(a < b && b < c)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            
           
        }
    }
}


Measured memory_bytes: 15956
#include "bits/stdc++.h"
using namespace std;
#define fastcin {\
    cin.tie(0);\
    ios::sync_with_stdio(false);\
}
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = a; i >= b; i--)
#define fore(i, a) for(auto &i:a)
#define print(x) cout << x << "\n"
#define SORT(a, n) sort(a, a+n);
#define REVERSE(a,n) reverse(a,a+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VREVERSE(v) reverse(v.begin(), v.end());
#define MOD 1000000007
#define yes "YES"
#define no "NO"
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

int main() {
    fastcin;
    int n, c[200] = {}, cm[200] = {}, ans = 0;
    string s;
    cin >> n >> s;
    rep(i, 0, n) {
        c[s[i]]++;
        cm[s[i]] = 1;
    }
    int maxa = 0;
    rep(i, 0, n-1) {
        if(cm[s[i]]==1) {
            ans++;
            cm[s[i]] = 0;
        }
        c[s[i]]--;
        if(c[s[i]]==0) {
            if(cm[s[i]]==0) ans--;
        }
        maxa = max(maxa, ans);
    }
    print(maxa);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
int main(void) {
	string str;
	int n;
	scanf("%d",&n);
	cin>>str;
	if(n % 2 != 0) printf("No\n");
	else {
		bool flag = true;
		int mid = (n >> 1) - 1;
//		printf("mid = %d\n",mid);
		for(int i = 0,j = mid + 1; i <= mid && j < str.length(); i ++,j ++) {
			if(str[i] != str[j]) {
				flag = false;
				break;
			}
		}
		if(flag) printf("Yes\n");
		else printf("No\n");
	} 
	return 0;
}

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

using i64 = long long;

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

int read() {
	int r = 0;
	while (true) {
		char c = getchar_unlocked();
		if (c == ' ' || c == '\n') {
			return r;
		} else {
			r = r * 10 + c - 48;
		}
	}
}

int A[100001];
signed main() {
	int n = read();
	REP(i, n + 1) {
		A[i] = read();
	}
	i64 s = 0;
	REP(i, n) {
		int b = read();
		int m = A[i] < b ? A[i] : b;
		s += m;
		b -= m;
		m = A[i + 1] < b ? A[i + 1] : b;
		s += m;
		A[i + 1] -= m;
	}
	printf("%lld", s);
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
using namespace std;
 
 ll mod=1e9 +7;
 
ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
 
vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

const ll M=200006;
ll f[M],inv[M];

void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%mod;
    }
    inv[M-1]=expo(f[M-1],mod-2,mod);
    for(ll i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%mod;
    }
}
ll C(ll n,ll r){
    return (1LL*((1LL*f[n]*inv[r])%mod)*inv[n-r])%mod;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    compute();
    // Sieve();
    ll tests=1;
    // cin>>tests;
    while(tests--)
    {
      ll i,j,k,n,ans=0;
      cin>>n>>k;
      vector<ll>v(k+1,0);
      for(i=k;i>=1;i--)
      {
        ll tmp=k/i;
        ll val=expo(tmp,n,mod);
        for(j=2LL*i;j<=k;j+=i)
        {
          val-=v[j];
          val=(val+mod)%mod;
        }
        val%=mod;
        v[i]=val%mod;
        ans+=(val*i)%mod;
        ans%=mod;

      }
      cout<<ans;

    }
    return 0;
   }

Measured memory_bytes: 18212