akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
      int x;
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int i=1;
      do{
           x = i;
          if(x%3==0){
System.out.print(" "+i);
          }else while(true){
            if(x%10==3){
                System.out.print(" "+i);
                break;
            }
            x/=10;
            if(x!=0)continue;
            else break;
        }
      } while (++i<=n);
      System.out.println();
  }
}


Measured memory_bytes: 28892
A, B, M = map(int, input().split())

P = list(map(int, input().split()))
Q = list(map(int, input().split()))

res = min(P) + min(Q)

for _ in range(M):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1

    res = min(res, P[x] + Q[y] - c)

print(res)

Measured memory_bytes: 18612
/*
Sharif Hasan - CSE, PUST
Apr 24, 2020 02: 14 PM
*/
#include<bits/stdc++.h>
#include "string.h"
#define br cout<<"\n"
#define what(x) cout<<"in here var= "<<x<<"\n";

/*STL definations*/
#define pb push_back

#define FOR(i,n) for(int i=0;i<n;i++)
#define FROM(a,i,n) for(int i=a;i<n;i++)
using namespace std;
double clockAngle(double a,double b){
    double f=fabs(b*6-(a*30+b/2));
    if(f>180) f=360-f;
    return  f*acos(-1)/180.0;
}
int main(){
    int a,b;
    cin>>a>>b;
    map <int,bool> mk;
    FOR(i,b){
        int k;cin>>k;mk[k]=1;
    }
    int p=a;
    while (mk[p]==1){
        ++p;
    }
    int np=a;
    while (mk[np]==1){
        --np;
    }
    if(abs(a-p)>abs(a-np)){
        cout<<np<<endl;
    }else if(abs(a-np)>abs(a-p)){
        cout<<p<<endl;
    }else{
        cout<<min(np,p)<<endl;
    }
    return 0;
}

Measured memory_bytes: 3588
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
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; }
typedef pair <ll,ll> P;

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> a(M);
    rep(i, M) cin >> a[i];
    vector<bool> ok(N+1, true);
    rep(i, M) {
        ok[a[i]] = false;
    }
    rep(i, M-1) {
        if (a[i] + 1 == a[i+1]) {
            print(0);
            return 0;
        }
    }
    ll ans = 1;
    vector<ll> dp(N+1, 0);
    dp[0] = 1;
    ll start = 0;
    if (ok[1]) {
        dp[1] = 1;
        start = 2;
    } else {
        dp[2] = 1;
        start = 3;
    }
    for(ll i = start; i <= N; i++) {
        if (!ok[i]) continue;
        if (i-1>=0) dp[i] += dp[i-1];
        if (i-2>=0) dp[i] += dp[i-2];
        dp[i] %= MOD;
    }
    print(dp[N]);
    return 0;
}

Measured memory_bytes: 1408
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static final Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	long N,A,B;
	String S;

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		N = nextLong();
		A = nextLong();
		B = nextLong();

		long abs = B-A;
		long res;
		if(abs % 2 == 0) {
			res = abs/2;
		}else {
			long ans1 = A + (B-A)/2;

			long ans2 = (N-B) + ((N-A)-(N-B))/2+1;
			res = Math.min(ans1,ans2);
		}
		out.println(res);

	}


	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

	long gcd(long m,long n) {
		if (m<n) return gcd(n,m);
		if (n==0)return m;
		return gcd(n,m%n);
	}

	long lcm(long m, long n) {
	        return m * n / gcd(m, n);
	}
}

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

using namespace std;
using ll = long long int;
#define pii pair <  ll , ll >
#define ff first
#define ss second

pii ara[100005];

ll n,m;
priority_queue < ll > pq;

int main()
{
    ll i,j,sum=0;
    scanf("%lld %lld",&n,&m);
    for(i=1; i<=n; i++)
    {
        scanf("%lld",&j);
        pq.push(-j);
        sum+=j;
    }
    for(i=1; i<=m; i++)
    {
        scanf("%lld %lld",&ara[i].ss,&ara[i].ff);
    }
    sort(ara+1,ara+m+1);
    reverse(ara+1,ara+m+1);
    for(i=1; i<=m; i++)
    {
        //cout<<ara[i].ff<<' '<<ara[i].ss<<endl;
        ll cnt=0;
        while(1)
        {
            if(cnt==ara[i].ss) break;
            if(-pq.top()>=ara[i].ff) break;
            ll u=-pq.top();
            pq.pop();
            sum-=u;
            pq.push(-ara[i].ff);
            sum+=ara[i].ff;
            cnt++;

        }

    }
    /*while(!pq.empty())
    {
        cout<<pq.top()<<endl;
        pq.pop();
    }*/
    printf("%lld\n",sum);
    return 0;



}


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

