akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <random>
#include <ctime>
#include <utility>
#include <fstream>
#include <queue>
#include <deque>
 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("vpt")
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/STACK:256000000")
#pragma warning(disable:4996)
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
const ld pi = 3.14159265358979323846264;
const char el = '\n';
//const int inf = 1000'000'000;
const ll llinf = 1e18, mod = 1000'000'007;
 
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define firn(i, n) for (int i = 1; i < (int)n; ++i)
#define all(v) v.begin(), v.end()
#define x first
#define y second
 
template<typename T> bool uin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T> bool uax(T &a, T b) { if (b > a) { a = b; return 1; } return 0; }
template<class iterator> void output(iterator begin, iterator end, char p = ' ', ostream &out = cout) { while (begin != end) { out << (*begin) << p; begin++; } out << el; }
template<class T> void output(T x, char p = ' ', ostream &out = cout) { output(all(x), p, out); }
 
mt19937 rnd(time(NULL));
 
#define int ll

struct segment
{
    int l, r;
    segment() {}
    segment(int _l, int _r) {
        l = _l, r = _r;
    }
};

const int N = 100 * 1000 + 228;
const int INF = 1e9 + 228;

segment seg[N];
pair<int, int> a[N];
int b[N], suff[N];


signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin >> n;
    int res = 0;
    int maxl = 1, minr = 1;
    int max_len = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> seg[i].l >> seg[i].r;
        ++seg[i].r;
        uax(max_len, seg[i].r - seg[i].l);
        if (seg[i].l > seg[maxl].l) {
            maxl = i;
        }
        if (seg[i].r < seg[minr].r) {
            minr = i;
        }
    }
    uax(res, max_len + max(0LL, seg[minr].r - seg[maxl].l));
    if (minr == maxl) {
        cout << res << '\n';
        return 0;
    }
    for (int i = 1; i <= n; ++i) {
        a[i].first = max( seg[i].r - seg[maxl].l, 0LL );
        a[i].second = i;
        b[i] = max( seg[minr].r - seg[i].l, 0LL );
    }
    sort(a + 1, a + n + 1);
    reverse(a + 1, a + n + 1);
    suff[n + 1] = INF;
    for (int i = n; i; --i) {
        suff[i] = min(suff[i + 1], b[a[i].second]);
    }
    for (int i = 1; i < n; ++i) {
        uax(res, a[i].first + suff[i + 1]);
    }
    cout << res << '\n';
    return 0;
}
/*
<>>><<><<<<<>>><
0 3 2 1 0 1 2 0 1 2 3 4 5 2 1 0 1
0 3 2 1 0 1 2 0 1 2 3 4 5 3 2 0 1 

*/

Measured memory_bytes: 4992
def main():
    S = input()
    n = len(S)

    for i in range(1<<n-1):
        t = ''
        for j in range(n-1):
            t += S[j]
            if i & (1<<j):
                t += '+'
            else:
                t += '-'
        t += S[n-1]
        if eval(t) == 7:
            print(t+'=7')
            break


if __name__ == '__main__':
    main()

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll n,k;
ll p[5005];
ll c[5005];
ll step[5005];
ll dp[5005][5005];

// 2周以上なら最大か一歩手前
// 1周目が最大となる場合もある

