akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
  
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
 
#define pb emplace_back
#define fi first
#define se second

using namespace std;
 
typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
 
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-8;
const ll MOD = 1e9+7;

template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }
ll in(){ ll x; scanf( "%lld" , &x ); return x; }
 
// head

int r, c;
int n;

int rv[100010], cv[100010];
bool usedr[100010], usedc[100010];
bool used[100010];

vi rs[100010], cs[100010];

int a[100010], b[100010], v[100010];

ll minr, minc;

bool ans = true;

void dfsr( int y , ll vv );
void dfsc( int x , ll vv );

void dfsc( int x , ll vv ){
  usedc[x] = true;
  cv[x] = vv;
  chmin( minc , vv );
  YYS( w , cs[x] ){
    used[w] = true;
    int y = a[w];
    int z = v[w];
    if( !usedr[y] ){
      dfsr( y , z - vv );
    }
  }
}

void dfsr( int y , ll vv ){
  usedr[y] = true;
  rv[y] = vv;
  chmin( minr , vv );
  YYS( w , rs[y] ){
    used[w] = true;
    int x = b[w];
    int z = v[w];
    if( !usedc[x] ){
      dfsc( x , z - vv );
    }
  }
}

int main(){

  scanf( "%d %d" , &r , &c );
  scanf( "%d" , &n );
  REP( i , n ){
    scanf( "%d %d %d" , &a[i], &b[i], &v[i] );
    rs[ a[i] ].pb( i );
    cs[ b[i] ].pb( i );
  }

  REP( i , n ) if( !used[i] ){
    minr = INFLL, minc = INFLL;
    dfsr( a[i] , 0 );
    if( !usedc[ b[i] ] ) dfsc( b[i] , v[i] );
    if( minr + minc < 0 ) ans = false;
  }

  REP( i , n ) if( rv[ a[i] ] + cv[ b[i] ] != v[i] ) ans = false;

  if( ans ) puts( "Yes" );
  else puts( "No" );

  return 0;
}


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

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  while(a>0 && c>0){
    a-=d;
    c-=b;
  }
  if(c>0){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
}


Measured memory_bytes: 3632
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
const char dir[4] = { 'u','l','d','r' };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL 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; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

map<LL, LL> zip;
int unzip[303030];

int compress(vector<LL> &x) {
	sort(x.begin(), x.end());
	x.erase(unique(x.begin(), x.end()), x.end());
	for (int i = 0; i < x.size(); i++) {
		zip[x[i]] = i;
		unzip[i] = x[i];
	}
	return x.size();
}

struct BIT {
	vector<LL> bit;
	BIT(int n) {
		bit.resize(n + 10);
		for (int i = 0; i < n; i++)bit[i] = 0;
	}
	int sum(int i) {
		LL s = 0;
		while (i > 0) {
			s += bit[i];
			i -= i& -i;
		}
		return s;
	}
	void add(int i, LL x) {
		while (i <= bit.size() - 1) {
			bit[i] += x;
			i += i& -i;
		}
	}
};

int n, q;
LL in1[101010], in2[101010], in3[101010], in4[101010];
vector<LL> v;
int main() {
	cin >> n;
	cin >> q;
	BIT bit(q * 3);
	REP(i, q) {
		cin >> in1[i];
		if (in1[i] == 0) {
			cin >> in2[i] >> in3[i] >> in4[i];
			v.emplace_back(in2[i]);
			v.emplace_back(in3[i] + 1);
		}
		else {
			cin >> in2[i];
			v.emplace_back(in2[i]);
		}
	}
	compress(v);
	REP(i, q) {
		if (in1[i] == 0) {
			bit.add(zip[in2[i]] + 1, in4[i]);
			bit.add(zip[in3[i] + 1] + 1, -in4[i]);
		}
		else {
			cout << bit.sum(zip[in2[i]] + 1) << endl;
		}
	}
}


Measured memory_bytes: 14576
#include <cstdio>
#include <iostream>
#include <sstream>

#include <string>
#include <cstring>

#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <utility>

#include <algorithm>
#include <cstdlib>
#include <numeric>

#include <climits>
#include <cmath>

#include <chrono>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vl = vector<long>;
using vll = vector<ll>;
using vd = vector<double>;
using pii = pair<int, int>;
using pli = pair<long, int>;
using plli = pair<ll, int>;
using pdi = pair<double, int>;
using pllll = pair<ll, ll>;
using pdd = pair<double, double>;

#define pb push_back
#define mp make_pair
#define fi first
#define se second

const long MAXN = 200010;
const ll MODP = 1e09 + 7;

struct Node {
    string name;
    int count;
    Node *parent, *l_c, *r_c;
};

ll fac[MAXN], facinv[MAXN], inv[MAXN];
ll Combination(int n, int k) {
    if (k < 0 || k > n) { return 0; }
    return (((fac[n] * facinv[k]) % MODP) * facinv[n-k]) % MODP;
}

