akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

typedef long long ll;

const int MOD = 998244353; // change if needed

struct Modint {
  ll val;
  
  Modint (ll _val = 0)
    : val(_val % MOD) {}

  Modint operator+ (Modint other) const {
    return Modint(val + other.val);
  }

  void operator+= (Modint other) {
    val += other.val;
    val %= MOD;
  }

  Modint operator- () const {
    return Modint(MOD - val);
  }

  Modint operator- (Modint other) const {
    return Modint(val + MOD - other.val);
  }

  void operator-= (Modint other) {
    val += MOD - other.val;
    val %= MOD;
  }

  Modint operator* (Modint other) const {
    return Modint(val * other.val);
  }

  void operator*= (Modint other) {
    val *= other.val;
    val %= MOD;
  }

  bool operator== (Modint other) const {
    return val == other.val;
  }

  bool operator!= (Modint other) const {
    return val != other.val;
  }
};

Modint exp (Modint a, int k) {
  if (k == 0) {
    return Modint(1);
  } else if (k % 2 == 0) {
    Modint half = exp(a, k / 2);
    return half * half;
  } else {
    return a * exp(a, k - 1);
  }
}

Modint inv (Modint a) {
  return exp(a, MOD - 2);
}

ostream& operator<< (ostream& out, Modint p) {
  out << p.val;
  return out;
}

char neg (char c) {
  if (c == '0') return '1';
  if (c == '1') return '0';
}

const int MAX_N = 2e5 + 5;

Modint cnt [MAX_N];
Modint mobius [MAX_N];
int factor [MAX_N];

int mobi (int x) {
  int last = -1;
  int ans = 1;
  while (x != 1) {
    if (factor[x] == last) return 0;
    last = factor[x];
    x /= factor[x];
    ans *= -1;
  }
  return ans;
}

