akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = INF;
    
    string S, T;
    cin >> S >> T;
    int N = S.length(), M = T.length();
    REP(i,N-M+1) {
        int tmp = 0;
        REP(j,M) {
            if (S[i+j] != T[j]) tmp++;
        }
        ans = min(tmp,ans);
    }
    cout << ans << endl;
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc177/abc177_b && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc177/abc177_b && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc177/abc177_b && sh shellscripts/submit_cpp.sh
*/


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    int c = a+b;
    if(c%2) cout << "IMPOSSIBLE" << endl;
    else cout << c/2 << 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>;

int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int min_hp = a[0];
  for (int i = 1; i < n; ++i) min_hp = gcd(min_hp, a[i]);
  cout << min_hp << endl;
  return 0;
}

Measured memory_bytes: 3700
import math
N, K = map(int, input().split())
ans = 0
for i in range(1, N+1):
    if i >= K:
        ans +=( N-K+1)/N
        break
    else:
        ans += (1/N)*((1/ 2)**math.ceil(math.log2(K/i)))
print(ans)

Measured memory_bytes: 3060
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int head[605],nxt[96000],to[96000],a[600][600],n,m,en,f[600],q[96000],now[600],num[600];
void add(int u,int v)
{
	nxt[++en]=head[u];
	head[u]=en;
	to[en]=v;
}
bool check(int p)
{
	en=0;
	memset(head,0,sizeof head);
	memset(num,0,sizeof num);
	int l=1,r=n;
	memset(f,0,sizeof f);
	for(int i=1;i<=n;++i)
	{
		q[i]=i;
		now[i]=1;		
	}
	while(l<=r)
	{
		int t=q[l];
		l++;
		if(f[a[t][now[t]]])
		{
			now[t]++;
			if(now[t]>m)
				return 0;
			q[++r]=t;
		}
		else
		{
			num[a[t][now[t]]]++;
			add(a[t][now[t]],t);
			if(num[a[t][now[t]]]>p)
			{
				int tt=a[t][now[t]];
				f[tt]=1;
				for(int i=head[tt];i;i=nxt[i])
				{
					now[to[i]]++;
					if(now[t]>m)
						return 0;
					q[++r]=to[i];
				}
			}
		}
	}
	return 1;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)
	for(int j=1;j<=m;++j)
	{
		scanf("%d",&a[i][j]);
	}
	int l=0,r=n;
	while(l<r-1)
	{
		int mid=(l+r)/2;
		if(check(mid)) r=mid;
		else l=mid;
	}
	printf("%d",r);
	return 0;
}

Measured memory_bytes: 2048
N,*a = map(int,open(0).read().split())
a.sort(reverse=True)
al = 0
b = 0
for i in range(N):
    if i%2 == 0:
        al += a[0]
        del a[0]
    else:
        b += a[0]
        del a[0]
print(al-b)

Measured memory_bytes: 2940
n = int(input())
alist = list(map(int, input().split()))
maxa, mina = max(alist), min(alist)

ans = []
if abs(maxa) >= abs(mina):
  p = alist.index(maxa) + 1
  for i in range(n):
    alist[i] += maxa
    ans.append((p, i+1))
  for i in range(n-1):
    alist[i+1] += alist[i]
    ans.append((i+1, i+2))
else:
  p = alist.index(mina) + 1
  for i in range(n):
    alist[i] += mina
    ans.append((p, i+1))
  for i in range(n-2, -1, -1):
    alist[i] += alist[i+1]
    ans.append((i+2, i+1))

print(len(ans))
for a in ans:
  print(*a)


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

int dp[110000];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	rep(i, 110000)dp[i] = n;
	dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= i; j *= 6) {
			chmin(dp[i], dp[i - j] + 1);
		}
		for (int j = 1; j <= i; j *= 9) {
			chmin(dp[i], dp[i - j] + 1);
		}
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    int n,k,c;
    cin>>n>>k>>c;
    string s;
    cin>>s;
    int A[200011],B[200011];
    A[0]=0;
    B[n]=0;
    int x=c+1,y=0;
    rep(i,n){
        if(x>c&&s[i]=='o') y++,A[i+1]=y,x=0;
        else A[i+1]=A[i];
        x++;
    }
    x=c+1,y=0;
    rep(i,n){
        if(x>c&&s[n-i-1]=='o') y++,B[n-i-1]=y,x=0;
        else B[n-i-1]=B[n-i];
        x++;
    }
    rep(i,n) if(A[i]+B[i+1]<k) cout<<i+1<<"\n";
    //rep(i,n+1) cout<<B[i]<<" ";
}

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

const int N=1e5+9;
typedef long long ll;
ll a[N];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	ll lb=2,rb=2;
	for(int i=n;i>=1;i--)
	{
		if(lb%a[i])
			lb=(lb/a[i]+1)*a[i];
		if(rb%a[i])
			rb=rb/a[i]*a[i];
		if(lb>rb)
			return puts("-1"),0;
		rb=rb+a[i]-1;
	}

	printf("%lld %lld\n",lb,rb);
	return 0;
}


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