int main() {
    inv[1] = 1;
    fac[0] = 1;
    facinv[0] = 1;
    for(int i = 2; i < MAXN; i++) {
        inv[i] = MODP - (MODP / i) * inv[MODP % i] % MODP;
    }
    for(int i = 1; i < MAXN; i++) {
        fac[i] = (fac[i - 1] * i) % MODP;
        facinv[i] = (facinv[i - 1] * inv[i]) % MODP;
    }
    ll ans = 0;
    int h, w, a, b;
    scanf("%d %d %d %d", &h, &w, &a, &b);
    int s = b + h - a - 1;
    int t = w + a - b - 1;
    for (int i = 0; i < w - b; i++) {
        if (b + i > s) { break; }
        ans = (ans + (Combination(s, b + i) * Combination(t, a + i)) % MODP) % MODP;
    }
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 4992
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

def power_func(a,b,p):
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p

class comb_calclator():
    def __init__(self, N, p):
        self.N = N
        self.p = p
        self.frac_N = [0 for i in range(N + 1)]
        self.frac_N[0] = 1L
        self.comb_N = {}
        for i in range(1, N + 1):
            self.frac_N[i] = (self.frac_N[i - 1] * i ) % p

    def comb(self, n, r):
        if n<0 or r<0 or n<r: return 0
        if n==0 or r==0: return 1
        if (n, r) in self.comb_N:
            return self.comb_N[(n, r)]
        a = self.frac_N[n]
        b = self.frac_N[r]
        c = self.frac_N[n - r]
        self.comb_N[(n, r)] = (a*power_func(b,self.p-2,self.p)*power_func(c,self.p-2, self.p))% self.p
        self.comb_N[(n, n - r)] = self.comb_N[(n, r)]
        return self.comb_N[(n, r)]


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [int(input_raw[0]), long(input_raw[1])]
    prime = prime_decomposition(M)
    prime_num = {}
    for p in prime:
        if p not in prime_num:
            prime_num[p] = 1
        else:
            prime_num[p] += 1

    cmb = comb_calclator(N * 10, 1000000007)
    count = 1L
    for p in prime_num:
        count = (count * cmb.comb(N + prime_num[p]- 1, prime_num[p])) % 1000000007

    print count
if __name__ == '__main__':
    main()


Measured memory_bytes: 129820
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

K, T = mapint()
As = list(mapint())
maxi = max(As)
rest = K-maxi
if maxi<=rest+1:
    print(0)
else:
    maxi -= rest+1
    print(maxi)

Measured memory_bytes: 61820
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <map>
#include <string.h>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>

using namespace std;
#define set_precision cout << fixed << setprecision(10)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repb(i, a, b) for (int i = a; i >= b; i--)
#define repit(arr) for (auto it = arr.begin(); it != arr.end(); it++)
#define vi vector<int>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define vpi vector<pair<int,int>>
#define seti set<int>
#define setl set<ll>
#define dseti set<int, greater<int>>
#define dsetl set<ll, greater<ll>>
#define mseti multiset<int>
#define msetl multiset<ll>
#define dmseti multiset<int, greater<int>>
#define dmsetl multiset<ll, greater<ll>>
#define sortA(arr) sort(arr.begin(), arr.end())
#define dsortA(arr) sort(arr.begin(), arr.end(), greater<int>())
#define ssort(arr) stable_sort(arr.begin(), arr.end())
#define nth(v,n) nth_element(v.begin,v.begin+n-1,v.end())
#define dnth(v,n) nth_element(v.begin,v.begin+n-1,v.end(), greater<int>())
#define pb push_back
#define ll long long

int fact(int n) 
{ 
    int res = 1; 
    for (int i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
}
int nCr(int n, int r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
}
ll cel(ll a,ll b){return((a-1)/b+1);} 
int gcd(int a, int b)
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int lcm(int a,int b){
    return (a*b)/gcd(a,b);
}
void dfs(int u,vi &visited,vi adj[]) {
    visited[u] = 1; 
	for (int i=0; i<adj[u].size(); i++) 
		if (visited[adj[u][i]] == 0) 
			dfs(adj[u][i],visited,adj); 
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,k,ans=0,c=0,x=0;
    cin>>n>>k;vl v(n);
    rep(i,0,n){cin>>v[i];}
    ll st=1,end=1000000000,mid;
    while(st<=end){
        mid=(st+end)/2;c=0;
        rep(i,0,n){
            c+=(max(x,cel(v[i],mid)-1));
        }
        if(c<=k){
            ans=mid;
            end=mid-1;
        }
        else{st=mid+1;}
    }
    cout<<ans;
    return 0;
}

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

int main(){
    int64_t K;
    cin >> K;
    int N = 50;
    int64_t q = K/N, r = K%N;
    vector<int64_t> ans(N, N-1+q);
    for(int s=0; s<r; s++) for(int i=0; i<N; i++) ans[i] += (i==s ? N : -1);
    cout << N << endl;
    for(int i=0; i<N; i++) cout << ans[i] << " \n"[i==N-1];
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

bool solve() {
  int N;
  cin >> N;
  vector<pii> up, stay, down;
  rep(i, 0, N) {
    int req_h = 0;
    string s;
    cin >> s;

    int h = 0;
    for (char x : s) {
      if (x == '(')
        h++;
      else
        h--;
      chmin(req_h, h);
    }
    req_h *= -1;
    if (h > 0)
      up.emplace_back(req_h, h);
    else if (h == 0)
      stay.emplace_back(req_h, h);
    else {
      h = 0;
      req_h = 0;
      rrep(j, 0, sz(s)) {
        if (s[j] == ')')
          h++;
        else
          h--;
        chmin(req_h, h);
      }
      down.emplace_back(req_h * (-1), h);
    }
  }

  int req_h_stay = 0;
  for (pii x : stay) {
    chmax(req_h_stay, x.first);
  }
  sort(all(up));
  sort(all(down));

  int h = 0;
  for (pii x : up) {
    if (h < x.first) {
      return false;
    }
    h += x.second;
  }
  if (h < req_h_stay) return false;

  dump(down);

  int h2 = 0;
  for (pii x : down) {
    if (h2 < x.first) {
      return false;
    }
    h2 += x.second;
  }

  dump(h, h2);
  return h == h2;
}
signed main() {
  cout << (solve() ? "Yes" : "No") << endl;
  return 0;
}



Measured memory_bytes: 19040
#include "bits/stdc++.h"
using namespace std;
int a[100002];
int main()
{
	int n, total = 0;
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d", &a[i]);
		total += abs(a[i] - a[i - 1]);
	}
	total += abs(a[n + 1] - a[n]);
	for(int i = 1; i <= n; ++i)
	{
		printf("%d\n", total - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i + 1] - a[i - 1]));
	}
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(auto i = k; i != n; i++)
#define rrep(i, n) RREP(i, n, 0)
#define RREP(i, n, k) for(auto i = n; i != k; i--)
#define all(x, r) (x), (x)+(r)
#define ALL(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " " << x << endl
#define exst(x, data) (data).find(x) != (data).end()
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define np next_permutation
#define b32 bitset<32>

using ll = long long;
using Pii = pair<int,int>;
using Tiii = tuple<int, int, int>;
template<class T>using V = vector<T>;

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

    ll N, A, B; cin >> N >> A >> B;

    if(N==1) {
        if(A!=B) {
            cout << 0 << endl;
            return 0;
        } else {
            cout << 1 << endl;
            return 0;
        }
    }

    if(A>B) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = (B-A)*(N-2) + 1;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define CLR(A, X) memset(A, X, sizeof(A))
using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
const double eps = 1e-10;
int dcmp(double x){if(fabs(x)<eps) return 0; return x<0?-1:1;}
const LL INF = 0x3f3f3f3f;
const LL MOD = 1e9+7;
const int N = 2e5+5;

int a[2][N];

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    CLR(a, 0);
    for(int i = 0; i < m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        if(u == 1) a[0][v] = 1;
        if(v == n) a[1][u] = 1;
    }
    bool flag = 0;
    for(int i = 1; i <= n; i++) {
        if(a[0][i] && a[1][i]) {
            flag = 1;
            break;
        }
    }
    printf("%s\n", flag?"POSSIBLE":"IMPOSSIBLE");
    return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <cstring>
using namespace std;
const int maxn=150;
char str[maxn][maxn];
int main()
{
    int x,y;
    memset(str,0,sizeof(str));
    cin>>x>>y;
    for(int i=0;i<x;i++)
        cin>>str[i];
    for(int i=0;i<2+y;i++)
        cout<<"#";
    cout<<endl;
    for(int i=0;i<x;i++)
    {
        cout<<"#";
        cout<<str[i];
        cout<<"#";
        cout<<endl;
    }
       for(int i=0;i<2+y;i++)
        cout<<"#";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD (long long)(1e9+7)
using namespace std;
int h,w,vis[55][55],dir[][2]={{0,1},{1,0},{0,-1},{-1,0}};
string s[55];
struct p{
	int x,y,dis;
	p(int a,int b,int c):x(a),y(b),dis(c){};
};
int main()
{
	int ans=-1,bl=0;
	cin >> h >> w;
	for(int i=0; i<h; i++)
	{
		cin >> s[i];
		for(int j=0; j<w; j++) bl+=(s[i][j]=='#'); 
	}
	
	queue<p> q; q.push(p(0,0,1)); vis[0][0]=1;
	while(!q.empty())
	{
		p u=q.front(); q.pop();
		if(s[u.x][u.y] == '#') continue;
		if(u.x == h-1 && u.y == w-1)
		{
			ans=u.dis;
			break;
		}
		for(int i=0; i<4; i++)
		{
			int a=u.x+dir[i][0],b=u.y+dir[i][1];
			if(a>=0 && a<h && b>=0 && b<w && s[a][b]!='#' && !vis[a][b])
			{
				q.push(p(a,b,u.dis+1));
				vis[a][b]=1;
			}
		}
	}
	if(ans==-1) cout << -1;
	else cout << h*w-bl-ans;
	return 0;
}


Measured memory_bytes: 3572
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    S = [input().rstrip() for _ in range(N)]

    neg = []
    pos = []
    total = 0
    for i, s in enumerate(S):
        t = 0
        tmn = 0
        for c in s:
            if c == '(':
                t += 1
            else:
                t -= 1
            tmn = min(tmn, t)
        if t >= 0:
            pos.append((tmn, t))
        else:
            neg.append((tmn - t, -t))
        total += t

    if total != 0:
        print('No')
        return
    t = 0
    for tmn, tsm in sorted(pos, reverse=True, key=lambda x: x[0]):
        if t + tmn < 0:
            print('No')
            return
        t += tsm
    t = 0
    for tmn, tsm in sorted(neg, reverse=True, key=lambda x: x[0]):
        if t + tmn < 0:
            print('No')
            return
        t += tsm
    print('Yes')


if __name__ == '__main__':
    main()


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

int main()
{
	string s;
	cin>>s;
	int p=0,q=0;
	for (int i = 0; i < 3; ++i)
	{
		if(s[i]=='R'){
			p=i;
			q=1;
			break;
	}
}
	if(p!=3){
		if (s[p+1]=='R')
		{
			q=2;
			if (s[p+2]=='R')
			{
				q=3;
			}
		}
	}

	cout<<q<<endl;
    return 0;
}

Measured memory_bytes: 3616
s = list(input())
t = list(input())

for i in range(len(s)):
    if s == t:
        print("Yes")
        exit()
    tmp = s[-1]
    for j in range(1, len(s)):
        s[-j] = s[-j + len(s) - 1]
    s[0] = tmp
print("No")


Measured memory_bytes: 2940
program atcoder
    implicit none
    integer(8) :: i,j,w,h,a,b,ans=0
    integer,allocatable,dimension(:,:) :: did
    character(len=401) :: s(401)

    read*,h,w
    allocate(did(h,w))
    did = 0

    do i=1,h
        read(*,*)s(i)
    enddo

    do i = 1,h
        do j = 1,w
            a=0
            b=0
            if(did(i,j)==0)then
                call dfs(i,j)
                ans = ans + a*b
            endif
        enddo
    enddo
    write(*,'(I0)')ans

    stop 
contains

recursive subroutine dfs(x,y)
    implicit none
    integer(8) :: x,y
    did(x,y) = 1
    if(s(x)(y:y)=='#')then
        b = b+1;
    else
        a = a+1;
    endif
    if(x>1 .and. did(x-1,y)==0 .and. s(x)(y:y)/=s(x-1)(y:y))Then
        call dfs(x-1,y)
    endif
    if(x<h .and. did(x+1,y)==0 .and. s(x)(y:y)/=s(x+1)(y:y))Then
        call dfs(x+1,y)
    endif
    if(y>1 .and. did(x,y-1)==0 .and. s(x)(y:y)/=s(x)(y-1:y-1))Then
        call dfs(x,y-1)
    endif
    if(y<w .and. did(x,y+1)==0 .and. s(x)(y:y)/=s(x)(y+1:y+1))Then
        call dfs(x,y+1)
    endif
end subroutine dfs

end program atcoder


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

int main(){
int x,y,z;
for(;;){
	cin>>x>>y;
	if(x==0&&y==0){break;}
	else if(x>y){z=x,x=y,y=z;}
	cout<<x<<" "<<y<<endl;
	}
return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
char s[10][10];
int n, m, stp, tot;
int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
    int x = 0, y = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++)
            if (s[i][j] == '#') tot++;
    }
    for (;;) {
        if (s[x + 1][y] == '#') {
            x++;
            stp++;
            continue;
        }
        if (s[x][y + 1] == '#') {
            y++;
            stp++;
            continue;
        }
        break;
    }
    puts(stp == tot ? "Possible" : "Impossible");
    return 0;
}

