akhauriyash/Code-Regression huggingface dataset:
x = int(input())
if x < 600:
    print(8)
elif x < 800:
    print(7)
elif x < 1000:
    print(6)
elif x < 1200:
    print(5)
elif x < 1400:
    print(4)
elif x < 1600:
    print(3)
elif x < 1800:
    print(2)
elif x < 2000:
    print(1)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
while(true) {
int N;
cin >> N;
if(N == 0) break;
int ans = 0;
for(int i = 1; i < N; i++) {
int now = 0;
for(int j = i; now < N; j++) {
now += j;
}
if(now == N) ans++;
}
cout << ans << endl;
}
    return 0;
}



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

int main() {
    //using vi = vector<int>;
    
    int r;
    cin >> r;
    cout << 2 * M_PI * r << endl;
}

Measured memory_bytes: 3780
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	string a, b; cin >> a >> b;
	for (int i = 0; i < b.size(); i++){
		cout << a[i] << b[i];
	}
	if (a.size() != b.size())cout << a[a.size() - 1];
	cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int n;
    cin >> n;
    int s[n];
    rep(i,n){
        char c;
        cin >> c;
        if(c == 'E')s[i] = 0;
        else s[i] = 1;
    }
    int ans = 10000000;
    int left = 0,right = 0;
    rep(i,n){
        if(s[i] == 0)right++;
    }

    rep(i,n){
        if(s[i] == 0)right--;
        ans = min(ans,left+right);
        if(s[i] == 1)right++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4784
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,ans=0;cin>>n;
  lvector A(n);rep(i,n) cin>>A[i];
  for(ll a:A) ans+=a-1;
  print(ans);
  return 0;
}

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

namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC093_C();
        }

        static void ABC093_C()
        {
            var ABC = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            for (var x = ABC.Max(); x <= 51; x++)
            {
                var a = (3 * x) - ABC.Sum();
                if (a % 2 == 0)
                {
                    Console.WriteLine(a / 2);
                    return;
                }
            }
        }
    }
}

Measured memory_bytes: 13396
print_values = []
while True:
    input_value = input().split()
    a = int(input_value[0])
    b = int(input_value[1])
    if a == 0 and b == 0:
        break
    elif a > b:
        print_values.append([b, a])
    else:
        print_values.append([a, b])

for values in print_values:
    print("{0} {1}".format(values[0], values[1]))



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

int main() {
	int A[3];
	cin >> A[0] >> A[1] >> A[2];
	sort(A, A+3);
	cout << A[0] + A[1] + 10 * A[2];
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

これ、1個の数を10倍してから全てを足すのと同じです
よってどの数を10倍するかだけ考えれば良く、それは最も大きいものを10倍すべきです

*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);
#if __cplusplus>=201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long N, string S){
  vector<vector<ll>> A(10);
  REP(N){
    A[S[i]-'0'].push_back(i);
  }
  ll ans=0;
  For(i,10){
    if(A[i].empty()){
      continue;
    }
    #define ALL(a) a.begin(),a.end()
    ll ii=A[i][0];
    For(j,10){
      auto jj= upper_bound(ALL(A[j]),ii);
      if(jj==A[j].end()){
        continue;
      }
      For(k,10){
        auto kk= upper_bound(ALL(A[k]),*jj);
        if(kk==A[k].end()){
          continue;
        }
        ++ans;
      }
    }
  }
  cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    string S;
    cin>>S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N;
    string S;
    cin >> N >> S;
    vector<int> cnt(2);
    for (int i = 0; i < N; i++) {
        if (S[i] == '(') cnt[1]++;
        else {
            if (cnt[1] > 0) cnt[1]--;
            else cnt[0]++;
        }
    }
    string ans = string(cnt[0], '(') + S + string(cnt[1], ')');
    cout << ans << '\n';
}


Measured memory_bytes: 256
use v5.18;
use warnings;
sub read_line { chomp(my $str = <STDIN>); $str }
sub splited_read_line { split / /, read_line }
my %counter;
my @chars = split //, read_line;
for my $char (@chars) {
  $counter{$char} = 1;
}
my @include = grep { defined } @counter{qw/ a b c /};
say @include == 3 ? 'Yes' : 'No';


Measured memory_bytes: 640
using System;

namespace _1_1d
{
    class Program
    {
        static void Main(string[] args)
        {
            int S=int.Parse(Console.ReadLine());
            int m = S / 60;
            S -= m*60;
            int h = m / 60;
            m -= h * 60;
            
            Console.WriteLine("{0}:{1}:{2}",h,m,S);
        }
    }
}



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

