akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <set>
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long LL;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    int x;
    cin >> x;
    int ans = 0;
    if(x == 0){
        ans = 1;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define int long long
#define fr(i, n) for(int i=0;i<n;i++)
#define frr(i, n) for(int i=n;i>=0;i--)
#define fra(i, a, n) for(int i=a;i<n;i++)
#define frra(i, a, n) for(int i=a;i>=n;i--)
#define f(i, a) for(auto &i:a)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define ff first
#define ss second
#define endl '\n'

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef set<int> si;
typedef unordered_map<int, int> uii;
typedef unordered_set<int> usi;

const int mod = 1e9 + 7;
const int MAXN = 2e5 + 5;
const int inf = 1e9 + 10;
const double eps = 1e-9;
const double pi = 3.14159265358979323;

int power(int x, int y) {
    int res = 1;
    while (y) {
        if (y & 1)res = (res * x) % mod;
        x = (x * x) % mod;
        y >>= 1;
    }
    return res;
}

vvi adj;
vi dp;

int dfs(int u) {
    if (~dp[u])return dp[u];
    int res = 0;
    for (auto v:adj[u]) {
        res = max(res, 1 + dfs(v));
    }
    return dp[u] = res;
}

void solve() {
    //CODE BEGIN
    int n, m;
    cin >> n >> m;
    adj.resize(n);
    dp.assign(n, -1);
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        adj[u].eb(v);
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (!~dp[i])dfs(i);
        ans = max(ans, dp[i]);
    }
    cout << ans << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int test = 1;
//    cin >> test;
    for (int i = 0; i < test; ++i) {
//        cout << "Case #" << i + 1 << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 8576
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <array>
#include <vector>
#include <cmath>

using namespace std;

typedef pair<double, double> Point;

double d2( Point p1, Point p2 ) {
  double dx = p1.first - p2.first;
  double dy = p1.second - p2.second;
  return dx * dx + dy * dy;
}

Point sub( Point p1, Point p2 ) {
  return Point( p1.first - p2.first, p1.second - p2.second );
}

Point add( Point p1, Point p2 ) {
  return Point( p1.first + p2.first, p1.second + p2.second );
}

Point div( Point p, double val ) {
  return Point( p.first / val, p.second / val );
}

Point middle( Point p1, Point p2 ) {
  return div( add( p1, p2 ), 2.0 );
}

double norm( Point p ) {
  return sqrt( p.first * p.first + p.second * p.second );
}

Point normalize( Point p ) {
  double n = norm( p );
  return div( p, n );
}

Point rotate( Point p, double th ) {
  double x = cos( th ) * p.first - sin( th ) * p.second;
  double y = sin( th ) * p.first + cos( th ) * p.second;
  return Point( x, y );
}								

void cross( Point p1, Point p2, Point &a1, Point &a2 ) {
  Point v = normalize( sub( p1, p2 ) );
  double th = acos( sqrt( d2( p1, p2 ) ) / 2.0 );
  a1 = add( rotate( v, th ), p2 );
  a2 = add( rotate( v, -th ), p2 );
}

void print( Point p ) {
  cerr << p.first << ", " << p.second << endl;
}

int main() {
  while( true ) {
	int n;
	cin >> n;
	if ( n == 0 ) break;
	
	vector<Point> vs( n );
	for ( int i = 0; i < n; i++ ) {
	  double x, y;
	  cin >> x >> y;
	  vs[ i ] = make_pair( x, y );
	}
	vector<Point> cands;
	for ( int i = 0; i < n; i++ ) {
	  for ( int j = i + 1; j < n; j++ ) {
		double d = d2( vs[ i ], vs[ j ] );
		if ( d == 4 ) {
		  cands.push_back( middle( vs[ i ], vs[ j ] ) );
		} else if ( d < 4 ) {
		  Point p1, p2;
		  cross( vs[ i ], vs[ j ], p1, p2 );
		  cands.push_back( p1 );
		  cands.push_back( p2 );
  		}
	  }
	}
	int maxCount = 1;
	for ( Point p : cands ) {
	  int c = 0;
	  for ( Point v : vs ) {
		if ( d2( p, v ) <= 1.0 ) {
		  c++;
		}
	  }
	  maxCount = max( maxCount, c );
	}
	cout << maxCount << endl;
  }
}

Measured memory_bytes: 1968
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	long long a, b, c, d, max=1000000000;
	max*=-max;
	cin>>a>>b>>c>>d;
	
	if(a*c>=max) max=a*c;
	if(a*d>=max) max=a*d;
	if(b*c>=max) max=b*c;
	if(b*d>=max) max=b*d;
	
	cout<<max;
	
	return 0;
}

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

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

int main() {
  	string str;

    getline(cin, str);

    for(int i = 0; i < str.size(); i++) {
        if(char(toupper(str[i])-str[i] != 0)) str[i] = char(toupper(str[i]));
        else str[i] = char(tolower(str[i]));
    }

    cout << str;
    cout << endl;
  
}


Measured memory_bytes: 3144
while 1:
	n=input()
	if n==0: break
	d=[map(int,raw_input().split()) for i in range(n)]
	w=max([sum([d2[0] for d2 in d if d2[1]<=d1[1]<d2[2]]) for d1 in d])
	print "OK" if w<151 else "NG"

Measured memory_bytes: 4236
#include <string>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string.h>
#include <utility>
#include <queue>
#include <stack>
#include <iomanip>
#include <ctype.h>
#include <map>
#include <set>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <sstream>
#include <math.h>
#include <time.h>
#include <iostream>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <tuple>
#include <cmath>
#include <stdio.h>      /* printf, fgets */
#include <stdlib.h>
#include <fstream>

using namespace std;

typedef long long LL;

#define FOR(i,n) for(int i = 0;i < n;i++)
#define MP make_pair
#define PB push_back
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int, int>
#define PLL pair<long long, long long>
#define CLEAR(a) memset(a, 0, sizeof(a))
#define ERASE(a) memset(a, -1, sizeof(a))
#define INF 2000000007LL
#define y1 uu1
#define y2 uu2
const double EPS = 1E-12;
const double PI = acos(-1.0);

using namespace std;

const LL mod = 998244353;

int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0);
  string s;
  int n;
  cin >> n >> s;
  FOR(i, s.length()) {
    char c = s[i];
    int cc = (int)c + n;
    if (cc > (int)'Z') cc -= 26;
    s[i] = (char)cc;
  }
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <cassert>
#define SIZE 105

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

