akhauriyash/Code-Regression huggingface dataset:
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker,"/stack:200000000")
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define print(x) return cout<<x<<endl,0
#define watch(x) cerr<<"->"<<#x<<": "<<x<<endl
// #define int long long
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int INF = 1000000000;
const int MOD = 1000000007;
const long long INFLL = 1e18;
const long double PI = 2*acos(0.0);
signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s;
	cin >> s;
	int res = 0;
	int n = s.length();
	for(int i=0;i<n;i++)
	{
		if((i+1)<n&&(i+2)<n&&s[i]==s[i+1])
			res+=2,i+=2;
		else
		{
			res+=1;
			if(s[i]==s[i+1])
				break;
		}
	}
	print(res);
	return 0;	
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline void read(T &x){
	register short f=1;x=0;char c=getchar();
	while(!isdigit(c)){ if(c=='-')f=-1;c=getchar();}
	while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();
	x*=f;
}
template<typename T>inline void write(T x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
template<typename T>inline void writeln(T x){
	write(x),putchar('\n');
}
const short dx[9]={0,-1,-1,-1,0,0,1,1,1};
const short dy[9]={0,-1,0,1,-1,1,-1,0,1};
int main(){
	int h,w,a[60][60];
	read(h),read(w);
	for(int i=1;i<=h;i++){
		string s;cin>>s;
		for(int j=1;j<=w;j++)
			a[i][j]=s[j-1]=='.'?0:-1;
	}
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			if(a[i][j]==-1)
				for(int k=1;k<=8;k++){
					int tx,ty;
					tx=i+dx[k],ty=j+dy[k];
					if(a[tx][ty]!=-1)a[tx][ty]++;
				}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(a[i][j]==-1)putchar('#');
			else write(a[i][j]);
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod ((long long)(998244353))
vector<long long> fact;
vector<long long> factInv;

long long pow_mod(long long a, long long b) {
  long long ret = 1;
  while (b > 0) {
    if (b & 1) ret = ret * a % mod;
    a = a * a % mod;
    b = b >> 1;
  }
  return ret;
}

void comb_init(long long n) {
  fact.resize(n + 1);
  factInv.resize(n + 1);
  fact[0] = 1;
  for (long long i = 1; i <= n; i++) {
    fact[i] = (fact[i - 1] * i) % mod;
    fact[i] %= mod;
  }
  factInv[n] = pow_mod(fact[n], mod - 2);
  for (long long i = n - 1; i >= 0; i--) {
    factInv[i] = factInv[i + 1] * (i + 1) % mod;
  }
}

long long comb(long long n, long long r) {
  if (n == 0 && r == 0) return 1;
  if (r > n) return 0;
  long long ret = factInv[n - r] * factInv[r] % mod;
  return ret * fact[n] % mod;
}

int main(void) {
  comb_init(200001);
  long long N, M, K;
  cin >> N >> M >> K;
  long long ans = 0;
  for (int i = 0; i <= K; i++) {
    ans += M * ((comb(N - 1, i) * pow_mod(M - 1, N - 1 - i)) % mod) % mod;
    ans %= mod;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6288
#include <algorithm>
#include <cstdio>

const int N=200005,inf=1000000000;
int cnt[N];

struct P{
	int v,id;
}q[N*2];

bool cmp(P a,P b){return a.v<b.v;}

int main(){
	int n,max1=0,max2=0,min1=inf,min2=inf,tot=0;
	scanf("%d\n",&n);
	for (int i=1;i<=n;i++){
		int x,y;
		scanf("%d%d\n",&x,&y);
		if (x<y) std::swap(x,y);
		max1=std::max(max1,x);
		max2=std::max(max2,y);
		min1=std::min(min1,x);
		min2=std::min(min2,y);
		q[++tot].v=x;q[tot].id=i;
		q[++tot].v=y;q[tot].id=i;
	}
	long long ans=1ll*(max1-min1)*(max2-min2);
	std::sort(q+1,q+tot+1,cmp);
	for (int i=1,j=1,k=0;i<=tot;i++){
		for (;j<=tot && k<n;j++) k+=!cnt[q[j].id]++;
		if (k<n) break;
		ans=std::min(ans,1ll*(max1-min2)*(q[j-1].v-q[i].v));
		k-=!--cnt[q[i].id];
	}
	printf("%lld\n",ans);
}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
  string S;
  cin >> S;
  if (S == "Sunny")
    cout << "Cloudy" << endl;
  else if (S == "Cloudy")
    cout << "Rainy" << endl;
  else
    cout << "Sunny" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define PI 3.14159265
#define scan(a) scanf("%d",&a)
#define scan2(a,b) scanf("%d %d",&a,&b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define print(x) printf("%d\n",x)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef vector<pair<int,int> > vpii;
static const int INF = 0x3f3f3f3f;
static const ll INFL = 0x3f3f3f3f3f3f3f3fLL;


int main()
{
    set<int> S;
    int n;
    cin>>n;
    for(int i=0;i<n;++i)
    {
        int a;
        cin>>a;
        S.insert(a);
    }
    cout<<S.size();
    return 0;
}




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

class Program {
    static void Main(string[] args) {
        var n = int.Parse(Console.ReadLine());
        var l = Console.ReadLine().Split(' ')
        .Select(x => long.Parse(x)).ToList();
        var ma = l.Max();
        var mi = l.Min();
        Console.WriteLine(ma - mi);
    }
}


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

int main(){
    int N; cin>>N;
    vector<int> a(N);
    
    int sum = 0;
    rep(i,N){
        cin>>a[i];
        sum = sum xor a[i];
    }
    // xor`合計が0じゃないならNo
    if(sum != 0){
        cout << "No" << endl;
        // return 0;
    }else{
        cout << "Yes" << endl;
    }

}


Measured memory_bytes: 3788
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String[] S = s.split("");

		int sum01 = 0;
		int sum10 = 0;
		int count = 0;

		for(String str:S){
			if(count%2==0){
				if(str.equals("0")){
					sum10++;
				}else{
					sum01++;
				}
			}else{
				if(str.equals("1")){
					sum10++;
				}else{
					sum01++;
				}
			}
			count++;
		}

		// 出力
		System.out.println(sum10<sum01?sum10:sum01);
	}
}

Measured memory_bytes: 32844
#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int main(){

	int n,table[11],count;
	bool First;

	for(int i=0; i <= 10; i++)table[i] = pow(4,i);

	while(true){
		scanf("%d",&n);
		if(n == -1)break;

		First = true;

		for(int i = 10; i >= 0; i--){
			count = 0;
			while(n >= table[i]){
				n -= table[i];
				count++;
			}
			if(count == 0 && First){
				//Do nothing
			}else{
				printf("%d",count);
				First = false;
			}
		}
		if(First == true)printf("0");
		printf("\n");
	}
    return 0;
}

Measured memory_bytes: 2720
n = gets.chomp.to_i
s = gets.chomp
h = Hash.new(0)
n.times do |i|
  h[s[i]] += 1
end

MOD = 10**9 + 7
ans = 1
h.each do |k, v|
  ans *= (v + 1)
  ans %= MOD
end
puts ans - 1


Measured memory_bytes: 2044
#include<stdio.h>
#include<string.h>
int main(void){
  int n[3]={0},i=0;
  char s[3][101];
  scanf("%s%s%s",s[0],s[1],s[2]);
  while(1){
    if(s[i][n[i]]=='\0')break;
    i=s[i][n[i]++]-'a';
  }
  printf("%c",'A'+i);
  return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
 
int n, w, a, b;
long long dp[100100];
 
int main() {
	scanf("%d %d",&n,&w);
  	memset(dp, -1, sizeof dp);
  	dp[0] = 0;
		for (int i = 0; i < n; i++) {
    	scanf("%d %d",&a,&b);
      	for (int j = 100000; j - b >= 0; j--)
          if (dp[j - b] != -1) {
						dp[j] = min(dp[j], (long long)dp[j - b] + a);
    				if (dp[j] == -1) dp[j] = dp[j - b] + a;
					}
		}
    int sol = 0;
    for (int i = 0; i < 100001; i++) if (dp[i] != -1 && dp[i] <= w) sol = i;
  	printf("%lld\n",sol);
  return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
using namespace std;
#define NIL -1
#define MAX 25
struct Node 
{
    int parent, left, right;
};

Node node[MAX];

void preParse(int u)
{
    if (u == NIL) return;
    cout << " " << u;
    preParse(node[u].left);
    preParse(node[u].right);
    
}

void inParse(int u)
{
    if (u == NIL) return;
    inParse(node[u].left);
    cout << " " << u;
    inParse(node[u].right);
    
}

void postParse(int u)
{
    if (u == NIL) return;
    postParse(node[u].left);
    postParse(node[u].right);
    cout << " " << u;
}



int main()
{
    int n;
    int id;
    int root = 0;
    
    cin >> n;
    for (int i = 0; i < n; i++){
        node[i].parent = node[i].left = node[i].right = NIL;
    }
    for (int i = 0; i < n; i++){
        cin >> id;
        int l, r;
        cin >> l >> r;
        node[id].left = l;
        node[id].right = r;
        if (l != NIL){
            node[l].parent = id;
        }
        if (r != NIL){
            node[r].parent = id;
        }
    }

    for (int i = 0; i < n; i++){
        if (node[i].parent == NIL) root = i;
        
    }
    
    cout << "Preorder" << endl;
    preParse(root);
    cout << endl;
    cout << "Inorder" << endl;
    inParse(root);
    cout << endl;
    cout << "Postorder" << endl;
    postParse(root);
    cout << endl;
    
    return 0;
    
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ll N;
  cin >> N;
  set<ll> D;
  for (ll i = 0; i < N; ++i) {
    ll d;
    cin >> d;
    D.insert(d);
  }
  cout << D.size() << "\n";
}


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

using namespace std;

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQUE(a)  (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef pair<pair<int,int>,int> PP;
vector<PP> v;
int main() {
	int n;
	cin >> n;
	REP(i,n){
		int a,b,c;
		cin>>a>>b>>c;
		if(a<b)swap(a,b);
		if(b<c)swap(b,c);
		if(a<b)swap(a,b);
		v.push_back(MP(MP(a,b),c));
	}
	SORT(v);
	cout << (v.end() - unique(ALL(v))) << endl;
	return 0;
}

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

int main(){
  std::string str;
  int num;
  
  std::cin >> str;
  num = str.length();
  
  for(int i=num-1; i>=0; i--){
    std::cout << str[i];
  }
  std::cout << std::endl;

  return 0;
}

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long double ld;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

/*
1~i番目までの商品を用いて重みをj以下にするときの価値の最大値p[i][j]
*/

int p[110][10100];

void solve(){

    int N,W;
    cin >> N >> W;
    int v[1010];
    int w[1010];
    rep(i,N){
        cin >> v[i+1] >> w[i+1];
    }
    rep(i,W+1){
        p[0][i]=0;
    }
    rep(i,N+1){
        p[i][0]=0;
    }
    for(int i=1; i<=N; i++){
        for(int j=1; j<=W; j++){
            if(j>=w[i]) p[i][j]=max(p[i-1][j], max(p[i-1][j-w[i]]+v[i],p[i][j-w[i]]+v[i]));
            else p[i][j]=p[i-1][j];
        }
    }

    /*
    rep(i,N+1){
        rep(j,W+1){
            cout << p[i][j] << " ";
        }
        cout << endl;
    }
    */

    cout << p[N][W] << endl;

}

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



Measured memory_bytes: 7176
using System;
using static System.Console;
using static System.Int32;
using static System.Math;
using System.Linq;

class Solution
{
    static void Main()
    {
    lb:
        ReadLine();
        var ary = ReadLine().Split().Select(Parse).ToArray();
        int result = 1;
        var min = ary[0];
        for(int i = 1; i<ary.Length; ++i)
        {
            if (ary[i] < min)
            {
                ++result;
                min = ary[i];
            }
        }
        WriteLine(result);
    }
}


Measured memory_bytes: 34012
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
typedef long long ll;

int main(){
  int n,a,b;
  cin >> n >> a >> b;
  cout << min(n*a,b) << endl;
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    int A,B,M;
    cin >> A >> B >> M;

    vector<int> a(A);
    rep(i,A) cin >> a[i];

    vector<int> b(B);
    rep(i,B) cin >> b[i];

    ll ans = INF;

    // 割引使う場合
    rep(i,M)
    {
        int x, y, c;
        cin >> x >> y >> c;
        if( a[x-1] + b[y-1] - c < ans ) ans = a[x-1] + b[y-1] - c;
    }

    // 割引使わない場合
    sort(all(a));
    sort(all(b));
    if( a[0] + b[0] < ans ) cout << a[0] + b[0] << endl;
    else cout << ans << endl;

}


Measured memory_bytes: 1024
x1, y1, x2, y2 = map(int, input().split())
v0 = x2 - x1
v1 = y2 - y1
x3 = x2 - v1
y3 = y2 + v0
x4 = x3 - v0
y4 = y3 - v1
print('{} {} {} {}'.format(x3,y3,x4,y4))


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		final char c = 'x';

		StringBuilder sb = new StringBuilder(s.length());
		for(int i = 0; i < s.length(); i++) {
			sb.append(c);
		}
		System.out.println(sb.toString());
	}

}


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

typedef long long LL;
typedef long double LD;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;
typedef pair < LD, LD > PDD;

#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
template < typename _T > inline void _DBG(const char *s, _T x) { cerr << s << " = " << x << "\n"; }
template < typename _T, typename... args > void _DBG(const char *s, _T x, args... a) { while(*s != ',') cerr << *s++; cerr << " = " << x << ','; _DBG(s + 1, a...); }

#ifdef LOCAL
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define DBG(...) (__VA_ARGS__)
#define cerr if(0) cout
#endif

// ********************** CODE ********************** //

const int N = 2e5 + 7;

int n, m, deg[N][2];
char s[N];
vector < PII > G[N][2];

int main()
{
    _upgrade
    cin >> n >> m;
    cin >> (s + 1);
    for(int i = 0; i < m; i++)
    {
        int a, b; cin >> a >> b;
        if(s[a] == s[b])
        {
            G[a][1].push_back({b, 0});
            G[b][1].push_back({a, 0});
            deg[b][0]++;
            deg[a][0]++;
        }
        else
        {
            G[a][0].push_back({b, 1});
            G[b][0].push_back({a, 1});
            deg[b][1]++;
            deg[a][1]++;
        }
    }
    queue < PII > Q;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 0; j < 2; j++)
        {
            if(deg[i][j] == 0)
            {
                Q.push({i, j});
            }
        }
    }
    int cnt = 0;
    while(!Q.empty())
    {
        int v = Q.front().first, p = Q.front().second;
        cnt++;
        Q.pop();
        for(auto u: G[v][p])
        {
            deg[u.first][u.second]--;
            if(deg[u.first][u.second] == 0)
            {
                Q.push(u);
            }
        }
    }
    cout << (cnt == 2 * n ? "No\n" : "Yes\n");
	return 0;
}


