akhauriyash/Code-Regression huggingface dataset:
/* 
 * Project: AtCoder Beginners Contest 135 A - Harmony
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/09/11
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cstdint>
#include <algorithm>
using namespace std;

int64_t a, b;

void solve() {

    uint32_t min_val = min(a, b);
    uint32_t max_val = max(a, b);
    uint32_t diff = max_val - min_val;
    if (diff%2 == 0) {
        printf("%d\n", diff/2+min_val);
    } else {
        printf("IMPOSSIBLE\n");
    }
}

int main() {

    scanf("%lld", &a);
    scanf("%lld", &b);

    solve();

}

Measured memory_bytes: 3180
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<queue>
using namespace std;
typedef long long LL;
#define sqr(x) ((x)*(x))
#define mp make_pair
inline long long read(){
	long long x = 0; char ch = getchar(); bool positive = 1;
	for (; !isdigit(ch); ch = getchar())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = getchar())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(long long a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(long long a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
const long long N=5005;
long long n,dp[N][N],oo=1000000007*N;
pair<long long,long long> a[N];
inline bool cmp(pair<int,int> a,pair<int,int> b){
	return a.second+a.first<b.second+b.first;
}
int main(){
	n=read();
	for(long long i=1;i<=n;i++){
		a[i].first=read(); a[i].second=read();
	}
	sort(&a[1],&a[n+1],cmp); for(long long i=1;i<=n;i++)dp[0][i]=oo;
	for(long long i=1;i<=n;i++){
		for(long long j=0;j<=n;j++){
			dp[i][j]=dp[i-1][j];
			if(j&&dp[i-1][j-1]<=a[i].first)dp[i][j]=min(dp[i-1][j-1]+a[i].second,dp[i][j]);
		}
	}
	for(long long i=n;i;i--)if(dp[n][i]<oo){
		cout<<i<<endl; return 0;
	}
}

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

int T;
int t_cycle[30];
int limit_times[100];

int memo[30][100];

int search(int cycle,int day) {
	int ret,challenger;
	if(day>=100)return 0;
	if(memo[cycle][day]>0)return memo[cycle][day]-1;
	/* take anhydrous caffeine */
	ret=search(1%T,day+1)+1;
	/* don't take anhydrous caffeine */
	if(t_cycle[cycle]<=limit_times[day]) {
		challenger=search((cycle+1)%T,day+1);
		if(challenger<ret)ret=challenger;
	}
	memo[cycle][day]=ret+1;
	return ret;
}

int main(void) {
	while(scanf("%d",&T)==1 && T>0) {
		int N,i;
		memset(memo,0,sizeof(memo));
		for(i=0;i<T;i++) {
			if(scanf("%d",&t_cycle[i])!=1)return 1;
		}
		if(scanf("%d",&N)!=1)return 1;
		for(i=0;i<100;i++)limit_times[i]=24;
		for(i=0;i<N;i++) {
			int D,M;
			if(scanf("%d%d",&D,&M)!=2)return 1;
			if(M<limit_times[D-1])limit_times[D-1]=M;
		}
		printf("%d\n",search(0,0));
	}
	return 0;
}

Measured memory_bytes: 620
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
using namespace std;
const int mod=1e9+7;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int r,ans=0; cin >> r;
    ans=r*r;
   
    cout << ans << endl;
 } 

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }


/*
<url:>
問題文============================================================

=================================================================

解説=============================================================

================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> a(N),b(N);
    for(auto& in:a) {cin >> in; in--;}
    for(auto& in:b) {cin >> in; in--;}
    set<ll> s(b.begin(),b.end());
    if(s.size() == N){
        cout << "Yes" << endl;
    }else{
        vector<int> f(N,0);
        for(auto it:s){
            f[it] = 1;
        }
        vector<ll> c(N),d(N);
        iota(c.begin(),c.end(),1);
        iota(d.begin(),d.end(),1);
        for(int i = 0; i < N;i++){
            if(f[a[i]] == 0){
                c[i] = i+1;
                if(i == 0) d[i] = 2;
                else d[i] = 1;
            }else{
                c[i] = i+1;
                d[i] = i+1;
            }
        }
        cout << "No" << endl;
        cout << c << endl;
        cout << d << endl;

    }
	return 0;
}



Measured memory_bytes: 10772
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;

int main(){
  int x[5];
  rep(i,5){
     cin>>x[i];
     if(x[i]==0) cout<<i+1;
  }
return 0;
}


Measured memory_bytes: 3592
/*
* @Author: Samson
* @Date:   2018-06-26 15:41:40
* @Last Modified by:   Samson
* @Last Modified time: 2018-06-26 15:48:03
*/
//   @URL : http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_1_A
#include<bits/stdc++.h>
#include<algorithm>
#include <cstdlib>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
const int MAXN = 1e5+10;

int f[MAXN];

int find(int x)
{
	return f[x] == x? x : f[x] = find(f[x]);
}

int main(void)
{
	ios::sync_with_stdio(false); 
	//cin.tie(0);
	int n,q,p,u,v;
	cin>>n>>q;
	for(int i = 1; i < MAXN; ++i)
		f[i] = i;
	for(int i = 1; i <= q; ++i)
	{
		cin>>p>>u>>v;
		int x = find(u),y = find(v);
		if(p == 0)
		{
			if(x != y)
			{
				f[x] = find(y);
			}
		}
		else
		{
			if(x == y)
				cout<<1<<'\n';
			else
				cout<<0<<'\n';
		}
	}
	return 0;
}



Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;

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

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

const ll MOD = 1000000007;
const ll INF = 100000;


