akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

struct point{
  ll x,y;  
  point operator + (const point &p)const{
    return (point){x+p.x,y+p.y};
  }
  point operator - (const point &p)const{
    return (point){x-p.x,y-p.y};
  }
  point operator * (const ll r)const{
    return (point){x*r,y*r};
  }
  bool operator < (const point &p)const{
    return (y==p.y?x<p.x:y<p.y);
  }
};

ll dot(point a,point b){
  return a.x*b.x+a.y*b.y;
}
ll norm(point a){
  return dot(a,a);
}
ll cross(point a,point b){
  return a.x*b.y-b.x*a.y;
}
ll myabs(ll a){return (a<0?-a:a);}
ll n;
point t[40];
ll dp[40][40][40][41];
ll pre[40][40][40][41];

int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>t[i].x>>t[i].y;
  memset(dp,-1,sizeof(dp));
  
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j)continue;
      if(t[j].y<t[i].y)continue;
      dp[i][i][j][2]=0;
    }
  }
  
  for(int si=0;si<n;si++){
    for(int k=2;k+1<=n;k++){
      for(int i=0;i<n;i++){
        if(t[i].y<t[si].y)continue;
        for(int j=0;j<n;j++){
          if(t[j].y<t[si].y)continue;
                    
          if(dp[si][i][j][k]==-1)continue;
            
          for(int to=0;to<n;to++){
            if(t[to].y<t[si].y)continue;
            if(cross(t[j]-t[i],t[to]-t[j])<=0)continue;
            
            ll cost = dp[si][i][j][k];
            ll addcost = cross(t[j]-t[si],t[to]-t[si]);


            
            if(addcost<=0)continue;
            cost+=addcost;
            if(dp[si][j][to][k+1]==-1 ||  cost < dp[si][j][to][k+1] ){
              dp[si][j][to][k+1]=cost;
              
              pre[si][j][to][k+1]=i;
            }
          }
        }
      }
    }
  }

  int q,a;
  cin>>q;
  while(q--){
    cin>>a;
    int I,J,K;
    ll mini=1e9;
    point g;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        for(int k=0;k<n;k++){
          if(dp[i][j][k][a]==-1)continue;
          if(dp[i][j][k][a]>mini)continue;
          if(dp[i][j][k][a]==mini&&g<t[i])continue;

          g=t[i];
          mini=dp[i][j][k][a];
          I=i,J=j,K=k;

        }
      }
    }
    if(mini==1e9){
      cout<<"NA"<<endl;
      continue;
    }
    vector<int> ans;
    for(int i=0;i<a-1;i++){
      ans.push_back(K);
      I=I;
      int tmp=pre[I][J][K][a-i];
      K=J;
      J=tmp;
    }
    ans.push_back(I);
    reverse(ans.begin(),ans.end());
    for(int i=0;i<(int)ans.size();i++){
      if(i)cout<<' ';
      cout<<ans[i]+1;
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 41484
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

using ll = long long;
using namespace std;
ll mod = 1e9 + 7;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> dp(N + 2);
    vector<int> A(M);
    int pre = 0;
    bool flag = false;
    REP(i, M) {
        cin >> A[i];
    }

    dp[N + 1] = 0;
    dp[N] = 1;

    int index = M - 1;
    for (int i = N - 1; i >= 0; i--) {
        if (index >= 0 && A[index] == i) {
            dp[i] = 0;
            index--;
        }
        else {
            dp[i] = dp[i + 1] + dp[i + 2];
        }
        dp[i] %= mod;
    }

    cout << dp[0] << endl;
    return 0;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  long a[N];
  long sum = 0;
  long rsum = 0;

  for (int i = 0; i < N; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  long r = 0;

  for (int j = 0; j < N - 1; ++j) {
    rsum += a[j];
    sum -= a[j];
    if (j == 0) {
      r = abs(sum - rsum);
    } else {
      r = min(r, abs(sum - rsum));
    }
    // cout << sum << " " << rsum << endl;
  }

  cout << r;
  return 0;
}


Measured memory_bytes: 1792
#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>;

int main() {
  ll N,K;
  cin >> N >> K;
  N -= K*(N/K);
  cout << min(N,-(N-K)) << endl;
  return 0;
}

Measured memory_bytes: 256
// In The Name Of God
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define sqr(A) ((A) * (A))
#define X first
#define Y second
#define MP make_pair
#define bsz  __builtin_popcount
#define all(A) A.begin(), A.end()
using namespace std;
using namespace __gnu_pbds;
template < typename T >
using ordered_set = tree < T , null_type , less < T > , rb_tree_tag , tree_order_statistics_node_update >;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
const int MOD2 = 1e9 + 9;
const int PR = 727;
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;

const int N = 1e2 + 20;
const int M = 1e5 + 20;
ll dp[2][M], w[N], v[N], n, W;

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	memset(dp, 31, sizeof dp);
	cin >> n >> W;
	for (int i = 0; i < n; i++)
		cin >> w[i] >> v[i];
	dp[0][0] = 0;
	dp[0][v[0]] = w[0];
	for (int i = 1; i < n; i++) {
		dp[i % 2][0] = 0;
		for (int j = 1; j < M; j++) {
			dp[i % 2][j] = dp[1 - (i % 2)][j];
			if (v[i] <= j)
				dp[i % 2][j] = min(dp[i % 2][j], dp[1 - (i % 2)][j - v[i]] + w[i]);
		}
	}
	for (int i = M - 1; i >= 0; i--)
		if (dp[1 - (n % 2)][i] <= W)
			return cout << i << endl, 0;
}