int main(){
	int n,m;
	cin >> n >> m;
	vector<int> height(n+1);
	vector<int> ma(n+1);

	for(int i = 1; i <= n; i++){
		cin >> height.at(i);
		ma.at(i) = 0;
	}
	for(int i = 0; i < m;i++){
		int a, b;
		cin >> a >> b;
		ma.at(a) = max(ma.at(a), height.at(b));	 
		ma.at(b) = max(ma.at(b), height.at(a));	 
	}

	int ans = 0;
	for(int i = 1; i <= n; i++){
		if(ma.at(i) < height.at(i)){
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4060
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define m_k make_pair
using namespace std;
const int N=1e5+100;
int n,m,h[N];
vector <int> e[N];
signed main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++) scanf("%d",&h[i]);
	for (int i=1;i<=m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		e[u].push_back(v);
		e[v].push_back(u);
	}
	int cnt=0;
	for (int i=1;i<=n;i++)
	{
		bool bl=1;
		for (int j=0;j<(int)e[i].size();j++)
		{
			int u=e[i][j];
			if (h[u]>=h[i])
			{
				bl=0;
				break;
			}
		}
		if (bl) cnt++;
	}
	printf("%d\n",cnt);
}

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

#define REP(i, n) for(int (i) = 0; (i) < (int)(n); (i)++)
#define REPR(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 1e9

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

typedef long long ll;

using namespace std;

int main(int argc, char const *argv[])
{
    int H, W;
    int h, w;

    cin >> H >> W;
    cin >> h >> w;

    cout << (H - h) * (W - w) << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define forn(i, n) for (llong i = 0ll; i < (llong) n; ++i)
#define fornn(i, l, r) for (llong i = (llong) l; i < (llong) r; ++i)
#define size(x) ((int) (x.size()))
 
using namespace std;
 
typedef long long llong;
const llong inf = (llong) 1e+9 + 7ll;
const llong linf = (llong) 1e+18 + 7ll;
const long double eps = (long double) 1e-9;
const long double pi = acosl((long double) -1.0);
const int alph = 26;

mt19937 mrand(random_device{} ()); 

template<typename T, typename U> inline llong umin(const T& a, const U& b) { return a < b ? a : b; }
template<typename T, typename U> inline llong umax(const T& a, const U& b) { return a > b ? a : b; }
 
static char buff[(int) 2e6 + 17]; // reads std::string
const int maxn = (int) 5e6 + 17;

struct pt
{
	int x, y;
	pt() { }
};

static int H[maxn], F[maxn], used[maxn];

struct hash_table
{
	hash_table() { }

	int getpos(int h) const
	{
		int i = h % maxn;
		for (; used[i] && H[i] != h; ++i) if (i == maxn) i = 0;
		return i;
	}

	int& operator[](int h)
	{
		int i = getpos(h);
		H[i] = h;
		used[i] = 1;
		return F[i];
	}
};

struct fenwick
{
	int n;
	hash_table F;

	fenwick() { n = inf; }

	void upd(int i, int x)
	{
		for (; i < n; i |= i + 1)
			F[i] = max(F[i], x);
	}

	int get(int i)
	{
		int res = 0;

		for (; i >= 0; i &= i + 1, --i)
			res = max(res, F[i]);

		return res;
	}
};

int n;
pt s, f;
pt p[maxn];

bool read()
{
	if (scanf("%d %d %d %d %d", &s.x, &s.y, &f.x, &f.y, &n) != 5)
		return false;

	forn (i, n)
		scanf("%d %d", &p[i].x, &p[i].y);

	return true;
}

bool cmp(pt a, pt b) { return make_pair(a.x, a.y) < make_pair(b.x, b.y); }

void solve()
{
	if (s.x > f.x)
		swap(s, f);

	if (s.y > f.y)
	{
		f.y = 2 * s.y - f.y;

		forn (i, n)
			p[i].y = 2 * s.y - p[i].y;
	}

	vector<pt> pp;

	forn (i, n)
		if (s.x <= p[i].x && p[i].x <= f.x && s.y <= p[i].y && p[i].y <= f.y)
			pp.push_back(p[i]);

	sort(pp.begin(), pp.end(), cmp);
	fenwick dp;

	forn (i, size(pp))
		dp.upd(pp[i].y, dp.get(pp[i].y) + 1);

	int lis = dp.get(inf);
	long double ans = 0;

	if (lis != min(f.y - s.y, f.x - s.x) + 1)
		ans = 100.0 * (f.y - s.y + f.x - s.x) - 20.0 * lis + 5 * M_PI * lis;
	else
		ans = 100.0 * (f.y - s.y + f.x - s.x) - 20.0 * lis + 5 * M_PI * (lis - 1) + 10 * M_PI;

	printf("%.15f\n", (double) ans);
}

int main()
{
#if SEREZHKA
	freopen("file.in", "r", stdin);
#endif

	while (read())
		solve();

	return 0;
}


Measured memory_bytes: 62704
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        a:i64,
        b:i64,
    }
    let ans = if a <= b *2 {
        0
    } else {
        a - b*2
    };
    println!("{}",ans);
}