ll n;
int main(void){
    string s;
    cin >> s;

    bool flag = true;
    for (int i = 1; i < s.size(); i++){
        if (s[i] != '9') flag = false;
    }

    if (s.size() == 1|| flag){
        int ans = 0;
        for (int i = 0; i < s.size(); i++){
            ans += s[i] - '0';
        }
        cout << ans << endl;
    }
    else {
        cout << s[0] - '0' - 1 + 9 * (s.size() - 1);
    }

}

Measured memory_bytes: 256
#include<algorithm>
#include<cstdio>
#include<map>
#include<cstring>
using namespace std;
const int N=200005;
int n,k;
double p[N],sum=0,res=0;
double dp[N];
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1; i<=n; i++)
    {
        scanf("%lf",&p[i]);
    }
    for(int i=1; i<=n-k+1; i++)
    {
        if(i==1)
        {
            for(int j=i; j<i+k; j++)
            {
                res+=p[j];
            }
        }
        else
        {
            res-=p[i-1];
            res+=p[i+k-1];
        }
        sum=max(sum,res);
    }
    printf("%.12lf",(sum+k)/2.0);
}

Measured memory_bytes: 1792
#include<stdio.h>

char s[200001],td[200000][2];
int n,q;

int han(int a){
	int i;
	for(i=0;i<q;i++){
		if(s[a]==td[i][0]){
			if(td[i][1]=='L'){
				a--;
			}else a++;
		}
		if(a<0)return 1;
		if(a==n)return 2;
	}
	return 0;
}
int main(){
	int i,j;
	scanf("%d%d%s",&n,&q,s);
	for(i=0;i<q;i++){
		char tmp1[2],tmp2[2];
		scanf("%s%s",tmp1,tmp2);
		td[i][0]=tmp1[0];
		td[i][1]=tmp2[0];
	}
	int ub=n,lb=0;
	while(ub-lb>1){
		int mid=(ub+lb)/2;
		if(han(mid)!=1)ub=mid;
		else lb=mid;
	}
	int l=ub;
	ub=n,lb=0;
	while(ub-lb>1){
		int mid=(ub+lb)/2;
		if(han(mid)==2)ub=mid;
		else lb=mid;
	}
	int r=lb;
	printf("%d\n",r-l+1);
	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <climits>
#include <vector>
#include <string>
#include <ctime>
#include <map>
#include <set>
#include <queue>
#include <stack>

using namespace std;

const long long len = 100010;
long long n,a[len],s[len],p;
const long long mo = 1e9+7;
long long mi[len];

void extend_gcd(long long a, long long b, long long &x, long long &y) {
    if (!b) {
        x = 1, y = 0;
        return;
    }
    extend_gcd(b, a % b, y, x);
    y -= a / b * x;
}

long long c(long long x,long long y) {
	if (y<x) return 0;
	long long m,n;
	extend_gcd(mi[y-x]*mi[x], mo, n, m);
    return (mi[y]*n%mo+mo)%mo;
}

int inv[len];
/*long long c(int n, int m) {
	if(m < n) return 0;
	return mi[m] * inv[n]% mo * inv[m - n] %mo;
}*/
int Pow(int a, int b) {
	int ret = 1;
	while(b) {
		if(b & 1) ret = 1LL * ret * a % mo;
		a = 1LL * a * a % mo;
		b >>= 1;
	}
	return ret;
}
int main()
{
	
    //freopen("test.in","r",stdin);
    //freopen("test.out","w",stdout);
    mi[0] = 1;
    mi[1] = 1;
    memset(s,0,sizeof(s));
    for (int i=2;i<=len;i++) {
    	mi[i] = mi[i-1]*i%mo;
    }
    for (int i = 0; i <= len; i++) {
		inv[i] = Pow(mi[i], mo-2);
	}
//	printf("%d %d %d \n", c(2,3), c(2,4), c(1, 2));
    cin >> n;
    for (int i=1;i<=n+1;i++) {
    	cin >> a[i];
    }
    for (int i=1;i<=n+1;i++) {
    	s[a[i]]++;
    	if (s[a[i]] == 2) {p = a[i];break;}
    }
    long long l[2];
    long long k = 0;
    for (int i=1;i<=n+1;i++) {
    	if (a[i] == p) {
    		l[k] = i;k++;
    	}
    }
    long long m = n+1-(l[1]-l[0]+1);
    for (int i=1;i<=n+1;i++) {
    	if (i == 1) cout << n << endl;
    	 else {
    	 if (i == n+1) cout << 1 << endl;
    	 else {
    	 	long long ans = ((c(i,n+1) - c(i-1,m))%mo+mo)%mo;
    	 	printf("%lld\n",ans);
    	   }
    	 }
    }
    return 0;  
}

Measured memory_bytes: 4600
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, char* argv[]) {
  int N, M;
  cin >> N >> M;

  vector<vector<int> > s(M);
  for (int i = 0; i < M; ++i) {
    int k;
    cin >> k;
    for (int j = 0; j < k; ++j) {
      int tmp;
      cin >> tmp;
      s[i].push_back(tmp - 1);
    }
  }

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

  long long ret = 0;
  for (int i = 0; i < pow(2, N); ++i) {
    int state[N];
    for (int j = 0; j < N; ++j) {
      if (((i >> j) & 1) == 0) {
        state[j] = 0;
      } else {
        state[j] = 1;
      }
    }
    bool on = true;
    for (int j = 0; j < M; ++j) {
      int tmp = 0;
      for (int k = 0; k < s[j].size(); ++k) {
        if (state[s[j][k]] == 1) {
          ++tmp;
        }
      }
      if (tmp % 2 != p[j]) {
        on = false;
        break;
      }
    }
    if (on)
      ++ret;
  }

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 384
package main

import(
    "fmt"
)



func main() {
    var x int
    fmt.Scan(&x)
    ans := ""
    if x < 1200 {
        ans = "ABC"
    } else {
        ans = "ARC"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}


Measured memory_bytes: 512
N, M = (int(x) for x in input().split())
ac_dir = {n:False for n in range(1, N+1)}
wa_dir = {n:0 for n in range(1, N+1)}
ac_count = 0
wa_count = 0
for _ in range(M):
    data = input().split()
    p = int(data[0])
    S = data[1]
    if ac_dir[p]:
        continue
    else:
        if S == "AC":
            ac_dir[p] = True
            ac_count += 1
            wa_count += wa_dir[p]
        elif S == "WA":
            wa_dir[p] += 1
print(ac_count, wa_count)

Measured memory_bytes: 27368
#include<iostream>
using namespace std;
int main()
{
int n,j,i;
cin>>n;
int t[n],z[n];
for(int i=0;i<n;i++)
{
cin>>t[i];                //7 2 3 8 5
}
int m;
cin>>m;
int p[m],x[m];
for(i=0;i<m;i++)
{
	cin>>p[i]>>x[i];     
}
//5
//7 2 3 8 5
//3
//4 2
//1 7
//4 13
 for(j=0;j<m;j++)  
	{
	for(i=0;i<n;i++)   
    {
     z[i]=t[i];     
    }
    i=0;
    int sum=0;
	while(i<n)      
        {
		if(p[j]==i+1)      
		{
		z[i]=x[j];    
	     sum+=z[i];
		}
		else
		{	
         sum+=z[i];
         
	    }
	       
	    i++;
        }
      cout<<sum; 
      cout<<endl  ;
}

}




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

void solve() {
    ll K;
    cin >> K;
    ll start = 7;
    int steps = 1;
    while(steps < 1e7) {
        if (start % K == 0) break;
        start = start * 10 + 7;
        start %= K;
        ++steps;
    }
    cout << (steps < 1e7 ? steps : -1)  << endl;
}

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

    int t = 1;
    while(t--) {
        solve();
    }
}


Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 2e5 + 10;
int K, N;
LL A[MAX];

int main(void) {
    cin >> K >> N;
    REP(i, N) {
        cin >> A[i];
    }

    LL ans = K - A[0] - (K - A[N - 1]);
    REP(i, N - 1) {
        chmin(ans, K - (A[i + 1] - A[i]));
    }

    cout << ans << endl;
}


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

int main() {
  string N;
  cin >> N;
  
  if (N[0] == N[1] && N[1] == N[2]) {
    cout << "Yes" << endl;
  }  
    
  else if (N[1] == N[2] && N[2] == N[3]) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

const int MAX_N = 100005;
vector<vector<P>> to(MAX_N);
vector<int> ans(MAX_N, -1);

void dfs(int now, int c) {
    ans[now] = c;
    for (P p: to[now]) {
        if(ans[p.first]!=-1) continue;
        dfs(p.first, (c+p.second)%2);
    }
    return;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
	int n;
	cin >> n;
    rep(i,n-1) {
        int u, v, w;
        cin >> u >> v >> w;
        --u, --v;
        to[u].push_back(make_pair(v,w));
        to[v].push_back(make_pair(u,w));
    }
    // ans[0] = 0;
    dfs(0,0);
    rep(i,n) cout << ans[i] << "\n";
	return 0;
}


Measured memory_bytes: 10236
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    int A,B,C,D;cin>>A>>B>>C>>D;
    cout<<min(A,B)+min(C,D)<<endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
 
using namespace std;
 
//container util
//------------------------------------------
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
 
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).end()) i=(c).end(); i!=(c).begin(); --i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
 
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).begin(),(c).end(),greater<int>())
 
