akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(int i = (int)k; i < (int)n; i++)
#define rrep(i, n) RREP(i, 0, n)
#define RREP(i, k, n) for(int i = (int)n-1; i > (int)k-1; i--)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define ALL(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " " << x << endl;

typedef long long ll;


vector<vector<int>> g(10,vector<int>(10,0));
int n,m;

int dfs(int v,int bit){
    int res = 0;
    bit |= (1<<(v-1));

    if(bit==((1<<n)-1)) return 1;

    rep(i,g[v].size()){
        if(g[v][i]==1){
            if((bit>>(i-1))&1) continue;//もしもビットが立っていたらcontinue;
            res += dfs(i,bit);
        }
    }
    return res;
}

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


    cin >> n >> m;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        g[a][b] = 1;
        g[b][a] = 1;
    }
    cout << dfs(1,0) << endl;
    return 0;
}

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

#define ll long long
#define ar array
 
using namespace std;

int main() {
	
	int a;
	
	cin >> a;
	
	if(a==7 || a==5 || a==3){
		cout << "YES"<<endl;
	}else{
		cout <<"NO"<<endl;
	}
	
   	return 0;
}
   

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split(' ');
        int r = int.Parse(s[0]);
        int g = int.Parse(s[1]);
        int b = int.Parse(s[2]);
        Console.WriteLine(
            (10 * g + b) % 4 == 0 ?
            "YES" : "NO");
    }
}


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

