akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define sort(a) sort(all(a))
using P = pair<int, int>;
using ll = long long;
using ld = long double;
int dx[4] = { 0, 1, 0,-1 };
int dy[4] = { 1, 0,-1, 0 };

bool isPrime(int n) {
  for (int i = 2; i*i < n; i++) {
    if (n%i==0) return false;
  }
  return true;
}

signed main() {
  int x; cin >> x;
  while(true) {
    if (isPrime(x)){
      cout << x << endl;
      break;
    }
    x++;
  }
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

pub fn combination(n: u64, mut k: u64) -> u64 {
    assert!(n >= k);
    if k * 2 > n {
        k = n - k
    }
    let mut ans = 1;
    for d in 1..k + 1 {
        ans *= n + 1 - d;
        ans /= d;
    }
    ans
}

fn main() {
    input!{
      n: u64,
      k: u64,
    }
    if n == 2 {
        if k == 0 {
            println!("{}", 1);
            println!("{} {}", 1, 2);
        } else {
            println!("{}", -1);
        }
        return;
    }




    let cur = combination(n-1, 2);
    if k > cur {
        // debug!(cur);
        return println!("{}", -1);
    }

    let mut ans = vec![];
    for i in 2..n+1 {
        ans.push((1, i));
    }


    let mut a = 2;
    let mut b = 3;
    for i in 0..cur-k {
        ans.push((a, b));
        b += 1;
        if b > n {
            a += 1;
            b = a + 1;
        }
    }
    println!("{}", ans.len());
    for a in ans {
        println!("{} {}", a.0, a.1);
    }
}


Measured memory_bytes: 4352
#include <iostream>

int map[18][18]={};

int a,b;


int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    
    
    while(true){
        std::cin>>a>>b;
        if(a==0&&b==0)break;
        int n;
        std::cin>>n;
        int x[41],y[41];
        for (int i=0; i<n; ++i)
        {
            std::cin>>x[i]>>y[i];
            map[x[i]][y[i]]=-1;
        }
        map[1][1]=1;
        
        for(int i=1;i<=a;++i)
        {
            for(int j=1;j<=b;++j)
            {
                if(map[i][j]==-1)continue;
                if(map[i-1][j]!=-1)map[i][j]+=map[i-1][j];
                if(map[i][j-1]!=-1)map[i][j]+=map[i][j-1];
                //            std::cout<<i<<" "<<j<<" "<<map[i][j]<<"\n";
            }
        }
        std::cout<<map[a][b]<<"\n";
        for(int i=1;i<=a;++i)
        {
            for(int j=1;j<=b;++j)
            {
                map[i][j]=0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
const int M=1e5+5;

int n,m;
struct Edge{int v,to,c,d;}E[M<<1];int Head[M],e_tot;
void Link(int u,int v,int c,int d){E[++e_tot]=(Edge){v,Head[u],c,d},Head[u]=e_tot;}

int Fa[M],siz[M],son[M],tp[M],dep[M],dis[M];
void dfs_Init(int u){
	siz[u]=1;
	for(int i=Head[u];i;i=E[i].to){
		int v=E[i].v;if(v==Fa[u])continue;
		int d=E[i].d;
		dep[v]=dep[u]+1;dis[v]=dis[u]+d;Fa[v]=u;
		dfs_Init(v);
		siz[u]+=siz[v];if(siz[v]>siz[son[u]])son[u]=v;
	}
}
void re_dfs_Init(int u){
	for(int i=Head[u];i;i=E[i].to){
		int v=E[i].v;if(v==Fa[u])continue;
		tp[v]=v==son[u]?tp[u]:v;
		re_dfs_Init(v);
	}
}
int LCA(int u,int v){
	while(tp[u]!=tp[v])
		if(dep[tp[u]]<dep[tp[v]])v=Fa[tp[v]];
		else u=Fa[tp[u]];
	return dep[u]<dep[v]?u:v;
}

int Cnt[M],Len[M];
int Ans[M];
struct qry{
	int c,y,delt,id;
};vector<qry>Q[M*3];

void dfs(int u){
	for(unsigned int qi=0;qi<Q[u].size();qi++){
		qry q=Q[u][qi];
		int ad=q.delt*(dis[u]+Cnt[q.c]*q.y-Len[q.c]);
		Ans[q.id]+=ad;
	}
	for(int i=Head[u];i;i=E[i].to){
		int v=E[i].v;if(v==Fa[u])continue;
		int c=E[i].c,d=E[i].d;
		Cnt[c]++;Len[c]+=d;
		dfs(v);
		Cnt[c]--;Len[c]-=d;
	}
}

void Solve(){
	dfs_Init(1);re_dfs_Init(1);
	for(int i=1;i<=m;i++){
		int x,y,u,v;scanf("%d%d%d%d",&x,&y,&u,&v);
		int g=LCA(u,v);
		Q[u].push_back((qry){x,y,1,i});
		Q[v].push_back((qry){x,y,1,i});
		Q[g].push_back((qry){x,y,-2,i});
	}
	dfs(1);
	for(int i=1;i<=m;i++)printf("%d\n",Ans[i]);
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<n;i++){
		int u,v,c,d;scanf("%d%d%d%d",&u,&v,&c,&d);
		Link(u,v,c,d);Link(v,u,c,d);
	}
	Solve();
	return 0;
} 

Measured memory_bytes: 25588
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  ll N, K;
  cin >> N >> K;
  int a=0;
  for(int i=0; i < N; i++)
    cin >> a;
  int i=1;
  for(i; i < N; i++){
    if(i*K - (i-1) >= N)
      break;
  }
  cout << i << endl;
  return 0;
}


Measured memory_bytes: 256
(d,g),*l=[list(map(int,i.split()))for i in open(0)]
def f(i,g):
	if i==0:return 1e9
	n,m=l[i-1];c=min(g//(100*i),n);s=100*i*c+m*(c==n);c+=f(i-1,g-s)*(s<g);return min(c,f(i-1,g))
print(int(f(d,g)))

Measured memory_bytes: 3064
import java.io.*;
import java.util.*;
public class Main{
	public static long INF = (long)1e18;
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		long[] list = Arrays.stream(reader.readLine().split(" ")).mapToLong(Long::parseLong).toArray();
		for(int i = 0;i<n;i++){
			if(list[i]==0L){
				System.out.println(0);
				return;
			}
		}
		long res = 1;
		for(int i = 0;i<n;i++){
			if(INF/res < list[i]){
				System.out.println(-1);
				return;
			}
			else res*=list[i];
		}
		System.out.println(res);
	}
}


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

public class Main {

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

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			double n = scanner.nextDouble();
			if (n < 0)
				break;
			int val = (int) n;
			if (Integer.toBinaryString(val).length() > 8)
				System.out.println("NA");
			else {
				double syousu = (n - val) * 16;
				int syousuInt = (int) syousu;
				if (syousu != syousuInt)
					System.out.println("NA");
				else {
					int a = Integer.parseInt(Integer.toBinaryString(val));
					int b = Integer.parseInt(Integer.toBinaryString(syousuInt));
					System.out.printf("%08d.%04d\n", a, b);
				}
			}

		}
	}
}