#define PB(a) push_back(a)
#define PF(a) pop_front(a)
 
#define MP(a,b) make_pair(a,b)
 
#define FS first
#define SE second
 
#define ALL(x) (x).begin(),(x).end()
#define MAX_EL(c) *max_element((c).begin(),(c).end())
#define MIN_EL(c) *min_element((c).begin(),(c).end())
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef string str;
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
 
//------show vector---------
template <typename T>
void showV(vector < T > a){
  EACH(i,a){
    cerr << *i << ',';
  }  
  cerr << endl;
}
 
//------show matrix---------
template <typename T>
void showVV(vector < vector < T > > a){
  EACH(i,a){
    showV(*i);
  }  
}
//grobal var
//------------------------------------------
LL dp[2000][2000];
vector< int > divisor(int n) {
  vector< int > ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  return (ret);
}
 
int main(){
// magic spell------------------------------
  cin.tie(0);
  ios::sync_with_stdio(false);
//------------------------------------------
  int A,B;
  int ans;
  
  cin >> A >> B;
  REP(i,max(A,B)){
    ans += min(A,B)*pow(10,i);
  }
   
  cout << ans << endl;
  return 0;
}

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

int main() {
  while(true){
    int a,b;
    char s;
    cin>>a>>s>>b;
    if(s=='+')cout<<a+b<<endl;
    else if(s=='-')cout<<a-b<<endl;
    else if(s=='*')cout<<a*b<<endl;
    else if(s=='/')cout<<a/b<<endl;
    else if(s=='?')break;
  }
}


Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <utility>

using namespace std;
using llong = long long;

