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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    string a,b,c; cin >> a >> b >> c;
    if(a[a.size()-1] == b[0] && b[b.size()-1]==c[0])cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(int i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl
int main()
{
	int m,n,l;
	cin>>m>>n>>l;
	vector<string> vs(n);
	for(int i=0;i<m;i++)cin>>vs[i];
	ll ans = INF;
	FOR(mask,0,1<<(m-1))
	{
		vector<ll> cut;cut.push_back(0);
		ll cur = 0;
		for(int i=0;i<m-1;i++)
		{
			if(mask&(1<<i))
				cut.push_back(i+1) , cur++;
		}
		cut.push_back(m);
		ll k = cut.size()-1;
		vector<ll> cnt(k);
		for(int j=0;j<n;j++)
		{
			ll pos = 0;
			vector<ll> add(k);
			for(int i=0;i<m;i++)
			{
				if(i == cut[pos+1]) pos++;
				add[pos]+=vs[i][j]-'0';
			}
			for(int i=0;i<k;i++)
				cnt[i]+=add[i];
			bool isok = true;
			for(int i=0;i<k;i++)
				 if(cnt[i]>l)
				 	isok = false;
			if(isok == true)
				continue;
			cur++;
			for(int i=0;i<k;i++)
				cnt[i] = add[i];
			isok = true;
			for(int i=0;i<k;i++)
				if(cnt[i]>l)
					isok = false;
			if(!isok)
				cur = ans+1;
		}
		ans = min(ans,cur);
	}
	cout<<ans<<endl;
} 


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

using namespace std;

using i64 = int64_t;
const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;

signed main(){
    vector<int> q(12);
    for(int i = 0;i < 12;i++){
        cin >> q[i];
    }
    sort(q.begin(), q.end());
    bool f = true;
    for(int i = 0;i < 12;i+=4){
        if(q[i] == q[i+1] && q[i+1] == q[i+2] && q[i+2] == q[i+3]){

        }else{
            f = false;
        }
    }
    cout<<(f ? "yes" : "no")<<endl;
}



Measured memory_bytes: 3144
N = int(input())
ABC = [tuple(map(int,input().split())) for i in range(N-1)]
Q,K = map(int,input().split())
K -= 1
XY = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(Q)]
es = [[] for i in range(N)]
for a,b,c in ABC:
    a,b = a-1,b-1
    es[a].append((b,c))
    es[b].append((a,c))
INF = float('inf')
dist = [INF] * N
dist[K] = 0
import heapq
hq = [(0,K)]
heapq.heapify(hq)
while hq:
    c,v = heapq.heappop(hq)
    for to,d in es[v]:
        if c+d >= dist[to]: continue
        dist[to] = c+d
        heapq.heappush(hq,(c+d,to))
ans = []
for x,y in XY:
    ans.append(dist[x]+dist[y])
print(*ans, sep='\n')