Measured memory_bytes: 25832
n = int(input())
s = input()

cs = [0] * (n+1)
for i in range(n):
    cs[i+1] = cs[i]
    if s[i] == 'E':
        cs[i+1] += 1

ans = n
for i in range(n):
    e_left = cs[i]
    e_right = cs[n] - cs[i+1]
    # print(i, e_left, e_right)
    ans = min(ans, (i - e_left) + e_right)

print(ans)


Measured memory_bytes: 15264
/*
    author: Salam_35
    Created at :

*/

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

#define ll long long int
#define pb push_back
#define sc(n) scanf("%d",&n)
#define Max 100005
#define scan(n) scanf("%lld",&n)
#define pi acos(-1.0)
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ALL(x) x.begin(),x.end()
#define sci(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define load(array,size)  for(ll i=0 ; i<size ; i++) cin>>array[i] ;
#define load1(array,size)  for(ll i=1 ; i<=size ; i++) cin>>array[i] ;
#define INF	1LL<<19
#define pll pair<ll,ll>
#define mst(arr,value) memset(arr,value,sizeof(arr));
#define tst() int t;cin >> t;while(t--)
#define Mod 100000007
#define YES cout<<"Yes"<<endl;
#define NO cout<<"No"<<endl;
void inversemod(ll n, ll mod, ll invmod[],ll MOD){for(int i=2; i<=n; ++i) invmod[i]=MOD-MOD/i*invmod[MOD%i]%MOD;}
//void bigmod( ll a, ll b ,ll mod){ll r = 1;a = a%mod;while(b){if( b%2 ) r = (r*a)%mod;b = b/2;a = (a*a)%mod; }return (ll)r;}

typedef vector<ll>vec;
typedef pair<ll,ll> pii;
typedef map<ll,ll>mpll;
typedef set<ll>seet;

int main()
{
    ll n;
    cin >> n;
    cout<<(n*(n+1))/2<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int data[4][13] = {};
	int i, j;
	char c, mark[4] = {'S', 'H', 'C', 'D'};
	int n, num;
	
	scanf("%d", &n);
	
	while (n--) {
		scanf(" %c %d", &c, &num);
		num--;
		
		switch(c) {
			case 'S': data[0][num] = 1; break;
			case 'H': data[1][num] = 1; break;
			case 'C': data[2][num] = 1; break;
			case 'D': data[3][num] = 1; break;
		}
	}
	
	for (i = 0; i < 4; i++) {
		for (j = 0; j < 13; j++) {
			if (!data[i][j]) {
				printf("%c %d\n", mark[i], j + 1);
			}
		}
	}
	
	return 0;
}

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