Measured memory_bytes: 1792
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      ArrayList<String> s = nextCharArray();
      int output = 0;
      String t = "";
      for(int i = 0; i < s.size(); i++){
        t = s.get(i) + t;
      }
      for(int i = 0; i < s.size(); i++){
        output += (!s.get(i).equals(t.substring(i, i + 1))) ? 1 : 0;
      }
      myout(output / 2);
	}
	//Method addition frame start

  

	//Method addition frame end
}


Measured memory_bytes: 37744
import java.util.Scanner;
 
public class Main{
	static int M = 1000000007;
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		long ans=0,pre1=2,pre2=1;
		for(int i=2;i<=num;i++) {
			long xy=pre1+pre2;
			pre1= pre2;
			pre2=xy;
			ans=xy;
		}
		System.out.println(num==0?(2):(num==1)?1:ans);
	}
}

Measured memory_bytes: 23892
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N, K;
	cin >> N >> K;
	cout << K * (int)pow(K - 1, N - 1) << endl;

	return 0;
}

Measured memory_bytes: 384
// V solo
#include <bits/stdc++.h>

#define forn(i, a, b) for (int i = a; i <= b; ++i)
#define forr(i, a, b) for (int i = a; i >= b; --i)

using namespace std;

const int N = (int)2e5 + 7;
const int INF = 1e9 + 7;

typedef long long ll;
typedef long double ld;

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

int n, m;
vector < int > v;
map < int, int > cnt;
int main (){
  scanf ("%d %d", &n, &m);
  forn (i, 1, m){
    int x, y;
    scanf ("%d %d", &x, &y);
    if (y == n) v.push_back(x);
    else if (x == 1) cnt[y] = 1;
  }
  forn (i, 0, (int)v.size() - 1){
    if (cnt[v[i]]) return printf ("POSSIBLE\n"), 0;
  }
  printf ("IMPOSSIBLE\n");
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i,n) cin >> s.at(i);
    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

int n;
ll A, B;
vector<ll> h;

bool check(ll k){
    ll cnt=0;
    rep(i, n){
        if(h[i]-k*B <= 0) continue;
        
        cnt += (h[i]-k*B + (A-B-1)) / (A-B);
    }
    if(cnt<=k) return true;
    else return false;
}

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

    cin >> n;
    cin >> A >> B;
    h.assign(n, 0);
    rep(i, n) cin >> h[i];

    int left=0, right=1e9;
    int mid;
    while(right-left > 1){
        mid = (left+right)/2;
        if(check(mid)) right=mid;
        else left=mid;
    }

    cout << right << '\n';


    return 0;
}


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

