akhauriyash/Code-Regression huggingface dataset:
n, m = gets.split.map(&:to_i)
infos = n.times.map { gets.split.map(&:to_i) }.map { |a| a.drop(1) }
cnt = 0

(1..m).each do |i|
  cnt += 1 if infos.all? {|info| info.include?(i) }
end
puts cnt

Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
 
class Program {
  static void Main (string[] args) {
    string str = Console.ReadLine();
    int count = 0;
    List<int> max = new List<int>();
    for (int cnt = 0; cnt < str.Length; cnt++) {
      char s = str[cnt];
      if (s == 'A' || s == 'C' || s == 'G' || s == 'T') {
        count++;
        if (cnt == str.Length - 1) max.Add(count);
      }
      else
      {
        max.Add(count);
        count = 0;
      }
    }
    int fin = 0;
    foreach (int c in max) {
      if (c > fin) fin = c;
    }
    Console.WriteLine(fin);
  }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("test.in");ofstream coutt("test.out");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Use __builtin_popcountll for ll;
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 

int n,x;
int l[105];
int d[105];

signed main(){
    FASTER;
    cin>>n>>x;
    for(int i=1;i<=n;i++)cin>>l[i];
    int ans=0;
    for(int i=2;i<=n+1;i++){
        d[i]=d[i-1]+l[i-1];
        if(d[i]<=x)ans=i;
    }
    cout<<ans;
}

Measured memory_bytes: 3608
S = int(input())

name = [input() for _ in range(S)]

l = [0]*5
M=A=R=C=H=0
for i in range(S):
	if name[i][0] == "M":
		l[0] += 1
	if name[i][0] == "A":
		l[1] += 1
	if name[i][0] == "R":
		l[2] += 1
	if name[i][0] == "C":
		l[3] += 1
	if name[i][0] == "H":
		l[4] += 1

ans = 0
for i in range(3):
	for j in range(i+1,4):
		for k in range(j+1,5):
			ans += l[i]*l[j]*l[k]

print(ans)

Measured memory_bytes: 9776
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n,ans=0;
  cin>>n;
  vector<ll>v(n,0);
  for(ll i=0;i<n;i++){
    cin>>v[i];
  }
  if(n==1){
    cout<<"Yes"<<endl;
    return 0;
  }
  for(ll i=1;i<n;i++){
    v[i-1]--;
    if(v[i-1]>v[i])ans=1;
    if(v[i-1]==v[i])v[i]++;
  }
  if(ans==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	std::string s; cin >> s;
	
	if((s.size() & 1) ^ !(s.front() == s.back())) printf("Second\n");
	else printf("First\n");
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int h,w;
  cin >> h >> w;
  vector<vector<char>> a(h,vector<char>(w));
  for(int i=0;i<h;i++){
    int cnt=0;
    for(int j=0;j<w;j++){
      cin >> a[i][j];
      if(a[i][j]=='.') cnt++;
    }
    if(cnt==w){
      i--;
      h--;
    }
  }
  for(int j=0;j<w;j++){
    int cnt=0;
    for(int i=0;i<h;i++){
      if(a[i][j]=='.') cnt++;
    }
    if(cnt==h){
      for(int i=0;i<h;i++){
	a[i].erase(a[i].begin()+j);
      }
      j--;
      w--;
    }
  }
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cout << a[i][j];
    }
    cout << "\n";
  }


  
  return 0;
}


Measured memory_bytes: 256
n = int(input())
*a, = map(int, input().split())

t = []
for i, j in zip(range(1, n+1), a):
    t.append((i, j))

ans = []
for i in sorted(t, key=lambda x: x[1]):
    ans.append(i[0])
print(" ".join(map(str, ans)))


Measured memory_bytes: 25556
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vii vector<vector<int>>
#define vpi vector<pair<int,int>>
#define w(t) int t;cin>>t;while(t--)
#define pi pair<int,int>
#define mii map<int,int>
#define pb push_back
#define ff first
#define ss second
#define FOR(i,t,n) for(int i=t;i<n;i++)
#define SCI(x)  scanf("%d",&x)
#define SCL(x) scanf("%lld",&x)
#define debug(x) cout<<x<<endl
#define debug2(x,y) cout<<x<<" "<<y<<endl;
#define debug3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;

int main()
{
	int n;
	cin >> n;
	int k;
	cin >> k;
	if (k >= n) {
		k = n - 1;
	}
	int a[n];
	FOR(i, 0, n) {
		cin >> a[i];
	}
	int dp[n];
	dp[0] = 0;
	for (int i = 0; i <= k; i++) {
		dp[i] = abs(a[i] - a[0]);
	}

	for (int i = k + 1; i < n; i++) {
		int ans = INT_MAX;
		for (int j = 1; j <= k; j++) {
			ans = min(dp[i - j] + abs(a[i] - a[i - j]) , ans);
		}
		dp[i] = ans;
	}

	cout << dp[n - 1] << endl;
}


