akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f3f3f3f3f
#define mod 1000000007
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'

using namespace std;
typedef long long ll;
const int maxn = 110;
int a[maxn];
int dp[maxn][maxn];
signed main()
{
    IOS;
        int num;
    cin >> num;
    for (int i = 1;i <= num;++i);
    memset(dp, 0, sizeof(dp));
    for (int k = 0; k <= 9; ++k) {
        dp[1][k] = 1;
    }
    for (int i = 2; i <= 10; ++i) {
        for (int j = 0; j <= 9; ++j) {
            dp[i][j] = dp[i - 1][j] + dp[i - 1][j - 1] + dp[i - 1][j + 1];
        }
    }
    
    int l = 0, r = 0, fl = 0;
    queue<int> ans;
    for (int j = 1; j <= 10; ++j) {
        for (int i = 1; i <= 9; ++i) {
            if (num <= dp[j][i]) {
                l = j;
                r = i;
                fl = 1;
                break;
            }
            num -= dp[j][i];
        }
        if (fl == 1)break;
    }
    --l;
    ans.push(r);
    while (l != 0) {
        if (num <= dp[l][r - 1]) {
            --r;
            ans.push(r);
        }
        else {
            num -= dp[l][r - 1];
            if (num <= dp[l][r]) {
                ans.push(r);
            }
            else {
                num -= dp[l][r];
               ++r;
                ans.push(r);
            }
        }
        --l;
    }
    for (int i = 1;i <= 12;++i) {
        for (int j = 1;j <= 1234;++j) {

        }
    }
    while (!ans.empty()) {
        int now = ans.front();
        cout << now;
        ans.pop();
    }
}

Measured memory_bytes: 256
<?php

$input = explode(" ", trim(fgets(STDIN)));
$num_arr = [];
for ($i = 0; $i < count($input); $i++) {
    $num = $input[$i];
    switch ($input[$i]) {
        case '+':
            $num = $num_arr[count($num_arr)-2] + $num_arr[count($num_arr)-1];
            array_pop($num_arr);
            array_pop($num_arr);
            break;
        case '-':
            $num = $num_arr[count($num_arr)-2] - $num_arr[count($num_arr)-1];
            array_pop($num_arr);
            array_pop($num_arr);
            break;
        case '*':
            $num = $num_arr[count($num_arr)-2] * $num_arr[count($num_arr)-1];
            array_pop($num_arr);
            array_pop($num_arr);
            break;
    }

    array_push($num_arr, $num);
}

echo $num_arr[0], "\n";


Measured memory_bytes: 9308
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
using ll=long long;

const ll INF = 1LL << 60;

#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int MAX_N = 110;
const int MAX_V = 100100;

int N;
ll W; 
ll w[MAX_N];
ll v[MAX_N];
ll dp[MAX_N][MAX_V];