void solve(){
    int Q;
    cin >> Q;
    while(Q--){
        string S, T;
        cin >> S >> T;
        int s_len = S.size();
        int t_len = T.size();
        
        vector<vector<int>> dp(s_len+1, vector<int>(t_len+1, 0));
        
        int ans = 0;
        for(int i=0; i<s_len; i++){
            for(int j=0; j<t_len; j++){
                if(S[i]==T[j])
                    dp[i+1][j+1] = dp[i][j] + 1;
                else
                    dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);

                ans = max(ans, dp[i+1][j+1]);
            }
        }
        cout << ans << endl;
        
    }
}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}



Measured memory_bytes: 6824
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map> 
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
   int n;
   cin >> n;
   ll now = 0LL;
   map<ll,int> m;
   m[0]++;
   rep(i,n){
      ll tmp;
      cin >> tmp;
      now += tmp;
      m[now]++;
   }
   ll ans = 0LL;
   for (auto w:m){
      //cout << w.first <<" " << w.second << endl;
      ans += ((ll)w.second*(w.second-1)/2LL);
   }
   cout << ans << endl;
   
   return 0;
}


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

class p
{
	public:
  vector<int> dm;
  p()
  {
  	dm = vector<int>(10);
  }
};
bool dist(p a,p b)
{
  int h=0;
  for(int i=0;i<10;i++)
    h+=(a.dm[i]-b.dm[i])*(a.dm[i]-b.dm[i]);
 // cout<<h<<"\n";  
  int l = sqrt(h);
  if(l*l==h)
    return true;
  return false;
}
int main()
{
  int n,d;
  cin>>n>>d;
  vector<p> v(n);
  int ans=0;
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<d;j++)
      cin>>v[i].dm[j];
  }
  for(int i=0;i<n-1;i++)
  {
    for(int j=i+1;j<n;j++)
      if(dist(v[i],v[j]))
        ans++;
  }
  cout<<ans<<"\n";
  return 0;
}

Measured memory_bytes: 256
n = int(input())
f = [list(map(int, input().split())) for i in range(n)]
p = [list(map(int, input().split())) for i in range(n)]
ans = -float("inf")
for bit in range(1, 1 << 10):
    cc = 0
    for i in range(n):
        c = 0
        for j in range(10):
            if (bit >> j & 1) and f[i][j]:
                c += 1
        cc += p[i][c]
    ans = max(ans, cc)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	int y; cin >> y;
	int a = -1, b = -1, c = -1;
	rep(i, n + 1) {
		rep(j, n + 1) {
			int k = n - i - j;
			if (0 <= k && k <= n) {
				if (10000 * i + 5000 * j + 1000 * k == y) {
					a = i; b = j; c = k;
				}
			}
		}
	}
	cout << a << " " << b << " " << c << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define MOD 1000000007
ll power(ll a, ll b) { //a^b
	ll res = 1;
	a = a % MOD;
	while (b > 0) {
		if (b & 1) {res = (res * a) % MOD; b--;}
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}

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

int main() {
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s, t;
	cin >> s;
	cin >> t;
	ll n = s.length();
	ll m = t.length();
	ll ans = m;
	for (ll i = 0; i + m - 1 < n; i++) {
		ll cnt = 0;
		for (ll j = 0; j < m; j++) {
			if (s[i + j] != t[j])
				cnt++;
		}
		ans = min(ans, cnt);
	}
	cout << ans << "\n";
}


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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);

int main() {
    ios_base::sync_with_stdio(false);
    ll x; cin >> x;
    ll ok = 100;
    ll ans = 0;
    while(ok < x) ok += ok/100, ans++;
    cout << ans << endl;
}



Measured memory_bytes: 3648
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))

x = sum(B)-sum(A)
if x<0:
  #print(sum(B), sum(A), x)
  print('No')
  exit()
  
