akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll a,b,n;cin>>a>>b>>n;
    ll x=b-1;
    if(x>=n)x=n;
    ll ans=(a*x)/b;
    ans-=a*(x/b);
    cout<<ans<<endl;
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int X;
    cin >> X;
    int a = X/500;
    int b = (X - a*500)/5;
    cout << a*1000 + b*5 << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define pb push_back
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 1e11
using namespace std;
typedef pair<int,long long> pil;

int main(){
	int v,e,s,t,w;
	cin>>v>>e;
	long long mincost[v];
	vector<pil> vec[v];
	bool used[v];
	long long ans=0;
	fill(mincost,mincost+v,INF);
	fill(used,used+v,false);
	rep(i,e){
		cin>>s>>t>>w;
		vec[s].pb(pil(t,w));
		vec[t].pb(pil(s,w));
	}
	mincost[0]=0;
	while(1){
		int next=-1;
		for(int u=0;u<v;u++){
			if(!used[u]&&(next==-1||mincost[u]<mincost[next]))next=u;
		}
		if(next==-1)break;
		used[next]=true;
		ans+=mincost[next];
		for(int i=0;i<vec[next].size();i++){
			mincost[vec[next][i].first]=min(mincost[vec[next][i].first],vec[next][i].second);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 8460
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

int sum(int n) {
    int s = 0;
    while (n > 0) {
        s += n %  10;
        n /= 10;
    }
    return s;
}

int main()
{
    int n;
    std::cin >> n;
    int min = 1 + sum(n - 1);

    for (int i = 1; i <= n - i; i++) {
        min = std::min(min, sum(i) + sum (n - i));
    }
    std::cout << min << std::endl;
    return 0;
}


Measured memory_bytes: 256
/*
Author:loceaner
*/
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

const int A = 5e5 + 11;
const int B = 1e6 + 11;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;

inline int read() {
	char c = getchar(); int x = 0, f = 1;
	for( ; !isdigit(c); c = getchar()) if(c == '-') f = -1;
	for( ; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
	return x * f;
}

int main() {
	int n = read();
	if (n % 1000 == 0) return cout << "0\n", 0;
	cout << 1000 - (n % 1000) << '\n';
	return 0;
}


Measured memory_bytes: 3188
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s, t;
    cin >> s >> t;

    long c = 0;

    for(int i=0; i<s.length(); i++){
        if(s.at(i) != t.at(i)){
            c++;
        }
    }
    cout << c << endl;
}

Measured memory_bytes: 3852
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt(), x = in.nextInt();
			int[] m = new int[n];
			int min = INF;
			for (int i = 0; i < n; i++) {
				int a = in.nextInt();
				m[i] = a;
				min = Math.min(min, a);
			}

			for (int i = 0; i < n; i++) {
				x -= m[i];
			}

			int ans = 0;
			ans += n;

			ans += x / min;
			out.println(ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 21460
#if 1

#include <bits/stdc++.h>
using namespace std;
int a[100005],d[100005];

int main()
{
    int n,k;
    scanf("%d %d", &n, &k);
    for(int i = 1;i <= n;i++)
    {
        scanf("%d",&a[i]);
        d[i] = 2e9;
    }
    d[1] = 0;
    d[2] = abs(a[2]-a[1]);
    for(int i = 3;i <= n;i++)
    {
        for(int j = 1;j <= k;j++)
        {
            if(i <= j) break;
            d[i] = min(d[i],d[i-j]+abs(a[i]-a[i-j]));
        }
        //cout << d[i] << " ";
    }
    printf("%d",d[n]);
}

#endif // 1++

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

void ti(){
  #ifndef ONLINE_JUDGE
    freopen("in.txt", "r+", stdin);
    freopen("out.txt", "w", stdout);
  #endif
}

typedef long long ll;
const int MAX = 10000105;

int factor[MAX] = { 0 };

void gpf(){
    factor[1] = 1;
    for (int i = 2; i < MAX; i++)
        factor[i] = i;

    for (int i = 4; i < MAX; i += 2)
        factor[i] = 2;

    for (int i = 3; i * i < MAX; i++) {

        if (factor[i] == i) {

            for (int j = i * i; j < MAX; j += i) {
                if (factor[j] == j)
                    factor[j] = i;
            }
        }
    }
}

ll divCount(int n)
{
    if (n == 1)
        return 1;

    ll ans = 1;
    ll dup = factor[n];
    ll c = 1;

    ll j = n / factor[n];

    while (j != 1) {
        if (factor[j] == dup)
            c += 1;

        else {
            dup = factor[j];
            ans = ans * (c + 1);
            c = 1;
        }

        j = j / factor[j];
    }
    ans = ans * (c + 1);

    return ans;
}

int main(){

  // ti();
  long long int n; cin>>n;
  long long ans = 0;

  gpf();
  int i = 1;
  while(i <= n){
    ans+=i*divCount(i);
    i++;
  }

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


Measured memory_bytes: 42692
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int a[1234],b[12345]={0};
int main() {
    int x,n;
    cin>>x>>n;
    /*
    if (n==0) {
        cout<<x-1<<endl;
        return 0;
    }
    */
    map<int,int>b;
    for (int i=1;i<=n;i++) {
            cin>>a[i];
            b[a[i]]=1;
    }

    for (int i=0;i<=1000;i++) {
        if (b[x-i]==0) {
            cout<<x-i;
            break;
        }
        if (b[x+i]==0) {
            cout<<x+i;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3628
///                ..:: In The Name Of God ::..
#include<bits/stdc++.h>

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define error(x) cerr << #x << " = " << (x) << endl;
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define Size(x) (int)(x).size()
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double ld;
int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    
    int n, x;
    cin >> n >> x;
    vi l(n + 1);
    vi d(n + 1);
    for1(i, n) cin >> l[i];
    ll ans = 0;
    d[1] = 0;
    for (int i = 2; i <= n + 1; i++) {
        d[i] = d[i-1] + l[i-1];
    }
    for(int i = 1; i <= n + 1; i++)
        ans += d[i] <= x;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define base 998244353
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long

using namespace std;

string s;
int n;
ll ans=1;
vector<int> ball[3];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("in.txt","r",stdin);
    cin>>n;
    cin>>s;
    for (int i=0;i<s.length();i++) {
        int id = (s[i]=='R'?0:(s[i]=='G'?1:2));
        ball[id].push_back(i);
    }
    for (int i=0;i<3;i++) sort(ball[i].begin(),ball[i].end());
    vector<pii> all[7];
    for (int i=0;i<n;i++) {
        vector<int> ps = {ball[0][i],ball[1][i],ball[2][i]};
        sort(ps.begin(),ps.end());
        int id = (ps[0]==ball[0][i]?0:(ps[0]==ball[1][i]?1:2));
        all[id].push_back(pii(ps[0],1));
        all[id].push_back(pii(ps[1],-1));
        int id1 = (ps[2]==ball[0][i]?0:(ps[2]==ball[1][i]?1:2))+3;
        all[id1].push_back(pii(ps[1],1));
        all[id1].push_back(pii(ps[2],-1));
    }

    for (int i=0;i<6;i++) {
        sort(all[i].begin(),all[i].end());
        int tmp=0;
        for (auto p:all[i]) {
            if (p.se==1) tmp++;
            else {
                ans = (1ll*ans*tmp)%base;
                tmp--;
            }
        }
    }
    for (int i=1;i<=n;i++) ans = (1ll*ans*i)%base;
    cout<<ans;
}


Measured memory_bytes: 6660
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<map>
#include<algorithm>
#include<stack>
#define P pair<int,int>
using namespace std;

int g[1000005];
int main() {
	int a, b, c[1001];
	while (scanf("%d%d", &a, &b), a | b) {
		for (int d = 0; d < a; d++)scanf("%d", &c[d+1]);
		c[0] = 0;
		int sum = 0;
		for (int e = 0; e <= a; e++) {
			for (int f = e; f <= a; f++) {
				g[sum] = c[e] + c[f];
				sum++;
			}
		}
		sort(g, g + sum);
		int MAX = 0;
		for (int l = 0; l < sum; l++) {
			auto x = upper_bound(g, g + sum, b - g[l]);
			x--;
			if(g[l]<=b)MAX = max(MAX, g[l] + *x);
		}
		cout << MAX << endl;
	}
}

Measured memory_bytes: 5148
n=int(input())
a=list(map(int,input().split()))
o=[]
e=[]
for i in range(n):
  if i%2==0:
    o.append(a[i])
  else:
    e.append(a[i])
from collections import Counter as co
o=co(o)
e=co(e)
o['x']=0
e['x']=0
ov=o.values()
ev=e.values()
mo=max(ov)
me=max(ev)
if n==2:
  if a[0]==a[1]:
    print(1)
  else:
    print(0)
else:
  if max(o,key=o.get)==max(e,key=e.get):
    if mo>me:
      me=sorted(ev)[-2]
    elif mo<me:
      mo=sorted(ov)[-2]
    else:
      mo=max(sorted(ev)[-2],sorted(ov)[-2])
  print(n-mo-me)

Measured memory_bytes: 18552
n,l = map(int,input().split())
ans = 0

list =[]
abs_list = []

for i in range(n):
  list.append(l+i)
  abs_list.append(abs(l+i))

x = min(abs_list)

for i in range(len(abs_list)):
  if abs_list[i] == x:
    x = i
    break

list.pop(x)

print(sum(list))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int n,s[123],A[123],o,p[123];
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s[i];
		for(int j=0;j<=i;j++)A[j]+=s[i];
		o+=s[i];
	}
	for(int i=0;i<n;i++){
		p[i]=((o-A[i])-(A[i]));
		if(p[i]<0)p[i]=(p[i]-(p[i]*2));
	}
	sort(p,p+n);
	cout<<p[0]<<endl;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.read
def main():
    def find(x):
        if par[x] < 0:
            return x
        else:
            par[x] = find(par[x])
            return par[x]
    def unite(x, y):
        x = find(x)
        y = find(y)
        if x == y:
            return False
        else:
            if par[x] > par[y]:
                x, y = y, x
            par[x] += par[y]
            par[y] = x
            return True
    def same(x, y):
        return find(x) == find(y)
    def size(x):
        return -par[find(x)]

    n, m, k = map(int, input().split())
    par = [-1] * n
    r = [-1] * n
    for _ in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        unite(a, b)
        r[a] -= 1
        r[b] -= 1
    for i1 in range(n):
        r[i1] += size(i1)
    m = map(int, read().split())
    cd = zip(m, m)
    for c, d in cd:
        c -= 1
        d -= 1
        if same(c, d):
            r[c] -= 1
            r[d] -= 1
    print(*r, end=' ')

if __name__ == '__main__':
    main()

Measured memory_bytes: 33172
#include<iostream>
using namespace std;
int main()
{
int N,a,b,c,d;
cin>>N;
c=N%10;
a=N/100;
d=N/10;
b=d%10;
if(a==7||b==7||c==7)
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}
return 0;



}

Measured memory_bytes: 3620
#include <cstdio>
#include <vector>
#include <algorithm>
long long N;
int num[60], L = -1, d = 1, u;
int main()
{
	scanf("%lld", &N);
	N++;
	while (N)
	{
		num[++L] = N & 1;
		N >>= 1;
	}
	std::vector < int > O;
	for (int i = L - 1; ~i; i--)
	{
		O.push_back(++u);
		if (num[i])
			O.push_back(--d);
	}
	printf("%d\n", int(O.size()) << 1);
	for (int i = 1; i <= int(O.size()); i++)
		printf("%d ", i);
	for (int i : O)
		printf("%d ", i + 1 - d);
	putchar(10);
	return 0;
}


Measured memory_bytes: 256
// Target Expert 

/*
 * Author    : raj1307 - Raj Singh
 * Institute : Jalpaiguri Government Engineering College
 * Date      : 3.08.19
 */

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <iomanip>
#include <memory.h>
#include <assert.h>
using namespace std;


//#define DEBUG
#ifdef DEBUG
#define deb(...) cerr<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
#define debarr(a,n) cerr<<#a<<" : ";for(int i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define debmat(mat,row,col) cerr<<#mat<<" :\n";for(int i=0;i<row;i++) {for(int j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}

#else
#define deb(...) {}
#define debarr(a,n) {}
#define debmat(mat,row,col) {}
#define endl "\n"
#endif

#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fr(i, a, b) for(int i = (a); i < (b); ++i)
#define fb(i, b, a) for(int i = (b); i > (a); --i)
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define rr return 
#define int long long
#define pb push_back
#define sz(x) ((int)x.size())
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a>b) return b; else return a;}

const int mod = 1000*1000*1000+7;
const int INF = 1e18 +5;

int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}


const int N = 5e5 + 5;
int n,W;
 
int cache[3005][3005];
string a,b,output="";
 
int dp(int x,int y){
 	
	if(x<0 or y<0)
		return 0;

 	else if(cache[x][y]!=-1)
		return cache[x][y];

	else if(a[x]==b[y])
		return 1+dp(x-1,y-1);


	
	else{
	
		cache[x][y]=max(dp(x-1,y),dp(x,y-1)); 
		return cache[x][y];
 
	}
 
}
 

void path(int x,int y){

	if(x<0 or y<0)
		return;

	int ans=dp(x,y);

	if(a[x]==b[y]){
		output+=a[x];
		return path(x-1,y-1);
	}
	else{

		if(ans==dp(x-1,y))
			return path(x-1,y);
		return path(x,y-1);


	}





}





 
 
 
 
void solve(){
 
 
	cin>>a>>b;
 	
	memset(cache,-1,sizeof(cache));
 	
	dp(sz(a)-1,sz(b)-1);
	path(sz(a)-1,sz(b)-1);

	reverse(output.begin(), output.end()); ;
	cout<<output;


	
 
}
 



signed main() {
	fio;
	 
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	while(t--) {
		solve();
	}

	
	return 0;
}


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

using namespace std;

#define int long long

const int mod = 1e9 + 7;
int fac[2000001];

int b_p(int a, int b) {
    if (b == 0) return 1;
    int val = b_p(a, b / 2);
    if (b % 2) return (((val * val) % mod) * a) % mod;
    return (val * val) % mod;
}

int dv(int a, int b) {
    return (a * b_p(b, mod - 2)) % mod;
}

int c(int n, int k) {
    return dv(fac[n], (fac[k] * fac[n - k]) % mod);
}

void solve() {
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    fac[0] = 1;
    for (int i = 1; i <= 2000000; ++i) fac[i] = (fac[i - 1] * i) % mod;
    int ans = 0, sum = 0;
    sum = c(r1 + c1, r1);
    ans = sum;
    //cout << sum << '\n';
    int lx = r1, ly = c1, rx = r1, ry = c1;
    while (ly < c2 || lx < r2) {
        sum += sum;
        if (ly < c2) {
            ++ly;
            sum += c(ly + lx - 1, ly);
        }
        else {
            sum -= c(lx + ly, lx);
            ++lx;
        }
        if (rx < r2) {
            ++rx;
            sum += c(ry + rx - 1, rx);
        }
        else {
            sum -= c(rx + ry, rx);
            ++ry;
        }
        sum = ((sum % mod) + mod) % mod;
        ans += sum;
        ans %= mod;
        //cout << sum << ' ' << lx << ' ' << ly << ' ' << rx << ' ' << ry << '\n';
    }
    cout << ans;
}

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


Measured memory_bytes: 15872
#include <iostream>
#include <vector>
#include <algorithm>
#define N 5
using namespace std;
int main() {
  vector<int> v1(N);
  for(int i = 0; i < N; ++i) {
	cin >> v1[i];
  }
  sort(v1.begin(), v1.end());
  reverse(v1.begin(), v1.end());
  for(int i = 0; i < N; ++i) {
	cout << v1[i];
	cout << ((i < N - 1) ? " " : "\n");
  }
  return 0;
}

Measured memory_bytes: 3112
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int main(){

	int N,L;
	scanf("%d %d",&N,&L);

	int* table = new int[N+1];
	int* DEQ = new int[N+1];
	for(int i = 1; i <= N; i++)scanf("%d",&table[i]);

	int left  = 0;
	int right = 0;

	DEQ[0] = 0;
	table[0] = BIG_NUM;

	for(int i = 1;i <= L-1; i++){
		while(right >= 0 && table[i] <= table[DEQ[right]])right--;
		DEQ[right+1] = i;
		right++;
	}

	for(int i = L; i <= N; i++){
		if(i-DEQ[left]+1 > L)left++;
		while(right >= left && table[i] <= table[DEQ[right]])right--;
		DEQ[right+1] = i;
		right++;
		if(i != L){
			printf(" %d",table[DEQ[left]]);
		}else{
			printf("%d",table[DEQ[left]]);
		}
	}

	printf("\n");

	return 0;
}

Measured memory_bytes: 10940
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        String op = sc.next();
        int b = sc.nextInt();

        if (op.equals("+")){
            System.out.println(a+b);
        }else if(op.equals("-")){
            System.out.println(a-b);
        }
    }
}