using namespace std;

int main() {
  bool flag[30];
  int a;
  while (cin >> a && a) {
    for (int i = 0; i < 30; i++) flag[i] = false;
    flag[a-1] = true;
    int tmp, cnt = 0;
    for (int i = 0; i < 27; i++) {
      cin >> tmp;
      flag[tmp-1] = true;
    }
    for (int i = 0; i < 30; i++) {
      if (!flag[i]) {
        cout << i+1 << endl;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3088
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin >> n;

  ll ans = 0;

  for(ll r = 1;r * r <= n;r++){
    if(n % r == 0){
      ll m = n/r-1;
      if(m > r){
	ans += m;
      }
    }
  }

  cout << ans << endl;
}

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

const int N = 2e+5 + 5;
long long int a[N], dp[N][2];
int n;

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    dp[1][1] = a[1];
    for (int i = 2; i <= n; i++)
    {
        if (i % 2 == 0)
        {
            dp[i][1] = a[i] + max(dp[i - 2][0], dp[i - 2][1]);
            dp[i][0] = a[i - 1] + dp[max(0, i - 2)][0];
        }
        else
        {
            dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]);
            dp[i][1] = a[i] + max(dp[i - 2][1], dp[i - 2][0]);
            if (i == 3)
                dp[i][1] = a[i];
        }
    }
    cout << max(dp[n][0], dp[n][1]);
}

Measured memory_bytes: 8312
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(d)]
# t = [int(input()) for i in range(d)]
last = [-1]*26

ans = 0
for i in range(d):
    op = s[i].index(max(s[i]))
    ans += s[i][op]
    last[op]=i
    for j in range(26):
        ans -= c[j]*(i-last[j])
    print(op+1)

Measured memory_bytes: 68580
#include <stdio.h>

int N; char A[55],B[55];

int main()
{
	scanf ("%d %s %s",&N,A,B);

	int last = 0;
	long long ans = 1;
	const long long mod = 1000000007;
	for (int i=0;A[i];i++){
		if (A[i] == B[i]){
			ans = ans * (3 - last) % mod;
			last = 1;
		}
		else{
			if (last == 2)
				ans = ans * 3 % mod;
			else
				ans = ans * (3 - last) * (2 - last) % mod;
			last = 2;
			i++;
		}
	}
	printf ("%lld\n",ans);

	return 0;
}

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