char str[SIZE];

int main()
{
	int n;
	scanf("%d",&n);
	scanf("%s",&str);
	int r=0,b=0;
	for(int i=0;i<n;i++)
	{
		if(str[i]=='R') r++;
		else b++;
	}
	if(r>b) puts("Yes");
	else puts("No");
	return 0;
}


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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)


void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}

void putb(unsigned int v) {
  putchar('0'), putchar('b'), printb(v), putchar('\n');
}

int n;
ll a[200000];
ll b[200002];
ll c[200002];
vector<pii> ans;
ll cnt = 0;
int main(){
  cin >> n;
  REP(i,n) cin >> a[i];
  b[0] = 0;
  c[0] = 0;
  FOR(i,1,n+1){
   b[i] = b[i-1] + a[i-1];
   c[i] = c[i-1]^a[i-1];
  }
  int l = 1;
  FOR(r,1,n+1){
    if(b[r]-b[l-1]!=(c[r]^c[l-1])){
      ans.push_back(pii(l,r-1));
      //cout <<r<<" "<< l << " " << r-l <<endl;
      while(b[r]-b[l-1]!=(c[r]^c[l-1])){
        l++;
        if(r==l) break;
      }
    }
  }
  //cout << n << " " <<l << " " << n-l+1 << endl;
  ll rm = -1;
  ans.push_back(pii(l,n));
  REP(i,ans.size()){
    ll l = ans[i].first;
    ll r = ans[i].second;
    cnt += (r-l+1)*(r-l+2)/2;
    if(rm >=0) cnt -= (rm-l+1)*(rm-l+2)/2;
    //cout << (rm-l+1)*(rm-l+2)/2 <<endl;
    //cout << l << " " << r << " " << r-l+1 <<endl;
    rm = max(r,rm);
  }
  cout << cnt << endl;
  //REP(i,n) putb(a[i]);
}


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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  bool works = false;
  --n;
  for (int i = 0; i <= n; ++i) {
    long long lo = a - d * i + (n - i) * c;
    long long hi = a - c * i + (n - i) * d;
    if (lo <= b && b <= hi) {
      works = true;
      break;
    }
  }
  cout << (works ? "YES" : "NO") << endl;
  return 0;
}


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

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int inf = 1e9;

int main()
{

    //freopen("input.txt", "r", stdin);

    //ios_base::sync_with_stdio(false);
    //cin.tie(0);

    int n, m;
    cin >> n >> m;

    vector<vector<int> > v(n, vector<int>(m));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> v[i][j];
        }
    }

    vector<vector<vector<int> > > dp(n, vector<vector<int> >(n, vector<int>(n + m - 1, -inf)));
    dp[0][0][0] = v[0][0];
    int dx[2] = {1, 0};
    int dy[2] = {0, 1};
    for (int k = 0; k < n + m - 2; ++k) {
        for (int a = 0; a < n; ++a) {
            for (int b = 0; b < n; ++b) {
                if (dp[a][b][k] != -inf) {
                    int c = k - a, d = k - b;
                    for (int i = 0; i < 2; ++i) {
                        for (int j = 0; j < 2; ++j) {
                            if (a + dx[i] < n && c + dy[i] < m && b + dx[j] < n && d + dy[j] < m) {
                                int sum = v[a + dx[i]][c + dy[i]];
                                if (a + dx[i] != b + dx[j] || c + dy[i] != d + dy[j]) {
                                    sum += v[b + dx[j]][d + dy[j]];
                                }
                                dp[a + dx[i]][b + dx[j]][k + 1] = max(dp[a + dx[i]][b + dx[j]][k + 1], dp[a][b][k] + sum);
                            }
                        }
                    }
                }
            }
        }
    }

    cout << dp[n - 1][n - 1][n + m - 2] << "\n";

}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int &
#define SZ(a) ((int)((a).size()))
#define watch(x) cout << (#x) << " = " << (x) << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


inline void transpose(vector<string> &a) {

    int n = a.size();
    if (n == 0) return;
    int m = a[0].size();
    vector<string> b(m, string(n, ' '));
    fori (i, n) fori (j, m) b[j][i] = a[i][j];
    a = b;
}


