akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;

void main() {
    int N, W;
    scan(N, W);

    auto w = new int[](N);
    auto v = new int[](N);
    iota(N).each!(i => scan(v[i], w[i]));

    auto dp = new int[](W + 1);

    foreach (i ; 0 .. N) {
        foreach_reverse (j ; w[i] .. W + 1) {
            chmax(dp[j], dp[j - w[i]] + v[i]);
        }
    }

    auto ans = dp[W];
    writeln(ans);
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}



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

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

int f(int x) {
  int res = 0;
  while (x%2 == 0) {
    x /= 2;
    res++;
  }
  return res;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  // a -> a'
  rep(i,n) {
    if (a[i]%2 == 1) {
      cout << 0 << endl;
      return 0;
    }
    a[i] /= 2;
  }

  // a' -> a''
  int t = f(a[0]);
  rep(i,n) {
    if (f(a[i]) != t) {
      cout << 0 << endl;
      return 0;
    }
    a[i] >>= t; // a[i] /= 2^t
  }
  m >>= t;

  ll l = 1;
  rep(i,n) {
    l = lcm(l, a[i]);
    if (l > m) {
      cout << 0 << endl;
      return 0;
    }
  }

  m /= l;
  int ans = (m+1)/2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

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;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll d,t,s;
    cin>>d>>t>>s;
    if(d<=t*s) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
using namespace std;
int a[101];
int main()
{
    int n, x, mn(1001);
    cin >> n >> x;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        mn = min(a[i], mn);
        x -= a[i];
    }
    cout << n + x / mn;
}



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

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

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

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

def main(argv)
  (x, y) = InputLine.to_ia

  z = y - (x * 2)

  flag1 = z >= 0
  flag2 = z % 2 == 0
  flag3 = (z / 2) <= x
  puts ((flag1 and flag2 and flag3) ? 'Yes' : 'No')
end

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

Measured memory_bytes: 14296
n,d=map(int,input().split())
x=[list(map(int,input().split())) for _ in range(n)]
res=0
for i in range(n):
	for j in range(i+1,n):
		cnt = 0
		for k in range(d):
			cnt += (x[i][k]-x[j][k])**2
		if (cnt**0.5)==(cnt**0.5)//1:
			res += 1
print(res)

Measured memory_bytes: 3060
S = input()

max_len = 0
for i in range(10):
    for j in range(i, 10):
        s = S[i:j+1]
        for n, k in enumerate(s, 1):
            if k not in ['A', 'T', 'G', 'C']:
                break
            if n == len(s):
                max_len = max(max_len, len(s))
print(max_len)

Measured memory_bytes: 8960
s = str(input())
n = len(s)
ans = [0]*n

cnt = 0
for i in range(n):
    if s[i] == 'R':
        cnt += 1
        if s[i+1] == 'L':
            ans[i] += (cnt+1)//2
            ans[i+1] += cnt//2
    else:
        cnt = 0

cnt = 0
for j in range(n-1,0,-1):
    if s[j] == 'L':
        cnt += 1
        if s[j-1] == 'R':
            ans[j] += (cnt+1)//2
            ans[j-1] += cnt//2
    else:
        cnt = 0

print(*ans)

Measured memory_bytes: 6400
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define db(x) cout<<#x<<"="<<x<<endl
#define deb(x) each(x.begin(),x.end(),(int& y){cout << y <<" ";})
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
#define EPS 1e(-9);
using namespace std;
typedef long long ll;

ll dp[60][60][3000];

void Main(){

  int N,K; cin>>N>>K;

  dp[0][0][0]=1; // [iこ目の箱][jこ保留][そこまでの奇妙さ]=みたす数

  rep(i,N){
    rep(j,N+1){
      rep(k,N*N+1){
        dp[i+1][j][2*j+k]+=dp[i][j][k];
        dp[i+1][j+1][2*j+k]+=dp[i][j][k];
        dp[i+1][j][2*j+k]+=j*dp[i][j][k]%MOD;
        dp[i+1][j-1][2*j+k]+=j*j*dp[i][j][k]%MOD;
        dp[i+1][j][2*j+k]+=j*dp[i][j][k]%MOD;
      }
    }
  }

  cout<< dp[N][0][K]%MOD <<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 70656
// Author:Eleus Ahammad, CSE, KUET
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define vii vector<pii>
#define vi vector<int>
#define F first
#define S second
#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ifile freopen("input.txt", "r", stdin)
#define ofile freopen("output.txt", "w", stdout)
#define MOD 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0) return a;
    return gcd(b, a%b);
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b);}
ll modpow(ll a, ll b, ll m)
{
    if (b == 0) return 1%m;
    ll u = modpow(a, b / 2, m);
    u = (u * u)%m;
    if (b%2) u = (a * u)%m;
    return u;
}
ll egcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0) {
        x = 1, y = 0;
        return a;
    }
    ll x1, y1;
    ll d = egcd(b, a%b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}
