akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<algorithm>
using namespace std;
int main(void){
    // Your code here!
    int a[101];
    long long int ans = 1000000000;
    int n;
    cin >> n;
    for(int i=0;i<n;i++)cin >> a[i];
    for(int i=0;i<101;i++){
        long long int temp=0;
        for(int j=0;j<n;j++)temp += (a[j] - i) * (a[j] - i);
        ans = min(ans,temp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
*x, = map(int, list(input()))
digit = 3
for i in range(2**digit):
    res = x[0]
    arr = str(x[0])
    for j in range(digit):
        if (i>>j) & 1:
            res += x[j + 1]
            arr += '+' + str(x[j + 1])
        else:
            res -= x[j + 1]
            arr += '-' + str(x[j + 1])
    if res == 7:
        print(arr + '=7')
        break

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXS = 10005;
const int MAXN = 1005;
const LL MOD = 998244353;
const LL INF = (LL)1e18 + 5;

struct Block {
	int w, s;
	LL v;
};

bool cmp(const Block &b1, const Block &b2) {
	return b1.w + b1.s > b2.w + b2.s;
}

int N;
LL dp[MAXS];
Block b[MAXN];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> b[i].w >> b[i].s >> b[i].v;
	}
	
	sort(b, b + N, cmp);
	for (int i = 0; i < MAXS; i++) dp[i] = -INF;
	for (int i = 0; i < N; i++) {
		int w = b[i].w, s = b[i].s, v = b[i].v;
		LL maxv = 0;
		
		for (int j = 0; j < MAXS; j++) {
			if (j - w >= s) maxv = max(maxv, dp[j]);
			if (j <= s && j + w < MAXS && dp[j + w] != -INF) {
				dp[j] = max(dp[j], dp[j + w] + v);
			}
		}
		
		dp[s] = max(dp[s], maxv + v);
	}
	
	cout << *max_element(dp, dp + MAXS) << "\n";
}


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


int main() {
  int n,a,b;
  cin >> n>>a>>b;
  
  cout<<min(n*a,b)<<endl;
  
}

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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

int n,a[3][11],sam[11];

void nhap()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i)
        scanf("%d",&a[1][i]);
    for (int i=1;i<=n;++i)
        scanf("%d",&a[2][i]);
    for (int i=1;i<=n;++i)
        sam[i]=i;
}

bool check(int type)
{
    for (int i=1;i<=n;++i)
        if (a[type][i]!=sam[i]) return false;
    return true;
}

void process()
{
    int x=0,y=0;
    int dem=1;
    if (check(1))
        x=dem;
    while (next_permutation(sam+1,sam+1+n) && !x)
    {
        dem++;
        if (check(1))
        {
            x=dem;
            break;
        }
    }
    for (int i=1;i<=n;++i)
        sam[i]=i;
    dem=1;
    if (check(2))
        y=dem;
    while (next_permutation(sam+1,sam+1+n) && !y)
    {
        dem++;
        if (check(2))
        {
            y=dem;
            break;
        }
    }
    cout<<abs(x-y);
}