template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "{";
    fori (i, SZ(a))
        out << a[i] << vector<string>{", ", "}"}[i + 1 == SZ(a)];
    return out;
}

void smain();

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


#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#define cerr cout
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\n";
    cout << "TOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}


const int N = 1e5 + 9;
const int L = 1e4 + 9;
const ll oo = 1e18;


void smain() {


    int n, w;
    cin >> n >> w;

    vector<pii> a(n);
    fori (i, n) cin >> a[i].first >> a[i].second;
    vl dp(w + 1, 0);
    for (int i = 0; i < n; ++i) {
        for (int j = w; j >= a[i].first; --j)
            inmax(dp[j], dp[j - a[i].first] + a[i].second);
    }
    cout << dp[w];
}

Measured memory_bytes: 1024
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    if (args.length > 0 && args(0) == "TEST") {
      println(test())
    } else {
      val input = io.Source.stdin.getLines().mkString("\n")
      println(solve(input).trim())
    }
  }

  def solve(input: String): String = {
    val s: Scanner = new Scanner(input)
    val n = s.nextInt
    val r = List.fill(n)(s.next , s.nextInt).zip(Stream from 1)
    r.sortBy(elm => (elm._1._1, -elm._1._2)).map(elm => elm._2).mkString("\n")
  }

  val tests = List(
    """6
      |khabarovsk 20
      |moscow 10
      |kazan 50
      |kazan 35
      |moscow 60
      |khabarovsk 40
      |""".stripMargin ->
      """3
        |4
        |6
        |1
        |5
        |2
        |""".stripMargin,
    """10
      |yakutsk 10
      |yakutsk 20
      |yakutsk 30
      |yakutsk 40
      |yakutsk 50
      |yakutsk 60
      |yakutsk 70
      |yakutsk 80
      |yakutsk 90
      |yakutsk 100""".stripMargin ->
    """10
      |9
      |8
      |7
      |6
      |5
      |4
      |3
      |2
      |1
    """.stripMargin
  )

  def test(): String = tests.map { case (i, o) => (i.trim(), o.trim()) }
    .zipWithIndex.map {
    case ((input, outputExpect), i) =>
      val output = solve(input).trim()
      val tnum = i + 1
      s"test$tnum:" + (
        if (output == outputExpect) "Passed"
        else s"Failed\nexpect:\n$outputExpect\noutput:\n$output")
  }
    .mkString("\n")
}

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

    int main(){
        ll n , c , k , t;
        ll ans = 0;
        cin >> n  >> c >> k;
        vector<ll> v;
        vector<int> checked;
        checked.assign(n , 0);
        for(long i = 0 ; i < n ; i++){
            cin >> t;
            v.push_back(t);
        }
        sort(v.begin(), v.end());
        for(long i = 0 ; i < n ; i++){
            if(checked[i] == 0){
                checked[i] = 1;
                ans += 1;
                for(long j = 1; j < c && i + j < n ; j++){
                     if(v[i+j] - v[i] > k){
                         break;
                     }else{
                         checked[i+j] = 1;
                     }
                }
            }
        }
        
        cout << ans << endl;
        
        return 0;
        
    }

Measured memory_bytes: 1784
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i = 0; i < n; i++)

int main(void)
{
    int n;
    string s;
    cin >> n >> s;
    int cnt  = 0;
    REP(i, n) cnt+=(s[i]=='R')?1:-1;
    cout << ((cnt >0)?"Yes":"No") << endl;
}


Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.stream.IntStream;