Measured memory_bytes: 20480
#include <bits/stdc++.h>
#if ONLINE_JUDGE
    #define DEBUG false
#else
    #define DEBUG true
#endif
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rep1(i, n) REP(i, 1, n)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)
#define rrep(i, n) rREP(i, 0, n)
#define forlist(i, vec) for(auto &&i : vec)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define UNIQUE(x) x.erase(unique(all(x)), x.end());
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define truecheck assert
#define dump(x) cerr << #x << ": " << (x) << endl
using namespace std;
typedef long long LL;
typedef long long int64;
typedef std::vector<int> VI;
typedef std::vector<VI> VVI;
typedef std::vector<LL> VL;
typedef std::vector<VL> VVL;
typedef std::vector<std::string> VS;
typedef std::pair<int, int> PII;
typedef std::pair<LL, LL> PLL;
typedef std::queue<int> QI;
typedef std::priority_queue<int> PQI;
template<class T,class U>inline bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T,class U>inline bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>inline void vcinpb(T &v, U n){rep(i, n){typename T::value_type a;cin >> a;v.pb(a);}}
template<class T>inline void dumpv(T &v){
    if(!DEBUG){return;}cout<<"{";rep(i,v.size()){cout<<v[i]<<",";}cout<<"}"<<endl;
}

