akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
int MOD=1e9+7;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
ll min(ll a,ll b){return (a>b)?b:a;}
ll max(ll a,ll b){return (a>b)?a:b;}
bool prime[1000001];
vi primes;
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for(int p=2;p<1000001;p++)
        if(prime[p])
            primes.pb(p);
}
ll fact[1001];
void factorial(int n){
    fact[0]=1;
    for(int i=1;i<=n;i++)
        fact[i]=fact[i-1]*i,fact[i]%=MOD;
}
ll ncr(ll n,ll r)
{
    if(n<r)
        return -1;
    else{
        ll x=fact[r]*fact[n-r]%MOD;
        return fact[n]*fermat_inv(x)%MOD;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int t=1;
    //cin>>t;
    //SieveOfEratosthenes(1000000);
    //factorial(1000);
    while(t--){
        ll x,k,d;
        cin>>x>>k>>d;
        ll y=abs(x)/d;
        //cout<<y;
        if(k<=y){
            if(x>0)
                cout<<abs(x-k*d);
            else
                cout<<abs(x+k*d);
        }
        else if((k-y)%2){
            if(x>0)
                cout<<abs(x-y*d-d);
            else
                cout<<abs(x+y*d+d);
        }
        else{
            if(x>0)
                cout<<abs(x-y*d);
            else
                cout<<abs(x+y*d);
        }
    }
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n, k; cin >> n >> k;
	string s; cin >> s;
	
	int sum = 0;
	int r = 0;
	int ans = 0;
	
	bitset<100001> bs;
	bitset<100001> bs_end;
	bool flag = false;
	for( int i = 0; i < n; ++i ){
		if( s[i] == '0' && !flag ){
			flag = true;
			bs[i] = 1;
		}
		if( s[i] == '1' && flag ){
			flag = false;
			bs_end[i] = 1;
		}
	}
	
	for( int l = 0; l < n; ++l ){
		if( bs_end[l] ){
			--sum;
		}
		while( r < n && sum + bs[r] <= k ){
			// cout << "cur:" << l << ", " << r << endl; 
			sum += bs[r];
			++r;
		}
		ans = max(ans, r-l);
		if( l == r ){
			++r;
		}
	}
	
	cout << ans << endl;
	return 0;
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if ( A + B + C == 17 ){
    if ( A + B == 10 || A + C == 10 || B + C == 10 ){
      cout << "YES" << endl;
    }
  }
        else{
          cout << "NO" << endl;
        }
       
}
          


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

using namespace std;
typedef long long ll;

ll manhattan(const pair<ll, ll>& p1, const pair<ll, ll>& p2){
    return abs(p1.first - p2.first) + abs(p1.second - p2.second);
}

int main(){
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> s(n), c(m);
    for(int i = 0; i < n; ++i){
        cin >> s.at(i).first >> s.at(i).second;
    }
    for(int i = 0; i < m; ++i){
        cin >> c.at(i).first >> c.at(i).second;
    }
    for(auto p : s){
        ll ans = 0;
        ll maxdist = numeric_limits<ll>::max();
        for(int i = 0; i < m; ++i){
            if(maxdist > manhattan(p, c.at(i))){
                maxdist = manhattan(p, c.at(i));
                ans = i;
            }
        }
        cout << ans + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 384
import sys
from collections import deque

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    n = ni()
    p = nl()
    diag = [-1, 1, n, -n]
    st = [1]*(n+2)**2
    gr = [0]*(n+2)**2
    ans = 0
    for i in range(n):
        for j in range(n):
            gr[i*n + j + n + 1] = min(min(i, j), n-1-max(i, j))
    for v in p:
        v += n
        ans += gr[v]
        st[v] = 0
        c = gr[v]
        for dv in diag:
            nv = v + dv
            c = min(c, gr[nv] + st[nv])
        gr[v]= c
        q = deque()
        q.append(v)
        while q:
            v = q.popleft()
            for dv in diag:
                nv = v + dv
                if gr[nv] > gr[v] + st[v]:
                    gr[nv] = gr[v] + st[v]
                    if st[v]:
                        q.append(nv)
                    else:
                        q.appendleft(nv)
    print(ans)
    return

if __name__ == '__main__':
    solve()


Measured memory_bytes: 170868
#include<stdio.h>
#include<iostream>

using namespace std;

#define BUF_SIZE 1024

class Stack{
public:
	Stack(int stack_size):
		m_index(0){
		m_array = new int[stack_size];
	};
	~Stack(){
		delete[] m_array;
	};
	void push(int var){
		m_array[m_index++] = var;
	};
	int pop(){
		return m_array[--m_index];
	};

	bool isEmpty(){
		return m_index == 0;
	};

private:
	int* m_array;
	int m_index;
};

int main(){
	char buf[BUF_SIZE];

	for(int i = 0; i < BUF_SIZE; i++){
		buf[i] = 'e';
	}
	fgets(buf,BUF_SIZE,stdin);

	Stack stack(BUF_SIZE);

	bool numFLG = false;
	int S = 0,op1=0,op2=0;

	for(int i = 0;buf[i] != 'e'; i++){
		if(buf[i] >= '0' && buf[i] <= '9'){
			numFLG = true;
			S = 10*S + (buf[i] - '0');
		}else{
			if(numFLG){
				stack.push(S);
				S = 0;
				numFLG = false;
			}

			if(buf[i] == '+'){
				op2 = stack.pop();
				op1 = stack.pop();
				stack.push(op1+op2);
			}else if(buf[i] == '-'){
				op2 = stack.pop();
				op1 = stack.pop();
				stack.push(op1-op2);
			}else if(buf[i] == '*'){
				op2 = stack.pop();
				op1 = stack.pop();
				stack.push(op1*op2);
			}
		}
	}

	op1 = stack.pop();
	printf("%d\n",op1);
}


Measured memory_bytes: 3220
import sys 
from collections import defaultdict
input = lambda:sys.stdin.readline().strip()
n = int(input())
a = list(map(int,input().split()))
a_s = sum(a)
freq = defaultdict(int)
for i in a:
    freq[i]+=1
q = int(input())
while q:
    q-=1
    bi,ci = map(int,input().split())
    new_a_s = a_s+freq[bi]*(ci-bi)
    print(new_a_s)
    freq[ci]+=freq[bi]
    freq[bi]=0
    a_s = new_a_s

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

int main()
{
  int n,a[100],c=1;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  for(int i=0;i<n-1;i++){
    if(a[i]!=a[i+1])
        c++;
  }
  cout<<c;
    return 0;

}


Measured memory_bytes: 3592
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    Edge = [[] for _ in range(N)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        Edge[a-1].append(b-1)
        Edge[b-1].append(a-1)
    count = [0] * N
    for _ in range(Q):
        p, x = map(int, input().split())
        count[p-1] += x
    q = deque()
    for nextN in Edge[0]: q.append((nextN, 0))
    while q:
        nowN, parN = q.popleft()
        count[nowN] += count[parN]
        for nextN in Edge[nowN]:
            if nextN != parN: q.append((nextN, nowN))
    print(" ".join(map(str, count)))
    
    
    return 0

if __name__ == "__main__":
    solve()

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

int main(){
  int h,w;
  cin >> h >> w;
  vector<string> a(h);
  for (int i=0; i< h;i++) cin >> a[i];

  vector<bool> column(h,false);
  vector<bool> row(w,false);

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(a[i][j]=='#'){
        column[i]=true;
        row[j]=true;
      }
    }
  }
  for (int i=0;i<h;i++){
    if(column[i]){
      for (int j=0;j<w;j++){
        if(row[j]) cout << a[i][j];
      }
    }
    cout << endl;
  }
}

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

using namespace std;

typedef long long LL;
typedef pair<int,int> pi;
typedef vector<int> vi;
#define ST first
#define ND second
#define PB push_back
#define DET(a,b,c) (LL(b.x-a.x)*LL((c.y-a.y))-LL((c.x-a.x))*LL((b.y-a.y)))

const int MAXN = 1000+10;
const int MOD = 1000*1000*1000+7;
int n,m;
int dp[MAXN][MAXN];
char a[MAXN][MAXN];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m;
    for(int i=1; i<=n;i++) for(int j=1; j<=m;j++) cin>>a[i][j];
    dp[1][1]=1;
    for(int i=1; i<=n;i++) {
        for(int j=1; j<=m;j++) {
            if(i==1&&j==1) continue;
            if(a[i][j]=='#') dp[i][j] = 0;
            else {
                dp[i][j] = (dp[i-1][j]+dp[i][j-1])%MOD;
            }
        }
    }
    cout<<dp[n][m];
}


Measured memory_bytes: 5248
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;


int main(void)
{
    vector<int> a(3);
    int max,mid,min;
    cin >> a[0] >> a[1] >> a[2];

    int ans = 0;
    sort(a.begin(), a.end());
    max = a[2];
    min = a[0];
    mid = (a[0] + a[1] + a[2]) - (max + min);
    
    for (;mid != max;)
    {
        mid++;
        min++;
        ans++;
    }

    for (;mid - min > 1;)
    {
        min += 2;
        ans++;
    }

    if (min != mid)
    {
        ans+=2;
    }
    cout << ans << endl;

    
    
    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var input = Console.ReadLine().Split();
        var A = new int[N];
        for (int i = 0; i < N; i++)
        {
            A[i] = int.Parse(input[i]);
        }

        var denominator = 0.0;
        foreach (var item in A)
        {
            denominator += 1.0 / item;
        }

        Console.WriteLine(1.0 / denominator);
    }
}


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