/**
 * 解説通りに作成したソースコード
 * 
 * https://atcoder.jp/contests/abc116/submissions/14852322 にも参考
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt(), k = scanner.nextInt();
			int[] t = new int[n];
			long[] d = new long[n];
			IntStream.range(0, n).forEach(i -> {
				t[i] = scanner.nextInt();
				d[i] = scanner.nextLong();
			});
			// indexをd[i]でソートする
			int[] sortedIndexes = IntStream.range(0, n).boxed().sorted((i1, i2) -> Long.compare(d[i2], d[i1]))
					.mapToInt(Integer::intValue).toArray();
			// 選択されたtを保存するセット
			Set<Integer> tSet = new HashSet<>();
			Stack<Long> extraDs = new Stack<>();
			long sum = IntStream.range(0, k).map(i -> sortedIndexes[i]).mapToLong(index -> {
				if (tSet.contains(t[index])) {
					extraDs.add(d[index]);
				} else {
					tSet.add(t[index]);
				}
				return d[index];
			}).sum();
			long max = sum + tSet.size() * (long) tSet.size();
			for (int i = k; i < n; i++) {
				int index = sortedIndexes[i];
				if (!extraDs.isEmpty() && !tSet.contains(t[index])) {
					sum += d[index] - extraDs.pop();
					tSet.add(t[index]);
					max = Math.max(max, sum + tSet.size() * (long) tSet.size());
				}
			}
			System.out.println(max);
		}
	}
}


Measured memory_bytes: 63512
#import<bits/stdc++.h>
#define endl '\n'
using namespace std;
int h,i,j,w,x,y,a[105][105],b[105][105];
string s[105];
main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>h>>w;
	for(;i++<h;)cin>>s[i];
	for(i=0;i++<h;)
	{
		for(j=0;j<w;j++)
		{
			a[i][j+1]=s[i][j]&1;
		}
	}
	for(i=0;i++<h;)
	{
		for(j=0;j++<w;)
		{
			x=b[i-1][j]+(a[i-1][j]<a[i][j]);
			y=b[i][j-1]+(a[i][j-1]<a[i][j]);
			if(i<2)b[i][j]=y;
			else if(j<2)b[i][j]=x;
			else b[i][j]=min(x,y);
			//cout<<b[i][j]<<' ';
		}
		//cout<<endl;
	}
	cout<<b[h][w];
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
ll N,A,B,C,D;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>A>>B>>C>>D;
    if(C==0&&D==0){
        if(A==B) cout <<"YES"<<"\n";
        else cout <<"NO"<<"\n";
    }
    else{
        if(N-1>=(B-A+(N-1)*C+C+D-1)/(C+D)&&(B-A+(N-1)*D)/(C+D)>=0&&(B-A+(N-1)*C+C+D-1)/(C+D)<=(B-A+(N-1)*D)/(C+D)) cout <<"YES"<<"\n";
        else cout <<"NO"<<"\n";
    }
}

Measured memory_bytes: 256
require 'pp'
N,d=gets.chomp.split(' ').map{|n| n.to_i}
A=gets.chomp.split(' ').map{|n| n.to_i}
B=gets.chomp.split(' ').map{|n| n.to_i}
A_sum = A.inject(0){|sum,n| sum+n}
B_sum = B.inject(0){|sum,n| sum+n}

# puts A_sum
# puts B_sum

diff = B_sum-A_sum
a_cnt=0
b_cnt=0

0.upto(N-1){|i|
	a = A[i]
	b = B[i]
	if(b-a>0)
		a_cnt += (b-a)/2
		if((b-a)%2==1)
			a_cnt += 1
			b_cnt += 1
		end
	elsif(b-a<0)
		b_cnt += a-b
	end
}
if(a_cnt <= diff && b_cnt <= diff)
	puts "Yes"
else
	puts "No"
end


Measured memory_bytes: 3452
#include<iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= 9; ++i) {
        for (int l = 1; l <= 9; ++l) {
            if (i * l == n) {
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
    return 0;
}

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

int main() {
  int A,B,i,sum;
  cin>>A>>B;
  for(i=A;i<B+1;i++){
    if(i/10000==i%10&&(i/1000)%10==(i/10)%10)
      sum++;
  }
  cout<<sum<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
        #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
        #define M_PI 3.14159265358979323846
        #define data data_
        #define ff first
        #define ss second
        #define pb push_back
        #define ld long double
        #define int long long
        #define print(t) cout << "Case #" << t << ": ";
        int32_t main()
        {
            tani_nachi_ke  
            
            int a,b,c,d;
            cin >> a >> b >> c >> d;
            int x = (c + b - 1)/b;
            int y = (a + d - 1)/d;
            // cout << x << " " << y << endl;
            if(x <= y)
                cout << "Yes" << endl;
            else
                cout << "No" << endl;





           return 0;
        }
          

Measured memory_bytes: 3636
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))

    op = None
    prev = A[0]
    cnt = 0
    for i in range(1, N):
        if op is None:
            if prev == A[i]:
                continue
            elif prev < A[i]:
                op = "up"
                prev = A[i]
            else:
                op = "down"
                prev = A[i]
        else:
            if op == "up":
                if prev <= A[i]:
                    prev = A[i]
                    continue
                else:
                    cnt += 1
                    op = None
                    prev = A[i]
            else:
                if prev >= A[i]:
                    prev = A[i]
                    continue
                else:
                    cnt += 1
                    op = None
                    prev = A[i]

    cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()


Measured memory_bytes: 14480
# -*- coding: utf-8 -*-


def main():
    n, w = map(int, input().split())
    items = [tuple(map(int, input().split())) for i in range(n)]

    dp = [[0] * (w + 1) for i in range(n + 1)]

    for i, item in enumerate(items):
        for i_w in range(w + 1):
            if i_w >= item[0]:
                dp[i + 1][i_w] = max(dp[i][i_w - item[0]] + item[1], dp[i][i_w])
            else:
                dp[i + 1][i_w] = dp[i][i_w]

    print(dp[n][w])


if __name__ == '__main__':
    main()


Measured memory_bytes: 118256
#include <stdio.h>

int main(void)
{
	int a, b, c,i,cn=0;
	
	scanf("%d %d %d", &a, &b, &c);
	for(i=a; i<=b; i++){
		if( c%i == 0){
			cn++;
		}
	}
	printf("%d\n", cn);
	return 0;
}


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

int main()
{
    string s, t;
    cin >> s >> t;
    for(int i = 0; i < s.size(); i++){
        if(s == t){
            cout << "Yes" << endl;
            system("pause");
            return 0;
        }
        s = s.back() + s.substr(0, s.size()-1);
    }
    cout << "No" << endl;
    system("pause");
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000
using ll = long long;

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> X(M);
    for(int i=0;i<M;i++){
        cin >> X[i];
    }
    sort(X.begin(),X.end());

    vector<int> diffs(M);
    for(int i=1;i<M;i++){
        diffs.push_back(X[i]-X[i-1]);
    }
    sort(diffs.begin(),diffs.end(),greater<int>());

    int ans = X[M-1]-X[0];
    for(int i=0;i<min((int)diffs.size(),N-1);i++){
        ans -= diffs[i];
    }
    cout << ans << endl;
}


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

using namespace std;

int main()
{
	int h,w;
	cin >> h >> w;
	string s[10];
	for(int i=1;i<=h;i++)
		cin >> s[i-1];
	
	bool can=true;
	int count=0;
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			if(s[i-1][j-1]=='#')
			{
				if(count==j or count+1==j)
					count=j;
				else can=false;
			}
		}
	}
	cout << (can==true ? "Possible" : "Impossible") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>

#define MAX_N 100

int wa[MAX_N] = {0};
int va[MAX_N] = {0};
std::map<std::pair<int, int>, int> note;

int max_knapsack(int i, int j) {
    int v;
    std::pair<int, int> p = std::make_pair(i, j);
    if (note.find(p) != note.end()) {
        return note[p];
    }
    if (i == 0 || j == 0) {
        v = 0;
    } else if (j < wa[i - 1]) {
        v = max_knapsack(i - 1, j);
    } else {
        v = std::max(
            max_knapsack(i - 1, j),
            max_knapsack(i - 1, j - wa[i - 1]) + va[i - 1]
            );
    }
    note[p] = v;
    return v;
}

int main() {
    int n, w;
    std::cin >> n >> w;
    for (int i = 0; i < n; i++) {
        std::cin >> wa[i] >> va[i];
    }
    std::cout << max_knapsack(n, w) << std::endl;
}

Measured memory_bytes: 6400
a, b, c = map(int, input().split())

aa = a
s = a % b
data = []

while True:
  aa += a
  data.append(aa % b)
  if aa % b == s:
    break
    
data.sort()

if a % b == 0:
  print("NO")
elif c % data[1] != 0:
  print("NO")
else:
  print("YES")
  

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

int main() {
    int x;
    cin >> x;
    int ans = 0;
    if(x < 4) ans = 1;
    else {
        for (int i = 2; i <= x; i++)
        {
            for (int j = 2; j < 10; j++)
            {
                if(pow(i, j) <= x) ans = max((double)ans, pow(i, j));
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>

using namespace std;

int main() {
    int N;
    cin >> N;
    
    vector<pair<pair<int, int>, long long int> > vec(N);
    for(int n=0; n<N; n++) {
        cin >> vec[n].first.first >> vec[n].first.second >> vec[n].second;
    }
    
    for(int x=0; x<=100; x++) {
        for(int y=0; y<=100; y++) {
            long long int H;
            bool is_lower_ok = vec[0].second ? false : true;
            bool is_center=true;
            H = vec[0].second + abs(vec[0].first.first - x) + abs(vec[0].first.second - y);
            // cout << x << " " << y << " " << H << " " << is_lower_ok << endl;

            for(int n=1; n<N; n++) {
                if(is_lower_ok) {
                    is_lower_ok = vec[n].second ? false : true;
                    if(is_lower_ok) {
                        H = min(H, vec[n].second+abs(vec[n].first.first - x)+abs(vec[n].first.second - y));
                    } else {
                        if(H>=vec[n].second+abs(vec[n].first.first - x)+abs(vec[n].first.second - y)) {
                            H = vec[n].second+abs(vec[n].first.first - x)+abs(vec[n].first.second - y);
                        } else {
                            is_center = false;
                            break;
                        }
                    }
                } else {
                    if(vec[n].second!=0) {
                        if(H!=vec[n].second+abs(vec[n].first.first - x)+abs(vec[n].first.second - y)) {
                            is_center = false;
                            break;
                        }
                    } else {
                        if(H>vec[n].second+abs(vec[n].first.first - x)+abs(vec[n].first.second - y)) {
                            is_center = false;
                            break;
                        }
                    }
                }
            }
            if(is_center) {
                cout << x << " " << y << " " << H << endl;
                return 0;
            }
        }
    }


    return 0;
    
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using std::sort;
int main(void)
{
    int i,N,*a,K;
    scanf("%d%d",&N,&K);
    a=new int [N];
    for(i=0;i<N;i++)
        scanf("%d",a+i);
    sort(a,a+N);
    for(i=0;K>0 && i<N;i++)
    {
        K-=a[i];
    }

    if(K<0)
        printf("%d\n",i-1);
    else if(K==0)
        printf("%d\n",i);
    else if(K>0)
        printf("%d\n",N-1);


    delete [] a;

}


Measured memory_bytes: 256
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    a, b = nm()
    print(a + b if b % a == 0 else b - a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9028
class SegmentTree():
    """
    update, get を提供するSegmentTree

    Attributes
    ----------
    __n : int
        葉の数。2 ^ i - 1
    __dot :
        Segment function
    __e: int
        単位元
    __node: list
        Segment Tree
    """
    def __init__(self, A, dot, e):
        """
        Parameters
        ----------
        A : list
            対象の配列
        dot :
            Segment function
        e : int
            単位元
        """
        n = 2 ** (len(A) - 1).bit_length()
        self.__n = n
        self.__dot = dot
        self.__e = e
        self.__node = [e] * (2 * n)
        # for i in range(len(A)):
        #     self.__node[i + n] = A[i]
        # for i in range(n - 1, 0, -1):
        #     self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])
    
    def update(self, i, c):
        i += self.__n
        node = self.__node
        node[i] = c
        while i > 0:
            i //= 2
            node[i] = self.__dot(node[2 * i], node[2 * i + 1])

    def get(self, l, r):
        vl, vr = self.__e, self.__e
        l += self.__n
        r += self.__n
        while (l < r):
            if l & 1:
                vl = self.__dot(vl, self.__node[l])
                l += 1
            l //= 2
            if r & 1:
                r -= 1
                vr = self.__dot(vr, self.__node[r])
            r //= 2
        return self.__dot(vl, vr)


def solve():
    N = int(input())
    P = map(int, input().split())
    plist = []
    for i, p in enumerate(P):
        plist.append((p, i))
    plist.sort(reverse=True)

    maxSeg = SegmentTree([-1] * N, max, -1)
    minSeg = SegmentTree([N] * N, min, N)

    cnt = 0
    for p, c in plist:
        l2 = maxSeg.get(0, c)
        l1 = -1 if l2 <= 0 else maxSeg.get(0, l2)

        r1 = minSeg.get(c + 1, N)
        r2 = N if r1 >= N - 1 else minSeg.get(r1 + 1, N)

        a = (l2 - l1) * (r1 - c)
        b = (r2 - r1) * (c - l2)
        cnt += p * (a + b)

        maxSeg.update(c, c)
        minSeg.update(c, c)

    print(cnt)


solve()


Measured memory_bytes: 118284
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    vint a(N);
    REP(i,N) cin>>a[i];

    int cnt=0;
    REP(i,N){
        if(a[i]%2==1) cnt++;
    }
    cout<<(cnt%2==0? "YES":"NO")<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         998244353
#define mode        1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265358979323


void solve()
{
       ll n,a,b;
       cin>>n>>a>>b;
       ll mn=(n-1)*a+b,mx=(n-1)*b+a;
       ll ans=max(mx-mn+1,0LL);
       cout<<ans;
}


int main()
{
    speed_up
    ll T=1;
    //cin>>T;
    while(T--)
        solve();
    return 0;
}


Measured memory_bytes: 256
def calc(b,A,N):
    sadness = 0
    for i in range(N):
        sadness += abs(A[i] - (b + i))
    return sadness

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

k = []
for i in range(N):
    k.append(A[i] - i)

k = sorted(k)

sadness = 0
if N % 2 == 1:
    sadness = calc(k[N//2],A,N)
else:
    sadness = min(calc(k[N//2],A,N),calc(k[(N//2)+1],A,N))

print(sadness)


Measured memory_bytes: 26180
#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<int,int>;
const int INF = 1001001001;

int main(){ 
    int h,w;  
    cin >> h >> w;
    vector<vector<char>> s(h,vector<char>(w));
    rep(i,h) rep(j,w) cin >> s.at(i).at(j);
    int ans = 0;
    rep(i,h) rep(j,w) {
        if(s.at(i).at(j) == '#') continue;
        vector<vector<int>> dist(h,vector<int>(w,-1));
        dist.at(i).at(j) = 0;
        queue<P> q;
        q.push(make_pair(i,j));
        while(!q.empty()){
            auto x = q.front();q.pop();
            int ty = x.first,tx = x.second;
            if(ty > 0 && dist.at(ty-1).at(tx) == -1 && s.at(ty-1).at(tx) == '.'){
                dist.at(ty-1).at(tx) = dist.at(ty).at(tx) + 1;
                q.push(make_pair(ty-1,tx)); 
            }
            if(ty < (h - 1) && dist.at(ty+1).at(tx) == -1 && s.at(ty+1).at(tx) == '.'){
                dist.at(ty+1).at(tx) = dist.at(ty).at(tx) + 1;
                q.push(make_pair(ty+1,tx)); 
            }
            if(tx > 0 && dist.at(ty).at(tx-1) == -1 && s.at(ty).at(tx-1) == '.'){
                dist.at(ty).at(tx-1) = dist.at(ty).at(tx) + 1;
                q.push(make_pair(ty,tx-1)); 
            }
            if(tx < (w - 1) && dist.at(ty).at(tx+1) == -1 && s.at(ty).at(tx+1) == '.'){
                dist.at(ty).at(tx+1) = dist.at(ty).at(tx) + 1;
                q.push(make_pair(ty,tx+1)); 
            }
        }
        int t_ans = 0;
        rep(i,h) rep(j,w) t_ans = max(t_ans,dist.at(i).at(j));
        ans = max(t_ans,ans);
    }
    cout << ans << endl;

}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 510000;
const int MOD = 1000000007;

     signed main(){
             cout << std::setprecision(15) ;
         double l;
         cin>>l;
         cout<<(l*l*l)/27;
         
         
}

        


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
}init;

bool solve(int N, vector<int> S){
  sort(RALL(S));

  vector<bool> check(1<<N);
  vector<int> a = {S[0]};
  check[0] = true;

  REP(i,N){
    vector<int> temp;

    int j = 0;
    for(auto &x : a){

      while(check[j] or S[j] >= x){
        ++j;

        if(j >= (1<<N)) return false;
      }

      temp.push_back(S[j]);
      check[j] = true;
    }

    a.insert(a.end(), ALL(temp));
    sort(RALL(a));
  }

  return true; 
}


int main(){
  int N;
  while(cin >> N){
    vector<int> S(1<<N); cin >> S;
    bool ans = solve(N,S);

    cout << (ans ? "Yes" : "No") << endl;    
  }

  return 0;
}


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

int main()
{
    /*istringstream iss;

    string value = "32 40 50 30 60";
    int arr[5];
    iss.str (value); //what does this do???
    for (int i = 0; i < 5; i++)
    {
        int val;
        iss >> val;
        iss>>arr[i];


        cout << i << "-> " << val <<typeid(val).name()<<endl;
    }
    for(int i=0;i<5;i++){
        cout<<arr[i]<<" ";
    }*/
    int n,m,a,sum=0;
    cin>>n>>m;
    while(m--){

        cin>>a;
        sum+=a;
    }


    if(sum>n){
        cout<<-1<<endl;
    }
     else{
        cout<<n-sum<<endl;
    }

    return 0;
}


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

