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

int main(){
    string S,t;
    cin >> S;
    cin >> t;
    int sl = S.length();
    int tl = t.length();
    vector<string> strs;
    if(tl > sl){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

    for(int i = 0; i <= sl-tl ;i++){
        bool check = true;
        string s = S;
        for(int j = 0 ; j < tl ; j++){
            if(s.at(i+j) == '?'){
                s.at(i+j) = t.at(j);
            }else if(s.at(i+j) != t.at(j)){
                check = false;
                break;
            }
        }
        if(check){
            for(int k = 0; k < sl ;k++){
                if(s.at(k) == '?'){
                    s.at(k) = 'a';
                }
            }
            strs.push_back(s);
            //i = i + tl-1;
        }
   }
   if(!strs.empty()){
        sort(strs.begin(),strs.end());
        cout << strs.front() << endl;
   }else{
        cout << "UNRESTORABLE" << endl;
   }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<random>
#include<numeric>
#include<string>
#include<cstring>
typedef long long ll;
typedef long double ld;
using namespace std;
ll dx[] = { 0,0,1,-1 };
ll dy[] = { 1,-1,0,0 };

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b)*b;
}
ll prime(ll x) {
	ll i;
	if (x < 2)return 0;
	else if (x == 2) return 1;
	if (x % 2 == 0) return 0;
	for (i = 3; i*i <= x; i += 2) {
		if (x%i == 0) return 0;
	}
	return 1;
}

int main() {
	string ans = "No";
	ll N;
	cin >> N;
	for (ll i = 0; i <= 100; i++) {
		for (ll j = 0; j <= 100; j++) {
			if (N == 4 * i + 7 * j)
				ans = "Yes";
		}
	}
	cout << ans << endl;
	
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline

n,k= map(int, input().split())
s = input().strip()

s.strip()
p = [0]
for i in range(n):
    if s[i] != s[p[-1]]:
        p.append(i)
p.append(n)

X = []
for i in range(len(p)-1):
    if s[p[i]] == "1":
        li = i
        ri = i + 2 * k + 1
        if ri >= len(p)-1:
            ri = len(p)-1
        x = p[ri] - p[li]
    else:
        li = i-1
        if li < 0:
            li = 0
        ri = i + 2 * (k-1) + 1
        if ri >= len(p)-1:
            x = n - p[li]
        else:
            x = p[ri] - p[li] + 1
    X.append(x)
print(max(X))


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

using namespace std;

int a[51];

int main() {
    ios_base::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    int x, y;
    for (int i = 0; i < m; ++i) {
        cin >> x >> y;
        a[x-1]++;
        a[y-1]++;
    }
    for (int i = 0; i < n; ++i) {
        cout << a[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;

const int N = 100009;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 97;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

// OrderedSet
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template < typename T > using ordered_set = tree < T, null_type, greater < T >, rb_tree_tag, tree_order_statistics_node_update >;

//typedef uint64_t hash_t;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//const int HASH_COUNT = 2;
//const hash_t HASH_P = (uint32_t)-13337;
//uniform_int_distribution<hash_t> MULT_DIST(0.25 * HASH_P, 0.75 * HASH_P);
//const hash_t HASH_MULT[HASH_COUNT] = {MULT_DIST(rng), MULT_DIST(rng)};

int h, n;

int A[N], B[N];
ll dp[1005][10005];

ll go(int pos, int rem){
  if(rem <= 0) return 0;
  if(pos >= n) return 1e9;
  if(dp[pos][rem] != -1){
    return dp[pos][rem];
  }
  /*ll ret = 1ll * 1e15;
  int turn = (rem / A[pos]) + (rem % A[pos] != 0);
  for(int i = 0; i <= turn; i++){
    ret = min(ret, i * B[pos] + go(pos + 1, rem - i * A[pos]));
  }*/
  return dp[pos][rem] = min(go(pos + 1, rem), B[pos] + go(pos, rem - A[pos]));
}

int main(){
  fastScan(h);
  fastScan(n);
  for(int i = 0; i < n; i++){
    fastScan(A[i]);
    fastScan(B[i]);
  }
  memset(dp, -1, sizeof dp);
  for(int i=n;i>0;i/=2) go(i,h);
  printf("%d\n", go(0, h));
}


Measured memory_bytes: 79360
#include <climits>
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n; cin >> n;
  vector<int> v(n, 0);
  for(auto& e: v) cin >> e;
  vector<int> dp(n, 1e9 + 5);
  dp[0] = 0;
  dp[1] = abs(v[0] - v[1]);
  for (int i = 2; i < n; ++i) {
    dp[i] =
        min(dp[i - 1] + abs(v[i] - v[i - 1]), dp[i - 2] + abs(v[i] - v[i - 2]));
  }
  cout << dp.back() << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

long long A[3], K;
int main() {
    while (cin >> A[0] >> A[1] >> A[2] >> K) {
        sort(A, A+3);
        for (int i = 0; i < K; ++i) A[2] *= 2;
        long long res = 0;
        for (int i = 0; i < 3; ++i) res += A[i];
        cout << res << endl;
    }
}


Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)
puts (0...N).reduce(0){ |a,i| a + [A[i]-B[i], 0].max } <= (0...N).reduce(0){ |a,i| a + [B[i]-A[i], 0].max / 2 } ? "Yes" : "No"


Measured memory_bytes: 3196
nk = gets.chomp.split
n = nk[0].to_i
k = nk[1].to_i

sunukes = Array.new(n+1, false)
k.times do
    d = gets.to_i
    a = gets.chomp.split
    d.times do |i|
        a[i] = a[i].to_i
        sunukes[a[i]] = true if sunukes[a[i]] == false
    end
end

puts sunukes.count(false) - 1

Measured memory_bytes: 14308
n, k = map(int, input().split())
x = list(map(int, input().split()))

xr =  [0] + [_ for _ in x if _ >= 0]
xl = [-_ for _ in x if _ < 0] + [0]
xl.reverse()

xr = xr[:k+1]
xl = xl[:k+1]

if len(xl) > len(xr):
  xr, xl = xl, xr
  
xl, xr = xl[k - (len(xr)-1):], xr[k - (len(xl)-1):]

xl.reverse()

print(min(min(2*i+j, 2*j+i) for i, j in zip(xl, xr)))

Measured memory_bytes: 14224
#include <stdio.h>

int main(void) {
	int A,B;
	int count=1,ans;
	scanf("%d %d",&A,&B);
	if(B==1){
    	printf("0\n");
    }
  	else if(A>=B){
		printf("1\n");
	}else{
  	ans=A;
  	while(ans<B){
  	if(ans<B){
  		ans+=A-1;
  		count++;
  	}
	}
		printf("%d",count);
	}
	return 0;
}


Measured memory_bytes: 128
h,w = gets.chomp.split.map(&:to_i)

def solve(h, w)
  (1..h-1).each.map{|h1|
    h2 = h - h1
    s1 = [h1*w, w*(h2/2.to_f).ceil, w*(h2/2.to_f).floor].minmax
    s2 = [h1*w, h2*(w/2.to_f).ceil, h2*(w/2.to_f).floor].minmax
    [s1[1] - s1[0], s2[1] - s2[0]].min
  }.min
end

puts [solve(h,w), solve(w,h)].min

Measured memory_bytes: 3452
#include <stdio.h>

using namespace std;

int main(){
	int n,m,l;
	scanf("%d %d %d",&n,&m,&l);
	int A[n][m],B[m][l];
	long long int C[n][l];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			C[i][j] = 0;
		}
	}

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

	for(int i = 0; i < n; i++){
		for(int k = 0; k < l; k++){
			for(int j = 0; j < m; j++){
				C[i][k] += A[i][j]*B[j][k];
			}
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < l-1; j++){
			printf("%lld ",C[i][j]);
		}
		printf("%lld\n",C[i][l-1]);
	}
}



Measured memory_bytes: 2888
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuilder sbHead = new StringBuilder();
        StringBuilder sbTail = new StringBuilder();
        int q = in.nextInt();
        int asc = 1;
        for(int i=0; i<q; i++) {
            int t = in.nextInt();
            if(t==1) {
                asc *= -1;
                continue;
            }
            int f = in.nextInt();
            String c = in.next();
            if((asc>0&&f==1) || (asc<0&&f==2)) {
                sbHead.insert(0, c);
            }
            else {
                sbTail.append(c);
            }
        }
        if(asc>0) {
            System.out.println(sbHead.toString() + s + sbTail.toString());
        }
        else {
            StringBuilder sb = new StringBuilder(s);
            System.out.println(sbTail.reverse().toString() + sb.reverse().toString() + sbHead.reverse().toString());
        }
    }
}


