akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
 
struct S002 {
  int n;
  S002& operator > (long& x) {
    n = x;
    return *this;
  }
  S002& operator > (long&& x) {
    n = x;
    return *this;
  }
  S002& operator >= (long& x) {
    if( scanf("%ld", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (double& x) {
    if( scanf("%lf", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (std::string& s) {
    if( not (std::cin >> s) ) exit(0);
    return *this;
  }
  template<typename a>
  S002& operator >= (std::vector<a>& v) {
    v.resize(n);
    for(long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template<typename a, std::size_t s>
  S002& operator >= (std::array<a, s>& x) {
    for(long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};

struct Solver {
  long n;
  Solver() {
    S002 reader;
    reader >= n;
  }
  long f(long x) {
    if( x == 0 ) return 0;
    return f(x / 10) + 1;
  }
  void solve() {
    long res = (1 << 29);
    for(long i = 1; i <= 100000; ++i) {
      if( n % i == 0 ) {
        res = std::min(res, std::max(f(i), f(n/i)));
      }
    }
    printf("%ld\n", res);
  }
};
 
int main() {
  loop std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    ll n, m;
    cin >> n >> m;
    
    ll sum = 0;
    if (n == 1 && m == 1) sum += 1;
    else if (n == 1 && m != 1) sum += m-2;
    else if (n != 1 && m == 1) sum += n-2;
    else if (n >= 2 && m >= 2) sum += (n-2)*(m-2);
    cout << sum << endl;
    

    //cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FRE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int long long
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
#define endl "\n"
const int oo = INT_MAX;
const int MOD = 1e9 + 7;
const int sz = 1e5 + 5;

int32_t main() {
    IOS;
    
    int tc = 1;
    //cin >> tc;
    while(tc--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        int ans = LLONG_MIN;
        for(auto i : {a, b}) for(auto j : {c, d}) ans = max(i* j, ans);
            cout << ans << endl;

    }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define Rint register int
#define C(n,m) (n<m?0:1ll*fac[n]*invfac[n-m]%mod*invfac[m]%mod)
#define slope(i,j,k) (b[k].a-b[i].a)*(j-i)>=(b[j].a-b[i].a)*(k-i)
using namespace std;
int T,n,m,p,k,st[200010],t=0;
long long c[200010];
struct node{
	long long a;
	int b;
}a[200010],b[200010];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i].a);
	for(int i=1;i<=n;i++) scanf("%d",&a[i].b);
	long long tmp=-1,id=0;
	for(int i=1;i<=n;i++) if(a[i].a>tmp) tmp=a[i].a,id=i;
	for(int i=id;i<=n;i++) b[i-id+1]=a[i];
	for(int i=1;i<id;i++) b[i+n-id+1]=a[i];
	b[++n]=b[1]; 
	c[1]=c[2]=0;
	for(int i=3;i<=n;i++) c[i]=2*(b[i-1].b+c[i-1])-c[i-2];
	for(int i=1;i<=n;i++) b[i].a-=c[i];
	for(int i=1;i<=n;i++){
		while(t>=2&&slope(st[t-1],st[t],i)) t--;
		st[++t]=i;
	}
	long long ans=0;
	for(int i=1;i<t;i++) ans+=b[st[i]].a*(st[i+1]-st[i]+1)+b[st[i+1]].a*(st[i+1]-st[i]-1);
	for(int i=1;i<n;i++) ans+=c[i]*2;
	printf("%.12lf\n",ans/(2*n-2.0));
}


Measured memory_bytes: 12212
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = long.Parse(line[0]);
        var b = long.Parse(line[1]);
        var c = long.Parse(line[2]);
        if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) { Console.WriteLine(0); goto end; }
        if (a == b && b == c) { Console.WriteLine(-1); goto end; }
        var count = 0;
        while (true)
        {
            if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) { Console.WriteLine(count); goto end; }
            var  wa = a / 2;
            var wb = b / 2;
            var wc = c / 2;
            a = wb + wc;
            b = wc + wa;
            c = wa + wb;
            count++;
        }
        end:;
    }
}

Measured memory_bytes: 13140
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;

int main(){
  ll n,p;
  string s;
  cin>>n>>p>>s;
 
  if(p==2){
    vector<ll>two(n);
    ll ans=0;
    rep(i,n){
      
      if((s[i]-'0')%2==0)ans+=i+1;
    }
    cout<<ans<<endl;
    return 0;
  }
  if(p==5){
     ll ans=0;
    rep(i,n){
     
      if((s[i]-'0')%5==0)ans+=i+1;
    }
    cout<<ans<<endl;
    return 0;
  }
  vector<ll>ten(n);
  ten[0]=1;
  for(ll i=1;i<n;i++){
    ten[i]=ten[i-1]*10%p;
  }
  vector<ll>MOD(n);
  MOD[0]=(s[n-1]-'0')%p;
  for(ll i=1;i<n;i++){
    MOD[i]=(ten[i]*(s[n-1-i]-'0')+MOD[i-1])%p;
  }
  vector<ll>vec(p);
  for(ll i=0;i<n;i++){
    vec[MOD[i]]++;
  }
  ll ans=0;
  ans+=vec[0];
  for(ll i=0;i<p;i++){
    if(vec[i]==0)continue;
    else ans+=vec[i]*(vec[i]-1)/2;
  }
  cout<<ans<<endl;
}
           

  
  
      

Measured memory_bytes: 3716
'use strict'
const main = (sdi) => {
  const s = sdi.split("\n");
  const h1 = s[0].split(" ")[0]-0;
  const w1 = s[0].split(" ")[1]-0;
  const h2 = s[1].split(" ")[0]-0;
  const w2 = s[1].split(" ")[1]-0;
  console.log((h1-h2)*(w1-w2));
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));

Measured memory_bytes: 7372
import sys

num = raw_input().strip().split()
ans = 0

for i in range(1, int(num[0])+1):
    cnt = 0
    a = i
    while a !=0:
        cnt += a%10
        a = a/10
    if cnt >= int(num[1]) and cnt <= int(num[2]):
        ans += i
print(str(ans))

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

const ll MAX = 1001000;
const ll MOD = 1e9+7;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


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

  ll X, Y;
  cin >> X >> Y;
  ll N3;
  N3 = X + Y;

  COMinit();

  ll ans = 0;
  if(N3%3 != 0){
    ans == 0;
  }else{
    ll N = N3/3;
    if(X >= N && X <= (2*N)){
      
      ll A = N;
      ll B = X - N;
      // 答えは ACB
      ans = COM(A, B);
    }else{
      ans = 0;
    }
  }

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 23680
#include <stdio.h>

int main(){
    int n,m,sum=0,count=0;
    scanf("%d %d",&n,&m);
    int a[n];
    for(int i=0;i<n;i++){
        scanf("%d",a+i);
        sum+=*(a+i);
    }
    for(int j=0;j<n;j++){
        if(a[j]>=(float)sum/(4*m)){
            count++;
        }
        if(count==m){
            printf("Yes\n");
            break;
        }
        if(j==n-1){
            printf("No\n");
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    string s, a, b;

    cin >> s;

    a = s.substr(s.size() / 2 + 1);

    b = s.substr(0, s.size() / 2);

    if (a == b)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define LL long long
#define rep(i,st,ed) for (int i=st;i<=ed;++i)
using namespace std;
const double pi=acos(-1);
const double eps=1e-13;
const int N=400005;

struct pos {
	LL x,y; double arc;
	LL operator *(pos b) const {
		return x*b.y-y*b.x;
	}
	pos operator +(pos b) const {
		return (pos) {x+b.x,y+b.y};
	}
	pos operator -(pos b) const {
		return (pos) {x-b.x,y-b.y};
	}
	LL len() {
		return x*x+y*y;
	}
} p[N];

bool cmp(pos a,pos b) {
	return a.arc<b.arc;
}

int main() {
	int n,cnt=0;
    cin >> n;
	rep(i,1,n) {
        int x,y;
        cin >> x >> y;
		if (1LL*x*x+1LL*y*y) {
			p[++cnt]=(pos) {x,y,atan2(x,y)};
		}
	} n=cnt;
    //eeezzz
	sort(p+1,p+n+1,cmp);
	rep(i,1,n) p[i+n]=p[i],p[i+n].arc=p[i].arc+2*pi;
	pos ans=(pos) {0,0};
	LL prt=0;
	for(int l=1,r=1;l<=n;){
		while (r<l+n&&(p[r].arc-p[l].arc<=pi+eps)) {
			ans=ans+p[r++];
			prt=max(prt,ans.len());
		}
		ans=ans-p[l++];
		prt=max(prt,ans.len());
	}
    cout.precision(30);
    cout << sqrt(prt);
	return 0;
}


Measured memory_bytes: 384
# AOJ 0031 Weight
# Python3 2018.6.14 bal4u

w = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512];

while True:
	try:
		a = int(input())
		ans = []
		i = 0
		while a > 0:
			if a & 1:
				ans.append(w[i])
			a >>= 1
			i += 1
		print(*ans)
	except EOFError:
		break


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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

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

#ifdef OJ
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#else
#define debug(x)
#define debugv(x)
#endif

#define all(x) (x).begin(), (x).end()
#define rsort(x) sort((x).rbegin(), (x).rend())
#define sz(x) ((int)x.size())
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return 0;}while(0)
#define RETURNV(x) do{cout << (x) << '\n'; return ;}while(0)

const int MOD = 1e9+7;
const int MAXN = 2e6+3;
const int INF = 1e9;

void solve() {
    int N; cin >> N;
    LL ans = 0;
    fore(i,2,N) {
        int p = i;
        while(p <= N) {
            ans += p;
            p += i;
        }
    }
    cout << ans + 1LL*(N+1)*N/2 << '\n';
}

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int ntest = 1;
    int tt = 1;
    while(ntest--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n;
    cin>>n;
    map<P,int> mp;
    rep(i,n){
        int a,b,j=i+1;
        b=j%10;
        while(j){
            a=j%10;
            j/=10;
        }
        mp[P(a,b)]++;
    }
    int ans=0;
    for(auto v: mp){
        P x={v.first.second,v.first.first};
        ans+=mp[x]*v.second;
    }
    cout<<ans<<endl;
}

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

long long gcd(long long a, long long b)
{
    for (;;)
    {
        if (a == 0) return b;
        b %= a;
        if (b == 0) return a;
        a %= b;
    }
}

long long lcm(long long a, long long b)
{
    long long temp = gcd(a, b);

    return temp ? (a / temp * b) : 0;
}

int main(){
    long long n;cin>>n;

    long long nums[n];for (int i=0;i<n;i++){cin>> nums[i];}

    long long acc = 1;
    for (int i=0;i<n;i++){
        acc = lcm(acc, nums[i]);

    }

    cout << acc << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    private static final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        final int N = Integer.parseInt(sc.nextLine());
        final List<Long> L = Arrays.stream(sc.nextLine().split(" "))
                .parallel()
                .map(Long::parseLong)
                .sorted()
                .collect(Collectors.toList());

        int counter = 0;
        for (int i = 0; i < N - 2; i++) {
            for (int j = i + 1; j < N - 1; j++) {
                final long L1 = L.get(i);
                final long L2 = L.get(j);
                for (int k = j + 1; k < N; k++) {
                    final long L3 = L.get(k);
                    if (L1 == L2 || L2 == L3 || L3 == L1) {
                        continue;
                    } else if (L1 + L2 > L.get(k)) {
                        counter++;
                    } else {
                        break;
                    }
                }
            }
        }
        System.out.println(counter);
    }
}


Measured memory_bytes: 37588
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll X;
  cin >> X;
  rep(i, 1000000){
    if(((i+1)*X)%360==0){
      cout << (i+1);
      return 0;
    }
  }
  /*
  ll a = (360+X-1)/X;
  ll over = a*X-360;
  if(over==0){
    cout << 360/X;
  }else{
    ll res = over*X/gcd(over, X);
    cerr << res << endl;
    cout << a*res*(360+over)/360;
    }*/
  return 0;
}


Measured memory_bytes: 3632
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line = br.readLine();

        while(!(line.equals("0 0"))){
            String[] input = line.split(" ");
            int h = Integer.valueOf(input[0]);
            int w = Integer.valueOf(input[1]);
            StringBuilder sb = new StringBuilder();

            for(int i = 0; i < h; i++){
                boolean which = i%2 == 0;
                for(int j = 0; j < w; j++){
                    if(which) sb.append("#");
                    else sb.append(".");
                    which = !which;
                }
                sb.append("\n");
            }

            System.out.println(sb);
            
            line = br.readLine();
        }

    }
}

Measured memory_bytes: 25332
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

const int MAX_N = 100100;
char T[MAX_N];
bool visited[MAX_N];
ll dp[MAX_N][3];
int N, K;
ll R, S, P;

ll judge(char you, char opp) {
    if(you == 'R' && opp == 's') return R;
    if(you == 'S' && opp == 'p') return S;
    if(you == 'P' && opp == 'r') return P;
    return 0LL;
}

ll judge1(char opp){
    if(opp == 'r') return P;
    if(opp == 's') return R;
    if(opp == 'p') return S;
    return 0LL;
}

int main()
{
    scanf("%d %d", &N, &K);
    scanf("%lld %lld %lld", &R, &S, &P);
    scanf("%s", T);
    ll res = 0LL;
    for(int i = 0; i < N; ++i) {
        if(visited[i]) continue;
        visited[i] = true;
        dp[i][0] = judge('R', T[i]);
        dp[i][1] = judge('S', T[i]);
        dp[i][2] = judge('P', T[i]);
        int j=i+K;
        for(j = i+K; j < N; j += K) {
            visited[j] = true;
            dp[j][0] = max(dp[j][0],
                            max(dp[j-K][1] + judge('R', T[j]),
                                dp[j-K][2] + judge('R', T[j])
                                )
                        );
            dp[j][1] = max(dp[j][1],
                            max(dp[j-K][0] + judge('S', T[j]),
                                dp[j-K][2] + judge('S', T[j])
                                )
                        );
            dp[j][2] = max(dp[j][2],
                            max(dp[j-K][0] + judge('P', T[j]),
                                dp[j-K][1] + judge('P', T[j])
                                )
                        );
            
        }
        res += max(dp[j-K][0], max(dp[j-K][1], dp[j-K][2]));
    }
    
    for(int i = 0; i < N; ++i) if(!visited[i]) res += judge1(T[i]);
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 2816
#include <iostream>

using namespace std;

typedef long long ll;

ll gcd(ll a, ll b)
{
  if(a < b) return gcd(b, a);
  else if(a % b == 0) return (a / b * 2 - 1) * b;
  else return (a / b * 2) * b + gcd(b, a % b);
}

int main()
{
  ll n, x;
  cin >> n >> x;
  cout << n + gcd(n - x, x) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long h, w;
  cin >> h >> w;
  long long ans;
  ans = h * w / 2LL;
  if (h % 2LL == 1LL && w % 2LL == 1LL){
    ans++;
  }
  if (h == 1LL || w == 1LL) ans = 1LL;
  cout << ans << endl;
}

Measured memory_bytes: 256
h, w, k = map(int, input().split())
s = [input() for _ in range(h)]

out = [[0 for i in range(w)] for j in range(h)]

count = 1
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            out[i][j] = count
            count += 1

for i in range(h):
    for j in range(w-1):
        if out[i][j] > 0 and out[i][j+1] == 0:
            out[i][j+1] = out[i][j]
    for j in range(w-1, 0, -1):
        if out[i][j] > 0 and out[i][j-1] == 0:
            out[i][j-1] = out[i][j]

for j in range(w):
    for i in range(h-1):
        if out[i][j] > 0 and out[i+1][j] == 0:
            out[i+1][j] = out[i][j]
    for i in range(h-1, 0, -1):
        if out[i][j] > 0 and out[i-1][j] == 0:
            out[i-1][j] = out[i][j]

for o in out:
    print(*o)


Measured memory_bytes: 7584
n=input()
li=list(map(int,input().split()))

li.sort()
#mod_li=[[i,num] for i,num in enumerate(li)]

result=0
for i in range(len(li)-2):
  tmp=i+2
  for j in range(i+1,len(li)-1):
    for k in range(tmp,len(li)):
      if li[i]+li[j]<=li[k]:
        tmp=k-1
        if tmp-j>0:
          result+=tmp-j
        break
      elif k==len(li)-1:
        tmp=k
        result+=tmp-j
        break
print(result)

Measured memory_bytes: 44124
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}


void get(char &x){
	if(x == '1') x = '0';
	else x = '1';
}
ll cur[N], ans[N];

void solve()
{
	ll m, n, sum = 0;
	cin >> m >> n;
	rep(i, n){
		ll x;
		cin >> x;
		sum += x;
	}
	if(sum > m) cout << -1;
	else cout << m - sum;
}



 
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;

}