Measured memory_bytes: 4368
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int x, a, b;
	cin >> x >> a >> b;
	int temp1,temp2;
	
	if(x>a) temp1 = x-a;
	else temp1 = a-x;
	if(x>b) temp2 = x-b;
	else temp2 = b-x;
	
	if(temp1 < temp2) cout << "A" << endl;
	else cout << "B" << endl;
	return 0;
}

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

int main(){
	int n,m,i,j;
	int a[100][100];
	int b[100];
	int c[100];

	cin >> n >> m;
	for( i=0; i<n; i++ )
		for( j=0; j<m; j++ ) cin >> a[i][j];
			for( i=0; i<m; i++ ) cin >> b[i];

	for( i=0; i<n; i++ ){
		c[i] = 0;
		for( j=0; j<m; j++ ){
			c[i] += a[i][j]*b[j];
		}
	}

	for( i=0; i<n; i++ ) cout << c[i] << endl;

	return 0;
}

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

long long N, D;
long long X[210000];
long long Y[210000];

int main(void){

    cin >> N >> D;
    for (int i = 1; i <= N;i++) cin >> X[i] >> Y[i];

    int ans;
    ans = 0;
    D = D * D;

    for (int i = 1; i <= N;i++){
        long long dist = X[i] * X[i] + Y[i] * Y[i];
        if (D >= dist) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6760
#include<iostream>
#include<cstdio>
#define mod 1000000007
using namespace std;
long long n,m,x[100001],y[100001];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>x[i];
	for(int j=1;j<=m;j++) cin>>y[j];
	long long h=0,w=0;
	for(int l=1,r=n;l<r;++l,--r) w=(w+(x[r]-x[l])*(r-l)%mod)%mod;
	for(int l=1,r=m;l<r;++l,--r) h=(h+(y[r]-y[l])*(r-l)%mod)%mod;
	cout<<h*w%mod;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(){
   int H,W;
   while(true){
       cin >> H >> W;
     if(H==0 && W==0){
       break;
     }
     for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
          cout << '#';
        }
      cout << endl;
     }
   cout << endl;
   }
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++) {cin >> d.at(i);}
  sort(d.begin(), d.end());
  if (d.at(N / 2) - d.at(N / 2 - 1) == 0) {cout << 0 << endl;}
  else {cout << d.at(N / 2) - d.at(N / 2 - 1) << endl;}
}

Measured memory_bytes: 3792
#include <iostream>
#include <sstream>
int INF=1000000000;
int cnt=0;
void merge(int A[],int left,int mid,int right){
  int n1,n2;
  n1=mid-left;
  n2=right-mid;
  int L[n1+1];
  int R[n2+1];
  for(int i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(int i=0;i<n2;i++){
    R[i]=A[mid+i];
  }
  L[n1]=R[n2]=INF;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      cnt++;
    }else{
      A[k]=R[j];
      j++;
      cnt++;
    }
  }
}

void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}

int main(){
  int n;
  std::cin>>n;
  int A[n];
  for(int i=0;i<n;i++){
    std::cin>>A[i];
  }
  int left=0;
  int right=n;
  mergeSort(A,left,right);
  for(int i=0;i<n-1;i++){
    std::cout<<A[i]<<" ";
  }
  std::cout<<A[n-1]<<"\n";
  std::cout<<cnt<<"\n";
}


Measured memory_bytes: 6968
#include<bits/stdc++.h>
#define N 100010
#define ll long long
using namespace std;

ll n, sum, ans, res;
ll a[N], p[70];

void rd(ll &ans)
{
    ans = 0; ll f = 1;
    char x = getchar();
    while(x > '9' || x < '0') {if(x == '-') f = -1; x = getchar();}
    while(x >= '0' && x <= '9') ans = ans * 10 + x - '0', x = getchar();
    ans *= f;
}

void insert(ll x)
{
    for(int i = 60; ~i; i --)
        if(x & (1LL << i))
        {
            if(p[i]) x ^= p[i];
            else {p[i] = x; break;}
        }
}

int main()
{
    rd(n);
    for(int i = 1; i <= n; i ++) rd(a[i]), sum ^= a[i];
    for(int i = 0; i < 60; i ++)
    {
        if((sum & (1LL << i)) == 0) continue;
        ans += (1LL << i);
        for(int j = 1; j <= n; j ++)
            if(a[j] & (1LL << i)) a[j] ^= (1LL << i);
    }
    for(int i = 1; i <= n; i ++) insert(a[i]);
    for(int i = 60; ~i; i --) res = max(res, res ^ p[i]);
    printf("%lld", ans + (res << 1));
    return 0;
}

