akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    vl v(26, INF);
    rep(i, n) {
        string s;
        cin >> s;
        vl w(26);
        rep(j, s.size()) {
            w[s[j] - 'a']++;
        }
        rep(j, 26) {
            chmin(v[j], w[j]);
        }
    }

    rep(i, 26) {
        char c = 'a' + i;
        rep(j, v[i]) {
            cout << c;
        }
    }
    
    cout << endl;
    re0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/14  Problem: 063_arc_a / Link: https://abc047.contest.atcoder.jp/tasks/arc063_a?lang=en  ----- */
/* ------問題------

きつねの次郎と三郎が一次元リバーシで遊んでいます。一次元リバーシでは、盤面には白か黒の石が一列に並んだ状態となっており、列の右端か左端に新たに石を打っていきます。通常のリバーシと同じように、たとえば白の石を打つことで黒の石を挟むと、挟まれた黒の石は白い石に変わります。
ゲームの途中で三郎に急用ができて帰ってしまうことになりました。このとき、盤面の状態は文字列 S で表されます。石は |S| (文字列の長さ) 個並んでおり、左から i (1≦i≦|S|) 個目の石の色は、S の i 文字目が B のとき黒、W のとき白です。
次郎は現在の盤面に対して、できるだけ少ない個数の石を新たに打つことで全ての石を同じ色にしようと考えました。最小で何個の石を打てばよいかを求めてください。

-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	string s;
	cin >> s;
	char t = s[0];
	FOR(i, 1, SZ(s)) {
		if (t != s[i]) {
			t = s[i];
			ans++;
		}
	}
	cout << ans << "\n";

	return 0;
}


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

int main() {
    long long x, money, res; cin >> x;
    res = 0;
    money = 100;
    while(true) {
        money *= 1.01;
        ++res;
        if(money >= x) {
            cout << res << endl;
            return 0;
        }
    }
    return 0;
}

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

int main(int argc, char **argv) {
	string s;
	cin >> s;
	bool ok = false;
	for (int i = 0; i < (int)s.length(); ++i) {
		for (int j = i + 1; j < (int)s.length(); ++j) {
			ok |= s[i] == 'C' && s[j] == 'F';
		}
	}
	cout << (ok ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
bingo = []
for i in range(3):
    A1, A2, A3 = map(int, input().split())
    bingo.append(A1)
    bingo.append(A2)
    bingo.append(A3)

N = int(input())
b_list = []
for i in range(N):
    b = int(input())
    b_list.append(b)

for i in range(3):
    if ((bingo[i-1] in b_list) and (bingo[i+2] in b_list) and (bingo[i+5] in b_list)):
        print("Yes")
        exit()

    elif ((bingo[3*(i-1)] in b_list) and (bingo[3*(i-1)+1] in b_list) and (bingo[3*(i-1)+2] in b_list)):
        print("Yes")
        exit()

if ((bingo[0] in b_list) and (bingo[4] in b_list) and (bingo[8] in b_list)):
    print("Yes")
    exit()

elif ((bingo[2] in b_list) and (bingo[4] in b_list) and (bingo[6] in b_list)):
    print("Yes")
    exit()

else:
    print("No")

Measured memory_bytes: 3064
// Standard I/O
#include <iostream>
#include <sstream>
#include <cstdio>
// Standard Library
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
// Template Class
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
// Container Control
#include <algorithm>

using namespace std;

#define rep( i, n ) for( int i = 0; i < n; ++i )
#define irep( i, n ) for( int i = n-1; i >= 0; --i )
#define reep( i, s, n ) for ( int i = s; i < n; ++i )
#define ireep( i, n, s ) for ( int i = n-1; i >= s; --i )
#define foreach(itr, x) for( typeof(x.begin()) itr = x.begin(); itr != x.end(); ++itr)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all( v ) v.begin(), v.end()
#define fs first
#define sc second
#define vc vector

// for visualizer.html
double SCALE = 1.0;
double OFFSET_X = 0.0;
double OFFSET_Y = 0.0;
#define LINE(x,y,a,b) cerr << "line(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(a) + OFFSET_X << ","										\
	<< SCALE*(b) + OFFSET_Y << ")" << endl;
#define CIRCLE(x,y,r) cerr << "circle(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(r) << ")" << endl;

typedef long long ll;
typedef complex<double> Point;

typedef pair<int, int> pii;
typedef pair<int, pii> ipii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector< vector<int> > vii;
typedef vector< vector<double> > vdd;

typedef vector<int>::iterator vi_itr;

const int IINF = 1 << 28;
const double INF = 1e30;
const double EPS = 1e-10;
const double PI = acos(-1.0);

// Direction : L U R D
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1 };

struct UnionFind
{
	vi root;

	UnionFind ( int N ){
		root.resize(N);
		rep(i, N) root[i] = i;
	}

	int check_root ( int x )
	{
		if( root[x] == x ) return x;
		return root[x] = check_root(root[x]);
	}
	
	void unite ( int x, int y )
	{
		int root_x = check_root(x), root_y = check_root(y);

		if( root_x == root_y ) return;
		root[root_y] = root_x;
	}
	
	int check ( int x, int y  )
	{
		int root_x = check_root(x), root_y = check_root(y);

		return root_x == root_y;
	}
};

int N, M;
vi lang[100000];
int main()
{
	cin >> N >> M;
	rep(i, N){
		int k;
		cin >> k;
		rep(j, k){
			int l;
			cin >> l;
			--l;

			lang[l].pb(i);
		}
	}

	UnionFind uf(N);
	rep(i, M){
		reep(j, 1, lang[i].size()) uf.unite(lang[i][0], lang[i][j]);
	}

	int ans = 0;
	rep(i, uf.root.size()) if( uf.root[i] == i ) ++ans;
	cout << (ans == 1 ? "YES" : "NO") << endl;
}


Measured memory_bytes: 4608
function Main(input) {
input = input.split("\n");
tmp = input[2].split(" ");
var a = parseInt(input[0], 10);
var b = parseInt(input[1], 10);
var c = 0;
for (i=0; i<a; i++){
  if(parseInt(tmp[i], 10) <= b/2){
    c = c + parseInt(tmp[i], 10)*2;
  } else {
    c = c + (b - parseInt(tmp[i], 10))*2;
  }
}
  console.log('%s', c);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 23092
#include <iostream>
#include <bits/stdc++.h>
#include <stdio.h>
#include <string.h>
using namespace std;
int main(){
  int n;
  scanf("%d",&n);
  int a=n%10;
  int b=n/100;
  if(a==b)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: August 27 2019
 * 
 */

