akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int A, B;
    cin >> A >> B;
    if (A<10 && B<10){
        cout << A*B << endl;
    }else{
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.*
import java.math.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrintln: (String)->Unit = { msg -> System.err.println(msg) }
private const val MOD = 1_000_000_007L


fun main(args: Array<String>) {
    val (A,B,C,K) = readListInt()

    var k = K
    var ans = 0
    if (A>=k) {
        ans = k
        println(ans)
        return
    } else {
        assert(A<k)
        ans += A
        k -= A
    }
    if (B>=k) {
        println(ans)
        return
    } else {
        assert(B<k)
        k -= B
    }
    ans -= k
    println(ans)
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    string S, T;
    cin >> S >> T;
    T.pop_back();
    cout << ((S == T) ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
 
public class Main {
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int[] counter = new int[26];

        String line;
        while((line = br.readLine()) != null) {
            char[] charArray = line.toLowerCase().toCharArray();
            for(int i = 0; i < charArray.length; i++) {
                if(charArray[i] < 'a' || charArray[i] > 'z') {
                    continue;
                }
                counter[charArray[i]-'a']++;
            }
        }
 
        for(int i = 0; i < counter.length; i++) {
            System.out.println((char)('a' + i) + " : " + counter[i]);
        }
    }
}


Measured memory_bytes: 24200
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);

signed main(){

    int N; cin >> N;
    vec a(N); readvec(a);

    int ans = 0;
    while(true){
        int tmp = 0;
        REP(i, N){
            if(a[i] <= N - 1) continue;
            int n = (a[i] - (N - 1)) / N + min((int)1, (a[i] - (N - 1)) % N);
            tmp += n;
            a[i] -= n * (N + 1);
            REP(j, N) a[j] += n;
        }
        if(tmp == 0) break;
        ans += tmp;
    }

    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

const int MAX=510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        //???
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}


//n!
ll fact_mod(ll n) {
    ll ret=1; 
    for(ll i=2;i<=n;i++) ret=ret*(i%mod)%mod;
    return ret;
}
 
// 繰り返し二乗法 
ll pow_mod(ll x, ll n){
    if(n==0) return 1;
    ll ret=pow_mod((x*x) % mod, n/2);
    if(n&1) ret=(ret*x)%mod;
    return ret;
}
 
//nCr O(r) nがでかくても安心
ll combination_mod(ll n, ll r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    ll a=1;
    //a=n!/(n-r)!=n~n-r+1までの総積->O(r)
    for(ll i=0;i<r;i++) a=a*((n-i)%mod)%mod;
    //b=inv(r!)
    ll b=pow_mod(fact_mod(r), mod-2);
    return (a%mod)*(b%mod)%mod;
}
 
ll inv_mod(ll n){
    // フェルマーの小定理
    return pow_mod(n,mod-2);
}

int n;
vector<vector<int>> g;

vector<ll> dp,ko,ans;

ll dfs0(int pre,int now){
    ll ret=1;
    for(auto to:g[now])if(to!=pre){
        ret+=dfs0(now,to);
    }
    return ko[now]=ret;
}

ll dfs1(int pre,int now){
    ll ret=1;
    ll sum=0;
    for(auto to:g[now])if(to!=pre){
        sum+=ko[to];
        ret*=inv_mod(fac[ko[to]]);
        ret%=mod;
        ret*=dfs1(now,to);    
        ret%=mod;
    }
    ret*=fac[sum];
    ret%=mod;
    return dp[now]=ret;
}

void dfs2(int pre,int now){
    ll memo=dp[now];

    ll res=fac[n-1];
    for(auto to:g[now]){
        if(to!=pre){
            res*=inv_mod(fac[ko[to]]);
            res%=mod;
        }else{
            res*=inv_mod(fac[n-ko[now]]);
            res%=mod;
        }
        res*=dp[to];
        res%=mod;
    }
    ans[now]=res;
    dp[now]=ans[now];
    for(auto to:g[now])if(to!=pre){
        dp[now]*=fac[ko[to]];dp[now]%=mod;
        dp[now]*=fac[n-1-ko[to]];dp[now]%=mod;
        dp[now]*=inv_mod(fac[n-1]);dp[now]%=mod;
        dp[now]*=inv_mod(dp[to]);dp[now]%=mod;

        dfs2(now,to);

        dp[now]=ans[now];
    }
    dp[now]=memo;
}

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


    cin>>n;
    g.resize(n);dp.resize(n);ans.resize(n);ko.resize(n);
    rep(i,n-1){
        int u,v;cin>>u>>v;u--,v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs0(-1,0);
    dfs1(-1,0);
    dfs2(-1,0);
    rep(i,n) cout<<ans[i]<<endl;
    return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	int64_t ans=0;
	for(int i=1;i<=n;++i){
		for(int j=i;j<=n;j+=i){
			ans+=j;
		}
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  unordered_set<int> st;
  unordered_map<int,int> mp;
  rep(i,n){
    cin >> a[i];
    st.insert(a[i]);
    mp[a[i]]++;
  }
  sort(a.begin(),a.end());
  if(a[0]==1){
    if(a[1]==1){
      cout << 0 << ln; return 0;
    } else {
      cout << 1 << ln; return 0;
    }
  }

  int ans = 0;
  rep(i,n){
    bool flag = true;
    for(int j=2; j*j<=a[i]; j++)if(a[i]%j==0){
      if(st.find(j)!=st.end() || st.find(a[i]/j)!=st.end()){
        flag = false; break;
      }
    }
    if(mp[a[i]]>1){ flag=false; }
    if(flag){
      ans++;
    }
  }

  cout << ans << ln;

  return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<long long> reach(n, 0);
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
        if (i - a[i] >= 0) {
            ans += reach[i - a[i]];
        }
        if (i + a[i] < n) reach[i + a[i]] += 1;

    }
    cout << ans << endl;
}


Measured memory_bytes: 5524
N = int(input())
A = list(map(int, input().split()))
is_approved = True
for i in range(N):
    if A[i] % 2 != 0:
        continue
    if A[i] % 3 != 0 and A[i] % 5 != 0:
        is_approved = False
        break
if is_approved:
    print("APPROVED")
else:
    print("DENIED")

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

int main(){
  int N, A = 0, B = 0, max, max_data;
  cin >> N;
  vector<int> data(N);
  for (int i = 0; i < N; i++){
    cin >> data.at(i);
  }
  for (int i = 0; i < N; i++){
    if(i % 2 == 0){
      max = 0;
      max_data = 0; 
      for (int j = 0; j < N; j++){
        if (max < data.at(j)){
          max = data.at(j);
          max_data = j;
        }
      }
      A += max;
      data.at(max_data) = 0;
    }
    else{
      max = 0;
      max_data = 0; 
      for (int j = 0; j < N; j++){
        if (max < data.at(j)){
          max = data.at(j);
          max_data = j;
        }
      }
      B += max;
      data.at(max_data) = 0;
    }
  }
  cout << A - B;
  return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;
const int mod = 1e9 + 7;

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    if (n % 2){
        cout << b[(n-1) / 2] - a[(n-1) / 2] + 1 << endl;
    } else{
        cout << (b[n/2 - 1] + b[n/2]) - (a[n/2 - 1] + a[n/2]) + 1 << endl;
    }
}

Measured memory_bytes: 4768
n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(1,n-1):
  if p[i]!=min(p[i-1],p[i],p[i+1]) and p[i]!=max(p[i-1],p[i],p[i+1]):
    cnt+=1
print(cnt)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
	#define ll long long int
	#define loop(i,a,b) for(i=a;i<b;i++)
	#define mod 100000007
	#define INF 1000000000000
	#define pb push_back
	#define lim 200001
	using namespace std;

    int main()
    { ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll i,n,cnt=0;

        cin>>n;
        vector<ll> ans(n,1);
        char x[n+1];
        
        cin>>x;
        ll power1[lim+1],power2[lim+1];

        power1[0]=1;power2[0]=1;
        loop(i,0,n)
         if(x[i]=='1') cnt++;

        loop(i,1,lim+1) {if(cnt>1) power1[i]=(power1[i-1]*2)%(cnt-1);
        	power2[i]=(power2[i-1]*2)%(cnt+1);}

        ll val1=0,val2=0;
        	loop(i,0,n)
        	{
        		if(cnt>1)
        		val1=(val1+(x[i]-48)*power1[n-i-1])%(cnt-1);
        	val2=(val2+(x[i]-48)*power2[n-i-1])%(cnt+1);
        }
    //cout<<val1<<" "<<val2<<endl;

        loop(i,0,n)
        {
        	if(x[i]=='1'){
        		
        		if(cnt>1){
        			ll curr=((val1-power1[n-1-i])%(cnt-1)+(cnt-1))%(cnt-1);
        			while(curr){
        				curr=curr%__builtin_popcountll(curr);
        				ans[i]++;
        			}}
        			else
        				ans[i]=0;
        		}
        
        	else
        	{
        		ll curr=(val2+power2[n-1-i])%(cnt+1);
        			while(curr){
        				curr=curr%__builtin_popcountll(curr);
        				ans[i]++;
        			}
        		}}

        		loop(i,0,n)
        		cout<<ans[i]<<endl;

        		return 0;}

        

Measured memory_bytes: 8168
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){

    int A,B,C;
    cin >> A >> B >> C;
    
    long long S = A;
    
    bool can = false;
    for(int i=0;i<B;i++){
        S = S * (i+1) ;
        if(S<i)break;
        int origin = i*B+C;
        if(origin%A==0){
            can = true;
            break;            
        }
    }
    
    if(can) cout << "YES";
    else cout << "NO";
    
}