Measured memory_bytes: 35668
import sys


def input():
    return sys.stdin.readline()[:-1]


def dfs(tree: dict, count: list) -> list:
    res = [0] * (N + 1)

    stack = [1]
    while stack:
        label = stack.pop()
        res[label] = count[label]
        if tree[label] != []:
            for next_label in tree[label]:
                count[next_label] += count[label]
            stack += tree[label]

    return res


N, Q = map(int, input().split())

tree = {}
for i in range(1, N + 1):
    tree[i] = []
for i in range(N - 1):
    a, b = map(int, input().split())
    tree[a] += [b]

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

ans = dfs(tree, count)
print(*ans[1:])


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

using namespace std;

#define endl '\n'

typedef long long ll;
typedef pair<ll, ll> pii;

const ll mod = 1e9 + 7;
const int maxn = 3000 + 5;
const int maxm = 2e5 + 5;

ll dp[maxn], f[maxm];

ll mod_exp(ll a, ll b){
	if(b == 0)
		return 1;
	if(b % 2 == 0){
		ll t = mod_exp(a, b / 2) % mod;
		return t * t % mod;
	}
	return a * mod_exp(a, b - 1) % mod;
}

ll inv(ll x){
	return mod_exp(x, mod - 2) % mod;
}

ll n_k(ll n, ll k){
	if(k > n)
		return 0;
	ll num = f[n];
	ll den = f[k];
	den = (den * f[n - k]) % mod;
	den = inv(den);
	return (num * den) % mod;
}

