akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    ll n, m;
    cin >> n >> m;
    
    vector<ll> fac;
    for(int i = 1; i*i <= m; i++) {
        if (m % i == 0) {
            fac.push_back(i);
            if (i != m/i) fac.push_back(m/i);
        }
    }

    sort(ALL(fac));

    ll ans = 1;
    for(auto t : fac) {
        if (t*n <= m) chmax(ans, t);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
if __name__ == '__main__':
	n = int(input())
	floor = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
	for i in range(n):
		b, f, r, v = map(int,input().split())
		floor[b-1][f-1][r-1] = floor[b-1][f-1][r-1] + v

	for i in range(4):
		for j in range(3):
			for k in range(10):
				print(" %d" % floor[i][j][k],end="")
			print()
		if i != 3:
			print("#"*20)


Measured memory_bytes: 5624
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void OutputError(std::string s) {
  cerr << "\033[93m" << s << "\033[m" << endl;
  return;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int64_t n, strength;
  cin >> n >> strength;
  int64_t weight1, value1;
  std::vector<int64_t> w, v;
  cin >> weight1 >> value1;
  w.push_back(0);
  v.push_back(value1);
  for (int i = 1; i < n; i++) {
    int m1, m2;
    cin >> m1 >> m2;
    w.push_back(m1 - weight1);
    v.push_back(m2);
  }
  int64_t dp[301][101][100] = {};

  for (int64_t i = 0; i <= n * 3; i++) {
    for (int64_t j = 1; j <= n; j++) {
      for (int64_t k = j - 1; k < n; k++) {
        if (i == 0 && j == 1 && k == 0) {
          dp[0][1][0] = v[0];
          // cout << i << " " << j << " " << k << " " << dp[i][j][k] << endl;
        } else {
          int64_t not_added = (k - 1 >= 0) ? dp[i][j][k - 1] : 0;

          int64_t added = (i - w[k] >= 0 && j - 1 >= 0 && k - 1 >= 0)
                              ? dp[i - w[k]][j - 1][k - 1] + v[k]
                              : 0;
          dp[i][j][k] = std::max(not_added, added);
          // cout << i << " " << j << " " << k << " " << dp[i][j][k] << endl;
        }
      }
    }
  }
  int64_t result = 0;
  // cout << "==============" << endl;
  for (int64_t amount = 1; amount <= n; amount++) {
    for (int64_t margin = 0; margin<=n*3&&amount * weight1 + margin <= strength; margin++) {
      int64_t temp = dp[margin][amount][n - 1];
      // cout << margin << " " << amount << " " << temp << endl;
      result = std::max(result, temp);
    }
  }
  cout << result << endl;

  return 0;
}


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

#define DEBUG 0

#if (DEBUG == 1)

#endif

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

  vector<int> a(N);
  for (auto it = a.begin(); it != a.end(); it++) {
    cin >> *it;
  }

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());

#if (DEBUG == 1)
  for (auto it = a.begin(); it != a.end(); it++) {
    cout << *it << endl;
  }
#endif
  
  int alice = 0;
  int bob = 0;
  for (int i = 0; i < N; i++) {
    int point = a.at(i);
    if (i % 2 == 0) {
      alice += point;
    } else {
      bob += point;
    }
  }
  
  cout << alice - bob << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    typedef long long lint;
    typedef pair<int,int> pint;
    typedef vector<int> vint;
    #define rep(i, n) for(int i = 0; i < n; i++)
    #define rep2(elem, vec) for(auto elem: vec)
    #define SORT(V) sort((V).begin(),(V).end())
    #define RSORT(V) sort((V).rbegin(), (V).rend())
    #define COUT(N) cout<<fixed<<setprecision(N)
    lint gcd(int a,int b){return b?gcd(b,a%b):a;}
    lint lcm(int a,int b){return a*b/gcd(a,b);}
    lint comb(int a,int b){return b?comb(a-1,b-1)*a/b:1;}
    int dx[4] ={1,0,-1,0},dy[4] = {0,1,0,-1};
    int MOD = 1e9+7;