Measured memory_bytes: 256
from bisect import bisect
from itertools import accumulate as acc
N = int(input())

d = dict()
for i in range(2, int(N**(1/2))+2):
    if N%i == 0:
        d[i] = 0
    while N%i == 0:
        d[i] += 1
        N //= i
if N != 1:
    d[N] = 1

a = list(acc(range(1, 100)))

r = 0
for v in d.values():
    r += bisect(a, v)

print(r)

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

int main() {
	int N;
	cin >> N;
	map<string, int> P;
	int mv = 0;
	rep(i, N) {
		string s;
		cin >> s;
		P[s]++;
		mv = max(mv, P[s]);
	}
	for (auto p : P) {
		if (p.second == mv) cout << p.first << endl;
	}
}

Measured memory_bytes: 25216
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	q := scanInt()

	pq0 := priorityQueue0{}
	pq1 := priorityQueue1{}

	ans := 0
	_ = scanInt()
	mid := scanInt()
	heap.Push(&pq0, mid)
	b := scanInt()
	c := 1

	for i := 0; i < q-1; i++ {
		query := scanInt()
		if query == 1 {
			a := scanInt()
			b += scanInt()
			c++

			if mid < a {
				heap.Push(&pq1, a)
			} else {
				heap.Push(&pq0, a)
			}

			if len(pq0) < len(pq1) {
				heap.Push(&pq0, heap.Pop(&pq1).(int))
			}

			if len(pq0) > len(pq1)+1 {
				heap.Push(&pq1, heap.Pop(&pq0).(int))
			}

			now := pq0[0]

			if c&1 == 0 {
				ans += abs(mid - now)
			}
			mid = now

			ans += abs(mid - a)

		} else {
			fmt.Fprintln(wr, mid, ans+b)
		}
	}

}