ll paths(int xo, int yo, int xi, int yi){
	int n = abs(xo - xi);
	int m = abs(yo - yi);
	return n_k(n + m, n);
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	f[0] = 1LL;
	for(int i = 1; i < maxm; i++)
		f[i] = (f[i - 1] * 1LL * i) % mod;

	vector<pii> a;
	
	ll h, w, n;
	cin >> h >> w >> n;
	
	for(ll i = 0; i < n; i++){
		ll x, y;
		cin >> x >> y;
		a.push_back({x, y});
	}
	
	a.push_back({h, w});
	sort(a.begin(), a.end());
	
	n = a.size();
	
	for(int i = 0; i < n; i++){
		dp[i] = paths(1, 1, a[i].first, a[i].second);
		for(int j = 0; j < i; j++){
			if(a[j].first <= a[i].first && a[j].second <= a[i].second){
				ll cant = dp[j] * paths(a[j].first, a[j].second, a[i].first, a[i].second) % mod;
				dp[i] = (dp[i] + mod - cant) % mod;
			}
		}
	}
	
	cout << dp[n - 1] << endl;

	return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int32_t main() {
    fastio
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
        unordered_map<string, int> cache ( {{"AC", 0},{"WA", 0},{"TLE", 0},{"RE", 0}} );
        int N;
        cin >> N;
        string input;
        while (N--) {
                cin >> input;

                if (cache.find(input) != cache.end())
                        cache[input] += 1;
        }

        array<string, 4> v =  {"AC", "WA", "TLE", "RE"};
        for(auto& i : v) {
                int r;
                r = cache.at(i);
                cout << i << " x " << r << "\n";
        }

    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string A,B;
  cin >> A >> B;
  int C=0;
  for(int i=0;i<A.size();i++){
    if(A[i]==B[i]){
      C++;
    }
  }
  if(C==A.size()){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

//最小公倍数= a*b / 最大公約数
//最大公約数
int gcd(int x, int y)
{
    return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y)
{
    return x / gcd(x, y) * y;
}


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

    int ans = lcm(2, N);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  vs s(n);
  rep(i, n){
    cin >> s[i];
  }
  ll a, w, t, r;
  a = 0, w = 0, t = 0, r = 0;
  rep(i, n){
    switch(s[i][0]){
      case 'A': a++; break;
      case 'W': w++; break;
      case 'T': t++; break;
      case 'R': r++; break;
      
    }
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << w << endl;
  cout << "TLE x " << t << endl;
  cout << "RE x " << r << endl;
}


Measured memory_bytes: 6360
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <math.h>
#include <deque>
#include <stack>

using namespace std;

typedef long long ll;

int main(void){
    ll r;
    cin >> r;
    cout << pow(r,2) * 3 << endl;
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
    const N = parseInt(input.shift())
    const As = input.map(x => parseInt(x));

    var isOdd = false;
    var absSum = 0;
    var minAbs = Number.MAX_SAFE_INTEGER;

    As.forEach(element => {
        if (element < 0) {
            isOdd = !isOdd;
            element *= -1;
        }
        absSum += element;
        minAbs = Math.min(minAbs, element);
    });

    if (isOdd) {
        absSum -= minAbs * 2;
    }

    console.log(absSum);
}

// 1行入力の場合
// Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

// 改行で分割
// Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n/));

// 改行・空白で分割
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

Measured memory_bytes: 27328
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int main(){
    int n;
    cin >> n;
    vector<P> ve;
    rep(i,n){
        int b;
        cin >> b;
        ve.emplace_back(b,i-b+1);
    }
    vector<int> ans;
    rep(i,n){
        for(int j=n-1-i; j>=0; j--){
            if(ve[j].second==0){
                for(int k=j+1; k<ve.size(); k++){
                    ve[k].second--;
                }
                ans.push_back(ve[j].first);
                ve.erase(ve.begin()+j);
                break;
            }
        }
        if(ans.size()!=i+1){
            cout << -1 << endl;
            return 0;
        }
    }
    reverse(ans.begin(),ans.end());
    rep(i,n) cout << ans[i] << endl;

    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
const int inf = 1e9;
const int mod = 1e9+7;
 
int main() {
    int N;
    cin >> N;
    int A[N];
    ll S = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        S += A[i];
    }
 
    ll x_sum = 0;
    for (int i = 1; i <= N-2; i+=2) {
        x_sum += (2 * A[i]);
    }
 
    int x[N];
    x[0] = (int)(S - x_sum);
    for (int i = 0; i < N-1; i++) {
        x[i+1] = 2 * A[i] - x[i];
    }
 
    for (int i = 0; i < N; i++) {
        cout << x[i];
        if (i != N-1) cout << " ";
        else cout << endl;
    }
 
    return 0;
}

Measured memory_bytes: 2048
using System;
using System.Linq;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //string[] str = Console.ReadLine().Split(' ');
            //int n = int.Parse(Console.ReadLine());

            string[] str = Console.ReadLine().Split(' ');
            long n = long.Parse(str[0]);
            long a = long.Parse(str[1]);
            long b = long.Parse(str[2]);

            long ans = 0;

            if (a == 0)
            {
                Console.WriteLine(0);
                return;
            }
            if (b == 0)
            {
                Console.WriteLine(n);
                return;
            }

            long ab = a + b;
            long dup = n / ab;
            ans += dup*a;

            if (n % ab > a) { ans += a; }
            else { ans += n % ab; }


            Console.WriteLine(ans);

            //ここまで
        }
    }
}


