akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
using namespace std;

int main() {

int a[50100];
a[0]=0;
a[1]=0;
a[2]=1;
a[3]=1;
a[5]=1;
for(int kk=2;kk<25050;kk++){
	a[2*kk]=0;
}
for(int k=3;k<25050;k++){
	int n,q=1;
	n=sqrt(2*k+1);
	for(int j=1;j<=n/2;j++){
	if(	(2*k+1)%(2*j+1)==0){
		q=0;
	}
	}
a[2*k+1]=q;
}
int p;
while(cin>>p){
	int l=1,m=1;
	while(a[p+l]==0){
		l=l+1;
	}
	while(a[p-m]==0){
		m=m+1;
	}
	cout<<p-m<<" "<<p+l<<endl;
}
	return 0;
}

Measured memory_bytes: 1352
n = gets.to_i
as = gets.split(" ").map(&:to_i)

b = Array.new(n, nil)
flg = true
fi = 0
li = -1
n.times do |i|
  a = as.pop
  if flg
    b[fi] = a
    fi += 1
  else
    b[li] = a
    li -= 1
  end
  flg = !flg
end

puts b.join(" ")

Measured memory_bytes: 23788
/* ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ */
/* ☻ Name : Souvik Mahato  ☻ */
/* ☻ Nick : WIZARDO        ☻ */
/* ☻ Institution : IIEST   ☻ */
/* ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ ☻ */

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

#define ll long long int
#define in(v) (v).begin(),(v).end()
#define rin(v) (v).rbegin(),(v).rend()
#define inf 1e9+7



int solvius()
{
    int n,i,j;
    cin>>n;
    vector<int> h(n),cost(n,inf);
    for(int &x : h)
        cin>>x;
    cost[0]=0;
    for(i=0;i<n;i++)
    {
        for(int j : {i+1,i+2})
            cost[j]=min(cost[j],cost[i]+abs(h[j]-h[i]));
    }
    cout<<cost[n-1];
    return 0;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);    
	ll t=1;
   // cin>>t;
	while(t--)
		solvius();
    return 0;
}

Measured memory_bytes: 3904
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
int main(void)
{
    int r, c, sum;
    cin >> r >> c;
    vector<vector<int> > table(r + 1, vector<int>(c + 1));
    
    rep(i, r)
    {
        rep(j, c)
        {
            cin >> table.at(i).at(j);
        }
    }
    
    rep(i, r)
    {
        sum = 0;
        rep(j, c)
        {
            sum += table.at(i).at(j);
        }
        table.at(i).at(c) = sum;
    }
    
    rep(i, c + 1)
    {
        sum = 0;
        rep(j, r)
        {
            sum += table.at(j).at(i);
        }
        table.at(r).at(i) = sum;
    }
    
    rep(i, r + 1)
    {
        rep(j, c + 1)
        {
            cout << table.at(i).at(j);
            if (j != c)
            {
                cout << " ";
            }
            else
            {
                cout << endl;
            }
        }
    }
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<long> a(n), b(n);
    for(int i = 0; i < n; i++)
        cin >> a[i] >> b[i];
    long ans = 0;
    for(int i = n-1; i >= 0; i--){
        a[i] += ans;
        ans += ((a[i] / b[i]  + 1)* b[i] - a[i]) % b[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll C[55][55];
// Prototype of a utility function that returns minimum of two integers
ll min(ll a, ll b);
 
// Returns value of Binomial Coefficient C(n, k)
ll binomialCoeff(ll n, ll k)
{
    
    ll i, j;
 
    // Caculate value of Binomial Coefficient in bottom up manner
    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= min(i, k); j++)
        {
            // Base Cases
            if (j == 0 || j == i)
                C[i][j] = 1;
 
            // Calculate value using previosly stored values
            else
                C[i][j] = C[i-1][j-1] + C[i-1][j];
        }
    }
 
    return C[n][k];
}
 
// A utility function to return minimum of two llegers
ll min(ll a, ll b)
{
    return (a<b)? a: b;
}
 
/* Drier program to test above function*/
int main()
{
	ll n,k,odd=0,even=0;
	cin>>n>>k;
	ll a[n];
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]&1)
		odd++;
		else
		even++;
	}
	binomialCoeff(n,n);
	if(k&1)
	{
		ll ans=0,first=0,second=0;
//		cout<<"hello "<<odd<<" "<<even<<endl;
		for(int i=0;i<=even and even!=0;i++)
		{
			first+=C[even][i];
		}
		for(int i=1;i<=odd and odd!=0;i+=2)
		{
			second+=C[odd][i];			
		}
	//	cout<<first<<" "<<second<<endl;
		if(first==0)
		cout<<second;
		else if(second==0)
		cout<<"0";
		else
		cout<<first*second;
	}
	else
	{
		ll ans=0,first=0,second=0;
		for(int i=0;i<=even and even!=0;i++)
		{
			first+=C[even][i];
		}
		for(int i=0;i<=odd and odd!=0;i+=2)
		{
			second+=C[odd][i];			
		}
		if(first==0)
		cout<<second;
		else if(second==0)
		cout<<first;
		else
		cout<<first*second<<endl;
	}
    return 0;
}