int main()
{

  int n,k;
  int r,s,p;
  string t;
  int ans = 0;
  int i;
  int flg[100005] = {};

  cin >> n >> k;
  cin >> r >> s >> p;
  cin >> t;

  for(i=0; i<k; i++){

    if(t[i] == 'r'){
      
      ans += p;
      flg[i] = 1;

    } else if(t[i] == 's'){

      ans += r;
      flg[i] = 1;
    
    } else if(t[i] == 'p'){

      ans += s;
      flg[i] = 1;
    
    }
  
  }

  for(; i<n; i++){

    if(t[i] != t[i-k]){
      
      if(t[i] == 'r'){
      
	ans += p;
	flg[i] = 1;

      } else if(t[i] == 's'){

	ans += r;
	flg[i] = 1;
    
      } else if(t[i] == 'p'){
	
	ans += s;
	flg[i] = 1;
	
      }

    } else {

      if(flg[i-k] == 0){

	if(t[i] == 'r'){
      
	  ans += p;
	  flg[i] = 1;

	} else if(t[i] == 's'){

	  ans += r;
	  flg[i] = 1;
    
	} else if(t[i] == 'p'){

	  ans += s;
	  flg[i] = 1;
	
	}
	
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;

}


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

int main(){

  int MAX_N = 200002;
  int n;
  long long k;
  cin >> n >> k;

  vector<pair<int,long long>> count(MAX_N,pair<int,long long>(0,0));
  vector<int> move(n);
  for(int i=0;i<n;i++){
    int to;
    cin >> to;to--;
    move[i] = to;
  }

  bool flag = 0;
  long long repCount = 0;

  int now=0;
  while(k>0){
    count[now].first++;
    if(count[now].first==1)count[now].second = k;
    if(count[now].first==2 && flag==0){
      flag=1;
      repCount=count[now].second - k;
      k = k%repCount;
      for(int i=0;i<k;i++){
        now=move[now];
      }
      cout << now+1 << endl;
      break;
    }


    k--;
    now=move[now];
    if(k==0)cout << now+1 << endl;
  }

}

Measured memory_bytes: 7220
import java.math.BigInteger;
import java.util.Scanner;

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

	private void solveC() {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] a = new long[N];
		BigInteger sum = BigInteger.ZERO;
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextLong();
			sum = sum.add(BigInteger.valueOf(a[i]));
		}
		sum = sum.subtract(BigInteger.valueOf(a[0]));
		BigInteger sum2 = BigInteger.valueOf(a[0]);
		BigInteger min = sum.subtract(sum2).abs();
		for (int i = 1; i < N - 1; i++) {
			BigInteger val = BigInteger.valueOf(a[i]);
			sum = sum.subtract(val);
			sum2 = sum2.add(val);
			BigInteger abs = sum.subtract(sum2).abs();
			if (abs.compareTo(min) < 0) {
				min = abs;
			}
		}
		System.out.println(min);
	}
}

Measured memory_bytes: 94468
#ifndef _TEMPLATE_ROOT
#define _TEMPLATE_ROOT
#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
#define repd(i, a, b) for(int i = b; i >= (a); --i)
#define repdl(i, a, b) for(ll i = b; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool ihmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
#endif
#ifndef _TEMPLATE_IO
#define _TEMPLATE_IO

template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
#endif
#ifndef _TEMPLATE_OPT
#define _TEMPLATE_OPT
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#endif
using namespace std;

int a[500005];

struct Query {
  int l, r, id, ans;
};

// freqcnt
int freq[500005];
int distinct = 0;
void freqadd(int x) { 
//write("FA", x, freq[x], "->", freq[x]+1);
  if (!freq[x]) distinct++; freq[x]++; }
void freqrem(int x) { 
  
//write("FR", x, freq[x], "->", freq[x]-1);
  freq[x]--; if (!freq[x]) distinct--; }
Query query[500005];

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

  int n, q; read(n, q);
  rep(i, 1, n + 1) read(a[i]);
  rep(i, 0, q) read(query[i].l, query[i].r), query[i].id = i;
  
  const int BS = 700;
  sort(query, query + q, [](const Query& a, const Query& b) {
    if (a.l / BS != b.l / BS) return a.l / BS < b.l / BS;
    else return a.r < b.r;
    });

  // inclusive [cl, cr]
  int cl = 1, cr = 0;
  rep(i, 0, q) {
    int nl = query[i].l, nr = query[i].r;
    while (cl > nl) freqadd(a[--cl]);
    while (cr < nr) freqadd(a[++cr]);
    while (cl < nl) freqrem(a[cl++]);
    while (cr > nr) freqrem(a[cr--]);
    query[i].ans = distinct;
  }

  sort(query, query + q, [](const Query& a, const Query& b) { return a.id < b.id; });
  rep(i, 0, q) write(query[i].ans);
}



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