Measured memory_bytes: 112120
import sys
import math
import itertools

readline = sys.stdin.readline
sqrt = math.sqrt

def euclid_distance(a, b):
    return sqrt(pow(a[0]-b[0],2) + pow(a[1]-b[1],2))

def main():
    N = int(input())
    A = []
    for _ in range(N):
        A.append(tuple(map(int, readline().split())))
    
    D = []
    for i in range(N):
        tmp = []
        for j in range(N):
            tmp.append(euclid_distance(A[i], A[j]))
        D.append(tmp)

    distance = []
    for root in itertools.permutations(range(N)):
        dsum = 0
        for r in range(N-1):
            dsum += D[root[r]][root[r+1]]
        distance.append(dsum)
    
    ans = sum(distance)/len(distance)    
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 4460
#include <stdio.h>
 
int main(void) {
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if(x >= r && y >= r && (H - r) >= y && (W - r) >= x) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,a2,b;
	cin>>n>>a2>>b;
	int a[n];
	for(int i =0 ;i<n;i++)
		cin>>a[i];

	ll ans = 0;
	for(int i = 0 ;i<n-1;i++)
	{
		a[i]= -a[i]+a[i+1];
		ll h = a[i]*a2;
		ans += min(h,b);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int>v(n);
  int c=0,ne=0;
  for(auto i=0;i<n;i++)
  {
    cin>>v[i];
    if(!(v[i]&1))
    {
      ne++;
      if(v[i]%3==0||v[i]%5==0)
      {
        c++;
      }
    }
  }
  if(ne!=c)
  {
    cout<<"DENIED";
  }
  else
    cout<<"APPROVED";
  return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

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

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int dp[100010];

int main() {

	int n; cin >> n;

	for (int i = 0; i < 100010; i++) {
		dp[i] = INF;
	}

	dp[0] = 0;

	//dp[i円払った]状態の最低枚数

	//コインは無限に使える。
	//更新の向きを気にしなくていい。

	
		//6べきを一つとってくる
		for (int power = 1; power <= n; power = power * 6) {
			for (int i = power; i<=n; i++) {
				dp[i] = min(dp[i], dp[i-power] + 1);
			}
		}

		//9べきの遷移
		for (int power = 1; power <= n; power = power * 9) {
			for (int i = power; i <= n; i++) {
				dp[i] = min(dp[i], dp[i-power] + 1);
			}
		}

		cout << dp[n] << endl;
	
	return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        String N = sc.next();
        int count = 0;
        
        for(int i = 0; i < 3; i++){
            if( N.charAt(i) == '1') count++;
        }
        System.out.println(count);
    }
}


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

using namespace std;

typedef long long ll;

int n;
ll mod;

vector <vector <int>> g;
vector <ll> dp;
vector <ll> up;
vector <int> children;

void dfs1(int v, int p);
void dfs2(int v, int p);
void build(int l, int r, int idx, vector <ll>& st);
ll quest(int l, int r, int idx, int left, int right, vector <ll>& st);

void dfs2(int v, int p = -1)
{
    children.clear();
    for (auto u:g[v])
        if (u!=p)
            children.push_back(u);

    vector <ll> st(4*children.size());
    if (children.size())
        build(0, children.size()-1, 1, st);

    for (int i=0; i<children.size(); ++i)
    {
        int u = children[i];
        ll a = (i == 0) ? 1 : quest(0, children.size()-1, 1, 0, i-1, st);
        ll b = (i == children.size()-1) ? 1 : quest(0, children.size()-1, 1, i+1, children.size()-1, st);
        int x = up[v];
        up[u] = ((up[v] + (v!=0)) * a % mod) * b % mod;
    }
    for (auto u:g[v])
        if (u != p)
            dfs2(u, v);
}

void dfs1(int v, int p = -1)
{
    dp[v] = 1;
    for (int u:g[v])
        if (u != p)
        {
            dfs1(u, v);
            dp[v] *= dp[u]+1;
            dp[v] %= mod;
        }
}

void build(int l, int r, int idx, vector <ll>& st)
{
    if (l == r)
    {
        st[idx] = dp[children[l]] + 1;
        st[idx] %= mod;
        return;
    }

    int m = (l + r) / 2;
    build(l, m, 2*idx, st);
    build(m+1, r, 2*idx+1, st);
    st[idx] = st[2*idx] * st[2*idx + 1];
    st[idx] %= mod;
}

ll quest(int l, int r, int idx, int left, int right, vector <ll>& st)
{
    if (right < l || left > r)
        return 1;
    if (r <= right && l >= left)
        return st[idx];
    int m = (l + r) / 2;
    ll a = quest(l, m, 2*idx, left, right, st);
    ll b = quest(m+1, r, 2*idx+1, left, right, st);
    return a*b%mod;
}

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

    g.resize(n);
    up.resize(n, 1);
    dp.resize(n);

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

    cout << dp[0] << "\n";
    for (int i=1; i<n; ++i)
        cout << (up[i]+1)*dp[i]%mod<< "\n";

    return 0;
}