Measured memory_bytes: 256
from itertools import accumulate
N, C = map(int, input().split())
XV = [tuple(map(int, input().split())) for _ in range(N)]

# 時計回りに寿司を食べていく
eat = 0
walk = 0
now = 0
clockwise = [(0, 0)]
for x, v in XV:
    eat += v
    walk += x-now
    clockwise.append((eat, walk))
    now = x

# 半時計周りに食べていく
eat = 0
walk = 0
now = C
counter_clockwise = [(0, 0)]
for x, v in XV[::-1]:
    eat += v
    walk += now - x
    counter_clockwise.append((eat, walk))
    now = x

# 前処理
best_left_go = [e - w for e, w in counter_clockwise]
best_left_go = list(accumulate(best_left_go, func=max))
best_left_back = [e - 2 * w for e, w in counter_clockwise]
best_left_back = list(accumulate(best_left_back, func=max))
best_right_go = [e - w for e, w in clockwise]
best_right_go = list(accumulate(best_right_go, func=max))
best_right_back = [e - 2 * w for e, w in clockwise]
best_right_back = list(accumulate(best_right_back, func=max))

# 時計回りして戻って反時計回りに食べる
ans = 0
for i, rb in enumerate(best_right_back):
    calorie = rb + best_left_go[N - i]
    ans = max(ans, calorie)
# 反時計回りして戻って時計回りに食べる
for i, lb in enumerate(best_left_back):
    calorie = lb + best_right_go[N - i]
    ans = max(ans, calorie)

print(ans)

Measured memory_bytes: 61332
N = int(input())
S = input()

mx=0

for i in range(1,N):
    str1=S[i:]
    str2=S[:i]

    same=[]

    for c1 in str1:
        for c2 in str2:
            if c1==c2:
                same.append(c1)

    if mx < len(set(same)):
        mx= len(set(same))

print(mx)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n;
    rep(i,n)cin>>a[i];
    while(1){
        int ok=0;
        rep(i,n){
            if(a[i]%2==1){
                ok=1;
                break;
            }
        }
        if(ok)break;
        ans++;
        rep(i,n)a[i]/=2;
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int P=1e9+7;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
const int N=2e5+5;
struct Matrix{
	int a[3][3];
	inline Matrix(){memset(a,0,sizeof(a));}
	inline int* operator [](const int &x){return a[x];}
	inline Matrix operator *(Matrix b){
		Matrix c;
		fp(i,0,2)fp(k,0,2)fp(j,0,2)upd(c[i][j],mul(a[i][k],b[k][j]));
		return c;
	}
}bin[35],A,B,ans;
int a[N],n,m;
inline Matrix ksm(R int x){
	Matrix c;c[0][0]=c[1][1]=c[2][2]=1;
	for(R int i=0;x;x>>=1,++i)if(x&1)c=c*bin[i];
	return c;
}
int main(){
	scanf("%d%d",&n,&m);
	fp(i,1,m)scanf("%d",&a[i]),++a[i];
	A[0][0]=1,A[0][1]=2,A[0][2]=1;
	A[1][0]=0,A[1][1]=1,A[1][2]=1;
	A[2][0]=1,A[2][1]=2,A[2][2]=2;
	B=A,B[2][0]=0,B[2][1]=0,B[2][2]=1;
	bin[0]=A;fp(i,1,30)bin[i]=bin[i-1]*bin[i-1];
	ans[0][0]=ans[1][1]=ans[2][2]=1;
	fp(i,1,m)ans=ans*ksm(a[i]-a[i-1]-1)*B;
	ans=ans*ksm(n-a[m]);
	printf("%d\n",ans[0][2]);
	return 0;
}

Measured memory_bytes: 640
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    H, W = MAP()
    A = [input() for i in range(H)]
    ans = ["#" * (W + 2)] + ["#" + A[i] + "#" for i in range(H)] + ["#" * (W + 2)]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()




Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
#define ALL(x) (x).begin(), (x).end()
LL POW(LL a,LL p,LL M){ if(!p) return 1LL;LL T = POW(a,p/2,M);T = T*T%M; if(p&1) T=T*(a%M)%M; return T; }
LL SQRT(LL a) { LL b = (LL)sqrtl(((double)a)+0.5); while(b*b<a) ++b; while(b*b>a) --b; return (b*b==a)?b:-1; }
//endl
//<------------------------edits---------------------------------------------->
const LL MOD = 1e9+7;//998244353
// #define LOCAL LDD
// #define int LL

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);cout << fixed;
#ifdef LOCAL
  freopen("input.txt", "rt", stdin);
