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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

ll n;
ll a[300000];

int main(int argc, char **argv) {
	cin >> n;
	REP(i, 3 * n) cin >> a[i];
	sort(a, a + 3 * n);
	ll res = 0;
	REP(i, n) res += a[3 * n - 2 - i * 2];
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
int memo[45]={};


int fibo(int n){
    if(n==0 || n==1) return memo[n]=1;
    
    else if(memo[n]!=0)
    {
        return memo[n];
    }
    return memo[n]=fibo(n-2)+fibo(n-1);
}



int main(){

    int n;
    scanf("%d",&n);
    printf("%d\n",fibo(n));

    
}


Measured memory_bytes: 2132
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)


















vector<vector<pair<ll, ll>>> g;
vector<ll> color;

void dfs(ll now){
    for(auto c : g[now]){
        ll to = c.first, w = c.second;
        if(!color[to]){
            if(w % 2 == 1){
                color[to] = color[now] == 1? 2 : 1;
            }
            else{
                color[to] = color[now] == 1? 1 : 2;
            }
            dfs(to);
        }
    }
}



int main(){
    ll n;
    cin >> n;
    g.resize(n);
    REP(i, n - 1){
        ll u, v, w;
        cin >> u >> v >> w;
        u--; v--;
        g[u].push_back({v, w});
        g[v].push_back({u, w});
    }
    
    color.resize(n);
    color[0] = 1;
    dfs(0);
    
    REP(i, n){
        cout << (color[i] == 1? 0 : 1) << endl;
    }
}


Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(a,b) __gcd(a,b)
#define ff first
#define ss second
#define p pair<int,int>
#define pb push_back
#define endl '\n'
#define w(t) ll test;cin>>test;while(test--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define pi acos(-1)

int main()
{
    fast;
    ll n;
    cin>>n;
    vector<ll>vec(n);
    ll sum=0;
    ll mn=1e18+7;
    ll mx=-1000;
    for(auto &i:vec)
    {
        cin>>i;
        /*mn=min(mn,i);
        mx=max(mx,i);*/
       // sum+=i;
    }

    /*if(sum%n!=0)
    {
        sort(vec.begin(),vec.end());
        sum/=n;
        ll lb=lower_bound(vec.begin(),vec.end(),sum)-vec.begin();
        ll ub=vec.end()-lower_bound(vec.begin(),vec.end(),sum);
       // cout<<lb<<" "<<ub<<endl;
        if(lb<ub)sum++;

    }
    else sum/=n;*/

   //cout<<sum<<endl;
    ll ans=0;
    for(ll i=-100;i<=100;i++)
    {
        ans=0;
        for(auto it:vec)
    {
        ans+=pow((i-it),2);
       // cout<<ans<<" ";
    }
    mn=min(ans,mn);
    }

    cout<<mn<<endl;
}



Measured memory_bytes: 3652
from bisect import bisect_left

n, k = map(int, input().split())
x = list(map(int, input().split()))

si = bisect_left(x, 0)

ans = (x[-1] - x[0]) * 2
if si + k - 1 < len(x):
    ans = min(ans, x[si + k - 1])
if si - k >= 0:
    ans = min(ans, abs(x[si - k]))

for i in range(n):
    tmp_ans = 0
    if i < si and i + k -1 < len(x):
        tmp_ans = abs(x[i]) * 2 + x[i + k - 1]
        ans = min(ans, tmp_ans)
    elif i >= si and i - k + 1 >= 0:
        tmp_ans = x[i] * 2 + abs(x[i - k + 1])
        ans = min(ans, tmp_ans)

print(ans)


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

using namespace std;

#define int long long

#define rep(i, n) for (int i = 0, size_##i = (n); i < size_##i; i++)
#define FOR(i, a, b) for (int i = (a), int size##i = (b); i < size##i; i++)
#define FORR(i, a, b) for (int i = (a); i >= (b); i--)

#define pb push_back
#define fst first
#define snd second

#define vdel(v, n) v.erase(v.begin() + (n))
#define all(v) v.begin(), v.end()

#define tint(str) atoi(str.c_str())
#define tstr(num) to_string(num)

#define prt(x) cout << x << endl

#ifdef DEBUG
#define debug(x) cout << x << endl
#else
#define debug(x)
#endif

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using RPQ = priority_queue<T, vector<T>, less<T>>;

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

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


