akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define Fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Freed freopen ("0in.txt","r",stdin);
#define Fout freopen ("0out.txt","w",stdout);
#define ll long long int
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define Mod 1000000007
#define limit 1000008
using namespace std;

void solve(int t)
{
    ll i,j,n,m,ans=1,ct=0;
    cin >> n >> m;
    ll A[n+5];
    for(i=0; i<n; i++)
    {
        cin >> A[i];
        A[i] /= 2;
        ans = (ans*A[i])/__gcd(ans,A[i]);
        if(ans>m)
            ct=1;
    }
    for(i=n-1; i>=0; i--)
    {
        if((ans/A[i])%2==0)
        {
            cout <<0<<endl;
            return ;
        }
    }
    ct = m/ans;
    cout <<(ct+1)/2<<endl;
    return ;
}
int  main()
{
//    Fast
//    Freed
//    Fout
    int t,tt=1;
   // cin >> tt;
    for(t=1; t<=tt; t++)
        solve(t);
  return 0;
}



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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    int n;
    cin >> n;
    vi a(n), b(n), c(n-1);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n-1) cin >> c[i];
    rep(i, n) a[i]--;
    int ans = 0;
    rep(i, n) {
        ans += b[a[i]];
        if (i==0) continue;
        if (a[i]==a[i-1]+1) ans += c[a[i]-1];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(void){
	ll n,m,a[5000],b[5000],i,p,pp,mx,cnt;
	cin>>n>>m;
	for(i=0;i<n;i++) cin>>a[i];
	for(i=0;i<m;i++) cin>>b[i];
	mx=0;
	for(i=0;i<m;i++){
		p=i; pp=0; cnt=0;
		while(1){
			if(p==m||pp==n) break;
			if(a[pp]==b[p]) pp++,p++,cnt++;
			else pp++;
			mx=max(mx,cnt);
		}
	}
	cout<<mx<<endl;
	return 0;
}


Measured memory_bytes: 3184
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
A = [int(i) for i in input().split()]

dp = [0 for i in range(K+1)]
for i in range(K+1):
    if not dp[i]:
        for j in range(N):
            if i + A[j] < K + 1:
                dp[i+A[j]] = 1

if dp[K]: print("First")
else: print("Second")

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

int main(){
        int r;
        cin >> r;
        char ans[4];
        if(r<1200) strcpy(ans,"ABC");
        else if(r<2800) strcpy(ans,"ARC");
        else strcpy(ans,"AGC");
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 256
s = input()
num = len(s)-1
ans = 0

if num == 0:
    print(int(s))
else:
    for i in range(2**num):
        mode = ['-']*num
        for j in range(num):
            if (i>>j)&1:
                mode[j] = '+'
        val = s[0]
        for k in range(num):
            if mode[k] == '+':
                if val != '':
                    ans += int(val)
                val = s[k+1]
            else:
                val += s[k+1]
            if val != '' and k == num-1:
                ans += int(val)
    print(ans)
    


Measured memory_bytes: 9076
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int solve(int n) {
	int ret = 0;
	int w = 5;
	while (w <= n) {
		ret += n / w;
		w *= 5;
	}
	return ret;
}

int main() {
	while (true) {
		int n; cin >> n;
		if (n == 0)break;

		Cout(solve(n));
	}
}


Measured memory_bytes: 2980
ss = input()
n = 0
for i in range(len(ss)):
    if i%2 == 0:
        if ss[i] == 'R' or ss[i] == 'U' or ss[i] == 'D':
            n += 0
        else:
            n += 1
    if i%2 == 1:
        if ss[i] == 'L' or ss[i] == 'U' or ss[i] == 'D':
            n += 0
        else:
            n += 1
if n == 0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
main(){
	int n;
	scanf("%d",&n);
	while(n--){
		int i;
		double x[4],y[4],e;
		for(i=0;i<4;i++)	scanf("%lf%lf",&x[i],&y[i]);
		e=(x[3]-x[2])*(y[1]-y[0])-(y[3]-y[2])*(x[1]-x[0]);
		printf(-1e-8<e&&e<1e-8?"YES\n":"NO\n");
	}
	exit(0);
}

Measured memory_bytes: 0
import copy
floor = [0 for i in range(10)]
building = [floor.copy(), floor.copy(), floor.copy()]
buildings = [[], [], [], []]
for i in range(4):
    buildings[i] = copy.deepcopy(building)

# 要素を書き換える。
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    buildings[b-1][f-1][r-1] += v

# 結果を出力する。
for b in range(4):
    for f in buildings[b]:
        print(" "+" ".join([str(x) for x in f]))
    if b != 3:
        print("".join(["#" for x in range(20)]))



Measured memory_bytes: 6340
//Krzysztof Boryczka
#pragma GCC optimize "O3"
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;

#define FOR(i, b, e) for(int i=b; i<=e; i++)
#define FORD(i, b, e) for(int i=b; i>=e; i--)
#define SIZE(x) ((int)x.size())
#define pb push_back
#define st first
#define nd second
#define sp ' '
#define ent '\n'

void solve(){
	int ans=0;
	string s;
	cin>>s;
	FOR(i, 0, SIZE(s)/2-1){
		if(s[i] != s[SIZE(s)-i-1]) ans++;
	}
	cout<<ans<<ent;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// int tt; cin>>tt;
	// FOR(te, 1, tt)
	solve();
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define ll long long
using namespace std;
const int N=404;
const ll mod=1e9+7;
int n,m,a[N],b[N],maxx;
ll dp[N][N],mult[N][N],sum[N][N];
inline ll read(){
	char ch=getchar(); ll x=0, f=1;
	while(ch<'0' || ch>'9') {if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();}
	return x*f;}
inline int mx(int a,int b){return a>b ? a : b;}
int main()
{
//	freopen("Children and Candies.in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(); m=read();
	for(RG int i=1;i<=n;i++) a[i]=read();
	for(RG int i=1;i<=n;i++) b[i]=read(), maxx=mx(maxx,b[i]);
	for(RG int i=1;i<=maxx;i++)
	{
		mult[i][0]=1;
		for(RG int j=1;j<=m;j++) mult[i][j]=mult[i][j-1]*i%mod;
	}
	for(RG int i=1;i<=maxx;i++)
	 for(RG int j=0;j<=m;j++)
	  sum[i][j]=(sum[i-1][j]+mult[i][j])%mod;
	dp[0][0]=1;
	for(RG int i=1;i<=n;i++)
	 for(RG int j=0;j<=m;j++)
	  for(RG int l=0;l<=j;l++)
	   (dp[i][j]+=dp[i-1][j-l]*((sum[b[i]][l]-sum[a[i]-1][l]+mod)%mod)%mod)%=mod;
	printf("%lld\n",dp[n][m]);
	//fclose(stdin); fclose(stdout);
	return 0;
}

Measured memory_bytes: 4096
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll [[maybe_unused]] = long long;
using ull [[maybe_unused]] = unsigned long long;
using ld [[maybe_unused]] = long double;

[[maybe_unused]] static constexpr int mod = (int)1e9 + 7;
[[maybe_unused]] static constexpr int inf = 100100100;
[[maybe_unused]] static constexpr ll linf = 1e18;
[[maybe_unused]] static constexpr double eps = 1e-9;
[[maybe_unused]] static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, a) for (ll i = a; i >= 0; --i)
#define all(obj) begin(obj), end(obj)
#define rall(obj) rbegin(obj), rend(obj)
#define pb push_back
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll R;
    cin >> R;
    if (R < 1200) {
        cout << "ABC" << endl;
    } else if (R < 2800) {
        cout << "ARC" << endl;
    } else {
        cout << "AGC" << endl;
    }
}


Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]
N,A,B,C=map(int,input().split())
pr=10**9+7
def gya(n):
    return pow(n,pr-2,pr)