type priorityQueue0 []int

func (pq priorityQueue0) Len() int            { return len(pq) }
func (pq priorityQueue0) Swap(i, j int)       { pq[i], pq[j] = pq[j], pq[i] }
func (pq priorityQueue0) Less(i, j int) bool  { return pq[i] > pq[j] }
func (pq *priorityQueue0) Push(x interface{}) { *pq = append(*pq, x.(int)) }
func (pq *priorityQueue0) Pop() interface{} {
	old := *pq
	n := len(old)
	x := old[n-1]
	*pq = old[0 : n-1]
	return x
}

type priorityQueue1 []int

func (pq priorityQueue1) Len() int            { return len(pq) }
func (pq priorityQueue1) Swap(i, j int)       { pq[i], pq[j] = pq[j], pq[i] }
func (pq priorityQueue1) Less(i, j int) bool  { return pq[i] < pq[j] }
func (pq *priorityQueue1) Push(x interface{}) { *pq = append(*pq, x.(int)) }
func (pq *priorityQueue1) Pop() interface{} {
	old := *pq
	n := len(old)
	x := old[n-1]
	*pq = old[0 : n-1]
	return x
}


Measured memory_bytes: 8576
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        long N = Long.parseLong(scanner.next());
        long M = Long.parseLong(scanner.next());
        long gcd = gcd(N, M);
        Map<Long, Integer> m = factorize(gcd);
        System.out.println(m.size() + 1);
    }

    static long gcd(long x, long y) {
        if (x < y) {
            return gcd(y, x);
        }
        if (y == 0) {
            return x;
        }
        return gcd(y, x % y);
    }

    static TreeMap<Long, Integer> factorize(long n) {
        TreeMap<Long, Integer> primes = new TreeMap<>();
        for (long i = 2; i * i <= n; i++) {
            while (n % i == 0) {
                primes.put(i, primes.getOrDefault(i, 0) + 1);
                n /= i;
            }
        }
        if (n != 1) {
            primes.put(n, 1);
        }
        return primes;
    }

}