int main() {
    int N, K;
    cin >> N >> K;
    int h = 0;
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        cin >> h;
        if (h >= K) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
lst=[0]*n
ac=0
wa=0
for i in range(m):
    num,result=input().split()
    num=int(num)-1
    if result=="AC":
        if lst[num]!=-1:
            wa+=lst[num]
            lst[num]=-1
            ac+=1
    else:
        if lst[num]!=-1:
            lst[num]+=1
print(ac,wa)

Measured memory_bytes: 76504
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=1e9+7;

const int N=101, W=2e5;
ll dp[W],n,p;

/*ll go(ll val, ll pos){
    if(dp[val][pos]!=-1)
        return dp[val][pos];

}*/

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();
    
    cin>>n>>p;
    vector<ll> w(n),v(n);
    for(ll i=0;i<n;i++)
        cin>>w[i]>>v[i];
    //memset(dp,0,sizeof(dp));
    //cout<<go(0,0);
    ll mx=1e5,na=1e10;
    for(ll i=0;i<=mx;i++) dp[i]=na;
    dp[0]=0;
    for(ll i=0;i<n;i++){
        for(ll j=mx-1;j>=0;j--){    
            if(dp[j]!=na){
                dp[j+v[i]]=min(dp[j+v[i]],w[i]+dp[j]);
                //cout<<j+v[i]<<" "<<dp[j+v[i]]<<"\n";
            }
        }
    }
    for(ll i=mx;i>=0;i--){
        if(dp[i]<=p){
            cout<<i;
            return 0;
        }
    }



    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int n; cin >> n;
    vector<bitset<64> > M;
    rep(i,n){
        bitset<64> m(0);
        int k; cin >> k;
        rep(j,k){
            int b; cin >> b;
            m.set(b);
        }
        M.push_back(m);
    }
    bitset<64> A(0);
    int q; cin >> q;
    rep(_,q){
        int query; cin >> query;
        if(query == 0){
            int i; cin >> i;
            if(A.test(i)) cout << 1 << endl;
            else cout << 0 << endl;
        }else if(query == 1){
            int mn; cin >> mn;
            A |= M[mn];
        }else if(query == 2){
            int mn; cin >> mn;
            A = (A & M[mn]) ^ A;
        }else if(query == 3){
            int mn; cin >> mn;
            A ^= M[mn];
        }else if(query == 4){
            int mn; cin >> mn;
            if((A & M[mn]) == M[mn]) cout << 1 << endl;
            else cout << 0 << endl;
        }else if(query == 5){
            int mn; cin >> mn;
            if(!((A & M[mn]) == 0)) cout << 1 << endl;
            else cout << 0 << endl;
        }else if(query == 6){
            int mn; cin >> mn;
            if((A & M[mn]) == 0) cout << 1 << endl;
            else cout << 0 << endl;
        }else if(query == 7){
            int mn; cin >> mn;
            cout << (A & M[mn]).count() << endl;
        }else if(query == 8){
            int mn; cin >> mn;
            cout << ((A & M[mn]).to_ullong()) << endl;
        }
    }
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

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

const int MAXN = 5005;
const int MAXM = 205;

int n, m, b[MAXM][MAXN];
LL ans, a[MAXN], s[MAXN][MAXN];

inline void Add(int l, int r, int L, int R, int v)
{
	s[l][L] += v, s[r + 1][R + 1] += v, s[l][R + 1] -= v, s[r + 1][L] -= v;
}

inline void Solve(int *b)
{
	static int tp, st[MAXN], l[MAXN], r[MAXN];
	for (int i = 1; i <= n; st[++ tp] = i ++)
		while (tp && b[st[tp]] < b[i])
			r[st[tp --]] = i - 1;
	while (tp)
		r[st[tp --]] = n;
	for (int i = n; i; st[++ tp] = i --)
		while (tp && b[st[tp]] <= b[i])
			l[st[tp --]] = i + 1;
	while (tp)
		l[st[tp --]] = 1;
	for (int i = 1; i <= n; i ++)
		Add(l[i], i, i, r[i], b[i]);
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), m = Read();
	for (int i = 2; i <= n; i ++)
		a[i] = Read() + a[i - 1];
	for (int i = 1; i <= n; i ++)
		for (int j = 1; j <= m; j ++)
			b[j][i] = Read();
	for (int i = 1; i <= m; i ++)
		Solve(b[i]);
	for (int i = 1; i <= n; i ++)
		for (int j = 1; j <= n; j ++)
		{
			s[i][j] += s[i][j - 1] + s[i - 1][j] - s[i - 1][j - 1];
			if (i <= j)
				ans = max(ans, s[i][j] - a[j] + a[i]);
		}
	return printf("%lld\n", ans), 0;
}


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

