akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
 
int main()
{
  	int N = 0;
 	cin >> N;
   	if ((N/100)==7){
  	cout << "Yes";
  	return 0;
	}
	N-=(100*(N/100));
	if (N/10==7){
  		cout << "Yes";
  		return 0;
	}
	N-=(10*(N/10));
	if (N==7){
  	cout << "Yes";
  	return 0;
	}
 
	cout << "No";
 	return 0;
}

Measured memory_bytes: 3644
s = gets.chomp
t = s.size - 1
(2 ** t).times do |i|
  temp = s.dup
  ans = temp.slice!(0,1)
  sum = ans.to_i
  t.times do |j|
    num = temp.slice!(0,1)
    if i[j] == 0
      ans += "-#{num}"
      sum -= num.to_i
    else
      ans += "+#{num}"
      sum += num.to_i
    end
  end
  ans += "=7"
  if sum == 7
    puts ans
    break
  end
end

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

int main(){
	long N,K;
	cin>>N>>K;
	vector<long>h;
	long tmp;
	for(int i=0;i<N;++i){
		cin>>tmp;
		h.push_back(tmp);
	}
	sort(h.begin(),h.end());
	long ans=h[h.size()-1];
	for(int i=0;i<N-(K-1);++i){
		if(ans>h[i+K-1]-h[i])ans=h[i+K-1]-h[i];
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define int long long int
#define pb push_back


using namespace std;



signed main()
{
   int n;
   cin>>n;
   double a[n+1];
   for(int i=1;i<=n;i++)
    cin>>a[i];
   double dp[n+1][n+1]={0};
   dp[0][0]=1;
   for(int i=1;i<=n;i++)
   {
       for(int j=0;j<=i;j++)
       {
            if(j!=0)
            {
                dp[i][j]=dp[i-1][j-1]*a[i];


            }


            dp[i][j]+=dp[i-1][j]*(1-a[i]);

       }


   }double p=0;
   for(int i=(n+1)/2;i<=n;i++)
   {
       p+=dp[n][i];
   }
   cout<<fixed<<setprecision(9)<<p<<"\n";


    return 0;
}


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

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

  ll SUM = 0, sum = 0;
  ll m = 1000000000000000000LL;

  vector<ll> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    SUM += v[i];
  }

  for (ll i = 0; i < n - 1; i++) {
    sum += v[i];
    m = min(m, abs(SUM - sum * 2));
  }

  cout << m << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define prt_cs                  printf("Case %lld: ",cs)
#define sqr(x)                  (x)*(x)
#define ms(a,b)                 memset(a, b, sizeof(a))
#define db                      double
#define ll                      long long int
#define MOD                     100000007
#define PI                      2*acos(0.0)
#define pii                     pair< int, int >
#define READ                    freopen("in.txt","r",stdin)
#define WRITE                   freopen("out.txt","w",stdout)
#define gcd(a, b)               __gcd(a, b)
#define lcm(a, b)               (((a)*(b))/gcd(a,b))
#define MAX                     100005

using namespace std;

int main()
{
//    READ;
//    WRITE;
    vector<int> v;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        v.push_back(x);
    }
    sort(v.begin(),v.end());
    int ans=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            int k=v[i]+v[j];
            int x = lower_bound(v.begin(),v.end(),k)-v.begin();
            if(x>j)
            {
                if(v[x]>=k || x==n)x--;
                ans+=(x-j);
//                if(v[x]==k || x==n)ans--;
//            cout<<">> "<<v[i]<<" "<<v[j]<<" "<<x<<" "<<ans<<endl;
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	int n; cin >> n;
	map<lpair, ll> ma;
	rep2(i, 1, n+1){
		ma[make_pair(i%10, to_string(i)[0]-'0')]++;
	}
	rep2(i, 1, n+1){
		ans += ma[make_pair(to_string(i)[0]-'0', i%10)];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

/*-------------------------------------------*/

const int N = 2005;
int n, w[N], b[N], dpw[2 * N][N], dpb[2 * N][N], dp[N][N];

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

    cin >> n;
    FOR(i, 1, 2 * n + 1) {
        char c;
        int a;
        cin >> c >> a;
        (c == 'W' ? w[a] : b[a]) = i;
        rep(j, n) {
            dpw[i][j] = dpw[i - 1][j];
            dpb[i][j] = dpb[i - 1][j];
            (c == 'W' ? dpw : dpb)[i][j] += a > j;
        }
    }
    FOR(j, 1, n + 1) dp[0][j] = 1e9;
    rep(i, n + 1) rep(j, n + 1) {
        if(i) dp[i][j] = dp[i - 1][j] + dpw[w[i]][i] + dpb[w[i]][j];
        if(j) chmin(dp[i][j], dp[i][j - 1] + dpw[b[j]][i] + dpb[b[j]][j]);
    }
    cout << dp[n][n] << endl;

    return 0;
}

Measured memory_bytes: 78720
#include <stdio.h>
int main(void){
    int r, D, x, i;
    scanf("%d %d %d", &r, &D, &x);  
    for(i = 0; i < 10; i++){
        x = (r * x) - D;
        printf("%d\n", x);
    }
  return 0;
}


Measured memory_bytes: 1708
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)      for(int i = 0; i < (n); ++i)
#define all(c)         begin(c), end(c)
#define rall(c)        rbegin(c), rend(c)
#define SZ(a)          ((ll) a.size())

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main() {
  int N,K;
  cin >> N >>  K;
  vi x(N);
  rep(i,N) scanf("%d",&x[i]);

  rep(i,N){
    if(x[i]==0) K--;
  }
  if (K == 0) {
	  cout << 0;
	  return 0;
  }

  vi right(K,-1);
  vi left(K,-1);
  int j;

  j=-1;
  rep(i,N){
    if(x[i]>0){
      j=i;
      break;
    }
  }
  if(j!=-1){
    rep(i,K){
      if((i+j)<N) right[i]=x[j+i];
      else break;
    }
  }

  j=-1;
  RFOR(i,N-1,-1){
    if(x[i]<0){
      j=i;
      break;
    }
  }
  if(j!=-1){
    rep(i,K){
      if((j-i)>=0) left[i]=-x[j-i];
      else break;
    }
  }

  vi ans(K+1);
  ans[0]=right[K-1];
  ans[K]=left[K-1];
  rep(i,K-1){
    if(right[i]==-1 || left[K-i-2]==-1) ans[i+1]=-1;
    else ans[i+1]=right[i]+left[K-i-2]+min(right[i],left[K-i-2]);
  }

  sort(all(ans));

  rep(i,K+1){
    if(ans[i]>=0){
      cout << ans[i];
      break;
    }
  }


  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define pb push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define all(v) ALL(v)
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr double eps = 1e-14; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int n,m,a;

void solve(){
    int cur = a-1;

    int g[101][1010];
    rep(i,101) rep(j,1010) g[i][j]=-1;
    rep(i,m){
        int h,p,q;
        cin >> h >> p >> q;
        p--;q--;
        g[p][h] = q;
        g[q][h] = p;
    }

    for(int h=1000;h>=0;h--){
        if(g[cur][h]==-1) continue;
        cur = g[cur][h];
    }

    cout << cur + 1 << endl;
}

int main(){
    while(cin >> n >> m >> a){
        if(n==0 and m==0 and a==0) break;
        solve();
    }
}

Measured memory_bytes: 3380
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int main()
{
    vector<int> x(9);
    rep(i,9) cin >>x[i];

    vector<int> p(9);
    iota(all(p),1);

    int ans=0;
    do {
        bool go=true;
        rep(i,9)if(x[i]!=-1)
        {
            if(p[i]!=x[i]) go=false;
        }
        if(!go) continue;

        int a = p[0]+p[2]+p[5];
        if(a%10!=p[8]) continue;
        int X = a/10;

        a = p[1]+p[4]+X;
        if(a%10!=p[7]) continue;
        X = a/10;

        a = p[3]+X;
        if(a%10!=p[6]) continue;
        X = a/10;
        if(X!=0) continue;

        ++ans;
    } while(next_permutation(all(p)));

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

///////////////////////////




int main() {

	ll a, b, k;
	cin >> a >> b >> k;

	if (k < a) { cout << a - k << " " << b; }
	else if (k < a + b) { cout << 0 << " " << a + b - k; }
	else { cout << 0 << " " << 0; }


	system("PAUSE");


}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
  }
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X, A;
    cin >> X >> A;
    cout << (X<A?"0":"10") <<endl;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
ans = 0
for k, v in counter.items():
    if 2 <= v:
        ans += v * (v - 1) // 2
for a in A:
    if a in counter and 2 <= counter[a]:
        v = counter[a]
        diff = v * (v - 1) // 2 - ((v- 1) * (v - 2) // 2)
        print(ans - diff)
    else:
        print(ans)

Measured memory_bytes: 26780
def calc_floors(N):
    # floor(N / n) (n = 1, ..., N) のとりうる値と
    # 各floorの値を与えるnの範囲（閉区間）を返す
    n_values = list()
    n_ranges = list()
    k = 1
    while k <= N:
        # k = floor(N / n)  <-->  N/(k+1) < n <= N/k
        # N/(k+1)より大きい最小の整数は(N + k + 1) // (k + 1)
        left, right = (N + k + 1) // (k + 1), N // k
        n_values.append(k)
        n_ranges.append((left, right))
        if left == 1:
            break
        k = N // (left - 1)
    return n_values, n_ranges


def main():
    MOD = 10 ** 9 + 7
    N, K = list(map(int, input().split()))
    n_values, n_ranges = calc_floors(N)
    # dp[k][i]: k個目までで題意を満たす＆一番右の数が区分iの範囲に入るような整数の組の個数
    dp = [[0 for _ in range(len(n_values))] for _ in range(K)]
    dp[0][0] = n_values[0]
    for i in range(1, len(n_values)):
        dp[0][i] = n_values[i] - n_values[i - 1]
    dp[0].reverse()
    for k in range(1, K):
        # dpの累積和（後ろから順に）
        csdp = [0 for _ in range(len(n_values))]
        csdp[len(n_values) - 1] = dp[k - 1][len(n_values) - 1]
        for i in range(len(n_values) - 2, -1, -1):
            csdp[i] = csdp[i + 1] + dp[k - 1][i]
        # dpの更新
        for i in range(len(n_values)):
            v = csdp[len(n_values) - i - 1] * (n_ranges[i][1] - n_ranges[i][0] + 1)
            dp[k][i] = v % MOD
    ans = 0
    for i in range(len(n_values)):
        ans += dp[K - 1][i]
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 168760
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
// clang-format on
int A, B;

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

  cin >> A >> B;

  cout << (A + B) % 24 << endl;

  return 0;
}


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

int a[101],n;

bool check(){
	sort(a+1,a+n+1);
	if(a[n] != a[n-1]) return false;
	for(int i=1;i<n;++i)
		if(a[i+1] > a[i] + 1)
			return false;
	int md = (a[n]+1>>1);
	if(a[1] < md) return false;
	if(a[n]&1) if(a[1] != md or a[2] != md or a[3] == md) return false;
	if(!(a[n]&1)) if(a[1] != md or a[2] == md) return false;
	return true;
}

int main(){
	scanf("%d",&n);
	for(int i=n;i;--i)scanf("%d",a+i);
	puts(check()?"Possible":"Impossible");
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
using System.Runtime.InteropServices.ComTypes;
using System.Threading.Channels;
using System.IO.Pipes;

class Program
{
    static char[] abc = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
    static long mod = 1000000007;
    static void Main(string[] args)
    {

        //var N = long.Parse(Console.ReadLine());
        //var inp = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        //var D = inp[0];
        //var T = inp[1];
        //var S = inp[2];
        var S = Console.ReadLine();
        var T = Console.ReadLine();

        var ans = long.MaxValue;
        for (int i = 0; i+T.Length-1 < S.Length; i++)
        {
            var count = 0;
            for (int j = 0; j < T.Length; j++)
            {
                if (S[i+j] != T[j])
                {
                    count++;
                }
            }
            ans = Math.Min(count,ans);
        }

        Console.WriteLine(ans);
    }
}




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

int dp[151][1001][76];
int main() {
	int n, m;
	while (scanf("%d%d", &n, &m), n) {
		memset(dp, 0x3f, sizeof(dp));
		vector<P>E[151];
		rep(i, n) {
			int k; scanf("%d", &k);
			rep(t, k) {
				int x, d; scanf("%d%d", &x, &d);
				E[i].push_back(P(d, --x));
			}
		}
		for (P i : E[0])dp[0][i.second][0] = 0;
		for (P i : E[1])dp[1][i.second][1] = 0;
		rep(i, n - 1) {
			for (P j : E[i]) {
				for (int t = 0; t <= m; t++) {
					if (dp[i][j.second][t] == INF)continue;
					for (P k : E[i + 1])dp[i + 1][k.second][t] =
						min(dp[i + 1][k.second][t], dp[i][j.second][t] + (j.first + k.first)*abs(j.second - k.second));
					if (i<n - 2) {
						for (P k : E[i + 2])dp[i + 2][k.second][t + 1] =
							min(dp[i + 2][k.second][t + 1], dp[i][j.second][t] + (j.first + k.first)*abs(j.second - k.second));
					}
				}
			}
		}
		int Min = INF;
		for (P i : E[n - 1]) {
			for (int j = 0; j <= m; j++)Min = min(Min, dp[n - 1][i.second][j]);
		}
		for (P i : E[n - 2]) {
			for (int j = 0; j<m; j++)Min = min(Min, dp[n - 2][i.second][j]);
		}
		printf("%d\n", Min);
	}
}

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

#define pb push_back
#define int ll

using ll=long long;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vpii=vector<pii>;
using vvpii=vector<vpii>;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    map<string, int> scnt;
    for (int i=0; i<n; ++i) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        ++scnt[s];
    }
    ll totcnt = 0;
    for (const auto& p: scnt) {
        totcnt += p.second*ll(p.second-1)/2;
    }
    cout << totcnt << endl;
}