signed main(){
	int N, i;
	scanf("%lld", &N);
	vector<int> Anum(N + 1, 0), num(N + 1, 0);
	for(i = 0; i < N; i++){
		int A;
		scanf("%lld", &A);
		Anum[A]++;
		num[Anum[A]]++;
	}
	for(i = 1; i <= N; i++){
		num[i] += num[i - 1];
	}
/*	for(i = 0; i <= N; i++){
		printf("num[%d] = %d\n", i, num[i]);
	}
*/	for(i = 1; i <= N; i++){
//		printf("i = %d\n", i);
		int l = 0, h, r = N + 1;
		while(r - l > 1){
			h = (l + r) / 2;
//			printf("h = %d\n", h);
			if(num[h] < h * i){
//				printf("test4\n");
				r = h;
			}
			else{
//				printf("test5\n");
				l = h;
			}
		}
		printf("%lld\n", l);
	}
	return 0;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int dp[26];
int main(){
  string s; cin >> s;
  int n = int(s.size());
  ll ans = 1;
  for(int i = 0; i < n; ++i){
    int x = s[i]-'a';
    ans += i - dp[x];
    dp[x]++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
using namespace std;
long long n, a, x, s, d[55][2505]={1};
int main() {
	int i, j, k;
	cin>>n>>a;
	for(i=1; i<=n; i++) {
		cin>>x;
		for(j=i; j; j--) 
			for(k=0; k<=(j-1)*50; k++) d[j][k+x] += d[j-1][k];
	}
	for(j=1; j<=n; j++) s += d[j][j*a];
	cout<<s;
	return 0;
}

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

void solve()
{
	string s;
	cin >> s;
	int n = s.length();
	int ans = 0, cnt = 0;
	for(int i = 0; i < n; i++) {
		if(s[i] == 'R') {
			cnt++;
			ans = max(cnt, ans);
		}
		else cnt = 0;
	}
	cout << ans;
}

int main()
{
	int t = 1;
	//scanf("%d", &t);
	while(t--) {
		solve();
		puts("");
	}
}


Measured memory_bytes: 3632
#include <iostream>
//#define N 101
#define N 101
using namespace std;

int main(){
  int n,q,m,d;
  int data[N];

  while( cin>>n>>q && (n||q) ){

    //    cout << "n="<<n<<" q="<<q << endl;

    for( int i=0;i<N;i++ )
      data[i] = 0;

    for( int i=0;i<n;i++ ){
      cin >> m;
      for( int i=0;i<m;i++ ){
	cin >> d; data[ d ]++;
      }
    }

    /*
    for( int i=0;i<N;i++ )
      cout << "  day"<<i <<"="<<data[i]<<" person" << endl;
    */

    int max=-1, mm=-1;
    for( d=0;d<N;d++ )
      if( max<data[d] ){
	max=data[d]; mm=d;
      }

    if( max<q )
      cout << "0" << endl;
    else
      cout << mm << endl;


  }

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int N, A[1 << 18], B[1 << 18];

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = N; i >= 1; i--) {
		int t = A[i];
		for (int j = i * 2; j <= N; j += i) t ^= B[j];
		B[i] = t;
	}

	vector<int> vec;
	for (int i = 1; i <= N; i++) {
		if (B[i] == 1) vec.push_back(i);
	}

	cout << vec.size() << endl;
	for (int i = 0; i < vec.size(); i++) {
		if (i) cout << " "; cout << vec[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  ll n,c=1;
  string s;
  cin>>n>>s;
  map<char,ll> m,d;
  set<char> ss;
  vector<char> e;
  for(int i=0;i<n;i++){
    ss.insert(s[i]);
  }
  for(auto au:ss){
    e.push_back(au);
  }
  sort(s.begin(),s.end());
  int j=0;
  for(int i=0;i<n;i++){
    if(d[s[i]]==0){
      if(j!=0){
        m[e[j-1]]=c;
      }
      c*=2;
      c%=M;
      d[s[i]]++;
      j++;
    }else{
      if(j==1){
        c++;
        c%=M;
      }else{
        c+=m[e[j-2]];
        c%=M;
      }
    }
  }
    if(c==0) cout<<M-1;
    else cout<<c-1;
}

Measured memory_bytes: 512
n, Y = map(int, input().split())

for x in range(n + 1):
    for y in range(n + 1):
        z = (Y - 10000 * x - 5000 * y) / 1000
        if x + y + z == n and z >= 0 and z.is_integer():
            print(x, y, int(z))
            exit()
print("-1 -1 -1")



Measured memory_bytes: 2940
#C
n = int(input())
b = list(map(int,input().split()))

a = [0 for _ in range(n)]

a[0] = b[0]
a[n-1] = b[n-2]

for i in range(1,n-1):
    a[i] = min(b[i],b[i-1])
    

print(sum(a))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

/*
    Ball and Boxes 6
*/

int main() {
    ll n, k;
    cin >> n >> k;
    COMinit();

    ll ans = COM(n-k+(k-1),k-1);

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



Measured memory_bytes: 15076
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n,x,y;
  cin >> n >> x >> y;
  int xx=x;
  int yy=n-y+1;
  x--;
  y--;
  int t=y-x;
  vector<int> q(n-1,0);
  rep(i,n){
    rep(j,i){
      int ans=i-j;
      if(j<=x&&i>=y) ans=ans-t+1;
      ans--;
      int b=abs(x-j)+abs(y-i);
      ans=min(ans,b);
      q[ans]++;
    }
  }
  rep(i,n-1) cout << q[i] << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;}
using ll = long long;
using P = pair<int,int>;

int n,m,a,b,c;
string s,t;

int main() {
  cin >> a >> b >> c;
  swap(a,b),swap(a,c);
  cout << a << " " << b << " " << c << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

int main()
{
	int ans = 0;
	int N, K;
	cin >> N >> K;

	vector<int> A(N);

	int before_count, after_count;
	bool is_pop_1 = false;
	before_count = after_count = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];

		if (A[i] == 1)
		{
			is_pop_1 = true;
			continue;
		}

		if (is_pop_1)
		{
			after_count++;
		}
		else
		{
			before_count++;
		}
	}

	if (N <= K)
	{
		cout << 1 << endl;
		return 0;
	}

	while (before_count > 0)
	{
		before_count -= (K - 1);

		if (before_count < 0)
		{
			after_count += before_count;
		}

		ans++;
	}

	cout << ceil((double)after_count / (K - 1)) 
		+ ans << endl;

	return 0;
}

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

int main(){
  char c;
  cin >> c;
  
  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'e' || c == 'o'){
    cout << "vowel" << endl;
  }
  else cout << "consonant" << endl;
}

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

int main() {
  int A,B,C,D ;
  cin >> A >> B >> C >> D ;
  if (A+B > C+D){
    cout << "Left" << endl;
  }
  else if (A+B == C+D) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s1, s2;
	int n, c1, c2;
	cin >> n;
	c1 = c2 = 0;  //初始化得分 
	for(int i=1; i<=n; i++){
		cin >> s1 >> s2;
		if(s1>s2)
			c1 += 3;
		if(s1==s2)
			c1++, c2++;
		if(s1<s2)
			c2 += 3;
	}
	cout << c1 << " " << c2 << endl;
	return 0;
}


Measured memory_bytes: 3164
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

struct dice{
	int val[6];
	void roti(){
		int t=val[5];
		val[5]=val[1];
		val[1]=val[4];
		val[4]=val[0];
		val[0]=t;
	}
	void rotj(){
		int t=val[3];
		val[3]=val[1];
		val[1]=val[2];
		val[2]=val[0];
		val[0]=t;
	}
	void rotk(){
		int t=val[3];
		val[3]=val[4];
		val[4]=val[2];
		val[2]=val[5];
		val[5]=t;
	}
};

int f[3][3],t[3][3];
dice cube[3][3][3];
int n;
bool res[55];

void rec(int cur){
	if(cur==27){
		int sum=0;
		for(int i=0;i<3;i++){
			for(int k=0;k<3;k++){
				sum+=cube[i][2][k].val[4];
			}
		}
		res[0]=false;
		res[sum]=true;
		return;
	}
	int k=cur/9;
	int i=(cur/3)%3;
	int j=cur%3;
	dice d=(dice){2,5,6,1,3,4};
	for(int r=0;r<24;r++){
		d.rotk();
		if(r%4==0){
			if(r<16)d.rotj();
			else if(r==16)d.roti();
			else{
				for(int l=0;l<2;l++){
					d.roti();
				}
			}
		}
		if(k==0 && t[i][j] && t[i][j]!=d.val[0])continue;
		if(i==2 && f[k][j] && f[k][j]!=d.val[2])continue;
		if(i && cube[i-1][j][k].val[2]+d.val[3]!=7)continue;
		if(j && cube[i][j-1][k].val[4]+d.val[5]!=7)continue;
		if(k && cube[i][j][k-1].val[1]+d.val[0]!=7)continue;
		cube[i][j][k]=d;
		rec(cur+1);
	}
}

void solve(){
	memset(res,false,sizeof(res));
	res[0]=true;
	rec(0);
	if(res[0])printf("0\n");
	else{
		bool c=false;
		for(int i=1;i<=54;i++){
			if(res[i]){
				if(c)printf(" ");
				c=true;
				printf("%d",i);
			}
		}
		printf("\n");
	}
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				scanf("%d",&t[j][k]);
			}
		}
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				scanf("%d",&f[j][k]);
			}
		}
		solve();
	}
	return 0;
}

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18 + 1;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll Q;