using P = pair<int,int>;
P X[200000];
int B[200000];
int main(){
  int N;
  cin >> N;
  for(int i=0;i<N;++i){
    cin >> X[i].first;
    X[i].second = i;
  }
  sort(X,X+N);
  for(int i=0;i<N;++i){
    if(i>(N-1)/2){
      B[X[i].second] = X[(N-1)/2].first;
    }else{
      B[X[i].second] = X[(N-1)/2+1].first;
    }
  }

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

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

namespace ABC118
{
    public class B
    {
        public void Solve()
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = int.Parse(s[0]);
            int M = int.Parse(s[1]);
            int[] c = new int[M];
            for (int i = 0; i < N; i++)
            {
                string[] ss = Console.ReadLine().Split(' ');
                int K = int.Parse(ss[0]);
                for (int j = 0; j < K; j++)
                {
                    int A = int.Parse(ss[j + 1]);
                    c[A - 1]++;
                }
            }
            int res = 0;
            for (int i = 0; i < M; i++)
            {
                if (c[i] == N) { res++; }
            }
            Console.WriteLine(res);
        }
    }
}

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new ABC118.B().Solve();
        }
    }
}

Measured memory_bytes: 13140
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.TreeSet;

public final class Main {

	static final Scanner sc = new Scanner(System.in);
	static PrintWriter writer = new PrintWriter(System.out);

	public static void main(String[] args) {
		int N = sc.nextInt();
		int Q = sc.nextInt();
		ArrayList<State> ss = new ArrayList<>();
		for (int i = 0; i < N; i++) {
			int S = Integer.parseInt(sc.next());
			int T = Integer.parseInt(sc.next());
			int X = Integer.parseInt(sc.next());
			ss.add(new State(S - X, X, -2));
			ss.add(new State(T - X, X, -1));
		}
		for (int i = 0; i < Q; i++) {
			int D = Integer.parseInt(sc.next());
			ss.add(new State(D, 0, i));
		}
		Collections.sort(ss);
		int[] ans = new int[Q];
		TreeSet<Integer> stop = new TreeSet<>();
		for (int i = 0; i < ss.size(); i++) {
			State s = ss.get(i);
			if (s.v == -2) {
				stop.add(s.d);
			} else if (s.v == -1) {
				stop.remove(s.d);
			} else {
				ans[s.v] = stop.isEmpty() ? -1 : stop.first();
			}
		}
		for (int i = 0; i < Q; i++) {
			writer.println(ans[i]);
		}
		writer.flush();
	}

	static class State implements Comparable<State> {
		int t, d, v;

		State(int t, int d, int v) {
			this.t = t;
			this.d = d;
			this.v = v;
		}

		@Override
		public int compareTo(State o) {
			return Integer.compare(this.t, o.t);
		}
	}

}

Measured memory_bytes: 131292
#include <bits/stdc++.h>
using namespace std;
main()
{
    int n,k; cin >> n >> k;
    int h[n];
    for(int i=0;i<n;i++)
        cin >> h[i];
    int dp[n];
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++)
    {
        int mini = INT_MAX;
        for(int j=1;j<=k && (i-j)>=0;j++)
        {
            mini = min(mini,dp[i-j]+abs(h[i]-h[i-j]));
        }
        dp[i]=mini;
    }
    
    cout << dp[n-1] << "\n";

}       

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int w,h,n;
int num[1005][1005];
int dp[1005][1005]={};
int main(){
	while(1){
	scanf("%d %d %d",&h,&w,&n);
	if(h+w+n==0) break;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			scanf("%d",&num[i][j]);
		}
	}
	memset(dp,0,sizeof(dp));
	dp[1][1]=n-1;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(i!=1){
				if(dp[i-1][j]%2==0){
					dp[i][j]+=dp[i-1][j]/2;
				}else{
					if(num[i-1][j]==0){
						dp[i][j]+=(dp[i-1][j]+1)/2;
					}else{
						dp[i][j]+=(dp[i-1][j]-1)/2;
					}
				}
			}
			if(j!=1){
				if(dp[i][j-1]%2==0){
					dp[i][j]+=dp[i][j-1]/2;
				}else{
					if(num[i][j-1]==1){
						dp[i][j]+=(dp[i][j-1]+1)/2;
					}else{
						dp[i][j]+=(dp[i][j-1]-1)/2;
					}
				}
			}
		}
	}
	int i=1,j=1;
	while(i!=h+1 && j!=w+1){
		if(dp[i][j]%2==1){
			if(num[i][j]==0){
				j++;
			}else{
				i++;
			}
		}else{
			if(num[i][j]==0){
				i++;
			}else{
				j++;
			}
		}
	}
		printf("%d %d\n",i,j);
}
}

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

#define len(x) ((int)(x).size())
#define log(x) cout << (x) << endl

int main() {
	int k;
	string s;
	cin >> s >> k;

	char a = s[0];

	if (len(s) > 1 && s[0] == '1') {
		int p = 1;
		while (s[p]=='1' && p<len(s)) ++p;
		a = (p == len(s)) ? '1' : ((k > p) ? s[p] : '1');
	}

	log(a);

	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
import heapq
N,K=map(int,input().split())

hq=[]
tset_all=set()
for i in range(N):
  t,d=map(int,input().split())
  heapq.heappush(hq,(-d,t))
  tset_all.add(t)
#print(heapq)

hq_K=[]
dsum=0
tdic=defaultdict(int)
for i in range(K):
  md,t=heapq.heappop(hq)
  heapq.heappush(hq_K,((-md,t)))
  dsum-=md
  tdic[t]+=1  

t0=len(tdic)
max_answer=dsum+(t0**2)
#print(t0,max_answer)

for i in range(t0+1,min(K,len(tset_all))+1):
  loop_flg=True
  while(loop_flg):
    d,t=heapq.heappop(hq_K)
    if tdic[t]>1:
      tdic[t]-=1
      dsum-=d
      
      while(True):
        md2,t2=heapq.heappop(hq)
        if tdic[t2]==0:
          tdic[t2]=1
          dsum-=md2
          loop_flg=False
          break
          
  answer_i=dsum+(i**2)
  #print(i,answer_i)
  max_answer=max(max_answer,answer_i)
  
print(max_answer)

Measured memory_bytes: 27112
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  int n,m;
  while(cin>>n>>m,n){
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];

    int p=m+1;
    vector<int> x(n);

    using P = pair<int, int>;
    map<P, int> cnt;
    for(int i=0;i<n;i++){
      x[i]=(p/a[i]+1)*a[i];
      if(x[i]>m) x[i]=(m/a[i])*a[i];
      chmin(p,x[i]);
      P res(x[i],a[i]);
      if(cnt.count(res)) cnt[res]=-1;
      else cnt[res]=i;
    }
    
    int idx=cnt.begin()->second;
    if(idx<0) idx=n-1;
    cout<<idx+1<<endl;
  }
  return 0;
}