Measured memory_bytes: 3604
using System;
class Program{
  static void Main(string[] args){
    string[] tmp = Console.ReadLine().Split(' ');
    int a = int.Parse(tmp[0]);
    int b = int.Parse(tmp[1]);
    int c = int.Parse(tmp[2]);
    if((a<c&&c<b)||(b<c&&c<a)){
      Console.WriteLine("Yes");
    }else{
      Console.WriteLine("No");
    }
  }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define F(i,n) for (int i = 0; i < n; ++i)
#define F1(i,n) for (int i = 1; i <= n; ++i)
#define dbg(x) cerr << #x << " = " << x << endl
#define dbgg(x) cerr << #x << " = " << x << ' '
#define T(x) x[pool]
#define mineq(x,y) { if ((x) > (y)) (x) = (y); }
#define maxeq(x,y) { if ((x) < (y)) (x) = (y); }
#define MEOW cout << "meowwwww" << '\n'; system("pause");
#define int long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c)
{
	s << "[ "; for (auto it : c) s << it << " "; s << "\b]\n";
	return s;
}

template<typename T>
ostream& operator <<(ostream &s, const pair<int, T> &c)
{
	s << "[ "; cout << c.fi << " , " << c.se << " ] ";
	return s;
}

const int maxn = 123456, maxm = 234567, oo = 1000000000;
int n, m, l[maxm], r[maxm], d[maxm], vis[maxn], v[maxn];
vector<pii> e[maxn];

void input()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	F1 (i, m) cin >> l[i] >> r[i] >> d[i];
}

