akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
#define pb push_back
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;
//const ll MAX_V=114514LL;
//const ll MAX = 500010LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};




int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  /*--------------------------------*/
  vl v(5);
  rep(i,5)cin>>v[i];
  rep(i,5){
    if(v[i]==0){
      cout<<i+1<<endl;
    }
  }
}

Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define ALL(v) (v).begin(),(v).end()
const ll MOD = 1e9 + 7;

int main() {
	int N;
	cin >> N;
	vector<P> vec;
	for (int i = 0; i < N; i++) {
		ll A, B;
		cin >> A >> B;
		vec.emplace_back(B, A);
	}
	sort(ALL(vec));
	ll sum = 0;
	for (int i = 0; i < N; i++) {
		sum += vec[i].second;
		if (sum > vec[i].first) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 6512
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <numeric>
#include <algorithm>
#include <stdio.h>

int main(void){
  double n,m,s=0;
  std::cin >> n >> m;
  std::vector<double> a(n);
  for(int i=0;i<n;i++){
    std::cin >> a[i];
  }
  
  for(int i=0;i<n;i++){
    s += a[i];
  }
  std::sort(a.begin(),a.end());
  std::reverse(a.begin(),a.end());
  
  if((a[m-1])>=s/(4.0*m)){
    std::cout << "Yes";
  }else{
    std::cout << "No";
  }
  
  return 0;
}

Measured memory_bytes: 3764
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: str(sys.stdin.buffer.readline().rstrip())
rs = lambda: map(str, sys.stdin.buffer.readline().split())
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
aa = [ri() for _ in range(n)]
a = sorted(aa)
m = a[-1]
if m == a[-2]:
    for _ in range(n):
        print(m)
else:
    for i in aa:
        if i < m:
            print(m)
            continue
        else:
            print(a[-2])

Measured memory_bytes: 23292
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    ll n; cin>>n;
    ll dp[n+1][4][4][4]={};
    rep(i,4)rep(j,4)rep(k,4){
        dp[3][i][j][k]=1;
    }
    dp[3][0][2][1]=0;
    dp[3][2][0][1]=0;
    dp[3][0][1][2]=0;
    for(int N=4;N<=n;N++){
        rep(i,4)rep(j,4)rep(k,4)rep(l,4){
            if((l==0 && j==2 && k==1) || 
               (l==0 && i==2 && k==1)) continue;
            dp[N][i][j][k]=(dp[N][i][j][k]+dp[N-1][l][i][j])%MOD;
        }
        dp[N][0][2][1]=0;
        dp[N][2][0][1]=0;
        dp[N][0][1][2]=0;
    }
    ll ans=0;
    rep(i,4)rep(j,4)rep(k,4){
        ans=(ans+dp[n][i][j][k])%MOD;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
 int a,b,c; cin>>a>>b>>c;
  cout <<min(c,b/a)<<endl;
}
  

Measured memory_bytes: 256
// {{{ by unolight
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f\n",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
// }}}

struct edge {
    int from,to,cost;
};
const LL INF=1e18;

void main() {
    int n,m,p;
    R(n,m,p);
    vector<edge> es(m);
    vector<VI> G(n);
    REP(i,m) {
        int a,b,c;
        R(a,b,c);
        --a; --b;
        es[i]={a,b,p-c};
        G[a].PB(b);
    }
    vector<LL> dist(n,INF);
    dist[0]=0;
    VI changed(n);
    REP(k,n) {
        REP(i,m) {
            int from=es[i].from,to=es[i].to,cost=es[i].cost;
            if ( dist[to]>dist[from]+cost ) {
                dist[to]=dist[from]+cost;
                if ( k+1==n ) changed[to]=1;
            }    
        }
    }
    VI vis(n),ok(n);
    ok[n-1]=1;
    function<void(int)> go=[&](int u) {
        vis[u]=1;
        for ( int v:G[u] ) {
            if ( !vis[v] ) go(v);
            ok[u]|=ok[v];
        }
        if ( ok[u] && changed[u] ) {
            W(-1);
            exit(0);
        }
        // dump(u);
    };
    go(0);
    dist[n-1]*=-1;
    if ( dist[n-1]<0 ) W(0);
    else W(dist[n-1]);
}

}} // {{{ main
int main() { unolight::main(); return 0; }
// }}}

Measured memory_bytes: 4180
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main()
    {
        var input = MyUtil.ReadlongArray();
        var count = input[0] * 3 + input[1];


        WriteLine(count / 2);
        ReadKey();
    }
}


static class MyUtil
{
    public static long[] ReadlongArray()
    {
        return ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
    }