C = [b-a for a, b in zip(A,B)]
#a
if sum([(c+1)//2 if c>0 else 0 for c in C]) >x:
  #print(C)
  #print([(c+1)//2 if c>0 else 0 for c in C])
  print('No')
  exit()

#b
if sum([-c if c<=0 else c%2 for c in C]) >x:
  #print('b')
  #print(C)
  #print([-c if c<=0 else c%2 for c in C])
  print('No')
  exit()
print('Yes')


Measured memory_bytes: 4856
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

const int INF = 1e9;
const long long LINF = 1e18;
const double PI=3.14159265358979323846;

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

    // cout << static_cast<long long>(1e18) << endl;
    // printf("%f\n", static_cast<double>(1e18) / static_cast<double>(999999000001));

    bool ng = false;
    long long ans = 1;
    for (long long i = 0; i < N; i++) {
        long long Ai;
        cin >> Ai;
        if (Ai == 0) {
            cout << 0 << endl;
            return 0;
        }

        if (ng || Ai > static_cast<long long>(1e18) / ans) {
            ng = true;
        }
        // cout << ": " << static_cast<long long>(ans) << ", " << static_cast<long long>(1e18) / Ai << endl;
        ans *= Ai;
    }

    if (ng) {
        cout << "-1" << endl;
    } else {
        cout << static_cast<long long>(ans) << endl;
    }

    return 0;
}


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

int main()
{
	int64_t n;
	cin >> n;
	vector<vector<pair<int64_t, int64_t>>> g(n);
	for (int64_t i = 0; i < n - 1; i++)
	{
		int64_t u, v, w;
		cin >> u >> v >> w;
		u--;
		v--;
		g[u].push_back({v, w});
		g[v].push_back({u, w});
	}

	vector<bool> col(n, false), done(n, false);

	stack<pair<int64_t, int64_t>> st;
	st.push({0, -1});

	while (!st.empty())
	{
		int64_t now = st.top().first;
		int64_t par = st.top().second;
		st.pop();

		if (done[now])
		{
			continue;
		}

		done[now] = true;

		for (auto &p : g[now])
		{
			int64_t next = p.first;
			int64_t cost = p.second;
			if (next == par || done[next])
			{
				continue;
			}
			col[next] = (col[now] + (cost % 2)) % 2;
			st.push({next, now});
		}
	}

	for (auto c : col)
	{
		cout << c << endl;
	}

	return 0;
}

Measured memory_bytes: 7936
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>

typedef long long ll;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

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

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a, bool g){
	if(g){
		if(a[index]<key){
			return true;
		}
	}
	else{
		if(a[index]>key){
			return true;
		}
	}
	return false;
}

ll bin_search(ll key, vector<ll> &a, bool g){
	
	ll l=-1;
	ll r=a.size();

	if(g){
		l=a.size();
		r=-1;
	}

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a, g)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

int main(){

	ll n,k;
	cin>>n>>k;
	string s;
	cin>>s;

	if(s[k-1]=='A'){
		s[k-1]='a';
	}
	else if(s[k-1]=='B'){
		s[k-1]='b';
	}
	else if(s[k-1]=='C'){
		s[k-1]='c';
	}

	cout<<s<<endl;
	
    return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; ++i)
#define ifb(N, n) if(N & (1 << n))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define V [0x1000] 
#define AV = malloc(0x8000) 
#define VZ(v) memset(v, 0, 0x1000)
#define addv(a,b) a = (unsigned long long)a + (unsigned long long)b
#define assv(a,b) a = (unsigned long long)b
#define vi 0x7fffffffffffffff

typedef void * v;
typedef unsigned long long ull;

int main(void) {
    char s V;
    scanf("%3s", s);
    if (s[1] == 'B') puts("ARC");
    else puts("ABC");
}

Measured memory_bytes: 2092
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        var hwd = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var h = hwd[0];
        var w = hwd[1];
        var d = hwd[2];
        Tuple<int, int>[] nums = new Tuple<int, int>[h * w];
        var a = Enumerable.Repeat(0, h).Select(_ => Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray()).ToArray();
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                nums[a[i][j]] = new Tuple<int, int>(i, j);
            }
        }
        List<int>[] accumMagic = Enumerable.Repeat(0, d).Select(_ => new List<int>() { 0 }).ToArray();
        for (int i = d; i < nums.Length; i++)
        {
            accumMagic[i % d].Add(accumMagic[i % d].Last() + Abs(nums[i - d].Item1 - nums[i].Item1) + Abs(nums[i - d].Item2 - nums[i].Item2));
        }
        var q = int.Parse(Console.ReadLine());
        for (int i = 0; i < q; i++)
        {
            var lr = Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
            Console.WriteLine(accumMagic[lr[1] % d][lr[1] / d] - accumMagic[lr[0] % d][lr[0] / d]);
        }
    }
}


Measured memory_bytes: 31588
def main():
    N, K = map(int, input().split())

    pN_ = []

    ans = 0
    total = 0
    for i, s in enumerate(input().split()):
        total += 1 + int(s)
        pN_.append(total)

        if i == K - 1:
            ans = max(ans, (total / 2))
        elif K <= i:
            ans = max(ans, (total - pN_[i - K]) / 2)

    print(ans)


main()


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