Measured memory_bytes: 11264
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int n = s.size();
    s = s + s;
    rep(i,n){
        bool ok = true;
        rep(j,n){
            if(s[i+j] != t[j]){
                ok = false;
                break;
            }
        }
        if(ok){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

int main() {
  int N, K;
  cin >> N;
  bool S;
  
  vector<int> how_many(1);
  cin >> how_many.at(0);
  
  for (int i=0; i<N-1; i++) {
    cin >> K;
    for (int j=0; j<how_many.size(); j++) {
      if (how_many.at(j) == K) {
        S = true;
        break;
      }
    }
    if (S == false) {
      how_many.push_back(K);
    } else {
      S = false;
    }
  }
  
  cout << how_many.size() << endl;
}


Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) throws FileNotFoundException {

//    Scanner cin = new Scanner(new FileReader("input.txt"));
    Scanner cin = new Scanner(System.in);


    String in = cin.next();

    String newS = in.replaceAll("/", "");
    long year = Long.parseLong(newS);

    if (year > 20190430) {
      System.out.println("TBD");
    }
    else {
      System.out.println("Heisei");
    }

  }

}

Measured memory_bytes: 21844
while True:
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1: break
    if m==-1 or f==-1: print('F')
    elif m+f>=80: print('A')
    elif m+f>=65 and m+f<80: print('B')
    elif m+f>=50 and m+f<65: print('C')
    elif m+f>=30 and m+f<50:
        if r>=50: print('C')
        else: print('D')
    elif m+f<30: print('F')
    