MAX_NUM = 2*10**5 + 1
fac  = [0 for _ in range(MAX_NUM)]
finv = [0 for _ in range(MAX_NUM)]
inv  = [0 for _ in range(MAX_NUM)]
fac[0]  = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2,MAX_NUM):
    fac[i] = fac[i-1] * i % pr
    inv[i] = pr - inv[pr%i] * (pr // i) % pr
    finv[i] = finv[i-1] * inv[i] % pr
def c(n,k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % pr) % pr
a=0
ab=A+B
for i in range(N):
    a+=(i+N)*c(N+i-1,N-1)*pow(ab,N-1-i,pr)%pr*(pow(A,N,pr)*pow(B,i,pr)+pow(B,N,pr)*pow(A,i,pr))%pr
    a%=pr
a=a*100*gya(pow(ab,2*N,pr))%pr
print(a)

Measured memory_bytes: 57548
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
// clang-format on

int N;
int a[MAX_N];

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  REP(i, N) cin >> a[i];

  map<int, int> mp;
  REP(i, N)
  {
    for (int j = -1; j <= 1; j++) mp[a[i] + j]++;
  }

  int ans = 0;
  for (auto m : mp) ans = max(ans, m.second);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int K;
  int S;
  cin >> K >> S;
  int X;
  int Y;
  int Z;
  int num = 0;
  
  for(X = K;X >= 0;--X){
    for(Y = K;Y >= 0;--Y){
      Z = S - X - Y;
      if(Z >= 0 && Z <= K){
        num++;
      }       
    }
  }
  
  cout << num << endl;
}



Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<utility>
#define ll long long int
#define MOD 1000000007LL
using namespace std;
int main() {
    int n;
    cin>>n;
    string s1,s2;
    cin>>s1>>s2;
    int a[100]={};
    int j=0;
    for(int i=0;i<n;i++){
        if(s1[i]==s2[i]){
            a[j]=0;
            j++;
        }else{
            a[j]=1;
            j++;
            i++;
        }
    }
    ll ans=0;
    if(a[0]==0){
        ans=3;
    }else{
        ans=6;
    }
    for(int i=1;i<j;i++){
        if(a[i]==0){
            if(a[i-1]==0){
                ans*=2;
            }
        }else{
            if(a[i-1]==0){
                ans*=2;
            }else{
                ans*=3;
            }
        }
        ans=ans%MOD;
    }
    cout<<ans<<endl;

}


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