Measured memory_bytes: 13140
import sys

def solve(s):
	if s[0] != 'A':
		return False


	s2 = s[2:L-1]
	if s2.count("C") != 1:
		return False

	s1 = s[1:].replace("C", "")
	if s1.islower():
		return True

	return False


s = sys.stdin.readline()
s = s.strip()
L = len(s)

flag = solve(s)

if flag == True:
	print("AC")
else:
	print("WA")



Measured memory_bytes: 38384
#include <atcoder/math>
using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr lint B1 = 1532834020;
constexpr lint M1 = 2147482409;
constexpr lint B2 = 1388622299;
constexpr lint M2 = 2147478017;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
template<class T>void chmax(T &a, const T &b) { if (a<b) a=b; }
template<class T>void chmin(T &a, const T &b) { if (b<a) a=b; }
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while(T--) {
    lint n, m, a, b;
    cin >> n >> m >> a >> b;
    cout << floor_sum(n, m, a, b) << "\n";
  }
}

Measured memory_bytes: 3612
#include <math.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;

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

const ll INF_ll = 1e17;
const int INF = 1e8;

int main() {
  int N;
  cin >> N;
  if (N <= 599) {
    cout << 8 << endl;
    return 0;
  }
  if (N <= 799) {
    cout << 7 << endl;
    return 0;
  }
  if (N <= 999) {
    cout << 6 << endl;
    return 0;
  }
  if (N <= 1199) {
    cout << 5 << endl;
    return 0;
  }
  if (N <= 1399) {
    cout << 4 << endl;
    return 0;
  }
  if (N <= 1599) {
    cout << 3 << endl;
    return 0;
  }
  if (N <= 1799) {
    cout << 2 << endl;
    return 0;
  }
  cout << 1 << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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 all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    int n;ll c;cin>>n>>c;
    vll x(n),v(n);rep(i,n)cin>>x[i]>>v[i];
    vll left(n),right(n),leftmax(n),rightmax(n);
    //left,rightはそれぞれi番目まで左回り右回りした時に得るエネルギー, leftmax,rightmaxはそれぞれi番目まで左回り右回りした時に得るエネルギーが最大になる場所でのそれ
    ll m=0;
    left[0]=v[0]-x[0];leftmax[0]=left[0];
    right[0]=v[n-1]-(c-x[n-1]);rightmax[0]=right[0];
    rep(i,n-1){
        left[i+1]=left[i]+v[i+1]-(x[i+1]-x[i]);
        leftmax[i+1]=max(leftmax[i],left[i+1]);
    }
    rep(i,n-1){
        right[i+1]=right[i]+v[n-2-i]-(x[n-1-i]-x[n-2-i]);
        rightmax[i+1]=max(rightmax[i],right[i+1]);
    }
    m=max(m,max(leftmax[n-1],rightmax[n-1]));
    rep(i,n-1)m=max(m,left[i]-x[i]+rightmax[n-2-i]);//いったん左に行ってuターンして右に行くパターン
    rep(i,n-1)m=max(m,right[i]-(c-x[n-1-i])+leftmax[n-2-i]);//上の逆
    cout<<m<<endl;
}

