akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

  LL N;
  LL M;
  cin >> N>>M;
  vector<LL> a(N);
  REP(i, N)
  {
    cin >> a[i];
  }

  SORT(a);

  LL cnt = 0;

  REP(i,N){
    if(i==N-1){
      if(M-a[i]==0){
        cnt++;
      }
    }else{
    if(M-a[i]>=0){
      M -= a[i];
      cnt++;
    }else{
      break;
    }
    }
  }

  cout << cnt << endl;
}


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

int main(int argc, char** argv)
{
	int n, cnt = 0;
	scanf("%d", &n);
	while(n--)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		if(x == y)
		{
			if(++cnt == 3)
			{
				puts("Yes");
				return 0;
			}
		}
		else cnt = 0;
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define st first
#define nd second

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

int main(){
	int a, b, v, w, t;
	scanf("%d %d %d %d %d", &a, &v,&b, &w, &t);
	if(v <= w) return !printf("NO");
	int dis = abs(a - b);
	if(1LL * dis <= 1LL * (v - w) * t) printf("YES");
	else printf("NO");

}

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


bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
signed main() {
	int x;
	cin >> x;
    int y;
	for (int i = x; i < 10 ^ 8; i++) {
        if (IsPrime(i)) {
            y = i;
            break;
       }
	}
    cout << y << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int x, b;
    scanf("%d %d", &x, &b);

    if( (x+b)%3==0 || x%3==0 || b%3==0 )
    {
        printf("Possible");
    }

    else
    {
        printf("Impossible");
    }
    return 0;
}

Measured memory_bytes: 1704
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstring>
#include<map>
int a[100010];
const int t=1000000000;
using namespace std;
int main(){
    int n,m,sum;
    scanf("%d%d%d",&n,&m,&sum);
    for (int i=0;i<m;i++){
        a[i]=sum;
    }
    if (sum!=t){
    for (int j=m;j<n;j++){
        a[j]=sum+1;
    }
}
    else {
        for (int j=m;j<n;j++){
        a[j]=1;
    }

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

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

using namespace std;

int main () {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  sort(A, A+N);
 // cout << A[1];
  int i = A[1];


  for (; i > 0; i--){
    int count = 0;
    for ( int j = 0; j < N; j++){
      if (A[j] % i == 0) count++;
    }
    if (count >= N-1) {
      cout << i;
      break;
    }
  
  }

}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		StringBuilder sb = new StringBuilder();
		for (int i=0; i < n-1; i++) {
			sb.append(a[i] + " ");
		}
		sb.append(a[n-1] + "\n");

		System.out.print(sb);

		for (int i=1; i <= n-1; i++) {

			int v = a[i]; // v : temp
			int j = i - 1;

			while ( j >=0 && a[j] > v ) {

				a[j+1] = a[j]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> a[j]
				// j--
			}

			for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.println(a[n-1]);

		}
	}

}

Measured memory_bytes: 31620
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#include<limits>
#include<bitset>
#include<ctype.h>
#include<set>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=10000;
const ll INF=1000000000;
const int MAX=100001;
const double EPS=1e-10;
using namespace std;
int main() {
    int n;
    cin>>n;
    int a[100010];
    vector<P> v;
    for(int i=0;i<n;i++){
        cin>>a[i];
        v.push_back(P(a[i],i));
    }
    sort(v.begin(),v.end());
    int ans=0;
    for(int i=0;i<n;i++){
        if(v[i].second%2==0&&i%2==1){
            ans++;
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 1656
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);
        
        try {
            int n = Integer.parseInt(br.readLine());
            int[] fr = new int[n+1];
            for(int i=1 ; i<=n ; i++) {
                for(int j=i ; j<=n ; j+=i) {
                    fr[j]++;
                }
            }

            long ans = 0;
            for(int i=1 ; i<=n ; i++) {
                ans += (long)i*fr[i];
            }

            pw.println(ans);
        }
        finally {
            pw.flush();
            pw.close();
        }
    }
}


Measured memory_bytes: 71976
//Link : https://atcoder.jp/contests/code-festival-2017-qualb/tasks/code_festival_2017_qualb_d

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 1000000

char s[N];

int in[N];
int dp[N];
void solve() {
  int n;scanf("%d ", &n);
  scanf("%s", s);
  int ret = 0;
  for(int i=0;i<n;) {
    if(s[i]=='0') {
      ++i;
      continue;
    } else {
      bool isPrevZero = false;
      int j;
      int pos = 0,num = 0;
      for(j=i;j<n;++j) {
        if(s[j]=='0') {
          if(isPrevZero) {
            break;
          } else {
            isPrevZero = true;
            in[pos++] = num;
            num = 0;
          }
        } else {
          isPrevZero = false;
          ++num;
        }
      }
      for(int k=i;k<j;++k) {
        dp[k] = 0;
      }
      int val = 0;
      for(int k=i;k<j;++k) {
        if(s[k]=='0') {
          int p = 0;
          if(k-2>=i) {
            p = dp[k-2];
          }
          for(int u =k+1;u<j;++u) {
            if(s[u]=='0') {
              break;
            }
            dp[u] = max(dp[u],p + u-k);
          }
          if(k+1<j && s[k+1]=='1') {
            for(int u=k-1;u>=0;--u) {
              if(s[u]=='0') {
                break;
              }
              p = 0;
              if(u-1>=i) {
                p = dp[u-1];
              }
              dp[k+1] = max(dp[k+1], p + k-u);
            }
          }
        }
        if(k-1>=i) {
          dp[k] = max(dp[k],dp[k-1]);
        }
        val = max(val,dp[k]);
      }
      i = j;
      ret += val;
    }
  }

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

int main() {
    //freopen("input.txt","r",stdin);
    solve();
    return 0;
}


Measured memory_bytes: 6400
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005

void solve()
{
	string s;
	cin>>s;
	set<char> cd;
	for(auto it:s)
		cd.insert(it);
	if(sz(cd)==2)
		cout<<"Yes";
	else
		cout<<"No";

}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	return 0;
}		

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

int N,M,x[4]={1,0,-1,0},y[4]={0,1,0,-1};
char P[501][501];
vector<pair<char,int> > V;

int beat(int a,int b)
{
  int c,d;
  V.clear();
  for(int k=0;k<4;k++){
    c=a+x[k],d=b+y[k];
    while(1){
      if(c<0 || d<0 || c>=M || d>=N)break;
      if(P[c][d]!='.'){
	V.push_back(make_pair(P[c][d],k));
	break;
      }
      c+=x[k],d+=y[k];
    }
  }
  int sum=0;
  for(int i=0;i<V.size();i++){
    for(int j=i+1;j<V.size();j++){
      if(V[j].first==V[i].first){
        sum+=2;
	c=a+x[V[j].second],d=b+y[V[j].second];
        while(1){
          if(P[c][d]==V[j].first){
	    P[c][d]='.';
	    break;
	  }
	  c+=x[V[j].second],d+=y[V[j].second];
	}
	c=a+x[V[i].second],d=b+y[V[i].second];
        while(1){
          if(P[c][d]==V[i].first){
	    P[c][d]='.';
	    break;
	  }
	  c+=x[V[i].second],d+=y[V[i].second];
	}
      }
    }
  }       
  return sum;
}

int main()
{
  int ans=0,sum;
  cin>>M>>N;
  for(int i=0;i<M;i++){
    for(int j=0;j<N;j++)cin>>P[i][j];
  }
  while(1){
    sum=0;
    for(int i=0;i<M;i++){
      for(int j=0;j<N;j++){
	if(P[i][j]=='.')sum+=beat(i,j);
      }
    }
    if(sum==0)break;
    ans+=sum;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1436
#include<iostream>
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
using namespace std;
int main()
{
    fastio;
    bitset<2000009> arr;
    long long n,i,sum=0;
    cin>>n;
    long long a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        sum=sum+a[i];
    }
    arr[0]=1;
    for(i=0;i<n;i++)
    {
        arr=arr|(arr<<a[i]);
    }
    for(i=sum/2;i>=0;i--)
    {
        if(arr[i]==1)
        {
            cout<<sum-i;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 4384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <iomanip>

using namespace std;

long long mod = 1000000007;

long long pow(long long x, long long k)
{
    if (k == 0)
    {
        return 1LL;
    }
    long long temp = pow(x, k / 2);
    if (k % 2 == 1)
    {
        return (((temp * temp) % mod) * x) % mod;
    }
    else
    {
        return (temp * temp) % mod;
    }
}

long long modular_inverse(long long x)
{
    return pow(x, mod - 2);
}

long long binomial(long long n, long long k)
{
    long long rez = 1;
    for (int i = n - k + 1; i <= n; i++)
    {
        rez *= i;
        rez %= mod;
    }
    long long temp = 1;
    for (int i = 1; i <= k; i++)
    {
        temp *= i;
        temp %= mod;
    }
    rez *= modular_inverse(temp);
    rez %= mod;
    return rez;
}

int main()
{
    long long r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    long long l = binomial(r2 + c2 + 2, r2 + 1), s = binomial(r2 + c1 + 1, r2 + 1);
    long long l1 = binomial(r1 + c2 + 1, r1), s1 = binomial(r1 + c1, r1);
    long long rez = (l - s - l1 + s1) % mod;
    // for (int i = c1; i <= c2; i++)
    // {
    //     rez += l - s;
    //     rez %= mod;
    //     l *= (r2 + c1 + 1 + (i - c1 + 1));
    //     l %= mod;
    //     l *= modular_inverse((r2 + c1 + 1 + (i - c1 + 1)) - r2);
    //     l %= mod;
    //     s *= (r1 + c1 + (i - c1 + 1));
    //     s %= mod;
    //     s *= modular_inverse((r1 + c1 + (i - c1 + 1)) - (r1 - 1));
    //     s %= mod;
    // }
    cout << (rez + mod) % mod << '\n';
    return 0;
}

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

def get_sum(num):
    i = num
    s = 0
    while i != 0:
        s += i % 10
        i = i // 10
    return s

# A >= Bとして考える
if N % 2 == 0:
    last_A = int(N/2)
else:
    last_A = int((N-1)/2 + 1)

ans = float("inf")
for A in range(1, last_A + 1):
    B = N - A
    sum_of_AB = get_sum(A) + get_sum(B)
    ans = min(ans, sum_of_AB)

print(ans)

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

const int maxn = 1111;
int d[maxn][maxn];
bool was[maxn][maxn];
char a[maxn][maxn];
vector<int> g[maxn * maxn];

void dfs(int x, int y, int c) {
	if(was[x][y]) return;
	if(a[x][y] == '#') return;
	d[x][y] = c;
	was[x][y] = 1;
	dfs(x + 1, y, c);
	dfs(x - 1, y, c);
	dfs(x, y + 1, c);
	dfs(x, y - 1, c);
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	for(int i = 0; i < maxn; i++) {
		for(int j = 0; j < maxn; j++) {
			a[i][j] = '#';
		}
	}
	int n, m;
	cin >> n >> m;
	int c1, c2, d1, d2;
	cin >> c1 >> c2 >> d1 >> d2;
	c1++, c2++, d1++, d2++;
	for(int i = 2; i <= n + 1; i++) {
		for(int j = 2; j <= m + 1; j++) {
			cin >> a[i][j];
		}
	}
	if(a[c1][c2] == '#' or a[d1][d2] == '#') {
		cout << -1 << endl;
		return 0;
	}
	int col = 0;
	for(int i = 2; i <= n + 1; i++) {
		for(int j = 2; j <= m + 1; j++) {
			if(!was[i][j] and a[i][j] != '#')
				dfs(i, j, ++col); 
		}
	}
	for(int i = 2; i <= n + 1; i++) {
		for(int j = 2; j <= m + 1; j++) {
			for(int k = i - 2; k <= i + 2; k++) {
				for(int l = j - 2; l <= j + 2; l++) {
					if(a[i][j] == '.' and a[k][l] == '.' and d[i][j] != d[k][l]) {
						g[d[i][j]].push_back(d[k][l]);
                      	g[d[k][l]].push_back(d[i][j]);
					}
				}
			}
		}
	}       
	queue<int> q;
	q.push(d[c1][c2]);
	int dist[col + 1];
	fill(dist, dist + col + 1, n * m + 1);
	dist[d[c1][c2]] = 0;
	while(!q.empty()) {
		int x = q.front();
		q.pop();
      	for(int i : g[x]) {
			if(dist[i] > dist[x] + 1) {
				dist[i] = dist[x] + 1;
				q.push(i);
			}
		}
	}
	if(dist[d[d1][d2]] == n * m + 1) cout << -1 << endl;
	else cout << dist[d[d1][d2]] << endl; 
	return 0;
}

Measured memory_bytes: 61420
class Myqueue():

    def __init__(self, size):
        self.size = size
        self.N = [None for _ in range(size)]
        self.head = 0
        self.tail = 0

    def is_empty(self):
        return self.head == self.tail

    def is_full(self):
        return self.head == (self.tail + 1) % self.size

    def enqueue(self, x):
        if self.is_full():
            raise OverflowError
        self.N[self.tail] = x
        self.tail += 1
        if self.tail == self.size:
            self.tail = 0

    def dequeue(self):
        if self.is_empty():
            raise IndexError
        x = self.N[self.head]
        self.head += 1
        if self.head == self.size:
            self.head = 0
        return x


class Node:

    def __init__(self):
        self.distance = -1
        self.status = 0

    def input_data(self, nodes):
        data = input().split()
        self.number = int(data[0])
        self.v = [nodes[int(x) - 1] for x in data[2:]]

n = int(input())
queue = Myqueue(n)
nodes = [Node() for _ in range(n)]
[node.input_data(nodes) for node in nodes]
nodes[0].status = 1
nodes[0].distance = 0
queue.enqueue(nodes[0])
while not queue.is_empty():
    u = queue.dequeue()
    for v in u.v: #type: Node
        if v.status == 0:
            v.status = 1
            v.distance = u.distance + 1
            queue.enqueue(v)
    u.status = 2


nodes.sort(key=lambda i: i.number)
for node in nodes:
    print(f"{node.number} {node.distance}")


Measured memory_bytes: 5672
#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.at(i);
    vector<bool> dp(1000001, true);
    sort(A.begin(), A.end());
    for(int i=0; i<N-1; i++){
        if(!dp.at(A.at(i))) continue;
        if(A.at(i) == A.at(i+1)) dp.at(A.at(i)) = false;
        int t = 2;
        while(A.at(i) * t <= 1000000){
            dp.at(A.at(i) * t) = false;
            t++;
        }
    }
    int count = 0;
    for(int i=0; i<N; i++){
        if(dp.at(A.at(i))) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3996
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <bitset>
#include <string>
#include <cmath>
#include <set>
#include <map>
#define Rep(i, x, y) for (int i = x; i <= y; i ++)
#define Dwn(i, x, y) for (int i = x; i >= y; i --)
#define RepE(i, x) for (int i = pos[x]; i; i = g[i].nex)
#define ev g[i].y
#define eps 1e-10
using namespace std;
typedef long long ll;
typedef double db;
const int N = 20005, mod = 998244353;
char A[N], B[N];
int n, m, len;
ll fac[N], inv[N], f[2][N], ans;
ll mypow(ll x, int y) {
	ll z = 1;
	while (y) {
		if (y & 1) (z *= x) %= mod;
		y >>= 1; (x *= x) %= mod;
	}
	return z;
}
ll sqr(ll x) { return x * x % mod; }
ll C(int x, int y) { return fac[x] * inv[y] % mod * inv[x - y] % mod; }
int main()
{
	scanf ("%s%s", A + 1, B + 1);
	len = strlen(A + 1);
	fac[0] = 1;
	Rep(i, 1, len) fac[i] = fac[i - 1] * i % mod;
	inv[len] = mypow(fac[len], mod - 2);
	Dwn(i, len, 1) inv[i - 1] = inv[i] * i % mod;
	Rep(i, 1, len) if (A[i] == '1') {
		if (B[i] == '1') n ++;
		else m ++;
	}
	// f[0][0] = 1;
	Rep(i, 0, n) {
		bool u = i & 1;
		if (i) {
			Rep(j, 0, m) f[u][j] = f[u ^ 1][j] * i * j % mod;
		} else f[u][0] = 1;
		Rep(j, 1, m) (f[u][j] += f[u][j - 1] * j * j) %= mod;
		// cout << i<<" "<<f[u][m]<<endl;
		(ans += f[u][m] * C(n, i) % mod * C(n + m, i + m) % mod * sqr(fac[n - i])) %= mod;
	}
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 512
//#pragma GCC optimize("-O3")
/*
				C++
				encoding: UTF-8
				Last Modified: 09/Nov/19 05:40:15 PM
*/

#include <bits/stdc++.h>
#ifdef H4wk3ye
#	include <prettypr.hpp>
#endif

using namespace std;

// clang-format off

#define		int                    long long
#define		ve                     vector
#define		pb                     push_back
#define		endl                   "\n"
#define		ff                     first
#define		ss                     second
#define		pii                    pair<int, int>
#define		len(v)                 (int)v.size()
#define		all(v)                 v.begin(), v.end()
#define		reset(a, b)            memset(a, b, sizeof(a));
#define		fr(i, s, n)            for (int i = s ; i < n ; ++i)
#define		dfr(i, s, n)           for (int i = s ; i > n ; --i)

template < typename T > void pr (const T& t) {
    cout << t << "\n";
}

template < typename T, typename U, typename... ARGS >
void pr (const T& t, const U& u, const ARGS&... args) {
    cout << t << " ";
    pr (u, args...);
}

// clang-format on


signed main () {
	ios_base::sync_with_stdio (false), cin.tie (nullptr);
	int n;
	cin >> n;
	int ans = n / 2 - (n % 2 == 0);
	pr (ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
 int A[100][100],B[100][100];
  int n,m,l,i,j,k;
  long long int C[100][100]={{},{}};

   
    scanf("%d%d%d",&n,&m,&l);
  for(i=0;i<n;i++)
    {
      for(j=0;j<m;j++)
	{
	  scanf("%d",&A[i][j]);
	}
    }
  for(i=0;i<m;i++)
    {
      for(j=0;j<l;j++)
	{
	  scanf("%d",&B[i][j]);
	}
    }
  for(i=0;i<n;i++)
    {
      for(j=0;j<l;j++)
	{
  for(k=0;k<m;k++)
    { C[i][j]+=A[i][k]*B[k][j];}
	}
    }
  
  for(i=0;i<n;i++)
    {
      for(j=0;j<l;j++)
	{
	  printf("%lld",C[i][j]);
	  if(j!=l-1){printf(" ");}
	}
      printf("\n");
    }

  return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<double,ll> P;

void Main() {
  ll n;
  R n;
  vector<ll> g;
  ll t=1,r=0;
  rep(k,16) {
    REP(i,1,1000) g.pb(i*t+r);
    t*=10;
    r*=10;
    r+=9;
  }
  sort(all(g));
  g.erase(unique(all(g)),g.end());
  priority_queue<P> que;
  rep(i,g.size()) {
    ll x=g[i],sum=0;
    while(x) {
      sum+=x%10;
      x/=10;
    }
    double d=(double)g[i]/sum;
    while(!que.empty()&&que.top().F>d) que.pop();
    que.push(P(d,g[i]));
  }
  vector<ll> a;
  while(!que.empty()) a.pb(que.top().S),que.pop();
  reverse(all(a));
  rep(i,min(n,(ll)a.size())) pr(a[i]);
}

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


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

namespace aizu
{
    public class OnlineJudge
    {
        static void Main()
        {
            int count;
            while((count = int.Parse(Console.ReadLine())) != 0) {
                var converter = (from p in Enumerable.Range(0, count) let input = Console.ReadLine().Split() select new { k = input[0][0], v = input[1][0] }).ToDictionary(p => p.k, p => p.v);
                var baseString = (Enumerable.Range(0, int.Parse(Console.ReadLine())).Select(p => new { k = p, v = Console.ReadLine()[0] })).ToDictionary(p => p.k, p => p.v);
                var output = new char[baseString.Count()];
                foreach(var item in baseString) {
                    output[item.Key] = converter.ContainsKey(item.Value) ? converter[item.Value] : item.Value;
                }
                Console.WriteLine(output);
            }
        }
    }
}

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

int main() {
  	string r, g, b;
	cin >> r >> g >> b;
  	int num = atoi((r + g + b).c_str());
  	if(num % 4 == 0){
    	cout << "YES" << endl;
    }else{
    	cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iomanip>
#define inf -2147483647
using namespace std;
struct info
{
    int l,r,d;
}s[400005];
int n,m;
int flag = 1;
int dis[100005],visited[100005];
int first[400005],nexti[400005];
void dfs(int t)
{
    if(!flag)return;
    int k = first[t];
    while(k != -1)
    {
        if(!flag)return;
        if(!visited[s[k].r])
        {
            dis[s[k].r] = dis[s[k].l] + s[k].d;
            visited[s[k].r] = 1;
            dfs(s[k].r);
        }
        else if(s[k].d != dis[s[k].r] - dis[s[k].l])
        {
            flag = 0;
            return;
        }
        k = nexti[k];
    }
}
int main()
{
    scanf("%d%d",&n,&m);
    memset(first,-1,sizeof(first));
    for(int i = 0;i < m;i ++)
    {
        scanf("%d%d%d",&s[i].l,&s[i].r,&s[i].d);
        nexti[i] = first[s[i].l];
        first[s[i].l] = i;
        s[i + m].r = s[i].l;
        s[i + m].l = s[i].r;
        s[i + m].d = -s[i].d;
        nexti[i + m] = first[s[i + m].l];
        first[s[i + m].l] = i + m;
    }
    for(int i = 1;i <= n;i ++)
    {
        if(!visited[i])
        {
            visited[i] = 1;
            memset(dis,0,sizeof(dis));
            dfs(i);
        }
    }
    if(flag)printf("Yes");
    else printf("No");
}


Measured memory_bytes: 9728
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a==1)a=14;
	if(b==1)b=14;
	if(a>b)cout<<"Alice"<<endl;
	if(a==b)cout<<"Draw"<<endl;
	if(a<b)cout<<"Bob"<<endl;
	return 0;
}


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

using namespace std;
typedef long long ll;


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

    int x,y,z; cin>> x >> y >> z;
    if(x % y == 0){
        cout << x / y * z <<'\n';
    }else{

        cout << (x / y  + 1)* z <<'\n';
    }



}



Measured memory_bytes: 3656
//Go to Jail

#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
using namespace std;
const int INF = 1 << 29;
int main ()
{
    int N;
    cin >> N;
    int count = 0;
    for (int i = 0; i < N; i++) {
        int D1,D2;
        cin >> D1 >> D2;
        if (D1 == D2) {
            count++;
        }
        else {
            count = 0;
        }

        if (count > 2) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int N, M, C;
  cin >> N >> M >> C;

  vector<int> B(M);
  rep(i, M) cin >> B[i];

  int sum = 0;
  rep(n, N)
  {
    int tmp = 0;
    rep(i, M)
    {
      int a;
      cin >> a;
      tmp += a * B[i];
    }
    if (tmp + C > 0)
      sum++;
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

void ABC141B()
{
	string S;
	cin >> S;
	set<char> even{ 'L','U','D' };
	set<char> odd{ 'R','U','D' };
	bool good = true;
	for (int i = 0; i < S.size(); ++i)
	{
		if (i % 2 == 0 && S[i] == 'L')
			good = false;
		else if (i % 2 == 1 && S[i] == 'R')
			good = false;
	}
	if (good)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

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

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       int len = sc.nextInt();
       int []array = new int[len];
       int A = sc.nextInt();
       int B = sc.nextInt();
       int A_flag = 0;
       int B_flag = 0;
       if((B-A-1)%2 == 1){
           System.out.println("Alice");
       }else if((B-A-1)%2 == 0){
           System.out.println("Borys");
       }
       
    }
}


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

int main() {
  int N;
  cin>>N;
  int64_t Z=0,MIN=167167167167617,A=1;
  for(int i=0;i<N;i++){
    int64_t a;
    cin>>a;
    if(a<0){
      A*=-1;
      a*=-1;
    }
    Z+=a;
    MIN=min(MIN,a);
  }
  cout<<Z-MIN+A*MIN<<endl;
}



Measured memory_bytes: 3644
# E - Colorful Blocks
import sys
readline = sys.stdin.readline

MOD = 998244353
N, M, K = map(int, readline().split())

# 予め階乗を計算しておく
f = [1]
for i in range(N):
    f.append(f[i] * (i+1) % MOD)

f_inv = [1] * N
f_inv[N-1] = pow(f[N-1], MOD-2, MOD)
for i in range(N-1)[::-1]:
    f_inv[i] = f_inv[i+1] * (i+1) % MOD

# 組み合わせ関数
def comb_mod(n, r, p):
    return (f[n] * f_inv[r] * f_inv[n-r])%p

ans = 0
for i in range(K+1):
    ans = (ans + (M*pow(M-1, N-1-i, MOD)) * comb_mod(N-1, i, MOD))%MOD

print(ans)


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

int main() {
  int N;
  string S;
  cin >> N >> S;

  if (N % 2 != 0) {
    cout << "No" << endl;
    return 0;
  }

  if (N == 2) {
    if (S[0] == S[1]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    return 0;
  }

  int mid = N/2;
  if (S.substr(0, mid-1) == S.substr(mid, N-mid-1)) {
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << endl;
}


Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string N,M;
  cin>>N>>M;
  int n=0;
  if(N[0]==M[0])
    n=n+1;
  if(N[1]==M[1])
    n=n+1;
  if(N[2]==M[2])
    n=n+1;
  cout<<n<<endl;


}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    static final int MOD = 1000000009;
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        /*
        String[] in = br.readLine().split(" ");
        int n = Integer.parseInt(in[0]);
        int m = Integer.parseInt(in[1]);
        */

        char[] s = br.readLine().toCharArray();
        boolean flag = false;
        for(int i = 0; i < 3; i++) {
            if(s[i] == s[i + 1]) {
                flag = true;
                break;
            }
        }
        System.out.println(flag? "Bad" : "Good");
    }
}

Measured memory_bytes: 22100
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  int ans = 0;
  string s;
  cin >> s;
  if(s[0] == 'R') {
    ans = 1;
    if(s[1] == 'R') {
      ans = 2;
      if(s[2] == 'R') {
        ans = 3;
      }
    }
  } else if(s[1] == 'R') {
    ans = 1;
    if(s[2] == 'R') {
      ans = 2;
    }
  } else if(s[2] == 'R') {
    ans = 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
string s;
long long cnt=0;
void dfs(long long x,long long y,long long z){
	if(x==s.size()){
		cnt+=y+z;
		return ;
	}
	long long d=(long long)(s[x]-'0');
	if(z)dfs(x+1,y+z,d);
	dfs(x+1,y,z*10+d);
}
int main(){
	cin>>s;
	dfs(0,0,0);
	cout<<cnt<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main(){
    ll N;
    cin >> N;
    string S[100010];
    ll m=0, a=0, r=0, c=0, h=0;
    for(ll i = 0;i < N;i++){
        cin >> S[i];
        if(S[i][0] == 'M')m++;
        if(S[i][0] == 'A')a++;
        if(S[i][0] == 'R')r++;
        if(S[i][0] == 'C')c++;
        if(S[i][0] == 'H')h++;
    }
    ll ans = m * a * r + m * a * c + m * a * h + m * r * c + m * r * h + m * c * h + a * r * c + a * c * h + a * r * h + r * c * h;
    cout << ans;
}


Measured memory_bytes: 6144
#include <iostream>

using namespace std;
typedef pair<int,int> P;

P pro[100];
int main(void)
{
  int n,m;
  int sp=1,spl = 0,mp,spi=-1,mpi=-1;
  cin>>n;cin>>m;
  for(int i=0;i<m;i++){
    cin>>pro[i].first>>pro[i].second;
    if(pro[i].first == 1 && pro[i].second >spl)
    {
      spi = i;
      spl = pro[i].second;
    }if(pro[i].second == n)
      mpi = i;
  }
  if(spi==-1||mpi==-1){
    cout<<"Impossible"<<endl;
    return 0;
  }
  int index = pro[spi].second;
  int professor = 1;
  while(index!=n&&professor!=m)
  {
    mpi = -1;
    mp = index;
    for(int j=0;j<m;j++)
    {
      if(index+1>=pro[j].first&&pro[j].second>=mp)
      {
        mp = pro[j].second;
        mpi = j;
      }
    }

    if(mpi < 0)break;

    index = pro[mpi].second;
    professor++;
  }

  if(index<n)
    cout<<"Impossible"<<endl;
  else
    cout<<professor<<endl;
  return 0;
}

Measured memory_bytes: 1164
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

vector<string> res;

void dfs(string &s, string sub, map<char, bool> &changed) {
    if (s.size() == sub.size()) res.emplace_back(sub);
    char c = s[sub.size()];
    if (!changed[c] && c != 'z') {
        changed[c] = true;
        dfs(s, sub + char(c + 1), changed);
        changed[c] = false;
    }
    if (changed[c - 1] || c == 'a') {
        dfs(s, sub + char(c), changed);
    }
}

int main() {
    string s;
    while (cin >> s && s != "#") {
        res.clear();
        map<char, bool> changed;
        dfs(s, "", changed);
        sort(res.begin(), res.end());
        int cnt = res.size();
        cout << cnt << endl;
        for (int i = 0; i < cnt; i++) {
            if (i < 5 || cnt - 5 <= i) cout << res[i] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4368
'use strict';
//　他の方の回答をベースに以下コードを記述
function main(input) {
  // inputを配列に切り分ける
  var list = input[1].split(" ").map(v=>v-0);
  // 配列用の変数
  var ans = 0;
  // 探索用の変数
  var target = 1;
  // カウントされたかどうかの確認（1だけだった時用の対策）
  var cnt = false;
  list.forEach(v=>{
    // もしもvが目当てのものと異なるなら、回答用にカウントを一つあげる
    if(v != target) {ans++}
    // 目当てのものがあったらターゲットの数を1つ増やす、そして、カウントされたってフラグを立てる
    else {target++; cnt = true;}
  });
  if(cnt) {console.log(ans)}
  else {console.log(-1)};
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


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

int main(){
    int h,w;
    scanf("%d%d",&h,&w);
    char c[w],s[w],t[w];
    for(int i=0;i<h;i++){
        scanf("%s",c);
        strcpy(s,c);
        printf("%s\n",s);
        strcpy(t,c);
        printf("%s\n",t);
    }
    return 0;
}

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int val[b];
    bool flag = 0;

    for (int i = 0; i < b; i++){
        val[i] = a*i % b;
        if (val[i] == c) flag = 1;
    }

    if(flag == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
my ($a, $b, $c, $d) = split(/ /, <>);
if (abs($a - $c) <= $d){
        print "Yes";
        exit 0;
}
if (abs($a - $b) <= $d and abs($b - $c) <= $d){
        print "Yes";
        exit 0;
}
print "No";


Measured memory_bytes: 512
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<cstring>
using namespace std;
deque<int> a;
bool dir;
int n,x;
int main(){
	cin>>n;
	if (n%2==0) dir=false;else dir=true;
	for (int i=0;i<n;i++){
		cin>>x;
		if (dir) a.push_front(x);
		else a.push_back(x);
		dir^=1;
	}
	for (int i=0;i<a.size()-1;i++)	cout<<a[i]<<" ";
	cout<<a[a.size()-1];
	return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
#include <boost/lexical_cast.hpp>
#define lli long long int
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    lli i,sum=0;
    for(i=0;i<s.size();i++)
    {
        sum+=(s[i]-'0');
    }
    if(sum%9==0)
    cout<<"Yes"<<"\n";
    else
    cout<<"No"<<"\n";
}

Measured memory_bytes: 3680
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k;
		
		for (int i = 1; i <= n; i++) {
			if (i % 3 == 0) {
				System.out.print(" " + i);
			}
			else {
				k = i;
				while (true) {
					if (k < 3) break;
					else if (k % 10 == 3) {	
						System.out.print(" " + i);
						break;
					}
					else {
						k = k / 10;
					}
				}
			}
		}
		System.out.println();
	}
}


Measured memory_bytes: 28632
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoderLibraryCSharp.Examples
{
    public static class Program
    {
        public static void Main()
        {
            var NQ = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
            var (N, Q) = (NQ[0], NQ[1]);
            var A = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();

            var ft = new FenwickTree(N);
            for (var i = 0; i < N; i++) ft.Add(i, A[i]);

            for (var i = 0; i < Q; i++)
            {
                var TPX = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
                var (t, p, x) = (TPX[0], TPX[1], TPX[2]);
                if (t == 0) ft.Add(p, x);
                else Console.WriteLine(ft.Sum(p, x));
            }
        }
    }
}

namespace AtCoderLibraryCSharp
{
    public class FenwickTree
    {
        private readonly int _n;
        private readonly long[] _data;

        public FenwickTree(int n = 0)
        {
            _n = n;
            _data = new long[n];
        }

        public void Add(int p, long x)
        {
            if (p < 0 || _n <= p) throw new IndexOutOfRangeException(nameof(p));
            p++;
            while (p <= _n)
            {
                _data[p - 1] += x;
                p += p & -p;
            }
        }

        public long Sum(int l, int r)
        {
            if (l < 0 || r < l || _n < r) throw new IndexOutOfRangeException();
            return Sum(r) - Sum(l);
        }

        private long Sum(int r)
        {
            var s = 0L;
            while (r > 0)
            {
                s += _data[r - 1];
                r -= r & -r;
            }

            return s;
        }
    }
}

Measured memory_bytes: 91352
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

void Main() {
    string s;
    cin >> s;
    for(size_t i = 0; i<s.size()-1;++i){
        if(s[i]==s[i+1]){
            cout << "Bad" << endl;
            return;
        }
    }
    cout << "Good" << endl;
}


int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <iomanip>
using ll = long long;
using namespace std;
//#define int long long

#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = 0; i <= (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int i = n; i >= 0; i--)
int factorical(int n) {
	int sum = 1;
	for (int i = 1; i <= n; ++i)
	{
		sum *= i;
	}
	return sum;
}

vector<int> divisors(int n) {
	vector<int> res;
	for (int i = 1; i * i <= n; ++i) {
		if (n % i != 0) continue;
		res.push_back(i);
		if (n / i == i) continue; // 上の行で追加済み。
		res.push_back(n / i);
	}
	return res;
}
vector<ll> divisors_ll(ll n) {
	vector<ll> res;
	for (ll i = 1; i * i <= n; ++i) {
		if (n % i != 0) continue;
		res.push_back(i);
		if (n / i == i) continue; // 上の行で追加済み。
		res.push_back(n / i);
	}
	return res;
}


void printVector(const vector<int>& vec) {
	for (int value : vec) {
		cout << value << " ";
	}
	cout << endl;
}



int main() {
	vector<int> a;
	int n;
	cin >> n;
	a.resize(n);
	rep(i, n) {
		cin >> a[i];
	};
	int flag = 0;
	rep(i, n) {
		if (a[i] % 2 == 0) {
			if (a[i] % 3 != 0 && a[i] % 5 != 0) {
				cout << "DENIED" << endl;
				flag += 1;
				break;
			}
		}
	}
	if (flag == 0) {
		cout << "APPROVED" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
#include <cassert>
#include <memory>
using namespace std;
typedef long long ll;
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

bool check (string S)
{
    for (int i = 0; i < S.size() / 2; i++) {
        if (S[i] != S[S.size() - 1 - i]) {
            return false;
        }
    }
    return true;
}

int main ()
{
    string s1; cin >> s1;
    int N = (int)s1.size();
    string s2 = s1.substr(0, (N - 1) / 2);
    string s3 = s1.substr((N + 3) / 2 - 1, N - (N + 3) / 2 + 1);

    if (check(s1) && check(s2) && check(s3)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception addd) {
					addd.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception addd) {
				addd.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	
	public static FastReader sc = new FastReader();
 
	static int mod = (int) (1e9+7),MAX=(int) (2e5+100);
    static List<Integer>[] edges;
    static Long[] dp;
    static int n,d;
    static int[][] adj;
    static long[] cost;

	public static void main(String[] args) {
	    n = sc.nextInt();
	    adj = new int[n][n];
	    cost = new long[1<<n];
	    for(int i=0;i<n;++i) {
	    	for(int j=0;j<n;++j)
	    		adj[i][j] = sc.nextInt();
	    }
	    dp = new Long[1<<n];
	    for(int mask=1;mask < 1<<n;++mask) {
	    	cost[mask] = get(mask);
	    }
	    
	    long ans = f((1<<n)-1);
	    out.print(ans);
		out.close();
   }

	private static long get(int mask) {
		long val = 0;
		for(int i=0;i<n;++i) {
			for(int j=i+1;j<n;++j) {
				if(((mask>>i)&1) == 1 && ((mask>>j)&1) == 1)
					val+=adj[i][j];
			}
		}
		return val;
	}

	private static long f(int mask) {
		if(dp[mask] != null) return dp[mask];
		long ans = 0;
		/*
		 * brutforcing some people in group + f(remaining people)
		 * remaining people = mask - submask 
		 */
		for(int submask=mask; submask!=0; submask = (submask-1)&mask)
			ans = Math.max(ans, cost[submask] + f(mask^submask));
		return dp[mask] = ans;
	}
	
}



Measured memory_bytes: 24148
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
  double a,b,c,C,ra;
  double S,L,h;
  cin >> a >> b >> C;
  ra=M_PI/180*C;
  c=sqrt(a*a+b*b-2*a*b*cos(ra));
  S=a*b*sin(ra)/2;
  L=a+b+c;
  h=b*sin(ra);
  printf("%.8f\n%.8f\n%.8f\n",S,L,h);
  return 0;
}
  

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,sum=0;
cin>>n;
int a[2*n];
for(int i=0;i<2*n;i++)
    cin>>a[i];
sort(a,a+2*n);
for(int i=0;i<2*n;i+=2)
    sum+=a[i];
cout<<sum;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

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

  for (ll i = 0; i < N; i++) {
    if (K > 0) {
      cout << S << endl;
    } else if (S >= 1000000000) {
      cout << 1 << endl;
    } else {
      cout << S + 1 << endl;
    }
    K--;
  }

  return 0;
}


Measured memory_bytes: 1280
import java.util.Arrays;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	void tr(Object... objects) {
		System.out.println(Arrays.toString(objects));
	}

	void run() throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long X = sc.nextLong();
		long[] A = new long[N];
		for (int i = 0; i < N; ++i) {
			A[i] = sc.nextLong();
		}
		Arrays.sort(A);
		int ans = 0;
		for (int i = 0; i < N; ++i) {
			if (A[i] <= X) {
				X -= A[i];
				++ans;
				if (i == N - 1 && X != 0) {
					--ans;
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 0; i < n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<endl
#define AA(i) cout<<i<<endl
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
    int N; cin >>N;
    vector<int> P(1000001, 1);
    vector<ll> A(N);
    int i,j;
    int ans=0;
    rep(i,N) cin >> A[i];
    sort(A.begin(), A.end());
    rep(i,N){
        if(P[A[i]]){
            if(A[i] != A[i+1]){
                ans++;
                for(j=A[i];j<=1000000;j+=A[i]){
                    P[j] = false;
                }
            }
            else{
                for(j=A[i];j<=1000000;j+=A[i]){
                    P[j] = false;
                }
            }
        }
    }
    AA(ans);
    return 0;
}

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


int main(){
    int n;
    long long int c=0;
    int k;

    cin>>n;
    for(int i=1;i<n+1;i++){
        if(i%5!=0 && i%3!=0) c+=i; 
    }

    cout<<c<<endl;

    

}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int ans = 0;
    while(c > 0) {
        ans++;
        c -= a;
        if(ans % 7 == 0) c -= b;
    }
    cout << ans << '\n';
    return 0;
}



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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int k; cin>>k;
  int s[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout<<s[k-1]<<endl;
}

Measured memory_bytes: 256