akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 998244353;
ll mul(ll a, ll b){
    return ((a%mod) * (b%mod))%mod;
}
ll power(ll a, ll b){
    ll z = 1; ll x = a;
    while(b>0){
        if (b&1)z = mul(z, x);
        x = mul(x, x);
        b >>= 1;
    }
    return z;
}
vector<int> bin(int n, int s){
    vector<int> a(s);
    int cnt = 0;
    while(n>0){
        if (n&1)a[cnt] = 1;
        n/=2;
        cnt++;
    }
    return a;
}
int check(vector<string> v, int y, int z, int n, int m, vector<int> a){
    if (a[y]==1 || a[n+z]==1)return 0;
    return 1;
}
int main()
{
    int n, m, k;
    cin>>n>>m>>k;
    int b = 0;
    vector<string> v;
    for (int i=0; i<n; i++){
        string s; cin>>s;
        v.push_back(s);
    }
    for (int i=0; i<n; i++){
        for (int j=0; j<m; j++)if (v[i][j]=='#')b++;
    }
    int ans = 0;
    if (k > b){cout<<0<<endl;return 0;}
    // cout<<11<<endl;
    for (int i=0; i<power(2, m+n); i++){
        vector<int> a = bin(i, m+n);
        
        int x = 0;
        for (int y=0; y<n; y++){
            for (int z=0; z<m;z++){
                if (v[y][z] == '#' && check(v, y, z, n, m, a))x++;
            }
        }
        if (x==k){
            // for (int j=0; j<a.size(); j++)cout<<a[j];
            // cout<<endl;
            ans++;
        }
    }
    cout<<ans<<endl;

}


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

int n,a[105],dp[80];

int main()
{
	cin >> n;
	for(int i = 2; i <= n; i++){
		int k = i;
		for(int j = 2; j <= sqrt(i); j++) {
			while(k % j == 0){
				a[j]++;
				k /= j;
			}
		}
		if (k > 1) a[k]++;
	}
	dp[1] = 1;
	for(int i = 1; i <= n; i++){
		for(int j = 75; j > 0; j--){
			for(int k = a[i]; k ; k--){
				if(j * (k + 1) <= 75){
					dp[j*(k+1)] += dp[j];
				}
			}
		}
	}
	cout << dp[75] << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
 
public class Main {
 
    public static void main(String[] args){
 
        Scanner sc = new Scanner(System.in);
        int second = sc.nextInt();
        sc.close();
 
        int h = 0,m = 0,s = 0;
 
        if(second != 0){
            h = (int)(Math.floor(second / 3600));
            m = (int)(Math.floor(second / 60)) % 60;
            s = second % 60;
        }
        System.out.println(h+":"+m+":"+s);
    }
 
}

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

int main()
{
    string s; cin >> s;

    bool ans = false;
    if ((s[2] == s[3])and(s[4] == s[5])) ans = true;

    cout << (ans?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    string S; cin >> S;
    int ans = 0;
    for (auto c : S) {
        if ('+' == c) ans++;
        else if ('-') ans--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,z;
    char ca,cb,cc;
    cin>>a>>b;
    if((abs(a+b))%2==0) cout<<abs(a+b)/2<<endl;
    else cout<<"IMPOSSIBLE";
    return 0;
}


Measured memory_bytes: 3668
//
// Created by wulang on 10/10/16.
//

#include <stdio.h>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 100000 + 10;
typedef long long ll;
ll p[N], q[N], n, m;
const ll INF = 1ll << 60;

int main(int argc, char *argv[]) {
    if (argc == 2) {
        freopen(argv[1], "r", stdin);
    }

    while (cin >> n >> m) {
        for (int i = 0; i < n; i++) cin >> p[i];
        for (int j = 0; j < m; j++) cin >> q[j];
        sort(p, p + n);
        p[n] = INF;
        sort(q, q + m);
        q[m] = INF;

        int tmpx = 0, tmpy = 0, x = 0, y = 0;
        ll cnt = (n + 1) * (m + 1) - 1, ans = 0;
        while (cnt > 0) {
            if (p[x] < q[y]) {
                ll tmp = min(cnt, m + 1 - tmpy);
                tmpx++;
//                cout << p[x] << " " << tmp << endl;
                ans += p[x++] * tmp;
                cnt -= tmp;
            } else {
                ll tmp = min(cnt, n + 1 - tmpx);
                tmpy++;
//                cout << q[y] << " " << tmp << endl;
                ans += q[y++] * tmp;
                cnt -= tmp;
            }
        }
        cout << ans << endl;

    }

    return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
 
int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans =0;
  
  for(int i=1;i<s.size()-1;i++){
    if(s[i-1]=='A' && s[i]=='B' && s[i+1]=='C')
      ans++;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n,q,num=0;
    cin>>n;
    set<int> s;
    for(int i=0;i<n;i++){
    	cin>>q;
    	s.insert(q);
    }
    cin>>q;
    for(int i=0;i<q;i++){
    	cin>>n;
    	if(s.find(n)!=s.end())num++;
    }
    cout << num<<endl;
    return 0;
}




Measured memory_bytes: 7812
S = input().split('T')

N = len(S)
X = []
Y = []

for i in range(N):
    if i%2:
        Y.append(len(S[i]))
    else:
        X.append(len(S[i]))

Xsum = sum(X)
Ysum = sum(Y)

from collections import defaultdict,deque

dpx = defaultdict(int)# 初期値を0にした辞書
dpy = defaultdict(int)# 初期値を0にした辞書

dpx[Xsum] = 1
dpy[Ysum] = 1
que = deque()
for i,x in enumerate(X):
    if i == 0:
        continue
    for k,v in dpx.items():
        if v:
            que.append(k-2*x)
    while que:
        q = que.popleft()
        dpx[q] = 1

for i,y in enumerate(Y):
    for k,v in dpy.items():
        if v:
            que.append(k-2*y)
    while que:
        q = que.popleft()
        dpy[q] = 1


x,y = map(int,input().split())
print('Yes' if dpx[x] and dpy[y] else 'No')


Measured memory_bytes: 85340
import java.math.BigDecimal;
import java.util.Scanner;


class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		final String X = "X";
		final String CLAC = "[+=]";
		final int C = 10;
		int ans = -1;
		Scanner in = new Scanner(System.in);
		while((in.hasNext())){
			String s = in.nextLine();
			String[] ss = s.split(CLAC);
			for(int i=0;i<C;i++){
				if(i == 0){
					if(ss[0].substring(0, 1).equals("X")){
						if(ss[0].length() > 1){
							continue;
						}
					}
					else if(ss[1].substring(0, 1).equals("X")){
						if(ss[1].length() > 1){
							continue;
						}
					}
					else if(ss[2].substring(0, 1).equals("X")){
						if(ss[2].length() > 1){
							continue;
						}
					}
				}
				if(xc(ss[0],X,i).add(xc(ss[1],X,i)).equals(xc(ss[2],X,i))){
					ans = i;
					break;
				}
			}
			if(ans< 0){
				System.out.println("NA");
			}
			else{
				System.out.println(ans);
			}
			ans = -1;
		}

	}
	public static BigDecimal xc(String s,String X ,int i){
		BigDecimal big = new BigDecimal(s.replaceAll(X,Integer.toString(i)).toCharArray());
		return big;
	}

}

Measured memory_bytes: 22916
#include <iostream>

int main()
{
    int64_t a, b, x;
    std::cin >> a >> b >> x;
    a = (a + x - 1) / x * x;
    b = b / x * x;
    const int64_t n = (b - a) / x + 1;
    std::cout << n << std::endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())

cnt = 0

#約数取得
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


for i in range(1,n+1):
    if i%2 != 0:
        if len(make_divisors(i)) == 8:
            cnt += 1
print(cnt)

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define ba 47
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
    if(c == '-') f = -1;
    c = getchar();
    }
    while(c >= '0' && c <= '9') {
    res = res * 10 +c - '0';
    c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
    out(x / 10);
    }
    putchar('0' + x % 10);
}