int main() {
    int h, n;
    cin >> h >> n;

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

    int p=0;
    for(int x:a){
        p+=x;
    }

    if(p>=h){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


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

int main() {
	int a, b;

	cin >> a >> b;

	int max, min;
	if (a >= b) {
		max = a;
		min = b;
	}
	else {
		max = b;
		min = a;
	}

	for (int i = 0; i < max; i++) {
		cout << min;
	}

	cout << "\n";

	return 0;
}

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

int main() {
    int N, T;
    cin >> N >> T;
    vi S(N);
    rep(i, N) {
        cin >> S[i];
    }

    ll ans = 0;
    for (int i = 0; i < N - 1; i++) {
        ans += min(S[i + 1] - S[i], T);
    }
    ans += T;

    cout << ans << endl;
}

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

int main()
{
    std::size_t N;
    std::cin >> N;

    std::uint64_t total = 0;
    std::vector<std::uint64_t> A(N);
    for(auto& a : A)
    {
        std::cin >> a;
        total ^= a;
    }

    for(const auto a : A)
    {
        std::cout << (total ^ a) << std::endl;
    }


    return 0;
}


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

vector<ll> solve(ll n, vector<ll> a) {
  stack<pair<ll, ll>> stk;
  vector<ll> ret(n);
  ll cnt = 0;

  for (ll i = n - 1; i >= 0; i--) {
    ret[i] = cnt;
    if (i == 0) break;

    ll x = a[i - 1], y = a[i];
    if (x > y) {
      while (x > y) {
        ll k = n;
        while (!stk.empty()) {
          if (stk.top().second == 0) {
            stk.pop();
            continue;
          }
          k = stk.top().first;
          stk.top().second--;
          break;
        }
        cnt += (k - i) * 2;
        y *= 4;
      }
    } else {
      ll r = 0;
      while (x * 4 <= y) {
        r++;
        x *= 4;
      }
      stk.push(make_pair(i, r));
    }
  }

  return ret;
}

int main(void) {
  ll n;
  cin >> n;
  vector<ll> a(n);
  REP(i, 0, n) cin >> a[i];

  vector<ll> r = solve(n, a);

  reverse(a.begin(), a.end());
  REP(i, 0, n) a[i] *= 2;
  vector<ll> l = solve(n, a);
  reverse(l.begin(), l.end());
  REP(i, 0, n) l[i] += i + 1;

  ll ans = min(l[n - 1], r[0]);
  REP(i, 0, n - 1) ans = min(ans, l[i] + r[i + 1]);
  cout << ans << endl;
}

Measured memory_bytes: 9828
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  string s;cin>>s;
  if(s.size()==2){
    if(s[0]==s[1])cout<<"1 2";
    else cout<<"-1 -1";
  }else{
    reps(i,2,s.size()){
      if(s[i-2]==s[i-1]||s[i-2]==s[i]||s[i-1]==s[i]){
        cout<<i-1<<" "<<i+1;
        return 0;
      }
    }
    cout<<"-1 -1";
  }
}

Measured memory_bytes: 512
def main():
    s = input()
    n = len(s)
    mod = 10 ** 9 + 7
    dp = [[0 for _ in range(13)] for _ in range(n + 1)]
    dp[0][0] = 1
    for i in range(1, n + 1):
        if s[i - 1] == "?":
            for now in range(10):
                for before in range(13):
                    ind = (now + 10 * before) % 13
                    dp[i][ind] += dp[i - 1][before]
                    dp[i][ind] %= mod
        else:
            for before in range(13):
                ind = (int(s[i - 1]) + 10 * before) % 13
                dp[i][ind] += dp[i - 1][before]
                dp[i][ind] %= mod
    print(dp[n][5])


if __name__ == '__main__':
    main()


Measured memory_bytes: 96288
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SORTR(x) sort(ALLR(x));
#define SORT(x) sort(ALL(x));
#define SUM(x) accumulate(ALL(A), 0);
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef vector<char> VC;
typedef vector<VC> VVC;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}


void Main()
{
	ll N,M;
	ll result=0;
	cin>>N>>M;
	VVI AB(N,VI(2,0));
	REP(i, N) cin >> AB[i][0]>>AB[i][1];
	ll num=0;
	ll index=0;
	SORT(AB);
	while(num<M){
		//最小の金額のものを選ぶ
		//最小の金額のBを１本減らす
		if(AB[index][1]==0) index++;
		AB[index][1]--;

		result+=AB[index][0];
		num++;
	}



	
	cout << result << "\n";
	return;
}

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


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

typedef long long ll;

int V;

int op(int a, int b) {
    return max(a, b);
}

int e() {
    return -1;
}

bool f(int x) {
    return x < V;
}

int main() {
    int N, Q, A, T, X;
    cin >> N >> Q;
    segtree<int, op, e> seg(N);
    rep(i, N) {
        cin >> A;
        seg.set(i, A);
    }
    rep(i, Q) {
        cin >> T >> X >> V;
        if (T == 1) {
            seg.set(X - 1, V);
        } else if (T == 2) {
            cout << seg.prod(X - 1, V) << "\n";
        } else {
            cout << seg.max_right<f>(X - 1) + 1 << "\n";
        }
    }
}

Measured memory_bytes: 6200
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;
typedef long long ll;

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

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 2019;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string S;
  cin>>S;
  map<int,int> mp;
  mp[0]=1;
  int now=0,N=S.length();
  vector<int> pows(N+1);
  pows[0]=1;
  REP(i,N){
    pows[i+1]=pows[i]*10;
    pows[i+1]%=MOD;
  }
  int ans=0;
  REP(i,N){
    now+=((S[N-i-1]-'0')*pows[i]);
    now%=2019;
    ans+=mp[now];
    mp[now]++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void)
{
  int i, N;
  scanf("%d", &N);
  int A[N-1], B[N];
  for(i=0; i<N; i++)
    B[i]=0;
  
  for(i=0; i<=N-2; i++){
    scanf("%d", &A[i]);
    B[A[i]-1] +=1;
  }
  for(i=0; i<N; i++){
    printf("%d\n", B[i]);
  }
  
  return 0;
}