Measured memory_bytes: 3124
Program main
  implicit none
  integer(16) :: X
  integer(16) :: a = 100
  integer :: n
  read(*,*) X
  n = 0
  do
     n = n + 1
     a = (a*int(101,8))/int(100,8)
     if (a>=X) exit
  end do
  write(*,'(i0)') n
  
end program main


Measured memory_bytes: 2836
//自称高知能系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, k;
	string s;
	cin >> n >> k >> s;
	if(s[k-1]=='A') s[k-1]='a';
	if(s[k-1]=='B') s[k-1]='b';
	if(s[k-1]=='C') s[k-1]='c';

    cout << s << endl;
}

Measured memory_bytes: 256
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val H, W = in.next().toInt
  val c = Array.ofDim[Int](10, 10)
  val A = Array.ofDim[Int](H+1, W+1)

  for(y <- 0 to 9)
    for(x <- 0 to 9)
      c(y)(x) = in.next().toInt
  for(y <- 1 to H; x <- 1 to W)
    A(y)(x) = in.next().toInt


  //
  // d[a][b] は辺 e = (a, b) のコスト(存在しない場合はINF, ただし d[i][i] = 0 とする)
  val d = Array.ofDim[Long](10, 10)

  // 初期化
  val MAX = Long.MaxValue
  for(i <- 0 to 9; j <- 0 to 9){
    if(i == j)
      d(i)(j) = 0
    else
      d(i)(j) = MAX
  }

  // ここで d の入力行う
  for(y <- 0 to 9)
    for(x <- 0 to 9)
      d(y)(x) = c(y)(x)


  // warshall_floyd
  for(k <- 0 to 9; i <- 0 to 9; j <- 0 to 9){
    d(i)(j) = Math.min(d(i)(j), d(i)(k) + d(k)(j))
  }



  val memo = new Array[Int](10)
  for(y <- 1 to H; x <- 1 to W)
    if(A(y)(x) != -1)
      memo(A(y)(x)) += 1


  var ans = 0L
  for(i <- 0 to 9){
    if(i != 1)
      ans += d(i)(1) * memo(i)
  }

  println(ans)
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 35008
#include <bits/stdc++.h>
 
using namespace std;
 
#define SZ(x) ((int)(x).size())
using namespace std;
typedef pair<int,int> PII;
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define REP(i,n) for (int i = 0; i < n; ++i)
#define FOR(i,a,b) for (int i = a; i <= b; ++i)
#define M 1000000007
#define MM 998244353
#define SZ(a) int((a).size())
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define mod 1000000007
using ll = long long;

//a and b are assumed to be taken modulo p
inline ll add(ll a, ll b, ll p = mod){ ll c = a + b; if(c >= p) c -= p; return c; }
inline ll sub(ll a, ll b, ll p = mod){ ll c = a - b; if(c < 0) c += p; return c; }
inline ll mul(ll a, ll b, ll p = mod){ return (a * 1ll * b) % p; }
 
using VI = vector<int>;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
using VLL = vector<ll>;
using ld = long double;
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
      
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;     // Initialize result
  
    x = x % p; // Update x if it is more than or
                // equal to p
  
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;
  
        // y must be even now
        y = y>>1; // y = y/2
        x = (x*1ll*x) % p;
    }
    return res;
}
const int MX = 2e5+10;
const int MX2 = 1e6+5;

ll INF= 4 * (ll)1e18;
int mx = 2 * (ll)1e9 + 10;
set<ll> Sx[MX];
set<ll> Sy[MX];
int main(int argc, const char * argv[]) {

    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0); // insert code here...
    
    ll X;
    cin >> X;
    ll rem = X % 500;
    cout << max((X / 500) * 1000 + (rem / 5) * 5,(X/5) * 5) << endl;
    return 0;
    
}


Measured memory_bytes: 19072
#include <cctype>
#include <cstdio>
#include <iostream>
#include <sstream>
#include <stack>
#include <string>
using namespace std;

int s2i(string s){
	stringstream ss(s);
	int d;
	ss >> d;
	return d;
}

int main(){
	string s;
	double a, b, x;
	while (getline(cin, s)){
		stack<double>X;
		stringstream ss(s);
		while(ss>>s){
			if (s=="+"||s=="-"||s=="*"||s=="/"){
				b = X.top(); X.pop();
				a = X.top(); X.pop();
				if (s == "+") x = a + b;
				else if (s == "-") x = a - b;
				else if (s == "*") x = a * b;
				else if (s == "/") x = a / b;
				X.push(x);
			}
			else{
				X.push(s2i(s));
			}
		}
		printf("%.6f\n", X.top());
	}
}