ll now;
bool visited[5005];
void dfs(ll v, ll cost, ll cnt){
  if(!visited[p[v]]){
    visited[p[v]]=1;
    dp[now][cnt+1]=cost+c[p[v]];
    chmax(step[now],cnt+1);
    dfs(p[v], cost+c[p[v]], cnt+1);
  }
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  cin>>n>>k;
  rep(i,n) cin>>p[i], p[i]--;
  rep(i,n) cin>>c[i];
  
  rep(i,n){
    rep(j,n) visited[j]=0;
    now=i;
    dfs(i, 0, 0);
  }
  
  // rep(i,5){
  //   rep(j,5) cout<<dp[i][j]<<' ';
  //   cout<<endl;
  // }
  
  // rep(i,n) cout<<step[i]<<' ';
  // cout<<endl;
  
  
  ll ans=-LINF;
  rep(i,n){
    ll ma=-LINF;
    irep(j,1,min(step[i],k)+1) chmax(ma, dp[i][j]);
    if(chmax(ans, ma)){
      if(ans==29544642561){
        // cout<<'x'<<endl;
      }
    }
    
    if(step[i]<=k){
      {
        ll tmp=dp[i][step[i]]*(k/step[i]);
        ll ma=0;
        irep(j,1,k%step[i]+1) chmax(ma, dp[i][j]);
        if(chmax(ans, tmp+ma)){
          // if(ans==29544642561) cout<<'a'<<endl;
        }
      }
      {
        ll tmp=dp[i][step[i]]*(k/step[i]-1);
        if(chmax(ans, tmp+ma)){
          // if(ans==29544642561) cout<<"b"<<endl;
        }
      }
    }
    
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 199248
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm> 
#include<climits>
#include<queue>
using namespace std;
 
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef pair<int,int> P_ii;
typedef long long int ll;
const int mod = 1e9+7;
 
int main() {
    int N, K; cin >> N >> K;
    string S; cin >> S;

    vector<int> nums;    
    if (S[0] == '0') nums.push_back(0);
    for (int i = 0; i < S.size();) {
        int j = i;
        while (j < S.size() && S[j] == S[i]) ++j;
        nums.push_back(j - i);
        i = j;
    }
    if (S.back() == '0') nums.push_back(0);

    vector<int> sums((int)nums.size() + 1, 0);
    for (int i = 0; i < nums.size(); i++) sums[i+1] = sums[i] + nums[i];

    int res = 0;
    for (int left = 0; left < sums.size(); left += 2) {
        int right = left + K*2+1;
        if (right >= sums.size()) right = (int)sums.size() - 1;
        res = max(res, sums[right] - sums[left]);
    }
    cout << res << endl;
}

Measured memory_bytes: 1272
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

n = inp[0]
a = inp
t = na(n,0)
ans = 0
n.times do |i|
  t[i+a[i]] += 1 if(a[i]+i<n)
if(i-a[i]>=0)
  ans += t[i-a[i]]
end
end
p ans



Measured memory_bytes: 30580
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

#include <map>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    map<int,int> m;
    string s;
    cin >> s;
    for(auto &c: s) {
        m[c]++;
    }
    bool ok = m.size() == 2;
    for (auto &it : m) {
        ok &= (it.second == 2);
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 764
#include<stdio.h>
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  int i=1;
  for(;i*(i+1)/2<n;i++);
  int t=i*(i+1)/2-n;
  for(int j=1;j<=i;j++){
    if(j!=t)cout << j << endl;
  }
  return 0;
}

Measured memory_bytes: 256
//https://beta.atcoder.jp/contests/abc115/tasks/abc115_a
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};


int main(){
    int D;
    cin>>D;
    string ret="Christmas";
    for(int i:range(25-D))ret+=" Eve";
    cout<<ret<<endl;
    return 0;
}

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

typedef long long int ll;

#define endl '\n'
ll n;
vector < pair <ll,ll> > vec;


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

    cin>>n;

    for(ll i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        vec.push_back({a,b});
    }
    if(n==1){
        cout<<1<<endl;return 0;
    }
    vector < pair <ll,ll> > veco;
    map < pair <ll,ll> , ll> mop;
    for(ll i=0;i<n;i++){
        for(ll j=i+1;j<n;j++){

            mop[{vec[i].first-vec[j].first,vec[i].second-vec[j].second}]++;
            mop[{-vec[i].first+vec[j].first,-vec[i].second+vec[j].second}]++;
        }
    }
    ll co = INT_MAX;
    for(auto it=mop.begin();it!=mop.end();it++)
    {

        ll p = (it->first).first;
        ll q = (it->first).second;


        ll c = 0;
        map < pair <ll,ll> ,ll > mp;
        for(ll i=0;i<n;i++){
            for(ll j=i+1;j<n;j++){

                if(((vec[i].first - vec[j].first) == p ) and ((vec[i].second - vec[j].second) == q))
                {
                    mp[vec[i]]++;
                    mp[vec[j]]++;

                    c++;



                }
                else{
                   if(((vec[i].first - vec[j].first) == -p ) and ((vec[i].second - vec[j].second) == -q))
                    {
                        mp[vec[i]]++;
                        mp[vec[j]]++;

                        c++;
                    }
                }

            }
        }


        ll com = 0;
        for(auto it=mp.begin();it!=mp.end();it++){

            ll p1 = (it->first).first;
            ll q1 = (it->first).second;
            //cout<<p1<<" "<<q1<<endl;
            if(mp.find({p1-p,q1-q})!=mp.end()){

                if(mp.find({p1+p,q1+q})!=mp.end()){
                    com++;
                }

            }

        }
        //cout<<p<<" "<<q<<" "<<com<<endl;
        co = min(co,ll(n-mp.size()+max(0LL,((c)-com))));



    }
    cout<<max(0LL,co)<<endl;









}


Measured memory_bytes: 384
n,a,b=map(int,input().split())
s=input()
ct=0
jct=0
fct=0
for i in s:
    ct+=1
    if i=='a':
        if jct<(a+b):
            print('Yes')
            jct+=1
        else:
            print('No')
    elif i=='b':
        if (jct<(a+b))and(fct<b):
            print('Yes')
            fct+=1
            jct+=1
        else:
            print('No')
    else:
        print('No')

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

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

#define ll   long long 
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define S second
#define F first
#define die() return 0;


#define md          1000000007
#define fmd         998244353 
#define M           200011
#define N            18
ll exp(ll a,ll b){if(b<0)return 0;ll r=1;while(b){if(b&1)r=r*a%md,r%=md;a=a*a%md;b/=2;}return r;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}