int main()
{
    nhap();
    process();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

main(){
  int n, sum = 0;
  cin >> n;
  bool ans = true;
  for(int i=0;i<n;i++){
    char c;
    int in;
    cin >> c >> in;
    if(c == ')') sum -= in;
    if(c == '(') sum += in;
    if(sum < 0) ans = false;
  }
  if(ans && sum == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator
#define VL vector<LL>::iterator
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
void Y()
{
    cout<<"Yes"<<endl;
}
void N()
{
    cout<<"No"<<endl;
}
V<LL>v;
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,t,z;
    string a;
    cin>>n;
    k=0;
    l=0;
   while(n)
   {
       n/=2;
       k+=(pow(2,l));
       l++;
   }
   cout<<k<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define all(v) (v).begin(),(v).end()
#define pb push_back
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/
signed main(){
  int x,y,a,b,c;
  cin>>x>>y>>a>>b>>c;
  priority_queue<int> P,Q,R;
  rep(i,a){
    int p;
    cin>>p;
    P.push(p);
  }
  rep(i,b){
    int q;
    cin>>q;
    Q.push(q);
  }  
  rep(i,c){
    int r;
    cin>>r;
    R.push(r);
  }
  int nx=0,ny=0,nz=0;
  int ans=0;
  while(nx+ny+nz<x+y){
    int p=0,q=0,r=0;
    if(!P.empty()&&nx<x)p=P.top();
    if(!Q.empty()&&ny<y)q=Q.top();
    if(!R.empty())r=R.top();
    if(p>=q&&p>=r){
      ans+=p;
      P.pop();
      nx++;
      // nz++;
    }
    else if(q>=p&&q>=r){
      ans+=q;
      Q.pop();
      ny++;
      // nz++;
    }
    else if(r>=p&&r>=q){
      ans+=r;
      R.pop();
      nz++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


// int n,x,y;
// int ans;
// vi to[2002];
// int ar[2002][2002][2002];//i->j

// int bfs(int i,int k){
//   queue<int> q;
//   q.push(i);
//   vi dist(n,0);
//   while(!q.empty()){
//     int v=q.front();q.pop();
//     ar[k][i][v]=1;
//     for(auto u:to[v]){
//       if(ar[k][i][u]) continue;
//       q.push(u);
//     }
//   }
// }

// signed main(){
//   cin>>n>>x>>y;
//   x--;y--;
//   rep(i,n-1){
//     to[i].pb(i+1);
//     to[i+1].pb(i);
//   }
//   to[x].pb(y);
//   to[y].pb(x);


//   FOR(k,1,n-1){
//     ans=0;
//     rep(i,n){
//       // ans+=bfs(i,k);
//     }
//     cout<<ans<<endl;
//   }
//   return 0;
// }


Measured memory_bytes: 3444
char S[9];main(n,h,o,s){for(scanf("%d",&n);n--;printf("%d\n",s))for(h=o=s=0;o<3;){scanf("%s",S);if(S[0]=='O')o++;if(S[1]=='O')s+=h+1,h=0;if(S[1]=='I')if(h==3)s++;else h++;}exit(0);}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	string S;
	cin >> S;
	int k;
	cin >> k;

	rep(i, n) {
		if (S[i] != S[k - 1]) S[i] = '*';
	}

	dunk(S);

	return 0;
}

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

using namespace std;
#define N 100100
#define SIGMA 26
string s;

bool strongpalindrome (string s){
    int m = s.size() / 2;
    int ok = 1;
    for (int i = 0; i < m; ++i)
        if (s[i] != s[s.size() - 1 - i])
            ok = 0;
    int m1 = m / 2;
    for (int j = 0; j < m1; ++j)
        if (s[j] != s[m - 1 - j])
            ok = 0;
    return ok;
}
int main()
{
    ios::sync_with_stdio();
    cin.tie(0);
    cin >> s;
    if (strongpalindrome(s))
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
        int N,Q;
        int s[100000],t[50000];
        cin >> N;
        for(int i=0 ; i<N ; i++ )
                cin >> s[i];
        cin >> Q;
        int counter=0;
        for(int i=0 ; i<Q ; i++ ){
                cin >> t[i];
                int middle=N/2,left=0,right=N;
                while(left<right){
                        if(t[i]==s[middle]){
                                counter++;
                                break;
                        }else if(t[i]>s[middle]){
                                left=middle+1;
                                middle=(left+right)/2;
                        }else if(t[i]<s[middle]){
                                right=middle;
                                middle=(left+right)/2;
                        }
                }
        }
        cout << counter << endl;
        return 0 ;
}

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

const int INF = 1<<28;

int main(){
    int n,i,j,k,a,b,c;
    while( cin >> n, n ){
        int cost[10][10];
        for(i=0;i<10;i++){
            for(j=0;j<10;j++){
                cost[i][j] = INF;
                if(i==j) cost[i][j] = 0;
            }
        }
        for(i=0;i<n;i++){
            cin >> a >> b >> c;
            cost[a][b] = cost[b][a] = c;
        }
        for(k=0;k<10;k++){
            for(i=0;i<10;i++){
                for(j=0;j<10;j++){
                    cost[i][j] = min(cost[i][j], cost[i][k]+cost[k][j]);
                }
            }
        }
        int sumCost, minCost = INF, city;
        for(i=0;i<10;i++){
            sumCost = 0;
            for(j=0;j<10;j++){
                if( cost[i][j] < INF ) sumCost += cost[i][j];
            }
            if( sumCost && sumCost < minCost ){
                minCost = sumCost;
                city = i;
            }
        }
        cout << city << ' ' << minCost << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(void)
{
    unsigned long n,a,b;
    scanf("%lu%lu%lu", &n,&a,&b);
    if(a==0){
        printf("0");
        return 0;
    }else if(b==0){
        printf("%lu",n);
        return 0;
    }else if(n>(a+b)){
        unsigned long tmp=n/(a+b);
        unsigned long blue=tmp*a;
        if(n%(a+b)>a){
            blue+=a;
            printf("%lu",blue);
            return 0;
        }else{
            blue+=n%(a+b);
            printf("%lu",blue);
            return 0;
        }
    }else if(n>=a){
        printf("%lu",a);
        return 0;
    }else if(n<a){
        printf("%lu",n);
        return 0;
    }
    return 0;
}

Measured memory_bytes: 128
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

H,W,K=get_i
c=array(H)
H.times do|i|
    c[i]=get_nsp
end
ans=0
(2**H).times do|bit_h|
    (2**W).times do|bit_w|
        cnt=0
        H.times do|i|
            next if (bit_h&(2**i)).zero?
            W.times do|j|
              next if (bit_w&(2**j)).zero?
              cnt+=1 if c[i][j]=="#"   
            end
        end
        ans+=1 if cnt==K
    end
end
puts ans

Measured memory_bytes: 14420
#include<iostream>
using namespace std;
int main(){
	int n, flag=0,flag1=0;
	cin>>n;
	while(n--){
		int a,b;
		cin>>a>>b;
		if(a==b)
		flag++;
		else
		flag=0;
		if(flag==3)
		flag1=1;
	}
	if(flag1)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
}

Measured memory_bytes: 3136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String buf = scanner.nextLine();
		int n = Integer.parseInt(buf);
		String s = scanner.nextLine();

		int count = 0;
		char last_char='\0';

		for(int i = 0; i < n; i++){
			char c = s.charAt(i);
			if(last_char != c) {
				count++;
				last_char= c;
			}
		}
		System.out.println(count);

		scanner.close();
	}

}


Measured memory_bytes: 27968
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int arr[n+1];
    for(int i=1; i<=n; i++){
        cin>>arr[i];
    }
    int ans=0;
    while(n>0){
        n-=k;
        ans++;
        if(n==0)break;
        else n++;

    }
    cout<<ans<<endl;

}





Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
long int N, M;
 
int main(void)
{
    cin >> N >> M;
 
    priority_queue<int> A;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        A.push(a);
    }
 
    for(int i=0;i<M;i++){
        int a = A.top();
        A.pop();
        A.push(a / 2);
    }
 
    long long d=0;
    for(int i=0;i<N;i++){
        d+=A.top();
        A.pop();
    } 
    cout<<d;
}

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

int main(){
    int f[45],n;
    cin>>n;
    f[0]=1;f[1]=1;
    for(int i=2;i<45;i++){
        f[i]=f[i-1]+f[i-2];
    }
    cout<<f[n]<<endl;
    return 0;
}


Measured memory_bytes: 3080
#include<iostream>
#include<algorithm>
using namespace std;
long long  n , a[200005],ans ,b[200005],mod = 1e9+7,sum;
int main(){
     
    cin >> n; 
    for(int i = 1; i <=n ; i++)
    {   
	   cin >> a[i];
	    
	   b[i] = a[i] ;
    }
    
    for(int i = n ; i >= 1 ; i--)
    {
    	 b[i]+=b[i+1];
    	 b[i] = b[i]%mod;
	}
	
	for(int i = 1; i < n; i++)
	{ 
		sum+=(a[i]*b[i+1])%mod; 
		sum%=mod;
	}
	
	cout << sum%mod ;
	return 0;
}

Measured memory_bytes: 6284
#include <stdio.h>
int main(int argc, char *argv[])
{
	int n,m,k,i,j,x,s = 0;
	while(scanf("%d%d%d",&n,&m,&k) != EOF)
	{
		s = 0;
		for(i = 0; i <= n; i++)
		{
			for(j = 0; j <= m; j++)
			{
				x = i * m + (n - i) * j - i * j;
				if(x == k)s = 1;
			}
		}
		if(s == 1)printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int H, W;
    int i,j;
    while(1){
    scanf("%d %d", &H, &W);
    if(H==0 && W==0)break;
    for(i=0;i<H;i++){
        for(j=0;j<W;j++){
            printf("#");
        }
        printf("\n");
    }
    printf("\n");
}
return 0;
}


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

int main ()
{
    char S[10];
    gets(S);
    if (strcmp(S, "Sunny")==0 || strcmp(S, "sunny")==0)
        printf("Cloudy");
    else if (strcmp(S, "Cloudy")==0 || strcmp(S, "cloudy")==0)
        printf("Rainy");
    else if (strcmp(S, "Rainy")==0 || strcmp(S, "rainy")==0)
        printf("Sunny");

    return 0;
}


Measured memory_bytes: 128
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val A = Array(N) {
        readLine()!!.toInt()
    }
    val AC = A.copyOf().sortedDescending()

    for (i in A.indices) {
        if (A[i] == AC.first()) {
            println(AC[1])
        } else {
            println(AC.first())
        }
    }
}



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

int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;
  int ans = 0;
  if (S.size()%2 == 1) {
    cout << "No" << endl;
  }
  else {    
    for (int i = 0; i < S.size()/2; i++) {
      if (S.at(i) != S.at(i + S.size()/2)) {
        ans++;
      }
    }
    if (ans == 0) {
      cout << "Yes" << endl;
    }
    else 
      cout << "No" << endl;   
  }
  
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Runtime.CompilerServices;

namespace MinPro2019D
{
    public class Program
    {
        void Solve(SimpleScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var L = ss.NextLong();
            var dp = new long[5];

            for (var i = 0; i < L; i++)
            {
                var A = ss.NextLong();
                var x = A == 0 ? 2 : A & 1;

                dp[0] += A;
                dp[1] += x;
                dp[2] += (x & 1) ^ 1;
                dp[3] += x;
                dp[4] += A;

                for (var t = 1; t < 5; t++)
                {
                    dp[t] = Math.Min(dp[t], dp[t - 1]);
                }
            }

            sw.WriteLine(dp[4]);
            //---------------------------------
        }

        static void Main()
        {
            var ss = new SimpleScanner(Console.OpenStandardInput());
            var sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            new Program().Solve(ss, sw);
            sw.Flush();
        }
    }

    public class SimpleScanner
    {
        const int DefaultCapacity = 1024;

        readonly Stream stream;
        readonly int capacity;
        readonly byte[] buffer;

        int index;
        int length;

        public SimpleScanner(Stream stream, int capacity = DefaultCapacity)
        {
            this.stream = stream;
            this.capacity = capacity;
            this.buffer = new byte[capacity];

            length = stream.Read(buffer, 0, capacity);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public long NextLong()
        {
            var ret = 0L;

            while (buffer[index] < 48 || 57 < buffer[index])
            {
                ++index;

                if (index < length) continue;
                index = 0;
                length = stream.Read(buffer, 0, capacity);
            }

            while (48 <= buffer[index] && buffer[index] <= 57)
            {
                ret = ret * 10 + buffer[index] - 48;
                ++index;

                if (index < length) continue;
                index = 0;
                length = stream.Read(buffer, 0, capacity);
            }

            return ret;
        }
    }
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    int n;
    cin >> n;
    int ans = (n + 999)/ 1000 * 1000 - n;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)
#define rep1(i, n) for(int i = 1; i <= (int) n; i++)

const ll mod = 1e9+7;

int main() {
    ll n,m;
    cin >> n >> m;
    if (abs(n-m) > 1) {
        cout << 0 << endl;
        return 0;
    }
    ll dog = 1;
    ll mon = 1;
    rep1(i,n) {
        dog = dog*i%mod;
    }
    rep1(i,m) {
        mon = mon*i%mod;
    }
    ll ans = dog*mon % mod;
    if (n == m) {
        ans = 2*ans%mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(raw_input())
dic = {}

for i in xrange(n):
	line = raw_input().split()
	cmd = line[0]
	ope = line[1]
	if cmd == "insert":
		dic[ope] = 1
	else:
		try:
			dic[ope] == 1
		except:
			print("no")
		else:
			print("yes")

Measured memory_bytes: 33016
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRT(v) sort(v.begin(),v.end())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

void u(){cout<<'U';}
void r(){cout<<'R';}
void d(){cout<<'D';}
void l(){cout<<'L';}


int atcoder(){
    //入力
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >>ty;
    int dx,dy;
    dx = tx - sx;
    dy = ty - sy;
    
    //処理
    
    //出力
    REP(i,0,dy) u();
    REP(i,0,dx) r();
    REP(i,0,dy) d();
    REP(i,0,dx) l();
    l();
    REP(i,0,dy+1) u();
    REP(i,0,dx+1) r();
    d();
    r();
    REP(i,0,dy+1) d();
    REP(i,0,dx+1) l();
    u();
    cout << ENT;
    return 0;
}

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


Measured memory_bytes: 256
#include <stdio.h>

int a[200000];

int main(){
  int n,i;
  //max[i][j] i:index,j:number
  int max[2][2]={{0,0}};
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(a[i]>max[0][1]){
      max[1][0]=max[0][0];
      max[1][1]=max[0][1];
      max[0][0]=i;
      max[0][1]=a[i];
    } else if(a[i]>max[1][1] && a[i]<=max[0][1]){
      max[1][0]=i;
      max[1][1]=a[i];
    }
  }
  for(i=0;i<n;i++){
    if(i!=max[0][0]){
      printf("%d\n",max[0][1]);
    } else {
      printf("%d\n",max[1][1]);
    }
  }
}

Measured memory_bytes: 2304
#include<stdio.h>
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    int sum=0;
    if(n>=2)
    {
        sum+=n*(n-1)/2;
    }
    if(m>=2)
    {
        sum+=m*(m-1)/2;
    }
    printf("%d",sum);
}


Measured memory_bytes: 128
#include <vector>
#include <cstdlib>
#include <queue>
#include <ctime>
#include <map>
#include <algorithm>
#include <complex>
using namespace std;
typedef complex<double> P;

struct NODE{
	long long w,t,x,i;
	NODE(){}
	NODE(long long w,long long t,long long x,long long i) : w(w) , t(t) , x(x) , i(i) {}
};
bool cmp(const NODE &a,const NODE &b){ return a.w < b.w; };

typedef unsigned int uint;
int in() {
    int x = 0, c;
    for (; (uint)((c = getchar()) - '0') >= 10; ) { if (c == '-') return -in(); if (!~c) throw ~0; }
    do { x = (x << 3) + (x << 1) + (c - '0'); } while ((uint)((c = getchar()) - '0') < 10);
    return x;
}

NODE info[100000];
int query[100000];
long long res1[100000];
long long res2[100000];


long long A[3] , B[3] , C[3];

priority_queue< pair<int,pair<int,int> > , vector< pair<int,pair<int,int> > > , greater< pair<int,pair<int,int> > > > remQue;

int main(){
	int N,Q;
	scanf("%d%d",&N,&Q);
	for(int i = 0 ; i < N ; i++){
		scanf("%lld%lld%lld",&info[i].w,&info[i].t,&info[i].x);
		info[i].i = i;
	}
	for(int i = 0 ; i < Q ; i++){
		scanf("%d",&query[i]);
	}
	for(int i = 0 ; i < N ; i++) res1[i] = -1;
	sort(info,info+N,cmp);
	long long power = 0;
	int idx = 0 , idx2 = 0;
	
	for(int day = 0 ; day <= 3652425 ; day++){
		while( remQue.size() && remQue.top().first == day ){
			A[remQue.top().second.first] -= 1;
			B[remQue.top().second.first] -= remQue.top().second.second;
			C[remQue.top().second.first] -= remQue.top().second.second * remQue.top().second.second;
			
			remQue.pop();
		}
		while( idx < N && power >= info[idx].w ){
			res1[idx] = day; 
			A[info[idx].t]++;
			remQue.push(make_pair(day+info[idx].x,make_pair(info[idx].t,info[idx].x)));
			idx++;
		}
		while( idx2 < Q && day == query[idx2] ) {
			res2[idx2] = power;
			idx2++;
		}
		B[1] += A[1];
		C[2] += 2*B[2]+A[2];
		B[2] += A[2];	
		// by girl
		power += 1;

		// by 1
		power += A[0];

		// by x
		power += B[1];

		// by x^2
		power += C[2]; 
	}
	for(int i = 0 ; i < N ; i++){
		if( res1[i] == -1 ) puts("Many years later");
		else printf("%lld%c",res1[i],10);
	}
	for(int i = 0 ; i < Q ; i++)
		printf("%lld%c",res2[i],10);
}

Measured memory_bytes: 6848
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DOWN(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) std::cin>>(P)
#define IN2(P1,P2) std::cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) std::cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) UP(I,0,N) std::cin>>V[I]
#define OUT(P) std::cout<<P<<std::endl
#define OUT2(P1,P2) std::cout<<P1<<" "<<P2<<std::endl
#define OUT3(P1,P2,P3) std::cout<<P1<<" "<<P2<<" "<<P3<<std::endl
#define OUTS(I,N,V) UP(I,0,N) std::cout<<V[i]<<std::endl
#define ALL(C) (C).begin(),(C).end()
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using namespace std;
using namespace __gnu_pbds;
int i,j,k;
ll N;
string S;
ll v=2;
inline void solve(){
  IN(N);
  if(N==0){
    OUT(0);
    return;
  }
	while(N) {
		if(N%abs(v)) {
			S+='1';
			N-=v/2;
		}
		else {
			S+='0';
		}
		v*=-2;
	}
	reverse(ALL(S));
	OUT(S);
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000;
#define all(v) v.begin(), v.end()

int main(){
  ll N,A,B;
  cin >> N >> A >> B;
  if((B-A)%2==0){
    cout << (B-A)/2 << endl;
  }else{
    cout << min(N-B,A-1)+(B-A+1)/2 << endl;
  }
  
}

Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;
#pragma endregion
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int a, b, c;
	cin >> a >> b >> c;

	string ans;
	if (a == b && b != c)
	{
		ans = "Yes";
	}
	else if (b == c && c != a)
	{
		ans = "Yes";
	}
	else if (c == a && a != b)
	{
		ans = "Yes";
	}
	else
	{
		ans = "No";
	}

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 256
function Main(input) {
  input = input.split('\n');
  input = input.map((n) => parseInt(n,10));
  input.pop();
  if(input[0] == 1) {
    console.log('Hello World');
  }else if(input[0] == 2) {
    var result = input[1] + input[2];
    console.log(result);
  }
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
N, K = [int(i) for i in input().split()]
MOD = 10**9 + 7

class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )


memo = [-1] * K
def count(k):
    if(memo[k-1] != -1):
        return memo[k-1]
    
    if(k > K//2):
        memo[k-1] = ModInt(1)
        return memo[k-1]
    
    res = ModInt(K//k) ** N
    for i in range(2, K//k + 1):
        res -= count(i * k)

    memo[k-1] = res
    return res

ans = 0
for k in range(K, 0, -1):
    ans += count(k) * k
print(ans)

Measured memory_bytes: 27004
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){//桁数
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){//最小公倍数
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){//最大公約数
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
signed main(){
  int n;
  cin>>n;
  int b=0;
  vector<int> p(n);
  for(int i=0; i<n; i++)
    cin>>p[i];
  vector<int> a=p;
  Sort(p);
  for(int i=0; i<n; i++){
    if(p[i]!=a[i])
      b++;
  }
  if(b<=2)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}
      

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

h = sorted(h)

ans = 10000000000
for i in range(N - K + 1):
    if ans > h[i + K - 1] - h[i]:
        ans = h[i + K - 1] - h[i]

print(ans)


Measured memory_bytes: 8280
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <cctype>
#include <algorithm>
using namespace std;
int main(void){
    double a , b , h ;
    cin >> a >> b >> h ;
    cout << (a + b) * h /2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

bool check(int n, int s, int w, int e) {
    if(n>0 && s==0) return false;
    if(n==0 && s>0) return false;
    if(w>0 && e==0) return false;
    if(w==0 && e>0) return false;
    return true;
}

int main(void){
    string str;
    cin >> str;
    int n=0, s=0, w=0, e=0;
    REP(i, str.size()) {
        if(str[i]=='N') n++;
        if(str[i]=='S') s++;
        if(str[i]=='W') w++;
        if(str[i]=='E') e++;
    }
    
    if(check(n, s, w, e)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main(){
  int n,x;
  cin >> n >> x;
  vector<int> l(n+10);
  vector<int> d(n+10);
  rep(i,n) cin >> l[i];
  d[1] = 0;
  for(int i = 2;i <= n+1;++i){
    d[i] = d[i-1] + l[i-1];
  }
  int count = 0;
  rep(i,n+1){
    if(d[i] <= x) ++count;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main(){
    
    int a,b,d,r;
    double f;
    scanf("%d %d",&a,&b);
    d=a/b;
    r=a%b;
    f=(double)a/b;
    printf("%d %d %lf\n",d,r,f);
}



Measured memory_bytes: 2760
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> bool max_self(T & a, const T & b){ 
  return b > a ? a = b, true : false; 
}
template<class T> bool min_self(T & a, const T & b){ 
  return b < a ? a = b, true : false;    
}
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);

int main(){
  FAST_IO
  vector<int> num(3);
  for(int &ele : num) cin >> ele;
  sort(ALL(num));
  
  int sum = 0;
  for(int idx = 1; idx < 3; ++idx) sum += num[idx] - num[idx - 1];
  cout << sum << '\n';
  return 0;
}


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

int main(){
  int N;
  while(cin >> N && N>0){
    int pt,total,max,min;
    total=0;
    max=0;
    min=1000;

    for(int i=0;i<N;i++){
      cin >> pt;
      if(pt>max) max=pt;
      if(pt<min) min=pt;
      total+=pt;
    }
    cout << (total-min-max)/(N-2) << endl;
  }

  return 0;
}

Measured memory_bytes: 3004
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main(N):
    div = np.zeros(N+1, np.int64)
    for n in range(1, N+1):
      for m in range(n, N+1, n):
        div[m] += m
    return div.sum()

if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    i8 = numba.int64
    cc = CC('my_module')

    def cc_export(f, signature):
        cc.export(f.__name__, signature)(f)
        return numba.njit(f)

    main = cc_export(main, (i8, ))
    cc.compile()

from my_module import main

N = int(read())
print(main(N))


Measured memory_bytes: 105124
#include <iostream>
#include <vector>

using namespace std;

int N = 0;
int M = 0;

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

    vector<int> A(M, 0);
    vector<int> P(N, 0);

    int target = 0;
    int count  = 0;
    int x = 0;
    int z = 0;

    for(int i=0; i<M; ++i){
        cin >> A[i];
    }

    for(int i=0; i<M; ++i){
        target = A[i];

        count = 0;
        for(int j=0; j<N; ++j){
            cin >> x;

            if(x == target){
                P[j] += 1;
                count++;
            }
        }

        P[target - 1] += (N - count);
    }

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

Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define v vector<int>
using namespace std;
signed main(){
    v num(3);
    for(int i=0; i<3; i++) cin>>num.at(i);
    sort(num.begin(),num.end());
    int sum=num.at(2)-num.at(1)+num.at(2)-num.at(0);
    cout<<(sum%2==0?sum/2:(sum+3)/2)<<endl;;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int H,N;
    cin>>H>>N;
    int count=0;
    vector<int>h(N);
    for(int i=0; i<N; i++){
    cin>>h.at(i);
    count+=h.at(i);
    }
    if(count>=H){
    cout<<"Yes"<<endl;
    }
    else
    cout<<"No"<<endl;
}

Measured memory_bytes: 640
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

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

	cout << (b - a == c - b ? "YES" : "NO") << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

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

	for (int i = 0; i < n; i++)
	{
		if (s[i] != s[k-1])
		{
			s[i] = '*';
		}
	}

	cout << s << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define N 2009

ll inv[N], fac[N], finv[N];

void make()
{
	fac[0] = fac[1] = 1;
	inv[1] = 1;
	finv[1] = finv[0] = 1;
	for(int i = 2; i < N; ++i)
	{
		fac[i] = i * fac[i - 1] % MOD;
		inv[i] = MOD - MOD/i * inv[MOD % i] % MOD;
		finv[i] = inv[i] * finv[i - 1] % MOD;
	}
}

ll C(ll n, ll k)
{
	if(n < k || n < 0) return 0;
	return fac[n] * finv[n - k] % MOD* finv[k] % MOD;
}

ll gcd(ll a, ll b)
{
	if(b == 0)
		return a;
	return gcd(b, a % b);
}
int n, m;
int s[N], t[N];
ll dp[N][N];
ll dpf(int i, int j)
{
	if(i == n || j == m)
		return 0;
	if(dp[i][j] >= 0)
		return dp[i][j];
	if(s[i] == t[j])
		dp[i][j] = (1 + dpf(i + 1, j) + dpf(i, j + 1))% MOD;
	else
		dp[i][j] = (dpf(i + 1, j) + dpf(i, j + 1) - dpf(i + 1, j + 1) + MOD) % MOD;
	return dp[i][j];
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	// memset(dp, -1, sizeof(dp));
	cin >> n >> m;
	for (int i = 0; i < n; ++i)
	{
		cin >> s[i];
	}
	for (int i = 0; i < m; ++i)
	{
		cin >> t[i];
	}
	for(int i = n -1; i >= 0; --i)
	{
		for(int j = m - 1; j >= 0; --j)
		{
			if(s[i] == t[j])
				dp[i][j] = (dp[i + 1][j] + dp[i][j + 1] + 1)%MOD;
			else
				dp[i][j] = (dp[i + 1][j] + dp[i][j + 1] - dp[i + 1][j + 1] + MOD)%MOD;
		}
	}
	// ll ans = (dpf(0, 0) + 1) % MOD;
	ll ans = (dp[0][0] + 1) % MOD;
	cout << ans << "\n";
	return 0;
}

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


int main() {
  ll N,K;
  cin>>N>>K;
  vector<ll> A(N),F(N);
  rep(i,N){
      cin>>A[i];
  }
  rep(i,N){
      cin>>F[i];
  }
  sort(A.begin(),A.end());
  sort(F.begin(),F.end());
  reverse(F.begin(),F.end());
  ll l=-1,r=A.at(N-1)*F.at(0);
  while(r-l>1){
      ll m=(r+l)/2;
      ll count=0;
      rep(i,N){
          if(F.at(i)*A.at(i)>m){
              count+=A.at(i)-m/F.at(i);
          }
      }
      if(count<=K){r=m;}
      else{l=m;}
  }
  cout<<r<<endl;
}

Measured memory_bytes: 3328
/* 実行時間1s制限の場合10^6 1,000,000 : 余裕をもって間に合う10^7
  10,000,000 : おそらく間に合う10^8 100,000,000 : 非常にシンプルな処理
  でないと厳しい
 */
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#include <bits/stdc++.h>
#define M_PI 3.14159265358979323846
using namespace std;

typedef long long ll;                                // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll, int>> factorize(ll n)
{ // a,bの公約数 = GCD(a, b)の約数
  vector<pair<ll, int>> res;
  for (ll i = 2; i * i <= n; i++)
  { // √nまで探せばよい
    if (n % i)
      continue;
    res.emplace_back(i, 0); // 割り切れたら
    while (n % i == 0)
    {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1)
    res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
  return res;
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) { return (a + b - 1) / b; }

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

int main(int argc, char *argv[])
{
#ifdef LOCAL
  // 以降 cin の入力元が 'xxx.txt' になる
  std::ifstream in("code.txt");
  std::cin.rdbuf(in.rdbuf());
#endif
  int n, a, b;

  cin >> n >> a >> b;

  cout << min(n*a, b);


  return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    vector<vector<int>> vec(n_rows, vector<int>(n_cols, value));  // 2次元配列初期化
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define fi first
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const int inf = 100100100;
const int MOD = (int) 1e9 + 7;
const double EPS = 1e-9;

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

int main() {
    string s,t;
    cin >> s;
    cin >> t;
    int arr[27]={};
    bool b[27] = {};
    rep(i,27) arr[i] = -1;
    rep(i,s.size()){
        if(arr[s[i]-'a']<0){
            arr[s[i]-'a'] = t[i]-'a';
            if(b[t[i]-'a']) {
                cout << "No" << endl;
                return 0;
            }
            b[t[i]-'a'] = true;
        }else{
            if(arr[s[i]-'a']!=t[i]-'a'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 776
w={"m":1000, "c":100, "x":10, "i":1}
def mcxiToNum(s):
    res=0
    while len(s)>0:
        if s[0] in w:
            res+=w[s[0]]
            s=s[1:]
        else:
            res+=w[s[1]]*int(s[0])
            s=s[2:]
    return res

def numToMcxi(n):
    s="ixcm"
    res=""
    for i in xrange(4):
        if n%10==0:
            res=res
        elif n%10==1:
            res=s[i]+res
        else:
            res=str(n%10)+s[i]+res
        n/=10
    return res

n=int(raw_input())
for _ in xrange(n):
    x,y=raw_input().split()
    print numToMcxi(mcxiToNum(x)+mcxiToNum(y))

Measured memory_bytes: 6360
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  // for prime MOD
  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination MOD prime
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < MOD);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n, int k) {
    return fact[n]*ifact[n-k];
  }
} c(10000007);
// c(5, 2) → 10, c.p(5, 2) → 20, c.fac[4] → 24

int main() {
  // 全ての数のそれぞれに桁にいくつビットが立っているか、1の数 x 0の数
  // long long、(1 << 60)のオーバーフローに注意
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  vector<int> bitNum(60);
  rep(i, N) {
    for (int j = 0; j < 60; j++) {
      if ((A[i] >> j) & 1) bitNum[j]++;
    }
  }
  mint ans = 0;
  for (ll i = 0; i < 60; i++) {
    ll x = bitNum[i];
    ll cur = x * (N-x) % MOD;
    rep(j, i) cur = cur * 2 % MOD;
    ans += cur;
  }
  cout << ans << '\n';
  return 0;
}

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

    int a,b;
  cin>>a>>b;
  int ma1=max(a,b);
  int ma2=min(a,b);
  for(int i=0;i<ma1;i++){
  	cout<<ma2;
  }
  return 0;
}



Measured memory_bytes: 256