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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll HIGHINF = (ll)1e18;
const ll LOWINF = (ll)1e15;
const long double PI = 3.1415926535897932384626433;

template<typename T> vector<T> make_v(size_t N,T init){return vector<T>(N,init);}
template<typename... T> auto make_v(size_t N,T... t){return vector<decltype(make_v(t...))>(N,make_v(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	int N,K; cin >> N >> K;
	string S; cin >> S;
	S[K-1] = tolower(S[K-1]);
	cout << S << endl;
  
    return 0;
}


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

#define INF 1 << 30
#define MOD 1000000007
#define PI 3.14159265358979
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r) for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r) for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define D(x) cout << x << endl
#define d(x) cout << x
#define all(x) (x).begin(), (x).end()
#define pub(x) push_back(x)
#define pob() pop_back()
#define puf(x) push_front(x)
#define pof() pop_front()
#define mp(x, y) make_pair((x), (y))
#define fi first
#define se second
#define setp(x) setprecision(x)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }

static const int dx[] = {0, 0, 1, -1};
static const int dy[] = {-1, 1, 0, 0};

int main() { 
        int n;
        cin >> n;
        vi a(n);
        int sum = 0;
        rep(i, n) {
                cin >> a[i];
                sum += a[i];
        }
        int ave = sum / n;

        int ans = INF;
        int res;
        for (int j = -10; j <= 10; j++) {
                res = 0;
                rep(i, n) {
                        res += ((ave + j) - a[i]) * ((ave + j) - a[i]);
                }
                amin(ans, res);
        }
       
        D(ans);

        return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
 
long long int INF = 2e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define endl "\n"
#ifdef ENJAPMA
    #undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
 
const ll mod = 998244353ll;
// const ll mod = 1000000007ll;
  
ll mypow(ll number1,ll number2, ll mod){
    if(number2 == 0){
        return 1ll;
    }else{
        ll number3 = mypow(number1,number2 / 2, mod);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
bool multicase = false;

ll n,m,num,a,b,c,d,e,h,q;
ll x[105], y[105], z[105], w[105];
ll dp[15][15];

vector<ll> v;

ll dfs(ll idx){
    if(idx == n + 1){
        ll res = 0;
        for(ll i=0;i<q;i++){
            if(v[x[i] - 1] + z[i] == v[y[i] - 1])res += w[i];
        }
        return res;
    }
    ll mini = v.back();
    ll res = 0;
    for(ll i=mini;i<=m;i++){
        v.pb(i);
        res = max(res, dfs(idx+1));
        v.pop_back();
    }
    return res;
}


void solve(){
    cin >> n >> m >> q;
    for(ll i=0;i<q;i++){
        cin >> x[i] >> y[i] >> z[i] >> w[i];
    }

    v.pb(1);
    ll ans = dfs(2);
    p(ans);

}

int main(){
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if(multicase){
        cin >> q;
    }else{
        q = 1; 
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}
















Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;  //駐車時間
  int A;  //時間当たりの値段
  int B;  //固定金額(プラン２の値段)
  
  cin >> N >> A >> B;  //入力
  
  int S1 = N * A;  //プラン１の値段
  int S2 = B;  //プラン２の値段
  
  cout << min(S1, S2) << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 4005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int c1[maxn],c2[maxn],B[maxn][maxn],W[maxn][maxn],n,x[maxn];
int x1[maxn],x2[maxn],cnt1,cnt2,dp[maxn][maxn];
char s[maxn],q;

inline void a1(int x,int val){for(int i=x;i<=n;i+=i&-i) c1[i]+=val;}
inline void a2(int x,int val){for(int i=x;i<=n;i+=i&-i) c2[i]+=val;}
inline int q1(int x){int res=0; for(int i=x;i;i-=i&-i) res+=c1[i]; return res;}
inline int q2(int x){int res=0; for(int i=x;i;i-=i&-i) res+=c2[i]; return res;}

int main()
{
	n=read(); rep(i,1,2*n) cin>>s[i],x[i]=read();
	rep(i,1,2*n)
	{
		if(s[i]=='B')
		{
			a1(x[i],1);
			rep(j,0,n) B[x[i]][j]=i-q1(x[i])-q2(j);
		}
		else
		{
			a2(x[i],1);
			rep(j,0,n) W[j][x[i]]=i-q1(j)-q2(x[i]);
		}
	}
	rep(i,0,n) rep(j,0,n) dp[i][j]=inf; dp[0][0]=0;
	rep(i,0,n) rep(j,0,n)
	{
		if(i!=0) dp[i][j]=min(dp[i][j],dp[i-1][j]+B[i][j]);
		if(j!=0) dp[i][j]=min(dp[i][j],dp[i][j-1]+W[i][j]);
	}
	cout<<dp[n][n]<<endl;
	return 0;
}

Measured memory_bytes: 74560
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int k,a,b,flag;
  cin>>k>>a>>b;
  flag=0;
  while(a<=b){
    if(a%k==0){
      flag=1;
    }
    a++;
  }
  if(flag==1){
    cout<<"OK";
  }else{
    cout<<"NG";
  }
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define For(i,j,k) for(int i=j;i<=k;++i)
using namespace std;
int read(){
	int x=0,fh=1; char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') fh=-1;
	for (;isdigit(ch);ch=getchar()) x=x*10+(ch^48);
	return x*fh;
}
int main(){
	int n=read(),x,y;
	if (n==3) printf("2 5 63\n");
	else if (n==4) printf("2 5 20 63\n");
	else if (n==5) printf("2 4 6 3 9\n");
	else if (n==6) printf("2 4 6 3 9 12\n");
	else{
		For(i,2,min(n,15000)){
			x=i; y=n-i;
			if (y<=5000&&(x%3==0||x%3==2)&&y%2==0) break;
		}
		int z=0; For(i,1,x) z+=2,printf("%d ",z);
		z=-3; For(i,1,y) z+=6,printf("%d ",z);
	}
	return 0;
}

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


int main(){
  int N;
  cin>>N;
  vector<string> s(N);
  vector<int> t(N);
  for(int i=0;i<N;i++){
    cin>>s.at(i);
    cin>>t.at(i);
  }
  string X;
  cin>>X;
  int ans = 0;
  int flag = 0;
  for(int i=0;i<N;i++){
    if(flag==1){
    ans+=t.at(i);
    }
    if(X==s.at(i)){
      flag=1;
    }
  }

  cout<<ans<<endl;

}


Measured memory_bytes: 256
n,Y=map(int,input().split())

for i in range(n+1):
    for j in range(n-i+1):
        x=i
        y=j
        z=n-i-j
        if 10000*x + 5000*y + 1000*z == Y:
            print(x,y,z)
            exit()
print(-1,-1,-1)


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

using pii = pair<int, int>;

constexpr int dx[5] = {0, 0, 1, 0, -1};
constexpr int dy[5] = {0, 1, 0, -1, 0};

short d[256][256][256];

void init() {
    for(int i = 0; i < 256; ++i) {
        for(int j = 0; j < 256; ++j) {
            for(int k = 0; k < 256; ++k) {
                d[i][j][k] = 10000;
            }
        }
    }
}

bool move_check(int prev1, int to1, int prev2, int to2) {
    return to1 != to2 && (prev1 != to2 || prev2 != to1);
}

int main() {
    int w, h, n;
    while(cin >> w >> h >> n, n) {
        init();
        vector<string> c(h);
        vector<pii> cs1, cs2;
        cin.ignore(1000, '\n');
        for(int i = 0; i < h; ++i) {
            getline(cin, c[i]);
            for(int j = 0; j < w; ++j) {
                if('a' <= c[i][j] && c[i][j] <= 'z') {
                    cs1.emplace_back(c[i][j], i * w + j);
                }
                if('A' <= c[i][j] && c[i][j] <= 'Z') {
                    cs2.emplace_back(c[i][j], i * w + j);
                }
            }
        }
        sort(begin(cs1), end(cs1));
        sort(begin(cs2), end(cs2));
        array<int, 3> s = {255, 255, 255}, g = {255, 255, 255};
        for(int i = 0; i < n; ++i) {
            s[i] = cs1[i].second;
            g[i] = cs2[i].second;
        }

        queue<pair<array<int, 3>, short>> que;
        d[s[0]][s[1]][s[2]] = 0;
        que.emplace(s, 0);
        int res = 0;
        while(!que.empty()) {
            auto now = que.front().first;
            auto cost = que.front().second;
            que.pop();
            if(now == g) {
                res = cost;
                break;
            }
            for(int i = 0; i < 5; ++i) {
                int ny0 = now[0] / w + dy[i], nx0 = (now[0] % w) + dx[i];
                if(c[ny0][nx0] == '#') {
                    continue;
                }
                for(int j = 0; j < 5; ++j) {
                    int ny1 = now[1] / w + dy[j], nx1 = (now[1] % w) + dx[j];
                    if(n >= 2 && c[ny1][nx1] == '#') {
                        continue;
                    }
                    for(int k = 0; k < 5; ++k) {
                        int ny2 = now[2] / w + dy[k], nx2 = (now[2] % w) + dx[k];
                        if(n == 3 && c[ny2][nx2] == '#') {
                            continue;
                        }
                        array<int, 3> nxt = {ny0 * w + nx0,
                                             (n >= 2 ? ny1 * w + nx1 : 255),
                                             (n == 3 ? ny2 * w + nx2 : 255)};
                        bool move_ok = true;
                        for(int l = 0; n != 1 && l < n; ++l) {
                            move_ok &= move_check(now[l], nxt[l], now[(l + 1) % n], nxt[(l + 1) % n]);
                        }
                        if(move_ok && d[nxt[0]][nxt[1]][nxt[2]] == 10000) {
                            d[nxt[0]][nxt[1]][nxt[2]] = cost + 1;
                            que.emplace(nxt, cost + 1);
                        }
                    }
                }
            }
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 39464
# main関数
if __name__ == '__main__':

    w, a, b = map(int,input().split())

    if (a + w - b) * (a - (b + w)) <= 0:
        print(0)
    elif b > a + w:
        print(b - a - w)
    else:
        print(a - b- w)

Measured memory_bytes: 38384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxn 105
using namespace std;
short f[maxn][maxn][maxn][maxn];
char s[maxn][maxn];
int a[maxn][maxn];
int X,Y,n,m;
void update(short &x,short y)
{
    if(x<y)  x=y;
}
int get(int x1,int y1,int x2,int y2)
{
    return a[x2][y2]-a[x2][y1-1]-a[x1-1][y2]+a[x1-1][y1-1];
}
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)  scanf("%s",s[i]+1);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(s[i][j]=='o')  a[i][j]=1;
            if(s[i][j]=='E')  X=i,Y=j;
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)  a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1];
    }
    memset(f,213,sizeof(f));
    f[0][0][0][0]=0;
    short ans=0;
    for(int l=0;Y-l>=1;l++)
    {
        for(int r=0;Y+r<=m;r++)
        {
            for(int u=0;X-u>=1;u++)
            {
                for(int d=0;X+d<=n;d++)
                {
                    update(ans,f[l][r][u][d]);
                    int xl=max(X-u,d+1),xr=min(X+d,n-u);
                    int yl=max(Y-l,r+1),yr=min(Y+r,m-l);
                    if(Y-l>=r+2)   update(f[l+1][r][u][d],f[l][r][u][d]+get(xl,Y-l-1,xr,Y-l-1));
                    if(Y+r<=m-l-1) update(f[l][r+1][u][d],f[l][r][u][d]+get(xl,Y+r+1,xr,Y+r+1));
                    if(X-u>=d+2)   update(f[l][r][u+1][d],f[l][r][u][d]+get(X-u-1,yl,X-u-1,yr));
                    if(X+d<=n-u-1) update(f[l][r][u][d+1],f[l][r][u][d]+get(X+d+1,yl,X+d+1,yr));
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    int m, f, r;
    while(1){
        cin >> m >> f >> r;
        if(m == -1 && f == -1 && r == -1)break;
        
        if(m == -1 || f == -1){
            cout << 'F' << endl;
        }else if((m + f) >= 80){
            cout << 'A' << endl;
        }else if((m + f) >= 65 && (m + f) < 80){
            cout << 'B' << endl;
        }else if((m + f) >= 50 && (m + f) < 65){
            cout << 'C' << endl;
        }else if((m + f) >= 30 && (m + f) < 50){
            if(r >= 50){
                cout << 'C' << endl;
            }else{
                cout << 'D' << endl;
            }
        }else if((m + f) < 30){
            cout << 'F' << endl;
        }
    }
    return 0;
}


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

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using uint=unsigned int;
using ll=long long;
using pii=pair<int,int>;
using vi=vector<int>;
using ld=long double;

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

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

int read(){
	int i;
	scanf("%d",&i);
	return i;
}

ll readLL(){
	ll i;
	scanf("%lld",&i);
	return i;
}

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

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

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

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

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

int main(){
	int p[6],q[6];
	REP(i,6)
		p[i]=read();
	REP(i,6)
		q[i]=read();
	vector<double> thre({0,1});
	REP(i,6)if(p[i]&&q[i])
		thre.PB(double(q[i])/(p[i]+q[i]));
	sort(ALL(thre));
	double ans=0;
	FOR(j,1,thre.size()){
		double up=thre[j],bt=thre[j-1];
		const double x=(up+bt)/2;
		double a=0,b=0;
		REP(i,6)
			if(x*p[i]<(1.0-x)*q[i])
				a+=p[i];
			else
				b+=q[i];
		if(a>b)
			chmax(ans,0.01*(up*a+(1.0-up)*b));
		else
			chmax(ans,0.01*(bt*a+(1.0-bt)*b));
	}
	cout<<fixed<<setprecision(19)<<1.0-ans<<endl;
}


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

/* A <= (8/100)x < A + 1
   (100/8) A <= x < 100/8 (A + 1) */
   // 10B < x < 10(B + 1)
int main(){
  int A, B;
  cin >> A >> B;
  int m, n, k, l;
  if(A % 2 == 0){
    m = A * 25 / 2;
    n = (A + 1) * 25 / 2;
  }else{
    m = A * 25 / 2 + 1;
    n = (A + 1) * 25 / 2 - 1;
  }
  k = 10 * B; 
  l = 10 * (B + 1);
  
  bool flag = false;
  for(int x = 1; x < 100000; x++){
    if(m <= x && x < n && k <= x && x < l){
      flag = true;
      cout << x <<endl;
      break;
    }
  }
  if(!flag) cout << "-1" <<endl;
}
    
    

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

int main() {
    string s;
    cin >> s;
    rep(i, s.size()) cout << 'x';
    cout << endl;

}




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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3007, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int mat[N][N], dp[N][N][4];

int n, m, k;

int get(int i, int j, int pick)
{
	if ( i == n and j == m )
	{
		if ( pick < 3) return mat[i][j];
		else return 0;
	}

	int &mafia = dp[i][j][pick];
	if ( mafia + 1 ) return mafia;

	int d1 = 0, d2 = 0, r1 = 0, r2 = 0;
	if ( i < n ) d1 = get(i + 1, j, 0);
	if ( pick < 3  and i < n ) d2 = mat[i][j] + get(i + 1, j, 0);

	if ( j < m ) r1 = get(i, j + 1, pick);
	if ( pick < 3 and j < m ) r2 = mat[i][j] + get(i, j + 1, pick + 1);

	int ans = max( {d1, d2, r1, r2} );
	return mafia = ans;
}

void solve()
{
	cin >> n >> m >> k;

	memset(dp, -1, sizeof dp);

	lop(i, 0, k)
	{
		int r, c, val;
		cin >> r >> c >> val;
		mat[r][c] = val;
	}

	int res = get(1, 1, 0);
	cout << res << endl;

}

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

	int test = 1;
	// cin >> test;
	while (test--)solve();


}





















Measured memory_bytes: 357336
#include<bits/stdc++.h>
//priority_queue<ll, vector<ll>, std::greater<ll> > q;
#define ull 		unsigned long long
#define ll 			long long
#define M 			1000000007
#define pb 			emplace_back
#define p_q 		priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) // gcd((a),(b))
#define ios	    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp 			make_pair
#define lb 			lower_bound
#define ub			upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)	for(ll int i=0;i<n;i++) a[i]=0;
#define hell 		(ull)1e9
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
using namespace std;
//ll maxi = 3005;
ll dp[3005][3005];
void boost()
{
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
    cout.tie(NULL);
}



int main(void)
{
    boost();
    string s1 , s2;
    cin>>s1>>s2;
    ll n = s1.size();
    ll m = s2.size();
    dp[n+1][m+1];
    rep(i,0,n+1)
        dp[i][0] = 0;
    rep(i,0,m+1)
        dp[0][i] = 0;
    rep(i,0,n){
        rep(j,0,m){
            if (s1[i] == s2[j]){
                dp[i+1][j+1] = 1 + dp[i][j];
            }
            else{
                dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
            }
        }
    }
    // rep(i,0,n+1){
    //     rep(j,0,m+1){
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<"\n";
    // }
    string s3 = " ";
    ll i = n;
    ll j = m;
    while (i > 0 && j > 0){
        if (s1[i-1] == s2[j-1]){
            //cout<<"hi"<<"\n";
            s3.push_back(s1[i-1]);
            i--;
            j--;
        }
        else if (dp[i-1][j] > dp[i][j-1])
            i--;
        else
            j--;
    }
    reverse(all(s3));
    cout<<s3;
}   

Measured memory_bytes: 70784
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
ll N;
int P[51];

int main() {
	cin>>N;

	for(int i=1;i<N+1;i++){
		cin>>P[i];
	}
	int S=0;
	for(int i=1;i<N+1;i++){
		if(i!=P[i]){
			S++;
		}
	}
	if(S<=2){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    ls = [0] * (n + 1)
    ls[0] = 2
    ls[1] = 1
    for i in range(2, len(ls)):
        ls[i] = ls[i-1] + ls[i-2]
    print(ls[-1])


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38340
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<stdlib.h>
#include<string>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    cout<<c<<' '<<a<<' '<<b;
    return 0;
}

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> P(n), Q(n);
    for(int i = 0; i < n; i++){
        cin >> P[i];
    }
    for(int i = 0; i < n; i++){
        cin >> Q[i];
    }

    vector<int> A(n);
    for(int i = 0; i < n; i++){
        A[i] = i + 1;
    }

    int p = 1, q = 1;
    do{
        bool f = true;
        for(int i = 0; i < n; i++){
            if(A[i] == P[i]);
            else{
                f = false;
                break;
            }
        }
        if(f) break;
        p++;
    }while(next_permutation(A.begin(), A.end()));

    sort(A.begin(), A.end());
    do{
        bool f = true;
        for(int i = 0; i < n; i++){
            if(A[i] == Q[i]);
            else{
                f = false;
                break;
            }
        }
        if(f) break;
        q++;
    }while(next_permutation(A.begin(), A.end()));

    cout << abs(p - q) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
 
int main(void){
    ll n,x;
 
    cin >> n;
 
    x = n*100/108;
 
    if(x*108/100==n || (x+1)*108/100==n){
        if(n*100%108 != 0)
            cout << x+1 << endl;
        else
            cout << x << endl;
    }else{
        cout << ":(" << endl;
    }
 
    return 0;
}

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

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

  string S;
   cin >> S;

   sort(S.begin(), S.end());
   int ans = 0;
   for (int i = 1; i < S.size(); ++i) {
     if (S.at(i - 1) == S.at(i)) {
       cout << "no" << endl;
       return 0;
     }
   }

   cout << "yes" << endl;
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(' ').map(String::toInt)
    val x = Array(n) { 0 }
    x[1] = a.take(n - 1).sum() - a[n - 1]
    for (i in 1..(n - 3) / 2) {
        x[1] -= a[i * 2] * 2
    }
    x[0] = a[0] * 2 - x[1]
    for (i in 2 until n) {
        x[i] = a[i - 1] * 2 - x[i - 1]
    }
    println(x.joinToString(" "))
}


Measured memory_bytes: 59372
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int e[200005];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        e[i]=a[i];
    }
    sort(e,e+n);
    int mid1=n/2-1,mid2=n/2;
    for(int i=0;i<n;i++)
    {
        if(a[i]<=e[mid1])
        {
            printf("%d\n",e[mid2]);
        }
        else if(a[i]>=e[mid2])
        {
            printf("%d\n",e[mid1]);
        }
    }
}

Measured memory_bytes: 3712
import bisect

N = int(input())
Alist = sorted(list(map(int, input().split())))
Blist = sorted(list(map(int, input().split())))
Clist = sorted(list(map(int, input().split())))

ans = 0

for B in Blist:
    Aindex = bisect.bisect_left(Alist, B)
    Cindex = bisect.bisect_right(Clist, B)

#    print(B, Aindex, N-Cindex)
    ans += Aindex * (N - Cindex)

print(ans)




Measured memory_bytes: 107108
chomp($s=<>);
@a=split//,$s;

for($i=0;$i<=$#a;$i++){
	if($a[$i] eq "A"){
    	$stt=$i+1;
       	last;
    }
}
for($i=$#a;$i>=0;$i--){
	if($a[$i] eq "Z"){
    	$end=$i+1;
        last;
    }
}
print $end-$stt+1;

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

int main() {
    int n;
    cin >> n;
    int sum = 0;
    int mx = 0;
    for (int i = 0; i < n; i++) {
        int l;
        cin >> l;
        sum += l;
        mx = max(mx, l);
    }

    if (mx < sum - mx) {
        puts("Yes");
    } else {
        puts("No");
    }
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

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

    int cnt = 0;
    rep(i, 10) {
        int i_i = 0;
        while (i_i < N && (S[i_i] - '0') != i) i_i++;
        rep(j, 10) {
            int i_j = i_i + 1;
            while (i_j < N && (S[i_j] - '0') != j) i_j++;
            rep(k, 10) {
                int i_k = i_j + 1;
                while (i_k < N && (S[i_k] - '0') != k) i_k++;
                if (i_k < N) cnt++;
            }
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 384
N, H = map(int, input().split())
A = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append((a, b))

A = sorted(A, key=lambda x: -x[0])
a = A[0][0]
ans = 0

A = sorted(A, key=lambda x: -x[1])
for i in range(N):
    if H <= 0:
        break
    if A[i][1] > a:
        ans += 1
        H -= A[i][1]

if H > 0:
    ans += (H + a - 1) // a

print(ans)


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

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

        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        sc.close();

        if (B % A == 0) {
            out.printf("%d\n", A + B);
        } else {
            out.printf("%d\n", B - A);
        }
        out.flush();
    }
}


Measured memory_bytes: 21716
#include<stdio.h>

typedef struct{
  int parent;
  int sibling;
  int child;
}Tree;

int main()
{
  int i, j, n, id,  x, temp, kids, depth, d;

  
  scanf("%d", &n);
  
  Tree T[n];

  for( i=0; i<n; i++ )
    {
      T[i].parent = -1;
    }
  
  for( i=0; i<n; i++ )
    {
      scanf("%d%d", &id, &x);
      
      if( x != 0 )
	{
	  scanf("%d", &T[id].child);

	  kids = T[id].child;
	  
	  for( j=0; j<x; j++ )
	    {
	      if( j == x-1 ) T[kids].sibling = -1;
	      else scanf("%d", &T[kids].sibling);
	      
	      T[kids].parent = id; 
	   
	      kids = T[kids].sibling;
	    }
	}

      else T[id].child = -1;
    }


  for( i=0; i<n; i++ )
    {
      printf("node %d: ", i);
      printf("parent = %d, ", T[i].parent);
      
      depth = 0;
      d = i;
      while(1)
	{
	  if( T[d].parent == -1 ) break;
	  depth++;
	  d = T[d].parent;
	}
	   
      printf("depth = %d, ", depth);
      
      if( T[i].parent == -1 )
	{
	  if( T[i].child == -1 ) printf("root, []\n");
	  
	  else
	    {
	      printf("root, [%d", T[i].child);
	      temp = T[i].child;
	      
	      while(1)
		{
		  if( T[temp].sibling == -1 )
		    {
		      printf("]\n");
		      break;
		    }
		  printf(", %d", T[temp].sibling);
		  temp = T[temp].sibling;
		  
		}
	    }
	}
      
      else if( T[i].child == -1 ) printf("leaf, []\n");
      
      else
	{
	  printf("internal node, [");
	  temp = T[i].child;
	  
	  while(1)
	    {
	      if( T[temp].sibling == -1 )
		{
		  printf("%d]\n", temp);
		  break;
		}
	      else
		{
		  printf("%d, ", temp);
		  temp = T[temp].sibling;
		}
	      
	    }
	}
    } 

  return 0;
}

	
      



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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int h, w, n;
  cin >> h >> w >> n;
  int x = max(h, w);
  cout << (n + x - 1) / x << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MIN(x,y) x<y?x:y
#define MAX(x,y) x>y?x:y

int main(){
	long int A,B,C,X,Y;
	scanf("%ld %ld %ld %ld %ld",&A,&B,&C,&X,&Y);
	long int ans1=(MIN(X, Y))*(MIN((2*C), (A+B)))+A*(X-(MIN(X,Y)))+B*(Y-(MIN(X,Y)));
        long int ans2=(MAX(X,Y))*2*C;
	printf("%ld",MIN(ans1,ans2));
	return 0;
}


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

H, W = map(int, input().split())
arr = [[j for j in input().rstrip()] for i in range(H)]
b = [x for x in arr if '#' in x]
c = zip(*[x for x in zip(*b) if '#' in x])
for x in c:
  print("".join(x))

Measured memory_bytes: 3188
<?php
fscanf(STDIN, "%d %d", $h, $n);
$a = explode(' ', fgets(STDIN));

$at = "";
for ($i = 0; $i < $n; $i++) { 
    $at += $a[$i];
}

if ($h > $at) {
    echo "No";
} else {
    echo "Yes";
}


Measured memory_bytes: 12792
#include<bits/stdc++.h>
#define ios std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
typedef long long ll;
int isprime(ll a )
{   
	int flag=1;
	for(int i=2;i*i<=a;i++)
	  if(a%i==0) { flag=0;break;}
	return  flag?1:0;
}
using namespace std;
int main(){
    ios;
	ll a,b,k;
	cin>>a;
	for(int i=a;;i++)
	{
        if(isprime(i)) {cout<<i<<endl;break;}
	}
	return 0;
}


Measured memory_bytes: 256
from operator import itemgetter
n,k = (int(i) for i in input().split())
c = 0
e = sorted([tuple([int(i) for i in input().split()]) for i in range(n)],key=itemgetter(0))
for a,b in e:
    if c<=k<=c+b:
        print(a)
        exit()
    c+=b


Measured memory_bytes: 19072
import sys, os
import collections

MOD = 10 ** 9 + 7

def solve(input_stream):
  table = {
    "SUN": 7,
    "MON": 6,
    "TUE": 5,
    "WED": 4,
    "THU": 3,
    "FRI": 2,
    "SAT": 1
  }

  target = input_stream.readline().strip()
  return [str(table[target])]

def read_ints(input_stream):
  return [i for i in map(int, input_stream.readline().strip().split())]

def read_int(input_stream):
  return int(input_stream.readline().strip())


if __name__ == "__main__":
    outputs = solve(sys.stdin)
    for line in outputs:
      print(line)

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);
  int h, w;
  cin >> h >> w;
  vector<string> board(h);
  rep(i, h) {
    cin >> board[i];
  }
  int num[h][w] {};
  fill(&num[0][0], &num[h][0], -1);
  queue<pair<int, int>> q;
  rep(i, h) {
    rep(j, w) {
      if (board[i][j] == '#') {
        q.push(pair<int, int>(i, j));
        num[i][j] = 0;
      }
    }
  }
  int ans = 0;
  while (q.size() > 0) {
    pair<int, int> pos = q.front();
    q.pop();
    pair<int, int> diff[4] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};  
    for (auto& d : diff) {
      int i = pos.first + d.first;
      int j = pos.second + d.second;
      if (0 <= i && i < h && 0 <= j && j < w && num[i][j] == -1) {
        num[i][j] = num[pos.first][pos.second] + 1;
        ans = max(ans, num[i][j]);
        q.push(pair<int, int>(i, j));
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 13456
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(n+1):
    for j in range(n+1):
        x = l[2]*i
        y = l[1]*j
        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
            count = count + 1
print(count)



Measured memory_bytes: 40684
package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)
)

func main() {
	defer writer.Flush()
	var N, K int
	fmt.Fscanf(reader, "%d\n%d\n", &N, &K)
	x := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Fscanf(reader, "%d", &x[i])
	}
	var count int
	for _, t := range x {
		if t-0 > K-t {
			count += K - t
		} else {
			count += t - 0
		}
	}
	fmt.Fprintf(writer, "%d\n", count*2)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll n, x, t;
    cin >> n >> x >> t;
    ll ans = (n/x + (n%x!=0)) * t; 
    cout << ans << endl;
    //printf("%.12f", ans);
}

Measured memory_bytes: 3632
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
from bisect import bisect_left  as bl
from bisect import bisect_right as br
from bisect import insort_left  as il    # insort_leftはO(N)
from bisect import insort_right as ir
#-------------------------------------------------------------------
n = int(input())
L = list( map(int, input().split()) )	# 1 2 3 4 5 ...

L.sort()

ans=0

for i in range(n-2):
	a=L[i]
	
	for j in range(i+1, n-1):
		b=L[j]
		
		k = bl(L,a+b)
		
		ans+=k-j-1

print(ans)





Measured memory_bytes: 3188
#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()

using namespace std;

const int MSIZE = 100100;
bool WIN[MSIZE];
int  arr[101];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    for (int i = 1; i <= k; i++) {
        for (int j = 0; j < n; j++) {
            if (i - arr[j] < 0) continue;
            WIN[i] |= !WIN[i - arr[j]];
        }
    }
    cout << (WIN[k] ? "First" : "Second") << endl;

}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> P;
typedef unsigned long long int ull;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const int INF=1e9;
const ll MOD=1e9+7;
const int A=1;
const int C=2;
const int G=3;
const int T=4;
int main(){
    int N;cin>>N;
    ll DP[N+1][5][5][5];
    for(int i=0;i<=N;i++){
        for(int a=0;a<=4;a++){
            for(int b=0;b<=4;b++){
                for(int c=0;c<=4;c++){
                    DP[i][a][b][c]=0;
                }
            }
        }
    }
    DP[0][0][0][0]=1;
    for(int i=0;i<N;i++){
        for(int a=0;a<=4;a++){
            for(int b=0;b<=4;b++){
                for(int c=0;c<=4;c++){
                    for(int d=1;d<=4;d++){
                        if(b==A&&c==G&&d==C) continue;
                        if(a==A&&c==G&&d==C) continue;
                        if(b==G&&c==A&&d==C) continue;
                        if(b==A&&c==C&&d==G) continue;
                        if(a==A&&b==G&&d==C) continue;
                        DP[i+1][b][c][d]+=DP[i][a][b][c];
                        DP[i+1][b][c][d]%=MOD;
                    }
                }
            }
        }
    }
    ll ans=0;
    for(int a=0;a<=4;a++){
        for(int b=0;b<=4;b++){
            for(int c=0;c<=4;c++){
                ans+=DP[N][a][b][c];
                ans%=MOD;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3620
n, k = map(int, input().split())
x = list(map(int, input().split()))

# c = combinations(x, k)
c = []
for i in range(n - k + 1):
    l = x[i]
    r = x[i + k - 1]
    c.append([l, r])


# print(list(c))

ans = 10 ** 10

for l, r in c:
    tmp = min(abs(l) + abs(r - l), abs(r) + abs(r - l))
    ans = min(ans, tmp)

# for g in c:
#     a = max(0, max(g))
#     b = min(0, min(g))
#     # print(a, b)
#     if (a * b) < 0:
#         tmp = min(2 * abs(a) + abs(b), 2 * abs(b) + abs(a))
#     else:
#         tmp = abs(a) + abs(b)
#     ans = min(ans, tmp)

print(ans)


Measured memory_bytes: 14252
using System;


class abc
{
public static void Main()
{
String[] str1 = new String[2];
str1 = Console.ReadLine().Split();

int a = int.Parse(str1[0]);
int b = int.Parse(str1[1]);


int c = a*b;
int d = (a+b)*2;

str1[0] = c.ToString();
str1[1] = d.ToString();

Console.WriteLine(str1[0] + " "+str1[1]);
}
}


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

#define endl '\n'

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

    string s; cin >> s;
    vector<char> beg, end;
    int q; cin >> q;
    bool reversed = false;
    while(q--){
        int t; cin >> t;
        if (t == 1) reversed ^= true;
        else{
            int f;
            char c;
            cin >> f >> c;
            if (f == 1){
                if (reversed) end.push_back(c);
                else beg.push_back(c);
            } else{
                if (reversed) beg.push_back(c);
                else end.push_back(c);
            }
        }
    }
    if (reversed){
        reverse(end.begin(), end.end());
        reverse(s.begin(), s.end());
        for (char x : end) cout << x;
        cout << s;
        for (char x : beg) cout << x;
        cout << endl;
    } else{
        reverse(beg.begin(), beg.end());
        for (char x : beg) cout << x;
        cout << s;
        for (char x : end) cout << x;
        cout << endl;
    }
}

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

vector<int> cycle(int ind, vector<int> Dest){
  
  vector<int> c = {};
  while (Dest.at(ind) != -1) {
    c.push_back(Dest.at(ind)-1);
    int ind2 = ind;
    ind = Dest.at(ind)-1;
    Dest.at(ind2) = -1;
    
  }
  
  return c;
  
}
 
int main() {
  
  int N, K;
  cin >> N >> K;
  
  vector<int> P(N), C(N);
  
  for (int i = 0; i < N; i++) {
    cin >> P.at(i);
  } 
  
  for (int i = 0; i < N; i++) {
    cin >> C.at(i);
  } 
    
  int64_t score = -1000000000;
  int64_t score2 = -1000000000;
  
  for (int i = 0; i < N; i++) {
    vector<int> cyc = cycle(i,P);
    int n = cyc.size();
    int64_t m = 0;
    int64_t l = 0;
    for (int j = 0; j < min(K,K%n + n); j++) {
      m += C.at(cyc.at(j%n));
      if (m > score2) {
        score2 = m;
      }
      if (j == n-1) {
        l = m;
      }
    }
    
    if(K >= 2*n && l > 0){
      score2 += l*(K/n - 1) ;
    }
    
    if (score <= score2) {
      score = score2;
    }
    score2 = -1000000000;
  }
  
  cout << score << endl;
  
return 0;
}


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

using namespace std;

#define pb push_back
#define pp pop_back
#define mp make_pair
#define F first
#define S second
#define xmax(x,y) ((x) = max((x),(y)))
#define xmin(x,y) ((x) = min((x),(y)))
#define all(x) (x).begin(),(x).end()
#define mem(x) memset(x , 0 , sizeof(x))
#define _ ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define FP(a , b , c)  for(ll (a) = (b) ; (a) < (c) ; (a++));
#define FM(a , b , c)  for(ll (a) = (b) ; (a) >= (c) ; (a--));
#define connect(a , b , c) a[b].pb(c) , a[c].pb(b)

typedef long long int ll;
typedef unsigned long long int ull;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector <ll> vl;
typedef vector <int> vi;
typedef vector <string> vs;

const ll Maxn3 = 1e3 + 10;
const ll Maxn4 = 1e4 + 10;
const ll Maxn5 = 1e5 + 10;
const ll Maxn6 = 1e6 + 10;
const ll Maxn7 = 1e7 + 10;
const ll Maxn8 = 1e8 + 10;
const ll Maxn9 = 1e9 + 10;
const ll Maxn18 = 1e18 + 10;
const ll Mod1 = 1e7 + 7;
const ll Mod2 = 1e9 + 7;
const ll LLMax = LLONG_MAX;
const ll LLMin  = LLONG_MIN;
const ll INTMax = INT_MAX;
const ll INTMin  = INT_MIN;

ll mn = LLMax , mx = LLMin;

int main()
{_
    ll a[3];cin >> a[0] >> a[1] >> a[2];
    ll res = 0;
    while(1)
    {
        sort(a , a + 3);
        if(a[0] == a[1] and a[1] == a[2])
            break;
        if(a[0] == a[1])
            a[0]++ , a[1]++;
        else
            a[0] += 2;
        res++;
    }
    return cout << res , 0;
}
///SAliB


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

int main() {
    string s;
    cin >> s;
    auto sa = suffix_array(s);
    auto la = lcp_array(s, sa);
    int64_t l = s.size(), ans = l * (l + 1) / 2;
    for (auto x : la) {
        ans -= x;
    }
    cout << ans << endl;
}


Measured memory_bytes: 15652
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
 
int main()
{
    long long h, w;
    cin >> h >> w;
    if (h == 1 || w == 1)
    {
        cout << 1;
        return 0;
    }
    cout << 1ll * (h / 2) * (w / 2) * 2 + 1ll * (h % 2) * (w / 2) + 1ll * (h / 2) * (w % 2) + 1ll * (h % 2) * (w % 2) << endl;
    // system("pause");
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *

L = int(input())
n = int(log(L, 2))
es = []
m = min(n, 19)
for i in range(1, 20):
    es.append((i, i+1, 0))
for i in range(m):
    es.append((i+1, i+2, 1<<i))
t = L-(1<<m)
for i in range(20):
    if (t>>i) & 1:
        L -= 1<<i
        es.append((i+1, 20, L))
print(20, len(es))
for u, v, c in es:
    print(u, v, c)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int main() {
char c;
  cin >> c; 
  if (c == 'a'||c == 'i'||c == 'u'||c == 'e'| c == 'o'){
    cout << "vowel" <<endl;
  }
  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 3644