Measured memory_bytes: 25684
x,y = map(int,input().split())
mod = 10**9+7
def comb(a,b):
  comb = 1
  chld = 1
  for i in range(b):
    comb = comb*(a-i)%mod
    chld = chld*(b-i)%mod
  return (comb*pow(chld,mod-2,mod))%mod
if (x+y)%3!=0:
  print(0)
else:
  nm = (x+y)//3
  n = y-nm
  m = x-nm
  if n>=0 and m>=0:
    print(comb(n+m,m))
  else:
    print(0)

Measured memory_bytes: 9136
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = input()[::-1]
n = len(s)
d = [['maerd',5],['remaerd',7],['esare',5],['resare',6]]
ind = 0
while True:
    if ind == n:
        print('YES')
        break
    ok = False
    for t,a in d:
        if ind + a <= n and s[ind:ind+a] == t:
            # print(s[ind:ind+a],t)
            ind += a
            ok = True
            break
    if not ok:
        print('NO')
        break



Measured memory_bytes: 5348
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    int n;cin>>n;
    VEC(int,p,n);
    sort(ALL(p));
    int res = 0;
    rep(i,n){
        if(i != n-1)res += p[i];
        else res += (p[i]/2);
    }
    cout<<res;
}



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

using namespace std;

int main(){
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> Bj(M);
    for(int j=0; j<M; j++){
        cin >> Bj.at(j);
    }

    vector<vector<int>> Aij(N, vector<int>(M));
    for(int i=0; i<N; i++){
        for(int j=0; j<M; j++){
            cin >> Aij.at(i).at(j);
        }
    }

    int count = 0;
    for(int i=0; i<N; i++){
        int val = 0;
        for(int j=0; j<M; j++){
            val += Aij.at(i).at(j) * Bj.at(j);
        }
        val += C;
        if (val > 0){
            count += 1;
        }
    }

    cout << count;
    return 0;
}

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

int cul(vector<int> &data, vector<vector<char>> &array, int x) {
  int sum = data.at(0);
  
  for (int i = 0; i < 3; i++) {
    if (array.at(x).at(i) == '+') sum += data.at(i + 1);
    else sum -= data.at(i + 1);
  }
  return sum;
}

int main() {
  int S;
  cin >> S;
  
  vector<int> data(4);
  int c = 0;
  while (1) {
    data.at(c) = S % 10;
    S /= 10;
    c++;
    if (c == 4) break;
  }
  
  reverse(data.begin(), data.end());
  
  vector<vector<char>> array(8, vector<char>(3));
  int cnt = 0;
  for (int i = 0; i < 2; i++) {
    for (int k = 0; k < 2; k++) {
      for (int l = 0; l < 2; l++) {
        if (l == 0) array.at(cnt).at(2) = '+';
        else array.at(cnt).at(2) = '-';
        if (k == 0) array.at(cnt).at(1) = '+';
        else array.at(cnt).at(1) = '-';
        if (i == 0) array.at(cnt).at(0) = '+';
        else array.at(cnt).at(0) = '-';
        cnt++;
      }
    }
  }
  
  int a;
  for (int i = 0; i < 8; i++) {
    if (cul(data, array, i) == 7) {
      a = i;
      break;
    }
  }
  
  for (int i = 0; i < 3; i++) {
    cout << data.at(i) << array.at(a).at(i);
  }
  cout << data.at(3) << "=7" << endl;
}        

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dp[1000000];
int main(){
    int n;
    cin>>n;
    int h[n+1];
    for(int i=1;i<=n;i++){
        cin>>h[i];
    }
    for(int i=0;i<=n;i++){
        dp[i]=-1;
    }
    for(int i=1;i<=n;i++){
    if(i==1){
        dp[i]=0; 
        continue;
    }
    if(i==2){
        dp[i]=abs(h[i]-h[i-1]);
        continue;
    }
    else{
       dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]));
    }
    //cout<<dp[i]<<" "<<i<<endl;
    }
    cout<<dp[n];

}

Measured memory_bytes: 1024
require 'pp'
n, a, b= gets.split.map(&:to_i)

if (b-a).even?
  p (b-a)/2
