akhauriyash/Code-Regression huggingface dataset:
//In The Name Of GOD
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int inf = 2000000000;
const int maxn = 5000;
#define ll long long
#define pb push_back
#define mp make_pair
#define IO ios_base::sync_with_stdio(false);
int main(){
  IO;
  int n;
  cin>>n;
  int A[n],B[n/2],BB[n/2];
  for(int i=0;i<n;i++){
    cin>>A[i];
    if(!(i%2)){
      // cout<<i<<endl;
      B[i/2]=A[i];
    }
  }
  sort(A,A+n);
  for(int i=0;i<n;i++){
    if(!(i%2)){
      BB[i/2]=A[i];
    }
  }
  int m=(n+1)/2,i=0,j=0,ans=0;
  sort(B,B+m);
  sort(BB,BB+m);
  // for(int i=0;i<(n+1)/2;i++){
  //   cout<<B[i]<<' '<<BB[i]<<endl;
  // }
  while(i<m&&j<m){
    if(B[i]==BB[j]){
      i++;j++;ans+=1;
      // cout<<"/hi";
    }else if(B[i]<BB[j]){
      i++;
    }else{
      j++;
    }
  }
  cout<<m-ans;
}


Measured memory_bytes: 1024
public class Main {

	public static void main(String[] args) {
		java.util.Scanner scanner = new java.util.Scanner(System.in);
		
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		
		System.out.print( a * b +" ");
		System.out.println(2 * ( a + b ));

	}

}

Measured memory_bytes: 26124
#include "bits/stdc++.h"
#define rep(i,n) for(ll i=0;i<(n);i++)
using namespace std;
using ll = long long;

