akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class BStringsWithTheSameLength {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        string s, t;
        in >> n >> s >> t;

        string res = "";
        rep(i, n){
            res += s[i];
            res += t[i];
        }

        out << res << endl;
	}
};


int main() {
	BStringsWithTheSameLength solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <stack>
#include <string>
#include <iostream>
using namespace std;
 
int main() {
    stack<int> S,T;
    string geo;
    int i,sum,deepness,part;
    i = 0;
    sum = 0;
    deepness = 0;
    part = 0;
    cin >> geo;
    while(geo[i]!='\0') {
        //cout << i << endl;
        if(geo[i]=='\\') {
            if(i!=0) {
                if((geo[i-1] != '\\') && (part != 0) ) {
                    while((! T.empty())&& (deepness < T.top() )) {
                        T.pop();
                        int n = T.top();
                        T.pop();
                        part += n;
                    }
                    if(part !=0) T.push(part);
                    T.push(deepness);
                    part = 0;
                }
            }
            S.push(i);
            deepness +=1;
            //cout << deepness << endl;
        }
        else if(geo[i]=='/') {
            if(! S.empty()) {
                int k=S.top();
                S.pop();
                sum += i - k;
                part += i-k;
                deepness -= 1;
                //cout << deepness << endl;
            }
        }
        ++i;
    }
    cout << sum << endl;
    if(part !=0) {
        while((! T.empty()) && (deepness < T.top() )) {
            T.pop();
            int n = T.top();
            T.pop();
            part += n;
        }
        T.push(part);
        T.push(deepness);
        part = 0;
    }
    i =0;
    stack<int> INV;
    while (! T.empty()) {
        T.pop();
        int m=T.top();
        T.pop();
        INV.push(m);
        ++i;
    }
    cout << i;
    for(int l =0 ; l<i; ++l) {
        int m = INV.top();
        INV.pop();
        cout << " " << m;
    }
    cout << endl;
    return 0;
}

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

int main(){
    int n, a, ans, eqCount;
    vector<int> foo1, foo2;

    while( cin >> n , n ){
        ans = 0;
        foo1.clear();
        for(int i=0 ; i<n ; i++){
            cin >> a;
            foo1.push_back(a);
        }
        while( foo1 != foo2 ){
            ans++;
            foo2.clear();
            for(int i=0 ; i<foo1.size() ; i++){
                a = count( foo1.begin() , foo1.end() , foo1.at(i) );
                foo2.push_back(a);
            }
            swap( foo1 , foo2 );
        }
        cout << (ans-1) << endl;
        for(int i=0 ; i<foo2.size() ; i++){
            cout << foo2[i];
            ( i == foo2.size()-1 )? cout << endl : cout << " " ;
        }
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int num[100005],ans,n,k,sum;
int main(){

    while(1){
    cin >> n >> k;
    if(n==0&&k==0)break;
    for(int i=0;i<n;i++){
            cin >> num[i];
            if(k>i)sum+=num[i];
    }


    for(int i=k;i<n;i++){
        ans=max(ans,sum);
        //cout << "#" << sum << endl;
        sum-=num[i-k];
        sum+=num[i];
    }

    cout << ans << endl;
    ans=0;
    sum=0;
    }

return 0;
}

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

int main(){
	int L, A, B, C, D, ans = 0;
	cin >> L >> A >> B >> C >> D;
	for(int i=0 ; i < L ; i++ ){
		if( A <= 0 && B <= 0 ){
			ans++;
		}else{
			A -= C;
			B -= D;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1160
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;

#pragma endregion

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 




/*****************************************************************************/
int n, m;
vvi g;
vi dp;

int rec(int v) {
	if (dp[v] != -1)return dp[v];

	int res = 0;
	for (auto v2 : g[v]) {
		res = max(res, rec(v2) + 1);
	}
	return dp[v] = res;
}

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

	cin >> n >> m;
	g.assign(n + 1, vi());
	f(i, 0, m) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		g[x].push_back(y);
	}
	dp.resize(n);
	f(i, 0, n) {
		dp[i] = -1;
	}
	int ans = 0;
	f(i, 0, n) {
		ans = max(ans, rec(i));
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 8576
#include <stdio.h>

typedef long long ll;

int main(void)
{
	ll n, i = 0, cnt = 0, ans = 0;

	scanf("%lld", &n);

	for (i = 1; i <= n; i++)
		if (i % 3 && i % 5)
			++cnt, ans += i;
	
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <vector>

using namespace std;

void sort_and_print(vector<int>& a) {
	int nos = 0;
	int minj,size = a.size();
	for (int i = 0; i < size; ++i) {
		minj = i;
		for (int j = i; j < size; ++j) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		if (i != minj) {
			swap(a[i],a[minj]);
			++nos;
		}
	}
	for (int i = 0; i < size; ++i) {
		cout << a[i];
		if (i < size-1) {
			cout << " ";
		}
	}
	cout << endl;
	cout << nos << endl;
	return;
}

int main(void) {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort_and_print(a);
	return 0;
}



Measured memory_bytes: 3108
import java.util.*

fun main(args: Array<String>) {
  val (n, d) = readLine()!!.split(" ").map(String::toInt)
  val r = d * 2 + 1
  var ans = n / r
  if (n % r > 0)
    ++ans
  println(ans)
}

fun debug(vararg objs: Any) {
  System.err.println(Arrays.deepToString((objs)))
}

Measured memory_bytes: 37688
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

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


if(a == b + c || b == c + a || c == a + b) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
I, X, Y, n, m, rm, ans['   '];
main() {
  scanf("%d%d", &n, &m);
  for (; ~scanf("%d%d", &X, &Y);) {
    int b = Y + 1;
    for (int j = 1; j * j <= m; j++) {
      int tx = (X + j - 1) / j, ty = Y / j;
      ans[tx]++;
      ans[ty + 1 < b ? ty + 1 : b]--;
      b = tx;
    }
    for (I = 1; I < b; I++) {
      if ((X - 1) / I < Y / I) {
        ans[I]++;
        ans[I + 1]--;
      }
    }
  }
  for (I = 1; I <= m; I++) {
    ans[I] += ans[I - 1];
    printf("%d\n", ans[I]);
  }
}

Measured memory_bytes: 1280
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int main()
{
	int N, a[100010];
	cin >> N;
	int ans = 0;
	for (int i = 0; i < N; i++) cin >> a[i];
	for (int i = 0; i < N - 1; i++) {
		if (a[i] == i + 1) {
			swap(a[i], a[i + 1]);
			ans++;
		}
	}
	if (a[N - 1] == N) ans++;
	cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  ll a, b, m;
  cin >> a >> b >> m;
  vl A(a),B(b);
  vl AA(a),BB(b);
  ll ma = 1000001L,mb = 1000001L;
  rep(i,a){
    cin >> A[i];
    AA[i] = A[i];
    mins(ma,A[i]);
  }
  rep(i,b){
    cin >> B[i];
    BB[i] = B[i];
    mins(mb,B[i]);
  }

  ll ans = ma+mb;
  rep(i,m){
    ll x,y,c;
    cin >> x >> y >> c;
    x--;y--;
    mins(ans,A[x]+B[y]-c);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

const int MAX = 1e6+3;
const ll MOD = 1e6+3;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = (ll)fac[i - 1] * i % MOD;
    inv[i] = (ll)MOD - inv[MOD%i] * 1ll * (MOD / i) % MOD;
    finv[i] = (ll)finv[i - 1] * inv[i] % MOD;
  }
}

ll mod_pow(ll x, ll p){
  ll res = 1;
  while(p){
    if(p & 1) res = res*x%MOD;
    x = x*x %MOD;
    p>>=1;
  }
  return res;
}

int main(void){
  int Q;cin >> Q;
  COMinit();
  while(Q--){
    ll x,d,n;cin >> x >> d >> n;
    if(d==0){
      cout << mod_pow(x,n) << endl;
      continue;
    }
    x = x * inv[d]  % MOD;
    ll ans = mod_pow(d,n);
    if(x+n-1 >= MOD) cout << 0LL << endl;
    else{
      ans = ans * fac[x+n-1] % MOD;
      ans = ans * finv[x-1] % MOD;
      cout << ans << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 24320
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const long long MOD = 998244353;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
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();
}

//
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;
}
//

template <typename T>
T modpow(T m, T n, const T& p) {
  if (n == 0) return 1;
  T ret = modpow(m * m % p, n / 2, p);
  if (n % 2) ret *= m;
  return ret % p;
}

lint cnt[101010];
lint maxd = 0;

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

  int N;
  cin >> N;
  lint d;
  rep(i, N) {
    cin >> d;
    if (i == 0 && d != 0) {
      cout << 0 << endl;
      return 0;
    }
    if (i != 0 && d == 0) {
      cout << 0 << endl;
      return 0;
    }
    cnt[d]++;
    maxd = max(maxd, d);
  }

  lint ans = 1;
  for (int i = 1; i <= maxd; i++) {
    ans *= modpow(cnt[i - 1], cnt[i], MOD);
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}

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

int main()
{
  string S;
  unsigned int ans = 0;
  
  cin >> S;
  for (int i = 0; i < S.size()  / 2; i++) {
    if (S.at(i) != S.at(S.size() - i - 1)) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> v;
  unordered_map<long long, long long> mp3;
  unordered_map<long long, long long> mp;
  for(int i = 0;i < n;++i) {
    int x;
    cin >> x;
    v.push_back(x);
    mp[x]++;
    mp3[x]++;
  }
  sort(v.rbegin(), v.rend());
  long long ans = 0;
  for(int iii = 0;iii < n;++iii) {
	long long value = v[iii];
    
    mp[value]--;
    int ok = 1;
    if(mp3[value] == 1) {
      for(int64_t i = 1; i * i <= value; i++) {
      if(value % i == 0) {
        if(mp[i] > 0) {
ok = 0;
          break;
        }
        if(i * i != value){
        long long vv = value / i;
          if(mp[vv] > 0) {
 ok = 0;
            break;
          }
        }
      }
    }}else {ok = 0;}
    if(ok==1) ++ans;
    
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 41608
h,w,m = gets.strip.split.map(&:to_i)
hary = Array.new(h,0)
wary = Array.new(w,0)
rec = []
m.times do
  hn,wn = gets.strip.split.map(&:to_i)
  rec.unshift([hn,wn])
  hary[hn-1] += 1
  wary[wn-1] += 1
end
#入力完了
maxh = hary.max
maxw = wary.max

mhx = hary.each_index.select{|i| hary[i]==maxh}
whx = wary.each_index.select{|i| wary[i]==maxw}
#列番号や行番号になる、これはともに配列
mh = mhx.map{|z| z+1}
wh = whx.map{|z| z+1}

s = maxh + maxw
#重なる点の有無で場合わけ

cnt = 0
rec.each do |x,y|
  if hary[x-1] == maxh && wary[y-1] == maxw
    cnt += 1
  end
end
if cnt >= (mh.size)*(wh.size)
  puts s-1
else
  puts s
end
#こういう書き方もできる

Measured memory_bytes: 50456
#include<bits/stdc++.h>
using namespace std;
char str[3002],st[3002];
int visit[3001][3001];

int dp(int i, int j)
{

    if(str[i]=='\0' || st[j]=='\0')return 0;
    if(visit[i][j]!=-1)return visit[i][j];
    if(str[i]==st[j])return visit[i][j]=1+dp(i+1,j+1);
    else
    {
        int p=dp(i+1,j);
        int r=dp(i,j+1);
        return visit[i][j]=max(p,r);
    }
}

void print_lcs(int i, int j)
{
    if(str[i]=='\0' || st[j]=='\0')return;
    if(str[i]==st[j])
    {
        printf("%c",str[i]);
        print_lcs(i+1,j+1);
    }
    else
    {
        if(visit[i+1][j]>visit[i][j+1])print_lcs(i+1,j);
        else print_lcs(i,j+1);
    }
}

int main()
{
    int i;
    scanf("%s %s",str,st);
    memset(visit,-1,sizeof(visit));
    dp(0,0);
    print_lcs(0,0);
    printf("\n");
    return 0;
}


Measured memory_bytes: 35712
#include "bits/stdc++.h"
using ll = long long;
using namespace std;

ll f(ll n, ll x) {
   return n / x;
}

void solve() {
   ll a, b, x;
   cin >> a >> b >> x;
   ll ans = 0;
   if (a == 0) ans = 1, a++;
   ans += f(b, x) - f(a - 1, x);
   cout << ans << endl;

}

int main() {
   cin.tie(0);
   cin.sync_with_stdio(0);
   int testcase = 1;
   // cin >> testcase;

   for(int i = 0; i < testcase; i++) {
      solve();
   } 
   return 0;
}


Measured memory_bytes: 3644
#include<cstdio>
#include<queue>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<map>
#include<cmath>
#include<set>
using namespace std;
typedef long long int LL;
const int inf=1e9+10;
int main()
{
    char S[110];
    int K,len;
    scanf("%d%s",&K,S);
    len=strlen(S);
    if(K>=len)
    {
        printf("%s\n",S);
        return 0;
    }
    else
    {
        for(int i=0;i<K;i++)
            printf("%c",S[i]);
        printf("...\n");
        return 0;
    }
}

Measured memory_bytes: 3772
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var (D, T, S) = Read3Longs();
            if((double)D / (double)S > (double)T)
            {
                return "No";
            }
            return "Yes";
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 28244
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll a;
  cin >> a;
  cout << a + a * a + a * a * a << endl;
}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Scanner;

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

        int name[] = new int [5];
        Arrays.fill(name, 0);
        for (int i = 0; i < n; i++) {
            String s = in.next();
            if (s.charAt(0) == 'M') name[0]++;
            if (s.charAt(0) == 'A') name[1]++;
            if (s.charAt(0) == 'R') name[2]++;
            if (s.charAt(0) == 'C') name[3]++;
            if (s.charAt(0) == 'H') name[4]++;
        }

        long total = 0;
        for (int i = 0; i < 3; i++) {
            for (int j = i + 1; j < 4; j++) {
                for (int k = j + 1; k < 5; k++) {
                    total += (long)name[i] * name[j] * name[k];
                }
            }
        }

        System.out.println(total);
    }
}

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

int main(){
  double a, b, c, d, e, f;
  while(cin >> a >> b >> c >> d >> e >> f){
    double bb = b * d, cc = c * d;
    double ee = e * a, ff = f * a;
    double y = (cc - ff) / (bb - ee);
    double x = (c - b * y) / a;

    printf("%0.3f %0.3f\n", x, y);
  }
  return 0;
}



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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}


int N, M;
bool to_n[1000100];
vector<int> G[1000100];

int main(){
    

    cin >> N >> M;
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
        if(a == N){
            to_n[b] = true;
        }
        else if(b == N){
            to_n[a] = true;
        }
    }
    for(int to : G[1]){
        if(to_n[to]){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }

    cout << "IMPOSSIBLE" << endl;

}


Measured memory_bytes: 30960
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<map>
#include <algorithm>
#include<cstdlib>
#include<cmath>
#include<deque>
#include <numeric>
typedef long long ll;

int main() {
	
	ll n;
	std::string a, b,c;

	std::cin >> n >> a >> b >> c;

	ll tmps = 0;
	for( int i = 0 ; i < n ; ++i )
	{
		ll tmpss = 0;
		if(a[i] != b[i] )
		{
			tmpss++;
		}
		if (b[i] != c[i])
		{
			tmpss++;
		}
		if (c[i] != a[i])
		{
			tmpss++;
		}
		if (tmpss == 0)
		{
		}
		else if (tmpss == 1)
		{
		}
		else if (tmpss == 2)
		{
			tmps += 1;
		}
		else if (tmpss == 3)
		{
			tmps += 2;
		}

	}
	std::cout << tmps << std::endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

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

int main()
{
  int n, m, x;
  cin >> n >> m >> x;

  int c[100];
  int a[100][100];

  rep(i, n)
  {
    cin >> c[i];
    rep(j, m)
    {
      cin >> a[i][j];
    }
  }

  ll ans = iINF;

  for (int bit = 0; bit < (1 << n); ++bit)
  {
    int skill[100] = {0};
    vector<int> S;
    ll sum = 0;
    for (int i = 0; i < n; ++i)
    {
      if (bit & (1 << i))
      {
        rep(j, m)
        {
          skill[j] += a[i][j];
        }
        sum += c[i];
      }
    }

    bool flag = true;

    rep(i, m)
    {
      if (skill[i] < x)
      {
        flag = false;
      }
    }
    if (flag)
    {
      chmin(ans, sum);
    }
  }
  if (ans == iINF)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, cnt=0;
    cin>>n;
    string s;
    cin>>s;

    for(int i=0; i<s.size(); i++)
    {
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
}



Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int h, a; cin >> h >> a;
    cout << h / a + (h % a == 0? 0: 1) << '\n';
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	static class Pizza {
		int num;
		int money;

		Pizza(int n, int m) {
			this.num = n;
			this.money = m;
		}

		int getnum() {
			return num;
		}

		int getmoney() {
			return money;
		}
	}

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		// A B C X Y
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		int X = sc.nextInt();
		int Y = sc.nextInt();

		int A_B = A + B;

		Pizza p_B;
		Pizza p_S;

		if (X > Y) {
			p_B = new Pizza(X, A);
			p_S = new Pizza(Y, B);
		} else {
			p_S = new Pizza(X, A);
			p_B = new Pizza(Y, B);
		}

		int ans = 0;
		if (A_B > C * 2) {
			ans = C * p_S.getnum() * 2;
		} else {
			ans = A_B * p_S.getnum();
		}

		int n = p_B.getnum() - p_S.getnum();

		if (p_B.getmoney() > C * 2) {
			ans = ans + n * C * 2;
		} else {
			ans = ans + n * p_B.getmoney();
		}

		System.out.println(ans);
		sc.close();

	}
}


Measured memory_bytes: 22612
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;

void main(){
	auto ip = readln.split, s = ip[1];
	writeln("A", s[0], "C");
}

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

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

int main(void){

    string str;
    cin >> str;

    if(str.back()-'0' == 2 || str.back()-'0' == 4 || str.back()-'0' == 5 || str.back()-'0' == 7 || str.back()-'0' ==  9) cout << "hon" << endl;
    else if(str.back()-'0' == 0 || str.back()-'0' == 1 || str.back()-'0' == 6 || str.back()-'0' == 8) cout << "pon" << endl;
    else cout << "bon" << endl;

    return 0;
}


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

int main()
{
	int n,k;cin>>n>>k;
		int mi=1001010100;
	
	int h[n+1],dp[n+1];
	
	for(int i=0;i<n;i++)
{	cin>>h[i];dp[i]=mi;}
	
	dp[0]=0;dp[1]=abs(h[1]-h[0]);
	
	
	for(int i=2;i<n;i++)
	{
	
		for(int j=1;j<=k;j++)
		{	if(i<j)
		break;
		dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
		cout<<dp[n-1]<<endl;
	
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#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<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n, m;
    cin >> n >> m;
    ll x = 1 << m;
    ll ans = x * (100 * (n - m) + 1900 * m);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 764
import java.util.*;
import java.io.*;

/**
 * Made by egor https://github.com/chermehdi/egor.
 * 
 * @author Azuz
 */
public class Main {

    void solve(Scanner in, PrintWriter out) {
        boolean ans = false;
        int n = in.nextInt();
        while (n > 0) {
            if (n % 10 == 7) {
                ans = true;
                break;
            }
            n /= 10;
        }

        out.println(ans ? "Yes" : "No");
    }

    public static void main(String[] args) {
        try(Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
        }
    }
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cerr << (*begin) << " ";
    *begin++;
  }
  cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cerr << " " << Array[i][j];
    }
    cerr << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

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

int H, W, N;
int sy, sx;
string s, t;

bool solve(char cRight, char cLeft, int Max, int start) {
  int left = 1, right = Max;
  // 一番最後の手
  if (s[N-1] == cRight) right--;
  if (s[N-1] == cLeft) left++;

  for (int i = N-2; i >= 0; i--) {
    // 青木
    if (t[i] == cRight) {
      left = max(1ll, left - 1);
    }
    if (t[i] == cLeft) {
      right = min(Max, right + 1);
    }

    // 高橋
    if (s[i] == cRight) {
      right--;
    }
    if (s[i] == cLeft) {
      left++;
    }

    // 青木が移動できる範囲がなくなったら終了
    if (left > right) return false;
  }

  return left <= start and start <= right;
}

signed main() {
  cin >> H >> W >> N;
  cin >> sy >> sx;
  cin >> s >> t;

  bool a1 = solve('R', 'L', W, sx);
  bool a2 = solve('D', 'U', H, sy);
  bool ans = a1 and a2;

  puts(ans ? "YES" : "NO");

  return 0;
}

Measured memory_bytes: 776
def main():
  N,M,*alst=map(int, open(0).read().split())
  alst=set(alst)
  mod=10**9+7
  dp = [0] * (N+1)
  dp[:2] = [1, 1 if 1 not in alst else 0]
  for i in range(2, N+1):
    if i not in alst:
      dp[i] = (dp[i-2] + dp[i-1])%mod
  print(dp[N])
main()

Measured memory_bytes: 14180
#include <iostream>
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <cmath>

const double PI = atan(1) * 4;

using namespace std;

int main()
{
    double r;
    cin >> r;

    cout << setprecision(6) << fixed 
         << PI*r*r << ' ' 
         << 2*PI*r << endl;

}


Measured memory_bytes: 3284
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(void) {
    int m = -1;
    vector<int> num(3), diff;
    for (auto &n: num) {
        cin >> n;
        if (n >= m) m = n;
    }
    for (auto n: num) {
        if (n != m) {
            diff.push_back(m - n);
        }
    }

    if (diff.size() == 0) {
        cout << 0 << endl;
    } else if (diff.size() == 1) {
        cout << (diff[0] % 2 == 0 ? diff[0] / 2 : diff[0] / 2 + 2) << endl;
    } else {
        if (diff[0] % 2 == 0 && diff[1] % 2 == 0) {
            cout << (diff[0] / 2 + diff[1] / 2) << endl;
        } else if (diff[0] % 2 == 1 && diff[1] % 2 == 1) {
            cout << (min(diff[0], diff[1]) + abs(diff[0] - diff[1]) / 2) << endl;
        } else {
            cout << (min(diff[0], diff[1]) + abs(diff[0] - diff[1]) / 2 + 2) << endl;
        }
    }
}

Measured memory_bytes: 256
import collections
import math

N = int(input())
N = math.factorial(N)
INF = 10 ** 9 + 7

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

res = collections.Counter(prime_factorize(N))
keys = list(res.keys())
length = len(keys)
ans = 1
for i in range(length):
    ans = (ans * (res[keys[i]] + 1)) % INF
print(ans)

Measured memory_bytes: 39152
#include<iostream>
using namespace std;
int main(int argc, char const *argv[])
{
   string s;
   int n;
   cin >> n >> s;

   for(int i = 0; i < s.size(); i++)
   {
      s[i] = (s[i] - 'A' + n)%26 + 'A';
   }
   cout << s << endl;
   return 0;
}


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

int main(void){
    string s;
    cin >> s;
    if(s=="SUN") cout << 7 << endl;
    if(s=="MON") cout << 6 << endl;
    if(s=="TUE") cout << 5 << endl;
    if(s=="WED") cout << 4 << endl;
    if(s=="THU") cout << 3 << endl;
    if(s=="FRI") cout << 2 << endl;
    if(s=="SAT") cout << 1 << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<bitset>
int main()
{
	const int N=1000001;
	static std::bitset<N>p,c;
	int i,j,n,x,a[30],f;
	p.set();
	p[0]=p[1]=0;
	for(i=2;i<N/2;++i)if(p[i])for(j=2*i;j<N;j+=i)p[j]=0;

	while(scanf("%d%d",&n,&x),n)
	{
		for(i=0;i<n;++i)scanf("%d",&a[i]);
		c.reset();
		c[0]=1;
		for(i=0;i<n;++i)
		{
			for(j=0;j+a[i]<=x;++j)
			{
				if(c[j]) c[ j+a[i] ]=1;
			}
		}
		f=0;
		for(i=x;i>=0;--i)
			if(c[i]&&p[i])
			{
				f=1,x=i;
				break;
			}
		if(f) printf("%d\n",x);
		else puts("NA");
	}
	return 0;
}

Measured memory_bytes: 1016
#include<iostream>
int main()
{
	int a = 0, b = 0, c = 0;
	int i;
	int j = 0;
			std::cin >> a >> b >> c;
	for ( int i = a; i <= b; ++i )
	{
		    if ( c%i == 0 )
		    {
				++j;
			}
	}
	std::cout << j << std::endl;
	return 0;
}


Measured memory_bytes: 3100
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    a,b,c=list(map(int,input().split()))
    ans=0
    for x in range(a,b+1):
        if c%x==0:ans+=1
    print(ans)

main()



Measured memory_bytes: 5608
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
def dump(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' => '+repr(arg) for arg in args), file=sys.stderr)
# }}}

def local_input():# {{{
    from pcm.utils import set_stdin
    import sys
    from pathlib import Path
    parentdir = Path(os.path.dirname(__file__)).parent
    inputfile = parentdir.joinpath('test/sample-1.in')
    if len(sys.argv) == 1:
        set_stdin(inputfile)
# }}}

def solve():
    T, X = map(float, input().split())
    print(T/X)
    return 0

if __name__ == "__main__":# {{{
    try:
        local_input()
    except:
        pass
    solve()
# vim: set foldmethod=marker:}}}


Measured memory_bytes: 105068
// https://atcoder.jp/contests/arc068/tasks/arc068_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

#define isvisiblechar(c) (0x21 <= (c) && (c) <= 0x7E)
#define cin scanner
#define cout printer
namespace {
class MaiScanner {
  public:
    template <typename T> void input_integer(T &var) {
        var = 0;
        T sign = 1;
        int cc = getchar_unlocked();
        for (; cc < '0' || '9' < cc; cc = getchar_unlocked())
            if (cc == '-')
                sign = -1;
        for (; '0' <= cc && cc <= '9'; cc = getchar_unlocked())
            var = (var << 3) + (var << 1) + cc - '0';
        var = var * sign;
    }
    inline int c() { return getchar_unlocked(); }
    inline MaiScanner &operator>>(int &var) {
        input_integer<int>(var);
        return *this;
    }
    inline MaiScanner &operator>>(long long &var) {
        input_integer<long long>(var);
        return *this;
    }
    inline MaiScanner &operator>>(string &var) {
        int cc = getchar_unlocked();
        for (; !isvisiblechar(cc); cc = getchar_unlocked())
            ;
        for (; isvisiblechar(cc); cc = getchar_unlocked())
            var.push_back(cc);
        return *this;
    }
    template <typename IT> void in(IT begin, IT end) {
        for (auto it = begin; it != end; ++it)
            *this >> *it;
    }
};
class MaiPrinter {
  public:
    template <typename T> void output_integer(T var) {
        if (var == 0) {
            putchar_unlocked('0');
            return;
        }
        if (var < 0)
            putchar_unlocked('-'), var = -var;
        char stack[32];
        int stack_p = 0;
        while (var)
            stack[stack_p++] = '0' + (var % 10), var /= 10;
        while (stack_p)
            putchar_unlocked(stack[--stack_p]);
    }
    inline MaiPrinter &operator<<(char c) {
        putchar_unlocked(c);
        return *this;
    }
    inline MaiPrinter &operator<<(int var) {
        output_integer<int>(var);
        return *this;
    }
    inline MaiPrinter &operator<<(long long var) {
        output_integer<long long>(var);
        return *this;
    }
    inline MaiPrinter &operator<<(char *str_p) {
        while (*str_p)
            putchar_unlocked(*(str_p++));
        return *this;
    }
    inline MaiPrinter &operator<<(const string &str) {
        const char *p = str.c_str();
        const char *l = p + str.size();
        while (p < l)
            putchar_unlocked(*p++);
        return *this;
    }
    template <typename IT> void join(IT begin, IT end, char sep = ' ') {
        for (bool b = 0; begin != end; ++begin, b = 1)
            b ? *this << sep << *begin : *this << *begin;
    }
};
} // namespace
MaiScanner scanner;
MaiPrinter printer;

int main() {
    int n, t, sz = 0;
    cin >> n;
    bitset<100001> bt;
    REP(i, n) {
        cin >> t;
        if (!bt[t]) {
            sz++;
            bt.set(t);
        }
    }
    cout << sz - (sz % 2 == 0) << '\n';

    return 0;
}


Measured memory_bytes: 256
function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const A=input[0].split(' ')[0]-0;
  const B=input[0].split(' ')[1]-0;
  var i=0;
  while(Math.floor(i*0.08)!==A||Math.floor(i*0.1)!==B){
    i++;
    if(i===2000){
      console.log(-1);
      return;
    }
  }
  console.log(i);
}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  



  


Measured memory_bytes: 29852
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb push_back
#define mp make_pair
#define nt _ll128
#define ld double
long double PI =3.14159265;
using ll = long long;

const ll modo=1e9+7;
const ll ms=2e5+5;
const ll inf=1e17;

ll modpow(ll a, ll b)
{
    a%=modo;
    ll r=1;
    while(b)
    {
        if(b&1)
        {
            r=(r*a)%modo;
        }
        a=(a*a)%modo;
        b>>=1;
    }
    return r;
}

int main()
{
    idfc;

    ll n;
    cin>>n;


    ll a=modpow(10,n)+modpow(8,n);
    a=a+modo-modpow(9,n);
    a=a+modo-modpow(9,n);
    a%=modo;
    cout<<a;

    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll power(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)

//your code here!

int main(void){
    ll N, K;
	scanf("%lld %lld", &N, &K);
	printf("%lld\n", N%K ? 1: 0);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

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

using namespace std;
int main(void)
{
  for(;;){
    int n,m;
    cin >> n >> m;
    if(!n&&!m) return 0;
    vector<bool> infected;
    infected.assign(n+1,false);
    infected[1]=true;
    vector<pair<int,pair<int,int> > > sendlog;
    REP(i,m){
      int t,s,d;
      cin >> t >> s >> d;
      sendlog.push_back(make_pair(t,make_pair(s,d)));
    }
    SORT(sendlog);
    REP(i,sendlog.size())
      infected[sendlog[i].second.second]=infected[sendlog[i].second.second]||infected[sendlog[i].second.first];
    int answer=0;
    REP(i,infected.size()) if(infected[i]) ++answer;
    cout << answer << endl;
  }
}

Measured memory_bytes: 1684
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);		
		long a = sc.nextLong();		
		long b = sc.nextLong();
		long c =sc.nextLong();

		if(4*a*b<(c-a-b)*(c-a-b)&&c-a-b>0)
		System.out.println("Yes");
		else
		System.out.println("No");

	
	    
	}	
}

Measured memory_bytes: 22996
import java.security.SecureRandom;
import java.sql.Array;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        int count = 0;
//       if (s.charAt(0)=='R')count++;
//       else count=0;
//       if (s.charAt(1)=='R')count++;
//       else count=0;
//        if (s.charAt(2)=='R')count++;
//        else count=0;
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'R') count++;
            else count = 0;
            if (count > max) max = count;
        }

            System.out.println(max);

    }
    }


Measured memory_bytes: 35484
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1e9;
const long long INFL = 1LL<<60;
// https://youtu.be/ERZuLAxZffQ?t=4765
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

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

  mint dog = 1;
  mint ape = 1;
  for (int i = 1; i <= n; i++) {
    dog *= i;
  }
  for (int i = 1; i <= m; i++) {
    ape *= i;
  }
  mint ans = dog * ape;
  if (n == m) {
    ans *= 2;
  }

  cout << ans.x << endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [0]*N
L = [0]*N

for i in range(N):
    A[i] = int(input())

L = sorted(A)
mx1 = L[N-1]
mx2 = L[N-2]

for i in range(N):
    if A[i] == mx1:
        print(mx2)
    else:
        print(mx1)


Measured memory_bytes: 15012
# AOJ 1002: Extraordinary Girl I
# Python3 2018.7.5 bal4u

import sys
from sys import stdin
input = stdin.readline

INF = 0x7fffffff
cost = ((((0,3),(1,3)),((1,2),(1,2)),((2,2),(2,2))),
	    (((1,2),(1,2)),((0,1),(1,2)),((1,1),(2,2))),
	    (((2,2),(2,2)),((1,1),(2,2)),((0,1),(3,3))))

for cno in range(int(input())):
	n = int(input())
	n2 = n << 1
	shelf = [[0 for j in range(n+2)] for i in range(2)]
	p = input()
	for i in range(n2):
		if p[i] == 'Y': shelf[0][(i+1)>>1] = 1
	for i in range(n2):
		if p[n2+i] == 'Y': shelf[1][(i+1)>>1] = 1

	dp = [[INF for j in range(n+2)] for i in range(3)]
	dp[0][0] = 0
	for i in range(n+1):
		for j in range(9):
			dp[j%3][i+1] = min(dp[j%3][i+1], dp[j//3][i]+cost[j//3][j%3][shelf[0][i]][shelf[1][i]]+1)
	print(dp[0][n+1]-1)


Measured memory_bytes: 7188
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
#include<utility>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a[2];
  for(int i = 0; i < 2; i++) a[i].resize(n);
  for(int i = 0; i < 2; i++) for(int j = 0; j < n; j++) cin >> a[i][j];
  int dp[2][n + 1];
  for(int i = 0; i < 2; i++) for(int j = 0; j < n + 1; j++) dp[i][j] = 0;
  for(int i = 0; i < n; i++) dp[0][i + 1] = dp[0][i] + a[0][i];
  for(int i = 0; i < n; i++) dp[1][i + 1] = max(dp[0][i + 1], dp[1][i]) + a[1][i];
  cout << dp[1][n] << endl;
  return 0;
}


Measured memory_bytes: 256