int main () {
  ios::sync_with_stdio(false);

  // let's precalculate the mobius values
  for (int i = 2; i < MAX_N; i++) {
    if (factor[i] == 0) {
      for (int j = i; j < MAX_N; j += i) {
        factor[j] = i;
      }
    }
  }

  for (int i = 1; i < MAX_N; i++) {
    mobius[i] = Modint(MOD + mobi(i));
  }
  
  int n;
  cin >> n;

  string X;
  cin >> X;

  Modint pref (0);
  Modint ans (0);
  for (int i = 0; i < n; i++) {
    pref *= Modint(2);
    if (X[i] == '1') {
      pref += Modint(1);
    }

    if (n % (i + 1) == 0 && (n / (i + 1)) % 2 == 1) {
      Modint period (2 * (i + 1));
      Modint cnt_cur (0);
      cnt[i + 1] = pref;
        
      // check if the completion of prefix is <= X
      int k = i + 1;
      int ok = 0;
      for (int t = 0; t < n; t++) {
        if (t % (2 * k) < k) {
          if (X[t % k] < X[t]) {
            ok = 1;
            break;
          } else if (X[t % k] > X[t]) {
            ok = -1;
            break;
          }
        } else {
          if (neg(X[t % k]) < X[t]) {
            ok = 1;
            break;
          } else if (neg(X[t % k]) > X[t]) {
            ok = -1;
            break;
          }
        }
      }

      if (ok >= 0) {
        cnt[k] += Modint(1);
      }

      Modint uniq (0);
      for (int d = 1; d <= k; d++) {
        if (k % d == 0) {
          uniq += mobius[d] * cnt[k / d];
        }
      }

      ans += uniq * period;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 4688
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer cur = nil->next;
  while(cur!=nil&&cur->key!=key){
      cur=cur->next;
  }
  return cur;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  if(t==nil) return;
  t->next->prev=t->prev;
  t->prev->next=t->next;
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  NodePointer t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
}

void delete(int key){
  deleteNode(listSearch(key));
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->prev=nil;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}


Measured memory_bytes: 36152
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"3"# => "2",
r#"1 5 3"# => "54",
 // r#"11"# => "30",
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        a: usize,
        b: usize,
        c: usize,
    }
    std::cmp::max(std::cmp::max(a * 10 + b + c, a + b * 10 + c), a + b + c * 10).to_string()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const double pi=acos(-1);

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

int main(){
    int d;
    cin >> d;
    string s="Christmas";
    while(d!=25){
        s+=" Eve";
        d++;
    }
    cout << s << endl;
}


Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n;
	cin>>n;
	string s[n];
	rep(i,n){
		cin>>s[i];
		sort(s[i].begin(),s[i].end());
	}
	string ans="";
	rep(i,26){
		int num=100;
		rep(j,n){
			int tmp=0;
			rep(k,s[j].size())if(s[j][k]==(char)('a'+i))tmp++;
			num=min(num,tmp);
		}
		rep(j,num)ans+=(char)('a'+i);
	}
	cout<<ans<<endl;
	return 0;
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
	?oo
	?xx
	
	?1122 21 21
	?3344 12 11
}*/

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

	int x = s[0] == t[0] ? 1 : 2;
	int ans = 3*x;
	rep(i, x, n){
		if(s[i] == t[i]){
			if(s[i-1] == t[i-1]){
				(ans *= 2) %= mod;	
			}
		}else{
			if(s[i-1] == t[i-1]){
				(ans *= 2) %= mod;
			}else{
				(ans *= 3) %= mod;
			}
			i++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
int p2(int i)
{
  int a = 1;
  while(i--) a *= 2;
  return a;
}
int main(void)
{
  int d, g, tmp, ans = 0;
  int p[10], c[10];
  std::cin >> d >> g;
  for(int i = 0; i != d; i++){
    std::cin >> p[i] >> c[i];
    ans += p[i];
  }
  tmp = p2(d);
  for(int i = 0; i != tmp; i++){
    int nkr = g, tmp2 = 0;
    bool aac[10] = {};
    for(int j = 0; j != d; j++){
      aac[j] = (i >> j) % 2;
      if(aac[j]){
        nkr -= ((1 + j) * 100 * p[j] + c[j]);
        tmp2 += p[j];
      }
    }
    for(int j = d - 1; j >= 0; j--){
      if(!aac[j] && (nkr > 0)){
        if(((p[j] - 1) * (j + 1) * 100) >= nkr){
          tmp2 += (1 + ((nkr - 1) / ((j + 1) * 100)));
          nkr = 0;
        }
        else{
          tmp2 += (p[j] - 1);
          nkr -= ((p[j] - 1) * (j + 1) * 100);
        }
      }
    }
    if(nkr <= 0){
      ans = std::min(tmp2, ans);
    }
  }
  std::cout << ans << std::endl;
  return 0;
}

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

using ll = long long;

using namespace std;

int main() {
    ll a[4];
    for (auto &ai:a) cin >> ai;
    ll ans = a[0] * a[2];
    for (int i=0; i<2; i++) {
        for (int j=2; j<4; j++) {
            ans = max(ans, a[i] * a[j]);
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>

using namespace std;

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

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    int n, m, sum=0; 
    cin >> n;
    vector<int> a(n);
    REP(i, n){
        cin >> a[i];
        sum += a[i];
    }

    cin >> m;
    int p, x, sum2;
    REP(i, m){
        sum2 = sum;
        cin >> p >> x;

        sum2 += (x-a[p-1]);
        cout << sum2 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
const int INF = 1e9;
const long long LINF = 1e18;
const double EPS = 1e-8;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef pair<Pii,int> P;
typedef vector<int> vi;
typedef long long ll;
template<class T>
ostream& operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()){
		out << v[i] <<", ";
	}
	return out << "}" << endl;
}
int memo[200001];
int main(){
	int N,M;
	cin >> N >> M;
	vi a;
	rep(i,M){
		int tmp;
		cin >> tmp;
		a.pb(tmp);
	}
	reverse(a.begin(),a.end());
	rep(i,M){
		if(!memo[a[i]]++){
			cout << a[i] << endl;
		}
	}
	reps(i,1,N+1){
		if(!memo[i]){
			cout << i << endl;
		}
	}
	return 0;
}

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

int main(){
  string a,b;
  cin >> a >> b;
  int q,r;
  cin >> q >> r;
  string w;
  cin >> w;
  if(w == a){cout << q-1 << " " << r << endl;}else if(w == b){cout << q << " " << r-1 << endl;}
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) vc<vc<T>> xs(n, vc<T>(m)); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cins(int, n, p);
    
    int premin = 1e9, ans = 0;
    For(i, n){
        if(p[i] < premin) premin = p[i], ans ++;
    }
    Cout(ans);
}


Measured memory_bytes: 1024
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vt>vvt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

//nCr mod m
#define MOD 998244353
#define M 220000
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
//nCr
ll nCr(ll n,ll r,ll m=MOD){
	if(!h)init();
	if(n<0||r<0||n<r)return 1;//??????
	ll out=fact[n]*powmod(fact[r]*fact[n-r]%m,m-2,m)%m;
	return out;
}
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
vi dp(1000,-1);
int f(int a){
	if(dp[a]+1)return dp[a];
	return dp[a]=powmod(fact[a],MOD-2,MOD);
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin>>n;
	string s;
	cin>>s;
	int c=0;
	rep(i,n-2)if(s.substr(i,3)=="ABC")c++;
	cout<<c<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
	int n,k; cin >> n >> k;
	cout << (n%k==0 ? 0:1) << endl;
}


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

int main()
{
	string s;
	cin >> s;
	int b = s.size(), e = -1;
	for(auto i = 0; i < (int)s.size(); ++i){
		if(s[i] == 'A'){
			b = i;
			break;
		}
	}
	for(auto i = (int)s.size() - 1; i >= 0; --i){
		if(s[i] == 'Z'){
			e = i;
			break;
		}
	}
	cout << max(0, e - b + 1) << endl;
	return 0;
}

Measured memory_bytes: 640
import sys

a_list = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
b_list = [int(input()) for _ in range(n)]
bingo_list = [[0,0,0] for _ in range(3)]

for b in b_list:
    for i,row in enumerate(a_list):
        for j,n in enumerate(row):
            if n == b:
                bingo_list[i][j] = 1

for row in bingo_list:
    if sum(row) == 3:
        print('Yes')
        sys.exit()

for i in range(3):
    num = bingo_list[0][i] + bingo_list[1][i] + bingo_list[2][i]
    if num >= 3:
        print('Yes')
        sys.exit()

if bingo_list[0][0] + bingo_list[1][1] + bingo_list[2][2] >= 3:
    print('Yes')
    sys.exit()

if bingo_list[0][2] + bingo_list[1][1] + bingo_list[2][0] >= 3:
    print('Yes')
    sys.exit()

print('No')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
int main()
{
    ll n;
    cin >> n;
    vector <ll> arr(n);
    vector<ll>plus;
    vector<ll>minus;
    for(ll i=0;i<n;i++)
    {
        cin >> arr[i];
        plus.push_back(arr[i]+i);
        minus.push_back((i-arr[i]));
    }
    ll ans=0;
    sort(minus.begin(),minus.end());
    for(ll i=0;i<plus.size();i++)
    {
        ll coins;
        coins=plus[i];
       ll upper=upper_bound(minus.begin(),minus.end(),coins)-minus.begin() ;
       ll lower=lower_bound(minus.begin(),minus.end(),coins)-minus.begin() ;
        ans+=upper-lower;
    }
    cout << ans<<"\n";

}


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

using namespace std;

int main()
{
     int n,k,sum=0;
     cin>>n>>k;
     int arr[n];
     for(int i=0;i<n;i++){
        cin>>arr[i];
     }
     sort(arr, arr+n);
     for(int i=0;i<k;i++){
        sum+=arr[i];
     }
     cout<<sum;

    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
long long i,j=1000,n,m,a[100],b,c,d,x;
int main()
{
  for(cin>>n>>x;i<n;c+=m,i++)cin>>m,j=min(j,m);
  cout<<(x-c)/j+n;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = 998244353;
const long long INF_LL = 1e18+11; const int INF_int = 1e9+11;
#define ll long long
#define mp std::make_pair
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto x:a) cout << x << " ";cout << endl;
//最大公約数
long long gcd(long long a,long long b){
    if(a<b) swap(a,b);
    while(a%b!=0){
        swap(a,b);
        b = b%a;
    }
    return b;
}
vector<ll> makeprimes(long n){
    bool judge[n+1];
    for(int i = 0;i<=n;i++){
        judge[i] = true;
    }
    vector<ll> prime;
    for(int i = 2;i<=n;i++){
        if(judge[i]){
            for(int j = 2*i;j<=n;j+=i){
                judge[j] = false;
            }
            prime.push_back(i);//ここでprimeに入れられる素数の条件を指定できる
        }
    } 
    return prime;
}
int main(){
    int n;
    cin >> n;
    vector<ll> a;
    rep(i,n){
      ll b;
      cin >> b;
      a.push_back(b);
    }
    ll t = a[0];
    for(int i = 1;i<n;i++) t = gcd(t,a[i]);
    if(t!=1){
        cout << "not coprime" << endl;
        return 0;
    }
    vector<ll> primes = makeprimes(1003);
  	int s = primes.size();
    vector<int> vec(s);
    fill(All(vec),0);
    bool fl = true;
    set<int> st;
    rep(i,n){
        rep(j,s){
            ll now = primes[j];
            if(a[i]%now==0) vec[j]++;
            while(a[i]%now==0){
                a[i]/=now;
            }
        }
        if(st.empty()) st.insert(a[i]);
        else if(a[i]!=1){
            if(st.count(a[i])!=0){
                fl = false;
            }
            else{
                st.insert(a[i]);
            }
        }
    }
    rep(i,s){
        if(vec[i]>=2) fl = false;
    }
    if(fl) cout << "pairwise coprime" << endl;
    else cout << "setwise coprime" << endl;
}


Measured memory_bytes: 14532
import sys
input = sys.stdin.readline

a, b, q = [int(x) for x in input().split()]
s = [int(input()) for _ in range(a)]
t = [int(input()) for _ in range(b)]
x = [int(input()) for _ in range(q)]
s.sort()
t.sort()

import bisect

for i in x:
    s_idx = bisect.bisect_right(s, i)
    ans = 10 ** 18
    if s_idx == 0:
        s_ = [s[0]]
    elif s_idx >= a:
        s_ = [s[-1]]
    else:
        s_ = [s[s_idx], s[s_idx - 1]]
    for j in s_:
        tmp = abs(i - j)
        t_idx = bisect.bisect_right(t, j)
        if t_idx == 0:
            tmp += abs(j - t[0])
        elif t_idx >= b:
            tmp += abs(j - t[-1])
        else:
            tmp += min(abs(j - t[t_idx]), abs(j - t[t_idx - 1]))
        ans = min(tmp, ans)
    
    t_idx = bisect.bisect_right(t, i)
    if t_idx == 0:
        t_ = [t[0]]
    elif t_idx >= b:
        t_ = [t[-1]]
    else:
        t_ = [t[t_idx], t[t_idx - 1]]
    for j in t_:
        tmp = abs(i - j)
        s_idx = bisect.bisect_right(s, j)
        if s_idx == 0:
            tmp += abs(j - s[0])
        elif s_idx >= a:
            tmp += abs(j - s[-1])
        else:
            tmp += min(abs(j - s[s_idx]), abs(j - s[s_idx - 1]))
        ans = min(tmp, ans)
    print(ans)

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

int main(){
  ll n; cin>>n;
  ll a[n];
  for(ll i=0;i<n;i++) cin>>a[i];
  ll pre[n];
  pre[n-1] = a[n-1];
  for(ll i=n-2;i>=1;i--)
    pre[i] = a[i] + pre[i+1];
  ll ans = 0, mod = 1e9+7;
  for(ll i=0;i<n-1;i++)
    ans = (ans + a[i]*(pre[i+1]%mod))%mod;
  cout<<ans;
  return 0;
}
    

Measured memory_bytes: 6756
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 
 using namespace std;

 int main()
 {
   int n,m;
   int arr[20+2];
   int dp[50000+1];
   dp[0]=0;
   cin>>n>>m;
   //int start;
   for(int i=0;i<m;i++) cin>>arr[i];
   sort(arr,arr+m);
   for(int i=1;i<=n;i++)
   {
     dp[i]=dp[i-arr[0]]+1;
     for(int j=1;j<m;j++)
     {
       if(i<arr[j]) break;
       dp[i]=min(dp[i],dp[i-arr[j]]+1);        
     }        
   }
   cout<<dp[n]<<endl;
   //while(1);
   return 0;
 }

 

Measured memory_bytes: 3340
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let input = read_vec::<i64>();
    for x in input[0]..input[1]+1 {
        if x <  input[0]+input[2] || x > input[1] - input[2] {
            println!("{}",x);
        }
    }
}

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

int main() {
	int n,a,mxa = -1,mna = 1001;
	cin >> n;
	for(int i = 0;i < n;i++)
	{
		cin >> a;
		mxa = max(mxa,a);
		mna = min(mna,a);
	}
    cout << mxa - mna << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int s,a[100005];
    cin>>s;
    for(int i=0;i<s;i++)
        cin>>a[i];
    sort(a,a+s);
    int f=1,x=a[s-1],t=0,m=0,n=0;
    long long sum=1;
    for(int i=s-2;i>=0;i--)
    {
        if(t>=2) break;
        if(a[i]==x)
        {
            f++;
            if(f>1&&f<4&&m==0)
            {
                sum*=x;t++;m=1;
            }
            else if(f>=4&&n==0)
            {
                sum=sum*x;t++;n=1;
            }
        }
        else if(a[i]!=x)
        {
              x=a[i];f=1;
              m=0;n=0;
        }
    }
    if(t<2) cout<<0<<endl;
    else cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
#include<bitset>
#include<iomanip>
using namespace std;

int main() {
	int N, K; cin >> N >> K;
	vector<int> D(K);
	for (int i = 0; i < K; i++)cin >> D[i];
	long long ans = N;
	while (1) {
		bool x = 1; long long z = ans;
		while(1){
			for (int i = 0; i < K; i++) {
				if (z % 10 == D[i]) { x = 0; break; }
			}
			z /= 10;
			if (z == 0||x==0)break;
		}
		if (x) {
			cout << ans << endl; return 0;
		}
		ans++;
	}
}



Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    vvi C(3, vi(3));
    REP(i, 3)
        REP(j, 3) cin >> C[i][j];

    vi a(3), b(3);

    a[0] = 0;
    REP(j, 3) b[j] = C[0][j] - a[0];
    REP(i, 3) a[i] = C[i][0] - b[0];

    bool ok = true;
    REP(i,3) {
        REP(j,3){
            if (a[i]+b[j] != C[i][j]){
                ok = false;
                break;
            }
        }
        if (!ok) break;
    }

    string ans = ok ? "Yes" : "No";
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const double INF = 1e9;

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

  double D; int N, B;
  cin >> D >> N >> B;
  vector<double> P(N), H(N);
  REP(i,N) cin >> P[i] >> H[i];

  double ans = INF;
  for(int bi=0;bi<=B;++bi){
	double span = D / (bi+1);
	double vy = 0.;
	for(int i=0;i<N;++i){
	  double pos = P[i];
	  while(pos > span) pos -= span;
	  if(pos > span/2) pos = span - pos;
	  double t = pos / span;
	  vy = max(vy, sqrt(H[i] / (2*t*(1. - t))));
	}
	double vx = span / (2*vy);
	if(vx >= vy) ans = sqrt(span);
	ans = min(ans, sqrt(vx*vx+vy*vy));
  }
  cout << fixed << setprecision(9) << ans << endl;

  return 0;
}

Measured memory_bytes: 1308
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int a,b,ans;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>a>>b;
    ans = a;
    if(b<a)ans--;
    cout<<ans<<newl;
}


Measured memory_bytes: 256
input()#入力１
l_m = [int(i) for i in input().split()]#入力２[]コピペで数列化(整数i)
l_t = []#空のリストを作る[]
ret = 0#返された情報を表示する形式を作る
for index,i in enumerate(l_m):#forでifの計算式をループ処理させるenuでインデックス番号（要素数）を取得
    if i > 0:#プラスの時
        if not i in l_t:#l_tの中にiがないとき
            l_t.append(i)#l_tに送る
        else:#おかしいの
            ret = index + 1#おかしい瞬間を現在の要素数+1してretで送る
            break
    elif i < 0:#マイナスの時
        
        if len(l_t) > 0 and l_t[-1] == - i:#lenでリスト内要素数を取得l_tにiが最後尾[-1]にあるとき
            l_t.pop(-1)#l_tの最後尾を消す
        else:#おかしいの
            ret = index + 1#おかしい瞬間を現在の要素数+1してretで送る
            break
if ret == 0:#retが０の時はＯＫを出力
    print("OK")
else:#それ以外は弾かれた瞬間+1の要素数=retで出力
    print(ret)
    


Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxn = 1e5+5;
 
ll n;
ll pre[maxn];
ll c[maxn<<1], s[maxn];
 
ll lowbit(ll x) {return x&(-x);}
 
ll query(ll x){
    ll res = 0;
    for(ll i = x; i ; i -= lowbit(i)){
        res += c[i];
    }
    return res;
}
 
void add(ll x){
    for(ll i = x; i <= 2*n; i += lowbit(i)){
        c[i] += 1;
    }
}
 
bool check(ll x){
    memset(c, 0, sizeof(c));
    s[0] = 0;
    for(ll i = 1; i <= n; i++) {
        s[i] = pre[i]>=x?1:-1;
        s[i] += s[i-1];
    }  
    ll sum = 0;
    for(ll i = 0; i <= n; i++){
        sum += query(s[i]+n);
        add(s[i]+n);
    }
    ll num = n*(n+1)/2, ss;
    if (num%2) ss = (num+1)/2;
    else ss = num/2;
    if (sum >= ss) return true;
    return false;
}
 
int main () {
    cin >> n;
     
    ll l = 1, r = 1;
    for(ll i = 1; i <= n; i++) {
        scanf("%lld", &pre[i]);
        if (pre[i] > r) r = pre[i]; 
    }
     
     
    ll ans;
    while(l <= r){
        ll mid = (l+r)>>1;
        if (check(mid)) ans = mid, l = mid+1;
        else r = mid-1;
    }
     
    printf("%lld\n", ans); 
     
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
ii tab[100005];
int main(){
	boost ;
	int n,m,idx=0;
	cin>>n>>m;
	for (int i = 0; i < n; ++i)
		cin>>tab[i].fi>>tab[i].se;
	sort(tab,tab+n);
	ll ans=0;
	priority_queue<int> pq;
	for (int i = 1; i <= m; ++i)
	{
		while(idx<n&&tab[idx].fi<=i)
			pq.push(tab[idx++].se);
		if(!pq.empty())
			ans+=pq.top(),pq.pop();
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
    #define ll long long
    #define rep(i,a,b) for(i=a;i<b;i++)
    #define pb push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define vi vector < ll  int >
    #define CLR(a) memset((a),0,sizeof(a))
    #define mp make_pair
    #define hell 1000000007
    using namespace std;

    #define MAXN 1000005
    int spf[MAXN];
    void sieve()
    {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)
            spf[i] = i;
        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;

        for (int i=3; i*i<MAXN; i++)
        {
            if (spf[i] == i)
            {
                for (int j=i*i; j<MAXN; j+=i)

                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }


    vector<int> gf(int x)
    {
        vector<int> ret;
        while (x != 1)
        {
            ret.push_back(spf[x]);
            x = x / spf[x];
        }
        return ret;
    }
    int BIT[100050]; //fenwick
    void upd(int x) { ++x;  while(x<=MAXN)  {  BIT[x]++;  x+=(x&-x);  } }
    int cal(int x) {  ++x;  int res=0;  while(x>0)  {  res+=BIT[x];  x-=(x&-x);  } return res; }
    ll Com[1051][1051];
    void pre()
    {

        ll i,j,n=1051;
        rep(i,0,n) Com[i][0]=Com[i][i]=1;
        rep(i,2,n)
        {
            rep(j,1,i)
            {
                Com[i][j]=Com[i-1][j]+Com[i-1][j-1];
                Com[i][j]%=hell;
            }
        }

    }
    ll mod=hell;
    ll pr( ll x , ll y)
    {
        ll ans=1;
        if(y==0) return ans;
        while(y>1)
        {
            if(y&1) ans*=x;
            x*=x;
            y/=2;
            x%=mod;
            ans%=mod;
        }
        ans*=x;
        ans%=mod;
        return ans;
    }
    ll inv(ll n)
    {
        return pr(n,mod-2);
    }
    ll stoi(string s)
    {
        int n=s.size();
        ll k=0; int i;
        rep(i,0,n)
        {
            k+=s[i]-'0';
            k*=10;
        }
        return k/10;
    }
    string to_string(ll n)
    {  if(!n) return "0";
        string s=""; int a,b;
        while(n>0)
        {
            b=n%10;
            s+=(b+'0');
            n/=10;
        }
        reverse(all(s));
        return s;
    }


    void solve()
    {
    //double i,j=0,r=200,p,q,k=0,d,y=0,n,h=10000000,flag=0,m=0,a=hell,b=hell,id,h1,h2,a1,b1,a2,w,x,u,f,l,c=0,e,ans=0;
    double n;
     cin>>n;
     double pie=6.28318530717958623200;
     n*=pie;
     cout<<fixed<<setprecision(10)<<n;
    }
    signed main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t=1;
       // cin>>t;
        while(t--)
        solve();
    }


Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false); //cin.tie(NULL); cout.tie(NULL)
#define mp make_pair
#define pb push_back
#define fs first
#define sc second

using namespace std;
typedef long long ll;
typedef long double ld;

void bug();

/* BIEN CUC BO BEGIN*/
	string st;	
	
	stack <char> S;
	int cnt = 0;
/* BIEN CUC BO END*/

void solve(){	
	cin >> st;
	for (int i=0; i<st.size(); ++i){
		if (!S.size()){
			S.push(st[i]);
		} else {
			if (st[i] != S.top()){
				S.pop();
				++cnt;
			} else {
				S.push(st[i]);
			}
		}
	}
	cout << cnt*2;
}

int main(){ FIO;
	solve();
return 0;}	

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main()
{
    
    int N;
    cin >> N;
    
    int C0, C1, C2, C3;
    C0 = C1 = C2 = C3 = 0;
    
    for(int i = 0; i < N; i++){
        string S;
        cin >> S;
        if(S == "AC") C0++;
        if(S == "WA") C1++;
        if(S == "TLE") C2++;
        if(S == "RE") C3++;
    }
    
    cout << "AC x " << C0 << endl;
    cout << "WA x " << C1 << endl;
    cout << "TLE x " << C2 << endl;
    cout << "RE x " << C3 << endl;
    
    return 0;
}


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

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

int main()
{
  ll A;
  cin >> A;
  ll B;
  cin >> B;
  cout << lcm(A, B) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      int n;
      cin>>n;
      n--;
      cout<<n/2;
}


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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  string s;
  cin >> s;

  rep(i, (ll)s.size()) s[i] = 'x';

  cout << s << endl;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
	
    int n,k,i,j;
    cin>>n>>k;
    int a[n];
    for(i=0;i<n;i++)
    cin>>a[i];
 
    int dp[n+1];
    dp[0] =0;
    
    for(i=1;i<n;i++) {
        int temp = INT_MAX;
        for(j=i-1;j>=(i-k) && j>=0; j--) {
            temp = min(temp, abs(a[i]-a[j])+dp[j]);
        }
        dp[i] = temp;
    }
    
    cout << dp[n-1];
}


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

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int maxn = 21+1;
const ll mod = 1000000000+7;
int N,A[maxn][maxn];
ll memo[maxn][1<<maxn];

ll dp(int pos,int mask){
	if(pos >= N){
		if(mask == (1<<N)-1)return 1;
		return 0;
	}
	ll &res = memo[pos][mask];
	if(res != -1)return res;
	res = 0;
	forn(i,0,N){
		if(mask&(1<<i))continue;
		if(!A[pos][i])continue;
		res += dp(pos+1,mask|(1<<i));
		res %= mod;
	}
	return res;
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	forn(i,0,maxn)forn(j,0,(1<<maxn))memo[i][j] = -1;
	cin >> N;
	forn(i,0,N)forn(j,0,N)cin >> A[i][j];
	ll res = dp(0,0);
	if(res < 0)res += mod;
	cout << res << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Measured memory_bytes: 721152
'use strict';
class Queue {
    constructor(size) {
        this.arr = new Array(size);
        this.head = this.tail = 0;
    }
    is_full() {
        return this.head == (this.tail + 1) % this.arr.length;
    }
    push(v) {
        if (this.is_full()) {
            this.arr.length *= 2;
        }
        this.arr[this.tail] = v;
        this.tail = (this.tail + 1) % this.arr.length;
    }
    is_empty() {
        return this.head == this.tail;
    }
    pop() {
        if (this.is_empty()) {
            throw -1;
        }
        let v = this.arr[this.head];
        this.head = (this.head + 1) % this.arr.length;
        return v;
    }
    maxsize() {
        return this.arr.length;
    }
}
function main(input) {
    let lines = input.split('\n');
    let v = lines[0].split(' ').map((n) => parseInt(n));
    let h = v[0];
    let w = v[1];
    let c = [];
    let d = [];
    for (let i = 1; i < h + 1; i++) {
        c.push(lines[i]);
        d.push([]);
    }
    let q = new Queue(1000000);
    for (let i = 0; i < h; i++) {
        for (let j = 0; j < w; j++) {
            if (c[i][j] == '#') {
                q.push([i, j]);
                d[i][j] = 0;
            }
            else {
                d[i][j] = -1;
            }
        }
    }
    let p = q.pop();
    let max = 0;
    const dx = [1, 0, -1, 0];
    const dy = [0, 1, 0, -1];
    while (true) {
        const xx = p[0];
        const yy = p[1];
        for (let i = 0; i < 4; i++) {
            let x = xx + dx[i];
            let y = yy + dy[i];
            if (x < 0 || x > h - 1 || y < 0 || w - 1 < y || d[x][y] >= 0) {
                continue;
            }
            if (c[x][y] == '.') {
                q.push([x, y]);
                let count = d[xx][yy] + 1;
                if (max < count) {
                    max = count;
                }
                d[x][y] = count;
            }
        }
        if (q.is_empty()) {
            break;
        }
        p = q.pop();
    }
    console.log(max);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 128956
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var [x,y]=input.trim().split(" ").map(Number);
var cnt = 0;
for(var i=0;i<=x;i++){
   if(y*i*2/(x*2)%1===0)cnt++;
}
console.log(x+1+y+1-cnt);


Measured memory_bytes: 17196
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV ll(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
// IT 5000兆　欲しい
/* Coding space */
template<class T>
struct FT{
    vector<T> d;
    FT(size_t n):d(n+1){}
    T sum(size_t i){T s{};for(++i;i>0;i-=i&-i)s+=d[i];return s;}
    T sum(size_t i,size_t j){return i?sum(j)-sum(i-1):sum(j);}
    void add(size_t i,T x){for(++i;i<d.size();i+=i&-i)d[i]+=x;}
    void add(size_t i, size_t j,T x){add(i,x); add(j+1,-x);}
};
template<class T>
struct lazy_FT{
  FT<T> d,lazy; // value, lazy array
  lazy_FT(size_t n):d(n+1),lazy(n+1){}
  void add(size_t l, size_t r,T val){ // log(n)
    d.add(l, r, val);
    lazy.add(l, r, (l - 1) * val);
    lazy.add(r + 1, (-r + l - 1) * val);
  }
  T sum(size_t i){return d.sum(i) * i - lazy.sum(i);} // log(n)  sum(0 to i)
  T sum(size_t i, size_t j){return sum(j) - sum(i-1);} // log(n)
};
int main(){
  int n,m; cin >> n >> m;
  lazy_FT<int> bit(1000000);
  using Data = tuple<int,int,int>; // Dist,l,r
  vt<Data> data;
  rep(i,n){
    int l,r; cin >> l >> r;
    data.pb(Data{r-l+1,l,r});
  }
  sort(ALL(data));

  int index = 0;
  for(int i = 1; i <= m; i++){
    int a,b,c; tie(a,b,c) = data[index];
    //SHOW(i,a);
    while(i > a && index < n){
      //cerr << i << " " << a << " " << b << " " <<  c << endl;
      bit.add(b,c,1);
      index++;
      if(index >= n) break;
      tie(a,b,c) = data[index];
    }
    
    int ans = n - index;
    for(int j = 0; j <= m; j += i)
      ans += bit.sum(j,j);
    cout << ans << endl;
  }
}

Measured memory_bytes: 16112
S = input()
ans = [0 for i in range(len(S))]

_Ls = [0 for i in range(len(S))]
_Rs = [0 for i in range(len(S))]
last_L = -1
last_R = -1
for i,s in enumerate(S):
    _Ls[i] = i - last_L-1
    _Rs[i] = i - last_R-1
    if s == 'L':
        last_L = i
    else:
        last_R = i

Ls_ = [0 for i in range(len(S))]
Rs_ = [0 for i in range(len(S))]
last_L = -1
last_R = -1
for i,s in enumerate(reversed(S)):
    Ls_[i] = i - last_L-1
    Rs_[i] = i - last_R-1
    if s == 'L':
        last_L = i
    else:
        last_R = i
Ls_ = [s for s in reversed(Ls_)]
Rs_ = [s for s in reversed(Rs_)]

for i,s in enumerate(S):
    if S[i] == 'L' and S[i-1] == 'R':
        ans[i] = int(Rs_[i]/2) + int(_Ls[i]/2) + 1
    if S[i] == 'R' and S[i+1] == 'L':
        ans[i] = int(Rs_[i]/2) + int(_Ls[i]/2) + 1

print(' '.join(str(i) for i in ans))


Measured memory_bytes: 20692
N,M=map(int,input().split())
MOD = 10**9+7
a = abs(N-M)
if a>1:
    print(0)
    exit()
ans = 0
n = 1
for i in range(1,N+1):
    n = (n*i)%MOD
m = 1
for i in range(1,M+1):
    m = (m*i)%MOD

if N==M:
    ans = 2*(n*m)%MOD
else:
    ans = (n*m)%MOD

print(ans)

Measured memory_bytes: 3064
h,w,k=map(int,input().split())
l=[]
v=['']*w
h_n=[0]*h
v_n=[0]*w
n=0
ans=0
for i in range(h):
    s=input()
    scnt=s.count('#')
    n+=scnt
    h_n[i]+=scnt
    l.append(s)
    for j in range(w):
        v[j]+=s[j]
for i in range(w):
    v_n[i]+=v[i].count('#')


for i in range(2**h):
    for j in range(2**w):
        i_bin=bin(i)[2:]
        i_bin='0'*(h-len(i_bin))+i_bin
        j_bin=bin(j)[2:]
        j_bin='0'*(w-len(j_bin))+j_bin
        h_ind=[]
        w_ind=[]
        for ii in range(len(i_bin)):
            if i_bin[ii]=='1':
                h_ind.append(ii)
        for jj in range(len(j_bin)):
            if j_bin[jj]=='1':
                w_ind.append(jj)
        nn=0
        for kk in h_ind:
            nn+=h_n[kk]
            for ll in w_ind:
                if l[kk][ll]=='#':
                    nn-=1
        for ll in w_ind:
            nn+=v_n[ll]
        if n-nn==k:
            ans+=1
print(ans)


Measured memory_bytes: 9288