Measured memory_bytes: 5596
import sys,string
A = 'abcdefghijklmnopqrstuvwxyza'
rot = string.maketrans(A[1:], A[:-1])
for line in sys.stdin:
    line = line[:-1]
    while 1:
        if line.count("the") or line.count("this") or line.count("that"):
            print line
            break
        line = line.translate(rot)

Measured memory_bytes: 4372
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int Q;
    cin >> Q;
    for(int _=0; _<Q; _++){
        ll a,b;
        cin >> a >> b;
        if(a == b){
            cout << a*2 - 2 << "\n";
            continue;
        }
        ll ok=1,ng=(ll)inf*3;
        while(ng-ok>1){
            ll mid = (ok+ng)/2;
            ll temp = (mid+1)/2 * (mid+1 - (mid+1)/2);
            if(temp >= a*b){
                ng = mid;
            }else{
                ok = mid;
            }
        }
        cout << ok - 1 << "\n";
    }


    return 0;
}

Measured memory_bytes: 256
import sys
L, R = map(int, input().split())
mod = 2019
mn = L*R
for i in range(L,R):
    if R-L > 673:
        print(0)
        sys.exit()
    for j in range(i+1,R+1):
        mn = min(mn,(i*j)%mod)
print(mn)



Measured memory_bytes: 3316
n,m=map(int,input().split())
a=[0]*m
b=[0]*m
c=[0]*m
for i in range(m):
    a[i],b[i]=map(int,input().split())
    c[i]=sum(map(lambda x:2**(int(x)-1),input().split()))