#endif
  int n;cin >> n;
  vector<LL> v(n);
  LL pr = 0;LL sm = 0;
  for(int i=0;i<n;i++) {cin >> v[i];sm += v[i];}
  LL f = LONG_LONG_MAX;
  for(int i=0;i<n-1;i++){
    pr += v[i];
    LL rem = sm - pr;
    rem = abs(rem-pr);
    f = min(f,rem);
  }  
  cout << f << endl;
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
  return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
struct node{
	node* nxt[26];
    int num;
	node(int num=0):num(num){
		fill(nxt, nxt+26, nullptr);
	}
};
int m;
int cnt[1000010];
int cntc[26][1000010];
int x[26];
void add(node* t, string p){
	node* t0=t;
	for(int i=0; i<p.size(); i++){
		if(!t0->nxt[p[i]-'a']){
			t0->nxt[p[i]-'a']=new node(m++);
		}
		t0=t0->nxt[p[i]-'a'];
        for(int j=0; j<26; j++){
            if(x[j]==i){
                cntc[j][t0->num]++;
            }
        }
	}
    cnt[t0->num]++;
}
ll cnts[1000010];
ll dp[26][1000010];
ll ans;
void dfs(node* t){
	if(!t) return;
    for(int l=0; l<26; l++){
        dp[l][t->num]+=cntc[l][t->num];
    }
	for(int j=0; j<26; j++){
        if(!t->nxt[j]) continue;
        dfs(t->nxt[j]);
        cnts[t->num]+=cnts[t->nxt[j]->num];
        for(int l=0; l<26; l++){
            dp[l][t->num]+=dp[l][t->nxt[j]->num];
        }
    }
    for(int j=0; j<26; j++){
        if(!t->nxt[j]) continue;
        for(int l=0; l<26; l++){
            if(!t->nxt[l] || l==j) continue;
            ans+=dp[l][t->nxt[j]->num]*cnt[t->nxt[l]->num];
        }
    }
    ans+=cnts[t->num]*cnt[t->num];
    cnts[t->num]+=cnt[t->num];
}
int main()
{
    int n; cin>>n;
    node t; m=1;
    for(int i=0; i<n; i++){
        string s; cin>>s;
        reverse(s.begin(), s.end());
        for(int j=0; j<26; j++){
            x[j]=-1;
        }
        int l=s.size();
        for(int j=0; j<s.size(); j++){
            if(x[s[l-1-j]-'a']==-1){
                x[s[l-1-j]-'a']=l-1-j;
            }
        }
        add(&t, s);
    }
    dfs(&t);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 534036
#include <stdio.h>

int main(void) {
   
   int N,K;
   scanf("%d%d",&N,&K);
   
   char S[N+10];
   scanf("%s",S);
   
   if(S[K - 1] == 'A'){
      S[K - 1] = 'a';
   }
   else if(S[K - 1] == 'B') {
      S[K - 1] = 'b';
   }
   else {
      S[K - 1] = 'c';
   }
   
   printf("%s\n",S);
   
   
   return 0;
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  string S;
  cin >> S;

  int ans = 1;
  string t;
  t.push_back(S.front());
  string b;
  rep(i, 1, S.size()) {
    b.push_back(S[i]);
    if (t != b) {
      ans++;
      t = b;
      b.clear();
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
string i_t_s(int x){
	string t="";
	while(x){
		t+=x%10+'0';
		x/=10;
	}
	reverse(all(t));
	re t;
}
int s_t_i(string t){
	int x=0;
	rep(i,sz(t)){
		x=x*10+(t[i]-'0');
	}
	re x;
}
int n;
ll a[200001];
ll ans;
ll sum;
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	rep(i,n){
		cin>>a[i];
		sum+=a[i];
		sum%=mod;
	}
	rep(i,n){
		sum-=a[i];
		if(sum<0)
		sum+=mod;
		ll ans1=a[i]*sum;
		ans1%=mod;
		ans+=ans1;
		ans%=mod;
	}
	cout<<ans;
	re 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> V(N);
  vector<int> C(N);
  
  for( int i = 0; i < N; i++ ) cin >> V.at(i);
  for( int i = 0; i < N; i++ ) cin >> C.at(i);
  
  int ans = 0;
  for( int i = 0; i < N; i++ ){
    if( V.at(i) - C.at(i) > 0 ) ans += V.at(i) - C.at(i);
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a+b==c||a+c==b||c+b==a){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl


int main() {
    int N;  cin >> N;
    vector<string> S(N);
    vector<int> P(N);
    rep(i, N) cin >> S[i] >> P[i];

    pair<pair<string, int>, int> p[110];
    rep(i, N) {
        p[i] = make_pair(make_pair(S[i], -P[i]), i);
    }
    sort(p, p+N);
    rep(i, N) print(p[i].second+1);

}



Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
int main(int argc, const char * argv[]) {
    char word;
    while(1){
        scanf("%c",&word);
    if(word=='\n'){
        printf("\n");
        break;
    }else if(isupper(word)){
        printf("%c",tolower(word));
    }else if(islower(word)){
        printf("%c",toupper(word));
    }else{
        printf("%c",word);
    }
    }
    return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
int main(){ 
  int e[4];
  for(int i=0;i<4;++i) cin>>e[i];
  sort(e,e+4);
  cout<<((e[0]==e[1]&&e[2]==e[3])?"yes":"no")<<endl;
  return 0;
}



Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

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;}

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(b-a == c-b) cout << "YES" << endl;
  else cout << "NO" << endl;
} 






Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


char str[20]={0};
int main(int argc, char* argv[])
{
    scanf("%s", str);
    str[4]='\0';
    if(strcmp(str,"YAKI")==0) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }



    return 0;
}


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

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define rep1(i,n) rep(i,1,n+1)

#define BR "\n"
#define SP " "

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

  vector<ll> A[N];

  rep0(i, Q) {
    int index; cin >> index;

    if (index == 0) {

      int t, x; cin >> t >> x;
      A[t].push_back(x);

    } else if (index == 1) {

      int t; cin >> t;
      if (A[t].empty()) {
        cout << BR;
      } else {
        int s = A[t].size() - 1;
        rep0(j, s) {
          cout << A[t][j] << SP;
        }
        cout << A[t][s] << BR;
      }
    } else {
      
      int t; cin >> t;
      A[t].clear();
    }
  }
  return 0;
}


Measured memory_bytes: 8860
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int Mod = 1000000007;

ll powmod(ll n, ll k) {
    ll r = 1, t = n % Mod;
    for (; k != 0; k /= 2) {
        if (k & 1) r = r * t % Mod;
        t = t * t % Mod;
    }
    return r;
}

ll gcd(ll n, ll m) {
    if (n < m) swap(n, m);
    while (m != 0) {
        ll r = n % m;
        n = m;
        m = r;
    }
    return n;
}

struct P {
    bool operator<(const P &p) const {
        return a != p.a ? a < p.a : b < p.b;
    }
    ll a, b;
    int t;
};

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

    int n;
    cin >> n;

    int m = 0;
    vector<P> p;

    for (int i = 0; i < n; i++) {
        ll a, b;
        cin >> a >> b;

        if (a == 0 && b == 0) {
            m++;
        } else {
            ll c = gcd(abs(a), abs(b));
            if (b < 0 || (b == 0 && a < 0)) {
                c *= -1;
            }
            a /= c;
            b /= c;

            int t = a <= 0;
            if (t) {
                ll x = a;
                a = b;
                b = -x;
            }
            //cout << a << ' ' << b << endl;

            p.push_back({ a, b, t });
        }
    }
    sort(p.begin(), p.end());

    p.push_back({ 0, 0, -1 });
    n = p.size();

    ll a = 0, b = 0, r = 1;
    int k = 0, t = 0;

    for (int i = 0; i < n; i++) {
        if (!(p[i].a == a && p[i].b == b)) {
            if (i != 0) {
                //cout << k-t << ' ' << t << endl;
                r *= powmod(2, k - t) + powmod(2, t) - 1;
                r %= Mod;
            }
            k = 0;
            t = 0;
            a = p[i].a;
            b = p[i].b;
        }
        k++;
        t += p[i].t;
    }

    r += m;
    r--;
    r %= Mod;
    if (r < 0) r += Mod;

    cout << r << endl;

    //0匹選ぶ1通りは引き算する (0,0)にいるのは単品でしか使えない
    //90度違いは無視して同じ向きのやつで分類
    //向きが同じであることをどう判定するか

    return 0;
}

Measured memory_bytes: 9528
#include <iostream>
#include <vector>
#define eol '\n'
using namespace std;

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

  string s;
  cin >> s;
  int n = s.size();

  if (n == 2) {
    if (s[0] == s[1]) {
      cout << "1 2" << eol;
    } else {
      cout << "-1 -1" << eol;
    }
    return 0;
  }

  for (int i = 0; i < n-2; i++) {
    if (s[i] == s[i+1]) {
      cout << (i+1) << " " << (i+2) << eol;
      return 0;
    } else if (s[i] == s[i+2]) {
      cout << (i+1) << " " << (i+3) << eol;
      return 0;
    }
  }
  
  cout << "-1 -1" << eol;
  return 0;
}


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int[] l = new int[m];
		int[] r = new int[m];
		for (int i = 0; i < m; i++) {
			l[i] = Integer.parseInt(sc.next());
			r[i] = Integer.parseInt(sc.next());
		}

		int ans = Arrays.stream(r).min().getAsInt() - Arrays.stream(l).max().getAsInt() + 1;

		System.out.println(Math.max(ans, 0));

	}

}


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

