akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 998244353;


int main() {
    int n; cin >> n;
    vector<ll> as(n), bs(n);
    rep(i, n) {
        cin >> as[i]; 
        cin >> bs[i];
    }
    sort(all(as)); sort(all(bs));
    ll ret; 
    if (n%2) {
        ll a = as[(n-1)/2];
        ll b = bs[(n-1)/2];
        ret = b - a + 1;
    } else {
        ll a = as[n/2] + as[(n/2)-1];
        ll b = bs[n/2] + bs[(n/2)-1];
        ret = b - a + 1;
    }
    cout << ret << endl; 
    return 0;
}

Measured memory_bytes: 6300
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int n;

int main()
{
    cin >> n;
    string ans = n >= 1000 ? "ABD" : "ABC";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)

NM = [int(x) for x in input().split()]
NM.sort()
N = NM[0]
M = NM[1]

if N == 1:
    if M >= 3:
        ans = M - 2
    elif M == 1:
        ans = 1
    else:
        ans = 0

    print(ans)
    exit()
elif N == 2:
    print(0)
    exit()

ans = (N - 2) * (M - 2)

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

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

  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<int> cumul(n);

  for(int i = 1; i < n; i++) {
    cumul[i+1] = cumul[i];
    if(s[i-1]=='A' && s[i]=='C') ++cumul[i+1];
  }

  rep(i, q) {
    int l, r; cin >> l >> r;
    cout << cumul[r] - cumul[l] << '\n';
  }
  return 0;
}


Measured memory_bytes: 1488
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,x,a[111111]={},b[111111]={};
	cin>>n>>x;
	LL ans=0;
	FOR(i,0,n){
		cin>>a[i];
		int t;
		if(a[i]>x){
			t=a[i]-x;
			a[i]-=t;
			ans+=t;
		}
	}
	FOR(i,0,n-1){
		int t=a[i]+a[i+1];
		if(t>x){
			int tt=t-x;
			ans+=tt;
			if(a[i+1]>=tt){
				a[i+1]-=tt;
			}else{
				a[i+1]=0;
				tt-=a[i+1];
				a[i]-=tt;
			}
		}
	}
	cout<<ans<<endl;
    return 0;
}


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

class TreeDiameter {
public:
  int V;
  vector<vector<int>> G;
  vector<int> diameter;
  TreeDiameter(int node_size) : V(node_size),  G(V) {}
  void add(int u, int v) {
    G.at(u).push_back(v), G.at(v).push_back(u);
  }
  void dfs(int u, int p, int d, int &far, int &mx) {
    if (mx < d) {
      far = u;
      mx = d;
    }
    for (int v : G.at(u)) {
      if (v != p) {
        dfs(v, u, d + 1, far, mx);
      }
    }
  }
  bool redfs(int u, int p, const int t) {
    if (u == t) {
      return true;
    }
    for (int v : G.at(u)) {
      if (v != p) {
      diameter.push_back(v);
      if (redfs(v, u, t)) {
        return true;
      } else {
        diameter.pop_back();
      }
      }
    }
    return false;
  }
  void solve() {
    int s, t, mx;
    mx = -1;
    dfs(0, -1, 0, s, mx);
    mx = -1;
    dfs(s, -1, 0, t, mx);
    diameter.push_back(s);
    redfs(s, -1, t);
  }
};

int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  TreeDiameter TD(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    TD.add(--a, --b);
  }
  TD.solve();
  int D = TD.diameter.size() - 1;
  cout << ((D % 3 == 1) ? "Second" : "First") << "\n";
}

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

using namespace std;