dp=[-1]*(2**n)
for i in range(m):
    for j in range(2**n):
        if j|c[i]==c[i]:
            if dp[j]<0:
                dp[j]=a[i]
            else:
                dp[j]=min(dp[j],a[i])
for i in range(m):
    for j in range(2**n):
        if dp[j]<0:
            continue
        if dp[c[i]|j]<0:
            dp[c[i]|j]=dp[j]+a[i]
        else:
            dp[c[i]|j]=min(dp[c[i]|j],dp[j]+a[i])
print(dp[-1])

Measured memory_bytes: 46552
package main

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

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	var (
		l, r int
		lMax = 0
		rMin = 100001
	)
	for i := 0; i < m; i++ {
		sc.Scan()
		l, _ = strconv.Atoi(sc.Text())
		if l > lMax {
			lMax = l
		}
		sc.Scan()
		r, _ = strconv.Atoi(sc.Text())
		if r < rMin {
			rMin = r
		}
	}

	v := rMin - lMax + 1
	if v < 0 {
		v = 0
	}
	if v < n {
		fmt.Println(v)
	} else {
		fmt.Println(n)
	}
}


Measured memory_bytes: 1792
c = [0 for i in range(3)]
for i in range(3):
    c[i] = list(map(int, input().split()))
ans = 'Yes'
for i in range(1, 3):
    if c[i][0] - c[0][0] != c[i][1] - c[0][1] or c[i][1] - c[0][1] != c[i][2] - c[0][2]:
        ans = 'No'
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define rep(i, n) FOR(i, 0, n - 1)
using namespace std;
typedef long long ll;
template <class T> inline bool dpmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool dpmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