Measured memory_bytes: 3612
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <vector>
using namespace std;
#define FOR(__I,__N) for (int __I = 0; __I < __N; ++__I)

typedef long long int64;
typedef pair<int,int> pii;
typedef pair<int64, int64> pll;
typedef double db;
typedef long double ldb;

const int INF = 0x3f3f3f3f;
const int64 INF64 = 0x3f3f3f3f3f3f3f3fLL;

const int MOD = 1000000007;

const int MAX_N = 200000;
int a[MAX_N];

void solve(int N){
	int sum = 0;
	FOR(i,N)	sum ^= a[i];
	FOR(i,N)	a[i] ^= sum;
}


int main(){
	int N;	cin >> N;
	FOR(i,N)	cin >> a[i];

    solve(N);
	FOR(i,N){
		printf("%d%c",a[i]," \n"[i+1==N]);
	}
}





Measured memory_bytes: 4396
#include <iostream>
using namespace std;
int main() {
  int N,M,sumN,sumM;
  sumN=1;
  sumM=1;
cin>>N>>M;
for(int i=0;i<=1;i++){
  sumN*=(N-i);  
}
sumN/=2;
for(int i=0;i<=1;i++){
  sumM*=(M-i);  
}
sumM/=2;
cout<<sumN+sumM;
}