int main(){
    int res = 0, n, x = 0;
    string s;
    cin>>n;
    cin>>s;
    for(int i = 0; i < n; i++){
        if(s[i] == 'I') x++;
        else if(s[i] == 'D') x--;
        res = max(res,x);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
S = input()
N = len(S)

def is_kaibun(kaibun):
    for i in range(len(kaibun) // 2):
        if kaibun[i] != kaibun[-i - 1]:
            return False
    return True

if is_kaibun(S) and is_kaibun(S[:int((N - 1) / 2)]) and is_kaibun(S[int((N + 3) / 2 - 1):]):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
import sys
s = list(input())
front, back = list(), list()

repeat = (len(s)-1) // 2
for i in range(repeat):
    if s[i] == s[len(s)-1-i]:
        front.append(s[i])
        back.append(s[len(s)-1-i])
    else:
        print('No')
        sys.exit()

if len(front) % 2 == 0:
    repeat = len(front) // 2
else:
    repeat = (len(front)-1) // 2        

for i in range(repeat):
    if front[i] == front[len(front)-1-i] and back[i] == back[len(back)-1-i]:
        pass
    else:
        print('No')
        sys.exit()
        
print('Yes')

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

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





///////////////////////////


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

	string ans = "Three";

	repn(i, N) {
		char S;
		cin >> S;
		if (S == 'Y') { ans = "Four"; }
	}

	cout << ans;

	system("PAUSE");

}


Measured memory_bytes: 504
s = input()

a_pos = (len(s)-1) // 2
b_pos = (len(s)+3) // 2 - 1

s_first = s[:a_pos]
s_second = s[b_pos:]

if s == s[::-1]:
    if s_first == s_first[::-1]:
        if s_second == s_second[::-1]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 2940
// https://atcoder.jp/contests/abc096/tasks/abc096_c

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int H, W;
string s, ls, ns, es;
bool r = true;

bool chk(int i)
{
  if (ls[i] == '#' || ns[i] == '#')
    return true;
  else if (0 < i && s[i - 1] == '#')
    return true;
  else if (i < W - 1 && s[i + 1] == '#')
    return true;
  else
    return false;
}

int main()
{
  es = "";
  cin >> H >> W;
  REP(i, W)
  {
    es += '.';
  }
  ls = s = es;
  REP(i, H)
  {
    cin >> ns;
    REP(j, W)
    {
      if (r && s[j] == '#')
        r = chk(j);
    }
    ls = s;
    s = ns;
  }
  ns = es;
  REP(i, W)
  {
    if (r && s[i] == '#')
      r = chk(i);
  }

  cout << (r ? "Yes" : "No") << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}


int main(void) {
  ll Q;
  cin >> Q;
  ll i;
  set<ll> sa;
  ll sb=0;
  
  ll l=0, r=0;
  ll p=0;
  ll cnt=0;
  priority_queue<ll> ql, qr;
  
  for(i=0; i<Q; i++) {
    ll c;
    cin >> c;
    
    if(c==1) {
      ll a, b;
      cin >> a >> b;
      
      sb+=b;
      if(i==0) {
        p=a;
        cnt++;
        continue;
      }
      
      if(cnt%2==1) {
        if(a<p) {
          ql.push(a);
          l+=a;
          qr.push(-p);
          r+=p;
          p=ql.top();
          cnt++;
        }else {
          ql.push(p);
          l+=p;
          qr.push(-a);
          r+=a;
          p=ql.top();
          cnt++;
        }
      }else if(cnt%2==0) {
        if(a<p) {
          ql.push(a);
          l+=a;
          p=ql.top(); ql.pop();
          l-=p;
          cnt++;
        }else {
          qr.push(-a);
          r+=a;
          p=-qr.top(); qr.pop();
          r-=p;
          cnt++;
        }
      }
    
    }else if(c==2) {
      
      pt(p<<" "<<r-l+sb);
      
    }
    
  }
  
  
  
  
}












Measured memory_bytes: 3828
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
#define LL long long

LL C(int n,int m)
{
    LL ret = 1;
    int x = 2;
    for (int i=n-m+1;i<=n;i++)
    {
        ret *= i;
        while (x<=m&&ret%x==0)
        {
            ret /= x;
            x++;
        }
    }
    return ret;
}

int main()
{
    int n,p;
    scanf("%d%d",&n,&p);
    int ji=0,ou=0;
    for (int i=0;i<n;i++)
    {
        int xxx;
        scanf("%d",&xxx);
        if (xxx%2==1) ji++;
        else ou++;
    }
    LL ans = 0;
    if (p==1)
    {
        for (int i=0;i<=ji;i++)
            if (i%2==1)
                ans += C(ji,i);
        ans <<= ou;
    }
    else
    {
        for (int i=0;i<=ji;i++)
            if (i%2==0)
                ans+= C(ji,i);
        ans <<= ou;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int simbol(char a){
  if(a=='M')return 0;
  else if(a=='D')return 1;
  else if(a=='C')return 2;
  else if(a=='L')return 3;
  else if(a=='X')return 4;
  else if(a=='V')return 5;
  else if(a=='I')return 6;
  else return 7;
}

int trans(int value[],char str[100],int pos){
  if(simbol(str[pos]) - simbol(str[pos+1]) > 0){
    return -1 * value[simbol(str[pos])];
  }else{
    return value[simbol(str[pos])];
  }
}
    

int main(void){
  int i;
  char roman[100];
  int value[] = {1000,500,100,50,10,5,1,0};
  int len;
  int sum;

  while(scanf(" %s ",roman)!=EOF){

    sum = 0;
    len = strlen(roman);

    for(i=0;i<len-1;i++){
      sum += trans(value,roman,i);
    }

    sum += value[simbol(roman[len-1])];

    printf("%d\n",sum);
  }


  return 0;
}  

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;

int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;

	ll k, n;
	cin >> n >> k;
	vector<double> p(n);
	vector<double> m(n);
	rep(i, n)
	{
		cin >> p[i];
		m[i] = (1 + p[i]) * p[i];
		m[i] /= 2.0;
		m[i] /= p[i];
	}
	for (int i = 1; i < n; i++)
	{
		m[i] += m[i - 1];
	}
	double ans = 0;
	ans = m[k-1];

	for (int i = 1; i <= n - k; i++)
	{
		ans = max(ans, m[i + k-1] - m[i - 1]);
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 3456
def main():

    S, W = input_ints()
    if S > W:
        print('safe')
    else:
        print('unsafe')
      

def input_int():
    return int(input())


def input_ints():
    return map(int, input().split())


def input_int_list_in_line():
    return list(map(int, input().split()))


def input_int_tuple_list(n: int, q: int):
    return [tuple(map(int, input().split())) for _ in range(n)]


main()


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int minus_sum = 0;
    ll ans = 0;
    rep(i,n) {
        if(a[i] < 0) minus_sum++;
    }
    if(minus_sum % 2 == 0) {
        rep(i,n) {
            if(a[i] < 0) a[i] *= -1;
        }
        rep(i,n) ans += a[i];
    }
    else {
        int x = 1e9;
        rep(i,n) {
            if (a[i] >= 0) {
                x = min(x,a[i]);
                continue;
            }
            else {
                a[i] *= -1;
                x = min(x,a[i]);
            }
        }
        rep(i,n) ans += a[i]; 
        ans -= 2 * x;       
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>

using namespace std;
typedef long long ll;

ll seg[1 << 18];
int size;

void init(int n)
{
	size = 1;
	while (size < n) size *= 2;
}

void update(int k, ll x)
{
	k += size - 1;
	seg[k] = x;
	
	while (k){
		k = (k - 1) / 2;
		seg[k] = max(seg[k * 2 + 1], seg[k * 2 + 2]);
	}
}

ll getMax(int a, int b, int k, int l, int r)
{
	if (r <= a || b <= l){
		return (0);
	}
	
	if (a <= l && r <= b){
		return (seg[k]);
	}
	ll lch = getMax(a, b, k * 2 + 1, l, (l + r) / 2);
	ll rch = getMax(a, b, k * 2 + 2, (l + r) / 2, r);
	
	return (max(lch, rch));
}

int main()
{
	ll n;
	ll ans;
	int data;
	
	scanf("%lld", &n);
	
	init(n);
	ans = 0;
	
	for (int i = 0; i < n; i++){
		scanf("%d", &data);
		update(data, getMax(1, data + 1, 0, 0, size) + data);
		ans = max(ans, seg[data + size - 1]);
	}
	
	printf("%lld\n", n * (n + 1) / 2 - ans);
	
	return (0);
}

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

int main(){
    int N;
    cin >> N;
    double ans=0.0,A;
    for(int i=0;i<N;++i){
        cin >>A;
        ans += 1.0/A;
    }
    ans = 1.0/ans;
    cout << setprecision(16) << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
using namespace std;

int main(){
    long long int i;
    long long int a;
    long long int n, k;
    long long int min = 1000000000;
    cin >> n >> k;
    vector<long long int> h;
    for(i=0; i<n; i++){
        cin >> a;
        h.push_back(a);
    }
    sort(h.begin(), h.end());
    for(i=0; i<=n-k; i++){
        if(h[i+k-1] - h[i] < min){
            min = h[i+k-1] - h[i];
        }
    }
    cout << min << endl;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int main ()
{

int W , H, i, j, k, N, h[10000][2];
i  = 0;
k = 0;
do{

	cin >> W >> H;
	h[i][0] = W;
	h[i][1] = H;
	i++;
	k++;
	
}while(W != 0 && H != 0);

for (i = 0; i < k-1;i++)
{

	if(h[i][0] != 0 && h[i][1] != 0)
		{
			for(j = 0;j < h[i][0];j++)
				{	
						for(N = 0;N < h[i][1];N++)
						{
							cout << "#";
						}
						cout  << endl;
				}
		
		cout  << endl;
		}
}

return 0;
}



Measured memory_bytes: 3100
from itertools import combinations_with_replacement as cwr
N,M,Q=map(int,input().split())
A=[]
B=[]
C=[]
D=[]
for _ in range(Q):
    inp=list(map(int,input().split()))
    A.append(inp[0])
    B.append(inp[1])
    C.append(inp[2])
    D.append(inp[3])

all=cwr(range(1,M+1),N)

max_d=0

for tmp in all:
    tmp_d=0
    for i in range(Q):
        if tmp[B[i]-1] - tmp[A[i]-1] == C[i]:
            tmp_d += D[i]
    if max_d < tmp_d:
            max_d = tmp_d
    
print(max_d)

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

const int MOD = 1e9 + 7;
struct mint {
  long long x;
  mint(long long x = 0) :x((x%MOD + MOD) % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(MOD - 2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

int main() {
  int N; cin >> N;
  vector<int> D(64, 0);
  rep(i, N) {
    long long A; cin >> A;
    bitset<64> Bs(A);
    rep(k, 64) if (Bs[k]) D[k]++;
  }

  mint ans = 0;
  mint k = 1;
  rep(i, 64) {
    ans += k * D[i] * (N - D[i]);
    k *= 2;
  }
  cout << ans.x << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, A, B;
  cin >> N >> A >> B;
  vector<long> data(3);
  long a;
  for(int i = 0; i < N; i++){
    cin >> a;
    if(a <= A)data.at(0)++;
    else if(a >= A + 1 && a <= B)data.at(1)++;
    else data.at(2)++;
  }
  cout << min(data.at(0), min(data.at(1), data.at(2))) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

#define DIV 1000000007

using namespace std;

long long N;
long long A[100005];
map<long long, long long> memo;


long long modpow(long long ori, long long po){
	long long res = 1;
	while(po > 0){
		if(po&1){
			res *= ori;
			res %= DIV;
		}
		ori *= ori;
		ori %= DIV;
		po >>= 1;
	}
	return res;
}


int main(){
	cin >> N;
	for(int i = 0; i < N; i++){
		long long tmp;
		cin >> tmp;
		memo[tmp]++;
	}
	if(N%2 == 0){
		for(auto me: memo){
			if(me.first % 2 != 1 || me.first >= N || me.second != 2){
				cout << 0 << endl;
				return 0;
			}
		}
	}else{
		if(memo[0] != 1){
			cout << 0 << endl;
			return 0;
		}
		memo.erase(0);
		for(auto me: memo){
			if(me.first % 2 != 0 || me.first >= N || me.second != 2){
				cout << 0 << endl;
				return 0;
			}
		}
	}
	cout << modpow(2, N/2) << endl;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define o 3005
using namespace std;
int a[o],b[o];
int n,K,Q,ans;
bool check(int l,int r){
	int x=1,y,num=0,zm=0;
	while(x<=n){
		if(a[x]<l){
			x++;
			continue;
		} 
		y=x;
		while(y<n&&a[y+1]>=l) y++;
		zm=0;			
		for(int k=x;k<=y;k++) if(a[k]<=r) zm++;
		num+=min(zm,max((y-x+1)-(K-1),0));
		x=y+1;
	}
	return num>=Q;
}
int main(){
	scanf("%d%d%d",&n,&K,&Q);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),b[i]=a[i];
	
	sort(b+1,b+n+1);
	ans=b[Q]-b[1];
	int sz=1;
	for(int i=2;i<=n;i++) if(b[i]!=b[i-1]) b[++sz]=b[i];
	for(int i=1;i<=sz;i++){
		int l=i,r=sz,mid,as=0;
		while(l<=r){
			mid=(l+r)>>1;
			if(check(b[i],b[mid])) as=mid,r=mid-1;
			else l=mid+1;
		}
		if(as) ans=min(ans,b[as]-b[i]);
	}
	cout<<ans<<endl;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            long[] H = new long[N];
            string[] input = Console.ReadLine().Split(' ');
            for (int i = 0; i < N; i++)
            {
                H[i] = long.Parse(input[i]);
            }
            int count = 0;
            int countMax = 0;
            long currentHeight = H[0];
            for (int i = 1; i < N; i++)
            {
                if (H[i] <= currentHeight)
                {
                    count++;
                    if (count > countMax) countMax = count;
                }
                else
                {
                    if (count > countMax) countMax = count;
                    count = 0;
                }
                currentHeight = H[i];
            }
            Console.WriteLine(countMax.ToString());
//            Console.Read();
        }
    }
}

Measured memory_bytes: 23392
def show(A, n):
    for i in range(n):
        if i != n-1:
            print(A[i], end=' ')
        else:
            print(A[i])


def bubblesort(A, n):
    flag = 1
    count = 0
    while flag:
        flag = 0
        for i in range(n-1):
            if A[i] > A[i+1]:
                A[i], A[i+1] = A[i+1], A[i]
                flag = 1
                count += 1
    show(A, n)
    print(count)


def main():
    n = int(input())
    A = list(map(int, input().split()))
    bubblesort(A, n)


if __name__ == "__main__":
    main()



Measured memory_bytes: 5612
#include <stdio.h>

int main(void){

	int W,H,x,y,r;

	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

	if(r<=x&&x<=W-r&&r<=y&&y<=H-r){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 1012
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <stack>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define For(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}

int whichSection(double dist, int l1, int l2, int l3, int l4, int l5, int l6, int l7, int l8, int l9, int l10) {
    vector<int> l;
    l.push_back(l1);
    l.push_back(l2);
    l.push_back(l3);
    l.push_back(l4);
    l.push_back(l5);
    l.push_back(l6);
    l.push_back(l7);
    l.push_back(l8);
    l.push_back(l9);
    l.push_back(l10);
    int distFromLeftSec = 0;
    REP(i,10) {
        distFromLeftSec += l[i];
        if (distFromLeftSec >= dist) return i+1;
    }
    return -1;
}

int main() {
    int l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,v1,v2;
    char c;
    while(cin>>l1>>c>>l2>>c>>l3>>c>>l4>>c>>l5>>c>>l6>>c>>l7>>c>>l8>>c>>l9>>c>>l10>>c>>v1>>c>>v2) {
        int dist = l1+l2+l3+l4+l5+l6+l7+l8+l9+l10;
        double time = double(dist) / (v1+v2);
        double distFromLest = time * v1;
        cout << whichSection(distFromLest, l1,l2,l3,l4,l5,l6,l7,l8,l9,l10) << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

const int N = 1003;
vector <int> v[N], path, cyc;
bool vis1[N], vis2[N];
int pos[N];

void dfs(int x) {
    if ((int)cyc.size()) return;
    vis1[x] = true;
    vis2[x] = true;
    path.pb(x);
    for (int y : v[x]) {
        if (vis2[y]) {
            int sz = path.size();
            bool is = false;
            for (int i = 0; i < sz; i++) {
                if (path[i] == y) {
                    is = true;
                }
                if (is) {
                    cyc.pb(path[i]);
                }
            }
            return;
        }
        if (!vis1[y]) {
            dfs(y);
            if ((int)cyc.size()) return;
        }
    }
    path.pop_back();
    vis2[x] = false;
}

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i = 0; i < m; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        v[x].pb(y);
    }
    for (int i = 1; i <= n; i++) {
        if (!vis1[i]) {
            dfs(i);
            if ((int)cyc.size()) {
                int sz = cyc.size();
                for (int i = 0; i < sz; i++) {
                    pos[cyc[i]] = i + 1;
                }
                for (int i = 0; i < sz; i++) {
                    int x = cyc[i];
                    int mx1 = 0, mx2 = 0;
                    for (int y : v[x]) {
                        if (pos[y] == 0) continue;
                        if (pos[y] < i + 1) {
                            mx2 = max(mx2, pos[y]);
                        } else {
                            mx1 = max(mx1, pos[y]);
                        }
                    }
                    if (mx2 != 0) {
                        mx2--;
                        for (int j = i + 1; j < sz; j++) {
                            pos[cyc[j]] = 0;
                        }
                        for (int j = 0; j < mx2; j++) {
                            pos[cyc[j]] = 0;
                        }
                        break;
                    } else {
                        mx1--;
                        for (int j = i + 1; j < mx1; j++) {
                            pos[cyc[j]] = 0;
                        }
                        i = mx1 - 1;
                    }
                }
                vector <int> res;
                for (int i = 1; i <= n; i++) {
                    if (pos[i]) {
                        res.pb(i);
                    }
                }
                printf("%d\n", (int)res.size());
                for (auto x : res) {
                    printf("%d\n", x);
                }
                return 0;
            }
        }
    }
    printf("-1");
    return 0;
}


Measured memory_bytes: 3876
#include <iostream>

using namespace std;


int main() {
	int a, b;
	cin >> a >> b;

	int sum = 0;
	for (int i = 0; i < 2; i++) {
		if (a > b) {
			sum += a;
			a--;
		}
		else if (b >= a) {
			sum += b;
			b--;
		}
	}

	cout << sum << endl;

	//system("pause");

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



int main() {
  string a, b;
  cin >> a >> b;
  if(a[0]==b[2] && a[1]==b[1] && a[2]==b[0]) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const double EPS=1e-10;
const ll INF=1000000000;
const ll MAX=100010;
int main(){
    int h,w;
    vector<pair<int,P> > v;
    for(int i=1;i<=150;i++){
        for(int j=i+1;j<=150;j++){
            v.push_back(make_pair(i*i+j*j,P(i,j)));
        }
    }
    sort(all(v));
    while(cin>>h>>w,h+w){
        pair<int,P> p=make_pair(h*h+w*w,P(h,w));
        pair<int,P> ans=*upper_bound(all(v),p);
        cout<<ans.second.first<<" "<<ans.second.second<<endl;
    }
}


Measured memory_bytes: 3252
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int P = 1e9 + 7;
inline int add(int a, int b) {if((a += b) >= P) a -= P; return a;}
inline int sub(int a, int b) {if((a -= b) < 0) a += P; return a;}
inline int mul(int a, int b) {return 1ll * a * b % P;}
inline int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----
const int N = 10101, M = 256;
char s[N];
int n;
vi pos[M];
string gao(string s) {
	set<string> sb;
	rep(i, 0, sz(s)) pos[s[i]].pb(i);
	rep(i, 0, M) {
		rep(j, 0, 100) {
			for(auto & p : pos[i]) {
				if(p + j < sz(s)) {
					string t = s.substr(p, j + 1);
					sb.insert(t);
				}
			}
		}
	}
	int cnt = 0;
	for(auto s : sb) {
		cnt++;
		if(cnt == n) return s;
	}
}
int main(){
	scanf("%s%d", s, &n);
	printf("%s\n", gao(s).c_str());
	return 0;
}


Measured memory_bytes: 66560
#!/usr/bin/env python3
import os
from sys import stdin, stdout
    
    
def solve(tc):
    d, t, s = map(int, stdin.readline().split())

    if d/t<=s:
        print("Yes")
    else:
        print("No")

    
tcs = 1
tc = 1
while tc <= tcs:
    solve(tc)
    tc += 1

Measured memory_bytes: 61696
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<long long> A(N), B(N);
    for(int i=0; i<N; i++) cin >> A[i] >> B[i];
    long long sm = 0;
    long long mn = 1<<30;
    for(int i=0; i<N; i++){
        sm += A[i];
        if(A[i] > B[i])
            mn = min(mn, B[i]);
    }
    if(mn == 1<<30) cout << 0 << endl;
    else cout << sm - mn << endl;


    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int cnt = 0;
    char c = 'E';
    rep(i, s.size()){
        if(c == s[i])cnt++;
        c = s[i];
    }
    int ans = min(cnt + k * 2, n - 1);
    cout << ans << endl;
}

Measured memory_bytes: 512
### coding: UTF-8
import sys

head = sys.stdin.readline()
[n, m] = map(lambda x: long(x), head.split(" "))

amount = 0

# 店の件数分読み込み
rows = [sys.stdin.readline() for _ in range(n)]
rows.sort(key=lambda x: long(x.split(" ")[0]))
for row in rows:
    [ai, bi] = map(lambda x: long(x), row.strip().split(" "))
    # 購入可能な最大数まで買う
    x = bi if m >= bi else m
    amount += ai * x
    m -= x
    if m == 0:
        break

print amount


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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    cin >> k;
    ll ret = 0; 
    for(i=1;i<=k;i++){
        for(j=1;j<=k;j++){
            for(m=1;m<=k;m++){
                ret +=gcd(i,gcd(j,m));
            }
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 555555;
Vi e[N];int n,f[N];
void dfs(int u, int fa){
	per(i,SZ(e[u])-1,0)
		if(e[u][i]!=fa)dfs(e[u][i],u),f[u]^=f[e[u][i]]+1;
}
int main() {
	read(n);rep(i,2,n){int u,v;read(u);read(v);e[u].pb(v);e[v].pb(u);}
	dfs(1,0);if(f[1])puts("Alice");else puts("Bob");
	return 0;
}


Measured memory_bytes: 23168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
int main(){
    ll k, n;
    cin >> k >> n;
    vec<ll> a(n);
    rep(i, n) cin >> a[i];
    //sort(a.begin(), a.end());
    ll max_dis = a[0];
    rep(i, n-1) {
        max_dis = max(max_dis, a[i+1] - a[i]);
    }
    max_dis = max(k + a[0] - a[n-1], max_dis);
    cout << k - max_dis << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
using namespace std;
#define N 31623 //√10^9
int main() {
    int n;
    cin >> n;
    int x = n; //n /= i
    cout << n << ":";
    for (int i = 2; i * i <= x; i++) {
        while (n % i == 0) {
            cout << " " << i;
            n /= i;
        }
    }
    if (n != 1) { //999993031 : 999993031
        cout << " " << n;
    }
    cout << endl;
    return 0;
}



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

using LL = long long;
const LL M = 1e9+7;

string L;

map<pair<int,bool>, LL> memo;
LL dp(int i, bool eq) {
  if(i == L.size()) return 1;
  auto p = make_pair(i, eq);
  if(memo.count(p)) return memo[p];
  LL res = 0;
  if(eq) {
    if(L[i] == '1') res += 2 * dp(i+1, true) + dp(i+1, false);
    else            res += dp(i+1, true);
  } else {
    res += 3 * dp(i+1, false);
  }
  return memo[p] = res % M;
}

int main() {
  cin >> L;
  cout << dp(0, true) << endl;
}


Measured memory_bytes: 20608
import java.util.*;
 
public class Main{
	public static void main(String[] args){
	    Scanner sc = new Scanner(System.in);
    	int num = sc.nextInt();
        int e = 0;
        for(int i = 1; i < num + 1; i++){
            if(num == 1){
            	e = 1;
            }else{
        		for(int j = 2; j < num; j++){
            		if((Math.pow(i,j) <= num) && (e < Math.pow(i,j))){
                		e = (int)Math.pow(i,j);
                	}
            	}
            }
        }
        System.out.println(e);
	}
}

Measured memory_bytes: 35804
#![allow(unused)]

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

fn main() {
    input! {
        k: i64,
        x: i64,
    }

    let ans = (x - k + 1..x + k).fold(String::new(), |s, now| format!("{}{} ", s, now));

    println!("{}", ans.trim());
}


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

typedef long long ll;

int main() {
    int N;
    string S;
    cin >> N >> S;
    int count = 1;
    for (int i=1;i<N;i++){
        if (S[i-1] == S[i]) continue;
        count++;
    }
    cout << count << endl;

    return 0;
}

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

int findAns(vector<int> &A, vector<int> &dp, int i, int &ans)
{
	if(i > A.size())
		return A[i-2];

	if(i == A.size())
		return A[i-1];

	if(dp[i] != INT_MAX)
		return dp[i];


	ans += min(abs(A[i] - findAns(A, dp, i+1, ans)), abs(A[i] - findAns(A, dp, i+2, ans))) ;

	dp[i] = ans;

	return dp[i];

}

int findAnsItertavely(vector<int> &A, int n, vector<int> &dp)
{
	if(n <= 2)
		return abs(A[0] - A[n-1]);

	dp[0] = 0;
	dp[1] = abs(A[0] - A[1]);

	for(int i = 2; i < n; i++)
	{
		dp[i] = min(abs(A[i-2] - A[i]) + dp[i-2], abs(A[i-1] - A[i]) + dp[i-1]);
	}

	return dp[n-1];

}

int main()
{

	int n;
	cin>>n;

	vector<int> A(n, 0);
	for(int i = 0; i < n; i++)
		cin>>A[i];

	vector<int> dp(n, 0);
	int ans = 0;

	//int temp = findAns(A, dp, 0, ans);
	ans = findAnsItertavely(A, n, dp);

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 4004
import java.util.*;

class Main{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int[] l = new int[n];
	int[] r = new int[n];
	for(int i = 0; i < n; i++) {
		l[i] = sc.nextInt();
		r[i] = sc.nextInt();
	}
	int ans = 0;
	for(int i = 0; i < n; i++) {
		ans += r[i] - l[i] + 1;
	}
	System.out.println(ans);
}
}

Measured memory_bytes: 25840
function Main(input) {
	input = input.trim();
  var mae = parseInt(input.split(" ")[0]);
  var ato = parseInt(input.split(" ")[1]);
  var output = mae;
  if(ato < mae){
     output--;
  }
  console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> data(H, vector<char>(W));
  for (int i = 0; i < H; i++)
    for (int j = 0; j < W; j++)
      cin >> data.at(i).at(j);
  
  vector<bool> row(H, false);
  vector<bool> col(W, false);
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (data.at(i).at(j) == '#') {
        row.at(i) = true;
        col.at(j) = true;
      }
    }
  }
  
  for (int i = 0; i < H; i++) {
    if (row.at(i)) {
      for (int j = 0; j < W; j++) {
        if (col.at(j))
          cout << data.at(i).at(j);
      }
      cout << endl;
    }
  }
}

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

using namespace std;

int64_t INF = 1'000'000'000'000'000;
int64_t N, ans;

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

    vector<int64_t> P(M), Y(M);
    for(int i=0;i<M;i++)    cin >> P[i] >> Y[i];

    vector< vector<int64_t> > sorted(N, vector<int64_t>());
    for(int i=0;i<M;i++){
        sorted[P[i]-1].push_back(Y[i]);
    }
    for(int i=0;i<N;i++){
        sort(sorted[i].begin(), sorted[i].end());
    }

    for(int i=0;i<M;i++){
        printf("%012lld\n", (int64_t)(P[i]*1000000 + lower_bound(sorted[P[i]-1].begin(), sorted[P[i]-1].end(), Y[i]) - sorted[P[i]-1].begin() + 1) );
    }

}

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

int main()
{
    int n, x, t;
    cin >> n >> x >> t;
    int ans = 0;
    int a = n / x;
    ans = a * t;
    if(n % x != 0){
        ans += t;
    }
    cout << ans << endl;
}

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

string s;

int main(){
	cin >> s;
	if(s == "RRR") cout << 3;
	else if(s == "RRS" || s == "SRR") cout << 2;
	else if(s[0] == 'R' || s[1] == 'R' || s[2] == 'R') cout << 1;
	else cout << 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) std::cin>>(P)
#define IN2(P1,P2) std::cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) std::cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) UP(I,0,N) std::cin>>V[I]
#define OUT(P) std::cout<<P<<std::endl
#define OUT2(P1,P2) std::cout<<P1<<" "<<P2<<std::endl
#define OUT3(P1,P2,P3) std::cout<<P1<<" "<<P2<<" "<<P3<<std::endl
#define OUTS(I,N,V) UP(I,0,N) std::cout<<V[i]<<std::endl
#define ALL(C) (C).begin(),(C).end()
using namespace std;
using namespace __gnu_pbds;
const int MAX_N=2*10E5;
int N;
int A[MAX_N];
int AA[MAX_N];
int i;
long ans;
inline void solve(){
  IN(N);
  REP(i,N){
    IN(A[i]);
    AA[i]=A[i]-i-1;
  }
  nth_element(AA,AA+N/2,AA+N);
  REP(i,N){
    ans+=abs(A[i]-i-1-AA[N/2]);
  }
  OUT(ans);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 5120
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <numeric>
#include <bitset>
#include <complex>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
#include <cassert>
using namespace std;
 
typedef long long ll;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
bool ISINT(double x){return fabs(x-(int)round(x))<EPS;}
bool ISEQ(double x,double y){return fabs(x-y)<EPS;}
string itos(ll x){stringstream ss;ss<<x;return ss.str();}
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin();itr!=c.end();itr++)
 
int main(void){
  for(int i = 1; i < 10; i++){
    for(int j = 1; j < 10; j++){
      cout << i << "x" << j << "=" << i * j << endl;
    }
  }
}

Measured memory_bytes: 1120
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
int main()
{
    Hello
    int n, ans = 0, sz = 0;
    cin >> n;
    int arr[n + 5];
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    for(int i = 1; i < n; i++){
        if(arr[i - 1] >= arr[i])
            sz++;
        else
            sz = 0;
        ans = max(ans, sz);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

ll dp[105][100005];

int main() {
    int n, W; cin >> n >> W;
    REP(i,n+1) {
        int w, v; cin >> w >> v;
        rep(j,W+1) {
            dp[i][j] = dp[i-1][j];
            if (j-w >= 0) chmax(dp[i][j],dp[i-1][j-w]+v);
        }
    }
    cout << dp[n][W] << endl;
}

Measured memory_bytes: 79360
A,B,K = map(int,input().split())
if(B-A > 1000):
    for i in range(A,A+K):
        print(i)
    for i in range(B+1-K,B+1):
        print(i)
else:
    for i in range(A,B+1):
        if(i < A+K or i > B-K):
            print(i)

Measured memory_bytes: 3060
#include <cstdio>//一个万能库
#include<cmath>
using namespace std;

int a,b,c,len;

int main()
{
    scanf("%d%d",&a,&b);//读入~~
    c=b;//备份一个b
    while(c>0)//用一个while求出b的位数
    {
        c/=10;//删掉末尾
        len++;//位数加1
    }
    a=a*pow(10,len)+b;//pow()函数用于求幂
                      //至于为什么是10的位数次方
                      //嗯...好像是因为位值原理...
    if(sqrt(a)==floor(sqrt(a)))printf("Yes");//判断部分比较a的平方和它平方的整数部分，如相等，就是完全平方数，输出Yes
    else printf("No");//否则输出No
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
 
int main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int a[n];
	for (int i=0;i<n;i++) cin >> a[i];
	sort (a,a+n);
	bool y=1;
	if (n%2==1) {
		for (int i=0;i<n;i++) {
			if (i%2) {
				if (a[i]!=i+1) y=0;	
			} else {
				if (a[i]!=i) y=0;
			} 
		}
		if (y==0) cout << 0;
		else {
			int b=1;
			for (int i=0;i<n/2;i++) {
				b=b*2%1000000007; 
			}
			cout << b;
		}
	} else {
		for (int i=0;i<n;i++) {
			if (i%2) {
				if (a[i]!=i) y=0;	
			} else {
				if (a[i]!=i+1) y=0;
			} 
		}
		if (y==0) cout << 0;
		else {
			int b=1;
			for (int i=0;i<n/2;i++) {
				b=b*2%1000000007; 
			}
			cout << b;
		}
	}
	
}

Measured memory_bytes: 640