fn is_prime(x:i64) -> bool {
    if x == 2 {return true;}
    if x < 2 || x % 2 == 0 {return false;}
    let mut j = 3;
    while j <= (x as f64).sqrt() as i64 {
        if x % j == 0 {
            return false;
        }
        j += 2;
    }
    true
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
//#define mx 10001
#define ll long long int
int main(){
   ll a,b,m,n,leg,mx,min,x,y;
   cin >> x >> y;
   if(x*2==y || x*4==y)
    cout << "Yes" << endl;
   else
   {
       ll count = 0;
       for(ll i=1;i<x;i++)
       {
           a = i*2;
           b = (x-i)*4;
           m = i*4;
           n = (x-i)*2;
           if(a+b==y || m+n==y){
                count = 1;
           break;
           }
            //cout << "Yes" << endl;
           else
            count = 0;
       }
       if(count==1 )
        cout << "Yes" << endl;
       else if(count ==0)
        cout << "No" << endl;
   }
return 0;
}


Measured memory_bytes: 3576
import java.util.Arrays;

public class Main {


  private static void solve() {
    int n = ni();
    int[] a = na(n);

    dp = new long[n][n];
    for (long[] v : dp) Arrays.fill(v, Long.MIN_VALUE);
    long ret = rec(0, n - 1, a);
    System.out.println(ret);
  }

  static long[][] dp;;
  
  private static long rec(int i, int j, int[] a) {
    if (i > j) {
      return 0;
    }
    
    if (dp[i][j] != Long.MIN_VALUE) {
      return dp[i][j];
    }

    long ret = Long.MIN_VALUE;
    ret = Math.max(ret, -rec(i + 1, j, a) + a[i]);
    ret = Math.max(ret, -rec(i, j - 1, a) + a[j]);
    dp[i][j] = ret;
    return ret;
    
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 130644
n, x = (int(i) for i in input().split())  
t = [int(input()) for i in range(n)] 
t.sort()
count = 0
for i in range(n):
    x = x - t[i]
    count += 1

while(1):
    if x >= t[0]:
        x = x - t[0]
        count += 1
    else:
        break
    
print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
typedef long long ll ;
string s[maxn];
map<string,int>mp;
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
        sort(s[i].begin(),s[i].end());
        mp[s[i]]++;
    }
    ll ans=0;
    for(auto it=mp.begin();it!=mp.end();it++)
    {
        ans+=((ll)it->second*(it->second-1))/2;
    }
     cout<<ans;
    return 0;
}

Measured memory_bytes: 18944
#coding:utf-8

ans = []
for i in xrange(20000):
    a, op, b = raw_input().split()
    if op == "?":
        break
    else:
        if op == "+":
            ans.append(int(a) + int(b))
        elif op == "-":
            ans.append(int(a) - int(b))
        elif op == "*":
            ans.append(int(a) * int(b))
        else:
            ans.append(int(a) / int(b))

for n in xrange(len(ans)):
    print(ans[n])

Measured memory_bytes: 6376
#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define PI acos(-1)
#define endl "\n"
#define fastcin ios_base::sync_with_stdio(false);
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> ii;
typedef complex<double> base;

#define INF 0x3f3f3f3f

const int N = 200005;
int n;
string s;
int dp[N][3];

int solve(int i, int flag){
	if(i == n) return 0;
	if(dp[i][flag] != -1) return dp[i][flag];

	int ret = INF;
	if(s[i] == '#'){
		if(flag == 1)
			ret = solve(i+1, 1);
		else
			ret = min(solve(i+1, 1), solve(i+1, 0) + 1);
	}
	else{ // s[i] == '.'
		if(flag == 1)
			ret = solve(i+1, 1) + 1;
		else{
			ret = min(solve(i+1, 0), solve(i+1, 1) + 1);
		}
	}

	return dp[i][flag] = ret;
}

int main(void){
	fastcin;
	cin >> n;
	cin >> s;

	memset(dp, -1, sizeof dp);
	int ans = solve(0, 0);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 12308
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main(){
    string s;
    cin >> s;
    int n = s.at(6) - '0';
    int m = s.at(5) - '0';
    if(m>0){
        cout << "TBD" << endl;
    }
    else if(n>4){
        cout << "TBD" << endl;
    }
    else
    {
        cout << "Heisei" << endl;
    }
    
}

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

#define ll long long
#define pb push_back
#define f first
#define s second
#define all(s) s.begin(), s.end()
#define sz(a) (int)a.size()

const int mod = 1e9+7;

//ll binpow(ll a, ll n);
//ll modp(ll a, ll b, int m);
//ll binmul(ll a, ll b, ll c);
long long wp[101], v[101];
long long dp[100001][101];
long long rec(int w, int i){
	
	if (w<0) return INT_MIN;
	else if(i < 1) return 0;
	
	else if(dp[w][i]> 0 ) return dp[w][i];
	
	else{
		dp[w][i] =  max(rec(w,i-1), v[i] + rec(w-wp[i], i-1));
		return dp[w][i];
	}
}
void solve(){
	int w, n; cin>>n>>w;
	for(int i = 1 ; i <= n; i++){
		cin>>wp[i]>>v[i];
	}
	for(int i = 0 ; i < w ; i++){
		dp[0][i] = 0;
	}
	for(int i = 1 ; i < 101; i++){
		for(int j = 1; j <= w ; j++){
			dp[j][i] = INT_MIN;
		}
	}
	
	cout<<rec(w,n)<<"\n";
}

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


	solve();
	return 0;
}

//ll binpow (ll a, ll n) {
//	ll res = 1;
//	while (n) {
//		if (n & 1)
//			res *= a;
//		a *= a;
//		n >>= 1;
//	}
//	return res;
//}

//long long modp(long long a, long long b, int m)
//{
//    int result = 1;
//    while (b > 0)
//    {
//        if (b % 2 == 1)
//            result = (result * a) % m;
//        b = b >> 1;
//        a = (a * a) % m;
//    }
//    return result;
//}

//ll binmul(ll a, ll b, ll c) {
//	if(b == 0) return 0;
//	if(b % 2 == 1) {
//		ll x = binmul(a, b-1, c);
//		return (x+a) % c;
//	}
//	ll x = binmul(a, b/2, c);
//	return x * 2 % c;
//}

Measured memory_bytes: 79232
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type node struct {
	key int
	parent *node
	left *node
	right *node
}

type tree struct {
	root *node
}

func (tree *tree) insert(key int) {
	if tree.root == nil {
		tree.root = &node{key: key}
		return
	}

	var currentNode, prevNode *node
	currentNode = tree.root
	for currentNode != nil {
		prevNode = currentNode
		if currentNode.key < key {
			currentNode = currentNode.right
		} else {
			currentNode = currentNode.left
		}
	}

	newNode := &node{key: key}
	newNode.parent = prevNode
	if prevNode.key < key {
		prevNode.right = newNode
	} else {
		prevNode.left = newNode
	}
}

func (tree *tree) find(key int) bool {
	node := tree.root
	for node != nil {
		if node.key == key {
			return true
		} else if node.key < key {
			node = node.right
		} else {
			node = node.left
		}
	}
	return false
}

func (tree tree) print() {
	var acc []int
	if tree.root == nil {
		fmt.Println("")
		fmt.Println("")
	} else {
		fmt.Println(" " + strings.Join(isToAs(visitInorder(tree.root, acc)), " "))
		fmt.Println(" " + strings.Join(isToAs(visitPreorder(tree.root, acc)), " "))
	}
}

func visitPreorder(node *node, acc []int) []int {
	if node == nil {
		return acc
	}
	acc = append(acc, int(node.key))
	if node.left != nil {
		acc = visitPreorder(node.left, acc)
	}
	if node.right != nil {
		acc = visitPreorder(node.right, acc)
	}
	return acc
}

func visitInorder(node *node, acc []int) []int {
	if node == nil {
		return acc
	}
	if node.left != nil {
		acc = visitInorder(node.left, acc)
	}
	acc = append(acc, int(node.key))
	if node.right != nil {
		acc = visitInorder(node.right, acc)
	}
	return acc
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}

	tree := &tree{}
	for i := 0; i < n; i++ {
		command := nextText(sc)
		switch command {
		case "insert":
			key, err := nextInt(sc)
			if err != nil {
				panic(err)
			}
			tree.insert(key)
		case "find":
			key, err := nextInt(sc)
			if err != nil {
				panic(err)
			}
			if tree.find(key) {
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		case "print":
			tree.print()
		default:
			panic("unknown command: " + command)
		}
	}
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) (int, error) {
	return strconv.Atoi(nextText(sc))
}

func isToAs(is []int) []string {
	n := len(is)
	as := make([]string, n)
	for i := 0; i < n; i++ {
		as[i] = strconv.Itoa(is[i])
	}
	return as
}


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

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  string s;
  cin >> s;
  s.pop_back();
  for (; ; s.pop_back()) {
    if (s.size() % 2) continue;
    auto a = s.substr(0, s.size() / 2);
    auto b = s.substr(s.size() / 2);
    if (a == b) {
      cout << s.size() << endl;
      return 0;
    }
  }
}