Measured memory_bytes: 256
n = int(input())
c = list(input())
wpos = 0
rpos = n-1
count = 0
while wpos < rpos :
  while c[wpos] == "R":
    wpos += 1
    if wpos > rpos: break
  while c[rpos] == "W":
    rpos -= 1
    if wpos > rpos: break
  if wpos < rpos :
    count += 1
    c[wpos],c[rpos]=c[rpos],c[wpos]
print(count)

Measured memory_bytes: 77632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define pb push_back
#define mp make_pair
#define pi 3.14
typedef pair<int,int> ii;
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s,t;
	cin>>s>>t;
	if(s==t.substr(0,t.length()-1))
	cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int> 

int main(){
  int N; cin >> N;
  int a, tot=0;
  rep(i,N){
    cin >> a;
    tot += a-1;
  }
  cout << tot << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    char a;
    cin >> a;
    if((int)a < 97) cout << 'A' << endl;
    else cout << 'a' << endl;
}

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

typedef long long ll;

const int MAX_N = 100000;
int N, Q;
ll sum;
vector<int> C;

void input_init(void) {
	cin >> N;
	C.resize(MAX_N + 1, 0);
	sum = (ll)0;
	for (int i = 0; i < N; ++i) {
		int a;
		cin >> a;
		++(C[a]);
		sum += (ll)a;
	}
}