void solve(long long A, long long B) {
    ll res = 0;
    ll ans = 0;
    while (res+1 < B) {
        res += A - 1;
        ans++;
    }

    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips:
// You use the default template now. You can remove this line by using your
// custom template)
int main() {
  long long A;
  cin >> A;
  long long B;
  cin >> B;
  solve(A, B);
  return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector> 
#include <cmath>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <cerrno>
#include <stdio.h>
#include <stdlib.h>
#include <cfenv>
#include <stack>
#include <math.h>
#include <iomanip>
#include <limits>
#include <queue>
#define ll long long int
#define pb push_back
#define mp make_pair

using namespace std;

int main(){

    string a,b;

    cin >> a >> b;

    if(a.size()>b.size()){
        for(int i=0;i<b.size();i++){
            cout << a[i] << b[i];
        }
        cout << a[a.size()-1] << endl;
    }
    else if(a.size()==b.size()){
        for(int i=0;i<a.size();i++){
            cout << a[i] << b[i];
        }
        cout << endl;
    }
    else if(a.size()<b.size()){
        for(int i=0;i<a.size();i++){
            cout << a[i] << b[i];
        }
        cout << b[b.size()-1] << endl;
    }

    return 0;
}

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

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

    for (int i=0; i<3; i++) {
        if (n.at(i)=='1') {
            n.at(i) = '9';
        }
        else if (n.at(i)=='9') {
            n.at(i) = '1';
        }
    }
    int ans = atoi(n.c_str());
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int cnt[4][3][10] = {0};
  int n, b, f, r, v;
  cin >> n;

  for (int i = 0; i < n; ++i) {
    cin >> b >> f >> r >> v;
    cnt[b - 1][f - 1][r - 1] += v;
  }

  for (int i = 0; i < 4; ++i) {
    if (0 < i) cout << "####################" << endl;
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 10; ++k) {
        cout << ' ' << cnt[i][j][k];
      }
      cout << endl;
    }
  }
  return 0;
} 



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

typedef long long ll;

struct st {
	ll v, s;
	bool c;
	st *L, *R;
	void change(ll V) {
		v = V;
		c = 1;
	}
	ll get() {
		if (c) return v*s;
		return v;
	}
	void push() {
		if (c) {
			L->change(v);
			R->change(v);
		}
	}
	void pull() {
		v = L->get()+R->get();
		c = 0;
	}
};

st *build(int L, int R)
{
	st *c = new st();
	if (L == R) {
		c->v = 0;
		c->s = 1;
		c->c = 0;
		return c;
	}
	int m = (L+R)/2;
	c->L = build(L, m);
	c->R = build(m+1, R);
	c->pull();
	c->s = R-L+1;
	return c;
}

void modify(st *c, int L, int R, int x, int y, ll v)
{
	if (x > y) return;
	if (y < L || R < x) return;
	if (x <= L && R <= y) {
		c->change(v);
		return;
	}
	c->push();
	int m = (L+R)/2;
	modify(c->L, L, m, x, y, v);
	modify(c->R, m+1, R, x, y, v);
	c->pull();
}

ll query(st *c, int L, int R, int x)
{
	if (x < L || R < x) return 0;
	if (L == R) return c->get();
	c->push();
	int m = (L+R)/2;
	ll ans;
	if (x <= m) ans = query(c->L, L, m, x);
	else ans = query(c->R, m+1, R, x);
	c->pull();
	return ans;
}

int main()
{
	int n, q, c, x;
	scanf("%d%d", &n, &q);
	ll ans = ll(n-2)*ll(n-2);
	st *C = build(2, n-1), *R = build(2, n-1);
	int safeC = n, safeR = n;
	while (q--) {
		scanf("%d%d", &c, &x);
		if (c == 1) {
			if (x > safeC) ans -= query(C, 2, n-1, x);
			else ans -= ll(safeR-2), modify(C, 2, n-1, x+1, safeC-1, safeR-2), safeC = x;
		}
		else {
			if (x > safeR) ans -= query(R, 2, n-1, x);
			else ans -= ll(safeC-2), modify(R, 2, n-1, x+1, safeR-1, safeC-2), safeR = x;
		}
	}
	printf("%lld\n", ans);
}

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

vector<vector<int>> G;
vector<int> Prev;
vector<bool> visited;

int bfs(int s, int t){
    queue<pair<int,int>> que;
    que.push({s,0});
    while(!que.empty()){
        auto now = que.front(); que.pop();
        int v = now.first;
        int d = now.second;
        if(v == t){
            return d;
        }
        for(auto e: G[v]) if(!visited[e]) {
            visited[e] = true;
            que.push({e, d + 1});
            Prev[e] = v;
        }
    }
    return -1;
}

int tbfs(int s){
    queue<int> que;
    que.push(s);
    int cnt = 0;
    while(!que.empty()){
        auto v = que.front(); que.pop();
        for(auto e: G[v]) if(!visited[e]) {
            visited[e] = true;
            que.push(e);
            cnt++;
        }
    }
    return cnt;
}

