akhauriyash/Code-Regression huggingface dataset:
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        var w = a[0];
        for (int i = 1; i < n; i++) w = Lcm(w, a[i]);
        Console.WriteLine(w);
    }
    public static long Lcm(long a, long b)
    {
        if (a < b) return Lcm(b, a);
        var ab = a * b;
        while (b != 0)
        {
            var wk = a % b;
            a = b;
            b = wk;
        }
        return ab / a;
    }
}



Measured memory_bytes: 9176
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,A,B,C,D;
  string S,ans;
  cin>>N>>A>>B>>C>>D>>S;
  S.push_back('#');
  S.push_back('#');
  S.push_back('#');
  
  A--;B--;C--;D--;

  int su_right=A, hu_right=B;

  bool tmp_flag=false;
  for(int i=B-1;i<=D-1;i++){
    if(S[i]=='.' && S[i+1]=='.' && S[i+2]=='.'){
      tmp_flag=true;
    }
  }

  for(int i=A;i<N+2;i++){
    if(S[i-1]=='#' && S[i] =='#'){
      su_right=i-2;
      break;
    }
  }

  for(int i=B;i<N+2;i++){
    if(S[i-1]=='#' && S[i] =='#'){
      hu_right=i-2;
      break;
    }
  }
  if(C<D){
    if(C<=su_right && D<=hu_right){
      ans="Yes";
    }else{
      ans="No";
    }
  }else{
    if(su_right==hu_right && tmp_flag==true && C<=su_right && D<=hu_right){
      ans="Yes";
    }else{
      ans="No";
    }
  }

  cout<<ans<<endl;

}


Measured memory_bytes: 592
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string in; cin >> in;
    uniq(in);

    int cur = 0;
    for(auto& e : in){
        char cc = (char)(cur + 'a');
        if(e != cc){
            break;
        }
        cur++;
    }
    if(cur < 26){
        cout << (char)(cur + 'a') << endl;
    }
    else {
        cout << "None" << endl;
    }

    return 0;
}


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