void sequence(void) {
	int b, c;
	cin >> b >> c;
	if (C[b] != 0) {
		sum -= (ll)b * C[b];
		sum += (ll)c * C[b];
		C[c] += C[b];
		C[b] = 0;
	}
	cout << sum << '\n';
}

int main(void) {
	input_init();
	cin >> Q;
	for (int i = 0; i < Q; ++i)
		sequence();
	return 0;
}


Measured memory_bytes: 3692
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MAX 300005
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1e18;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
int main()
{
	fast();
	string s;
	cin>>s;
	if(s[0]==s[1] and s[1]==s[2])
		cout<<"No";
	else
		cout<<"Yes";
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

n = int(input())
#n, op = [i for i in readline().split()]


a21 = [["a","a"],["b","b"]]
a22 = [["c","d"],["c","d"]]

a3 = [["a","a","."],[".",".","b"],[".",".","b"]]

a4 = [["q","q","r","s"],["t","t","r","s"],["u","x","v","v"],["u","x","w","w"]]

a5 = [["c","c","d","d","l"],["e","f","f",".","l"],["e",".",".","h","g"],["i",".",".","h","g"],["i","j","j","k","k"]]

a7 = [["c","c","d","d",".",".","e"],[".","f","f",".",".","g","e"],[".",".","h","h",".","g","i"],["j",".",".",".","k",".","i"],["j","l",".",".","k",".","."],["m","l",".",".","n","n","."],["m",".",".","o","o","p","p"]]



if n == 2: print(-1)
else:
    if n == 3:
        ans = a3

    elif n%2 == 0:
        ans = [["."]*n for i in range(n)]
        for i in range(n//2):
            for j in range(2):
                for k in range(2):
                    ans[2*i+j][2*i+k] = a21[j][k]
    
        for i in range(n//2):
            for j in range(2):
                for k in range(2):
                    ans[2+2*i+j-n][2*i+k] = a22[j][k]

    elif n%4==1:
        ans = [["."]*n for i in range(n)]
        for i in range(5):
            for j in range(5):
                ans[i][j] = a5[i][j]
                
        for i in range((n-5)//2):
            for j in range(2):
                for k in range(2):
                    ans[5+2*i+j][5+2*i+k] = a21[j][k]
    
        for i in range((n-5)//2):
            for j in range(2):
                for k in range(2):
                    c = 5+2+2*i+j
                    d = 5+2*i+k
                    if c >= n:
                        c = 5+j
                    ans[c][d] = a22[j][k]
        


    elif n%4==3:
        ans = [["."]*n for i in range(n)]
        for i in range(7):
            for j in range(7):
                ans[i][j] = a7[i][j]

        for i in range((n-7)//2):
            for j in range(2):
                for k in range(2):
                    ans[7+2*i+j][7+2*i+k] = a21[j][k]
    
        for i in range((n-7)//2):
            for j in range(2):
                for k in range(2):
                    c = 7+2+2*i+j
                    d = 7+2*i+k
                    if c >= n:
                        c = 7+j
                    ans[c][d] = a22[j][k]

    for i in ans:
        print(*i,sep="")











Measured memory_bytes: 13496
N,M = map(int,input().split())
gra = [[]for i in range(N)]
p = [[0]+[-float("inf")]*(N-1) for i in range(N*2+1)]
p[0][0] = 0
for i in range(M):
    a,b,c = map(int,input().split())
    gra[a-1].append([b-1,c])
for i in range(N*2):
    for j in range(N):
        for b,c in gra[j]:
            p[i+1][b] = max(p[i+1][b],p[i][j]+c,p[i][b])
print(["inf",p[N][-1]][p[N][-1] == p[-1][-1]])

Measured memory_bytes: 126552
import java.util.*;



public class Main{

	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	
	//等差数列
	static long tousasum(int n) {
		return (long)n*((long)n+1)/2;
	}



	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}


	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}


	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}


	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 int N=sc.nextInt();
	 int[] A=new int[N];
	 int odd=0;
	 int result=0;
	 int minus=1;
	 
	 for(int i=0;i<N;i++) {
		 A[i]=sc.nextInt();
		 if(A[i]%2!=0) {
			 odd+=1;
			 minus*=1;
		 }else {
			 minus*=2;
		 }
	 }
	 if(N==1) {
		 if(odd==0) {
			 result=1;
		 }else {
			 result=0;
		 }
		 
	 }else {
		 result=(int)Math.pow(3, N)-minus;
	 }
	 
	 System.out.println(result);
	 
	 
 }
	


}


Measured memory_bytes: 21840
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};
using namespace std;
typedef long long  ll;
typedef pair<double, double> P;

/** Problem0233 : Book Arrangement **/
int main() {
	int n;
	while (cin>>n, n) {
		string ans;
		while (1) {
			int t = n%10;
			n/=-10;
			if (t>=0)
				ans+='0'+t;
			else {
				ans+='0'+(t+10);
				n++;
			}
			if (n==0)
				break;
		}
		reverse(ans.begin(), ans.end());
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<vector>
#include<algorithm>

#define ll long long
using namespace std;

int main(){
    int N, cnt = 0;
    int a,b;
    cin >> N;
    vector <ll> d(N);
    for(int i = 0; i < N; i++){
        cin >> d[i];
    }
    sort(d.begin(),d.end());
    a = d[N/2 -1];
    b = d[N/2]; 

    cout << b - a << endl;
}

Measured memory_bytes: 1024
a, b, c, d = map(int, input().split())

def gcd(x,y):
  while y:
    x, y = y, x%y
  return x
lcm = c*d // gcd(c,d)

def cnt(z):
  return b//z - (a-1)//z

print(b+1-a-cnt(c)-cnt(d)+cnt(lcm))

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main() {
    // insert code here...
    int a, b, c;
    int j = 0;
    cin >> a >> b >> c;
    for (int i = a; i <= b; i++){
        if (c % i == 0){
            j++;
        }
    }
cout << j << endl;
return 0;
}



Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <algorithm>
#define llint long long

using namespace std;

struct edge{
	llint to, cost;
	edge(){}
	edge(llint a, llint b){
		to = a, cost = b;
	}
};

llint n, m;
vector<edge> G[2005];
llint s[2005];
vector<llint> vec;

llint dfs(llint v, llint pre, llint r)
{	
	vector<llint> tmp;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i].to == pre) continue;
		llint res = dfs(G[v][i].to, v, r);
		tmp.push_back(res + G[v][i].cost);
	}
	sort(tmp.begin(), tmp.end());
	for(int i = 0; i < (int)tmp.size()-1; i++) vec.push_back(s[r] * tmp[i]);
	if(tmp.size()) return tmp.back();
	else return 0;
}

int main(void)
{
	cin >> n >> m;
	llint a, b, c;
	for(int i = 0; i < n-1; i++){
		cin >> a >> b >> c;
		G[a].push_back(edge(b, c));
		G[b].push_back(edge(a, c));
	}
	for(int i = 1; i <= n; i++) cin >> s[i];
	
	for(int i = 1; i <= n; i++) vec.push_back(s[i] * dfs(i, -1, i));
	sort(vec.rbegin(), vec.rend());
	
	llint ans = 0;
	for(int i = 0; i < min(m, (llint)vec.size()); i++) ans += vec[i];
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 36068
#include <bits/stdc++.h>
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
using namespace std;
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/*************************************/

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  string s;
  cin >> s;
  int n = SZ(s);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] != s[n - i - 1]) {
      s[i] = s[n - i - 1];
      ++ans;
    }
  }
  kek(ans);
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <limits>
 
