akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define PrintLn(X) cout << X << endl
#define Loop(n) for(int loop_ = n; loop_; --loop_)
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, a, b) for(int i = a; i < (int)(b); ++i)

int A[100000];
int main(void)
{
	int N;
	cin >> N;
	Rep(i, N){
		cin >> A[i];
	}
	sort(A, A+N);
	int ans = N;
	int b = -1;
	ll sum = 0;
	Rep(i, N - 1){
		sum += A[i];
		if(sum * 2 < A[i + 1]){
			b = i;
		}
	}
	if(b == -1){
		PrintLn(ans);
	}else{
		PrintLn(ans - b - 1);
	}
	return 0;
}


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <math.h>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <string.h>
#include <cstring>
#include <queue>
#include <iomanip>
#include <istream>
#include <map>
#include <stack>
#include <numeric>
#include <ostream>
#include <set>
#include <cassert>
#include <sstream>
#include <string>
#include <utility>
#include <stdio.h>
#include <vector>
using namespace std;
#define dout if (debug) cout
#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) (int((x.size())))
typedef long double ld;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VPI;
#define REP(i,a,n) for (int i=a;i<n;i++)
#define db(x) cerr << #x << " = " << x << endl
#define PER(i,a,n) for (int i=n-1;i>=a;i--)
const int inf = 1000000404;
const ll MOD = 1000000007ll;
const ld PI = acos(-1.0);
const ll INF = 1000000000000000404ll;
const ld EPS = 1e-9;
template <typename t1, typename t2> inline void upmax(t1 &a, t2 b) { a = max(a, (t1)b); }
template <typename t1, typename t2> inline void upmin(t1 &a, t2 b) { a = min(a, (t1)b); }
template <typename T>inline T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template <typename T>inline T lcm(T a, T b) { return a*(b / gcd(a, b)); }
template <typename T>inline T sqr(T a) { return a*a; }
inline bool pal(string &x) { int n = (int)x.length(); REP(i, 0, n / 2) { if (x[i] != x[n - i - 1]) return 0; }return 1; }
template <typename T>inline void rev(T &x) { int n = SZ(x); REP(i, 0, n / 2) swap(x[i], x[n - i - 1]); }
int month[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
class compare{
public:
	bool operator()(const int a, const int b) const {

		return 1;
	}
};
int SQ = 400;

#define debug 1
#define N 111111
int m[N];
int p[N];
void solve()
{
	int n;
	cin >> n;
	REP(i, 1, n + 1) {
		cin >> p[i];
	}
	int ans = 0;
	REP(i, 1, n + 1) {
		if (p[i] == i) {
			ans++;
			if (i == 1 || i == n) {
				if (i == 1) swap(p[i], p[i + 1]);
				if (i == n) swap(p[i], p[i - 1]);
			}
			else {
				swap(p[i], p[i + 1]);
			}
		}
	}
	cout << ans;
}

int main()
{
	//freopen("codeforces.in", "r", stdin);
	//freopen("codeforces.out", "w", stdout);
	ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0);
	int t = 1;
	//cin>>t;

	while (t--) {
		solve();
	};


	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 640
def factorization(n):
    m=n
    counter_map={}
    i=2
    tmp=1
    while n!=1:
        #因数に持つか判定
        if n%i==0:
            n=n//i
            #素数判定
            for j in range(2,int(i**(1/2))+1):
                if i%j==0:
                    break
            else:
                tmp*=i
                if i not in counter_map:
                    counter_map[i]=1
                    tmp=1
                else:
                    if tmp not in counter_map:
                        counter_map[tmp]=1
                        tmp=1
        else:
            i+=1
            tmp=1
        if i>int(m**(1/2)) and n!=1:
            counter_map[n]=1
            break
        #print(i,n,counter_map)
    return counter_map


a=int(input())
b=factorization(a)
#print(b)

print(len(b))


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define F            first
#define S            second
#define pb(x)        push_back(x)
#define mp(a,b)      make_pair(a,b)
#define mt(a,b,c)    make_tuple(a,b,c)
#define sz           size()
#define all(A)       A.begin(), A.end()
#define mem(a, b)    memset(a, b, sizeof(a))   // all elements of A are b=0 or b=-1 else don't work
#define f0(i,b)      for(ll i=0;i<(b);i++)
#define f1(i,b)      for(ll i=1;i<=(b);i++)
#define f2(i,a,b)    for(ll i=(a);i<=(b);i++)
#define f3(i,b,a)    for(ll i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(ll i=(a);i!=(b);i+=(c))

#define mod          10000007
#define PI           acos(-1.0)
#define MAX3(a,b,c)  max(a,max(b,c))

#define whilee(i,t)  while(i!=t)
#define  sl(a)       scanf("%lld",&a)
#define  pl(a)       printf("%lld\n",a)

//x = 1e18 means 10^18
//for(auto it =A.begin(); it!=A.end(); it++)
//sort(A.begin(),A.end()); //sort(A, +n, greater<int>());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//count(A.begin(), A.end(), X); //counts the occurrences of X
//distance(A.begin(),A.end());  //distance between first to last element
//accumulate(A.begin(), A.end(), 0); //add
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());
//swap(S[0], T[0]);