int main(){
  string s;
  int n;
  cin>>s;
  n=s.length();
  map<char,int> m;
  m.insert({'p',0});
  m.insert({'q',1});
  m.insert({'b',2});
  m.insert({'d',3});
  for(int i=0;i<n;i++){
    if((m[s[i]]^m[s[n-1-i]])!=1){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 3228
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<cstring>
#include<string>
#include<cctype>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<queue>
using namespace std;
const int maxn = 1e8 + 8;

int a[10000 + 8];
int n,v,j;

void insertSort(int a[])
{
    for(int i = 1; i < n; ++i){
        v = a[i];
        j = i - 1;
        while(j >= 0 && a[j] > v){
            a[j+1]  = a[j];
            j--;
        }
        a[j+1] = v;
    }
}
bool  judge(int x)
{
    if(x == 2) return true;
    for(int i = 2; i <= (int)sqrt(x); ++i){
        if(x % i == 0) return false;
    }
    return true;
}
int main()
{
    memset(a,0,sizeof a);

    scanf("%d",&n);
    for(int i = 0; i < n; ++i){
        scanf("%d",&a[i]);
    }
    //insertSort(a);//??¶??´?????????O(n^2)
    
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        if(judge(a[i])) cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}
/*
11
12
13
14
15
16
17
7
8
9
10
11
*/

Measured memory_bytes: 3240
#include <stdio.h>

int main(void){
  int a,b,c,i,co=0;

  scanf("%d%d%d",&a,&b,&c);
  for(i=a;i<=b;i++){
    if(c%i==0)  co++;
  }
  printf("%d\n",co);

  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <stack>
#include <sstream>
using namespace std;


int main(){
	int temp;
	string s;
	stringstream ss;
	stack<int> st;
	while(cin >> s){
		int a,b;
		switch(s[0]){

			case '+':
			b=st.top();
			st.pop();
			a=st.top();
			st.pop();
			st.push(a+b);
			break;
			case '-':
			b=st.top();
			st.pop();
			a=st.top();
			st.pop();
			st.push(a-b);
			break;
			case '*':
			b=st.top();
			st.pop();
			a=st.top();
			st.pop();
			st.push(a*b);			
			break;
			default:
			ss<<s;
			ss>>temp;
			ss.clear();
			st.push(temp);
			break;
		}
	}
	cout << st.top()<< endl;
	return 0;
}

Measured memory_bytes: 3120
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<utility>
using namespace std;
#define MS(m,z) memset(m,z,sizeof(m))
typedef unsigned U; typedef pair<int,int > P; typedef long long ll;
void inp();
int main(){
#ifdef XS
	freopen("D.in","r",stdin);
#endif
	//int n;scanf("%d",&n);for(int i=1;i<=n;i++)
	inp();
	return 0;
}
const int N = 1e5+100;
int head[N],ecnt=0;
struct E{
	int f,t,n;
	ll c;
	void set(int f,int t,int c,int n){this->f=f,this->t=t,this->c=c,this->n=n;}
}es[N*2];
void ae(int a,int b,int c){ es[ecnt].set(a,b,c,head[a]);head[a]=ecnt; ecnt++; }
ll d[N];
void dfs(int v,int fa){
	E e;
	for(int i=head[v];i!=-1;i=e.n){
			e=es[i];
			if(e.t==fa)continue;
			d[e.t]=d[v]+e.c;
			dfs(e.t,v);
	}
}
void inp(){
	MS(head,-1);
	int n; scanf("%d",&n);
	int a,b,c;
	for(int i =0;i<n-1;i++){
		scanf("%d%d%d",&a,&b,&c);
		ae(a,b,c);ae(b,a,c);
	}
	int q,rt;scanf("%d%d",&q,&rt);
	dfs(rt,-1);
	for(int i=0;i<q;i++){
		scanf("%d%d",&a,&b);
		printf("%lld\n",d[a]+d[b]);
	}
}
//D.cc by xsthunder at Sat Aug 12 20:16:49 2017


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

using namespace std;

using ll = long long;
const int MAX_N = 1e5 + 1;
int n, m;
int p[MAX_N], used[MAX_N];
bool visited1[MAX_N], visited2[MAX_N];
vector<int> g[MAX_N];

void Input() {
    scanf("%d %d", &n, &m);

    for (int i = 0; i < n; ++i) {
        scanf("%d", &p[i]);
        --p[i];
    }
    for (int i = 0, x, y; i < m; ++i) {
        scanf("%d %d", &x, &y);
        g[x - 1].push_back(y - 1);
        g[y - 1].push_back(x - 1);
    }

    for (int i = 0; i < n; ++i)
        visited1[i] = visited2[i] = false;
}

void Dfs1(const int cur, const int gr) {
    visited1[cur] = true;
    used[p[cur]] = gr;

    for (auto dst : g[cur]) {
        if (visited1[dst]) continue;
        Dfs1(dst, gr);
    }
}

int Dfs2(const int cur, const int gr) {
    visited2[cur] = true;

    int res = (used[cur] == gr ? 1 : 0);
    for (auto dst : g[cur]) {
        if (visited2[dst]) continue;
        res += Dfs2(dst, gr);
    }

    return res;
}


int Solve() {
    int res = 0, gr = 1;

    for (int v = 0; v < n; ++v) {
        if (visited1[v]) continue;
        Dfs1(v, gr);
        res += Dfs2(v, gr);
        ++gr;
    }

    return res;
}

int main() {
    Input();
    printf("%d\n", Solve());

    return 0;
}


Measured memory_bytes: 9728
#include<stdio.h>
#define N 10000

int main(void){
  int i,num,j,k;
  int a,b;
  int n;
  int x,y;
  int map[20][20];
  int ams[N];

  for(i=0;;i++){
    scanf("%d%d",&a,&b);
    if(a==0 && b==0)
      break;

    for(j=0;j<=a;j++)
      map[0][j]=0;
    for(j=0;j<=b;j++)
      map[j][0]=0;
    for(j=0;j<b;j++)
      for(k=0;k<a;k++)
        map[j+1][k+1]=-1;

    scanf("%d",&n);
    for(j=0;j<n;j++){
      scanf("%d%d",&x,&y);
      map[y][x]=0;
    }

    for(j=1;j<=a && map[1][j]!=0;j++)
      map[1][j]=1;
    for(j=1;j<=b && map[j][1]!=0;j++)
      map[j][1]=1;

    for(j=1;j<=b;j++)
      for(k=1;k<=a;k++)
        if(map[j][k]==-1)
          map[j][k]=map[j-1][k]+map[j][k-1];

    ams[i]=map[b][a];
  }

  num=i;

  for(i=0;i<num;i++)
    printf("%d\n",ams[i]);

  return 0;
}

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

using namespace std;

int main(void)
{
	int n, a, b;
	cin >> n >> a >> b;
	if ((b - a) % 2 == 0) {
		cout << "Alice" << endl;
	} else {
		cout << "Borys" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;
using P= pair<int,int>;


int main() {
    ll N;
    ll answer=0;
    cin>>N;
    vector<int> d(N+1);
    for(int i=1;i<=N;i++){
      for(int j=i;j<=N;j+=i)d[j]++;
    }
    for(int i=1;i<=N;i++)answer+=ll(i)*d[i];
    cout<<answer<<endl;
    return 0;
}

Measured memory_bytes: 42340
import java.util.*;
public class Main{
	public static void main(String args[]){
    	Scanner s = new Scanner(System.in);
    	int n = s.nextInt();
      	int a = n % 10;
      	int b = (n / 10) % 10;
      	int c = (n / 100) % 10;
      	if(a == 7 || b == 7 || c == 7){
        	System.out.println("Yes");
        }else{
        	System.out.println("No");
        }
    }
}

Measured memory_bytes: 35716
#include <bits/stdc++.h>
#define fi first
#define se second
#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 fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,r,l) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define INF (1LL<<62)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
const int MOD = 1e9+7;
const double PI = atan(1)*4;
const int MAXN = 55;
const double EPS = 1e-9;
int n;
vector<vi> m1, m2, res, mat;
ll k, ans;

vector<vi> multiply(vector<vi> m1, vector<vi> m2){
    int dim = m1[0].size();
    vector<vi> res (dim);
    forn(i,dim){
        res[i].resize(dim);
    }
    forn(i, dim){
        forn(j,dim){
            res[i][j]=0;
            forn(k, dim){
                res[i][j] += m1[i][k]*m2[k][j];
                res[i][j] %= MOD;
            }
        }
    }
    return res;
}

vector<vi> binPow(vector<vi> m, ll e){
    if(e==1){
        return m;
    }
    if(e%2){
        return multiply(m, binPow(multiply(m,m), e/2));
    } else{
        return binPow(multiply(m,m), e/2);
    }
}

int main(){
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL); cout.tie(NULL);
    cout<< setprecision(2)<< fixed;
    cin>>n>>k;
    m1.resize(n);
    forn(i,n){
        m1[i].resize(n);
        forn(j,n){
            cin>>m1[i][j];
        }
    }
    mat = binPow(m1, k);
    forn(i,n){
        forn(j,n){
            ans += mat[i][j];
            ans %= MOD;
        }
    }
    cout<<ans<<el;
}


Measured memory_bytes: 4096
#include<iostream>
using namespace std;
 
int main()
{
 string grade;
 int n,i,pm,pe,pj;
 while(cin>>n,n){
  for(i=0;i<n;i++){
   cin>>pm>>pe>>pj;
   if(pm==100||pe==100||pj==100) grade="A";
   else if((pm+pe)/2 >= 90) grade="A";
   else if((pm+pe+pj)/3 >= 80) grade="A";
   else if((pm+pe+pj)/3 >= 70) grade="B";
   else if((pm+pe+pj)/3 >= 50 && (pm>=80||pe>=80)) grade="B";
   else grade="C";
   cout<<grade<<endl;
  }
 }
 return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
const int MAXN=1e3+5;
const int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};
int a[MAXN][MAXN];
int n,m;
int d[MAXN][MAXN];
struct rec{
	int x,y;
};
queue<rec> q;
bool ub(int x,int y){
	return x<1||x>n||y<1||y>m;
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++){
			char c=getchar(); while (c!='#'&&c!='.') c=getchar();
			a[i][j]=(c=='#'); d[i][j]=1e9;
			if (a[i][j]) d[i][j]=0,q.push((rec){i,j});
		}
	}
	while (!q.empty()){
		rec u=q.front(); q.pop();
		for (int i=0;i<4;i++){
			int nx=u.x+dx[i],ny=u.y+dy[i];
			if (ub(nx,ny)) continue;
			if (d[nx][ny]==1e9){
				d[nx][ny]=d[u.x][u.y]+1;
				q.push((rec){nx,ny});
			}
		}
	}
	int ans=0;
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++) ans=max(ans,d[i][j]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 16272
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#include <bitset>
#define M 1000000007
#define M1 998244353

#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define fast                        \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

ll power(ll x, ll n)
{
    ll result = 1;
    while (n)
    {
        if (n % 2 == 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}

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

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

inline ll mul(ll x, ll y, ll m)
{
    ll z = 1LL * x * y;
    if (z >= m)
    {
        z %= m;
    }
    return z;
}

ll powmod(ll x, ll y, ll m)
{
    ll r = 1;
    while (y)
    {
        if (y & 1)
        {
            r = mul(r, x, m);
        }
        y >>= 1;
        x = mul(x, x, m);
    }
    return r;
}



void start()
{
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
/***********************************************************************************************************/

int main()
{
    start();
    int n;
    cin>>n;
    int t[n+1];
    for (int i=1;i<=n;i++)
    {
        cin>>t[i];
    }
    int s=0;
    for (int i=1;i<=n;i++)
    {
        s+=t[i];
    }
    int m;
    cin>>m;
    while (m--)
    {
        int x, y;
        cin>>x>>y;
        cout<<s-t[x]+y<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3660
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
#include<array>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acosl(-1.0);

ll mod_pow(ll x, ll n, ll m = mod) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * x % m;
		x = x * x % m; n >>= 1;
	}
	return res;
}
struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n % mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint& a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint& a, modint b) { a.n = ((ll)a.n * b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, ll n) {
	if (n == 0)return modint(1);
	modint res = (a * a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 21;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

void solve() {
	int n; cin >> n; int k; cin >> k;
	vector<modint> dp(n + 1);
	dp[1] = 1;
	vector<int> l(k), r(k);
	rep(i, k)cin >> l[i] >> r[i];
	vector<modint> rdp(n + 2);
	for (int i = 1; i <= n; i++) {
		dp[i] += rdp[i]; rdp[i + 1] += rdp[i];
		rep(j, k) {
			int tl = i + l[j];
			int tr = i + r[j] + 1;
			if (tl > n)continue;
			rdp[tl] += dp[i];
			if(tr<=n)rdp[tr] -= dp[i];
		}
	}
	cout << dp[n] << "\n";
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(15);
	//init_f();
	//init();
	//expr();
	//int t; cin >> t; rep(i, t)
	solve();
	return 0;
}




Measured memory_bytes: 39088
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a;
    cin>>a;
    string s;
    cin>>s;
    if(a<3200){cout<<"red"<<endl;}
    else{cout<<s<<endl;}
    return 0;
    }


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

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

    int X; cin >> X;
    //int p = X / 100 * 100;
    FOR(i,0,1001){
        int rx = X - (i*100);
        if(rx < 0) continue;
        if(rx <= i*5){
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;

}


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

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N)cin >> A[i];
    bool ok = true;
    for(int i=0;i<N;i++){
        if(A[i]%2==0){
            if(A[i]%3==0 || A[i]%5==0);
            else ok = false;
        }
    }
    if(ok)cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}

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

int main()
{
    int N, X, T;
    cin >> N >> X >> T;
    int add = 0;
    if (N % X != 0)
    {
        add = 1;
    }
    cout << (N / X + add) * T << endl;
    return 0;
}

Measured memory_bytes: 3596
import java.util.Arrays;
import java.util.Scanner;

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

        int[] x = new int[5];
        for (int i = 0; i < x.length; ++i) {
            x[i] = sc.nextInt();
        }

        System.out.println(solve(x));

        sc.close();
    }

    static int solve(int[] x) {
        return 15 - Arrays.stream(x).sum();
    }
}

Measured memory_bytes: 35896
# coding: utf-8
N = int(input())
info = []
for i in range(N):
    info.append(list(map(int, input().split())))
# s = False
info.sort(key=lambda x: x[2], reverse=True)
for cx in range(101):
    for cy in range(101):
        flag = True
        s = False
        for i in range(N):
            x, y, h = info[i]
            # if x < 0 or y < 0 or h <= 0:
            #     continue
            if not s:
                H = h + abs(cx - x) + abs(cy - y)
                s = True
                continue
            else:
                if h != max(H - abs(cx - x) - abs(cy - y), 0):
                    flag = False
        if flag:
            print(cx, cy, H)
            exit()
ans = info[0]
for i in range(1, N):
    if ans[2] > info[i][2]:
        ans = info[i]
print(*ans)


Measured memory_bytes: 3064
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
//#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){

    int D;
    cin >> D;

    if(D==25){
        cout << "Christmas";
    }else if(D==24){
        cout << "Christmas Eve";
    }else if(D==23){
        cout << "Christmas Eve Eve";
    }else if(D==22){
        cout << "Christmas Eve Eve Eve";
    }

    

}

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  ll X, Y; scanf("%lld %lld", &X, &Y);
  int ans = 1;
  ll val = X;
  while (val * 2 <= Y) {
    ++ans;
    val *= 2;
  }
  printf("%d\n", ans);
  return 0;
}


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

vector<int> edge[123456];

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


int d(int a){
  int res=0;
  vector<int> v;
  for(int p:edge[a])v.push_back(d(p));
  sort(v.rbegin(),v.rend());
  for(int i=0;i<v.size();i++)chmax(res,v[i]+i);
  return res+1;
}

signed main(){
  int n;cin>>n;
  for(int i=1;i<n;i++){
    int a;cin>>a;a--;
    edge[a].push_back(i);
  }
  cout<<d(0)-1<<endl;
}


Measured memory_bytes: 20364
#include<bits/stdc++.h>
 
#define reps(i,f,n) for(int i = f; i < n; ++i)
#define rep(i,n) reps(i,0,n)
 
using namespace std;
 
int main(void){
    int ans = 0;
    vector<int> a;
    a.resize(5);
    int m = 10;
 
    rep(i, a.size()){
        cin >> a[i];
        if(a[i] % 10 < m && a[i] % 10 != 0){
            m = a[i] % 10;
        }
    }
    rep(i, a.size()){
        if(a[i] %10 != m){
          if(a[i]%10 != 0){
            ans += a[i] + (10 - a[i] % 10);
          }else{ans += a[i];}
        }else{
            ans += a[i];
            m = 10;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 764
K=int(input())
l=[]
for i in range(10):
    r=[]
    if (i-1)<0:
        pass
    else:
        r.append(str(i-1))
    r.append(str(i))
    if (i+1)>9:
        pass
    else:
        r.append(str(i+1))
    l.append(r)
lst=[]
count=0
for i in range(1,10):
    lst.append(str(i))
    count+=1
queue=lst[0]
tmp=0
while(1):
    queue=lst[tmp]
    s=queue[-1]
    num=int(s)
    for i in range(len(l[num])):
        s=queue
        s=s+l[num][i]
        lst.append(s)
        count+=1
    tmp+=1
    if count>=K:
        break
print(lst[K-1])

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

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int n = fs.nextInt(), p = fs.nextInt();
		String s = fs.next();
		char c[] = s.toCharArray();
		int a[] = new int[n];
		for(int i=0;i<n;i++)a[i] = c[i] - '0';
		
		
		if(p==2) {
			long ans = 0;
			for(int i=0;i<n;i++) {
				if(a[i]%2==0) {
					ans += i+1;
				}
			}
			System.out.println(ans);
			return;
		}
		if(p==5) {
			long ans = 0;
			for(int i=0;i<n;i++) {
				if(a[i]%5==0) {
					ans += i+1;
				}
			}
			System.out.println(ans);
			return;
		}
		
		int sum[] = new int[n+1];
		
		int d = 1;
		Map<Integer,Integer> map = new HashMap<>();
		for(int i=0;i<n;i++) {
			sum[i+1] = (a[n-1-i] * d + sum[i])%p;
			d = d * 10 % p;
		}
		for(int i=0;i<n+1;i++) {
			map.put(sum[i], map.getOrDefault(sum[i], 0)+1);
		}
		long ans = 0;
		for(int key:map.keySet()) {
			int num = map.get(key);
			ans += (long)num * (num-1) / 2;
		}
		System.out.println(ans);
	}

	//MOD culculations
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

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

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

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

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

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

Measured memory_bytes: 34352
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

// author:Swastik Banerjee

using namespace std;

typedef long long ll;
#define MOD 1000000007


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



  



    ll n;   cin>>n;
    string s=to_string(n);

    int x=s[s.size()-1]-'0';

    if(x==2 || x==4 || x==5 || x==7 || x==9)
        cout<<"hon";
    else if(x==0 || x==1 || x==6 || x==8)
        cout<<"pon";
    else
        cout<<"bon";



  
    


}

Measured memory_bytes: 3720
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int N;
  long long K;
  cin >> N >> K;
  //整数firstをsecond個挿入する
  pair<int, long long> push[N];
  for(int i=0; i<N; i++){
    int a, b;
    cin >> a >> b;
    push[i].first = a;
    push[i].second = b;
  }
  //ここまで入力

  //firstでソートし，小さいものから見ていく
  sort(push, push+N);

  long long count = 0, i = 0;
    while(1){
      //整数の個数がKを超えない間はカウントし続ける
      if(count + push[i].second < K)
	count += push[i].second;
      else
	break;
      i++;
    }

    //このときのiのfirstが求める整数になる
    cout << push[i].first << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <queue>
#include <vector>
#define pb push_back
using namespace std;
queue<int> q;
vector<int> v[110];
bool seen[110] = {0};
int main() {
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        int u, k; cin >> u >> k;
        while (k--) {
            int tmp; cin >> tmp;
            v[u].pb(tmp);
        }
    }
    q.push(1);
    int d[n + 1];
	for (int i = 0; i <= n; i++)
		d[i] = -1;
    d[1] = 0; seen[1] = 1;
    while (!q.empty()) {
        for (int x: v[q.front()]) {
            if (!seen[x]) {
                q.push(x);
                seen[x] = 1;
                d[x] = d[q.front()] + 1;
            }
        }
        q.pop();
    }
    for (int i = 1; i <= n; i++)
        cout << i << ' ' << d[i] << '\n';
    return 0;
}


Measured memory_bytes: 3164
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main(void){
  char c;
  int a, b, n;
  vector<int> v;
  map<int, int> m;

  while(cin >> a >> c >> b, a || b){
    m[a] = b;
    if(find(v.begin(), v.end(), b) == v.end()){
      v.push_back(b);
    }
  }
  sort(v.begin(), v.end(), greater<int>());


  vector<int>::iterator it;
  while(cin >> n){
    it = find(v.begin(), v.end(), m[n]);
    cout << it - v.begin() + 1 << endl;
  }

  return 0;
}

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

int main() {
	int a[3];
	scanf("%d%d%d", &a[0], &a[1], &a[2]);

	int ok = 0;
	for(int i = 0; i < 3; i++) {
		for(int j = i + 1; j < 3; j++) {
			if(a[i] != a[j])
				continue;

			for(int k = 0; k < 3; k++) {
				if(k != i && k != j && a[k] != a[i] && a[k] != a[j])
					ok = 1;
			}
		}
	}

	if(ok)
		printf("Yes\n");

	else printf("No\n");

	return 0;
}

Measured memory_bytes: 384
<?php
 
function input_and_explode() {
    $input_line = trim(fgets(STDIN));
    return explode(" ", $input_line);
}

list($N, $M) = input_and_explode();

$A = input_and_explode();

$sum = 0;
for ($i = 0, $len = count($A); $i < $len; $i++) {
    $sum += $A[$i];
    $sum %= $M;
    $A[$i] = $sum;
}

$count_values = array_count_values($A);

$result = 0;

foreach ($count_values as $k => $v) {
    if ($k === 0) {
        $v++;
    }
    $result += $v * ($v - 1) / 2;
}

echo "$result\n";

Measured memory_bytes: 16884
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
/*ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}*/
// --------------------------------------------------</TEMPLATE>--------------------------------------------------
ll arr[505][505];
ll brr[505][505];
void solve()
{
    ll n,w;
    cin>>n>>w;
    ll dp[n+1][w+1];
    vector<pair<ll,ll> >v(n);
    for(ll i=0;i<n;i++)
    {
        cin>>v[i].first>>v[i].second;
    }
    for(ll i=0;i<n+1;i++)
    {
        for(ll j=0;j<w+1;j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;
            else if(j<v[i-1].first)
                dp[i][j]=dp[i-1][j];
            else if(j>=v[i-1].first)
                dp[i][j]=max(dp[i-1][j],v[i-1].second+dp[i-1][j-v[i-1].first]);
        }
    }
    cout<<dp[n][w]<<endl;
}

int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);
}


Measured memory_bytes: 82488
#include <iostream>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>

using namespace std;

typedef long long signed int ll;

constexpr ll NIL = -20000000000;

class path{
public:
    int from;
    int to;
    int dist;
    path(){
        from = -1;
        to = -1;
        dist = -1;
    }
    path(int from_,int to_,int dist_){
        from = from_;
        to = to_;
        dist = dist_;
    }
    static bool compare(const path& a,const path& b) {
        return a.from < b.from;
    }
    bool operator<(const path& e) const {
        return this->dist < e.dist;
    }
};

int n,u,k,v,c;
vector<path> w;
ll d[10000];
bool dd[10000];

int main() {
    for(int i = 0;i < 10000;i++)d[i] = -NIL;
    for(int i = 0;i < 10000;i++)dd[i] = false;
    cin >> n;
    for(int i = 0;i < n;i++) {
        cin >> u >> k;
        for(int j = 0;j < k;j++) {
            cin >> v >> c;
            w.push_back(path(u,v,c));
        }
    }
    sort(w.begin(),w.end(),path::compare);
    priority_queue<pair<int,int>,vector<pair<int,int>>,std::greater<pair<int,int>> > q;
    q.push(make_pair(0,0));
    d[0] = 0;
    while(!q.empty()) {
        auto y = q.top();q.pop();
        if(dd[y.second]) continue;
        dd[y.second] = true;
        auto r = lower_bound(w.begin(),w.end(),path(y.second,0,0),path::compare);
        auto l = lower_bound(w.begin(),w.end(),path(y.second+1,0,0),path::compare);
        for(auto itr = r;itr < l;itr++) {
            if(d[itr->to] > d[itr->from] + itr->dist) {
                d[itr->to] = d[itr->from] + itr->dist;
                q.push(make_pair(d[itr->to],itr->to));
            }
        }
    }
    for(int i = 0;i < n;i++){
        cout << i << " " << d[i] << endl;
    }
}



Measured memory_bytes: 9092
#!/usr/bin/env python3
import sys


def solve(A: int, P: int):
    P += A * 3
    print(int(P / 2))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    solve(A, P)

if __name__ == '__main__':
    main()


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

N, W = map(int, input().split())
table = []
for i in range(N):
  w,v = map(int, input().split())
  table.append((w,v))
INF = W+1
dp = [[INF]*(10**3*N+1) for i in range(N+1)]
dp[0][0] = 0
for i in range(1,N+1):
  for k in range(10**3*N+1):
    w,v = table[i-1]
    dp[i][k] = dp[i-1][k]
    if v<=k and dp[i-1][k-v] <= INF:
      dp[i][k] = min(dp[i][k],dp[i-1][k-v]+w)

for i in range(10**3*N,-1,-1):
  if 0<= dp[-1][i] <= W:
    print(i)
    exit()


Measured memory_bytes: 120028
N, M = map(int, input().split())

if N == 1:
    num_list = [0]
    done_list = [False]
else:
    num_list = [1] + [0] * (N-1)
    done_list = [False] * (N)

result = 0
for i in range(M):
    s, c = map(int, input().split())
    if not done_list[s-1]:
        num_list[s-1] = c
        done_list[s-1] = True
    elif num_list[s-1] == c:
        pass
    else:
        result = -1
        break
    if N > 1 and s == 1 and c == 0:
        result = -1
        break

if result == 0:
    result = "".join(map(str, num_list))
print(result)


Measured memory_bytes: 38480
#include <sstream>
#include <iostream>
#include <vector>
#include <string>

using namespace std;
int main() {
    std::string line;
    std::getline(std::cin, line);
    std::vector<string> strings;
    std::istringstream f(line);
    std::string _X;
    std::string _t;
    getline(f, _X, ' ');
    getline(f, _t, ' ');
	int X = stoi(_X);
	int t = stoi(_t);
	if( X >= t) {
		cout << X - t << endl;
	} else {
		cout << 0 << endl;
	}
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<string.h>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<climits>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    double a,b,t;
    cin>>a>>b>>t;
    t+=0.5;
    int ans = 0;
    double seconds=0;
    while(true){
        if(seconds+a>t){
            break;
        }
        seconds+=a;
        ans+=b;
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>	       vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)	           for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

int h, w;
int dijkstra(vector<string>& g, int a, int b, int c, int d) {
  vector<vi> dist(h, vi(w, INF));
  vector<vb> visit(h, vb(w, false));
  priority_queue<tuple<int, int, int>> q;
  q.emplace(0, a, b);
  dist[a][b] = 0;
  while (!q.empty()) {
    auto [dis, x, y] = q.top();
    q.pop();
    if (visit[x][y]) continue;
    if (x == c and y == d) return abs(dis);
    visit[x][y] = true;
    for (int i = -2;i <= 2;i++) {
      for (int j = -2;j <= 2;j++) {
        int nx = x + i;
        int ny = y + j;
        if (nx < 0 or nx >= h or ny < 0 or ny >= w or visit[nx][ny] or g[nx][ny] == '#') continue;
        dist[nx][ny] = abs(dis) + (abs(i) + abs(j) != 1);
        q.emplace(-dist[nx][ny], nx, ny);
      }
    }
  }
  return -1;
}

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

  cin >> h >> w;
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  a--, b--, c--, d--;
  vector<string> m(h);
  loop(h) {
    cin >> m[i];
  }
  cout << dijkstra(m, a, b, c, d) << endl;
	return 0;
}



Measured memory_bytes: 9384
N,A = map(int,input().split())
X = list(map(int,input().split()))
Y = [x-A for x in X]
t = sum(X)
dp = [[0]*(t*2+1) for _ in range(N+1)]
#dp[i][j] -> i枚目まで見る。合計をj-tにするパターン数
#i枚目を使う場合 -> dp[i][j] += dp[i-1][j-Yi]
#i枚目を使わない場合 -> dp[i][j] += dp[i-1][j]
dp[0][t] = 1

for i in range(1,N+1):
    y = Y[i-1]
    for j in range(t*2+1):
        if 0 <= j-y <= t*2:
            dp[i][j] += dp[i-1][j-y]
        dp[i][j] += dp[i-1][j]

print(dp[-1][t]-1)

Measured memory_bytes: 41328
#include<iostream>
#include<sstream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e12,EPS=1e-9;

const int MOD=100000;
int w,h;
int dp[100][100][4];

void func(int &a,int b){
	a=(a+b)%MOD;
}
int main()
{
	while(cin>>w>>h,w)
	{
		rep(i,h)rep(j,w)rep(k,4)dp[i][j][k]=0;
		dp[0][0][1]=dp[0][0][3]=1;
		rep(i,h)rep(j,w)
		{
			if(i+1<h)
			{
				func(dp[i+1][j][0],dp[i][j][0]+dp[i][j][1]);
				func(dp[i+1][j][1],dp[i][j][2]);
			}
			if(j+1<w)
			{
				func(dp[i][j+1][2],dp[i][j][2]+dp[i][j][3]);
				func(dp[i][j+1][3],dp[i][j][0]);
			}
		}
		int ans=accumulate(dp[h-1][w-1],dp[h-1][w-1]+4,0)%MOD;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
a,l="+<"
f,r=print,range(29,-1,-1)
f(60451,l,4,0,3)
s,t=[a,7,7,7],[a,8,8,8]
for i in r:f(a,3,4,7,*s*i,a,5,7,7,l,0,7,7,l,7,3,7,a,4,4,6);[f(a,3,4,8,*t*j,a,6,8,8,l,1,8,8,l,8,3,8,l,8,7,9,*t*j,a,8,6,6,l,9,7,8,*t*(i+j),a,8,2,2)for j in r];f(*s*i,a,7,5,5)

Measured memory_bytes: 9492
#include <stdio.h>
const int limit= 10000;
char s[limit];
int main (){
  int n;
  bool y=false;
  scanf("%d\n", &n);
  for( int i=0; i<n; i++){
    if( i==(n-1) ){
      scanf("%c", &s[i]);
    }else{
      scanf("%c ", &s[i]);
    }
    if( s[i]=='Y') y = true;
  }
  if( y ) printf("Four\n");
  else printf("Three\n");
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cstdlib>
#include<algorithm>
#include<cctype>

using namespace std;

int main(){
	
	int num;
	int count=0;
	int all=0;
	
	cin>>num;
	
	for(int i=1;i<=num;i++){
		for(int j=1;j<=200;j++){
			if(i%j==0){
				count++;
			}
		
		}
		if(count==8 && i%2==1){
			all++;
		}
	count=0;
	}
	cout<<all<<endl;
	return 0;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

void first() {
	puts("First");
	exit(0);
}
void second() {
	puts("Second");
	exit(0);
}

const int MAXN = 100000 + 50;
int N;
int A[MAXN];

ll get_sum() {
	ll sum = 0;
	for(int i = 0; i < N; i++)
		sum += A[i] - 1;
	return sum;
}
int get_odd() {
	int cnt = 0;
	for(int i = 0; i < N; i++)
		if(cnt % 2 == 1)
			cnt++;
	return cnt;
}
bool have_one() {
	for(int i = 0; i < N; i++)
		if(A[i] == 1)
			return true;
	return false;
}
void go() {
	int g = 0;
	for(int i = 0; i < N; i++)
		g = __gcd(g, A[i]);
	for(int i = 0; i < N; i++)
		A[i] /= g;
}

int main() {
	scanf("%d", &N);
	for(int i = 0; i < N; i++)
		scanf("%d", &A[i]);
	if(N == 1) second();
	else if(N == 2) {
		if(get_sum() % 2 == 1) first();
		else second();
	}
	else { // N >= 3
		while(true) {
			if(get_sum() % 2 == 1) first();
			if(get_odd() > 1 || have_one()) second();
			for(int i = 0; i < N; i++)
				if(A[i] % 2 == 1) {
					A[i]--;
					break;
				}
			go();

			if(get_sum() % 2 == 1) second();
			if(get_odd() > 1 || have_one()) first();
			for(int i = 0; i < N; i++)
				if(A[i] % 2 == 1) {
					A[i]--;
					break;
				}
			go();
		}
	}
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int C[202020];
ll mo=1000000007;

ll dp[202020];
ll num[202020];
vector<int> cand[202020];
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>C[i];
		if(i&&C[i]==C[i-1]) {
			i--;
			N--;
			continue;
		}
		cand[C[i]].push_back(i);
	}
	dp[0]=1;
	FOR(i,N) {
		(num[C[i]]+=dp[i])%=mo;
		(dp[i+1]+=num[C[i]])%=mo;
	}
	cout<<dp[N]<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 15232
#include <iostream>
using namespace std;
char D[1002][1002]={};
int M,N;
char E[2][2];
char b[4]={'S','J','O','I'};

int main() {

	cin>>M>>N;
	for(int i=1; i<M+1; i++){
		for(int j=1; j<N+1; j++){
			cin>>D[i][j];
		}
	}
	for(int i=0; i<2; i++){
		for(int j=0; j<2; j++){
			cin>>E[i][j];
		}
	}

	int a = 0;
	for(int i=1; i<M; i++){//何も変えなかったとき
		for(int j=1; j<N; j++){
			if(D[i][j]==E[0][0] && D[i][j+1]==E[0][1] && D[i+1][j]==E[1][0] && D[i+1][j+1]==E[1][1])a += 1;
		}
	}

	int c[4];
	int R = 0;
	for(int i=1; i<M+1; i++){//一文字変えたとき
		for(int j=1; j<N+1; j++){

			b[0] = D[i][j];

			for(int k=0; k<4; ++k){

				D[i][j] = b[k];

				c[k] = 0;
				if(D[i][j]==E[0][0]     && D[i][j+1]==E[0][1]   && D[i+1][j]==E[1][0]   && D[i+1][j+1]==E[1][1])c[k]+=1;
				if(D[i][j-1]==E[0][0]   && D[i][j]==E[0][1]     && D[i+1][j-1]==E[1][0] && D[i+1][j]==E[1][1])  c[k]+=1;
				if(D[i-1][j-1]==E[0][0] && D[i-1][j]==E[0][1]   && D[i][j-1]==E[1][0]   && D[i][j]==E[1][1])    c[k]+=1;
				if(D[i-1][j]==E[0][0]   && D[i-1][j+1]==E[0][1] && D[i][j]==E[1][0]     && D[i][j+1]==E[1][1])  c[k]+=1;
			}

			D[i][j] = b[0];

			R = max(R,a+c[1]-c[0]);
			R = max(R,a+c[2]-c[0]);
			R = max(R,a+c[3]-c[0]);
		}
	}

	cout<<R<<endl;
	return 0;
}



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

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

    ll j = 7;
    for(ll i = 1; i <= k; ++i)
    {
        if(j % k == 0)
        {
            cout << i << "\n";
            return 0;
        }
        j = (j * 10 + 7) % k;
    }
    
    cout << -1 << "\n";
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll A, B, K; cin >> A >> B >> K;
    if (A >= K){
        cout << A - K << " " << B << endl;
    } else if (A + B <= K){
        cout << 0 << " " << 0 << endl;
    } else {
        cout << 0 << " " << B - (K - A) << endl;
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256