#include <bits/stdc++.h>

#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(i,x) for(auto i=0 ; i<(x); ++i)
#define ef else if
#define wh while
#define el else
#define ivv(x) int x; cin>>x
#define lv(x) bint x; cin>>x
#define sv(x) string x; cin>>x
#define cv(x) char x; cin>>x
#define fv(x) float x; cin>>x
#define dv(x) double x; cin>>x
#define endl '\n'
using namespace std;

auto SOLUTION_FUNCTION( void ) ->void {
    // your solution goes here 
    ivv(n);
    vi mx(2);
    vi v(n);
    rep(i,n){
        cin>>v.at(i);
        if(v.at(i)>mx.at(0)){
            mx.at(1)=mx.at(0);
            mx.at(0)=v.at(i);
        }else if( v.at(i)>mx.at(1) ){
            mx.at(1)=v.at(i);
        }
    }
    rep(i,n){
        if(v.at(i)<mx.at(0)){
            cout<<mx.at(0)<<'\n';
        }else{
            cout<<mx.at(1)<<'\n';
        }
    }
    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("input","r",stdin);
    freopen("output","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>
#include <tuple>



typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
#define rep(i,n) FOR(i,0,n)
#define sz(x) int(x.size())


template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;
vector<int> v;
int n;
const int inf=2147483647;

void update (int i, int x){
    i+=n-1; //セグ木内でのindexに変換
    v[i]=x;
    while(i>0){
        i=(i-1)/2;
        v[i]=min(v[2*i+1],v[2*i+2]);
    }
}

int query(int a,int b,int k,int l,int r){
    // l,rは今見ている木のkが担当する区間
    if (b<=l || r<=a) return inf;
    if (a<=l && r<=b) return v[k];
    
    else{
        int c1=query(a,b,2*k+1,l,(l+r)/2);
        int c2=query(a,b,2*k+2,(l+r)/2,r);
        return min(c1,c2);
    }
}





int main(){
    int N,Q;
    cin>>N>>Q;
    n=1;
    while(n<N) n*=2;
    v=vector<int>(2*n-1,inf); //セグ木の初期化
    rep(i,Q){
        int com,a,b;
        cin>>com>>a>>b;
        if (com==0){
            // updateさせる
            update(a,b);
        }else {
            //最小値を探す
            b++;
            cout<<query(a,b,0,0,n)<<endl;
        }
        
    }
    
    
    return 0;
}


Measured memory_bytes: 3800
import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt();
      	long answer = 0;
      	Map<String, Long> map = new HashMap<>();
      	for(int i = 0 ; i < n ; i ++){
        	String s = scan.next();
          	String[] k = s.split("");
          	Arrays.sort(k);
          	String sortedstr = String.join("", k);
          	//String sortedstr = new String(k);
          	if(map.containsKey(sortedstr)){
              	answer += map.get(sortedstr);
          		map.put(sortedstr, (map.get(sortedstr) + 1)); 	
            }
          	else{
            	map.put(sortedstr, (long)1);
            }
        }
      	
      	System.out.print(answer);
    }
}

