akhauriyash/Code-Regression huggingface dataset:
ans = 0

def go(s,index,cnt):
  if cnt == 0:
    temp = ''.join(s).replace(" ","")
    global ans
    ans+=eval(temp)
  else:
    for i in range(index,len(s),2):
      s[i] = '+'
      go(s,i+2,cnt-1)
      s[i] = ' '

s1 = input()
ans = int(s1)

s2 , k = "" , 0

for i in range(0,2*len(s1)-1):
  if i%2 == 0 : 
    s2+=s1[k]
    k+=1
  else:
    s2+=' '

s2 = list(s2)

for i in range(1,len(s1)):
  go(s2,1,i)

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9 + 7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};


int main() {
    ll n,c; cin >> n >> c;
    vl x(n+2,0),v(n+2,0);
    REP(i,1,n+1) cin >> x[i] >> v[i];
    x[n+1] = c;
    vl right1(n+2,0);
    vl right2(n+2,0);
    vl left1(n+2,0);
    vl left2(n+2,0);
    vl mxr(n+2,0);
    vl mxl(n+2,0);
    rep(i,n){
        right1[i+1] = right1[i] + v[i+1] - (x[i+1] - x[i]);
        right2[i+1] = right2[i] + v[i+1] - 2*(x[i+1] - x[i]);
        mxr[i+1] = max(mxr[i], right2[i+1]);
    }
    for(ll i=n+1; i>=2; i--){
        left1[i-1] = left1[i] + v[i-1] - (x[i] - x[i-1]);
        left2[i-1] = left2[i] + v[i-1] - 2*(x[i] - x[i-1]);
        mxl[i-1] = max(mxl[i], left2[i-1]);
    }
    ll ans = 0;
    REP(i,1,n+1){
        ans = max(ans, max(right1[i],0LL) + max(0LL, mxl[i+1]));
        ans = max(ans, left1[i] + max(0LL, mxr[i-1]));
        //cout << ans << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 6528
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------
long long n, k, s;
void solve(){
    long long dum;
    if(s == 1 || s == 2){
        for(int i = 0; i < n; i++){
            if(i < k){
                cout << s << " ";
            }
            else{
                cout << 3 << " ";
            }
            if(i == n - 1){
                cout << endl;
            }
        }
    }
    else{
        dum = s - 1;
        for(int i = 0; i < n; i++){
            if(i < k){
                cout << s << " ";
            }
            else{
                cout << dum << " ";
            }
            if(i == n - 1){
                cout << endl;
            }
        }
    }
}
int main(){
    cin >> n >> k >> s;

    solve();
    return 0;
}



Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    map<char, ll> abc;
    ll n; cin >> n >> abc['A'] >> abc['B'] >> abc['C'];

    // 操作指示を格納
    vector<string> order(n);
    rep(i, n) cin >> order[i];

    // 結果格納用
    bool psb = true;
    vector<char> cmd(n);

    rep(i, n){
        // 操作対象の読み出し
        char p = order[i][0];
        char q = order[i][1];

        // 操作不可の場合
        if(abc[p] == 0 && abc[q] == 0){
            psb = false;
            break;
        }

        // 必ずpに少ない方が入るようにする
        if(abc[p] > abc[q]) swap(p, q);

        // 両方1なら、次の操作指示を見てどちらに寄せるか決める
        if(abc[p] == 1 && abc[q] == 1 && i != n-1){
            char p_n = order[i+1][0];
            char q_n = order[i+1][1];
            if(p != p_n && p != q_n) swap(p, q);
        }

        // pをインクリメント、qをデクリメントして履歴を残す        
        abc[p]++; abc[q]--;
        if(abc[q] < 0){
            psb = false;
            break;
        }
        cmd[i] = p;
    }

    if(!psb) No();
    else{
        Yes();
        rep(i, n) cout << cmd[i] << endl;
    }
}

Measured memory_bytes: 6648
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;

int N;
double v[55];

double ans;

signed main(){
    cin>>N;
    for(int i=0;i<N;++i)cin>>v[i];
    sort(v,v+N);
    ans=v[0];
    for(int i=1;i<N;++i){
        ans = (ans+v[i])/2;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

bool check(char a, char b) {
	return a > b;
}

int kuraiwa(int n) {
	int ans = 0;
	while (n > 0) {
		ans += n % 10;
		n /= 10;
	}
	return ans;
}

int main() {
	int n;
	int a, b;
	cin >> n >> a >> b;
	int ans = 0;
	int tmp;
	rep(i, n + 1) {
		tmp = kuraiwa(i);
		if (a <= tmp && tmp <= b) {
			ans += i;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i,n) cin >> l.at(i);
  sort(ALL(l));
  int ans = 0;
  for(int i=0; i<n; i++){
    for(int j=i+1; j<n; j++){
      int a=l.at(i);
      int b=l.at(j);
      int p = lower_bound(ALL(l),a+b)-l.begin();
      ans+=p-(j+1);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int temp[3005][3005];
string s,t;

void result(int i,int j)
{
    string ans="";

   while (i > 0 && j > 0)
   {
      if (s[i-1] == t[j-1])
      {
          ans += s[i-1];
          i--; j--;
      }

      else if (temp[i-1][j] > temp[i][j-1])
         i--;
      else
         j--;
   }
   reverse(ans.begin(),ans.end());
   cout<<ans<<endl;
}
void lcs()
{
    for(int i=0; i<=s.size(); i++)
    {
        for(int j=0; j<=t.size(); j++)
        {
            if(i==0 || j==0)temp[i][j]=0;
            else if(s[i-1] == t[j-1])temp[i][j] = temp[i-1][j-1]+1;
            else
            {
                temp[i][j] =  max(temp[i-1][j],temp[i][j-1]);

            }
        }
    }
    result(s.size(),t.size());
}
int main()
{

    cin>>s>>t;
    lcs();
}


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

int main()
{
    int a,out;
    scanf("%d",&a);
    out=a+pow(a,2)+pow(a,3);
    if(a<=10)
    {
        printf("%d",out);
    }
    else
    {
        printf("Incorrect");
    }
}


Measured memory_bytes: 2504
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  string S;
  cin >> S;
  string T;
  cin >> T;
  int N = len(S);
  if (T.substr(0, N) == S)
    cout << "Yes\n";
  else
    cout << "No\n";
}

Measured memory_bytes: 3660
import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args)
			throws java.io.IOException{
		Scanner scan = new Scanner(System.in);
			while(scan.hasNext()){
				int hit =0;
				int blow =0;

				int []a ={scan.nextInt(),scan.nextInt(),scan.nextInt(),scan.nextInt()};
				int []b ={scan.nextInt(),scan.nextInt(),scan.nextInt(),scan.nextInt()};
				
				for(int i=0;i<4;i++){
					for(int j=0;j<4;j++){
						
						if(i!=j&&a[i]==b[j]){blow++;}
						
					}
					if(a[i]==b[i]){hit++;}
				}
							System.out.println(hit+" "+blow);
	
			}
	}
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = max((a),(b))
#define chmin(a, b) a = min((a),(b))
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;



int main(){
    int n,i;
    cin>>n>>i;
    cout<<n-i+1<<endl;
}

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

int a[3][3];

void mark(int b){
    rep(i, 3){
        rep(j, 3){
            if(a[i][j] == b){
                a[i][j] = -1;
            }
        }
    }
}

bool ck(){
    if(a[0][0]==-1 && a[0][1]==-1 && a[0][2]==-1)return true;
    if(a[1][0]==-1 && a[1][1]==-1 && a[1][2]==-1)return true;
    if(a[2][0]==-1 && a[2][1]==-1 && a[2][2]==-1)return true;

    if(a[0][0]==-1 && a[1][0]==-1 && a[2][0]==-1)return true;
    if(a[0][1]==-1 && a[1][1]==-1 && a[2][1]==-1)return true;
    if(a[0][2]==-1 && a[1][2]==-1 && a[2][2]==-1)return true;

    if(a[0][0]==-1 && a[1][1]==-1 && a[2][2]==-1)return true;
    if(a[2][0]==-1 && a[1][1]==-1 && a[0][2]==-1)return true;

    return false;
}

int main() {
    cin >> a[0][0] >> a[0][1] >> a[0][2];
    cin >> a[1][0] >> a[1][1] >> a[1][2];
    cin >> a[2][0] >> a[2][1] >> a[2][2];
    
    int n;
    cin >> n;

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

    rep(i, n){
        mark(b[i]);
    }
    if(ck()){
        cout << "Yes";
    }
    else{
        cout << "No";
    }

}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    count_negative = 0
    for i in range(n):
        if a[i] < 0:
            count_negative += 1
    a = [abs(x) for x in a]
    answer = sum(a)
    if count_negative % 2:
        answer -= 2 * min(a)
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 14412
# D 

from collections import Counter
N=int(input())
A=list(map(int,input().split()))
A.sort()
maxi=A[-1]
real=set()
forbid=set()
#print(A[0],maxi)
d=dict(Counter(A))
#print(d)

cnt=0
for i in range(N):
    if A[i] not in forbid:
        if d[A[i]]==1:
            cnt +=1
        p=maxi//A[i]
        for j in range(1,p+1):
            forbid.add(j*A[i])
        
        
#print(forbid)
print(cnt)


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    ll n,p;cin>>n>>p;
    vl a(n);
	rep(i,n)cin>>a[i];
	ll cnt1=0,cnt2=0;
	rep(i,n){
		if(a[i]%2==0)cnt1++;
		else cnt2++;
	}
	if(n==1){
		if(p==1&&a[0]%2==0){
			cout<<0<<endl;
			return 0;
		}
	}
	if(cnt1==n&&p==1){
		cout<<0<<endl;
		return 0;
	}
	ll ans=1;
	while(cnt1>0){
		ans*=2;
		cnt1--;
	}
	while(cnt2>1){
		ans*=2;
		cnt2--;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    private static final Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        if(a<b) System.out.println("a < b");
        else if(a>b) System.out.println("a > b");
        else System.out.println("a == b");
    }
}

Measured memory_bytes: 26180
//ｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwｺｹｯwwwｺｹｯｺｯwwwｺｯwwｺｯwwｺｹｯwwwｺｯwwwｺｹｯwwwｺｹｯｺｯwwwｺｹｰｰｰｰｯ!!!wwwwwｺｹｯｺｯｯｺｰｰｰｰ!!!!!!wwwwwwwwwww
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = sc.next();
        System.out.println("A" + s.charAt(0) + "C");
    }
}

Measured memory_bytes: 38380
#Union-Find木の実装
from collections import Counter
N,M=map(int,input().split())
 
#初期化
par=[i for i in range(N)]#親の要素(par[x]=xのときxは木の根)
rank=[0]*N#木の深さ
 
#木の根を求める
def find(x):
  #xが根だった場合xをそのまま返す
  if par[x] == x:
    return x
  else:
    #根が出るまで再帰する
    par[x] = find(par[x])
    return par[x]
 
#xとyの属する集合を併合
def unite(x,y):
  x=find(x)#xの根
  y=find(y)#yの根
  #根が同じなら何もしない
  if x == y:
    return
  #もし根の深さがyの方が深いなら
  if rank[x] < rank[y]:
    par[x] = y#yを根にする
  else:
    par[y] = x#xを根にする
    if rank[x] == rank[y]:
      rank[x]+=1
 
#xとyが同じ集合に属するか否か
#def same(x,y):
  #return find(x)==find(y)
 
for _ in range(M):
  a,b = map(int,input().split())
  a,b = a-1, b-1
  unite(a,b)
 
for i in range(N):
  find(i)
c=Counter(par)
print(len(c)-1)

Measured memory_bytes: 17056
// Sky's the limit :)
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    //int t = 1; cin >> t; while(t--)
    {
        int n;
        cin >> n;

        int x = 121;
        for(int a = -x; a < x; a++) {
            for(int b = -x; b < x; b++) {
                if(pow(a, 5) - pow(b, 5) == n)
                    return cout << a << ' ' << b, 0;
            }
        }

        
    }
    
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



Measured memory_bytes: 4112
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
typedef pair<string,int> P;
int main(void){
  int n,i;
  string s;
  map<string,int> m;
  cin >> n;
  for (i=0;i<n;i++){
    cin >> s;
    sort(s.begin(),s.end());
    m[s]++;
  }
  
  long k,ans=0;
  map<string,int>::iterator ite;
  for (ite=m.begin();ite!=m.end();ite++){
    k=ite->second;
    ans+=k*(k-1)/2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <string>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define f first
#define s second
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define eb emplace_back
#define in insert
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define FOR(i, n, x) for(int i = x; i < n; i++)
#define OUT(a, e) FOR(i, e, 0) cout << a[i] << ' '
#define OUTV(a) for(auto e : a) cout << e << ' ';
#define maxim(a, n, mx) FOR(i, n, x)mx = max(mx, a[i]);
using namespace std;
int INF = 1e9 + 7;

int main()
{
    int n; cin >> n;
    string s, t; cin >> s >> t;
    string ans = "";
    FOR(i, n, 0)
    {
        ans += s[i];
        ans += t[i];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include <string>
#include<cstdio>
#include<math.h>
#include<stack>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
using namespace std;
typedef long long int ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}

//------------------変数-----------------------//
ll n, cost[30],m,a[100001],k,d;
vector<vector<ll>> v(39);
//-------------------関数----------------------//


int main() {
	cin >> n;
	cout << "ABC" << n << endl;


	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int x1 = saori.saori_hayami();
		int y1 = saori.saori_hayami();
		int x2 = saori.saori_hayami();
		int y2 = saori.saori_hayami();
		System.out.println((x2-y2+y1) + " " + (x2-x1+y2) + " " + (x1-y2+y1) + " " + (x2-x1+y1));

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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; }

// UnionFind
struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int main() {
  int n, m;
  cin >> n >> m;
  vi h(n);
  vi ok(n, 1);
  REP(i, n)  cin >> h[i];
  int ans = 0;
  REP(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    if (h[a] <= h[b]) ok[a] = 0;
    if (h[a] >= h[b]) ok[b] = 0;
  }
  REP(i, n) {
    if(ok[i]) ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4052
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<iomanip>
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
const int INF = (1 << 30);


//変数
int N, K, ans;
vector<vector<int>> place;

//vectorの中身を全部表示
//lenに引数を入れれば、その長さで整列させます
template<typename T>
void show(vector<T> v, int len=-1) 
{
	if (len == -1) {
		for (auto col : v)cout << col << " ";
	}
	else {
		for (auto col : v)cout << setw(len) << right << col << " ";
	}
	cout << endl;
}
template<typename T>
void show(vector<vector<T>> v,int len=-1)
{
	for (auto row : v)show(row,len);
	cout << endl;
}


//サブ関数
//入力
void input()
{
	cin >> N >> K;
	place = vector<vector<int>>(2 * K, vector<int>(2 * K, 0));


	int x, y;
	char c;
	REP(i, N) {
		cin >> x >> y >> c;
		if (c == 'W')x += K;
		x %= 2 * K;
		y %= 2 * K;
		place[x][y]++;
	}
}

//vectorの中身を全部表示
template<typename T>
void show(vector<T> v)
{
	for (auto col : v)cout << col << " ";
	cout << endl;
}
template<typename T>
void show(vector<vector<T>> v)
{
	for (auto row : v)show(row);
	cout << endl;
}



vector<vector<int>> make_imos(vector<vector<int>> p) 
{

	vector<vector<int>> imos(2 * K, vector<int>(2 * K, 0));

	REP(i, 2*K) {
		REP(j, 2 * K) {
			int y = i % K;
			int x = j % K;
			int cnt = (y != i ? 1 : 0) + (x != j ? 1 : 0);

			//一つだけ特殊な処理
			if (cnt % 2 == 0)imos[0][0] += p[i][j];

			//他は、2パターンは符号が逆転してるだけ
			int sub = (cnt % 2 == 0 ? 1 : -1)*p[i][j];

			//端点をプロットしていきます
			imos[0][x] -= sub;
			imos[0][x + K] += sub;
			imos[y][0] -= sub;
			imos[y][x] += 2 * sub;
			imos[y][x + K] -= 2 * sub;
			imos[y + K][0] += sub;
			imos[y + K][x] -= 2 * sub;
			imos[y + K][x + K] += 2 * sub;
			//show(imos, 2);
			//cout << "==========" << endl;
		}
	}
	return imos;
}

void paint_imos(vector<vector<int>>& imos)
{
	REP(i, 2 * K)REP(j, 2 * K - 1) {
		imos[i][j + 1] += imos[i][j];
	}
	REP(j, 2 * K)REP(i, 2 * K - 1) {
		imos[i + 1][j] += imos[i][j];
	}
}

int find_ans(vector<vector<int>> imos)
{
	int res = 0;
	REP(i, 2 * K)REP(j, 2 * K)res = max(res, imos[i][j]);
	return res;
}


//計算
void calc()
{
	auto imos = make_imos(place);
	paint_imos(imos);
	ans = find_ans(imos);
}


//出力
void output()
{
	cout << ans << endl;
}

//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 47360
#include <stdio.h>
#define N 100
int main() {
    int n, a[N],i,j,flag = 0,tmp,count=0;
    
    scanf("%d",&n);

    for (i = 0; i < n; i++) scanf("%d", &a[i]);

    for (i = 0; i < n; i++) {

        flag = 1; // 逆の隣接要素が存在する
        while (flag == 1) {
            flag = 0;
            for (j = n - 1; j > 0; j--) {
                if (a[j] < a[j - 1]) {
                    tmp = a[j];
                    a[j] = a[j - 1];
                    a[j - 1] = tmp;
                    flag = 1;
                    count++;
                }
            }
            
        }

    }

    for (i = 0; i < n; i++){
      printf("%d", a[i]);
      if(i != n-1) printf(" ");
    }

    printf("\n%d\n",count);
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  LL A,B; read(A,B);
  int k=59;
  while(~k) {
    if((A>>k&1)^(B>>k&1)) break;
    if(A>>k&1) A^=1ll<<k,B^=1ll<<k;
    --k;
  }
  if(k==-1) return puts("1"),0;
  int g=k-1;
  while(~g) {
    if(B>>g&1) break;
    --g;
  }
  LL L=g==-1?B:(1ll<<k)+(1ll<<(g+1))-1,R=(1ll<<k)+A;
  LL res=(1ll<<(k+1))-A;
  if(L+1<R) res-=R-L-1;
  printf("%lld\n",res);
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

long long int INF = 2147483647;
long long int MOD = 1000000007;
using namespace std;

typedef pair<long long int, long long int> P;

#define MAX_N 200000

using namespace std;

int const TREE_SIZE = 1 << 20;
long long int seg_tree[TREE_SIZE];

void change(int a, long long int w){
	
	// a番目の要素をwに変更する O(log N)
	
	a += TREE_SIZE / 2;
	
	seg_tree[a] += w;
	
	for(int x = a / 2; x > 0; x /= 2){
		seg_tree[x] = seg_tree[2 * x] + seg_tree[2 * x + 1];
	}
}

long long int query(int a, int b, int index, int l, int r){
	
	// 区間 [a, b) の要素の最小値を返す O(log N)
	// 外からは query(a, b, 1, 0, TREE_SIZE / 2) のように呼ぶ
	
	if(r <= a || b <= l){
		return 0;
	}
	if(a <= l && r <= b){
		return seg_tree[index];
	}
	
	return query(a, b, index * 2, l, (l + r) / 2) + query(a, b, index * 2 + 1, (l + r) / 2, r);
}

int main(){
	
	int n, q;
	cin >> n >> q;
	
	for(int i = 0; i < TREE_SIZE; i++){
		seg_tree[i] = 0;
	}
	
	for(int i = 0; i < q; i++){
		long long int num, a, b;
		cin >> num >> a >> b;
		if(num == 0){
			change(a, b);
		}else{
			cout << query(a, b + 1, 1, 0, TREE_SIZE / 2) << endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 11312
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int cnt=0;
  while(s.size()){
    if(s[0]==s[s.size()-1]){
      s=s.substr(1,s.size()-2);
    }
    else{
      if(s[0]=='x'){
        s=s+"x";
        cnt++;
      }
      else if(s[s.size()-1]=='x'){
        s="x"+s;
        cnt++;
      }
      else{
        cout << -1 << endl;
        return 0;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>

using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n, vector<int> (m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    int ans = n;
    while (!a[0].empty()) {
        vector<int> cnt(m);
        for (auto t : a) {
            cnt[t[0]]++;
        }
        int mx = *max_element(cnt.begin(), cnt.end());
        vector<int> toer;
        for (int i = 0; i < m; i++) {
            if (cnt[i] == mx) toer.push_back(i);
        }
        ans = min(ans, mx);
        for (auto &t : a) {
            for (auto x : toer) {
                t.erase(find(t.begin(), t.end(), x));
            }
        }
    }
    cout << ans << endl;
}   


Measured memory_bytes: 640
#include<stdio.h>
#include<map>
using namespace std;
int n,ch[1000005],sh[1000005],ans,sum,fa[1000005],tot,mk[1000005];
map <int,int> mp,mmp;
int gf(int p){
	if(fa[p]==p)return p;
	return fa[p]=gf(fa[p]);
}
void mg(int a,int b){
	int fx=gf(a),fy=gf(b);
	if(fx!=fy){
		fa[fx]=fy;
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&sh[i]);sum^=sh[i];mp[sh[i]]++;
	}mp[sum]++;
	for(int i=1;i<=n;i++){
		scanf("%d",&ch[i]);mp[ch[i]]--;
		if(mp[ch[i]]<0){
			ans=-999999999;
		}
		if(sh[i]!=ch[i]){mk[i]=1;
			ans++;
		}
	}
	sh[n+1]=sum;
	for(int i=1;i<=n+1;i++){
		if(mp[sh[i]]>0){
			ch[n+1]=sh[i];break;
		}
	}
	n++;tot=n+n;
	mk[n]=1;
	for(int i=1;i<=n;i++){
		if(!mk[i])continue;
		if(mmp[sh[i]]==0)mmp[sh[i]]=++tot;
		fa[i]=i;fa[i+n]=i+n;
	}
	for(int i=1;i<=tot;i++)fa[i]=i;
	for(int i=1;i<=n;i++){
		if(!mk[i]){
			fa[i]=fa[i+n]=0;
		}
	}
	for(int i=1;i<=n;i++){
		if(sh[i]!=ch[i])mg(i,i+n);
		mg(i,mmp[sh[i]]);mg(i+n,mmp[ch[i]]);
	}
	for(int i=1;i<=tot;i++){
		if(fa[i]==i){//printf("i:%d\n",i);
			ans++;
		}
	}
	ans--;
	if(ans<0)printf("-1");
	else printf("%d",ans);
}

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

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

    int k = 0;
    if (s.size() % 2 == 0)
    {
        for (int i = 0; i < s.size() / 2; i++)
        {

            if (s[i] == s[s.size() / 2 + i])
            {
                k++;
            }
        }
        if (k == s.size() / 2)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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


typedef struct{
	char name[11];
	int time;
}Process;

class ProcessQueue{
	public:
		ProcessQueue(int size){
			m_size = size;
			m_process = new Process[m_size];
			m_head = 0;
			m_tail = 0;
			number = 0;
		}
		~ProcessQueue() {
			delete m_process;
		}
		void enQueue(Process process){
			number++;
			if (m_tail < m_size-1) {
				m_process[m_tail++] = process;
			} else {
				m_process[m_size-1] = process;
				m_tail = 0;
			}
		}
		Process deQueue() {
			number--;
			if (m_head < m_size-1) {
				return m_process[m_head++];
			} else {
				m_head=0;
				return m_process[m_size-1];
			}
		}
		int getNumber () {
			return number;
		}
	private:
		int m_size;
		int number;
		int m_head;
		int m_tail;
		Process* m_process;
};
int main() {
	int n, q, initTime=0;
	Process temp;
	cin>>n>>q;
	ProcessQueue pqueue(n);
	for (int i=0; i<n; i++) {
		//scanf("%s%d", &temp.name, &temp.time);
		cin>>temp.name>>temp.time;
		pqueue.enQueue(temp);
	}
	while (pqueue.getNumber() > 0) {
		temp = pqueue.deQueue();
		if (temp.time - q > 0) {
			initTime += q;
			temp.time -= q;
			pqueue.enQueue(temp);
		} else {
			initTime += temp.time;
			// printf("%s %d\n", temp.name, initTime);
			cout<<temp.name<<" "<<initTime<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define ll long long
#define ld long double
const ll MOD = 998244353;
const ll INF = 1e18;
using namespace std;


main(){    
    #ifdef XOX
        freopen("D:\\V S Code\\cpp\\competitiveProgramming\\Input.txt", "r", stdin);
        freopen("D:\\V S Code\\cpp\\competitiveProgramming\\OPT.txt", "w", stdout);
    #endif

    ios::sync_with_stdio(!cin.tie(NULL));
    
    int n, m;
    ll k;
    cin >> n >> m >> k;

    ll arr[n], brr[m];

    for(int i = 0; i < n; i++)  cin >> arr[i];
    for(int i = 0; i < m; i++)  cin >> brr[i];

    for(int i = 1; i < n; i++)  arr[i] = arr[i - 1] + arr[i];
    for(int i = 1; i < m; i++)  brr[i] = brr[i - 1] + brr[i];

    ll ans = upper_bound(brr, brr + m, k) - brr;
    ll tmp = 0, cur = 0;
    for(int i = 0; i < n and arr[i] <= k; i++) {
        cur = arr[i];
        tmp = upper_bound(brr, brr + m, k - cur) - brr;
        ans = max(ans, tmp + i + 1);
    }

    cout << ans;
}

Measured memory_bytes: 6764
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,w;
    cin>>n>>w;
    vector<int> weights(n);
    vector<int> values(n);
    for(int i = 0;i<n;++i)
    {
        cin>>weights[i]>>values[i];
    }
    long long int dp[n+1][w+1];
    for(int i = 0;i<=n;++i)
    {
        for(int j = 0;j<=w;++j)
        {
            dp[i][j] = 0;
        }
    }
    for(int i = 1;i<=n;++i)
    {
        for(int j = 0;j<=w;++j)
        {
            int left = j - weights[i-1];
            if(left >= 0)
            {
                dp[i][j] = max(dp[i-1][j] , values[i-1] + dp[i-1][left]);
            }
            else
            {
                dp[i][j] = dp[i-1][j];
            }
        }
    }
    cout<<dp[n][w];
}

Measured memory_bytes: 82360
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using Double = long double;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int N;
        cin >> N;
        if (N == 1) {
            cout << "1" << endl;
            cout << "1" << endl;
            return;
        } else if (N == 2) {
            cout << "2" << endl;
            cout << "1" << endl;
            cout << "00" << endl;
            return;
        }

        string pre = "1";
        string mid = "";
        string suf = "1";
        cout << N - 1 << endl;
        for (int i = 0; i + 1 < N; ++i) {
            string ans = pre + mid + suf;
            cout << ans << endl;
            mid += "0";
        }


    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}



Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1<<20;
int n, a, x;
ll b[N][3], Z;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  FOR(i, 0, N) b[i][0] = 1;
  scanf("%d", &n);
  FOR(i, 0, n){
    scanf("%d", &a);
    if(x^=a){
      (b[x][0] += b[x][1]*(Z-b[x][2])) %= MOD;
      (b[x][1] += b[x][0]) %= MOD;
      b[x][2] = Z;
    }else{
      Z++;
    }
  }
  if(x){
    printf("%d\n", b[x][0]);
    return 0;
  }
  ll ans = modPow(2, Z-1, MOD);
  FOR(i, 1, N) ans += b[i][1];
  printf("%d\n", ans%MOD);
}

Measured memory_bytes: 24960
H,W=map(int,input().split())
s=["0"+input()+"0" for i in range(H)]
s=["0"*(W+2)]+s+["0"*(W+2)]
check=1

for i in range(1,H+1):
    for j in range(1,W+1):
        if s[i][j]=="#":
            if s[i-1][j]!="#" and s[i+1][j]!="#" and s[i][j+1]!="#" and s[i][j-1]!="#":
                
                check=0

if check==1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import sys

import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
from operator import attrgetter, itemgetter

# import math

# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(input())
    s = input()

    e = [0] * n
    w = [0] * n

    for i in range(n - 1):
        w[i + 1] = w[i]
        if s[i] == "W":
            w[i + 1] += 1

    for i in range(n - 1, 0, -1):
        e[i - 1] = e[i]
        if s[i] == "E":
            e[i - 1] += 1

    ans = INF
    for j in range(n):
        temp = w[j] + e[j]
        ans = min(ans, temp)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 45660
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define ull         unsigned long long int
#define ll          long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.0000000001
#define all(a)      (a).begin(),(a).end()
#define ordered_set     tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> 
 
const long long INF = (long long) 1e11+1;
const long long mod = (long long) 998244353;
const long long hell = (long long) 1000000007;

ll power(ll x,ll y){
  ll res=1;
  while(y>0){
    if(y%2) res=(x%hell*res%hell)%hell;
    x=(x%hell*x%hell)%hell;    
    y=y/2;
  }
  
  return res%hell;
}
 
ll modinv(ll x){
  return power(x,hell-2);
}

ll gcd(ll a,ll b){
    while( b != 0)
	{
		ll  t = b;
		b= a %t;
		a = t;
	}
	return a;
}    
    
void fastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

void solve(){
  string s;
  cin>>s;
  string t=s.substr(0,3);
  cout<<t;
}    

int main(){
   fastIO();
   int test;
   //cin>>test;
   test=1;    
      
   while(test--)
   solve();
}

Measured memory_bytes: 3652
A, B = map(int,input().split())

def gcd(m, n):
  x = max(m, n)
  y = min(m, n)
  
  if x % y == 0:
    return y
  
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z
      
def lcm(m, n):
  return int(m * n / gcd(m, n))

print(lcm(A, B))

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

using namespace std;
typedef long long ll;

void desc_26th(ll numero)
{
  if (numero == -1) return;
    char a = (numero % 26) + 97;
    numero /= 26;
    desc_26th(--numero);
    cout << a;
}

int main() 
{
  ll numero; cin >> numero;
  desc_26th(--numero);
  return 0;
}

Measured memory_bytes: 3528
#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    int n;
    ll x,zb = 1;
    cin >> n;

    vector<ll> V;
    for(int i=0;i<n;i++)
    {
        cin >> x;
        V.push_back(x);
        if(x == 0)
        {
            cout << 0 << endl;
            return 0;
        }
    }

    for(int i=0;i<n;i++)
    {
        x = V[i];
        if(1000000000000000000/zb < x)
        {
            cout << -1;
            return 0;
        }
        zb *= x;
    }

    cout << zb;
    return 0;
}


Measured memory_bytes: 4328
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

vector<int> digitlist(int x){
  vector<int> a;
  while(x!=0){
    int now = x%10;
    x = x/10;
    a.push_back(now);
  }
  return a;
}

int main(){
    int h,w;
    cin >> h >> w;
    vector<string> ss(h+1);
    for(int i=0; i<h; i++){
        cin >> ss[i];
    }
    //for(int i=0;i<h;i++) cout << ss[i] << endl;
    
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            char ans=0;
            for(int k=-1; k<=1; k++){
                for(int l=-1; l<=1; l++){
                    if(0<=i+k && i+k<h && 0<=j+l && j+l<w)
                        if(ss[i+k].at(j+l)=='#') ans+=1;
                }
            }
            if(ss[i].at(j)=='.') ss[i].at(j) = (char)(ans+(int)'0');
        }
    }
    for(int i=0;i<h;i++) cout << ss[i] << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

const string AIZU = "AIZUNYAN";
string s;

bool check(int& n){
	int A=0,I=0,D=0,U=0,N=0,Y=0;
	loop(i,n,n+8){	
		if(s[i]=='A')A++;
		if(s[i]=='I')I++;
		if(s[i]=='D')D++;
		if(s[i]=='U')U++;
		if(s[i]=='N')N++;
		if(s[i]=='Y')Y++;		
	}
	return (A==2&&N==2&&I==1&&D==1&&U==1&&Y==1);
}

void slove(){
	if(s.size()<8)return;
  for(int i=0; i<s.size()-7; ){
		if(check(i)){
			s.replace(i,8,AIZU);
			i+=8;
		}else{
			i++;
		}
	}
}

int main(){
	cin>>s;
	slove();
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
long A[22];
int main()
{
   long long a,b,n,i,r=1;
   cin>>n;
   for(i=1;i<=n;i++)
   {
      r*=i;
      r=r%1000000007;
   }
   cout<<r<<endl;
}


Measured memory_bytes: 3632
import itertools
n,m,q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(q)]


A = list(itertools.combinations_with_replacement(list(range(1, m+1)), n))

max_score = 0

for a in A:
  score = 0
  for abcd in ABCD:
    if a[abcd[1]-1]-a[abcd[0]-1]==abcd[2]:
      score += abcd[3]
  max_score = max(max_score, score)
  
print(max_score)

Measured memory_bytes: 21624
import collections as c
ip = lambda : map(int, input().split())
# ##############
N = int(input())
p = list(ip())
q = list(ip())

d = {0:1}
for i in range(1,N):
    d[i] = d[i-1]*i
# print(d)
ansp = 0
ansq = 0
lp = list(range(1,N+1))
lq = list(range(1,N+1))
for i in range(N-1):
    ansp += d[N-1-i]*(lp.index(p[i]))
    ansq += d[N-1-i]*(lq.index(q[i]))
    lp.pop(lp.index(p[i]))
    lq.pop(lq.index(q[i]))
    # print(ansp,ansq)
print(abs(ansp-ansq))

Measured memory_bytes: 3316
/*


    大石泉、好きですよね？
        大石泉、好きだと思うんです？
            どうか、コラボしてくれませんか？
                心からの願いです。


*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int n,m,i,j,k,sum,total;
//long long int ;
//float ;
//double ;
char s[11];
int main(void){
    scanf("%s",s);
    for ( i = 0; i < 10 ; i++)
    {
        if(s[i]=='\0'){
            break;
        }
        if((s[i]=='h')&&(s[i+1]=='i')){
                k++;
        }
        i++;    
    }
    if (i/2==k)
    {
        printf("Yes\n");
    } else
    {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int x;
void grouping(int X){
  switch(X){
    case 1:
      x=1;
      break;
    case 2:
      x=3;
      break;
    case 3:
      x=1;
      break;    
    case 4:
      x=2;
      break;
    case 5:
      x=1;
      break;
    case 6:
      x=2;
      break;
    case 7:
      x=1;
      break;
    case 8:
      x=1;
      break;
    case 9:
      x=2;
      break;
    case 10:
      x=1;
      break;
    case 11:
      x=2;
      break;
    case 12:
      x=1;
      break;
    default:
      x=0;
      break;
  }
}
int main(void){
  int a,b,s,t;
  cin>>a>>b;
  grouping(a);
  s=x;
  grouping(b);
  t=x;
  if(s==t)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256