Measured memory_bytes: 4516
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <string>
#include <sstream>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<ll> VL;

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

    ll A[5];
    cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4];

    int minIndex = -1;
    for (int i = 0; i < 4; ++i) {
        if (A[i] % 10 == 0) {
            continue;
        }
        if (minIndex < 0) {
            minIndex = i;
        } else {
            minIndex = (A[minIndex] % 10) > (A[i] % 10) ? i : minIndex;
        }
    }

    ll ans = 0;
    ll lim = minIndex < 0 ? 5 : 4;
    for (int i = 0; i < 5; i++) {
        if (i == minIndex) {
            continue;
        }
        // cout << A[i] << endl;
        ans += A[i] + (A[i] % 10 == 0 ? 0 :  10 - (A[i] % 10));
    }
    if (minIndex >= 0) {
        ans += A[minIndex];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
number = []
for _ in range(n):
    number.append(list(map(int, input().split())))

number = [list(num) for num in zip(*number)]
score = [0] * n

for num in number:
    for i, n in enumerate(num):
        if num.count(n) == 1:
            score[i] += n

for s in score:
    print(s)



Measured memory_bytes: 5632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace mondai0001
{
    class Program
    {
        static void Main(string[] args)
        {
            int[]   height  = new int[ 10 ];
            for( int i = 0; i < 10; i++ ) {
                height[ i ] = int.Parse( Console.ReadLine() );
            }
            Array.Sort( height );
            Console.WriteLine( height[ 9 ] );
            Console.WriteLine( height[ 8 ] );
            Console.WriteLine( height[ 7 ] );
        }
    }
}

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

int main() {
	int N;
	cin >> N;
	string first;
	cin >> first;
	char last = first.back();
	set<string> Used;
	Used.insert(first);

	bool ans = true;
	for (int i = 1; i < N; i++) {
		string s;
		cin >> s;
		if (s.front() != last || Used.find(s) != Used.end()) ans = false;
		Used.insert(s);
		last = s.back();
	}
	cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    vector<ll> v(3); ll k;
    cin >> v[0] >> v[1] >> v[2] >> k;
    vector<ll> a{1, 0, -1};
    ll cnt = k, ans1 = 0, ans2 = 0;
    for (int i = 0; i < 3; ++i) {
        ans1 += a[i]*min(cnt, v[i]);
        cnt -= min(cnt, v[i]);
    }
    cout << ans1 << "\n";
    return 0;
}

Measured memory_bytes: 3588
h,w = map(int,input().split())

board = [input() for i in range(h)]

dx = [-1,0,1,0]
dy = [0,-1,0,1]

ans = 'Yes'

for i in range(h):
  for j in range(w):
    if board[i][j] == '#' and ans == 'Yes':
      T_F = False
      for d in range(4):
        ni = i + dx[d]
        nj = j + dy[d]
        if 0 <= ni < h and 0 <= nj < w and board[ni][nj] == '#':
          T_F = True
      if not T_F :
        ans = 'No'
        break
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;
class Main{
  public static void main (String[] args){
    Scanner stdIn = new Scanner(System.in);
    
    long  X = stdIn.nextLong();
    
    int y = 0;
    double money = 100;
    do{
      double r =Math.floor(money * 0.01);
      money = money + r;
      y++;
    }while(money < X);
    System.out.println(y);
  }
}


Measured memory_bytes: 35744
import java.util.*;
class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int num = 1;

        for(int i = 2; i <= 31; i++)
        {
            for(int j = 10; j > 1; j--)
            {
                double tmp = Math.pow(i, j);
                if(tmp <= x && tmp > num) num = (int) tmp;
            }
        }
        System.out.print(num);
        scan.close();
    }
}