using namespace std;

int main(){
  int h1,h2,m1,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  
  int l = (h2*60+m2)-(h1*60+m1)-k;
  
  cout << l << endl;
  
  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false)
#define ll long long
ll a[400000],vs[2000000],d[4000000],ar[400000];
vector<ll> v[40];
queue<ll>q;

int main()
{
    IO;
    ll i, j, n, m,mm=1e6, k=1, t, ans=0,l=0, g, p;
    cin>>n>>p;
    for(i=1; i<=n; i++){
        cin>>a[i];
    }
    vs[1]=1; k=1; ar[0]=1;
    for(i=1; i<=n+1; i++){
        j=a[k]; //cout<<j<<endl;
        if(vs[j]==1) {
            l=d[k]+1-d[j];
            k=j; break;
        }
        else {
            d[j]=d[k]+1;
            vs[j]=1; ar[d[j]]=j;
        }
        k=j;
    }
    if(p<=d[k]) cout<<ar[p]<<endl;
    else {
            //cout<<d[k]<<' '<<p<<' '<<ar[2]<<endl;
        p-=d[k];
        l=p%l;
        k=d[k]+l; //cout<<k<<endl;
        cout<<ar[k]<<endl;
    }
    return 0;
}


Measured memory_bytes: 9768
[X,N] = [int(i) for i in input().split()]
if N == 0:
  print(X)