#include <cstring>
    #define mp make_pair
    #define pb push_back
    #define p push

    #define FOR(a,c) for(int a = 0;a<c;a++)
    #define ll long long int

    #define getI(a) scanf("%d",&a)
    #define getII(a,b) scanf("%d%d",&a,&b)
    #define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
    #define getL(a) scanf("%lld",&a)
    #define getLL(a,b) scanf("%lld%lld",&a,&b)
    #define BEND(c) (c).begin(),(c).end()
    #define BEND2(c) (c).begin(),(c).end(),greater<int>()
    #define fi first
    #define se second
    #define pi 3.1415926535897932384626
    #define getS(a) scanf("%s",a)
    #define pfi(a) printf("%d",a);
    #define pfii(a,b) printf("%d%d",a,b);
    #define pfl(a) printf("%lld",a);
    #define pfll(a,b) printf("%lld%lld",a,b);
    #define pfd(a) printf("%lf",a);


    #define sag (sol|1)
    #define sol (root<<1)
    #define ort (bas+son)/2
    #define SIZE 1000000007
    using namespace std;

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


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

        for (int i = 0; i <s.size() ; ++i) {
             int k = s[i];
             k +=n;
             while (k > 90){
                 k-=26;
             }
             s[i]=k;
        }
        cout<<s;


        return 0;
    }






    /*
    int main(){
        double a ,b;
        cin>>a>>b;
        ll res =0;
        while(1){
            if(a > b){
                cout<<"t1\n";

                ll k = a /b;
                a -= (b*k);
                res+=k;
            }
            if(a < b){
                cout<<b;
                ll k = b/a;
                b -= (a*k);
                res+=k;
            }
            if(a ==b){
                res++;
                break;
            }
        }



        cout<<res;
        return 0;
    }
    */

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200500;
typedef long long ll;
ll a[maxn];
int main()
{
    int n,t;
    cin>>n>>t;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int start=a[0];
    ll ans=0;
    ll now=a[0];
   /* for(int i=1;i<n;i++)
    {
        now+=a[i];
        cout << now <<endl;
        if(start+t<=now)
        {
            ans+=t;
            start=now;
        }
        else if(start+t>now)
        {
            ans+=now-start;
            cout << now-start <<endl;
            start=now;
        }
        cout << ans <<endl;
    }*/
    for(int i=1;i<n;i++)
    {
        if(a[i-1]+t<=a[i])
            ans+=t;
        else
            ans+=a[i]-a[i-1];
    }
    ans+=t;
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int inf = 1<<30;

int main() {
  int N; cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  int MaxN = A[0], MinN = A[0], cnt = 1;
  for(int i = 1; i < N; ++i) {
    if(A[i] == MaxN && A[i] == MinN) {
      continue;
    } else if(A[i] >= MaxN) {
      MaxN = A[i];
      MinN = -inf;
    } else if(A[i] <= MinN) {
      MinN = A[i];
      MaxN = inf;
    } else {
      cnt++;
      MaxN = MinN = A[i];
    }
  }
  cout << cnt << endl;
  return 0;
}


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

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		int x,y,n,j;
		x = scan.nextInt();
		n = scan.nextInt();
		
		int[] ary = new int[n];
		
		for(int i=0;i<n;i++) {
			ary[i] = scan.nextInt();
		}
		
		Arrays.sort(ary);
		j = 0;
		
		while(true) {
			if(Arrays.binarySearch(ary, x-j) < 0) {
				y = x-j;
				break;
			}else if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			}
		}
		System.out.println(y);
	}

}