using namespace std;
 
int N;
vector<long long> v;
vector<vector<long long>> dp; 
long long LIM = std::numeric_limits<long long>::min();
 
long long deque(long long i, long long j)
{
  long long c = (N - j - i) % 2 == 0 ? 1 : -1; 
 
  if (i+1 == j) return v[i] * c;
  if (dp[i+1][j] == LIM) dp[i+1][j] = deque(i+1, j); 
  if (dp[i][j-1] == LIM) dp[i][j-1] = deque(i, j-1);
 
  long long a = v[i]*c + dp[i+1][j];
  long long b = v[j-1]*c + dp[i][j-1];
 
  dp[i][j] = c < 0 ? min(a, b) : max(a, b);
  return dp[i][j];
}
 
int main()
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
 
  std::cin >> N;
  v.resize(N);
  dp = vector<vector<long long>>(N+1, vector<long long>(N+1, LIM));
 
  for (int i = 0; i < N; ++i)
  {
    long long val;
    cin >> val;
    v[i] = val;
  }
 
  std::cout << deque(0, N); 
 
  return 0;
}

Measured memory_bytes: 70912
#include<bits/stdc++.h>
#include <cstring>
using namespace std;
#define ll  long long
#define endl '\n'
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
   int a,b;
   cin>>a>>b;
   if (a<10&&b<10)
    cout<<a*b<<endl;
   else
    cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