const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;
// M_PI 3.1415...

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cill(n);
    VL v(n+10), ph(201000), mh(201000), idxes;
    LL ans = 0;
    rep(i, n){
        cin >> v[i];
    }
    rep(i, n){
        if(i+1 + v[i] < 200900){
            ph[ i+1 + v[i] ]++;
            if (ph[ i+1 + v[i] ] == 1){
                idxes.pb(i+1 + v[i]);
            }
        }
        if(i+1 - v[i] > 0){
            mh[ i+1 - v[i] ]++;
            if (mh[ i+1 - v[i] ] == 1){
                idxes.pb(i+1 - v[i]);
            }
        }

    }
    SORT(idxes);
    UNIQUE(idxes);
    for(auto&& i : idxes){
        ans += ph[i] * mh[i];
    }
    co(ans);
    return 0;
}

Measured memory_bytes: 9996
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long long n,x;
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
int main()
{
	cin>>n>>x;
	cout<<(n-gcd(n,x))*3<<endl;
}

Measured memory_bytes: 256
#include <math.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <map>

using namespace std;


int main()
{
    int t{};
    cin >> t;

    map <string, int> m;
    m.insert({"AC", 0});
    m.insert({"WA", 0});
    m.insert({"TLE", 0});
    m.insert({"RE", 0});

    
    for (size_t i = 0; i < t; i++)
    {
        string temp;
        cin >> temp;
        m.at(temp) += 1;        
    }

    cout << "AC x " << m.at("AC") << "\n";
    cout << "WA x " << m.at("WA") << "\n";
    cout << "TLE x " << m.at("TLE") << "\n";
    cout << "RE x " << m.at("RE") << "\n";

}