else
  cnt1 = a 
  cnt1 += ( (b-a) )/2
  cnt2 = n - b + 1
  cnt2 += ( n - (a + (n-b+1) ) )/2
  p [cnt1,cnt2].min
end






# 1 2


Measured memory_bytes: 2172
Imports System.Collections.Generic
Imports System.Console
Imports System.Math  
Module Program
 	Sub Main()
        Dim input() As String = Console.ReadLine().Split(" ")
        Dim a As String = input(0)
        Dim b As String  = input(1)
        Console.WriteLine(IIF(a=b, "H", "D"))
    End Sub
End Module


Measured memory_bytes: 19792
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int k; cin >> k;
	int odd = 0, even = 0;
	for (int i = 1; i <= k; i++) {
		if (i % 2 == 1) odd++;
		else even++;
	}
	cout << odd * even << endl;
	return 0;
}

Measured memory_bytes: 3632
package main

import "fmt"

func main() {
	var s string
	var result string
	fmt.Scan(&s)
	for _, c := range s {
		if c == 'B' {
			if result != "" {
				result = result[:len(result)-1]
			}
		} else {
			result += string(c)
		}
	}
	fmt.Println(result)
}


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

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

    int n;
    cin >> n;
    vector<int> L(n);
    for (int &Li : L) cin >> Li;

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

    int ans = 0;

    for (int i = 0; i < n - 2; ++i) {
        for (int j = i + 1; j < n - 1; ++j) {
            if (L.at(i) == L.at(j)) continue;
            for (int k = j + 1; k < n; ++k) {
                if (L.at(j) == L.at(k)) continue;
                if (L.at(i) + L.at(j) > L.at(k))
                    ans++;
                else
                    break;
            }
        }
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3652
#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 main()
{
  int K, X;
  cin >> K >> X;
  if (500 * K >= X) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import numpy as np
n, k = map(int,input().split())
f = lambda:list(map(int,input().split()))
h = np.array(f())
#print(h)
dp = np.zeros(n,'i8')

for i in range(1,n):
  s = max(i-k,0)
  dp[i] = np.min(dp[s:i]+np.abs(h[s:i]-h[i]))
print(dp[-1])

Measured memory_bytes: 22804
import java.util.*;

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

		Arrays.sort(map);
		
		for (int i = 0; i < N; i++) {
			if (src[i] == map[N-1]) {
				System.out.println(map[N-2]);
			} else {
				System.out.println(map[N-1]);
			}	
		}
		
    }
}

Measured memory_bytes: 105976
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
int main()
{
	 int n;
	 while(cin>>n){
	 	char a,red,blue;
	 	red=0;blue=0;
	 	for(int i=0;i<n;i++){
	 		cin>>a;
	 		if(a=='R'){
	 			red++;
			 }
			 if(a=='B'){
			 	blue++;
			 }
		 }
		 if(red>blue){
		 	cout<<"Yes"<<endl;
		 }
		 else{
		 	cout<<"No"<<endl;
		 }
	 } 
	return 0;
}


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

int main(){
  int N;
  cin >> N;
  int count=0;
  if(N%10==2){
    count++;
  }
  if(N/1000==2){
    count++;
  }
  if(N%1000-N%100==200){
    count++;
  }
  if(N%100-N%10==20){
    count++;
  }
  cout << count << endl;
}


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

int n;
double x[105], y[105], X, Y, d, e;
double dist(double a, double b) {
	return a*a + b*b;
}
int main() {
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	cout<<fixed<<setprecision(18);

	cin>>n;
	for (int i = 0; i < n; i++) {
		cin>>x[i]>>y[i];
		X += x[i];
		Y += y[i];
	}

	X /= n; Y /= n;
	double P = 0.1;
	for (int i = 0; i < 70000; i++) {
		int f = 0;
		d = dist(X - x[0], Y - y[0]);
		for (int j = 1; j < n; j++) {
			e = dist(X - x[j], Y - y[j]);
			if (d < e) {
				d = e;
				f = j;
			}
		}
		X += (x[f] - X)*P;
		Y += (y[f] - Y)*P;
		P *= 0.998;
	}
	double ans=0;
	for(int i=0 ; i<n ; ++i)
		ans = max( ans , sqrt( dist(X-x[i],Y-y[i]) ) );
	cout<< ans ;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

typedef int _loop_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 DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    double n;
    cin>>n;
    double ans = ceil(n/2) / (double)n;
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define rep(i,a,b) for(auto i = (a); i != (b); ++i)
#define REP(i,n) rep(i,0,n)
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

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

	ll N, A, B;
	cin >> N >> A >> B;
	cout << min(N * A, B) << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"

using namespace std;
using ll = long long int;

#define all(v) (v).begin(),(v).end()
#define repeat(cnt,l) for(typename remove_const<typename remove_reference<decltype(l)>::type>::type cnt={};(cnt)<(l);++(cnt))
#define rrepeat(cnt,l) for(auto cnt=(l)-1;0<=(cnt);--(cnt))
#define iterate(cnt,b,e) for(auto cnt=(b);(cnt)!=(e);++(cnt))
#define diterate(cnt,b,e) for(auto cnt=(b);(cnt)!=(e);--(cnt))
const long long MD = 1000000007ll; const long double PI = 3.1415926535897932384626433832795L;
template<typename T1, typename T2> inline ostream& operator <<(ostream &o, const pair<T1, T2> p) { o << '(' << p.first << ':' << p.second << ')'; return o; }
template<typename T> inline T& chmax(T& to, const T& val) { return to = max(to, val); }
template<typename T> inline T& chmin(T& to, const T& val) { return to = min(to, val); }
void bye(string s, int code = 0) { cout << s << endl; exit(code); }
mt19937_64 randdev(8901016);
template<typename T, typename Random = decltype(randdev), typename enable_if<is_integral<T>::value>::type* = nullptr>
inline T rand(T l, T h, Random& rand = randdev) { return uniform_int_distribution<T>(l, h)(rand); }
template<typename T, typename Random = decltype(randdev), typename enable_if<is_floating_point<T>::value>::type* = nullptr>
inline T rand(T l, T h, Random& rand = randdev) { return uniform_real_distribution<T>(l, h)(rand); }




int main() {
  int N;
  cin >> N;
  int best = -999999999;
  int low;
  cin >> low;
  repeat(i, N-1) {
    int r;
    cin >> r;
    chmax(best, r - low);
    chmin(low, r);
  }
  cout << best << '\n';
  return 0;
}



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

using namespace std;

#define int long long
#define pb push_back
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0);