Measured memory_bytes: 35936
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int ans;
        if(k%2==0) {
            ans = (k/2)*(k/2);
        } else {
            ans = (k/2)*(k/2 + 1);
        }
        System.out.println(ans);

        sc.close();
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <map>
#include <utility>
#include <set>
#include <climits>

using namespace std;

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


char s[20];

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

    if (a >= 3200) {
        printf("%s\n", s);
    } else {
        printf("red\n");
    }
    return 0;
}



Measured memory_bytes: 384
import java.io.*;
import java.util.Arrays;

/**
 * Created by Ayushi on 18/08/2019.
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        double[] a = new double[n];
        temp = r.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            a[i] = Double.parseDouble(temp[i]);
        }
        r.close();

        Arrays.sort(a);

        double ans = a[0];
        for (int j = 1; j < n; j++) {
            ans += a[j];
            ans = ans/2;
        }

        System.out.println(ans);
    }
}


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

string s;
char t[1000001];
int ans;

int main(){
	scanf("%s", t);
	s = t;

	for(int i=0; i<s.size(); i++){
		int J, O, I;
		if(s[i] == 'J'){
			J = 0;
			while(s[i] == 'J'){
				i++;
				J++;
			}
			if(s[i] == 'O'){
				O = 0;
				while(s[i] == 'O'){
					i++;
					O++;
				}
				if(s[i] == 'I'){
					I = 0;
					while(s[i] == 'I'){
						i++;
						I++;
					}
					if(O <= J && O <= I) ans = max(ans, O);
				}
			}
		i--;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 4360
#include <cstdio>
#include <cmath>
#include <vector>

int main(int argc, char const *argv[]) {
    char s[17];
    scanf("%s", s);
    int l = 0;
    while (s[l] != 0) l++;
    int n[l];
    int max = 0;
    for (int i = 0; s[i] != 0; i++) {
        n[i] = s[i] - '0';
        max += n[i];
        // printf("%d\n", n[i]);
    }
    std::vector<int> v;
    for (int i = 0; i < l - 1; i++) {
        if (i == 0 || (i != 0 && n[i] > 0)) {
            int r = 0;
            for (int j = 0; j < l; j++) {
                if (j < i) {
                    r += n[j];
                } else if (j == i) {
                    r += (n[j] - 1);
                } else if (j > i) {
                    r += 9;
                }
            }
            // printf("%d\n", r);
            if (max < r) {
                max = r;
            }
        }
    }
    printf("%d\n", max);
    return 0;
}


Measured memory_bytes: 128
n,m=map(int,input().split())
a=list(map(int,input().split()))
total=sum(a)
if m<a[0]:
    a[0]=m
for i in range(1,n):
    if m<a[i]+a[i-1]:
        a[i]=m-a[i-1]
tot=sum(a)
print(total-tot)

Measured memory_bytes: 14252
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
 
using namespace std;
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define ll long long

int main()
{
    int a, b, n;
    char c;
    cin >> a >> c >> b;
    if(c == '+')
    {
        cout << a + b;
    } else 
    {
        cout << a -b;
    }



}

Measured memory_bytes: 256
const input = require("fs")
  .readFileSync("/dev/stdin", "utf8")
  .split(/\s/)
  .map(Number);

var ret = 0;
for (var i = 1; i <= input[0]; i++) {
  var s = i.toString().split("");
  var sum = s.map(Number).reduce(function (a, b) {
    return a + b;
  });

  if (input[1] <= sum && sum <= input[2]) ret += i;
}
console.log(ret);

Measured memory_bytes: 10344
main = do
  s <- getLine 
  putStrLn $ solve s

solve :: String -> String 
solve s = if bool1 s && bool2 s && bool3 s then "AC" else "WA"

isLower :: Char -> Bool 
isLower c = if 'a' <= c && c <= 'z' then True else False

bool1 :: String -> Bool
bool1 (x:xs) = and $ map isLower target
  where target = filter (\c -> c /= 'C') xs

bool2 :: String -> Bool
bool2 ('A':rest) = True
bool2 _ = False

bool3 :: String -> Bool
bool3 s = if (length $ filter (\c -> c == 'C') substr) == 1 then True else False
  where substr = init.tail.tail $ s


Measured memory_bytes: 380
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map> 
using namespace std; 
int main(){
long long x,a,b,c,ans=0;
    cin>>a>>b>>c>>x;
    for(int i=0;i<=a;i++)
        for(int j=0;j<=b;j++)
            for(int z=0;z<=c;z++){
                int k=i*500+j*100+z*50;
                if(k==x){
                	ans++;
				}
                   
                if(k>x){
                   break;
               }
            }
    cout<<ans<<endl;
    return 0;	
}


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

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i=0; i<n ; i++){
    cin >> v[i];
  }
  vector <int> dp(n, INT_MAX);
  dp[0] = 0;
  for(int i=0; i<n; i++){
    for(int j = i+1; j <= i+2 ; j++ ){
        if(j < n){
            dp[j] = std::min(dp[j], dp[i]+abs(v[i]-v[j]));

        }
    }
  }
  cout << dp[n-1];
}


Measured memory_bytes: 4036
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	long long n, i, j, k, s, ans = 0, x;
	cin >> n;
	map<long long, long long> ct;
	ct[0] = 1;
	s = 0;
	for (i = 1; i <= n;i++) {
		cin >> x;
		s += x;
		ans += ct[s];
		ct[s]++;
	}
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 12800
# AtCoder 星には四種類の塩基 A, C, G, T が存在し、A と T、C と G がそれぞれ対になります。
# 文字bが入力されます。これは A, C, G, T のいずれかです。
# 塩基bと対になる塩基を表す文字を出力するプログラムを書いてください。

b = input()

if b =='A' :
   print('T')
elif  b =='C' :
   print('G')
elif b =='G' :
   print('C')
elif b =='T' :
   print('A')

Measured memory_bytes: 8972
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n){
    cin >> a[i];
  }
  int cnt = 0;
  for(int i = 1;i<n-1;i++){
    if(a[i] > a[i-1] && a[i+1] > a[i])cnt++;
    else if(a[i] < a[i-1] && a[i+1] < a[i])cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3556
//
//  main.cpp
//  SPG-B
//

#include <iostream>
#include<vector> // 配列を使う
using namespace std;
int main(int argc, const char * argv[]) {
    int N;
    long K;
    long mod=1000000000+7;
    cin >> N>>K;
    vector<int> A(N);
    for (int i=0; i<N; i++) {
        cin >> A.at(i);
    }
    long ans0=0;
    for (int j=0; j<N; j++) {
        for (int k=j+1; k<N; k++) {
            if (A.at(j)>A.at(k)) {
                ans0++;
            }
        }
    }
    long ans1=0;
    for (int m=0; m<N; m++) {
        for (int p=0; p<N; p++) {
            if (A.at(m)>A.at(p)) {
                ans1++;
            }
        }
    }
    ans0 *= K%mod;
    ans1 = (K*(K-1)/2)%mod*ans1%mod;
    long ans=ans0+ans1;
    cout << ans%mod << endl;
    return 0;
}


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

using namespace std;

int main()
{
  int n, m;
  while(cin >> n >> m, n || m){
    int p[1001];
    for(int i = 0; i < n; i++) cin >> p[i];
    sort(p, p + n, greater<int>());
    int ans = 0;
    for(int i = 0; i < n; i++){
      if((i+1)%m == 0) continue;
      ans += p[i];
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    char x, y;
    cin >> x >> y;
    if (x < y)
        cout << "<";
    else if (x == y)
        cout << "=";
    else
        cout << ">";
    cout << endl;

}


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

int main()
{
    int n;
    cin >> n;
    int sai[n][2];
    int a,b;

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

    bool flag = false;

    for (int i = 0; i < n - 2; i++) {
        if (sai[i][0] == sai[i][1] && sai[i+1][0] == sai[i+1][1] && sai[i+2][0] == sai[i+2][1]) {
            flag = true;
            break;
        }
    }

    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
        
    
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef tuple<ll,ll,ll,ll> tp;
typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int h[]={0,2,0,1,0,1,0,0,1,0,1,0};
	int n,m;
	cin>>n>>m;
	if(h[n-1]==h[m-1])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}










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

int main() {
  int N, T, c[1000], t[1000];
  
  cin >> N >> T;
  int min = 1001;
  
  for(int i = 0; i < N; i++) {
    cin >> c[i] >> t[i];
    if(t[i] <= T)
      if(c[i] < min)
	min = c[i];
  }
  if(min == 1001)
    cout << "TLE" << endl;
  else 
    cout << min << endl;
}


Measured memory_bytes: 256
// atcoder dp contest Knapsack 1
// standard dp knapsack
#include <bits/stdc++.h>
 
# define C continue;
# define R return
 
# define D double
# define I insert
# define ll long long
# define ld long double
 
# define ull unsigned long long
# define ui unsigned int
 
# define pb push_back
# define pf push_front
 
# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue
 
# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >
 
# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp
 
# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >
# define pipii pair<int, pii >
# define pcpii pair<char,pii>
 
# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >
 
# define vvpii vector < vector < pii > >
# define vpipii vector< pipii >
 
# define F first
# define S second
# define mp make_pair
 
# define unm unordered_map
# define unmii unm< int , int >
# define unmll unm< ll , ll >
# define unms unm<string,int>
# define unmci unm<char,int>
 
# define sortvia sort(a.begin(),a.end());
# define sortvib sort(b.begin(),b.end());
# define revsorta sort(a.begin(), a.end(), greater <int>());
# define revsortb sort(b.begin(), b.end(), greater <>());
# define loop(q,n) for(int i=q;i<n;i++)
# define test int t;cin >> t;while(t--)
# define nextline "\n"
# define tab "\t"
# define space " "
//vector<vector<int> > vec( n , vector<int> (m, 0));
//YES
//NO
//cout
//true
//false
//yes
//no
 
const ll mod9=1e9+7;
const ll maxsize=2e9+1;
// const ll mod =998244353;
const ll mod2=1073741824;
const ll INF=1e18L+5;
const int two_pow_fiv=200008;
const int IINF=1e8+5;
using namespace std;

void max_self(ll& a,ll b){
    a=max(a,b);
}


int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    int n,w;
    cin>>n>>w;
    vector <ll> dp(w+1,0);
    // dp[i] denotes the max_value that can be acquired for wieght i
    ll wt,value;
    loop(0,n){
        cin>>wt>>value;
        // this wieght and value can be used to update value of max wieght of W-wt
        for(int wt_already=w-wt;wt_already>=0;wt_already--){
            max_self(dp[wt_already+wt],dp[wt_already]+value);
        }
    }
    ll ans=0;
    loop(0,w+1){
        max_self(ans,dp[i]);
    }
    cout<<ans<<nextline;
return 0;
}

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

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> height(N);
    rep(i,N){
        cin >> height[i];
    }
    sort(all(height));
    int min_height = height[K - 1] - height[0];
    rep(i,N - K + 1){
        min_height = min(min_height, height[K + i - 1] - height[i]);
    }
    cout << min_height << endl;
}


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

#define PI 3.14159265358979323846264338327950L 

int main() {
	int a, b, h, m;
	scanf("%d%d%d%d", &a, &b, &h, &m);

	long double rad = PI * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long
double)m / 60.0);
    
    long double rsq = (long double)(a * a + b * b) - (long double)(2 * a * b) * cosl(rad);
  
	printf("%20.20Lf\n", sqrtl(rsq));
}

Measured memory_bytes: 2580
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reve(a) reverse(a.begin(), a.end())
#define PI 3.14159265359
typedef long long ll;
const ll MOD = 1e9+7;

ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}
/*ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}*/

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