pair<int, int> dfs(int cur, int val)
{
	vis[cur] = true;
	v[cur] = val;
	int mx = val, mi = val;
	for (pii nxt : e[cur]) if (!vis[nxt.fi])
	{
		pii x = dfs(nxt.fi, val + nxt.se);
		mx = max(mx, x.fi);
		mi = min(mi, x.se);
	}
	return mp(mx, mi);
}

void solve()
{
	bool flag = true;
	F1 (i, m) e[l[i]].pb(mp(r[i], d[i]));
	F1 (i, m) e[r[i]].pb(mp(l[i], -d[i]));
	F1 (i, n) 
		if (!vis[i]) 
		{
			pii x = dfs(i, 0);
			if (x.fi - x.se > oo) flag = false;
		}
	F1 (i, m) if (v[r[i]] - v[l[i]] != d[i]) flag = false;
	if (flag) cout << "Yes\n";
	else cout << "No\n";
}

main()
{
	input();
	solve();
}


Measured memory_bytes: 23552
#include<bits/stdc++.h>
#define ll            long long
#define pb            emplace_back
#define fi            first
#define se            second
#define mp            make_pair
//#define int           int64_t

using namespace std;

typedef pair<ll, int> pii;
const int N = (int)5e3 + 5;
const ll inf = (ll)1e18;

int n, A, B, a[N], pos[N];
ll f[N][N], mn;

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #define FileName      "test"
    if(fopen(FileName".inp", "r")) {
       freopen(FileName".inp", "r", stdin);
       freopen(FileName".out", "w", stdout);
    }
    cin >> n >> A >> B;
    fill_n(&f[0][0], N * N, inf);
    for(int i = 1; i <= n; ++i) cin >> a[i], pos[a[i]] = i - 1;
    ///(0, 1], (1, 2], (2, 3], ..., (n - 1, n], (n, n + 1]
    ///to the right A, to the left B
    for(int i = 0; i <= n; ++i) f[1][i] = (i == pos[1]? 0: (i < pos[1]? B: A));
    for(int i = 2; i <= n; ++i) { /// f(i, j) = sort 1 -> i, pos(i) in range (j, j + 1]
        mn = inf;
        for(int j = 0; j <= n; ++j) {
            /// f(i, j) min f(i - 1, k) k < j
            mn = min(mn, f[i - 1][j]);
            f[i][j] = mn + (j == pos[i]? 0: (j < pos[i]? B: A));
        }
    }
    cout << *min_element(f[n], f[n] + n + 1);
}

Measured memory_bytes: 196096
#include<stdio.h>