signed main () {
  cin.tie(0);
  cout << setprecision(10);

  int n; cin >> n;
  vector<int> a(n), b(n), c(n);
  REP(i, n) {
    cin >> a[i];
  }

  REP(i, n) {
    cin >> b[i];
  }

  REP(i, n) {
    c[i] = b[i] - a[i];
  }

  int su1=0, su2=0;
  REP(i, n) {
    if(c[i] < 0) {
      su1 += -c[i];
    } else {
      su2 += c[i] - c[i]%2;
    }
  }

  if(2 * su1 <= su2) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int n,i; 
char a[250],b[250];
int main()
{
	scanf("%d",&n);
	scanf("%s%s",a,b);
	for(i=0;i<n;++i)
		printf("%c%c",a[i],b[i]);	
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <ctime>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;



int main()
{
    // 整数の入力
    ll N,K,total;
    total = 0;
    vector<ll> takoyaki;
    cin >> N;
    for(int i = 0;i<N;i++){
        ll h;
        cin >> h;
        takoyaki.push_back(h);
    }

    for(int i = 0;i<N;i++){
        for(int j = i+1;j<N;j++){
            total += takoyaki[i] * takoyaki[j];
        }
    }
    cout << total << endl;
    return 0;
}

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

int main() {
	int n, k, x[100000],sum;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	sum = (n - 1) / (k - 1);
	if ((n - 1) % (k - 1) != 0)sum++;
	cout << sum << endl;
}

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

#define int long long
map < int , int > now;
int arr[200003] , nxt[200003] , len[200003] , N , K;
int tms[200003];

signed main(){
	cin >> N >> K;
	for(int i = 0 ; i < N ; ++i) cin >> arr[i];
	for(int i = N - 1 ; i >= 0 ; --i){
		if(now.find(arr[i]) != now.end()) nxt[i] = now[arr[i]];
		now[arr[i]] = i;
	}
	for(int i = N - 1 ; i >= 0 ; --i)
		if(!nxt[i]) nxt[i] = N + now[arr[i]];
	int cnt = 0 , all = N * K;
	while(!len[cnt % N]){len[cnt % N] = cnt + 1; cnt += nxt[cnt % N] - (cnt % N) + 1;}
	if(all > len[cnt % N] - 1){
		all -= len[cnt % N] - 1;
		all = all % (cnt / N * N);
		cnt %= N;
	}
	else cnt = 0;
	while(all >= nxt[cnt] - cnt + 1){
		all -= nxt[cnt] - cnt + 1;
		cnt = (nxt[cnt] + 1) % N;
	}
	deque < int > q;
	while(all){
		if(tms[arr[cnt]])
			while(tms[arr[cnt]]){
				--tms[q.back()]; q.pop_back();
			}
		else{q.push_back(arr[cnt]); ++tms[arr[cnt]];}
		--all; cnt = (cnt + 1) % N;
	}
	while(!q.empty()){
		printf("%lld " , q.front()); q.pop_front();
	}
	return 0;
}


Measured memory_bytes: 21888
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef complex<double> P;
static const double EPS = 1e-8;
static const int INF = (int)1e8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOREQ(i,k,n) for (int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FIND(m,w) ((m).find(w)!=(m).end())
int w,h;
int grid[15][15];
int memo[15][15];
int dfs(int x,int y){
  if(x<0||x>=w) return 0;
  if(y<0||y>=h) return 0;
  if(grid[y][x]==1) return memo[y][x] = 0;
  if(y==0) return memo[y][x] = 1;
  if(memo[y][x]>=0){
    return memo[y][x];
  }
  int ret = 0;
  if(grid[y-1][x]!=2)ret += dfs(x,y-1);
  if(grid[y][x]!=2&&x-1>=0&&grid[y-1][x-1]!=2)ret += dfs(x-1,y-1);
  if(grid[y][x]!=2&&x+1<w&&grid[y-1][x+1]!=2)ret += dfs(x+1,y-1);
  if(y>=2&&grid[y-2][x]==2) ret += dfs(x,y-2);
  return memo[y][x] = ret;
}

int main(void){
  while(cin>>w>>h,w){
    memset(memo,-1,sizeof(memo));
    REP(y,h)REP(x,w){
      cin>>grid[y][x];
    }
    int ans = 0;
    REP(x,w){
      ans += dfs(x,h-1);
      if(grid[h-2][x]==2) ans += dfs(x,h-2);
    }
    
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long lli;
typedef pair<int, int> pii;
int n;
string s;

void ReadInput()
{
    cin >> s;
    n = s.length();
}

void Solve()
{
    int i = 0, cnt_a = 0;
    lli ans = 0;
    while(i < n)
    {
        if(cnt_a > 0)
        {
            if(s[i] == 'A') ++cnt_a;
            else if(s[i] == 'B')
            {
                if(i + 1 < n && s[i + 1] == 'C')
                {
                    ans += cnt_a;
                    ++i;
                }
                else cnt_a = 0;
            }
            else cnt_a = 0;
        }
        else if(s[i] == 'A') ++cnt_a;
        ++i;
    }
    cout << ans << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ReadInput();
    Solve();
}


Measured memory_bytes: 720
def main():
    from collections import Counter

    n = int(input())
    a = tuple(int(x) for x in input().split())

    c = Counter(a)
    c1 = c[1]
    c2 = c[2]
    c3 = c[3]

    x1 = 310 ** 2
    x2 = 310

    dp = [0.0] * (310 ** 3)
    dp[0] = 0.0
    # dp[x * x1 + y * x2 + z]:=1,2,3個の皿がx,y,z残っているときの期待値

    div_tbl = [1]
    div_tbl.extend([1 / i for i in range(1, 300 * 3 + 1)])

    for r3 in range(c3 + 1):
        d3 = c3 - r3
        for r2 in range(c2 + d3 + 1):
            for r1 in range(c1 + d3 + c2 - r2 + 1):
                ind = r1 * x1 + r2 * x2 + r3
                if ind != 0:
                    dp[ind] = (n \
                               + (dp[ind - x1] * r1 if r1 > 0 else 0) \
                               + (dp[ind + x1 - x2] * r2 if r2 > 0 else 0) \
                               + (dp[ind + x2 - 1] * r3 if r3 > 0 else 0)) \
                              * div_tbl[r1 + r2 + r3]

    print(dp[c1 * x1 + c2 * x2 + c3])


if __name__ == '__main__':
    main()

# dp[now] =
# 1
# + dp[1個の皿を食べた] * p
# + dp[2個の皿を食べた] * p
# + dp[3個の皿を食べた] * p
# + dp[0個の皿を食べた==now] * p

# if mainの追加
# 初期値None->-1.0にした
# checked配列を辞めた
# チェック済みかどうかの判定を-1.0と一致するかの比較にした

# カウントはCounterを使う方が速い
# 1次元にした
# resの加算を複数回に分けると
# 三項演算子より遅くなる
# 再帰関数を辞めた
# 割り算を先に計算しておく


Measured memory_bytes: 267544
# -*- coding:utf-8 -*-
import itertools
a = list(map(int, list(input())))
factor = list(itertools.product(['+', '-'], repeat=3))
for tmp in factor:
    op1 = tmp[0]
    op2 = tmp[1]
    op3 = tmp[2]
    if op1 == '+':
        ans = a[0]+a[1]
    else:
        ans = a[0]-a[1]
    if op2 == '+':
        ans += a[2]
    else:
        ans -= a[2]
    if op3  == '+':
        ans += a[3]
    else:
        ans -= a[3]
    if ans == 7:
        print(str(a[0])+op1+str(a[1])+op2+str(a[2])+op3+str(a[3])+'=7')
        break
    else:
        pass

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin>>N;
  vector<int> mochi(N);
  for(int i=0; i<N; i++){
    cin>>mochi[i];
  }
  sort(mochi.begin(), mochi.end());
  int ans;
  for(int i=0; i<N-1; i++){
    if(mochi[i]!=mochi[i+1]){
      ans++;
    }
  }
  cout<<ans+1<<endl;
}

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

int main()
{
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    vector< string>div{"maerd","remaerd","esare","resare"};
    
    bool isyes=true;
   
for(int i=0;i<s.size();){
   bool t=true;
   
     for(int j=0;j<4;j++){       
       string d=div.at(j);
       if(d==s.substr(i,d.size())){
        t=false;
        i+=d.size();
        }
    }
  if(t){
    isyes=false;
  break;
    }
}
if(isyes) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
          
    return 0;
}


Measured memory_bytes: 512
fun main(args: Array<String>){
    val sorce = readLine()
    val time = if (sorce==null) 0 else sorce.toInt()
    val h = time/3600
    val m = (time-h*3600)/60
    val s = (time-h*3600-m*60)
    println("${h}:${m}:${s}")
}



Measured memory_bytes: 25284
def find_sum(n):
  ret = 0
  while(n > 0):
    ret += n % 10
    n = int((n - n % 10) / 10)
  return ret

N, A, B = map(int, input().split())
ret = 0
for i in range(N + 1):
  #v = sum(map(int, list(str(i))))
  v = find_sum(i)
  if v >= A and v <= B:
    ret += i
print(ret)

Measured memory_bytes: 40048
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        long K=sc.nextLong();
        if(K==1){
            System.out.println(s.charAt(0));
        }else{
            int i=0;
            while(i<K&&s.charAt(i)=='1'){
                i++;
            }
            if(i==K){
                System.out.println(s.charAt((int)(K-1)));
            }else{
                System.out.println(s.charAt(i));
            }
        }
    }
}


Measured memory_bytes: 21844