signed main() {
    cin >> Q;
    REP(i, Q) {
        LCIN(A, B);
        if(A == B) {
            cout << (2 * A - 2) << "\n";
            continue;
        }
        ll lb = 1, ub = A + B - 1;
        while(ub - lb > 1) {
            ll mid = (lb + ub) / 2;
            ll M = (mid / 2 + 1) * (mid + 1 - (mid / 2 + 1));
            if(M < A * B)
                lb = mid;
            else
                ub = mid;
        }
        cout << lb - 1 << "\n";
    }
}


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

#define MAX 1000000001
 
int main(){ 
    int n,m,k;
    cin>>n>>m>>k;

    int *A,*B;

    A=(int*)malloc(sizeof(int)*n+1);
    B=(int*)malloc(sizeof(int)*m+1);

    for(int i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    for(int i=0;i<m;i++){
        scanf("%d",&B[i]);
    }
    
    long long int *a,*b;

    a=(long long int*)malloc(sizeof(long long int)*n+2);
    b=(long long int*)malloc(sizeof(long long int)*m+2);

    a[0]=0;
    b[0]=0;

    int t,s;

    for(int i=1;i<=n;i++){
        t=i;
        a[i]=A[i-1]+a[i-1];
        if(a[i]>k){
            t=i-1;
            break;
        }
    }

    for(int i=1;i<=m;i++){
        s=i;
        b[i]=B[i-1]+b[i-1];
        if(b[i]>k){
            s=i-1;
            break;
        }
    }

    int ans=0;

    for(int i=0;i<=t;i++){
        int j=s;
        while(a[i]+b[j]>k){
            j--;
            if(j==0)break;
        }
        s=j;
        ans=max(ans,j+i);
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 8332
#include <iostream>
#include <bits/stdc++.h>
#include <queue>
#include <stack>
#include <vector>
#define loop(n) for(ll i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
using namespace std;
typedef long long int ll;



int main()
{
    fastio;
    ll n,m;
    cin>>n>>m;
    string arr[n];
    loop(n)
		cin>>arr[i];
	
	ll dp[n][m];
	
	for(ll i=0;i<n;i++)
	{
		for(ll j=0;j<m;j++)
		{
			if(i==0 && j==0)
				dp[i][i] = 1;
			else
			{
				if(arr[i][j] == '.')
				{
					if(i == 0) //1st row
						dp[i][j] = dp[i][j-1];
					else if(j==0 )
						dp[i][j] = dp[i-1][j];
					else
						dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
				}
				else
					dp[i][j] = 0;
			}
		}
	}
	cout<<dp[n-1][m-1]<<endl;
			
					
		
    
    return 0;
}


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

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 600000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000 大きいとワ―シャルフロイドでオーバーフローを起こす
#define PI 3.14159265358979

//.size()はunsignedなので0-1でオーバーフローする

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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


int main(void) {

	int N, W, H;
	vector<int>xx(100002,0), yy(100002,0);
	bool flag = true;
	bool check = true;
	bool point = true;

	cin >> N >> W >> H;
	int x, y, w;


	FOR(i, 1, N) {
		cin >> x >> y >> w;

		xx[max(1, x+-w + 1)]++;
		xx[min(x+w, W) + 1]--;
		yy[max(1, y+-w + 1)]++;
		yy[min(y + w, H) + 1]--;

	}

	FOR(i, 1, W) {
		xx[i] += xx[i - 1];
	}
	FOR(i, 1, H) {
		yy[i] += yy[i - 1];
	}

	FOR(i, 1, H) {
		if (yy[i] <=0) {
			flag = false;
			check = false;
		}
	}
	FOR(i, 1, W) {
		if (xx[i] <=0) {
			flag = false;
			point = false;
		}
	}

	if (flag||(check==true||point==true)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}


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

#include <stdio.h>
using namespace std;

int main(void) {
	string s;
	int countChar[26] = {};
	while (1) {
		getline(cin, s);
		if (cin.eof()) break;
		for (int i = 0; i < s.length(); i++) {
			if (isupper(s[i]))
				s[i] = tolower(s[i]);
			countChar[s[i] - 'a']++;
		}
	}

	for (int i = 0; i < sizeof(countChar)/sizeof(int); i++) {
		cout << (char) (i + (int) 'a') << " : " << countChar[i] << endl;
	}

	return 0;
}



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

int main(){
  string s, t;
  cin >> s;
  cin >> t;
  int out=0;
  for (int i=0; i!=s.size(); ++i){
    if (s[i] != t[i]){
      ++out;
    }
  }
  cout << out << endl;
	return 0;
}


Measured memory_bytes: 3852
#include <stdio.h>
#include <string.h>
int main()
{
	int d;
	scanf("%d\n",&d);
	char s[d];
	gets(s);
	int i,j;
	j=0;
for(i=0;i<d;i++)
{
	if(s[i]!=s[i+1])
	{
		j=j+1;
	}
	}
printf("%d\n",j);
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)
#define FORR(i,n,m) for(ll i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M,X,Y;
    cin >> N >> M >> X >> Y;

    ll max_X=-110;
    REP(i,N){
        ll x;
        cin >> x;
        max_X = max(max_X,x);
    }

    ll min_Y=110;
    REP(i,M){
        ll y;
        cin >> y;
        min_Y = min(min_Y,y);
    }

    for(int i=X;i<Y;i++){
        if(max_X<=i && i<min_Y){
            cout << "No War" << endl;
            return 0;
        }
    }
    cout << "War" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i,n)cin >> l[i];
    sort(all(l));
    ll ans=0;
    rep(i,n){
        rep(j,n){
            if(i==j)continue;
            int tem;
            auto itr1=upper_bound(all(l),abs(l[i]-l[j]));
            auto itr2=lower_bound(all(l),l[i]+l[j]);
            tem=itr2-itr1;
            int it1=itr1-l.begin();
            int it2=itr2-l.begin();
            if(it1<=i && i<it2)tem--;
            if(it1<=j && j<it2)tem--;
            if(tem>0)ans+=(ll)tem;
        }
    }
    cout << ans/6;


}

/*



 */



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define lli long long int
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF 9223372036854775807+1
#define sosuu 1000000007

int main(){
  int N;
  cin >>N;
  int ans =0;
  int A[N][2];
  rep(i, N)
    cin >> A[i][0];
  rep(i, N)
    cin >> A[i][1];
  rep(i, N)
  {
    if(A[i][0]-A[i][1]>0)
      ans+=A[i][0]-A[i][1];
  }
  cout << ans << endl;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		int[][] sum;
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int h = in.nextInt();
			int w = in.nextInt();

			int[][] mat = new int[h+1][w+1];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					mat[i][j] = in.nextInt();
				}
			}

			sum = new int[h+1][w+1];
			for (int i = 0; i <= h; i++) {
				for (int j = 0; j <= w; j++) {
					sum[i][j] = mat[i][j];
					if (j - 1 >= 0) sum[i][j] += sum[i][j - 1];
					if (i - 1 >= 0) sum[i][j] += sum[i - 1][j];
					if (i - 1 >= 0 && j - 1 >= 0) sum[i][j] -= sum[i - 1][j - 1];
				}
			}

			int l = -1;
			int r = Math.min(h, w);

			long ans = 0;
			while (r-l > 1) {
				int k = (r+l)/2;
				boolean ok = false;
				for (int i = 0; i+k < h; i++) {
					for (int j = 0; j+k < w; j++) {
						if (get(i, j, i+k, j+k) == 0) {
							ans = Math.max(ans, (k+1)*(k+1));
							ok = true;
						}
					}
				}
				if (ok) {
					l = k;
				} else {
					r = k;
				}
			}

			out.println(ans);

		}

		int get(int x1, int y1, int x2, int y2) {

			int res = sum[x2][y2];
			if (x1 > 0) res -= sum[x1 - 1][y2];
			if (y1 > 0) res -= sum[x2][y1 - 1];
			if (x1 > 0 && y1 > 0) res += sum[x1 - 1][y1 - 1];

			return res;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}



