akhauriyash/Code-Regression huggingface dataset:
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<unordered_map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<memory>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a)   a.begin(),a.end()
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
    //
    ModInt operator++(int) {
        auto t = *this;
        *this += 1;
        return t;
    }

    ModInt operator--(int) {
        auto t = *this;
        *this -= 1;
        return t;
    }
    ModInt operator<<(const int n){
        return ModInt(*this)*ModInt(2).pow(n);
    }
    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

void a(){
    ll A;
    cin >> A;
    cout << A+A*A+A*A*A;
}
void b(){
    string S;
    string T;
    cin >> S >> T;
    ll ans = 0;
    rep(i,S.size()){
        if(S[i]!=T[i]) ans++;
    }
    cout << ans;
}
void c(){}
void d(){}
void e(){}


int main(){
    b();
}

Measured memory_bytes: 3888
#include<iostream>
using namespace std;
int main(){
    char a,b;
    cin>>a>>b;
    bool reverse=true;
    if(a=='H'){
        reverse=false;
    }
    if(reverse){
        cout<<(b=='H'?'D':'H');
    }
    else{
        cout<<b;
    }
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define mx 100005
using namespace std;

int n, a[3], l[10], ans = 1e9+7;

int main(){
  scanf("%d%d%d%d", &n, a, a+1, a+2);
  for(int i = 0; i < n; i++){
    scanf("%d", l+i);
  }
  for(int i = 0; i < (1<<(2*n)); i++){
    int aa[4] = {}, cs = 0;
    bool used[3] = {}, ok = true;
    for(int j = 0; j < n; j++){
      int tm = (i >> (2*j)) & 3;
      aa[tm] += l[j];
      if(tm != 3){
        if(!used[tm]) used[tm] = true;
        else cs += 10;
      }
    }
    for(int j = 0; j < 3; j++){
      cs += abs(aa[j] - a[j]);
      if(!used[j]) ok = false;
    }
    if(ok) ans = min(ans, cs);
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll a,b,c,k;
	cin>>a>>b>>c>>k;

	ll ans = 0;
	if (k>=a)
	{
		ans+=a;
		k-=a;
		if (k>=b)
		{
			k-=b;
			ans-=k;
		}

	}
	else
	{
		ans = k;
	}
	cout<<ans;
}

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

int main(void){
  int N, A, B;
  int foreignRank = 0, pass = 0;
  string S;
  
  cin >> N >> A >> B;
  cin >> S;
  
  for(int i = 0; i < N; i++){
    if(S.at(i) == 'a'){
      if(pass < A + B){
        cout << "Yes" << endl;
        pass++;
      }
      else{
        cout << "No" << endl;
      }
    }
    else if(S.at(i) == 'b'){
      foreignRank++;
      if(pass < A + B && foreignRank <= B){
        cout << "Yes" << endl;
        pass++;
      }
      else{
        cout << "No" << endl;
      }
    }
    else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define MP make_pair
#define vii vector<pii>
#define vi vector<int>
#define ll long long
using namespace std;
string s;
int ans[100005];
int cnt=0;
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)ans[i]=1;
	for(int i=0;i<s.size()-1;i++)
	{
		if(s[i]=='R'&&s[i+1]!='L')
		{
			ans[i+1]+=ans[i];
			ans[i]=0;
		}
	}
	for(int i=s.size()-1;i>=1;i--)
	{
		if(s[i]=='L'&&s[i-1]!='R')
		{
			ans[i-1]+=ans[i];
			ans[i]=0;
		}
	}
	for(int i=0;i<s.size();i++)
	{
		if(ans[i])
		{
			int a=ans[i];
			int b=ans[i+1];
			ans[i]=ans[i+1]=0;
			ans[i]=(a+1)/2+b/2;
			ans[i+1]=a+b-ans[i];
			i++;
		}
	}
	for(int i=0;i<s.size();i++)cout<<ans[i]<<' ';
	return 0;
}

Measured memory_bytes: 1024
N,u,v = map(int,input().split())
u -= 1
v -= 1
E = [[] for _ in range(N)]
for _ in range(N-1):
    A,B=map(int,input().split())
    E[A-1].append(B-1)
    E[B-1].append(A-1)

ans = 0
if u==v:
    print(0)
    exit()

#u〜vの最短経路を求める
r = []
parent = [-1]*N
def dfs(root,end):
    global r
    stack = []
    stack.append(root)
    parent[root] = root
    while len(stack)>0:
        p = stack.pop()
        if p==end:
            break
        for e in E[p]:
            if parent[e]==-1:
                parent[e] = p
                stack.append(e)
    p=end
    while p!=root:
        r.append(p)
        p = parent[p]
    r.append(root)

dfs(v,u)
ans += (len(r)//2)+(len(r)&1)
v = r[len(r)//2]
u = r[(len(r)//2)-1]

#uから最も遠い頂点までの距離を求める
dmax = 0
depth = [-1]*N
def dfs2(root,end,d):
    global dmax
    stack = []
    stack.append(root)
    depth[root] = d
    depth[end] = 0
    while len(stack)>0:
        p = stack.pop()
        for e in E[p]:
            if depth[e]==-1:
                depth[e] = depth[p]+1
                dmax = max(dmax,depth[e])
                stack.append(e)

dfs2(u,v,0)
ans += dmax - 1

print(ans)

Measured memory_bytes: 63212
unittest
{
	assert( [ "8 6" ].parse.expand.solve == "Alice" );
	assert( [ "1 1" ].parse.expand.solve == "Draw" );
	assert( [ "13 1" ].parse.expand.solve == "Bob" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto ab = input.front.split.to!( long[] );
	return tuple( ab[ 0 ], ab[ 1 ] );
}

auto solve( long a, long b )
{
	if( a == b ) return "Draw";
	if( a == 1 ) a = 100;
	if( b == 1 ) b = 100;
	return ( b < a ) ? "Alice" : "Bob";
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>

using namespace std;

namespace {

inline long abs(int a, int b) {
  const int r = a - b >= 0 ? a - b : b - a;
  return static_cast<long>(r);
}

double CalcMinkowskiDistance(const int* x, const int* y, int n, int p) {
  long d = 0;
  for (int i = 0; i < n; ++i) {
    const long e = abs(x[i], y[i]);
    long r = 1;
    for (int j = 0; j < p; ++j) {
      r *= e;
    }
    d += r;
  }
  return pow(static_cast<double>(d), 1.0 / static_cast<double>(p));
}

double CalcManhattanDistance(const int* x, const int* y, int n) {
  long d = 0;
  for (int i = 0; i < n; ++i) {
    const long e = abs(x[i], y[i]);
    d += e;
  }
  return static_cast<double>(d);
}

double CalcEuclideanDistance(const int* x, const int* y, int n) {
  double d = 0.0;
  for (int i = 0; i < n; ++i) {
    d += static_cast<double>(x[i] - y[i]) * static_cast<double>(x[i] - y[i]);
  }
  return sqrt(d);
}

double CalcChebyshevDistance(const int* x, const int* y, int n) {
  long d = 0;
  for (int i = 0; i < n; ++i) {
    const long e = abs(x[i], y[i]);
    d = max(d, e);
  }
  return static_cast<double>(d);
}
} // namespace

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

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

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

  printf("%f\n", CalcManhattanDistance(x, y, n));
  printf("%f\n", CalcEuclideanDistance(x, y, n));
  printf("%f\n", CalcMinkowskiDistance(x, y, n, 3));
  printf("%f\n", CalcChebyshevDistance(x, y, n));
  return 0;
}

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

int main(){
  int n,ans=0;cin>>n;
  REP(i,n){
    int t;
    cin>>t;
    while(!(t%2)){
      ans++;
      t/=2;
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;
 
int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int n;
   cin >> n;
   vector<int> h(n);
   f(i,0,n){
      cin >> h[i];
   }
   for(int i=n-2;i>=0;i--){
      if(h[i] > h[i+1]){
         h[i]--;
      }
   }
   if(is_sorted(all(h))){
      cout << "Yes\n";
   }else{
      cout << "No\n";
   }
   return 0;
}

Measured memory_bytes: 1024
import math

n = int(input())
aL = list(map(int, input().split(" "))) + [0]
bL = ["NO" for _ in range(n)]

mk = 0
mm = 1000

up = False
for i in range(n):
    cr = aL[i]
    nx = aL[i + 1]

    if up:
        if cr > nx:
            up = False
            mm += mk * cr
            mk = 0
    else:
        if cr < nx:
            up = True
            mk = mm // cr
            mm = mm % cr

print(mm)

Measured memory_bytes: 9220
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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)*}
    };
}

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<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        m: usize,
        e: [(usize1, usize1, i64); m],
    }
    let mut g = vec![vec![]; n];
    for (a, b, c) in e {
        g[a].push((b, -c));
    }
    let inf = 1000000000 * (n as i64);
    let mut dp = vec![inf; n];
    dp[0] = 0;
    for _ in 0..n {
        for v in 0..n {
            if dp[v] == inf {
                continue;
            }
            for &(u, c) in g[v].iter() {
                let d = dp[v] + c;
                if d < dp[u] {
                    dp[u] = d;
                }
            }
        }
    }
    let mut q = std::collections::VecDeque::new();
    let mut neg = vec![false; n];
    for v in 0..n {
        if dp[v] == inf {
            continue;
        }
        for &(u, c) in g[v].iter() {
            let d = dp[v] + c;
            if d < dp[u] {
                neg[v] = true;
                q.push_back(v);
                break;
            }
        }
    }
    while let Some(v) = q.pop_front() {
        for &(u, _) in g[v].iter() {
            if neg[u] {
                continue;
            }
            neg[u] = true;
            q.push_back(u);
        }
    }
    if neg[n - 1] {
        println!("inf");
    } else {
        println!("{}", -dp[n - 1]);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using pii = pair<int, int>;
#define int ll
#define INF 1e18
using ll = long long;
int MOD =INF+7;
ll  doublePower(ll a, ll b ){
    //cal a^b
    if(b==0)return 1;
    if(b%2==0){
        long long d=doublePower(a,b/2);
        return (d*d)%MOD;
    }else{
        return (a*doublePower(a,b-1)%MOD);
    }
}
ll MOD_nCr(ll n,ll r,ll MOD){;
    ll denom=1;
    ll numer=1;
    for(ll i=1;i<=r;i++) numer=(numer*i)%MOD;
    for(ll i=n-r+1;i<=n;i++)denom=(denom*i)%MOD;
    return (denom*doublePower(numer, MOD-2)%MOD);
}
signed main(){
    int n,m; cin>>n>>m;
    vector<vector<int>>d(n,vector<int>(n,INF));
    rep(i,m){
        int a,b,c; cin>>a>>b>>c;
        d[a-1][b-1]=c;
        d[b-1][a-1]=c;
    }
    vector<vector<int>>d_min;
    rep(i,n)d[i][i]=0;
    d_min=d;
    rep(k,n)rep(i,n)rep(j,n)d_min[i][j]=min(d_min[i][j],d_min[i][k]+d_min[k][j]);
    vector<vector<bool>>used(n,vector<bool>(n,true));
    int ans=0;
    rep(i,n)rep(j,n)if(i!=j&&d[i][j]!=INF&&d_min[i][j]!=INF&&d[i][j]!=d_min[i][j])
        ans++;
    
    
    cout<<ans/2<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if (a<b) swap(a,b);
	if (a<c) swap(a,c);
	if (b<c) swap(b,c);
	printf("%d\n",a-c);
}

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

typedef long long ll;
typedef long double ld;

int mat[1005][1005];
int brow[1005];
int bcol[1005];

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n, m;
    cin >> n >> m;
    for(int i=1; i<=n; i++){
        string s;
        cin >> s;
        for(int j=1; j<=m; j++){
            if(s[j-1] == '#') mat[i][j] = 1;
        }
    }
    for(int i=1; i<=n; i++){
        int cnt = 0;
        for(int j=1; j<=m; j++){
            cnt += mat[i][j];
        }
        if(cnt == 0) brow[i] = 1;
    }
    for(int j=1; j<=m; j++){
        int cnt = 0;
        for(int i=1; i<=n; i++){
            cnt += mat[i][j];
        }
        if(cnt == 0) bcol[j] = 1;
    }
    for(int i=1; i<=n; i++){
        if(brow[i]) continue;
        for(int j=1; j<=m; j++){
            if(bcol[j]) continue;
            if(mat[i][j]) cout << "#";
            else cout << ".";
        }
        cout << "\n";
    }
    return 0;
}


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

int main(int argc, char const *argv[])
{
    int s;

    cin >> s;

    int top = s / 100;
    int bottom = s - top * 100;
    bool b1 = 0 < top && top <= 12;
    bool b2 = 0 < bottom && bottom <= 12;

    if(b1 && b2){
        cout << "AMBIGUOUS" << endl;
        return 0;
    }
    
    if(b1){
        cout << "MMYY" << endl;
        return 0;
    }

    if(b2){
        cout << "YYMM" << endl;
        return 0;
    }

    cout << "NA" << endl;
    return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair <ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll S[100005];

int main() {
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> S[i];
    }

    ll ans = 0;
    ll Q;
    cin >> Q;
    REP(i, Q) {
        ll q;
        cin >> q;
        REP(j, N) {
            if (q == S[j]) {
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3076
n = int(input())
a_lis = list(map(int, input().split()))
a_lis.sort(reverse=True)
alice = True
al_lis = []
bo_lis = []
for i in a_lis:
    if alice:
        al_lis.append(i)
    else:
        bo_lis.append(i)
    alice = not alice
print(sum(al_lis) - sum(bo_lis))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
ll n , x;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>x;
  std::vector<ll> a(n);
  ll cnt = INF;
  rep(i,n) {
    cin>>a[i];
    minch(cnt,a[i]);
    x-=a[i];
  }
  cout<<n+x/cnt<<endl;


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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
 
int main(){
    string S;
    cin >> S;
    int N=S.size(),count=0;
    rep(i,floor(N/2)){
        if(S.at(N-1-i)!=S.at(i)){
            count++;
        }    
    }
    cout << count << endl;
}

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

const int mod = 1e9 + 7;

int add(int x, int y) {
	return (x += y) >= mod ? x - mod : x;
}

template<class... T>
int add(int x, T... y) {
	return add(x, add(y...));
}

int mul(int x, int y) {
	return 1LL * x * y % mod;
}

template<class... T>
int mul(int x, T... y) {
	return mul(x, mul(y...));
}

void upd(int &x, int y) {
	if ((x += y) >= mod) x -= mod;
}

int main() {
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;

	static int inv[1000001];

	inv[1] = 1;
	for (int i = 2; i <= 1000; i++) {
		inv[i] = mul(inv[mod % i], mod - mod / i);
	}

	static int F[1000001];
	static int invF[1000001];
	F[0] = 1;
	invF[0] = 1;
	for (int i = 1; i <= 1000000; i++) {
		F[i] = mul(F[i - 1], i);
		invF[i] = mul(invF[i - 1], inv[i]);
	}

	auto C = [&](int n, int r) {
		if (n < 0 || r < 0 || n < r) return 0;
		return mul(F[n], invF[r], invF[n - r]);
	};

	static int dp0[1001];
	static int dp1[1001];
	dp0[0] = 1;

	for (int i = a; i <= b; i++) {
		memcpy(dp1, dp0, sizeof(dp1));

		for (int j = 0; j < n; j++) {
			int f = 1;
			for (int k = 0; k <= d && j + i * k <= n; k++) {
				// j + i * k <= n
				if (k >= c) {
					upd(dp0[j + i * k], mul(dp1[j], C(n - j, i * k), F[i * k], f, invF[k]));
				}
				f = mul(f, invF[i]);
			}
		}
	}

	cout << dp0[n] << endl;
}


Measured memory_bytes: 8064
#include <stdio.h>


int main() {
 

  int n;
  scanf("%d",&n);

  int cnt4=0,cnt2=0;
  //4の倍数
  //4の倍数出ないが、2の倍数/2
  //の合計がn/2より大きい
  for(int i=0;i<n;i++){
    int wk;
    scanf("%d",&wk);
    if(wk%4==0)
      cnt4++;
    else if(wk%2==0)
      cnt2++;
  }

  if(cnt4+cnt2/2>=n/2)
    printf("Yes\n");
  else 
    printf("No\n");

	return 0;
}

Measured memory_bytes: 1664
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
int times[100000], que[100000];
char name[100000][15];

int main(void){
  int n, q, i, left, dec = 0, total = 0;
  
  scanf("%d %d",&n, &q);
  left = n;
  for(i=0;i<n;i++) {
    scanf("%s %d", name[i], &times[i]);
    que[i] = i;
  }
  while(left > 0){
    dec = 0;
    for(i=0;i<left;i++){    
      times[que[i]]-=q;
      total += q;    
   
      if(times[que[i]] <= 0){
	dec++;
	printf("%s ",name[que[i]]);
	total += times[que[i]];
	printf("%d\n",total);
      }
      else que[i-dec] = que[i];
    }
    left -= dec;
  }

  return 0;
}


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

using namespace std;

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

bool era[10000001]={false};


void makeERA(){
    for(int i=2;i<1000001;i++){
        if(era[i]!=true)continue;
            int x=10000000/i;
            for(int j=2;j<=x;j++){
                    era[i*j]=false;
            }

    }
    era[2]=true;
}




int main(){
    for(int i=0;i<10000001;i++)era[i]=true;
    era[0]=false;era[1]=false;
    makeERA();
    
    int n;
    while(cin>>n){
        if(n==0)break;
        
        if(n%2==0)n--;
        for(int i=n;i>=8;i-=2){
            if(era[i-8]&&era[i-6]&&!era[i-4]&&era[i-2]&&era[i]){
                cout<<i<<endl;
                goto next;
            }
        }
        next:;
    }
    
    
    return 0;
}

Measured memory_bytes: 10924
#include<stdio.h>

int main(void)
{
	int a, b,c,i;

	scanf("%d %d", &a, &b);

	c = b - a+1;
	b = a * 2 - 1;
	for(i=0;i<b;i++,c++)
	printf("%d ", c);

	

	return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int h = sc.nextInt(), w = sc.nextInt();
        boolean[][] a = new boolean[h][w];
        for (int i = 0; i < h; i++) {
            String s = sc.next();
            for (int j = 0; j < w; j++) {
                if (s.charAt(j) == '#') {
                    a[i][j] = true;
                }
            }
        }

        List<Integer> skip = new ArrayList<>();
        for (int j = 0; j < w; j++) {
            boolean allWhite = true;
            for (int i = 0; i < h; i++) {
                if (a[i][j]) {
                    allWhite = false;
                    break;
                }
            }
            if (allWhite) {
                skip.add(j);
            }
        }
        for (int i = 0; i < h; i++) {
            boolean allWhite = true;
            for (int j = 0; j < w; j++) {
                if (a[i][j]) {
                    allWhite = false;
                    break;
                }
            }
            if (!allWhite) {
                for (int j = 0; j < w; j++) {
                    if (!skip.contains(j)) {
                        System.out.print(a[i][j] ? '#' : '.');
                    }
                }
                System.out.println();
            }
        }
    }
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	LLi n, x, m, tmp, del, rp, ans=0, flag=1;
	vector<LLi> v, va;

	cin>> n >> x >> m;
	v.resize(m+1);
	va.resize(m+1);

	for(LLi i=1;i<=n;i++){
		tmp=x;
		ans+=x;
		x=x*x;
		x=x%m;
		if(v[tmp]>0 && flag){
			flag=0;
			del=i-v[tmp];
			rp=(n-i)/del;
			//cout<< del << "#" << rp << "#" << i << "#" << v[x] << "#" << ans << "#" << va[x] <<endl;
			i+=rp*del;
			ans+=rp*(ans-va[tmp]);
		}
		v[tmp]=i;
		va[tmp]=ans;
	}

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

Measured memory_bytes: 4836
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

void solve() {
	ll A, B;

	cin >> A >> B;

	cout << max(A + B, max(A - B, A*B));


}

int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 888
# なぜかunion findが動かないので手癖で復習
n, m = map(int, input().split())
# par = [i for i in range(n)]

def root(x, par):
    if x == par[x]:
        return x
    else:
        t = root(par[x], par)
        par[x] = t
        return t

def same(a, b, par):
    return root(a, par) == root(b, par)

def union(a, b, par):
    if not same(a, b, par):
        ra = root(a, par)
        rb = root(b, par)
        # par[rb] = ra
        par[rb] = a

edges = []
for _ in range(m):
    edges.append(tuple(map(lambda x : int(x)-1, input().split())))

ans = 0
for i in range(m):
    par = [k for k in range(n)]
    for j in range(m):
        if i == j:
            continue
        a, b = edges[j]
        if same(a, b, par):
            continue
        union(a, b, par)
    # 以降が.....
    a, b = edges[i]
    if not same(a, b, par):
        ans += 1
print(ans)

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

void solve(){

	int n ;
	cin>>n ;

	string s ;
	cin>>s ; 

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

	string t=s.substr(n/2) ;
	t=t+t ;

	if(s==t){
		cout<<"Yes" ;

	}
	else{
		cout<<"No" ;
	}

}


int main(){

		int y ;

		y=1 ;
		//cin>>y ;

		while(y--){
 
			solve() ;

		}

}

Measured memory_bytes: 3596
# coding: utf-8
import sys
input = sys.stdin.readline

N, M, start = map(int, input().split())
lst_station = input().split()

cost2zero = sum(1 for i in range(start) if str(i) in lst_station)
cost2N = sum(1 for i in range(start+1, N+1) if str(i) in lst_station)

print(min(cost2zero, cost2N))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> istream & operator>>(istream & s, vector<T> & v) { RF(e, v) { s >> e; } return s; }
template<typename T> ostream & operator<<(ostream & s, vector<T> const & v) {
	inc(i, SI(v)) { s << (i == 0 ? "" : " ") << v[i]; }
	return s;
}

int main() {
	IN(int, n);
	vector<LL> a(n);
	cin >> a;
	
	LL s = 0, mi = 2e9;
	inc(i, n) {
		s += a[i];
		setmin(mi, a[i]);
	}
	bool f = (n % 2 == 1 ? (s % 2 == 1) : ! (s % 2 == 0 && mi % 2 == 0));
	OUT(f ? "First" : "Second");
}



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

int main() {
  int a, b, avg_i, avg_x;
  double avg_d;

  cin >> a >> b;

  avg_i = (a + b) / 2;
  avg_d = (a + b) / 2.0;
  avg_d = avg_d - avg_i;
  avg_x = avg_d + avg_d;

  cout << avg_i + avg_x << endl;
}


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

int main()
{
    #ifdef TooLazy
        freopen("input.txt", "r", stdin);
    #endif // TooLazy

    int a, b, c;
    while(cin >> a >> b >> c) {
        int ara[5];
        ara[0] = a;
        ara[1] = b;
        ara[2] = c;
        sort(ara, ara+3);
        int x = ara[1] - ara[0];
        int y = ara[2] - ara[1];
        if(x==y)
            puts("YES");
        else
            puts("NO");
    }

    return 0;
}


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

int main() {
    string s;
    cin >> s;
    if(s == "SUN"){
        cout << 7 << endl;
    }
    else if(s == "MON"){
        cout << 6 << endl;
    }
    else if(s == "TUE"){
        cout << 5 << endl;
    }
    else if(s == "WED"){
        cout << 4 << endl;
    }
    else if(s == "THU"){
        cout << 3 << endl;
    }
    else if(s == "FRI"){
        cout << 2 << endl;
    }
    else if(s == "SAT"){
        cout << 1 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    long long n;
    cin>>n;
    vector<char>s;
    char a;
    while(n){
        n--;
        a='a'+n%26;
        s.push_back(a);
        n/=26;
    }
    rep(i,s.size())cout<<s[s.size()-1-i];
	return 0;
}


Measured memory_bytes: 3568
n = int(input())
num = list(map(int, input().split()))
cnt = 1
print(" ".join(map(str,num)))
while cnt < len(num):
    for i in range(cnt, 0, -1):
        if num[i] < num[i-1]:
            num[i], num[i-1] = num[i-1], num[i]
    print(" ".join(map(str,num)))
    cnt+=1


Measured memory_bytes: 5604
#include<stdio.h>
#include<stdlib.h>

int main(void){
    int H,N,A;
    int ans;

    scanf("%d",&H);
    scanf("%d",&N);

    ans=0;
    for(int i=0;i<N;i++){
        scanf("%d",&A);
        ans+=A;
    }

    if(ans >= H){
        printf("Yes");
    }else{
        printf("No");
    }

    return 0;
}

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

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

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

    for (int i = 0; i < n; i++) {
        if (b[i] == a[n - 1]) cout << a[n - 2] << endl;
        else cout << a[n - 1] << endl;
    }
    return 0;
}


Measured memory_bytes: 3200
#include<stdio.h>
    int main(void){
        int r,g,b,a;
        scanf("%d%d%d",&r,&g,&b);
       a = g*10+b;
       if(a%4==0){
       printf("YES"); 
      } else{
       printf("NO");
      }
       return 0;
    }

Measured memory_bytes: 128
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int main()
{
	string s;
	cin >> s;
	cout << "ABC" << s << endl;
}

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


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

  if(s=="ABC") cout <<"ARC" << endl;
  else cout <<"ABC" << endl;
  
  
  return 0;
    

}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
const ll INF = 999999999999999;
const ll MOD = 1000000007 /*988244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, g, h, x, y, z, p, q, m, n, t, r, k, w, l, ans, i, j;
string S, T;
vl A, B;
void solve() { cout << sqrt(a * a + b * b - 2 * a * b * cos(asin(1) * 2 * (11 * m - 60 * h) / 360)) << endl; }
int main() {
    cout << fixed << setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b >> h >> m;
    solve();
}

Measured memory_bytes: 4180
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int q;
  while(cin>>q, q!=-1) {
    double x = 0.5 * q;
    while(abs(x*x*x-q) >= 0.00001 * q) {
      x = x - (x*x*x-q)/(3*x*x);
    }
    printf("%.6lf\n",x);
  }
}

Measured memory_bytes: 0
// Problem : C - Align
// Contest : AtCoder - Tenka1 Programmer Beginner Contest
// URL : https://atcoder.jp/contests/tenka1-2018-beginner/tasks/tenka1_2018_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long   ll;
typedef long double ld;
typedef complex< ld > cd;
 
typedef pair<int, int> pi;
typedef pair<ll, ll>   pl;
typedef pair<ld, ld>   pd;
 
typedef vector< int > vi;
typedef vector< ld >  vd;
typedef vector< ll >  vl;
typedef vector< pi >  vpi;
typedef vector< pl >  vpl;
typedef vector< cd >  vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a)    for (int i=0; i<(a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a)     for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)    for (auto& a : x)
#define uid(a, b)     uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f  first
#define s  second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	int n;
	cin>> n;
	vi a(n);
	loop(i,n)
		cin>>a[i];
	sort(all(a));
	ll sum=a[n-1]-a[0];
	l00p(i,1,n/2)
		sum+=a[n-i-1]-a[i-1]+a[n-i]-a[i];
	if(n%2)
	sum+=max(a[n/2+1]-a[n/2],a[n/2]-a[n/2-1]);
	cout<<sum;
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
bool LTE(double a,double b) { return equals(a,b) || a < b; }
bool LT(double a,double b) { return !equals(a,b) && a < b; }

void compute() {

}

int main() {
  int N,H,W;
  cin >> N >> H >> W;
  cout << ( N - H + 1 )  * ( N - W + 1) << endl;
  compute();
  return 0;
}


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

#define int long long
#define db(a, ...) cerr<<#a<<" = "<<a<<'\n'
#define db2(a, b) cerr<<#a<<" = "<<a<<", ", db(b)
#define db3(a, b, c) cerr<<#a<<" = "<<a<<", ", db2(b, c)
#define db4(a, b, c, d) cerr<<#a<<" = "<<a<<", ", db3(b, c, d)

using namespace std;

const int MOD = 200003;

using cd = complex<double>;
const double PI = acos(-1);

void fft(vector<cd> &a, bool invert) {
    int n = a.size();

    for (int i = 1, j = 0; i < n; i++) {
        int bit = n >> 1;
        for (; j & bit; bit >>= 1)
            j ^= bit;
        j ^= bit;

        if (i < j)
            swap(a[i], a[j]);
    }

    for (int len = 2; len <= n; len <<= 1) {
        double ang = 2 * PI / len * (invert ? -1 : 1);
        cd wlen(cos(ang), sin(ang));
        for (int i = 0; i < n; i += len) {
            cd w(1);
            for (int j = 0; j < len / 2; j++) {
                cd u = a[i + j], v = a[i + j + len / 2] * w;
                a[i + j] = u + v;
                a[i + j + len / 2] = u - v;
                w *= wlen;
            }
        }
    }

    if (invert) {
        for (cd &x : a)
            x /= n;
    }
}


vector<int> multiply(vector<int> const &a, vector<int> const &b) {
    vector<cd> fa(a.begin(), a.end()), fb(b.begin(), b.end());
    int n = 1;
    while (n < a.size() + b.size())
        n <<= 1;
    fa.resize(n);
    fb.resize(n);

    fft(fa, false);
    fft(fb, false);
    for (int i = 0; i < n; i++)
        fa[i] *= fb[i];
    fft(fa, true);

    vector<int> result(n);
    for (int i = 0; i < n; i++)
        result[i] = round(fa[i].real());
    return result;
}

int n, M[MOD];

int mul(int x, int k) {
    if (k == 0)
        return 1;
    int tmp = mul(x, k / 2);
    if (k % 2 == 0)
        return tmp * tmp % MOD;
    return tmp * tmp % MOD * x % MOD;
}

int32_t main() {
#ifdef ACM
    freopen("A.in", "r", stdin);
#endif
    for (int i = 0; i < MOD - 1; i++)
        M[mul(2, i)] = i;
    cin >> n;
    int x, rs = 0;
    vector<int> V(MOD);
    while (n--) {
        cin >> x;
        if (x == 0)
            continue;
        rs -= x * x % MOD;
        V[M[x]]++;
    }
    vector<int> A = multiply(V, V);
    for (int i = 0; i < A.size(); i++)
        rs += mul(2, i) * A[i];
    cout << rs / 2;
}

Measured memory_bytes: 27256
#include <cstdio>
#include <fstream>
#include <cstring>

using namespace std;

const int mx = 100 + 5;
int mark[mx];

int main(){
    int a, b, c;
    while(~scanf("%d%d%d", &a, &b, &c)){
        int t = c % b, r = a;
        memset(mark, 0, sizeof(mark));
        while(a != t){
            if(mark[a]){
                break;
            }
            mark[a] = 1;
            a = (a + r) % b;
        }
        if(a == t){
            printf("YES\n");
        }
        else{
            printf("NO\n");
        }
    }
    return 0;
}

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;

  bool flag=false;
  for(int i=1; i<=b-1; i++){
    if(a*i%b == c){
      flag = true;
      break;
    }
  }

  cout << (flag? "YES": "NO") << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
    cin>>s;
    if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I') 
        cout<<"Yes"<<endl;
    else 
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int N, A, B;
	cin >> N >> A >> B;
	cout << min(A * N, B) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 998244353
using namespace std;
int read();
void Add(int &x, int y) { (x += y) >= mod ? x -= mod : x; }
int fsp(long long bs, int p) {
    int rt = 1;
    while (p) {
        if (p & 1) rt = bs * rt % mod;
        bs = bs * bs % mod, p >>= 1;
    }
    return rt;
}
int n;
int a[502], b[502], sa, sb;
int fac[502], caf[502], lim = 500;
void init() {
    fac[0] = 1;
    for (int i = 1; i <= lim; ++i) fac[i] = 1ll * fac[i - 1] * i % mod;
    caf[lim] = fsp(fac[lim], mod - 2);
    for (int i = lim; i >= 1; --i) caf[i - 1] = 1ll * caf[i] * i % mod;
}

int f[502][502], g[502][502];
int main() {
    n = read();
    for (int i = 1; i <= n; ++i) sa += (a[i] = read()), sb += (b[i] = read());
    init();
    g[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        int p = 1ll * a[i] * fsp(sa, mod - 2) % mod;
        for (int j = 0; j <= sa; ++j)
            for (int k = 0; k <= sb; ++k) f[j][k] = 0;
        for (int j = 0; j <= sa; ++j)
            for (int k = 0, x, tmp; k <= sb; ++k) {
                if (!(x = g[j][k])) continue;
                Add(f[j + a[i]][k], x), tmp = mod - x;
                for (int t = 0; t < b[i]; ++t, tmp = 1ll * tmp * p % mod)
                    Add(f[j][k + t], 1ll * tmp * caf[t] % mod);
            }
        swap(f, g);
    }
    int res = 0;
    for (int i = 0; i < sa; ++i) {
        int p = 1ll * sa * fsp(sa - i, mod - 2) % mod, tmp = p;
        for (int j = 0; j <= sb; ++j, tmp = 1ll * tmp * p % mod)
            Add(res, 1ll * g[i][j] * fac[j] % mod * tmp % mod);
    }
    printf("%d\n", mod - res);
    return 0;
}
const int _SIZE = 1 << 22;
char ibuf[_SIZE], *iS = ibuf, *iT = ibuf;
#define gc                                                         \
    (iS == iT ? iT = ((iS = ibuf) + fread(ibuf, 1, _SIZE, stdin)), \
     (iS == iT ? EOF : *iS++) : *iS++)
int read() {
    int x = 0, f = 1;
    char c = gc;
    while (!isdigit(c)) f = (c == '-') ? -1 : f, c = gc;
    while (isdigit(c)) x = x * 10 + c - '0', c = gc;
    return x * f;
}

Measured memory_bytes: 2176
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;


void Main(){
    ll K, N, p;
    sll(N);
    sll(K);
    vector<ll> ps(N,0);
    rep(i, N){
        sll(ps[i]);
    }
    sort(ps.begin(), ps.end());
    
    ll sum = 0;
    rep(i ,K){
        sum += ps[i];
    }
    cout << sum << endl;


}

int main(){
    Main();
}

Measured memory_bytes: 3260
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    N, T = map(int, input().split())
    t = list(map(int, input().split()))

    arr = [[]] * len(t)
    for i in range(len(t)):
        arr[i] = [t[i], t[i]+T]

    ans = arr[0][1]
    for i in range(len(t)-1):
        _, t1 = arr[i]
        f2, t2 = arr[i+1]

        if t1 <= f2:
            ans += t2 - f2
        else:
            ans += t2 - t1
    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < n; i++) {
    cout << s.at(i) << t.at(i);
  }
  cout << endl;
}


Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
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()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,x;
    cin>>n>>m>>x;
    vector<int>a(m);
    rep(i,m)cin>>a[i];
    vector<bool>b(n+1,false);
    rep(i,m){
        b[a[i]]=true;
    }
    int suma=0;
    int sumb=0;
    rep(i,x+1){
        if(b[i])suma++;
    }
    for(int i=n;i>=x;i--){
        if(b[i])sumb++;
    }
    cout<<min(suma,sumb)<<"\n";
}


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

typedef long long ll;

ll N, M;

int main() {
    cin >> N >> M;
    N = N - 2;
    M = M - 2;

    if (N < 0) N = 1;
    if (M < 0) M = 1;
    cout << N * M << endl;
}

Measured memory_bytes: 256