Measured memory_bytes: 77764
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main() {
    int k;
    cin >> k;
    if (k % 2 == 1) {
        int ans;
        ans = (k / 2) * (k + 1) / 2;
        cout << ans << endl;
    }
    else cout << (k / 2) * (k / 2) << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    int a = accumulate(w.begin(), w.end(), 0);
    int b = 0;
    int ans = a;
    for(int i=0; i<n; ++i){
        a -= w[i];
        b += w[i];
        ans = min(ans, abs(a - b));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <cmath>
#include <limits>
#include <stack>
// 二分木探索(logN)
using namespace std;

// int main(){
//   long N,tmp;
//   vector<long> a,b,c;
//   long s[100005];
//   long count = 0;
//   cin >> N;
//   for(int i=0;i<N;++i){
//     cin >> tmp;
//     a.push_back(tmp);
//   }
//   for(int i=0;i<N;++i){
//     cin >> tmp;
//     b.push_back(tmp);
//   }
//   for(int i=0;i<N;++i){
//     cin >> tmp;
//     c.push_back(tmp);
//   }
//   sort(a.begin(),a.end());
//   sort(b.begin(),b.end());
//   sort(c.begin(),c.end());
//   for(int i=0;i<N;++i){
//     vector<long>::iterator it1 = lower_bound(a.begin(),a.end(),b[i]);
//     vector<long>::iterator it2 = upper_bound(c.begin(),c.end(),b[i]);
//     count += (it1-a.begin())*(c.end()-it2);
//   }
//   cout << count << endl;
// }

int main(){
  long N,tmp;
  vector<long> A,B,C;
  long count =0;
  // 入力の保持
  cin >> N;
  for(long i=0;i<N;++i){
    cin >> tmp;
    A.push_back(tmp);
  }
  for(long i=0;i<N;++i){
    cin >> tmp;
    B.push_back(tmp);
  }
  for(long i=0;i<N;++i){
    cin >> tmp;
    C.push_back(tmp);
  }
  // 三段それぞれをソート
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  sort(C.begin(),C.end());
  // 二段目を基準に一段目と三段目で大小を比べる
  for(long i=0;i<N;++i){
    vector<long>::iterator it1 = lower_bound(A.begin(),A.end(),B[i]);
    vector<long>::iterator it2 = upper_bound(C.begin(),C.end(),B[i]);
    count += (it1-A.begin())*(C.end()-it2);
  }
  // 結果出力
  cout << count << endl;
}


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

using namespace std;


int main(){
    int n,m,cnt;
    cin>>n>>m;
    int  a[m];
    for(int i=0;i<m;i++){cin>>a[i];}
    int sum=accumulate(a,a+m,0);
    if(n<sum){cout<<"-1"<<endl;}
    else{cout<<n-sum;}
    return 0;
    }

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Competition
{
    public class Program
    {
        static void Main(string[] args)
        {
            var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var ka = Enumerable.Repeat(0, nm[0]).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();

            var res = Enumerable.Repeat(true, nm[1]).ToArray();
            for(var i = 0; i < nm[0]; i++)
            {
                var likes = new bool[nm[1]];
                for(var j = 0; j < ka[i][0]; j++)
                {
                    likes[ka[i][j+1]-1] = true;
                }
                for (var j = 0; j < nm[1]; j++) res[j] &= likes[j];
            }
            var count = Enumerable.Range(0, nm[1]).Count(n => res[n]);
            Console.WriteLine(count);
        }

    }
}


Measured memory_bytes: 13524
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(obj) (obj).begin(),(obj).end()
ll mod=1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int dp[1004];
  rep(i,1004)dp[i]=0;
  for(int i=2;i<=n;i++){
    int ss=i;
    while(ss%2==0){
      dp[2]++;
      ss/=2;
    }
    for(int j=3;j*j<=n;j+=2){
      while(ss%j==0){
        dp[j]++;
        ss/=j;
      }
    }
    if(ss!=1)dp[ss]++;
  }
  ll total=dp[2]+1;
  for(int i=3;i<=n;i+=2){
    if(dp[i]!=0){
      total*=(dp[i]+1);
      total%=mod;
    }
  }
  cout<<total<<endl;
  return 0;
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef int Int;
typedef pair<Int, Int> pii;
typedef pair<Int, double> pid;
typedef pair<double, double> pdd;
typedef pair<Int, pii> pip;
typedef pair<pii, Int> ppi;
typedef pair<double, Int> pdp;
typedef vector<Int> veci;
typedef vector<double> vecd;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<double> vecd;
typedef vector<pii> vecpii;
typedef vector<ppi> vecppi;
typedef vector<veci> mati;
typedef vector<vecll> matll;
typedef vector<vecd> matd;
#define PB(x) push_back(x)
#define EB(x) emplace_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (x).size()
#define CLR(x) memset(x,0,sizeof x)
#define pdebug() printf("%d\n",__LINE__)
#define REP(i, a, b) for(int i = (a);i <= (b);i++)
#define FORO(i, n) REP(i,0,(int)n-1)
#define FORI(i, n) REP(i,1,(int)n)
#define FORIT(i, t) for(auto i = t.begin();i != t.end();i++)
#define eps 1e-6
#define sqr(x) ((x)*(x))
#define dist(_a, _b) sqrt(sqr(_a.A-_b.A)+sqr(_a.B-_b.B))
#define norm(_a) sqrt(sqr(_a.A)+sqr(_a.B))
#define DEBUG 1
#if DEBUG
#define DUMP(a) do { std::cout << #a " = " << (a) << ", "; } while(false)
#define DUMPLN(a) do { std::cout << #a " = " << (a) << std::endl; } while(false)
#else
#define DUMP(a)
#define DUMPLN(a)
#endif
template<typename T, typename U>
inline void getMin(T &a, U b) { if (a > b) a = b; }
template<typename T, typename U>
inline void getMax(T &a, U b) { if (a < b) a = b; }
template<typename T>
vector<T> getVector(const int n) { return vector<T>(n); }
template<typename T>
vector<T> getVector(const int n, const T a) { return vector<T>(n, a); }
template<typename T>
vector<T> getEmptyVector() { return vector<T>(); }
template<typename T>
void appendAll(vector<T> &a, vector<T> b) { a.insert(a.end(), b.begin(), b.end()); }
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
// #define X first
// #define Y second
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
const ll MOD = 1000000007;
const int MAXN = 1 << 17;
const int inf = 1 << 27;
const ll llinf = 1LL << 50;
const int NIL = -inf;
int popcount(int x) { return __builtin_popcount(x); }

void test_case() {
    int n;
    cin >> n;
    veci A(n);
    FORO(i, n) cin >> A[i];
    ll ret = 0;
    int mx = A[0];
    for(auto a : A) {
        if(mx > a)  ret += mx - a;
        mx = max(mx, a);
    }
    cout << ret << endl;
}

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

    int T = 1;
    while(T--) {
        test_case();
    }

    return 0;
}


Measured memory_bytes: 3988
#include <vector>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <math.h>
#include <list>

using namespace std;

int sum_digit(int n) {
	if (n == 0) return 0;
	else return n % 10 + sum_digit(n / 10);
}
int absolute(int a) {
	if (a < 0) return -a;
	else return a;
}
void uniq(list<int> &lst) {
	auto itr = lst.begin();
	if (itr == lst.end()) return;
	int prev = *itr++;
	while(itr != lst.end()) {
		if (*itr == prev) {
			itr = lst.erase(itr);
		}
		else {
			prev = *itr++;
		}
	}
}
int main()
{
  string s; cin >> s;
  
  int n_white = 0 , n_black = 0;
  for(int i = 0; i < s.size(); i++){
    if(i % 2 == 0){
      if(s.at(i) != '1') n_white++;
      else n_black++;
    }
    if(i % 2 == 1){
      if(s.at(i) != '0') n_white++;
      else n_black++;
    }
  }
  cout << min(n_white,n_black) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n; cin >>n;
  vector<int>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  long long count=0;
  for(int i=0;i<n;i++){
    int x=a[i];
    while(x){
      if(x%2==0){
        x/=2;
        count++;
      }
      if(x%2==1)break;
    }
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;

int solve(vector<int> &v, int i, int sum){

  if(sum > 21) return 0;

  if(i == v.size()){
    if(sum > 21) sum = 0;
    return sum;
  }
  int res = 0;

  if(v[i] == 1){
    res = max(solve(v, i+1, sum+1), solve(v, i+1, sum+11));
  }else if(v[i] >= 2 && v[i] <= 9){
    res = solve(v, i+1, sum+v[i]);
  }else{
    res = solve(v, i+1, sum+10);
  }
  return res;
}

int main(){

  string s;
  while(true){
    getline(cin, s);
    if(s == "0") break;

    vector<int> v;
    int len = s.length();
    int idx = 0;
    REP(i,len){
      if(s[i] == ' '){
        //cout << s.substr(idx, i-idx) << endl;
        v.pb(stoi(s.substr(idx, i-idx)));
        idx = i + 1;
      }
    }
    v.pb(stoi(s.substr(idx, len-idx)));
    cout << solve(v, 0, 0) << endl;
  }

  return 0;
}




Measured memory_bytes: 3156
#define fast ios::sync_with_stdio(false); cin.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

bitset<100> bs;

int main() {
	fast;
	int n, a, b;
	cin >> n;
	foru(i, 0, n) {
		cin >> a >> b;
		bs[i] = (a == b);
	}
	foru(i, 0, n - 2) {
		if (bs[i] && bs[i + 1] && bs[i + 2]) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3048
#include <iostream>
#include <stdio.h>
using namespace std;
int main(int argc, const char * argv[]) {
    int a,b,c,d;
    double e;
    cin >> a >> b;
    c = a/b;
    d =a%b;
    e= 1.0*a/b;
    //printf("%d " "%d,%.5lf\n",c,d,e);
    // insert code here...
   // cout << c <<" " << d << " " ;
    printf("%d",c);
    printf(" ");
    printf("%d",d);
    printf(" ");
    printf("%.8lf\n",e);
    return 0;
}

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

vector<int> vis[200010];
vector<int> ans;

void dfs(int v, int p=-1){
  for(int u : vis[v]){
    
    if(u==p) continue;

    ans[u] += ans[v];
    dfs(u,v);
  }
}


int main(){
  int n,q,i;
  cin >> n >> q;

  for(i=0;i<n-1;++i){
    int a,b;
    cin >> a >> b;
    --a;
    --b;
    vis[a].push_back(b);
    vis[b].push_back(a);
  }

  ans.resize(n);
  for(i=0;i<q;i++){
    int p,x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }

  dfs(0);

  for(i=0;i<n;i++){
    cout << ans[i] << " ";
  }
  cout << "\n";

  return 0;
}


Measured memory_bytes: 23424
using System;
using System.Linq;
class p
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    string[] nArr = new string[N];
    for (int i = 0; i < N; i++) {
      nArr[i] = Console.ReadLine();
    }
    int M = int.Parse(Console.ReadLine());
    string[] tArr = new string[M];
    for (int i = 0; i < M; i++) {
      tArr[i] = Console.ReadLine();
    }
    
    int max = 0;
    for (int i = 0; i < N; i++) {
      int plus = nArr.Count(x => x == nArr[i]);
      int mins = tArr.Count(x => x == nArr[i]);
      max = Math.Max(max, plus - mins);
    }
    Console.WriteLine(max);
  }
}

Measured memory_bytes: 13268
#include <cassert>
#include <iostream>
#include <vector>
/*
` `: Free
`Q`: Queen
`A`: Attackable
*/
typedef std::vector<std::vector<char> > TBoard;
struct TResult
{
    TBoard Board;
    bool IsOk;
    TResult(const TBoard& ABoard, bool AIsOk)
     : Board(ABoard), IsOk(AIsOk){}
};
TBoard AddQueen(const TBoard& ABoard, int r, int c)
{
    TBoard Board = ABoard;
    assert(Board[r][c] == ' ');
    Board[r][c] = 'Q';
    for(int i = 0; i < 8; ++i){
        if(i == r) continue;
        Board[i][c] = 'A';
    }
    for(int i = 0; i < 8; ++i){
        if(i == c) continue;
        Board[r][i] = 'A';
    }
    for(int i = -std::min(r, c); i < 8 - std::max(r, c); ++i){
        if(i == 0) continue;
        Board[r+i][c+i] = 'A';
    }
    for(int i = -std::min(r, 7-c); i < 8 -std::max(r, 7-c); ++i){
        if(i == 0) continue;
        Board[r+i][c-i] = 'A';
    }
    return Board;
}

TResult Solve(const TBoard& ABoard, int n)
{
    if(n == 0) return TResult(ABoard, true);
    TBoard Board = ABoard;
    for(int r = 0; r < 8; ++r){
        for(int c = 0; c < 8; ++c){
            if(Board[r][c] != ' ') continue;
            TResult Result = Solve(AddQueen(Board, r, c), n-1);
            if(Result.IsOk) return Result;
        }
    }
    return TResult(Board, false);
}
void Print(const TBoard& Board, std::ostream& out)
{
    for(int r = 0; r < 8; ++r){
        for(int c = 0; c < 8; ++c){
            char symbol = Board[r][c] == 'Q' ? 'Q' : '.';
            out << symbol;
        }
        out << std::endl;
    }
}
int main()
{
    int k;
    std::cin >> k;
    TBoard Board(8, std::vector<char>(8, ' '));
    for(int i = 0; i < k; ++i){
        int r, c;
        std::cin >> r >> c;
        Board = AddQueen(Board, r, c);
    }
    // Print(Board, std::cout);
    TResult Result = Solve(Board, 8 - k);
    Print(Result.Board, std::cout);
    return 0;
    
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int k,x; cin>>k>>x;
	for(int i=x-k+1;i<k+x;i++){
		cout<<i<<(i==k+x-1?"\n":" ");
	}
	return 0;
}

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

int main(){
    int N;
    cin>>N;
    vector<int> a(N),A(N);
    for(int i=0;i<N;i++){
        cin>>a.at(i);
    }
    for(int i=0;i<N;i++){
        A.at(a.at(i)-1)=i+1;
    }
    for(int i=0;i<N;i++){
        cout<<A.at(i)<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
const ll MOD = (ll)1e9+7;
//const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define OUTPUT(x) (output(x), output("\n"))
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
        if(b&1)res = res * x % MOD;
        x = x * x % MOD;
        b>>=1;
    }
    return res;
}

ll modinv(ll x){
    return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
}
void outendl(){
    was_output = false;
    cout << endl;
}
ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
}

ll C(ll a, ll b){
    ll res = 1;
    rep(i, b){
        res *= (a-i) * modinv(i+1) % MOD;
        res %= MOD;
    }
    return res;
}

int main(){
    ll n = in();
    ll a = in();
    ll b = in();
    ll ans = modpow(2, n) - 1;
    ans = ans - C(n, a) - C(n, b);
    ans = (ans % MOD + MOD) % MOD;
    cout << ans << endl;
    return 0;
}


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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)



int main() {
	ll N;
	string S;
	cin >> N >> S;

	ll cnt = 0;
	bool used1[10] = {};
	rep(i,0,N-2) {
		if (used1[S[i] - '0']) continue;
		bool used2[10] = {};
		rep(j,i+1,N-1) {
			if (used2[S[j] - '0']) continue;
			bool used3[10] = {};
			rep(k,j+1,N) {
				if (used3[S[k] - '0']) continue;
				cnt++;
				used3[S[k] - '0'] = true;
			}
			used2[S[j] - '0'] = true;
		}
		used1[S[i] - '0'] = true;
	}

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    long long n, k;
    cin>>n>>k;
    if(k==0) {
        cout << n <<endl;
        return 0;
    }
    if(n >= k) n %= k;

    if(n <= k/2) {
        cout << n <<endl;
        return 0;
    }
    if(n > k/2) {
        cout << k-n <<endl;
        return 0;
    }

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int n,i;
    scanf("%d",&n);
    long long a[n],p=1;
    for(i=0;i<n;i++) scanf("%lld",&a[i]);
    for(i=0;i<n;i++)
    {
        if(a[i]==0)
        {
            printf("0\n");
            return 0;
        }
    }
    for(i=0;i<n;i++)
    {
        if(a[i]>1000000000000000000/p)
        {
            printf("-1\n");
            return 0;
        }
        else p*=a[i];
    }
    printf("%lld\n",p);
}

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

template<typename T>
void read(T &ans){T f = 1; char c = getchar();ans = 0;while(!isdigit(c)){if(c == '-')f = -1;c = getchar();}while( isdigit(c)){ans = ans*10 + c - '0';c = getchar();}ans *= f;}

#define int long long 
int n, a[5][500], sum[5][500];

signed main(){
    read(n);
    for(int i = 1; i <= 2; i++)
        for(int j = 1; j <= n; j++){
            read(a[i][j]);
            sum[i][j] = sum[i][j-1] + a[i][j];
        }
    
    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans = max(ans, sum[1][i] + sum[2][n] - sum[2][i-1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
let rec init_hash i h =
  if i = 0 then ()
  else
    let s = read_line () in
    let v = try Hashtbl.find h s with _ -> 0 in
    Hashtbl.replace h s (v + 1) ;
    init_hash (i - 1) h

let n = read_int ()
let b = Hashtbl.create n
let () = init_hash n b

let m = read_int ()
let r = Hashtbl.create m
let () = init_hash m r

let () =
  Hashtbl.fold (fun k v tmp ->
      let red = try Hashtbl.find r k with _ -> 0 in 
      max tmp (v - red))
    b 0
  |> Printf.printf "%d\n"

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

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

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// テーブルを作る前処理
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int N,M;
    cin >> N >> M;

    vector<ll> a(N,1);
    vector<bool> b(N,false);
    b[0] = true;

    REP(i,M) {
        int x,y;
        cin >> x >> y;
        x--;y--;

        a[y]++;
        if(b[x]) b[y] = true;

        a[x]--;
        if(a[x]==0) b[x] = false;
    }

    int ans = 0;
    REP(i,N) if(b[i]) ans++;

    pl(ans)

    return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2])
    {
        cout << "Yes" << '\n';
    }
    else if (s[0] == s[2] && s[1] == s[3] && s[0] != s[1])
    {
        cout << "Yes" << '\n';
    }
    else if (s[0] == s[3] && s[1] == s[2] && s[0] != s[1])
    {
        cout << "Yes" << '\n';
    }
    else
    {
        cout << "No" << '\n';
    }
    return 0;
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
 
using namespace std;
int MOD = 1000000007;
 
signed main(){

    int n,k;
    cin >> n >> k;
    int h[100010] = {0};
    rep(i,n)cin >> h[i];

    int dp[100010] = {0};

    dp[1] = abs(h[1] - h[0]);
    for(int i = 2;i <= n-1;i++){
        dp[i] = abs(h[i]-h[i-1])+dp[i-1];
        for(int j = 2;j <= k  && i-j >= 0;j++){
            dp[i] = min(dp[i],abs(h[i]-h[i-j])+dp[i-j]);
        }
    }

    cout << dp[n-1] << endl;
    

    return 0;   
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://dp.contest.atcoder.jp/tasks/dp_a
// rm -r -f test;oj dl http://yahoo-procon2017-qual.contest.atcoder.jp/tasks/yahoo_procon2017_qual_c

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL N; cin >> N;
		UL D; cin >> D; D *= 2;
		UL A; cin >> A;
		vector<pair<UL, UL>> XH(N);
		rep(i, N) cin >> XH[i].first >> XH[i].second;
		rep(i, N) XH[i].second = (XH[i].second - 1) / A + 1;
		A = 1;
		sort(XH.begin(), XH.end());
		deque<pair<UL, UL>> q;
		ULL ans = 0;
		UL d = 0;
		rep(i, N) {
			UL p = XH[i].first;
			UL h = XH[i].second;
			while (q.size()) {
				if (q.front().first < p) {
					d -= q.front().second; q.pop_front();
				}
				else break;
			}
			if (h > d) {
				q.push_back({ p + D, h - d });
				ans += h - d;
				d = h;
			}
		}
		cout << ans << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
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(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n;
    cin>>n;
    int ans=1;
    FOR(i,2,n){
        int t=i*i;
        while(t*i<=n){
            t*=i;
        }
        if(t<=n){
            chmax(ans,t);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 
#define MAX_CHAR 256

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;

void solve(){
    ll x;
    cin>>x;
    ll curr=100;
    ll cmpd;
    int count=0;
    while(curr<x){
        cmpd=curr/100;
        count+=1;
        curr+=cmpd;
    }
    out(count);
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int maxN = 1e6+7;
const int maxV = 90010;
//const int INF = 1e9+9;
//const ll INF = (1ll)<<60;
const int INF = 2e9+9;
const ull MOD = 16769023;
const ull MOD1 = 1125899839733759;
int n,k;
int main()
{
	scanf("%d%d",&n,&k);
	int ans = 0;
	if(k == 1)
		ans = 0;
	else 
		ans = n-k;
	cout<<ans<<endl;
	return 0;
}


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

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c;
    cin>>a>>b>>c;
    int req=c%b;
    int rep=a%b;
    int temp=b,aa=a;
    if(a==1){
        cout<<"YES";
        return 0;
    }
    while(temp)
    {

        a+=aa;
        if(a%b==req){
            cout<<"YES\n";
            return 0;
        }
        if(a%b==rep){
            break;
        }
        temp--;
    }
    cout<<"NO";
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repA(i,a,n) for(int i=a;i<n;i++)
#define trav(a,x)for(auto &a: x)
#define fll(a) memset(a,0,sizeof(a));
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define itr(it,x) for(auto it=x.begin();it!=x.end();it++)
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
typedef vector<int>vi;
typedef map<int,int>ma;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
void fopen()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);   
}
void solve()
{
  int n,k;
  cin>>n>>k;
  int a[n];
  rep(i,n)
  {
    cin>>a[i];
  }
  int dp[n];
  dp[0]=0;
  dp[1]=abs(a[1]-a[0]);
  repA(i,2,n)
  {
    dp[i]=INT_MAX;
    for(int j=i-1;j>=max(0,i-k);j--)
    {
      dp[i]=min(dp[j]+abs(a[j]-a[i]),dp[i]);
    }
  }
  cout<<dp[n-1];
}
int main()
{
  fastio;
  //fopen();
  int t;
  //cin>>t;
  rep(i,1)
  { 
    //cout<<"Case #"<<i+1<<": ";
    solve();
    cout<<endl;
  }
  
}

Measured memory_bytes: 1024
import collections

n = int(input())
ls = list(map(int, input().split()))

counter = collections.Counter()
for a in ls:
    counter[min(8, a // 400)] += 1
n_keys = len(counter.keys())
n8 = counter[8]
if n8 > 0:
    if n_keys == 1:
        n_min = 1
        n_max = n
    else:
        n_min = n_keys - 1
        n_max = n_min + n8
else:
    n_min = n_max = n_keys
print(n_min, n_max)

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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

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

	int n;
	cin >> n;

	vector<ll> a(n);
	for (auto& v : a) {
		cin >> v;
	}

	vector<ll> memo = a;
	for (int i = 0; i < n - 1; i++) {
		memo[i + 1] += memo[i];
	}

	ll ans = 0;
	map<ll, ll> mp;
	mp[0]++;

	for (auto& v : memo) {
		ans = mp.count(v) != 0 ? ans + mp[v] : ans;
		mp[v]++;
	}

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


Measured memory_bytes: 15872
A,B,C = map(int,input().split())
count7 = 0
count5 = 0

ans = [A,B,C]

for i in ans:
    if i == 7:
        count7 += 1
    elif i == 5:
        count5 += 1

if count7 == 1 and count5 == 2:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

const int N = 85;

char a[N], b[N];

void reverse(char a[]) {
	int len = strlen(a);
	for (int i=0, j=len-1; i<j; ++i, --j) {
		char tmp = a[i];
		a[i] = a[j];
		a[j] = tmp;
	}
}

void add(char a[], char b[]) {
	int lenA = strlen(a);
	int lenB = strlen(b);
	int i, j, tmp, jin = 0;
	for (i=0; i<lenA && i<lenB; ++i) {
		tmp = (a[i] - '0') + (b[i] - '0') + jin;
		a[i] = tmp % 10 + '0';
		jin = tmp / 10;  
	}
	if (!a[i] && !b[i] && jin) {
		a[lenA] = jin + '0';
		a[lenA + 1] = '\0';
	}
	else if (a[i] && !b[i]) {
		for (; i<lenA; ++i) {
			tmp = a[i] - '0' + jin;
			a[i] = tmp % 10 + '0';
			jin = tmp / 10;
		}
		if (jin) {
			a[lenA] = jin + '0';
			a[lenA + 1] = '\0';
		} 
	}
	else if (!a[i] && b[i]) {
		for (; i<lenB; ++i) {
			tmp = b[i] - '0' + jin;
			a[i] = tmp % 10 + '0';
			jin = tmp / 10;
		}
		if (jin) {
			a[lenB] = jin + '0';
			a[lenB + 1] = '\0';
		}
		else a[lenB] = '\0';
	}
}

int main() {
	int t;
	scanf ("%d", &t);
	while (t--) {
		scanf ("%s%s", a, b);
		if (strlen(a) > 80 || strlen(b) > 80) printf ("overflow\n");
		else {
			reverse(a);
			reverse(b);
			add(a, b);
			if (strlen(a) > 80) printf ("overflow\n");
			else reverse(a), printf ("%s\n", a);
		}
	}
	return 0;
}

Measured memory_bytes: 0
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string input = Console.ReadLine();
                if (input == "-")
                    break;
                int shufflecnt = int.Parse(Console.ReadLine());//?????£??????????????°
                int[] shufflenum = new int[shufflecnt];

                for (int i = 0; i < shufflecnt; i++)
                {
                    shufflenum[i] = int.Parse(Console.ReadLine());
                }


                for (int i = 0; i < shufflecnt; i++)
                {
                    string left = input.Substring(0, shufflenum[i]);//?????¨???????????????
                    string right = input.Substring(shufflenum[i]);//?????¨???????????????
                    input = right + left;//??????????????£??\
                }

                Console.WriteLine(input);
            }
            
        }
    }
}

Measured memory_bytes: 8988
n, k, s = map(int, input().split())
ans = []
if s == 10**9:
    for i in range(k):
        ans.append(10**9)
    for i in range(n-k):
        ans.append(1)
    print(" ".join(map(str, ans)))

else:
    for i in range(k):
        ans.append(s)
    for i in range(n-k):
        ans.append(10**9)

    print(" ".join(map(str, ans)))


Measured memory_bytes: 12056
h,w = map(int,input().split())	
s=[0 for i in range(h)]
for i in range(h):
    s[i]=list(input())
n=[["." for _ in range(w+2)]for _ in range(h+2)]
for i in range(h):
    for j in range(w):
        n[i+1][j+1]=s[i][j]
    

for i in range(h+2):
    for j in range(w+2):
        if(n[i][j]=="."):
            n[i][j]=0
        else:
            n[i][j]="1"


for i in range(h):
    for j in range(w):
        if(n[i+1][j+1]=="1"):
            if(n[i][j]!="1"):
                n[i][j]+=1
            if(n[i][j+1]!="1"):
                n[i][j+1]+=1
            if(n[i+1][j]!="1"):
                n[i+1][j]+=1
            if(n[i][j+2]!="1"):
                n[i][j+2]+=1
            if(n[i+2][j]!="1"):
                n[i+2][j]+=1
            if(n[i+1][j+2]!="1"):
                n[i+1][j+2]+=1
            if(n[i+2][j+1]!="1"):
                n[i+2][j+1]+=1
            if(n[i+2][j+2]!="1"):
                n[i+2][j+2]+=1

for i in range(h+2):
    for j in range(w+2):
        if(n[i][j]=="1"):
            n[i][j]="#"

for i in range(h):
    for j in range(w):
        s[i][j]=n[i+1][j+1]
        
for i in range(h):
    print(''.join(map(str,s[i])))

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

using namespace std;
int main(){
    long long a,b,v,w,t;
    cin >> a >> v >> b >> w >> t;
    int i,j,flag=0;
    long long sub=v-w;
    long long qwe=b-a;



    if(sub>0&&qwe>0){
        if(sub*t>=qwe)
            flag=1;
    }
    else if(sub>0&&qwe<0){
        if(sub*t>=abs(qwe))
            flag=1;
    }
    /*
    if(sub<0&&qwe<0){
        sub=abs(sub);
        qwe=abs(qwe);
        if(sub*t>=qwe)
            flag=1;
    }
*/

    if(flag)
        cout << "YES";
    else
        cout << "NO";
}


Measured memory_bytes: 3636
#include<stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define T !0
#define F 0

int prime[100010];
int s[100010];
void makep(ll n){prime[0]=prime[1]=T;for(int i=2;i*i<=n;i++)if(!prime[i])for(int j=i*i;j<=n;j+=i)prime[j]=T;}

int main(){
	makep(100005);
	rep(i,1,100005){
		s[i]=s[i-1];
		if(!prime[i]&&!prime[(i+1)/2])s[i]++;
	}
	int q;
	scanf("%d",&q);
	while(q--){
		int l,r;
		scanf("%d%d",&l,&r);
		printf("%d\n",s[r]-s[l-1]);
	}
	return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var array = Console.ReadLine().Split().Select(_ => decimal.Parse(_)).ToArray();
            var A = array[0];
            var B = array[1];

            var c = Math.Ceiling((B - 1) / (A-1));

            Console.WriteLine(c);
        }
    }
}


Measured memory_bytes: 13396
import sys
range = xrange
input = raw_input

k = int(input()) - 1
print [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][k]


Measured memory_bytes: 27884
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(){
    char a[81];
    int size;
    int i,t;
    while(fgets(a,81,stdin)!=NULL){
    size = strlen(a);
    for(t=0;t<26;t++){
        for(i=0;i<size;i++)if(isalpha(a[i]))a[i] = 'a'+(a[i]+1-'a')%26;
        for(i=0;i<size;i++){
            if(a[i]=='t'&&a[i+1]=='h'){
                if(a[i+2]=='e'||(a[i+2]=='i'&&a[i+3]=='s')||(a[i+2]=='a'&&a[i+3]=='t')){
                    printf("%s",a);
                    break;
                }
            }
        }
    }
    }
}

Measured memory_bytes: 948
package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	var n2, n4 int
	for i := 0; i < n; i++ {
		var t int
		fmt.Scanf("%d", &t)
		if t%4 == 0 {
			n4++
		} else if t%2 == 0 {
			n2++
		}
	}
	n1 := n - n2 - n4
	if n2 != 0 {
		if n4 >= n1 {
			fmt.Printf("Yes\n")
		} else {
			fmt.Printf("No\n")
		}
	} else {
		if n4 != 0 && n4+1 >= n1 {
			fmt.Printf("Yes\n")
		} else {
			fmt.Printf("No\n")
		}
	}
}