int main(){
    int N; cin >> N;
    G.resize(N);
    rep(i, N - 1){
        int a, b; cin >> a >> b;a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    Prev.resize(N, -1);
    visited.assign(N, 0);
    bfs(0, N - 1);
    visited.assign(N, 0);
    vector<int> path, rpath; // pathがフェネック
    for(int v = N - 1; v != 0; v = Prev[v]){
        rpath.push_back(v);
        //cout << v << endl;
    }
    rpath.push_back(0);
    for(auto it = rpath.rbegin(); it != rpath.rend(); it++){
        path.push_back(*it);
    }
    int k = rpath.size();
    //cout << k << endl;
    //path = rpath;
    //reverse(rpath.begin(), rpath.end());
    rpath.resize(k/2);
    path.resize(k - (k / 2));
    int black = k - (k / 2);
    int white = k / 2;
    //cout << black << white << endl;
    for(auto e: path){
        visited[e] = true;
    }
    for(auto e: rpath){
        visited[e] = true;
    }
    for(auto e: path){
        //cout << e << endl;
        black += tbfs(e);
    }
    for(auto e: rpath){
        white += tbfs(e);
    }
    //cout << black << endl;
    if(black > white) puts("Fennec");
    else puts("Snuke");
    return 0;
}

Measured memory_bytes: 7288
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
using namespace std;
typedef pair<ll, ll>P;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll dp[114][10];
ll f[114];
signed main() {
	ll h, w, k;
	cin >> h >> w >> k;
	f[0] = 1;
	f[1] = 1;
	for (int i = 2; i <= 110; i++)f[i] = f[i - 2] + f[i - 1];
	dp[0][0] = f[w - 1];
	dp[0][1] = f[w - 2];
	for (int i = 0; i < h - 1; i++) {
		for (ll j = 0; j < w; j++) {
			if(j-1>=0)dp[i+1][j-1]+=dp[i][j]*f[j-1]*f[w-j-1];
			if(j+1<w)dp[i+1][j+1]+=dp[i][j]*f[j]*f[w-j-2];
			dp[i+1][j]+=dp[i][j]*f[j]*f[w-j-1];
			dp[i + 1][j - 1] %= inf;
			dp[i + 1][j] %= inf;
			dp[i + 1][j + 1] %= inf;
		}
	}
	cout << dp[h - 1][k - 1] % inf << endl;
	getchar(); getchar(); return 0;
}





Measured memory_bytes: 256
M, D = map(int, input().split())
cnt = 0
for m in range(1, M + 1):
  for d in range(1, D + 1):
    d1 = d % 10
    d10 = d // 10
    if d1 >= 2 and d10 >= 2 and d1 * d10 == m:
      cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
#define int long long
int INF = 1e9+7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
unsigned day;
if(dow < dow1) dow += 7;
day = dow - dow1;
day += 7 * n - 6;
return day;
}
unsigned DayToWeekNumber(unsigned day)
{
  return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
  return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main(){
	int N; cin>>N;
	cout<<(N-1)*N/2<<endl;
}

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

int main() {
  
  int p;
  cin >> p;
  
  int q = 0;
  
  if(p / 100 == 7){
    cout << "Yes" << endl;
  }else{
    q = p%100;
  
  int r = 0;
  
  if(q / 10 == 7){
    cout << "Yes" << endl;
  }else{
    r = q%10;
  
  if(r==7){
    cout << "Yes" << endl;
  }else{
    cout << "No" <<endl;
  }
  
  }
  }
  
}



Measured memory_bytes: 3612
n = int(input())

minlen = 100
mins = []
S = []
for i in range(n):
	s = list(input())
	s.sort()
	S.append(s)
	if len(s) < minlen:
		minlen = len(s)
		mins = s

mins = [c for c in mins]
s = ""
for c in mins:
	flag = True
	for l in S:
		if c in l:
			l.remove(c)
		else:
			flag = False
	if flag:
		s += c

print(s)

Measured memory_bytes: 3064
const main = (inputs) => {
  var N = inputs[0]-0;
  var list = [];
  for(var i=1;i<=N;i++){
    list.push({
      a: inputs[i].split(" ")[0]-0,
      b: inputs[i].split(" ")[1]-0,
    });
  }
  list.sort((a,b)=>{
    return a.b-b.b;
  });
  var ans = true;
  var tmp = 0;
  list.forEach(obj=>{
    tmp += obj.a;
    if(tmp>obj.b) ans=false;
  });
  console.log(ans?"Yes":"No");
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));


Measured memory_bytes: 66480
n=int(input())
a=list(map(int,input().split()))
flag=1
k=0
c=1000
for i in range(n-1):
  if flag and a[i]<a[i+1]:
    k=c//a[i]
    c-=a[i]*k
    flag=0
  elif not flag and a[i]>a[i+1]:
    c+=k*a[i]
    k=0
    flag=1
c+=k*a[-1]
print(c)

Measured memory_bytes: 61740
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

int main(){
  int N, H;
  cin >> N >> H;
  vector<int> a(N), b(N);
  rep(i, N) cin >> a[i] >> b[i];
  sort(a.rbegin(), a.rend());
  sort(b.rbegin(), b.rend());
  int sum = 0, ans = 0;
  rep(i, N) {
    if(b[i] > a[0] && sum < H) {
      sum += b[i];
      ans++;
    } else
      break;
  }
  if(sum < H)
    ans += (H-sum+a[0]-1)/a[0];
  cout << ans << endl;
}

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

ll func(ll x){
  if(x < 1) return 0;
  else if(x == 1) return 1;
  
  ll ans = func(x/2);
  return ans*2 +1;
}

int main(){
  ll h;
  cin >> h;
  cout << func(h) << endl;  
  return 0;
}


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

vector<int> ans;