int n,a[100010],x,A,B;

void work()
{
	scanf("%d",&n);
	for (int i=1; i<=n; i++)  scanf("%d",&a[i]);
	sort(a+1,a+n+1),reverse(a+1,a+n+1);
	for (int i=1; i<=n; i++)  if ((a[i]>=i)&&(i>=a[i+1]))  {x=i-1;  break;}
	A=a[x+1]-x;
	for (int i=1; i<=n+1; i++)  if (a[i]<=x)  {B=i-x-1;  break;}
	puts((A&1)&&(B&1)?"Second":"First");
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 640
#import sys
#input = sys.stdin.readline
def main():
    N, K = map( int, input().split())
    rsp = list(map( int, input().split()))
    T = input()
    TmodK = [[] for _ in range(K)]
    for i in range(N):
        if T[i] == 'r':
            TmodK[i%K].append(0)
        elif T[i] == 's':
            TmodK[i%K].append(1)
        elif T[i] == 'p':
            TmodK[i%K].append(2)
    ans = 0
    cnt = N//K
    red = N%K
    s = 0
    for i in range(K):
        if i < red:
            s = 1
        else:
            s = 0
        dp = [[0,0,0] for _ in range(cnt+s)]
        dp[0][(TmodK[i][0] + 2)%3] = rsp[(TmodK[i][0] + 2)%3]
        for j in range(1, cnt+s):
            t = TmodK[i][j]

            win = (t+2)%3
            # print(t, win)
            for q in range(3):
                if q == win:
                    dp[j][q] = max(dp[j-1][(q+1)%3] + rsp[win], dp[j-1][(q+2)%3] + rsp[win])
                else:
                    dp[j][q] = max(dp[j-1][(q+1)%3], dp[j-1][(q+2)%3])
#        print(dp)
        ans += max(dp[cnt+s-1])
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 57904
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */


#ifndef SOLUTION_COMMON_H

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using PI = pair<int, int>;
template<class T> using V = vector<T>;
using VI = V<int>;
#define _1 first
#define _2 second

#ifdef MY_DEBUG
# define DEBUG(x) x
#else
# define DEBUG(x)
#endif

template<class A, class B>
std::ostream & operator <<(ostream &os, const pair<A, B> &p) {
  os << "(" << p._1 << "," << p._2 << ")";
  return os;
}

template<class T>
inline void debug(T &A) {
  DEBUG(
      for (const auto &a : A) {
        cerr << a << " ";
      }
      cerr << '\n';
  )
}

template<class T, class Func>
inline void debug_with_format(T &A, Func f) {
  DEBUG(
      for (const auto &a : A) {
        cerr << f(a) << " ";
      }
      cerr << '\n';
  )
}

template<class T>
inline void debug_dim2(T &A) {
  DEBUG(
      for (const auto &as : A) {
        debug(as);
      }
  )
}

template<typename ... Args>
inline void debug(const char *format, Args const &... args) {
  DEBUG(
      fprintf(stderr, format, args ...);
      cerr << '\n';
  )
}

template<typename ... Args>
string format(const string &fmt, Args ... args) {
  size_t len = snprintf(nullptr, 0, fmt.c_str(), args ...);
  vector<char> buf(len + 1);
  snprintf(&buf[0], len + 1, fmt.c_str(), args ...);
  return string(&buf[0], &buf[0] + len);
}

template<class T1, class T2>
string fmtP(pair<T1, T2> a) {
  stringstream ss;
  ss << "(" << a._1 << "," << a._2 << ")";
  return ss.str();
}

#define SOLUTION_COMMON_H

#endif //SOLUTION_COMMON_H

const int MOD = 1000000007;

class EPayment {
public:
  void solve(std::istream& in, std::ostream& out) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string S;
    in >> S;

    V<VI> dp(S.size() + 1, VI(2, 1e9));
    dp[0][0] = 0;
    dp[0][1] = 1;
    for (int i = 0; i < S.size(); ++i) {
      int d = S[i] - '0';
      for (int j = 0; j < 2; ++j) { // j == 1 のとき10受け取っている
        for (int k = 0; k < 2; ++k) { // k == 1 のとき余計に1受け取っている
          int v;
          if (j == 0 && k == 0) {
            v = d;
          } else if (j == 0 && k == 1) {
            v = d + 1;
          } else if (j == 1 && k == 0) {
            v = 10 - d;
          } else {
            v = 10 - d - 1;
          }
          dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + v);
        }
      }
    }
    debug_dim2(dp);
    int ans = dp[S.size()][0];
    out << ans;
  }
};


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


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