int N,tot;
int64 w[15][15],M,a[] = {0,1,2,4,7,12,20,29,38,53,73};
bool vis[15];
void dfs(int dep,int pre,int64 sum) {
    if(dep > tot) {
        M = max(M,sum);
        return;
    }
    for(int i = 1 ; i <= tot ; ++i) {
        if(!vis[i]) {
            vis[i] = 1;
            dfs(dep + 1,i,sum + w[pre][i]);
            vis[i] = 0;
        }
    }
}
void Solve() {
    read(N);
    M = 0;
    for(int i = 2 ; i <= N ; ++i) {
        for(int j = 1 ; j < i ; ++j) {
            w[i][j] = w[j][i] = (M + 1) * a[j];
        }
        tot = i;
        dfs(1,0,0);
    }
    for(int i = 1 ; i <= N ; ++i) {
        for(int j = 1 ; j <= N ; ++j) {
            out(w[i][j]);space;
        }
        enter;
    }
}
int main(){
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 256
/*
        ####   ####
     ###    ###    ###
   ###    Bravery    ###
  ###  Determination  ###
   ##  Perseverance   ##
    ##   Integrity   ##
     ##  Patience   ##
      ## Kindness  ##
        ##Justice##
         ##     ##
           ## ##
             #
*/
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
typedef long long ll;
using namespace std;
char c;
int main(){
	cin>>c;
	if (c=='A'){
		cout<<'T';
	}else if(c=='T'){
		cout<<'A';
	}else if (c=='C'){
		cout<<'G';
	}else{
		cout<<'C';
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    vector<int> water(31, 0);
    water[0] = 1;
    rep(i, 31){
        if (i < a) continue;
        if (water[i-a] == 1) water[i] = 1;
    }
    rep(i, 31){
        if (i < b) continue;
        if (water[i-b] == 1) water[i] = 1;
    }
    vector<int> suger(3001, 0);
    suger[0] = 1;
    rep(i, 3001){
        if (i < c) continue;
        if (suger[i-c] == 1) suger[i] = 1;
    }
    rep(i, 3001){
        if (i < d) continue;
        if (suger[i-d] == 1) suger[i] = 1;
    }

    set<int, greater<int>> sset;
    rep(i, 3001){
        if (suger[i] == 1) sset.insert(i);
    }


    double rate = 0;
    int ans_s = 0;
    int ans_w = 0;
    rep1(i, 30){
        if (water[i] == 1){
            int limit = i*e;
            limit = min(limit, f-i*100);
            if (limit <= 0) continue;            
            auto suger = sset.lower_bound(limit);
            //cout << i*100 << ":" << *suger << endl;
            double trate = (double)*suger / (double)i;
            if (trate >= rate){
                ans_w = i*100; ans_s = *suger;
                rate = trate;
            }
        }
    }

    cout << ans_w+ans_s << " " << ans_s << endl; 

}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int sta[40],tot;
int a[40];
int main(){
    scanf("%d",&n);
    while(n){
        sta[++tot]=n%10,n/=10;
    }
    ll ans=0;
    for(int mask=0;mask<(1<<(tot*2-1));mask++){
        for(int i=1;i<=tot*2;i++)a[i]=sta[i];
        for(int i=0;i<tot*2-1;i++){
            if(mask>>i&1)a[i+1]-=10,a[i+2]+=1;
        }
        ll res=1;
        int s=1;
        while(s<=tot*2&&a[s]==0)s++;
        int t=tot*2;
        while(t>=s&&a[t]==0)t--;

        bool f=true;
        for(int i=s;i<=t;i++)if(a[i]+a[s+t-i])f=false;
        for(int i=s;i<=t;i++)if(a[i]<-9||a[i]>9)f=false;
        if(a[t]<0)f=false;
        if(f==false)continue;
        for(int i=1;i<=(s+t)/2;i++){
            if(i==1)res*=9-abs(a[i]);
            else res*=10-abs(a[i]);
        }
        /*
        cout<<mask<<endl;
        cout<<s<<' '<<t<<endl;
        for(int i=s;i<=t;i++)cout<<a[i]<<' ';
        cout<<endl;
        */
        ans+=res;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define rrep(i, a, b) for(int i=(a); i>=(b); i--)
typedef long long ll;

int main()
{
  string S;
  cin >> S;
  string T;
  cin >> T;
  ll A;
  cin >> A;
  ll B;
  cin >> B;
  string U;
  cin >> U;
  if (S==U) A--;
  if (T==U) B--;
  cout << A << " " << B << endl;

  return 0;
}


Measured memory_bytes: 256
a,b,c,x,y=map(int,input().split())

mincost=min(a+b,2*c)
ans=0
while (x>0 and y>0):
    ans+=mincost
    x-=1
    y-=1

ans+=min(a,2*c)*x+min(b,2*c)*y
print(ans)
    


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int A = l[0], B = l[1];

            var count = 0;
            for (var n = A; n <= B; n++)
            {
                var nString = n.ToString();
                if (nString[0] == nString[4] && nString[1] == nString[3])
                    count++;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 15444
import sys
n = int(input())
s = [0] * n
for i in range(n):
  s[i] = int(input())
s = sorted(s)
t = sum(s)
if t % 10 != 0:
  print(t)
  sys.exit()

for i in range(n):
  t = sum(s[:i]) + sum(s[i + 1:])
  if t % 10 != 0:
    print(t)
    sys.exit()
print(0)
  
  
  

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ull<<62)-1)
#define cINFINT ((1<<30)-1)

int main()
{
	ull n, k; cin >> n >> k;
	vector<ll> v( n, 0 );
	REP(i,n) cin>>v[i];
	vector<ll> vt( n, 0 );
	
	ll ans = 0;
	REP( i, min( n, k ) + 1 ) REP( j, i + 1 )
	{
		// 取る
		vt.clear();
		REP( ii, j ) vt.push_back( v[ii] );
		REP( ii, i - j ) vt.push_back( v[n - 1 - ii] );
		sort( ALL( vt ) );
		// 減らす
		ll gIdx = 0;
		REP( ii, k - i )
		{
			if( vt[ii] >= 0 ) break;
			++gIdx;
		}
		ll sum = 0;
		for( ll ii = gIdx; ii < vt.size(); ++ii )
			sum += vt[ii];
		//cout << i << " " << j << " " << gIdx << " " << sum << endl;
		ans = max( ans, sum );
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
program main
  implicit none
  integer :: a,b
  character(len=9) :: ab,ba
  integer :: i
  read(*,*) a,b
  ab=''
  ba=''
  do i = 1,b
     write(ab(i:i),'(i0)') a
  end do
  do i = 1,a
     write(ba(i:i),'(i0)') b
  end do
  if ( lge(trim(ab),trim(ba)) )then
     write(*,'(a)') trim(ba)
  else 
     write(*,'(a)') trim(ab)
  end if
  stop
end program main

Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <unordered_set>
#include <unordered_map>
using namespace std;

int main()
{
	//	input	--------------------------------------------------
//	char a;
//	cin >> a;
	int a, b;
	cin >> a >> b;
//	int a, b, c;
//	cin >> a >> b >> c;

//	string str;
//	cin >> str;

	struct obj
	{
		bool wa = false;
		int ngCnt = 0;
	};

	vector< obj > vec( a+1 );

	int quiz = 0;
	string judge;

	int ok=0, ng=0; 

	for( int i=0 ; i<b ; i++ )
	{
		cin >> quiz >> judge;

		//	なし
		if( vec.at( quiz ).wa == false )
		{
			if( judge == "AC" )
			{
				ok++;
				ng += vec.at( quiz ).ngCnt;
				vec.at( quiz ).wa = true;
			}
			else
			{
				vec.at( quiz ).ngCnt++;
			}
		}
		
	}

//	sort( vec.begin(), vec.end(), []( const obj &a, const obj &b ){ return a.tim < b.tim; } );
	
	//	--------------------------------------------------

	cout << ok << " " << ng << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cmath>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int n,m,w,cnt=0,a;
	cin>>n>>m;
	vector<int>v(m+1);
	for(int i=0;i<n;i++){
		cin>>w;
		for(int j=0;j<w;j++){
			cin>>a;
			a--;
			v.at(a)++;
		}
	}
	for(int i=0;i<m;i++){
		if(v.at(i)==n)cnt++;
	}

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



Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
#include <algorithm>
//#include <utility>
#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

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


Measured memory_bytes: 256
///HELLO THERE~!
///CREATED BY MD SADMAN MEHEDI SIVAN(IUT CSE-SWE^19)

#include <bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define read freopen("blue.txt","r",stdin);
#define write freopen("red.txt","w",stdout);
#define pie 2*acos(0.0);

typedef long long ll;

using namespace std;

int  main()
{

    fastio;

    int k;
    cin>>k;

    string s;
    cin>>s;
    if(s.size()<=k)
        cout<<s;
    else
    {
        for(int i=0;i<k;i++)
            cout<<s[i];
            cout<<"...";
    }

    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int c[3] = {0};
  for(int i = 0;i < n;i++){
    int x;
    cin >> x;
    if(x % 4 == 0)
      c[2]++;
   	else if(x % 2 == 0)
      c[1]++;
    else
      c[0]++;
  }
  if(c[0] == c[2] + 1 && c[1] == 0 || c[0] <= c[2]){
   cout << "Yes"; 
  }else{
   cout << "No"; 
  }
}

Measured memory_bytes: 256
// problem: "https://atcoder.jp/contests/abc158/tasks/abc158_c"

#include<bits/stdc++.h>

using namespace std;

int main()
{
    float a,b;
    cin>>a>>b;

    float na1,na2,nb1,nb2;
    na1 = a * 25/2.0;
    na2 = (a+1) * 25/2.0;
    nb1 = 10.0 * b;
    nb2 = 10.0 * (b+1);

    float n1,n2;
    n1 = max(na1,nb1);
    n2 = min(na2,nb2);

    if(n1 < n2)
        cout<<ceil(n1);
    else
        cout<<-1;

    return 0;
}


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

int main(){
  int field[14][14];
  int xx[12]={1,2,3,0,0,0,-1,-2,-3,0,0,0};
  int yy[12]={0,0,0,1,2,3,0,0,0,-1,-2,-3};
  string line;
  queue<int> search;
  int x,y;
  int n,k;
  cin>>n;
  for(k=0;k<n;k++){
    for(y=0;y<14;y++){
      for(x=0;x<14;x++){
	field[x][y] = 0;
      }
    }
    for(y=0;y<8;y++){
      cin>>line;
      for(x=0;x<8;x++){
	if (line[x]=='1')
	  field[x+3][y+3] = 1;
      }
    }
    cin>>x>>y;
    x+=2;
    y+=2;
    field[x][y]=0;
    search.push(y*14+x);
    while(!(search.empty())){
      for(int i=0;i<12;i++){
	if(field[search.front()%14+xx[i]][search.front()/14+yy[i]]){
	  field[search.front()%14+xx[i]][search.front()/14+yy[i]]=0;
	  search.push(search.front()+yy[i]*14+xx[i]);
	}
      }
      search.pop();
    }
    cout<<"Data "<<k+1<<":"<<endl;
    for(int y=3;y<11;y++){
      for(int x=3;x<11;x++){
	cout<<field[x][y];
      }
      cout<<endl;
    }
  }
  return 0;
}

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

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#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, a, b) for(int i = a;i < b;++i)
#define ALL(x) (x).begin(),(x).end()
#define INF 999999999
using namespace std;
#define lint long long

int main(){
    int N,K; cin >> N >> K;
    string S; cin >> S;
    int res = 0;
    REP(i,N-1){
        if(S[i+1] == S[i]) res++;
    }
    cout << min(res+2*K,N-1) << endl;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// std::ios::sync_with_stdio(false);

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int inf = 1e9;
const int maxn = 55;
LL N,A[maxn];
vector<PII> ans;

void solve_up(const LL maxx)
{
    int x = 0;
    FOR(i,0,N) if (A[i] == maxx)
        x = i;
    FOR(i,1,N) if (A[i] < A[i-1]) {
        A[i] += A[x];
        ans.push_back(PII(x,i));
        if (A[i] < A[i-1]) {
            A[i] += A[x];
            ans.push_back(PII(x,i));
        }
        if (A[i] > A[x])
            x = i;
    }
}

void solve_down(const LL minn)
{
    int x = 0;
    FOR(i,0,N) if (A[i] == minn)
        x = i;
    FORR(i,N-2,-1) if (A[i] > A[i+1]) {
        A[i] += A[x];
        ans.push_back(PII(x,i));
        if (A[i] > A[i+1]) {
            A[i] += A[x];
            ans.push_back(PII(x,i));
        }
        if (A[i] < A[x])
            x = i;
    }
}

int main()
{
    while (cin >> N) {
        ans.clear();
        LL maxx = -inf, minn = inf;
        FOR(i,0,N) {
            cin >> A[i];
            maxx = max(maxx,A[i]);
            minn = min(minn,A[i]);
        }
        if (abs(maxx) > abs(minn)) 
            solve_up(maxx);
        else 
            solve_down(minn);
        FOR(i,1,N)
            assert(A[i-1] <= A[i]);
        cout << ans.size() << endl;
        FOR_ALL(a,ans)
            cout << a->first+1 << ' ' << a->second+1 << endl;
    }
    return 0;
}


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

int main() {
  long long x, k, d;
  cin >> x;
  cin >> k;
  cin >> d;
  int i;

  if(x<0) x = -x;
  if(k%2==0){
    long long id;
    id = x/d;
    //if(id<0) id = -id;

    if(id >= k){
      cout << abs(x-k*d) << endl;
    }else {
      if(id%2==0){
        cout << abs(x-id*d) << endl;
      }else{
        long long t1 = abs(x- (id+1)*d);
        long long t2 = abs(x- (id-1) * d);
        cout << min(t1, t2) << endl;
      }
    }
  }else {
    long long id;
    id = x/d;
    //if(id<0) id = -id;
    if(id >= k){
      cout << abs(x-k*d) << endl;
    }else {
      if(id%2==1){
        cout << abs(x-id*d) << endl;
      }else{
        long long t1 = abs(x- (id+1)*d);
        long long t2 = abs(x- (id-1) * d);
        cout << min(t1, t2) << endl;
      }
    }

  }
  

}


Measured memory_bytes: 3580
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
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; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
//#include <math.h>
int main(void) 
{
    string s, t;
    cin>> s;
    
    rep(i, s.size()) {
        t.insert(i, "x");
    }
    cout <<t <<endl;
    
    return 0;
}

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

#define ALL(v) (v).begin(),(v).end()

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int a, b ;
  cin >> a >> b ;
  
  if(a==b){
    cout << a+b <<endl ;
  }
  else if(a>b){
    cout <<a+(a-1)<<endl ;
  }
  else{
    cout <<b+(b-1)<<endl ;
  }
    return 0 ;
}

/*　吾輩はやれば出来る子である。 
　　　　∩∩ 
　　　（´･ω･） 
　　 ＿|　⊃／(＿＿_ 
　／　└-(＿＿＿_／ 
　￣￣￣￣￣￣￣ 
　やる気はまだない 

　　 ⊂⌒／ヽ-、＿_ 
　／⊂_/＿＿＿＿ ／ 
　￣￣￣￣￣￣￣　　*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout <<" "<<kbrni;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;
const int LOG_N = 17;

vector<int> G[MAX_N];

int par[LOG_N][MAX_N];
int depth[MAX_N];

void dfs(int u,int p,int d)
{
    par[0][u] = p;
    depth[u] = d;
    rep(i,G[u].size()){
        if(G[u][i] != p){
            dfs(G[u][i],u,d+1);
        }
    }
}

int lca(int u,int v)
{
    if(depth[u] > depth[v]){
        swap(u,v);
    }
    rep(i,LOG_N){
        if((depth[v] - depth[u]) >> i & 1){
            v = par[i][v];
        }
    }
    if(u == v){
        return u;
    }
    for(int i=LOG_N-1;i>=0;i--){
        if(par[i][u] != par[i][v]){
            u = par[i][u];
            v = par[i][v];
        }
    }
    return par[0][u];
}

int main()
{
    int n;
    cin >> n;
    rep(i,n){
        int m;
        scanf("%d",&m);
        rep(j,m){
            int x;
            scanf("%d",&x);
            G[i].pb(x);
        }
    }
    dfs(0,-1,0);
    rep(i,LOG_N-1){
        rep(j,n){
            if(par[i][j] < 0){
                par[i+1][j] = -1;
            }else{
                par[i+1][j] = par[i][par[i][j]];
            }
        }
    }
    int q;
    cin >> q;
    rep(i,q){
        int x,y;
        scanf("%d%d",&x,&y);
        printf("%d\n",lca(x,y));
    }
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  for(int i = 0; i < n; i++) cin >> d[i];
  set<int> quantity;
  for(int i = 0; i < n; i++){
    quantity.insert(d[i]);
  }
  cout << quantity.size() << endl;
  return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>

int main(){
	int n;
	int b,f,r,v;
	int i,t,s;
	int data[4][3][10]={0};
	scanf("%d",&n);
	for(i = 0;i < n;i++){
		scanf("%d %d %d %d", &b, &f, &r, &v);
		data[b-1][f-1][r-1]+=v;
	}
	for(i = 0;i < 4;i++){
		for(t = 0;t < 3;t++){
			for(s = 0;s < 10; s++){
				printf(" %d", data[i][t][s]);
			}
			puts("");
		}
		if(i!=3)
			puts("####################");
	}
	return 0;
}

Measured memory_bytes: 608
from collections import deque
import sys
input = sys.stdin.readline

N, u, v = map(int, input().split())
u -= 1
v -= 1

edges = [[] for _ in range(N)]
for _ in range(N - 1):
    fr, to = map(int, input().split())
    fr -= 1
    to -= 1
    edges[fr].append(to)
    edges[to].append(fr)

def minDist(start):
    minDist = [10**10] * N
    que = deque([(start, 0, -1)])
    while que:
        now, d, pr = que.popleft()

        if minDist[now] <= d:
            continue
        minDist[now] = d

        for to in edges[now]:
            if to == pr:
                continue
            if minDist[to] > d + 1:
                que.append((to, d + 1, now))

    return minDist

minDistU = minDist(u)
minDistV = minDist(v)

ans = 0
for du, dv in zip(minDistU, minDistV):
    if du <= dv:
        ans = max(ans, dv - 1)

print(ans)

Measured memory_bytes: 29356
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;



int main(void){
    ll x,y;
    cin>>x>>y;
    if(x<y)swap(x,y);
    if(x-y==1||x-y==0)cout<<"Brown"<<endl;
    else cout<<"Alice"<<endl;
    return 0;
}


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

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

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

    cout << (N % K == 0 ? 0 : 1) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
	int i = 1;
	do{
            int x = i;
	    if(x%3 == 0){
		System.out.print(" "+i);
	    }else{
		while(true){
		    if(x%10 == 3){
			System.out.print(" "+i);
			break;
		    }else{
			x /= 10;
			if(x!=0) continue;
			else break;
		    }
		}
	    }
	}while(++i <= n);
	System.out.println();
    }
}

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

long long a[200000];

int main()
{
	int n, m, j = 0;
	bool f = 1;

	cin >> n;

	for (int i = 0; i < n; i++)
		cin >> a[i];
	a[n] = 1000000001;

	cin >> m;

	for (int i = 0; i < m; i++) {
		long long b;
		cin >> b;

		while (b > a[j])
			j++;

		if (b < a[j]) {
			f = 0;
			break;
		}
	}

	cout << f << endl;

	return 0;
}


Measured memory_bytes: 4688
// abc134d: Preparing Boxes
#include <stdio.h>

int main(){
  int n;scanf("%d",&n);
  int a[n+1],b[n+1];
  for(int i=1;i<=n;i++){
    scanf("%d",a+i);
    b[i]=0;
  }

  int m=0;
  for(int i=n;i>0;i--){
    int c=0;for(int j=i;j<=n;j+=i) c+=b[j];// 排他的論理和で剰余処理
    if((a[i]+c)%2){
      b[i]=1;
      m++;
    }
  }

  printf("%d\n",m);
  for(int i=1;i<=n;i++)
    if(b[i]) printf("%d%c",i,--m?' ':'\n');

  return 0;
}

Measured memory_bytes: 2432
#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)-1;i>=0;i--)
#define rrepa(i,a,n) for(int i=(n)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define maxs(a,b) a=max(a,b);
#define mins(a,b) a=min(a,b);
#define max3(a,b,c) max(a,max(b,c)) 
#define mix3(a,b,c) mix(a,mix(b,c))
#define pairi pair<int,int>

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;

int main(){
   
    int p,q,r;
    cin>>p>>q>>r;

    int ans=p+q+r;
    ans-=max(p,max(q,r));

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


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

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(vi a(10);cin>>a[0],a[0];){
		repi(i,1,10)
			cin>>a[i];
		cout<<a[0]-accumulate(1+allof(a),0)<<endl;
	}
	
	return 0;
}

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

int main() {
	
	     ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	  
	   long long n,i,j,k,count=0,ans=0,x,a,b,c;
	   cin>>a>>b;
	   cout<<(a*(a-1))/2+(b*(b-1))/2;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll KnapScack(vector< pair< int,int > > &item,int n,int w)
{
    vector< vector< ll > > DP(n+1,vector< ll >(w+1,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=w;j++){
            if(j>=item[i].first){
                DP[i][j] = max((ll)item[i].second + DP[i-1][j-item[i].first], DP[i-1][j]);
            }
            else{
                DP[i][j] = DP[i-1][j];
            }
        }
    }
    return DP[n][w];
}
int main()
{
    //freopen("in.txt","r",stdin);
    int n,w;
    cin >> n >> w;

    vector< pair< int,int > > item(n+1);
    for(int i=1;i<=n;i++){
        cin >> item[i].first >> item[i].second;
    }

    ll ans = KnapScack(item,n,w);

    cout << ans << endl;
}


Measured memory_bytes: 80256
from collections import *
from copy import *
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
a.sort()
a=deque(a)
b=deepcopy(a)
bb=deque()
bb.append(b.pop())
aa=deque()
aa.append(a.popleft())
while a:
    aa.append(a.pop())
    if a:
        aa.appendleft(a.pop())   
    if a:
        aa.append(a.popleft())
    if a:
        aa.appendleft(a.popleft())
ans=0
aa=list(aa)
while b:
    bb.append(b.popleft())
    if b:
        bb.appendleft(b.popleft())
    if b:
        bb.append(b.pop())
    if b:
        bb.appendleft(b.pop())
bb=list(bb)
ans1=0
for i in range(n-1):
    ans+=abs(aa[i]-aa[i+1])
    ans1+=abs(bb[i]-bb[i+1])
print(max(ans1,ans))


Measured memory_bytes: 15728
const = 1000000007
n, m = [int(_) for _ in input().split()]
dp = [0]* (n+2)

for _ in range(m):
    dp[int(input())] = -1

dp[0] = 1
dp[n+1] = -1

for i in range(0, n):
    if dp[i] != -1:
        if dp[i+1] != -1:
            dp[i+1] += dp[i]
        if dp[i+2] != -1:
            dp[i+2] += dp[i]

print(dp[n]%const)

Measured memory_bytes: 462708
N, M = map(int, input().split())
AC = [0]*(N+1)
WA = [0]*(N+1)
for i in range(M):
    P, S = input().split()
    P = int(P)
    if S == "AC" and AC[P] == 0:
        AC[P] = 1
    elif S == "WA" and AC[P] == 0:
        WA[P]+=1
print(sum(AC), sum(w*a for w, a in zip(AC, WA)))





Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
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; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    int n;
    cin >> n;
    int ans = 0;
    rep1(i, n+1){
        int tmp = 0;
        int j = i;
        while(j>0){
            tmp++;
            j /= 10;

        }
        ans += (tmp%2 ? 1 : 0);

    }
    cout << ans << endl;


}

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s;
    cin >> s;

    cout << string(s.length(), 'x') << "\n";

    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip> 
#include <bits/stdc++.h>
using namespace std;
double pi = 3.14159265358979323846264338;
string arr[100001];
const int ad = 'A' - 'a';





bool issqt(long long k) {
	if (k <= 3)return true;
	long long s = (long long)sqrt(k);
	//cout<<k<<" "<<s<<endl;
	for (long long i = 2; i <= s; i++)
		if (k % i == 0)return false;
	return true;
}
string s;
bool cmp(string a, string b) {
	int la = a.length();
	int lb = b.length();
	int lnth = min(la, lb);
	for (int i = 0; i < lnth; i++) {
		if (a[i] == b[i])continue;
		int ac, bc;
		for (int j = 0; j < 26; j++) {

			if (a[i] == s[j])ac = j;
			if (a[i] == s[j] + ad)ac = j - ad;
			if (b[i] == s[j])bc = j;
			if (b[i] == s[j] + ad)bc = j - ad;
		}
		return ac < bc;
	}
	if (la < lb)return true;
	return false;
}

int main() {
	string s, t;
	cin >> s >> t;
	int lnth = s.length();
	int cnt = 0;
	for (int i = 0; i < lnth; i++)
		if (s[i] != t[i])cnt++;
	cout << cnt << endl;

	
	return 0;
}




Measured memory_bytes: 7044
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin>>n;
    vector<ll> arr,tmp;
    ll sum=0;
    for(int i=0; i<n; i++)
    {
        ll x;
        cin>>x;
        arr.push_back(x);
    }
    sort(arr.begin(),arr.end());
    reverse(arr.begin(),arr.end());
    ll lagbe=n-1;
    int j=0;
    j++;
    lagbe--;
    sum=arr[0];
    while(lagbe>1)
    {
        lagbe-=2;
        sum += arr[j];
        sum +=arr[j];
        j++;
    }
    if(lagbe) sum +=arr[j];
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 5300
def resolve():
    N = int(input())
    W = [input() for _ in range(N)]
    if len(set(W)) != N:
        print('No')
        return
    for i in range(N-1):
        if W[i][-1] != W[i+1][0]:
            print('No')
            return
    print('Yes')
    return

resolve()

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	static int a[]=new int[10];
	static int x[]=new int[10];
	static int y[]=new int[10];
	static boolean f;
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int i,n;
		n=sc.nextInt();
		while(n--!=0){
			for(i=0;i<10;i++){
				a[i]=sc.nextInt();
			}
			f=false;
			check(0,0,0);
			if(f){
				System.out.println("YES");
			}
			else{
				System.out.println("NO");
			}
		}
	}
	public static void check(int i,int k,int h){
		int j,l;
		if(i==10){
			for(j=1;j<k;j++){
				if(x[j-1]>=x[j]) break;
			} 
			for(l=1;l<h;l++){
				if(y[l-1]>=y[l]) break;
			}
			if(j==k && l==h) f=true;
			return;
		}
		x[k]=a[i];
		check(i+1,k+1,h);
		y[h]=a[i];
		check(i+1,k,h+1);
	}
}

Measured memory_bytes: 12000
// 2013/06/29 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int DP[1000000];
	int DP2[1000000];
	DP[0] = 0;
	DP2[0] = 0;
	for(int i=1; i<1000000; i++){
		DP[i] = 1000000;
		DP2[i] = 1000000;
	}

	for(int i=1; ; i++){
		int p = i*(i+1)*(i+2)/6;

		if(p>=1000000)
			break;

		DP[p] = 1;

		if(p%2==1){
			DP2[p] = 1;
		}
	}
/*
	for(int i=0; i<P.size(); i++){
		cout << P[i] << endl;
	}
*/
	for(int i=0; i<1000000; i++){
		if(DP[i]!=1)
			continue;

		for(int j=0; j+i<1000000; j++){
			if(DP[j]+1<DP[j+i]){
				DP[j+i] = DP[j]+1;
			}

			if(DP2[i]==1 && DP2[j]+1<DP2[j+i]){
				DP2[j+i] = DP2[j]+1;
			}
		}
	}

	while(true){
		int n;
		cin >> n;

		if(n==0)
			break;

		cout << DP[n] << ' ' << DP2[n] << endl;
	}

	return 0;
}

Measured memory_bytes: 8972
H,W,D = map(int,input().split())
A = [list(map(int,input().split())) for _ in [0]*H]
Q=int(input())
LR = [list(map(int,input().split())) for _ in [0]*Q]

N = H*W
C = [0]*N
pos = [(0,0)]*N
for i in range(H):
    for j in range(W):
        a = A[i][j]-1
        pos[a] = (i,j)
for i in range(D,N):
    C[i] = sum(abs(pos[i][xy]-pos[i-D][xy]) for xy in range(2))
S = [0]*(N+1)
for i in range(D,N+1):
    S[i] = C[i-1] + S[i-D]

for l,r in LR:
    print(S[r] - S[l])

Measured memory_bytes: 43752
#include<stdio.h>
struct _data{
	long long int num;
	int	c1;
	int c2;
}typedef data;
data d[1001];
void sort(int n){
	int i,j,t;
	long long tmp;
	for(i=0;i<n;i++){
		for(j=i;j<n;j++){
			if(d[i].num>d[j].num){
				tmp=d[i].num;
				d[i].num=d[j].num;
				d[j].num=tmp;
				t=d[i].c1;
				d[i].c1=d[j].c1;
				d[j].c1=t;
				t=d[i].c2;
				d[i].c2=d[j].c2;
				d[j].c2=t;
			}
		}
	}
}
int main(){
	int m,i,j;
	long long n;
	char str[128];
	for(i=0;fgets(str,128,stdin)&& str[0]!='\n';){
		sscanf(str,"%lld,%d\n",&n,&m);
		for(j=0;j<i;j++){
			if(d[j].num==n){
				i--;
				break;
			}
		}
		d[j].num=n;
		d[j].c1++;
		i++;
	}
	for(;fgets(str,128,stdin);){
		sscanf(str,"%lld,%d\n",&n,&m);
		for(j=0;j<i;j++){
			if(d[j].num==n){
				i--;
				break;
			}
		}
		d[j].num=n;
		d[j].c2++;
		i++;
	}
	sort(i);
	for(j=0;j<i;j++){
		if(d[j].c1 >0&&d[j].c2>0){
			printf("%lld %d\n",d[j].num,d[j].c1+d[j].c2);
		}
	}
	return 0;
}

Measured memory_bytes: 0
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

l = inputSLs(2)

if l[0][2]==l[1][0] and l[0][1]==l[1][1] and l[0][0]==l[1][2]:
  print("YES")
else:
  print("NO")


Measured memory_bytes: 63980
#include<stdio.h>
int main(void)
{
	int n,cnt,i;
	scanf("%d",&n);
	while(n!=0){
		cnt=0;
		while(n!=1){
			if(n%2==0){
				n=n/2;
				cnt++;
			}
			else if(n%2!=0){
				n=(n*3)+1;
				cnt++;
			}
		}
	printf("%d\n",cnt);
	scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 1028