else:
  PA = [int(i) for i in input().split()]
  if not X in PA:
    print(X)
  else:
    i = 1  
    while True:
      [m,p] = [X-i,X+i]
      if not m in PA:
        print(m)
        break
      elif not p in PA:
        print(p) 
        break
      i += 1

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

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

int n,a,b;
bool memo[300001]={true};

signed main() {
    scanf("%d%d%d",&n,&a,&b);
    if (n > a*b || n < a+b-1) puts("-1");
    else {
        int now=b,cnt=n;
        while(1) {
            rep(i,b) {
                if (i==b-1) a--;
                cnt--;
                printf("%d ",now-i);
                memo[now-i] = true;
                if (a == cnt) {
                    rep(k,n+1) if (!memo[k]) printf("%d ",k);
                    return 0;
                }
            }
            now = min(n,now+b);
        }
    }
}


Measured memory_bytes: 2304
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n; cin >> n; int a[114514];
	for (int i = 0; i < n; i++)cin >> a[i];
	sort(a, a + n);
	int ans = 0;
	for (int i = n - 1; i >= 0; i -= 2) {
		ans += a[i];
		if (i >= 1)ans -= a[i - 1];
	}
	cout << ans << endl;
}

Measured memory_bytes: 888
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++) a[i] = sc.nextInt();
		long ans = 0;
		for(int i = 0 ; i < n - 1 ; i++) {
			if(a[i] + a[i + 1] > x) {
				ans += a[i] + a[i + 1] - x;
				if(x >= a[i]) {
					a[i + 1] = x - a[i];
				} else {
					a[i + 1] = 0;
					a[i] = x;
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 49856
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
const long long INF = 1LL<<60;

const int maxN = 110;
const int maxV = 100100;

int n;
long long w, weight[maxN], value[maxN];
long long dp[maxN][maxV];


int main() {
	
	cin >> n >> w;
	rep(i, n) cin >> weight[i] >> value[i];

	
	rep(i, maxN) rep(j, maxV) dp[i][j] = INF;

	dp[0][0] = 0;

	rep(i, n) rep(j, maxV) {
		if (j - value[i] >= 0) {
			dp[i+1][j] = min(dp[i+1][j], dp[i][j - value[i]] + weight[i]);

		} 
		dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
	}

	long long res = 0;
	rep(j, maxV) {
		if (dp[n][j] <= w) res = j;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 86272
N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(N)]

dp = [[0]*(W+1) for _ in range(N+1)]

for i in range(1,N+1):
    for j in range(W+1):
        
        if j < wv[i-1][0]:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j],dp[i-1][j-wv[i-1][0]] + wv[i-1][1])

print(dp[N][W])


Measured memory_bytes: 120172
// agrawal117
//chahatagrawal117 
#include<bits/stdc++.h>
#define mod 1000000007
#define endl '\n'
typedef  long long int ll ; 
using namespace std;
#define MAX 1002
ll n;
vector<string> ans;
void solve(int i,string s) 
{
    if(i==n+1)  { ans.push_back(s); return ; }
    int k=0;
    // if(s.size()==0) k=0;
    for(int j=0;j<s.size();j++) k=max(k,int (s[j]-'a'+1)) ;
    for(int j=0;j<=k;j++){
        s.push_back(char(j+'a'));
        solve(i+1,s);
        s.pop_back();
    }
    
}
int main()
{
   cin>>n;
//    null.push_back("");
//    vector<string> ans=solve(0,n);
string s;
solve(1,s);
   sort(ans.begin(),ans.end());
   for(int i=0;i<ans.size();i++) cout<<ans[i]<<endl;
//    cout<<ans.size()<<endl;

}

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

using namespace std;

int y, z , e;

int main()
{
	cin >> e;
	while (e != 0) {
		y = z = 0;
		int mi = 100000000;
		
		for (; z * z * z <= e; z++) {
			for (y = 0; z * z * z + y * y <= e; y++) {
				mi = min(mi, z + y + (e - z * z * z - y * y));
			}
		}
		cout << mi << endl;
		cin >> e;
	}
	return 0;
}



Measured memory_bytes: 3068
N = int(input())

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x,y))
    
