akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll     = long long;
using prefix = __attribute__((constructor))void;
const ll MOD = 1000000007;
const ll INF = 9223372036854775807LL;

#define elif           else if
#define def            inline auto
#define func           inline constexpr ll
#define up(i,a,n)      for(ll i=(a),i##_1=(n);i<=i##_1;++i)
#define down(i,a,n)    for(ll i=(a),i##_1=(n);i>=i##_1;--i)
#define rep(i,n)       up(i,0,n-1)
#define append(a)      push_back(a)

func    gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
func    lcm(ll a,ll b) {return a*b/gcd(a,b);}
def     dig(ll a)      {return to_string(a).length();}
prefix  init()         {cin.tie(0),ios::sync_with_stdio(0),cout<<fixed<<setprecision(10);}

signed main(){
    ll N,M,S=0;
    cin>>N>>M;
    ll A[N];
    rep(i,N)cin>>A[i];
    sort(A,A+N);
    rep(i,N){
        if(M>=A[i]){
            M-=A[i];
            S++;
            if(i==N-1&&M&&S)S--;
        }
        else break;
    }
    
    cout<<S<<endl;
}

Measured memory_bytes: 256
/*
(1)for binary shift operator always use 'LL' 1LL<<63

*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set_pair tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
  const double  pi=3.1415926535; 
  struct pair_hash
{
	template <class T1, class T2>
	std::size_t operator () (std::pair<T1, T2> const &pair) const
	{
		std::size_t h1 = std::hash<T1>()(pair.first);
		std::size_t h2 = std::hash<T2>()(pair.second);

		return h1 ^ h2;
	}
};
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;cin>>n;
	cout<<(1000-n%1000)%1000;

	return 0;
} 

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

int main() {
  int N;
  cin >> N;
  int F[N][10];
  int P[N][11];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> F[i][j];
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= 10; j++) {
      cin >> P[i][j];
    }
  }

  bool flag[10];
  int c[N];
  int ans = -2e9;
  for (int i = 1; i < 1024; i++) {
    fill(flag, flag + 10, false);
    fill(c, c + N, 0);
    for (int j = 0; j < 10; j++) {
      if ((i >> j) & 1) flag[j] = true;
    }
    for (int j = 0; j < N; j++) {
      for (int k = 0; k < 10; k++) {
        if (F[j][k] == 1 && flag[k]) c[j]++;
      }
    }
    int tmp = 0;
    for (int j = 0; j < N; j++) {
      tmp += P[j][c[j]];
    }
    ans = max(ans, tmp);
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
using ll = int64_t;
using ull = uint64_t;
using namespace std;

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

    for (size_t i = 0; i < N; i++) {
        bool isMatch = true;
        for (size_t j = i; j < N; j++) {
            // cout << s.at(j) << " " << t.at(j - i) << endl;
            if (s.at(j) != t.at(j - i)) {
                isMatch = false;
            }
        }

        if (isMatch) {
            cout << (N - i) + i * 2 << endl;
            return 0;
        }
    }
    cout << N * 2;
}

Measured memory_bytes: 3580
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

	if (n % 2 == 0) {
		cout << n / 2 << endl;
	}
	else cout << n / 2 + 1 << endl;

	return 0;
}

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

int main(){
  int a[3][3];
  for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++) cin >> a[i][j];
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    int b;
    cin >> b;
    int flag = 0;
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 3; k++){
        if(b == a[j][k]){
          a[j][k] = -1;
          flag = 1;
          break;
        }
      }
      if(flag == 1) break;
    }
  }

  int flagall = 0;
  for(int i = 0; i < 3; i++){
    int flag1 = 0, flag2 = 0;
    for(int j = 0; j < 3; j++){
      if(a[i][j] == -1) flag1++;
      if(a[j][i] == -1) flag2++;
    }
    if(flag1 == 3 || flag2 == 3){
      flagall = 1;
      break;
    }
  }
  if(a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1) flagall = 1;
  else if(a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1) flagall = 1;
  if(flagall == 1) cout << "Yes\n";
  else cout << "No\n";
  return 0;

}


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

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

	if ( N == 1 ) {
		cout << "Hello World" << endl;
	} else {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}

	return ( 0 );
}


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

using namespace std;

#define int long long

int n, k;
int a[200001], p[200001];
                            
int bit[200001];
void upd(int u)
{
	for (; u <= 200000; u += u & (-u))
		bit[u]++;			
}

int query(int u)
{
	int ans = 0;
	for (; u > 0; u -= u & (-u))
		ans += bit[u];
	return ans;			
}

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

	cin >> n >> k;
	vector<int> val_p = {-1000000000000000000LL, 0LL};
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		a[i] -= k;
		p[i] = p[i - 1] + a[i];
		val_p.push_back(p[i]);
	}
	sort(val_p.begin(), val_p.end());
	val_p.resize(unique(val_p.begin(), val_p.end()) - val_p.begin());
	upd(lower_bound(val_p.begin(), val_p.end(), p[0]) - val_p.begin());
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		int pos = lower_bound(val_p.begin(), val_p.end(), p[i]) - val_p.begin();
		ans += query(pos);
		upd(pos);			
	}
	cout << ans;
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<vector<int>> v(n * 2, vector<int>(2));
	for (int i = 0; i < n; i++)
	{
		cin >> v[i][0];
		v[i][1] = 1;
	}
	for (int i = n; i < n * 2; i++)
	{
		cin >> v[i][0];
		v[i][1] = -1;
	}
	sort(v.begin(), v.end());
	long long ret = 1;
	long long count = 0;
	for (auto x : v)
	{
		if (x[1] < 0)ret *= max(count, -(count - 1));
		ret %= (int)1e9 + 7;
		count += x[1];
	}
	cout << ret << endl;
	return 0;
}


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

typedef long long ll;

int main() {
    ll N;
    cin >> N;
    string S;
    if (N == 0) S="0";
    while (abs(N)>0) {
        if (N%2==0) S="0"+S;
        else {
            S="1"+S;
            N--;
        }
        N/=-2;
    }
    cout << S << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define REP(i,n) FOR(i,0,n)
 
int main() {
  int A, P;
  int ans;
 
  cin >> A >> P;
 
  ans = (P + A * 3) / 2;
 
  cout << ans << endl;
 
  return 0;
}

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

using namespace std;

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

struct edge {int cost, to; };

typedef pair<int, pair<int, int> > P; // cost, vertex, chicket
typedef pair<int, int> Pint; //

int c, n, m, s, d;
int dist[110][15];

int main() {
    while(true) {
        cin >> c >> n >> m >> s >> d;
        if (n==0) break;

        vector<edge> g[110];
        REP(i, m) {
            int a, b, f;
            cin >> a >> b >> f;
            
            edge e;
            e.to = b-1;
            e.cost = f;
            g[a-1].push_back(e);
            
            edge e2;
            e2.to = a-1;
            e2.cost = f;
            g[b-1].push_back(e2);
        }

        REP(i, n) {
            REP(j, c+1) {
                dist[i][j] = INF;
            }
        }
        dist[s-1][c] = 0;

        P p=pair<int, Pint>(0, Pint(s-1, c));
        priority_queue<P, vector<P>, greater<P> > que;
        que.push(p);

        while(!que.empty()) {
            P p = que.top();
            que.pop();

            int v = p.second.first;
            int ckt = p.second.second;
            if(dist[v][ckt] < p.first) continue;

            REP(i, g[v].size()) {
                int to = g[v][i].to;
                int cost = g[v][i].cost;
                // don't use chicket
                if (dist[to][ckt] > dist[v][ckt] + cost){
                    dist[to][ckt] = dist[v][ckt] + cost;
                    P p = pair<int, Pint>(dist[v][ckt] + cost, Pint(to, ckt));
                    que.push(p);
                }

                // use chicket
                if (ckt >= 1) {
                    if (dist[to][ckt-1] > dist[v][ckt] + cost/2){
                        dist[to][ckt-1] = dist[v][ckt] + cost/2;
                        P p = pair<int, Pint>(dist[v][ckt] + cost/2, Pint(to, ckt-1));
                        que.push(p);
                    }
                }
            }
        }
        
        int output = INF;
        REP(i, c+1) {
            output = min(output, dist[d-1][i]);
        }

        cout << output << endl;
    }
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define EPS (1e-10)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	int n,a,b;cin>>n>>a>>b;
	cout<<min(n*a,b)<<endl;
}

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


int main()
{	
	string a,b;
	cin>>a>>b;
	if(a+b[b.length()-1]==b)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3628
#include<math.h>
#include <stdio.h>
int main(void)
{
	int a, b, c;
	double d, s, l, h, e, f;
	scanf("%d %d %d", &a, &b, &c);
	e = 3.141592653589*c/180;
	s = 0.5*a*b*sin(e);
	d = pow(a, 2) + pow(b, 2) - 2 * a*b*cos(e);
	f = sqrt(d);
	l = a+b+f;
	h = 2*s/a;
	printf("%f\n%f\n%f\n", s, l, h);
	return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int mod){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%mod;Rac[n-1]=modInv(Fac[n-1],mod);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 998244353;
const int N = 1e5;
ll n, m, v, p, a[N];
ll _s[N+1], *s=_s+1;
bool check(ll b){
  if(b >= n-p) return true;
  if(a[b]+m < a[n-p]) return false;
  b = upper_bound(a, a+n, a[b])-a-1;
  return (v-p-b)*m+s[n-p]-s[b] <= (a[b]+m)*(n-p-b);
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m >> v >> p;
  FOR(i, 0, n) cin >> a[i];
  sort(a, a+n);
  FOR(i, 0, n) s[i] = s[i-1]+a[i];
  maxs(v, p);
  ll ng=-1, ok=n-1, mid;
  while(ok-ng>1){
    mid = (ok+ng)/2;
    (check(mid) ? ok : ng) = mid;
  }
  cout << n-ok << endl;
}

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

int main (){

    int a, b;
    cin >> a >> b;
    int x = a + b;
    int xa = x%2;
  int y;
  if(xa ==0){
        y = x/2;

    }
    else{
        y = (x+1)/2;

    }

    cout << y << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;


signed main(){
    

    vector<int> l(4, 0);
    vector<int> r(4, 0);

    double a, b;
    while(cin >> a >> b){
        if(a >= 1.1) l[0]++;
        else if(a >= 0.6) l[1]++;
        else if(a >= 0.2) l[2]++;
        else l[3]++;


        if(b >= 1.1) r[0]++;
        else if(b >= 0.6) r[1]++;
        else if(b >= 0.2) r[2]++;
        else r[3]++;
    }

    for(int i = 0; i < 4; i++){
        cout << l[i] << " " << r[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 3184
n = int(input())
s = str(input())
ans = set()
for i in range(10):
    if str(i) in s:
        for j in range(10):
            if str(j) in s[s.find(str(i))+1:]:
                for k in range(10):
                    if str(k) in s[s.find(str(j), s.find(str(i))+1)+1:]:
                        ans.add((i,j,k))
print(len(ans))


Measured memory_bytes: 38512
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
sat = 0
for i in range(n):
  j = a[i]-1
  sat += b[j]
  if 0<i<=n-1 and a[i]-a[i-1]==1:
    sat += c[j-1]
print(sat)

Measured memory_bytes: 3064
import math
import bisect

n = int(input())
alist = [0]+list(map(int,input().split()))
uv_list = []
for i in range(n-1):
    u,v = map(int,input().split())
    if u > v:
        u, v = v, u
    uv_list.append([u,v])

tree = [[] for _ in range(n+1)]
for i in range(n-1):
    uv = uv_list[i]
    tree[uv[0]].append(uv[1])
    tree[uv[1]].append(uv[0])
    

queue = [1]
used = [0]*(n+1)
ans = [0]*(n+1)
dp = []
stack = []
while queue != []:
    cur = queue[-1]

    if used[cur] == 0:
        if cur == 1:
            dp.append(alist[cur])
            stack.append([len(dp)-1,None])
        else:
            if alist[cur] > dp[-1]:
                dp.append(alist[cur])
                stack.append([len(dp)-1,None])
            else:
                offset = bisect.bisect_left(dp,alist[cur])
                stack.append([offset,dp[offset]])
                dp[offset] = alist[cur]
        ans[cur] = len(dp)

    if tree[cur] != [] and used[cur] == 0:
        for child in tree[cur]:
            if used[child] == 0:
                queue.append(child)
    else:
        queue.pop()

        #reverse
        back = stack.pop()
        if back[1] == None:
            dp.pop()
        else:
            dp[back[0]] = back[1]
    used[cur] = 1
for i in range(n):
    print(ans[i+1])


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

int main()
{
  int h, n;
  cin >> h >> n;
  
  int a;
  bool canWin = false;
  for (int i = 0; i < n; i++) {
    cin >> a;
    h -= a;
    if (h <= 0) {
      canWin = true;
      break;
    }
  }
  
  cout << (canWin ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3540
#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>;
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int& i : a) cin >> i, --i;
    vector<int> s(n + 1, 0);
    for (int i = 1; i <= n; ++i) (s[i] += s[i - 1] + a[i - 1]) %= k;
    map<int, int> m;
    ll r = 0;
    for (int i = 1; i < min(k, n + 1); ++i) ++m[s[i]];
    for (int i = 0; i <= n; ++i) {
        r += m[s[i]];
        if (i + k <= n) ++m[s[i + k]];
        if (i + 1 <= n) --m[s[i + 1]];
    }
    cout << r << endl;
}

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

int main() {
  int A,B,X,count;
  cin >> A >> B;
  X=A;
  vector<int> num(5);
  for(int i=0;i<=(B-A);++i){
    int T=X;
    for(int j=0;j<5;++j){
      num.at(j)=T%10;
      T=T/10;
    }
    if((num.at(0)==num.at(4)) && (num.at(1)==num.at(3))){
      ++count;
    }
    ++X;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <assert.h>
#include <fstream>

using namespace std;

typedef long long ll;

const int MAXN = 4005;
const int MOD = 1000000007;

int n,ans1,ans2;
int f[MAXN << 1][MAXN];
int mrk[MAXN][MAXN];

int power(int a,int b)
{
	int res = 1;
	while (b)
	{
		if (b & 1)
			res = (ll)res * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return res;
}

int main()
{
	ios::sync_with_stdio(false);
	for (int i = 0;i <= 8000;i++)
	{
		f[i][0] = 1;
		for (int j = 1;j <= min(i,4000);j++)
			f[i][j] = (f[i - 1][j] + f[i - 1][j - 1]) % MOD;
	}
	cin >> n;
	for (int a,b,i = 1;i <= n;i++)
	{
		cin >> a >> b;
		(ans2 += f[(a + b) << 1][a << 1]) %= MOD;
		mrk[2000 - a][2000 - b]++;
		mrk[2000 + a][2000 + b]++;
	}
	memset(f,0,sizeof(f));
	for (int i = 0;i <= 4000;i++)
		for (int j = 0;j <= 4000;j++)
		{
			if (i < 2000 && j < 2000)
				f[i][j] = mrk[i][j];
			if (i)
				(f[i][j] += f[i - 1][j]) %= MOD;
			if (j)
				(f[i][j] += f[i][j - 1]) %= MOD;
			if (i > 2000 && j > 2000)
				ans1 = ((ll)mrk[i][j] * f[i][j] + ans1) % MOD;
		}
	cout << ((ll)(ans1 - ans2 + MOD) * (MOD + 1) / 2) % MOD << endl;
	return 0;
}

Measured memory_bytes: 187776
n = int(input())
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997,10000]

ass = []
m = 10**9+7
k = 0
while p[k] <= n:
    a = 0
    i = 1
    while p[k]**i <= n:
        a += (n//(p[k]**i))
        i += 1
    ass.append(a%m)
    k += 1
ans = 1
for i in range(len(ass)):
    ans = ans * (ass[i]+1) % m
print(ans)


Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
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 (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n, m;
cin >> n >> m;
vector<int> box(n,1);
vector<bool> prob(n,false);
prob[0] = true;
int x, y;

rep(i, m){
     cin >> x >> y;
     x--, y--;
    if(prob[x]){
        prob[y]=true;
    }
    box[x]--;
    box[y]++;
    if(box[x]==0){
        prob[x] = false;
    }
}
int sum = 0;
for(auto v:prob){
    if(v){
        sum++;
    }
}
cout << sum << endl;
//system("pause");
return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
char c;
int N, A, i;
int main(void){
	c=getchar();
	while(c!=10){N=N*10+(c-'0'); c=getchar();}
	for(i=0; i<N; i++){
		c=getchar();
		while(c!=10){A=c; c=getchar();}
		if(A%2){
			printf("first\n");
			return 0;
		}
	}
	printf("second\n");
	return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a<b){
            System.out.println("a < b");
        }else if(a>b){
             System.out.println("a > b");
        }else{
             System.out.println("a == b");
        }
    }
}



Measured memory_bytes: 26232
#include<bits/stdc++.h>
#define debug(x) cerr << #x << " = " << x << "\n";
#define debug_v(x) cerr << #x << " ="; for(auto it : x) {cerr << " [" <<  it << "]";} cerr << "\n";
using namespace std;
using ll = long long;
using ld = double;
const double PI = acos(-1);
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 2e18;
const int N = 303;
ld dp[N][N][N];
ld ev[N][N][N];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cout << fixed << setprecision(20);
	ld n;
	cin >> n;
	vector<int> qan(4);
	for(int i = 0;i < n;++i){
		int t;
		cin >> t;
		++qan[t];
	}
	dp[qan[1]][qan[2]][qan[3]] = 1;
	ev[qan[1]][qan[2]][qan[3]] = 0;
	for(int three = n;three >= 0;--three){
		for(int two = n;two >= 0;--two){
			for(int one = n;one >= 0;--one){
				ld n2 = one + two + three;
				if(n2 == 0.0 || n2 > n){
					continue;
				}
				ld waste = (n - n2) / n;
				ld ev_waste = waste / (1 - waste);
				ev[one][two][three] += ev_waste * dp[one][two][three];
				ld p1 = one / n2;
				if(one >= 1){
					dp[one - 1][two][three] += p1 * dp[one][two][three]; 
					ev[one - 1][two][three] += p1 * ev[one][two][three];
				}
				ld p2 = two / n2;
				if(two >= 1){
					dp[one + 1][two - 1][three] += p2 * dp[one][two][three];
					ev[one + 1][two - 1][three] += p2 * ev[one][two][three]; 
				}
				ld p3 = three / n2;
				if(three >= 1){
					dp[one][two + 1][three - 1] += p3 * dp[one][two][three]; 
					ev[one][two + 1][three - 1] += p3 * ev[one][two][three]; 
				}
			}
		}
	}
	cout << qan[1] + 2 * qan[2] + 3 * qan[3] + ev[0][0][0] << '\n';
	return 0;
}


Measured memory_bytes: 434432
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 10000000000000;
#define pb push_back
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;

// ll modexp(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;
// }

// ll mulmod(ll a, ll b)
// {
// 	return ((a % mod) * (b % mod)) % mod;
// }

// ll sub_mod(ll a, ll b, ll m){
//    if (a >= b)
//        return a - b;
//    else
//        return m - b + a;
// }

// ll add_mod(ll a, ll b){
//    if (0 == b) 
//        return a;

//    b = mod - b;
//    if (a >= b)
//        return a - b;
//    else
//        return mod - b + a;
// }

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

// ll modInv(ll a) 
// { 
//     ll g = gcd(a, mod); 
//     if (g != 1) 
//         return -1; 
//     else
//         return modexp(a, mod-2, mod); 
// } 


int main()
{
	fastio;
//#ifndef ONLINE_JUDGE   
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif
	ll n = 0;
	cin >> n;
	vector<ll>v(n+1);
	for (ll i = 1; i <= n; ++i)
	{
		cin >> v[i];
		v[i] -= i;
	}
	sort(v.begin()+1, v.end());
	ll m = 0;
	if (n & 1)
		m = v[(n+1)/2];
	else
		m = (v[n/2]+v[n/2+1])/2;
	ll s = 0;
	for (ll i = 1; i <= n; ++i)
	{
		s += (abs(v[i] - m));
	}
	cout << s;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define MAX 500005
using namespace std;

template<typename T>
void read(T &n){
    n = 0;
    T f = 1;
    char c = getchar();
    while(!isdigit(c) && c != '-') c = getchar();
    if(c == '-') f = -1, c = getchar();
    while(isdigit(c)) n = n*10+c-'0', c = getchar();
    n *= f;
}
template<typename T>
void write(T n){
    if(n < 0) putchar('-'), n = -n;
    if(n > 9) write(n/10);
    putchar(n%10+'0');
}

int n, m, cnt;
int head[MAX], vet[MAX], h[MAX], Next[MAX];

void add(int x, int y){
    cnt++;
    Next[cnt] = head[x];
    head[x] = cnt;
    vet[cnt] = y;
}

int main()
{
    ll X;
    cin >> X;
    for(int i = -2000; i <= 2000; i++){
        for(int j = -2000; j <= i; j++){
            ll x = (ll)i*i*i*i*i, y = (ll)j*j*j*j*j;
            if(x - y == X){
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define INTINF 1<<30
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )

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

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

ll factorial(ll x) {
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }
	if (n == r) { return 1; }

	if (r > n / 2) { r = n / 2; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (ll i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

ll GreaterBinarySearch(ll *array, ll key, ll max, ll min) {
	if(array[max]<array[min]) {
		return NULL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int main() {
	int N; cin>>N;
	vector<intpair> arm(N);
	for(int i=0; i<N; i++) {
		int X,L; cin>>X>>L;
		arm[i].first=X+L;
		arm[i].second=X-L;
	}
	sort(arm.begin(),arm.end());

	int result=0;
	int narm=-INTINF;
	for(int i=0; i<N; i++) {
		if(narm<=arm[i].second) {
			narm=arm[i].first;
			result++;
		}
	}

	cout<<result<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>

int main(void) {
  int a,b;

  std::cin >> a;
  std::cin >> b;

  if (a <= 8 && b <= 8) {
    std::cout << "Yay!" << std::endl;
  } else {
    std::cout << ":(" << std::endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;

const int maxn = 2e5+5;
vector<int> adj[maxn];
int typ[maxn];
char trash[maxn];
int n, m; 

int vis[maxn][4];

bool pass[maxn];

bool good;

bool dfs(int u, int th)
{
	vis[u][th] = 1;
	for(auto v : adj[u])
	{
		int e = typ[u]^typ[v];
		if(e == th) 
		{
			if(!vis[v][1-th]) dfs(v, 1-th);
			else if(vis[v][1-th] == 1) good = true;
		}
	}
	vis[u][th] = 2;
} 

void dfs2(int u)
{
	if(pass[u]) return;
	pass[u] = true;
	for(auto v : adj[u]) dfs2(v);
}

int main()
{
	scanf("%d %d", &n, &m);
	scanf("%s", trash+1);
	for(int i = 1; i<= n; i++) typ[i] = (trash[i] == 'A');
	for(int i = 1; i<= m; i++)
	{
		int u, v; scanf("%d %d", &u, &v);
		adj[u].pb(v); adj[v].pb(u);
	}
	for(int i = 1; i<= n; i++)
	{
		sort(adj[i].begin(), adj[i].end());
		adj[i].resize(unique(adj[i].begin(), adj[i].end())-adj[i].begin());
	}
	for(int i = 1; i<= n; i++)
	{	
		if(!vis[i][0]) dfs(i, 0);
		if(!vis[i][1]) dfs(i, 1);
	}
	puts(good?"Yes":"No");
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int sum = 0;
			for ( int i = 0; i < 4; i++ )
				sum += sc.nextInt();
			System.out.println(sum/60+"\n"+sum%60);
		}
	}
}

Measured memory_bytes: 12000
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <map>
#include <bitset>
#define ri register
#define inf 0x7fffffff
#define E (1)
#define mk make_pair
#define int long long
//#define double long double
using namespace std; const int N=1000010;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch-'0'), ch=getchar();
    return s*w;
}
void print(int x) { if(x<0) x=-x, putchar('-'); if(x>9) print(x/10); putchar(x%10+'0'); }
int n,tot=1,res,tt,ch[N][26],f[N][26],book[N][26],g[N]; char s[N];
void Insert(int x,int now)
{
    if(now==tt+1)
    {
        g[x]++;
        return;
    }
    if(!ch[x][s[now]-'a']) ch[x][s[now]-'a']=++tot;
    for(ri int i=0;i<26;i++) if(book[now][i]) res+=g[ch[x][i]];
    if(now==tt) res+=f[x][s[now]-'a'];
    Insert(ch[x][s[now]-'a'],now+1);
    for(ri int i=0;i<26;i++) f[x][i]+=book[now][i];
}
signed main()
{
    n=read();
    for(ri int i=1;i<=n;i++)
    {
        scanf("%s",s+1);
        tt=strlen(s+1);
        memset(book[tt+1],0,sizeof(book[tt+1]));
        reverse(s+1,s+1+tt);
        for(ri int j=tt;j;j--)
        {
            memcpy(book[j],book[j+1],sizeof(book[j+1]));
            book[j][s[j]-'a']=1;
        }
        Insert(1,1);
    }
    printf("%lld\n",res);
    return 0;
}

Measured memory_bytes: 648880
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end())
            cout << " ";
    }
    cout << endl;
};

int main() {
    int n, tmp, C = 0;
    string order, str;
    cin >> n;
    map<string, bool> dict;
    rep(i, n) {
        cin >> order >> str;
        if(order == "insert") {
            dict.insert(make_pair(str, 1));
        } else { // find
            cout << (dict.count(str) ? "yes" : "no") << endl;
        }
    }
}


Measured memory_bytes: 36780
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

void solve() {
    int n, m;
    cin >> n >> m;
    if(n == 0 && m == 0) exit(0);
    vi c(m);
    rep(i, m) cin >> c[i];
    vi x(n);
    rep(i, n) cin >> x[i];
    vl cur(256, INF);
    cur[128] = 0;
    rep(i, n) {
        vl nxt(cur.size(), INF);
        rep(j, 256) rep(k, m) {
            int y = j + c[k];
            if(y < 0) y = 0;
            if(y > 255) y = 255;
            chmin(nxt[y], cur[j] + (x[i] - y)*(x[i] - y));
        }
        swap(cur, nxt);
    }
    cout << *min_element(all(cur)) << endl;
}

int main(){
    while(1) solve();
}


Measured memory_bytes: 3164
# input
N, K = map(int, input().split())

MOD = 10**9+7

# process
l = [0]*(K+1)  # 最大公約数がiとなる数列の数
ans = 0
for i in range(K, 0, -1):
    l[i] = pow((K//i), N, MOD) - sum(l[i*j] for j in range(2, K//i+1)) % MOD
    ans = (ans + i*l[i]) % MOD

# output
print(ans)


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

int main(int argc, char const *argv[])
{
    string str;
    cin >> str;
    int w[30];
    for(int i=0;i < 30;i++) w[i] = 0;

    for(int i = 0,e =str.size(); i < e; i++){
        w[str[i] - 'a']++;
    }
    for(int i = 0; i < 30 ;i++){
        if (w[i] % 2 != 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}


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

int main(void){
    int a[3][3];
    for(int i=0; i<3; ++i)
        for(int j=0; j<3; ++j)
            cin >> a[i][j];
        
    int n, x;
    cin >> n;
    for(int z=0; z<n; ++z){
        cin >> x;

        for(int i=0; i<3; ++i){
            for(int j=0; j<3; ++j){
                if(a[i][j] == x){
                    a[i][j] = 0;
                }
            }
        }

        for(int i=0; i<3; ++i){
            int s = 0;
            for(int j=0; j<3; ++j){
                s += a[i][j];
            }
            if(s==0){
                cout << "Yes" << endl;
                return 0;
            }
        }

        for(int i=0; i<3; ++i){
            int s = 0;
            for(int j=0; j<3; ++j){
                s += a[j][i];
            }
            if(s==0){
                cout << "Yes" << endl;
                return 0;
            }
        }

        if(a[0][0] + a[1][1] + a[2][2] == 0){
            cout << "Yes" << endl;
            return 0;
        }
        if(a[0][2] + a[1][1] + a[2][0] == 0){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 3592
import scala.io.{StdIn => in}
import annotation.tailrec

object Main extends App {
  val n = in.readInt

  val table = Array.ofDim[Long](n+1)
  val a = in.readLine.split(" ").map(_.toLong)
  (0 until n).foreach { i =>
    table(i+1) = table(i) + a(i)
  }

  val ans = (1 until n)./:(Int.MaxValue.toLong) { case (acc, i) =>
    acc min ( table(i) - (table(n) - table(i)) ).abs
  }
  
  println(ans)
}

Measured memory_bytes: 66928
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);

#define endl '\n'
#define D(x) cout << #x << " = " << (x) << endl;

class disjointset {
public:
  int n;
  vector<int> parent;
  disjointset(int _n) {
    n = _n;
    parent.resize(n);
    makeset();
  }

  void makeset() {
    for (int i = 0; i < n; ++i) {
      parent[i] = i;
    }
  }

  int findset(int x) {
    if (parent[x] != x) parent[x] = findset(parent[x]);
    return parent[x];
  }

  void join(int x, int y) {
    parent[findset(x)] = findset(y);
  }
};


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

  vector<pair<int,int>> v(n);
  for (int i = 0; i < n; ++i) {
    int value;
    cin >> value;
    v[i] = {value, i};
  }
  sort(v.begin(), v.end());

  disjointset ds(n);
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    ds.join(x, y);
  }

  set<int> sets;
  for (int i = 0; i < n; ++i) {
    sets.insert(ds.findset(i));
  }

  if (sets.size() == 1) {
    cout << 0 << endl;
    return 0;
  }

  long long ans = 0;
  int cnt = (sets.size() - 1) * 2 - sets.size();

  vector<int> mark(n);
  for (int i = 0; i < v.size(); ++i) {
    int value = v[i].first;
    int index = v[i].second;

    int set_index = ds.findset(index);
    if (mark[set_index] == 0) {
      mark[set_index] = 1;
      ans += value;
    } else if (cnt) {
      cnt--;
      ans += value;
    }
  }

  if (cnt > 0) {
    cout << "Impossible" << endl;
  } else {
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 6528
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int[] appearance = new int[26];
        for(int i = 0, f = s.length(); i < f; ++i) {
            ++appearance[s.charAt(i) - 'a'];
        }
        
        if(s.length() < 26) {
            for(int i = 0; i < 26; ++i) {
                if(appearance[i] == 0) {
                    char x = (char)('a' + i);
                    System.out.println(s + x);
                    return;
                }
            }
        }
        
        int si = 0;
        for(int i = 25; i > 0; --i) {
            if(s.charAt(i - 1) < s.charAt(i)) {
                si = i;
                break;
            }
        }
        
        if(si == 0) {
            System.out.println(-1);
            return;
        }
        
        char r = s.charAt(si - 1);
        char q = 'z';
        for(int i = 25; i >= si; --i) {
            char tmp = s.charAt(i);
            if(tmp > r) q = (tmp < q) ? tmp : q;
        }
        StringBuilder ans = new StringBuilder(s.substring(0, si - 1)).append(q);
        System.out.println(ans.toString());
    }
}


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

int main() {
  int n,k,q;cin>>n>>k>>q;
  vector<int>a(q),vec(n,k-q);
  rep(i,q){
    cin>>a[i];
    vec[a[i]-1]++;
  }
  rep(i,n){
    if(vec[i]>0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}

Measured memory_bytes: 4032
#include <iostream>
#include <string>
#include <bitset>
    
class Baseball{
    u_int score, out_count;
    std::bitset<4> runners; 
public:
    Baseball() : score(), out_count(){} //initializer list
    ~Baseball() = default;
    void hit();
    void homerun();
    void out() {++out_count;}
    u_int getScore() {return score;}
    u_int getOutcount() {return out_count;}
};
   
void Baseball::hit(){
    runners <<= 1; //shift
    runners.set(0); //set runner
    if(runners.test(3)){
        ++score;
        runners.reset(3);
    }
}
   
void Baseball::homerun(){
    score += runners.count() + 1;
    runners.reset();
}
   
int main(){
    u_int inning;
    std::cin >> inning;
    for(u_int i = 0; i < inning; ++i){
        Baseball game;
        while(game.getOutcount() != 3){
            std::string event;
            std::cin >> event;
            if(event == "HIT"){
                game.hit();
            }else if(event == "HOMERUN"){
                game.homerun();
            }else if(event == "OUT"){
                game.out();
            }
        }
        std::cout << game.getScore() << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3084
import java.io.*;
import java.util.*;
 
class Main
{
  public static void main (String[] arg)
  {
    Scanner scan = new Scanner(System.in);
    String mng = scan.next(); //整数
    
    String ans_A = "AAA";
    String ans_B = "BBB";
    
    if(mng.equals(ans_A)){
      System.out.println("No");
    }
    else if(mng.equals(ans_B)){
      System.out.println("No");
    }
    else{
      System.out.println("Yes");
    }
    
  }
}

Measured memory_bytes: 22996
//E
//Author : Sidiq Tri Pratikto
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(v) v.begin(), v.end()

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
//order_of_key(x) = number of elements stricly smaller than x
//find_by_order(x) = return x-th largest element
typedef long long LL;
const LL MOD = 1e9 + 7;
const double PI = 2 * acos(0);

int main() {
	int N, M;
	scanf("%d%d", &N, &M);
	int batas = N / 2;
	if (N % 2 == 0) batas--;
	for (int i = 1; i <= (batas + 1) / 2 && M > 0; i++) {
		printf("%d %d\n", i, batas + 1 - i + 1);
		M--;
	}
	for (int i = batas + 2; i <= (batas + 2 + (batas - 1) + batas + 2) / 2 && M > 0; i++) {
		printf("%d %d\n", i, batas + 2 + (batas - 1) - (i - batas - 1) + 1);
		M--;
	}
}


Measured memory_bytes: 3732
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define SZ(c) int(c.size())
#define pb push_back
#define loop(i,start,n)  for(int i=start;i<n;i++)
#define rloop(i,start,n)  for(int i=start;i>n;i--)

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
const ll inf = 2e9+3;

void solve(){
    int tc=1 ;
    //cin >> tc;
    while(tc--) {
        ll n,m,k,res=0;
        cin >> n >> m >> k;
        vll va(n+1) , vb(m+1);
        ll A=0, B=0;
        loop(i,1,n+1) { cin >> va[i]; va[i] = va[i]+va[i-1]; }
        loop(i,1,m+1) { cin >> vb[i]; vb[i] = vb[i]+vb[i-1]; }
        ll b = m , a = n;
        loop(i,1,n+1) if(va[i]<=k) a = i;
        loop(i,1,m+1) if(vb[i]<=k) b = i;
        loop(i,0,a+1){
            if(vb[b] <= k-va[i]) res = max(res,i+b);
            else b--;
            /*loop(j,0,b+1) {
                if (va[i] + vb[j] <= k) res = max(res,(ll)(i+j));
            }*/
        }
        cout << res;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 6328