const int N=3e3+5,MAX=3e7,MOD=1e9+7;
 
using namespace std;
 
string str1,str2;
int n1,n2;

int memo[N][N];
int solve(int indx1,int indx2){

	 if(indx1==n1 || indx2 == n2)return 0;

	 if(str1[indx1]==str2[indx2])return 1+solve(indx1+1,indx2+1);

	 int &ret = memo[indx1][indx2];

	 if(ret !=-1)return ret;

	 ret = solve(indx1+1,indx2);

	 ret = max(ret , solve(indx1,indx2+1));

	 return ret;
}

void trace(int indx1,int indx2){

	 if(indx1==n1 || indx2==n2)return;

	 if(str1[indx1]==str2[indx2]){

	 	   cout<<str1[indx1];
	 	   trace(indx1+1,indx2+1);
	 	   return;
	 }

	 if(solve(indx1+1,indx2) > solve(indx1,indx2+1)){

	 	  trace(indx1+1,indx2);
	 	  return;
	 }

	 trace(indx1,indx2+1);
}
int main(){
    //#ifndef ONLINE_JUDGE
      //freopen("test.txt","r",stdin);
    //#endif
    
    cin>>str1>>str2;
     
    n1 = sz(str1),n2=sz(str2);

    memset(memo,-1,sizeof(memo));

    if(solve(0,0))
    	trace(0,0);
     
}