int main() {
	string s, t;
	cin >> s >> t;
	int n = s.size();
	int ans = 0;
	rep(i, n) {
		if (s[i]!= t[i]) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int N;
vector< int > I;
int S, A, C;

int R(int i) {
  if(i == 0) return(S);
  return((A * R(i - 1) + C) % 256);
}
int O(int i) {
  return((I[i - 1] + R(i)) % 256);
}

int main() {
  while(cin >> N, N){ 
    I.resize(N);
    for(int i = 0; i < N; i++) {
      cin >> I[i];
    }

    const int INF = 1 << 30;
    double RH = INF;
    int RS, RA, RC;
    for(int SS = 0; SS <= 15; ++SS) {
      for(int AA = 0; AA <= 15; ++AA) {
        for(int CC = 0; CC <= 15; ++CC) {

          S = SS, A = AA, C = CC;
          vector< int > HAETA(256, 0);
          for(int M = 1; M <= N; M++) ++HAETA[O(M)];

          double ret = 0;
          for(int i = 0; i < 256; i++) {
            if(HAETA[i] == 0) continue;
            ret -= ((double)HAETA[i] / N) * log((double)HAETA[i] / N);
          }
          if(ret + 1e-8 < RH) {
            RH = ret;
            RS = S;
            RA = A;
            RC = C;
          }
        }
      }
    }
    cout << RS << " " << RA << " " << RC << endl;
  }
}

Measured memory_bytes: 1260
#include <iostream>

int main() {
    char b;
    std::cin >> b;

    char ans = ' ';
    switch (b){
        case 'A' :
            ans = 'T';
            break;
        case 'C' :
            ans = 'G';
            break;
        case 'G' :
            ans = 'C';
            break;
        case 'T' :
            ans = 'A';
            break;
        default:;
    }
    std::cout<< ans << std::endl;
}

Measured memory_bytes: 256
import sys

input_array = input().split()
takahashi_tairyoku = int(input_array[0])
takahashi_kougeki = int(input_array[1])
aoki_tairyoku = int(input_array[2])
aoki_kougeki = int(input_array[3])

while(1):
  aoki_tairyoku -= takahashi_kougeki
  if(aoki_tairyoku <= 0):
    print('Yes')
    sys.exit()
  else:
    takahashi_tairyoku -= aoki_kougeki
    if(takahashi_tairyoku <= 0):
      print('No')
      sys.exit()


Measured memory_bytes: 9108
#include<iostream>
#include<algorithm>
using namespace std;
static const int N=100;
int main(){
  int n,p[N+1],m[N+1][N+1];
  cin >> n;
  for(int i=1;i<=n;i++){
    cin >> p[i-1] >> p[i];
  }
  for(int i=1;i<=n;i++) m[i][i]=0;
  for(int l=2;l<=n;l++){
    for(int i=1;i<=n-l+1;i++){
      int j=i+l-1;
      m[i][j]=(1<<21);
	for(int k=i;k<=j-1;k++){
	  m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
        }
    }
  }
  cout << m[1][n] << endl;
  return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define input(str) cin >> str;
#define output(str) cout << str << endl;

int main()
{
    double N, T;
    input(N)
    T = 1.08;

    double A = N / T;

    int Ah = ceil(A) * T;
    int Al = floor(A) * T;

    if (Ah == N || Al == N)
    {
        int C = (Ah == N) ? ceil(A) : (Al == N) ? floor(A) : 0;
        output(C)
    }
    else
    {
        output(":(")
    }
}

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

using namespace std;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main(){
	int n, q;
	cin >> n >> q;
	string s;
	cin >> s;
	vector<int> pos;
	REP(i, s.size()-1) if(s.substr(i,2) == "AC") pos.pb(i);
	REP(i, q){
		int a, b;
		cin >> a >> b;
		a--;
		b--; b--;
		cout << upper_bound(ALL(pos), b) - lower_bound(ALL(pos), a) << endl;
	}
	return 0;
} 


Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  long long H;
  int N;
  cin >> H >> N;
  
  vector<int> A(N);
  
  for(int i = 0;i < N;++i){
    cin >> A[i];
  }
  
  sort(A.begin(),A.end());
  
  reverse(A.begin(),A.end());
  
  long long num = 0LL;
  
  for(int i = 0;i < N;++i){
    num = num + A[i];
  }
  
  if(num >= H){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 640
all_b = "bbb"
all_w = "www"
while True:
  r1 = input()
  if r1 == "0":
    break
  r2 = input()
  r3 = input()
  cands = [r1, r2, r3]
  for i in range(3):
    col = r1[i] + r2[i] + r3[i]
    cands.append(col)
  cands.append(r1[0] + r2[1] + r3[2])
  cands.append(r1[2] + r2[1] + r3[0])
  for cand in cands:
    if cand == all_b:
      print("b")
      break
    elif cand == all_w:
      print("w")
      break
  else:
    print("NA")


Measured memory_bytes: 5560
/*                          The four Truths of Life

                                    CKMKB
                                    PKMKB

                                    CKMKC
                                    PKMKC
*/


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define ye cout<<"YES";
#define no cout<<"NO";
#define ln cout<<"\n";
// cout<<"Case #"<<ts<<": “;
//priority_queue < pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;


using namespace std;

ll mod(ll x, ll m) {
	return (x % m + m) % m;
}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll t = 1, r, n, a, d, c, b, x, y, sum, cnt, i, j, k, m, l, q, maxx, minn, temp, ans, flag, g, ts;
	ll mod = 1000000007;
	char ch, chh;
	double dans;
	string str, ttr;

	//cin >> t;


	for (ts = 1; ts <= t; ts++)
	{
		flag = 0; sum = 0; cnt = 0; ans = 0; k = 0; maxx = 0; minn = 0; a = 0; b = 0; temp = 0;

		cin >> n >> m >> k;
		//ll arr[n]; for (i = 0; i < n; i++) {cin >> arr[i];}

		for (i = n; i <= m; i++)
		{
			if (i % k == 0)
				cnt++;
		}

		cout << cnt;




		ln
	}
	return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,s,ans;
    vector<int> v;
    while(cin >> n) {
        v = vector<int>(n); s = 0;
        for(int i = 0; i < n; i++) {
            cin >> v[i];
            s += v[i];
        }
        s = round(s*1./n); ans = 0;
        for(int i = 0; i < n; i++) {
            ans += (s-v[i])*(s-v[i]);
        }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
from copy import deepcopy
n = int(input())
s = [input() for _ in range(n)]
cnt = []

for si in s:
    tmp = [0] * 26
    for i in range(len(si)):
        tmp[ord(si[i])-97] += 1
    if cnt == []:
        cnt = deepcopy(tmp)
    else:
        for j in range(26):
            cnt[j] = min(cnt[j], tmp[j])

ans = ''
for i in range(26):
    for j in range(cnt[i]):
        ans += chr(i+97)
print(ans)


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

ll a[MAXN], b[MAXN];

void solve(){
	int n;
	scanf("%d", &n);
	REP(i, 0, n) {
		scanf("%lld", &a[i]);
	}
	REP(i, 0, n) {
		scanf("%lld", &b[i]);
	}
	//sort(a, a + n);
	//sort(b, b + n);
	ll sa = 0ll, sb = 0ll;
	REP(i, 0, n) {
		if (a[i] > b[i]) {
			sb += a[i] - b[i];
		} else {
			sa += (b[i] - a[i]) / 2;
		}
	}
	if (sa >= sb) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

bool judge_kaibun(string s)
{
    bool ret = true;
    
    int N = (int)s.size();
    
    for (int i = 0; i < N/2; i++) {
        if (s[i] != s[N-1-i]) {
            ret = false;
            break;
        }
    }
    
    return ret;
}

int main(int argc, const char * argv[]) {
    string S;
    cin >> S;

    if (!judge_kaibun(S)) {
        std::cout << "No";
        return 0;
    }
    
    int N = (int)S.size();
    
    string s0 = "";
    for (int i = 0; i < (N-1)/2; i++) {
        s0 += S[i];
    }
    if (!judge_kaibun(s0)) {
        std::cout << "No";
        return 0;
    }
    
    string s1 = "";
    for (int i = (N+3)/2 - 1; i < N; i++) {
        s1 += S[i];
    }
    if (!judge_kaibun(s1)) {
        std::cout << "No";
        return 0;
    }

    std::cout << "Yes";
    return 0;
}


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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            var N = a[0];
            var K = a[1];
            var H = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse).OrderByDescending(c => c).ToArray();

            for (int i = 0; i < K; i++)
            {
                if (i < H.Length)
                {
                    H[i] = 0;
                }
                else
                {
                    break;
                }
            }

            Console.WriteLine(H.Sum());
        }
    }
}


Measured memory_bytes: 39184
import math
N = int(input())

a1  = N // 10
a2  = N // 100
a3  = N // 1000
a4  = N // 10000
a5  = N // 100000
a6  = N // 1000000
a7  = N // 10000000
a8  = N // 100000000
a9  = N // 1000000000
a10 = N // 10000000000
a11 = N // 100000000000
a12 = N // 1000000000000
a13 = N // 10000000000000
a14 = N // 100000000000000
a15 = N // 1000000000000000
a16 = N // 10000000000000000
a17 = N // 100000000000000000
a18 = N // 1000000000000000000
a19 = N // 10000000000000000000

b1  = (N // 50) - a2
b2  = (N // 250  ) - a3
b3  = (N // 1250 ) - a4
b4  = (N // ((5**4)*10) ) - a5
b5  = math.ceil(N // ((5**5)*10 )) - a6
b6  = math.ceil(N // ((5**6)*10 )) - a7
b7  = math.ceil(N // ((5**7)*10 )) - a8
b8  = math.ceil(N // ((5**8)*10 )) - a9
b9  = math.ceil(N // ((5**9)*10 )) - a10
b10 = math.ceil(N // ((5**10)*10) ) - a11
b11 = math.ceil(N // ((5**11)*10) ) - a12
b12 = math.ceil(N // ((5**12)*10) ) - a13
b13 = math.ceil(N // ((5**13)*10) ) - a14
b14 = math.ceil(N // ((5**14)*10) ) - a15
b15 = math.ceil(N // ((5**15)*10) ) - a16
b16 = math.ceil(N // ((5**16)*10)) - a17
b17 = math.ceil(N // ((5**17)*10) ) - a18
b18 = math.ceil(N // ((5**18)*10) ) - a19
b19 = math.ceil(N // ((5**19)*10) )
b20 = math.ceil(N // ((5**20)*10) )
b21 = math.ceil(N // ((5**21)*10) )
b22 = math.ceil(N // ((5**22)*10) )
b23 = math.ceil(N // ((5**23)*10) )
b24 = math.ceil(N // ((5**24)*10) )
b25 = math.ceil(N // ((5**25)*10) )
b26 = math.ceil(N // ((5**26)*10) )


ans = a1*1 + a2*1+ a3*1+ a4*1 + a5*1+ a6*1+ a7*1+ a8*1+ a9*1+ a10*1+ a11*1+ a12*1+ a13*1+ a14*1+ a15*1+ a16*1+ a17*1+ a18*1+ a19*1
ans = ans + b1*1 + b2*1+ b3*1+ b4*1 + b5*1+ b6*1+ b7*1+ b8*1+ b9*1+ b10*1+ b11*1+ b12*1+ b13*1+ b14*1+ b15*1+ b16*1+ b17*1+ b18*1 + b19+b20+b21+b22+b23+b24+b25

if N % 2 == 1:
  print(0)
else:
  print(ans)

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

using namespace std;

const int MAXN=105;
int n;
int a[MAXN];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d",&a[i]);
	int ans=0,vcnt=n;
	for(int i=2;i<=n;++i){
		if(a[i]==a[i-1]) a[i]=++vcnt,++ans;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string s;
  cin >> s;
  for (auto c : s) {
    if (c == ',')
      cout << " ";
    else
      cout << c;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3604
import java.util.*;
import java.lang.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        while (true) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            if (x == 0 && y == 0) {
                break;
            }
            if (x < y) {
                System.out.println(x + " " + y);
            } else {
                System.out.println(y + " " + x);
            }
        }
    }
}


Measured memory_bytes: 35844
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

ll DP[3005][3005];

int main() {
  int N, S;
  cin>>N>>S;
  int tmp;
  for(int i=0;i<N;++i) {
    cin>>tmp;
    DP[i][0]++;
    DP[i][0] %= mod1;
    if(i==0) {
      DP[0][tmp]++;
    }
    else {
      DP[i][tmp]++;
      for(int j=0;j<=S;++j) {
        DP[i][j] += DP[i-1][j];
        DP[i][j] %= mod1;
        if(j+tmp<=S) {
          DP[i][j+tmp] += DP[i-1][j];
          DP[i][j+tmp] %= mod1;
        }
      }
    }
  }
  ll ans = 0;
  for(int i=0;i<N;++i) {
    ans += DP[i][S];
    ans %= mod1;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 74012
I=lambda:list(map(int,input().split()))
a=int(input())
b=int(input())
x=[1,2]
y=[1,3]
z=[2,3]
aa=[a,b]
aa.sort()
if aa==x:
    print(3)
elif aa==y:
    print(2)
elif aa==z:
    print(1)

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

#define vi vector<int>
#define vii vector<int, int>
#define ll long long
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
#else
#define trace(...) 42
#endif

const int MOD = 1000000007;

int main(){
    IOS;

    int k, x;
    cin >> k >> x;

    if (k * 500 >= x) cout << "Yes" << endl;
    else cout << "No" << endl;


    #ifdef LOCAL
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif

    return 0;
}



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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

ll solve(ll d, vector<ll>& c, vector<vector<ll>>& s, vector<ll>& t)
{
    ll i,j;
    vector<ll> last(26,0);
    ll ans = 0;
    for(i = 0;i < d;++i){
        ans += s.at(i).at(t.at(i));
        last.at(t.at(i)) = i+1;
        rep(j,26){
            ans -= c.at(j)*(i+1 - last.at(j));
        }
    }
    return ans;
}


int main()
{
    ll i,j;
    ll d;
    cin >> d;
    vector<ll> c(26);
    for(i = 0;i < 26;++i){
        cin >> c.at(i);
    }
    vector<vector<ll>> s(d,vector<ll>(26));
    for(i = 0;i < d;++i){
        rep(j,26){
            cin >> s.at(i).at(j);
        }
    }
    vector<ll> t(d);
    for(i = 0;i < d;++i){
        cin >> t.at(i);
        --t.at(i);
    }
    ll m;
    cin >> m;
    for(i = 0;i < m;++i){
        ll day, query;
        cin >> day >> query;
        --query;
        t.at(day-1) = query;
        ll ans = solve(d, c, s, t);
        cout << ans << endl;
    }

    return 0;
}

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

int main(){
  long long N, D;
  cin >> N >> D;
  int result = 0;
  for(int i = 0; i < N; i++){
    long long X, Y;
    cin >> X >> Y;
    if(X*X + Y*Y <= D*D){
      result ++;
    }
  }
  cout << result << endl;
}


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

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main() {
  string s;
  cin >> s;
  int N = s.size();
  bool flag = true;
  rep(i, N) {
    if (s[i] != s[N-i-1]) {
      flag = false;
      break;
    }
  }
  int a, b;
  a = 0;
  b = (N-1)/2;
  rep(i, b-a) {
    if (s[a+i] != s[b-i-1]) {
      flag = false;
      break;
    }
  }
  a = (N+3)/2 - 1;
  b = N;
  rep(i, b-a) {
    if (s[a+i] != s[b-i-1]) {
      flag = false;
      break;
    }
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}



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

int main(){
  int n;
  cin >> n;
  vector<bool> prime(222220,true);
  for(int i=2; i<=222220; ++i) for(ll j=(ll)i*i; j<=222220; j += i){
    prime[j] = false;
  }
  vector<int> ans(n);
  int num = 0;
  for(int i=11; i<=55555; i += 5){
    if(!prime.at(i)) continue;
    ans[num] = i;
    ++num;
    if(num == n) break;
  }
  for(int i=0; i<n; ++i){
    if(i != n-1)cout << ans[i] << " ";
    else cout << ans[i] << endl;
  }
}

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

using namespace std;

#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
#define deb(x) cout << x << endl
#define done(x) {cout << x << endl;return;}
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<pair<int,int>> spii;
typedef queue<int> qi;


const int N = 5e5+5;


void solve() {

  int n,x=0,is_small=0;
  cin>>n;
  vi a(n);
  rep(i,0,n)
    cin>>a[i];
  rep(i,2,n)
    x^=a[i];
  int sum = a[0]+a[1];
  if(((sum^x)&1) || sum<x)
    done(-1)
  int y = (sum-x)/2;
  if(y&x)
    done(-1)
  int b = y;
  frev(i,0,50){
    if(x>>i&1){
    int can = b|(1ll<<i);
    if(can<=a[0])
      b=can;
    }
    
   }
   if(!b||b>a[0])
     done(-1)
   cout<<a[0]-b<<endl;
   /*cout<<x<<endl;
   cout<<(b^(sum-b))<<endl;
   cout<<x<<" "<<y;*/
}


signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(15);
    int t = 1;
   //cin >> t;

    while (t--)
        solve();
#ifdef aa
    cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


int powm(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1)
            res = (res*a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}


int divide(int a, int b) {
    return (a % mod) * powm(b, mod - 2) % mod;
}




int norm(int a) {
    while (a >= mod) a -= mod;
    while (a < 0) a += mod;
    return a;
}


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

Measured memory_bytes: 3628
import sys
from collections import Counter
def input() : return sys.stdin.readline().strip()

def main():
    N = int(input())
    S = input()
    c = Counter(S)
    r = c["R"]
    g = c["G"]
    b = c["B"]

    all_num = r*g*b
    sub = 0
    for i in range(N):
        for j in range(i+1, N):
            if S[i] == S[j]: continue
            k = j + (j - i)
            if k >= N or S[k] == S[i] or S[k] == S[j]: continue
            sub += 1
    print(all_num - sub)

if __name__ == "__main__":
    main()

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

char cmd[105];

int main(){

int u,s,e,w,n,d;

scanf("%d %d %d %d %d %d",&u,&s,&e,&w,&n,&d);
scanf("%s",cmd);

int len = strlen(cmd);


for(int i=0;i<len;i++){
	if(cmd[i] == 'S'){

		int temp2 = d;
		int temp4 = u;

		u = n;
		d = s;
		s = temp4;
		n = temp2;

			

	}
	if(cmd[i] == 'E'){
		int temp1 = u;
		int temp2 = d;
	

		u = w;
		d = e;
		e = temp1;
		w = temp2;

			

	}
	if(cmd[i] == 'N'){
		int temp1 = u;
		int temp2 = d;
		

		u = s;
		s = temp2;
		d = n;
		n = temp1;

			

	}
	if(cmd[i] == 'W'){
		int temp1 = u;
		int temp2 = d;
		
		u = e;
		d = w;
		e = temp2;
		w = temp1;

		



	}
}

printf("%d\n",u );


	return 0;
}


Measured memory_bytes: 2100
lst=[int(c) for c in input()]

for i in range(8):
    s=str(lst[0])
    cnt=lst[0]
    idx=1
    while idx<4:
        res=i%2
        if res==0:
            s+='+'+str(lst[idx])
            cnt+=lst[idx]
        else:
            s+='-'+str(lst[idx])
            cnt-=lst[idx]
        i//=2
        idx+=1
    if cnt==7:
        s+='=7'
        print(s)
        break


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

int main() {
  int x,y,size; 
  int field[10][10];
  int dx[] = { 0,0,-1,1,-1,-1,1,1,0,0,-2,2};
  int dy[] = { -1,1,0,0,-1,1,-1,1,-2,2,0,0};
  for ( int i = 0; i < 10; i++ ) {
    for ( int j = 0; j < 10; j++ ) {
      field[i][j] = 0;
    }
  }

  while ( scanf("%d,%d,%d",&x,&y,&size) != EOF ) {
    field[y][x]++;   
    
    for ( int i = 0; i < size*4; i++ ) {
      int mx = x + dx[i];
      int my = y + dy[i];
      if ( mx >= 0 && mx < 10 && my >= 0 && my < 10 ) {
	field[my][mx]++;
      }
    }

  }
 
  int cnt = 0,maxv = 0;

  for ( int i = 0; i < 10; i++ ) {
    for ( int j = 0; j < 10; j++ ) {
      if ( field[i][j] == 0 ) cnt++;
      maxv = max(maxv,field[i][j]);
    }
  }

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

Measured memory_bytes: 1204
#include <iostream>
#include <string>
using namespace std;
int main() {
	bool f = false;
	string s, ans[10] = {
		"* = ****",
		"* =* ***",
		"* =** **",
		"* =*** *",
		"* =**** ",
		" *= ****",
		" *=* ***",
		" *=** **",
		" *=*** *",
		" *=**** "
	};
	while(cin >> s) {
		if(f) {
			cout << endl;
		}
		else {
			f = true;
		}
		while(s.size() < 5) {
			s = '0' + s;
		}
		for(int i = 0; i < 8; ++i) {
			for(int j = 0; j < 5; ++j) {
				cout << ans[s[j] - '0'].at(i);
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 1188
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

typedef long long ll;

int main(){
  ll N, M, K;
  std::cin >> N >> M >> K;
  std::vector<ll> A_acc(N + 1);
  std::vector<ll> B_acc(M + 1);
  for(int i = 1 ; i <= N  ; i++){
    std::cin >> A_acc[i];
    A_acc[i] += A_acc[i - 1];
  }
  for(int i = 1 ; i <= M  ; i++){
    std::cin >> B_acc[i];
    B_acc[i] += B_acc[i - 1];
  }
  ll max= 0;
  for(int i = 0 ; i <= N && A_acc[i] <= K; i++){
    ll j = std::upper_bound(B_acc.begin(), B_acc.end(), K - A_acc[i]) - B_acc.begin();
    if(max <= j + i - 1) max = j + i - 1;
  }
  std::cout << max << std::endl;
  return 0;
}


Measured memory_bytes: 6424
#include <cstdio>
#include <cstring>

int main() {
	while (true) {
		int n, r;

		scanf("%d %d", &n, &r);

		if (n == 0) break;

		char s[50];
		char b[50];
		for (int i = 0; i < n; i++) s[i] = n - i;

		for (int i = 0; i < r; i++) {
			int p, c;
			scanf("%d %d", &p, &c);

			memmove(b, s + p - 1, c);
			memmove(s + c, s, p - 1);
			memmove(s, b, c);
		}

		printf("%d\n", s[0]);
	}

	return 0;
}

Measured memory_bytes: 1060
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

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

  vi nums;
  int now = 1;
  int cnt = 0;
  // 1-0-1-0-1の形の配列を作る
  // 0番目の区間が0なら、(1,0)が先頭に追加される
  // 0番目の区間が1なら、そのまま数えられる
  rep(i,n) {
    if (s[i] == (char)('0' + now)) cnt++;
    else {
      nums.pb(cnt);
      now = 1 - now;
      cnt = 1;
    }
  }
  // 最後の区間がまだついていないので付け加える
  if (cnt != 0) nums.pb(cnt);
  // numsのサイズが偶数の場合、1-0-1-0の形になってしまっているので、
  // 後ろに(1,0)を追加して、1-0-1-0-1の形にする
  if (nums.size()%2 == 0) nums.pb(0);

  // k = 1: 1-0-1 -> 1-1-1
  //                 |   |
  //                 l   l+2*k
  // k = 2: 1-0-1-0-1 -> 1-1-1-1-1
  //                     |       |
  //                     l       l+2*k
  int add = 2*k + 1;
  int ans = 0;

  int left = 0, right = 0;
  int tmp = 0; // [left, right)のsum
  // 1-0-1...の1から始めるので、偶数番目だけ見る
  for (int i = 0; i < nums.size(); i+=2) {
    int nextleft = i;
    int nextright = min(i+add, (int)nums.size());
    
    // 左端を移動する
    while (left < nextleft) tmp -= nums[left++];
    // 右端を移動する
    while (right < nextright) tmp += nums[right++];

    ans = max(tmp, ans);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1020
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

bool isEvenStr(string ss) {
  bool res = false;
  int len = ss.size() / 2;
  if (ss.size() % 2 == 0) {
    if (ss.substr(0, len) == ss.substr(len, len)) {
      res = true;
    }
  }
  return res;
}

int main() {
  string s;
  cin >> s;
  s[5] = ' ';
  s[13] = ' ';
  cout << s << endl;
  return 0;
}


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

int main(void)
{
    int a, b;
    char buf[256], rel[3];
    rel[2] = '\0';
    fgets(buf, 256, stdin);
    buf[255] = '\0';
    sscanf(buf, "%d %d", &a, &b);

    a = a - b;
    if (a)
    {
        if (a & 0x80000000)
            rel[0] = '<';
        else
            rel[0] = '>';
        rel[1] = 0;
    }
    else
        memset(rel, '=', 2);
    printf("a %s b\n", rel);
    return 0;
}



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

int main() {
	int n, m, x, y, ma = -101, mi = 101;
	cin >> n >> m >> x >> y;
	ma=max(x,ma);
	mi=min(y,mi);
	vector<int> a(n), b(m);
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
		ma = max(a.at(i), ma);
	}
	for (int i = 0; i < m; i++) {
		cin >> b.at(i);
		mi = min(b.at(i), mi);
	}
	if(ma<mi){
		cout<<"No War"<<endl;
	}else{
		cout<<"War"<<endl;
	}
	return 0;
}



Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main(){
    let (a,b,c,d) = (read::<i32>(),read::<i32>(),read::<i32>(),read::<i32>());
    println!("{}",if ((a-b).abs()<=d && (c-b).abs()<=d) || (a-c).abs()<=d {"Yes"} else{"No"});
}
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin.bytes().map(|c| c.expect("Error") as char) 
        .skip_while(|c| c.is_whitespace()).take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("Error")
}

Measured memory_bytes: 4352
a, b, c = gets.split.map(&:to_i)
if a > b
    t = a
    a = b
    b = t
end
if a > c
    t = a
    a = c
    c = t
end
if b > c
    t = b
    b = c
    c = t
end
print a
print " "
print b
print " "
puts c

Measured memory_bytes: 8612
#include <bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353
#define MEM_SIZE 101010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template <typename T>
void DEBUG(T e)
{
  if (DEBUG_OUT == false)
    return;
  std::cout << e << " ";
}
template <typename T>
void DEBUG(const std::vector<T> &v)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &e : v)
  {
    std::cout << e << " ";
  }
  std::cout << std::endl;
}
template <typename T>
void DEBUG(const std::vector<std::vector<T>> &vv)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &v : vv)
  {
    DEBUG(v);
  }
}
template <class T, class... Ts>
void DEBUG(T d, Ts... e)
{
  if (DEBUG_OUT == false)
    return;
  DEBUG(d);
  DEBUG(e...);
}
template <class T>
void corner(bool flg, T hoge)
{
  if (flg)
  {
    cout << hoge << endl;
    abort();
  }
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  int n, m;
  cin >> n >> m;
  vector<int> vec(n, 0);
  for (int i = 0; i < n; i++)
  {
    cin >> vec[i];
  }
  // midをの幸福度
  sort(ALL(vec));
  vector<int> s(n + 1, 0);
  for (int i = 0; i < n; i++)
  {
    s[i + 1] = s[i] + vec[i];
  }
  auto calc = [&](int x) {
    //合計がx以上になるのが何個あるのか
    int tot = 0;
    int num = 0;
    for (int i = 0; i < n; i++)
    {
      int j = lower_bound(ALL(vec), x - vec[i]) - vec.begin();
      num += n - j;
      tot += s[n] - s[j];
      tot += vec[i] * (n - j);
    }
    return make_pair(tot, num);
  };

  int l = 0, r = INF;
  while (abs(r - l) > 1)
  {
    int mid = (r + l) / 2;
    if (calc(mid).second >= m)
      l = mid;
    else
      r = mid;
  }
  auto p = calc(l);
  int res = p.first;
  res -= (p.second - m) * l;//m個に調整する
  cout << res << endl;

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


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

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)


void func(std::string S, std::string T){
    cout << T+S << endl;
}

int main(){
    // cout << fixed << setprecision(5);

    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    func(S, T);
    return 0;
}


Measured memory_bytes: 256
import sys

alphabets = "abcdefghijklmnopqrstuvwxyz"
S = input()
mp = {}

for s in S:
    if s in mp.keys():
        mp[s] = mp[s] + 1
    else:
        mp[s] = 1

def idx(c):
    if len(c) != 1:
        print("error")
        return None # invalid
    for i, e in enumerate(alphabets):
        if c == e:
            return i
    print("error")
    return None # invalid

# 使われてない文字がある場合
unused = []
for a in alphabets:
    if a not in mp.keys():
        unused.append(a)
        
if len(unused) > 0:
    print(S + unused[0])
    sys.exit(0)

# 先頭から探していく
pos = len(S) - 1
while True:
    if pos == 0:
        print(-1)
        sys.exit()
    x = S[pos-1]
    y = S[pos]
    if idx(x) < idx(y):
        # 書き換え
        minc = 'z'
        unused.append(y)
        for c in unused:
            if idx(minc) > idx(c) and idx(c) > idx(x):
                minc = c
        print(S[:pos-1] + minc)
        sys.exit()
    else:
        unused.append(y)

    # update
    pos = pos - 1

"""
abcdefghijklmnopqrstuvwzyx
abcdefghijklmnopqrstuvzyxw
azyxwvutsrqponmlkjihgfedcb
"""

Measured memory_bytes: 3064
N, M = list(map(int, input().split()))
H = [0,] + list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(M)]
B = [1] * N
for i in range(M):
    if H[A[i][0]] < H[A[i][1]]:
        B[A[i][0] - 1] = 0
    elif H[A[i][0]] > H[A[i][1]]:
        B[A[i][1] - 1] = 0
    else:
        B[A[i][0] - 1] = 0
        B[A[i][1] - 1] = 0
print(sum(B))


Measured memory_bytes: 94084
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    
           int n;
           cin >>n;

    vector<int> vec(n+1);
  vec[0]=0;
 
  int k=1;
  int cnt=n;
    for (int i = 1; i <=n; i++) {
        cin>> vec.at(i);
    }
  
 bool A=false;
  for(int i=1;i<=n;i++){
  if(vec[i]==k){
    A=true;
    k++;
   cnt--;
 }

  }
if(A)cout<<cnt<<endl;
  else cout <<"-1"<<endl;
  
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define pll pair<ll,ll>
#define pii pair<int,int>
#define F first
#define S second
const int maxn = 1e6 + 5;
const int mod = 998244353;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    for (auto &i : s) {
        if (i == '?') {
            i = 'D';
        }
    }
    cout << s << '\n';
}

Measured memory_bytes: 3744
#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<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
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;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

    int a,b;
    cin >>a>>b;
    if((a*b)%2==0)cout<<"Even"<<endl;
    else cout<<"Odd"<<endl;

    
  
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
int main() {
    int n;
    cin>>n;
    cin.ignore();
    string s;
    cin>>s;
    vector<vector<ll>> dp(3003,vector<ll>(3003,0));
    dp[1][1]=1;
    for(int i=2;i<=n;i++)
    {
        if(s[i-2]=='<')
        {
            for(int j=1;j<=i;j++)
            {
                dp[i][j] = (dp[i][j-1]%mod + dp[i-1][j-1]%mod)%mod;
            }
        }
        else
        {
            for(int j=i;j>=1;j--)
            {
                dp[i][j] = (dp[i-1][j]%mod+dp[i][j+1]%mod)%mod;
            }
        }
    }
    ll ans = 0;
    for(int i=1;i<=n;i++)
    ans = (ans%mod + dp[n][i]%mod)%mod;
    cout<<ans;
}


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

ll GetDigit(ll num)
{
  return log10(num) + 1;
}

//実行部
void Main()
{
  ll a, b, c, d; cin >> a >> b >> c >> d;
  fin(min(a, b) + min(c, d))
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
def judge(n,hs):

    stack = []
    ans = 0

    for i, h in enumerate(hs):
        j = -1
        while stack and stack[-1][1] > h:
            j, h2 = stack.pop()
            ans = max(ans, (i - j) * h2)
        if not stack or stack[-1][1] < h:
            stack.append((i if j == -1 else j, h))
    ans = max(ans, max((n - j) * h2 for j, h2 in stack))
    return ans

H,W = map(int,input().split())
hs = [0]*W
result = 0
for i in range(H):
    f = lambda x,y:(x+1)*abs(y-1)

    ht = list(map(int, input().split()))
    hs = list(map(f,hs,ht))

    result = max(result,judge(W,hs))

print(result)

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

using namespace std;

typedef long long LL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<LL> vl;
typedef vector<vector<LL>> vvl;
typedef vector<vector<vector<LL>>> vvvl;


const int inf = 1e9+7;
const LL INF = 1e18+5;
const int mod = 1e9+7;
const int mxN = 1e5+5;
const int mxM = 1e5+5;

int main(){
    #ifndef ONLINE_JUDGE
    freopen("E:\\Coding\\Programming\\input.txt", "r", stdin);
    freopen("E:\\Coding\\Programming\\output.txt", "w", stdout);
    #endif
    int x;
    cin>>x;
    if(x>=30){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
//#include<stdlib.h>
using namespace std;

main(){
  int n=0,sum=0;
  char c;
  while(1){
    if(scanf("%c",&c)==EOF){
      sum += n;//
      break;
    }
    if('0' <=c && c <= '9'){
      n *= 10;//
      //    n += atoi(c);
      n += c -'0';//'0'=48charc48//
    }
    else{
      sum += n;n=0;
    }
  }
  cout << sum << endl;
  

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s
 
typedef long long ll;
 
using namespace std;

ll modd = 1000*1000*1000+7;

ll binary_search(function<bool(ll)> func, ll start, ll end) {
    /*      func:int ->bool
            returns smallest int x where func(x) evaluates to true, searches in [start,end), it is assumed the values are false, .. , false, true ...
             */
    if (end <= start) {   return end;  }   // has to be here, otherwise func(end-1) in next line could be a problem
    if (!func(end-1)) {  return end;  }
    while (end-start>1) {
        ll mid = (start+end)/2;
        if (func(mid)) {  end = mid;  } else { start = mid;   }
    }
    if (func(start)) {  return start;  } else {  return end;   }
};


template<class T>
T fastpower(T a, long long n) {  // n must be >= 1
  if (n==0) {return 1;}
  if (n % 2 == 0) {  
      T halfpower = fastpower<T>(a, n/2);
      return (halfpower*halfpower) % modd;
  } else {
      if (n == 1) {  return a; } else {  
          T halfpower = fastpower<T>(a, n/2);
          return (((halfpower*halfpower)%modd)*a)%modd;
      }
  }
};


int how_many_below(vector<ll>& a, ll y) {
   return (lower_bound(a.begin(), a.end(), y) - a.begin());
}

int main()   {

    ios_base::sync_with_stdio(false);

    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
 
//    auto start = chrono::steady_clock::now();
  
//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readint(n);
        vector<int> a;
        int ct = 0;
        forr(i,0,n) {
            readint(kk);
            ct += (kk==i+1);
        }
        if (ct<n-2) {
            cout << "NO" << endl;
        } else {
            cout << "YES" << endl;
        }

    }
 
//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;
 
    return 0;
}

Measured memory_bytes: 3644
import java.io.*;
public class Main{
    public static void main(String [] args) throws NumberFormatException, IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] st=br.readLine().split(" ");
        int a=Integer.parseInt(st[0]);
        int b=Integer.parseInt(st[1]);
        int c=Integer.parseInt(st[2]);
        System.out.println(a<b&&b<c?"Yes":"No");
    }}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

using Complex = complex<double>;

bool isinter(Complex c1, double r1, Complex c2, double r2){
  double d = abs(c1-c2);
  return r1+r2 >= d;
}

double cross(Complex c1, Complex c2){
  return c1.real() * c2.imag() - c1.imag() * c2.real();
}

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

  double lb = 0., ub = 1e5;
  vector<Complex> xs(3);
  vector<double> rs(3);
  REP(i,3){
	double x, y;
	cin >> x >> y;
	xs[i] = Complex(x, y);
  }
  REP(i,3) rs[i] = abs(xs[i] - xs[(i+1)%3]);
  double s = accumulate(ALL(rs), 0.) / 2.;
  double S = accumulate(ALL(rs), s, [s](double acc, double x){ return acc * (s-x); });
  S = sqrt(S);
  ub = S / s;

  vector<Complex> dir(3);
  vector<double> sn(3);
  REP(i,3){
	auto d1 = (xs[(i+1)%3] - xs[i]);
	auto d2 = (xs[(i+2)%3] - xs[i]);
	dir[i] = (d1 * abs(d2) + d2 * abs(d1)) / (abs(d1) + abs(d2));
	d1 /= abs(d1);
	dir[i] /= abs(dir[i]);
	sn[i] = abs(cross(d1, dir[i]));
  }

  REP(_,100){
	double r = (lb + ub) / 2.;
	vector<Complex> cs(3);
	REP(i,3) cs[i] = xs[i] + dir[i] * r / sn[i];

	bool ok = false;
	REP(i,3) REP(j,3){
	  if(i == j) continue;
	  if(!isinter(cs[i], r, cs[j], r)){
		ok = true;
		int sg = cross(cs[i] - xs[0], xs[0] - xs[1]) > 0? 1: -1;
		REP(ii,3){
		  int sg_ = cross(cs[i] - xs[ii], xs[ii] - xs[(ii+1)%3]) > 0? 1: -1;
		  ok &= sg == sg_;
		}

		sg = cross(cs[j] - xs[0], xs[0] - xs[1]) > 0? 1: -1;
		REP(ii,3){
		  int sg_ = cross(cs[j] - xs[ii], xs[ii] - xs[(ii+1)%3]) > 0? 1: -1;
		  ok &= sg == sg_;
		}

		if(ok) i = j = 3;
		break;
	  }
	}
	
	if(ok) lb = r;
	else ub = r;
  }
  cout << fixed << setprecision(12) << lb << endl;

  return 0;
}


Measured memory_bytes: 256
// 1041
#include <stdio.h>

int main()
{
    int i, n, sum, a;

    while (1) {
        scanf("%d", &n);
        if (n == 0)
            break;
        sum = 0;
        for (i = 0; i < n / 4; i++) {
            scanf("%d", &a);
            sum += a;
        }
        printf("%d\n", sum);
    }
    return 0;
}

Measured memory_bytes: 0