ll F[M],iv[M];
void prec(){
    F[0]=iv[0]=1;
    for(int i=1;i<M;++i){
        F[i]=F[i-1]*i%md;F[i]%=md;
        iv[i]=iv[i-1]*exp(i,md-2)%md;iv[i]%=md;
    }
}
ll chose(ll n,ll k){
    if(n<k)return 0;
    ll r=F[n];r=r*iv[k];r%=md;r=r*iv[n-k];return r%md;
}


int solve(){
    ll n,i,j,k,m,x,y,z;
    ll p;
    cin>>n>>k;
    ll ans=0;
    for(i=0;i<=min(k,n);++i){
        x=chose(n,i);
        x=x*chose(n-1,n-i-1);x%=md;
        ans+=x;ans%=md;

    }cout<<ans<<"\n";





	die();

}
 
 
int main(){
 
 
#ifndef ONLINE_JUDGE
    double _tBeg=clock();
#endif

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

    int t;
    t=1;;
    prec();
    // cin>>t;
 
    while(t--){

        solve();
    }
 
 
 
 


#ifndef ONLINE_JUDGE
    double _tEnd=clock();
    // printf("\ntotal time %.6f\n",(_tEnd-_tBeg)/CLOCKS_PER_SEC);
#endif
 
    die();
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define MAX 3010
using namespace std;

int P;
int arr[MAX];
int brr[MAX];
int poly[MAX];

int add(int a, int b)
{
	return (a + b) % P;
}

int prod(int a, int b)
{
	return 1LL * a * b % P;
}

int power(int a, int n)
{
	if (!n) return 1;
	int mid = power(a, n / 2);
	mid = prod(mid, mid);
	if (n % 2) mid = prod(mid, a);
	return mid;
}

int inv(int a)
{
	return power(a, P - 2);
}

int main(void)
{
	cin >> P;
	for (int i = 0; i < P; i++)
	{
		int val;
		cin >> val;
		if (!val) continue;
		brr[1] = P - 1;
		brr[P] = 1;
		for (int j = P; j > 0; j--)
		{
			arr[j - 1] = brr[j];
			brr[j - 1] = add(brr[j - 1], prod(brr[j], i));
			brr[j] = 0;
		}
		for (int j = 0; j < P; j++) poly[j] = add(poly[j], prod(arr[j], P - 1));
	}
	for (int i = 0; i < P; i++) cout << poly[i] << " ";
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, k, n, w, ans = 0, count = 0;
  string s, t;
  cin >> s >> t;
  a = stoi(s + t);
  if ((int)sqrt(a) * (int)sqrt(a) == a)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import math
a, b, x = map(int, input().split())

def capa(theta):
    theta = theta*math.pi/180
    if math.tan(theta) < b/a:
        return a*a*(b - a*math.tan(theta)/2)
    else:
        return a*b*b/(2*math.tan(theta))

left = 0
right = 90
while right - left > 10**(- 7):
    mid = (left + right)/2
    if capa(mid) > x:
        left = mid
    else:
        right = mid
print((left + right)/2)

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int N;
queue<int> A[1010];
set<pii> se;

signed main() {
    cin >> N;
    rep(i, N) {
        rep(j, N - 1) {
            int a;
            cin >> a;
            --a;
            A[i].push(a);
        }
    }
    rep(i, N) {
        se.insert(pii(A[i].front(), i));
    }
    int m = 0;
    int ans = 0;
    vector<int> vec, vec2;
    rep(i, N) {
        vec2.push_back(i);
    }
    while (1) {
        for (int i:vec2) {
            if (A[i].empty())continue;
            if (se.count(pii(i, A[i].front()))) {
                m++;
                se.erase(pii(i, A[i].front()));
                se.erase(pii(A[i].front(), i));
                vec.push_back(i);
                vec.push_back(A[i].front());
            }
        }
        for (int i:vec) {
            A[i].pop();
            if (A[i].empty())continue;
            se.insert(pii(A[i].front(), i));
        }
        ans++;
        if (m == N * (N - 1) / 2)break;
        if (vec.empty()) {
            cout << -1 << endl;
            return 0;
        }
        swap(vec, vec2);
        vec.clear();
    }
    cout << ans << endl;
    return 0;
}


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

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

    string res = "";
    for(int i=0; i<(int)s.length(); ++i){
        char c = s[i];
        if(c == '0')
            res += "0";
        else if(c == '1')
            res += "1";
        else if(c == 'B'){
            res = res.substr(0, res.length() - 1);
        }
            
    }
    cout << res << endl;
}


Measured memory_bytes: 256
n = input()

l = [9, 909, 90909]
ans = 0
if len(n) == 1:
    ans = int(n)
elif len(n) != 1 and len(n) % 2 == 1:
    ans = int(n) - 10 ** (len(n) - 1) + 1 + l[len(n) // 2 - 1]
else:
    ans =  l[len(n) // 2 - 1]

print(ans)


Measured memory_bytes: 61772
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
  int A,B,X;
  char str[100],*p;
  
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  A=atoi(p);
  p=strtok(NULL," \n");
  B=atoi(p);
  p=strtok(NULL," \n");
  X=atoi(p);
  
  if(X<=A+B && X>=A){
   printf("YES\n");
    return 0;
  }else{
   printf("NO\n");
    return 0;
  }
  
  
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main(){
    int n,m;//n:?????°???m:?????????????????????????????????
    scanf("%d %d",&n,&m);
    int dp[n][m+1];
    int v[n],w[n];//v:??????,w:??????
    int i,j;
    for(i=0;i<n;i++){
        scanf("%d %d",&v[i],&w[i]);
    }
    for(i=0;i<n;i++){
        for(j=0;j<=m;j++){
            dp[i][j]=0;
        }
    }
    for(i=w[0];i<=m;i++){
        dp[0][i]=v[0];
    }
    int a;//????????¨
    for(i=1;i<n;i++){
        for(j=0;j<=m;j++){
            a=0;
            if(j>=w[i]){
                a=dp[i-1][j-w[i]]+v[i];
            }
            dp[i][j]=dp[i-1][j]>a?dp[i-1][j]:a;
        }
    }
    printf("%d\n",dp[n-1][m]);
    return 0;
}

Measured memory_bytes: 6632
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    LLONG a, b, c; cin >> a >> b >> c;
    LLONG left = 4 * a * b;
    LLONG right = a * a + b * b + c * c
        + 2 * a * b - 2 * a * c - 2 * b * c;
    if (a + b < c && left < right)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
}


Measured memory_bytes: 256
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.split(/ |\n/),
    cid = 0;

function next() {
    return +cin[cid++];
} // number一個取得
function nextstr() {
    return cin[cid++];
} // 文字列一個取得
function nextbig() {
    return BigInt(cin[cid++]);
} // BigInteger一個取得
// 長さnの配列として取得。aは文字列フラグ
function nexts(n, a) {
    return a ? cin.slice(cid, cid += n) : cin.slice(cid, cid += n).map(a => +a);
}
// 長さnのBigInt配列として取得。
function nextsbig(n) {
    return cin.slice(cid, cid += n).map(a => BigInt(a));
}
// w個ずつを組にして長さhの配列。aは文字列フラグ。
function nextm(h, w, a) {
    var r = [],
        i = 0;
    if (a)
        for (; i < h; i++) r.push(cin.slice(cid, cid += w));
    else
        for (; i < h; i++) r.push(cin.slice(cid, cid += w).map(a => +a));
    return r;
}
// 多次元配列。v,a1,a2,a3 なら、3次元。[[値vで長さa3の配列]をa2個並べた配列]をa1個並べた配列。
function xArray(v) {
    var a = arguments,
        l = a.length,
        r = "Array(a[" + --l + "]).fill().map(x=>{return " + v + ";})";
    while (--l) r = "Array(a[" + l + "]).fill().map(x=>" + r + ")";
    return eval(r);
}


console.log(main().toString());

function main() {
    let s = nextstr().split("").sort().join();
    let t = nextstr().split("").sort().reverse().join();


    return s < t ? 'Yes' : 'No'

}

Measured memory_bytes: 7500
#include <iostream>
#include <vector>
#include <set>
#include <utility>
#include <algorithm>

using namespace std;

typedef pair<int,int> pii;
#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

int main(){
    int n, m;
    while(cin>>m, m){
        vector<pii> p(m);
        for(int i=0; i<m; i++) cin >> p[i].first >> p[i].second;
        // C++11 ならこう書ける↓
        // for(auto& e:p) cin >> e.first >> e.second;
        // repマクロを使うとこう書ける↓
        // rep(i,m) cin >> p[i].first >> p[i].second;

        cin >> n;
        vector<pii> q(n);
        for(int i=0; i<n; i++) cin >> q[i].first >> q[i].second;

        // sortが使える条件は，要素の型に対する比較演算子"<"が定義されていること↓
        sort(q.begin(), q.end());
        // binary_search, set, priority_queue などでも同様
        // pair の演算子は定義されているので不要だが，
        // 自作の構造体を格納するコンテナでこれをやるときは
        // 演算子を定義するか，第3引数に演算子として使う関数を渡すかしなければいけない
        // 面倒なので pair や C++11 で追加された tuple を使うのが楽

        int ax=-1, ay=-1;
        rep(i,n){
            int dx = q[i].first - p[0].first;
            int dy = q[i].second - p[0].second;
            bool ok = true;
            rep(j,m){
                pii t(p[j].first + dx, p[j].second + dy);
                if(!binary_search(q.begin(), q.end(), t)){
                    ok = false;
                    break;
                }
            }
            if(ok){
                ax = dx;
                ay = dy;
            }
        }

        cout << ax << " " << ay << endl;
    }
}

Measured memory_bytes: 1208
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] array = scanner.next().toCharArray();
			Map<Character, Integer> map = new HashMap<>();
			map.put('0',0);
			map.put('1',0);

			for (char c : array) {
				if (map.containsKey(c)) {
					map.put(c, map.get(c)+ 1);
				}
			}
			System.out.println(map.get('1'));
		}
	}
}