Measured memory_bytes: 35968
#include<iostream>
#include<queue>
#include<vector>
using namespace std;

int indeg[10000],s,t,V,E;
vector<int> A[10000];
bool flag[10000]={false};
vector<int> ans;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

void bfs(int a){
    queue<int> Q;
    Q.push(a);
    flag[a]=true;

    while(!Q.empty()){
        int u=Q.front();
        Q.pop();
        ans.push_back(u);

        for(int i=0;i<A[u].size();++i){
            --indeg[A[u][i]];
            if(indeg[A[u][i]]==0 && flag[A[u][i]]==false){
                flag[A[u][i]]=true;
                Q.push(A[u][i]);
            }
        }
    }

}

void tp_srt(){
    
    for(int i=0;i<V;++i){
        if(indeg[i]==0 && flag[i]==false){
            bfs(i);
        }
    }
}

int main(){
    
    cin>>V>>E;
    Fill(flag,false);

    
    for(int i=0;i<E;++i){
        cin>>s>>t;
        A[s].push_back(t);
    }
    
    for(int i=0;i<V;++i){
        for(int j=0;j<A[i].size();++j){
            ++indeg[A[i][j]];
        }
    }
    
    tp_srt();

    for(int i=0;i<ans.size();++i){
        cout<<ans[i]<<"\n";
    }

}