int main() {
  string s;cin>>s;
  if(s.substr(0,4)=="YAKI")cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3576
// IOI 2021
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
 
////////////////////////////////////////////////////////////////////
 
const int N = 2e3 + 5;

int H[N];
vector<int> G[N];

void DFS(int v, int p = 0) { for (int u : G[v]) if (u != p) H[u] = H[v] + 1, DFS(u, v); }

int main() {
 
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));
	
	int n, k; cin >> n >> k;
	for (int i = 1; i < n; i++) {
		int v, u; cin >> v >> u;
		G[v].push_back(u), G[u].push_back(v);
	}
	int ans = n;
	if (k & 1) {
		for (int v = 1; v <= n; v++) for (int u : G[v]) {
			H[v] = H[u] = 0;
			DFS(v, u), DFS(u, v);
			int res = 0;
			for (int i = 1; i <= n; i++) res += H[i] > k / 2;
			ans = min(ans, res);
		}
	} else {
		for (int v = 1; v <= n; v++) {
			H[v] = 0;
			DFS(v);
			int res = 0;
			for (int i = 1; i <= n; i++) res += H[i] > k / 2;
			ans = min(ans, res);
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3876
#include <stdio.h>
int main(){
  int n,i,k,q,c = 0,score[200][3],sum[200] = {0};
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    for(k = 0;k < 3;k++){
      scanf("%d",&score[i][k]);
    }
  }
  for(q = 0;q < 3;q++){
    for(i = 0;i < n;i++){
      for(k = 0;k < n;k++){
        if(i != k && score[i][q] == score[k][q]){
          c = 1;
          break;
        }
      }
      if(c == 0)
        sum[i] += score[i][q];
        c = 0;
    }
  }
   for(i = 0;i < n;i++){
     printf("%d\n",sum[i]); 
   }
   return 0;
}

Measured memory_bytes: 1028
#include <stdio.h>

int main(void) {
	float mountain[100];
	float num, max, min, dif;
	int N = 0, i;
	
	while(scanf("%f", &num) != EOF){
		mountain[N] = num;
		N++;
	}
	
	max = mountain[0]; min = mountain[0];
	for(i = 1; i < N; i++){
		if(max < mountain[i]) max = mountain[i];
		if(min > mountain[i]) min = mountain[i];
	}
	
	dif = max - min;
	printf("%f\n", dif);
	
	return 0;
}

Measured memory_bytes: 644
def Ics(x, y):
    a = len(x)
    b = len(y)
    c1 = [0] * (b + 1)

    for i in range(a):
        d = x[i]
        c2 = c1[:]
        for j in range(b):
            if d == y[j]:
                c1[j + 1] = c2[j] + 1
            elif c1[j + 1] < c1[j]:
                c1[j + 1] = c1[j]
    return (c1[-1])

q = int(input().rstrip())
r = []
for k in range(q):
    s1 = input().rstrip()
    s2 = input().rstrip()
    r.append(Ics(s1, s2))

print(*r, sep = "\n")

Measured memory_bytes: 7724
/* C - One Quadrillion and One Dalmatians */

#include <stdio.h>
#define ALPH 26

/*
long long ExAlph(int n){
  if(n == 0) return 1;
  else return ALPH * ExAlph(n - 1);
}
*/

int main(void){
  long long N, n;
  long long exAlph[12];
  scanf("%lld", &N);
  for(int i = 0; i < 12; i++){
    if(i == 0){
      exAlph[i] = 1;
    }else{
      exAlph[i] = exAlph[i - 1] * ALPH;
    }
    // printf("%lld\n", exAlph[i]);
  }
  n = N;
  for(int i = 1; ; i++){
    if(n <= exAlph[i]){ // 出力される文字数はiで確定
      n--;
      for(int j = i; j > 0; j--){
        printf("%c", (int) 'a' + n / exAlph[j - 1]);
        n -= n / exAlph[j - 1] * exAlph[j - 1];
      }
      break;
    }else{
      n -= exAlph[i];
    }
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 1736
N = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(N-1):
    for j in range(N-1,i,-1):
        if A[j-1] > A[j]:
            A[j-1], A[j] = A[j], A[j-1]
            count += 1
print(*A); print(count)


Measured memory_bytes: 5608
s = input()
array = []
for i in range(len(s)):
  array.append(s[i])
#print(array)
yes = 1
for i in range(len(array)):
  counter = array.count(array[i])
  if counter % 2 == 1:
    yes = 0
    break

if yes == 1:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class DKi {
public:

    vector<int> tree[200005];
    vector<ll> cnt;
    vector<bool> used;

    void dfs(int p, ll r) {
      used[p] = true;
      for(auto e: tree[p]) {
        if (used[e]) continue;
        cnt[e] += r;
        dfs(e, cnt[e]);
      }
    }

    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n, q; cin >> n >> q;
      cnt.resize(n);
      used.resize(n);
      rep(i, n-1) {
        int a, b; cin >> a >> b;
        a--; b--;
        tree[a].push_back(b);
        tree[b].push_back(a);
      }
      while(q--) {
        int p, x; cin >> p >> x;
        p--;
        cnt[p]+=x;
      }
      dfs(0, cnt[0]);
      for(auto e: cnt) {
        cout << e << ' ';
      }
      cout << endl;
    }
};

signed main() {
  DKi solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 20480
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
  if(b>a){
    int t=a;
    a=b;
    b=t;
  }
  if (b==0) return a;
  return gcd(b,a%b);
}

int main(){
  long long int A,B;
  cin >> A >> B;
  cout << A*B/gcd(A,B);
}


Measured memory_bytes: 256
def main():
    N = int(input())
    c = input()

    r_count = 0
    w_count = 0

    for cc in c:
        if cc == 'R':
            r_count += 1
        else:
            w_count += 1

    ans = 0
    for cc in c[:r_count]:
        if cc == 'W':
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9344
n, d = gets.chomp.split(' ').map(&:to_i)
ans = 0
# while n > 0
#   x , y = gets.chomp.split(' ').map(&:to_i)
#   if x**2 + x**2 <= d**2
#     ans += 1
#   end
#   n -= 1
# end
points = []
while n > 0
  points.push(gets.chomp.split(' ').map(&:to_i))
  n -= 1
end
points.each do |point|
  if point[0]**2 + point[1]**2 <= d**2
    ans += 1
  end
end
print ans

Measured memory_bytes: 28704
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

// vector<vector<int>> data(3, vector<int>(4));

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

  string str;

  cin >> str;

  long sum = 0;

  rep(i, str.size()) { sum += stoi(str.substr(i, 1)); }

  if (sum % 9 == 0) {
    cout << "Yes";
  } else {
    cout << "No";
  }

  return 0;
}

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

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

int main(){

    int n;
    cin>>n;

    ll ans=1;
    int count[n+1]={};
    int k=0;
    for(int i=2;i<=n;i++){
        k=i;
        for(int j=2;j<=i;j++){
            while(k%j==0){
                k/=j;
                count[j]++;
            }
        }
        count[k]++;
    }
    
    for(int i=2;i<=n;i++)ans=(ans*(count[i]+1))%mod;
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
chk = 0
S=gets()
a=[]
a[0] = S.slice(0)
a[1] = S.slice(1)
a[2] = S.slice(2)
for i in 0..2
if a[i]=='a' then
chk += 1
elsif a[i] == 'b' then
chk += 10
elsif a[i] == 'c' then
chk += 100
end
#puts chk
end
if chk == 111 then
  print 'Yes'
else
  print 'No'
end



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

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

using namespace std;

int main(void) {
	int nball, mp;
	cin >> nball >> mp;
	if (mp == 1) {
		cout << 0 << endl;
	} else {
		int remain = nball - mp;
		cout << remain << endl; 
	}
	return 0;
}


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

void Koch(vector<Pos>& v) {
	vector<Pos> res;
	Pos s(1.0 / 3, 0), u(0.5, sqrt(3.0) / 6), t(2.0 / 3, 0);

	res.push_back(v[0]);
	for (size_t i = 1; i < v.size(); i++) {
		Pos sta = v[i - 1], vec = v[i] - v[i - 1];
		res.push_back(sta + vec * s);
		res.push_back(sta + vec * u);
		res.push_back(sta + vec * t);
		res.push_back(sta + vec);
	}
	v = res;
}

int main()
{
	int n;
	vector<Pos> v;
	v.push_back(Pos(0, 0));
	v.push_back(Pos(100, 0));
	cin >> n;
	while (n--) {
		Koch(v);
	}
	for_each(v.begin(), v.end(), [](const Pos& p) {
		cout << fixed << setprecision(5) << p.real() << ' ' << p.imag() << endl;
	});
	return 0;
}

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

/* snippet: useful macros and functions */
#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<class T> T rng(const T &a, const T &b){ return a < b ? b - a : a - b; }
template<class T> void th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

/* snippet: modint library */
template<class T, int MOD>
class Modint{
	T val;
public:
	Modint(T val = 0) : val(val % MOD + (val > 0 ? 0 : MOD)) {}
	operator T(){ return val; }
	Modint &operator+=(const Modint &a){ val += a.val; if(val >= MOD) val -= MOD; return *this; }
	Modint &operator-=(const Modint &a){ val -= a.val; if(val < 0) val += MOD; return *this; }
	Modint &operator*=(const Modint &a){ val = val * a.val % MOD; return *this; }
	void inverse(){T x[2]={MOD,val},a[2]={0,1};int i;for(i=0;x[!i];i^=1){a[i]-=x[i]/x[!i]*a[!i];x[i]=x[i]%x[!i];}if(!i)a[i]+= MOD;val=a[i];}
	Modint &operator/=(Modint a){ a.inverse(); return *this *= a; }
	friend Modint modpow(Modint a, int n){ Modint ret(1); while(n){ if(n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
	friend Modint operator+(Modint a, const Modint &b){ return a += b; }
	friend Modint operator-(Modint a, const Modint &b){ return a -= b; }
	friend Modint operator*(Modint a, const Modint &b){ return a *= b; }
	friend Modint operator/(Modint a, const Modint &b){ return a /= b; }
	friend std::ostream &operator<<(std::ostream &os, const Modint &a){ return os << a.val; }
};

/* snippet: using declarations */
using Int = long long;
using std::cout;
using std::cin;
using std::endl;
using Mint = Modint<long long, 1000000007>;

int main(){
	Int n;
	cin >> n;
	std::map<Int, Int> map;
	Int count = 0;
	RC(i, n){
		Int a;
		cin >> a;

		auto it = map.find(i - a);
		if(it != map.end()){
			count += it->second;
		}

		a += i;
		it = map.find(a);
		if(it == map.end()){
			map.insert(std::make_pair(a, 1));
		}else{
			++it->second;
		}

		/*
		for(auto &j : map){
			cout << j.first << ":" << j.second << endl;
		}
		cout << endl;
		*/
	}
	cout << count << endl;
}


Measured memory_bytes: 15928
#include <iostream>
using namespace std;
int main(){
  int n;
  int c[] = {500,100,50,10,5,1};

  while( cin >> n ,n ){
    n = 1000-n;
    int ans = 0;
    for( int i=0;i<6;i++ ){
      if( n >= c[i] ){
	ans += n / c[i];
	n = n% c[i];
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1160
#include<iostream>
#include<math.h>
#include <algorithm>
#include<float.h>
#include <limits>
#include <vector> 
#include <numeric>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long

using namespace::std;

int jo(ll int jxo, ll int jyo){
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){
  return (toxbig-0x20);
}
char tolow(char toxlow){
  return (toxlow+0x20);
}
  


int main(){
  int A;
  cin>>A;
  cout<<"ABC"<<A;
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	// byte(stringでのruneと同じ)でsliceで取る
	// sortするために要素をstringに直す
	// sort(昇順)
	// compareのために全体を一つのstringに直す
	// compare
	// (わりと長くてめんどい)
	var a, b []byte
	fmt.Scan(&a, &b)
	// fmt.Println(a, b)
	// for a
	aslice := make([]string, len(a))
	for i := 0; i < len(a); i++ {
		as := string(a[i])
		aslice[i] = as
	}
	sort.Strings(aslice)
	atext := strings.Join(aslice, "")
	// for b
	bslice := make([]string, len(b))
	for i := 0; i < len(b); i++ {
		bs := string(b[i])
		bslice[i] = bs
	}
	sort.Sort(sort.Reverse(sort.StringSlice(bslice)))
	btext := strings.Join(bslice, "")
	// fmt.Printf("a=%s, b=%s\n", atext, btext)
	if atext < btext {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
def f(x,y): return x-y
def g(x,y): return x+y

N = int(input())
P, Q = [], []
for _ in range(N):
    x, y = map(int, input().split())
    P.append(f(x,y))
    Q.append(g(x,y))
print(max(max(P)-min(P), max(Q)-min(Q)))


Measured memory_bytes: 99884
#include<bits/stdc++.h>
#define mx 100005
using namespace std;

int main(){
	int d, g, p[12], c[12], fans = 1005;
	scanf("%d%d", &d, &g);
	g /= 100;
	for(int i = 0; i < d; i++){
		scanf("%d%d", &p[i], &c[i]);
		c[i] /= 100;
	}
	for(int i = 0; i < (1<<d); i++){
		int point = 0, ans = 0;
		for(int j = 0; j < d; j++){
			if((i>>j)&1){
				point += p[j]*(j+1) + c[j];
				ans += p[j];
			}
		}
		if(point < g){
			int j = d-1;
			for(; (i>>j)&1 && j >= 0; j--);
			if(j < 0) continue;
			int k = min(p[j], (g - point - 1)/(j+1)+1);
			point += k*(j+1);
			ans += k;
		}
		if(point >= g && ans < fans) fans = ans;
	}
	printf("%d\n", fans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

void printMatrix (const vector < vector < int > > & mat) {
	for (const vector < int > vec : mat) {
		for (const int x : vec) {
			cout << x << " ";
		}
		cout << endl;
	}
}

void add_self (int & a, int b) {
	a += b;
	if (a >= MOD) {
		a -= MOD;
	}
}

void sub_self (int & a, int b) {
	a -= b;
	if (a < 0) {
		a += MOD;
	}
}


int main() {
	int D; char K[10005];
	scanf ("%s %d", K, &D);
	vector < vector < int > > dp (D, vector < int > (2));
	// dp[i][j] := answer for i=sum%D till now [ j = 1 => 
	// current number is already smaller than actual number]
	dp[0][0] = 1;
	// printMatrix (dp);
	int len = strlen (K);
	for (int i = 0; i < len; i++) {
		int digit = K[i] - '0';
		vector < vector < int > > new_dp (D, vector < int > (2));
		for (int sum = 0; sum < D; sum++) {
			for (bool already_smaller : {false, true}) {
				int end = digit;
				if (already_smaller) end = 9;
				for (int d = 0; d <= end; d++) {
					int smaller = already_smaller || d < digit;
					add_self (new_dp[(sum + d) % D][smaller], dp[sum][already_smaller]);
				}
			}
		}
		dp = new_dp;
	}
	// printMatrix (dp);
	int answer = dp[0][0];
	add_self (answer, dp[0][1]);
	sub_self (answer, 1);
	printf ("%d\n", answer);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
typedef long long LL;
typedef long double DL;
const LL maxn=1e6+9;
//const DL mod=998244353;
LL Read(){
	LL x(0),f(1); char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-') f=-1; c=getchar();
	}
	while(c>='0' && c<='9'){
		x=(x<<3)+(x<<1)+c-'0'; c=getchar();
	}return x*f;
}
LL n,K;
LL a[maxn],b[maxn],c[maxn];
LL tot;
std::multiset<LL> Set;
std::multiset<LL>::iterator it1,it2;
bool Check(LL mid){
	for(int i=1;i<=tot;++i) Set.insert(c[i]);//,printf("%lld ",c[i]);puts("");
//	printf("%lld,%d:\n",tot,Set.size());
	tot=0;
	LL ret(0);
	for(int i=1;i<=n;++i){
		LL nw(mid/b[i]); 
		it1=Set.lower_bound(nw);
//		c[++tot]=*it1; printf("%lld ",*it1);
		if(it1==Set.end()){
			--it1; Set.erase(it1); c[++tot]=*it1;
		}else{
			ret+=(*it1-nw); c[++tot]=*it1;
			Set.erase(it1);
		}
		if(ret>K) return false;
	}
	return true;
}
int main() {
	n=Read(); K=Read();
	for(int i=1;i<=n;++i) a[i]=Read(),Set.insert(a[i]);
	for(int i=1;i<=n;++i) b[i]=Read();
	std::sort(b+1,b+1+n);
	LL l(0),r(1e12),ans(0);
//	printf("%d",Check(0));
//	return 0;
	while(l<=r){
		LL mid(l+r>>1);
//		printf("(%lld,%lld)%lld %d\n",l,r,mid,Check(mid));
//        printf("%lld %d %d\n",mid,Check(mid),Check(mid));
		if(Check(mid)) r=mid-1,ans=mid;
		else l=mid+1;
	}
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;

#define io freopen("test.txt", "r", stdin);
#define fast ios_base::sync_with_stdio(0);cin.tie(0);


#define ull unsigned long long int
#define lli long long int
#define li long int
#define ld long double

#define cout(x) cout<<x<<" "
#define coutn(x) cout<<x<<endl
#define newline cout<<endl

#define sz(x) (int)x.size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define ar array

#define pii pair<int,int>
#define pll pair<lli,lli>
#define pps pair<pair<int,int>, string>

const int MOD=1000000007;
const lli INF=1e18;
const int MX=100001;
const int N=1000000;


void solve(){

    int n;
    cin>>n;

    string s="ACL";

    for(int i=1;i<n;i++){
        s+="ACL";
    }
    cout<<s<<"\n";

}


int main(){
    fast
    // #ifndef godzqa
    //     io
    // #endif

    lli t=1;
    // cin>>t;

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

Measured memory_bytes: 3644
program example
	implicit none
    
    integer :: N,K,kurai=0
    
    read(*,*) N,K
    
    do
    	if(N/K>0) then
        	kurai=kurai+1            
            N=N/K

        else
        	exit
        end if
    end do
    
    write(*,*) kurai+1

end program

Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));

 
int main() {
	string S;
	cin>>S;
	fx(S.size()){
		if(S.at(x)=='1'){
			S.at(x)='9';
		}else{
			S.at(x)='1';
		}
	}
	
	ce(S)
	
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <stack>
#include <queue>
#include <list>
using namespace std;

#define is_uruu leapyear
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(a);i>(b);--i)
#define REP(i,a) for(int i=0;i<(a);++i)
    

int main() {
	stack<int> S;
	int H, W, N, a[10000];
	cin >> H >> W >> N;
	FOR(i, 1, N+1) cin >> a[i];
	
	FOR(i, 1, N+1){
		FOR(j, 0, a[i]) S.push(i);
	}
	
	int HW[100][100];
	FOR(i, 0, H){
		if(i%2 == 0){
			FOR(j, 0, W) {
				HW[i][j] = S.top(); 
				S.pop();
			}
		} else {
			ROF(j, W-1, -1) {
				HW[i][j] = S.top(); 
				S.pop();
			}
		}
	}
	
	FOR(i, 0, H){
		FOR(j, 0, W-1) cout << HW[i][j]  << " " ;
		cout << HW[i][W-1] << endl;
	}
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(),v.rend())
#define mkp(a,b) make_pair(a,b)
#define scf2(a,b) scanf("%lld%lld",&a,&b)
#define scf(a) scanf("%lld",&a)
#define pf(a) printf("%lld\n",a)
#define mx 100005
using namespace std;

ll a[mx];
ll b[mx];
ll c[mx],sum=0,ans=0,n;
ll ans1[mx];
ll ans2[mx];
ll ans3[mx];

ll rec(ll i , ll bol)
{
    if(i>=n)return 0;
    //cout << a[i]  << endl;


    if(bol==1){
            if(ans1[i]!=-1)return ans1[i];
            return ans1[i]=max(rec(i+1,2),rec(i+1,3)) + a[i];
    }
    else if(bol==2){
            if(ans2[i]!=-1)return ans2[i];
            return ans2[i]=max(rec(i+1,1) , rec(i+1,3)) + b[i];
    }
    else if(bol==3){
            if(ans3[i]!=-1)return ans3[i];
            return ans3[i]=max(rec(i+1,1),rec(i+1,2)) + c[i];
    }

}

int main()
{
    cin >> n;
    for(ll i=0;i<n;i++)
    {
        cin >> a[i] >> b[i] >> c[i];
    }
    for(ll i=0;i<n;i++)ans1[i]=-1,ans2[i]=-1,ans3[i]=-1;
    rec(0,1);
    rec(0,2);
    rec(0,3);
    //cout << ans1[0] << " " << ans2[0] << " " << ans3[0] << endl;
    cout << max(ans1[0],max(ans2[0],ans3[0])) << endl;
}









Measured memory_bytes: 8064
# def makelist(n, m):
# 	return [[0 for i in range(m)] for j in range(n)]

# a = int(input())
# b, c = map(int, input().split())
# s = input()


b, c = map(int, input().split())
ans = 1

if b == 0 or c == 0 or (b < 0 and c > 0):
	ans = 0
elif b > 0 and c > 0:
	ans = 1
else:
	tmp = abs(b) - abs(c)
	if tmp % 2 == 0:
		ans = -1
	else:
		ans = 1

if ans > 0:
	print("Positive")
elif ans < 0:
	print("Negative")
else:
	print("Zero")


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

int main() {
  string s;
  int x;

  cin >> s;

  if (s[0]=='1') {
    x++;
  }
  if (s[1]=='1') {
    x++;
  }
  if (s[2]=='1') {
    x++;
  }
  cout << x << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=a; i<=b; i++)
#define per(i,a,b) for (register int i=a; i>=b; i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 333333;
int n,a[N],b[N],v[N];
void add(int p){while(p<=n+n+1)v[p]++,p+=p&-p;}
int query(int p){int res=0;while(p){res+=v[p];p-=p&-p;}return res;}
int main() {
	read(n);rep(i,1,n)read(a[i]);
	int l=1,r=1e9;
	while(l<r){
		int mid=(l+r+1)>>1;
		rep(i,1,n)b[i]=b[i-1]+(a[i]>=mid?1:-1);
		memset(v,0,sizeof(v));ll tot=0;
		rep(i,1,n){
			add(b[i-1]+n+1);tot+=query(b[i]+n+1);
		}
		if(4LL*tot>=1LL*n*(n+1))l=mid;else r=mid-1;
	}
	cout<<l;
	return 0;
}

Measured memory_bytes: 2304
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>

const double EPS = 1e-10;

double add( double x, double y )
{
	if( abs( x + y ) < EPS * ( abs( x ) + abs( y ) ) )
		return 0;

	return x + y;
}

struct P
{
	double x, y;

	P()
	:	x( 0 ), y( 0 )
	{}

	P( double x, double y )
	:	x( x ), y( y )
	{}

	P operator+ ( const P& p ) const
	{
		return P( add( x, p.x ), add( y, p.y ) );
	}

	P operator- ( const P& p ) const
	{
		return P( add( x, -p.x ), add( y, -p.y ) );
	}

	P operator* ( double d ) const
	{
		return P( x * d, y * d );
	}

	double dot( const P& p ) const
	{
		return x * p.x + y * p.y;
	}

	double cross( const P& p ) const
	{
		return x * p.y - y * p.x;
	}

	double norm() const
	{
		return x * x + y * y;
	}
};

int ccw( P& a, P& b, P& c )
{
	b = b - a; c = c - a;

	if( b.cross( c ) > 0 )
		return 1;	// counter clockwise
	else if( b.cross( c ) < 0 )
		return -1;	// clockwise
	else if( b.dot( c ) < 0 )
		return 2;	// c-a-b
	else if( b.norm() < c.norm() )
		return -2;	// a-b-c
}

int main()
{
	double x[4], y[4];
	while( scanf( "%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3] ) != EOF )
	{
		int cw;
		bool f = true;

		for( int i = 0; i != 4; ++i )
		{
			P p( x[i], y[i] ), q( x[( i + 1 ) % 4], y[( i + 1 ) % 4] ), r( x[( i + 2 ) % 4], y[( i + 2 ) % 4] );
			
			int t = ccw( p, q, r );

			if( !i )
				cw = t;

			if( t != cw )
			{
				f = false;
				break;
			}
		}

		if( f )
			std::cout << "YES" << std::endl;
		else
			std::cout << "NO" << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1224
# coding: utf-8

class Stack(object):
	maxnum = 100
	array = []
	for i in range(100):
		array.append(0)
	index = 0
	def push(self, data):
		self.array[self.index] = data
		self.index += 1
	def pop(self):
		print(self.array[self.index-1])
		self.index -= 1

road = Stack()
while True:
	try:
		num = int(raw_input())
		if num != 0:
			road.push(num)
		else:
			road.pop()
	except EOFError:
		break


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

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

    long long cnt = 0;
    bool f = false;
    for(int i = 0; i < n; i++){
        int tmp = A[i];
        if(f) tmp += 1;
        f = false;
        cnt += tmp / 2;
        tmp %= 2;
        if(A[i] != 0 and tmp) f = true;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(){
	int n,flag=0,a[10];
	while(scanf("%d",&n)!=EOF){
		if(n!=0){
			a[flag]=n;
			flag++;
		}else{
			printf("%d\n",a[flag-1]);
			flag--;
		}
	}	
	return 0;
}

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

int main() {
	// your code goes here
	int n,i,k;
	cin>>n>>k;
	int A[n];
	for(i=0;i<n;i++)
		cin>>A[i];
	int dp[n];
	for(i=0;i<n;i++)
		dp[i]=0;
	dp[0]=0;
	for(i=1;i<n;i++)
	{
		int j=i-1;
		int minCost=INT_MAX;
		while(j>=0 && i-j<=k)
		{
			minCost=min(minCost,dp[j]+abs(A[i]-A[j]));
			j--;
		}
		dp[i]=minCost;
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>
#include<numeric>

using namespace std;
typedef long long ll;
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;}
const ll INF = 1e18+1;



int main() {
    ll N, H; cin >> N >> H;
    vector<ll> a(N), b(N);
    for (int i = 0; i < N; i++) cin >> a[i] >> b[i];
    
    priority_queue<pair<ll,ll> > que;
    for (int i = 0; i < N; i++) {
        que.push(make_pair(a[i],1e9+1));
        que.push(make_pair(b[i],1));
    }
    ll tmp = 0;
    ll res = 0;
    while (!que.empty()) {
        pair<ll, ll> p = que.top();
        if (p.second == 1) {
            que.pop();
            tmp += p.first;
            res++;
            if (tmp >= H) break;
        } else {
            res += (H - tmp + p.first - 1)/p.first; 
            break;
        }
    }
    cout << res << endl;

}



Measured memory_bytes: 7920
#include<iostream>

int main() {
    char a;
    std::cin >> a;
    if(a == 'a' || a ==  'e' || a == 'i' || a == 'o' || a == 'u')
        std::cout << "vowel" << std::endl;
    else
        std::cout << "consonant" << std::endl;
}

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

int main(){
	string s;
	cin >> s;
	
	if(s[5]=='1'  || s[6]>'4'){
		cout << "TBD" << endl;
	} else {
		cout << "Heisei" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
def main():
    N,M,Q=map(int,input().split())
    p=[[0 for i in range(509)] for j in range(509)]

    for i in range(1,M+1):
        L,R=map(int,input().split())
        p[L][R]+=1
    for i in range(1,N+1):
        for j in range(1,N+1):
            p[i][j]+=p[i][j-1]
    for i in range(1,N+1):
        for j in range(1,N+1):
            p[i][j]+=p[i-1][j]
    for i in range(1,Q+1):
        L,R=map(int,input().split())
        print(p[R][R]+p[L-1][L-1]-p[L-1][R]-p[R][L-1])

main()


Measured memory_bytes: 13400
from collections import deque
h, w = map(int, input().split())
grid = []
for i in range(h):
    grid.append(list(input()))
def check(s,t):
    if (0 <= s <= w - 1) and (0 <= t <= h - 1):
        return True
    else:
        return False
def bfs(que):
    finished = set()
    while que:
        x , y, cost = que.popleft()
        if (not check(x,y) ) or grid[y][x] == '#':
            continue
        if (x,y) not in finished:
            finished.add((x,y))
            graph[y][x] = cost
            que.append([x+1,y,cost+1])
            que.append([x, y+1, cost+1])
            que.append([x-1,y,cost+1])
            que.append([x,y-1,cost+1])
ans = 0
inf = 400

for i in range(h):
    for j in range(w):
        que = deque()
        que.append([j,i,0])
        graph = [[inf for _ in range(w)] for _ in range(h)]
        bfs(que)
        for p in range(h):
            for q in range(w):
                if graph[p][q] < inf:
                    ans = max(ans, graph[p][q])
print(ans)


    



Measured memory_bytes: 47324
/*


               BASIC TEMPLATES


*/
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")

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

//#
//#  #
//#   #
//#    #
//#   # #
//#  #   ###
//#
#define ll long long
#define pb push_back
#define emb emplace_back
#define ff first
#define ss second
#define FAST cin.tie(0); ios_base::sync_with_stdio (false)
#define pii pair<int,int>
#define TEN6 1000000
#define TEN5 100000
#define TEN4 10000
#define TEN9 1000000000
#define ipv pair<ll,vector<ll> >
#define pll pair<ll,ll>
#define CASE(x) "Case "<<x<<": "
#define _endl "\n"


#define for_r(i,st,lim) for(ll i=st-1;i>=lim;i--)
#define fRead(x) freopen(x,"r",stdin)
#define fWrite(x) freopen (x,"w",stdout)
#define all_set(arr,val) memset(arr,val,sizeof(arr))
#define all(x) x.begin(),x.end()
#define for_(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//lower_bound returns an iterator pointing to the first element in the range [first,last) which has a value not less than ‘val’.

//upper_bound returns an iterator pointing to the first element in the range [first,last) which has a value greater than ‘val’.
using namespace __gnu_pbds;
#define ordered_set tree<ll , null_type,less<ll  >, rb_tree_tag,tree_order_statistics_node_update>

#define MOD 998244353 ///////<<<<<<<<<<<<<<<<<<=====MOD value change here!!!!!
#define INF 5e18
#define what_is(x) cerr << #x << " is " << x << endl;

ll BMod(ll B,ll P,ll M)
{
    ll R=1;
    B=B%M;
    while(P)
    {
        if(P&1)
            R=(R*B)%M;
        P >>= 1;
        B=(B*B)%M;
    }
    return R;
}

ll invMOD(ll num,ll M)
{
    return BMod(num,M-2,M);
}


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 my_abs(ll x)
{
    if(x<0)x*=-1;
    return x;
}
ll dp[102][TEN5 +3];
int main()
{
    //
    // FAST;
    ll n,w;
    cin>>n>>w;
    pll arr[n+10];
    for_(i,0,n)
    {
        cin>>arr[i].ff>>arr[i].ss;
    }

    all_set(dp,0);
    for_(pos,n,0)
    {

        for_(wt,0,w+1)
        {
            if(pos==n-1)
            {
                if(wt>=arr[pos].ff)dp[pos][wt]=arr[pos].ss;
                else dp[pos][wt]=0;

            }
            else if(wt==0)dp[pos][wt]=0;
            else if(wt<arr[pos].ff)dp[pos][wt]=dp[pos+1][wt];
            else
            {

                dp[pos][wt]=max(dp[pos+1][wt],arr[pos].ss+dp[pos+1][wt-arr[pos].ff]);
            }

        }

    }
    cout<<dp[0][w];

}

















Measured memory_bytes: 79872
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int64_t a, v, b, w, t; cin >> a >> v >> b >> w >> t;

	if (a == b) {
		cout << "YES" << endl;
		return 0;
	}

	if (v <= w) {
		cout << "NO" << endl;
		return 0;
	}

	int d = abs(a - b);
	if (d <= t * (v - w)) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

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

long long gcd(long long a, long long b){
    return (a % b ? gcd(b, a % b) : b);
}

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

    int n;
    cin >> n;

    long long x;
    REP(i, n){
        long long y;
        cin >> y;
        if(i){
            if(x < y) swap(x, y);
            x = x / gcd(x, y) * y;
        }else{
            x = y;
        }
    }

    cout << x << endl;

    return 0;
}

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


auto solve(long long n, std::vector<long long> a){
    vector<long long > res;

    auto bi0 = rbegin(a);
    auto ei0 = rend(a);
    while(true) {
        res.push_back(*bi0);
        bi0++;
        if(bi0 == ei0){
            break;
        }
        bi0++;
        if(bi0 == ei0){
            break;
        }
    }

    auto bi = begin(a);
    auto ei = end(a);
    if(n % 2 == 1) {
        bi++;
    }
    while(bi != ei) {
        res.push_back(*bi);
        bi++;
        if(bi == ei){
            break;
        }
        bi++;
        if(bi == ei){
            break;
        }
    }

    stringstream ss;
    ss << res[0];
    for(int i = 1; i< res.size(); i++) {
        ss << " " << res[i];
    }
    return ss.str();
}

int main(){
    long long n;
    scanf("%lld",&n);
    std::vector<long long> a(n);
    for(int i = 0 ; i < n ; i++){
        scanf("%lld",&a[i]);
    }
    auto result = solve(n, std::move(a));
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 7412
#include"bits/stdc++.h"
#include<cassert>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const int inf = 1ll << 61;
const double eps = 1e-10;
typedef pair<int, int> P;
typedef pair<int, P>PP;
typedef pair<double, double>DP;
typedef vector<double>vec;
typedef vector<vec>mat;
struct edge {
	int to, cost;
};
double x[55], y[55];
int X[55], Y[55];
double dis(double x1, double y1, double x2, double y2) {
	return sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
}
bool pararell(int i,int j,int k) {
	int d1 = X[j] - X[i], d2 = Y[j] - Y[i], d3 = X[k] - X[j], d4 = Y[k] - Y[j];
	if (d1*d4 ==d2*d3)return true;
	return false;
}
vec gauss(const mat &A, const vec &b) {
	int n = A.size();
	mat  B(n, vec(n + 1));
	rep(i, n)rep(j, n)B[i][j] = A[i][j];
	rep(i, n)B[i][n] = b[i];

	rep(i, n) {
		int pivot = i;
		for (int j = i; j < n; j++) {
			if (abs(B[j][i]) > abs(B[pivot][i]))pivot = j;
		}
		swap(B[i], B[pivot]);
		if (abs(B[i][i]) < eps)return vec();
		for (int j = i + 1; j <= n; j++)B[i][j] /= B[i][i];
		rep(j, n) {
			if (i != j) {
				for (int k = i + 1; k <= n; k++)B[j][k] -= B[j][i] * B[i][k];
			}
		}
	}
	vec x(n);
	rep(i, n)x[i] = B[i][n];
	return x;
}
signed main() {
	int n; cin >> n;
	rep(i, n) {
		cin >> X[i] >> Y[i];
		x[i] = (double)X[i], y[i] = (double)Y[i];
	}

	double ans=1e5;
	if (n == 2)ans = dis(x[0], y[0], x[1], y[1]) / 2.0;
	else {
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				for (int k = j + 1; k < n; k++) {
					if (pararell(i,j,k)) {
						vector<DP>V;
						V.push_back(DP(x[i], y[i]));
						V.push_back(DP(x[j], y[j]));
						V.push_back(DP(x[k], y[k]));
						sort(V.begin(), V.end());

						double mx = (V[0].first + V[2].first) / 2, my = (V[0].second + V[2].second) / 2;
						double r = dis(mx, my, V[0].first, V[0].second);
						int flg = 0;
						rep(l, n) {
							if (dis(x[l], y[l], mx, my) <=r+eps )flg++;
						}
						if (flg == n) {
							ans = min(ans, r);
						}
					}
					else {
						mat A(3, vec(3));
						vec b(3),c(3);
						A[0][0] = x[i];
						A[0][1] = y[i];
						A[0][2] = 1.0;
						A[1][0] = x[j];
						A[1][1] = y[j];
						A[1][2] = 1.0;
						A[2][0] = x[k];
						A[2][1] = y[k];
						A[2][2] = 1.0;
						b[0] = -x[i] * x[i] - y[i] * y[i];
						b[1] = -x[j] * x[j] - y[j] * y[j];
						b[2] = -x[k] * x[k] - y[k] * y[k];
						c = gauss(A, b);
						int flg = 0;
						rep(l, n) {
						//	double D = x[l] * x[l] + y[l] * y[l] + c[0] * x[l] + c[1] * y[l] + c[2];
							if (x[l]*x[l]+y[l]*y[l] <= -c[2]-c[0]*x[l]-c[1]*y[l]+eps)flg++;
						}
						if (flg == n) {
							double r = c[0] * c[0]/4 + c[1] * c[1]/4 - c[2];
							r = sqrt(r);
							ans = min(ans, r);
						}
					}
				}
			}
		}

		rep(i, n) {
			for (int j = i + 1; j < n; j++) {
				double mx = (x[i] + x[j]) / 2.0, my = (y[i] + y[j]) / 2.0;
				double r = dis(mx, my, x[i], y[i]);
				int flg = 0;
				rep(k, n) {
					if (dis(mx, my,x[k], y[k]) <= r + eps)flg++;
				}
				if (flg == n)ans = min(ans, r);
			}
		}
	}
	printf("%.14Lf\n", ans);
}


Measured memory_bytes: 256
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());


		for(int i = 0; i < n; i++){
			String[] tmpArray = br.readLine().split(" ");

			Point2D[] points = new Point2D[4];

			for(int j = 0; j < 4; j++){
				int x = Integer.parseInt(tmpArray[j*2]);
				int y = Integer.parseInt(tmpArray[j*2 + 1]);

				points[j] = new Point2D.Double(x, y);
			}

			Line2D[] lines = new Line2D[2];
			for(int j = 0; j < 2; j++){
				lines[j] = new Line2D.Double(points[j*2], points[j*2 + 1]);
			}

			Point2D result = crossPoint(lines[0], lines[1]);

			System.out.printf("%.8f %.8f\n", result.getX(), result.getY());
		}
	}

	static Point2D crossPoint(Line2D l1, Line2D l2){
		if(!l1.intersectsLine(l2)){
			return null;
		}

		//l1がx軸に垂直
		if(l1.getX1() == l1.getX2()){
			double a = (l2.getY2() - l2.getY1())/(l2.getX2() - l2.getX1());

			return new Point2D.Double(l1.getX1(), a*(l1.getX1() - l2.getX1()) + l2.getY1());
		}
		//l2がx軸に垂直
		else if(l2.getX1() == l2.getX2()){
			double a = (l1.getY2() - l1.getY1())/(l1.getX2() - l1.getX1());

			return new Point2D.Double(l2.getX1(), a*(l2.getX1() - l1.getX1()) + l1.getY1());
		}
		else {
			double a1 = (l1.getY2() - l1.getY1())/(l1.getX2() - l1.getX1());
			double a2 = (l2.getY2() - l2.getY1())/(l2.getX2() - l2.getX1());
			double b1 = -a1*l1.getX1() + l1.getY1();
			double b2 = -a2*l2.getX1() + l2.getY1();

			double x = (b2 - b1)/(a1 - a2);
			double y = a1*x + b1;

			return new Point2D.Double(x, y);

		}

	}

}



Measured memory_bytes: 34872
n = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
Cs = list(map(int, input().split()))
ans = 0
#満足度の計算からいく[
for i in range(1, n + 1):
    if i == n:
        break
    if As[i-1] + 1 == As[i]:
        ans += Cs[As[i-1] - 1]
ans += sum(Bs)
print(ans)


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

int main(){
  ll N;
  cin >> N;
  vector<ll> L(N);
  for(int i = 0; i < N; ++i){
    cin >> L[i];
  }
  sort(L.begin(), L.end());
  ll a,b,c;
  ll res = 0;
  for(int i = 0; i < N-2; ++i){
    for(int j = i+1; j < N-1; ++j){
      a = L[i];
      b = L[j];
      auto itr2 = lower_bound(L.begin(), L.end(), a + b);
      int right = itr2 - L.begin();
      res += right - j - 1;
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int t[10001];
bool rt(int a)
{
    if(a%3==0||a%5==0)
        return true;
    else
        return false;
}
int main()
{
    int n,b=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>t[i];
        if(t[i]%2==0)
            if(!rt(t[i]))
            {
                b=1;
            }
    }
    if(b==1)
        cout<<"DENIED"<<endl;
    else
        cout<<"APPROVED"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int A,B;
    scanf("%d %d",&A,&B);
    if(A!=3 && B!=3){
        printf("3\n");
    }
    else if(A!=2 && B!=2){
        printf("2\n");
    }
    else if(A!=1 && B!=1){
        printf("1\n");
    }
}


Measured memory_bytes: 128