#coding:utf-8
import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    S,T = input().split()
    A, B = LMIIS()
    num = {}
    num[S] = A
    num[T] = B
    num[input()] -= 1
    print(num[S], num[T])

if __name__ == '__main__':
    main()

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

int main(){
	int h[10];
	int i,j;
	int t;

	for(i=0;i<10;i++){
		cin >> h[i];
	}

	for(i=9;i>-1;i--){
		for(j=i-1;j>-1;j--){
			if(h[j]<h[i]){
				t=h[i];
				h[i]=h[j];
				h[j]=t;
			}
		}
	}

	
	for(i=0;i<3;i++){
		cout << h[i] << endl;
	}

	return 0;

}

Measured memory_bytes: 1160
#include <iostream>

int main(int argc, char const *argv[]) {
    int x, a, b;
    std::cin >> x >> a >> b;
    if (a - b > -1) std::cout << "delicious" << '\n';
    else if (a - b >= -x) std::cout << "safe" << '\n';
    else std::cout << "dangerous" << '\n';
    return 0;
}

Measured memory_bytes: 256
def pin(type=int):
    return map(type,input().split())
#どっかで最悪計算量の入力データを用意する関数を作ろう？
def worstdata():
    a=0
    return a
#solution:
def comp(x,y):
    dp=[0,max(act[0])]*(N+1) #[i]日目のActivity で得られる最大幸福量
    
    return 0