Measured memory_bytes: 3596
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <memory.h>
#include <set>
#include <cmath>
#define fio ios::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ll _pow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; b >> i; i++) {
		if ((b >> i) & 1) ans *= a;
		a *= a;
	}
	return ans;
}
int gcd(int a, int b) {
	if (!b) return a;
	return gcd(b, a%b);
}
int main(void) {
	int n; scanf("%d", &n);
	int x, y; scanf("%d %d", &x, &y);
	int ans = gcd(x, y);
	for (int i = 0; i < n - 2; i++) {
		int k; scanf("%d", &k);
		ans = gcd(ans, k);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
using ll = long long;

typedef pair<ll, ll> P;

const int MOD = 1000000007;
const ll INF = 1LL << 60;


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

vector<vector<int> > vvi;
vector<vector<vector<int> > > vvvi;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }


int n, A, B, C;
vector<int> l;


int dfs(int n_used, int a, int b, int c){
    if (n_used == n){
        if (a > 0 & b > 0 & c > 0){
            return abs(a - A) + abs(b - B) + abs(c - C);
        }else{
            return 999999;
        }
    }
    int ret1 = dfs(n_used + 1, a, b, c);
    int ret2 = dfs(n_used + 1, a + l[n_used], b, c) + (a ? 10 : 0);
    int ret3 = dfs(n_used + 1, a, b + l[n_used], c) + (b ? 10 : 0);
    int ret4 = dfs(n_used + 1, a, b, c + l[n_used]) + (c ? 10 : 0);

    // return min(ret1, ret2, ret3, ret4);
    return min(min(ret1, ret2), min(ret3, ret4));
}



int main(int argc, char**argv){
    cin >> n >> A >> B >> C;
    for (int i = 0; i < n; i++){
        int l_tmp;
        cin >> l_tmp;
        l.push_back(l_tmp);
    }

    int ans = dfs(0, 0, 0, 0);

    cout << ans << endl;

    return 0;

}




















Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL A[305][305];
int main()
{
    int N;
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            scanf("%lld",&A[i][j]);
        }
    }
    LL ans=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<i;j++){
            bool flag=1;
            for(int k=0;k<N;k++){
                if(A[i][j]>A[i][k]+A[k][j]){
                    cout<<-1<<endl;
                    return 0;
                }else if(i!=k&&j!=k&&A[i][j]==A[i][k]+A[k][j]) flag=0;
            }
            if(flag){
                ans+=A[i][j];
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int n,k;
    string s;
	cin >> n>> k>>s;
    int kawa=0;
    int max=0;
    fr(i,n-1){
      if(s[i]!=s[i+1])kawa++;
    }
    if(s[0]=='0')kawa++;
    if(s[n-1]=='0')kawa++;
    int kiri[kawa+2];
    kiri[0]=0;
    int gen=1;
    if(s[0]=='0'){kiri[1]=0;gen=2;}
    fr(i,n-1){
      if(s[i]!=s[i+1]){
        kiri[gen]=i+1;
        gen++;
      }
    }
    if(s[n-1]=='0'){kiri[kawa]=n;}
    kiri[kawa+1]=n;
    if(kawa+1<2*k)max=n;
    else{
    for(int i=0;i<kawa+1-2*k;i+=2){
      if(kiri[i+2*k+1]-kiri[i]>max)max=kiri[i+2*k+1]-kiri[i];
    }
    }
      cout << max << endl;
}


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

int main(){
    int n;
    cin >>n;
    string s, t;
    cin >> s >> t;
    string ans;
    for(int i=0; i<n; ++i){
        ans+=s[i];
        ans+=t[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3616
#include<cstdio>
inline int read()     
{     
    int x=0,f=1;char c=getchar();     
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}     
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}     
    return x*f;     
} 
int a;
int main()
{
	a=read()*read();
	if(a%2==0)
		puts("Even");
	else
		puts("Odd");
}

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

signed main(){
  int N;
  cin>>N;
  int A[100000];
  
  //入力
  for(int i=0;i<=N;i++){
    cin>>A[i];
  }
  
  //各深さの最低・最高の出力
  int maxnode[N+1];
  int minnode[N+1];
  minnode[N]=A[N];
  maxnode[N]=A[N];
  
  for(int i=N;i>0;i--){
    //cout<<i<<" "<<minnode[i]<<" "<<maxnode[i]<<endl;
    minnode[i-1]=(minnode[i]+1)/2+A[i-1];
    maxnode[i-1]=maxnode[i]+A[i-1];
  }
  //cout<<0<<" "<<minnode[0]<<" "<<maxnode[0]<<endl;
  //構成可能かを判定
  if(!(minnode[0]<=1 && maxnode[0]>=1)){
    cout<<-1<<endl;
    return 0;
  }
  
  //最大ノードの判定
  int ans[N+1];
  ans[0]=1;
  for(int i=1;i<=N;i++){
    ans[i]=min((ans[i-1]-A[i-1])*2,maxnode[i]);
  }
  int sum=0;
  for(int i=0;i<=N;i++){
    //cout<<i<<" "<<ans[i]<<endl;
    sum+=ans[i];
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 6732
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;

int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n; cin>>n;
	vector<int> a(n+1);
//	cout<<0<<" ";
	for(int i=1; i<=n; i++) {
		cin>>a[i];
	}
	int last=0;
	for(int i=1; i<=n; i+=2) {
		last=last^a[i]^a[i+1];
	}
	for(int i=1; i<=n; i++) {
		int ans=last^a[i];
		cout<<ans<<" ";
	}
	cout<<endl;




	return 0;
}


Measured memory_bytes: 3900
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  LL x; cin >> x;
  LL now = 100;
  for (RI i = 1; 666; ++i) {
    now = 1.01 * now;
    if (now >= x) return (cout << i), 0;
  }

  return 0;
}

// created by Daniel yuan


Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[100010];
P p[100010];

signed main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	vector<int> v;
	REP(i,N){
		if(i+1==A[i]){
			v.push_back(i);
		}
	}
	int ans=0;
	for(int i=0;i<v.size();i++){
		if(i<N-1&&v[i]+1==v[i+1]){
			ans++;
			i++;
		}
		else{
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2168
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE OverloadedStrings #-}
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as BS

main = do
  [n,a,b,c,d] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  s <- BS.getLine
  let ss = BS.drop a (BS.take (max c d) s)
  let answer | "##" `BS.isInfixOf` ss = False
             | d > c = True
             | otherwise = "..." `BS.isInfixOf` BS.drop (b-2) (BS.take (min c d + 1) s)
  putStrLn $ if answer then "Yes" else "No"


Measured memory_bytes: 892
N = int(input())
A = list(map(int,input().split()))


B=[]

for i in range(N):
    if A[i]%2==1:
        B.append(0)
    elif A[i]%3==0:
        B.append(0)
    elif A[i]%5==0:
        B.append(0)
    else:
        B.append(1)

T = sum(B)

if T==0:
    print("APPROVED")
else:
    print("DENIED")
        


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    //String s=gs();
	    int a=gi();
	    //int b=gi();
	    

	    
	    System.out.println(Math.floorDiv(a-1,2));
//	    if (s.charAt(0)==s.charAt(2) && s.charAt(1)==s.charAt(3)) {
//	    	System.out.print("Yes");
//	    }else {
//	    	System.out.print("No");
//	    }



	}

	public static long d(long n) {
		String a=String.valueOf(n);
		return (long)a.length();
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

using namespace std;
const int MAXN = 1e5 + 5;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    long double ans = 2 * acos(-1) * (double)n;
    cout << fixed << setprecision(20) << ans ;
    
}

Measured memory_bytes: 3792
#ABC107-B
h,w = map(int,input().split())
grid = [input() for _ in range(h)]

row = [False for _ in range(h)]
col = [False for _ in range(w)]

for i in range(h):
    for j in range(w):
        if grid[i][j] == '#':
            row[i] = True
            col[j] = True
            
            
for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(grid[i][j],end='')
                
        print()
                

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

using namespace std;

int main(void) {
	int a, b, c, d;
	int start, finish;
	cin >> a >> b >> c >> d;
	start = max(a, c);
	finish = min(b, d);
	if (start < finish) cout << finish - start;
	else cout << '0';
}

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

int main() {
    map<string, int> words;
    string word, largestWord, mostFrequentWord;
    int maxLength = 0, mode = 0;    

    while (cin >> word) {
        words[word]++;
    }
    
    for (map<string, int>::iterator it = words.begin(); it != words.end(); ++it) {
        if (it->second > mode) {
            mode = it->second;
            mostFrequentWord = it->first;
        }
        if (it->first.size() > maxLength) {
            maxLength = it->first.size();
            largestWord = it->first;
        }
    }

    cout << mostFrequentWord << " " << largestWord << endl;
    return 0;
}

Measured memory_bytes: 1196
N = int(input())
A = [[0, 0] for _ in range(N)]
for i in range(N):
  X, L = map(int, input().split())
  A[i] = [X + L, X - L]
A.sort()
R = A[0][1]
cnt = 0
for r, l in A:
  if l < R:
    continue
  R = r
  cnt += 1
print(cnt)

Measured memory_bytes: 20116
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
ll dp[105][2][5];
int main(){
  ll n; cin >> n;
  vector<ll> a(n);
  double ans = 0.0;
  rep(i,n){
    cin >> a[i];
    ans += (double)1.0/a[i];
  }
  ans = 1.0/ans;
  printf("%.8f",ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int sunday(int);
int monday(int);
int tuesday(int);
int wednesday(int);
int thursday(int);
int flyday(int);
int saturday(int);


int main(){
  int day ,month ,today;
  while(true){
    cin >> month >> day;
    if( month == 0 && day == 0 ){
      break;
    }

    if( month == 1 || month == 4 || month == 7 ){
      today = thursday(day);
    }
    
    if( month == 9 || month == 12 ){
      today = wednesday(day);
    }
    
    if( month == 3 || month == 11 ){
      today =  monday(day);
    }
    
    if( month == 6 ){
      today =  tuesday(day);
    }
    
    if( month == 2 || month == 8 ){
      today = sunday(day);
    }
    
    if( month == 10 ){
      today =  flyday(day);
    }
    
    if( month == 5 ){
      today =  saturday(day);
    }

    switch(today){
    case 0:
      cout << "Sunday" << endl;
      break;

    case 1:
      cout << "Monday" << endl;
      break;
    
    case 2:
      cout << "Tuesday" << endl;
      break;

    case 3:
      cout << "Wednesday" << endl;
      break;

    case 4:
      cout << "Thursday" << endl;
      break;
    
    case 5:
      cout << "Friday" << endl;
      break;

    case 6:
      cout << "Saturday" << endl;
      break;
    }
  }
  return 0;
}
  
int sunday(int day){
  int i ,today=0;
  for( i=1 ; i<day ; i++ ){
    today++;
    if( today == 7 ){
      today = 0;
    }
  }
  return today;
}


int monday(int day){
   int i ,today=1;
  for( i=1 ; i<day ; i++ ){
    today++;
    if( today == 7 ){
      today = 0;
    }
  }
  return today;
}


int tuesday(int day){
   int i ,today=2;
  for( i=1 ; i<day ; i++ ){
    today++;
    if( today == 7 ){
      today = 0;
    }
  }
  return today;
}


int wednesday(int day){
   int i ,today=3;
  for( i=1 ; i<day ; i++ ){
    today++;
    if( today == 7 ){
      today = 0;
    }
  }
  return today;
}


int thursday(int day){
    int i ,today=4;
  for( i=1 ; i<day ; i++ ){
    today++;
    if( today == 7 ){
      today = 0;
    }
  }
  return today;
}


int flyday(int day){
  int i ,today=5;
  for( i=1 ; i<day ; i++ ){
    today++;
    if( today == 7 ){
      today = 0;
    }
  }
  return today;
}


int saturday(int day){
    int i ,today=6;
  for( i=1 ; i<day ; i++ ){
    today++;
    if( today == 7 ){
      today = 0;
    }
  }
  return today;
}

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

int main()
{
  int N, a=0;
  cin >> N;
  rep(i,25){
    rep(j,15){
      if(i*4+j*7==N){
        a=1;
        break;
      }
    }
    if(a==1) break;
  }
  if(a==1) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
# vinegar that will do it!!!!!!!!!!!
 
 
N,A,B = map(int, input().split())
 
 

 
 
if N < 2:
    if A == B:
        print(1)
    else:
        print(0)
elif A <= B:
    ans = range((A+B) + A*(N-2), (A+B) + B*(N-2) + 1)
    print(len(ans))
else:
    print(0)
 
 


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

#define mp                  make_pair
#define pii                 pair<int,int>
#define vi                  vector<int>
#define vii                 vector<vector<int>> v;
#define mem(dp,a)           memset(dp,a,sizeof dp)
#define sonic               ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb(x)               push_back(x)
#define itr(it,c)           for(auto const &it : c)
#define all(c)              c.begin(), c.end()
#define ff                  first
#define ss                  second
#define INF                 INT_MAX
#define REPl(i,a,b)         for (ll i=a;i<b;i++)
#define REPi(i,a,b)         for (ll i=a;i<b;i++)
//*******Uer-Defined Functions*********//

//*******Functions end here************//
//*******Main func starts**************//
int main()
{/*

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
  */  
    sonic;     
    int n,k;
    cin >> n >> k;
    vi v;
    v.resize(n+1,0);
    for (int i=1,x;i<=n;i++)
    {
    	cin >> x;
    	v[i] = x;
    }
    sort(all(v));
    int sum = 0;
    for (int i=1;i<=k;i++)
    {
    	sum += v[i];
    }
    printf("%d",sum);
}
//******Main Ends here****************//

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

int main(){
int n;cin >> n;
int y;cin >> y;
int s=-1,t=-1,u=-1;
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++){
if(n-i-j>=0&&10000*i+5000*j+1000*(n-i-j)==y){
s=i;t=j;u=n-i-j;
break;}}}
cout << s << " " << t << " " <<u;}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, a[101010], b[101010];
void solve(){
	cin >> n;
	int ans = 0, ma = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
		if(chmax(ma, a[i])){
			ans = ma+b[i];
		}
	}
	
	cout << ans << endl;
}

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

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

#define endl '\n'
#define x first
#define y second
#define ii pair<int, int>
#define mp make_pair
#define pb push_back
#define vii vector<ii>
#define vi vector<int>
#define vvi vector<vi>
#define INF int(1e9)
#define TAM int(2e5)
#define LL long long int 

using namespace std;

int main () {
    ios_base::sync_with_stdio(false);

    string str;
    cin >> str;
    for(int i=0; i<str.size(); i++)
        if(str[i]=='7'){
            cout << "Yes" << endl;
            return 0;
        }

    cout << "No" << endl;
    return 0;
}

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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

class A9x9 {
public:
    void solve(std::istream& in, std::ostream& out) {
        int a,b;
        in >> a >> b;
        if(a <= 9 && b <= 9){
            out << (a*b) << endl;
        }else{
            out << -1 << endl;
        }
    }
};


int main() {
    std::ios_base::sync_with_stdio(false);
    A9x9 solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    in.tie(0);
    out << std::fixed << std::setprecision(10);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	s := getNextString(scanner)
	x := getNextInt(scanner)
	y := getNextInt(scanner)

	ans := solve(s, x, y)
	fmt.Fprintln(writer, ans)

	writer.Flush()
}

func solve(s string, x, y int) string {
	ans := "No"
	n := len(s)
	forwards := make([]int, n+1)
	f := 0
	for i := 0; i < n; i++ {
		if s[i] == 'F' {
			forwards[f]++
			continue
		}
		f++
	}
	imx := IntMap{}
	imy := IntMap{}
	imx.set(forwards[0], 1)
	imy.set(0, 1)
	for i := 1; i <= f; i++ {
		im := IntMap{}
		if i%2 == 0 {
			for v := range imx {
				im.set(v+forwards[i], 1)
				im.set(v-forwards[i], 1)
			}
			imx = im
			continue
		}
		for v := range imy {
			im.set(v+forwards[i], 1)
			im.set(v-forwards[i], 1)
		}
		imy = im
	}
	if imx.get(x) == 1 && imy.get(y) == 1 {
		ans = "Yes"
	}

	return ans
}

// IntMap ...
type IntMap map[int]int

func (m IntMap) get(key int) int {
	if _, ok := m[key]; ok {
		return m[key]
	}
	return 0
}

func (m IntMap) set(key, n int) {
	if _, ok := m[key]; ok == false {
		m[key] = 0
	}
	m[key] = n
}

func (m IntMap) increment(key int) {
	if _, ok := m[key]; ok == false {
		m[key] = 0
	}
	m[key]++
}


Measured memory_bytes: 7860
#include <algorithm>
#include <cstdio>
using namespace std;

const int N = 1010;

int n, m, x[N], y[N], d[N];
bool tg[N];

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++) {
		scanf("%d%d", x + i, y + i);
		tg[(x[i] + y[i]) & 1] = 1;
	}
	if(tg[0] & tg[1]) return puts("-1") & 0;
	if(tg[0]) d[++ m] = 1;
	for(int i = 30; ~ i; i --) d[++ m] = 1 << i;
	printf("%d\n", m);
	for(int i = 1; i <= m; i ++) printf("%d%c", d[i], " \n"[i == m]);
	for(int i = 1; i <= n; i ++, putchar('\n')) {
		for(int j = 1; j <= m; j ++) {
			if(abs(x[i]) > abs(y[i])) {
				if(x[i] > 0) x[i] -= d[j], putchar('R');
				else x[i] += d[j], putchar('L');
			} else {
				if(y[i] > 0) y[i] -= d[j], putchar('U');
				else y[i] += d[j], putchar('D');
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
use std::cmp::Ordering;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mut done: bool = false;

    while !done {
        let x: u32 = read();
        let y: u32 = read();

        if x == 0 && y == 0 {
            done = true;
        } else {
            match x.cmp(&y) {
                Ordering::Less => println!("{} {}", x, y),
                Ordering::Greater => println!("{} {}", y, x),
                Ordering::Equal => println!("{} {}", x, y),
            };
        }
    }
}


Measured memory_bytes: 5020
#include <iostream>
using namespace std;
int main()
{
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	if (a == 0)
		cout << "1";
	else if (b == 0)
		cout << "2";
	else if (c == 0)
		cout << "3";
	else if (d == 0)
		cout << "4";
	else
		cout << "5";
}

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

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int N, M;
  cin >> N >> M;
  ll x[M];
  for (int i = 0; i < M; i++) scanf("%lld", x + i);

  if (N >= M) {
    cout << 0 << endl;
    return 0;
  }

  sort(x, x + M);
  ll d[M-1];
  for (int i = 0; i < M - 1; i++) {
    d[i] = x[i+1] - x[i];
  }
  sort(d, d + (M - 1));

  cout << accumulate(d, d + (M - N), 0) << endl;
  return 0;
}



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

int main(void) {
    int N, K;
    cin >> N >> K;
    int digit = 0;
    int d = 1;
    while (d <= N) {
        d *= K;
        ++digit;
    }
    printf("%d\n", digit);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()


const int Max = 200005;
vector<int> a,ans;
vector<int> to[Max];
int dp[Max];
void dfs(int v,int p=-1) {
	int i = lower_bound(dp, dp + Max, a[v]) - dp;
	
	int old = dp[i];
	dp[i] = a[v];
	ans[v] = i;
	if (p != -1) {
		ans[v] = max(ans[v], ans[p]);
	}
	for (int u : to[v]) {
		if (u == p)continue;
		dfs(u, v);
	}
	dp[i] = old;
}
int main() {
	int n;
	cin >> n;
	a=vector<int>(n);
	ans = vector<int>(n);
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n-1) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		to[v].push_back(u);
		to[u].push_back(v);
	}
	rep(i, Max) {
		dp[i] = INT_MAX;
	}
	dp[0] = -1;
	dfs(0);
	rep(i, n) {
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 27496
from itertools import combinations

N, D = map(int, input().split())
X = []
for _ in range(N):
  x = [int(i) for i in input().split()]
  X.append(x)
  
count = 0
for i, j in combinations(X, 2):
  dist = sum([(i_ - j_)**2 for i_, j_ in zip(i, j)])**0.5
  if dist.is_integer():
    count += 1

print(count)

Measured memory_bytes: 3064
def is_operator(ele):
    if ele == "+" or ele == "-" or ele == "*":
        return True
    else:
        return False

def calc_reverse_polish_notation(A):
    stack = []
    for i in A:
        if is_operator(i):
            a = stack.pop()
            b = stack.pop()
            ans = eval("{0} {1} {2}".format(b, i, a))
            stack.append(ans)
        else:
            stack.append(i)
    return stack.pop()

A = list(map(str,input().split()))

print(calc_reverse_polish_notation(A))


Measured memory_bytes: 5564
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
 
//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//infinity
#define INTINF 2000000000
#define LONGINF 20000000000
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
int main(){
	long long x, y;
	cin >> x >> y;
	long long now = x;
	int count = 1;
	while(true){
		now *= 2;
		if(now > y){
			break;
		}
		count++;
	}
	cout << count << 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;
using ll = long long;
using P = pair<int,int>;

// #define NDEBUG
#include<assert.h>
const int INF = 1001001001;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  for(int i = 0; i + k < n; ++i) {
    if(a[i] < a[i + k]) puts("Yes");
    else puts("No");
  }
  return 0;
}

Measured memory_bytes: 3984