// Code begins here

void solve()
{
    ll n, k;
    cin >> n >> k;
    if (k == 1) puts("0");
    else {
        ll rem = n%k;
        cout << min(rem, (ll) abs(rem - k)) << endl;
    }
}


int main()
{
    fastio;
    int t = 1;
    //cin >> t;

    while (t--) {
        solve();
    }
}



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

int main() {
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i, n)cin>>a[i];
    bool t=0;
    int ans=0;
    do{
        int cnt=0;
        rep(i, n){
            if(a[i]!=0 && a[i]%2==0)
            {
                a[i]/=2;
                cnt++;
            }
        }
        if(cnt==a.size())
        {
            ans++;
            t=1;
        }
        else t=0;

    }
    while(t);
    cout<<ans;
    
    return 0;
    }

Measured memory_bytes: 3612
#include<iostream>
using namespace std;
string str,tmp,x="apple",y="peach";
int main(){
	getline(cin,str);
	for(int i=0;i<(int)str.size()-4;i++){
		tmp=str.substr(i,5);
		if(tmp==x)for(int j=0;j<5;j++)str[i+j]=y[j];
		else if(tmp==y)for(int j=0;j<5;j++)str[i+j]=x[j];
	}
	cout<<str<<endl;
	return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <fstream>
#include <algorithm>
#include <set>
#include <map>
//#define LOCAL
using namespace std;
typedef long long ll;
const int mx=2e5+10;
map<ll, int>vis;
int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
set<ll>value;
ll q;
cin>>q;
for(ll i=1;i<=q;i++){
    ll a, b;
    cin>>a>>b;
    if(0==a){
        value.insert(b);
        vis[b]=1;
        printf("%d\n", value.size());
    }else if(1==a){
        printf("%d\n",
               vis[b]);
    }else{
        value.erase(b);
        vis[b]=0;
    }
}


#ifdef LOCAL
fin.close();
#endif // LOCAL
}



Measured memory_bytes: 25032
//ITNOA
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
const long long INF=1e9+10,MAX=2e5+1e4,MOD=1e9+7;
typedef long long ll;
typedef pair<ll,ll> pii;
typedef pair<pii,ll> piii;
void OUT(long double o,int x){
	 cout<<fixed<<setprecision(x)<<o;
	 return;
}
bool a[10][MAX];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,m,x,y;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>x>>y;
		if(x==1)
			a[0][y]=1;
		if(y==n)
			a[1][x]=1;
	}
	for(int i=2;i<n;i++){
		if(a[0][i]&&a[1][i])
			return cout<<"POSSIBLE",0;
	}
	cout<<"IMPOSSIBLE";
	return 0;
}


Measured memory_bytes: 640
import collections
import bisect
n, m = map(int, input().split())#入力
s = [[int(_) for _ in input().split() ] for _ in range(m)]
a = collections.defaultdict(list)#「県」と「市の誕生順」を分けて管理
for x,y in sorted(s):#ソート⇒県の順番に並ぶ
    a[x]+=[y]
for x,y in s:
    z = bisect.bisect(a[x],y)
    #二分検索⇒「県」内の「市の誕生順」のインデックスを返す
    print("%06d%06d"%(x,z))#形式を整えて出力、出力は入力時の順番

Measured memory_bytes: 41012
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
ll dp[100000][4];
ll a[100000][4];
ll n;