//素数判定 O(√n)
bool is_prime(int64_t n){
  for(int64_t i = 2; i*i<=n; i++){
    if(n%i==0) return false;
  }
  return n!=1;
}

//約数の列挙 O(√n)
vector<int64_t> dividor(int64_t n){
  vector<int64_t> res;
  for(int64_t i=1; i*i<=n; i++){
    if(n%i==0){
      res.push_back(i);
      if(i != n/i) res.push_back(i);
    }
  }
  return res;
}

//素因数分解 O(√n)
map<int64_t, int64_t> prime_factor(int64_t n){
  map<int64_t, int64_t> res;
  for(int64_t i=2; i*i<=n; i++){
    while(n%i==0){
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n] = 1;
  return res;
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){ 
  int64_t a,b,c,d;
  cin >> a >> b >> c >> d;
  int64_t ac = a*c;
  int64_t ad = a*d; 
  int64_t bd = b*d;
  int64_t bc = b*c; 
  int64_t m = ac;
  m = max(m, bc);
  m = max(m, bd);
  m = max(m, ad);
  cout << m << endl;

}




Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  string s;
  cin >> s;
  vector<string> days = {"SUN","MON","TUE","WED","THU","FRI","SAT"};

  rep(i,7){
  if(s == days.at(i)) cout << 7 -i << endl;

}  
  }



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i,N) {
        cin >> A[i];
    }
    sort(A.begin(),A.end(),greater<ll>());
    ll ans = 0;
    for(int i = K; i < N; i++) {
        ans += A[i];
    }
    cout << ans << endl;    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, sum = 0, s1 = 0, s2 = 0;
	cin>>n;
	int wt[n];
	int mini = INT_MAX;
	for(int i = 0; i<n; i++)
	cin>>wt[i], sum += wt[i];
	for(int i = 0; i<n; i++){
		s1 += wt[i], s2 = sum-s1;
		mini = min(mini, abs(s1-s2));
	}
	cout<<mini;
	return 0;
}

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