Measured memory_bytes: 4992
#include <cstdio>
#include <algorithm>
using namespace std;

typedef long long ll;

const int MAXN = 100005;

int N, K;
ll a[MAXN];
ll pref[MAXN];

void load() {
	scanf("%d%d", &N, &K);
	for (int i = 1; i <= N; i++)
		scanf("%lld", a + i);
}

ll solve() {
	for (int i = 1; i <= N; i++)
		pref[i] = pref[i - 1] + max(a[i], 0ll);
		
	for (int i = 1; i <= N; i++)
		a[i] += a[i - 1];
		
	ll sol = 0;
	for (int i = 1; i + K - 1 <= N; i++)
		sol = max(sol, pref[N] + pref[i - 1] - pref[i + K - 1] + max(a[i + K - 1] - a[i - 1], 0ll));
	
	return sol;
}

int main() {
	load();
	printf("%lld\n", solve());
	return 0;
}

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

int main() {
int a,b,c;
cin>>a>>b>>c;
if(a==b)
{
    if(a==c)
    cout<<"No";
    else
    cout<<"Yes";
}
else{ 
if(a==c)
cout<<"Yes";
else if(b==c)
cout<<"Yes";
else cout<<"No";
}

}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

const int mod = 1e9 + 7;

signed main() {
  int l, r, ans = 1e18;
  cin >> l >> r;
  for (int i = l; i <= r && i <= l + 4038; i++) {
    for (int j = i + 1; j <= r && j <= l + 4038; j++) {
      chmin(ans, (i * j) % 2019);
    }
  }
  print(ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <set>

using namespace std;

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

  set<int> as;

  as.insert(s);

  int i{1};
  while(1) {
    ++i;
    if (s%2) {
      s = 3*s+1;
    } else {
      s /= 2;
    }

    if(!as.insert(s).second) break;
  }

  cout << i << endl;
  
  return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()

signed main(){
	int N;
	string S,T,U;
	cin >> N >> S >> T;
	rep(i, N) {
		U += S[i];
		U += T[i];
	}
	cout << U;
}

Measured memory_bytes: 888
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <vector>
#define ll long long int
#define mp make_pair
#define pb push_back
#define vi vector<int>
using namespace std;
struct objects{
    int weight,value;
};
ll solve(){
   int n,w;
   cin>>n>>w;
   objects object[n];
   int totalvalue=0;
   for(int i=0;i<n;i++){
       cin>>object[i].weight>>object[i].value;
       totalvalue+=object[i].value;
   }
   ll dp[totalvalue+1];
   dp[0]=0;
   int ans=0;
   for(int i=1;i<=totalvalue;i++){
       dp[i]=1e18;
   }
   for(int i=0;i<n;i++){
       for(int j=totalvalue;j>=0;j--){
           if(j>=object[i].value){
                dp[j]=min(dp[j],dp[j-object[i].value]+object[i].weight);
           }
           if(dp[j]<=w){
               ans=max(ans,j);
           }
       }
   }
   return ans;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);;
    cout<<solve();
}


Measured memory_bytes: 1024
MOD = 1000000007
n, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
A = set(A)
dp = [-1 for _ in range(n+1)]
dp[0] = 1
dp[1] = 1
if 1 in A:
    dp[1] = 0

step = 2
while True:
    if step == n+1:
        break
    
    if step in A:
        dp[step] = 0
    else:
        dp[step] = (dp[step-1] + dp[step-2]) % MOD
        
    step += 1
    
print(dp[n])

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

using namespace std;

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

int main() {
  int N;
  cin >> N;
  vector<int> inputs(N);
  rep(i, N){
    cin >> inputs.at(i);
  }
  
  vector<int> mochis(101, 0); 
  rep(i, N){
    mochis.at(inputs.at(i)) = 1;
  }
  int different = 0;
  rep(i, 101){
    different += mochis.at(i);
  }
  cout << different << endl;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()
arr=[0]*N
d={'r':P,'s':R,'p':S}
for i,t in enumerate(T):
    if i-K>=0:
        if T[i-K]!=t:
            arr[i]=d[t]
        elif arr[i-K]==0:
            arr[i]=d[t]
    else:
        arr[i]=d[t]
print(sum(arr))

Measured memory_bytes: 4084
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def get_depth(parent, node):
    depth = 0
    n = node
    while True:
        if parent[n] == -1: break
        n = parent[n]
        depth += 1

    return depth


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    parent = [-1] * N
    children = collections.defaultdict(list)

    for n in range(N):
        id, k, *C = il()
        for c in C:
            children[id].append(c)
            parent[c] = id

    for node in range(N):
        depth = get_depth(parent, node)
        type = ''
        if parent[node] == -1:
            type = 'root'
        elif len(children[node]) > 0:
            type = 'internal node'
        else:
            type = 'leaf'

        print('node {0}: parent = {1}, depth = {2}, {3}, {4}'.format(node, parent[node], depth, type, children[node]))


if __name__ == '__main__':
    main()



Measured memory_bytes: 29156
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n;
    string s;
    cin >> n >> s;
    int k;
    cin >> k;
    k--;
    rep(i,n){
        if(s[i] != s[k])cout << "*";
        else cout << s[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};

int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int a;
    cin>>a;
    cout<<(3*a*a)<<endl;

    return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;

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

        int k = sc.nextInt();
        int s = sc.nextInt();

        int cnt = 0;

        for (int x = 0; x <= k; x++) {
            for (int y = 0; y <= k; y++) {
                if (s-x-y >= 0 && s-x-y <= k)
                    cnt++;
            }
        }

        System.out.println(cnt);
    }
}


Measured memory_bytes: 21716
#include <iostream>

int main(void){
	int n, cnum;
	int* b;
	std::cin >> n;
	b = new int[n];
	n--;

	for(int i=0; i<=n; i++){
		std::cin >> cnum;
		if(n % 2 && i % 2 || !(n % 2) && !(i % 2)){
			b[n/2-i/2] = cnum;
		}else{
			b[(n+(n+1)%2)-(n/2-i/2)] = cnum;
		}
	}

	for(int i=0; i<=n; i++){
		std::cout << b[i];
		if(i != n) std::cout << ' ';
	}
	std::cout << '\n';

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


Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(){
    cin.tie(0)->sync_with_stdio(false);

	int N;
	cin >> N;
	map<int, int> a;
	REP(i, N) {
		int tmp;
		cin >> tmp;
		a[tmp]++;
	}
	vector<int> diff((int)a.size());
	int i = 0;
	for (auto x : a) {
		diff[i] = x.second - 1;
		i++;
	}

	int n = diff.size();
	REP(i, n) {
		if (!diff[i]) continue ;
		int sum = 0;
		for (int j = i + 1; j < n; j++) {
			sum += diff[j];
			if (diff[i] <= sum) {
				for (int k = i + 1; k < j; k++) diff[k] = 0;
				diff[j] = sum - diff[i];
				diff[i] = 0;
				sum = 0;
				break ;
			}
		}
	}

	int res = 0;
	REP(i, n) res += diff[i];
	cout << n - (res % 2) << '\n';
    return 0;
}


Measured memory_bytes: 8236
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    ll A, B, C; cin >> A >> B >> C;

    if (C < A+B) {
        cout << "No" << endl;
    } else if (4*A*B >= (C-A-B)*(C-A-B)) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



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

int main(){ 
  string S;
  cin >> S;
  string Y(4,'0');
  for(int i = 0; i < 4; i++){
    Y.at(i) = S.at(i);
  }
  string M(2,'0');
  for(int i = 0; i < 2; i++){
    M.at(i) = S.at(i + 5);
  }
  int y = atoi(Y.c_str());
  int m = atoi(M.c_str());
  if(y < 2019) cout << "Heisei" << endl;
  else if(y = 2019 && m <= 4) cout << "Heisei" << endl;
  else cout << "TBD" << endl;
}


Measured memory_bytes: 256