void solve(int N, int A, int B, int msk) {
	assert(__builtin_popcount(unsigned(A^B)) % 2 == 1);
	assert(((A^B) & msk) == (A^B));
	assert(__builtin_popcount(unsigned(msk)) == N);
	if (N == 1) {
		ans.push_back(A);
		ans.push_back(B);
		return;
	}
	int d = A ^ B;
	int flip = d & (-d);
	msk ^= flip;
	d ^= flip;
	assert(__builtin_popcount(unsigned(d)) % 2 == 0);
	assert(msk);
	d ^= msk & (-msk);
	solve(N-1, A, A ^ d, msk);
	solve(N-1, A^d^flip, B, msk);
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, A, B; cin >> N >> A >> B;
	assert(A != B);
	if (__builtin_popcount(unsigned(A^B)) % 2 == 0) {
		cout << "NO" << '\n';
		exit(0);
	}

	solve(N, A, B, (1<<N)-1);
	cout << "YES" << '\n';
	for (int i = 0; i < (1<<N); i++) {
		cout << ans[i] << " \n"[i+1==(1<<N)];
	}

	return 0;
}


Measured memory_bytes: 1656
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,a,b)for(int i=a;i<b;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define clr1(arr) memset(arr,-1,sizeof(arr));
#define clr0(arr) memset(arr,0,sizeof(arr));
#define pi pair<int,int>
#define pii pair<int,pi>
#define sortV(v) v.begin(),v.end()
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
// DSU
/*
const int maxn=100009;
int arr[maxn];
int sz[maxn];
void init(){rep(i,maxn){arr[i]=i;sz[i]=1;}}
int root(int a){while(a!=arr[a]){arr[a]=arr[arr[a]];a=arr[a];}return a;}
int check(int a,int b){if(root(a)==root(b))return 1;return 0;}
int un(int a,int b)
{
  int roota=root(a);int rootb=root(b);
  if(sz[roota]>=sz[rootb]){sz[roota]+=sz[rootb];arr[rootb]=roota;}
  else {sz[rootb]+=sz[roota];arr[roota]=rootb;}
}
*/
int32_t main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
   fastio
   int n;
   cin>>n;
   if(n<100 && n>=10)
   {
     cout<<9<<endl;
     exit(0);
   }
   else if(n<10)
   {
     cout<<n<<endl;
     exit(0);
   }
   else if(n>=1000 && n<10000)
   {
     cout<<9+900;
   }
   else if(n>=100 && n<1000)
   {
     cout<<9+n-100+1<<endl;
     exit(0);
   }
   else if(n>=10000 && n<100000)
   {
     cout<<9+900+n-10000+1<<endl;
   }
   else
   {
     cout<<90909<<endl;
     exit(0);
   }
   return 0;
}


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

int main() {
  int long long N;
  cin>>N;
  int long long A[N+1],B[N+1];
    for(int long long i=0;i<N+1;i++){
    A[i]=0;
    B[i]=0;
  }
  for(int long long i=0;i<N;i++){
    int long long t;
    cin>>t;
    A[t]++;
    B[i]=t;
  }

  int long long ans=0;
  for(int long long i=0;i<N+1;i++){
    ans+=A[i]*(A[i]-1)/2;
  }
  for(int long long i=0;i<N;i++){
    cout<<ans-A[B[i]]+1<<endl;
  }
}


Measured memory_bytes: 5760
from itertools import product

N=int(input())
S=list(input())
t=["0","1","2","3","4","5","6","7","8","9"]

u=product(t,repeat=3)
ans=0
for com in u:
  x=com[0]
  y=com[1]
  z=com[2]
  
  if x in set(S):
    idx_x = S.index(x)
    tmp1 = S[idx_x+1:]
    if y in set(tmp1):
      idx_y = tmp1.index(y)
      tmp2 = tmp1[idx_y+1:]
      if z in set(tmp2):
        ans+=1
        continue
        
print(ans)

Measured memory_bytes: 134336
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

#define INF 1e9
#define MOD 1000000007;//1e9+7