//scanf("%lld",&x);
//printf("%lld\n",x);
//printf("%I64d\n", a);
//while (scanf("%lld %lld", &a, &b) == 2)
//printf("Case %lld: %lld\n", t++, a);

//vector <ll> A;
//deque <ll> A;
//queue <ll> A;
//stack <ll> A;
//list <int> A;
//set <ll> A;
//map <ll,ll> A;
//pair <ll,ll> A ;
//tuple <ll, ll, ll> A;
//vector <pair <ll,ll>> A ;
//bitset<32> bset1;
//bool ok = true;
//char ch;
//string S, T, U;
ll i=0, j=0, k=0, a, b, c, d, e, f, g, h, l, m, n, o, p, q, r, s, t=1, u, v, w, x, y, z, maxx=INT_MIN, minn=INT_MAX, ans=0, sum=0, cnt=0;

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

    while(cin>>n)
    {
        cnt=0;
        for(i=0; i<=9; i++)
        {
            for(j=0; j<=9; j++)
            {
                for(k=0; k<=9; k++)
                {
                    for(m=0; m<=9; m++)
                    {
                        if((i+j+k+m)==n)
                        {
                            cnt++;
                        }
                    }
                }
            }
        }
        cout<<cnt<<endl;
    }
    return 0;
}



Measured memory_bytes: 3100
import sys

N, M = input().split(' ')
p_acwa_dict = {}
cnt_ac = 0
cnt_wa = 0
pre_p = 0
for line in sys.stdin:
  p, s = line.rstrip().split()
  p = int(p)
      
  pre_p = p
  acwa_cnt_dict = p_acwa_dict.setdefault(p, {'AC': 0, 'WA': 0})
  
  if acwa_cnt_dict['AC'] > 0:
    continue
    
  if s == 'AC':
    acwa_cnt_dict['AC'] += 1
    cnt_ac += 1
    cnt_wa += acwa_cnt_dict['WA']
  elif s == 'WA':
    acwa_cnt_dict['WA'] += 1

print("{} {}".format(cnt_ac, cnt_wa))

Measured memory_bytes: 42144
#include<bits/stdc++.h> 
using namespace std;
const int N=2e5+5;