int main(void){
    long n;
    cin >> n;
    vector<long> v(n);
    vector<long> d(n-1);
    for(long i=0; i<n; i++){
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    long vmax = v[n-1];
    long dmin = LONG_MAX;
    long imin = -1;
    for(long i=0; i<n-1; i++){
        long t = labs(2*v[i]-vmax);
        if(t<dmin){
            dmin = t;
            imin = i;
        }
    }
    cout << vmax << " " << v[imin] << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main() {
    int w,h;
    cin >> w >> h;
    while(w!=0||h!=0) {
        for(int i=0;i < w;i++){
            for(int j=0;j < h;j++)
                cout << '#';
            cout << endl;
        }
        cout << endl;
        cin >> w >> h;
    }
    return 0;
}


Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
const int MX  = 3e3+5;
long long dp[MX][MX] = {};
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  vector <int> a(n);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i]*1LL;
    dp[i][i] = a[i];
  }
  for (int i = n-1; i >= 0; i--) {
    for (int j = 0; j < n; j++) {
      if(j - i == 1) dp[i][j] = max(a[j], a[i]);
     else if(j - i  > 1) dp[i][j] = max(min(dp[i+2][j],dp[i+1][j-1]) + a[i], min(dp[i][j-2], dp[i+1][j-1])+a[j]);
    }
  }
  cout << (2*dp[0][n-1] - sum);
  return 0;
}