void solve() {
    string S;
    cin >> S;
    for (int i = 0; i < S.size(); i++)cout << "x";
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin >>n;
  ll a[n];
  ll even=0,odd=0;
  for(int i=0;i<n; i++){
    cin >> a[i];
    if(i%2==0) even+=a[i];
    else odd+=a[i];
  }
  ll ans[n];
  ans[0]=abs(odd-even);
  for(int i=0;i<n-1; i++){
   	ans[i+1]=2*a[i]-ans[i];
  }
  
  cout <<ans[0];
  for(int i=1;i<n; i++){
   	cout <<" "<<ans[i];
  }
  cout <<endl;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
int n, c, A[10];
double f[500][(1 << 7)], ans, t;
inline double fact(int k)
{
	if (!k) return 1;
	if (k == 1) return 1;
	if (k == 2) return 2;
	if (k == 3) return 6;
	if (k == 4) return 24;
	if (k == 5) return 120;
	return 0; 
}
int main()
{
	scanf("%d%d", &n, &c);
	for(int i = 0; i < n; ++i) scanf("%d", &A[i]);
	sort(A, A + n);
	do
	{
		memset(f, 0, sizeof f);
		f[A[n - 1] * n][0] = 1;
		for(int i = 0; i <= n * c; ++i)
			for(int j = i; j <= n * c; ++j)
				for(int S = 0; S < (1 << n - 1); ++S)
					if(i % n && !((S >> (i % n - 1)) & 1))
						f[min(n * c, max(j, i + A[i % n - 1] * n))][S | (1 << (i % n - 1))] += f[j][S];
		ans += f[n * c][(1 << n - 1) - 1];
		++t;
	}
	while(next_permutation(A, A + n - 1));
	printf("%.15lf", (double)ans / t / pow(c, n - 1));
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    string s;
    cin>>s;
    bool T=false;
    string fs="";
    rep(0,i,3){
        if(fs=="")fs=s.substr(i,1);
        else if(s.substr(i,1)!=fs)T=true;
    }
    if(T)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string s, t;
	cin >> s >> t;
	cout << t << s << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort(all(変数),greater<型名>())で降順に、*max_element(all(変数))で最大値を獲得
#include<bits/stdc++.h>
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric>
// xとyのgcdは__gcd(x,y),xとyのlcmは(x*y)/__gcd、accumulate(all(変数),0)で要素の全加算
#include<queue>//priority_queue<型名> 変数
#include<set>
#include<stack>
#include<string>//変数.substr(どこから,いくつ)
#include<vector>
#define rep(i,n)  for(ll i=0; i<n; i++)
#define rrep(i,n) for(ll i=n-1; 0<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
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; }

int main(){
  string s;  cin >> s;
  vi x(3);
  rep(i,s.size()){
    if(s[i] == 'a'){
      x[0]++;
    }else if(s[i] == 'b'){
      x[1]++;
    }else{
      x[2]++;
    }
  }
  if(*max_element(all(x))-*min_element(all(x)) <= 1) cout << "YES";
  else cout << "NO";
  cout << "\n";
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define rep(i, a, b) for(i = a; i < b; i++)
#define per(i, a, b) for(i = a; i >= b; i--)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define trav(x, it) for(auto it = x.begin(); it != x.end(); it++)
#define pr(x) cout << #x << " = " << x << endl
#define fill(x,y) memset(x,y,sizeof(x))
#define endl "\n"
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector< pii > vpii;
typedef vector< pll > vpll;
ld eps = 1e-7;
ll mod = 1000000007;
ll N = 998244353;

ll binpow(ll b, ll p){ ll ans = 1; while(p > 0){if(p & 1) ans = (ans * b) % mod; b = (b * b) % mod; p >>= 1;}return ans;}
ll modinv(ll x){return binpow(x, mod - 2);}

void solve()
{
	int x, y, i, a, b;
	cin >> x >> y;
	for(i = 0; i <= x; i++)
	{
		a = i;
		b = x - i;
		if(2 * a + 4 * b == y)
		{
			cout << "Yes\n";
			return;
		}
	}
	cout << "No\n";
}

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

	int t = 1;
	//cin >> t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3652
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld  double
#define pii pair<int,int>
#define pb push_back
#define N 200003
#define inf (ll)1e9+11
#define warmup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int mod=1e9+7;
unordered_map<string,int> cnt;

signed main()
{
    warmup
    
    int n;
    cin>>n;
    int i,j,ma=0;
    string s;
    for(i=1;i<=n;++i)
        cin>>s, cnt[s]++, ma=max(ma,cnt[s]);
    
    vector<string> v;   v.clear();
    for(auto it:cnt)
        if(it.second==ma)
            v.pb(it.first);
    
    sort(v.begin(), v.end());
    for(auto it:v)
         cout<<it<<'\n';
    
    
    return 0;
}


Measured memory_bytes: 25284
#include <bits/stdc++.h>
#define sanyes ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long int
#define pb push_back
#define bpc __builtin_popcount
#define f first
#define s second

const llong mxn = 1e5 + 7;
const llong mod = 1e9 + 7;
const llong inf = 1e18 + 9;

using namespace std;

llong n, k, a[mxn], dp[mxn][2], cnt[2];

int main(){
    cin >> n >> k;
    for (int i = 1; i <= n; i ++){
        cin >> a[i];
    }
    dp[0][0] = 1;
    for (int i = 1; i <= n; i ++){
        for (int j = 0; j <= 1; j ++){
            llong x = j - (a[i] % 2);
            if(x < 0){
                x += 2;
            }
            ///almasak
            dp[i][j] += dp[i - 1][j];
            ///alsak
            dp[i][j] += dp[i - 1][x];
        }
    }
    /*
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= 1; j++) {
            cout<<dp[i][j] << ' ';
        }
        cout<<endl;
    }*/
    cout << dp[n][k];
    return 0;
}


Measured memory_bytes: 256