#input
C=[list(pin()) for _ in range(3)]#combinationの実装が適当すぎる
yoko=[[0]*3 for _ in range(3)]
yoko[0]=[C[1][i]-C[0][i] for i in range(3) ]
yoko[1]=[C[2][i]-C[1][i] for i in range(3) ]
yoko[2]=[C[0][i]-C[2][i] for i in range(3) ]
#print(yoko)
cond=1
for kakaka in range(3):
    if not(yoko[kakaka][0]== yoko[kakaka][1] and yoko[kakaka][1]== yoko[kakaka][2]):
        cond=0
        break
#print(solution(H,N))
print(["No","Yes"][cond])



Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 0;
        for(int i=1;i<=N;i++){
            int a = sc.nextInt();
            if(i%2==1 && a%2==1){
                ans ++;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35704
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int cnt[50];
int main() {
	int n, m; cin >> n >> m;
	rep(i, m) {
		int a, b; cin >> a >> b; a--; b--;
		cnt[a]++; cnt[b]++;
	}
	rep(i, n) {
		cout << cnt[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_4
{
    class Program
    {
        static void Main(string[] args)
        {

            long sum = 0;   // ????¨????
            Console.ReadLine();
            string[] str_List = Console.ReadLine().Split(' ');

            long min = int.Parse(str_List[0]);   // ????°????
            long max = int.Parse(str_List[0]);   // ?????§???

            foreach ( string str in str_List)
            {
                long tmp = int.Parse(str);
                // ????°????????´?
                if(tmp < min)
                {
                    min = tmp;
                }

                // ?????§???????´?
                if( tmp > max)
                {
                    max = tmp;
                }

                // ????¨??????????
                sum += tmp;
            }

            Console.WriteLine("{0} {1} {2}",min,max,sum);

            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9960
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;


int n,q;
char s[500005];
int bit[26][500005];
 
int sum(int op,int pos){
    int res=0;
    while(pos>0){
        res+=bit[op][pos];
        pos-=pos&-pos;
    }
    return res;
}
 
void add(int op,int pos,int val){
    while(pos<=n){
        bit[op][pos]+=val;
        pos+=pos&-pos;
    }
}
 
int main(){
 
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    cin>>n;
    cin>>s+1;
    for(int i=1;i<=n;i++){
        add(s[i]-'a',i,1);
    }
    cin>>q;
    while(q--){
        int typ;
        cin>>typ;
        if(typ==1){
            int pos;char val;
            cin>>pos>>val;
            add(s[pos]-'a',pos,-1);
            s[pos]=val;
            add(val-'a',pos,1);
        }else{
            int l,r,cnt=0;
            cin>>l>>r;
            for(int i=0;i<26;i++){
                if(sum(i,r)-sum(i,l-1)){
                    cnt++;
                    //cerr<<(char)(i+'a')<<' ';
                }
            }
            cout<<cnt<<endl;
        }
    }
 
    return 0;
}

Measured memory_bytes: 51584
using System;

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine();
        int day = int.Parse(s);
        int n = 25 - day;
        Console.Write("Christmas");
        for (int i = 0; i < n; i++)
        {
            Console.Write(" Eve");
        }
    }
}


Measured memory_bytes: 11092