int main(){
    cin >> N >> W;
    REP(i,N) cin >> w[i] >> v[i];
    REP(i,MAX_N){
        REP(j,MAX_V){
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;
    REP(i,N){
        REP(j,100100){
            if(j-v[i]>=0) chmin(dp[i+1][j],dp[i][j-v[i]]+w[i]);
            chmin(dp[i+1][j],dp[i][j]);
        }
    }
    ll res = 0;
    REP(j,100100){
        if(dp[N][j]<=W){
            res = j;
        }
    }
    cout << res << endl;
}

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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

string s;
int cur, n;

void dfs(int i) {
	if(i == n) {
		pstr(s.c_str()); pc('\n');
		return;
	}
	rep(v, cur+2) {
		s += (v+'a');
		if(v == cur+1) {
			cur = v;
			dfs(i+1);
			cur = v-1;
		} else {
			dfs(i+1);
		}
		s.pop_back();
	}
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    gi(n);
	cur = -1;
	dfs(0);
}


Measured memory_bytes: 4864
/*
 * 2312.cc: Magical Girl Sayaka-chan
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 2000;
const int MAX_M = 100000;

typedef long long ll;
const ll LINF = 1LL << 62;

/* typedef */

/* global variables */

int ks[MAX_N], ss[MAX_M];
ll sums[MAX_M + 1], dp[MAX_N][MAX_N];

/* subroutines */

inline ll force(int a, int b, int l) {
  return
    (a <= b) ? (sums[b] - sums[a - 1]) / l : (sums[a] - sums[b - 1]) / l;
}

/* main */

int main() {
  int n, m, l;
  cin >> n >> m >> l;

  for (int i = 0; i < n; i++) cin >> ks[i];
  sort(ks, ks + n);
  
  for (int i = 0; i < m; i++) {
    cin >> ss[i];
    sums[i + 1] = sums[i] + ss[i];
  }

  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) dp[i][j] = LINF;
  dp[0][0] = 0;
  
  for (int i = 0; i < n - 1; i++)
    for (int j = 0; j < n - 1; j++)
      if (dp[i][j] < LINF) {
	int k = (i > j) ? i + 1 : j + 1;
	ll dik = dp[i][j] + force(ks[j], ks[k], l);
	ll dkj = dp[i][j] + force(ks[i], ks[k], l);
	if (dp[i][k] > dik) dp[i][k] = dik;
	if (dp[k][j] > dkj) dp[k][j] = dkj;
      }

  ll mind = LINF;
  for (int i = 0; i < n; i++)
    if (dp[i][n - 1] < LINF) {
      ll d = dp[i][n - 1] + force(ks[i], ks[n - 1], l);
      if (mind > d) mind = d;
    }
  printf("%lld\n", mind);

  return 0;
}

Measured memory_bytes: 33596
n = int(input())
s = input()
_max = 0
memo_ls = [[0 for i in range(n)] for j in range(n)]
memo_dict = {i : [0 for j in range(n)] for i in range(-1,n)}
for i in range(n):
    for j in range(min(i+1,n-1), n):
        if s[i] != s[j]:
            continue
        candidate = memo_dict[i-1][j-1] + 1
        if candidate > j - i:
            candidate = j - i
        memo_dict[i][j] = candidate
        if candidate > _max:
            _max = candidate
print(_max)

Measured memory_bytes: 456712
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8

vector<LL> flg;
queue<int> que;
vector<int> vs;
inline void check(LL t){
	int u = t & 0xfffff;
	if((flg[u] >> 40) >= (t >> 40) && flg[u] != t){
		flg[u] = t;
		que.push(u);
		vs.push_back(u);
	}
}

void mainmain(){
	int n, m;
	scanf("%d%d", &n, &m);
	VV(LL) G(n + 1);
	for(int i = 0; i < m; ++i){
		LL p, q, c;
		scanf("%lld%lld%lld", &p, &q, &c);
		G[p].push_back(c << 20 | q);
		G[q].push_back(c << 20 | p);
	}
	for(int i = 1; i <= n; ++i){
		sort(ALL(G[i]));
	}

	flg.assign(n + 1, LLONG_MAX);
	flg[1] = 1;
	vector<LL> nxt;
	vs.push_back(1);
	for(LL tm = 1; !vs.empty(); ++tm){
		nxt.clear();
		for(int u : vs){
			for(LL e : G[u]){
				nxt.push_back(tm << 40 | e);
			}
		}
		sort(ALL(nxt));
		vs.clear();
		for(LL t : nxt){
			LL comflag = t & 0xfffff00000;
			check(t);
			while(!que.empty()){
				int u = que.front();
				que.pop();
				auto it = lower_bound(ALL(G[u]), comflag);
				for(; it != G[u].end(); ++it){
					if((*it & 0xfffff00000) != comflag){ break; }
					LL f = tm << 40 | *it;
					check(f);
				}
			}
		}

		sort(ALL(vs));
		vs.erase(unique(ALL(vs)), vs.end());
	}
	LL ans = (flg[n] == LLONG_MAX ? -1LL : flg[n] >> 40);
	cout << ans << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 15216
n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]

xy1 = []
xy2 = []

for x,y in xy:
    xy1.append(x+y)
    xy2.append(x-y)

xy1.sort()
xy2.sort()

print(max(xy1[-1] - xy1[0], xy2[-1] - xy2[0]))


Measured memory_bytes: 129328
#include<iostream>
using namespace std;
int main() {
	int n; cin >> n;
	int a[100];
	for (int i = 0; i < n; i++)cin >> a[i];
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		int minj = i;
		for (int j = i; j < n; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		swap(a[i], a[minj]); if(i!=minj)cnt++;
	}
	for (int i = 0; i < n; i++) {
		if (i > 0)cout << " ";
		cout << a[i];
	}
	cout << endl << cnt << endl;
	return 0;
}

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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define int long long

typedef pair<int, int> ii;

const int N = 3e3 + 5;

int lcs[N][N];
ii tr[N][N];

string s, t;

vector<int> vec;

signed main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> s >> t;
    s = "+" + s;
    t = "+" + t;
    for(int i = 1; i < s.length(); i++) {
        for(int j = 1; j < t.length(); j++) {
            if(s[i] == t[j]) {
                if(lcs[i - 1][j - 1] + 1 > lcs[i][j]) {
                    tr[i][j] = {i - 1, j - 1};
                }
                lcs[i][j] = max(lcs[i - 1][j - 1] + 1, lcs[i][j]);
            }
            if(lcs[i - 1][j] > lcs[i][j]) {
                tr[i][j] = {i - 1, j};
                lcs[i][j] = lcs[i - 1][j];
            }
            if(lcs[i][j - 1] > lcs[i][j]) {
                tr[i][j] = {i, j - 1};
                lcs[i][j] = lcs[i][j - 1];
            }
            lcs[i][j] = max(lcs[i][j], max(lcs[i - 1][j], lcs[i][j - 1]));
        }
    }
    int m = s.length() - 1, n = t.length() - 1, sum = lcs[m][n];
    while(m > 0 || n > 0) {
        ii frt = tr[m][n];
        if(sum == 0) break;
        if(abs(frt.fi - m) + abs(frt.se - n) == 2) {
            vec.pb(m);
            sum--;
        }
        m = frt.fi;
        n = frt.se;
    }
    reverse(vec.begin(), vec.end());
    for(int i = 0; i < vec.size(); i++)
        cout << s[vec[i]];
}


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

#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384