int func(int ind,int flag){
	ll ans =0;
	if(ind==n) return 0;
	if(dp[ind][flag]!=-1) return dp[ind][flag];

	if(flag==0){
		ans = max(ans ,a[ind][1] + func(ind+1,1));
		ans = max(ans ,a[ind][2] + func(ind+1,2));
		ans = max(ans ,a[ind][3] + func(ind+1,3));
	} else if(flag==1){
		ans = max(ans ,a[ind][2] + func(ind+1,2));
		ans = max(ans ,a[ind][3] + func(ind+1,3));
	} else if(flag==2){
		ans = max(ans ,a[ind][1] + func(ind+1,1));
		ans = max(ans ,a[ind][3] + func(ind+1,3));
	} else if(flag==3){
		ans = max(ans ,a[ind][1] + func(ind+1,1));
		ans = max(ans ,a[ind][2] + func(ind+1,2));
	}
	dp[ind][flag] = ans;
	return dp[ind][flag];
}
int main(){
	memset(dp,-1,sizeof(dp));
	memset(a,-1,sizeof(a));

	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=1;j<=3;j++)
			cin>>a[i][j];
	}
	cout<<func(0,0);

}

Measured memory_bytes: 17692
#include<stdio.h>

int main(void){
 int x;
 int f[101]={0};
 while(scanf("%d",&x)!=EOF){
 f[x]=f[x]+1;
 }
 int i;
 int m=0;
 for(i=0;i<101;++i){
  if(m<f[i]){
   m=f[i];
 }}
 for(i=0;i<101;++i){
 if(m==f[i]){
  printf("%d\n",i);
 }}
return 0;
}