Measured memory_bytes: 256
import collections
n = int(input())
d_ = [int(i) for i in input().split()]
m = int(input())
t_ = [int(i) for i in input().split()]
d = collections.Counter(d_)
t = collections.Counter(t_)
for ti in t_:
    if d[ti] == 0:
        print("NO")
        exit()
    else:
        d[ti] -= 1
print("YES")

Measured memory_bytes: 56928
n = int(input())
h = list(map(int, input().split()))

def chmin(a, b):
    if a > b: return b
    else: return a

dp = [float('inf')] * n
dp[0] = 0
for i in range(1, n):
    dp[i] = chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
    if i > 1:
        dp[i] = chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print(dp[n-1])

Measured memory_bytes: 85620
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  string s;
  cin >> s;
  rep(i,s.size()){
    if(s[i] == ',') s[i] = ' ';
  }
  cout << s << endl;
}


Measured memory_bytes: 256
from collections import defaultdict
N = int(input())
dic = defaultdict(int)
for n in range(1,N+1):
    s = str(n)
    dic[(int(s[0]), int(s[-1]))] += 1

res = 0
for key, value in dic.items():
    a, b = key
    cnt = dic.get((b,a),0)
    res += value * cnt

print(res)


Measured memory_bytes: 73968
#include<bits/stdc++.h>
using namespace std;
const int MAX = 26;
typedef long long int ll;
vector<ll>pp;
bool prime[90000000];
const string st="abacaba";

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll  m,n,t,ab,k,a,b,c,d,flag=0;

    string s1,s2,s;
    //vector<ll>vec;

    char ch;
    vector<ll>vec1;
    map<ll,ll>mp1;
    map<char,ll>mp2;
    vector<ll>vec2;
    //ll  sum=0;
    set<char>st;


    cin>>t;
    if(t==1){
        cout<<0<<endl;
    }
    else cout<<1<<endl;
}