int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}    //最大公約数
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}     //最小公倍数
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション
int nHr(int a,int b){return nCr(a+b-1,b);}       // 重複組み合わせ
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}  //階乗
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}   //数字の各位の和
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}  // b進数の各位の和？
int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和

//以下long long ver
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}

//double
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}


typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) ; for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

 
/*CODE START HERE*/

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

int main() {
  int x;
  cin >> x;
  int p=x;
  while(!is_prime(p)) p++;
  cout << p << endl;
}

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

#define NIL -1
#define INF 1000000001

using namespace std;


void maxHeapify(int i, vector<int> &heap_array){
    int H = (int)heap_array.size(); // H+1
    int left = 2*i;
    int right= 2*i+1;
    int largest;
    if(left < H && heap_array[left] > heap_array[i]) largest = left;
    else largest = i;
    if(right< H && heap_array[right]> heap_array[largest]) largest = right;

    if(largest != i){
        swap(heap_array[largest],heap_array[i]);
        maxHeapify(largest,heap_array);
    } 
}

void buildMaxHeap(vector<int> &heap_array){
    int H = (int)heap_array.size();
    for(int i = H/2;i > 0;i--){
        maxHeapify(i,heap_array);
    }
}

int main(){
    int size_of_H;
    int temp;
    scanf("%d",&size_of_H);
    vector<int> heap_array(size_of_H+1,0);
    
    for(int i = 1;i <= size_of_H;i++){
        scanf("%d",&temp);    
        heap_array[i]= temp;
    }
    
    buildMaxHeap(heap_array);
    for(int i = 1;i <= size_of_H;i++){
        printf(" %d",heap_array[i]);
    }
    printf("\n");
    return 0;
}


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