Measured memory_bytes: 596
function Main(input) {
	if (new Date('2019/04/30') >= new Date(input)) {
    console.log('Heisei');
  } else {
    console.log('TBD');
  }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 100005
ll freq[SIZE];
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ll N,K,Q;
	cin>>N>>K>>Q;
	for(ll i=0;i<Q;++i){
		ll t;
		cin>>t;
		freq[t]++;
	}
	for(ll i=1;i<=N;++i){
		if(K-(Q-freq[i])>0)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
const long long MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


int main() {
    int n;cin>>n;
    
    vector<pLL> order;
    rep(i,n){
        ll x,y;cin>>x>>y;
        order.emplace_back(x, y);
    }
    int par = (abs(order[0].first)+abs(order[0].second)) %2;
    
    rep(i,n){
        int par2 = (abs(order[i].first)+abs(order[i].second)) %2;
        order[i] = pLL(order[i].first + order[i].second, order[i].first-order[i].second);
        if(par2!=par){
            cout<<-1<<endl;
            return 0;
        }
    }
    
    vector<ll> d;
    for(auto i = 30; i>=0; i--)d.push_back(1LL<<i);
    if(par%2==0)d.push_back(1LL);
    cout<<d.size()<<endl;
    
    
    
    rep(j,d.size()-1){
        cout<<d[j]<<" ";
    }
    cout<<d[d.size()-1]<<endl;
    
    for(auto i = 0;i<n;i++){
        int xdir, ydir;
        ll xsum=0, ysum=0;
        
        for(auto j = 0; j<(int)d.size();j++){
            if(xsum<=order[i].first) {xdir=1; xsum+=d[j];}
            else {xdir=-1; xsum-=d[j];}
            
            if(ysum<=order[i].second){ydir=1; ysum+=d[j];}
            else {ydir=-1; ysum-=d[j];}
            
            if(xdir==1 && ydir ==1)cout<<"R";
            else if(xdir==1 && ydir==-1)cout<<"U";
            else if(xdir==-1 && ydir==1)cout<<"D";
            else cout<<"L";

        }
        
        cout<<endl;
        
        
    }
    
    
    
    
    //// (X, Y) rotated..... L: (X-di,Y-di), R: (X+di, Y+di), D: (X-di,Y+di), U: (X+di, Y-di)
    
    
    
    return 0;
}






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

#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) (x).begin(), (x).end()

inline void Main() {
  int H, W, K; cin >> H >> W >> K;
  vector<vector<bool>> C(H, vector<bool>(W));
  vector<vector<bool>> D(H, vector<bool>(W));
  char tmp;
  rep(i, H) { rep(j, W) {
    cin >> tmp; C[i][j] = tmp == '#';
  }}

  int r = 0;
  rep(bit_i, 1 << H) {
    rep(i, H) {
      rep(j, W) {
        D[i][j] = bit_i & (1 << i);
      }
    }

    rep(bit_j, 1 << W) {
      int r_x = 0;
      rep(i, H) {
        rep(j, W) {
          if (C[i][j] && D[i][j] && (bit_j & (1 << j))) {
            r_x++;
          }
        }
      }
      r += r_x == K ? 1 : 0;
    }
  }

  cout << r << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 3556
#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

double distanceAB(double xa, double ya, double xb, double yb);
void trace(int A[], int N);

/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/

int bubbleSort(int A[], int N)
{
	int sw = 0;
	bool flag = 1;
	
	for (int i=0; flag; i++)
	{
		flag = 0;
		for (int j=N-1; j>=i+1; j--)
		{
			if (A[j] < A[j-1])
			{
				swap(A[j], A[j-1]);
				flag = 1;
				sw++;
			}
		}
	}
	
	return sw;
}

int main()
{
	int A[100], N, sw;
	
	cin >> N;
	REP(N) cin >> A[i];
	sw = bubbleSort(A, N);
	
	trace(A, N);
	cout << sw << endl;
	
	return 0;
}


void trace(int A[], int N)
{
	REP(N)
	{
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
}


double distanceAB(double xa, double ya, double xb, double yb)
{
	return sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya));
}

Measured memory_bytes: 1160
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;

ll calc(string str){
    string tmp;
    ll sum = 0;
    bool ok = true;
    rep(i, str.size()){
        if (str[i] == '+') ok = false;
    }
    if(ok) return stoll(str);

    rep(i, str.size()){
        if (str[i] == '+'){
            sum += stoll(tmp);
            tmp = "";
        }else {
            tmp += str[i];
        }
    }
    return sum + stoll(tmp);
}

int main(){
    string s;
    cin >> s;    
    vector<ll> a;
    for(int bit = 0; bit < (1<<(s.size()-1)); bit++){
        string ns;
        for (int i = 0; i < s.size(); i++){
            if (i != 0 && bit&(1<<(i-1))){
                ns += '+';
            }
            ns += s[i];
        }
        a.push_back(calc(ns));
    }
    ll ans = 0;
    rep(i, a.size()) ans += (ll)a[i];
    cout << ans << "\n";
}


Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())

x_dif = tx - sx
y_dif = ty - sy

first_loop = ('U' * y_dif) + ('R' * x_dif) + 'D' * y_dif + 'L' * x_dif
#second_loop
second_loop_1 = 'D' + 'R' * (x_dif + 1) + 'U' * (y_dif + 1) + 'L'
second_loop_2 = 'U' + 'L' * (x_dif + 1) + 'D' * (y_dif + 1) + 'R'
print(first_loop + second_loop_1 + second_loop_2)

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

int main(){
  int m,w,bm[12],bw[12];
  while(1){ 
    cin>>m>>w;
    if(m==0 && w==0)break;
    int dp[13][1<<12]={};
    for(int i=0;i<m;i++)cin>>bm[i];
    for(int i=0;i<w;i++)cin>>bw[i];

    int ans=0;    
    for(int i=0;i<m;i++)
      for(int S=0;S<(1<<w);S++){ 
	//if(i < __builtin_popcount(S))continue;
	for(int l=0;l<w;l++){
	  if((S&(1<<l))!=0)continue;
	
	  int t=abs(bm[i]-bw[l])*(abs(bm[i]-bw[l])-30)*(abs(bm[i]-bw[l])-30);
	  dp[i+1][S+(1<<l)]=max(dp[i+1][S+(1<<l)],dp[i][S]+t);
	  dp[i+1][S] = max(dp[i+1][S],dp[i][S]);  
	  ans=max(ans,dp[i+1][S+(1<<l)]);
	}  
      }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1376
import bisect

n,m,k=map(int,input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
acum1=[0]
for i in range(n):
  acum1.append(acum1[-1]+arr1[i])
acum2=[0]
for i in range(m):
  acum2.append(acum2[-1]+arr2[i])
ans=0
for i in range(n+1):
  if acum1[i]>k:
    break
  j=bisect.bisect_right(acum2,k-acum1[i])-1
  ans=max(ans,i+j)
print(ans)

Measured memory_bytes: 47496
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner kbScanner = new Scanner(System.in);
		int input, count = 1;
		
		while((input = kbScanner.nextInt()) != 0){
			System.out.println("Case " + count + ": " + input);
			count++;
		}
	}
}

Measured memory_bytes: 42400