Measured memory_bytes: 70016
#include <stdio.h>
int main(void){
	char a[101];
	int i,j,n;
	while(scanf("%s",a)!=EOF){
		i=0;
		while(a[i]!='\0'){
			if(a[i]=='@'){
				n=a[++i]-'0';
				++i;
				for(j=0;j<n;j++){
					printf("%c",a[i]);
				}
			}
			else{
				printf("%c",a[i]);
			}
			++i;
		}
		printf("\n");
	}
	return 0;
}

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

int main(void)
{
    char word[21];
    scanf("%s", word);
    for(int i = 20; i >= 0; i--)
    {
        if((word[i] >= 48 && word[i] <= 57) || (word[i] >= 65 && word[i] <= 90) || (word[i] >= 97 && word[i] <= 122))
        {
            printf("%c", word[i]);
        }
    }
    printf("\n");
}



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

int main()
{
  int n;
  cin>>n;
  n=n%10;
  if(n==2||n==4||n==5||n==7||n==9)
    cout<<"hon";
  else if(n==3)
    cout<<"bon";
  else
    cout<<"pon";
  return 0;
}

Measured memory_bytes: 3624
use std::io;
 
fn abs(buf:String) -> i32 {
    let mut result = 0;
    for x in buf.chars() {
        if x == '1' {
            result += 1
        }
    }
    return result;
}
 
fn main() {
    /*
    assert_eq!(abs("101".to_string()), 2);
    assert_eq!(abs("000".to_string()), 0);
    */
	let stdin = io::stdin();
    let mut line = String::new();
    stdin.read_line(&mut line).ok();
    let txt:Vec<_> = line.trim().split(' ').collect();
    let buf:String = txt[0].parse().unwrap();
 
    let result = abs(buf);
    println!("{}", result)
}

Measured memory_bytes: 4352
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(10000000)

n = input()
s = input()

for i in range(2, 10 ** 6):
    num = n
    S = 0
    while num > 0:
        S += num % i
        num /= i
    if S == s:
        print i
        exit()

if n < s:
    print -1
    exit()

if n == s:
    print n + 1
    exit()

ans = -1
for p in range(1, 10 ** 6):
    if (n - s) % p == 0:
        i = (n - s) / p + 1
        q = s - p
        if p < i and 0 <= q < i:
            ans = (n - s) / p + 1

print ans

Measured memory_bytes: 36600
import sys
from collections import deque


def bfs(x1, y1, d):
    q = deque([])
    q.append((d, x1, y1))
    M[x1][y1] = d

    while q:
        d, x1, y1 = q.popleft()

        if [x1, y1] == [xg, yg]:
            print(d)
            return

        for dx, dy in ((0, 1), (1, 0), (0, -1), (-1, 0)):
            for k in range(1, K + 1):
                x2 = x1 + dx * k
                y2 = y1 + dy * k
                if x2 < 0 or x2 >= H:
                    break
                if y2 < 0 or y2 >= W:
                    break
                if m[x2][y2] == '@':
                    break
                if M[x2][y2] < d + 1:
                    break
                if M[x2][y2] == d + 1:
                    continue

                q.append((d + 1, x2, y2))
                M[x2][y2] = d + 1

                # if (0 <= x2 < H) and (0 <= y2 < W):
                #     if m[x2][y2] == '@':
                #         break
                #     elif M[x2][y2] == -1:
                #         M[x2][y2] = d + 1
                #         q.append((d + 1, x2, y2))
                #     elif M[x2][y2] == d + 1:
                #         continue
                #     else:
                #         break
                # else:
                #     break
    print(-1)