Measured memory_bytes: 21844
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int i=1,num;
		while(true){
			num=sc.nextInt();
			if(num!=0){
				System.out.printf("Case %d: %d\n",i++,num);
			}
			else{
				break;
			}
		}
	}
}


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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  long double a, b;
  cin >> a >> b;
  long double c = log10(a);
  long double d = log10(b);
  if (c == d) {
    cout << "EQUAL" << endl;
  } else if (c > d) {
    cout << "GREATER" << endl;
  } else if (c < d) {
    cout << "LESS" << endl;
  }
  return 0;
}


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


// 公舎の入居者数
public class Main {

	private static int inputRecord;
	private static int[][][] houseInfo = { { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
														  { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
														  {	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
														  { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } };

	public static void main(String [] args) {
		
		// input
		getInfo();
		
		// output
		printInfo();
		
	}
	
	// input
	public static void getInfo() {
		
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
			// 入力件数
			inputRecord = Integer.parseInt(br.readLine());
			// 各棟の情報
			for (int i = 0; i < inputRecord; i++) {
				String[] baseInfo = br.readLine().split(" ");
 				int b = Integer.parseInt(baseInfo[0]) - 1; // 棟
 				int f = Integer.parseInt(baseInfo[1]) - 1; // 階
 				int r = Integer.parseInt(baseInfo[2]) - 1; // 部屋
 				int v = Integer.parseInt(baseInfo[3]); // 人数
				// 現在の人数
				int currentV = houseInfo[b][f][r];
				int  newV= currentV + v;
				if (newV < 0 || newV > 9) {
					System.out.printf("入居者数が不正です。（０人より少ないor９人より多い）\n");
					return;
				}
				houseInfo[b][f][r] = newV;
			}
		} catch (IOException e){
			System.out.println(e);
		}
	}

	// output
	public static void printInfo() {
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
						System.out.printf(" %d",houseInfo[i][j][k]);
				}
				System.out.printf("\n");
			}
			if (i < 3) {
				System.out.printf("####################\n");
			}
		}
	}
}