Measured memory_bytes: 3660
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
int x = 0, y = 0, z = 0,n = 0;
asas;
cncn;
//BEGIN OF CODE.
int main(void){
	int a, b, t;
	cin >> a >> b >> t;
	int s = 0;
	while (true) {
		s += a;
		if (t < s)break;
		else {
			cnt += b;
		}
	}
	cout << cnt << rt;
	please AC;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
    }
    let chars = s.chars().collect::<Vec<_>>();
    let n = chars.len();
    for i in 1..n {
        if chars[i - 1] == chars[i] {
            println!("Bad");
            return
        }
    }
    println!("Good");
}


Measured memory_bytes: 4352
#include <iostream>
#include<map>
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)

using namespace std;
#define fin(ans) cout << (ans) << '\n'
int main()
{
    string S;
    cin >> S;
    bool flag = true;
    REP(i,S.length()-1){
        if (S[i] == S[i + 1])
        {
            flag = false;break;
        }
    }
    if(flag) fin("Good");
    else fin("Bad");
    return 0;
}

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

int main(){

    int x,y;

    while (1)
    {
        cin >> x >> y;
        if(x == 0 && y ==0 ) break;

        if(x>y) swap(x,y);

        cout << x << " " << y <<endl;

    }
    

}




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

void solve(long long a, long long b, long long c, long long d) {
    ll ans = a * c;
    ans = max(ans, b * c);
    ans = max(ans, a * d);
    ans = max(ans, b * d);
    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main() {
    long long a;
    scanf("%lld", &a);
    long long b;
    scanf("%lld", &b);
    long long c;
    scanf("%lld", &c);
    long long d;
    scanf("%lld", &d);
    solve(a, b, c, d);
    return 0;
}


Measured memory_bytes: 3756
from itertools import product
H, W, K=map(int,input().split())
C = []
for i in range(H):
    C.append((input().replace(".","0").replace("#","1")))
# S=list(map(int,input().split()))
# B=list(map(int,input().split()))
count = 0

for i in product("01", repeat=H):
    for j in product("01", repeat=W):
        co = 0
        for k in range(H):
            for l in range(W):
                if int(i[k])*int(j[l])*int(C[k][l]):
                    co+=1
        if co==K:
            count+=1
print(count)




Measured memory_bytes: 9192
#include <string>
#include <iostream>

using namespace std;

int main() {
	string s;
	cin >> s;
	char station = s[0];
	bool yes = false;
	for (int i = 1; i < 3; i++) {
		if (s[i] != station) {
			yes = true;
			break;
		}
	}
	if (yes) cout << "Yes";
	else cout << "No";
	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<tuple>
using namespace std;
#define INF 1LL<<62
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());

ll A[110000],B[110000];

int main(){
    int N,K;
    cin>>N>>K;
    ll a[110000];
    for(int i=1;i<=N;i++){
        cin>>a[i];
    }
    for(int i=1;i<=N;i++){
        A[i]=A[i-1]; B[i]=B[i-1];
        A[i]+=a[i];
        if(a[i]>0){
            B[i]+=a[i];
        }
    }
    ll ans=0;
    for(int i=1;i<=N-K+1;i++){
        ll temp=0;
        temp=max(A[i+K-1]-A[i-1],0LL)+B[i-1]+(B[N]-B[i+K-1]);
        chmax(ans,temp);
    }
    cout<<ans<<endl;
    

}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<cmath>
#include<climits>
#include<vector>
using namespace std;
typedef long long ll;
//const long long mod1 = 999959LL;
//const long long mod2 = 999961LL; 
//const int mod1=999979,mod2=999983;
const ll mod = 10000000019LL;

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

long long mod_inv(long long a,long long m)
{
  long long x,y;
  extgcd(a,m,x,y);
  return (m+x%m)%m;
}

long long mod_mul(long long x,long long y,long long p)
{
  return ((((x*(y>>20))%p)<< 20)%p + x*(y&((1<<20)-1)))%p;
}

pair<long long,long long> linear_congruence(const vector<long long>& A,const vector<long long>& B,const vector<long long>& M)
{
  long long x = 0LL, m = 1LL;
  for(int i=0;i<A.size();i++)
    {
      long long a = A[i]*m,b = B[i]-A[i]*x,d = __gcd(M[i],a);
      if(b%d != 0)return make_pair(0,-1);
      long long t = b/d*mod_inv(a/d,M[i]/d)%(M[i]/d);
      x = x + m * t;
      m *= M[i]/d;
      /*
	cout << "b = " << b << endl;
	cout << "B[i] = " << B[i] << endl;
	cout << "A[i] = " << A[i] << endl;
	cout << "m = " << m << endl;
	cout << "t = " << t << endl;
	cout << "x = " << x << endl;
	cout << "d = " << d << endl;
	cout << "mod_inv = " << mod_inv(a/d,M[i]/d) << endl;
      */   
    }
  return make_pair((m+x)%m,m);
}
 

int main()
{
 
  int N;
  cin >> N;
  long long a;
  a = 0LL;
  for(int i=0;i<N;i++)
    {
      char o;
      long long Y;
      cin >> o >> Y;
      switch(o)
	{
	case '1':
	  a = (a+Y)%mod;
	  break;
	case '2':
	  a = (a-Y+mod)%mod;
	  break;
	case '3':
	  a = mod_mul(a,Y,mod)%mod;
	  break;
	case '4':
	  a = (mod_mul(a,mod_inv(Y,mod),mod))%mod;
	default:
	  break;
	}
      a = (a+mod)%mod;
    }
  /*  
      if(a > b)
      {
      ll y = mod_inv(mod2,mod1);
      //cout << a << " " << b << endl;
      ll ans = b+(a-b)*y*(ll)mod2;
      while(ans >= LONG_MAX)ans -= ((ll)mod1*mod2);
      cout << ans << endl;
      }
      else
      {
      ll y = mod_inv(mod1,mod2);
      //cout << a << " " << b << endl;
      ll ans = a+(b-a)*y*(ll)mod1;
      while(ans >= LONG_MAX)ans -= ((ll)mod1*mod2);
      cout << ans << endl;
      }
  */
  if(a >= (1LL<<31))a -= mod;
  cout <<a << endl;
    
  return 0;
}

Measured memory_bytes: 1164
#!/usr/bin/env pypy3
import sys


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    print(N+N**2 + N**3)


# oj t -c "python main.py"
# acc s
main()


Measured memory_bytes: 9168
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int main(){
int a;
cin>>a;
int b=a/15;
long long ans=800*a-200*b;
cout<<ans;
system("pause");
return 0;
}

Measured memory_bytes: 504
class Tree {
  static get Node() {
    return class {
      constructor(id, parent, children) {
        this.id = id;
        this.parent = parent;
        this.children = children;
      }

      get type() {
        if (this.parent === null) return 'root';
        if (this.children.length === 0) return 'leaf';
        return 'internal node';
      }

      get depth() {
        const getDepth = (node, i) => {
          if (node.parent === null) {
            return i;
          }
          return getDepth(node.parent, i + 1);
        };
        return getDepth(this, 0);
      }

      toString() {
        return `node ${this.id}: parent = ${this.parent !== null ? this.parent.id : -1}, depth = ${this.depth}, ${this.type}, [${this.children.map(n => n.id).join(', ')}]`;
      }
    };
  }

  constructor(n) {
    this.nodes = [];
    let Node = Tree.Node;
    for (let i = 0; i < n; i++) {
      this.nodes[i] = new Node(i, null, []);
    }
  }

  add(id, childrenIds) {
    let node = this.find(id);
    childrenIds.forEach((cid) => {
      let c = this.find(cid);
      c.parent = node;
      c.id = cid;
      node.children.push(c);
    })
  }

  find(id) {
    return this.nodes[id];
  }

  print() {
    console.log(this.nodes.sort((a, b) => a.id - b.id).map(n => n.toString()).join('\n'));
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  let tree = new Tree(n);

  let id, k, childrenIds;
  lines.map(l => l.split(' ')).forEach(function(line) {
    id = Number(line.shift());
    k = Number(line.shift());
    childrenIds = line.map(Number);
    tree.add(id, childrenIds);
  });

  tree.print();
})();



Measured memory_bytes: 158124
#include<bits/stdc++.h>
using namespace std;
int a,b,ans,f[60];
int main() {
	cin>>a>>b;
	for(int i=0; i<a; i++)cin>>f[i];
	sort(f,f+a);
	for(int i=0; i<=b; i++)ans+=f[a-i];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
from math import factorial
N, P = map(int, input().split())
A = [int(i) for i in input().split()]
o = []
e = []

def c(n,r):
    a = 1
    for i in range(n-r+1,n+1):
        a *= i
    return a//factorial(r)
for a in A:
    if a % 2: o.append(a)
    else: e.append(a)
ans = 0
if P:
    for i in range(1, len(o) + 1):
        if not i % 2: continue
        ans += c(len(o), i)
        for j in range(1, len(e)+1):
            ans += c(len(e), j) * c(len(o), i)
else:
    ans += 1
    for i in range(1, len(e) + 1):
        ans += c(len(e), i)
    for i in range(1, len(o) + 1):
        if i % 2: continue
        ans += c(len(o), i)
        for j in range(1, len(e) + 1):
            ans += c(len(e), j) * c(len(o), i)
print(ans)

Measured memory_bytes: 3188
/**
 * @author      : omgursocute
 * @created     : 12/02/2020
 * @task        : B
 */

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main() {
	// freopen("B.inp", "r", stdin);
	// freopen("B.out", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	
	string s;
	cin >> s;
	for(char c: s) cout << 'x';

	return 0;
}



Measured memory_bytes: 256
n = int(input())
s = list(map(int, input().split()))
k = max(s)
c = [0 for i in range(k+1)]
def counting_sort(a, k):
    global c
    b = [0 for i in range(len(a)+1)]
    for i in range(n):
        c[a[i]] += 1

    for i in range(1,k+1):
        c[i] = c[i] + c[i - 1]

    for i in reversed(range(n)):
        b[c[a[i]]] = a[i]
        c[a[i]] -= 1
    return b
res = counting_sort(s, k)[1:n+1]
print(*res)
#print(c)



Measured memory_bytes: 224384
n = int(input())
l = list(map(int,input().split()))

cnt = 0
for i in range(n):
  for j in range(i,n):
    for k in range(j,n):
      if l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
        if abs(l[i] - l[j]) < l[k] < l[i] + l[j]:
          cnt += 1
print(cnt)

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

int main() {
  int k, x;
  cin >> k >> x;

  int start = max(x - (k - 1), -1000000);
  int end = min(x + (k - 1), 1000000);
  for(int i = start; i <= end; i++) cout << i << " ";
}

Measured memory_bytes: 256
n = int(input())
l = []
if n%2:
    for i in range(1,n):
        for j in range(i+1,n+1):
            if i+j == n:
                continue
            l.append([i,j])
else:
    for i in range(1,n):
        for j in range(i+1,n+1):
            if i+j == n+1:
                continue
            l.append([i,j])
print(len(l))
for i in l:
    print(*i)


Measured memory_bytes: 9636
#!/usr/bin/env python
from math import *

N = int(input())
A = sorted(map(int, input().split()))

n = A[-1]

score_max = 0
r = A[0]
for i in range(1, N-1):
    score = min(A[i], n-A[i])
    if score_max < score:
        score_max = score
        r = A[i]
    else:
        break

print(n, r)

Measured memory_bytes: 14180
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
#include <numeric>
#include <sstream>
using namespace std;
typedef long long ll;
// #define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
const int maxn = 7e4 + 5;
int ans[maxn];
int main(int argc, char const *argv[])
{
	for(int i = 1;i <= 105; ++i)
	{
		for(int j = 1;j <= 105; ++j)
		{
			for(int k = 1;k <= 105; ++k)
			{
				ans[i * i + j * j + k * k + i * j + i * k + j * k]++;
			}
		}
		debug("i = %d\n",i);
	}
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n; ++i)
	{
		printf("%d\n",ans[i]);
	}
	return 0;
}

Measured memory_bytes: 3912
import sys

ni = lambda: int(sys.stdin.readline().rstrip())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
INF = 10 ** 9
n, m = nm()
ab = [nl() for i in range(n)]
cd = [nl() for i in range(m)]
ans = []
for i in range(n):
    temp = INF
    a = ab[i][0]
    b = ab[i][1]
    for j in range(m-1, -1, -1):
        c = cd[j][0]
        d = cd[j][1]
        if abs(a - c) + abs(b - d) <= temp:
            temp = abs(a - c) + abs(b - d)
            idx = j + 1
    ans.append(str(idx))
print('\n'.join(ans))


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

int main(){
    string str;
    int n;
    while(cin >> str){
        if(str=="-") break;
        cin >> n;
        for(int i=0,h; i<n; i++){
            cin >> h;
            string cat = str.substr(0,h);
            str.erase(0,h);
            str+=cat;
        }
        cout << str << endl;
    }
}




Measured memory_bytes: 3156
#include<iostream>
#include<algorithm>
#include<cmath>


int main() {
	int a, b, c,i;
	std::cin >> a >> b >> c >> i;

	auto m = std::max({ a,b,c });
	auto sum = a + b + c - m;

	sum += static_cast<int>(std::pow(2, i)*m);
	std::cout << sum << "\n";
	return 0;
}

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

int main(){
    vector<int> a(3);
    rep(i,3) cin >> a[i];
    sort(a.begin(),a.end());
    int ans = 0;
    ans += abs(a[1] - a[0]);
    ans += abs(a[2] - a[1]);
    cout << ans << endl;
}


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

int N, V, K;
int X[200010], L[20][200010], R[20][200010];
vector<int> P;

int cc1[1 << 20];
int dp1(int mask) {
    if(mask == 0) return -1;
    int &ret = cc1[mask];
    if(ret != -1) return ret;
    if(mask == 0) return ret = 0;

    ret = -1;
    for(int i = 0; i < K; i++) {
        if(mask & (1 << i)) {
            ret = max(ret, (dp1(mask - (1 << i)) == N - 1? N - 1 : R[i][ dp1(mask - (1 << i)) + 1 ]));
        }
    }
    return ret;
}
int cc2[1 << 20];
int dp2(int mask) {
    if(mask == 0) return N;
    int &ret = cc2[mask];
    if(ret != -1) return ret;

    ret = N;
    for(int i = 0; i < K; i++) {
        if(mask & (1 << i)) {
            ret = min(ret, (dp2(mask - (1 << i)) == 0? 0 : L[i][ dp2(mask - (1 << i)) - 1 ]));
        }
    }
    return ret;
}

int main() {
    scanf("%d %d", &N, &V);

    for(int i = 0; i < N; i++) {
        scanf("%d", &X[i]);
    }

    P.push_back(V);
    while(P.back()) {
        int t = P.back() / 2;
        P.push_back(t);
    }
    reverse(P.begin(), P.end());

    K = P.size();

    for(int i = 0; i < K; i++) {
        int pos = 0;
        for(int j = 0; j < N; j++) {
            if(pos < j) pos = j;
            while(pos < N - 1 && X[pos + 1] - X[pos] <= P[i]) pos++;
            R[i][j] = pos;
        }
        pos = N - 1;
        for(int j = N - 1; j >= 0; j--) {
            if(pos > j) pos = j;
            while(pos >= 1 && X[pos] - X[pos - 1] <= P[i]) pos--;
            L[i][j] = pos;
        }
    }

    memset(cc1, -1, sizeof(cc1));
    memset(cc2, -1, sizeof(cc2));

    if(dp1((1 << K) - 1) != N - 1) {
        for(int i = 0; i < N; i++) {
            printf("Impossible\n");
        }
        return 0;
    }

    int pos = 0;
    while(pos < N) {
        int nxt = R[K - 1][pos];

        bool ok = false;
        for(int i = 0; i < (1 << (K - 1)); i++) {
            if(pos - 1 <= dp1(i) && dp2((1 << (K - 1)) - 1 - i) <= nxt + 1) {
                ok = true;
                break;
            }
        }
        if(ok) {
            for(int i = pos; i <= nxt; i++) {
                printf("Possible\n");
            }
        }
        else {
            for(int i = pos; i <= nxt; i++) {
                printf("Impossible\n");
            }
        }
        pos = nxt + 1;
    }
}


Measured memory_bytes: 42112
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Akash
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AABC333 solver = new AABC333();
        solver.solve(1, in, out);
        out.close();
    }

    static class AABC333 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int a = in.nextInt();
            int b = in.nextInt();

            if (a % 2 > 0 && b % 2 > 0)
                out.println("Yes");
            else
                out.println("No");
        }

    }
}



Measured memory_bytes: 22996
# 066 B
S = input()

for i in range(len(S)):
    S = S[0:-1]
    if len(S)%2 ==0:
        #print(S[0:int(len(S)/2 )],S[int(len(S)/2) : ])
        if S[0:int(len(S)/2)]==S[int(len(S)/2 ) : ]:
            print(len(S))
            exit()

Measured memory_bytes: 3060