Measured memory_bytes: 21716
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct data
{
	int w,id;
	friend bool operator < (data a,data b){return a.w<b.w;}
}d[200020];
int n,a[100010],b[100010],cnt1,cnt2;
long long ans,sum,suma,sumb;
bool usea[100010],useb[100010];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d %d",&a[i],&b[i]);
		d[i*2-1]=data{a[i],i};
		d[i*2]=data{b[i],-i};
		suma+=a[i],sumb+=b[i];
	}
	ans=min(suma,sumb);
	sort(d+1,d+1+2*n);
	int cnt1=0,cnt2=0;
	for(int i=1;i<=n;++i)
	{
		sum+=d[i].w;
		if(d[i].id>0)usea[d[i].id]=1,++cnt1;
		else useb[-d[i].id]=1,++cnt2;
	}
	bool f=0;
	for(int i=1;i<=n;++i)if(usea[i]&&useb[i])f=1;
	if(f)return printf("%lld",sum),0;
	int mx=0;
	for(int i=1;i<=n;++i)if(d[i].id!=-d[n+1].id)mx=max(mx,d[i].w);
	ans=min(ans,sum+d[n+1].w-mx);
	mx=0;
	for(int i=1;i<=n;++i)if(d[i].id!=-d[n+2].id)mx=max(mx,d[i].w);
	ans=min(ans,sum+d[n+2].w-mx);
	printf("%lld",ans);
	return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  ll q;
  st s;
  cin >> s >> q;

  deque<char> str;
  ll sw = 0;
  rep(i, 0, s.size()){
    str.push_back(s.at(i));
  }

  rep(i, 0, q){
    ll t;
    cin >> t;
    if(t == 1) sw++;
    else{
      ll f;
      char c;
      cin >> f >> c;
      if((sw + f) % 2 == 0) str.push_back(c);
      else str.push_front(c);
    }
  }

  st ans = "";
  if(sw % 2 == 0){
    while(str.size()){
      ans += str.front();
      str.pop_front();
    }
  }
  else{
    while(str.size()){
      ans += str.back();
      str.pop_back();
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1416
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
    ios::sync_with_stdio(false);

    START:

    int n;
    cin >> n;
    if(n == 0) return 0;
    map<char,char> mp;
    for(int i=0; i<n; i++){
        char a,b;
        cin >> a >> b;
        mp[a] = b;
    }
    int m;
    cin >> m;
    for(int i=0; i<m; i++){
        char a;
        cin >> a;
        if(mp.count(a) > 0) cout << mp[a];
        else cout << a;
    }
    cout << endl;

    goto START;

    return 0;
}



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

int main() {
  string S;
  getline(cin, S);
  bool ans = false;
  for(int i = 0; i < S.size() - 1; i++){
  	if(S.at(i) != S.at(i + 1)){
      ans = true;
      break;
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        System.out.println(r * 2 * Math.PI);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 27184
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    ll a, b, x;
    cin >> a >> b >> x;
    if (a <= x && x <= a + b) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
    return 0;
}

Measured memory_bytes: 3592
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

bool IsExist[100000];
int main() {
	cin >> A >> B >> C >> D;
	rep(i, C - A) {
		cout << "R";
	}
	rep(i, D - B) {
		cout << "U";
	}
	rep(i, C - A) {
		cout << "L";
	}
	rep(i, D - B) {
		cout << "D";
	}

	cout << "D";
	rep(i, C - A + 1) {
		cout << "R";
	}
	rep(i, D - B + 1) {
		cout << "U";
	}
	cout << "L";

	cout << "U";
	rep(i, C - A + 1) {
		cout << "L";
	}
	rep(i, D - B + 1) {
		cout << "D";
	}
	cout << "R";
}



Measured memory_bytes: 256
//R<3S
#include <bits/stdc++.h>
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>


using namespace std;

int n;
vi v;
int dp[405][405];
int pre[405];
int find(int i,int j)
{
	if(i==j)return 0;
	// if(i+1==j)return v[i]+v[j];
	if(dp[i][j]!=-1)return dp[i][j];
	int minm=1e18+5;
	
	repA(x,i,j-1)
	{
		minm=min(minm,find(i,x)+find(x+1,j)+(i>0?pre[j]-pre[i-1]:pre[j]));
	}
	
	return dp[i][j]=minm;
	
}
void solve()
  {

	cin>>n;
	int x;
	rep(i,405)rep(j,405)dp[i][j]=-1;
	rep(i,n)
	{
		cin>>x;
		v.pb(x);
		if(i==0)pre[i]=x;
		else pre[i]=x+pre[i-1];
	}
	
	cout<<find(0,n-1);


  }



signed main()
{
   std::ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int t;
   t=1;
   //cin>>t;
   while(t--)
    {
        solve();
    }


   return 0;
}


Measured memory_bytes: 4944
#include<cstdio>

int main() {
  int n, Rt;
  int maxv = -2e9;
  int minv = 2e9;

  scanf("%d", &n);

  for ( int i = 0; i < n; i++ ) {
    scanf("%d", &Rt);
    maxv = maxv > Rt-minv ? maxv : Rt-minv;
    minv = minv < Rt ? minv : Rt;
  }

  printf("%d\n", maxv);

  return 0;
}


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


int main() {
  int n, m;
  cin>>n>>m;
  int a[m];
  int b[m];
  bool exist[n];
  for (int i=0; i<n; i++) exist[n] = false;

  bool c[m][n];
  for (int i=0; i<m; i++) {
    for (int j=0; j<n; j++) {
      c[i][j] = false;
    }
  }
  for (int i=0; i<m; i++) {
    cin>>a[i]>>b[i];
    for (int j=0; j<b[i]; j++) {
      int cij;
      cin>>cij;
      --cij;
      exist[cij] = true;
      c[i][cij] = true;
    }
  }
  for (int i=0; i<n; i++) {
    if (!exist[i]) {
      cout<<-1<<endl;
      return 0;
    }
  }
  int size = 1 << n;
  long long d[size];
  for (int i=0; i<size; i++) d[i] = 1e10;
  for (int i=0; i<m; i++) {
    int idx = 0;
    for (int j=0; j<n; j++) {
      if (c[i][j]) {
        idx += (1 << j);
      }
    }
    d[idx] = min((long long)a[i], d[idx]);
  }
  while (true) {
    bool updated = false;
    for (int i=0; i<size; i++) {
      for (int j=0; j<size; j++) {
        if (i == j) {
          continue;
        }
        if (d[i] == 1e10 || d[j] == 1e10) {
          continue;
        }
        int idx = 0;
        for (int k=0; k<n; k++) {
          if (((i >> k) | (j >> k)) & 1) {
            idx += (1 << k);
          }
        }
        if (d[idx] > d[i] + d[j]) {
          updated = true;
          d[idx] = d[i] + d[j];
        }
      }
    }
    if (!updated) {
      break;
    }
  }
  cout<<d[size-1]<<endl;
}

Measured memory_bytes: 384
//01 Matri

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define YN(flag) (flag?"Yes":"No")
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int h,w,a,b;cin>>h>>w>>a>>b;
    rep(i,0,h){
        rep(j,0,w){
            if(i<b){
                if(j<a){
                    cout<<0;
                }else{
                    cout<<1;
                }
            }else{
                if(j<a){
                    cout<<1;
                }else{
                    cout<<0;
                }
            }
        }
        cout<<nnn;
    }
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

typedef long long ll;

bool func(int n, int i, vector<ll> &v, vector<ll> &sum) {
    for (int j = i+1; j < n; j++) {
        if (2 * sum[j] < v[j])
            return false;
    }
    return true;
}

int main() {
    int n;  cin >> n;
    vector<ll> sum(n+1, 0);
    vector<ll> v(n);
    for (int i = 0; i < n; i++)
        cin >> v[i];
    sort(v.begin(), v.end());
    for (int i = 0; i < n; i++)
        sum[i+1] = sum[i] + v[i];
    int l = -1, r = n-1;
    while (r - l > 1) {
        int mid = (l + r) / 2;
        if (func(n, mid, v, sum))
            r = mid;
        else 
            l = mid;
    }
    

    cout << n - r << endl;
    return 0;
}

Measured memory_bytes: 4848
import numpy as np
n,k=map(int,input().split())
a=np.array(list(map(int,input().split())))
a.sort()
p=a[a>0]
z=a[a==0]
m=a[a<0]
l=-10**18
r=10**18
while r-l>1:
  mid=(r+l)//2
  cnt=0
  if mid>=0:
    cnt+=len(z)*n
  cnt+=a.searchsorted(mid//p,side='right').sum()
  cnt+=(n-a.searchsorted(-(-mid//m),side='left')).sum()
  cnt-=np.count_nonzero(a*a<=mid)
  cnt//=2
  if cnt>=k:
    r=mid
  else:
    l=mid
print(r)

Measured memory_bytes: 32320
#include<iostream>
#include<queue>
#include<iomanip>
#include<vector>
#include<string>

using namespace std;

#define MAX 1024
#define N 10
#define SIZE 22

#define NONE 0
#define START 1
#define DIRTY_TILE 2
#define FURNITURE 3

#define INFTY 1<<16

void bfs(int sti, int stj, int map[SIZE][SIZE], int cost_map[SIZE][SIZE]){
	const int di[] = {-1,0,1,0};
	const int dj[] = {0,1,0,-1};
	bool vis[SIZE][SIZE]={{false,},};
	queue< pair<int,int> > q;

	for(int i = 0; i < SIZE; ++i){
		for(int j = 0; j < SIZE; ++j){
			cost_map[i][j] = INFTY;
		}
	}

	q.push( make_pair(sti,stj) );
	cost_map[sti][stj]=0;
	vis[sti][stj]=true;
	while(!q.empty()){
		pair<int,int> t = q.front();
		q.pop();

		for(int k = 0; k < sizeof(di)/sizeof(*di); ++k){
			int ti = t.first + di[k];
			int tj = t.second + dj[k];
			if( map[ti][tj] != FURNITURE && !vis[ti][tj] ){
				cost_map[ti][tj] = cost_map[t.first][t.second] + 1;
				vis[ti][tj]=true;
				q.push( make_pair(ti,tj) );
			}
		}
	}
}

int dp(int n, int ini_cost[N], int cost[N][N] ){
	int ret=INFTY;
	int w[MAX][N];

	for(int state=0;state<(1<<n);++state){
		for(int i=0;i<n;++i){
			w[state][i]=INFTY;
		}
	}

	for(int i=0;i<n;++i){
		w[0][i]=ini_cost[i];
	}

	for(int state=1;state<(1<<n);++state){
		for(int i=0;i<n;++i){
			if(!(state&(1<<i))){
				for(int j=0;j<n;++j){
					if(state&(1<<j)){
						int pre_state=state^(1<<j);
						w[state][i]=min(w[state][i],w[pre_state][j]+cost[j][i]);
					}
				}
			}
		}
	}

	for(int i=0;i<n;++i){
		ret=min(ret,w[((1<<n)-1)^(1<<i)][i]);
	}

	return ret;
}

int CleaningRobot(int h, int w, int map[SIZE][SIZE]){
	int cost[N][N];
	int ini_cost[N];
	int cost_map[SIZE][SIZE];
	vector< pair<int, int> > vtiles;

	for(int i = 1; i <= h; ++i){
		for(int j = 1; j <= w; ++j){
			if( map[i][j] == DIRTY_TILE ){
				vtiles.push_back( make_pair( i, j ) );
			}
			if( map[i][j] == START ){
				bfs(i,j,map,cost_map);
			}
		}
	}

	for(unsigned int i = 0; i < vtiles.size(); ++i){
		ini_cost[i]=cost_map[vtiles[i].first][vtiles[i].second];
	}

	for(unsigned int i = 0; i < vtiles.size(); ++i){
		bfs(vtiles[i].first,vtiles[i].second,map,cost_map);
		
		/*for(int k = 1; k <= h; ++k){
			for(int l = 1; l <= w; ++l){
				cout << setw(4) << cost_map[k][l];
			}
			cout << endl;
		}
		cout << endl;
		*/

		for(unsigned int j = 0; j < vtiles.size(); ++j){
			cost[i][j] = cost[j][i] = cost_map[vtiles[j].first][vtiles[j].second];
			if(cost[i][j]>=INFTY)return -1;
		}
	}

	int ret = dp(vtiles.size(),ini_cost,cost);
	return ret>=INFTY?-1:ret;
}

int main(){
	while(true){
		int h,w;
		int map[SIZE][SIZE];
		cin>>w>>h;
		if(h==0&&w==0)break;
		for(int i=0;i<SIZE;++i){
			for(int j=0;j<SIZE;++j){
				map[i][j]=FURNITURE;
			}
		}
		for(int i=1;i<=h;++i){
			string s;
			cin>>s;
			for(unsigned int j=0;j<s.length();++j){
				switch(s[j]){
					case '.':
						map[i][j+1]=NONE;
						break;
					case 'x':
						break;
					case 'o':
						map[i][j+1]=START;
						break;
					case '*':
						map[i][j+1]=DIRTY_TILE;
						break;
				}
			}
		}

		cout << CleaningRobot(h,w,map) << endl;
	}
	return 0;
}

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

int main() {
	
	int c;
	cin >> c;
	int a, m;
	cin >> m;
	for (int i = 1; i < c; i++) {
		cin >> a;
		int b = a % m;
		while (b) {
			a = m;
			m = b;
			b = a % m;
		}
	}
	
	for (int i = 1; i <= m; i++) {
		if (m % i == 0) cout << i << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 3084
/* ABC138-C
   Takatan */

#include<stdio.h>
#include<stdlib.h>

typedef struct tnode{
    double value;
    struct tnode *left;
    struct tnode *right;
} tnode;

tnode* createTNode(double value);
void insertTNode(tnode *new, tnode **first);
void checkTree(tnode *first, double *value);
int main(void){
    int number, i;
    double value, min;
    tnode *new, *tree = NULL;
    min = 1000;

    scanf( "%d" , &number);
    for(i=0; i < number; i++){
        scanf( "%lf" , &value);
        if(value<min){
            min = value; /* 最小値を保存 */
        }
        new = createTNode(value); /* 新しいノードを作成 */
        insertTNode(new, &tree); /* 二分探索木に挿入 */
    }
    value = min;
    checkTree(tree, &value); /* 残る1個の具材の価値をvaludに保存 */
    printf( "%f\n" , value);
    return 0;
}

tnode* createTNode(double value){ /* 新しいノードを作成する関数 */
    tnode *new = malloc(sizeof(tnode));

    if(new==NULL){
        exit(2);
    }

    new->value = value; /* 価値をコピー */
    new->left = NULL;
    new->right = NULL;
    return(new);
}

void insertTNode(tnode *new, tnode **first){

    if(*first==NULL){
        *first = new; /* 1つ上が先端の時 */
    }else if((new->value)<((*first)->value)){
        /* 新しい材料の価値の方が小さいとき、左を探索 */
        insertTNode(new, &((*first)->left)); /* 再帰的に実行 */
    }else{
        /* 新しい材料の価値の方が大きいまたは同じとき、右を探索 */
        insertTNode(new, &((*first)->right)); /* 再帰的に実行 */
    }
}

void checkTree(tnode *first, double *value){
    if(first->left!=NULL){ /* 左に子がいる時 */
        checkTree(first->left, value); /* 再帰的に実行 */
    }
    *value = (*value + first->value)/2; /* 価値の低いものから順に合成 */
    if(first->right!=NULL){ /* 右に子がいる時 */
        checkTree(first->right, value); /* 再帰的に実行 */
    }
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int N, sum = 0;

int main() {
    cin >> N;
    int a[N];
    for (int i = 0; i < N; i++) cin >> a[i];
    for (int k = 0; k < N; k++) {
        sum += a[k] - 1;
    }
    cout << sum << endl;
    
    return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)

using namespace std;

int compute(string &s,int sp) {
  int cost = (int)s.size()-sp-1,cnt=0;
  char c = s[sp];
  rep(i,sp) {
    if( s[i] != c ) ++cnt;
    else cost = max(cost,cnt), cnt = 0;
  }
  cost = max(cost,cnt), cnt = 0;
  return cost;
}

int main() {
  string s;
  cin >> s;
  int mini = (int)s.size()-1;
  rep(i,(int)s.size()) mini = min(mini,compute(s,i));
  cout << mini << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;


int main()
{
	int cnt = 0,maxNum=0;
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C') {
			cnt++;
			maxNum = max(maxNum,cnt);
		}
		else cnt = 0;
	}
	cout << maxNum << endl;
}


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

int n, pos;
vector<int> pre, in, post;

void rec(int l, int r){
    if(l >= r) return;
    int root = pre[pos++];
    int m = distance(in.begin(), find(in.begin(), in.end(), root));
    rec(l, m);
    rec(m+1, r);
    post.push_back(root);
}

void solve(){
    pos = 0;
    rec(0, pre.size());
    for(int i=0; i<n; ++i){
        if(i) cout << " ";
        cout << post[i];
    }
    cout << endl;
}


int main(){
    cin >> n;
    pre.reserve(n); in.reserve(n); post.reserve(n); 
    int k;
    for(int i=0; i<n; ++i){
        cin >> k;
        pre.emplace_back(k);
    }

    for(int i=0; i<n; ++i){
        cin >> k;
        in.emplace_back(k);
    }

    solve();
}



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

#define rep(i, n) for(int i=0; i < (n); ++i)
#define ll long long

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
//const int mod = 998244353;

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, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

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

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
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];
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int temp = 0;
    rep(i, 3) {
        int t; cin >> t;
        temp += t;
    }

    if (temp >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		int n = Integer.parseInt(sc.nextLine());
		
		for (int i = 0; i < n; i++){
		    String []lines = sc.nextLine().split(" ");
		    
		    if (lines[0].equals("replace")){
		        str = replace(str, Integer.parseInt(lines[1]), Integer.parseInt(lines[2]), lines[3]);
		    }else if (lines[0].equals("reverse")) {
		        str = reverse(str, Integer.parseInt(lines[1]), Integer.parseInt(lines[2]));
		    }else {
		        print(str, Integer.parseInt(lines[1]), Integer.parseInt(lines[2]));
		    }
		}
	}
	
	public static String replace(String str, int start, int end, String replace_str){
	    char []str_to_char = str.toCharArray();
	    char []rstr_to_char = replace_str.toCharArray();
	    
	    for (int i = 0; start+i <= end; i++){
	        str_to_char[start+i] = rstr_to_char[i];
	    }
	    
	    str = String.valueOf(str_to_char);
	   
	    return str;
	}
	
	public static String reverse(String str, int start, int end){
	    char []str_to_char = str.toCharArray();
	    
	    while(end > start){
	        char tmp = str_to_char[start];
	        str_to_char[start] = str_to_char[end];
	        str_to_char[end] = tmp;
	        start++;
	        end--;
	    }
	    
	    str = String.valueOf(str_to_char);
	    
	    return str;
	}
	
	public static void print(String str, int start, int end){
	    char []str_to_char = str.toCharArray();
	    
	    for (; start <= end; start++){
	        System.out.print(str_to_char[start]);
	    }
	    
	    System.out.println();
	}
}


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

int main() {
	int N;
	cin >> N;
	vector<int> d(N);
	rep(i, N) {
		cin >> d.at(i);
	}
	sort(d.begin(), d.end());
	cout << d.at(N / 2) - d.at(N / 2 - 1) << endl;
	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){
  string S;
  cin >> S;
  int one = 0;
  int zero = 0;
  for(auto i = 0; i < S.length(); i++){
    if(S.at(i) == '0') zero++;
    else one++;
  }
  int a = min(one, zero);
  cout << 2*a << endl;
}


Measured memory_bytes: 512
//C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

//ここまで毎回include
//以下プログラム

using namespace std;

int main() {
	int w, h, n;
	cin >> w >> h >> n;
	vector<vector<int>> data(3, vector<int>(n));
	for (int i = 0; i < n; i++) {
		int x, y, a;
		cin >> x >> y >> a;
		data.at(0).at(i) = x;
		data.at(1).at(i) = y;
		data.at(2).at(i) = a;
	}
	vector<int>left(4);
	left.at(0) = 0;
	left.at(1) = w;
	left.at(2) = 0;
	left.at(3) = h;
	for (int i = 0; i < n; i++) {
		if (data.at(2).at(i) == 1) {
			left.at(0) = max(left.at(0), data.at(0).at(i));
		}
		else if (data.at(2).at(i) == 2) {
			left.at(1) = min(left.at(1), data.at(0).at(i));
		}
		else if (data.at(2).at(i) == 3) {
			left.at(2) = max(left.at(2), data.at(1).at(i));
		}
		else {
			left.at(3) = min(left.at(3), data.at(1).at(i));
		}
	}
	if (left.at(0) < left.at(1) && left.at(2) < left.at(3)) {
		cout << (left.at(1) - left.at(0)) * (left.at(3) - left.at(2)) << endl;
	}
	else {
		cout << 0 << endl;
	}
}



Measured memory_bytes: 256
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	string S,T;
	scan(S>>T);
	int N=S.size();
	int M=T.size();
	int ans=INF;
	rep(i,N-M+1){
		int sum=0;
		rep(j,M){
			if(S[i+j]!=T[j]){
				sum++;
			}
		}
		ans=min(ans,sum);
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    int N;cin>>N;
    string s;cin>>s;
    vector<vector<int>> dp(N+1,vector<int>(N+1,0));
    REP(i,N) if(s[i]==s.back()) dp[i][N-1]=1;
    for(int i=N-1;i>=0;--i) for(int j=N-1;j>=0;--j){
        if(s[i]==s[j]) dp[i][j]=dp[i+1][j+1]+1;
    }
    int ans=0;
    REP(i,N) REP(j,N) ans=max(ans,min(j-i,dp[i][j]));
    cout<<ans<<endl;
}

Measured memory_bytes: 100224
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
//priority_queue<int> pque;
//priority_queue<int, vector<int>, greater<int>> pque;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 998244353;

int N,W;
ll w[100010];
ll v[100010];
ll dp[110][100010];

ll Knapsack(int N, int W){
    int S_V = 0;
    for(int i = 0; i < N; i++){
        S_V += v[i];
    }
    for(int i = 0; i <= S_V; i++){
        dp[0][i] = INF;
    }
    for(int i = 0; i <= N; i++){
        dp[i][0] = 0;
    }
    
    
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= S_V; j++){
            dp[i][j] = dp[i-1][j];
            if(j-v[i-1] >= 0){
                dp[i][j] = min(dp[i][j], dp[i-1][j-v[i-1]] + w[i-1]);
            }
            
            
        }
    }
    
    int ans = 0;
    for(int i = 0; i <= S_V; i++){
        if(dp[N][i] <= W){
            ans = i;
        }
    }
    return ans;
}



int main(void){
    cin >> N >> W;
    for(int i = 0; i < N; i++){
        cin >> w[i] >> v[i];
    }
    cout << Knapsack(N, W) << endl;
}



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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;
const ll MOD = 1e9 + 7;


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

    int cnt = 0, x = 0, y = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == '(') cnt++;
        else{
            if(cnt == 0) x++;
            else cnt--;
        }
    }
    cnt = 0;
    for(int i = n - 1; i >= 0; i--){
        if(s[i] == ')') cnt++;
        else{
            if(cnt == 0) y++;
            else cnt--;
        }
    }

    for(int i = 0; i < x; i++) cout << '(';
    cout << s;
    for(int i = 0; i < y; i++) cout << ')';
    cout << "\n";

}


Measured memory_bytes: 256
use std::io;

fn main() {
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    let n: i32 = n.trim().parse().unwrap();
    let result = if n % 1000 == 0 { 0 } else { 1000 - n % 1000 };
    println!("{}", result);
}


Measured memory_bytes: 2072
class UnionFind:

    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        self.parents[x] = self.find(self.parents[x])
        return self.parents[x]

    def union(self, x, y):
        
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
            
        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x    

N, M = map(int, input().split())
uf = UnionFind(N)

for i in range(M):
    a,b = map(int, input().split())
    uf.union(a-1,b-1)

ans = 0
for i in range(N):
    ans = max(ans, -uf.parents[i])
print(ans)    

Measured memory_bytes: 76256
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		int count=0;
		for(int i=0;i<3;i++) {
			if(s.substring(i,i+1).equals("o")) {
				count++;
			}
		}
		System.out.println(count*100+700);
	}
}