Measured memory_bytes: 25588
#define _CRT_SECURE_NO_WARNINGS
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


#define MOD 1000000007



long long dp[41][1 << 16];

int trash[1 << 16];



int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, x, y, z;
	cin >> n >> x >> y >> z;
	const int haiku = (1 << x - 1) | (1 << x + y - 1) | (1 << x + y + z - 1);

	for (int i = 1; i < (1 << x + y + z - 1); i++) {
		int a = i;
		int n = x + y + z - 1;
		while ((a & 1 << x + y + z - 1) == 0) {
			a = a << 1 | 1;
			n--;
		}
		if ((a&haiku) != haiku) trash[i] = trash[i&~(1 << n)];
		else trash[i] = i;
	}

	const int mask = ((1 << x + y + z - 1) - 1);
	dp[0][0] = 1;
	rep(i, n) {
		rep(j, 1 << x + y + z - 1) if (dp[i][j]) {
			dp[i][j] %= MOD;
			for (int a = 1; a <= 10; a++) {
				int b = j << a | 1 << a - 1;
				if ((b&haiku) != haiku) {
					dp[i + 1][trash[b&mask]] += dp[i][j];
				}
			}
		}
	}

	long long ans = 1;
	rep(i, n)(ans *= 10) %= MOD;
	rep(i, 1 << x + y + z - 1) {
		(ans -= dp[n][i]) %= MOD;
	}
	ans += MOD;
	ans %= MOD;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 16256
#include <bits/stdc++.h>
using namespace std;
int mod=1e9+7;
const int N=1005;
char a[N][N];
int cache[1005][1005];
int h,w;
int dp(int i,int j)
{
    if(i==h && j==w)
    return 1;
    int &ans=cache[i][j];
    if(ans!=-1)
    return ans;
    ans=0;
    if(i<h && j<w)
    {
        if(a[i][j-1]=='.' && a[i-1][j]=='.')
        ans=(dp(i+1,j)%mod+dp(i,j+1)%mod)%mod;
        else if(a[i][j-1]=='.')
        ans=dp(i+1,j)%mod;
        else if(a[i-1][j]=='.')
        ans=dp(i,j+1)%mod;
    }
    else if(i<h  && a[i][j-1]=='.')
    ans=dp(i+1,j)%mod;
    else if(j<w && a[i-1][j]=='.')
    ans=dp(i,j+1)%mod;
    return ans;
}
int main()
{
    cin>>h>>w;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        cin>>a[i][j];
    }
    memset(cache,-1,sizeof(cache));
    cout<<dp(1,1);
    return 0;
}

Measured memory_bytes: 5248
#include <iostream>
//#include <conio.h>
#include <vector>
#include <algorithm>
using namespace std;

int f[200][200];
int help[200][200];