H, W, K = map(int, sys.stdin.readline().strip().split())
xs, ys, xg, yg = map(int, sys.stdin.readline().strip().split())
xg -= 1
yg -= 1

m = []
for _ in range(H):
    m.append(list(map(str, sys.stdin.readline().strip())))

M = [[float('inf')] * W for _ in range(H)]

bfs(xs - 1, ys - 1, 0)


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

int main() {
    long n, ans = 0;
    cin >> n;
    vector<long> name(5, 0);
    rep(i, n) {
        string str;
        cin >> str;
        switch(str.at(0)) {
            case 'M':
                name.at(0)++;
                break;
            case 'A':
                name.at(1)++;
                break;
            case 'R':
                name.at(2)++;
                break;
            case 'C':
                name.at(3)++;
                break;
            case 'H':
                name.at(4)++;
                break;
        }
    }
    for(int i = 0; i < 5; i++) {
        for(int j = i + 1; j < 5; j++) {
            for(int k = j + 1; k < 5; k++) {
                ans += name.at(i) * name.at(j) * name.at(k);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        
        int a = 0;
        int b = 1;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) != '1'){
                a = i+1;
                b = Integer.parseInt(s.substring(i, i+1));
                break;
            }
        }
        
        if(k < a){
            System.out.println(1);
        }else{
            System.out.println(b);
        }
    }
}

Measured memory_bytes: 21972
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> s(n);
    int mi = mod, sum = 0;
    rep(i,n){
        cin >> s[i];
        if(s[i]%10!=0)
            mi = min(mi, s[i]);
        sum += s[i];
    }
    if(sum%10!=0)
        cout << sum << endl;
        else
            cout << max(0, sum - mi) << endl;
        return 0;
}

Measured memory_bytes: 256
B = (1 << 10).times.map{|v| 10.times.count{|i| v[i] > 0 }}
def avenue(state)
  N.times.inject(0) do |s, i|
    s + P[i][B[F[i] & state]]
  end
end
N = gets.to_i
F = N.times.map{ gets.chomp.tr(' ','').to_i(2) }
P = N.times.map{ gets.split.map(&:to_i) }
puts (1 ... 1 << 10).map{|s| avenue(s) }.max