int main(void) {
    int a, b, c;
    bool flag = false, zohe[101] = {};
    cin >> a >> b >> c;
    for (int i = 1; ; i++) {
        if (a * i % b == c) {
            flag = true;
            break;
        }
        if (zohe[a * i % b]) break;
        zohe[a * i % b] = true;
    }
    cout << (flag ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool a)
{
    if (a == true)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

ll gcd(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    int n, k;
    cin >> n >> k;
    vll h(n);
    rep(i, 0, n) cin >> h[i];

    sort(h.begin(), h.end());
    ll m = LINF;
    rep(i, 0, n)
    {
        if (i + k - 1 >= n)
            break;
        m = min(h[i + k - 1] - h[i], m);
    }
    cout << m << endl;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main(){
    int a,b,n,c;
    int sum = 0;
    int sum_ = 0;
    scanf("%d %d %d",&n,&a,&b);
    
    
    for(int i=1;i<=n;i++){
        c = i;
        sum = 0;
        while(c>0){
            sum += c % 10;
            c = c/10;
        }
        if(sum <= b && sum >= a){
            sum_ += i;
        }
    }
    cout << sum_ << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

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

using ll = long long;
using Pii = pair<int, int>;

const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

using MIte = multimap<ll, ll, greater<ll> >::iterator;

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

	// long long?
	ll N;
	cin >> N;

	vector<int> vH(N,0);
	rep(i, N) {
		cin >> vH[i];
	}

	vector<int> dp(N, inf);
	dp[0] = 0;
	rep(i, N) {
		if (i + 1 <= N - 1) dp[i + 1] = min(dp[i+1], dp[i] + abs(vH[i + 1] - vH[i]));
		if (i + 2 <= N - 1) dp[i + 2] = min(dp[i+2], dp[i] + abs(vH[i + 2] - vH[i]));
	}

	cout << dp[N - 1] << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define int long long int
#define FILEIO  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 
#define maxn 1000000
 

using namespace std;

int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}

signed main() {
//FILEIO;
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int l , r , d;
cin>>l>>r>>d;
int temp = r/d;
int tempp = l/d;
if(l%d == 0)
{
	cout<<temp - tempp + 1;
}
else
{
	cout<<temp - tempp;
}










    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, S;
  cin >> N >> S;
  long long dp[3030][3030];
  long long mod = 998244353;
  vector<int>A(N);
  for (int i = 0; i < N; i ++) cin >> A[i];
  for (int i = 0; i <= N; i ++) {
    for (int j = 0; j <= S; j ++) {
      dp[i][j] = 0;
    }
  }
  dp[0][0] = 1;
  for (int i = 1; i <= N; i ++) {
    for (int j = S; j >= 0; j --) {
      dp[i][j] += dp[i - 1][j] * 2;
      dp[i][j] %= mod;
      if (j >= A[i - 1]) dp[i][j] += dp[i - 1][j - A[i - 1]];
      dp[i][j] %= mod;
    }
  }
  /*for (int i = 0; i <= N; i ++) {
    for (int j = 0; j <= S; j ++) {
      cout << dp[i][j] << ' ';
    }
    cout << endl;
  }*/
  cout << dp[N][S] << endl;
}



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

typedef long long ll;
typedef vector<long long> vll;
typedef vector<vector<long long>> mll;
typedef vector<pair<long long, long long>> vpl;
typedef pair<long long, long long> pll;
#define minimize(var, val) (var = min((val), var))
const long long MOD = 1e9 + 7;

#define BLACK first
#define WHITE second

class Tree {
   public:
    struct Node {
        int index;
        vector<Node*> adjacent;
        Node* parent = nullptr;
        long long start_time = 0, end_time = 0;
    };

    vector<Node> list;
    Node* root = nullptr;

    explicit Tree(int n) {
        list = vector<Node>(n);
        for (int i = 0; i < n; i++)
            list[i].index = i;
        root = &list[0];
    }
    void add_edge(int x, int y) {
        assert(x < list.size() && y < list.size());
        list[x].adjacent.push_back(&list[y]);
        list[y].adjacent.push_back(&list[x]);
    }
    int __build(Node* root = nullptr, int time = 0) {
        if (root == nullptr)
            root = this->root;
        root->start_time = time;
        for (auto child : root->adjacent) {
            if (child == root->parent)
                continue;
            child->parent = root;
            time = __build(child, time + 1);
        }
        root->end_time = time;
        return time;
    }
};

// Return pair {ways with black root, ways with white root}
pll dp(Tree::Node* root) {
    pll ans = {1, 1};
    for (auto child : root->adjacent) {
        if (child == root->parent)
            continue;
        pll dp_ans = dp(child);
        ans.BLACK = (ans.BLACK * dp_ans.WHITE) % MOD;
        ans.WHITE = (ans.WHITE * (dp_ans.WHITE + dp_ans.BLACK)) % MOD;
    }
    return ans;
}

int main() {
    int n;
    cin >> n;
    Tree tree(n);
    for (int i = 0; i < n - 1; i++) {
        int u, v;
        cin >> u >> v;
        tree.add_edge(u - 1, v - 1);
    }
    tree.__build();
    pll ans = dp(tree.root);
    cout << (ans.first + ans.second) % MOD << endl;
}

Measured memory_bytes: 14464
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;

int a[100010];
int mx[100010];

int main(){
  int n, t;
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  mx[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    if (a[i] > mx[i + 1]) {
      mx[i] = a[i];
    } else {
      mx[i] = mx[i + 1];
    }
  }
  int dif = 0;
  int cnt = 0;
  for (int i = 0; i < n - 1; i++) {
    if (mx[i + 1] - a[i] > 0) {
      if (mx[i + 1] - a[i] > dif) {
        dif = mx[i + 1] - a[i];
        cnt = 1;
      } else if (mx[i + 1] - a[i] == dif) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
 int X,Y;
 cin >> X >> Y;
  
 if(Y%2==0 && 2*X <= Y && Y <= 4*X)
 {
  cout <<"Yes" << endl; 
 }
  else
  {
   cout <<"No" << endl; 
  }
  
  
  
}

Measured memory_bytes: 3632
#include<stdio.h>
int main(){
    int i, j, n, q, s[100000], t[50000], count=0;
    scanf("%d", &n);
    for(i=0; i<n; i++)scanf("%d", &s[i]);
    scanf("%d", &q);
    for(i=0; i<q; i++)scanf("%d", &t[i]);
    for(i=0; i<q; i++)for(j=0; j<n; j++)if(t[i]==s[j]){
            count++;
            break;
    }
    printf("%d\n", count);
    return 0;
}

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

int main(){
	string s; cin>>s;
	int cnt=0;
	rep(i,6) if(s[i]=='1') cnt++;
	cout<<cnt<<endl;
}

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

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

  int a, b, c;
  cin >> a >> b >> c;
  if(a == b && b == c) cout << "No" << endl;
  else if(a != b && b != c && c != a) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    public static void solve(Scanner sc) {
        String a = sc.next();
        System.out.println("aiueo".contains(a) ? "vowel" : "consonant");
    }
}

Measured memory_bytes: 21844
#include<stdio.h>
int main(){
  int h,i,j,p,k,l,c;
  while(scanf("%d",&h),h){
    int d[15][7]={0};
    for(i=p=0;i<h;i++){
      for(j=0;j<5;j++)scanf("%d",&d[h-i-1][j]);
    }
    for(l=0;l<20;l++){
      for(i=0;i<h;i++){
	c=1;
	for(j=0;j<5;j++){
	  if(d[i][j]==d[i][j+1])c++;
	  else{
	    if(c>2){
	      p+=c*d[i][j];
	      for(k=j-c+1;k<=j;k++)d[i][k]=0;
	    }
	    c=1;
	  }
	}
      }
      for(j=0;j<5;j++){
	for(i=c=0;i<h;i++){
	  d[i-c][j]=d[i][j];
	  if(d[i][j]==0)c++;
	}
	for(i=h-c;i<h;i++)d[i][j]=0;
      }
    }
    printf("%d\n",p);
  }
  return 0;
}

Measured memory_bytes: 600
#include <cstdio>

void trace(int A[], int N) {
  for (int i = 0; i < N; ++i) {
    if (i > 0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

void insertionSort(int A[], int N) {
  for (int i = 1; i < N; ++i) {
    int v = A[i];
    int j = i - 1;
    while (j >= 0 && A[j] > v) {
      A[j + 1] = A[j];
      --j;
    }
    A[j + 1] = v;
    trace(A, N);
  }
}

int main() {
  int N;
  int A[100];

  scanf("%d", &N);
  for (int i = 0; i < N; ++i) scanf("%d", &A[i]);

  trace(A, N);
  insertionSort(A, N);

  return 0;
}

Measured memory_bytes: 2700
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int N;
    cin >> N;
    int tmp,sum=0;
    tmp = N;
    while(N != 0){
        sum += N%10;
        N = N /10;
    }



    if(tmp%sum == 0){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
def main():
    N, M = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(M):
        a, b, c = map(int, input().split())
        G[a - 1].append((b - 1, c))
    INF = 10 ** 40
    S = [-INF] * N
    S[0] = 0

    def helper(n, s, hist):
        for g, gc in G[n]:
            if S[g] >= s + gc or S[g] >= INF:
                continue
            S[g] = s + gc
            if g in hist:
                S[g] = INF
            hist[g] = hist.get(g, 0) + 1
            helper(g, S[g], hist)
            hist[g] -= 1
            if hist[g] == 0:
                del hist[g]
    helper(0, 0, {0: 1})
    s = S[-1]
    return s if s < INF else 'inf'

print(main())


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

typedef double f64;
typedef long long i64;
typedef int i32;
typedef pair<i32, i32> pi32;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef vector<i32> vi32;
typedef deque<i32> di32;

#define all(c) (c).begin(), (c).end()
#define REP(i, a, b) for (auto i = a; i < b; i++)
#define REPA(i, a, b, acc) for (auto i = a; i < b; i += acc)
#define PB push_back
#define PF push_front
#define PRINT(x) cout << #x ": " << (x) << endl;
#define TR(c, it) for (auto(it) = (c).begin(); (it) != (c).end(); (it)++)
#define MAX_PRECISION cout << setprecision(numeric_limits<double>::max_digits10);

i32 main() {
  ios::sync_with_stdio(false);  // Makes IO faster, remove this line if C style scanf/printf needed.

  i32 n;
  cin >> n;
  vector<i64> v(n);
  REP(i, 0, n) {
    cin >> v[i];
  }

  vector<pair<i64, i64>> m(n - 1);
  m[0].first = v[0] + v[1];
  m[0].second = -m[0].first;

  REP(i, 1, n - 1) {
    m[i].first = max(m[i - 1].first, m[i - 1].second) + v[i + 1];
    m[i].second = max(
        m[i - 1].first - 2 * v[i],
        m[i - 1].second + 2 * v[i]);
    ;
    m[i].second -= v[i + 1];
  }
  cout << max(m[n - 2].first, m[n - 2].second) << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#define llint long long
#define mod 1000000007

using namespace std;

struct Matrix{
	int h, w;
	vector<llint> mat;
	Matrix(){
		h = w = 0;
	}
	Matrix(int h, int w){
		this->h = h, this->w = w;
		mat.resize(h*w);
	}
	llint& at(int i, int j){
		return mat[w*(i-1)+(j-1)];
	}
	static Matrix ident(int size){
		Matrix ret(size, size);
		for(int i = 1; i <= size; i++) ret.at(i, i) = 1;
		return ret;
	}
	Matrix operator*(Matrix& ope){
		Matrix ret(h, ope.w);
		for(int i = 1; i <= h; i++){
			for(int j = 1; j <= ope.w; j++){
				for(int k = 1; k <= w; k++){
					ret.at(i, j) += at(i, k) * ope.at(k, j) % mod;
					ret.at(i, j) %= mod;
				}
			}
		}
		return ret;
	}
	Matrix pow(llint n){
		if(n == 0) return ident(h);
		if(n % 2){
			return pow(n-1) * (*this);
		}
		else{
			Matrix tmp = pow(n/2);
			return tmp * tmp;
		}
	}
	void print(){
		for(int i = 1; i <= h; i++){
			for(int j = 1; j <= w; j++){
				cout << at(i, j) << " ";
			}
			cout << endl;
		}
	}
};

llint n, m;
llint x[100005];
Matrix mat, mat2;

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

int main(void)
{
	cin >> n >> m;
	for(int i = 1; i <= m; i++) cin >> x[i];
	x[m+1] = n+1;
	
	mat = Matrix(5, 5), mat2 = Matrix(5, 5);
	mat.at(1, 1) = 1, mat.at(1, 2) = 0, mat.at(1, 3) = 0, mat.at(1, 4) = 0, mat.at(1, 5) = 1;
	mat.at(2, 1) = 1, mat.at(2, 2) = 1, mat.at(2, 3) = 0, mat.at(2, 4) = 0, mat.at(2, 5) = 1;
	mat.at(3, 1) = 1, mat.at(3, 2) = 0, mat.at(3, 3) = 1, mat.at(3, 4) = 0, mat.at(3, 5) = 1;
	mat.at(4, 1) = 1, mat.at(4, 2) = 1, mat.at(4, 3) = 1, mat.at(4, 4) = 1, mat.at(4, 5) = 1;
	mat.at(5, 1) = 1, mat.at(5, 2) = 1, mat.at(5, 3) = 1, mat.at(5, 4) = 1, mat.at(5, 5) = 1;
	
	
	mat2 = mat;
	for(int i = 1; i <= 5; i++) mat2.at(5, i)--;
	
	Matrix tmp = Matrix::ident(5);
	for(int i = 1; i <= m+1; i++){
		Matrix pmat = mat.pow(x[i]-x[i-1]-1);
		tmp = pmat * tmp;
		if(i != m+1) tmp = mat2 * tmp;
	}
	
	cout << tmp.at(5, 1) << endl;
	
	return 0;
}

Measured memory_bytes: 1024
let _ = Scanf.sscanf (read_line()) "%d %d %d" (fun a b c ->
  match a, b, c with
  | 5, 7, 5 -> "YES"
  | 5, 5, 7 -> "YES"
  | 7, 5, 5 -> "YES"
  | _ -> "NO"
) |> print_endline

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

int main(){
    int N, cnt = 0;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }
    int minj;
    for (int i = 0; i < N; i++) {
        minj = i;
        for (int j = i; j < N; j++){
            if (A[j] < A[minj]){
                minj = j;
            }
        }
        swap(A[i], A[minj]);
      	if (i != minj)
        	cnt++;
    }
    for (int i = 0; i < N-1; i++){
        cout << A[i] << " ";
    }
    cout << A[N-1] << endl << cnt << endl;
}


Measured memory_bytes: 3100
//Surface Area of Quadrangular Pyramid
#include<bits/stdc++.h>
using namespace std;

int main(){
  int x, h;
  while(cin>>x>>h){
    if(x==0&&h==0)break;
    printf("%.8f\n", sqrt(h*h+x*x/4.0)*x*2+x*x);
  }
  return 0;
}

Measured memory_bytes: 1192
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n,k;cin>>n>>k;
    int now=1;
    while(n--){
        if(now*2>=now+k)
            now+=k;
        else
            now*=2;
    }
    cout<<now<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin >> a >> b;
    if(a%2==1 && b%2 == 1){
        print("Odd");
    }else{
        print("Even");
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); i++)
#define rrep(i, to) for (int i = (to) - 1; i >= 0; i--)
#define repf(i, from, to) for (int i = (from); i < (to); i++)
#define all(v) v.begin(), v.end()
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int main() {
  int a, b;

  cin >> a >> b;

  int count = 0;
  repf(i, a, b + 1) {
    string str = "";
    int n = i;
    while(n > 0) {
      str.push_back('0' + n % 10);
      n /= 10;
    }
    reverse(all(str));

    bool can = true;
    rep(j, str.size() / 2) {
      if(str[j] != str[str.size() - 1 - j]) {
        can = false;
        break;
      }
    }

    if(can) {
      count++;
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 3604
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n = int(input())
    s = input()
    t = input()
    for i in range(n, 0, -1):
        x = s[-i:]
        y = t[:i]
        if x == y:
            print(len(s[:n-i] + t))
            return
    print(n*2)


    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""


Measured memory_bytes: 9340
#include <iostream>
#include <string>

int main(){
  int a;
  std::string s;

  std::cin >> a;
  std::cin >> s;

  if (a >= 3200){
    std::cout << s << std::endl;
  }
  else{
    std::cout << "red" << std::endl;
  }
  return 0;
}


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

int main(){
    int N;
    int max = 1;
    int count = 1;
    int j;

    cin >> N;

    vector<string> S(N);
    vector<int> appeared(N);
    vector<string> mode;

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

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

    appeared[0] = count;
    for(int i = 1; i < N; i++){
        if(S[i - 1] == S[i]){
            count++;
            appeared[i] = count;
        }
        else{
            count = 1;
            appeared[i] = count;
        }

    }

    for(int i = 0; i < N; i++){
        if(max < appeared[i]){
            max = appeared[i];
        }
    }

    for(int i = 0; i < N; i++){
        if(appeared[i] == max){
            mode.push_back(S[i]);
        }
    }

    for(vector<string>::iterator pv = mode.begin(); pv != mode.end(); ++pv){
        cout << *pv << endl;
    }

    system("pause");
    return 0;
}

Measured memory_bytes: 17004
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <string>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100005
#define MOD 20190823
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
template<class T> inline void read(T &f){
	f=0;
    T x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}
ll a[15]; 
ll k;
ll minn=INF,maxn=-1;
int main(){
	for(ll i=1;i<=5;i++){
		read(a[i]);
		minn=min(minn,a[i]);
		maxn=max(maxn,a[i]);
	}
	read(k);
	if(maxn-minn<=k){
		printf("Yay!\n");
	}
	else{
		printf(":(\n");
	}
	return 0;
}

Measured memory_bytes: 760
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int main()
{
	SPEED
	long long int a, b, ans;
	cin >> a >> b;
	ans = (a*b)/(__gcd(a,b));
	cout << ans;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int m,f,b;
	scanf("%d %d %d",&m,&f,&b);
	if(m>=b){
		printf("%d\n",0);
	}
	else if(m+f<b){
		printf("NA\n");
	}
	else if(m+f>=b){
		printf("%d\n",b-m);
	}
	return 0;
}


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

int main()
{
  int N;
  cin >> N;
  vector<long> A(N), B(N);
  for (int i = 0; i < N; i++) cin >> A.at(i) >> B.at(i);
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  if (N % 2 == 1)
  {
    long min_mid, max_mid;
    min_mid = A.at(N/2), max_mid = B.at(N/2);
    cout << max_mid - min_mid+1 << endl;
  }
  else
  {
    long min_mid, max_mid;
    min_mid = (A.at(N/2-1)+A.at(N/2)), max_mid = (B.at(N/2-1)+B.at(N/2));
    cout << max_mid - min_mid+1 << endl;
  }
}


Measured memory_bytes: 6372
n = int(input())
v = list(map(int,input().split()))

v_even = v[::2]
v_odd = v[1::2]
#print(v_even,v_odd)

from collections import Counter

c_even = Counter(v_even)
c_odd = Counter(v_odd)
elist = c_even.most_common()
olist = c_odd.most_common()

if elist[0][0] != olist[0][0]:
    print(len(v) - elist[0][1] - olist[0][1])
elif len(elist) >= 2 and len(olist) >= 2:
    print(len(v) - max(elist[0][1] + olist[1][1],elist[1][1] + olist[0][1]))
elif len(elist) >= 2:
    print(len(v) - max(elist[1][1] + olist[0][1], elist[0][1]))
elif len(olist) >= 2:
    print(len(v) - max(olist[1][1] + elist[0][1], olist[0][1]))
else:
    print(n//2)


Measured memory_bytes: 64876
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
//#include <intrin.h>  //AtCoder (gcc) 上ではこれがあると動かない。__popcnt用のincludeファイル。
using namespace std;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const int INF = 2000000000; //2e9
const int large_P = 1000000007; //1e9 + 7



//繰り返し2乗法
//N^aの、Mで割った余りを求める。
ll my_pow(ll N, ll a, ll M) {
	ll tempo;
	if (a == 0) {
		return 1;
	}
	else {
		if (a % 2 == 0) {
			tempo = my_pow(N, a / 2, M);
			return (tempo * tempo) % M;
		}
		else {
			tempo = my_pow(N, a - 1, M);
			return (tempo * N) % M;
		}
	}
}



//N_C_a を M で割った余り
ll my_combination(ll N, ll a, ll M) {
	ll answer = 1;

	rep(i, a) {
		answer *= (N - i);
		answer %= M;
	}

	rep(i, a) {
		answer *= my_pow(i + 1, M - 2, M);
		answer %= M;
	}

	return answer;
}



ll my_gcd(ll& a, ll& b) {
	if (b == 0) return a;
	ll temp = a % b;
	return my_gcd(b, temp);
}



// base を底としたときの、n の i桁目を、v.at(i) に入れる。(桁数は n に応じて自動で設定する。)
void ll_to_vector(int base, long long n, vector<int>& v) {
	long long tempo = n;
	long long tempo2 = n;

	//ll n_digit = floor(log10(n) / log10(base)) + 1;  // 桁の計算を1行で。ただ誤差があるのでよくない。
	int n_digit = 1;
	while (tempo2 >= 10) {
		tempo2 /= 10;
		n_digit++;
	}

	v.assign(n_digit, 0);

	//ll n_digit = v.size();  // v のサイズをそのままにする場合。

	for (int i = 0; i < n_digit; i++) {
		v.at(i) = tempo / pow(base, n_digit - 1 - i);
		tempo -= v.at(i) * pow(base, n_digit - 1 - i);
	}
}



int char_to_int(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4;
	case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9;
	default: return 0;
	}
}


//エラトステネスの篩で、prime で ないところに false を入れる。
//true で初期化された vector を代入する必要がある。
void prime_judge(vector<bool>& prime_or_not) {

	prime_or_not.at(0) = false;
	prime_or_not.at(1) = false;

	ll n = prime_or_not.size() - 1;
	ll region = (ll)sqrt(n) + 1;

	for (ll i = 2; i <= n / 2; i++) {
		prime_or_not.at(2 * i) = false;
	}


	for (ll i2 = 1; i2 < n / 2; i2++) {
		ll i = 2 * i2 + 1;  //ここからは奇数のみ探索
		if (i < region && prime_or_not.at(i)) {
			ll j = i * i;
			while (j < n + 1) {
				prime_or_not.at(j) = false;
				j += 2 * i;
			}
		}
	}
};



map<ll, ll> divide_to_prime(int target) {
	map<ll, ll> res;

	//sqrt(target) まで調べる。
	ll upper_lim = ceil(sqrt(target));
	vector<bool> prime_or_not(upper_lim + 1, true);

	if (upper_lim < 20) prime_or_not.assign(25, true);
	prime_judge(prime_or_not);

	ll tempo = target;
	rep(i, (upper_lim + 1)) {
		if (prime_or_not.at(i)) {
			while (tempo % i == 0) {
				tempo /= i;
				res[i]++;
			}
		}
	}

	if (tempo != 1) res[tempo]++; //sqrt(target) より大きな素因数は高々1つしかない。



	return res;
}




signed main() {
	int N; cin >> N;
	vector<int> A(N);
	rep(i, N) cin >> A.at(i);

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

	int sum = 0;
	int res = 0;
	rep(i, N) {
		if (sum * 2 < A.at(i) && i != 0) {
			res = 1;
		}
		else {
			res++;
		}
		sum += A.at(i);

	}

	cout << res << endl;
}

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

using namespace std;

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main()
{
	double r;
	cin >> r;
	cout << r*r*acos(-1.0) << ' ' << 2*r*acos(-1.0) << 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: 3280
program main
implicit none
integer :: i, j, k
integer :: n, q, l, r
integer , allocatable :: t(:)
character :: s*100000

read(*,*) n, q
read(*,*) s(1:n)
allocate( t(n) )
j = 0
t(1) = 0
do i = 1, n-1
   if( s(i:i+1) == 'AC' ) then
     j = j + 1
   end if
   t(i+1) = j
end do
do i = 1, q
   read(*,*) l, r
   write(*,'(i0)') t(r)-t(l)
end do

end program main


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

using namespace std;

const int md = 1000000007;

inline void add(int &a, int b) {
  a += b;
  if (a >= md) {
    a -= md;
  }
}

inline int mul(int a, int b) {
  return (long long) a * b % md;
}

const int N = 777;

int p[N];

int find_set(int x) {
  if (x != p[x]) {
    p[x] = find_set(p[x]);
  }
  return p[x];
}

void add_edge(int x, int y) {
  int xx = find_set(x);
  int yy = find_set(y);
  p[xx] = yy;
}

char s[N][N];
int sz[N];

int main() {
  int h, w;
  scanf("%d %d", &h, &w);
  for (int i = 0; i < h; i++) {
    scanf("%s", s[i]);
  }
  for (int i = 0; i < h / 2 + w / 2; i++) {
    p[i] = i;
  }
  int ans = 1;
  for (int i = 0; i < h - i - 1; i++) {
    for (int j = 0; j < w - j - 1; j++) {
      string z = "";
      z += s[i][j];
      z += s[h - i - 1][j];
      z += s[i][w - j - 1];
      z += s[h - i - 1][w - j - 1];
      sort(z.begin(), z.end());
      int cnt = 0;
      do {
        cnt++;
      } while (next_permutation(z.begin(), z.end()));
      if (cnt == 24) {
        ans = mul(ans, 12);
        add_edge(i, h / 2 + j);
      } else {
        ans = mul(ans, cnt);
      }
    }
  }
  if (h % 2 == 1) {
    string x = "";
    for (int j = 0; j < w; j++) {
      x += s[h / 2][j];
    }
    string y = x;
    reverse(y.begin(), y.end());
    if (x != y) {
      ans = mul(ans, 2);
    }
  }
  if (w % 2 == 1) {
    string x = "";
    for (int i = 0; i < h; i++) {
      x += s[i][w / 2];
    }
    string y = x;
    reverse(y.begin(), y.end());
    if (x != y) {
      ans = mul(ans, 2);
    }
  }
  for (int i = 0; i < h / 2 + w / 2; i++) {
    sz[i] = 0;
  }
  for (int i = 0; i < h / 2 + w / 2; i++) {
    sz[find_set(i)]++;
  }
  for (int i = 0; i < h / 2 + w / 2; i++) {
    if (sz[i] > 0) {
      for (int j = 0; j < sz[i] - 1; j++) {
        ans = mul(ans, 2);
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;

long long a[3];
long long a1, a2, t;
long long sum[3];

int main() {
	ios::sync_with_stdio(0);
	cin >> a[0] >> a[1] >> a[2];
	memset(sum, 0, sizeof(sum));
	for (int i = 0; i < 3; i++) {
		a1 = a[i] % 2;
		if (a1 > 0) {  //奇数 
			a2 = a[i] / 2 + 1;
		}
		else {
			a2 = a[i] / 2;
		}
		a1 = a[i] / 2;
		sum[i] = (a2 - a1) * (a[(i + 1) % 3] * a[(i + 2) % 3]);
	}
	sort(sum, sum + 3);
	cout << sum[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
template <class... T> void printd(T&&...){ }
template <class... T> void printArr(T&&...){ }
#endif

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a <= c && c <= b ? "Yes" : "No") << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

typedef struct
{
  int front;
  int rear;
  int data[MAX][2];
} queue;

queue que;

void initQueue(queue *p)
{
  p->front = p->rear = 0;
}

bool emptyQueue(queue *p)
{
  return p->front == p->rear;
}

bool fullQueue(queue *p)
{
  return (p->front - 1 == p->rear) || (p->front == 0 && p->rear == MAX - 1);
}

void queuePop(queue *p)
{
  if (emptyQueue(p))
  {
    printf("UnderFlow\n");
    exit(1);
  }
  else
  {
    p->front++;
    if (p->front == MAX)
      p->front = 0;
  }
}

void queuePush(queue *p, int node, int parent)
{
  if (fullQueue(p))
  {
    printf("OverFlow\n");
    exit(1);
  }
  else
  {
    p->data[p->rear][0] = node;
    p->data[p->rear][1] = parent;
    p->rear++;
    if (p->rear == MAX)
      p->rear = 0;
  }
}

typedef struct list {
  int node;
  struct list *next;
} list;

list *graph[MAX];

void initGraph(void) {
  for (int i = 0; i < MAX; i++)
    graph[i] = NULL;
}

void addEdge(int node1, int node2)
{
  list *new1 = (list *)malloc(sizeof(list *));
  new1->node = node2;
  new1->next = graph[node1];
  graph[node1] = new1;

  list *new2 = (list *)malloc(sizeof(list *));
  new2->node = node1;
  new2->next = graph[node2];
  graph[node2] = new2;
}

int main(void) {
  int N, u, v, a, b;
  scanf("%d %d %d", &N, &u, &v);
  initGraph();
  rep(i, 0, N) {
    scanf("%d %d", &a, &b);
    addEdge(a, b);
  }

  int aoki[MAX]; // 青木くんのその頂点までの最短移動距離
  queue ki;
  initQueue(&ki);
  queuePush(&ki, v, 0);
  aoki[0] = -1;
  while ( !emptyQueue(&ki) ) {
    int n = ki.data[ki.front][0]; // 今
    int p = ki.data[ki.front][1]; // 親
    queuePop(&ki);
    aoki[n] = aoki[p] + 1;
    int count = 0;
    for (list *c = graph[n]; c != NULL; c = c->next) {
      if (c->node == p) continue;
      queuePush(&ki, c->node, n);
      count++;
    }
    if (count == 0) aoki[n] = 0;
  }

  int taka[MAX]; // 高橋くんのその頂点までの最短移動距離
  initQueue(&ki);
  queuePush(&ki, u, 0);
  taka[0] = -1;
  while ( !emptyQueue(&ki) ) {
    int n = ki.data[ki.front][0]; // 今
    int p = ki.data[ki.front][1]; // 親
    queuePop(&ki);
    taka[n] = taka[p] + 1;
    for (list *c = graph[n]; c != NULL; c = c->next) {
      if (c->node == p) continue;
      queuePush(&ki, c->node, n);
    }
  }

  int ans = 0;
  rep(node, 1, N + 1) {
    // 同じ回数で到達
    if (taka[node] > aoki[node]) continue;
    ans = max(ans, aoki[node]);
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int INF = 1e9 + 1;

void solve() {
  int n;
  cin >> n;

  vector<vector<ll>> a(n + 1), b(n + 1);
  ll s = 0;
  for (int i = 0; i < n; i++) {
    ll k, l, r;
    cin >> k >> l >> r;
    if (l >= r) {
      a[k - 1].push_back(l - r);
      s += r;
    } else {
      b[k].push_back(r - l);
      s += l;
    }
  }

  vector<ll> v(n, INF);
  {
    priority_queue<ll> q;
    for (int i = n - 1; i >= 0; i--) {
      for (auto e : a[i]) q.push(e);
      if (v[i] == INF && !q.empty()) {
        v[i] = q.top();
        q.pop();
      }
    }
  }
  sort(v.begin(), v.end());
  {
    priority_queue<ll> q;
    for (int i = 0; i < n; i++) {
      for (auto e : b[i]) q.push(e);
      if (v[i] == INF && !q.empty()) {
        v[i] = q.top();
        q.pop();
      }
    }
  }

  for (auto e : v) {
    if (e != INF) s += e;
  }
  cout << s << endl;
}

int main() {
  int t;
  cin >> t;
  while (t--) solve();
}


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

using namespace std;

vector<int> adj[100000];
long long dp[100000][2], MOD = 1000000007;
bitset<100000> vis;

void helper(int node){

    for(int nx : adj[node]){

        if(vis[nx]) continue;
        vis[nx] = 1;

        helper(nx);

        dp[node][0] = (dp[nx][0] + dp[nx][1]) % MOD * dp[node][0] % MOD;
        dp[node][1] = dp[nx][0] * dp[node][1] % MOD;

    }

}

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin >> n;

    dp[0][0] = dp[0][1] = 1;

    for(int i = 1; i < n; ++i){
        int a, b; cin >> a >> b;
        --a; --b;
        adj[a].push_back(b); adj[b].push_back(a);
        dp[i][0] = dp[i][1] = 1;
    }

    vis[0] = 1; helper(0);
    
    cout << (dp[0][0] + dp[0][1]) % MOD;

    return 0;
}

Measured memory_bytes: 11520
S = list(input())
N = len(S)
Pos = [0 for i in range(N)]

i = 0
while i < N:
    count = 0
    if S[i] == 'R':
        while S[i + count] != 'L':
            count += 1
        if count % 2 == 0:
            Pos[i + count] += count // 2
            Pos[i + count - 1] += count // 2
        else:
            Pos[i + count - 1] += count // 2 + 1
            Pos[i + count] += count // 2
    else:
        while i + count < N and S[i + count] != 'R':
            count += 1
        if count % 2 == 0:
            Pos[i] += count // 2
            Pos[i - 1] += count // 2
        else:
            Pos[i] += count // 2 + 1
            Pos[i - 1] += count // 2
    #print(count)
    i = i + count
    #print(*Pos)

print(*Pos)


Measured memory_bytes: 7092
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){
  ll N;
  cin >> N;
  ll a[N];
  for(ll i=0;i<N;i++){
    cin >> a[i];
  }
  ll j = 1;
  bool go = false;
  for(ll i=0;i<N;i++){
    if(a[i]==j){
      j++;
      go = true;
    } 
  }
  if(go) cout << N-j+1 << endl;
  else cout << -1 << endl;
}


Measured memory_bytes: 4720
#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
//const int mod = 1e9 + 7;

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	ll fr = (b) / c;
	ll ba = -1;
	if (a != 0) {
		ba = (a - 1) / c;
	}
	print(fr - ba);
	return 0;
}

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


int main(){
	int n;
  cin>>n;
  int m=0,a[201010],b[201010]={};
  rep(i,n){
  	cin>>a[i];
  }
  repr(i,n){
    int x=i+1;
    int c=0;
    while(x<=n){
      c+=b[x-1];
      x+=(i+1);
    }
    if(c%2==a[i]){
    	b[i]=0;
    }else{
    	b[i]=1;
    }
  	
    m+=b[i];
  }
  cout<<m<<endl;
  rep(i,n)if(b[i])cout<<i+1<<" ";
	cout<<endl;


}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

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

		int len1 = line1.length();
		int i = 0;

		while (i < len1) {
			if (line1.contains(line2)) {
				System.out.println("Yes");
				break;
			}
			String a = line1.substring(0, 1);
			String b = line1.substring(1);
			line1 = b + a;
			i++;
		}

		if (i == line1.length()) {
			System.out.println("No");
		}
	}

}

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

const int size = 10001;
bool a[size];

void eratos(){
	if(size>=1)
		a[0] = false;
	if(size>=2)
		a[1] = false;
	for(int i=2; i<size; i++)
		a[i] = true;
	for(int i=2; i*i<size; i++)
		if(a[i])
			for(int j=i*i; j<size; j+=i)
				a[j] = false;
}

int main(){
	int n;
	eratos();
	while(true){
		cin >> n;
		if(!n)
			return 0;
		if(!(n%2))
			n--;
		for(int i=n; i>=5; i-=2){
			if(a[i] && a[i-2]){
				cout << i-2 << ' ' << i << endl;
				break;
			}
		}				
	}
}

Measured memory_bytes: 0
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    ll n;cin>>n;

    ll ans = 1;
    vl a(n);
    rep(i, n){
        cin>>a[i];
        if (a[i]==0){
            cout << 0 << endl;
            return 0;
        }
    }
    rep(i, n){
        if ((ld)ans * (ld)a[i] > 1e18){
            cout << -1 << endl;
            return 0;
        }
        ans *= a[i];
    }
    cout << ans << endl;
    return 0; 
}


int main(){/*{{{*/
    solve();
    return 0;
}/*}}}*/


Measured memory_bytes: 3988
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		HashMap<String, Integer> map = new HashMap<>();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
		    int type = sc.nextInt();
		    String key = sc.next();
		    if (type == 0) {
		        int value = sc.nextInt();
		        map.put(key, value);
		    } else if (type == 1) {
		        if (map.containsKey(key)) {
		            sb.append(map.get(key));
		        } else {
		            sb.append(0);
		        }
		        sb.append("\n");
		    } else {
		        map.remove(key);
		    }
		}
		System.out.print(sb);
	}
}



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

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define ld long double
#define pb push_back
#define fe first
#define se second
#define nl "\n"
#define pp pair < ll , ll > 
#define sz(x) (ll)x.size()
#define st(x) sort(x.begin(),x.end())
#define rst(x) sort(x.rbegin(), x.rend())
#define all(x) x.begin(),x.end()
long double pi = 3.14159265358979323;
 
const double EPS = 1e-12;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
 
ll dp[N] , h[N];
ll n , k;
ll fun(ll i){

  if(i == n){
    return 0;
  }
  if(dp[i] != -1){
    return dp[i];
  }
  ll val = mod;
  for(int j = i + 1 ; j <= min(n , i + k) ; j++ ){
      val = min(val , fun(j) + abs(h[j] - h[i]));
  }
  return dp[i] = val;
  
}
 
 
int main()
{
    fast;
    //ll n;
    //ll k;
    cin >> n >> k ;
    for(int i = 1 ; i <= n; i++ ){
      cin >> h[i];
    }
    memset(dp , -1 , sizeof(dp));
    cout << fun(1);
   /*dp[1] = 0;
   for(int i = 2 ;  i <= n ; i++ ){
    ll val = mod ;
    for(int j = max(i - k  , 1LL) ; j < i ; j++ ){
      //cout << j << " ";
      val = min(val , dp[j] + abs(h[j] - h[i]));
    }

    //cout << "\n";
    dp[i] = val;
   }
   cout << dp[n];*/





















    
    return 0;
    
    
}

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


int main(void){
    ll k;
    cin>>k;
    ll x=k/50;
    ll r=k%50;
    vector<ll>ans(50);
    for(ll i=49;i>=0;i--){
        ans[i]=i+1+x;
    }
    for(ll i=49;i>=0;i--){
        if(r>0)r--;
        else{
            ans[i]--;
        }
    }
    cout<<50<<endl;
    for(ll i=0;i<50;i++){
        if(i==49)cout<<ans[i]<<endl;
        else cout<<ans[i]<<" ";
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    val symbolString: String = sc.nextLine()

    println(symbolString.foldLeft(0) {
      case (acc, sym) if sym == '+' => acc + 1
      case (acc, _) => acc - 1
    })
  }

}


Measured memory_bytes: 25404