using namespace std;

int main(int argc, char *argv[])
{
    int N;
    cin >> N;
    vector<int> V(N);
    vector<int> C(N);
    for (auto&& v : V){
        cin >> v;
    }
    for (auto&& c : C){
        cin >> c;
    }
    vector<int> X_Y(N);
    for(int i = 0; i < N; i++){
        X_Y.at(i) = (V.at(i) - C.at(i));
    }
    int max = 0;
    for (auto&& x_y: X_Y){
        if (x_y > 0){
            max += x_y;
        }
    }
    cout << max << endl;


    

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
using namespace std;
//整形Shift + alt + f　2回
//int x[101],y[101],h[101];
//int koya[100001][];
/*
//ユークリッドの互除法
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
*/
int n;
int main()
{
    string s;
    int res = 10000000;
    int like = 753;
    cin >> s;

    for (int i = 0; i + 2 < s.length(); i++)
    {
        int tmp;
        tmp = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
        if (abs(tmp - like) < res)
        {
            res = abs(tmp - like);
        }
    }
    //cout << s.length() << endl;
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

vector<vector<ll>> g(100010); 
vector<ll> dist(100010);

int main(){
    ll n, k;
    cin >> n >> k;

    vector<ll> v(n);
    rep(i, n)cin >> v[i];

    ll ans = 0;
    rep(i, min(n, k) + 1)rep(j, min(n, k) + 1 - i){
        vector<ll> tmp = v;
        tmp.erase(tmp.begin()+i, tmp.end()-j);

        sort(ALL(tmp));

        rep(l, k - (i+j) && !tmp.empty()){
            if(tmp.front() < 0)tmp.erase(tmp.begin());
        }

        ll res = 0;
        rep(l, tmp.size())res += tmp[l];

        ans = max(ans, res);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, M; cin >> N >> M;
    vec X(N); cin >> X;

    vec cnt(100001, 0);
    REP(i, N) cnt[X[i]]++;

    vec mcnt(M, 0), spair(M, 0);
    FOR(i, 1, 100001){
        mcnt[i % M] += cnt[i];
        spair[i % M] += cnt[i] / 2;
    }
    int ans = 0;
    REP(i, M){
        int j = (M - i) % M;
        if(i == j) ans += mcnt[i] / 2;
        else if(i < j){
            int tmp = min(mcnt[i], mcnt[j]);
            ans += tmp;
            if(mcnt[i] > tmp){
                ans += min((mcnt[i] - tmp) / 2, spair[i]);
            }
            if(mcnt[j] > tmp){
                ans += min((mcnt[j] - tmp) / 2, spair[j]);
            }
        }
    }
    Out(ans);

    return 0;
}


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

int main() {
	int n, k; cin >> n >> k;
	vector<int>l(n); for (auto&& x : l)cin >> x;
	sort(l.rbegin(), l.rend());
	int ans = 0;
	for (int i = 0; i < k; i++) {
		ans += l[i];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3528
"use strict";
const main = arg => {
  let N = arg.split("\n")[0].split(" ")[0]*1;
  let x = arg.split("\n")[0].split(" ")[1]*1;
  let a = arg.split("\n")[1].split(" ");
  let count = 0;
  a = a.sort((a, b) => a - b)
  for(let i = 0; i < N; i++){
	if(x >= a[i]){
		x -= a[i]
      	count++;
    } else {
    	break;
    }
  }  
  if(x > 0 && count >= N){
  	count--;
  }
  
  console.log(count);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
def abs(a):
  if a<0:
    return a*(-1)
  else:
    return a

a,b,c,d=list(map(int,input().split()))
if abs(a-b)<=d and abs(b-c)<=d:
  print('Yes')
elif abs(a-c)<=d:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3060
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Libraries --------------------------------//

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    int r;
    cin >> r;
    cout << r * r << endl;
}

int main()
{
    solve();
    return 0;
}


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

int main()
{
	
	int k,a,b;cin>>k>>a>>b;
	for(int i=a;i<=b;i++){
		if(i%k==0){
			cout<<"OK";
			return 0;		
		}
	} 
	cout<<"NG";
	return 0;
}


Measured memory_bytes: 3556
import numpy as np
from scipy.spatial import distance

def rotation(x, t, deg = False):
    if deg == True:
        t = np.deg2rad(t)
    cos = np.cos(t)
    sin = np.sin(t)

    rot_x = [(x[0] * cos) - (x[1] * sin), (x[0] * sin) + (x[1] * cos)]
    
    return rot_x

if __name__ == "__main__":
    A, B, H, M = list(map(int, input().split()))
    
    a0 = np.array([0, A])
    b0 = np.array([0, B])

    a1 = rotation(a0, 0.5*(H*60+M), deg = True)
    b1 = rotation(b0, 6*M, deg = True)

    print(distance.euclidean(a1, b1))

Measured memory_bytes: 44572
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};


int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    string s, ans; cin >> s;
    
    for(auto ch : s)
    {
        if(ch == '0')
        {
            ans.push_back(ch);
        }
        else if(ch == '1')
        {
            ans.push_back(ch);
        }
        else if(ch == 'B')
        {
            if(!ans.empty())
                ans.pop_back();
        }
    }
    cout << ans;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

#define u 101

int main(){
  int i,n,ans,k,j,u_number,iranai;
  int Adj[u][u];
  
  for(i=0;i<u;i++){
    for(j=0;j<u;j++){
      Adj[i][j]=0;
    }
  }

  scanf("%d",&n);
  
  for(i=1;i<=n;i++){
    scanf("%d",&iranai);
    scanf("%d",&k);
    for(j=1;j<=k;j++){
      scanf("%d",&u_number);
      Adj[i][u_number]=1;
    }
  }
  
  for(i=1;i<=n;i++){
    for(j=1;j<n;j++){
    printf("%d ",Adj[i][j]);
    }
    printf("%d\n",Adj[i][n]);
  }
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <cassert>
#ifdef DEBUG
#include "./Lib/debug.hpp"
#else
#define dump(...)
template<class T>inline auto d_val(T a, T b) { return a; }
#endif

/* (=＾o＾=) */
#define int ll

/* macro */
#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define REPI2(it,b,e) for(auto it = (b); it != (e); ++it)
#define REPI(it,c) REPI2(it, (c).begin(), (c).end())
#define RREPI(it,c) REPI2(it, (c).rbegin(), (c).rend())
#define REPI_ERACE2(it, b, e) for(auto it = (b); it != (e);)
#define REPI_ERACE(it, c) REPI_ERACE2(it, (c).begin(), (c).end())
#define ALL(x) (x).begin(),(x).end()
#define cauto const auto&
/* macro func */
#define SORT(x) do{sort(ALL(x));}while(false)
#define RSORT(x) do{sort((x).rbegin(),(x).rend());}while(false)
#define UNIQUE(v) do{v.erase( unique(v.begin(), v.end()), v.end() );}while(false)
#define MAX(x,y) do{x = std::max(x,y);}while(false)
#define MIN(x,y) do{x = std::min(x,y);}while(false)
#define BR do{cout<<"\n";}while(false)

/* type define */
using ll = long long;
using PAIR = std::pair<ll, ll>;
using VS = std::vector<std::string>;
using VL = std::vector<long long>;
using VVL = std::vector<VL>;
using VVVL = std::vector<VVL>;
using VD = std::vector<double>;
template<class T>
using V = std::vector<T>;

/* using std */
using std::cout;
constexpr char endl = '\n';
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::queue;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::unordered_multiset;
using std::multiset;
using std::bitset;
using std::priority_queue;

/* constant value */
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;

/* Initial processing  */
struct Preprocessing { Preprocessing() { std::cin.tie(0); std::ios::sync_with_stdio(0); }; }_Preprocessing;

/* Remove the source of the bug */
signed pow(signed, signed) { assert(false); return -1; }

/* define hash */
namespace std { template <>	class hash<std::pair<ll, ll>> { public:	size_t operator()(const std::pair<ll, ll>& x) const { return hash<ll>()(1000000000 * x.first + x.second); } }; }

/* input */
template<class T> std::istream& operator >> (std::istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }

//=============================================================================================


signed main() {
	ll n;
	cin >> n;
	VL v(n);
	cin >> v;
	SORT(v);
	double ans = (1.0 * v[0] + v[1]) / 2.0;
	FOR(i, 2, n) {
		ans += v[i];
		ans /= 2;
	}
	cout << std::fixed << std::setprecision(10) << ans << endl;
}

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

void solve(){
  int64_t A,B,C,K;
  cin >> A >> B >> C >> K;
  if(A>K){
	  cout<<K;
  }
  else if(A+B>=K)
	  cout<<A;
  else{
	  cout<<A-(K-(A+B));
  }
}

int main(){
	
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   // int c;cin>>c;
   // while(c--)	
       solve();
    return 0;
}

Measured memory_bytes: 3636
s = input()
count = 0
flag = "ok"
for i in s:
    #print(i)
    count += 1
    if count % 2 == 0:
        if i == "R":
            flag = "ng"
            break
    else:
        if i == "L":
            flag = "ng"
            break
if flag == "ok":
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        long sum=0;
      
        int a[] = new int [sc.nextInt()];
       int max = 0;
        int min = 0;
        for(int i = 0; i<a.length; i++){
        a[i] = sc.nextInt();
        sum = sum + a[i];
        if (i == 0){
        max = a[i];
        min = a[i];
        }
        
        if(i !=0 && min>a[i]){
           min = a[i];
        }
        else if (i != 0 && max<a[i])
            max = a[i];
    }
        System.out.println( min+" "+max+ " "+ sum);
}}



Measured memory_bytes: 42804
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int b;
	int a[110];
	cin>>b;
	for(int i=1;i<=b;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=b;i++)
	{
		if(a[i]%2==1)continue;
		if(a[i]%3==0)continue;
		if(a[i]%5==0)continue;
		cout<<"DENIED";
		return 0;
	} 
	cout<<"APPROVED";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define rep2(i,s,n) for (ll i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
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;}
const ll inf = 1001001001001;

int main() {
    int n,W;
    cin >> n >> W;
    vector<ll> w(n),v(n);
    rep(i,n) cin >> w[i] >> v[i];
    vector<vector<ll>> dp(n+1,vector<ll>(100001,inf));
    dp[0][0] = 0;
    rep2(i,1,n+1) rep(j,100001) {
        chmin(dp[i][j],dp[i-1][j]);
        chmin(dp[i][j],dp[i-1][max(0LL,j-v[i-1])]+w[i-1]);
    }
    for(int i = 100000; i >= 0; i--) {
        if(dp[n][i] <= W) {
            cout << i << endl;
            return 0;
        }
    }
}

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

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
const int inf = 1e+9;

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

	vector<ll>  a(n), b(n);


	rep(i, n) {
		cin >> a[i] >> b[i];
	} 
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());

	if (n % 2 == 1) {
		int m = (n - 1) / 2;
		int a_m = a[m];
		int b_m = b[m];
		cout << b[m] - a[m] + 1 << endl;
		return 0;
	} 

	int a_m2 = a[n / 2 - 1] + a[n / 2];
	int b_m2 = b[n / 2 - 1] + b[n / 2];
	cout << b_m2 - a_m2 + 1  << endl;


	return 0;
}



Measured memory_bytes: 5948
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,k;
    cin >> a >> b >> k;
    if(b-a<2*k)for(int i=a;i<=b;i++)cout << i << endl;
    else {
        for(int i=a;i<a+k;i++)cout << i << endl;
        for(int i=b-k+1;i<=b;i++)cout << i << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mem0(a) memset(a,0,sizeof(a))
#define meminf(a) memset(a,0x3f,sizeof(a))
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef double db;
const int maxn=2e6+7;
const int INF=1e9;
char s[101];
int num1[26];
int num2[26];
int main()
{ 
   int n;
   cin>>n;
   cin>>s;
   int ans=-1;
   for(int i=0;i<n;i++)
    num2[s[i]-'a']++;
   for(int i=0;i<n;i++)
   {
    num1[s[i]-'a']++;
    num2[s[i]-'a']--;
    int temp=0;
    for(int j=0;j<26;j++)
    {
      if(num1[j]&&num2[j])
        temp++;
    }
    ans=max(temp,ans);
   }
   cout<<ans;
 }

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  ll ans = 0;
  rep(i, n) {
    ans += a[i] / 2;
    if (i + 1 < n && a[i] % 2 && a[i + 1] > 0) {
      ans++;
      a[i + 1]--;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"

using namespace std;
using std::vector;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD int(1e9) + 7
#define PAI  3.1415926535
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

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

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

int main(){
  
  vi v(5, 0);
  rep(i, 5) cin >> v[i];
  int k; cin >> k;

  bool flag = true;

  rep(i, 4){
    for(int j = i + 1; j < 5; j++)
    {
      int sum = v[j] - v[i];
      if(sum > k){
        flag = false;
      }
    }
    
  }

  if(flag) pr("Yay!");
  else pr(":(");

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;

int main() {
	int N;
	string S;
	cin >> N >> S;
	vector<int> pt(N);//pt使ったDP的ななにか
	//0番目の人が塾生注目させた時
	for (size_t i = 1; i < N; i++)
	{
		if (S.at(i)=='E')
		{
			pt.at(0)++;
		}
	}
	for (size_t i = 1; i < N; i++)
	{
		pt.at(i) = pt.at(i - 1);
		if (S.at(i)=='E')
		{
			pt.at(i)--;
		}
		if (S.at(i - 1) == 'W')pt.at(i)++;
	}
	sort(pt.begin(), pt.end());
	
	cout << pt.at(0);
}

Measured memory_bytes: 1796
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <limits>

using namespace std;

int main(){
	int n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	a--;b--;c--;d--;
	string s;
	cin>>s;
	bool is_s = true;
	for(int i=a+1;i<=c;i++){
		if(s[i] == s[i-1]){
			if(s[i] == '#') is_s = false;
		}
	}

	bool is_f = true;

	for(int i=b+1;i<=d;i++){
		if(s[i] == s[i-1]){
			if(s[i] == '#') is_f = false;
		}
	}

	bool is_c = false;

	if(d < c){
		for(int i=b+1;i<=(d+1);i++){
			if(i >= n) continue;
			if(i-2 < 0) continue;

			if(s[i] == '.'){
				if(s[i-1]== '.'){
					if(s[i-2] == '.'){
						is_c = true;
					}
				}
			}

		}
	} else {
		is_c = true;
	}

	if((is_s & is_f & is_c) == true){
		cout<<"Yes"<<endl;
	} else {
		cout<<"No"<<endl;
	}

	return 0;

}

Measured memory_bytes: 640
# coding: utf-8
n = int(input())

a = list(map(float,input().split())) 

a.sort()

for k in range(n-1):
    b=(a[0]+a[1])/2
    a.append(b)
    a.pop(0)
    a.pop(0)
    a.sort()

A =a[0]
print(A)

Measured memory_bytes: 3316
#include<iostream>
#include<math.h>

using namespace std;

int main(){
	int n,d,x[10][10],i,j,t,ans=0;
	double sum=0,num;

	cin>>n>>d;

	for(i=0;i<n;i++){
		for(j=0;j<d;j++){
			cin>>x[i][j];
		}
	}

	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			for(t=0;t<d;t++){
				sum+=pow(x[i][t]-x[j][t],2);
			}

			num=sqrt(sum);

			if(floor(num)==num){
				ans++;
			}

			sum=0;
		}
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
A = [list(map(int, input().split())) for i in range(n)]

ans = [[None for i in range(n)] for j in range(n)]


# for文で動的計画法
def dp1(i, j):
    if ans[i][j] is not None:
        return ans[i][j]
    else:
        if i == j:
            ans[i][j] = 0
        else:
            ret = float('INF')
            for k in range(i, j):
                tmp = dp1(i, k) + A[i][0]*A[k][1]*A[j][1] + dp1(k+1, j)
                ret = min(ret, tmp)
            ans[i][j] = ret
        return ans[i][j]


print(dp1(0, n-1))



Measured memory_bytes: 5848
#include<iostream>
using namespace std;
int main(){
  int x,y;
  cin>>x>>y;
  for(int i=0;i<=50;i++){
    for(int j=0;j<=25;j++){
      if(2*i+4*j==y&&i+j==x){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3592
answers = []

while (convert_num = gets.to_i) != 0
  convert_table = {}
  convert_num.times do
    befor_char, after_char = gets.chomp.split
    convert_table[befor_char] = after_char
  end

  output = ""
  gets.to_i.times do
    data = gets.chomp
    if (char = convert_table[data]) != nil
      output += char
    else
      output += data
    end
  end

  answers << output
end

puts answers

Measured memory_bytes: 98252
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
const int mod = 1e9+7;
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; }

int main(){
    string s,t; cin >> s >> t;
    int a,b; cin >> a >> b;
    string u; cin >> u;
    if(u == s){
        cout << a-1  << " " << b << endl;
    }
    else{
        cout << a << " " << b-1 << endl;
    }
}


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

using i64 = long long int;

int bsearch(int ok, int ng, vector<int> &s, int t){
    while(abs(ok - ng) > 1){
        int mid = (ok + ng) / 2;
        if(s[mid] >= t)ok = mid;
        else ng = mid;
    }
    return ok;
}

int main(){
    int n;
    cin >> n;
    vector<int> s;
    for(int i=0;i<n;++i){
        int tmp;
        cin >> tmp;
        s.push_back(tmp);
    }
    int q;
    cin >> q;
    int ans = 0;
    for(int i=0;i<q;++i){
        int t;
        cin >> t;
        int res = bsearch(n-1, -1, s, t);
        if(s[res] == t)ans++;
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3384
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<functional>
#include<vector>
#include<queue>
using namespace std;
#define f(i,n) for(int i=0;i<(int)n;i++)
#define MOD 1000000009
struct dice{
	int up;
	int down;
	int east;
	int west;
	int north;
	int south;
};
dice a, b;
char s[101]="NNNNENWNNNNENWNNNNENWNNNNENWENNNNWWNNNNE";
int x;
dice  input(){
	dice c;
	scanf("%d", &x);
	c.up = x;
	scanf("%d", &x);
	c.south = x;
	scanf("%d", &x);
	c.east = x;
	scanf("%d", &x);
	c.west = x;
	scanf("%d", &x);
	c.north = x;
	scanf("%d", &x);
	c.down = x;
	return c;
}
void nr(){
			x = a.north;
			a.north = a.up;
			a.up = a.south;
			a.south = a.down;
			a.down = x;
			return;
}
void sr(){
			x = a.south;
			a.south = a.up;
			a.up = a.north;
			a.north = a.down;
			a.down = x;
			return;
}
void er(){
	x = a.east;
	a.east = a.up;
	a.up = a.west;
	a.west = a.down;
	a.down = x;
	return;
}
void wr(){
	x = a.west;
	a.west = a.up;
	a.up = a.east;
	a.east = a.down;
	a.down = x;
	return;
}
bool comp(){
	if (a.up == b.up&&a.north == b.north&&a.east == b.east&&a.down == b.down&&a.south == b.south&&a.west == b.west)return true;
	else return false;
}
int main(void){
	int n;
	dice c, d;
	a=input();
	b=input();
	n = strlen(s);
	bool ans = false;
	f(i, n){
		if (s[i] == 'N'){
			nr();
		}
		else if (s[i] == 'S'){
			sr();
		}
		else if (s[i] == 'E'){
			er();
		}
		else if (s[i] == 'W'){
			wr();
		}
		ans = comp();
		if (ans == true)break;
	}
		if(ans==true)printf("Yes\n");
		else printf("No\n");

	return 0;
}

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

using namespace std;

using ll = long long;

const int MAX_N = 2 * 1e5 + 10;
int n, q;
string s;
char t[MAX_N], d[MAX_N];

bool CheckLeft(int idx) {
    if (idx < 0 || n <= idx) return false;
    for (int i = 0; i < q; ++i) {
        if (s[idx] == t[i]) {
            if (d[i] == 'L') --idx;
            else ++idx;
        }
        if (idx == -1) return true;
        else if (idx == n) return false;
    }
    return false;
}

bool CheckRight(int idx) {
    if (idx < 0 || n <= idx) return false;
    for (int i = 0; i < q; ++i) {
        if (s[idx] == t[i]) {
            if (d[i] == 'L') --idx;
            else ++idx;
        }
        if (idx == -1) return false;
        else if (idx == n) return true;
    }
    return false;
}

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

    cin >> n >> q >> s;
    for (int i = 0; i < q; ++i) {
        cin >> t[i] >> d[i];
    }

    int left = -1, right = n;
    {
        int lb = -1, ub = n;
        while (1 < ub - lb) {
            int mid = (lb + ub) >> 1;
            if (CheckLeft(mid)) lb = mid;
            else ub = mid;
        }
        left = lb;
    }
    {
        int lb = -1, ub = n;
        while (1 < ub - lb) {
            int mid = (lb + ub) >> 1;
            if (CheckRight(mid)) ub = mid;
            else lb = mid;
        }
        right = ub;
    }

    cout << n - (left + 1 + (n - right)) << endl;;

    return 0;
}


Measured memory_bytes: 976
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define MOD 1000000007
template<class T> T in(){T x;cin>>x;return x;}

int main(){
	int H,W; cin>>H>>W;

	vector<string> A;
	for(int i=0; i<H; i++) A.push_back(in<string>());

	vvi dp(H+1, vi(W+1));
	dp[H][W-1] = 1;
	for(int h=H-1; h>=0; h--) for(int w=W-1; w>=0; w--)
		if(A[h][w]=='.') dp[h][w] = (dp[h+1][w] + dp[h][w+1]) % MOD;
	cout<< dp[0][0] <<endl;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

// この開放だと計算量がN^2を超えるので、
// Nが 10^5のため間に合わない
int main() {
    int N;
    cin >> N;

    vector<int> A(N);
    rep(i, N) cin >> A[i];
		vector<int> L(N);
		vector<int> R(N);

		rep(i,N){
			if(i==0){
				L[i] = A[i];
			} else {
				L[i] = __gcd(L[i-1],A[i]);
			}
		}

		for(int i=N-1;i>=0;i--){
			if(i==N-1){
				R[i] = A[i];
			} else{
				R[i] = __gcd(A[i],R[i+1]);
			}
		}

		int ans = 0;
		rep(i,N){
			if(i==0){
				ans = max(ans,R[i+1]);
			}else if(i==N-1){
				ans = max(ans,L[i-1]);
			} else{
				ans = max(ans,__gcd(L[i-1],R[i+1]));
			}
		}

		cout << ans << endl;
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

const int inf = 1e9 + 7;

void maxi(int& a, int b) {
  a = max(a, b);
}

int main() {
  int n;
  scanf("%d", &n);

  vector<int> dp(3, 0);
  for (int i = 0; i < n; ++i) {
    vector<int> v(3);
    for (int j = 0; j < 3; ++j) scanf("%d", &v[j]);

    vector<int> dp2(3);
    for (int p=0; p<3; ++p)
      for (int q=0; q<3; ++q) if(p != q)
        maxi(dp2[q], dp[p] + v[q]);
    dp = dp2;
  }

  int ans = max({dp[0], dp[1], dp[2]});
  printf("%d", ans);

  return 0;
}

Measured memory_bytes: 256