int main()
{
	int n, m;
	cin >> n >> m;
	vector < vector<int> > gr(n);

	int u, v, cost;

	for (int i = 0; i < m; ++i)
	{
		cin >> v >> u >> cost;
		gr[v].push_back(u);
		gr[u].push_back(v);
		help[v][u] = cost;
	}
	int kk = help[0][1];
	int res = 0;
	for (;;)
	{
		int c = 1000000000;// c min

		vector<int> ans(n, -1);
		int q[200];
		vector<bool>used(n);
		int st = 0;
		int end = n - 1;
		int v = st;
		int h = 0, t = 0;
		q[t++] = st;
		while (h < t && v != end)
		{
			v = q[h++];
			for (int i = 0; i < gr[v].size(); ++i)
			{
				if (used[gr[v][i]] == false && help[v][gr[v][i]] - f[v][gr[v][i]] > 0)
				{
					q[t++] = gr[v][i];
					used[gr[v][i]] = true;
					ans[gr[v][i]] = v;
				}
			}
		}



		if (ans[end] != -1) //???????? ???????????????????? ???????? ?´?? ?????????°
		{
			int last = end;
			while (last != st)
			{
				if (help[ans[last]][last] - f[ans[last]][last] < c)
					c = help[ans[last]][last] - f[ans[last]][last]; //???????? ???° ???°?????? ???????? c min
				last = ans[last];
			}

			last = end;
			while (last != st)
			{
				f[ans[last]][last] += c;
				f[last][ans[last]] -= c;
				last = ans[last];
			}
			res += c;
		}
		else
			break;//?????????´???? ???? ???????????° 
	}
		
		/*for (int i = 0; i < gr[0].size(); ++i)
			res += f[0][gr[0][i]];*/
		cout << res << endl;
	//_getch();
	return 0;
}

Measured memory_bytes: 3312
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

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 S(): return input()
def pf(s): return print(s, flush=True)

class Flow():
    def __init__(self, e, N):
        self.E = e
        self.N = N

    def max_flow(self, s, t):
        r = 0
        e = self.E

        def f(c):
            v = self.v
            v[c] = 1
            if c == t:
                return 1
            for i in range(self.N):
                if v[i] == 0 and e[c][i] > 0 and f(i) > 0:
                    e[c][i] -= 1
                    e[i][c] += 1
                    return 1
            return 0

        while True:
            self.v = [0] * self.N
            if f(s) == 0:
                break
            r += 1

        return r

def main():
    rr = []

    def f(n,m):
        a = [LI_() for _ in range(m)]
        s,t = LI_()
        e = [[0]*n for _ in range(n)]
        for x,y in a:
            e[x][y] = 1
            e[y][x] = 1
        fl = Flow(e, n)
        r = fl.max_flow(s,t)
        re = []
        for i in range(m):
            x,y = a[i]
            if e[y][x] == 0:
                re.append(i+1)
        return [r,len(re)] + re

    while 1:
        n,m = LI()
        if n == 0:
            break
        rr.extend(f(n,m))
        # print('rr', rr[-1])
        break

    return '\n'.join(map(str,rr))


print(main())



Measured memory_bytes: 10060
from collections import deque
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]


a,b = map(str,input().split())
d = int(b[0]+b[2:])
c = int(a)
print(c*d//100)

Measured memory_bytes: 9468
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long A = scan.nextLong() - 1;
		long B = scan.nextLong();
		long C = scan.nextLong();
		long D = scan.nextLong();

		long tmp = (C * D) / gcd(C, D);
		long n = ((B - (B / C + B / D)) + (B / tmp));
		long m = ((A - (A / C + A / D)) + (A / tmp));

		System.out.println(n - m);
	}

	static long gcd(long a, long b) {
		if (b == 0) {
			return a;
		}
		a = a % b;
		return gcd(b, a);
	}
}

Measured memory_bytes: 27072
S = $stdin.gets.chomp
T = $stdin.gets.chomp

def comp(a, b)
  cnt = a.length
  0.upto(a.length - 1) do |i|
    if a[i] == b[i]
      cnt -= 1
    end
  end
  return cnt
end

min = T.length
0.upto(S.length - T.length) do |start|
  ssub = S[start, T.length]
  min1 = comp(ssub, T)
  if min > min1
    min = min1
  end
end
puts min


Measured memory_bytes: 14256
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define len(x) ((int)(x).size())
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

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

const ll LINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9+7;

/// command for char arrays with spaces -> scanf(" %[^\n]", text);
 
////////////////////////// Solution starts below. //////////////////////////////