int main(void)
{
	int temp=0,sum1=0,sum2=0,i;
	
	for(i=0;i<8;i++)
	{
		scanf("%d",&temp);
		if(i<4)
		sum1+=temp;
		else
		sum2+=temp;
	}
	if(sum1>sum2||sum1==sum2)
	printf("%d\n",sum1);
	else
	printf("%d\n",sum2);
	
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;

int main() {
  int h, w;
  cin >> h >> w;
  char c[110][110];

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> c[i][j];
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cout << c[i][j];
    }
    cout << endl;
    for (int j = 0; j < w; j++) {
      cout << c[i][j];
    }
    cout << endl;
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, i;
    cin >> n;
    ll a1, a2 ,s;
    cin >> a1 >> a2;
    s = 0;
    for(i=0;i<n-2;i++){
        ll x; cin >> x;
        s ^= x;
    }
    /*
    min x | (a1 - x) ^ (a2 + x) = s  , 0 <= x < a1
    max a | a ^ b = s, a+b = a1+a2, 0 < a <= a1
    a+b = a^b + 2*(a&b) => 2*(a&b) = (a+b) - s
    ----
    a^b = s
    a&b = w
    => s&w = 0
    a = a' ^ w ,  b = b' ^ w , a' ^ b' = s, a' & b' = 0
    0 < a <= a1
    */
    ll rhs = a1+a2-s;
    if(rhs < 0 || rhs%2 != 0){
        cout << "-1\n";
        return 0;
    }
    ll w = rhs>>1;
    if(w&s){
        cout << "-1\n";
        return 0;
    }
    for(i=63;i>=0;i--){
        ll tmp = 1ll<<i;
        if((s & tmp) && (w + tmp <= a1)){
            w += tmp;
        }
    }
    if(w == 0 || w > a1){
        w = -1;
    }else{
        w = a1 - w;
    }
    cout << w << "\n";

    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <utility>
typedef long long lint;

using namespace std;

// input N


int main()
{

	lint N,M;
	cin >> N >> M;
	vector<lint> B(N) ;
	vector<lint> A(N) ;

	for (lint i = 0; i < N; i++) {
		cin >> A[i] >> B[i]; // A[i]円，B[i]本
	}

	// i本買う金==T[i]とする
	vector<lint> T(M+1,0); //initialize 0

	vector <pair<lint,lint>> AB;
	// AB.first,AB.secondでアクセス

	for (lint i = 0; i < N; i++) {
		AB.push_back(pair<lint,lint>(A[i],B[i]));
	}

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


	lint abindex = 0;
	for (lint i = 1; i <= M; i++) {
		//cout << i << endl;

		T[i] = T[i-1] + AB[abindex].first;
		AB[abindex].second --;
		if (AB[abindex].second <= 0) {
			abindex ++;
		}

	}


	cout << T[M] << endl;
	

	

	return 0;
}

Measured memory_bytes: 4724
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll N;
ll a[101010];

int main() {
  cin >> N;
  ll ans = 1;
  rep(i, 0, N) {
    cin >> a[i];
    if (a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  rep(i, 0, N) {
    ll A = a[i];
    if (A > 1000000000000000000 / ans) {
      cout << -1 << endl;
      return 0;
    }
    ans *= A;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4408
#include <iostream>
#include <string>
using namespace std;
int a,b;
string s;
int main(){
    cin>>a>>b>>s;
    for(int i=0;i<a+b+1;i++){
        if(s[i]=='-'^i==a){
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define SZ(x) ((int)(x).size())
#define MEM(x,a) memset(x,a,sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
const ll mod=1000000007,N=1e5+5,M=1e5+5,INF=0x3f3f3f3f;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//head

int main(void){
    int w,s;
    cin>>s>>w;
    cout<<(w>=s?"unsafe":"safe");
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, bool>;
const int INF = 1000000007;

int main() {
  int s;
  cin >> s;
  int a = s / 100;
  int b = s % 100;
  if ((a > 12 && b > 12) || (a == 0 && b > 12) || (a > 12 && b == 0) ||
      (a == 0 && b == 0))
    cout << "NA" << endl;
  else if (a <= 12 && b <= 12 && a != 0 && b != 0)
    cout << "AMBIGUOUS" << endl;
  else if (a > 12 || a == 0)
    cout << "YYMM" << endl;
  else
    cout << "MMYY" << endl;
}

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

using namespace std;

#define int long long
#define forn(i,n) for(int i = 0; i <(int)n; ++i)
const int MOD = 1000000007; // opsi : 998244353, 1000000007,

int32_t main()
{
    ios::sync_with_stdio(false);
    int n,k;
    cin >> n >> k;
    vector<int> arr(n);
    forn(i,n){
        cin >> arr[i];
    }

    sort(arr.begin(),arr.end());
    int ans = 0;
    forn(i,k){
        ans+=arr[i];
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
#include <cstdio>   
#define PI              acos(-1)
#define pb              push_back 
#define endl            "\n"
#define mostrar(x,y)    cout<<x<<" "<<y<<endl;
#define f               first
#define s               second
#define mod             1000000007
#define EPS             1e-9
#define llenar(a,val)   memset(a,val,sizeof(a))
using namespace std;
typedef pair<int,int> ii;
typedef pair<pair<int,int>,int> iii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef long long ll;
    



int main(){
    ofstream out("output.txt");
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    string n;
    cin>>n;
    int l = n.size();
    ll a = 0;
    int m = stoi(n);
    int aux[6];
    aux[0] = 0;
    aux[1] = 9;
    aux[2] = 0;
    aux[3] = 900;
    aux[4] = 0 ;
    aux[5] = 90000;
    aux[6] = 0;
    
    l%2==1?a += m - pow(10,l-1) + 1:a+=0;
    l--;
    while(l>=0){
        a += aux[l];
        l--;
    }
    cout<<a<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 4611686018427387903;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	int n; cin >> n;
	VI a(n); REP(i,n) cin >> a[i];
	ll sum=a[0];
	REP(i,n-1) sum^=a[i+1];
	REP(i,n)
		cout << (sum^a[i]) << ' ';
	cout << endl;
	return 0;
}


Measured memory_bytes: 4780
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <iostream>

using namespace std;

int main()
{
    int N,count = 0,x = 0,y = 0;
    cin >> N;
    for(int i = 0;i<N;i++){
        x+=800;
        count++;
        if(count == 15){
            y+=200;
            count = 0;
        }
    }
    cout << x-y << endl;
    return 0;
}


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

using namespace std;

#define MIN -1000000
#define MAX 1000000

int main()
{
	int n; 
	long long x, min = MAX, max = MIN, sum_nums = 0;
	
	scanf("%d", &n);
	
	for(int i = 0; i < n; i++)
	{
		scanf("%lld", &x);
		
		if(x < min)
			min = x;
		if(x > max)
			max = x;
		sum_nums += x;
	}
	
	printf("%lld %lld %lld\n", min, max, sum_nums);
	
	return 0;
}


Measured memory_bytes: 3220
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int h, w, s;
char pond[10][10];
char d[4] = { 'U','R','D','L' };
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
string out;
bool jump(int x,int y,int dir,int k) {
	if (k == s) {
		return true;
	}
	for (int i = -1; i <= 1; i++) {
		int dd = (dir + i + 4) % 4;
		int nx = x; int ny = y;
		while (nx >= 0 && ny >= 0 && nx < h&&ny < w) {
			if (pond[nx][ny] == 'o') {
				pond[nx][ny] = '.';
				if (jump(nx, ny, dd, k + 1)) {
					out.push_back(d[dd]);
					return true;
				}
				pond[nx][ny] = 'o';
				break;
			}
			nx += dx[dd]; ny += dy[dd];
		}
	}
	return false;
}
int main(){
	cin >> h >> w;
	int x, y, dd;
	rep(i, h) {
		rep(j, w) {
			cin >> pond[i][j];
			if (pond[i][j] == 'o')s++;
			else if (pond[i][j] != '.') {
				x = i; y = j;
				rep(k, 4) {
					if (d[k] == pond[i][j])dd = k;
				}
			}
		}
	}
	jump(x,y,dd,0);
	reverse(out.begin(), out.end());
	cout << out << endl;
	return 0;
}


Measured memory_bytes: 3216
#include<bits/stdc++.h>                          
using namespace std;
int n,a[110],ans=1e6;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=100;i++)
	{
		int x=0;
		for(int j=1;j<=n;j++) 
		    x+=(a[j]-i)*(a[j]-i);
		ans=min(ans,x);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import numpy as np
h,w=map(int,input().split())
m=np.zeros((h,w))
for i in range(h):
  for j,c in enumerate(list(input())):
    if c=='#':
      m[i,j]=-1
def dis(mc,i,j):
  if mc[i,j]!=0:return 0
  q=[(i,j,1)]
  mc[i,j]=-1
  while 0<len(q):
    i,j,x=q.pop(0)
    if i+1<h and mc[i+1,j]==0:
      mc[i+1,j]=x
      q.append((i+1,j,x+1))
    if i-1>=0 and mc[i-1,j]==0:
      mc[i-1,j]=x
      q.append((i-1,j,x+1))
    if j+1<w and mc[i,j+1]==0:
      mc[i,j+1]=x
      q.append((i,j+1,x+1))
    if j-1>=0 and mc[i,j-1]==0:
      mc[i,j-1]=x
      q.append((i,j-1,x+1))
  return np.max(mc)
max=0
for i in range(h):
  for j in range(w):
    mc = np.copy(m)
    tmp=dis(mc,i,j)
    if max<tmp:max=tmp
print(int(max))

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

using namespace std;

int main() {
    
    int n;
    cin >> n;
    set<int> s;
    for(int i = 0 ; i < n ; i++)
    {
        int x;
        cin >> x;
        s.insert(x);
    }
    if((int)s.size() == n)
      cout << "YES";
     else
      cout << "NO";

}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](long a, long b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<long>;
using vvi = vector<vi>;
using vs = vector<string>;
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/
int main() {
  ll k,a,b;
  cin >> k >> a>>b;
  REP(i, a, b+1){
    if(i%k==0){
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	int N, X;
	cin >> N >> X;
	auto count = 1;
	auto d = 0;
	for (auto i = 0; i < N; ++i)
	{
		int L;
		cin >> L;
		d += L;
		if (d <= X)
		{
			++count;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>

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

using namespace std;

int main(){
    cin.sync_with_stdio(false);
    int n,a,min=1234567899,d=0,cnt=0;
    cin >> n >> a;
    REP(i,n){
        cin >> a;
        if(min>a){
            min = a;
        }else if(d==a-min){
            ++cnt;
        }else if(d<a-min){
            d = a - min;
            cnt=1;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

# abcabcab 型が必要

from collections import Counter
S = input().rstrip()
counter = Counter(S)
a = counter['a']
b = counter['b']
c = counter['c']

x = max(a,b,c) - min(a,b,c)

answer = 'YES' if x in [0,1] else 'NO'
print(answer)



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

a=[]
n=n-1
while n > 25:
    a.append(n%26)
    n//=26
    n-=1

ans=""
for b in a:
    s=chr(ord('a')+b)
    ans+=s
ans+=chr(ord('a')+n)
for u in ans[::-1]:
    print(u,end="")
    

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

class P {
public:
    P(double _x, double _y): x(_x), y(_y) {}
    P(): x(0), y(0) {}
    double x;
    double y;
    P operator-(P p) {
        P point;
        point.x = x - p.x;
        point.y = y - p.y;
        return point;
    }
    P operator+(P p) {
        P point;
        point.x = x + p.x;
        point.y = y + p.y;
        return point;
    }
    P operator*(double k) {
        P point;
        point.x = x * k;
        point.y = y * k;
        return point;
    }
    double dot(P p) {
        return x * p.x + y * p.y;
    }
    double length() {
        return sqrt(x * x + y * y);
    }
};

P projection(P p1, P p2, P p) {
    P v1 = p - p1;
    P v2 = p2 - p1;
    double t = v1.dot(v2) / v2.length() / v2.length();
    return v2 * t + p1;
}

int main() {
    P p1, p2;
    cin >> p1.x >> p1.y >> p2.x >> p2.y;
    int q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        P p;
        cin >> p.x >> p.y;
        p = projection(p1, p2, p);
        cout << setprecision(15) << p.x << ' ' << p.y << endl;
    }
}



Measured memory_bytes: 3288
/*******************************
 * written by Koki Riho
 * Rih0z https://github.com/Rih0z
 *******************************/

#include<iostream>
#include<map>
#include<vector>
#include<string>
#include<numeric>
#include<algorithm>
#include<cmath>

#define DEBUG false

#define FOR(i , a, b) for(size_t i = a ; i < b ; i++ )
#define REP(i,b) FOR(i , 0 , b)
#define RFOR(i,a,b) for(size_t i = a-1 ; i >= b ; i--)
#define RREP(i,a) RFOR(i,a,0)



typedef long long ll;
using namespace std;

int scanInt(void);
string scanString(void);

void scanLlArr(ll *a , int n);
void scanCharArr(char *string);

void printInt(int p);
void printLlArr(ll *a);
void printCharArr(char *string);


void perSum(ll *a , ll *sum ,int n);

/*************Global variable  **************/
int N ;
char str[26];
std::map<char,int> M ;
/*******************************/

int main(){
  if (DEBUG){
    std::printf("******debug mode********\n");
  }
  int A,B,C,Y,X ;
  cin >> A >> B >> C >> X >> Y ;
  int com ;
  int ans ; 
  int comuse;
  int sep ;
  int on;
  if(X>=Y){
  on = C*X*2 ;
    com = Y;
    comuse = (com * C *2 )+ ( (X-com) *A);
  }else{
  on = C*Y*2 ;
    com = X;
    comuse = (com * C *2)+ ( (Y-com) *B);
  }


  sep = (A*X) + (B*Y);
  ans = min(comuse,sep);
  ans = min(ans,on);
  cout << ans <<  endl;

    return 0 ;
}

//各地点までの部分和を計算する
void perSum(ll *a , ll *sum ,int n){
  int i ;
  sum[0] = a[0];
  for(i = 1 ; i < n ; i++){
    sum[i] = a[i] + sum[i-1];
  }

}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

const ll M = 1000000007;

ll modpow(ll x,ll k){
	if(k == 0)return 1;
	ll ret = modpow(x,k/2);
	ret *= ret; ret %= M;
	if(k%2 == 1){
		ret *= x;
		ret %= M;
	}
	return ret;
}

int main(){
	ll n,a,b,c,d;
	cin >> n >> a >> b >> c >> d;
	
	ll fact[1002];
	ll inv[1002];
	ll C[1002];
	ll D[1002];
	fact[0] = 1;
	inv[0] = 1;
	for(int i = 1 ; i < 1002 ; i ++){
		fact[i] = fact[i-1]*i;
		fact[i] %= M;
		inv[i] = modpow(fact[i],M-2);
		C[i] = modpow(inv[i],c);
	}
	
	ll dp[2][1002] = {};
	dp[0][0] = fact[n];
	for(int i = a ; i <= b ; i ++){
		for(int j = 0 ; j <= n ; j ++){
			dp[1][j] = 0;
			ll x[1002];
			for(int k = c ; k <= d ; k ++){
				if(i*k > j)break;
				x[k] = modpow(inv[i],k)*inv[k];
				x[k] %= M;
			}
			for(int k = c ; k <= d ; k ++){
				if(i*k > j)break;
				dp[1][j] += dp[0][j-k*i]*x[k];
				dp[1][j] %= M;
			}
		}
		/*	if(j < i*c)dp[1][j] = 0;
			else {
				dp[1][j] = dp[1][j-i]*inv[i]+dp[0][j-c*i]*C[i];
				if(j >= i*(d+1))dp[1][j] += M-(dp[0][j-(d+1)*i]*modpow(inv[i],d+1))%M;
				dp[1][j] %= M;
			}
		}*/
		for(int j = 0 ; j <= n ; j ++){
			dp[0][j] += dp[1][j];
			dp[0][j] %= M;
		}
	}
	cout << dp[0][n] << endl;
}



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

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && b == c && a % 2 == 0)cout << -1 << endl;
    else {
        for (int i = 0; true; i++) {
            if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
                cout << i << endl;
                break;
            }

            int x = b / 2 + c / 2, y = c / 2 + a / 2, z = a / 2 + b / 2;
            a = x, b = y, c = z;
        }
    }
    return 0;
}

Measured memory_bytes: 256
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){return "";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var s = next();
  var N = s.length;
  
  var mae = "";
  var maeN = Math.floor(N / 2);
  var ato = "";
  var atoN = Math.ceil(N / 2);
  
  for(var i = 0; i < maeN; i++){
    mae += s[i];
  }
  for(var i = atoN; i < N; i++){
    ato += s[i];
  }
  myerr(mae + " " + ato);
  for(var i = 0; i < N; i++){
    myerr("i:" + i + ":" + s[i] + " j:" + (N - i - 1) + ":" + s[N - i - 1]);
    if(s[i] != s[N - i - 1]){
      myout("No");
      return;
    }
  }
  
  for(var i = 0; i < maeN; i++){
    myerr("i:" + i + ":" + mae[i] + " j:" + (maeN - i - 1) + ":" + mae[maeN - i - 1]);
    if(mae[i] != mae[maeN - i - 1]){
      myout("No");
      return;
    }
    myerr("i:" + i + ":" + ato[i] + " j:" + (maeN - i - 1) + ":" + ato[maeN - i - 1]);
    if(ato[i] != ato[maeN - i - 1]){
      myout("No");
      return;
    }
  }
  
  myout("Yes");
}

Measured memory_bytes: 9136
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var abc = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            var flag = false;

            if(abc[0] == abc[1] && abc[1] != abc[2]) {
                flag = true;
            }else if(abc[0] == abc[2] && abc[1] != abc[2]) {
                flag = true;
            }else if(abc[1] == abc[2] && abc[0] != abc[1]) {
                flag = true;
            }

            Console.WriteLine(flag ? "Yes" : "No");

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
const int maxn=2010;
const int t=15000;
int n,m,k,ans;
bool ac[3*t],ab[3*t],bc[3*t];
char a[maxn],b[maxn],c[maxn];
inline bool ok(char aa,char bb)
{
	if (aa==bb ||aa=='?' || bb=='?') return 1;
return 0;
}
int main()
{
	scanf("%s%s%s",a+1,b+1,c+1); ans=3*maxn;
	n=strlen(a+1); m=strlen(b+1); k=strlen(c+1);
	memset(ac,1,sizeof ac); memset(ab,1,sizeof ab); memset(bc,1,sizeof bc);
	for (int i=1;i<=n;++i)
	 for (int j=1;j<=m;++j) if (!ok(a[i],b[j])) ab[i-j+t]=0;
	for (int i=1;i<=n;++i)
	 for (int j=1;j<=k;++j) if (!ok(a[i],c[j])) ac[i-j+t]=0;
	for (int i=1;i<=m;++i)
	 for (int j=1;j<=k;++j) if (!ok(b[i],c[j])) bc[i-j+t]=0;
	for (int i=-4010;i<=4010;++i)
	 for (int j=-4010;j<=4010;++j)
	 if (ab[t-(1-i)] && ac[t-(1-j)] && bc[t-(i-j)])
	 {
	 	int l=min(1,min(i,j)),r=max(n,max(i+m-1,j+k-1));
	 	ans=min(ans,r-l+1);
	 }
	printf("%d\n",ans);
return 0;
}

Measured memory_bytes: 512
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
using namespace std;

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

  if(e - a <= k){
    cout << "Yay!" << endl;
  }
  else{
  cout << ":(" << endl;
  }
  
}



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


int main () {

    char m[5][5];


    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++) {
            scanf (" %c", &m[i][j]);
        }
    }
    for(int x=0; x<3; x++) {
        printf("%c", m[x][x]);
    }
    printf("\n");


    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=4000000000000000000;
const long double EPS=1e-9;
typedef pair<int,int> P;
struct Segtree{
    int n;
    vector<int> node;
    Segtree(int n_){
        n=1;
        while(n<n_)n*=2;
        node.assign(2*n,INF);
    }
    void update(int k,int x){
        k+=n-1;
        node[k]=x;
        while(k>0){
            k=(k-1)/2;
            node[k]=min(node[2*k+1],node[2*k+2]);
        }
    }
    int getmin(int a,int b,int k=0,int l=0,int r=-1){
        if(r<0)r=n;
        if(r<=a||b<=l)return INF;
        if(a<=l&&r<=b)return node[k];
        int vl=getmin(a,b,2*k+1,l,(l+r)/2);
        int vr=getmin(a,b,2*k+2,(l+r)/2,r);
        return min(vl,vr);
    }
};
int main(){
    int n;cin>>n;
    int a[200010],id[200010];
    priority_queue<pair<P,P>,vector<pair<P,P>>,greater<pair<P,P>>> q;
    Segtree tree1(n+1),tree2(n+1);
    for(int i=0;i<n;i++){
        cin>>a[i];
        id[a[i]]=i;
        if(i%2==0){
            tree1.update(i,a[i]);
        }else{
            tree2.update(i,a[i]);
        }
    }
    q.push(make_pair(P(tree1.getmin(0,n),id[tree1.getmin(0,n)]),P(-1,n)));
    vector<int> ans;
    while(!q.empty()){
        pair<P,P> p=q.top();q.pop();
        int idx=p.first.second,l=p.second.first,r=p.second.second;
        ans.push_back(p.first.first);
        int nl=idx+1,nr;
        if(idx%2==0){
            tree1.update(idx,INF);
            int mi=tree2.getmin(idx,r);
            ans.push_back(mi);
            tree2.update(id[mi],INF);
            nr=id[mi];
        }else{
            tree2.update(idx,INF);
            int mi=tree1.getmin(idx,r);
            ans.push_back(mi);
            tree1.update(id[mi],INF);
            nr=id[mi];
        }
        if(idx-l>2){
            if((l+1)%2==0){
                q.push(make_pair(P(tree1.getmin(l+1,idx),id[tree1.getmin(l+1,idx)]),P(l,idx)));
            }else{
                q.push(make_pair(P(tree2.getmin(l+1,idx),id[tree2.getmin(l+1,idx)]),P(l,idx)));
            }
        }
        if(nr-nl>=2){
            if(nl%2==0){
                q.push(make_pair(P(tree1.getmin(nl,nr),id[tree1.getmin(nl,nr)]),P(nl-1,nr)));
            }else{
                q.push(make_pair(P(tree2.getmin(nl,nr),id[tree2.getmin(nl,nr)]),P(nl-1,nr)));
            }
        }
        if(r-nr>2){
            if((nr+1)%2==0){
                q.push(make_pair(P(tree1.getmin(nr+1,r),id[tree1.getmin(nr+1,r)]),P(nr,r)));
            }else{
                q.push(make_pair(P(tree2.getmin(nr+1,r),id[tree2.getmin(nr+1,r)]),P(nr,r)));
            }
        }
    }
    for(int i=0;i<ans.size();i++){
        cout<<ans[i]<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 8692
/*    Don’t Quit
    
    When things go wrong as they sometimes will;
        When the road you’re trudging seems all uphill;
            When the funds are low, and the debts are high;
                And you want to smile, but you have to sigh;
                    When care is pressing you down a bit
                        Rest if you must, but don’t you quit.
*/
#pragma gcc optimize ("unroll-loop")
#pragma gcc optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=2e3+5;
int gcd(int n,int m)
{
    if(n==0)
        return m;
    else
        return gcd(m%n,n);
}
int prer[N][N],preu[N][N],prel[N][N],pred[N][N];
char s[N][N];
int32_t main()
{
    IOS;
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>s[i][j];
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i][j]=='.')
                prer[i][j]=prer[i][j-1]+1;
            else
                prer[i][j]=0;
        }
        for(int j=m;j>=1;j--){
            if(s[i][j]=='.')
                prel[i][j]=prel[i][j+1]+1;
            else
                prel[i][j]=0;
        }
    }
    for(int j=1;j<=m;j++){
        for(int i=1;i<=n;i++){
            if(s[i][j]=='.')
                preu[i][j]=preu[i-1][j]+1;
            else
                preu[i][j]=0;
        }
        for(int i=n;i>=1;i--){
            if(s[i][j]=='.')
                pred[i][j]=pred[i+1][j]+1;
            else
                pred[i][j]=0;
        }
    }
    int mx=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i][j]=='.')
                mx=max(mx,prer[i][j]+pred[i][j]+prel[i][j]+preu[i][j]-3);
        }
    }
    cout<<mx<<endl;


}


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

int main() {
  int N;
  1000 <= N <= 9999;

  cin >> N;
  if ((N%1000)%111 == 0 || N == 1000 || N%1110 < 10 ) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256