Measured memory_bytes: 21588
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;

namespace ABC175
{
    class Program
    {
        static void Main(string[] args)
        {
            var XKD = Console.ReadLine().Split().Select(BigInteger.Parse).ToArray();
            BigInteger X = XKD[0]; BigInteger K = XKD[1]; BigInteger D = XKD[2];
            // var A = Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();
            // var CA = Enumerable.Repeat(0, (int)N).Select(_ => Console.ReadLine().Split().Select(long.Parse).ToArray()).ToArray();
            //var N = long.Parse(Console.ReadLine());
            //var L = Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();

            BigInteger count = X / D; // 移動回数
            if (count < 0) { count = -count; }
            BigInteger dist = X % D; // 0までの距離
            BigInteger rest = K - count; // 残りの試行回数
            //Console.WriteLine(rest);

            if (X == 0)
            {
                if (K % 2 == 0) Console.WriteLine(0);
                else Console.WriteLine(D);
                return;
            }



            if (rest <= 0 && 0 < X) { Console.WriteLine(X - (K * D)); return; }
            if (rest <= 0 && X < 0) { Console.WriteLine(-(X + (K * D))); return; }

            if (rest % 2 == 0) { Console.WriteLine(Math.Abs((long)dist)); return; }

            if (dist <= 0)
            {
                Console.WriteLine(Math.Abs((long)(dist + D)));
            }
            else
            {
                Console.WriteLine(Math.Abs((long)(dist - D)));
            }
        }
    }
}


Measured memory_bytes: 28720
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}


int main()
{
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    vector<double> ok(n+1);
    ok[0]=0;
    REP(i,n){
        cin >> p[i];
        ok[i + 1] = ok[i]+double(p[i] + 1) / 2;
    }
    double ans=0;
    REP(i,n-k+1){
        double now=ok[i+k]-ok[i];
        if(now>ans){
            ans=now;
        }
    }
    cout << fixed << setprecision(10);
    cout << ans << endl;
}

Measured memory_bytes: 2560