Measured memory_bytes: 23040
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

constexpr int64 MOD = 1000000007;

int H, W;
string c[100];

int main() {
    cin >> H >> W;
    for (int j = 0; j < H; ++j) {
        cin >> c[j];
    }

    int result[100][100];
    for (int j = 0; j < H; ++j) {
        int prev = c[j][0] == 'c' ? 0 : -1;
        for (int k = 0; k < W; ++k) {
            if (c[j][k] == 'c') { prev = k; }
            result[j][k] = prev < 0 ? -1 : k - prev;
        }
    }
    for (int j = 0; j < H; ++j) {
        for (int k = 0; k < W; ++k) {
            if (k > 0) cout << ' ';
            cout << result[j][k];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3200
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<vector>
#include<ctime>
#define ll long long
#define pr(x) cerr<<#x<<"="<<x<<endl
using namespace std;
char ch[110000],s[110000];
int i,cnt,ans,n;
int main()
{
	scanf("%s",ch);
	n=strlen(ch);
	for (i=0;i<n;i++)
	{
		if (ch[i]!='x') s[++cnt]=ch[i];
	}
	for (i=1;i<=cnt/2;i++)
	{
		if (s[i]!=s[cnt-i+1]) 
		{
			printf("-1\n");
			return 0;
		}
	}
	int l=0,r=n-1;
	while (l<r)
	{
		if (ch[l]=='x'&&ch[r]!='x') l++,ans++;
		else if (ch[r]=='x'&&ch[l]!='x') r--,ans++;
		else l++,r--;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 384
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, M = LI()
    G = collections.defaultdict(set)
    for _ in range(M):
        A, B = LI_()
        G[A].add(B)
        G[B].add(A)
    # print(G)

    # 連結成分をすべてバラバラにできればよい→最大の連結成分がわかればよい
    visited = [False] * N
    def dfs(c, cnt):
        visited[c] = True
        cnt[0] += 1
        for n in G[c]:
            if not visited[n]:
                dfs(n, cnt)

    ans = 0
    for i in range(N):
        cnt = [0]
        dfs(i, cnt)
        ans = max(cnt[0], ans)

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 310092
s = gets.chomp

until s.length == 0
  if s.end_with?('erase')
    s = s.chomp('erase')
  elsif s.end_with?('dream')
    s = s.chomp('dream')
  elsif s.end_with?('eraser')
    s = s.chomp('eraser')
  elsif s.end_with?('dreamer')
    s = s.chomp('dreamer')
  else
    puts 'NO'
    exit
  end
end

puts 'YES'


Measured memory_bytes: 70648
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>

using namespace std;
#define endl '\n'
#define pb push_back
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1e9 + 7)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) > "Yes" : "No" ) << endl


typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

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

void solve() {

	int x1 = in(), y1 = in(), x2 = in(), y2 = in();

	int x3, x4, y3, y4;

	int dx = x2 - x1, dy = y2 - y1;

	x3 = x2 - dy;
	y3 = y2 + dx;
	x4 = x3 - dx;
	y4 = y3 - dy;

	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;

	return;
}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end() //使うときはsort(all())という感じで
using ll = long long;

int main(){
  string s;
  cin>>s;
  int n=s.size();
  rep(i,n){
    if(i%2==0){
      if(s[i]=='L'){
        cout<<"No"<<endl;
        return(0);
      }
    }
    else{
      if(s[i]=='R'){
        cout<<"No"<<endl;
        return(0);
      }
    }
  }
  cout<<"Yes"<<endl;
  return(0);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
  string moji;
  cin >> moji;
  int kotae = 0;
  if(moji.size() != 1){
  for(int i = 0;i <= moji.size() / 2 - 1;i++){
    if(moji[i] != moji[moji.size() - i - 1]){
      kotae++;
    }
  }
  }
  cout << kotae << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(){
  int a1, a2, b;
  int cnt1=0, cnt2=0;
  while(scanf("%d,%d,%d", &a1, &a2, &b) != EOF){
    if(a1 == a2){
      cnt1++;
    }else if(pow(a1,2) + pow(a2, 2) == pow(b,2)){
      cnt2++;
    }
  }
  printf("%d\n%d\n", cnt2, cnt1);
  return 0;
}

Measured memory_bytes: 596
n, k = map(int, input().split())
x = list(map(int, input().split()))
start = 0 # i-1本目とi本目の間に0がある

ans = 10**9
for i in range(n-k+1):
    tmp_ans = min(
        abs(x[i]) + abs(x[i+k-1]-x[i]),
        abs(x[i+k-1]) + abs(x[i+k-1]-x[i])
    )
    if tmp_ans < ans:
        ans = tmp_ans

print(ans)


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

using namespace std;


int main() {
  
   int n,cnt=0;
   long int x;
   scanf("%d%ld",&n,&x);
   
   int a[n],i;
   long int sum=0;
   
   for(i=0;i<n;++i)
       {
           scanf("%d",&a[i]);
           sum+=a[i];
       }
       
    sort(a,a+n);
    cnt=n-1;
    sum=sum-a[0];
    x=x-sum;
    cnt+=x/a[0];
    
    cout<<cnt;
    	return 0;
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    string s;
    cin>> s;

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

    if( s[0]== s[1] and s[2]== s[3] and s[1]!= s[2] )
        cout << "Yes";
    else
        cout << "No";
    nl;

    return 0;
}




Measured memory_bytes: 3648
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);
	int s;
	int n;
	int t;
	String weekday;
	String time;
	Map<String, Integer> wmap = new HashMap<String, Integer>();

	int p;
	int m;
	final int WEEK = 60 * 24 * 7;
	final int DAY = 60 * 24;

	void run() {

		wmap.put("Sun", 0);
		wmap.put("Mon", 1);
		wmap.put("Tue", 2);
		wmap.put("Wed", 3);
		wmap.put("Thu", 4);
		wmap.put("Fri", 5);
		wmap.put("Sat", 6);
		wmap.put("All", 7);
		// 0 < s <= 500
		// 0 < n <= 100
		// s < t <= 1000
		// weekday ∈ {All, Sun, Mon, Tue, Wed, Thu, Fri, Sat}
		// All は、全ての曜日を意味する
		// time ∈ {All, Day, Night}
		// All は [0:00~24:00), Day は [6:00~18:00), Night は [18:00~6:00)
		// の時間帯を意味する。
		// 1 <= p <= 99999
		// 1 <= m <= 100

		// s n t weekday time p m
		while (true) {
			s = sc.nextInt();
			n = sc.nextInt();
			t = sc.nextInt();
			weekday = sc.next();
			time = sc.next();
			p = sc.nextInt();
			m = sc.nextInt();
			if (s == 0)
				break;
			int max = 0;
			for (int sw = 0; sw < 7; sw++) {
				for (int st = 0; st < DAY; st++) {
					int w = sw;
					int ctime = st;
					int cnt = 0;
					for (int k = 0; k < m; k++) {
						// System.out.println(ctime + " " + w + " " + k);
						if (check(ctime, w)) {
							cnt++;
						}
						ctime += t;
						w += ctime / DAY;
						w %= 7;
						ctime %= DAY;
					}
					max = Math.max(max, cnt);
				}
			}
			double ans = 1.0 - Math.pow(1.0 - 1.0 / p, 1.0 * n * max);
			System.out.printf("%.10f\n", ans);
		}
	}

	boolean check(int ctime, int week) {
		// 開始時の曜日
		boolean AllWeek = weekday.equals("All");
		if (wmap.get(weekday) != week && !AllWeek)
			return false;

		// 孵化時の曜日
		week += (ctime + s) / DAY;
		week %= 7;
		if (wmap.get(weekday) != week && !AllWeek)
			return false;

		int start = 0;
		int end = 0;
		if (time.equals("All")) {
			if (AllWeek)
				return true;
			start = 0;
			end = 24 * 60;
		}
		// Dayのときは[6:00~18:00)
		if (time.equals("Day")) {
			start = 6 * 60;
			end = 18 * 60;
		}
		// Nightのときは[18:00~6:00)
		if (time.equals("Night")) {
			start = 18 * 60;
			end = 30 * 60;
			if (start <= ctime && ctime + s < end || ctime >= 0
					&& ctime + s < 60 * 6)
				return true;
			else return false;
		}
		if (start <= ctime && ctime + s < end)
			return true;
		return false;
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 25452
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <stack>

using ll = long long;

ll F(ll a, ll b) {
    ll digA = 0;
    while (a > 0) {
        a /= 10;
        digA++;
    }
    ll digB = 0;
    while (b > 0) {
        b /= 10;
        digB++;
    }
    return std::max(digA, digB);
}

int main() {
    ll N;
    std::cin >> N;
    ll ans = N;

    for (ll i = 1; i * i <= N; i++) {
        if (N%i != 0)continue;
        ll b = N / i;
        ans = std::min(ans, F(i, b));
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
int main() {
    abdelrahman010
    ll n;
    cin >> n;
    n--;
    string ans = "";
    while(n > 0) {
        int c = n % 26;
        ans += (char)(c + 'a');
        n /= 26;
        n--;
    }
    if(n == 0)
        ans += 'a';
    reverse(ans.begin() , ans.end());
    cout << ans;
    return 0;
}

Measured memory_bytes: 3644
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

// Audition
// 2012/09/19
public class Main{
	Scanner sc=new Scanner(System.in);

	int n, m;
	int[] vi, da, vo;

	double[][] comb, combSum;

	void run(){
		n=sc.nextInt();
		m=sc.nextInt();
		vi=new int[n];
		da=new int[n];
		vo=new int[n];
		for(int i=0; i<n; i++){
			vi[i]=sc.nextInt();
			da[i]=sc.nextInt();
			vo[i]=sc.nextInt();
		}
		solve();
	}

	void solve(){
		int M=2010;
		comb=new double[M][M];
		combSum=new double[M][M];
		// comb[n][k] = C(n,k)(1/3)^k(2/3)^{n-k}
		// combSum[n][k] = comb[n][k]+...+comb[n][n]

		comb[0][0]=1;
		for(int j=1; j<M; j++){
			comb[j][0]=comb[j-1][0]*(2/3.0);
			for(int i=1; i<M; i++){
				comb[j][i]=comb[j-1][i]*(2/3.0)+comb[j-1][i-1]*(2/3.0)*(1/2.0);
			}
		}
		for(int j=0; j<M; j++){
			combSum[j][M-1]=comb[j][M-1];
			for(int i=M-2; i>=0; i--){
				combSum[j][i]=combSum[j][i+1]+comb[j][i];
			}
		}

		double[] viE=calcE(vi, 5);
		double[] daE=calcE(da, 3);
		double[] voE=calcE(vo, 2);

		double max=-Double.MAX_VALUE;
		for(int i=0; i<=m; i++){
			for(int j=0; i+j<=m; j++){
				int k=m-(i+j);
				max=max(max, viE[i]+daE[j]+voE[k]);
			}
		}
		println(String.format("%.12f", max));
	}

	double[] calcE(int[] value, int point){
		double[] E=new double[m+1];
		for(int i=0; i<=m; i++){
			int myValue=value[0]*i;
			double[][] top3=new double[n][3];
			top3[0][0]=1;
			double worst=1;
			for(int j=1; j<n; j++){
				int a=(myValue+value[j]-1)/value[j];
				double p=a<=m?combSum[m][a]:0;
				top3[j][0]=top3[j-1][0]*(1-p);
				top3[j][1]=top3[j-1][1]*(1-p)+top3[j-1][0]*p;
				top3[j][2]=top3[j-1][2]*(1-p)+top3[j-1][1]*p;
				worst*=p;
			}
			E[i]=point*(top3[n-1][0]+top3[n-1][1]+top3[n-1][2])-1*worst;
		}
		return E;
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 81000
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct para
{
    string s;
    int p, nr;
};

bool por(para a, para b)
{
    if (a.s < b.s)
        return true;
    if (a.s > b.s)
        return false;
    if (a.p > b.p)
        return true;
    return false;
}

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<para> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i].s >> a[i].p;
        a[i].nr = i + 1;
    }
    sort(a.begin(), a.end(), por);
    for (int i = 0; i < n; ++i)
        cout << a[i].nr << endl;
    return 0;
}


Measured memory_bytes: 256
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=200000+10;
const int inf=0x3f3f3f40;

int n,a[N],w[N],cnt[N]; char s[N];

#define ls (o<<1)
#define rs (o<<1|1)
struct sgt {
	int maxv[N<<2];
	void pushup(int o) { maxv[o]=max(maxv[ls],maxv[rs]); }
	void modify(int o,int l,int r,int p,int w) {
		if (l==r) { maxv[o]=w; return; }
		int mid=(l+r)>>1;
		if (p<=mid) modify(ls,l,mid,p,w);
		else modify(rs,mid+1,r,p,w);
		pushup(o);
	}
	int query(int o,int l,int r,int ql,int qr) {
		if (ql<=l&&r<=qr) return maxv[o];
		int mid=(l+r)>>1,res=-inf;
		if (ql<=mid) res=max(res,query(ls,l,mid,ql,qr));
		if (qr>mid) res=max(res,query(rs,mid+1,r,ql,qr));
		return res;
	}
} odd,even;
#undef ls
#undef rs

bool check(int p,int w) {
	if (w<0) return 0;
	if (w&1) return odd.query(1,1,n,p,n)>=w;
	else return even.query(1,1,n,p,n)>=w;
}

int main() {
	n=read();
	for (int i=1;i<=n;++i) a[i]=read();
	for (int i=1,mx=0;i<=n;++i) {
		if (a[i]>mx) w[i]=2,mx=a[i];
		else w[i]=1;
	}
	memset(odd.maxv,0xc0,sizeof(odd.maxv));
	for (int i=n;i;--i) {
		int mxo=odd.query(1,1,n,a[i],n),mxe=even.query(1,1,n,a[i],n);
		if (w[i]&1) odd.modify(1,1,n,a[i],mxe+w[i]),even.modify(1,1,n,a[i],mxo+w[i]);
		else odd.modify(1,1,n,a[i],mxo+w[i]),even.modify(1,1,n,a[i],mxe+w[i]);
	}
	for (int i=n;i;--i) cnt[i]=cnt[i+1]+w[i]-1;
	int cx=0,cy=0,mxx=0,mxy=0;
	for (int i=1;i<=n;++i) {
		odd.modify(1,1,n,a[i],-inf),even.modify(1,1,n,a[i],0);
		if (check(mxy,cx+(a[i]>mxx)+cnt[i+1]-cy)
		  ||check(max(mxx,a[i]),cy+cnt[i+1]-cx-(a[i]>mxx)))
			s[i]='0',cx+=(a[i]>mxx),mxx=max(mxx,a[i]);
		else s[i]='1',cy+=(a[i]>mxy),mxy=max(mxy,a[i]);
	}
	if (cx!=cy) puts("-1");
	else for (int i=1;i<=n;++i) putchar(s[i]);
	return 0;
}
// 爬~

Measured memory_bytes: 11320
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)

int main()
{
    int k, a, b;
    cin >> k >> a >> b;
    if ((b / k - a / k >= 1 || a % k == 0 || b % k == 0))
    {
        cout << "OK" << endl;
    }
    else
    {
        cout << "NG" << endl;
    }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string a;getline(cin,a);
  for(int i=0;i<a.length();i++){
    if((a.at(i)>='a')&(a.at(i)<='z')){
      a.at(i)-=32;
    }else if((a.at(i)>='A')&(a.at(i)<='Z')){
      a.at(i)+=32;
    }
  }
  cout<<a<<endl;
}


Measured memory_bytes: 3160
#include <stdio.h>
const int MAXN = 1e7 + 1;
int n, x, y, f, c, i, j, spf[MAXN];
long long ans = 1, z;
signed main()
{
	for (i = 2; i < MAXN; i += 2)
        spf[i] = 2;
	for (i = 3; i < MAXN; i += 2)
        spf[i] = i;
    for (i = 3; i < 3162; i += 2)
        if (spf[i] == i)
            for (j = i * i; j < MAXN; j += i)
                if (spf[j] == j)
                    spf[j] = i;
	scanf("%d", &n);
	for (i = 2; i <= n; ++i)
	{
		x = i, f = 1, c = 1, z = 1;
		while (x > 1)
			y = spf[x], x /= y, y > f ? z *= c, c = 2, f = y : ++c;
		ans += i * z * c;
	}
	printf("%lld", ans);
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()


using namespace std;

int main()
{
	int K; cin >> K;

	if (K % 2 == 0)
	{
		cout << (K / 2) * (K / 2) << endl;
	}
	else
	{
		cout << ((K + 1) / 2) * (K / 2) << endl;
	}

	return 0;
}


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

pll p[100001];

int main() {
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        ll x, l; cin >> x >> l;
        p[i] = {x - l, x + l};
    }

    sort(p, p + n, [](const pll& a, const pll& b) {
        if (a.second == b.second) {
            return a.first < b.first;
        }
        return a.second < b.second;
    });

    ll cnt = 0;
    ll x = -2e9;  // curr
    for (int i = 0; i < n; i++) {
        if (x <= p[i].first) {
            cnt++;
            // cout << i << ' ';
            x = p[i].second;
        }
    }

    cout << cnt << '\n';

    return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind() {double x; scanf("%lf", &x); return x;}

///*....Bitmask....*///
int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

int a[N], c[N];
int main()
{

  int t = 1, te = 0;
  //Int(t);
  while (t--) {
    int n;
    Int(n);

    int x = 0;
    for (int i = 1; i <= n; ++i) {
      Int(a[i]);
      x ^= a[i];
    }

    for (int i = 1; i <= n; ++i) {
      printf("%d ", (x ^ a[i]));
    }


    //printf("Case %d: ",++te);
  }
  return 0;
}






Measured memory_bytes: 4544
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define ARRAY_LEN(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
 
int main() {
  int N, K; cin >> N >> K;
  ll x[N], y[N];
  vector<vector<ll>> point(N, vector<ll>(2));
  for (int i=0; i<N; i++) { cin>>x[i]>>y[i]; point[i][0]=x[i]; point[i][1]=y[i]; }
  sort(x, x+N); sort(y, y+N);

  ll result = LLINF;
  for (int x1=0; x1<N; x1++) {
    for (int x2=0; x2<=x1; x2++) {
      for (int y1=0; y1<N; y1++) {
        for (int y2=0; y2<=y1; y2++) {
          int k_num = 0;
          for (auto &p: point) {
            if ( (p[0]<=x[x1] && p[0]>=x[x2]) && (p[1]<=y[y1] && p[1]>=y[y2]) ) k_num++;
          }
          if (k_num >= K) result = min(result, (x[x1]-x[x2]) * (y[y1]-y[y2]));
          // if (k_num >= K) cout << x[x1] << x[x2] << y[y1] << y[y2] << k_num << endl;
        }
      }
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
//A Payment


	#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		int n;
		cin>>n;
		if (n%1000 == 0)
		{
			cout<<n%1000;
		}
		else if (n%1000 != 0)
		{
			int sum = n%1000;
			int sum_1 = 1000-sum;
			cout<<sum_1<<endl;
		}
		return 0;
	}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

	ll num = 0;
	REP(i,N){
		while(!(A[i]%2) && A[i]>1){
			num++;
			A[i]/=2;
		}
	}
	
	cout << num << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int INF=0x3f3f3f3f;
const int maxn=1005;

struct edge{int to,cost;};

int n,m,s,cnt[maxn];
int d[maxn];
int qh,qt,q[maxn*maxn];
bool ok=1,inq[maxn];
vector<edge>G[maxn];

int main() {
	cin>>n>>m>>s;
	for (int i=0;i<m;i++) {
		int u,v,w; cin>>u>>v>>w;
		G[u].pb(edge{v,w});
	}
	memset(d,0x3f,sizeof(d));
	d[s]=0;
	q[qt++]=s; inq[s]=1;
	while (qh<qt) {
		int u=q[qh++]; inq[u]=0;
		for (edge e:G[u]) {
			if (d[e.to]>d[u]+e.cost) {
				d[e.to]=d[u]+e.cost;
				if (!inq[e.to]) {
					q[qt++]=e.to;
					inq[e.to]=1;
					++cnt[e.to];
					if (cnt[u]>m+5) {ok=0;break;}
				}
			}
		}
		if (cnt[u]>m+5) {ok=0;break;}
	}
	if (!ok) {
		cout<<"NEGATIVE CYCLE"<<'\n';
		return 0;
	}
	else for (int i=0;i<n;i++) 
		if (d[i]==INF) cout<<"INF"<<'\n';
		else cout<<d[i]<<'\n';
}


Measured memory_bytes: 5840
#include <stdio.h>

int n, s;

int combination(int d, int p, int b)
{
	int c = 0, i = b + 1;
	if (d == n + 1)	return p == s;
	for( ; i <= 9; i++)
		c += combination(d + 1, p + i, i);
	return c;
}

int main(void){
	while(scanf("%d%d", &n, &s) != EOF && n + s){
		printf("%d\n", combination(1, 0, -1));
	}
	return (0);
}




Measured memory_bytes: 2028
#include <stdio.h>

int main(void)
{
    int a, b, c, d;
    int area1, area2, max;

    scanf("%d %d %d %d", &a, &b, &c, &d);
    area1 = a * b;
    area2 = c * d;
    max = (area1 > area2) ? area1 : area2;
    printf("%d", max);

    return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
#include<cstring>
const int N=5e5+5;
int fail[N],n,t;
int vis[N];
char s[N];
void getfail(){
	for(int i=2,j=0;s[i];++i){
		while(j&&s[j+1]!=s[i])j=fail[j];
		if(s[j+1]==s[i])++j;
		fail[i]=j;
	}
}
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	getfail();
	if(n%(n-fail[n])!=0||!fail[n])puts("1\n1");else
	if(fail[n]==n-1)printf("%d\n1\n",n);else{
		for(int i=1;i<=n;++i)vis[i]=i%(i-fail[i])==0&&fail[i];
		std::reverse(s+1,s+n+1);
		getfail();
		for(int i=1;i<=n;++i)vis[n-i]|=i%(i-fail[i])==0&&fail[i];
		for(int i=1;i<=n;++i)t+=!vis[i];
		printf("2\n%d\n",t);
	}
	return 0;
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
 
using namespace std;
 
int f[123456];
 
bool prime(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return x > 1;
}
 
int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  for (int i = 1; i <= 100000; i++) {
    f[i] = f[i - 1] + (prime(i) && prime((i + 1) / 2));
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    printf("%d\n", f[r] - f[l - 1]);
  }
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int main(){

    int n;
    cin >> n;
    cout << n * n * n << endl;

}

Measured memory_bytes: 256
from math import ceil
A,B,C,D,E,F = map(int,input().split())

W,S = [],[0]

for ai in range(ceil(F/A)):
    for bi in range(ceil(F/B)):
        w = 100*A*ai+100*B*bi
        if w <= F and 0 < w and w not in W:
            W.append(w)
for ci in range(ceil(F/C)):
    for di in range(ceil(F/D)):
        s = C*ci+D*di
        if s <= F and 0 < s and s not in S:
            S.append(s)

AnsWS,AnsS,r = 0,0,-1
for wi in W:
    for si in S:
        if r < si/wi and si <= E*(wi//100) and (wi+si) <= F:
            AnsWS,AnsS,r = wi+si,si,si/wi

print(AnsWS,AnsS)

Measured memory_bytes: 3064
import java.util.Scanner;

class Main {

	private static int a,b;

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

		int ret = 0;
		ret += pressButton();
		ret += pressButton();

		System.out.println(ret);
	}

	private static int pressButton() {
		if(a>b) {
			a--;
			return a+1;
		}else {
			b--;
			return b+1;
		}
	}

}


Measured memory_bytes: 24148
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define swap(a,b) do{ll w=a;a=b;b=w;}while(0)
#define swapd(a,b) do{double w=a;a=b;b=w}while(0)
#define in(a) scanf("%lld", &(a))
#define ind(a) scanf("%lf", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a));
//def   puts(a) printf("%s\n", a) 文字はこっち
int cmp(const void *a, const void *b);
//your code here!

int main(void){
    ll isGood=1;
    char s[5];
    scanf("%s", s);
    rep(i,3) if(s[i]==s[i+1]) isGood=0;
    puts(isGood ? "Good":"Bad");
    return 0;
}

int cmp(const void *a, const void *b){
    ll A=*(ll *)a, B=*(ll *)b;
    if(A==B)return 0;
    else return A>B ? 1:-1;//昇順ソート
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
   int n;cin >>n;
   map<int,int>mp;
    for (int i = 0; i < n; ++i) {
        int a;cin >>a;
        mp[a]++;
    }
    ll now=0;
    ll cnt=0;
    for(auto e:mp){
//        cout <<e.second<<endl;
        now+=((e.second-1)/2)*2;
        if(e.second%2==0)cnt++;
    }
    now+=cnt;
    if(cnt%2==1)now++;
    cout <<n-now<<endl;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n, W;
    cin >> n >> W;
    vector<int> w(n), v(n);
    rep(i, n) cin >> w[i] >> v[i];
    auto dp = make_vec<int>(n+1, n+1, 3*n);
    rep(i, n) {
        rep(j, n) {
            rep(k, 3*n) {
                chmax(dp[i+1][j][k], dp[i][j][k]);
                if (k+w[i]-w[0] < 3*n) chmax(dp[i+1][j+1][k+w[i]-w[0]], dp[i][j][k] + v[i]);
            }
        }
    }
    int res = 0;
    rep(j, n+1) rep(k, 3*n) if (1LL * j * w[0] + k <= W) chmax(res, dp[n][j][k]);
    cout << res << endl;
}


Measured memory_bytes: 15904
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main() {

    char a[4];
    char b[4];
    char s[8];
    scanf("%s %s", a, b);

    //文字列連結
    sprintf(s,"%s%s",a,b);
    
    int num = atoi(s);
 
    double ans01 = pow(num, 1.0 / 2.0);

    int ans02 = (int) ans01;
    
    if (ans02 * ans02 == num) {
        printf("Yes");
    } else {
        printf("No");
    }


    return 0;
} 

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B,a,b,c,d;
  int ans = 0;
  cin >> N >> A >> B;
  for (int g = 0; g < 2; g++) {
    for (int h = 0; h < 10; h++) {
      for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
          for (int k = 0; k < 10; k++) {
            int sum = g + h + i + j + k;
            int num = 10000 * g + 1000 * h + 100 * i + 10 * j + k;
            if ((num <= N) && (sum >= A) && (sum <= B)) {
              ans += num;
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256