    /// <summary>
    /// <see cref="IEnumerable{T}"/>の各要素を並べてコンソールに出力します。各要素の間には半角スペースが一つ入ります。
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="ts"></param>
    public static void WriteToConsole<T>(this IEnumerable<T> ts)
    {
        StringBuilder stringBuilder = new StringBuilder();
        foreach (T t in ts)
        {
            stringBuilder.Append(t.ToString());
            stringBuilder.Append(" ");
        }
        stringBuilder.Remove(stringBuilder.Length - 1, 1);
        Console.WriteLine(stringBuilder.ToString());
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int dp[100010];

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

    for(int i = 0; i < 100010; i++){
        dp[i] = 1<<30;
//        cerr << dp[i] << endl;
    }
    dp[0] = 0;
    for(int i = 0; i < n-1; i++){
//        cerr << dp[i+1] << " " << dp[i]+abs(h[i]-h[i+1]) << endl;
        dp[i+1] = min(dp[i+1], dp[i]+abs(h[i]-h[i+1]));
        dp[i+2] = min(dp[i+2], dp[i]+abs(h[i]-h[i+2]));
    }

    cout << dp[n-1] << endl;
    return 0;
}


Measured memory_bytes: 1272
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int gcd(int a, int b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
int digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}

int s[100] = {};
int main() {
	int n, d, x;
	cin >> n >> d >> x;
	ll sum = x;
	REP(i, n) {
		int a;
		cin >> a;
		sum += (d - 1) / a + 1;
	}

	cout << sum << endl;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define PI 3.14159265359
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define tr(con, it) \
    for (auto it = con.begin(); it != con.end(); it++)
#define fr(it, a, b) \
    for (int it = (a); it < (b); it++)
#define present(con, ele) (con.find(ele) != con.end())
#define cpresent(con, ele) (find(all(con), ele) != con.end())
#define maximum(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
#define minimum(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
typedef long long ll;
typedef long double lf;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int s, w;
    cin >> s >> w;
    if (w >= s)
    {
        cout << "unsafe\n";
    }
    else
    {
        cout << "safe\n";
    }
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>

#define rep(i, N) for(int i = 0; i < N; ++i)

using namespace std;
typedef long long ll;

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

    struct Book
    {
        ll cost;
        vector<ll> score;
    };
    
    Book book[n];
    rep(i, n)
    {
        cin >> book[i].cost;

        rep(j, m)
        {
            ll data;
            cin >> data;
            book[i].score.push_back(data);
        }
    }

    ll totalCount = pow(2, n);
    Book totalScore[totalCount];

    constexpr ll MaxCost = 100000000;
    ll minCost = MaxCost;
    rep(i, totalCount)
    {
        // init
        totalScore[i].cost = 0;
        rep(j, m)
        {
            totalScore[i].score.push_back(0);
        }
        // parse choose book
        rep(j, n)
        {
            if ((i & (1 << j)) != 0)
            {
                totalScore[i].cost += book[j].cost;
                rep(k, m)
                {
                    totalScore[i].score[k] += book[j].score[k];
                }
            }
        }

        bool isSatisfied = true;
        rep(j, m)
        {
            if (totalScore[i].score[j] < x)
            {
                isSatisfied = false;
                break;
            }
        }

        if (isSatisfied && totalScore[i].cost < minCost)
        {
            minCost = totalScore[i].cost;
        }
    }        
    if (minCost != MaxCost)
    {
        cout << minCost << endl;
    }
    else
    {
        cout << "-1" << endl;
    }
    return 0;
}


Measured memory_bytes: 4696
s=input()

now_black=True
count_a=0
for c in s:
    if now_black and c == "1":
        count_a += 1
    elif (not now_black) and c == "0":
        count_a += 1
    now_black = not now_black

now_black=False
count_b=0
for c in s:
    if now_black and c == "1":
        count_b += 1
    elif (not now_black) and c == "0":
        count_b += 1
    now_black = not now_black

print (min(count_a, count_b))

Measured memory_bytes: 3188
/*

  "With age, comes wisdom. With travel, comes understanding.
   Remember that happiness is a way of travel – not a destination"

*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int             long long int
#define ld              long double
#define F               first
#define S               second
#define pb              push_back
#define si              set <int>
#define vi              vector <int>
#define pii             pair <int, int>
#define vpi             vector <pii>
#define vpp             vector <pair<int, pii>>
#define mii             map <int, int>
#define mpi             map <pii, int>
#define spi             set <pii>
#define endl            "\n"
#define sz(x)           ((int) x.size())
#define all(p)          p.begin(), p.end()
#define que_max         priority_queue <int>
#define que_min         priority_queue <int, vi, greater<int>>
#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
     int x = 1;
     while (b)
     {
          if (b & 1) x *= a;
          a *= a;
          b >>= 1;
     }
     return x;
}

typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> Set;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 200005;
int cache[N][4],a[N][4],n;

int dp(int i,int pre)
{
    if(i==n)
        return 0;
        
    int &ans=cache[i][pre];
    if(ans!=-1)
        return ans;
        
    if(pre!=1) ans=max(ans,a[i][1]+dp(i+1,1));
    if(pre!=2) ans=max(ans,a[i][2]+dp(i+1,2));
    if(pre!=3) ans=max(ans,a[i][3]+dp(i+1,3));
    
    return ans;
    
}

void solve()
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i][1]>>a[i][2]>>a[i][3];
        
    memset(cache,-1,sizeof cache);
    cout<<dp(0,0);
}

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

     cout << setprecision(9) << fixed;
     clock_t z = clock();
     
     solve();

     cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);

     return 0;
}

Measured memory_bytes: 17024
#include<stdio.h>
int main()
{
    long long int a,b,k,x;// 5 2 3
    scanf ("%lld",&a);
    scanf ("%lld",&b);//2 3 3
    scanf ("%lld",&k);
    if (a>0)
    {
        x=a;//5
        a=a-k;//2
        k=k-x;//3-5=-2
         if (a<0)
        {
            a=0;
        }
    }
    if (k>0 && b>0)
    {
        b=b-k;
        if (b<0)
        {
            b=0;
        }
    }
    printf ("%lld %lld\n",a,b);
}


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

int main() {
	int n;
	cin>>n;
	string s;
	cin>>s;
	int br = 0;
	for(int i=2;i<s.length();i++) {
		if(s[i] == 'C' && s[i-1] == 'B' && s[i-2] == 'A') br++;
	}
	cout<<br;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

const int MAXN = 5000;
const int MOD = 1000000007;
const int INF = 2000000000;
const double PI = 3.14159265358979;
const int dir_4r[] = { -1, 1, 0, 0 };
const int dir_4c[] = { 0, 0, -1, 1 };
const int dir_8r[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
const int dir_8c[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

int main()
{
	int n, a, b, val;
	while (cin >> n)
	{
		a = b = 0;
		for (int i = 0; i < n; ++i)
		{
			cin >> val;
			if (val % 4 == 0)
				a++;
			else if (val & 1 == 1)
				b++;
		}
		if (a >= n / 2)
			cout << "Yes" << endl;
		else if (a >= b)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}

	//system("pause");
	return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
    string s; cin >> s;
    bool ok = false;
    for (int i = 0; i < 2; i++) if (s[i] != s[i+1]) ok = true;
    if (ok) cout << "Yes\n";
    else cout << "No\n";
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl


   int main(){
       string S;
     cin >> S;
     int j = 0;
     rep(i,3){
       if(S[i] == '1'){
         j++;
       }
     }
     cout << j << endl;
     
   }


Measured memory_bytes: 256
#include <bits/stdc++.h>
     
    using namespace std;
    typedef long long ll;
    ll mod = 1e9+7;
     
    int main(void)
    {
      ll N,R;cin>>N>>R;
      ll res;
      if(N>10)res=R;
      else res=R+100*(10-N);
      cout<<res<<endl;
    }

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

const ll mod = 1e9+7;
const ll INF = ll(1e18)+1;
const ll MAXN = 1e6;

int main()
{
    int a[3][3]={0};
    bool c[3][3];
    rep(i,3)
    {
        rep(j,3)
        {
            cin>>a[i][j];
            c[i][j]=false;
        }
    }
    int n;
    cin>>n;
    rep(i,n)
    {
        int b;
        cin>>b;
        rep(i,3)
    {
        rep(j,3)
        {
            if(a[i][j]==b)c[i][j]=true;
        }
    }
        
    }
    bool ans=false;
    rep(i,3)
    {
        int tate=0;
        int yoko=0;
        rep(j,3)
        {
            if(c[i][j])yoko++;
            if(c[j][i])tate++;
        }
        if(yoko==3 || tate==3)ans=true;
    }
    int naname=0;
    int rev=0;
    rep(i,3)
    {
        if(c[i][i]==true)naname++;
        if(c[i][2-i]==true)rev++;
    }
    if(naname==3 || rev==3)ans=true;
    
    if(ans)cout<<"Yes";else cout<<"No";
}

Measured memory_bytes: 256
N, Q = map(int, input().split())

query = [[] for _ in range(N+1)]
for i in range(N-1):
    a, b = map(int, input().split())
    query[a-1].append(b-1)
    query[b-1].append(a-1)

from collections import deque

count = [0]*N

for i in range(Q):
    p, x = map(int, input().split())
    count[p-1] += x

queue = deque([0])
checked  = [0]*N
while queue:
    v = queue.pop()
    checked[v] = 1
    x = count[v]
    Vs = query[v]
    for i in Vs:
        if checked[i]:
            continue
        count[i] += x
        queue.append(i)
    
print(*count)

Measured memory_bytes: 105236
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef unsigned long long ull;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

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

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

int kaizyo(int x){
    if(x==1)return x;
    else return x*kaizyo(x-1);
}

typedef struct Point{
    int x;
    int y;
} P;


int main() {
    int a[]={1,3,5,7,8,10,12},b[]={4,6,9,11},c[]={2};
    int v[13]={0};
    rep(i,0,7)v[a[i]]=1;
    rep(i,0,4)v[b[i]]=2;
    v[c[0]]=3;
    
    int x,y;
    cin>>x>>y;
    if(v[x]==v[y])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}


Measured memory_bytes: 256
n,c,k = map(int ,input().split(" "))
t = sorted([int(input()) for i in range(n)])
total = 0
count = 0
while(count != n):
  temp = 0
  #print(count, total)
  for i in range(c):
    if count + i >= n:
      #print("乗りたい人数を全部さばいた")
      if t[-1] - t[count] <= k:
        #print("最後の人全員載せる")
        count = n
        total += 1
        break
      else:
        temp = 0
        while(count != n):
          #print("残りを何回で載せられるか")
          if t[count + temp] - t[count] <= k:
            temp += 1
          else:
            count += temp + 1
            total += 1
        break
      break
    if t[count + i] - t[count] > k:
      #print("定員を超えた")
      count += i
      total += 1
      break
  else:
    #print("k人全員載せる")
    count += c
    total += 1
    if count == n:
      break
print(total)

Measured memory_bytes: 14060
#include <bits/stdc++.h>
//#define int long long
using namespace std;
int32_t main()
{
    int n,k;
    string s;
    cin >> n >> k;
    cin >> s;
    vector<pair<int,int> >dp;
    for(int i=0;i<n;i++)
    {
        if(dp.empty() || dp.back().first!=s[i])
        {
            dp.push_back({s[i],1});

        }
        else
        dp.back().second++;
    }

    int ptr=0,res=0,ans=0,sm=0;
    for(auto &p:dp)
    {
        while(ptr < dp.size() && sm + (dp[ptr].first=='0') <=k)
        {
            sm+=dp[ptr].first=='0';
            res+=dp[ptr].second;
            ptr++;
        }
        ans = max(ans,res);
        res-=p.second;
        sm-=p.first=='0';
    }
    cout<<ans<<"\n";

}


Measured memory_bytes: 1528
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;


void solve(long long N, std::vector<long long> P){
	ll res = 0;
	ll min = 1e9;
	REP(i, N) {
		if (min > P[i]) {
			res++;
			min = P[i];
		}
	}
	cout << res << "\n";
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    solve(N, std::move(P));
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>

void F(double *x, double *y, double a, double b, double c, double d, double e, double f);
double SQ(double x){ return x * x; }
double SQS(double x, double y){ return SQ(x) + SQ(y); }

int main(void)
{
	int N;
	double x1, x2, x3, y1, y2, y3, px, py, l, m, n, r;
	
	scanf("%d", &N);
	
	while (N != 0){
		N--;
		scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
		
		F(&l, &m, x1 - x2, y1 - y2, SQS(x2, y2) - SQS(x1, y1),
			x1 - x3, y1 - y3, SQS(x3, y3) - SQS(x1, y1));
		
		px = -l / 2;
		py = -m / 2;
		r = sqrt(SQ(x1 - px) + SQ(y1 - py));
		
		printf("%.3lf %.3lf %.3lf\n", px, py, r);
		
	
	}
	
	return (0);
	
}

void F(double *x, double *y, double a, double b, double c, double d, double e, double f)
{
	*y = (c * d - f * a) / (b * d - e * a);
	*x = (b * f - e * c) / (b * d - e * a);
}

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

using namespace std;
using ll = long long;
using ld = long double;

#define int long long
signed main(){
//int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int h,w;
    cin >> h >> w;

    int dif=INT32_MAX;
    for(int i = 0; i < h; i++) {
        int a=i*w;
        int b=(h-i)*(w/2);
        int c=(h-i)*(w-w/2);
        int mx=max({a,b,c});
        int mn=min({a,b,c});
        dif=min(mx-mn,dif);

        b=((h-i)/2)*w;
        c=((h-i)-(h-i)/2)*w;

        mx=max({a,b,c});
        mn=min({a,b,c});
        dif=min(mx-mn,dif);
    }

    swap(h,w);
    for(int i = 0; i < h; i++) {
        int a=i*w;
        int b=(h-i)*(w/2);
        int c=(h-i)*(w-w/2);
        int mx=max({a,b,c});
        int mn=min({a,b,c});
        dif=min(mx-mn,dif);

        b=((h-i)/2)*w;
        c=((h-i)-(h-i)/2)*w;

        mx=max({a,b,c});
        mn=min({a,b,c});
        dif=min(mx-mn,dif);
    }
    cout << dif << "\n";
    return 0;
}

Measured memory_bytes: 3656
import numpy as np
N, X = [int(i) for i in input().split()]
xn = np.array([int(i) for i in input().split()])
xn = abs(X-xn)

def gcd(a, b):
    if b > a :
        a, b = b, a
    
    while b != 0:
        a, b = b, a % b
    
    return a

ans = xn[0]
for i in range(1, len(xn)):
    ans = gcd(ans, xn[i])

print(ans)

Measured memory_bytes: 23152
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main() {
  string str;
  cin >> str;
  bool flag = false;
  for (int i = 0; i < 3; i++) {
    if (str[i] == str[i + 1]) {
      flag = true;
    }
  }
  if (!flag) {
    cout << "Good" << endl;
  } else {
    cout << "Bad" << endl;
  }
  return 0;
}

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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define sfl(i,a,n) for (int i=a;i<n;i++)
#define ufl(i,a,n) for (int i=n-1;i>=a;i--)
#define SZ(x) ((int)(x).size())
#define endl '\n'
typedef long long ll;

ll power(ll a, ll b){
    ll res = 1;
    for(int i = 0; i<b; i++)
        res *= a;

    return res;
}

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}


int main()
{
    init();
    string s;
    cin >>s;
    int len=s.length();
    if(len<2)
    {
        return cout<<"-1 -1",0;
    }
    sfl(i,0,len-1)
    {
        if(s[i]==s[i+1])
            {
                cout <<i+1<<" "<<i+2;
                return 0;
            }

    }
    sfl(i,0,len-2)
    {
        if(s[i]==s[i+2])
        {
            cout <<i+1<<" "<<i+3;
            return 0;
        }
    }
        cout <<"-1 -1";
}


Measured memory_bytes: 512
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(c>a&&c<b||c==a&&c==b)
    {
        printf("Yes");
    }


    else
    {
        printf("No");
    }
    return 0;






}


Measured memory_bytes: 128
var k,ans,a,b,c,d :integer;

function gcd(p,q:integer):integer;
begin
  if (p mod q =0)then gcd:=q
  else gcd(q,p mod q)
end;

begin
  readln(k);
  ans:=0;
  for a:=1 to k do
  begin
    for b:=1 to k do
    begin
      d:=gcd(a,b);
      for c:=1 to k do
      begin
        inc(ans,gcd(d,c));
      end;
    end;
  end;
  writeln(ans);
end.


Measured memory_bytes: 1384
import math
x = int(input())

def get_prime(n):
    if n <= 1:
        return []
    prime = [2]
    limit = math.sqrt(n)

    data = [i+1 for i in range(2, n, 2)]
    while limit > data[0]:
        prime.append(data[0])
        data = [j for j in data if j % data[0] != 0]
    return prime + data

plist = get_prime(200000)
ans = 0
for y in range(x, 200000):
    if y in plist:
        ans = y
        break
    else:
        pass

print(ans)

Measured memory_bytes: 7576
#input
N = int(input())
d = [int(input()) for i in range(N)]

#chexk
#print(d)

#sorting
for i in range(N-1):
  for j in range(N-1-i): #昇順にしたい
    if (d[j] > d[j+1]): #要素i が 要素i+1 より大きい ので入れ替え
      temp = d[j]
      d[j] = d[j+1]
      d[j+1] = temp
  #check
  #print(d)

count = 1
temp = d[0]
for i in range(1,N):
  if(temp < d[i]):
    count += 1
    temp = d[i]

#b = int(input())
#N,A,B = map(int,input().split())
#judge
 
print(count)
#print('result')
#print('Count = '+str(count))
#print('Bob = '+str(Bob))
#print('Alice-Bob = '+str(Alice-Bob))
#print(Alice-Bob)
#output

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

typedef long long ll;

const ll MAX_N = 1e5 + 5, inf = 1000000LL * 1000000LL * 1000000LL;
ll n, E, T;
ll x[MAX_N];
ll dp[MAX_N];
ll seg[MAX_N << 2];
ll lazy[MAX_N << 2];

void shift (ll id) {
	seg[id << 1] += lazy[id];
	lazy[id << 1] += lazy[id];

	seg[id << 1 | 1] += lazy[id];
	lazy[id << 1 | 1] += lazy[id];
	lazy[id] = 0;
}

void add (ll l, ll r, ll val, ll s = 0, ll e = n, ll id = 1) {
	if (l <= s && e <= r) {
		seg[id] += val;
		lazy[id] += val;
		return ;
	}

	if (r <= s || e <= l)
		return ;

	shift(id);

	ll mid = e + s >> 1;
	add(l, r, val, s, mid, id << 1);
	add(l, r, val, mid, e, id << 1 | 1);
	seg[id] = min(seg[id << 1], seg[id << 1 | 1]);
}

ll get (ll l, ll r, ll s = 0, ll e = n, ll id = 1) {
	if (l <= s && e <= r)
		return seg[id];

	if (r <= s || e <= l)
		return inf;

	shift(id);
	ll mid = e + s >> 1;
	return min(get(l, r, s, mid, id << 1), get(l, r, mid, e, id << 1 | 1));
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> E >> T;
	for (ll i = 0; i < n; i++)
		cin >> x[i];

	dp[n - 1] = T;
	for (ll i = n - 2; ~i; i--) {
		add(i + 1, n, 2 * (x[i + 1] - x[i]));
		add(i, i + 1, dp[i + 1]);
		ll ind = lower_bound(x, x + n, x[i] + (T + 1) / 2) - x;
		ind--;

		dp[i] = T + dp[ind + 1];
		if (ind + 1 < n)
			dp[i] = min(dp[i], get(ind + 1, n));
	}

	cout << dp[0] + E << "\n";
	return 0;
}

Measured memory_bytes: 7040
def readinput():
    n=int(input())
    x=input()
    return n,x

poptbl=[0]*(2*10**5+1)
def popcount(x):
    global poptbl
    if poptbl[x]!=0:
        return poptbl[x]
    
    poptbl[x]=bin(x).count('1')
    return poptbl[x]

ftbl=[0]*(2*10**5+1)
def f(x):
    global ftbl

    if ftbl[x]!=0:
        return ftbl[x]
    
    #print('f(x), x: {}'.format(x))
    if x==0:
        return 0
    else:
        ans=f(x%popcount(x))+1
        #print(ans)
        ftbl[x]=ans
        return ans    

def main():
    n=int(input())
    x=input()
    m=x.count('1')
    #print('m: {}'.format(m))
    xint=int(x,2)
    #print('xint: {}'.format(xint))
    if m!=1:
        xmodm1=xint%(m-1)
    else:
        xmodm1=1
    xmodp1=xint%(m+1)
    pow2mod1=[0]*n
    pow2mod2=[0]*n
    pow2mod1[0]=1
    pow2mod2[0]=1
    for i in range(1,n):
        if m!=1:
            pow2mod1[i]=pow2mod1[i-1]*2 % (m-1)
        pow2mod2[i]=pow2mod2[i-1]*2 % (m+1)

    ans=[]
    #b=2**(n-1)
    for i in range(n):
        if x[i]=='1':
            if m==1:
                a=0
                ans.append(a)
            else:
                xx=( xmodm1 + (m-1) -pow2mod1[n-i-1] )%(m-1)
                #ans.append(f(xx)+1)
                a=f(xx)+1
                ans.append(a)
        else:
            xx=( xmodp1 + pow2mod2[n-i-1] )%(m+1)
            #ans.append(f(xx)+1)
            a=f(xx)+1
            ans.append(a)
        #b=b//2
        print(a)
    return ans

if __name__=='__main__':
    #n,x=readinput()
    ans=main()
    #for a in ans:
    #    print(a)



Measured memory_bytes: 29892
N = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(N):
  
  if a[i]%2 == 0:
    if a[i]%3 == 0 or a[i]%5 == 0:
      pass
    else:
     c += 1 
if c == 0:
  print('APPROVED')
else:
  print('DENIED')

Measured memory_bytes: 3064
from math import ceil

A, B = map(int, input().split())

max_A = (A+1)*12.5
min_A = (A)*12.5
max_B = (B+1)*10.0
min_B = B*10.0

if min_A < max_B and min_A >= min_B:
    print(ceil(min_A))
elif min_B < max_A and min_B >= min_A:
    print(ceil(min_B))
else:
    print(-1)


Measured memory_bytes: 9188
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int n,ans,k;
int f[111][111];
vector<P> v;
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		if(n%2==0){
			for(int j=1;j<=n;j++){
				f[j][i]=1;
				if(i==j||f[i][j])continue;
				if(n+1-i!=j)v.push_back(P(i,j));
			}
		}
		else{
			if(i==n){
				for(int j=1;j<=n;j++){
					f[j][i]=1;
					if(i==j||f[i][j])continue;
					v.push_back(P(i,j));
				}
			}
			else{
				for(int j=1;j<=n;j++){
					f[j][i]=1;
					if(i==j||f[i][j])continue;
					if(n-i!=j)v.push_back(P(i,j));
				}
			}
		}
	}
	cout<<v.size()<<endl;
	rep(i,v.size()){
		cout<<v[i].first<<" "<<v[i].second<<endl;
	}
}


Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
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; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a,a+3);
  ll ans = INF;
  rep(i,6){
    next_permutation(a,a+3);
    ans = min (ans,abs(a[1]-a[0])+abs(a[2]-a[1]));
  }
  pri(ans);
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
using namespace std;
//
const int inf=1e9+7;//0x3f
//
int main(){
	int N;
	cin>>N;
	vector<pair<int,int>> V;
	for(int i=-1;i<=1;i+=2){
		for(int j=0;j<N;j++){
			int x;
			cin>>x;
			V.push_back(make_pair(x,i));
		}
	}
	sort(V.begin(),V.end());
	int cnt=0;
	long long ans=1;
	for(int i=0;i<2*N;i++){
		if(cnt*V[i].second<0){
			(ans*=abs(cnt))%=inf;
		}
		cnt+=V[i].second;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2420
using System;
using System.Collections;
using System.Collections.Generic;

class Program
{
    public static void Main()
    {
        string[] strs = Console.ReadLine().Split(' ');
        int N = int.Parse(strs[0]);
        int K = int.Parse(strs[1]);
        string s = Console.ReadLine();
        string r = "";
        for (int i = 1; i <= N; i++)
        {
            if (i != K)
                r += s[i - 1];
            else
                r += (char)(s[i - 1] - 'A' + 'a');
        }
        Console.WriteLine(r);
    }
}


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

using namespace std;

map<char, int> cnt;
char S[100000];

int main()
{
    scanf("%s", S);
    int N=strlen(S);
    for(int i=0; i<N; i++)
        cnt[S[i]]++;
    if(!!cnt['W']!=!!cnt['E'])
        printf("No\n");
    else if(!!cnt['N']!=!!cnt['S'])
        printf("No\n");
    else
        printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
/**
    "If you have an apple and I have an apple and
    we exchange apples then you and I will still
    each have one apple. But if you have an idea
    and I have an idea and we exchange these
    ideas, then each of us will have two ideas."
                        -George Bernard Shaw
*/
#include<bits/stdc++.h>
using namespace std;

#define clean(x,y) memset(x,y,sizeof(x));
#define pb push_back
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define ALL(v) v.begin(),v.end()
#define PI acos(-1.0)
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define printa(a,L,R) for(int ii=L; ii<R; ii++) cout<<a[ii]<<" \n"[ii==R-1]
#define printv(a) printa(a,0,(int)a.size())
#define Unique(a) sort(ALL(a)); (a).resize(unique(ALL(a)) - (a).begin())
#define SZ(v) (int)v.size()
#define MOD 1000000007
#define MAX 200005

#define dbg(x) cout<<(#x)<<"="<<(x)<<":\n"
#define CS(i) cout<<"Case "<<i<<": "

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector< pii > vpi;
typedef vector< pll > vpl;
typedef map<int, int> mii;
typedef map<ll, ll> mll;


void syntex_error()
{
    ll i,j,k,l,r,n,m,a,b,c,x,y,z,sum=0LL;
    vl v;
    
    char ch;
    cin>>ch;
    if(ch>='A' && ch<='Z')
        cout<<"A\n";
    else
        cout<<"a\n";

}

int main()
{
    FAST
    
    ll TC=1LL;

    //cin>>TC;

    while(TC--){
        syntex_error();
    }

    return 0;
}



Measured memory_bytes: 3648
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;

int N, M;
int L[200100], R[200100];
priority_queue<int, vector<int>, greater<int> > pq;
int idx1[200100];
int up[200010];
int upL;
int res;

int cmp1(const void *aa, const void *bb)
{
	int i1 = *((int *)aa);
	int i2 = *((int *)bb);
	return L[i1] - L[i2];
}

void solve()
{
	int i;
	for(i=0; i<N; i++)
		idx1[i] = i;
	qsort(idx1, N, sizeof(int), cmp1);
	res = 0;
	int cur = 1;
	upL = 0;
	for(i=0; i<N; i++){
		if(cur <= L[idx1[i]]){
			cur ++;
			pq.push(R[idx1[i]]);
			res ++;
		}
		else{
			pq.push(R[idx1[i]]);
			up[upL] = pq.top() ;
			pq.pop() ;
			upL ++; 
		}
	}
	int lowpos = cur;
	sort(up, up+upL, greater<int>() );
	cur = M;
	for(i=0; i<upL; i++){
		if(cur < lowpos)
			break;
		if(cur >= up[i]){
			cur --;
			res ++;
		}
	}
	printf("%d\n", N-res);
}

int main()
{
	//freopen("in.txt", "r", stdin);
	int i;
	scanf("%d%d", &N, &M);
	for(i=0; i<N; i++){
		scanf("%d%d", &L[i], &R[i]);
		/*if(L[i] == 0)
			L[i] = 1;
		if(R[i] > M)
			R[i] = M;*/
	}
	solve();
	return 0;
}

Measured memory_bytes: 4340
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
 
int main()
{
    int N;
    cin >> N;

    vector<int> H(N);
    rep(i,N) cin >> H[i];

    int count = 1;
    for (int i = 1; i < N; i++) {
        bool a = true;
        for (int j = 0; j < i; j++) {
            if (H[i] - H[j] < 0) a = false;
        }
        if (a) count++;
    }

    cout << count << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int D;
    scanf("%d",&D);
    if(D==25){
        printf("Christmas\n");
    }
    if(D==24){
        printf("Christmas Eve\n");
    }
    if(D==23){
        printf("Christmas Eve Eve\n");
    }
    if(D==22){
        printf("Christmas Eve Eve Eve\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);
 
    long long a; std::cin >> a;
    long double b; std::cin >> b;
    long long y = round(b*100);
    std::cout << a*y/100 << "\n";
}

Measured memory_bytes: 3780
#include <stdio.h>

int main(){
	int n, r, p, c, i;
	
	while( 1 ){
		int N[50];
		scanf("%d %d", &n, &r);
		if( n == 0 && r == 0) break;
		
		//１からnまで順に積み上げる
		for( i = 0; i < n; i++){
			N[i] = n-i;
		}
		
		//カット操作
		for( ; r > 0; r--){
			scanf("%d %d", &p, &c);
			int copy[50];
			for( i = 0; i < p-1+c; i++){
				copy[i] = N[i];
			}
			for( i = 0; i < p-1+c; i++){
				if( i < c){
					N[i] = copy[p-1+i];
				}else{
					N[i] = copy[i-c];
				}
			}
		}
		printf("%d\n", N[0]);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int D;cin >> D;
  
  string r;
  if (D == 22) {
    r = "Christmas Eve Eve Eve";
  } else if (D == 23) {
    r = "Christmas Eve Eve";
  } else if (D == 24) {
    r = "Christmas Eve";
  } else {
    r = "Christmas";
  }
  
  cout << r << endl;
  
  return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
	is >> p.first >> p.second;
	return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}
/*
typedef __int128_t Int;
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
  if (s) {
	__uint128_t tmp = value < 0 ? -value : value;
	char buffer[128];
	char *d = std::end(buffer);
	do {
	  --d;
	  *d = "0123456789"[tmp % 10];
	  tmp /= 10;
	} while (tmp != 0);
	if (value < 0) {
	  --d;
	  *d = '-';
	}
	int len = std::end(buffer) - d;
	if (dest.rdbuf()->sputn(d, len) != len) {
	  dest.setstate(std::ios_base::badbit);
	}
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++)
	if ('0' <= s[i] && s[i] <= '9')
	  ret = 10 * ret + s[i] - '0';
  return ret;
}
*/

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template <class T> bool chmin(T &a, const T &b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>b(N); rep(i, 0, N) { cin >> b[i]; b[i]--; }
	vector<int>ans;
	loop(N) {
		dump(b);
		rrep(i, 0, b.size()) {
			if (b[i] == i) {
				b.erase(b.begin()+i);
				ans.eb(i);
				break;
			}
		}
	}
	if (b.size())cout << -1 << endl;
	else {
		rrep(i, 0, N)cout << ans[i]+1 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
N, C = map(int, input().split())
r = [[0] * C for _ in range(10 ** 5)]
for _ in range(N):
    s, t, c = map(int, input().split())
    for i in range(s - 1, t):
        r[i][c - 1] = 1
ans = 0
for t in r:
    sum_t = sum(t)
    if sum_t > ans:
        ans = sum_t

print(ans)

Measured memory_bytes: 37108
require "prime"

N_MAX = 10 ** 5

f = [0] * (N_MAX+1)
N_MAX.times do |i|
  f[i] = f[i-1]
  f[i] += 1 if i.prime? && ((i+1)/2).prime?
end

q = gets.to_s.to_i
q.times do |i|
  l, r = gets.to_s.split.map{|t| t.to_i }
  puts f[r] - f[l-1]
end

Measured memory_bytes: 3836
n, m = [int(i) for i in input().split()]

A = []
for i in range(n):
    A.append([int(j) for j in input().split()])

b = []
for j in range(m):
    b.append(int(input()))

for i in range(n):
    total = 0
    for j in range(m):
        total += A[i][j] * b[j]
    print(total)

Measured memory_bytes: 8004
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
      Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int[] a = new int[n];
      int[] b = new int[n];
      int[] c = new int[n];
      for(int i=0; i<n; i++) {
    	  a[i]=scan.nextInt()-1;
      }
      for(int i=0; i<n; i++) {
    	  b[i]=scan.nextInt();
      }
      for(int i=1; i<n; i++) {
    	  c[i]=scan.nextInt();
      }
      int sum =0;
      for(int i=0; i<n; i++) {
        sum = sum+b[a[i]];
        if(i!=0 && a[i]-a[i-1]==1) {
          sum = sum +c[a[i]];
        }
      }
      System.out.println(sum);
    }
}

Measured memory_bytes: 21844