Measured memory_bytes: 5504
n,m,q = map(int,input().split())
qd = []
for _ in range(q):
    qd.append(list(map(int,input().split())))

def calc_score():
    res = 0
    for i,j,c,d in qd:
        if a[j-1]-a[i-1] == c:
            res += d
    return res

a = []
score = [-1<<31]

def dfs(i,l,depth):  # i location filling # l largest
    if i == n:
        score[0] = max(score[0],calc_score())
        return
    for j in range(l, m+1):
        a.append(j)
        dfs(i+1,j,depth+1)
        a.pop()

dfs(0,1,0)

print(score[0])


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    vector<int> B(N);
    B = A;
    sort(B.begin(), B.end());
    int max1 = B[N-1];
    int max2 = B[N-2];

    for(int i=0; i<N; i++) {
        if(A[i] == max1) cout << max2 << endl;
        else cout << max1 << endl;
    }
}

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define popcnt __builtin_popcount
#define getBit(x, k) ((x >> k) & 1)
#define all(x) (x).begin(),(x).end()
// ---------------------------------

void Main() {
  int n; cin >> n;
  vector<int> a(n);
  for (auto &i : a) cin >> i;
  int ans = 0, cnt = 0, mi = 2e9;
  for (auto &i : a) {
    ans += abs(i);
    if (i < 0) cnt++;
    mi = min(mi, abs(i));
  }
  if (cnt % 2) ans -= mi * 2;
  cout << ans << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  cerr << "- ---- -- ----- <3\n";
#endif
  cin.tie(0)->sync_with_stdio(0);
  int T = 1;
  // cin >> T;
  while (T--) Main();
}