int main() {
    const int SECONDS_PER_HOUR = 3600;
    const int SECONDS_PER_MINUTE = 60;

    int S, h, m, s;

    cin >> S;

    h = S / SECONDS_PER_HOUR;
    m = (S - h * SECONDS_PER_HOUR) / SECONDS_PER_MINUTE;
    s = S - h * SECONDS_PER_HOUR - m * SECONDS_PER_MINUTE;

    cout << h << ":" << m << ":" << s << endl;
    
    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
    int n;cin>>n;
    string s;cin>>s;
    int maxv=0;
    rep(i,n){
        vector<int> a(26,0);
        vector<int> b(26,0);
        rep(j,n){
            if(j<=i)a[s[j]-'a']++;
            else b[s[j]-'a']++;
        }
        int cnt=0;
        rep(j,26)if(a[j]>0&&b[j]>0)cnt++;
        maxv=max(maxv,cnt);
    }
    cout<<maxv<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;

class quiz
{
    public long solve(int N, int A, int[] x)
    {
        long[,,] dp = new long[N + 1, 2501, N + 1];

        for (int i = 0; i < N + 1; i++)
        {
            for (int j = 0; j < 2501; j++)
            {
                for (int k = 0; k < N + 1; k++)
                {
                    dp[i, j, k] = -1;
                }
            }
        }

        dp[0, 0, 0] = 1;

        for (int i = 1; i < N + 1; i++)
        {
            for (int j = 0; j < 2501; j++)
            {
                for (int k = 0; k <= i - 1; k++)
                {
                    if (j >= x[i - 1] && dp[i - 1, j - x[i - 1], k] >= 0)
                    {
                        if (dp[i, j, k + 1] >= 0)
                            dp[i, j, k + 1] += dp[i - 1, j - x[i - 1], k];
                        else
                            dp[i, j, k + 1] = dp[i - 1, j - x[i - 1], k];
                    }

                    if (dp[i - 1, j, k] >= 0)
                    {
                        if (dp[i, j, k] >= 0)
                            dp[i, j, k] += dp[i - 1, j, k];
                        else
                            dp[i, j, k] = dp[i - 1, j, k];
                    }
                }
            }
        }

        long ans = 0;

        for (int i = 1; i < N + 1; i++)
        {
            if (dp[N, i * A, i] >= 0)
            {
                ans += dp[N, i * A, i];
            }
        }

        return ans;
    }

    public int[] ParseIntBySpace(string str)
    {
        int[] array = new int[str.Length];
        int lastloc = 0, spaceloc = -1;

        for (int i = 0; i < str.Length; i++)
        {
            if (str[i] == ' ')
            {
                array[lastloc++] = int.Parse(str.Substring(spaceloc + 1, i - spaceloc - 1));
                spaceloc = i;
            }
            else if (i == str.Length - 1)
            {
                array[lastloc++] = int.Parse(str.Substring(spaceloc + 1, i - spaceloc));
            }
        }

        Array.Resize(ref array, lastloc);

        return array;
    }
}

class Example
{
    static void Main()
    {
        int[] ans;
        quiz ex = new quiz();

        //while (true)
        //{
            ans = ex.ParseIntBySpace(Console.ReadLine());

            Console.WriteLine(ex.solve(ans[0], ans[1], ex.ParseIntBySpace(Console.ReadLine())));
        //}
    }
}

Measured memory_bytes: 63840
#include<bits/stdc++.h>
using namespace std;
struct st
{
    int tree[1600005],cov[1600005];
    void pushdown(int x)
    {
        if(!cov[x])return;
        tree[x*2]=tree[x*2+1]=cov[x*2]=cov[x*2+1]=cov[x];
        cov[x]=0;
    }
    void modify(int l,int r,int x,int a,int b,int c)
    {
        if(l>=a&&r<=b){tree[x]=cov[x]=c;return;}
        int mid=(l+r)>>1;
        pushdown(x);
        if(a<=mid)modify(l,mid,x*2,a,b,c);
        if(b>mid)modify(mid+1,r,x*2+1,a,b,c);
    }
    int query(int l,int r,int x,int a)
    {
        //cout<<l<<" "<<r<<" "<<x<<" "<<a<<endl;
        pushdown(x);
        if(l==r)return tree[x];
        int mid=(l+r)>>1;
        if(a<=mid)return query(l,mid,x*2,a);
        return query(mid+1,r,x*2+1,a);
    }
}T1,T2;
bool visited1[200005],visited2[200005];
int main()
{
    int n,q,c,x;
    scanf("%d%d",&n,&q);
    for(int i=1;i<=800000;i++)T1.tree[i]=T2.tree[i]=n;
    long long ans=1ll*(n-2)*(n-2);
    while(q--)
    {
        scanf("%d%d",&c,&x);
        if(c==1)
        {
            if(visited1[x])continue;
            visited1[x]=1;
            int t=T1.query(1,n,1,x)-1;
            //cout<<t<<endl;
            if(t==1||t==0)continue;
            ans-=t-1;
            if(T2.query(1,n,1,1)>x)T2.modify(1,n,1,1,t,x);
        }
        else
        {
            if(visited2[x])continue;
            visited2[x]=1;
            int t=T2.query(1,n,1,x)-1;
            //cout<<t<<endl;
            if(t==1||t==0)continue;
            ans-=t-1;
            if(T1.query(1,n,1,1)>x)T1.modify(1,n,1,1,t,x);
        }
        //cout<<ans<<endl;
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 19256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b; cin >> a >> b;
	for (int i = 1; i <= int(1e6); i++) {
		if (i * 8 / 100 == a and i * 10 / 100 == b) {
			cout << i;
			return 0;
		}
	}
	cout << -1;
}

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

int main( void )
{
  string S;
  cin >> S;
  int price = 700;
  
  for( int i = 0; i < 3; i++ ) {
    if( S.at( i ) == 'o' )
      price += 100;
  }
  cout << price << endl;
  
}
  

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
int n,a[100005];
int main(){
   scanf("%d",&n);
   for(int i=1;i<=n;i++)
      scanf("%d",&a[i]);
   n = unique(a+1,a+n+1) - a - 1;
   a[n+1] = 1000000005;
   int ans = 0;
   int type = 1;
   int zero = 0;
   for(int i=1;i<=n;i++){
      if (!zero){
         type = (a[i] < a[i+1]);
         ans++;
         zero = 1;
         continue;
      }
      if (type == 1){
         if (a[i] < a[i+1]) continue;
         else zero = 0;
      }
      else{
         if (a[i] > a[i+1]) continue;
         else zero = 0;
      }
   }
   printf("%d",ans);
}


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

#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif

#ifdef __WIN32
#define LLFORMAT "I64"
#define Rand() ((rand() << 15) + rand())
#else
#define LLFORMAT "ll"
#define Rand() (rand())
#endif

using namespace std;

const int maxn = 110;

const long long oo = 1ll << 62;

int n, dep[maxn], par[maxn], mx[maxn];
long long ans;
vector<int> g[maxn], v;

void dfs(int u, int p = 0) {
	par[u] = p;
	dep[u] = dep[p] + 1;
	for (int v: g[u]) {
		if(v != p) {
			dfs(v, u);
		}
	}
	return;
}

void dfs2(int u, int p, int d = 0) {
	int cnt = 0;
	for (int v: g[u]) {
		if(v != p) {
			dfs2(v, u, d + 1);
			++cnt;
		}
	}
	debug("dfs2(%d, %d) cnt = %d\n", u, p, cnt);
	mx[d] = max(mx[d], cnt);
	return;
}

void F2(int u, int v) {
	debug("F2(%d, %d)\n", u, v);
	for (int i = 0; i < maxn; ++i) {
		mx[i] = 0;
	}
	dfs2(u, v);
	dfs2(v, u);
	long long ret = 1;
	for (int i = 0; i < maxn; ++i) {
		if(!mx[i]) {
			break;
		}
		ret = (long long) ret * mx[i];
	}
	ans = min(ans, ret * 2);
}

int main(int argc, char *argv[]) {
	scanf("%d", &n);
	for (int i = 1; i < n; ++i) {
		int u, v;
		scanf("%d%d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(1);
	int S = 1;
	for (int u = 1; u <= n; ++u) {
		if(dep[u] > dep[S]) {
			S = u;
		}
	}
	dfs(S);
	int T = 1;
	for (int u = 1; u <= n; ++u) {
		if(dep[u] > dep[T]) {
			T = u;
		}
	}
	for (int u = T; u; u = par[u]) {
		v.push_back(u);
	}
	ans = oo;
	if(v.size() % 2 == 1) {
		printf("%d ", v.size() / 2 + 1);
		int root = v[v.size() / 2];
		for (int i = 0; i < maxn; ++i) {
			mx[i] = 0;
		}
		for (int u: g[root]) {
			dfs2(u, root);
		}
		long long ret = 1;
		for (int i = 0; i < maxn; ++i) {
			if(!mx[i]) {
				break;
			}
			ret = (long long) ret * mx[i];
		}
		ans = min(ans, ret * (long long) g[root].size());
		for (int u: g[root]) {
			F2(root, u);
		}
	}
	else {
		printf("%d ", v.size() / 2);
		F2(v[v.size() / 2], v[v.size() / 2 - 1]);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
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; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = (1 << 30);

int main() {
  int h, n;
  cin >> h >> n;
  vector<int> dp(22222, INF);
  vector<int> A(n);
  vector<int> B(n);
  rep(i, n){
    cin >> A[i] >> B[i];
  }
  dp[0] = 0;
  rep(i, n){
    rep(j, 22222){
      if(j < A[i]){
        continue;
      }else{
        dp[j] = min(dp[j], dp[j - A[i]] + B[i]);
      }
    }
  }
  int ans = INF;
   for(int i=h;i<22222;i++) chmin(ans, dp[i]);
   cout << ans << endl;
}

Measured memory_bytes: 3684
#include <iostream>
#include <stack>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;
#define endl "\n"

int main() {
    ios::sync_with_stdio(false);
    int N,M,C,ans=0;
    int a;
    cin>>N>>M>>C;
    vector<int>B(M,0);
    for(int i=0;i<M;i++){
        cin>>B[i];
    }
    for(int i=0;i<N;i++){
        int sum=0;
        for(int j=0;j<M;j++){
            cin>>a;
            sum+=a*B[j];
        }
        sum+=C;
        if(sum>0)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

const int N = 200001;

int n;
vector <int> v[N];

pair <int, int> dfs(int node, int pnode, int dep){
    auto ret = make_pair(dep, node);
    for(auto &i : v[node]){
        if(i == pnode) continue;
        ret = max(ret, dfs(i, node, dep + 1));
    }
    return ret;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for(int i = 0 ; i < n - 1 ; i++){
        int x, y;
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    int d = dfs(dfs(1, 0, 1).second, 0, 1).first;
    if((d - 2) % 3) cout << "First\n";
    else cout << "Second\n";
}


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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

// 条件
// 0. 目標より大きい数字が存在する
// 1. 互いに素な組が存在する
// 2. なかった時、目標より大きい数字

LL gcd(LL bigger,LL smaller) {
    if (bigger % smaller != 0) {
        return gcd(smaller,(bigger % smaller));
    }
    return smaller;
}

int main(int argc, char const* argv[])
{
    int N,K;
    string ok = "POSSIBLE", ng = "IMPOSSIBLE";
    cin >> N >> K;
    VI a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        if (a[i] == K) {
            cout << ok << endl;
            return 0;
        }
    }

    SORT(a);

    if (a.back() < K) {
        cout << ng << endl;
        return 0;
    }

    if (N == 1) {
        cout << ng << endl;
        return 0;
    }

    LL whole_gcd = gcd(a[0],a[1]);
    for (int i = 2; i < N; i++) {
        whole_gcd = gcd(whole_gcd,a[i]);
    }

    if (whole_gcd == 1) {
        cout << ok << endl;
        return 0;
    }

    for (int i = a.back(); i >= K; i -= whole_gcd) {
        if (i == K) {
            cout << ok << endl;
            return 0;
        }
    }

    cout << ng << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define f(i,a,b) for(int i = a; i < b; i++)
#define fd(i,a,b) for(int i = a; i > b;i--)
#define long long ll;
#define fl(i,a,b) for(ll i = a; i < b; i++)
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VS vector<string>
#define VL vector<long long>
#define VC vector<char>
#define VF vector<float>
#define PB push_back
#define F first
#define S second
#define fa(i,skill) for(auto i : skill)
#define fr(i,skill) for(VI :: reverse_iterator i = skill.rbegin(); i != skill.rend(); i++)
using namespace std;
 void edit(VI &skill,int n)
{
    f(i,0,n)
        {
            int x;
            cin >> x;
            skill.PB(x);
        }
}

void achilles()
{
    int n,x,t;cin >> n >> x >> t;
    int p;
    p = n / x;
    if(n % x != 0)
        p++;
    cout << p * t << "\n";
}
int main()
{
    achilles();
    return 0;
}


Measured memory_bytes: 3624
<?php 
  fscanf(STDIN,"%d",$n);
  $a = explode(" ",trim(fgets(STDIN)));
  $ans = array();
  for($i=0; $i<count($a); $i++){
    $ans[$a[$i]] += 1;
  }

  for($i=1; $i<=$n; $i++){
    if(array_key_exists($i,$ans)){
      echo $ans[$i]."\n";
    }else{
      echo "0\n";
    }
  }

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	vector<int> a(3);
	for (int i=0; i<3; i++)
		cin>>a[i];
	sort(a.begin(),a.end());
	cout<<a[0]*a[1]/2<<"\n";
	return 0;
}

Measured memory_bytes: 256
def main():
    N=int(input())

    ac=0
    wa=0
    tle=0
    re=0
    for i in range(N):
        j=input("")
        if j=="AC":
            ac+=1
        elif j=="WA":
            wa+=1
        elif j=="TLE":
            tle+=1
        else:
            re+=1
    print("AC x {}".format(ac))
    print("WA x {}".format(wa))
    print("TLE x {}".format(tle))
    print("RE x {}".format(re))

if __name__=="__main__":
    main()

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

template<int m>
struct modint {

	unsigned x;

	modint() : x(0) {}

	modint(long long arg) {
		arg %= m;
		if (arg < 0) {
			x = arg + m;
		} else {
			x = arg;
		}
	}	

	modint& operator+= (const modint& other) {
		x += other.x;
		if (x >= m) {
			x -= m;
		}
		return *this;
	}

	modint& operator*= (const modint& other) {
		x = (x * 1ull * other.x) % m;
		return *this;
	}

	modint& operator-= (const modint& other) {
		x += m - other.x;
		if (x >= m) {
			x -= m;
		}
		return *this;
	}

	modint operator+ (const modint& other) const {
		modint tmp = *this;
		tmp += other;
		return tmp;
	}

	modint operator- (const modint& other) const {
		modint tmp = *this;
		tmp -= other;
		return tmp;
	}

	modint operator* (const modint& other) const {
		modint tmp = *this;
		tmp *= other;
		return tmp;
	}

	explicit operator int () const {
		return x;
	}

	modint& operator++ () {
		++x;
		if (x == m) {
			x = 0;
		}
		return *this;
	}

	modint& operator-- () {
		if (x == 0) {
			x = m-1;
		} else {
			--x;
		}
		return *this;
	}

	modint operator++ (int) {
		modint tmp = *this;
		++*this;
		return tmp;
	}

	modint operator-- (int) {
		modint tmp = *this;
		--*this;
		return tmp;
	}

	bool operator== (const modint& other) const {
		return x == other.x;
	}

	bool operator!= (const modint& other) const {
		return x != other.x;
	}

	template<class T>
	modint operator^ (T arg) const {
		if (arg == 0) {
			return 1;
		}
		if (arg == 1) {
			return x;
		}
		auto t = *this ^ (arg >> 1);
		t *= t;
		if (arg & 1) {
			t *= *this;
		}
		return t;
	}

	template<class T>
	modint operator^= (T arg) {
		return *this = *this ^ arg;
	}

	modint inv() const {
		return *this ^ (m-2);
	}
};

const int MOD = 998244353;
typedef modint<MOD> mint;

int n;
int d[100005], c[100005];

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

	cin >> n;
	for (int i=1; i<=n; i++) {
		cin >> d[i];
		c[d[i]]++;
	}
	if (n == 1) {
		cout << (d[1] == 0 ? 1 : 0) << '\n';
		return 0;
	}

	if (d[1] != 0 || *min_element(d+2, d+n+1) == 0) {
		cout << "0\n";
		return 0;
	}

	mint sol = 1;
	for (int i=2; i<=n; i++) {
		sol *= c[d[i]-1];
	}

	cout << (int)sol << '\n';
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <bitset>

using namespace std;

int main(){

    string S;
    cin >> S;
    int N = 1<<(S.size()-1);
    long long ans(0);
    int l, t;
    unsigned int bit;
    
    for(int i=0;i<N;++i){
        bit = i + (1<<S.size());
        l = 0;
        t = 1;
        while(bit>0){
            // cout << bitset<8>(bit) << endl;
            if(bit & 1==1) {
                ans += stol( S.substr(l,t) );
                // cout << ans << endl;
                l += t;
                t = 1;
            }else{
                ++t;
            }
            bit >>= 1;
        }
    }
    
    cout << ans << endl;
    return 0;
}


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

int main() {
  int i, N, temp, MAX = 200000, A[MAX] = {};
  cin >> N;

  for (i = 0; i < N - 1; i++) {
    cin >> temp;
    A[temp - 1]++;
  }

  for (i = 0; i < N; i++) {
    cout << A[i] << endl;
  }
}


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

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

            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                array[i] = sc.nextInt();
            }
            Arrays.sort(array);

            double res = (array[0] + array[1]) / 2.0;
            for (int i = 2; i < n; i++) {
                res = (res + array[i]) / 2.0;
            }
            System.out.println(res);
        }
    }
}



Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <map>

using namespace std;

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

    vector <int> b(N);
    vector <int> c(N);
    for (int i = 0; i < N; i++){
        cin >> b[i];
        c[i] = b[i];
    }
    
    vector <int> ans(N);
    bool f = true;

    int count = 0;
    while (ans[N - 1] == 0 && f == true){
        for (int i = N - 1; i >= 0; i--){
            if (c[i] == 1){
                ans[count] = i + 1;
                count ++;
                c[i] --;
                break;
            }else if(i == 0){
                f = false;
            }
            c[i] --;
        }
    }
    
    if (f == true){
        for (int i = 0; i < N; i++){
            cout << b[ans[i] - 1] << endl;
        }
    }else{
        cout << -1 << endl;
    }
    
    
    
    

    return 0;
}

Measured memory_bytes: 256
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc102_a.cpp
 * time   : Thu Apr 30 21:42:07 2020
 * quest  : A - Multiple of 2 and N
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  cout << (n % 2 ? n * 2 : n) << "\n";
  return 0;
}


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

int main() {
    int m, n, sum;
    int seq[102][102];
    int a[102];

    cin >> m >> n;
    for (int i = 1; i <= m; ++i) {
        for (int j = 1; j <= n; ++j) {
            cin >> seq[i][j];
        }
    }
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }

    // calculation
    for (int i = 1; i <= m; ++i) {
        sum = 0;
        for (int j = 1; j <= n; ++j) {
            sum += seq[i][j] * a[j];
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 3128
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <bitset>
#include <map>
#include <cstring>
#include <cstdlib>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)

using namespace std;

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

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int main(void){
	int N, M;
	string A[51], B[51];
	cin >> N >> M;
	REP(i, N){
		cin >> A[i];
	}
	REP(i, M){
		cin >> B[i];
	}
	REP(i, N){
		REP(j, N){
			if(i + M > N) continue;
			if(j + M > N) continue;
			bool flag = true;
			REP(s, M){
				REP(t, M){
					if(A[i+s][j+t] != B[s][t]) flag = false;
				}
			}
			if(flag){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}


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

long long calc(string s){
  int N = s.size();
  long long ret = stoll(s);
  
  //recursive step
  for(int i=1;i<N;i++){
    string sl = s.substr(0,i);
    ret += stoll(sl)*pow(2,N-i-1);
    string sr = s.substr(i,N-i);
    ret += calc(sr);
  }
  
  return ret;
}

int main(){
  string s;
  cin >> s;
  cout << calc(s) << endl;
  
}

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

#define N 50

int graph[N][N];
int visited[N];
int n, m;

void dfs(int v){
    visited[v] = 1;
    for(int v2 = 0; v2 < n; v2++){
        if(graph[v][v2] == false){
            continue;
        }
        if(visited[v2] == true){
            continue;
        }
        dfs(v2);
    }
    
}

int main(){
    //int n, m;
    cin >> n >> m;

    int a[N], b[N];
    

    for(int i = 0; i < m; i++){
        cin >> a[i] >> b[i];
        graph[a[i]-1][b[i]-1] = graph[b[i]-1][a[i]-1] = 1;
    }

    int ans = 0;

    for(int i = 0; i < m; i++){
        graph[a[i]-1][b[i]-1] = graph[b[i]-1][a[i]-1] = 0;

        for(int j = 0; j < n; j++){
            visited[j] = 0;
        }

        dfs(0);

        bool bridge = false;
        for(int j = 0; j < n; j++){
            if(visited[j] == false) {
                bridge = true;
            }
        }
        if(bridge) {
            ans++;
        }

        graph[a[i]-1][b[i]-1] = graph[b[i]-1][a[i]-1] = 1;
    }

    cout << ans << endl;


    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>

using ll = long long;

int main()
{
    int N, M, X, Y;
    std::cin >> N >> M >> X >> Y;

    std::vector<int> x(N), y(M);
    for (int i = 0; i < N; i++)
    {
        std::cin >> x[i];
    }
    for (int i = 0; i < M; i++)
    {
        std::cin >> y[i];
    }

    std::sort(x.begin(), x.end());
    std::sort(y.begin(), y.end());
    int minY = y[0];
    if (x[N - 1] < minY && X < minY && minY <= Y)
    {
        std::cout << "No War" << std::endl;
    }
    else
    {
        std::cout << "War" << std::endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
  int x;
  
  cin >> x;
  if (x<1200){
    cout << "ABC" << endl;
  } else if (x < 2800){
    cout << "ARC" << endl;
  } else {
    cout << "AGC" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define int long long
#define endre getchar();getchar();return 0
#define INF 1000000007
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return kai(n - 1)*n;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int n, a[200005];
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] -= i + 1;
	}
	sort(a, a + n);
	int memo = a[n / 2], cnt = 0;
	for (int i = 0; i < n; i++) {
		cnt += abs(memo - a[i]);
	}
	cout << cnt << endl;
	endre;
}


Measured memory_bytes: 1792
import sys
N = int(input())
a = list(map(int, input().split()))
count = [0]*N
for ai in a:
    count[ai]+=1
m = max(a)
if min(a)<m-m//2:
    print('Impossible')
    sys.exit()
flag = True
for i in range(m, m-m//2-1, -1):
    if m%2 == 0 and i == m//2:
        if count[i] != 1:
            flag = False
            break
    elif m%2 == 1 and i == m//2+1:
        if count[i] != 2:
            flag = False
            break
    else:
        if count[i] <= 1:
            flag = False
            break
if flag:
    print('Possible')
else:
    print('Impossible')


Measured memory_bytes: 38384
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s;
	int w;
	cin >> s >> w;
	for (int i = 0; i < s.length(); i++) {
		if (i % w == 0) {
			cout << s[i];
		}
	}
	cout << endl;

	return 0;
}

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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

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

#define rep(i, j, k) for (int i = j; i < k; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 60);

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int N, K;
    cin >> N >> K;

    int sum = 0;
    rep(i, K, N + 2) {
        sum += (N + 1) * i - i * i + 1;
        sum %= mod;
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3656
import numpy as np

n,m = map(int,input().split())
base = np.zeros(n)
pena = np.zeros(n)

for i in range(m):
  s = list(input().split())
  if (s[1] == "WA") and (base[int(s[0])-1] == 0):
    pena[int(s[0])-1] += 1
  elif (s[1] == "AC"):
    base[int(s[0])-1] = 1
    
ans_1 = np.multiply(base,pena)
print(int(np.sum(base)),int(np.sum(ans_1)))

Measured memory_bytes: 14668
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
typedef long long int lli;
int map[10][10];
int main(void){
  lli N;
  cin >> N;
  for(lli i=1;i<=N;i++){
    int low = i%10;
    string str = to_string(i);
    char c = str[0];
    int up = atoi(&c);
    //cout << i << " " << up << endl;
    map[up][low]++;
  }
  lli num = 0;
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      num = num + map[i][j]*map[j][i];
      //cout << i << j << " " << map[i][j] << endl;
    }
  }
  cout << num << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
char c[5000][5000];
int x[5000];
int ans[5000];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	bool ok=false;
	for(int i=0;i<b;i++){
		int d,e;
		scanf("%d%d",&d,&e);
		d--;e--;
		c[d][e]=1;
		c[e][d]=2;
		x[e]++;
	}
	for(int i=0;i<a;i++){
		int v=0;
		int at=0;
		for(int j=0;j<a;j++){
			if(x[j]==0){
				at=j;
				v++;
			}
		}
		if(v>1)ok=true;
		x[at]=99999999;
		ans[i]=at;
		for(int j=0;j<a;j++)if(c[j][at]==2)x[j]--;
	}
	for(int i=0;i<a;i++)printf("%d\n",ans[i]+1);
	if(ok)printf("1\n");
	else printf("0\n");
}

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

using namespace std;

typedef long long ll;

struct Calc{
  ll p;
  string s;
  string::iterator it;

  Calc(ll p,string s) : p(p), s(s) {
    it = s.begin();
  }

  ll add(ll a,ll b){
    return (a + b) % p;
  }

  ll sub(ll a,ll b){
    return (a - b + p) % p;
  }

  ll mul(ll a,ll b){
    return (a * b) % p;
  }

  ll mod_pow(ll x,ll n){
    if(n == 0LL){ return 1LL; }
    ll res = mod_pow(x*x%p,n/2LL);
    if(n & 1LL){ res = res * x % p; }
    return res;
  }

  ll fact(){
    ll res = 0LL;
    if(*it == '('){
      ++it;
      res = exp();
      ++it;
    }else{
      while(isdigit(*it)){
        res *= 10LL;
        res += (*it-'0');
        ++it;
      }
    }
    return res;
  }

  ll term(){
    ll res = fact();
    while(*it == '*' || *it == '/'){
      if(*it == '*'){
        ++it;
        res = mul(res,fact());
      }else if(*it == '/'){
        ++it;
        ll x = fact();
        if(x == 0LL){ throw 0; }
        res = mul(res,mod_pow(x,p-2LL));
      }
    }
    return res;
  }

  ll exp(){
    ll res = term();
    while(*it == '+' || *it == '-'){
      if(*it == '+'){
        ++it;
        res = add(res,term());
      }else if(*it == '-'){
        ++it;
        res = sub(res,term());
      }
    }
    return res;
  }
};

string compress(string s){
  string res;
  for(int i = 0 ; i < (int)s.size() ; i++){
    if(s[i] != ' '){ res += s[i]; }
  }
  return res;
}

int main(){
  ll p;
  string in;
  while(getline(cin,in),in != "0:"){
    string s;
    int i;
    in = compress(in);
    for(i = 0 ; i < (int)in.size() ; i++){
      if(in[i] == ':'){ break; }
      s += in[i];
    }
    stringstream ss(s);
    ss >> p;
    in = in.substr(i+1); 
    Calc c(p,in);
    try{
      ll res = c.exp();
      cout << in << " = " << res << " (mod " << p << ")" << endl;
    }catch(...){
      cout << "NG" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int mod=1000000007;
int main()
{
	string s;
	cin>>s;
	if(s=="ABC") cout<<"ARC";
	else cout<<"ABC";
	return 0;
}

Measured memory_bytes: 3628
C = [[int(i) for i in input().split()] for _ in range(3)]

D = [[] for _ in range(4)]
for i in range(2):
    for j in range(3):
        D[i].append(C[i+1][j] - C[i][j])
        D[i+2].append(C[j][i+1] - C[j][i])

for d in D:
    if len(set(d)) != 1:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 9096
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9+7
int mpc(int i,int n,int a[],int hash[],int k)
{
    if(hash[i]!=-1)
    return hash[i];
    
    if(i==0)
    {
        hash[i]=0;
    }
  
    else
    {
        int temp=inf;
        for(int j=1;j<=k;j++)
        {   if(i-j>=0)
            temp=min(mpc(i-j,n,a,hash,k)+abs(a[i]-a[i-j]),temp);
            else break;
        }
        hash[i]=temp;
        
    }
    return hash[i];
    

}
int main()
{
    int n,k;
    cin>>n>>k;
    int a[n],hash[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        hash[i]=-1;
    }
    cout<<mpc(n-1,n,a,hash,k);
}

Measured memory_bytes: 10368