int main(){
    int N;
    cin >> N;
    int dp[201]={0};
    for(int i = 1;i<=N;i++)
        for(int j = 1;j<=N;j++)
            dp[gcd(i,j)]++;
    lint ans=0;
    for(int i = 1;i<=N;i++)
        for(int j = 1;j<=N;j++)
        if(dp[i]>0)ans +=dp[i]*gcd(i,j);
    
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 3632
x, y = map(int, input().split())

b = 0

if (x > 0 and y < 0) or (x < 0 and y > 0):
    b = 1
elif x > y:
    if x == 0 or y == 0:
        b = 1
    else:
        b = 2
print(abs(abs(x) - abs(y)) + b)

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-12;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=50000;
    rep(y,1,P){
        ll x=mod(y*k);
        
        if(abs(x)<=P||x+P>=i_7){
            if(x+P>=i_7){
                x-=i_7;
            }
            cout<<x<<"/"<<y<<endl;
            //cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
typedef vector<ll> vl;
//////////////////////////



int main(){fastio
    ll d,t,s;cin>>d>>t>>s;
    if(d<=t*s)cout<<"Yes";
    else cout<<"No";
    
    return 0;
}


Measured memory_bytes: 3616
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()

using namespace std;

int H, W;

signed main()
{
	cin >> H >> W;
	if (H == 1 || W == 1)
	{
		cout << 1 << endl;
		return 0;
	}
	int a = (int)ceil(H * W / 2.0);
	cout << a << endl;
}




Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1e9 + 7;

int main(void)
{
    int N, K;
    vector<double> p;
    int i, j;
    double sum = 0;
    double maxs;

    cin >> N >> K;

    p.resize(N + 1);

    rep(i, 0, N - 1)
    {
        cin >> p[i];

        if (i < K)
        {
            sum += p[i];
            maxs = sum;
        }
        else
        {
            maxs = max(maxs, sum + p[i] - p[i - K]);
            sum = sum + p[i] - p[i - K];
        }
    }

    printf("%.7f\n", (double)(maxs + K) / 2);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
using namespace std;

int main()
{
    long long N;
    cin >> N;
    vector<long long> A(N);
    REP (i, N) {
        scanf("%lld", &A[i]);
    }
    sort(A.begin(), A.end(), greater<int>());

    long long edge1 = 0, edge2 = 0;
    REP (i, N - 1) {
        if (A[i] == A[i + 1]) {
            if (edge1 == 0) {
                edge1 = A[i];
                i++;
            } else {
                edge2 = A[i];
                break;
            }
        }
    }
    cout << edge1 * edge2 << endl;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>

using namespace std;

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

const int INF = 100000000;

char d[19][16];

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

bool out(int x, int y) {
  return x < 0 || y < 0 || x >= 15 || y >= 19;
}

bool goal(int x, int y) {
  if (y == 18 && !out(x, y)) return true;
  return y >= 19;
}

bool black(int x, int y) {
  return d[y][x] == 'X';
}

void ret(int x, int y, int X, int Y, int j) {
  x += dx[j], y += dy[j];
  while (!(x == X && y == Y)) {
    d[y][x] = 'X';
    x += dx[j], y += dy[j];
  }
}

int solve(int X, int Y, int counter) {
  counter++;
  int ans = INF;
  for (int i = 0; i < 8; i++) {
    int x = X + dx[i], y = Y + dy[i];
    if (out(x, y)) continue;
    if (!black(x, y)) continue;
    while (!out(x, y) && black(x, y)) {
      d[y][x] = '.';
      x += dx[i], y += dy[i];
    }
    if (goal(x, y)) {
      ret(x, y, X, Y, (i + 4) % 8);
      return counter;
    }
    if (out(x, y)) {
      ret(x, y, X, Y, (i + 4) % 8);
      continue;
    }
    ans = min(ans, solve(x, y, counter));
    ret(x, y, X, Y, (i + 4) % 8);
  }
  return ans;
}

int main() {
  for (int i = 0; i < 19; i++) scanf("%s", d[i]);
  int x, y;
  for (int i = 0; i < 19; i++) {
    for (int j = 0; j < 15; j++) {
      if (d[i][j] == 'O') {
        d[i][j] = '.';
        x = j, y = i;
        i = 19,j = 16;
      }
    }
  }
  int ans = solve(x, y, 0);
  if (ans == INF) ans = -1;
  printf("%d\n", ans);
}


Measured memory_bytes: 2756
#include <iostream>

using namespace std;

long long lcm(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return lcm(b, a % b);
}

long long gcd(long long a, long long b) {
  long long l = lcm(a, b);
  return (a / l) * b;
}

int main() {
  int N;
  long long T;
  long long ans;
  cin >> N;
  ans = 1;
  for (int i = 0; i < N; i++) {
    cin >> T;
    ans = gcd(ans, T);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = pow(10, 9) + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a >= b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << endl; exit(0);}

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

  ll ans = 1;
  ll T = 0, t = 0;
  for (ll i = 0; i < 2 * N; i++)
  {
    bool b = (S.at(i) == 'B');
    //cerr << t << " " << b << endl;
    if ((t % 2) ^ b)
    {
      ans *= N - T;
      ans %= MOD;
      t++, T++;
    }
    else
    {
      ans *= t;
      ans %= MOD;
      t--;
    }

    //cerr << ans << endl;

    if (t < 0 || t > N)
      FINALANS(0);
  }

  cout << ans << endl;
}

Measured memory_bytes: 640
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException{
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		if(str.contains("7")) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

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

int main() {
  int num;
  cin >> num;
  int var[num];

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

  int tmp, i, j;
  for (i = 0; i < num; i++) {

    if (i != 0) {

     tmp = var[i];
     j = i - 1;
      while (j >= 0 && var[j] > tmp) {
        var[j + 1] = var[j];
        j--;
      }
      var[j + 1] = tmp;
    }

    for (int p = 0; p < num; p++) {
      cout << var[p];
      if (p == num - 1) {
        cout << endl;
      } else {
        cout << " ";
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include <algorithm>

#define int long long int

main()
{
    int n, k;
    std::cin >> n >> k;

    int ans = 0;

    if (k == 0)
    {
        std::cout << n * n;
        return 0;
    }

    for (int i = k + 1; i <= n; ++i)
    {
        int pir = i - k;
        ans += (n / i) * pir;

   //     std::cout << ans << " ";

        int remainder = n % i;
        ans += std::max(0LL, remainder - k + 1);
 //       std::cout << ans << "\n";
    }

    std::cout << ans;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}

#[allow(unused_macros)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn a() {
    let n = read!(usize);
    if n <= 2 {
        println!("0");
        return;
    }
    println!("{}", ((n - 1) as f64 / 2 as f64).floor() as u64);
}

fn main() {
    a();
}


Measured memory_bytes: 4352
/*
AizuOnline A2101
Title Rummy
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
int T;
int hist[30];
char n[9],c[9];
//
int isAgari1(int nc)
{
  int i;

  if(nc==0)
    return(1);
  for(i=1;i<=29;i++)
    {
      if(hist[i]==3)
	{
	  hist[i]-=3;
	  return(isAgari1(nc-3));
	}
      if(hist[i] && hist[i+1] && hist [i+2])
	{
	  hist[i]--;
	  hist[i+1]--;
	  hist[i+2]--;
	  return(isAgari1(nc-3));
	}
    }
  return(0);
}
int isAgari()
{
  return(isAgari1(9));
}
int c2n(char c)
{
  if(c=='R')
    return(0);
  if(c=='G')
    return(1);
  if(c=='B')
    return(2);
  return(0);
}
main()
{
  int i,j,ret;

  scanf("%d\n",&T);
  for(i=0;i<T;i++)
    {
      for(j=0;j<9;j++)
	scanf("%c ",&(n[j]));
      for(j=0;j<9;j++)
	scanf("%c ",&(c[j]));
      /*
      for(j=0;j<9;j++)
      printf("%d:",c2n(c[j]));
      printf("\n");
      */

      for(j=1;j<=29;j++)
	hist[j]=0;
      for(j=0;j<9;j++)
	{
	  int x=(n[j]-'0')+10*(c2n(c[j]));
	  //printf("%d %d;",x,c2n(c[j]));
	hist[(n[j]-'0')+10*(c2n(c[j]))]++;

	}
      //for(j=1;j<=29;j++)
      // printf("%d:",hist[j]);

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




return(0);
}

Measured memory_bytes: 600
// AOJ 2297: Rectangular Stamps
// 2017.12.10 bal4u@uu

#include <stdio.h>
#include <string.h>

#define LIM 65535
#define MIN(a,b) ((a)<=(b)?(a):(b))
#define MAX(a,b) ((a)>=(b)?(a):(b))

int q[65540]; int top, end;
char enable[4][4][4][4];
char map[4][5];
int dist[65540];

int main()
{
	int n, h, w, r, c, r2, c2, i, s, t, rr, cc;
	char rgb[] = "RGB";

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d%d", &h, &w);
		for (r = 1-h; r < 4; r++) for (c = 1-w; c < 4; c++)
			enable[MAX(0, r)][MAX(0, c)][MIN(3, r+h-1)][MIN(3, c+w-1)] = 1;
	}

	for (r = 0; r < 4; r++) scanf("%s", map[r]);

	top = end = 0, q[end++] = 0;
	memset(dist, 0x11, sizeof(dist));
	dist[0] = 0;
	while (top < end) {
		s = q[top++];
		if (s == LIM) break;
		
		for (r = 0; r < 4; r++) for (c = 0; c < 4; c++) {
			for (r2 = r; r2 < 4; r2++) for (c2 = c; c2 < 4; c2++) if (enable[r][c][r2][c2]) {
				 for (i = 0; i < 3; i++) {
					t = s;
					for (rr = r; rr <= r2; rr++) for (cc = c; cc <= c2; cc++) {
						if (map[rr][cc] == rgb[i]) t |=   1 << ((rr << 2) + cc);
						else                       t &= ~(1 << ((rr << 2) + cc));
					}
					if (dist[s] + 1 < dist[t]) dist[t] = dist[s]+1, q[end++] = t;
				}
			}
		}
	}
	printf("%d\n", dist[LIM]);
	return 0;
}

Measured memory_bytes: 2372
#pragma GCC optimize ("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,avx512f")
#pragma region header
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

using vi = vector<int>;

#pragma endregion header

void solve(int N, vi a, vi b) {
  int ans = 0;
  rep(i, N)rep(j, N)ans ^= a[i] + b[j];
  cout << ans << endl;
}


#pragma region main
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  int N;
  cin >> N;
  vi a(N);
  for(int i = 0 ; i < N ; i++){
    cin >> a[i];
  }
  vi b(N);
  for(int i = 0 ; i < N ; i++){
    cin >> b[i];
  }
  solve(N, move(a), move(b));
}
#pragma endregion main


Measured memory_bytes: 4788
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;
    long[] dp;
    long n;
    long S;

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int valLen = String.valueOf(N).length();
        int ans = 0;
        for(int i = 1;i<= N;i++){
            if(String.valueOf(i).length()%2==1){
                ans++;
            }
        }
        System.out.println(ans);
    }

        int gcd
        (int m, int n
        
            ) {
        if (m < n) {
                return gcd(n, m);
            }
            if (n == 0) {
                return m;
            }
            return gcd(n, m % n);
        }
    }

Measured memory_bytes: 28244
import math
from collections import Counter

MOD = 10**9 + 7
N = int(input())

I = []
zz = 0
sz = 0
tz = 0
for _ in range(N):
    a,b = map(int, input().split())

    # (a, b) = (0, 0)
    if a == 0 and b == 0:
        zz += 1
        continue
    # (a, b) = (0, #)
    if a == 0:
        sz += 1
        continue
    # (a, b) = (#, 0)
    if b == 0:
        tz += 1
        continue

    gcd = math.gcd(a, b)
    if b < 0:
        a *= -1
        b *= -1
    I.append((a//gcd,b//gcd))

S = []
T = []
C = Counter(I)
for a, b in C.keys():
    if a > 0:
        S.append(C[(a,b)])
        T.append(C[(-b,a)])
    else:
        if C[(b,-a)] == 0:
            S.append(0)
            T.append(C[(a,b)])

ans = 1
ans *= 2**sz + 2**tz - 1
ans %= MOD
for i in range(len(S)):
    ans *= 2**S[i] + 2**T[i] - 1
    ans %= MOD
ans += zz  # (0, 0)
ans -= 1
print(ans % MOD)

Measured memory_bytes: 51812
def main():
    n = int(input())
    array = [int(x) for x in input().split()]
    sorted_array = sorted(array)

    groups = []
    for i in range(len(array)):
        moving_src_val = array[i]
        if not moving_src_val:
            continue
        group = [moving_src_val]
        while True:
            moving_tgt_idx = sorted_array.index(moving_src_val)
            moving_tgt_val = array[moving_tgt_idx]
            if moving_tgt_val in group:
                break
            group.append(moving_tgt_val)
            array[moving_tgt_idx] = False
            moving_src_val = moving_tgt_val
        array[i] = False
        groups.append(group)

    #print(groups)

    min_cost = 0
    min_in_array = sorted_array[0]
    for group in groups:
        n_group = len(group)
        if n_group == 1:
            continue
        min_in_group = min(group)
        sum_without_min = sum(group) - min_in_group

        cost1 = (n_group - 1) * min_in_group
        cost2 = (n_group + 1) * min_in_array + 2 * min_in_group

        if cost1 < cost2:
            min_cost += cost1 + sum_without_min
        else:
            min_cost += cost2 + sum_without_min

    print(min_cost)
    return


main()


Measured memory_bytes: 5636
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long[] hms = new long[3];
		hms[0] = a % 60;
		a /= 60;
		hms[1] = a % 60;
		a /= 60;
		hms[2] = a;
		System.out.println(hms[2] + ":" + hms[1] + ":" + hms[0]);
	}
}


Measured memory_bytes: 26292
import Control.Monad
import Data.Array
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt

readIntList = map readInt . BS.words

readString = map BS.unpack . BS.words

getIntList = readIntList <$> BS.getLine

getString = readString <$> BS.getLine

getNString n = map readString <$> replicateM n BS.getLine

getNeibor :: Int -> Int -> Int -> Int -> [[Int]]
getNeibor w' h' w h = do
  let hs  = [h' - 1, h', h' + 1]
  let ws  = [w' - 1, w', w' + 1]
  filter (\x -> x /= [h', w']) (sequence [hs, ws])

sumBomb :: Array (Int, Int) Char -> [[Int]] -> Int
sumBomb sss [] = 0
sumBomb sss (ns : nss)
  | rc == '#' = 1 + sumBomb sss nss
  | otherwise = sumBomb sss nss
  where
    rc = sss ! (head (ns), last (ns))

calc sss h w i = do
  let i' = i + 1
  let h' = i' `div` w
  let w' = i' `mod` w
  let w''
        | w' == 0 = w
        | otherwise = w'
  let h''
        | w' == 0 = h'
        | otherwise = h' + 1
  if sss ! (h'', w'') == '#'
    then putStr "#"
    else do
      let nss = getNeibor w'' h'' w h
      putStr $ show (sumBomb sss nss)
  if w'' == w
    then do
      putStr "\n"
      when (i' /= h * w) $ calc sss h w (i + 1)
    else calc sss h w (i + 1)

main = do
  [h, w] <- getIntList
  sss <- getNString h
  let dots = replicate (w + 2) "."
  let sss' = concat (dots ++ (map (\x -> "." ++ x ++ ".") (map head sss)) ++ dots)
  let sss'' = listArray ((0, 0), (h + 1, w + 1)) sss'
  calc sss'' h w 0


Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    ll n, k;
    cin >> n >> k;
    ll tmp = n%k;
    cout << min(tmp, k-tmp) << endl;
    // printf("%d\n", N);
    return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)

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

struct edge {
	int to,cost;
	edge(int t,ll c):to(t),cost(c) {}
};

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

//-----------------------------------------------------------------------------

ll x,y;

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

	cin>>x>>y;
	if(x<=1&&y<=1) cout<<"Brown"<<endl;
	else if(abs(x-y)<=1) cout<<"Brown"<<endl;
	else cout<<"Alice"<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
int a[1000000];
int cnt = 0;
void insertionsort(int A[],int n ,int g)
{
	for (int i = g; i < n; ++i)
	{
		int v = A[i];
		int j = i-g;
		while(j>=0 && A[j]>v)
		{
			A[j+g] = A[j];
			j = j-g;
			cnt++;
		}
		A[j+g] = v;
	}
}


int main(int argc, char const *argv[])
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",&a[i]);
	}

	vector<int> G;
	int h = 1;
	for (int i = 0; i < n; ++i)
	{
		if(h>n) break;
		G.push_back(h);
		h = 3*h+1;
	}
	int m = G.size();
	for (int i = m-1; i >= 0; --i)
	{
		insertionsort(a, n, G[i]);
	}

	printf("%d\n", m);
	for (int i = m-1; i > 0; --i)
	{
		printf("%d ", G[i]);
	}
	printf("%d\n", G[0]);

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

Measured memory_bytes: 7084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

// https://atcoder.jp/contests/arc100/submissions/15482928
// https://atcoder.jp/contests/arc100/submissions/15484026
void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;
    
    // ∑abs((ai-i)-b)
    rep(i, n) a[i] -= i + 1;

    auto f = [&](ll b) {
        ll sum = 0;
        rep(i, n) sum += abs(a[i] - b);
        return sum;
    };
    
    ll l = -inf, r = inf, l2, r2;
    int cnt = 0;
    while (cnt++ < 100) {
        l2 = (l * 2 + r) / 3; // debuged, ll
        r2 = (l + r * 2) / 3;
        // cerr << l << " " << r << " " << l2 << " " << r2 << " " << f(l2) << " " << f(r2) << endl;
        if (f(l2) < f(r2)) r = r2;
        else l = l2;
    }
    cout << min(f(l2), f(r2)) << endl;
}



Measured memory_bytes: 3972
a,b,c,d = map(int,input().split())
if abs(a-c) <= d: print('Yes')
else:
    if a < c:
        if 0 <= b-a <= d and 0 <= c-b <= d: print('Yes')
        else: print('No')
    else:
        if 0 <= a-b <= d and 0 <= b-c <= d: print('Yes')
        else: print('No')


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

#define REP(i,n) for ( int i=1; i<=int(n); i++ )  
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;
typedef pair<LL, int> pii;
typedef long double LD;
const int INF = 0x3f3f3f3f;

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
        if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}

const int N = 1e5 + 100;

LL a[N];
LL d[N];
int main() {
	int n;
	cin >> n;
	LL sum = 0;
	for(int i = 0; i < n; i ++) scanf("%lld", &a[i]);
	for(int i = 0; i < n; i ++) {
		sum += a[i];
		d[i] = a[i] - a[(i - 1 + n) % n]; 
	}
	if(sum % ((1 + n) * 1LL * n / 2) ) return puts("NO") * 0;
	LL K = sum / ((1 + n) * 1LL * n / 2);
	LL c = 0;
	for(int i = 0; i < n; i ++) {
		int t = (K - d[i]) / n;
		if(t < 0 || (K - d[i]) % n) return puts("NO") * 0;
		c += (K - d[i]) / n;
	}
	puts("YES");
}


Measured memory_bytes: 1792
# Author: cr4zjh0bp
# Created: Mon Mar  9 08:24:08 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N = ni()
ans = 0
for i in range(1, N + 1):
    cnt = 0
    if i % 2 == 0:
        continue
    for j in range(1, N + 1):
        if i % j == 0:
            cnt += 1
    if cnt == 8:
        ans += 1

print(ans)

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int B= sc.nextInt();
		int data[] =new int[N*2-1];
		int count=0;
		for(int i=0;i<data.length;i++) {
			if(i<N-1) {
				data[i]=B-N+1+i;
			}else {
			
				data[i]=B+count;
				count++;
			}
			
		}
				
		
		
		for(int i=0;i<data.length;i++) {
			System.out.println(data[i]);	
		}
		
		
	}

}


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

long long gcd(long long a, long long b)
{
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    long long n;
    long long a, b;
    scanf("%lld", &n);
    for(long long i = 1;i <= n;++i)
    {
        long long x, y;
        scanf("%lld%lld", &x, &y);
        long long g = gcd(x, y);
        x /= g;
        y /= g;
        if(i == 1)
        {
            a = x;
            b = y;
        }
        else
        {
            long long t = max((a + x - 1) / x, (b + y - 1) / y);
            a = t * x;
            b = t * y;
        }
    }
    printf("%lld\n", a + b);
    return 0;
}


Measured memory_bytes: 256
# 挿入ソート

n = gets.to_i
array = gets.split.map(&:to_i)
puts array.join(" ")
# array[0]は初期状態で"ソート済みである"とみなす。
# よって対象とするのはarray[1]からarray[-1]まで。
(1..n-1).each do |i|
  target = array[i]
  j = i - 1 # ソートしようとしている数と比較する対象のインデックス
  while j >= 0 && array[j] > target #　比較対象の方が大きい場合
    array[j+1] = array[j] # 比較対象を一つ右にずらして格納する
    j -= 1 # 次（より左側）の数を比較対象にする
  end
  array[j+1] = target # ソートしようとしている数を格納する
  puts array.join(" ")
end



Measured memory_bytes: 6900
n = int(input())
R = [0] * n
for i in range(n):
    R[i] = int(input())

maxDiff = R[1] - R[0]
minRi = R[0]

for r in R[1:]:
    if (r - minRi) > maxDiff:
        maxDiff = r - minRi
    if r < minRi:
        minRi = r

print(maxDiff)



Measured memory_bytes: 14956
def mpow(x,n,mod):
    if n == 0:
        return 1
    if n % 4 == 0:
        return mpow((x**4)%mod,int(n/4),mod)
    elif n%4 == 1:
        return (mpow(x,int(n-1),mod)*x)%mod
    elif n%4 == 2:
        return (mpow(x,int(n-2),mod)*(x**2))%mod
    elif n%4 == 3:
        return (mpow(x,int(n-3),mod)*(x**3))%mod
n,m = map(int,input().split())
mod = 1000000007
print(mpow(n,m,mod))

Measured memory_bytes: 7764
N,M=map(int,input().split())
s=[list(map(int,input().split()))[1:] for m in range(M)]
p=list(map(int,input().split()))
count=0
for i in range(1<<N):
    for m in range(M):
        switch=0
        for j in range(N):
            if (i>>j)&1 and j+1 in s[m]:
                switch+=1
        if switch%2!=p[m]:
            break
    else:
        count+=1
print(count)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

char r[501][501],b[501][501];
int main(){
    int h,w;
    char ai;
    cin>>h>>w;
    rep(i,h)rep(j,w) r[i][j]=b[i][j]='.';
    rep(i,h)rep(j,w){
        cin>>ai;
        if(ai=='#'){
            r[i][j]='#',b[i][j]='#';
        }
        else if(j==0||i%2==0&&j!=w-1) r[i][j]='#';
        else b[i][j]='#';
    }
    rep(i,h){
        rep(j,w) cout<<r[i][j];
        cout<<endl;
    }
    cout<<endl;
    rep(i,h){
        rep(j,w) cout<<b[i][j];
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int a, b;
    cin >> a >> b;
    a -= b * 2;
    if(a <= 0) cout << 0 << endl;
    else cout << a << endl;
    return 0;
}

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

int main(){
  int r, g, b;
  cin >> r >> g >> b;
  
  if((100 * r + 10 * g + b) % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import sys
sys.setrecursionlimit(1000000)

def check(i,j):
    global n
    global m
    if m[i][j]==0:
        m[i][j]=-1
        if i+1<n*4+2:
            check(i+1,j)
        if i-1>=0:
            check(i-1,j)
        if j+1<n*4+2:
            check(i,j+1)
        if j-1>=0:
            check(i,j-1)

while True:
    n=int(input())
    if n==0:
        break
    points=[]
    plane=[[-1,-1,-1,-1] for i in range(n)]
    dic={}
    for i in range(n):
        a,b,x,y=map(int,input().split())
        dic[(a,b,i)]=0
        dic[(x,y,i)]=1
        points.append((a,b,i))
        points.append((x,y,i))
    points=sorted(points)
    p=0
    for i in range(len(points)):
        if dic[points[i]]==0:
            plane[points[i][2]][0]=p
        else:
            plane[points[i][2]][2]=p
        if i+1<len(points) and points[i][0]==points[i+1][0]:
            pass
        else:
            p+=1
    points=sorted(points,key=lambda q:q[1])
    p=0
    for i in range(len(points)):
        if dic[points[i]]==0:
            plane[points[i][2]][1]=p
        else:
            plane[points[i][2]][3]=p
        if i+1<len(points) and points[i][1]==points[i+1][1]:
            pass
        else:
            p+=1
    m=[[0 for i in range(n*4+2)]for i in range(n*4+2)]
    for p in plane:
        for j in range((p[1]-p[3])*2+1):
            m[p[0]*2+1][p[3]*2+j+1]=1
            m[p[2]*2+1][p[3]*2+j+1]=1
        for j in range((p[2]-p[0])*2+1):
            m[p[0]*2+j+1][p[3]*2+1]=1
            m[p[0]*2+j+1][p[1]*2+1]=1
    ans=0
    for i in range(n*4+2):
        for j in range(n*4+2):
            if m[i][j]==0:
                ans+=1
                check(i,j)
    print(ans)



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

namespace ITP1_3_B
{
    class Program
    {
        static void Main(string[] args)
        {
            //1つの整数xを読み込み、それをそのまま出力する。
            //xが終わりの時入力の終わりを示し、このデータセットの出力は行わない

            for (int i = 1; i > 0; i++)
            {
                int x = int.Parse(Console.ReadLine());
                if (x == 0) break;
                else Console.WriteLine("Case {0}: {1}", i, x);
            }
        }
    }
}



Measured memory_bytes: 17968
#include <iostream>
#include <stdio.h>

using namespace std;

const int N = 123456;

int a[N];

int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        int l,r;
        scanf("%d %d",&l,&r);
        if(l!=1 && r!=1)
        {
            a[l]++;
            a[r]++;
        }
        else
        {
            a[l]++;
            a[r]++;
        }
    }
    for(int i=1;i<=n;i++)
    {
        if(a[i]%2)
        {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    return 0;
}


Measured memory_bytes: 640
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
if n%2==1:
    a.append(0)
a.sort()

odd=tuple(a[::2])
even=tuple(a[1::2])

if odd==even:
    ans=2**(n//2)
    ans%=mod
    print(ans)
else:
    print(0)


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

using namespace std;

inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int A,B,stt[6000],top=0,vv[6000]; string tt;
int main()
{
	A=read(); B=read();
	if(A<=B) {puts("Impossible"); return 0;}
	for(int i=0;i<A+B;i++)
	{
		if(top==0) {stt[++top]=i; continue;}
		printf("? %d %d\n",stt[top],i);
		cin >> tt;
		if(tt[0]=='Y') stt[++top]=i;
		else top--;
	}
	for(int i=0;i<A+B;i++) 
	{
		printf("? %d %d\n",stt[top],i);
		cin >> tt;
		vv[i]=tt[0]=='Y'? '1':'0';
	}
	printf("! "); for(int i=0;i<A+B;i++)
		putchar(vv[i]); puts("");
	return 0;
}

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

using ll = long long;
using ld = long double;

int main()
{
    int n,m,ans=0;
    cin >> n;
    vector<string> s(n);

    
    for(int i = 0; i < n; i++)
    {
        cin >> s.at(i);
    }

    cin >> m;
    vector<string> t(m);
    
    for(int i = 0; i < m; i++)
    {
        cin >> t.at(i);
    }

    
    for(int j = 0; j < n; j++)
    {
        int tmp = 0;
        
        for(int i = 0; i < n; i++)
        {
            if(s.at(j)==s.at(i)) tmp++;
        }
        
        for(int i = 0; i < m; i++)
        {
            if(s.at(j) == t.at(i)) tmp--;
        }
        
        ans=max(ans,tmp);
    }
    
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
typedef long long ll;
 
int main(){
    int N;cin>>N;
    ll a[N],x[N];
    for(int i=0;i<N;i++){
        cin>>a[i];
        x[i]=0;
    }
    for(int i=1;i<=(N-1)/2;i++) x[0]+=a[2*i]-a[2*i-1];
    x[0]+=a[0];
    cout <<x[0]<<endl;
    for(int i=0;i<N-1;i++){
        x[i+1]=2*a[i]-x[i];
        cout << x[i+1] << endl;
    }
    
}

Measured memory_bytes: 5088
def insert(tree,node):
    parent=None
    child=root
    while child is not None:
        parent=child
        if node<child:child=tree[parent][0]
        else:child=tree[parent][1]
    if node<parent:tree[parent][0]=node
    else:tree[parent][1]=node


def In_order(node):
    if node is None:return
    In_order(tree[node][0])
    print(" {}".format(node), end="")
    In_order(tree[node][1])


def Pre_order(node):
    if node is None:return
    print(" {}".format(node), end="")
    Pre_order(tree[node][0])
    Pre_order(tree[node][1])


def find(x,key):
    while x is not None and key!=x:
        if key<x:x=tree[x][0]
        else:x=tree[x][1]
    return x


n=int(input())
tree,root={},None
for i in range(n):
    order=input().split()
    if order[0]=="print":
        In_order(root);print()
        Pre_order(root);print()
    elif order[0]=="find":
        if find(root,int(order[1])) is not None:print("yes")
        else:print("no")
    elif order[0]=="insert":
        num=int(order[1])
        if root is None:
            root=num
            tree[root]=[None,None]
        else:
            tree[num]=[None,None]
            insert(tree,num)


Measured memory_bytes: 75144
n, k = map(int, input().split())
mod = 10 ** 9 + 7
 
 
def cmb(n, r):

    # print("nsr",n,r)
    if (r < 0): return 0 
    if (n < 0): return 1
    if (n < r): return 0


    r = min(r, n - r)
    x = 1
    y = 1
    for i in range(r):
        x = x * (n - i) % mod
        y = y * (i + 1) % mod
    y = pow(y, mod-2, mod)
    return x * y % mod
 

for i in range(1,k+1):
    x,y = k,i
    blue = cmb(x-1,x-y)
    # print("bbbbbb",blue)

    red=0
    
    x,y = n-k,i-1
    red+=cmb(x-1,x-y)
    # print(red)

    x,y = n-k,i
    red+=cmb(x-1,x-y)
    red+=cmb(x-1,x-y)
    # print(red)

    x,y = n-k,i+1
    red+=cmb(x-1,x-y)
    # print(red)

    # print("ans",blue*red%mod)
    print(blue*red%mod)


Measured memory_bytes: 3316
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;
int h,w;
int a[505][505];
vector<pi>vec;
vector<pair<pi,pi> >ses;
vector<pi>yo;
int flag=0;
void dfs(int x,int y,int ex,int ey,int turn)
{
    if(flag)return ;
    if(x==ex && y==ey)
    {
        flag=1;
        return ;
    }
    if(y>w)
    {
        y=w;
        x++;
        turn=1-turn;
        dfs(x,y,ex,ey,turn);
        return ;
    }
    if(y<1)
    {
        y=1;
        x++;
        turn=1-turn;
        dfs(x,y,ex,ey,turn);
        return ;
    }
    yo.pb(mp(x,y));
    if(turn==0)
    {
        dfs(x,y+1,ex,ey,turn);
    }
    else if(turn==1)
    {
        dfs(x,y-1,ex,ey,turn);
    }

}
void work(pi u,pi v)
{
    int x1=u.fi;
    int y1=u.si;
    int x2=v.fi;
    int y2=v.si;
    int turn=0;
    if(x1%2==0)turn=1;
    flag=0;
    yo.clear();
    dfs(x1,y1,x2,y2,turn);
    yo.pb(mp(x2,y2));
    int sz=yo.size();
//    for(auto x:yo)
//    {
//        cout<<x.fi<<" "<<x.si<<endl;
//    }
//    cout<<"......"<<endl;
    for(int i=0;i<sz-1;i++)
    {
       ses.pb(mp(yo[i],yo[i+1]));
    }
}
 main()

{
    fast
    cin>>h>>w;
    f(i,1,h)
    {
        vector<pi>nw;
        f(j,1,w)
        {
            cin>>a[i][j];
            if(a[i][j]%2==1)nw.pb(mp(i,j));
        }
        if(i%2==0)reverse(nw.begin(),nw.end());
        for(auto x:nw)vec.pb(x);
    }
    if(vec.size()==0)
    {
        cout<<"0"<<endl;
        return 0;
    }
    if(vec.size()%2==1)vec.pop_back();
    int sz=vec.size();
    if(sz==0)
    {
        cout<<"0"<<endl;return 0;
    }
    for(int i=0;i<sz;i=i+2)
    {
        pi x=vec[i];
        pi y=vec[i+1];
        //cout<<x.fi<<" "<<x.si<<" "<<y.fi<<" "<<y.si<<endl;
        work(x,y);
    }
   cout<<ses.size()<<"\n";
    for(auto x:ses)
    {
        pi u=x.fi;
        pi v=x.si;
        cout<<u.fi<<" "<<u.si<<" "<<v.fi<<" "<<v.si<<"\n";
    }
    return 0;

}





































Measured memory_bytes: 15184
//
// Created by Hideaki Imamura on 2020-03-13.
//
# include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair <ll, ll> l_l;
typedef pair<int, int> i_i;

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

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

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

string s;

int main() {
    cin >> s;
    s += 'R';
    int ans[100010];
    int n = s.length();

    char cur = 'R';
    int start_place = 0;
    int change_place;
    for (int i = 1; i < n; ++i) {
        if (s[i] == cur) {
            continue;
        } else if (s[i] == 'L') {
            cur = s[i];
            change_place = i - 1;
        } else {
            cur = s[i];
            for (int j = start_place; j <= i - 1; ++j) {
                ans[j] = 0;
            }
            int left_len = change_place - start_place + 1;
            int right_len = i - 1 - change_place;
            ans[change_place] = left_len / 2 + left_len % 2 + right_len / 2;
            ans[change_place + 1] = left_len / 2 + right_len / 2 + right_len % 2;
            start_place = i;
        }
    }

    for (int i = 0; i <= n - 3; ++i) {
        cout << ans[i] << " ";
    }
    cout << ans[n - 2] << endl;
    return 0;
}

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

int main()
{
	vector<int> vec {52, 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};
  	int t;
  	cin>>t;
  	cout<<vec[t]<<endl;
  	return 0;
}

Measured memory_bytes: 256