Measured memory_bytes: 99144
#include <bits/stdc++.h>
#include<math.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 PI 3.14159265358979323846264338327950


int main () {
    int n ;
    cin >> n;
    bool ans = false ;
    rep(i, 10){
        rep(j, 10){
            if (n == i * j){
                ans = true;
                break;
            }
        }
    }
    if (ans){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

void solve(){
	ll fcnt=0, scnt=0;
	for(int i=0;i<3;i++){
		int a;
		cin>>a;
		if(a==5) fcnt++;
		else if(a==7) scnt++;
	}

	if(fcnt==2 && scnt==1)
		cout<<"YES";
	else
		cout<<"NO";
	//cout<<fcnt<<" "<<scnt;
}
int main(){boost;  //int t;cin>>t;while(t--){
	solve();
return 0;}

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

int main(){
  string S,T;
  cin>>S>>T;
  int N=S.length();
  rep(i,N){
    if(S==T){
      cout<<"Yes"<<endl;
      return 0;
    }
    S=S.substr(1)+S[0];
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define mx 1000007
using namespace std;

ll F[mx], inv[mx];

ll Pow( ll x, ll y )
{
    ll res= 1;

    while(y>0)
    {
        if(y&1)
            res= (res*x)%mod;
        x= (x*x)%mod;
        y>>= 1;
    }

    return res;
}

void init()
{
    F[0]= F[1]= inv[0]= inv[1]= 1;

    for( ll i=2;i<mx;i++ )
        F[i]= ( F[i-1]*i )%mod,
        inv[i]= Pow( F[i], mod-2 );
}

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

    ll ans= 0;

    for( int i=1;i<=n/3;i++ )
    {
        ll k= i;

        ll upor= F[n+k-1-i*3];
        ll nich= (inv[k-1]*inv[n-i*3])%mod;
        ll tot= (upor*nich)%mod;

        ans= (ans+tot)%mod;
    }

    cout<< ans <<"\n";
}

Measured memory_bytes: 19252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main(){
	int n,m,s[400],l[400],p[400],w[400],dp[400];
	cin>>n;
	rep(i,n) cin>>s[i]>>l[i]>>p[i];
	cin>>m;
	rep(i,m) cin>>w[i];
	fill(dp,dp+400,-1);
	dp[0]=0;
	for(int i=1;i<400;i++){
		for(int j=0;j<n;j++){
			for(int k=s[j];k<=l[j];k++){
				if(i-k>=0) dp[i]=max(dp[i],dp[i-k]+p[j]);
			}
		}
	}
	rep(i,m){
		if(dp[w[i]]<0){
			cout<<-1<<endl;
			return 0;
		}
	}
	rep(i,m) cout<<dp[w[i]]<<endl;
}


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

int main(){
    int N; cin >> N;
    vector<int> A(N);
    for(auto &v: A)
        cin >> v;
    
    int cnt = 0;
    for(int i=0; i<N; i++){
        for(int j=N-1; j>=i+1; j--){
            if(A[j] < A[j-1]){
                swap(A[j], A[j-1]);
                cnt++;
            }
        }
    }
    
    for(int i=0; i<N; i++)
        cout << A[i] << (i==N-1? "\n": " ");
    cout << cnt << endl;
    
    return 0;
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define int long long
struct IoSetup {
	IoSetup() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
		cerr << fixed << setprecision(10);
	}
}IoSetup;
typedef long long ll;
typedef pair < int , int >  pii;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 998244353;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T&b){if(a<b)return(a=b,1);return 0;}
template<class T>bool chmin(T &a, const T&b){if(b<a)return(a=b,1);return 0;}



signed main() {
   
   	ll a, v, b, w, t;

   	cin >> a >> v >> b >> w >> t;
	b = abs(b - a);

   	cout << (v * t >= b + w * t ? "YES\n": "NO\n");

  return 0;
}


Measured memory_bytes: 3536
def resolve():
  N = int(input())
  A = [0]*(N+1)

  for i in range(N):
    A[i+1] = int(input())

  move_count = 0
  next_index = 1
  for _ in range(N):
    move_count += 1
    if A[next_index] == 2:
      print(move_count)
      return True
    elif A[next_index] == 0:
      print(-1)
      return True
    else:
      temp = next_index
      next_index = A[temp]
      A[temp] = 0

if __name__ == "__main__":
  resolve()

Measured memory_bytes: 75584
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

from math import factorial
def combination(n, r):
    return factorial(n)//(factorial(n-r) * factorial(r))


h,w,k = readints()
c = [readstr() for i in range(h)]

ans = 0
for i in range(1<<h):
    for j in range(1<<w):
        black = 0
        for x in range(h):
            for y in range(w):
                if 1<<x & i and 1<<y & j and c[x][y]=='#':
                    black += 1
        if black == k:
            ans += 1

print(ans)



Measured memory_bytes: 74128
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;

vector<long> pp;

void preparePrime( long maxp )
{
    long i;
    vector<long> a(maxp+1);
    for(i=2; i<=maxp; i++) {
        long k=i+i;
        while(k<=maxp) {
            a[k]=1;
            k+=i;
        }
    }
    for(i=2; i<=maxp; i++) {
        if(a[i]==0) pp.push_back( i );
    }
    return;
}

void decompositPrime( ll a, vector<pair<ll,ll> >& vv )
{
    preparePrime( (long)sqrt((double)a) );

    long i;
    for(i=0; i<(long)pp.size(); i++) {
        long count = 0;
        while(a % pp[i] == 0 ) {
            a /= pp[i];
            count ++;
        }
        if(count>0) vv.push_back( make_pair( pp[i], count ) );
        if (a==1) break;
    }
    if(a>1) {
        vv.push_back( make_pair( a, 1 ) );
    }

    return;
}

int main(int argc, char* argv[])
{
    long n;
    ll  p;
    scanf("%ld%lld", &n, &p);

    vector<pair<ll,ll> > vv;
    decompositPrime( p, vv );

    ll ans=1;
    long i;
    for(i=0; i<(long)vv.size(); i++) {
        ll tmp = vv[i].second / n;
        while(tmp>0) {
            ans *= vv[i].first;
            tmp--;
        }
    }

    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 9208
#include <iostream>

using namespace std;

int main() {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;

	if ((x - r < 0) || (x + r > w) || (y - r < 0) || (y + r > h)) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}

	return 0;
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

using namespace std::chrono;

int main(void)
{
    IOS
    const int A = 26;
    const int M = 1e4;
    const int T = 1800;
    auto stime = system_clock::now();
    int D; cin >> D;
    vector<int> c(A);
    REP(i,A) cin >> c[i];
    vector<vector<int>> s(D,vector<int>(A));
    REP(i,D) REP(j,A) cin >> s[i][j];

    vector<int> last(A,-1);
    vector<int> ans(D);
    REP(i,D) {
        int mx = 0,a = -1;
        REP(j,A) {
            int tmp = (i-last[j])*c[j] + s[i][j];
            if (mx < tmp) {
                mx = tmp;
                a = j;
            }
        }
        ans[i]=a;
        last[a] = i;
    }
    auto calc = [&](const vector<int> &a){
        vector<int> l(A,-1);
        int score = 0;
        REP(i,D) {
            score += s[i][a[i]];
            l[a[i]] = i;
            REP(j,A) {
                score -= c[j]* (i-l[j]);
            }
        }
        return score;
    };

    int maxscore = calc(ans);

    random_device seed_gen;
    mt19937 engine(seed_gen());
    int loopcount = 0;
    while(true) {
        // time count
        auto time = system_clock::now();
        int t = duration_cast<milliseconds>(time-stime).count();
        if (t >= T) break;
        int mx = maxscore;
        vector<int> a1(ans);
        REP(_,M) {
            vector<int> a2(a1);
            a2[engine()%D] = engine() % A;
            int tmp = calc(a2);
            if (mx < tmp) {
                swap(a1,a2);
                mx = tmp;
            }
        }
        if (maxscore < mx) {
            swap(ans,a1);
            maxscore = mx;
        }
        loopcount++;
    }

    //cerr << loopcount << endl;
    REP(i,D) OUT(ans[i]+1)

    return 0;
}

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

using namespace std;
typedef long long int ll;
int main(){
ll n,W;
cin>>n>>W;
vector<ll> dp(W+1);//0..W

ll val=0;
ll weight=0;
for(int item=0;item<n;item++){
     
     cin>>weight>>val;
     

     for(int weight_already=W-weight;weight_already>=0;weight_already--){
         /* 
            dont consider the item and consider the item
            also understand the dp array is for each weight that we consider from 1 to W
         */
         dp[weight_already+weight]=max(dp[weight_already+weight],dp[weight_already]+val);
     }
}
ll ans=0;
for(int i=0;i<W+1;i++){
   ans=max(ans,dp[i]);
}
cout<<ans<<"\n";
}

Measured memory_bytes: 1024
N = int(input())
A = [0]+list(map(int,input().split()))
B = [0]+list(map(int,input().split()))

dp = [0]*(N+1)
Rm = [0]*(N+2)
dp[1] = min(A[1]+A[2],B[1])
Rm[1] = A[1]

for i in range(2,N+1):
    Rm[i] = max(Rm[i-1]+A[i]-B[i-1],0)
    if Rm[i-1]+A[i]-B[i-1] > A[i]:
        Rm[i] = A[i]
    dp[i] = dp[i-1]+min(B[i],Rm[i]+A[i+1])
    
        
  
ans = dp[N]
print(ans)


Measured memory_bytes: 20572
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,a[54],ans;
int main() {
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%d",&a[i]);
	for (int i=1;i<n;++i)
		for (int j=i+1;j<=n;++j)
			ans+=a[i]*a[j];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Map.Entry;

public class Main{
	
	public static void main(String[] args) throws IOException{
		//File file = new File("input.txt");
		//Scanner in = new Scanner(file);
		Scanner in = new Scanner(System.in);
		
		int N = in.nextInt();
		long[] march = new long[5];
		String marchS = "MARCH";
		
		for(int i = 0; i < N; i++){
			String S = in.next().substring(0, 1);
			for(int j = 0; j < 5; j++){
				if(S.equals(String.valueOf(marchS.charAt(j)))){
					march[j]++;
					break;
				}
			}
		}
		
		long ans = 0;
		for(int i = 0; i < 5 - 2; i++){
			for(int j = i + 1; j < 5 - 1; j++){
				for(int k = j + 1; k < 5; k++){
					ans += march[i] * march[j] * march[k];
				}
			}
		}
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 47508
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>

#define x first
#define y second
const double EPS = 1e-9;

using namespace std;

int n;

using pt = pair<int,int>;
using seg = pair<pt, pt>;
vector<pt> polygon;


pt operator-(pt a, pt b) {
  return pt(a.x - b.x, a.y - b.y);
}

bool zero(double x) {
  return fabs(x) <= EPS;
}

double cross(pt a, pt b) {
  return a.x*b.y - a.y*b.x;
}

bool ccw(pt a, pt b, pt c) {
  return cross(b - a, c - a) >= 0;
}

#define a first
#define b second



bool collinear(seg a, seg b) { // all four points collinear
  return zero(cross(a.b - a.a, b.a - a.a)) &&
         zero(cross(a.b - a.a, b.b - a.a));
}

double sq(double a) { return a * a; }

double dist(pt p, pt q) {
  return sqrt(sq(p.x - q.x) + sq(p.y - q.y));
}

bool intersect(seg a, seg b) {
  if (collinear(a, b)) {
	  	return 0;
    // double maxDist = 0;
    // maxDist = max(maxDist, dist(a.a, a.b));
    // maxDist = max(maxDist, dist(a.a, b.a));
    // maxDist = max(maxDist, dist(a.a, b.b));
    // maxDist = max(maxDist, dist(a.b, b.a));
    // maxDist = max(maxDist, dist(a.b, b.b));
    // maxDist = max(maxDist, dist(b.a, b.b));

    // return maxDist < dist(a.a, a.b) + dist(b.a, b.b) + EPS;
  }
  return ccw(a.a, a.b, b.a) != ccw(a.a, a.b, b.b) &&
         ccw(b.a, b.b, a.a) != ccw(b.a, b.b, a.b);
 }

bool onSegment(pt p, seg s)
{
	return cross(p - s.a, p - s.b) == 0 && 
			min(s.a.x, s.b.x) <= p.x && p.x <= max(s.a.x, s.b.x) &&
			min(s.a.y, s.b.y) <= p.y && p.y <= max(s.a.y, s.b.y);
}




int solve(pt p)
{
	pt infinite{20000, p.y};
	seg extreme{p, infinite};
	
	int count = 0;
	
	for(int i = 0; i < n; ++i)
	{
		pt a = polygon[i];
		pt b = polygon[(i + 1) % n];
		if(onSegment(p, {a, b})) return 1;
		if(intersect(extreme, {a,b})) count++;
	}
		
	return count % 2 == 0 ? 0 : 2;
}






int main(void)
{
	ios::sync_with_stdio(false);

	cin >> n;

	for(int i = 0; i < n; ++i)
	{
		int a, b;
		cin >> a >> b;
		polygon.emplace_back(a, b);
	}
	int q;
	cin >> q;
	while(q--)
	{
		int a, b;
		cin >> a >> b;
		cout << solve({a, b}) << '\n';
	}
}


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

int main(void){
    int N;
    char S[100010];
    cin>>N;
    cin>>S;
    int count=0;
    for(int i=0;i<N-1;i++){
        if(S[i]!=S[i+1]){
            count++;
            i++;
        }
    }
    cout<<count<<endl;
    return 0;

}



Measured memory_bytes: 3204