using namespace std;

int main()
{
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans;
    if (a + b < c * 2) {
        ans = a * x + b * y;
    } else {
        int tmp1, tmp2;
        if (x < y) {
            tmp1 = x * 2 * c + (y - x) * b;
            tmp2 = y * 2 * c;
        } else {
            tmp1 = y * 2 * c + (x - y) * a;
            tmp2 = x * 2 * c;
        }
        ans = min(tmp1, tmp2);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
using namespace std;
#define N 16400
#define M 204
#define mod 998244353
int dp[M][N],n,m,fr[N],ifr[N],rev[N],a[N],b[N],ntt[N];
int pw(int a,int p){int as=1;while(p){if(p&1)as=1ll*as*a%mod;a=1ll*a*a%mod;p>>=1;}return as;}
int c(int a,int b){if(a<b)return 0;return 1ll*fr[a]*ifr[b]%mod*ifr[a-b]%mod;}
void dft(int s,int *a,int t)
{
	for(int i=0;i<s;i++)rev[i]=(rev[i>>1]>>1)|(i&1?s>>1:0),ntt[rev[i]]=a[i];
	for(int i=2;i<=s;i<<=1)
	{
		int st=pw(3,(mod-1)/i);
		if(t==-1)st=pw(st,mod-2);
		for(int j=0;j<s;j+=i)
		for(int k=j,t=1;k<j+(i>>1);k++,t=1ll*t*st%mod)
		{
			int v1=ntt[k],v2=1ll*ntt[k+(i>>1)]*t%mod;
			ntt[k]=(v1+v2)%mod;ntt[k+(i>>1)]=(v1-v2+mod)%mod;
		}
	}
	int inv=t==-1?pw(s,mod-2):1;
	for(int i=0;i<s;i++)a[i]=1ll*ntt[i]*inv%mod;
}
int main()
{
	scanf("%d%d",&n,&m);
	dp[0][0]=1;
	fr[0]=ifr[0]=1;for(int i=1;i<=8020;i++)fr[i]=1ll*fr[i-1]*i%mod,ifr[i]=pw(fr[i],mod-2);
	for(int i=1;i<=m;i++)
	{
		int l=1;while(l<=n*2)l<<=1;for(int j=0;j<l;j++)a[j]=b[j]=0;
		for(int j=0;j<=n;j++)a[j]=1ll*dp[i-1][j]*ifr[j]%mod;
		for(int j=1;j<=n;j++)b[j]=ifr[j+2];
		dft(l,a,1);dft(l,b,1);for(int j=0;j<l;j++)a[j]=1ll*a[j]*b[j]%mod;dft(l,a,-1);
		for(int j=0;j<=n;j++)dp[i][j]=(1ll*a[j]*fr[j+2]+1ll*(1ll*j*(j-1)%mod*499122177%mod+j+1)%mod*dp[i-1][j])%mod;
	}
	int as=0;
	for(int j=0;j<=n;j++)as=(as+1ll*dp[m][j]*c(n,j))%mod;
	printf("%d\n",as);
}//

Measured memory_bytes: 12160
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
#include <stack>
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
typedef pair<ll,ll> P;

ll N;
ll a[1010];
ll ans=1;
int main(){
  cin >> N;
  for(int i=2;i<=N;i++){
    ll t = i;
    for(int j=2;j<=N;j++){
      if(i<j) break;
      while(t%j == 0){
        a[j]++;
        t/=j;
      }
    }
  }
  for(int i=2;i<=N;i++){
    ans = (ans*(a[i]+1)) % MOD;
  }
  cout << ans << endl;
}



Measured memory_bytes: 892
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
int n;
int w[111];
int s[111];
int main()
{
	int ans=1000000000;
	cin>>n;
	REP(i,n)cin>>w[i],s[i]=s[i-1]+w[i];
	REP(i,n){
		ans=min(ans,abs(s[i]-(s[n-1]-s[i])));
	}
	cout<<ans<<endl;	
	return 0;
}



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

int main()
{
	int n, z, w; cin>>n>>z>>w;
	vector<int> a(n);
	for(auto& e: a) cin>>e;
	cout<<max(abs(w-a[n-1]), (n>1)*abs(a[n-1]-a[n-2]))<<endl;
}

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

#define all(x) (x).begin(), (x).end()
#define itn int
#define make_unique(x) sort((x).begin(), (x).end()); (x).erase(unique((x).begin(), (x).end()), (x).end())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

void remin(int& x, int y) {
	x = min(x, y);
}

void remax(int& x, int y) {
	x = max(x, y);
}

bool is_small(int x) {
	return x < 1e7;
}

struct State {
	int len;
	int minx, maxx;

	bool operator <(const State& ot) const {
		if (len != ot.len) {
			return len < ot.len;
		} else {
			return minx < ot.minx;
		}
	}
};

bool isCovered(const State& st, int x, int y) {
	if (x + y == st.len) {
		return x % 2 == st.minx % 2 && x >= st.minx && x <= st.maxx;
	} else {
		return x + y > st.len && x >= st.minx && y >= st.len - st.maxx;
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	string s;
	cin >> s;

	vector<State> a = {{0, 0, 0}};
	for (char c : s) {
		vector<State> tmp;
		if (c != '1') {
			for (auto st : a) {
				if (st.minx > 0) {
					tmp.push_back({st.len, st.minx - 1, st.maxx - 1});
				} else {
					if (st.minx != st.maxx) {
						tmp.push_back({st.len, st.minx + 1, st.maxx - 1});
					}
					tmp.push_back({st.len + 1, 0, 0});
				}
			}
		}
		if (c != '0') {
			for (auto st : a) {
				if (st.maxx < st.len) {
					tmp.push_back({st.len, st.minx + 1, st.maxx + 1});
				} else {
					if (st.minx != st.maxx) {
						tmp.push_back({st.len, st.minx + 1, st.maxx - 1});
					}
					tmp.push_back({st.len + 1, st.len + 1, st.len + 1});
				}
			}
		}
		sort(all(tmp));
		a.clear();
		for (auto s : tmp) {
			for (const auto& t : a) {
				if (isCovered(t, s.minx, s.len - s.minx) && isCovered(t, s.maxx, s.len - s.maxx)) {
					s.minx = s.maxx + 2;
					break;
				}
				if (isCovered(t, s.minx, s.len - s.minx)) {
					int l = 0, r = (s.maxx - s.minx) / 2;
					while (r > l + 1) {
						int m = (l + r) / 2;
						int x = s.minx + 2 * m;
						int y = s.len - x;
						if (isCovered(t, x, y)) {
							l = m;
						} else {
							r = m;
						}
					}
					s.minx += 2 * r;
				} else if (isCovered(t, s.maxx, s.len - s.maxx)) {
					int l = 0, r = (s.maxx - s.minx) / 2;
					while (r > l + 1) {
						int m = (l + r) / 2;
						int x = s.maxx - 2 * m;
						int y = s.len - x;
						if (isCovered(t, x, y)) {
							l = m;
						} else {
							r = m;
						}
					}
					s.maxx -= 2 * r;
				}
			}
			if (s.minx <= s.maxx) {
				if (!a.empty() && a.back().len == s.len && a.back().maxx + 2 == s.minx) {
					a.back().maxx = s.maxx;
				} else if ((int)a.size() > 1 && a[(int)a.size() - 2].len == s.len && a[(int)a.size() - 2].maxx + 2 == s.minx) {
					a[(int)a.size() - 2].maxx = s.maxx;
				} else {
					a.push_back(s);
				}
			}
		}
		// cerr << c;
		// if (a.size() > 3) {
		// 	cerr << "\n";
		// 	return 0;
		// }
		// for (auto s : a) {
		// 	cerr << "(" << s.len << ", " << s.minx << " " << s.maxx << ") ";
		// }
		// cerr << "\n";
		// if (a.size() > 3) {
		// 	return 0;
		// }
	}
	int ans = 1e8;
	for (auto s : a) {
		ans = min(ans, s.len);
	}
	cout << ans << "\n";

	return 0;
}


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

int main() {
  int K,A,B;
  cin>>K>>A>>B;
  
  for(int i=A; i<B+1; i++){
    if(i%K==0){
      cout<<"OK"<<endl;
      break;
    }
    else if(i==B){
      cout<<"NG"<<endl;
    }
  }
}

Measured memory_bytes: 3596
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long
#define lli long long int

using namespace std;
using P = pair<int,int>;


int main(){

  int A, B, K;
  cin >> A >> B >> K;
  int ans = 0;

  int mx = max(A,B);

  int cnt = K;
  for (int i = mx; i >= 1; i--) {
    if(A%i == 0 && B%i == 0){
      cnt--;
      if(cnt == 0){
        ans = i;
        break;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3596
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int n,ans  = 1;
	int a[105];
	scanf("%d",&n);
	for(int i = 1;i <= n;i++){
		scanf("%d",&a[i]);
		}
	sort(a + 1,a + n + 1);
	
	for(int i = 1;i < n;i++){
			if(a[i] != a[i + 1]) ans++;
		}
		printf("%d\n",ans);
	return 0;
	}

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

#define ll   long long int
#define rep(i,n)    for(int i=0;i<(int)n;i++)
#define show(s)     cout<<s<<endl

int main() {

    int N;
    cin >> N;

    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N);

    rep(i,N){
        int a;
        cin >> a;
        A[i] = a-1;
    }
    rep(i,N){
        cin >> B[i];
    }
    rep(i,N-1){
        cin >> C[i];
    }

    int sum = 0;
    rep(i,N){
        sum+=B[A[i]];
        if(i<(N-1) && (A[i]+1) == A[i+1]){
            sum+=C[A[i]];
        }
    }

    show(sum);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000000;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int g[6][2]={{1,2},{-1,3,},{1,-1},{4,5},{5,2},{2,1}};

int main() {
  string s;
  while(cin >> s && s!="#") {
    int now=0;
    rep(i,s.size()) {
      now=g[now][(int)s[i]-'0'];
      if(now==-1) break;
    } 
    if(now==5) pr("Yes");
    else pr("No");
  }
  return 0;
}


Measured memory_bytes: 1184