Measured memory_bytes: 3992
#include<iostream>
#include<string>
using namespace std;
static const int MAX_SIZE=3000;
string dp[2][MAX_SIZE+10];
int main(void){
	string s,t,ans;
		cin >> s >> t;
	int ss=s.size(),ts=t.size();
	
	for(int i=ss-1,k=0;i>=0;i--,k^=1){
		for(int j=ts-1;j>=0;j--){
			if(s[i]==t[j])
				dp[k][j]=dp[k^1][j+1]+s[i];
			else
				dp[k][j]=(dp[k][j+1].size()>dp[k^1][j].size()?dp[k][j+1]:dp[k^1][j]);
		}
	}
	
	for(int i=dp[ss%2^1][0].size()-1;i>=0;i--)
		cout << dp[ss%2^1][0][i];
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 16980
///a-digit two sum
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x,a,b,c,way,ans=0;
int main()
{
    int64_t p,p1,n,m=0,k=0;
    cin>>n;
    p=n;
    while(p>10)
    {
        p/=10;
        m=(m*10)+9;
        k++;
    }
    p1=pow(10,k);
    ans=k*9;
    for(int i=1;i<=9;i++)
    {
        if(p1*i+m<=n) ans++;
    }
   cout<<ans;


  return 0;
}


Measured memory_bytes: 256
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
from operator import itemgetter

n = int(input())
l = []
for i in range(n):
    a, b = list(map(int, input().split()))
    l.append([a, b])

l.sort(key=itemgetter(1))
t = 0
for i in l:
    t += i[0]
    if t > i[1]:
        print('No')
        exit()

print('Yes')


Measured memory_bytes: 39008
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
a = LI()
xor = 0
for x in a:
    xor ^= x
for x in a:
    print(xor^x,end=' ')
print()


Measured memory_bytes: 31592
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  ll Q, H, S, D; cin >> Q >> H >> S >> D;
  ll N; cin >> N;

  vector<ll> liter(2);
  liter[0] = min({D, 2 * S, 4 * H, 8 * Q});
  liter[1] = min({S, 2 * H, 4 * Q});
  vector<ll> num(2);
  num[0] = N / 2;
  num[1] = N % 2;
  ll ans = num[0] * liter[0] + num[1] * liter[1];
  cout << ans << endl;
}