int main() {
    int N; cin >> N;
    string S; cin >> S;
    int res = 0;
    for(int i=0; i+2<N; ++i) {
        if(S.substr(i, 3) == "ABC") ++res;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
import scala.io.StdIn._

object Main extends App {


  val Array(n, k) = readLine().split(" ").map(_.toInt)

  def solve(): Int = {
    var digit = 0
    var num = n
    while(num > 0) {
      num /= k
      digit += 1
    }
    digit
  }

  println(solve())

}



Measured memory_bytes: 54644
def comb(n, m)
  return 0 if m > n
  return 1 if [0, n].include?(m)
  nm = n - m
  (1..m).reduce(1) { |a, e| a * (nm + e) / e }
end

N, A, B = gets.split.map(&:to_i)
vs = gets.split.map(&:to_i)

vs = vs.sort.reverse

avg = vs[0...A].reduce(&:+).to_f / A

x = vs[A - 1]
s = vs.index(x)
t = vs.rindex(x)
n = t - s + 1

pat = 0
if vs[0] == x
  (A - s).upto(B - s) do |i|
    pat += comb(n, i)
  end
else
  pat = comb(n, A - s)
end

puts format('%.10f',avg)
puts pat


Measured memory_bytes: 1788
Module P1
Sub main()

    Dim RD As String
    Dim SD() As String
    
    Dim AB As Long
    Dim BC As Long
    Dim ans As Long
    
    
    RD = Console.Readline()
    SD = Split(RD, " ")
    
    AB = SD(0)
    BC = SD(1)
    
    ans = AB * BC / 2
    
    Console.Writeline (ans)


End Sub

end Module


Measured memory_bytes: 13536
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

	static class ProblemC {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			char[] s = in.next().toCharArray();
			int k = in.nextInt();
			for (int i = 0; i < s.length; i++) {
				if (s[i] == 'a') {
					continue;
				}
				int need = 'z' - s[i] + 1;
				if (k >= need) {
					k -= need;
					s[i] = 'a';
				}
			}
			s[s.length - 1] = (char) ((((s[s.length - 1] - 'a') + k) % 26) + 'a');
			out.println(new String(s));
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}



Measured memory_bytes: 11476
#include<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (LL i=a;i<=b;i++)
#define FORD(i,a,b) for (LL i=a;i>=b;i--)
using namespace std;
typedef pair<int,int> pa;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int n;
int main(){
	scanf("%d",&n);
	FOR(i,1,3500)
		FOR(j,1,3500){
			LL x=(LL)n*i*j;
			LL y=(LL)i*j*4-n*j-n*i;
			if (y==0) continue;
			if (x%y!=0) continue;
			x/=y;
			if (x<1) continue;
			printf("%d %d %lld\n",i,j,x);
			return 0;
		}
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string A;
  cin >> A;
  int ans = 700;
  for (int i = 0; i < 3; i++) {
    if (A[i] == 'o') {
      ans += 100;
    }
  }
  cout << ans << endl;
}

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

int main() {

long long i,j,k,n,m,l;

cin >> n >> m >> l;

vector<vector<long long> > a(n,vector<long long>(m));
vector<vector<long long> > b(m,vector<long long>(l));
vector<vector<long long> > c(n,vector<long long>(l));

for(i=0;i<=n-1;++i){
for(j=0;j<=m-1;++j){
cin >> a.at(i).at(j);
}
}

for(j=0;j<=m-1;++j){
for(k=0;k<=l-1;++k){
cin >> b.at(j).at(k);
}
}

for(i=0;i<=n-1;++i){
for(k=0;k<=l-1;++k){

for(j=0;j<=m-1;++j){
c.at(i).at(k)+=a.at(i).at(j)*b.at(j).at(k);
}
if(k<l-1){
cout << c.at(i).at(k) << " ";
}else{
cout << c.at(i).at(k) << endl;
}

}
}

}


Measured memory_bytes: 3268
N = input()

if N[len(N)-1] == "2" or N[len(N)-1] == "4" or N[len(N)-1] == "5" or N[len(N)-1] == "7" or N[len(N)-1] == "9":
    print("hon")
elif N[len(N)-1] == "0"or N[len(N)-1] == "1" or N[len(N)-1] == "6" or N[len(N)-1] == "8":
    print("pon")
elif N[len(N)-1] == "3":
    print("bon")
else:
    print("hon")

Measured memory_bytes: 9144
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = x * a[i] // gcd(x, a[i])
    return x


a = list(map(int, input().split()))
print(lcm(a))


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()

int main(){
    ll n,h;cin>>n>>h;
    vector<ll> b(n);
    ll a_max=0;
    ll temp;
    rep(i,n){
      cin>>temp;
      a_max=max(a_max,temp);
      cin>>temp;
      b[i]-=temp;
    }
    sort(all(b));
    ll ans=ceil(double(1.0*h/a_max));
    rep(i,n){
      if(a_max<-1*b[i]){
        h+=b[i];
        if(h<0){
          ans=min(ans,ll(i+1));
          break;
        }else{
          ans=min(ans,ll(i+1+ceil(double(1.0*h/a_max))));
        }
      }else{
        break;
      }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int s,w;cin >> s >> w;
    if(w>=s){
        cout << "unsafe" << endl;
    }
    else{
        cout << "safe" << endl;
    }
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <set>

using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::set;

bool intension(set<int> s1, set<int> s2) {
	if (s1.size() < s2.size()) {
		return false;
	}

	for (set<int>::iterator itr = s2.begin(); itr != s2.end(); ++itr) {
		if ((s1.find(*itr)) == s1.end()) {
			return false;
		}
	}
	return true;
}

int main(void) {
	int N;
	cin >> N;

	while (N != 0) {
		vector< set<int> > data(N+1);
		int cri = -1;
		int count = 0;
		int temp;
		int M;
		for (int i = 0; i < N+1; i++) {
			cin >> M;
			for (int j = 0; j < M; j++) { 
				cin >> temp;
				data[i].insert(temp);
			}
			
		}

		for (int i = 0; i < N; i++) {
			if (count < 2) {
				if (intension(data[i], data[N])) {
					cri = i+1;
					count++;
				}
			}
		}
		if (count > 1) {
			cout << -1 << endl;
		}
		else {
			cout << cri << endl;
		}

		cin >> N;
	}

	return 0;
}

Measured memory_bytes: 3480
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

#define INF 1001;

int dis(string a, string b);

int main(void)
{
  string S,T,slocal;
  int ans = INF;
  cin >> S >> T;
  int N = S.size() - T.size() + 1;
  int tlen = T.size();

  int dislocal;
  for(int i = 0; i < N;i++)
  {
    slocal = S.substr(i,tlen);
    dislocal = dis(T,slocal);
    if(dislocal < ans) ans = dislocal;
  }
  cout << ans << endl;
  // cout << T << endl;

  return 0;
}

int dis(string a, string b)
{
  int N = a.size();
  int dis = 0;
  for(int i=0;i<N;i++)
  {
    if (a[i] != b[i]) dis++;
  }
  return dis;
}


Measured memory_bytes: 3604
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define mod 1000000007 //1e9+7
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  i,j,n,k,cnt=0;
    string s;
    cin>>n>>k;
    if(k==1)
        cout<<0<<endl;
    else
        cout<<max(0LL,n-k)<<endl;
    return 0;
}


Measured memory_bytes: 3612
#include<stdio.h>
#include<string.h>
int main(){
int a=0,b=0,c=0,d=0,e;
char f[3];
while(scanf("%d,%s\n",&e,f)!=EOF){
if(strcmp(f,"A")==0){
a++;
}
else if(strcmp(f,"B")==0){
b++;
}
else if(strcmp(f,"AB")==0){
c++;
}
else{
d++;
}
}
printf("%d\n%d\n%d\n%d\n",a,b,c,d);
return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> vi;

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

	int a, b, c; cin >> a >> b >> c;
	if((a+b+c)%17 == 0) {
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;
	
	return 0;
}


Measured memory_bytes: 3512
using System;

namespace ABC068
{
    class B
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            double res = 0;
            int i = 0;
            while (res <= N)
            {
                res = Math.Pow(2, i);
                i++;
            }
            Console.WriteLine(res / 2);
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const ld PI=M_PI;

int main(){
    int N; cin>>N;
    vector<pair<ld,int>> arg;
    vector<ld> x(N),y(N);
    rep(i,N){
        cin>>x[i]>>y[i];
        arg.pb({atan2(y[i],x[i]),i});
        arg.pb({atan2(y[i],x[i])+2.0*PI,i});
    }
    sort(all(arg));
    vector<ld> Theta(2*N),Sx(2*N+1),Sy(2*N+1); Sx[0]=Sy[0]=0.0;
    rep(i,2*N){
        Theta[i]=arg[i].st;
        Sx[i+1]=Sx[i]+x[arg[i].nd];
        Sy[i+1]=Sy[i]+y[arg[i].nd];
    }
    ld ans=0.0;
    rep(i,N){
        FOR(j,i,i+N){
            ans=max(ans,(ld)sqrt((Sx[j+1]-Sx[i])*(Sx[j+1]-Sx[i])+(Sy[j+1]-Sy[i])*(Sy[j+1]-Sy[i])));
        }
    }
    printf("%.15Lf\n",ans);
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
  int i,j,k,l,n,minj,flag=0;
  char *num[36],*out1[36],*out2[36],*temp;
  char str[3];
  
  scanf("%d",&n);

  for(i=0;i<n;i++)
    {
      scanf("%s",str);
      num[i]=(char *)malloc(sizeof(char)*(2+1));
      out1[i]=(char *)malloc(sizeof(char)*(2+1));
      out2[i]=(char *)malloc(sizeof(char)*(2+1));
      strcpy(out1[i],str);
      strcpy(out2[i],str);
      strcpy(num[i],str);
      
    }
  
  for(i=0;i<n;i++)
    {
      for(j=n-1;j>i;j--)
	{
	  if(out1[j][1] < out1[j-1][1])
	    {
	      temp=out1[j];
	      out1[j]=out1[j-1];
	      out1[j-1]=temp;
	    }
	}
    }
  
  for(i=0;i<n;i++)
    {
      if(i == n-1)
	{
	  printf("%s\n",out1[i]);
	}
      else
	{
	  printf("%s ",out1[i]);
	}
    }
  
  for(i=0;i<n;i++)
    {
      for(j=i+1;j<n;j++)
	{
	  for(k=0;k<n;k++)
	    {
	      for(l=k+1;l<n;l++)
		{
		  if(num[i][1] == num[j][1] && strcmp(num[i],out1[l]) == 0 && strcmp(num[j],out1[k]) == 0)
		    {
		      flag=1;
		    }
		}
	    }
	}
    }
  
  if(flag == 0)
    {
      printf("Stable\n");
    }
  else
    {
     printf("Not stable\n");
    }
  
  flag=0;
  
  for(i=0;i<n;i++)
    {
      minj=i;
      for(j=i;j<n;j++)
	{
	  if(out2[j][1] < out2[minj][1])
	    {
	      minj=j;
	    }
	}
      temp=out2[i];
      out2[i]=out2[minj];
      out2[minj]=temp;
    }
  
  for(i=0;i<n;i++)
    {
      if(i == n-1)
	{
	  printf("%s\n",out2[i]);
	}
      else
	{
	  printf("%s ",out2[i]);
	}
    }
  
  for(i=0;i<n;i++)
    {
      for(j=i+1;j<n;j++)
	{
	  for(k=0;k<n;k++)
	    {
	      for(l=k+1;l<n;l++)
		{
		  if(num[i][1] == num[j][1] && strcmp(num[i],out2[l]) == 0 && strcmp(num[j],out2[k])  ==0)
		    {
		      flag=1;
		    }
		}
	    }
	}
    }
  
  if(flag==0)
       {
	 printf("Stable\n");
       }
  else
    {
     printf("Not stable\n");
    }
  
  
  return 0;
}

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

int main() {
  string s;
  cin >> s;
  map<char, int> mp;
  for (char c : s) {
    mp[c]++;
  }
  bool ok = true;
  for (auto x : mp) {
    if (x.second >= 2) {
      ok = false;
    }
  }
  cout << (ok ? "yes" : "no") << endl;
  return 0;
}


Measured memory_bytes: 3616
'use strict'

function main(s) {
  s = s.split('\n');

  const R = Number(s[0].split(' ')[0]);
  const C = Number(s[0].split(' ')[1]);

  const sr = 0;
  const sc = 0;

  const gr = R - 1;
  const gc = C - 1;

  const table = s.slice(1, -1).map(l => l.split(''));
  const min = [...Array(R)].map(l => [...Array(C)].fill('*'));

  const dr = [0, 1, 0, -1];
  const dc = [1, 0, -1, 0];

  const bfs = () => {
    const que = [];

    que.push([sr, sc]);
    min[sr][sc] = 1;

    while (que.length > 0) {
      const p = que.shift();

      if (p[0] === gr && p[1] === gc) break;

      for (let i = 0; i < 4; i++) {
        const nr = p[0] + dr[i];
        const nc = p[1] + dc[i];

        if (nr < 0 || R <= nr) continue;
        if (nc < 0 || C <= nc) continue;
        if (table[nr][nc] === '#') continue;
        if (min[nr][nc] !== '*') continue;

        que.push([nr, nc]);
        min[nr][nc] = min[p[0]][p[1]] + 1;
      }
    }

    return min[gr][gc];
  }

  const countBlank = () => {
    return table.map(l => l.filter(c => c === '.').length).reduce((a, b) => a + b);
  }

  let ans = 0;
  const shortest = bfs();

  if (shortest === '*') {
    ans = -1;
  } else {
    ans = countBlank() - shortest;
  }

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7728
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M,mod=1000000007;
  cin >> N >> M;
  vector<bool> A(N+1,false);//trueは壊れている
  for(int i=0;i<M;i++){
    int B;
    cin >> B;
    A.at(B)=true;
  }
  vector<int> dp(N+1);
  dp.at(0)=1;
  for(int i=0;i<N;i++){
    if(!A.at(i+1)){
      dp.at(i+1)+=dp.at(i);
      dp.at(i+1)%=mod;
    }
    if(i!=N-1 && !A.at(i+2)){
      dp.at(i+2)+=dp.at(i);
      dp.at(i+2)%=mod;
    }
  }
  cout << dp.at(N) << endl;
}

Measured memory_bytes: 3768
#include <iostream>
#include <algorithm>
#include <vector>
#include <bitset>

using namespace std;

int n, m;

int main()
{
    cin >> n >> m;
    int k[m], p[m];
    vector<vector<int>> s(m);
    for (int i = 0; i < m; i++)
    {
        cin >> k[i];
        s[i].resize(k[i]);
        for (int j = 0; j < k[i]; j++)
        {
            int c;
            cin >> c;
            s[i][j] = c - 1;
        }
    }
    for (int i = 0; i < m; i++)
    {
        cin >> p[i];
    }
    int ans = 0;
    for (int bit = 0; bit < (1 << n); bit++)
    {
        int lightCnt = 0;
        for (int i = 0; i < m; i++)
        {
            int on = 0;
            for (int j = 0; j < k[i]; j++)
            {
                if (bit & (1 << s[i][j]))
                {
                    on++;
                }
            }
            if (on % 2 == p[i])
            {
                lightCnt++;
            }
        }
        if (lightCnt == m)
        {
            ans++;
        }
    }
    cout << ans << endl;
}


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

#include <iostream>
#include <fstream>

#include <iostream>
#include <vector>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
#include <cstring>

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

const int MOD = 1e9+7;

const int N = 3010;
ll g[N][N];
ll dp[N][N][5];

class EPickingGoods {
public:
    void solve(std::istream& in, std::ostream& out) {
        int R, C, k;
        in >> R >> C >> k;

        while(k--)
        {
            int x, y, v;
            in >> x >> y >> v;
            g[x][y] = v;
        }

        // dp[1][1] = g[1][1];
//        for(int j = 2; j <= C; ++j)
//            dp[1][j] = dp[1][j-1] + g[1][j];
//        for(int i = 2; i <= R; ++i)
//            dp[i][1] = dp[i-1][1] + g[i][1];
        for(int i = 1; i <= R; ++i)
            for(int j = 1; j <= C; ++j)
                for(int k = 1; k <= 3; ++k)
                {
                    ll max_prev = max(max(dp[i-1][j][1], dp[i-1][j][2]), dp[i-1][j][3]);
                    dp[i][j][k] = max(max(max(dp[i-1][j][k-1], dp[i][j-1][k-1]) + g[i][j], max_prev+g[i][j]), dp[i][j-1][k]);

                    //cout << i << " " << j << " " << k << " " << dp[i][j][k] << endl;
                }

        out << max(max(dp[R][C][1], dp[R][C][2]), dp[R][C][3]) << endl;



    }
};


int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    EPickingGoods solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 426808
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define int long long
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
int cev;
//~ map<int,int> vis;
string s;
vector<int> v;

inline bool asalmi(int n){
	for(int i=2;i*i<=n;i++){
		if(n%i==0)return 0;
	}
	return 1;
}

main(void){
	scanf("%lld %lld",&n,&m);
	n=__gcd(n,m);
	for(int i=1;i*i<=n;i++){
		if(n%i==0 && n/i==i){
			v.pb(i);
		}
		else if(n%i==0){
			v.pb(n/i);
			v.pb(i);
		}
	}
	//~ sort(v.begin(),v.end());
	for(int i=0;i<(int)v.size();i++){
		//~ if(vis[v[i]]==1)continue;
		if(v[i]==1){cev++;continue;}
		if(asalmi(v[i])==0)continue;
		cev++;
	}
	printf("%lld\n",cev);
	return 0;
}


Measured memory_bytes: 384
#![allow(unused_mut, non_snake_case, unused_macros,unused_imports)]
use std::cmp::{max, min, Ordering};
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque};
use std::iter::FromIterator;

//　高速 EOF要
//macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();input_inner!{iter, $($r)*}};($($r:tt)*) => {let mut s = {use std::io::Read;let mut s = String::new();std::io::stdin().read_to_string(&mut s).unwrap();s};let mut iter = s.split_whitespace();input_inner!{iter, $($r)*}};}
//macro_rules! input_inner {($iter:expr) => {};($iter:expr, ) => {};($iter:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($iter, $t);input_inner!{$iter $($r)*}};}
//macro_rules! read_value {($iter:expr, ( $($t:tt),* )) => {( $(read_value!($iter, $t)),* )};($iter:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()};($iter:expr, chars) => {read_value!($iter, String).chars().collect::<Vec<char>>()};($iter:expr, usize1) => {read_value!($iter, usize) - 1};($iter:expr, $t:ty) => {$iter.next().unwrap().parse::<$t>().expect("Parse error")};}
// 低速 EOF不要
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)*}};}
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")};}

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