signed main() {
    int K;
    cin >> K;
    string s;
    cin >> s;
    string out = "";
    if(K < s.size()) {
        rep(i, K) {
        out += s[i];
    }
    out += "...";
    cout << out << endl;
    }
    else{
        cout << s << endl;
    }

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define Cout(s) cout << s << endl;
using ll = long long;
using P = pair<int, int>;

const ll INF = 1ll << 60;
ll MOD = 1e9 + 7;

int main()
{

    int k;
    cin >> k;

    if (k % 2)
    {
        int a = k / 2;
        Cout(a * (a + 1));
    }
    else
    {
        Cout(k / 2 * k / 2);
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int 
#define ull unsigned long long int 
#define ld long long double 
#define endl '\n'
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define mp make_pair
#define print(v) for(auto x:v) cout<<x<<" ";
#define printf(v) for(auto x:v) cout<<x.first<<" "<<x.second<<endl;
using namespace std;
int main(){
fastio;
int a,b;
cin>>a>>b;
if(a<=9 && b<=9){
    cout<<a*b<<endl;
}
else{
    cout<<-1<<endl;
}
return 0;
}
        
        

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
n=int(input())
l=list(map(int,input().split()))
l.sort()
import bisect
ans=0
for i in range(n):
    for j in range(i+1,n):
        x=bisect.bisect_left(l[j+1:n],l[i]+l[j])
        ans+=x
print(ans)


Measured memory_bytes: 51872
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000001
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    vector<int> minimum(N, INF);
    for (int i = N - 1; i >= 0; i--) {
        *upper_bound(minimum.begin(), minimum.end(), A[i]) = A[i];
    }
    int ans = 0;
    rep(i,N) if (minimum[i] < INF) ans = i;

    cout << ans + 1 << endl;
    
    return 0;
}

Measured memory_bytes: 1024
// be name khoda
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int N, M, ans = 0;
    ll K, t = 0;
    cin >> N >> M >> K;
    ll A[N], B[M];
    for (int i = 0; i < N; i++)
        cin >> A[i];

    for (int i = 0; i < M; i++)
        cin >> B[i];

    ll c[M + 1]{};
    for (int i = 0; i < M; i++)
        c[i + 1] = c[i] + B[i];

    for (int i = 0; i <= N; i++)
    {
        if (i != 0) t += A[i - 1];
        if (t > K)  break;
        int l = -1;
        int r = M + 1;
        while (r - l > 1)
        {
            int m = (l + r) / 2;
            if (t + c[m] <= K) l = m;
            else r = m;
        }
        ans = max(ans, i + l);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 8324
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>

using namespace std;
int main(void){
 int cnt=0;
 int ans=0;
 int N; 
 cin>>N;


 for(int i=1;i<=N; i+=2){
  cnt=0;

  for(int j=1; j<=i; j++)if(i%j==0)cnt++;

  if(cnt==8)ans++;
 }
 std::cout<<ans<<std::endl;
 return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace A_ABC154
{
    class MainClass
    {

        static int[] ab;

        public static void Main(string[] args)
        {
            string[] st = ReadLine().Split().ToArray();
            ab = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            string[] u = ReadLine().Split().ToArray();

            if(u[0]==st[0]){
                WriteLine("{0} {1}",ab[0]-1,ab[1]);
            }else{
                WriteLine("{0} {1}",ab[0],ab[1]-1);                
            }
            
        }
    }
}


Measured memory_bytes: 13268
#include<stdio.h>
int main(void)
{
  char b;
  scanf("%s",&b);
  
  if(b=='A')
    printf("T");
  if(b=='T')
    printf("A");
  if(b=='C')
    printf("G");
  if(b=='G')
    printf("C");
  
  return 0;
}


Measured memory_bytes: 128
import java.util.*;
import static java.lang.System.*;
import static java.lang.Integer.*;

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = parseInt(sc.next());
    int x[] = new int[N];
    int y[] = new int[N];
    int h[] = new int[N];
    for(int i=0; i<N; i++){
      x[i] = parseInt(sc.next());
      y[i] = parseInt(sc.next());
      h[i] = parseInt(sc.next());
    }
    boolean check = true;
    for(int i=0; i<=100; i++){
      for(int w=0; w<=100; w++){
        check = true;
        int tmp = 0;
        for(int k=0; k<N; k++){
          if(h[k] != 0) tmp = h[k] + Math.abs(x[k] - i) + Math.abs(y[k] - w);
        }
        for(int j=0; j<N; j++){
          if(h[j] != Math.max(tmp - Math.abs(x[j] - i) - Math.abs(y[j] - w), 0) ){
            check = false;
            break;
          }
        }
        if(check == true){
          out.println(i + " " + w + " " + tmp);
          break;
        }
      }
      if(check == true) break;
    }   
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

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

int main() {
  int H, W;
  for (int i=0; ; i++) {
    cin >> H >> W;
    if (i != 0) cout << endl;
    if (H == 0 && W == 0) break;
    for (int j=0; j<H; j++) {
      for (int k=0; k<W; k++) {
        if (j == 0 || j == H-1) 
          if (k != W-1) cout << "#";
          else cout << "#" << endl;
        else {
          if (k == 0) cout << "#";
          else if (k == W-1) cout << "#" << endl;
          else cout << ".";
        }
      } 
    } 
  }
  return 0; 
}


Measured memory_bytes: 3064
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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;}

string S;
string T;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> S;
    cin >> T;
    solve();
}

// S, T は長さ 1 以上 2× 10^5 以下
// S, T は英小文字のみからなる
// S と T の長さは等しい

// string S, string T
// 答えを出力せよ。
void solve(){
    ll n=S.size();
    ll ans=0;
    rep(i,n){
        if(S[i]!=T[i])ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3748
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const int N=1000010,P=998244353;
inline int read(){
	int x=0,f=0,c=getchar();
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';c=getchar())
	x=(x<<1)+(x<<3)+c-'0';return f?-x:x;
}
inline void write(ll x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);putchar(x%10+'0');
}
ll f[N];
int n,k,i;
int main(){
	//freopen("1.out","w",stdout);
	n=read();f[0]=1;k=read();
	for(i=1;i<=n;i++)
	if(read()&1){f[0]=f[1]=f[0]+f[1];}
	else{f[1]+=f[1];f[0]+=f[0];}
	printf("%lld\n",f[k]);
	return 0;
}

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

int main(){
  int w,h;
  cin >> h >> w;
  vector<vector<char>>hyo(h*2,vector<char>(w));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> hyo.at(i*2).at(j);
      hyo.at(i*2+1).at(j)=hyo.at(i*2).at(j);
    }
  }
  for(int i=0;i<h*2;i++){
    for(int j=0;j<w;j++){
      cout << hyo.at(i).at(j);
    }
    cout << endl;
  }
  exit(0);
}

Measured memory_bytes: 3612
#include <stdio.h>
#include <stdlib.h>

int solve(int, int);

int n,*A,q,*m;
int main(){
  int i,j=0;
  
  scanf("%d",&n);
  A=(int *)malloc(sizeof(int)*n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  scanf("%d",&q);
  m=(int *)malloc(sizeof(int)*q);
  for(i=0;i<q;i++) scanf("%d",&m[i]);

  for(i=0;i<q;i++){
    if(solve(0,m[i])==1) printf("yes\n");
    else printf("no\n");
  }
  
  return 0;
}

int solve(int i, int m){
  if(m==0) return 1;
  else if(i>=n) return 0;
  int res=solve(i+1,m)||solve(i+1,m-A[i]);
  return res;
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int a;
	cin >> a;
	cout << a + a*a + a*a*a << en;


	return 0;
}



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


int main(){

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

    sort(x, x+n);

    int num1 = x[n/2];
    int num2 = x[n/2-1];

    for(int i=0; i<n; i++){
        if(y[i] <= num2){
            cout << num1 << endl;
        }else{
            cout << num2 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3712
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  int N;
  std::cin >> N;
  std::vector<std::string> s(N);
  for (int i = 0; i < N; ++i)
    std::cin >> s[i];

  int M = 10;
  std::map<std::vector<int>, int> mp;

  for (int i = 0; i < N; ++i) {
    std::vector<int> tmp(30, 0);
    for (int j = 0; j < M; ++j)
      tmp[s[i][j] - 'a'] += 1;
    mp[tmp] += 1;
  }

  long long res = 0;
  for (auto key : mp) {
    // for (auto v : key.first) {
    //   std::cout << v << " ";
    // }
    // std::cout << ": " << key.second;
    // std::cout << std::endl;
    int num = key.second;
    for (int k = num - 1; k >= 1; --k) {
      res += k;
    }
  }

  std::cout << res << std::endl;


  return 0;
}


Measured memory_bytes: 27648
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LLI long long int
#define LI long int 
const LI MOD=1e9+7;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//            When something is important enough, you do it even if the odds are not in your favor.

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      char ch;cin>>ch;
      if(ch>='A'&&ch<='Z') cout<<'A';
      else cout<<'a';
    }
    return 0;
}

Measured memory_bytes: 3636
// 配りDPと集めDP
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}

// const long long INF = 1LL << 60;

int N;
long long a[100010][3];

// dp
long long dp[100010][3];

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j];

    for (int i = 0; i<N;++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j == k) continue;
                // 1-indexと0-indexが混ざっていてこんがらがった
                chmax(dp[i+1][j], dp[i][k]+a[i][j]);
            }
        }
    }

    // cout << max({dp[N-1][0], dp[N-1][1], dp[N-1][2]}) << endl;
    long long res = 0;
    for (int i = 0; i < 3; i++) chmax(res, dp[N][i]);
    cout << res << endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define fi first