Measured memory_bytes: 256
N, K = list(map(int, input().strip().split(" ")))
hList = []
for n in range(N):
    hList.append(int(input().strip()))

hList.sort()
answer = 1000000000
for i in range(N - (K-1)):
    answer = min(answer, hList[i+K-1] - hList[i])
print(answer)

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

using namespace std;

int reward(int x){
    if(x == 1) return 300000;
    if(x == 2) return 200000;
    if(x == 3) return 100000;
    return 0;
}

int main(){

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

    int x, y;

    cin >> x >> y;

    int sol = reward(x) + reward(y);

    if(x == y and x == 1) sol += 400000;
    
    cout << sol << '\n';

    return 0;
}

Measured memory_bytes: 256
import sys
import heapq
import numpy as np
INF = 1000000000


def dijkstra(grids, s):
    pq = [(s, 0)]
    while pq:
        u, dist = heapq.heappop(pq)
        if dist >= grids[u][2]:
            continue
        grids[u][2] = dist
        for v in grids[u][1]:
            heapq.heappush(pq, (v, dist + 1))


def main():
    h, w = [int(e) for e in input().split()]
    board = [input() for _ in range(h)]
    grids = [[0, [], INF] for _ in range(h * w)]
    blocks = h * w
    for i, s in enumerate(board):
        for j, c in enumerate(s):
            if c == '.':
                grids[(i * w) + j][0] = 1
                blocks -= 1
    for i, g in enumerate(grids):
        if g[0] == 0:
            continue
        if i % w > 0 and grids[i - 1][0] == 1:
            grids[i][1].append(i - 1)
        if i % w < w - 1 and grids[i + 1][0] == 1:
            grids[i][1].append(i + 1)
        if i // w > 0 and grids[i - w][0] == 1:
            grids[i][1].append(i - w)
        if i // w < h - 1 and grids[i + w][0] == 1:
            grids[i][1].append(i + w)
    dijkstra(grids, 0)
    print(max(-1, (h * w) - (blocks + grids[(h * w) - 1][2] + 1)))


