akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
using namespace std;

int main () {
    int N, M;
    cin >> N >> M;
    vector<int> a(N);
    for (int i = 0; i < M; ++i) {
        int K;
        cin >> K;
        for (int j = 0; j < K; ++j) {
            int s;
            cin >> s;
            s--;
            a[s] |= 1<<i;
        }
    }

    int p = 0;
    for (int i = 0; i < M; ++i) {
        int x;
        cin >> x;
        x;
        p |= x<<i;
    }

    int ans = 0;
    for (int s = 0; s < (1<<N); ++s) {
        int t = 0;
        for (int i = 0; i < N; ++i) {
            if (s>>i & 1) {
                t ^= a[i];
            }
        }
        if (t == p){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;
ll inf = 1000000000;
typedef pair<ll, ll> P;
int main() {
	string s;
	cin >> s;
	int kai = 0;
	int kai2 = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != 'A') {
			kai++;
			
		}
		if (s[i] != 'B') {
			kai2++;
		}
		
	}
	if (kai == 3||kai2==3) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 256
import sys
N,C=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
mod=10**9+7
table=[[ pow(j,i,mod) for j in range(405)] for i in range(405)]
ntable=[[0]*405 for i in range(405)]
for i in range(405):
    t=0
    for j in range(1,405):
        t+=table[i][j]
        t%=mod
        ntable[i][j]=t
F=[B[i]-A[i]+1 for i in range(N)]
G=[0]*N
t=1
for i in range(N):
    t*=F[i]
    t%=mod
for i in range(N):
    G[i]=(t*pow(F[i],mod-2,mod))%mod
#print(G)
dp=[[0]*(C+1) for i in range(N)]
for i in range(C+1):
    dp[0][i]=((ntable[i][B[0]]-ntable[i][A[0]-1]))%mod#*G[0]
for i in range(1,N):
    for k in range(C+1):
        for l in range(k+1):
            dp[i][k]+=dp[i-1][l]*(ntable[k-l][B[i]]-ntable[k-l][A[i]-1])#*G[i]
            dp[i][k]%=mod
#print(dp)
print(dp[N-1][C])



Measured memory_bytes: 45420
using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();

            var max = 0;
            var length = 0;
            foreach (var item in str)
            {
                if (item == 'A' || item == 'C' || item == 'G' || item == 'T')
                {
                    length++;
                }
                else
                {
                    if (max < length)
                    {
                        max = length;
                    }
                    length = 0;
                }
            }

            if (max < length)
            {
                max = length;
            }

            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

vector<P> test[15];

int main() {
    int n;
    cin >> n;
    rep(i,n) {
        int a;
        cin >> a;
        rep(j,a) {
            int x, y;
            cin >> x >> y;
            x--;
            test[i].emplace_back(x,y);
        }
    }

    int ans = 0;
    rep(is,1<<n) {
        int cnt = __builtin_popcount(is);
        bool ok = true;
        rep(i,n) {
            if (is>>i&1) {
                for (auto p : test[i]) {
                    int x = p.first, y = p.second;
                    int t = is>>x&1;
                    if (t != y) ok = false;
                }
            }
        }
        if (ok) ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n,ans;
  cin>>n;
  ll k=sqrt(n)+1;
  ans=n;
  for(ll i=1;i<=k;i++){
    if(n%i==0){
      ans=min(ans,i+n/i-2);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define    endl        '\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repp(i,a,b)    for(ll int i=b-1;i>=a;i--)
#define tr(container,it) for(__typeof__(container.begin()) it = container.begin(); it != container.end(); it++)
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define mpi         map<pair<ll int,ll int>,ll int>
#define vii         vector<pair<ll,pair<ll,ll> > >
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        998244353
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;
#define N  10000
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";



void solve(){
	ll k,a,b;
	cin>>k>>a>>b;
	if(a%k==0||b%k==0){
		cout<<"OK";
		return;
	}
	a/=k;
	b/=k;
	if(a<b) cout<<"OK\n";
	else cout<<"NG";
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll TESTS=1,an=1,f;
    // cin>>TESTS;
    while(TESTS--){
        // cout<<"Case #"<<an<<": ";
        an++;
        solve();

    }
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#define endl '\n'
using namespace std;

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

    int ans=0;
    string S, T;
    cin >> S >> T;
    for(int i=0; i<S.size(); i++){
        if(S[i] != T[i]) ans++;
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 3788
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline

MOD = 10 ** 9 + 7


def sum_up_to_n(n):
    return n * (n + 1) // 2


def main():
    N, K = [int(x) for x in input().split()]

    ans = 0
    b = sum_up_to_n(N)
    for i in range(K, N + 2):
        a = sum_up_to_n(i - 1)
        aa = sum_up_to_n(N - i)
        ans += (b - aa) - a + 1
        ans = ans % MOD

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9088
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

  ll dp[n+1][5][5][5]={};
  string s="zACGT";
  dp[0][0][0][0]=1;
  for(int i=0;i<n;i++){
    for(int j=0;j<5;j++){
      for(int k=0;k<5;k++){
        for(int l=0;l<5;l++){
          for(int x=1;x<=4;x++){
            if(x==2&&k==1&&l==3) continue;
            if(x==2&&j==1&&k==3) continue;
            if(x==2&&j==1&&l==3) continue;
            if(x==2&&k==3&&l==1) continue;
            if(x==3&&k==1&&l==2) continue;
            dp[i+1][k][l][x]=(dp[i+1][k][l][x]+dp[i][j][k][l])%MOD;
          }
        }
      }
    }
  }

  ll ans=0;
  for(int j=0;j<5;j++){
    for(int k=0;k<5;k++){
      for(int l=0;l<5;l++){
        ans=(ans+dp[n][j][k][l])%MOD;
      }
    }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define debug_array(a,n) for (ll bccc=(0); bccc<(n); bccc++) cout<<a[bccc]<<" "<<"\n"
#define debug_vector(a) for(ll bccc=(0); bccc<(a.size());bccc++) cout<<a[bccc]<<" "<<"\n"
#define F           first
#define S           second
#define debug_set(s) for(auto p:s) cout<<p<<" "
#define debug_map(m) for(auto p:m) cout<<p.F<<" "<<p.S<<"\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
//#pragma GCC optimize("Ofast")  // works very well
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll kjk;
    for(kjk=0;kjk<b;kjk++)
        c*=a;
    return c;
}
ll hell=1000000007;
//ll hell=998244353   ;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// to generate random number , use rng() ... eg cout<<rng();
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,m,k,i,j;
    cin>>n>>m>>k;
    string s[n];
    for(i=0;i<n;i++)
        cin>>s[i];
    ll ans=0;
    for(ll maskx=0;maskx<powr(2,n);maskx++)
    {
        for(ll masky=0;masky<powr(2,m);masky++)
        {
            string ss[n];
            for(i=0;i<n;i++)
                ss[i]=s[i];
            for(i=0;i<n;i++)
            {
                if(maskx&powr(2,i))
                {
                    for(ll j=0;j<m;j++)
                        ss[i][j]='@';
                }
            }
            for(ll j=0;j<m;j++)
            {
                if(masky&powr(2,j))
                {
                    for(i=0;i<n;i++)
                        ss[i][j]='@';
                }
            }
            ll counter=0;
            for(i=0;i<n;i++)
            {
                for(ll j=0;j<m;j++)
                {
                    if(ss[i][j]=='#')
                        counter++;
                }
            }
            if(counter==k)
                ans++;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f(i,a,n) for(i=a;i<n;i++)
#define in(x) scanf("%lld",&x)
ll fun(ll a,ll b)
{
    if(a==b)
    return a;
        ll u=(b-a)/a;
        ll k=2*a*u;
        if(b-u*a==a)
            return a+k;
        return k+2*a+fun(b-(u+1)*a,a);
}
void solve()
{ 
    ll n,x;
    cin>>n>>x;
    ll a,b;
    a=x;
    b=n-x;
    if(a>b)
        swap(a,b);
    ll ans=n+fun(a,b);
    cout<<ans;
}
int main()
{
  //   ll t;
	 // cin>>t;
	 // while(t--)
		solve();
}

Measured memory_bytes: 3624
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int x;
   cin >> x;
   x ^= 1;
   cout << x;
   return 0;
} 

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;

using namespace std;

int main(){
    ll n;
    cin >> n;
    vector<ll> p(n);
    unordered_map<ll, ll> mp;
    set<ll> s;
    rep(i, n) {
        cin >> p[i];
        mp[p[i]] = i;
        s.insert(p[i]);
    }

    set<ll> idx;
    ll ans = 0;

    while(!s.empty()) {
        ll now = *s.rbegin();
        s.erase(now);

        ll i = mp[now];
        vector<ll> l(2, -1), r(2, n);

        {
            auto itr = idx.lower_bound(i);
            rep(j, 2) {
                if (itr == idx.end()) break;
                r[j] = *itr;
                itr++;
            }

        }

        {
            auto itr = idx.lower_bound(i);
            rep(j, 2) {
                if (itr == idx.begin()) break;
                itr--;
                l[j] = *itr;
            }
        }

        ll l1 = i - l[0], l2 = l[0] - l[1];
        ll r1 = r[0] - i, r2 = r[1] - r[0];
        ans += (l1 * r2 + l2 * r1) * now;

        idx.insert(i);
    }

    cout << ans << '\n';


}

Measured memory_bytes: 9764
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  map<int,int> mp;
  while(k--)
  {
    int a;
    cin>>a;
    for(int i=0;i<a;i++)
    {
      int b;
      cin>>b;
      mp[b]=1;
    }
  }
  int cnt = 0;
  for(int i=1;i<=n;i++)
  {
    if(mp[i]==0)
    {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3596
N,M = map(int,input().split())
lr = []
for _ in range(M):
    l, r = map(int,input().split())
    lr.append((l,r))
maxim = 10**6
minumum = 0

for l, r in lr:
    if minumum < l:
        minumum = l
    if r < maxim:
        maxim = r

print(max(maxim-minumum+1,0))


Measured memory_bytes: 16584
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define ll long long
using namespace std;
const int MOD = 1000000007;
const long long INF = 1LL << 60;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);
  vector<pair<ll, ll>> b(m);
  // vector<ll> c(m);
  // priority_queue<ll, vector<ll>, greater<ll>> q;
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (ll i = 0; i < m; i++) {
    ll x, y;
    cin >> x >> y;
    b[i] = pair<ll, ll>(y, x);
  }
  sort(a.begin(), a.end());
  sort(b.rbegin(), b.rend());
  ll j = 0;
  ll sum = 0;
  for (ll i = 0; i < n; i++) {
    if (a[i] < b[j].first) {
      a[i] = b[j].first;
      b[j].second--;
      if (b[j].second <= 0) {
        j++;
      }
    }
    sum += a[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 5544
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 15, INF = 0x3f3f3f3f;
int a[N][N], n, m;
int main() {
    // freopen("in.txt", "r", stdin);
    int x, y, w;
    while(scanf("%d", &m) && m) {
        n = 0;
        for(int i = 0; i < N; i++)
            for(int j = 0; j < N; j++)
                if(i == j)  a[i][j] = 0;
                else    a[i][j] = INF;
        for(int i = 0; i < m; i++) {
            scanf("%d %d %d", &x, &y, &w);
            n = max({x, y, n});
            a[x][y] = a[y][x] = min(a[x][y],w);
        }
        for(int k = 0; k <= n; k++)
            for(int i = 0; i <= n; i++)
                for(int j = 0; j <= n; j++)
                    if(a[i][j] > a[i][k] + a[k][j])
                        a[i][j] = a[i][k] + a[k][j];
        ll ans = INF, pos;
        for(int i = 0; i <= n; i++) {
            ll sum = 0;
            for(int j = 0; j <= n; j++)
                sum += a[i][j];
            if(sum < ans) {
                ans = sum;
                pos = i;
            }
        }
        printf("%lld %lld\n", pos, ans);
    }
    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI acos(-1)
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 
const int N = 0;
 
typedef long long int ll;
 
using namespace std;


 
int main(){
    FIN;
    //freopen("../input.txt", "r", stdin);freopen("../output.txt", "w", stdout);
    int a,b,c,d;cin>>a>>b>>c>>d;
    int i = 1;
    while(a>0 && c>0){
        if(i%2 == 0){
            a-=d;
        }else{
            c-=b;
        }
        //cout<<a<<" "<<c<<"\n";
        i++;
    }
    if(a<= 0){
        cout<<"No";
    }else{
        cout<<"Yes";
    }

    return 0;
}

// ============== Notes =============== //
// common bugs
// - remove reader 
// - fastio
// - int overflow (especially intermediate expressionns)
// - array bounds (indices bigger than MAXN?, is MAXN correct?)
// - special cases (n=1, graph not connected?)
// - re-initialize efficiently between test cases

Measured memory_bytes: 3656
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	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;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=200005;
const int mod=998244353;
char ch[MAXN];
int n,f[2*MAXN],g[2*MAXN];
void ad(int &x,int y){x+=y;if(x>=mod)x-=mod;}
void dl(int &x,int y){x-=y;if(x<0)x+=mod;}
int lst[2*MAXN];
bool check(int d)
{
	for(int i=1;i<=d;i++)lst[i]=ch[i]-'0';
	for(int j=d+1;j<=n;j++)
	{
		if(ch[j]-'0'<(lst[j-d]^1))return false;
		if(ch[j]-'0'>(lst[j-d]^1))return true;
		lst[j]=lst[j-d]^1;
	}
	return true;
}
vector<int> tag[2*MAXN];
int main()
{
	for(int i=1;i<2*MAXN;i++)for(int j=1;i*j<2*MAXN;j++)
		tag[i*j].push_back(i);
	n=read();scanf("%s",ch+1);
	int ans=0;
	for(int d=1;d<=2*n;++d)if(!((2*n)%d)&&((2*n/d)&1))
	{
		int k=d/2,cnt=0;
		for(int j=1;j<=k;j++)cnt=(cnt<<1|ch[j]-'0')%mod;f[d]=cnt;
		ad(f[d],check(k));
	}
	for(int i=1;i<=2*n;i++)if(f[i])
	{
		for(int j=0;j<tag[i].size();j++)
		{
			int u=tag[i][j];
			if(u!=i)dl(g[i],g[u]);
		}ad(g[i],f[i]);
		ad(ans,1LL*i*g[i]%mod);
	}pr2(ans);
	return 0;
}


Measured memory_bytes: 47548
#include <iostream>

using namespace std;
typedef unsigned long long int ll;


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

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

int main() {
	int N; cin >> N;
	ll ans = 1;
	for(int i = 0; i < N; i++) {
	    ll t; cin >> t;
	    ans = lcm(ans, t);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
  void run() {
    Scanner sc = new Scanner(System.in);
    long x = sc.nextLong();

    long ans = x / 11;
    if (6*ans + 5*ans >= x) {
      System.out.println(2*ans);
    } else if (6*(ans+1) + 5*ans >= x) {
      System.out.println(2*ans + 1);
    } else if (6*(ans+1) + 5*(ans+1) >= x) {
      System.out.println(2*ans + 2);
    }
  }
 
  public static void main(String[] args) {
    new Main().run();
  }
}

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

int main(void){
    int N,T;
    int c[1010]={0};
    int t[1010]={0};
    bool TLE = true;
    int min_time=500000;
    int min_route=500000;

    cin>>N>>T;
    for(int i = 0; i<N;i++){
        cin>>c[i]>>t[i];
    }

    for(int i=0;i<N;i++){
        if(min_route>c[i]&&t[i]<=T){
            min_route=c[i];
            min_time=t[i];
        }
    }
    



    if(min_time>T){
        cout<<"TLE"<<endl;
        return 0;
    }

    cout<<min_route<<endl;

    return 0;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#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, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    string s;
    cin >> n >> s;
    cout << (s.substr(0, n/2) == s.substr(n/2) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
d = int(input())
c = [int(i) for i in input().split()]
s = [[int(i) for i in input().split()] for j in range(d)]

#t = [int(input()) for i in range(d)]

ans = []
last = [[0 for i in range(26)] for j in range(27)]

for i in range(1,d+1):
    tmp_ans = [0]*26
    tmp_num = 0
    for j in range(26):
        tmp_ans[j] += s[i-1][j]
        last[j+1][j] = i
        for k in range(26):
            tmp_ans[j] -= (i-last[j+1][k])*c[k]
    idx = tmp_ans.index(max(tmp_ans))
    for j in range(26):
        for k in range(26):
            if k == idx:
                continue
            last[k][j] = last[idx][j]
    print(idx+1)
    #print(tmp_ans)
#print(ans)
    """
            
    ans += s[i-1][t[i-1]-1]
    last[t[i-1]-1] = i
    for j in range(26):
        ans -= (i-last[j])*c[j]
    print(ans)
    """
    


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

class Main{
    final static long MOD = 1000000007;
    FastScanner sc = new FastScanner();

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve(){

        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(n + a + b >= 22) System.out.println("bust");
        else System.out.println("win");

    }

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

    long pow_mod(long a, long r){ // return a^r (mod MOD)
        long sum = 1;
        while(r > 0){
            if((r & 1) == 1){
                sum *= a;
                sum %= MOD;
            }
            a *= a;
            a %= MOD;
            r >>= 1;
        }
        return sum;
    }

}



class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte(){
        if(ptr < buflen){
            return true;
        }else{
            ptr = 0;
            try{
                buflen = in.read(buffer);
            }catch(IOException e){
                e.printStackTrace();
            }
            if(buflen <= 0){
                return false;
            }
        }
        return true;
    }
    private int readByte(){ if(hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c){ return 33 <= c && c <= 126;}
    public boolean hasNext(){ while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next(){
        if(!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong(){
        if(!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        if(b < '0' || '9' < b){
            throw new NumberFormatException();
        }
        while(true){
            if('0' <= b && b <= '9'){
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt(){
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble(){ return Double.parseDouble(next());}
}


Measured memory_bytes: 23124
/**
 * File              : C.cpp
 * Author            : JCHRYS <jchrys@me.com>
 * Date              : 10.01.2020
 * Last Modified Date: 10.01.2020
 * Last Modified By  : JCHRYS <jchrys@me.com>
 */

#include <bits/stdc++.h>
using namespace std;

vector<vector<int>> order;
vector<int> subset;
bool visit[10] {};
int n;

void dfs(int depth, int n) {
    if (depth == n) {
        order.push_back(subset);
    }  else {
        for (int i = 1; i <= n; i++) {
            if (visit[i]) continue;
            visit[i] = true;
            subset.push_back(i);
            dfs(depth+1, n);
            visit[i] = false;
            subset.pop_back();
        } 
    }
}


void build() {
    dfs(0, n);
}

int main() {
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    for (int i = 0; i < n; i++)
        cin >> p[i];
    for (int i = 0; i < n; i++)
        cin >> q[i];
    build();
    int a = lower_bound(order.begin(), order.end(), p) - order.begin(); 
    int b = lower_bound(order.begin(), order.end(), q) - order.begin();
    cout << abs(a-b);


    return 0;
}


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

//region Template
#include "ext/pb_ds/assoc_container.hpp"

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int MOD = 1000000007;

using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;

#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }

void setOut(string s) { freopen(s.c_str(), "w", stdout); }

//const string USCAO_TAG = "mountains";
void usaco(const string &USACO_TAG) {
	setIn(USACO_TAG + ".in");
	setOut(USACO_TAG + ".out");
}

void print() {}

template<typename T, typename... Args>
void print(T firstArg, Args... args) {
	#ifdef LOCAL
	cout << firstArg << "\t";
	print(args...);
	#endif
}
//endregion

/* Notes:
 * Farah </3
 */

const int MAXN = 55;
const ll INF = 2e18;


ll a[MAXN];

int main() {
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int n, k;
	cin >> n >> k;

	for(int i = 0; i < n; i++){
		cin >> a[i];
	}

	ll ans = 0;
	for(int i = 1; i <= min(n, k); i++){
		vector<ll> left, right;

		for(int j = 0; j < i; j++){
			left.push_back(a[j]);
		}
		for(int j = -1; j < i; j++){
			if(j > -1) {
				left.pop_back();
				right.push_back(a[n - j - 1]);
			}

			vector<ll> v;
			for(auto x : left) v.push_back(x);
			for(auto x : right) v.push_back(x);

			sort(v.begin(), v.end());
			int idx = 0;
			for(int q = 0; q < (int) v.size() && idx < k - i; q++){
				if(v[idx] < 0){
					v[idx] = 0;
					idx++;
				}
			}
			ll sum = 0;
			for(auto x : v) sum += x;
			ans = max(ans, sum);
		}
	}
	cout << ans;
}


Measured memory_bytes: 3612
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

int main()
{
	int n, ans = 0;
	cin >> n;
	int n_ = n;
	while (n > 0)
	{
		ans += n % 10;
		n /= 10;
	}

	if (n_ % ans == 0)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char *argv[]){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a==1){
		a=14;
	}
	if(b==1){
		b=14;
	}
	if(a>b){
		printf("Alice\n");
	}
	else if(a<b){
		printf("Bob\n");
	}
	else{
		printf("Draw\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <bitset>

using namespace std;

int n, m;
const int MOD = 998244353;
long long ans = 0;
long long fact[6100000];
long long ufact[6100000];

long long inq(long long a, long long b)
{
    if (b == 0) return 1;
    long long l = inq(a, b / 2);
    if (b % 2) return l * l % MOD * a % MOD;
    return l * l % MOD;
}

long long cnk(long long n, long long k)
{
    return fact[n] * ufact[k] % MOD * ufact[n - k] % MOD;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	fact[0] = 1, ufact[0] = 1;
	cin >> n >> m;
	for (int i = 1; i <= 4 * (n + m); i++) fact[i] = fact[i - 1] * i % MOD, ufact[i] = inq(fact[i], MOD - 2);
	ans = cnk(3 * m + n - 1, n - 1);
	ans = (ans + MOD - n) % MOD;
	n--;
	for (int bad_len = 2 * m + 1; bad_len < 3 * m; bad_len++)
    {
        int cnt_pos = 3 * m - bad_len - 1;
        ans = (ans + MOD - cnt_pos * cnk(3 * m - bad_len + 1 + n - 2, n - 2) % MOD) % MOD;
        ans = (ans + MOD - 2 * cnk(3 * m - bad_len + 1 + n - 1, n - 1) % MOD) % MOD;
    }
    for (int b = m + 1; b <= min(3 * m, n + 1); b++)
    {
        int p = 3 * m + b;
        int g = n + 1 - b;
        int len = 3 * m + g;
        int kek = len - n - 1;
        if (kek % 2 == 0)
        {
            kek /= 2;
            ans = (ans + MOD - cnk(kek + n, n) * cnk(n + 1, g) % MOD) % MOD;
        }
    }
    cout << ans;
}


Measured memory_bytes: 94848
n = gets.to_i
s = gets.strip

w = Array.new(n, 0)
e = Array.new(n, 0)

t = 0
1.upto(n - 1) do |i|
  t += 1 if s[i - 1] == "W"
  w[i] = t
end

t = 0
(n - 2).downto(0) do |i|
  t += 1 if s[i + 1] == "E"
  e[i] = t
end

ans = n
0.upto(n - 1) do |i|
  a = w[i] + e[i]
  ans = a if a < ans
end

puts ans


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

const int MN = 100010;

int N;
int A[MN], B[MN];
unordered_map<int, int> cnt;

int Xn;
vector<int> X;
map<int, int> dx;

vector<int> adj[MN << 1];
int vis[MN << 1];

void dfs(int u) {
    vis[u] = 1;

    for(int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if(!vis[v]) {
            dfs(v);
        }
    }
}

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

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

    for(int i = 0; i < N; i++) cnt[ A[i] ]++;
    for(int i = 0; i < N; i++) {
        cnt[ B[i] ]--;
        if(cnt[ B[i] ] < 0) {
            printf("-1");
            return 0;
        }
    }
    for(int i = 0; i < N; i++) X.push_back(A[i]);
    sort(X.begin(), X.end());
    X.resize(unique(X.begin(), X.end()) - X.begin());
    Xn = X.size();
    for(int i = 0; i < Xn; i++) dx[X[i]] = i;
    for(int i = 0; i < N; i++) {
        A[i] = dx[A[i]];
        B[i] = dx[B[i]];
    }

    int t = 0;
    if(A[N - 1] != B[N - 1]) t = 1;
    for(int i = 0; i < N - 1; i++) if(A[i] != B[i] && A[i] == A[N - 1]) t = 1;
    if(t) {
        int d = 0;
        for(int i = 0; i < N; i++) {
            if(i != N - 1 && A[i] == B[i]) {
                d++;
                continue;
            }

            adj[ N + A[i] ].push_back(i);
            adj[ N + B[i] ].push_back(i);
            adj[i].push_back(N + A[i]);
            adj[i].push_back(N + B[i]);
        }
        int ccnt = 0;
        for(int i = 0; i < N; i++) if(!vis[i]) {
            if(i != N - 1 && A[i] == B[i]) continue;
            dfs(i);
            ccnt++;
        }
        printf("%d", N - d + ccnt - 2);
    }
    else {
        int d = 0;
        for(int i = 0; i < N - 1; i++) {
            if(A[i] == B[i]) {
                d++;
                continue;
            }

            adj[ N + A[i] ].push_back(i);
            adj[ N + B[i] ].push_back(i);
            adj[i].push_back(N + A[i]);
            adj[i].push_back(N + B[i]);
        }
        int ccnt = 0;
        for(int i = 0; i < N - 1; i++) if(!vis[i]) {
            if(A[i] == B[i]) continue;
            dfs(i);
            ccnt++;
        }
        printf("%d", N - 1 - d + ccnt);
    }
}


Measured memory_bytes: 28196
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

template <class T>
struct dice {
  T t,b,n,s,e,w;              // top bottom north south east west
  dice() {}
  dice(T t, T b, T n, T s, T e, T w) : t(t),b(b),n(n),s(s),e(e),w(w) {}
  void roll(T &a, T &b, T &c, T &d) { swap(a,b); swap(b,c); swap(c,d); }
  void roll_x() { roll(t, n, b, s); }
  void roll_y() { roll(t, w, b, e); }
  void roll_z() { roll(s, e, n, w); }
  vector<dice> all_rolls() {
    vector<dice> ret;
    for (int k=0; k<6; (k&1?roll_y():roll_x()),++k)
      for (int i=0; i<4; roll_z(), ++i)
        ret.push_back(*this);
    return ret;
  }
};
 
dice<int> di[3][3][3];              // ツ偲ィツ前ツづ個債カツ湘」ツつェツ個エツ点ツ、ツ右ツ古シツつォXツ篠イツ・ツ可コツ古シツつォYツ篠イツ・ツ可彁ツ篠イ
int top[3][3];
int front[3][3];

set<int> ans;

void dfs(int x, int y, int z) {
  if (x == 3) { dfs(0,y+1,z); return; }
  if (y == 3) { dfs(0, 0, z+1); return; }
  if (z == 3) {
    int sum = 0; 
    REP(i, 3) REP(j, 3)
      sum += di[2][i][j].e;
    ans.insert(sum);
    return;
  }
  dice<int> d(1,6,5,2,3,4);
  vector<dice<int> > all = d.all_rolls();
  int res = 0;
  REP(i, all.size()) {
    if (z == 0 && front[y][x] && all[i].s != front[y][x]) continue;
    if (y == 0 && top[2-z][x] && all[i].t != top[2-z][x]) continue;
    if (x && di[x-1][y][z].e + all[i].w != 7) continue;
    if (y && di[x][y-1][z].b + all[i].t != 7) continue;
    if (z && di[x][y][z-1].n + all[i].s != 7) continue;
    di[x][y][z] = all[i];
    //cout << "i = " << i << " " << di[x][y][z].t << " " << di[x][y][z].s << " " << di[x][y][z].e << endl;
    dfs(x+1,y,z);
  }
}

int main() {
  int N;
  cin >> N;
  while(N--) {
    REP(i, 3) REP(j, 3)
      cin >> top[i][j];
    REP(i, 3) REP(j, 3)
      cin >> front[i][j];
    ans.clear();
    dfs(0,0,0);
    if (ans.size()) {
      bool f = 0;
      FOR(it, ans) {
        if (f) cout << " ";
        f = 1;
        cout << *it;
      }
      cout << endl;
    } else {
      cout << 0 << endl;
    }
  }
}

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

int main(){
	int n,k;
	string s;
	cin>>n>>k>>s;
	int now=0;
	vector<int> comp;
	//両端を逆立ちと思いたいその1
	if (s[0]=='0') {
		comp.push_back(0);
		now++;
	}
	//連結成分の長さをベクターに突っ込む
	comp.push_back(1);
	for (int i = 1; i < n; i++) {
		if (s[i]==s[i-1]) {
			comp[now]++;
		}else {
			comp.push_back(1);
			now++;
		}
	}
	//両端を逆立ちと思いたいその2
	if (s[n-1]=='0') {
		comp.push_back(0);
	}
	priority_queue<int> cand;
	//初期状態を作る
	int temp=0;
	for (int i = 0; i < min(2*k+1,(int)comp.size()); i++) {
		temp+=comp[i];
	}
	cand.push(temp);
	int left=0;
	int right=min(2*k+1,(int)comp.size())-1;
	//候補を突っ込みまくる
	while (right+1<comp.size()) {
		temp+=comp[right+1]+comp[right+2]-comp[left]-comp[left+1];
		cand.push(temp);
		left+=2;
		right+=2;
	}
	cout<<cand.top()<<endl;
}

Measured memory_bytes: 1272
parseInt(x) = parse(Int,x)
parseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
    A,B,H,M = parseMap(split(readline()))
    ht = (H+M/60)*pi/6
    mt = M*pi/30
    t = abs(ht-mt)
    s = min(t,2*pi-t)
    C =sqrt(A^2+B^2-2*A*B*cos(s))
    println(C)
end

main()

Measured memory_bytes: 209212
#include<bits/stdc++.h>
#define register rg
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
using namespace std;
typedef long long ll;
int main() {
	//file("a");
	int a,b;
	cin>>a>>b;
	if(b%a==0)
		cout<<a+b;
	else
		cout<<b-a;
	return 0;
}


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

int main() {
  int K, S;
  cin >> K >> S;

  int ans = 0;

  for (int X = 0; X <= K; X++) {
    for (int Y = 0; Y <= K; Y++) {
      int Z = S - X - Y;
      if (0 <= Z && Z <= K) ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
function main()
    s = chomp(readline())
    a, b = [], []
    nw = a
    for i in 1:length(s)
        if s[i] == ' '
            nw = b
        else
            push!(nw,s[i]-'0')
        end
    end
    n, K = 0, 0
    d = 1
    for i in length(a):-1:1
        n += a[i]*d
        d *= 10
    end
    d = 1
    for i in length(b):-1:1
        K += d*b[i]
        d *= 10
    end
    (n % K == 0) ? println(0) : println(1)
end

main()


Measured memory_bytes: 169440
#include <bits/stdc++.h>
#define INF (1LL << 60)
#define ALL(x) (x).begin(),(x).end()
typedef long long LL;
using namespace std;

int main() {
	int n;	cin >> n;
	vector<int> l(n);
	int sum = 0;
	for (auto& x : l) {
		cin >> x;
		sum += x;
	}
	cout << ((sum - 2 * *max_element(ALL(l)) > 0) ? "Yes" : "No");

}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{

	public static void main(String[] args)  {
		Scanner sc = new Scanner(System.in);
		int ame = 0;
		int value = sc.nextInt();
		for(int i =1;i <= value; i++) {
			ame += i;
		}
		System.out.println(ame);
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) ((x).begin(), (x).end())
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

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

    string s;
    cin >> s;
    puts(s[2] == s[3] && s[4] == s[5] ? "Yes" : "No");

    return 0;
}

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

using namespace std;

int main(){
    int n, k, ans = 1000000000;
    cin >> n >> k;
    vector<int> h(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    sort(begin(h), end(h));
    for(int i = k - 1; i < n; i++){
        ans = min(ans, h[i] - h[i - (k - 1)]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
int main(){
	int n,d,x;
	cin >> n >> d >> x;
	int a[n];
	rep(i,n){
		cin>>a[i];
		x+=(d-1)/a[i]+1;
	}
	cout << x << endl;
}


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

int main() {
  int h,w;
  string l;
  cin >> h >> w;
  
  for(int i=0; i<h; i++){
    string s;
    cin >> s;
    l += s;
  }
  int n = 0;
  string a;
  for(int i=0; i<h; i++){

    for(int i=0; i<w; i++){
      if (l.at(n)  == '#') {
         cout << "#";
      } else {

        int c = 0;
        int s1, s2, s3, s4, s5, s6, s7, s8;
        s1 = n - w - 1;
        s2 = n - w;
        s3  = n - w + 1;
        s4 = n - 1;
        s5 = n + 1;
        s6  = n + w - 1;
        s7 = n + w;
        s8  = n + w + 1;
        if( s1 >= 0 && s1 < l.size() && i != 0)     { if (l.at(s1) == '#') c++;}
        if( s2 >= 0 && s2 < l.size() )              { if (l.at(s2) == '#') c++;}
        if( s3 >= 0 && s3 < l.size() && i != w - 1) { if (l.at(s3) == '#') c++;}
        if( s4 >= 0 && s4 < l.size() && i != 0)     { if (l.at(s4) == '#') c++;}
        if( s5 >= 0 && s5 < l.size() && i != w - 1) { if (l.at(s5) == '#') c++;}
        if( s6 >= 0 && s6 < l.size() && i != 0)     { if (l.at(s6) == '#') c++;}
        if( s7 >= 0 && s7 < l.size() )              { if (l.at(s7) == '#') c++;}
        if( s8 >= 0 && s8 < l.size() && i != w - 1) { if (l.at(s8) == '#') c++;}
        cout << c;
        
      }
      n++;
    }
    cout << endl;
  }
  cout << a << endl;
}


Measured memory_bytes: 256
#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; }


void func(long long N, long long M, std::vector<long long> p, std::vector<std::string> S){
    int WA[105000];
    bool AC[105000];
    int WAnum = 0;
    int ACnum = 0;
    rep(i, N){
        WA[i] = 0;
        AC[i] = false;
    }
    for(int i = 0; i < M; i++){
        if(AC[p[i]]) continue;
        if(S[i] == "AC"){
            AC[p[i]] = true;
            ACnum++;
            WAnum += WA[p[i]];
        }
        else if (S[i] == "WA") {
            WA[p[i]]++;
        }
    }
    cout << ACnum << " " << WAnum << endl;
}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> p(M);
    std::vector<std::string> S(M);
    for(long long i = 0 ; i < M ; i++){
        scanf("%lld",&p[i]);
        std::cin >> S[i];
    }
    func(N, M, std::move(p), std::move(S));
    return 0;
}


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

const long long INF = ll(1e18) + 1;

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

  vector<long long> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  
  sort(a.begin(), a.end());

  long long left = -INF, right = INF;

  /* 二分探索の時間　*/
  auto isOK = [&](ll key){
    ll total = 0;
    for(int i = 0; i < n; i++){
      if(a[i] < 0){
        int l = -1, r = n;
        while(l + 1 < r){
          int c = (l+r)/2;
          if(a[c]*a[i] < key) r = c; else l = c;
        }
        total += n - r;
      }else{
        int l = -1, r = n;
        while(l + 1 < r){
          int c = (l+r)/2;
          if(a[c]*a[i] < key) l = c; else r = c;
        }
        total += r;
      }
      if(a[i]*a[i] < key) total--;
    }
    total /= 2;
    //cout << "mid: " << key <<  " total: " << total << " return: " << (total < k) << endl;
    return total < k;
  };

  ll ok = -INF, ng = INF;
  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;

    if(isOK(mid))ok = mid;
    else ng = mid;
  }

  cout << ok << endl;  
}

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

int main(){

  int a,b,c;

  cin >> a >> b >> c;

  if((a == 7 && b == 5 && c == 5) || (a == 5 && b == 7 && c == 5) || (a == 5 && b == 5 && c == 7)){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <climits>

using namespace std;

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

typedef long long LL;
typedef vector<int> VI;

int main() {
  std::string S;
  cin >> S;
  int cnt = 0;
  int maxv = 0;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == 'R') {
      cnt++;
      maxv = max({maxv, cnt});
    } else {
      cnt = 0;
    }
  }
  cout << maxv << endl;
  return 0;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
int A, B, C, K;

int main(){
    cin >> A >> B >> C;
    cin.ignore();
    cin >> K;
    cin.ignore();
    while(A >= B && K > 0){
        B *= 2;
        --K;
    }
    if(A>=B){
        cout << "No" << endl;
        return 0;
    }
    while(B >= C && K > 0){
        C *= 2;
        --K;
    }
    if(B >= C){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
typedef long long ll;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define forn(i,a,b) for(ll i=a;i<(ll)b;i++)
ll fun(ll x)
{
    if(x==1)
    return 1;
    return (1+2*fun(x/2));
}
int main()
{
    ll h;
    cin>>h;
    cout<<fun(h);
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] argv) throws IOException {
        //*
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        while(true) {
            String s = in.readLine();
            if (s == null || s.length() < 1) {
                break;
            }
            f(s);
        }
        /*/
        f("8 6");
        f("50000000 30000000");
        //*/
    }

    public static void f(String s) {
        String[] sp = s.split(" ");
        BigInteger a = BigInteger.valueOf(Integer.parseInt(sp[0]));
        BigInteger b = BigInteger.valueOf(Integer.parseInt(sp[1]));
        if (a.compareTo(b) == -1) {
            BigInteger temp = a;
            a = b;
            b = temp;
        }
        System.out.println(a.gcd(b) + " " + lcm(a, b));
    }

    public static BigInteger lcm(BigInteger m, BigInteger n) {
        final BigInteger gcd = m.gcd(n);
        if (gcd.compareTo(BigInteger.ZERO) == 0) {
            return BigInteger.ZERO;
        }
        return m.multiply(n).divide(gcd);
    }
}

Measured memory_bytes: 9832
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<cstdlib>
#include<stack>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
#define lck_max(a,b) ((a)>(b)?(a):(b))
#define lck_min(a,b) ((a)<(b)?(a):(b))
typedef long long LL;
LL x,y;
inline LL read()
{
	LL kr=1,xs=0;
	char ls;
	ls=getchar();
	while(!isdigit(ls))
	{
		if(!(ls^45))
			kr=-1;
		ls=getchar();
	}
	while(isdigit(ls))
	{
		xs=(xs<<1)+(xs<<3)+(ls^48);
		ls=getchar();
	}
	return xs*kr;
}
inline void out(LL xs)
{
	if(!xs) {putchar(48); return;}
	if(xs<0) putchar('-'),xs=-xs;
	int kr[57],ls=0;
	while(xs) kr[++ls]=xs%10,xs/=10;
	while(ls) putchar(kr[ls]+48),ls--;
}
int main()
{
	x=read();y=read();
	out(x+y/2),putchar('\n');
return 0;
}


Measured memory_bytes: 256