#define se second
 
const ll MOD = 1000000007;
 
int main() {
   int a, b; scanf("%d%d", &a, &b);
   if ((max(a, b) - min(a, b)) % 2 == 0) {
      printf("%d", (max(a, b) + min(a, b)) / 2);
   } else {
      puts("IMPOSSIBLE");
   }
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
#include <cassert>
#include <unordered_map>
#include <chrono>
#include <random>
#include <ctime>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = 3.14159265358979323846;
const ll MOD = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	srand(time(0));
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int l, r, d;
	cin >> l >> r >> d;
	cout << r / d - (l - 1) / d;
}

Measured memory_bytes: 3620
from bisect import bisect_right
N = int(input())
A = [int(input()) for _ in range(N)]
ans = 1
min_vs = [A[-1]]
for i in range(N-2, -1, -1):
    a = A[i]
    idx = bisect_right(min_vs, a)
    if idx == len(min_vs):
        ans += 1
        min_vs.append(a)
    else:
        min_vs[idx] = a
print(ans)


Measured memory_bytes: 13600
<?php
  	$num = fgets(STDIN);
 	$arr = explode(" ",fgets(STDIN));
	$ans = 0;

	for ($i=0; $i<$num; $i++){

       for($j=$i+1; $j<$num; $j++)
       {
         $ans += $arr[$i] * $arr[$j];
       }
    }