Measured memory_bytes: 1916
#include<stdio.h>
int main(void)
{
	int a,b,c,d;
	scanf("%d",&a);
	scanf("%d",&b);
	c=a+b;
	if(c%2==0){
		d=c/2;
	}
	else{
		d=c/2+1;
	}
	printf("%d\n",d);
	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main(void){
	int n;
	cin >> n;
	cout << n*(n+1)/2 << endl;
	return 0;
}

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

int f[102][102];

void DFS(int x,int y,int c){
    if(f[x][y]!=c)  return;

    f[x][y]=10;
    DFS(x+1,y,c);
    DFS(x-1,y,c);
    DFS(x,y+1,c);
    DFS(x,y-1,c);
}

void print(int w,int h){
    for(int i=1;i<=w;i++){
        for(int j=1;j<=h;j++){
            cout<<f[i][j]<<' ';
        }
        cout<<endl;
    }
}

int main(){
    int w,h;
    int xs,ys;
    int xg,yg;
    int n;
    while(true){
        cin>>w>>h;
        if(w+h==0)  break;
        for(int i=1;i<=h;i++){
            for(int j=1;j<=w;j++){
                f[i][j]=-1;
            }
        }
        cin >> xs >> ys;
        cin >> xg >> yg;
        cin >> n;
        for(int i=0;i<n;i++){
            int c,d,x,y;
            cin >> c >> d >> x >> y;
            if(d==0){
                for(int j = 0; j<4; j++){
                    for(int k = 0; k<2; k++){
                        f[x+j][y+k] = c;
                    }
                }
            }else{
                for(int j = 0; j<2; j++){
                    for(int k = 0; k<4; k++){
                        f[x+j][y+k] = c;
                    }
                }
            }
        }
        //print(w,h);
        DFS(xs,ys,f[xs][ys]);
        //print(w,h);
        if(f[xg][yg]==10){
            cout<<"OK"<<endl;
        }else{
            cout<<"NG"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3136
using System;

namespace Branch_on_Condition
{
    class Range
    {
        static void Main(string[] args)
        {
            var token = Console.ReadLine().Split(' ');
            int a = int.Parse(token[0]);
            int b = int.Parse(token[1]);
            int c = int.Parse(token[2]);
            if ( a<b && b<c) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 8832
grids = Array.new(3, Array.new(3))

3.times do |i|
  grids[i] = STDIN.gets.split(' ').map(&:to_i)
end

correct = false

0.upto(100) do |a1|
  0.upto(100) do |a2|
    0.upto(100) do |a3|
      b1_1 = grids[0][0] - a1
      b1_2 = grids[1][0] - a2
      b1_3 = grids[2][0] - a3
      
      b2_1 = grids[0][1] - a1
      b2_2 = grids[1][1] - a2
      b2_3 = grids[2][1] - a3
      
      b3_1 = grids[0][2] - a1
      b3_2 = grids[1][2] - a2
      b3_3 = grids[2][2] - a3
      
      if ((b1_1 == b1_2 && b1_2 == b1_3) && 
        (b2_1 == b2_2 && b2_2 == b2_3) && 
        (b3_1 == b3_2 && b3_2 == b3_3))     
        correct = true
        break
      end
      
    end
  end
end

if correct
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 1788
#include<iostream>
using namespace std;
int main(){
	char a[4];
	cin>>a;
	if(a[0]==a[1]&&a[2]==a[3]&&a[1]!=a[2]&&a[0]!=a[3])
		cout<<"Yes"<<endl;
	else if(a[1]==a[2]&&a[0]==a[3]&&a[0]!=a[1]&&a[2]!=a[3])
		cout<<"Yes"<<endl;
	else if(a[0]==a[2]&&a[1]==a[3]&&a[0]!=a[1]&&a[2]!=a[3])
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE 100100
#define NIL -1
#define MAX_N 100100

double sq(double num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll e;

int main(){
	while (cin >> e&&e) {
		ll sum = INF;
		for (ll k = 0; k*k*k <= e;k++) {
			for (ll j = 0; j*j + k*k*k <= e; j++) {
				ll i = e - (j*j + k*k*k);
				if (sum > i + j + k)sum = i + j + k;
			}
		}
		cout << sum << endl;
	}
}


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

#define fastio {\
    ios::sync_with_stdio(0);\
    cin.tie(0);\
}

#define file {\
    freopen("io\\in.txt", "r", stdin);\
    freopen("io\\out.txt", "w", stdout);\
    freopen("io\\err.txt", "w", stderr);\
}

#ifdef LOCAL
#define debug(args...) {\
    string _s(#args);\
    replace(_s.begin(), _s.end(), ',', ' ');\
    stringstream _ss(_s);\
    istream_iterator<string> _it(_ss);\
    debug1(_it, args);\
}

#pragma GCC diagnostic ignored "-Wunused-parameter"
void debug1(istream_iterator<string> it) {
    cerr << endl;
}
#pragma GCC diagnostic pop

template<class T, class... Args>
void debug1(istream_iterator<string> it, T a, Args... args) {
    cerr << '>' << *it << " = " << a << "; ";
    debug1(++it, args...);
}
#else
#define debug(args...)
#define cerr if (false) cerr
#endif

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n)   for (int i = 0; i < n; i++)
#define dotc()      int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)       (int)x.size()
#define eb          emplace_back
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define all(x)      x.begin(), x.end()
#define rall(x)     x.rbegin(), x.rend()
#define fi          first
#define se          second

const int inf(0x3fffffff);
const int mod(1000000007);
const double pi(acos(-1.0));

signed main() {
    fastio;
#ifdef LOCAL
    file;
#endif

    int n;
    cin >> n;
    cout << pi * 2 * n;

    return 0;
}


Measured memory_bytes: 3780
import Control.Monad
import Control.Applicative
import Text.Printf

(>>>) :: (a -> b) -> (b -> c) -> (a -> c)
f >>> g = g . f

main = do
    n <- readLn
    replicateM_ n $ do
        [x1, y1, x2, y2, x3, y3] <- map read <$> words <$> getLine
        let det2 = 2 * ((x1 - x2)*(y1 - y3) - (y1 - y2)*(x1 - x3))
            a = x1^2 - x2^2 + y1^2 - y2^2
            b = x1^2 - x3^2 + y1^2 - y3^2
            x = ((y1 - y3)*a - (y1 - y2)*b) / det2 :: Double
            y = ((x1 - x2)*b - (x1 - x3)*a) / det2 :: Double
            r = ((x - x1)^2 + (y - y1)^2) ** 0.5   :: Double
        printf "%.3f %.3f %.3f\n" x y r

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

long long A, B;

int main(){
	cin >> A >> B;

	for(long long i = 0; i < 100000; i++) {
		if(((long long)(i * 0.08)) == A && ((long long)(i * 0.1)) == B) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}

Measured memory_bytes: 3564
/*      Chill raho be kuch nhi rakha sadness me. 
               Author: Maskman_lucifer                   */
               
#include <bits/stdc++.h>   
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long 
#define pll pair<ll,ll>
#define pb push_back
#define M 1000000007
#define lc '\n'
using namespace std;
ll dp[3006][3006];
string s,t;
ll l,r;
ll solve(ll ind1,ll ind2)
{
    if(ind1==-1 or ind2==-1)
    {
        return 0;
    }
    else
    {
        if(dp[ind1][ind2]!=-1)
        {
            return dp[ind1][ind2];
        }
        if(s[ind1]==t[ind2])
        {
            ll val=solve(ind1-1,ind2-1);
            ll val1=solve(ind1-1,ind2);
            
            ll val2=solve(ind1,ind2-1);
            
            if(val1>val+1 or val2>val+1)
            {
                 dp[ind1][ind2]=val;
            }
            else
            {
                 dp[ind1][ind2]=val+1;
            }
            return dp[ind1][ind2];
        }
        else
        {
            ll val;
            val=solve(ind1-1,ind2);
            val=max(val,solve(ind1,ind2-1));
            dp[ind1][ind2]=val;
            return dp[ind1][ind2];
        }
    }
}
int main()
{
    IO
    cin>>s>>t;
    memset(dp,-1,sizeof(dp));
    l=s.length();
    r=t.length();
    ll p=solve(l-1,r-1);
    string s1="";
    for(ll i=l-1;i>=0;i--)
    {
        for(ll j=r-1;j>=0;j--)
        {
            if(s[i]==t[j] and dp[i][j]==p)
            {
                s1+=s[i];
                p--;
                break;
            }
        }
    
    }
    reverse(s1.begin(),s1.end());
    cout<<s1<<lc;
    return 0;
}

Measured memory_bytes: 74672
#include <stdio.h>
#include <math.h>

const int maxn=1e6+10;
int n,a[maxn],dp[maxn],ans;

int C(int n, int m) {return (n|m)==n;}

int main() {
    scanf("%d", &n);
    for (int i=1;i<=n;++i) {
        scanf("%1d", &a[i]);
    }
    if (n==1) {
        printf("%d\n", a[1]);
        return 0;
    }
    int flag=1;
    for (int i=1;i<=n-1;++i) {
        dp[i] = abs(a[i]-a[i+1]);
        if (dp[i] == 1) flag=0;
    }
    if (flag) {
        for (int i=1;i<=n-1;++i) {
            dp[i] /= 2;
        }
    }
    else {
        for (int i=1;i<=n-1;++i) {
            dp[i] %= 2;
        }
    }
    for (int i=1;i<=n-1;++i) {
       if (dp[i]) ans ^= C(n-2,i-1);
    }
    if (flag) ans *= 2;
    printf("%d\n", ans);
    return 0;
}

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

string S;
int pt;
int target;

pair<int, int> calc_or(), calc_and(), calc_term();

pair<int, int> calc_or(){
    vector<int> ret0, ret1;
    while(true){
        auto r = calc_and();
        ret0.push_back(r.first);
        ret1.push_back(r.second);
        if(S[pt] == '|'){
            pt++;
        }else{
            break;
        }
    }

    int sz = ret0.size();
    int ans0 = accumulate(ret0.begin(), ret0.end(), 0);
    int ans1 = ret1[0], sum = 0;
    for(int i=0; i<sz-1; i++){
        sum += ret0[i];
        ans1 = min(ans1, sum + ret1[i+1]);
    }
    return {ans0, ans1};
}

pair<int, int> calc_and(){
    vector<int> ret0, ret1;
    while(true){
        auto r = calc_term();
        ret0.push_back(r.first);
        ret1.push_back(r.second);
        if(S[pt] == '&'){
            pt++;
        }else{
            break;
        }
    }

    int sz = ret0.size();
    int ans1 = accumulate(ret1.begin(), ret1.end(), 0);
    int ans0 = ret0[0], sum = 0;
    for(int i=0; i<sz-1; i++){
        sum += ret1[i];
        ans0 = min(ans0, sum + ret0[i+1]);
    }
    return {ans0, ans1};
}

pair<int, int> calc_term(){
    if(S[pt] == '?'){
        pt++;
        return {1, 1};
    }else{
        pt++;
        auto ret = calc_or();
        pt++;
        return ret;
    }
}

int main(){

    cin >> S;
    S.push_back('$');

    pt = 0;
    auto ans = calc_or();
    cout << ans.first << " " << ans.second << endl;
    return 0;
}



Measured memory_bytes: 3336
import itertools

s = input()
n = [i for i in s]
ans = 0

for i in range(len(n)):
    for j in itertools.combinations(range(len(n)-1), i):
        temp = [i for i in s]
        for k in j[::-1]:
            temp.insert(k+1, "+")
        temp = "".join(temp)
        temp = temp.split("+")
        temp = map(int, temp)
        ans += sum(temp)

print(ans)

Measured memory_bytes: 3064