from collections import defaultdict

dd = defaultdict(lambda:defaultdict(bool))

X = sorted(XY)

for x,y in XY:
    dd[x][y] = True

max_count = 0
for i, (x0, y0) in enumerate(X):
    for x1, y1 in X[i+1:]:
        diff_x, diff_y = (x1-x0, y1-y0)
        counter = 0
        for x, y in X:
            if dd[x+diff_x][y+diff_y]:
                counter += 1
        max_count = max(max_count, counter)
#print(max_count)

ans = N - max_count
print(ans)
        

Measured memory_bytes: 59356
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
#define mx 10000000000008
#define mod 1000000007
ll n,m,i,j,k,l,t,arr[sz],brr[sz],crr[sz];
vector<ll>v[sz];
void bfs(ll node,ll par)
{
    for(int ii=0;ii<v[node].size();ii++)
    {
        ll x=v[node][ii];
        if(arr[x]==1 || x==par)
            continue;
        arr[x]=1;
        m++;
        bfs(x,node);
    }
    return;
}
int main()
{
     t=1;
  //  scanf("%lld",&t);
    while(t--)
    {
     scanf("%lld %lld",&n,&m);
     for(i=0;i<m;i++)
     {
         scanf("%lld %lld",&j,&k);
         v[j].push_back(k);
         v[k].push_back(j);
     }
     for(i=1;i<=n;i++)
     {
         if(arr[i]==0)
         {
             m=1;
             arr[i]=1;
             bfs(i,-1);
             l=max(l,m);
         }
     }
     printf("%lld\n",l);
    }
    return 0;
}