echo $ans;

Measured memory_bytes: 4856
#include <cstdio>
#include <iostream>

using namespace std;

#define limit int(1e5 + 1)
int arr[ limit ];
int dn[ limit ];

int answer(int n) {
	fill(dn, dn + limit, int(1e9));
	dn[ 0 ] = arr[ 0 ];

	for(int i = 1; i < n; i++) {
		dn[ i ] = min(dn[ i ], dn[ i - 1 ] + abs(arr[ i - 1 ] - arr[ i ]));
		dn[ i + 1 ] = min(dn[ i + 1 ], dn[ i - 1 ] + abs(arr[ i - 1 ] - arr[ i + 1 ]));
	}

	return (dn[ n - 1 ] - dn[ 0 ]);
}

int main() {
	int n;
	scanf("%i", &n);

	for(int i = 0; i < n; i++) {
		scanf("%i", &arr[ i ]);
	}

	printf("%i", answer(n));
}

Measured memory_bytes: 1024
S = input()
N = len(S)
#print(N)

def checkpalin(s):
    if s == s[::-1]:
        return True
    else:
        return False

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


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define vl vector<ll>
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define sz size()
#define en end()
#define ro return 0
#define br break
#define con continue;
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define forr(i,a,b) for(ll i=a;i<b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair

bool op(pair<pair<long double , long double > , long double > &a , pair<pair<long double , long double > , long double > &b)
{
    long double foo = a.second ;

}

int main()
{
    ios;
    ll n , m ;
    cin >> n  >> m;
    vll v;
    forn(i , 1 , n){
       ll ai , bi ;
       cin >> ai >> bi ;
       v.pb({ai , bi});
    }
    sort(all(v));
    ll take = m  ;
    ll cost = 0 ;
    forn(i , 1 , n ){
       if(take == 0 ) br;
       ll foo = min(take , v[i-1].se);
       take = take - foo ;
       cost = cost + foo * v[i-1].fi;
    }
    cout << cost << el ;
    ro ;
}


Measured memory_bytes: 2420
def main()
  n = gets.chomp.to_i
  k = gets.chomp.to_i
  x = gets.chomp.split(' ').map(&:to_i)
  ans = 0
  x.each{|xi|
    ans = ans + [2 * xi, 2 * (k - xi)].min
  }
  puts ans
end

main()

Measured memory_bytes: 1788
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>


int main(void)
{
	long int i, j;
	long int n, k, q;
	long int sum;
	long int max;
	long int flgk, flgg;
	long int count;
	long int a[100000];
	char str[200];
	
	scanf("%s", str);
	
	flgk = flgg = 1;
	
	for(i = 0; i < strlen(str); i++) {
		if(i % 2 == 0) {
			if(str[i] == 'L') {
				flgg = 0;
			}
		} else {
			if(str[i] == 'R') {
				flgk = 0;
			}
		}
	}
	
	if(flgg * flgk) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	
	return 0;
}


Measured memory_bytes: 128
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def f(x, k, d, i)
  (x - k * d) + 2 * d * i
end

def main(argv)
  (x, k, d) = InputLine.to_ia

  hi = k + 1
  lo = 0
  while hi - lo > 4 do
    dist = (hi - lo) / 3
    midL = lo + dist
    midR = hi - dist

    valL = f(x, k, d, midL).abs
    valR = f(x, k, d, midR).abs

    if valL < valR then
      hi = midR
    else
      lo = midL
    end
  end

  lb = [0, lo - 10].max
  ub = [k, hi + 10].min
  mval = 1e+18.to_i
  (lb..ub).each do |i|
    mval = [mval, f(x, k, d, i).abs].min
  end
  puts mval.to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 14320
from functools import reduce
from fractions import gcd
N = int(input())
tn = [int(input()) for _ in range(N)]


def lcm_base(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


print(lcm_list(tn))

Measured memory_bytes: 5128
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<utility>
#include<string>
#include<set>
#include<iterator>
#define mx 1e9
typedef long long ll;
using namespace std;

int main()
{
    string a,b;
    cin>>a>>b;
    int n=a.size();
    for(int i=0;i<n;i++){
        if(a[i]!=b[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}



Measured memory_bytes: 3596
/*
    AUTHOR : TANMAY SINHA
    INORMATION TECHNOLOGY
    BIT MESRA ,RANCHI
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ld long double
#define ull unsigned long long int
#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define rep(i,L,R) for(i=L;i<R;i++)
#define DEBUG
#ifdef DEBUG
#define deb2(args...) {dbg,args; cerr<<endl;}
#else
#define deb2(args...)
#endif
struct debb{template<typename T> debb& operator,(const T &v){cerr<<v<<" ";return *this;}}dbg;
#define deb1(args...) do {cerr << #args << " : "; dbg,args; cerr << "\n";} while(0)
#define printa(a,L,R) rep(i,L,R) cout << a[i] <<' ';cout<<"\n";
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
template<typename T>T gcd(T a,T b){if(b==0)return a;else return gcd(b,a%b);}
template<typename T>T lcm(T a,T b){return a/gcd(a,b)*b;}
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1)res=((res%p)*(x%p))%p;y=y>>1;x=(x*x)%p;}return res;}
ll pow1(ll x,ll y){ll res=1;while(y>0){if(y&1)res=(res*x);y=y>>1;x=x*x;}return res;}
const ll INF = 1e18l+10,N = 1e5+10,MAX = 500500;
#define sq(X) ((X)*(X))

int main()
{
    ll h,n,i;
    cin>>h;
    n = (ull)log2(h)+1;
    cout<<(1ll<<n) - 1<<"\n";
}

Measured memory_bytes: 384
N = int(input())
src = [tuple(map(int, input().split())) for i in range(N-1)]

for i in range(N-1):
    time = 0
    for c, s, f in src[i:]:
        if time <= s:
            time = s+c
        else:
            if time%f == 0:
                time += c
            else:
                time += c + f-(time%f)
        
    print(time)
print(0)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;                                        
int main()
{
	int n,x,y;
    cin>>n;
    x=n*800;
    for(int i=1;i<=n/15;i++)
    {
        y++;
    }
    y=y*200;
    cout<<x-y;
    return 0;
} 

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
    l=[]
    l.append(a[i-1])
    l.append(a[i])
    l.append(a[i+1])
    l.sort()
    if l[1]==a[i]:
        ans+=1
print(ans)

Measured memory_bytes: 9188
#include <cstdio>
#include <cstdint>
#include <vector>

constexpr intmax_t mod = 1e9+7;

template <typename Tp>
Tp gcd(Tp a, Tp b, Tp& x, Tp& y) {
  x = Tp(0);
  y = Tp(1);
  for (Tp u = y, v = x; a;) {
    Tp q = b/a;
    std::swap(x -= q*u, u);
    std::swap(y -= q*v, v);
    std::swap(b -= q*a, a);
  }
  return b;
}

template <typename Tp>
Tp modinv(Tp a, Tp mod) {
  Tp x, y;
  gcd(a, mod, x, y);
  x %= mod;
  if (x < 0) x += mod;
  return x;
}

template <typename Tp>
Tp modadd(Tp a, Tp b, Tp mod) {
  a += b % mod;
  if (a < 0) a += mod;
  if (a >= mod) a -= mod;
  return a;
}

template <typename Tp>
Tp modadd(std::initializer_list<Tp> const& adds, Tp mod) {
  Tp res = 0;
  for (auto const& add: adds) {
    res += add % mod;
    if (res < 0) res += mod;
    if (res >= mod) res -= mod;
  }
  return res;
}

template <typename Tp>
Tp modsub(Tp a, Tp b, Tp mod) {
  a -= b % mod;
  if (a < 0) a += mod;
  if (a >= mod) a -= mod;
  return a;
}

template <typename Tp>
Tp modmul(std::initializer_list<Tp> const& muls, Tp mod) {
  Tp res = 1;
  for (auto const& mul: muls) (res *= mul) %= mod;
  return res;
}

template <typename Tp>
Tp modpow(Tp base, intmax_t iexp, Tp mod) {
  Tp res = 1;
  for (Tp dbl = base; iexp; iexp >>= 1) {
    if (iexp & 1) res = res * dbl % mod;
    dbl = dbl * dbl % mod;
  }
  return res;
}

class modchoose {
  std::vector<intmax_t> fact, fact_inv;
  const intmax_t mod;

public:
  modchoose(intmax_t N, intmax_t mod): mod(mod) {
    fact.resize(N+1);
    fact_inv.resize(N+1);
    fact[0] = 1;
    for (intmax_t i = 1; i <= N; ++i)
      fact[i] = fact[i-1] * i % mod;

    fact_inv[N] = modinv(fact[N], mod);
    for (intmax_t i = N; i--;)
      fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
  }

  intmax_t operator ()(intmax_t n, intmax_t r) const {
    intmax_t res = fact[n] * fact_inv[r] % mod;
    (res *= fact_inv[n-r]) %= mod;
    return res;
  }
};

class modfactorial {
  std::vector<intmax_t> fact, fact_inv;
  intmax_t mod;

public:
  modfactorial(intmax_t N, intmax_t mod): mod(mod) {
    fact.resize(N+1);
    fact_inv.resize(N+1);
    fact[0] = 1;
    for (intmax_t i = 1; i <= N; ++i)
      fact[i] = fact[i-1] * i % mod;

    fact_inv[N] = modinv(fact[N], mod);
    for (intmax_t i = N; i--;)
      fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
  }

  intmax_t operator ()(intmax_t k) const {
    return fact[k];
  }

  intmax_t inverse(intmax_t k) const {
    return fact_inv[k];
  }
};

int main() {
  intmax_t n, k;
  scanf("%jd %jd", &n, &k);

  modchoose mc(k, mod);
  modfactorial mf(k, mod);
  intmax_t res = 0;
  for (intmax_t j = 1; j <= k; ++j) {
    intmax_t res0 = 0;
    for (intmax_t i = 1; i <= j; ++i) {
      intmax_t cur = mc(j, i);
      if ((i-1) % 2) cur = (mod-cur) % mod;
      (cur *= modpow(j-i, n, mod)) %= mod;
      (res0 += cur) %= mod;
    }
    res0 = modsub(modpow(j, n, mod), res0, mod) * mf.inverse(j) % mod;
    (res += res0) %= mod;
  }
  printf("%jd\n", res);
}



Measured memory_bytes: 2772
#include <iostream>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	bool find = false;
	int sche[9] = {111,222,333,444,555,666,777,888,999};
	for (int i = 0; !find && i < 9; ++i) {
		if (N <= sche[i]) {
			cout << sche[i] << endl;;
			find = true;
		}
	}
	return 0;
}



Measured memory_bytes: 256
#!venv/bin/python
 
import math
import numpy as np
import random
import copy
import statistics 
import bisect
import heapq
from collections import defaultdict 
import time

N = int(input())
W = [ int(x) for x in input().split() ]

s = sum(W)
min = 100000
for i in range(N):
    s1 = sum(W[0:i+1])
    s2 = s - s1
    if abs(s1 - s2) < min:
        min = abs(s1 - s2)

print(min)


Measured memory_bytes: 23840
//aising2019_c.cpp
//Sat Jan 12 21:08:03 2019

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int tm[] = {0,-1,0,1};
	int ym[] = {1,0,-1,0};
	int visitedblack[h][w];
	int visited[h][w];
	for (int x=0;x<h;x++){
			for (int y=0;y<w;y++){
			visitedblack[x][y] = 0;
			visited[x][y] = 0;
		}
	}
	ll ans = 0;
	for (int i=0;i<h;i++){
		for (int j=0;j<w;j++){
			if (s[i][j]=='.' || visitedblack[i][j] == 1){
				continue;
			}
			queue<int> tate;
			queue<int> yoko;
			tate.push(i);
			yoko.push(j);
			visited[i][j] = 1;
			visitedblack[i][j] = 1;
			ll tempans = 0LL;
			ll numblack = 1LL;
			while (tate.size()){
				int tempt = tate.front();tate.pop();
				int tempy = yoko.front();yoko.pop();
				char curcol = s[tempt][tempy];
//				cout << "\t" << tempt << " " << tempy << endl;
				for (int k=0;k<4;k++){
					int tmoved = tm[k]+tempt;
					int ymoved = ym[k]+tempy;
					if (tmoved>=0 && tmoved<h && ymoved>=0 && ymoved<w){
						if (s[tmoved][ymoved]!=curcol && visited[tmoved][ymoved]!=1){
							tate.push(tmoved);
							yoko.push(ymoved);
							visited[tmoved][ymoved] = 1;
//							cout << "\t\t" << tmoved << " " << ymoved << endl;

							if (s[tmoved][ymoved] == '.'){
								tempans++;
							}else {
								numblack++;
								visitedblack[tmoved][ymoved] = 1;
							}
						}
					}
				}
			}
			ans += tempans * numblack;
//			cout << "\t\t\t" << tempans << " " << numblack << endl;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>

using namespace std;

#define ll long long
#define vec vector
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

int main()
{
	ll a,b;

	cin >> a >> b;

	if (a + b >= 10)
		cout << "error" << "\n";
	else
		cout << a + b << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
const int maxn=1000000;
int h[maxn];// f[i]表示到达第i个点的 最小花费  
ll f[maxn];
ll Max=10000000000LL;
int main()
{
	int n,k;
	cin>>n>>k;
	for (int i=1;i<=n;i++) scanf("%d",&h[i]);
	for (int i=2;i<=n;i++) f[i]=Max;
	for (int i=2;i<=n;i++) 
		for (int j=1;j<=k;j++){
			if (i-j>0) f[i]=min(f[i-j]+abs(h[i]-h[i-j]),f[i]);
		}
	cout<<f[n];
	return 0;
} 

Measured memory_bytes: 5120
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;

int main(){
	long long x,y;
  cin >> x >> y;
  int i = 1;
  while(true){
    x = x * 2;
    if(x > y){
      cout << i << endl;
      exit(0);
    }
    i++;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
vector<string>v;
void dfs(string str,string t="",int cnt=0){
    if(cnt==2){
        v.push_back(t);
        return;
    }else{
        for(int i=0;i<str.size();i++){
            dfs(str,t+str[i],cnt+1);
        }
    }
}
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n;
    while(cin>>n){
        n==3||n==5||n==7?cout<<"YES"<<endl:cout<<"NO"<<endl;
    }
    return 0;
}


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

#define ALL(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0, __##i##_length = (n); i < __##i##_length; i++)
#define rep_reverse(i, n) for (ll i = (n)-1; 0 <= i; i--)
#define FOR(i, from, to) for (ll i = (from), __##i##_end = (to); i < __##i##_end; i++)
#define FOR_REVERSE(i, from, to) for (ll i = (to)-1, __##i##_end = (from); __##i##_end <= i; i--)
#define foreach(e, v) for (const auto e : (v))
#define vfree(v) std::vector<int>().swap(v)
#define DEBUG(x) cout << #x << " = " << (x) << endl

using namespace std;
typedef int64_t ll;
typedef vector<ll> llv;
typedef vector<llv> llvv;
constexpr ll ll_max = numeric_limits<ll>::max();

int main()
{
  ll N;
  cin >> N;
  llv A(N);
  rep(i, N)
  {
    cin >> A[i];
  }
  sort(ALL(A));
  ll n = *A.rbegin();
  auto iter = lower_bound(ALL(A), n / 2);
  if (*iter == n / 2)
  {
    cout << n << " " << n / 2 << endl;
    return 0;
  }

  ll r = 0;
  ll dist = abs(n - r * 2);

  rep(i, N)
  {
    if (A[i] != n && abs(n - A[i] * 2) < dist)
    {
      r = A[i];
      dist = abs(n - A[i] * 2);
    }
  }

  cout << n << " " << r << endl;

  return 0;
}


Measured memory_bytes: 1024
/*
 *  Created on: 19 / 9 / 2020
 *  Author:     Eslam Waheed
 */

#define _CRT_SECURE_NO_WARNINGS
//#define __USE_MINGW_ANSI_STDIO

#include<bits/stdc++.h>
//#include <bits/BIGINT.h>
//#include <bits/Int128.h>
using namespace std;

#define Eslam__Waheed ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

#define ll   long long
#define ull  unsigned ll
#define ld   long double

#define all(c)  c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define stp(n)  cout << fixed << setprecision(n);
#define iq(v)   v.resize(unique(v.begin(),v.end())-v.begin())
#define sz(s)   s.size()
#define endl    '\n'

//ll gcd(ll a, ll b) { return !b ? abs(a) : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return abs(a / gcd(a, b)) * b; }

//const ld PI = acos(-1);
//const ll mod = 1e9 + 7;
//const ld EPS = 1e-8;
/*
 you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )
*/
int main()
{
    //stp(0)
    Eslam__Waheed;
    ll t; cin >> t;
    int x = 0, ans = INT_MIN;
    while (t--)
    {
        ll a, b; cin >> a >> b;
        if (a == b)
            x++;
        else
        {
            ans = max(ans, x);
            x = 0;
        }
    }
    ans = max(ans, x);
    if (ans >= 3)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    int n; cin>>n;
    int dp[100000]={0};
    dp[0]=2;
    dp[1]=1;
    for(int i=2;i<=n;i++)
        dp[i]=dp[i-1]+dp[i-2];
    cout<<dp[n]<<endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
using namespace std;

struct Node{
    int key;
    Node *right,*left,*parent;
};

Node *root,*NIL;

Node * find(Node *u,int k){
    while(u != NIL && k != u->key){
        if( k< u->key ) u= u->left;
        else u = u->right;
    }
    return u;
}

void insert(int k){
    Node *y = NIL;//设y为x的ｆ父结点
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while( x!=NIL) {
        y = x;//设y为插入结点z的父结点
        if (z->key < x->key) x = x->left;
        else x = x->right;
    }

    z->parent = y;
    if( y==NIL ) root = z;
    else if (z->key < y->key) y->left = z;//将z定为y的左子结点
    else y->right = z;//将z定为y的右子结点.


}


void inorder(Node *u){
    if(u==NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}

void preorder(Node *u){
    if(u==NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}


int main(){
    int n,i,x;
    string com;

    scanf("%d",&n);

    for(i=0; i<n; i++){
        cin >> com;
        if(com[0]=='f'){
            scanf("%d",&x);
            Node *t = find(root,x);
            if(t!=NIL) printf("yes\n");
            else printf("no\n");
        }else if(com == "insert"){
            scanf("%d",&x);
            insert(x);
        }else if(com=="print"){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    return 0;
}












Measured memory_bytes: 22036
#include<iostream>
#define p(i)  (i>>1)
#define l(i)  (i<<1)
#define r(i)   ((i<<1)+1)
using namespace std;
int a[10005];
int main()
{
    int n,Case=0;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)
    {
        cout<<"node "<<++Case<<": key = "<<a[i]<<", ";
        if(p(i)>=1) cout<<"parent key = "<<a[p(i)]<<", ";
        if(l(i)<=n) cout<<"left key = "<<a[l(i)]<<", ";
        if(r(i)<=n) cout<<"right key = "<<a[r(i)]<<", ";
        cout<<endl;
    }
    return 0;
}



Measured memory_bytes: 3096
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
	int n, d;
	double x[10][10];
	cin >> n >> d;
    
	REP(i, n){
		REP(j, d) cin >> x[i][j];
	}
	REP(i, n-1){
		for(int j=i+1; j<n; j++){
			double dis=0;
		
			REP(k, d){
				dis += (x[i][k]-x[j][k]) * (x[i][k]-x[j][k]);
			}
			dis = sqrt(dis);
			if(dis - (int) dis == 0) ans ++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
  IOS();
  ll a,b,c;
  cin>>a>>b>>c;
  ll ans = 0;
  if( a%2==0 && a==b && b==c ) return cout<<-1<<endl,0;
  while(1){
    if( a&1 || b&1 || c&1 ) break;
    if( a==b && b==c ) return cout<<-1<<endl,0;
    ans++;
    ll ta = a, tb = b, tc = c;
    a = (tb+tc)/2;
    b = (ta+tc)/2;
    c = (ta+tb)/2;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
program sample
    implicit none
  
    integer(8) :: i,j,k,m,n,l,r,d,a(10000),x,y,z
    
    read(*,*) n
    a(:)=0
    do i=1,100
        do j=1,100
            do k=1,100
                x=i**2+j**2+k**2+i*j+j*k+k*i
                if(x<=10000)then
                    a(x)=a(x)+1
                end if
            end do
        end do
    end do
    do i=1,n
        write(*,*) a(i)
    end do
    stop
end program sample
  


  



Measured memory_bytes: 2820
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
s = input()
t = input()
if s == t:
	print(N)
	exit()

for i in range(1, N):
	s1 = s[i:]
	t1 = t[:-i]
	if s1 == t1:
		print(2*N-len(s1))
		break
else:
	print(2*N)


Measured memory_bytes: 13584