Measured memory_bytes: 1288
#include <stdio.h>
main(){
 double x,y,a,b,c,d,e,f;
  while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f) !=EOF){
    if(a!=0&&a*e!=0&&c/a-(b*f)/(a*e)!=0&&1-b*d/(a*e)!=0){
      x=(c/a-(b*f)/(a*e))/(1-b*d/(a*e));
      y=(f-d*x)/e;
    }
    else if(a==0){
      y=c/b;
      x=(f-e*y)/d;
    }
    else if(e==0){
      x=f/d;
      y=(c-a*x)/b;
    }
    else{
      if(b!=0&&d!=0){
      x=(f/d-(e*c)/(b*d))/(1-a*e/(b*d));
      y=(f-d*x)/e;
      }
      else if(b==0){
	x=c/a;
	y=(f-d*x)/e;
      }
      else if(d==0){
	y=f/e;
	x=(c-b*y)/a;
      }
    }
    if(x==-0) x=0;
    if(y==-0) y=0;
    printf("%.3f %.3f\n",x,y);
  }
  return 0; 
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
const ll MOD = 1e9+7;
ll LLINF = 1LL << 60;
int INF = INT_MAX;

int main(){
    int n; cin>>n;
    string s; cin>>s;

    int close=0;
    int res=0;
    rep(i,0,n){
        if(s[i]=='(') res++;
        else if(res!=0){
            res--;
            close++;
        }
    }
    int rcnt=0;
    int lcnt=0;
    rep(i,0,n){
        if(s[i]=='(') lcnt++;
        else rcnt++;
    }
    string ans="";
    rep(i,0,rcnt-close) ans+='(';
    ans+=s;
    rep(i,0,lcnt-close) ans+=')';
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll inf=1000000000000000000,mod=1000000007,BS,k;

int main(){
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
        ll n;cin>>n;
        if(n>=30)
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;

}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,t,d;
	cin>>n>>k;
	int a[n];
	for(int m=1;m<=n;m++)
	a[m]=0;
	while(k--)
	{
		cin>>d;
		for(int i=0;i<d;i++)
		{
			cin>>t;
			for(int j=1;j<=n;j++)
		{
			if(t==j)
			a[j]++;
		}
		}
	}
	int ans=0;
	for(int q=1;q<=n;q++)
	{
		if(a[q]==0)
		ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3560
#include<stdio.h>

int ans[44];

int fib(int n)
{
    if(ans[n]) return ans[n];

    ans[n] = fib(n-1) + fib(n-2);
    return ans[n];
}

int main(void)
{
    int n;
    scanf("%d",&n);
    
    int i;
    for(i=0; i<44; i++){
        ans[i] = 0;
    }   

    ans[0] = 1;
    ans[1] = 1;

    printf("%d\n",fib(n));
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
using ll =long long;
using namespace std;

ll n,k;
ll w[MAX]={};
ll sum=0,maxw=0;

bool isDivisionSucceed(ll max_w){
    ll count=0;
    ll partialsum=0;
    for(ll i=0;i<n;i++){
        partialsum+=w[i];
        if(partialsum>max_w){
            partialsum=w[i];
            count++;
        }
    }
    if(count+1>k){
        return false;
    }else{
        return true;
    }
}
int main(){
    cin>>n>>k;
    for(ll i=0;i<n;i++){
        cin>>w[i];
        maxw=max(maxw,w[i]);
        sum+=w[i];
    }
    ll ans=sum;
    ll left=maxw;
    ll right=sum;
    ll mid=(right+left)/2;
    while(left<=right){
        if(isDivisionSucceed(mid)){
            ans=min(ans,mid);
            right=mid-1;
        }else{
            left=mid+1;
        }
        mid=(right+left)/2;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3880
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
ll n, x, ans = 0; 
void gcd(ll a, ll b)
{
   if (b == 0) { ans -= a; return; } 
   ans += a / b * b * 2;
   gcd(b, a % b);
}
int main()
{
   cin >> n >> x;
   ans = n;
   gcd(x, n - x);
   cout << ans << endl; 
   return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector <int > sam({0,2,5,5,4,5,6,3,7,6});
vector <pair<int , int > > allowed;

string find_max(string &curr,string  &temp){
	int sz =(int) curr.size();
	int tsz= (int) temp.size();
	bool flg = false;
	if(tsz > sz){
		flg = true ;
	}
	else if(tsz == sz ){
		
		for(int i = 0 ; i < sz ; i++){
			int a = curr[i]-'0';
			int b = temp[i]-'0';
			
			if(a > b)
				break ;
			if( a < b){
				flg = true ;
				break ;
			}
		}
	}
	
	if(flg )
		return temp;
	return curr ;
}

int main(){
	
	/* 5
	 * 117
	 * 711
	 * */
	 
	 int n, m;
	 scanf("%d%d",&n,&m);
	 
	 for(int i = 0 ; i< m ; i++){
		int temp ;
		scanf("%d",&temp);
		allowed.emplace_back(temp,sam[temp]);
	}
	/*
	 sort(allowed.begin(),allowed.end(),[](pair<int,int> x , pair<int,int> y){
		if(x.second <= y.second){
			if(x.second==y.second){
				if(x.first < y.first)
					return false;
				else
					return true;
			}
			return true;
		}
		return false;
		 
	 });
	*/
	
	const int nax = 1e4+5;
	vector < string > dp(nax,"");
	for(auto x : allowed){
		char value = x.first + '0';
		int cost = x.second;
		for(int i = 1; i <= n ; i++){
			
			if(i-cost >=0 ){
				if(dp[i-cost]!="" || i-cost==0){
					string temp = dp[i-cost];
					temp += value ;
					sort(temp.begin(),temp.end(),greater<int>());
					
					dp[i] = find_max(dp[i],temp);
				}
			}
			
			
		}
		
		
	}
	
	cout << dp[n] << endl;
	
	return 0;
}


Measured memory_bytes: 25344
N, Q = map(int, input().split())
S = str(input())
J=[0]*N


for i in range(1,N):
    if((S[i-1]=="A")&(S[i]=="C")):
        J[i]=J[i-1]+1
    else:
        J[i]=J[i-1]


for i in range(Q):
    L, R = map(int, input().split())
    print(J[R-1]-J[L-1])


Measured memory_bytes: 6060
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
using namespace std;
#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++)
typedef pair<long long,long long> pint;
typedef long long ll;
const int inf   = 1<<29;
const ll  longinf = 1LL<<60;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int calc(ll x){
  int a=0;
  while(x>=1){
    a++;
    x/=10;
    }
  return a;
  }

int main(){
  ll n;
  cin>>n;
  int ans=inf;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0)
      ans=min(ans,calc(n/i));
      }
  cout<<ans<<endl;
  return 0;
  }


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

using namespace std;

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

int n, k;
ll ans = 0;
ll v[52];
void search(int left, int right, int trash){
    ll get = 0;
    vector<ll> gar;
    for(int i = 0; i < left; i++){
        get += v[i];
        if(v[i] < 0)gar.push_back(v[i]);
    }
    for(int i = 0; i < right; i++){
        get += v[n-1-i];
        if(v[n-1-i] < 0)gar.push_back(v[n-1-i]);
    }
    sort(gar.begin(), gar.end());
    for(int i = 0; i < min(trash, int(gar.size())); i++)get -= gar[i];
    if(get == 98)cout << left << ' ' << right << ' ' << trash << endl;
    ans = max(ans, get);
}

int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++)cin >> v[i];
    for(int i = 0; i <= k; i++){
        for(int j = 0; i+j <= k; j++){
            if(i+j > n)continue;
            else{
                for(int l = 0; i+j+l <= k; l++)search(i, j, l);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,ans=2,a,b,nowa=1,nowb=1,A,B;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a >> b;
    A=a;B=b;
    if(nowa/a>0 or nowb/b>0){
      if(nowa/a>nowb/b){
        a*=nowa/A+(nowa%A!=0);
        b*=nowa/A+(nowa%A!=0);
      }else{
        a*=nowb/B+(nowb%B!=0);
        b*=nowb/B+(nowb%B!=0);
      }
    }
    ans+=a-nowa;
    ans+=b-nowb;
    nowa=a;
    nowb=b;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;
#define p 31
#define mod (int)1e9+7
#define int long long
int pow(int n) {
  int res = 1;
  for(int i = 0; i < n; i++) {
    res = (res* p)%mod;
  }
  return res;
}
int hashing(string s){
  sort(s.begin(), s.end());
  int res = 1;
  for(int i = 0; i < 10; i++) {
    res += pow(i)*(s[i]-96);
  }
  return res;
}

signed main() {
   int n; cin >> n;
   unordered_map<int,int> mp;
   for(int i = 0; i < n; i++) {
     string s;cin >> s;
     int has = hashing(s);
     if(mp[has]) mp[has]++;
     else mp[has] = 1;
   }
   int res = 0;
   for(auto x: mp) {
     res += x.second * (x.second-1)/2;
   }
   cout << res;
}


Measured memory_bytes: 4388
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
#include <sstream>
#include <utility>
#include <bitset>
#include <stack>

using namespace std;

#define MP make_pair 
#define PB push_back 
#define INF (1000000007) 
#define eps 1e-9
#define MOD (998244353) 
#define IOS ios::sync_with_stdio(false)

typedef pair<int,int> pii ;
typedef pair<double,double> pdd ;
typedef long long ll ;

int n;
pii p[200005];
bool del[100005];
priority_queue<pii> ml,mr;

inline ll sol(bool dir)
{
	while(!ml.empty()) ml.pop();
	while(!mr.empty()) mr.pop();
	memset(del,0,sizeof(del));
	for(int i=1;i<=n;i++) 
	{
		ml.push(MP(p[i].first,i));
		mr.push(MP(-p[i].second,i));
	}
	ll ret=0;
	int cur=0;
	for(int i=1;i<=n;i++,dir=!dir)
	{

		if(dir==1)
		{
			if(ml.empty()) break;
			int t=ml.top().second;
			while(del[t] && !ml.empty())
			{
				ml.pop();
				if(!ml.empty()) t=ml.top().second;
			}
			if(ml.empty() || (p[t].first<=cur && p[t].second>=cur)) break;
//			cout<<cur<<" "<<ml.top().first<<endl;
			ret+=abs((ll)ml.top().first-(ll)cur);
//			cout<<"L"<<(ll)ml.top().first<<endl;
			cur=ml.top().first;
			del[t]=1;
			ml.pop();
		}
		else 
		{
			if(mr.empty()) break;
			int t=mr.top().second;
			while(del[t] && !mr.empty())
			{
				mr.pop();
				if(!mr.empty()) t=mr.top().second;
			}
//			cout<<p[t].first<<" "<<p[t].second<<endl;
			if(mr.empty() || (p[t].first<=cur && p[t].second>=cur)) break;
//			cout<<cur<<" "<<-mr.top().first<<endl;
			ret+=abs((ll)-mr.top().first-(ll)cur);
//			cout<<"L"<<(ll)-mr.top().first<<endl;
			cur=(ll)-mr.top().first;
			del[t]=1;
			mr.pop();
		}	
//		cout<<dir<<" "<<cur<<" "<<ret<<endl;
	}
	ret+=abs(cur);
//	cout<<"ret="<<ret<<endl;
	return ret;
}
int main()
{
	IOS;
	cin>>n;
	for(int i=1;i<=n;i++) 
	{
		cin>>p[i].first>>p[i].second;
	}
	ll ans=0;
	ans=max(sol(1),sol(0));
	cout<<ans;
	return 0;
}

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

int main(void){
        int W,H,x,y,r;
        cin>>W>>H>>x>>y>>r;
        if(x-r>=0 and x+r<=W and y-r>=0 and y+r<=H) {
                cout<<"Yes"<<endl;
        }
        else{
                cout<<"No"<<endl;
        }
        return 0;
}



Measured memory_bytes: 3108
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

const double pi=6.2831853;

int main()
{
	double r; cin>>r;
	printf("%.6lf",r*pi);
	return 0;
}

Measured memory_bytes: 3764
require 'pp'

S = readline.chomp
T = readline.chomp

map1 = {}
map2 = {}
S.each_char.with_index do |s,i|
  t = T[i]
  if map1.has_key?(s) or map2.has_key?(t)
    unless map1[s] == t and map2[t] == s
      puts 'No'
      exit
    end
  else
    map1[s] = t
    map2[t] = s
  end
end
puts 'Yes'



Measured memory_bytes: 3064
//F5で実行 Shift+F5で停止
//F9でブレークポイント
#include<cmath>
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
//Shift+PageUpで上部の大半を選択できる
// 1e18 = 10の18乗

int K;

void _main() {
	cin >> K;

	string ans = "";
	string acl = "ACL";

	rep(i,0,K) {
		ans += acl;
	}

	cout << ans << endl;
}

Measured memory_bytes: 3612
from collections import deque
from enum import Enum
import sys
import math

LIST = deque()

num_command = int(input())

for loop in range(num_command):
    input_command = input()

    if input_command == 'deleteFirst':
        LIST.popleft()
    elif input_command == 'deleteLast':
        LIST.pop()
    else:
        com, num = input_command.split()
        if com == 'insert':
            LIST.appendleft(num)
        elif com == 'delete':
            try:
                LIST.remove(num)
            except:
                pass

print(' '.join(LIST))



Measured memory_bytes: 70084
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)

	sum := 0
	A := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&A[i])
		sum += A[i]
	}

	ans := 9999999999999999
	l := 0
	for i := 0; i < N; i++ {
		l += A[i]
		r := sum - l
		d := abs(r - l)
		if d < ans {
			ans = d
		}
	}
	fmt.Println(ans)
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 6952
import math

N=input()
N=float(N)
X=N/1.08
X1=math.floor(N/1.08)
X2=math.ceil(N/1.08)
if X.is_integer() == True  or math.floor(X2*1.08)== N:
	print(math.ceil(X))
else :
	print(":(")  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp(a) setprecision(a)<<fixed
#define ss second
#define fori(v) for(int i=0; i<v; i++)
#define forj(v) for(int j=0; j<v; j++)
#define fork(v) for(int k=0; k<v; k++)
#define forl(v) for(int l=0; l<v; l++)
#define fort(v) for(int t=0; t<v; t++)
#define forz(v) for(int z=0; z<v; z++)
#define ll long long 
#define MAX (int)(pow(10,7) + 10)
#define dim 26
#define pb(a) push_back(a)
// #define cout out
// #define cin in
ll inf = pow(10,18);
ll modulo = pow(10,9) + 7;
double eps = 1e-6;
ifstream in;
ofstream out;


void deal(){
	set<ll> all[dim];
	fori(dim){
		all[i].insert(inf);
	}
	ll n;
	string a;
	cin>>n>>a;
	fori(n){
		all[a[i]-'a'].insert(i);
	}
	ll q;
	cin>>q;
	fori(q){
		ll ty;
		cin>>ty;
		if(ty == 1){
			ll idx;
			char f;
			cin>>idx>>f;
			--idx;
			all[a[idx]-'a'].erase(idx);
			a[idx] = f;
			all[a[idx]-'a'].insert(idx);
		}
		else{
			ll l , r;
			cin>>l>>r;
			--l , --r;
			ll s = 0;
			forj(dim){
				auto num = *all[j].lower_bound(l);
				if(num <= r){
					++s;
				}
			}
			cout<<s<<'\n';
		}
	}
}

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



/* 
6 8 
1 2
2 3
3 4
4 1
2 5
3 5
1 6
4 6
*/

Measured memory_bytes: 24220
#include <bits/stdc++.h>
using namespace std;
int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    cout << (((2*n+(a-b))%2==1)?"Borys":"Alice") << endl;;
    
    return 0;
}

Measured memory_bytes: 256
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
ll n,dp[3005][3005];
ll a[3005];
ll fun(ll i,ll j,ll k){
	if(i==j&&k==1)return a[i];
	if(i==j&&k==0)return -a[i];
	if(dp[i][j]!=-1)return dp[i][j];
	if(k){
		dp[i][j]=max(fun(i+1,j,1-k)+a[i],fun(i,j-1,1-k)+a[j]);
		return dp[i][j];
	}
	else{
		dp[i][j]=min(fun(i+1,j,1-k)-a[i],fun(i,j-1,1-k)-a[j]);
		return dp[i][j];		
	}
}
int main(){
	cin>>n;
	for(ll i=1;i<=n;i++)cin>>a[i];
	memset(dp,-1,sizeof(dp));
	cout<<fun(1,n,1)<<endl;
}

Measured memory_bytes: 70912