Measured memory_bytes: 3276
#include <bits/stdc++.h>
using namespace std;
#define INF 1e9+7

using P = pair<int, int>;
struct Graph {
    int to;
    int cost;
    Graph(int a, int b) {
        to = a;
        cost = b;
    }
};

int main() {
    // input
    int V, E, r;
    cin >> V >> E >> r;
    vector<vector<Graph>> G(V);
    for (int i = 0; i < E; ++i) {
        int s, t, d;
        cin >> s >> t >> d;
        G[s].push_back(Graph(t, d));
        // G[t].push_back(Graph(s, d));
    }

    priority_queue<P, vector<P>, greater<P>> que;
    vector<int> dist(V, INF);

    // main
    que.push(P(0, r));
    dist[r] = 0;
    while (!que.empty()) {
        P edge = que.top();
        que.pop();

        if (dist[edge.second] < edge.first) {
            continue;
        }
        
        for (auto g : G[edge.second]) {
            if (dist[edge.second] + g.cost < dist[g.to]) {
                dist[g.to] = dist[edge.second] + g.cost;
                que.push(P(dist[g.to], g.to));
            }
        }
    }

    // output
    for (int i = 0; i < V; ++i) {
        if (dist[i] == INF) {
            cout << "INF" <<endl;
        }
        else {
            cout << dist[i] <<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 12900
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n,d,x;
  cin >> n >> d >> x;
  vec a(n);
  for(ll i=0;i<n;i++) cin >> a[i];
  ll ans=x;
  for(ll i=0;i<n;i++) {
    ans+=(d+a[i]-1)/a[i];
  }
  cout << ans << endl;
}

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

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


    lli n ,W;
    cin >> n >> W;
    vector<lli> w(n+1,0) ,v(n+1,0);
    for(int i = 1 ; i <= n ; ++i)cin >> w[i] >> v[i];

    vector<vector<lli>> dp(n+1,vector<lli> (W+1,0));

   
    for(int i = 1 ; i <= n ; ++i){
        for(int j = 0 ; j <= W ; ++j){
            if(w[i] <= j)
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[n][W] << endl;

    return 0;
}

Measured memory_bytes: 80256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#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 UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  int N;
  int ww[1010], s[1010], v[1010];
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    int wei, ss, val;
    cin >> wei >> ss >> val;
    ww[i] = wei, s[i] = ss, v[i] = val;
    a[i] = i;
  }

  sort(ALL(a), [&](int a, int b) {
    return min(s[a], s[b] - ww[a]) > min(s[b], s[a] - ww[b]);
  });

  static int dp[1010][30100];
  m0(dp);

  for (int i = 0; i < N; i++) {
    for (int w = 0; w <= 20100; w++) {
      int tmp = a[i];
      chmax(dp[i + 1][w], dp[i][w]);
      if (w <= s[tmp]) chmax(dp[i + 1][w + ww[tmp]], dp[i][w] + v[tmp]);
    }
  }

  int ans = 0;
  for (int w = 0; w <= 20100; w++) chmax(ans, dp[N][w]);

  cout << ans << endl;
  return 0;
}


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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

const lli e5 = 1 << 20;
const lli mod = 1000000007;
const lli e3 = 1 << 13;
const lli INF = 1ll << 62;

lli n,m,c;
lli b[e5];
lli a[e3][e3];
lli ans;

int main(){
  cin >> n >> m >> c;
  for(lli i = 0;i < m;i++) cin >> b[i];
  for(lli i = 0;i < n;i++){
    for(lli j = 0;j < m;j++) cin >> a[i][j];
  }
  for(lli i = 0;i < n;i++){
    lli mem = 0;
    for(lli j = 0;j < m;j++){
      mem += a[i][j]*b[j];
    }
    mem += c;
    if(mem > 0) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 2432
import math

n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [math.inf] * n
dp[0] = 0
for i in range(1, n):
    dp[i] = min(dp[j] + abs(h[i] - h[j]) for j in range(max(0, i - k), i))
print(dp[n - 1])


Measured memory_bytes: 20836
# coding: utf-8


def main():
    _ = int(input())
    integers = list(map(int, input().split(' ')))

    for integer_ in integers:
        if integer_ % 2 == 0:
            if integer_ % 3 == 0 or integer_ % 5 == 0:
                pass
            else:
                print('DENIED')
                return 0
        else:
            pass

    print('APPROVED')

    return 0


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
    string s;
    int ans=3;
   // scanf("%s",s);
    cin>>s;
    int legth=s.size();//header
    int at=0;
    while(at<=legth-at-1){
        if(s[at]!=s[legth-at-1]){
            ans=0;
        }
        at++;
    }

    int half=(legth-1)/2;
    at=0;
    while (at <= half - at )
    {
        if (s[at] != s[half - at - 1])
        {
            ans = 0;
        }
        at++;
    }

    at=half+1;
    while (at <= legth - at)
    {
        if (s[at] != s[legth - at - 1])
        {
            ans = 0;
        }
        at++;
    }
    cout<<solve(ans)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {
	string s;
	cin >> s;
	string x(s.size(), 'x');
	col(x);
	return 0;
}


Measured memory_bytes: 3588
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<functional>
using namespace std;
int main(void) {
    
    int n;
    cin>>n;

    int a[200000];

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

    int i = n-1;

    
        while(1){
            
            cout<<a[i]<<" ";
            i -= 2;
            if(i<0)break;
        }
        if(n==1)return 0;
        if(n%2==0)i=0;
        else i=1;
        

        while(1){
            cout<<a[i]<<" ";
            i +=2;
            if(i>n-1)break;
        }
    

    
    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int broke[m];
  for (int i=0;i<m;i++) cin >> broke[i];
  
  int way[n];
  int* iter = lower_bound(broke, broke+m, 1);
  if (*iter != 1) way[0] = 1;
  else way[0] = 0;
  
  iter = lower_bound(broke, broke+m, 2);
  if (*iter != 2) way[1] = 1 + way[0];
  else way[1] = 0;
  
  for (int i=2;i<n;i++){
    iter = lower_bound(broke, broke+m, i+1);
    if (*iter != i+1) way[i] = (way[i-1] + way[i-2])%1000000007;
    else way[i] = 0;
  }
 
  cout << way[n-1] << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
char classify(int pm, int pe, int pj);

int main(void)
{
    int n, pm, pe, pj;
    while (1) {
	scanf("%d", &n);
	if (n == 0){
	    break;
	} else {
	    for (int i = 0;i < n;i ++){
		scanf("%d %d %d", &pm, &pe, &pj); 
		printf("%c\n", classify(pm, pe, pj));
	    }
	}
    }
    return 0;
}

char classify(int pm, int pe, int pj)
{
    int ave = (pm + pe + pj) / 3;
    if (pm == 100 || pe == 100 || pj == 100){
	return 'A';
    } else if ((pm + pe) / 2 >= 90){
	return 'A';
    } else if (ave >= 80){
	return 'A';
    } else if (ave >= 70){
	return 'B';
    } else if (ave >= 50 && (pm >= 80 || pe >= 80)){
	return 'B';
    } else {
	return 'C';
    }
}

Measured memory_bytes: 1028
#include<stdio.h>

int A[1000000],n;

int binarySearch(int key){
	int left=0;
	int right=n;
	int mid;
	while(left<right){
		mid=(left+right)/2;
		if(key==A[mid])return 1;
		if(key>A[mid])left=mid+1;
		else if(key<A[mid])right=mid;
	}
	return 0;
}

int main(){
	int i,q,k,sum=0;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&k);
		if(binarySearch(k))sum++;
	}
	printf("%d\n",sum);
	
	return 0;
}

Measured memory_bytes: 980
//
//  main.cpp
//  ALDS1_7_A
#include <iostream>
using namespace std;
#define MAX 100005
#define NIL -1
#define rep(i,n) for(int i=0;i<(n);++i)
struct Node { int p,l,r;}; // 親　最初の子　右の兄弟
Node T[MAX];
int n,D[MAX];

void print(int u){
    int i,c;
    cout<<"node "<<u<<": ";
    cout<<"parent = "<<T[u].p<<", ";
    cout<<"depth = "<<D[u]<<", ";
    if(T[u].p==NIL) cout<<"root, "; // 親がないのが根
    else if(T[u].l==NIL)cout<<"leaf, "; // 子がないのが葉
    else cout<<"internal node, "; // それ以外が内部節点
    cout<<"[";
    
    for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
        if(i)cout<<", "; // 最初以外の節点の出力時
        cout << c;
    }
    cout<<"]"<<endl;
}
void rec(int u,int p){
    D[u]=p; // 深さ　最初は０
    if(T[u].r!=NIL) rec(T[u].r,p); // 兄弟も同じ深さ
    if(T[u].l!=NIL) rec(T[u].l,p+1); // 子の深さには、+1して再帰
    return;
}
int main(int argc, const char * argv[]) {
    int d,v,c;
    int l=0;
    cin>>n; // 節の数（根も含む）　根の節番号は０
    rep(i,n) T[i].p=T[i].l=T[i].r=NIL; // 初期化
    rep(i,n){
        cin>>v>>d; // v:id d:次数（子の数）
        rep(j,d){
            cin>>c; // 子の節番号
            if(j==0) {
                T[v].l=c; // vの最初の子はc
            } else{
                T[l].r=c; // 2番目以降の子は、その前の子の兄弟
            }
            l=c; // ２番目以降の子は、その前の子の兄弟
            T[c].p=v; // 節cの親はv
        }
    }
    int r=0;
    rep(i,n){
        if(T[i].p==NIL) r=i; // 根を探して
    }
    rec(r,0);
    rep(i,n) print(i);
    return 0;
}



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

using namespace std;
using ll = long long;

const int MOD = 1e9+7;

int main()
{
    string s;cin >> s;
    vector<vector<int>> dp(s.size()+1, vector<int>(13, 0));
    dp[0][0] = 1;
    for(int i = 0;i < s.size();i++){
        for(int j = 0;j < 13;j++){
            if(s[i] == '?'){
                for(int k = 0;k < 10;k++){
                    dp[i + 1][(j * 10 + k) % 13] += dp[i][j];
                    dp[i + 1][(j * 10 + k) % 13] %= MOD;
                }
            }else{
                int c = s[i] - '0';
                dp[i + 1][(j * 10 + c) % 13] += dp[i][j];
                dp[i + 1][(j * 10 + c) % 13] %= MOD;
            }

        }
    }
    cout<<dp[s.size()][5] % MOD<<endl;
}


Measured memory_bytes: 8960
import sys
sys.setrecursionlimit(10**6+1) #再帰関数の上限,10**5以上の場合python


def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None


#N, Q = map(int, input().split())
N, Q = map(int, input().split())
#A = tuple(map(int, input().split())) #1行ベクトル
#L = tuple(int(input()) for i in range(N)) #改行ベクトル
#S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

edge = [[] for i in range(N)]
for i in range(N-1):#木の場合M=N-1
    a,b,c,w = map(int,input().split())
    edge[a-1].append((b-1,c-1,w))
    edge[b-1].append((a-1,c-1,w)) #有向のばあいコメントアウト



#ダブリングによるLCA, 前処理NlogN, 呼び出しlogN, 安定  
def dfs(start):
    q=[(start,-1,0,0)]
    pars=[-1]*N
    depth=[-1]*N
    dist=[-1]*N
    while len(q):
        e,p,d,dis=q.pop()#ここをpopleftにすると幅優先探索BFSになる
        if depth[e]!=-1:continue
        pars[e]=p
        depth[e]=d
        dist[e]=dis
        for ne,c,w in edge[e]:
            q.append((ne,e,d+1,dis+w))
    return pars,depth,dist
pars,d,dist=dfs(0)
ln=N.bit_length()
dp=[[-1]*N for _ in range(ln+1)]
dp[0]=pars
for i in range(1,ln+1):
    for j in range(N):
        dp[i][j]=dp[i-1][dp[i-1][j]]


# LCAの計算
def lca(u, v):
    du = d[u]; dv = d[v]
    if du > dv:
        du, dv = dv, du
        u,v=v,u
    dif=dv-du
    for i in range(ln+1):
        if (dif>>i)&1:
            v=dp[i][v]
    if u==v:return u
    for i in range(ln,-1,-1):
        pu=dp[i][u];pv=dp[i][v]
        if pu!=pv:
            u,v=pu,pv
    return pars[u]

q=Q
qs = tuple(tuple(map(int, input().split())) for i in range(Q)) #改行行列
ans=[0]*Q
qn=[[] for _ in range(N)]
for i,(x,y,u,v) in enumerate(qs):
    ans[i]=dist[u-1]+dist[v-1]-2*dist[lca(u-1,v-1)]
    qn[u-1].append((i,x-1,y,1))
    qn[v-1].append((i,x-1,y,1))
    qn[lca(u-1,v-1)].append((i,x-1,y,-2))

cc=[[0,0] for _ in range(N-1)]

dfq=[(0,None,0,-1)]
def dfs2(e,c,d,p):
    if c!=None:
        cc[c][0]+=1
        cc[c][1]+=d
    for qi,x,y,sgn in qn[e]:
        ans[qi]+=(y*cc[x][0]-cc[x][1])*sgn
    for ne,nc,nd in edge[e]:
        if ne==pars[e]:continue
        dfs2(ne,nc,nd,e)
    if c!=None:
        cc[c][0]-=1
        cc[c][1]-=d
dfs2(0,-1,0,None)
printl(ans)

# n=N
# A = [0]*q
# C = [[] for _ in range(n)]
# num = [0]*n
# cum = [0]*n
# for i in range(q):
#   x, y, u, v = map(int, input().split())
#   u -= 1
#   v -= 1
#   a = lca(u, v)
#   C[u].append((i, x, y, 1))
#   C[v].append((i, x, y, 1))
#   C[a].append((i, x, y, -2))
# dist = 0
# stack = [0]
# def dfs2(v):
#   global dist
#   for i, x, y, b in C[v]:
#     A[i] += (dist + num[x]*y - cum[x]) * b
#   for nv, c, d in edge[v]:
#     c+=1
#     if nv ==pars[v]:continue
#     dist += d
#     num[c] += 1
#     cum[c] += d
#     dfs2(nv)
#     dist -= d
#     num[c] -= 1
#     cum[c] -= d
# dfs2(0)
# print(*A, sep="\n")

Measured memory_bytes: 215276