Measured memory_bytes: 3940
#include<iostream>
#include<algorithm>
#include<vector>

#define pb push_back
  
using namespace std;

int main(void){
  int n;
  vector<int> height;

  for(int i = 0;i < 10;i++){
    cin >> n;
    height.pb(n);
  }
  sort(height.begin() , height.end());
  
  for(int i = 9; i > 6;i--){
    cout << height.at(i) << endl;
  }  
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n; cin >> n;
    vector<int> a(n);
    for (int &x : a) {
        cin >> x;
    }
    for (int i = 0; i + 1 < n; i++) {
        if (a[i] - 1 <= a[i + 1] && (i == 0 || a[i] - 1 >= a[i - 1])) {
            a[i]--;
        }
    }
    if (is_sorted(a.begin(), a.end())) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}


Measured memory_bytes: 640
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	string n;
	cin >> n;

	for (long i = 0; i < n.size(); i += 2) {
		cout << n[i];
	}

	

	


}

Measured memory_bytes: 512
a = []
a = gets.split.map(&:to_i)
b = []
b = gets.split.map(&:to_i)
#puts b.join (" ")
 
d = []
n = 0
ans = 1
for i in 0..100000
  n = i
  ans = 1
  d = n.to_s.split("")
  for k in 0..d.length-1
      if b.include?(d[k].to_i)
        ans = nil
      end
  end
  #ans = nil
  #puts ans
  if n >= a[0] && ans
    puts n
    exit
  end
end
    
  

Measured memory_bytes: 2044
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{
    private const int INF = 1000000007;
    public static void Main()
    {
        int N = IntRead();
        int[] ab = IntLine();
        int[] p = IntLine();
        int[] ans = new int[3];
        for (int i = 0; i < N; i++) {
            if (p[i] <= ab[0]) ans[0]++;
            else if (ab[1] < p[i]) ans[2]++;
            else ans[1]++;
        }
        Console.WriteLine(ans.Min());
    }
}

public class AtCoder
{
    public static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int GCD(int a, int b)
    {
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (b != 0)
        {
            d = a % b;
            a = b;
            b = d;
        }
        return a;
    }
    public static long LCM(int a, int b)
    {
        return (long)a * b / GCD(a, b);
    }
    public static string StrReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int IntRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
    public static long[] LSRead()
    {
        return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
    }
    public static long Combination(int n, int r)
    {
        if (n == r || r == 0) return 1;
        return
            Enumerable.Range((n - r + 1), r).ToList().Aggregate((now, next) => now * next) /
            Enumerable.Range(1, r).ToList().Aggregate((now, next) => now * next);
    }
    public static long Permutation(int n, int r)
    {
        if (n == r) return 1;
        return
            Enumerable.Range((n - r), r).ToList().Aggregate((now, next) => now * next);
    }
    public static long RepPow(long x, long p, long m = 1000000007)
    {
        if (p == 1) return x % m;
        long b = RepPow(x, p / 2, m) % m;
        if (p % 2 == 0) { return (b * b) % m; }
        else { return (x * ((b * b) % m)) % m; }
    }
    public static long LongRead()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] LongLine()
    {
        return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
    }
    public static int[] IntLine()
    {
        return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    }
}


Measured memory_bytes: 13396
while input=gets
	a=input.chomp.split(" ")
	b=gets.chomp.split(" ")
	hit=0
	blow=0
	4.times{|i|
		4.times{|j|
			if a[i]==b[j] then
				if i==j then
					hit+=1
				else
					blow+=1
				end
			end
		}
	}
	print(hit," ",blow,"\n")
end


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int maxm = 1000000000 + 7;


using namespace std;


int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int a, b, c, k;
	cin >> a >> b >> c >> k;


	while (k > 0)
	{
		if (a >= b)
		{
			b *= 2;

		}

		else if (b >= c)
		{
			c *= 2;

		}

		k--;

	}
    
    

	if (a < b && b < c) cout << "Yes" << endl;

	else cout << "No" << endl;


}

Measured memory_bytes: 3592