Measured memory_bytes: 25684
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      ans+=[0,1][500*i+100*j+50*k==x]
print(ans)

Measured memory_bytes: 3060
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output


def chkprint(*args):
    names = {id(v): k for k, v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args))

# Binary converter


def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]

# --------------------------------------------


dp = None


def main():
    A, B, K = li_input()

    C = []

    for i in range(A, min(A + K, B+1)):
        C.append(i)

    for i in range(max(A, B - K + 1), B + 1):
        if i not in C:
            C.append(i)

    for c in C:
        print(c)


main()


Measured memory_bytes: 4628
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, [ $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, usize1) => {
        read_value!($next, usize) - 1
    };

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

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        c: usize,
        v: [(usize, usize, usize1); n]
    }
    let mut p = vec![vec![]; c];
    for &(s, t, ch) in &v {
        p[ch].push((s, t));
    }
    let mut q = vec![];
    for i in 0..c {
        if p[i].len() == 0 {
            continue;
        }
        p[i].sort_by_key(|x| x.0);
        q.push((p[i][0].0, 1));
        for j in 0..p[i].len() - 1 {
            if p[i][j].1 != p[i][j + 1].0 {
                q.push((p[i][j].1, 0));
                q.push((p[i][j + 1].0, 1));
            }
        }
        q.push((p[i][p[i].len() - 1].1, 0));
    }
    q.sort_by(|x, y| if x.0 == y.0 { y.1.cmp(&x.1) } else { x.0.cmp(&y.0) });
    let mut rec = 0;
    let mut ans = 0;
    for &(_, f) in &q {
        if f == 1 {
            rec += 1;
            ans = max(ans, rec);
        } else {
            rec -= 1;
        }
    }
    println!("{}", ans);
}


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

long long a, b, c, d, e, f, g;

int main() {
  cin >> a >> b >> c >> d >> e >> f;
  long long res = b;
  for (int i = 0; i <= min({a, d, e, 4LL}); ++i)
    res = max(res, 3 * i + 2 * ((a - i) / 2 + (d - i) / 2 + (e - i) / 2) + b);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define INF 100000001

int table[101][101];
int r[101];

int MatrixChainMp(int a, int b){
  int min = INF, min2;
  int k;
  for(k = a; k <= b - 1; k++){
    min2 = table[a][k] + table[k+1][b] + r[a-1]*r[k]*r[b];
    if(min2 < min)
      min = min2;
  }
  return min;
}

int main(){
  int i, j, l, n;

  scanf("%d", &n);
  if(n >= 1 && n <= 100){
    for(i = 1; i <= n; i++){
      scanf("%d %d", &r[i-1], &r[i]);
    }

    for(i = 1; i <= n; i++) table[i][i] = 0;

    for(j = 2; j <= n; j++){
      for(i = 1; i <= n - j + 1; i++){
	l = i + j - 1;
	table[i][l] = MatrixChainMp(i, l);
      }
    }
    printf("%d\n", table[1][n]);
  }
  return 0;
}



Measured memory_bytes: 2052