int main(){
	ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int n,m,cnt=1;
	cin>>n>>m;
	if(n>1){
		for(int i=1;i<n;i++){
			int k;
			cin>>k;
			if(k<m){
				cnt++;
				m=min(k,m);
			}
		}		
	}

	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        if((c-a-b)*(c-a-b)>(4*a*b) && (c-a-b)>0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35820
// C - Repsept
#include <bits/stdc++.h>
using namespace std;

int f(int k){
	for(int r=7%k, i=0; i<k; ++i, r=(r*10+7)%k) if(!r) return i+1;
	return -1;
}

int main(){
	int k; cin>>k;
	cout<< f(k) <<endl;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define N 10000007
ll a[N];
using namespace std;
int main(){
    Fast;
    ll n;
    cin>>n;
    for(ll i=1;i<N;i++){
        for(ll j=0;j<N;j+=i){
            a[j]++;
        }
    }
    //cout<<-1<<endl;
    ll ans=0;
    for(ll i=1;i<=n;i++){
        ans+=(a[i]*i);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 81704
s = input()
t = input()

n = len(s)
m = len(t)

# dp[i][j] = s[:i], t[:j] まで見たときの最長共通部分列の長さ
dp = [[0]*(m+1) for _ in range(n+1)]

for i in range(1, n+1):
    for j in range(1, m+1):
        dp[i][j] = max(dp[i-1][j], dp[i][j-1])
        if s[i-1] == t[j-1]:
            dp[i][j] = max(dp[i][j], dp[i-1][j-1]+1)

ans = ''
i, j = n, m
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans += t[j-1]
        i -= 1
        j -= 1
print(ans[::-1])

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

int main() {
    int a,b,c,x;
    int count = 0;
    
    cin >> a >> b >> c >> x;

    for(int i = 0; i<= a ;i++) {
        for(int j = 0; j<= b ;j++) {
            for(int k = 0; k<= c ;k++) {
                int total = 0;
                total += i*500 + j * 100 + k * 50;
                if(total == x) count++;    
            }
        }    
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
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();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,ans=0;
  cin>>N;
  Graph G(200010);
  bool CAN[200010];
  REP(i,200010) CAN[i]=false;
  
  REP(i,N){
    ll X,Y;
    cin>>X>>Y;
    Y+=100000;
    CAN[X]=true;
    CAN[Y]=true;
    G[X].PB(Y);
    G[Y].PB(X);
  }
  
  REP(i,200010){
    if(CAN[i]){
      ll cntX=0,cntY=0;
      CAN[i]=false;
      queue<ll> Q;
      Q.push(i);
      
      while(!Q.empty()){
        ll v=Q.front();
        if(v<=100000) cntX++;
        else cntY++;
        Q.pop();
        for(ll nv:G[v]){
          if(CAN[nv]==false) continue;
          CAN[nv]=false;
          Q.push(nv);
        }
      }
      ans+=cntX*cntY;
    }
  }
  
  co(ans-N);
  return 0;
}

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

int main()
{
    int x, n, i = 0;
    cin >> x >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    while(true) {
        if (find(p.begin(), p.end(), x-i) == p.end()) {
            cout << x-i << endl;
            return 0;
        }
        if (find(p.begin(), p.end(), x+i) == p.end()) {
            cout << x+i << endl;
            return 0;
        }
        i++;
    }
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
using namespace std;

int main() {
    ll n,i,flag=0,sum=0;
    cin>>n;
    vector <pair<ll,ll> > vi;
    for(i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        vi.pb(mp(y,x));
    }
    sort(vi.begin(),vi.end());
    
    for(i=0;i<vi.size();i++){
        sum+=vi[i].ss;
        if(sum>vi[i].ff){
            flag=1;
            break;
        }
    }
    if(flag==0){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }

}


Measured memory_bytes: 6512
#include<bits/stdc++.h>
#include<stdlib.h>
#include <dirent.h>
using namespace std;
#define sp << " " << 
typedef vector<int> vi;
typedef vector<long int> vli;
typedef vector<long long int> vlli;
typedef long int li;
typedef long long int lli;
typedef vector<pair<int,int> > vpi;
typedef vector<pair<lli,lli> > vplli;
typedef unordered_map<int,int> ump;

int main(){
    string s1, s2;
    cin >> s1 >> s2;
    const int n = s1.size();
    const int m = s2.size();
    vector<vector<int>> lcs(n+1, vector<int>(m+1,0));

    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(s1[i]==s2[j]){
                lcs[i+1][j+1] = 1+lcs[i][j];
            }
            else{
                lcs[i+1][j+1] = max(lcs[i][j+1],lcs[i+1][j]);
            }
        }
    } 
    int i=n,j=m;
    int cur = lcs[i][j];
    string ans ="";
    while(i>=1&&j>=1 && cur!=0){
        int val1, val2;
        if(j-1>=0){
            val1 = lcs[i][j-1];
        }
        if(i-1>=0){
            val2 = lcs[i-1][j];
        }
        if(val1!=cur && val2!=cur){
            // cout << i << " " <<  j << ans << endl;
            ans = s1[i-1]+ans;
            cur-=1;
            i-=1;
            j-=1;
        }
        else{
            if(val1==cur){
                j-=1;
            }
            else{
                i-=1;
            }
        }
    }
    cout << ans << endl;
    // for(int i=0;i<=n;i++){
    //     for(int j=0;j<=m;j++){
    //         cout << lcs[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    // cout << lcs[n][m] << endl;
    return 0;
}

Measured memory_bytes: 35584
#include <stdio.h>
int main(){
  int c1,c5,c10,c50,c100,c500,result=0,a,b;
  scanf("%d%d%d%d%d%d%d",&c1,&c5,&c10,&c50,&c100,&c500);
  if ((c1+(c5*5)+(c10*10)+(c50*50)+(c100*100)+(c500*500))/1000>=1)
    printf("1\n",a);
  if((c1+(c5*5)+(c10*10)+(c50*50)+(c100*100)+(c500*500))/1000<1)
      printf("0\n",b);
      
      
  return 0;
}

Measured memory_bytes: 2756
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>
#include<atcoder/all>
 
using namespace std;
using namespace atcoder;
 
/* template */
 
using ll = long long;
 
void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
 
#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};
 
struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};
 
 
using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;
 
template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}
 
template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
 
template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}
 
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
 
constexpr ll LNF = 1LL<<50;
 
constexpr int INF = 1e9+7;
 
const long double PI=3.14159265358979323846;
 
 
vector<int> dx = {1,0,-1,0};
vector<int> dy = {0,1,0,-1};
 
/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    vector<ll> a(n),b(m);
    rep(i,0,n) cin >> a[i];
    rep(j,0,m) cin >> b[j];
    auto c = convolution( a, b);
    rep(i,0,n+m-1){
        cout << c[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 27260
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
int A[9];
int match_map[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
bool used_match_no[10];
int dp[10][10001];
vector <int> use_matches;
int main(){
    int N;
    int M;
    cin >> N >> M;
    for(int i = 0; i < M; i++){
      cin >> A[i];
    }
    sort(A, A + M);
    
    for(int i = M - 1; i >= 0; i--){
      if(!used_match_no[match_map[A[i]]]){
        use_matches.push_back(A[i]);
        used_match_no[match_map[A[i]]] = true;
      }
    }
    reverse(use_matches.begin(), use_matches.end());
    
    for(int i = 0; i < use_matches.size(); i++){
      for(int j = 0; j <= N; j++){
        dp[i][j] = -1;
      }
    }

    for(int i = 0; i <= N; i++){
      if(i % match_map[use_matches[0]] == 0){
        dp[0][i] = i / match_map[use_matches[0]];
      }
    }

    for(int i = 1; i < use_matches.size(); i++){
      dp[i][0] = 0;
      for(int j = 0; j <= N; j++){
        int cur_match_no = match_map[use_matches[i]];
        if(j < cur_match_no || dp[i][j - cur_match_no] < 0){
          dp[i][j] = dp[i - 1][j];
        } else {
          dp[i][j] = max(dp[i - 1][j], dp[i][j - cur_match_no] + 1);
        }
      }
    }

    string ans = "";
    int cur_total_match_no = N;
    for(int i = use_matches.size() - 1; i >= 1; i--){
      while(cur_total_match_no - match_map[use_matches[i]] >= 0 
        && dp[i][cur_total_match_no - match_map[use_matches[i]]] >= 0 
        && dp[i][cur_total_match_no - match_map[use_matches[i]]] + 1 >= dp[i - 1][cur_total_match_no]){
          cur_total_match_no -= match_map[use_matches[i]];
          ans.push_back('0' + use_matches[i]);
      }
    }
    for(int i = 0; i < dp[0][cur_total_match_no]; i++){
      ans.push_back('0' + use_matches[0]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
/* ***************************************
Author        :Scau.ion
Created Time  :2017/01/22 20:45:03 UTC+8
File Name     :ion.cpp
*************************************** */

#include <bits/stdc++.h>
using namespace std;

#define LL long long
#define ULL unsigned long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<PII>
#define X first
#define Y second
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define IN freopen("in", "r", stdin);
#define OUT freopen("out", "w", stdout);

const int maxn=100010;

int dp[maxn];
VI son[maxn];

bool cmp(int a,int b)
{
    return dp[a]>dp[b];
}

void dfs(int st)
{
    for (int j=0;j<son[st].size();++j)
    {
        dfs(son[st][j]);
    }
    sort(son[st].begin(),son[st].end(),cmp);
    for (int j=0;j<son[st].size();++j)
    {
        dp[st]=max(dp[st],dp[son[st][j]]+j+1);
    }
    return;
}

int main()
{
    IOS;
    int n;
    cin>>n;
    for (int j=2;j<=n;++j)
    {
        int x;
        cin>>x;
        son[x].PB(j);
    }
    dfs(1);
    cout<<dp[1]<<endl;
    return 0;
}


Measured memory_bytes: 10752
#include<stdio.h>
int main()
{
    int i,j;
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            printf("%dx%d=%d\n",i,j,i*j);
            if(j>=9)
            break;
        }
    }
    return 0;
}



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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){
  
  int x,y,z;
  cin >> x >> y >> z;
  swap(x,y);
  swap(x,z);
  cout << x << " " << y << " " << z << endl;



  return 0;
}

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

int x[10003]={};

int main(){
	int a,b;
	while (1){
		cin>>a>>b;
		if (a==0 && b==0)return 0;
		for (int i=0;i<a;i++){
			if (i==0 || i==a-1){
			for (int j=0;j<b;j++)cout<<"#";
			}
			else {
				cout<<"#";
				for (int j=1;j<b-1;j++)cout<<".";
				cout<<"#";
			}
			cout<<endl;
		}
		cout<<endl;
	}
	
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
 
template<typename key> using ordered_set = tree <key, null_type, less<key>, rb_tree_tag, tree_order_statistics_node_update>;
 
int main () {
   IO;
   set< int > s;
   int a, b, c;
   cin >> a >> b >> c;
   s.insert(a);s.insert(b);s.insert(c);
   if(s.size() == 2)
      cout << "Yes";
   else
      cout <<"No";
   return 0;
}

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

int main(){
    set<int> s;
    for(int i=0;i<3;i++){
        int x;
        cin >> x;
        s.insert(x);
    }
    cout<<s.size()<< endl;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <ctime>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
//#include <random>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
#define PB push_back
#define MP make_pair
#define INF 1073741824
#define inf 1152921504606846976
#define pi 3.14159265358979323846
//#pragma comment(linker,"/STACK:10240000,10240000")
//mt19937 rand_(time(0));
const int N=3e5+7,M=2e6;
const long long mod=1e9+7;
inline int read(){int ret=0;char ch=getchar();bool f=1;for(;!isdigit(ch);ch=getchar()) f^=!(ch^'-');for(;isdigit(ch);ch=getchar()) ret=(ret<<1)+(ret<<3)+ch-48;return f?ret:-ret;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll ksm(ll a,ll b,ll mod){int ans=1;while(b){if(b&1) ans=(ans*a)%mod;a=(a*a)%mod;b>>=1;}return ans;}
ll inv2(ll a,ll mod){return ksm(a,mod-2,mod);}//逆元
int head[N],NEXT[M],ver[M],tot;void link(int u,int v){ver[++tot]=v;NEXT[tot]=head[u];head[u]=tot;}

ll dp[N][3],num[N],ans[N];
void dfs(int x,int pre){
    ll res_w=1,res_b=1;
    for(int i=head[x];i;i=NEXT[i]){
        int y=ver[i];
        if(y==pre) continue;
        dfs(y,x);
        res_w*=(dp[y][1]+dp[y][0]);
        res_b*=(dp[y][1]);
        res_w%=mod;
        res_b%=mod;
    }
    dp[x][1]=res_w;
    dp[x][0]=res_b;
}
int main(){
    //freopen("1.txt","r",stdin);
    //ios::sync_with_stdio(false);
    int n;
    int u,v;
    scanf("%d",&n);
    dp[0][1]=1;
    num[0]=0;
    for(int i=1;i<n;i++){
        scanf("%d%d",&u,&v);
        link(u,v);
        link(v,u);
    }
    dfs(1,0);
    printf("%lld\n",(dp[1][0]+dp[1][1])%mod);
    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}




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

using namespace std;

#define IOS ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);

#define endl "\n";


#define mod 1000000007
#define loop(i,s,n)  for(ll i=s;i<n;i++)
#define test  ll t; cin>>t; while(t--)
#define p push_back
typedef long long ll;
int main()
{IOS
ll  n,i,j,k,sum=0,f=0,count=0;

string s;
cin>>s;
string z;
cin>>z;
n=z.length()-1;
for(i=0;i+n<s.length();i++)
{count=0;
    for(j=0;j<z.length();j++)
    {
        if(s[i+j]==z[j])
        {
            count++;
        }
    }

sum=max(count,sum);
}

cout<<z.length()-sum;




return 0;
}


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

int main()
{
  int n;
  cin >> n;
  int i;
  vector<int> a(n);
  int ans = 0;
  for(i = 0; i < n; i++)
  {
    cin >> a.at(i);
    ans += a.at(i);
  }
  cout << ans - n << endl;
}

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

signed main(){
    char ch=getchar(),last;
    last=ch;
    
    for(int i=1;i<=2;++i){
        ch=getchar();
        if(ch!=last) return puts("Yes"),0;
        last=ch;
    }
    
    return puts("No"),0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int N; cin >> N;
  int D, X; cin >> D >> X;
  int A[101];
  rep(i, N) {
    cin >> A[i];
  }
  int cnt = X;
  REP(d, 1, D + 1) {
    rep(i, N) {
      if ((d - 1) % A[i] == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define int long long
#define ll long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define vl vector<long long>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vb vector<bool>
#define pb push_back
#define pob pop_back
#define gcd __gcd
#define mp make_pair
#define pii pair<int,int>
#define pipii pair<int,pii>
#define pll pair<long long,long long>
#define pld pair<long double,long double>
#define mod 1000000007 
#define mod2 998244353
#define rep(i,n) for (ll i = 0; i < n; i++)
#define repp(i,a,b) for(ll i = a ; i<b ; i++)
#define reppr(i,a,b) for(ll i = a-1 ; i>=b ; i--)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " << 
#define len(s) s.size()
#define setprecision0 cout << fixed << setprecision(0);
#define setprecision10 cout << fixed << setprecision(10);
#define all(n) n.begin(),n.end()
#define SORT(v) sort(all(v))
 
void solve();
signed main()
{
    fast;
 
    int t = 1;
    // cin >> t;
    while(t--)
        solve();
} 
 
void solve()
{
    // int k , n ;
    // cin >> k >> n ;
    // int mx = 0;
    // int a[n];
    // rep(i,n)
    // {
    //     cin >> a[i];
    // }
    // rep(i,n)
    // {
    //     if(i!=n-1)
    //         mx = max(mx,a[i+1]-a[i]);
    //     else
    //         mx = max(mx,a[0] + k - a[n-1]);
    // }
    // cout << k - mx;
    int n , x , y;
    cin >> n >> x >> y;
    int dist[n] = {};
    repp(i,1,n+1)
    {
        repp(j,i+1,n+1)
        {
            if((i>x) || (j<y) || (i>=x && j<=y && !(i==x && j==y)))
            {
                int lol = abs(i-x) + 1 + abs(j-y);
                dist[min(j-i,lol)]++;
            }
            else
                dist[j-i+x-y+1]++; 
        }
    }
    repp(i,1,n)
        cout << dist[i] << endl; 
}

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

const int M=105;
char s[M];

bool isp(int l,int r)
{
	while(l<r)
	{
		if(s[l]!=s[r]) return false;
		l++;
		r--;
	}
	return true;
}

int main()
{
	scanf("%s",s+1);
	int n=strlen(s+1);
	printf("%s\n",isp(1,n)&&isp(1,(n-1)/2)&&isp((n+3)/2,n)?"Yes":"No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

void solve(){
  long long a, b, c, d; cin >> a >> b;
  if(a < b) swap(a, b);
  while(b != 0){
    c = a % b;
    a = b;
    b = c;
  }
  long long cnt = 2;
  set<long long> ans;
  d = a;
  while(a > 1){
    if(a % cnt == 0){
      a /= cnt;
      ans.insert(cnt);
    }
    else cnt++;
    if(cnt > sqrt(d) + 1){
      ans.insert(cnt);
      break;
    }
  }
  cout << ans.size() + 1 << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int n,mi=10000000,ma=-10000000;
    long long sum=0;
  cin >> n;
  int i,b;
  for(i=0;i<n;i++){
    cin >> b;
    mi=min(mi,b);
    ma=max(ma,b);
    sum+=b;
  }
  cout << mi <<  " " << ma << " " << sum << endl;
  return 0;
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pii pair <ll,ll>
#define vl vector <ll>
#define vp vector <pair<ll,ll>>
#define sort(x) sort(x.begin(), x.end())
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll h,n,i,s = 0;
    cin>>h>>n;
    ll a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        s += a[i];
    }    
    if(s >= h)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    ll A[N];
    rep(i, N){
        cin >> A[i];
    }
    sort(A, A + N);

    cout << A[N - 1] - A[0] << endl;

    return 0;
}

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

#define ll long long
#define ar array

ll dp[41][2][2];

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

	//int x=32, y=69;
	//for(int i=0; i<x; ++i)
		//cout << ((x-i)^(y+i)) << " ";
	//return 0;
	int n;
	cin >> n;
	ll a[n];
	for(int i=0; i<n; ++i)
		cin >> a[i];
	ll b=0;
	for(int i=2; i<n; ++i)
		b^=a[i];
	ll a0=a[0], a1=a[1];
	//if((a[0]^a[1])%2!=b%2) {
		//cout << -1;
		//return 0;
	//}
	//dp[0][0][1]=dp[0][1][0]=dp[0][1][1]=-1;
	memset(dp, -1, sizeof(dp));
	dp[0][0][0]=0;
	for(int i=0; i<40; ++i) {
		int c0=a0>>i&1, c1=a1>>i&1, c2=b>>i&1;
		for(int j0 : {0, 1}) {
			for(int j1 : {0, 1}) {
				if(c0^c1^c2^j0^j1||dp[i][j0][j1]<0)
					continue;
				for(int x : {0, 1}) {
					int d0=c0, d1=c1, k0=0, k1=0;
					if(j0) {
						if(!d0)
							k0=1;
						d0^=1;
					}
					if(j1) {
						if(d1)
							k1=1;
						d1^=1;
					}
					if(x) {
						if(!d0)
							k0=1;
						d0^=1;
						if(d1)
							k1=1;
						d1^=1;
					}
					ll z=dp[i][j0][j1]|(ll)x<<i;
					if(dp[i+1][k0][k1]<0||dp[i+1][k0][k1]>z)
						dp[i+1][k0][k1]=z;
				}
			}
		}
	}
	if(dp[40][0][0]>=a0)
		dp[40][0][0]=-1;
	cout << dp[40][0][0];
}

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

int main() {
  string s;
  string t;
  int ans = 0;

  cin >> s;
  cin >> t;

  for(int i = 0; i < 3; i++){
    if(s[i] == t[i])ans++;
  }

  cout << ans << endl;
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

int main(){

    ll n;
    cin>>n;
    int ans=0;
    map<int,int> num;

    bool ex=true;
    int p=2;
    while(n!=1 && ex){
        ex=false;
        for(ll i=p;i*i<=n;i++){
            if(n%i!=0)continue;
            p=i;
            int beki=0;
            while(n%i==0){
                beki++;
                n/=i;
            }

            int x=0;
            while(x<beki){
                ans++;
                x++;
                beki-=x;
            }
            
            ex=true;
            break;
        }
    }
    if(n!=1){
        ans++;
    }

    cout<<ans<<"\n";

    return 0;

}

Measured memory_bytes: 3528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100000 + 10;
const int M = 1000000007;
const double PI = atan(1) * 4;
const int oo = 1000000000;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define pb push_back 
#define all(c) (c).begin(),(c).end()


int main(){
	ll x;
	cin>>x;
	ll d = x/11*2;
	ll f = x%11;
	cout<<d+(f>0)+(f>6);
}




Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		ArrayList<Integer> a = new ArrayList<Integer>();
		a.add(s);
		
		for(int i=1;;i++){
			if(a.get(i-1)%2==0){
				int x = a.get(i-1)/2;
				if(a.contains(x)){
					System.out.println(i+1);
					return;
				}
				a.add(x);
			}else{
				int y = 3*a.get(i-1)+1;
				if(a.contains(y)){
					System.out.println(i+1);
					return;
				}
				a.add(y);
			}
		}
	}
}


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

int main() 
{
int n;
cin>>n;
int v[n],c[n];
  for(int i=0;i<n;++i)
	cin>>v[i];
  for(int i=0;i<n;++i)
	cin>>c[i];
int ans=0;
  for(int i=0;i<n;++i)
  if(v[i]>c[i])
	ans+=(v[i]-c[i]);
cout<<ans<<endl;
return 0;
}

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

int main(){
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int cnt=0;
  for(int i=0; i<=A; i++){
    for(int j=0; j<=B; j++){
      int rem=X-500*i-100*j;
      if(rem%50==0 && 0<=rem/50 && rem/50<=C){
        cnt++;
      }
    }
  }
  cout << cnt <<endl;
}

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

using namespace std;

void printDP(const int n, const int c, vector<vector<int> >& dp){
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= c; j++) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
}

int knapsack01_a(const int n, const int c, const vector<int>& v, const vector<int>& w) {
    
    vector<vector<int>> dp(n + 1, vector<int>(c + 1, 0));
    
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= c; j++) {
            dp[i][j] = dp[i - 1][j];
            if (j >= w[i - 1]) {
                dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i - 1]] + v[i - 1]);
            }
        }
    }
    //printDP(n, c, dp);
    return dp[n][c];
}

int main() {
    int n, c;
    cin >> n >> c;
    vector<int> v(n, 0);
    vector<int> w(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> v[i] >> w[i];
    }
    int ans = knapsack01_a(n, c, v, w);
    cout << ans << endl;
}

Measured memory_bytes: 6788
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 207
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};


//=============================================ASIFAZAD==============================================//

int32_t main()
{
    io;
    string s;
    cin>>s;
    if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R')
        cout<<3;
    else if((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R'))
        cout<<2;
    else if(s[0] == 'R' || s[1] == 'R' || s[2] == 'R')
        cout<<1;
    else
        cout<<0;
    return 0;
}

Measured memory_bytes: 3640
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Text;

namespace Atcoder
{
    class Program
    {
        private const long COMDIV = 1000000007;
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var T = Console.ReadLine();
            if (S == new string(T.Take(S.Length).ToArray()))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

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

int main(){   
    int h, w;
    cin >> h >> w;
    int num = 0;
    string board[50];
    for (int i = 0; i < h; ++i) cin >> board[i];

    for (int i = 1; i < h; ++i){
    	for (int j = 1; j < w; ++j){

    		if (board[i][j] == '#' && board[i][j - 1] != '#' && board[i - 1][j] != '#' && board[i][j + 1] != '#' && board[i + 1][j] != '#') num++;
    	}
    }
    if (num == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x1 = sc.nextInt();
        int y1 = sc.nextInt();
        int x2 = sc.nextInt();
        int y2 = sc.nextInt();
        int[] res = new int[4];
        res[0]=x2-(y2-y1);
        res[1]=y2+(x2-x1);
        res[2]=x1+res[0]-x2;
        res[3]=y1+res[1]-y2;

        for(int i=0;i<4;i++) System.out.println(res[i]);
    }
}


Measured memory_bytes: 21844
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>
#include <atcoder/all>

using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

const int L=100*1000+9;
const long long M = 998244353;

// a>=0, b>=0, x*a+y*b=gcd>=0, a>0,b>0=>abs(y)<=a,abs(x)<=b
LL gcdex(LL a,LL b,LL& x, LL& y){
	LL ax=1,ay=0;
	LL bx=0,by=1;
	while(b){
		LL r=a/b;
		LL t=a-r*b; a=b; b=t;
		LL tx=ax-r*bx; ax=bx; bx=tx;
		LL ty=ay-r*by; ay=by; by=ty;
	}
	x=ax;
	y=ay;
	return a;
}
LL modinv(LL a, LL mod){
	LL x,y;
	gcdex(a,mod,x,y);
	if(x<0){
		x+=mod;
	}
	return x;
}


template<int S>
struct Comb
{
	LL r[S+1];
	LL f[S+1];
	LL mod;
	Comb(int m)
	{
		mod=m;
		f[0]=1;
		r[0]=1;
		for(LL i=1;i<=S;i++){
			f[i]=i*f[i-1]%m;
			r[i]=modinv(i,m)*r[i-1]%m;
		}
	}
	LL c(int n,int i){
		if(i<0||n<i)
		{
			//assert(0);
			return 0;
		}
		return f[n]*r[i]%mod*r[n-i]%mod;
	}
};
Comb<L> comb(M);
LL C(int n,int i){
	return comb.c(n,i);
}

LL df[L];
void solve(long long N, std::vector<long long> h){
	df[0]=1;
	for(int i=1;i<L;i++){
		df[i]=df[i-1]*(2*i-1)%M;
	}
	map<int,int> cnt;
	for(auto v:h){
		cnt[v]++;
	}
	vector<vector<LL>> cur,nex;
	for(auto p:cnt){
		int s=p.second;
		vector<LL> b;
		for(int i=0;2*i<=s;i++){
			b.push_back(C(s,2*i)*df[i]%M);
		}
		cur.push_back(b);
	}
	while(cur.size()>1){
		nex.clear();
		for(auto i=0;i<cur.size();i+=2){
			if (i+1<cur.size()){
				nex.push_back(atcoder::convolution(cur[i],cur[i+1]));
			}
			else{
				nex.push_back(cur[i]);
			}
		}
		nex.swap(cur);
	}
	LL ret=0;
	auto& cs=cur[0];
	LL sg=1;
	for(int i=0;i<cs.size();i++){
		ret+=(M+sg)*cs[i]%M*df[N-i]%M;
		ret%=M;
		sg=-sg;
	}
	cout << ret << endl;

}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> h(2*N);
    for(int i = 0 ; i < 2*N ; i++){
        scanf("%lld",&h[i]);
    }
    solve(N, std::move(h));
    return 0;
}


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

//{{{
/********************************************************************/
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

vector<string> split(const string &s, char delim) {
  vector<string> elems;
  string item;
  for (char ch: s) {
    if (ch == delim) {
      if (!item.empty()) elems.push_back(item);
      item.clear();
    }
    else item += ch;
  }
  if (!item.empty()) elems.push_back(item);
  return elems;
}

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

/****************************************************************/
//}}}

signed main()
{
  int a, b, c;
  
  while (cin >> a >> b >> c, a + b + c) {
    vector<int> v;
    int n = in();
    vector<pair<int, vector<int>>> vp;
    vector<int> ans;
    int r;
    rep(i, a + b + c) ans.pb(2);
    rep(i, n) {
      vector<int> ijk;
      rep(j, 3) ijk.pb(in());
      r = in();
      vp.pb(mp(r, ijk));
    }
    sort(all(vp));
    reverse(all(vp));
    rep(z, a + b + c) for (auto cvp : vp) {
      if (cvp.fst) {
        for (auto s : cvp.sec) {
          ans[s - 1] = 1;
        }
      }
      else {
        int i = cvp.sec[0] - 1, j = cvp.sec[1] - 1, k = cvp.sec[2] - 1;
        if (ans[i] == 1 and ans[j] == 1) ans[k] = 0;
        else if (ans[j] == 1 and ans[k] == 1) ans[i] = 0;
        else if (ans[k] == 1 and ans[i] == 1) ans[j] = 0;
      }
    }
    for (auto a : ans) print(a);
  }

  return (0);
}

Measured memory_bytes: 3152
#include <iostream>
#include <cmath>
#include <algorithm>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
#define EPS 1e-10
using namespace std;

int N, M[51], X[51][10], Y[51][10];

int len(int i, int j) {
  return abs(X[i][j] - X[i][j + 1]) + abs(Y[i][j] - Y[i][j + 1]);
}

int dir(int i, int j) {
  int x1 = X[i][j + 1] - X[i][j];
  int y1 = Y[i][j + 1] - Y[i][j];
  int x2 = X[i][j + 2] - X[i][j];
  int y2 = Y[i][j + 2] - Y[i][j];
  double r = atan2(x2, y2) - atan2(x1, y1);
  if(r < M_PI) r += M_PI * 2;
  if(r > M_PI) r -= M_PI * 2;
  if(abs(r) < EPS) return 0;
  return r > 0;
}

int main(void) {
  while(cin >> N, N) {
    REP(i, 0, N + 1) {
      cin >> M[i];
      REP(j, 0, M[i]) cin >> X[i][j] >> Y[i][j];
    }

    REP(i, 1, N + 1) {
      if(M[0] != M[i]) continue;
      bool f1 = true;
      REP(j, 0, M[0] - 1) if(len(0, j) != len(i, j)) f1 = false;
      REP(j, 0, M[0] - 2) if(dir(0, j) != dir(i, j)) f1 = false;
      bool f2 = true;
      reverse(X[i], X[i] + M[0]);
      reverse(Y[i], Y[i] + M[0]);
      REP(j, 0, M[0] - 1) if(len(0, j) != len(i, j)) f2 = false;
      REP(j, 0, M[0] - 2) if(dir(0, j) != dir(i, j)) f2 = false;
      if(f1 || f2) cout << i << endl;
    }
    cout << "+++++" << endl;
  }

  return 0;
}

Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define   PI    acos(-1)
#define mx 3005
int fx[]={0,0,-1,1};
int fy[]={1,-1,0,0};
char s1[mx],s2[mx];
char symbol[mx][mx];
int i,j,m,n,larr[mx][mx];
void print(int i,int j)
{
    if(i==0 || j==0)
        return ;
    if(symbol[i][j]=='c')
    {
        print(i-1,j-1);
        printf("%c",s1[i-1]);
    }
    else if(symbol[i][j]=='u')
    {
        print(i-1,j);
    }
    else{
        print(i,j-1);
    }
}
void Lcs()
{
     m=strlen(s1);
     n=strlen(s2);
    for(i=1;i<=m;i++){
         for(j=1;j<=n;j++)
         {
             if(s1[i-1]==s2[j-1]){
                  larr[i][j]=larr[i-1][j-1]+1;
                  symbol[i][j]='c';   //c -> diagonal
             }
             else if(larr[i-1][j]>=larr[i][j-1]){
                  larr[i][j]=larr[i-1][j];
                  symbol[i][j]='u';   //c -> upper
             }
             else{
                larr[i][j]=larr[i][j-1];
                  symbol[i][j]='l';   //c -> left
             }
         }
    }
}
int main()
{
    scanf("%s",s1);
    scanf("%s",s2);
    Lcs();
    print(m,n);
    printf("\n");
    return 0;
}




Measured memory_bytes: 44416
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main(){
	
	int N;
	
	int a[10000];
	
	bool color[8];
	
	cin >> N;
	
	int count = 0;
	
	for(int i = 0; i < 8; i++){
		color[i] = false;
	}
	
	for(int i = 0; i < N; i++){
		cin >> a[i];
		if(a[i] >= 3200){
			count++;
		}else{
			color[a[i] / 400] = true;
		}
	}
	
	int ans1 = 0;
	int ans2 = 0;
	
	for(int i = 0; i < 8; i++){
		if(color[i]){
			ans1++;
		}
	}
	
	ans2 = ans1 + count;
	ans1 = max(1, ans1);
	
	cout << ans1 << " " << ans2 << endl;
	
	return 0;
}

Measured memory_bytes: 256