main()


Measured memory_bytes: 12796
#include <iostream>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for( int i = 0; i < n; i++)
using namespace std;
using ll = unsigned long long;
int main()
{
    
    double n, k;
    cin >> n >> k ;
   
    double ans = 0.0L;
    rep(i,int(n)){
      int tmp   = int(i+1);
      double count = 1.0L;
      while( tmp < k ){
          tmp *= 2;
          count/=2.0L;
      }
      //ans += 1.0L / n * count;
      ans += 1.0L * count;
    }
    ans /= n ;
    
    //printf("%16.11Le",ans);
    printf("%.12f\n",ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define deb(x) cerr << "\n" \
                    << #x << "=" << x << "\n";
#define deb2(x, y) cerr << "\n"                   \
                        << #x << "=" << x << "\n" \
                        << #y << "=" << y << "\n";
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)

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

    int n;
    cin >> n;

    if (n % 10 == 2 || n % 10 == 4 || n % 10 == 5 || n % 10 == 7 || n % 10 == 9)
    {
        cout << "hon";
    }
    else
    {
        if (n % 10 == 3)
        {
            cout << "bon";
        }
        else
        {
            cout << "pon";
        }
    }

    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <limits>
#include <iterator>
#include <cmath>
#include <numeric>
#include <stack>
using namespace std;

template<class T> inline int GCD(T a, T b) { return b ? GCD(b, a % b) : a; }

int main() {
	int n; cin >> n;
	vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; }
	//左右から累積GCD
	vector<int> l(n + 1, 0), r(n + 1, 0);
	for (int i = 0; i < n; ++i) { l[i + 1] = GCD(l[i], a[i]); }
	for (int i = n - 1; i >= 0; --i) { r[i] = GCD(r[i + 1], a[i]); }

	//n-1個の累積GCD
	int res = 0;
	for (int i = 0; i < n; i++)
	{
		res = max(res, GCD(l[i], r[i + 1]));
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1408