Measured memory_bytes: 99016
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define popb(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  string s;
  int  a,b;
  cin>>s;
  rep(i,0,s.size()){
    if(s[i]=='A'){
      a=i;
      break;
    }
  }
  //cout<<a<<endl;
  rep(i,0,s.size()){
    if(s[s.size()-1-i]=='Z'){
      b=s.size()-i;
      break;
    }
  }
  //cout<<b<<endl;
  cout<<b-a<<endl;
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include<iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main()
{
	int n;
	vector<int> a;
	cin >> n;

	for (int i = 0; i < n; i++){
		int num;
		cin >> num;
		a.push_back(num);
	}

	sort(a.begin(), a.end());

	int length = 0;

	for (int i = 0; i < n - 1; i++){
		length += a[i + 1] - a[i];
	}

	cout << length;


	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;

int read() {
  int res = 0, w = 1; char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') c = getchar(), w = -1;
  while (isdigit(c)) res = (res << 1) + (res << 3) + c - '0', c = getchar();
  return res * w;
}

const int N = 1e5 + 10;

#define YES {puts("Yes"); return 0;}
#define NO {puts("No"); return 0;}

int n, m, k;
int op[N], x[N], y[N];

struct Union_Find {
  int fa[N];

  void init(int n) {
    for (int i = 1; i <= n; i++) fa[i] = i;
  }

  int find(int x) {
    return x == fa[x] ? x : fa[x] = find(fa[x]);
  }

  void merge(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return;
    fa[x] = y;
  }
} uf;

int main() {
  n = read(), m = read(), k = read();
  uf.init(n);
  for (int i = 1; i <= k; i++) {
    x[i] = read(), y[i] = read(), op[i] = read();
    x[i]++, y[i]++;
    if (op[i] == 0) uf.merge(x[i], y[i]);
  }
  bool fg = 0;
  for (int i = 1; i <= k; i++) {
    if (op[i] == 1) {
      if (uf.find(x[i]) == uf.find(y[i])) NO;
      fg = 1;
    }
  }
  int num = 0;
  for (int i = 1; i <= n; i++) if (i == uf.find(i)) num++;
  ll Min = num - !fg, Max = 1ll * num * (num - 1) / 2;
  if (Min <= m - (n - num) && m - (n - num) <= Max) YES
  else NO
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
using ll = long long;
vector <int> a;
bool b[N];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	for (int i = 2; i < N; ++i)
	{
		if (!b[i])
			a.emplace_back(i);
		for (int j : a)
		{
			if (i * j > N || j % i == 0)
				break;
			b[i * j] = 1;
		}
	}
	int x;
	cin >> x;
    cout << *lower_bound(begin(a), end(a), x);
}


Measured memory_bytes: 512
n, k = map(int,input().split())
tree_list = []
dif = 999999999
for i in range(n):
    tree_list.append(int(input()))
tree_list.sort()
for i in range(n-k+1):
    if dif > (tree_list[i+k-1] - tree_list[i]):
        dif = tree_list[i+k-1] - tree_list[i]
print(dif)


Measured memory_bytes: 7384
a,b = map(int,input().split())
if a==b:
  print(a)
else:
  ans = a
  if b-a<10**7:
    for i in range(a+1,b+1):
      ans = ans^i
    print(ans)
  else:
    if a%2==0:
      if (b-a)%4==1:
        print(1)
      elif (b-a)%4==2:
        print(b+1)
      elif (b-a)%4==3:
        print(0)
      else:
        print(b)
    else:
      if (b-a)%4==1:
        print(a^b)
      elif (b-a)%4==2:
        print(a-1)
      elif (b-a)%4==3:
        print((a-1)^b)
      else:
        print(a)

Measured memory_bytes: 3064
// Atcoder136 - B
function main(input) {
  var inputs = input.split('\n');
  var n = parseInt(inputs[0], 10);

  var counter = 0;
  for (var i = 1; i <= n; i++) {
    counter += `${i}`.length % 2 == 1 ? 1 : 0;
  }
  console.log(counter);
}

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


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

int main(int argc, char *argv[])
{
    string input;
    int sum;
    vector<int> output;
    while (cin >> input && input != "0")
    {
        for (int i = 0; i < input.size(); i++)
        {
            sum += input[i] - '0';
        }
        cout << sum << endl;
        sum = 0;
    }

    return 0;
}


Measured memory_bytes: 3184
N = int(input())
A = [int(x) for x in input().split()]

from collections import Counter

def f():
    cnt = Counter(A)
    m = N - 1
    for k, v in cnt.items():
        if k == 0 and v == 1: continue
        if v != 2 or k > m:
            return 0
    return pow(2, N//2, 10**9 + 7)

print(f())

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

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

  vector<ll> bit1(60);
  vector<ll> bit0(60);
  for (ll i = 0; i < n; ++i) {
    for (ll j = 0; j < 60; ++j) {
      if (a[i]>>j & 1) bit1[j]++;
      else bit0[j]++;
    }
  }

  ll ans = 0;
  for (ll i = 0; i < 60; ++i) {
    ll x = bit1[i]*bit0[i];
    for (ll j = 0; j < i; ++j) {
      x = x * 2 % MOD;
    }
    ans = (ans + x) % MOD;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    int diff = 1000;
    int ans = 0;
    for(int i = 1; i <= 9; i++){
        int next = i*111;
        if(next - n < diff && next - n >= 0){
            diff = next - n;
            ans = next;
        };
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque
mod = 10**9 + 7
n, k = map(int, input().split())
edges = [[]*n for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

root = 0
d = deque([root])
visited = [False]*n
visited[root] = True
colored = [-1]*n
colored[root] = k
while d:
    p = d.pop()
    count = 0
    for c in edges[p]:
        if visited[c]:
            continue
        visited[c] = True
        d.append(c)
        if p == root:
            colored[c] = (k-1-count) % mod
        else:
            colored[c] = (k-2-count) % mod
        count += 1
ans = 1
for i in range(n):
    ans = ans*colored[i] % mod
print(ans)

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

using namespace std;

int main() {
    set<int> st;
    for (int i = 0; i < 3; ++i) {
        int a;
        cin >> a;
        st.insert(a);
    }

    cout << (st.size() == 2 ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }

        int prev = (H[0] > 1) ? H[0] - 1 : H[0];

        for (int i = 1; i < N - 1; i++) {
            int target = H[i];
            int next = H[i + 1];

            // next が target より 2以上低い場合は無理
            if ((target - next) > 1) {
                System.out.println("No");
                return;
            } else if ((target - next) == 1) {
                // next が target より 1低い場合は、target を 1下げた結果を prev と比較する
                target -= 1;
                if (prev > target) {
                    System.out.println("No");
                    return;
                }
            } else {
                // next が target の高さ以上の場合、target と prev を比較して target を下げられる場合は下げる
                if (prev < target) {
                    target -= 1;
                }
            }

            prev = target;
        }

        System.out.println("Yes");
    }
}


Measured memory_bytes: 48568
#include <bits/stdc++.h>
using namespace std;
#include <math.h> 
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll a,b;
	cin>>a>>b;
	string s,t;
	for(ll i=0;i<b;i++){
		char now=char(a+'0');
		s.push_back(now);
	}
	for(ll i=0;i<a;i++){
		char now=char(b+'0');
		t.push_back(now);
	}
	if(s<t){
		cout <<s;
	}
	else{
		cout <<t;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+10 , OO = 0x3f3f3f3f;

#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(n) for(int &x : n) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
typedef pair <int,int> pii ;
typedef vector < pii > vii ;
typedef vector < int > vi;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

int rkm1 , rkm2;


int main()
{   

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

      cin >> rkm1 >> rkm2;
      if(500*rkm1 >= rkm2) cout << "Yes\n";
      else cout << "No\n";




    
      return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(ll i=0;i<n;++i)
#define END(x) (*(x.end()-1))
#define INF INT_MAX/2

using namespace std;
typedef long long ll;


template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a/gcd(a,b)*b;
}

int main(void){
    ll N,W;
    cin>>N>>W;
    vector<ll>w(N);
    vector<ll>v(N);
    rep(i,N){
        cin>>w[i]>>v[i];
    }
    ll dp[110][100010];//選ぶ品物：価値
    //dp[n][w] n個目までを選んで、価値wを達成できる重さの最小値
    rep(i,100010){
        dp[0][i]=INF;
    }
  dp[0][0]=0;
    rep(i,N){
        rep(j,100010){
            if(j-v[i]>=0){//入れる
                dp[i+1][j]=min(dp[i][j-v[i]]+w[i],dp[i][j]);
            }
            else{//入れない
                dp[i+1][j]=dp[i][j];
            }
        }
    }

    ll ans=0;
    rep(i,100010){
        if(dp[N][i]<=W){
            ans=i;
        }
    }
    cout<<ans;
}
/*

*/


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

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> bits(64, 0);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        for (int j = 0; j < 64; ++j) {
            if (((A[i] >> j) & 1) == 1) bits[j]++;
        }
    }
    ll ans = 0;
    ll mod = 1000000007;
    for (int i = 0; i < N - 1; ++i) {
        for (int j = 0; j < 64; ++j) {
            ll ones = bits[j];
            if (((A[i] >> j) & 1) == 1) {
                bits[j]--;
                ones = N - i - 1 - bits[j];
            }
            ans = (ans + (((1LL << j) % mod) * ones) % mod) % mod;
        }
    }
    cout << ans << endl;
}


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

int main() {

    int N;
    cin >> N;

    int cnt = 0;
    bool ans = false;
    for (int i = 0; i < N; i++) {
        int d1, d2;
        cin >> d1 >> d2;

        if (d1 == d2) {
            cnt++;
        } else {
            cnt = 0;
        }

        if (cnt == 3) {
            ans = true;
        }
    }

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

    return 0;
}


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

using namespace std;

int main(void) {
	int N,M;
	while (cin >> N >> M, N) {
		map<int,int> data;
		vector<int> w(N),h(M);
		for (int i = 0; i < N; ++i) {
			cin >> w[i];
			++data[w[i]];
		}
		int temp;
		for (int i = 0; i < N-1; ++i) {
			temp = w[i];
			for (int j = i+1; j < N; ++j) {
				temp += w[j];
				++data[temp];
			}
		}

		int res = 0;
		for (int i = 0; i < M; ++i) {
			cin >> h[i];
			if (data[h[i]] > 0) {
				res += data[h[i]];
			}
		}
		for (int i = 0; i < M-1; ++i) {
			temp = h[i];
			for (int j = i+1; j < M; ++j) {
				temp += h[j];
				if (data[temp] > 0) {
					res += data[temp];
				}
			}
		}
		cout << res << endl;
	}
	return 0;
}

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

int main() {

  string S;
  long long K;
  cin >> S >> K;

  int answer = 1;

  for (int i = 0; i < min(K, (long long)S.size()); i++) {
    if ((S[i] - '0') != 1) {
      answer = S[i] - '0';
      break;
    }
  }

  cout << answer << endl;

  return 0;

}

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

//#define getchar getchar_unlocked
//#define putchar putchar_unlocked
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define ff first
#define ss second
#define err stderr
#define out stdout

typedef long long int ll;
typedef long double ld;
typedef short int sh;

inline void readI(int *i)
{
	register int t=0;
	register char z=getchar();
	int znak=1;
	if (z=='-')
	{
		znak=-1;
	}
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
		if (z=='-')
		{
			znak=-1;
		}
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*i=(t*znak);
}
inline void readUI(int *i)
{
	register int t=0;
	register char z=getchar();
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*i=t;
}
inline void readL(ll *l)
{
	register ll t=0;
	register char z=getchar();
	int znak=1;
	if (z=='-')
	{
		znak*=-1;
	}
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
		if (z=='-')
		{
			znak=-1;
		}
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*l=(t*znak);
}
inline void readUL(ll *l)
{
	register ll t=0;
	register char z=getchar();
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*l=t;
}
inline void writeL(ll l)
{
	if (l==0)
	{
		putchar(48);
	}
	else
	{
		if (l<0)
		{
		   l*=-1;
		   putchar(45);
		}
		int _tab[21];
		int wsk=0;
		while (l>0)
		{
			++wsk;
			_tab[wsk]=(l%10)+48;
			l/=10;
		}
		for (int j=wsk; j>=1; --j)
		{
			putchar(_tab[j]);
		}
	}
}
inline void writeS(string s)
{
	int l=s.length();
	for (int i=0; i<l; ++i)
	{
		putchar(s[i]);
	}
}
inline void space()
{
	putchar(32);
}
inline void endl()
{
	putchar(10);
}

#define debug if(1)
#define debug2 if(1)
#define debug3 if(1)
#define debug4 if(1)
#define MAXN (int)(3e3)+5

int n;
char s[MAXN];
ll P=(1e9)+7;
ll dp[MAXN][MAXN];

int main()
{
	scanf ("%d", &n);
	scanf ("%s", s+1);
	dp[1][1]=1;
	for (int i=2; i<=n; ++i)
	{
		if (s[i-1]=='<')
		{
			for (int j=1; j<=i; ++j)
			{
				dp[i][j]=dp[i-1][j-1];
				dp[i][j]+=dp[i][j-1];
				dp[i][j]%=P;
			}
		}
		else
		{
			for (int j=1; j<=i; ++j)
			{
				dp[i][j]=dp[i-1][i-1]-dp[i-1][j-1]+P;
				dp[i][j]+=dp[i][j-1];
				dp[i][j]%=P;
			}
		}
	}
	fprintf (out, "%lld\n", dp[n][n]);
	return 0;
}
/*
*/




Measured memory_bytes: 68992
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  
  int x, n;
  cin >> x >> n;
  vector<int> a(n);
  int ans = 0;
  rep(i,n){
    cin >> a[i];
    if(a[i] == x) ans = 1;
  }
  
  if(ans){
    for(int i = 1; i<101; i++){
      ans = 0;
      int check1 = x-i;
      int check2 = x+i;

      rep(j, n){
        if(check1 == a[j]) ans += 1;
        if(check2 == a[j]) ans += 2;
      }
      
      if(ans == 0 || ans == 2){
        cout << check1 << endl;
        break;
      }
      else if(ans == 1){
        cout << check2 << endl;
        break;
      }
    }
  }
  else cout << x << endl;
  
return 0;
}

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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var x = int.Parse(Console.ReadLine());

        for (int a = -118; a <= 119; ++a)
        {
            for (int b = -199; b <= 118; ++b)
            {
                if (a * a * a * a * a - b * b * b * b * b == x)
                {
                    Console.WriteLine($"{a} {b}");
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 27540
#include<iostream>
#define N 10000 
using namespace std;
int main(){
  int a[N],b[N],n,scoreA,scoreB;
  while(cin >> n,n != 0){
   
    scoreA = 0; scoreB =0;
  for(int i = 0;i < n;i++){
    cin >> a[i] >> b[i];
  }
  for(int i = 0;i < n;i++){
    if(a[i] > b[i]){
      scoreA += a[i]+b[i];
    } else if(a[i] < b[i]){
      scoreB += a[i]+b[i];
    } else if(a[i]==b[i]){
      scoreA = scoreA + a[i]; scoreB += b[i];
    }
  }
   
  cout << scoreA <<" " << scoreB << endl;
  }
 
}

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

int main(){
  int a, b;
  cin >> a >> b;
  if(a==1 && b==2||a==2 && b==1)cout << 3 << endl;
  if(a==1 && b==3||a==3 && b==1)cout << 2 << endl;
  if(a==2 && b==3||a==3 && b==2)cout << 1 << endl;
  
  return 0;
}

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

int main() {
	int n;
	while (cin >> n, n) {
		int cnt = 0;
		while (n) {
			n /= 5;
			cnt += n;
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 3100
#include<stdio.h>
#include<math.h>
int main(){


     for (int i = 1; ; i++)
     {
     char ch;
     int a,b;
     if(ch == '?') break;
     scanf("%d ",&a);   
     scanf(" %c", &ch);
     scanf(" %d",&b);
     if(ch == '+')printf("%d\n",a+b);
     if(ch == '-')printf("%d\n",a-b);
     if(ch == '*')printf("%d\n",a*b);
     if(ch == '/')printf("%d\n",a/b);
     }
        
    return 0;
}



Measured memory_bytes: 2052
s = input()
k = int(input())
n = len(s)
dic = []
for i in range(n):
    for j in range(1, k + 1):
        if i + j > n:
            break
        if s[i:i+j] not in dic:
            dic.append(s[i:i+j])
dic.sort()
print(dic[k-1])


Measured memory_bytes: 3944
n,x,m=map(int,input().split())

yj=[x]
lps=0
for i in range(n):
  an=(yj[i]**2)%m
  if an in yj:
    lps=yj.index(an)
    break
  yj.append(an)

blp=yj[:lps]
lp=yj[lps:]
ans=sum(blp)+sum(lp)*((n-len(blp))//len(lp))+sum(lp[:(n-len(blp))%len(lp)])
print(ans)


Measured memory_bytes: 68548
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;
ll f(ll a,ll b)
{
    return a*a*a*a*a-b*b*b*b*b;
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("a.in","r",stdin);
#endif
    ll x;
    cin>>x;
    ll now=0;
    while (now*now*now*now*now<=x)
    {
        ll y=0;
        while (y<=now&&now*now*now*now*now+y*y*y*y*y<=x)
        {
            if (now*now*now*now*now+y*y*y*y*y==x)
            {
                cout<<now<<" "<<-y;
                return 0;
            }
            y++;
        }
        now++;
    }
    now=0;
    while (f(now,now-1)<=x)
    {
        ll y=now-1;
        while (y>=0&&f(now,y)<=x)
        {
            if (f(now,y)==x)
            {
                cout<<now<<" "<<y;
                return 0;
            }
            y--;
        }
        now++;
    }





}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	int H, W;
	cin >> H >> W;
	vector<string> s(H);
	for (int i = 0; i < H; i++) cin >> s[i];

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (s[i][j] == '.') continue;
			if (i > 0 && s[i - 1][j] == '#') continue;
			if (i < H - 1 && s[i + 1][j] == '#') continue;
			if (j > 0 && s[i][j - 1] == '#') continue;
			if (j < W - 1 && s[i][j + 1] == '#') continue;

			printf("No\n");
			return 0;
		}
	}

	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int one[200],two[200],three[200];


int main(){
	int N;
	cin >> N;
	for(int i = 0;i < N;i++){
		cin >>one[i]>>two[i]>>three[i];
	}
	for(int k =0;k <N;k++){
		int score = 0;
		if(count(&one[0],&one[N],one[k]) == 1){
		score = score + one[k];	
		}
		if(count(&two[0],&two[N],two[k]) == 1){
		score = score + two[k];	
		}
		if(count(&three[0],&three[N],three[k]) == 1){
		score = score + three[k];	
		}
		cout << score<<endl;
	}
		return 0;
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int n;
int a[301];
int x[4];
double dp[901][601][301];
int main(){
	
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		x[a[i]]++;
	for(int k=0;k<=x[3];k++)
		for(int j=0;j<=x[2]+x[3];j++)
			for(int i=0;i<=x[1]+x[2]+x[3];i++)
			{
				double l=i+j+k;
				if(!l)continue;
				if(i)dp[i][j][k]+=(i/l)*(dp[i-1][j][k]+n/l);
				if(j)dp[i][j][k]+=(j/l)*(dp[i+1][j-1][k]+n/l);
				if(k)dp[i][j][k]+=(k/l)*(dp[i][j+1][k-1]+n/l);
			}
	printf("%.15lf",dp[x[1]][x[2]][x[3]]);
	return 0;
}

Measured memory_bytes: 425472
#include<bits/stdc++.h>
using namespace std;
int main(){
 long long int N;
  cin>>N;
  
  vector<long long int>A(N+1);
  vector<long long int>B(N);
  long long int max=0;
  
  for(long long int i=0;i<N+1;i++){
    cin>>A[i];
    max+=A[i];
          }
    
  for(long long int i=0;i<N;i++){
cin>>B[i];
  }
  
  long long int rest=0;
for(long long int i=0;i<N;i++){
  if(A[i]>B[i]){
    rest+=(A[i]-B[i]);
    if(i==N-1){
      rest+=A[i+1];
  }
  }
  else {
    A[i+1]-=(B[i]-A[i]);
    if(A[i+1]<0){
      A[i+1]=0;
    }
    if(i==N-1){
      rest+=A[i+1];
  }
  
}
}
  cout<<max-rest<<endl;
}
   
  
  

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

int main()
{
	int n, x;
	
	cin >> n;
	x = n%10;
	
	if(x==2||x==4||x==5||x==7||x==9){
		cout << "hon";
	}
	else if(x==0||x==1||x==6||x==8){
		cout << "pon";
	}
	else if(x==3){
		cout << "bon";
	}
	
	
return 0;
}

Measured memory_bytes: 3572
#include<iostream>
using namespace std;
int main()
{
  int N,ans;
  while(cin>>N,N){
    ans=0;
    for(int i=1;i<N;i++){
      int s=0;
      for(int j=i;j<N;j++){
	s+=j;
	if(s<N)continue;
	if(s>N)break;
	ans++;
	break;
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 0
#include <stdio.h>

int main(){
	int n;
	int ans;
	scanf("%d",&n);
	while(n != 0){
		ans = 0;
		for(int i = 1; i <= n; i++){
			if(i % 15625 == 0){
				ans += 6;
			}else if(i % 3125 == 0){
				ans += 5;
			}else if(i % 625 == 0){
				ans += 4;
			}else if(i % 125 == 0){
				ans += 3;
			}else if(i % 25 == 0){
				ans += 2;
			}else if(i % 5 == 0){
				ans += 1;
			}
		}

		printf("%d\n",ans);
		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 1028
from collections import defaultdict
from itertools import combinations
n=int(input())
s=[input() for i in range(n)]
cnt=defaultdict(lambda :0)
cnt['M']=0
for i in range(n):
    if s[i][0] in 'MARCH':
        cnt[s[i][0]]+=1

if len(cnt)<=2:print(0)
else:
    num=len(cnt)
    ans=0
    for x,y,z in combinations(list(cnt.values()), 3):
        ans+=x*y*z
    print(ans)


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

#pragma GCC optimize ("-O2")
#define ll long long
#define tr(container, it) for(auto it = container.begin(); it != container.end(); it++)
#define testcase(t) int t;cin>>t;while(t--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl '\n'
#define what_is(x)  cerr << #x << " is " << x << endl;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

const int N=1e5+5,MOD=1e9+7;

int main(){

	IOS;

	ll n,sum=0;
	cin>>n;
	for(int i=0;i<=n;i++){
		if(i%3==0 && i%5==0) continue;
		else if(i%3==0) continue;
		else if(i%5==0) continue;
		else sum+=i;
	}

	cout<<sum<<endl;
	






	return 0;
}
 
/*

*/









Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <iterator>
#include <utility>
#include <iomanip>
#include <stack>
#include<bitset>
#include <cmath>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
ll gcd(ll x,ll y){
	if(y==0)return x;
	return gcd(y,x%y);
}
ll absol(ll x)
{
	if (x<0)
	{
		return -x;
	}
	return x;
}
priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > >pq;
ll expo(ll b,ll n,ll m)
{
 ll r,p;
	p=1;
	 b=b%m;
	while(n>0)
	{ 
		r=n%2;
		if(r==1)
		   p=((p%m)*(b%m))%m;
		b=((b%m)*(b%m))%m; 
		n=n/2;		
	}
 return (p%m);
}
ll divide1(ll a,ll b,ll m)
	{ ll r,p,n;
			p=a%m;
				n=m-2;
				while(n>0){
						 r=n%2;
						if(r==1)
							p=((p%m)*(b%m))%m;
						b=((b%m)*(b%m))%m; 
						n=n/2;	
					}
	return (p%m); }
ll dp[3002][3002];
pair<ll,ll> prevva[3002][3002];
bool markka[3002][3002];
void maxxa(ll i,ll j,ll i1,ll j1)
{
	if (dp[i][j]>dp[i1][j1])
	{
		return ;
	}
	dp[i][j]=dp[i1][j1];
	prevva[i][j]=mp(i1,j1);
	return ;
}
int main(int argc, char const *argv[])
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);
	string s,t;
	cin>>s>>t;
	for (int i = 0; i<s.length(); ++i)
	{
		for (int j = 0; j < t.length(); ++j)
		{
			prevva[i][j]=mp(-1,-1);
			if(j>=1)
			 maxxa(i,j,i,j-1);
			
			if(i>=1)
			 maxxa(i,j,i-1,j);
			
			if (s[i]==t[j])
				{
				 if(i>=1&&j>=1)
					{
						dp[i][j]=1+dp[i-1][j-1];
						prevva[i][j]=mp(i-1,j-1);
						markka[i][j]=1;
					}
					else
					{
						if (dp[i][j]==0)
						{
							dp[i][j]=1;
							markka[i][j]=1;
						}
					}
				}
		}
	}
	// string ans[3004];
	// ll finale=0;
	// string finaleee;
	// for (int i = s.length()-1; i>=0; --i)
	// {
	// 	int j;
	// 	for (j = 0; j < t.length(); ++j)
	// 	{
	// 		if (s[i]==t[j])
	// 		{
	// 			break;
	// 		}
	// 	}
	// 	if (j==t.length())
	// 	{
	// 		continue;
	// 	}
	// 	ll x=0;
	// 	int k,k1;
	// 	string g;
	// 	for (k = i+1; k < s.length(); ++k)
	// 	{
	// 		if (ans[k].length()>x)
	// 		{
	// 			x=ans[k].length();
	// 			k1=k;
	// 		}
	// 	}
	// 	ans[i].pb(s[i]);
	// 	ans[i]=ans[i]+ans[k1];
	// 	if (ans[i].length()>finale)
	// 		{
	// 			finale=ans[i].length();
	// 			finaleee=ans[i];
	// 		}
	// }
	string ans;
	ll minnj=-1;
	pair<ll,ll>p=mp(s.length()-1,t.length()-1);
	pair<ll,ll> chk=mp(minnj,minnj);
	while(p!=chk)
	{
		if (markka[p.ff][p.ss]==1)
		{
			ans.pb(s[p.ff]);
		}
		p=prevva[p.ff][p.ss];
	}
	reverse(ans.begin(), ans.end());
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 220288
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        String word1 = s.next(),word2=s.next();
        word1+=word2.charAt(word2.length()-1);
        System.out.println(word1.equals(word2)?"Yes":"No");


    }

}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

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

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25432
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int tmp = 0;
            int ans = 0;
            while (true)
            {
                tmp = ans * (A-1) + 1;
                if (tmp >= B) break;
                ans += 1;
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>

int main(){
        int x;
        int n,h=0;
        int i,j;

        for(;;){

                scanf("%d",&n);
                if(n == 0){
                        break;
                }else{

                        i = n / 4;
                        for(j = 0; j < i; j++){
                                scanf("%d",&x);
                                h += x;

                        }
                        printf("%d\n",h);
                        h = 0;
                }
        }

        return 0;
}

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, M; cin >> N >> M;

  ll xL = 1;
  ll xH = xL + M;
  ll yL = xH + 1;
  ll yH = yL + (M-1);
  while (true) {
    if (xL >= xH) break;
    cout << xL << " " << xH << "\n";
    if (yL >= yH) break;
    cout << yL << " " << yH << "\n";
    xL += 1;
    xH -= 1;
    yL += 1;
    yH -= 1;
  }

  return 0;
}



Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define endl '\n'
#define pi 3.1415926536
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
signed main()
{   
    SPEED; 
  	int h,w,n,ans1,ans2,ans3,ans4;
  	cin>>h>>w>>n;
  	ans1=n/h;
    if((n%h)%w)
      ans1+=((n%h)/w+1);
    else
      ans1+=((n%h)/w);
  	ans2=n/w;
    if((n%w)%h)
      ans2+=((n%w)/h+1);
    else
      ans2+=((n%w)/h);
   if((n%w))
      ans3+=(n/w+1);
    else
      ans3+=n/w;
  	if((n%h))
      ans4+=(n/h+1);
    else
      ans4+=n/h;
  	cout<<min(min(ans1,ans2),min(ans3,ans4));
}    

Measured memory_bytes: 256
//-----------------------
// author : xyqkoala
// time : 2020-06-16
//-----------------------

#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve();


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


void solve(){
	int x,y;
	cin>>x>>y;
	if(y<2*x || (y-2*x)%2){
		cout<<"No"<<endl;
		return;
	}
	if((y-2*x)/2 > x){
		cout<<"No"<<endl;
		return;
	}
	cout<<"Yes"<<endl;
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[100005];
ll B[100005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> A[i];
    }

    B[0] = 0;
    REP(i, N - 1) {
        B[i + 1] = A[i] - B[i];
    }
    ll a = (A[N - 1] - B[N - 1]) / 2;

    REP(i, N) {
        ll x = B[i];
        if (i % 2 == 0)
            x += a;
        else
            x -= a;
        cout << 2 * x << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    printf("100 100\n");
    char c[100][100];
    for(int i=0; i<50; i++)
        for(int j=0; j<100; j++)
            c[i][j]='.';
    for(int i=50; i<100; i++)
        for(int j=0; j<100; j++)
            c[i][j]='#';
    int k=1;
    for(int i=99; i>50; i-=2)
        {for(int j=i%2; j<98; j+=2)
        {
            if(k==a)
                break;
            c[i][j]='.';
            k++;
        }
            if(k==a)
                break;
        }
        k=1;
    for(int i=0; i<50; i+=2)
        {for(int j=i%2; j<98; j+=2)
        {
            if(k==b)
                break;
            c[i][j]='#';
            k++;
        }
        if(k==b)
                break;
        }
    for(int i=0; i<100; i++)
    {
        for(int j=0; j<100; j++)
            printf("%c",c[i][j]);
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 256