int getDist(ll x1, ll y1, ll x2, ll y2){
	return (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
}

int main(){
	fastio;
	int n;
	cin >> n;	
	vector<pair<ll, ll>> v;
	ll x, y;
	for(int i = 0; i < n; i++){
		cin >> x >> y;
		v.emplace_back(x, y);
	}
	sort(v.begin(), v.end());
	double sum = 0, cnt = 0, media = 0;
	do{
		cnt += 1.0;
		sum = 0;
		for(int i = 1; i < n; i++){
			sum += sqrt((double)getDist(v[i-1].fs, v[i-1].sc, v[i].fs, v[i].sc));
		}
		media += sum;
	}while(next_permutation(v.begin(), v.end()));
	media /= cnt;
	cout << setprecision(10) << fixed << media << '\n';
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
 
  int ans=__gcd(a.at(0),a.at(1));
  
 
  for(int i=2; i<N; i++){
    ans=__gcd(ans,a.at(i));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<map>
#include<stack>
#define FOR(i,a,b) for(int i=(a); i<int(b); ++i)
#define RFOR(i,a,b) for(int i=(b)-1; i>=int(a); --i)
#define rep(i,n) FOR(i,0,n)
#define rep1(i,n) FOR(i,1,int(n)+1)
#define rrep(i, n) RFOR(i, 0, n)
#define rrep1(i, n) RFOR(i, 1, int(n) + 1)
#define all(c) begin(c), end(c)
#define al(d) d.begin(),d.end()
using namespace std;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(int n){
	vector<T> vec;
	rep(i,n){
		T input;
		cin >> input;
		vec.emplace_back(input);
	}
	return vec;
}
using AdjList = vector<vector<int>>;
using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

// Recieve edge(=(int,int)) as an adj list.
vector<vector<int>> getadj(int N, int M){
	// Initialize all lists of the graph as a empty vector.
	vector<int> init;
	vector<vector<int>> graph(N,init);

	rep(i,M){
		int a, b;
		cin >> a >> b;
		graph[a-1].emplace_back(b-1);
		graph[b-1].emplace_back(a-1);
	}
// rep(i,N)
// 	putv(graph[i]);
	return graph;
}

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
using namespace std;

int main(){
	string w;
	cin >> w;
	vector<int> cntr(26,0);
	int len = w.length();
	rep(i,len)
		cntr[w[i]-97]++;
	for(auto x:cntr)
		if(x%2==1){
			cout << "No" << endl;
			return 0;
		}
	cout << "Yes" << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>                                                                                               
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main(){
    int a,b;
    cin >> a >> b;
    if(a > b) cout << a - 1 << '\n';
    else cout << a << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ff first
#define ss second
#define maxn 1000000007
#define PI 3.14159265358979323846
#define MAX 1000007 
using namespace std; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    //cout<<fixed<<setprecision(20);
    ll a,b,x;
    cin>>a>>b>>x;
    ll ar[10]={0};
    ar[0]=a*x-b;
    cout<<ar[0]<<endl;
    for (int i = 1; i < 10; ++i)
    {
        ar[i]=a*ar[i-1]-b;
        cout<<ar[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

bool dp[100010];

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,k+1){
        if(i<a[0]){
            dp[i] = 0;
        }else{
            bool flag =0;
            rep(j,n){
                if(i<a[j])break;
                if(!dp[i-a[j]])flag = 1;
            }
            dp[i] = flag;
        }
    }
    if(dp[k]){
        cout << "First" << endl;
    }else{
        cout << "Second" << endl;
    }
    return 0;
}

Measured memory_bytes: 888
//package atcoder.beginner_179;

import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main (String[] args) throws Exception {

        String s = "2";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); String S = nstr();
        if (S.endsWith("s")) {
            bw.write(S + "es\n");
        } else {
            bw.write(S + "s\n");
        }
        bw.flush();

    }

    static BufferedReader br;
    static BufferedWriter bw;
    static StringTokenizer st;
    static void rl() throws Exception{
        st = new StringTokenizer(br.readLine());
    }
    static long nlo(){
        return Long.parseLong(st.nextToken());
    }
    static int nin(){
        return Integer.parseInt(st.nextToken());
    }
    /*private static void te(){
      }*/
    static double ndo(){
        return Double.parseDouble(st.nextToken());
    }
    static char[] nca(){
        return st.nextToken().toCharArray();
    }
    static String nstr(){
        return st.nextToken();
    }
}

Measured memory_bytes: 36536
#include <stdio.h>

int main(){
    int matrixA[100][100];  //100 x 100の行列A
    int matrixB[100][1];   //1 x 100の行列B
    int n = 0,m = 0;  //行列A,Bの要素数
    int dst[100][1]; //結果
    
    for(int i = 0; i<100;i++){
        for(int j = 0; j<100;j++){
            matrixA[i][j] = 0;
            matrixB[i][j] = 0;   //配列A,Bの要素を初期化
        }
    }
    
    for(int i = 0; i<100;i++){
              dst[i][0] = 0; //結果の要素を初期化
          }
    scanf("%d %d",&n, &m);
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            scanf("%d",&matrixA[i][j]);//配列Aの要素を入力
        }
    }
    for(int i = 0; i < m; i++){
        for(int j = 0; j<1; j++){
            scanf("%d",&matrixB[i][j]); //配列Bの要素を入力
        }
    }
    for(int i=0; i<n; i++){
        for(int j = 0; j<m;j++){
            dst[i][0] += matrixA[i][j]*matrixB[j][0];  //計算
        }
    }
    for(int i=0; i<n; i++){
        printf("%d\n",dst[i][0]); //答えを出力
    }
    return 0;
}



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

int main(){

    ll N, ans = 0;
    cin >> N;
    vector<ll>A(N), B(N);
    for(ll i = 0; i < N; i++)cin >> A[i] >> B[i];
    for(ll i = N - 1; i >= 0; i--){
        ll a = A[i] + ans, b = B[i];
        ll tmp = a % b;
        if(tmp == 0)continue;
        ans += b - tmp;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
import string

n = int(input())
s = input()

alpha = [chr(i) for i in range(65, 65+26)]
res = ""

for c in s:
    po = alpha.index(c)
    po = po + n
    if po > 25:
        po = po - 26
    res = res + alpha[po]
    
print(res)

Measured memory_bytes: 9912
#include <stdio.h>

int main(void){
	double x1, x2, x3, x4, y1, y2, y3, y4;
	double a1, a2;

	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4) != EOF){
		if(y2-y1 == 0 && y4-y3 == 0){
			printf("NO\n");
		}else if(x2-x1 != 0 && x4-x3 != 0){
			a1 = (y2 - y1) / (x2 - x1);
			a2 = (y4 - y3) / (x4 - x3);
			if(a1 == -1/a2) printf("YES\n");
			else printf("NO\n");
		}else if(x2 - x1 == 0 && x4 - x3 == 0){
			printf("NO\n");
		}else if(x2 - x1 == 0){
			a2 = (y4 - y3) / (x4 - x3);
			if(a2 == 0) printf("YES\n");
			else printf("NO\n");
		}else{
			a1 = (y2 - y1) / (x2 - x1);
			if(a1 == 0) printf("YES\n");
			else printf("NO\n");
		}
	}

	return 0;
}

Measured memory_bytes: 0
Public Class Program
  Shared Sub Main()
    Dim s As String = Cin.Str()
    Console.WriteLine(New String("x", s.Length()))
  End Sub
End Class

Public Class Cin
  Public Shared Function Str() As String
    Return Console.ReadLine().Trim()
  End Function
  Public Shared Function Int() As Integer
    Return Integer.Parse(Str())
  End Function
  Public Shared Function Lng() As Long
    Return Long.Parse(Str())
  End Function
  Public Shared Function Dbl() As Double
    Return Double.Parse(Str())
  End Function
  Public Shared Function StrArr(Optional separator As String = " ") As String()
    Return Str().Split(separator)
  End Function
  Public Shared Function IntArr(Optional separator As String = " ") As Integer()
    Return Array.ConvertAll(Of String, Integer)(StrArr(separator), AddressOf Integer.Parse)
  End Function
  Public Shared Function LngArr(Optional separator As String = " ") As Long()
    Return Array.ConvertAll(Of String, Long)(StrArr(separator), AddressOf Long.Parse)
  End Function
  Public Shared Function DblArr(Optional separator As String = " ") As Double()
    Return Array.ConvertAll(Of String, Double)(StrArr(separator), AddressOf Double.Parse)
  End Function
End Class

Measured memory_bytes: 13140
import java.util.Scanner;

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

		int h = sc.nextInt();
		int w = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		StringBuilder[] ans = new StringBuilder[h];
		for (int i = 0; i < h; i++) {
			ans[i] = new StringBuilder("");
		}

		boolean flg = true;

		if (h == 1 || w == 1) {

			if (h == 1) {
				if (b != 0) {
					flg = false;
				} else {
					for (int i = 0; i < w; i++) {
						if (i < a)
							ans[0].append("0");
						else
							ans[0].append("1");
					}
				}
			}

			else if (w == 1) {
				if (a != 0) {
					flg = false;
				} else {
					for (int i = 0; i < h; i++) {
						if (i < b)
							ans[i].append("0");
						else
							ans[i].append("1");
					}
				}
			}
		} else {

			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {

					if (i < b) {
						if (j < a)
							ans[i].append("0");
						else
							ans[i].append("1");
					} else {
						if (j < a)
							ans[i].append("1");
						else
							ans[i].append("0");
					}
				}
			}

		}

		if (flg) {
			for (int i = 0; i < h; i++) {
				System.out.println(ans[i].toString());
			}
		} else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 29544
if __name__ == '__main__':
    N = int(input()) 
    H = list(map(int, input().split()))

    count = 0
    count_max = 0
    for i in range(N-1):
        if H[i+1] <= H[i]:
            count += 1
        else:
            count_max = max(count, count_max)
            count = 0
    count_max = max(count, count_max)
    print(count_max)

Measured memory_bytes: 15020
#include "bits/stdc++.h"
using namespace std;
typedef uint64_t ulong;
typedef int64_t slong;
typedef uint32_t uint;

int main() {

    //freopen("../output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin >> n;
    int arr[n];
    unordered_map<int, int> freq;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
        ++freq[arr[i]];
    }
    slong cnt = 0;
    for (pair<const int, int> w : freq) {
        if (w.first != w.second) {
            int mm = w.second; //remove all;
            if (w.second > w.first)mm = min(mm, w.second - w.first);
            cnt += mm;
        }
    }
    cout << cnt << '\n';

    return 0;
}


Measured memory_bytes: 4644