fn main(){
    input!(A:usize,B:usize);
    println!("{}",if A == 2 || B == 2 {"No"} else {"Yes"});
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll X, Y;
    ll count = 0;
    cin >> X >> Y;
    while(X < Y) {
        X *= 2;
        count++;
    }
    if(X == Y) count++;
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x:x[1])
t = 0
for i in range(N):
  t += AB[i][0]
  if t > AB[i][1]:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 55264
#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 = 1e9;
const int MOD = 1000000007;

ll power(int i,int j){
    ll res = 1;
    rep(k,j) res *= i;
    return res;
}

int main(){
    int n,p;
    cin >> n >> p;
    int even = 0,odd = 0;
    rep(i,n){
        int c;
        cin >> c;
        even += (c%2 == 0);
        odd += (c%2 == 1);
    }
    if(odd==0){
        if(p==0) cout << power(2,even) << endl;
        else cout << 0 << endl;
    }else{
        cout << power(2,even+odd-1) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <math.h>
#include <numeric>
using namespace std;
int main(){
  int A;
  int B;
  int C;
  int D;
  cin >> A >> B >> C >> D;
  int takahashi,takahashi_mod;
  int aoki,aoki_mod;
  takahashi=A/D;
  aoki=C/B;
  takahashi_mod=A%D;
  aoki_mod=C%B;
  if(takahashi>aoki){
    cout << "Yes" << endl;
  }else if(takahashi==aoki){
    if(takahashi_mod==0&&aoki_mod>0){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
  }else if(aoki-takahashi==1){
    if(takahashi_mod>0&&aoki_mod==0)cout << "Yes" << endl;
    else cout << "No" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3632
// https://atcoder.jp/contests/abc047/tasks/arc063_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N, T;
  cin >> N >> T;

  VL as(N);
  rep(i, N) cin >> as[i];

  // その点で売る場合の利益の最大値
  VL bs(N);
  {
    ll mi = as[0];

    rep(i, N) {
      bs[i] = max(0ll, as[i] - mi);
      chmin(mi, as[i]);
    }
  }

  ll b_max = -1;
  for (ll b : bs) chmax(b_max, b);

  ll res = 0;
  for (ll b : bs) {
    if (b == b_max) res++;
  }

  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n; cin >> n;
  vll a(n); REP(i, n) cin >> a[i];
  ll ans = HIGHINF;
  for(ll p=-100; p<=100; p++) {
    ll tmp = 0;
    REP(i, a.size()) tmp += (a[i]-p) * (a[i]-p);
    chmin(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}


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

#define ll long long

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

    int n, k;
    cin >> n >> k;

    k = min(n, k);

    int arr[n], dp[n];

    for (int i = 0; i < n; ++i)
    {
        cin >> arr[i];
        
        if (i < k)
            dp[i] = abs(arr[0] - arr[i]);
    }
    
    for (int i = k; i < n; ++i)
    {
        int mn = INT_MAX;

        for (int j = 0; j < k; ++j)
            mn = min(mn, abs(arr[i] - arr[i - j - 1]) + dp[i - j - 1]);

        dp[i] =  mn;
    }

    cout << dp[n - 1];

    return 0;
}


Measured memory_bytes: 1024