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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

struct People{
  ll id;
  vector<ll> former;
  bool operator<(const People &p){
    for(auto &&n : former){
      if(p.id == n){
        return true;
      }
    }
    return false;
  }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m;
  int x,y;
  cin >> m >> n;
  vector<People> di(m);
  REP(i,0,m){
    di[i].id = i+1;
    di[i].former.pb(2);
  }
  rep(i,n){
    cin >> x >> y;
    --x;
    di[x].former.pb(y);
  }
  REP(i,0,m){
    rep(k,di[i].former.size()){
      REP(j,i+1,m){
        if(di[j].id == di[i].former[k]){
          swap(di[i],di[j]);
          j = 0;
          i = 0;
        }
      }
    }
  }
  reverse(di.begin(),di.end());
  REP(i,0,m){
    cout << di[i].id<<endl;
  }
  return 0;
}

Measured memory_bytes: 3156
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String n = scanner.nextLine();
        if (n.endsWith("2") || n.endsWith("4") || n.endsWith("5") || n.endsWith("7") || n.endsWith("9")) {
            System.out.println("hon");
        }else if (n.endsWith("0") || n.endsWith("1") || n.endsWith("6") || n.endsWith("8")) {
            System.out.println("pon");
        }else {
            System.out.println("bon");
        }
    }
}


Measured memory_bytes: 35892
#include<iostream>
#include<stdio.h>
using namespace std;

int main()
{
  int i, j, k;
	for(i = 1; i < 10;i++){
	for(j = 1; j < 10;j++){
		k=i*j;
		cout<<i<<"x"<<j<<"="<<k<<endl;
	}}
  return 0;
}

Measured memory_bytes: 1116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
const ll INF=1e9;
const ll IINF=1e18;

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

int main(){
    ll Q;
    cin >> Q;
    ll center,suma=0,sumb=0,count=0;
    multiset<ll> s;
    auto itr=s.begin();
    rep(i,Q){
        ll q;
        cin >> q;
        if (q==1){
            ll a,b;
            cin >> a >> b;
            sumb+=b;
            s.insert(a);
            if (count==0){
                itr=s.begin();
                center=*itr;
                count++;
                continue;
            }
            suma+=abs(center-a);
            if (count%2==0&&a>=center){
                itr++;
                suma-=*itr-center;
                center=*itr;
            }
            if (count%2==1&&a<center){
                itr--;
                center=*itr;
            }
            count++;
        }
        else {
            cout << center << ' ' << suma+sumb << endl;
        }
    }
}

Measured memory_bytes: 9600
#include<queue>
#include<cstdio>
#include<iostream>
using namespace std;


int main()
{
	int t, k, s;

	while (1)
	{
		cin >> t >> k >> s;
		if (t == -1 && k == -1 && s == -1)
			break;
		else if ((t == -1 || k == -1) || (t + k < 30))
			cout << 'F' << endl;
		else if (t + k >= 80)
			cout << 'A' << endl;
		else if (t + k < 80 && t + k >= 65)
			cout << 'B' << endl;
		else if (t + k < 65 && t + k >= 50)
			cout << 'C' << endl;
		else if ((t + k < 50 && t + k >= 30) && s < 50)
			cout << 'D' << endl;
		else
			cout << 'C' << endl;
	}
}

Measured memory_bytes: 1156
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j]
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
int main(){
    int h,a; cin >> h >> a;
    int ans=h/a;
    if(h%a!=0) ans++;
    cout << ans;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    ll a, b, c, k;
    cin>>a>>b>>c>>k;
    ll now = max(a, b);
    now = max(now, c);
    ll ans = a+b+c-now;
    rep(i, k){
        now *= 2;
    }
    ans += now;
    cout<<ans<<endl;
    return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  vector<ll>a(26);
  string s;cin>>s;
  for(i=0;i<s.size();i++){
    a[s[i]-'a']++;
  }
  for(i=0;i<26;i++){
    if(a[i]%2){
      judge=false;
      break;
    }
  }
  ans1(judge);
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
 
public class Main {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
 
    void solve() throws IOException {
    	char[] s = in.nextToken().toCharArray();
    	if(s[0] == '9' || s[1] == '9') System.out.println("Yes");
    	else System.out.println("No");
    }
 
}
 
@SuppressWarnings("serial")
class MultiSet<T> extends HashMap<T, Long>{
    @Override public Long get(Object key){return containsKey(key)?super.get(key):0L;}
    public void add(T key,long v){put(key,get(key)+v);}
    public void add(T key){put(key,get(key)+1);}
    public void sub(T key){final long v=get(key);if(v==1)remove(key);else put(key,v-1);}
    public MultiSet<T> merge(MultiSet<T> set)
    {MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
        for(Entry<T,Long>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
}
 
class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}

Measured memory_bytes: 23380
#k=int(input())
a,b=map(int,input().split())
#hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

flag=False
import math
for price in range(1,1001):
    if math.floor(price*0.08)==a and math.floor(price*0.1)==b:
        flag=True
        break

if flag:
    print(price)
else:
    print(-1)


Measured memory_bytes: 2940
S = input()
count_dict = {}
for i in S:
  if i not in count_dict:
    count_dict[i] = 1
  else:
    count_dict[i] += 1

value = list(count_dict.values())
if len(value) == 2 and value[0] == value[1]:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
template<class F>
auto  maximize(int imin,int imax,F &f){
    while(imax - imin > 1){
        int mid = imin + (imax - imin)/2;
        if(f(mid)) imin = mid;
        else imax = mid;
    }
    return imin;
}
template<class T, class Func = function<T(T,T)>>
class CumulativeSum{
public:
    vector<T>sum;
    T e;
    CumulativeSum(const vector<T>v,T e,const Func f) : sum(v.size()),e(e){
        copy(v.begin(),v.end(),sum.begin());
        T past = 0;
        for(auto & itr : sum){
            itr = f(itr,past);
            past = itr;
        }
    }
    //[l,r)
    auto query(int l, int r, Func f = [](int a,int b){return a - b;}){
        if(r > 0) return f(sum[r - 1],(l == 0 ? 0 : sum[l - 1]));
        else return e;
        
    }
};
signed main(){
    int N; cin >> N;
    vector<int>v(N);
    for(auto & e: v) cin >> e;
    auto xor_f = [](int a, int b){return a xor b;};
    auto sumt = CumulativeSum<int>(v,0LL,[](int a, int b){return a + b;});
    auto xort = CumulativeSum<int>(v,0LL,xor_f);
    int ans = N;
    int L = -1;
    auto f = [&](int mid){
        return sumt.query(L,mid) == xort.query(L,mid,xor_f);
    };
    for(int i = 0; i < N - 1; ++i){
        L = i;
        int t = maximize(L,N+1,f) - 1;
        t -= L;
        ans += t;
    }
    cout << ans << endl;
}


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

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

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=200005;
int n,q;
string s;
int c[M],d[M];
int box[M];
bool chk(int pos)
{
    int rong=box[pos];
    int cur=pos;
    f(i,1,q)
    {
        if(c[i]==box[cur])
        {
            if(d[i]==0)
            {
                cur--;
                if(cur==0)return true;
            }
            else
            {
                cur++;
                if(cur>n)return false;
            }
        }
    }
    return false;
}
bool chk2(int pos)
{
    int rong=box[pos];
    int cur=pos;
    f(i,1,q)
    {
        if(c[i]==box[cur])
        {
            if(d[i]==0)
            {
                cur--;
                if(cur==0)return false;
            }
            else
            {
                cur++;
                if(cur>n)return true;
            }
        }
    }
    return false;
}
 main()

{
    fast
    cin>>n>>q;
    cin>>s;
    f(i,1,n)
    {
        box[i]=s[i-1]-'a';
    }
    f(i,1,q)
    {
        char ch,ch2;
        cin>>ch>>ch2;
        c[i]=ch-'a';
        if(ch2=='R')d[i]=1;
    }
    int lo=1,hi=n;
    while(hi>lo)
    {
        int mid=(lo+hi+1)>>1;
        if(chk(mid))
        {
            lo=mid;
        }
        else hi=mid-1;
    }
    int lft=0,rgt=n+1;
    if(chk(lo))lft=lo;
    lo=1,hi=n;
    while(hi>lo)
    {
        int mid=(lo+hi)>>1;
        if(chk2(mid))
        {
            hi=mid;
        }
        else
        {
            lo=mid+1;
        }
    }
    if(chk2(lo))rgt=lo;
    int ses=lft+(n+1-rgt);
    ses=n-ses;
    cout<<ses<<endl;
    return 0;

}



































Measured memory_bytes: 8424
#include<stdio.h>
int main(void){
   int d, dsum, area[1000], n, i;
   n = 0;
   while(scanf("%d", &d) != EOF){
      n++;
      area[n] = 0;
      for(dsum = 0; dsum < 600; dsum = dsum + d){
         area[n] = area[n] + d * dsum * dsum;
      }
      printf("%d\n", area[n]);
   }
   return 0;
}

Measured memory_bytes: 1792
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque, BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let (n, c) = get!(usize, usize);
    let stc = get!(usize, usize, usize; n);

    let mut imos = vec![vec![0i64; 100002]; c];

    for &(s, t, c) in &stc {
        let c = c - 1;
        imos[c][s] += 1;
        imos[c][t] -= 1;
    }

    let mut m = vec![0; c];
    let mut ans = 0;

    for i in 0..100002 {
        for k in 0..c {
            if imos[k][i] > 0 {
                m[k] += imos[k][i];
            }
        }
        ans = max(ans, m.iter().sum::<i64>());
        for k in 0..c {
            if imos[k][i] < 0 {
                m[k] += imos[k][i];
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 39164
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0
inf = float("inf")

n = k()
a = s()
for i in range(n-1):
    if a[i] != a[i+1]:
        count += 1

print(count+1)


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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> H(n);
    for (int i = 0; i < n; i++) cin >> H[i];
    int ma = 0, ans = 0;
    for (auto &h: H){
        if (ma <= h) {
            ans++;
            ma = h;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
/*
 * atcoder/dp_2nd/b.cpp
 */

// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>
#include <cstring>

#define ll long long
#define Int ll
#define loop(__x, __start, __end) for(Int __x = __start; __x < __end; __x++)
#define loopdown(__x, __start, __end) for(Int __x = __start; __x > __end; __x--)
#define rep(__n) for(Int __x = 0; __x < __n; __x++)
#define span(__a,__x,__y) __a.begin()+__x,__a.begin()+__y
#define span_all(__a) __a.begin(),__a.end()
#define len(__x) (__x.size())
#define last(__x) (__x[__x.size()-1])

using namespace std;

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

const Int INFTY = 10e17;
const Int MAX_N = 10e5+200;
Int N, K;
vector<Int> A;
Int dp[MAX_N];

void input() {
  cin >> N >> K;
  Int a;
  loop(n,0,N) {
    cin >> a;
    A.push_back(a);
  }
}

void solve() {
  loop(i,0,N+1) dp[i] = INFTY;
  dp[0] = 0;
  for (int i=0; i<N; i++) {
    for (int k=1; k<=K; k++) {
      if (i+k>=N) break;
      chmin(dp[i+k], dp[i] + abs(A[i+k] - A[i]));
    }
  }
  cout << dp[N-1] << endl;
}

int main() {
  // cout.precision(15);
  input();
  solve();
  return 0;
}


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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S, std::string T){
    if(S == T.substr(0, S.size())){
        cout << YES << endl;
    }else{
        cout << NO << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


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

int main(){
  int N, L;
  cin >> N >> L;
  vector<string> s(N);
  for (int i = 0; i < N;i++){
    cin >> s.at(i);
  }
  sort(s.begin(), s.end());
  for (int i = 0;i<N;i++){
    cout << s.at(i);
  }
  cout << endl;
  return 0;
}

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

using namespace std;

#define ll long long

void solve() {
	int a, b;
	cin >> a >> b;
	int n = a*b;
	cout << (n%2 ? "Odd" : "Even") << "\n";
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}



Measured memory_bytes: 3596
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>

typedef int32_t i32;
typedef int64_t i64;

const i32 mod = 1000000007;

i32 mod_pow (i32 r, i32 n) {
  i32 t = 1;
  i32 s = r;
  while (n > 0) {
    if (n & 1) t = (i64) t * s % mod;
    s = (i64) s * s % mod;
    n >>= 1;
  }
  return t;
}

i32 inv (i32 a) {
  return mod_pow (a, mod - 2);
}

#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

#define POS(i, j) (((i) & 1) * (n + 2) + (j))

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  char *s = ALLOC (n + 1, char);
  scanf ("%s", s);
  i32 k = strlen (s);
  free (s);
  i32 *dp = ALLOC (2 * (n + 2), i32);
  dp[POS(0, 0)] = 1;
  for (i32 i = 1; i <= n; ++i) {
    dp[POS(i, 0)] = (dp[POS(i - 1, 0)] + dp[POS(i - 1, 1)]) % mod;
    for (i32 j = 1; j <= i; ++j) {
      dp[POS(i, j)] = ((i64) 2 * dp[POS(i - 1, j - 1)] + dp[POS(i - 1, j + 1)]) % mod;
    }
  }
  i32 ans = (i64) dp[POS(n, k)] * mod_pow (inv (2), k) % mod;
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX_N = 1e5*2+1;
int N, Q;
ll PO[MAX_N];

void solve() {
    cin >> N >> Q;
    vector<vector<int>> g(N);
    for (int i = 0; i < N - 1; ++i) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int i = 0; i < Q; ++i) {
        int p;
        ll x;
        cin >> p >> x;
        p--;
        PO[p] += x;
    }
    queue<int> q;
    q.push(0);
    vector<bool> memo(N, false);
    while(!q.empty()) {
        int par = q.front(); q.pop();
        memo[par] = true;
        int po = PO[par];
        for (int ch: g[par]) {
            if (memo[ch]) continue;
            PO[ch] += po;
            q.push(ch);
        }
    }
    cout << PO[0] << " ";
    for (int i = 1; i < N; ++i) {
        printf("%ld ", PO[i]);
    }
    cout << endl;
}

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


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

using namespace std;

pair<long long, long long> p, q;

pair<long long, long long>t(pair<long long, long long> a, pair<long long, long long>b){
    a.first *= b.second; b.first *= a.second;
    a.second *= b.second;
    a.first += b.first;

    while(a.first%2 == 0 && a.second%2 == 0){a.first/=2; a.second/=2;}
    return a;
}

int main(){
    string s;
    while(cin >> s, s!="#"){
        p.first = 0; p.second = 1;
        string op;
        for(long long i=0; i < s.size(); i++){
            if(s.substr(i, 5) == "north")op+="n";
            else if(s.substr(i, 4) == "west")op+="w";
        }
        if(op == "n"){cout << 0 << endl; continue;}
        else if(op == "w"){cout << 90 << endl; continue;}

        int n = op.size();
        if(op[op.size()-1] == 'w') p.first = 90;
        for(int i = op.size()-2; 0 <= i; i--){
            if(op[i] == 'n'){q.first = -90; q.second = pow(2, n-i-1);}
            else {q.first = 90; q.second = pow(2, n-i-1);}
            p = t(p, q);
        }

        cout << p.first;
        if(p.second != 1) cout << "/" << p.second;
        cout << endl;
    }
}

Measured memory_bytes: 1248
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let s = sc.chars();
    let t = sc.chars();
    let n = s.len();
    let mut cost = 0;
    for i in 0..n {
        if s[i] != t[i] {
            cost += 1;
        }
    }
    println!("{}", cost);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        Self(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 3960
// https://atcoder.jp/contests/dp/tasks/dp_m

#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>

using namespace std;

int main (int argc, char* argv[]) {
	int n, k;
	cin >> n >> k;

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

	// dp[kid index][candies distributed] = number of patterns to distribute candies up to kid index
	vector<vector<long long>> dp(n, vector<long long>(k + 1));
	for (int i = 0; i <= min(k, max_candies[0]); i++) {
		dp[0][i] = 1;
	}
	for (int i = 1; i < n; i++) {
		long long patterns = 0;
		int window_size = min(max_candies[i], k) + 1;
		for (int total_c = 0; total_c <= k; total_c++) {
			if (total_c - window_size >= 0) {
				patterns = (patterns - dp[i - 1][total_c - window_size] + 1000000007) % 1000000007;
			}
			patterns = (patterns + dp[i - 1][total_c]) % 1000000007;
			dp[i][total_c] = patterns;
		}
	}
	cout << dp.back().back() << endl;
}


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

int main(){
  ll N,M,ans=0;
  cin>>N>>M;
  vector<pair<ll,ll>> X(N);
  for(ll i=0;i<N;i++){
    ll a,b;
    cin>>a>>b;
    X.at(i)=make_pair(a,b);
  }
  sort(X.begin(),X.end());
  for(ll i=0;;i++){
    ll a,b;
    tie(a,b)=X.at(i);
    if(M>b){
      ans+=a*b;
      M-=b;
    }else if(M<=b){
      ans+=M*a;
      break;
    }
  }
  cout<<ans<<endl;
  
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmpi = 0;
double tmpd = 0.0;


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

    char s[4];
    char s1, s2='0';
    Int c1=0, c2=0;
    cin >> s;

    s1 = s[0];
    c1++;
    for(Int i=1; i<4; i++){
        if(s[i] == s1){
            c1++;
            continue;
        }
        if(s[i] != s1 && s2 == '0'){
            s2 = s[i];
            c2++;
            continue;
        }
        if(s[i] == s2){
            c2++;
            continue;
        }
        if(s[i] != s1 && s[i] != s2){
            cout << "No" << endl;
            return 0;
        }
    }
    if(c1 == 2 && c2 == 2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>

inline int f(int x) {
    if (x % 2 == 0) {
        return x / 2;
    } else {
        return x * 3 + 1;
    }
}

int solve(int s) {
    std::set<int> x;
    x.insert(s);
    int a = s;

    for (int i = 2; true; i++) {
        a = f(a);
        if (x.count(a) != 0) {
            return i;
        }

        x.insert(a);
    }

    return 0;
}

int main() {
    int s;

    std::cin >> s;

    std::cout << solve(s) << std::endl;

    return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    H = [int(x) for x in input().split()]
    DP = [float("inf")]*N
    DP[0] = 0

    for i in range(1,N):
        if i == 1:
            DP[i] = DP[i-1]+abs(H[i]-H[i-1])
        else:
            DP[i] = min(DP[i-1]+abs(H[i]-H[i-1]),DP[i-2]+abs(H[i]-H[i-2]))
    
    print(DP[-1])

if __name__ == "__main__":
    main()
    pass

Measured memory_bytes: 13976
#include<bits/stdc++.h>//本当は必要なヘッダファイルだけインクルードするべきです
using namespace std;//本当は個別にusingするか変数や関数ごとにstd::をつけるべきです
//本当は関数内に宣言し明示的に初期化するべきです
string s,p,o;
int i,q,a,b,j;
int main(void){
  cin>>s>>q;
  for(i=0;i<q;i++){
    cin>>o;
    if(o=="print"){
      cin>>a>>b;
      cout<<s.substr(a,b-a+1)<<endl;
    }else if(o=="reverse"){
      cin>>a>>b;
      reverse(s.begin()+a,s.begin()+b+1);
    }else if(o=="replace"){
      cin>>a>>b>>p;
      for(j=0;j<=b-a;j++)s[a+j]=p[j];
    }
  }
  return 0;
}



Measured memory_bytes: 3200
import sys
import time

MAX = 999999

def is_prime(n):
  if n == 2:return True
  if n % 2 == 0:return False
  for i in range(3,int(n**0.5)+1,2):
    if n % i == 0:return False
  return True

def prime_list(n):
  return ([2] if n > 1 else []) + [i for i in range(3,n+1,2) if is_prime(i)]

L = prime_list(int(MAX**0.5))

def is_prime_2(n):
  a = int(n ** 0.5)
  for i in L:
    if i > a:return True
    if n % i == 0:return False
  return True

def prime_count(n):
  result = 0
  if n >= 2:result+=1
  for i in range(3,n+1,2):
    if is_prime_2(i):result+=1
  return result

def prime_list2(n):
  return ([2] if n > 1 else []) + [i for i in range(3,n+1,2) if is_prime_2(i)]

L2 = prime_list2(MAX)

def prime_count_2(n):
  for i,v in enumerate(L2):
    if v > n:return i
  return len(L2)

for n in sys.stdin:
  print(prime_count_2(int(n)))

Measured memory_bytes: 11460
(defn input []
  (list
    (->> (clojure.string/split (read-line) #"\s")
      (map #(Integer/parseInt %)))
    (-> (read-line)
      Integer/parseInt)))

(defn MaximumSum [[Ns K]]
    (int
      (#(+
          (* (Math/pow 2 K) (last %))
          (first %)
          (second %))
       (sort Ns))))

(-> (input)
  MaximumSum
  println)

Measured memory_bytes: 65944
#include<stdio.h>
int Liner_Search(int,int,int*);
int main()
{
  int i,count=0;
  int n,s[10001],q,t;

  scanf("%d",&n);
  for(i=0; i<n; i++) scanf("%d",&s[i]);
  scanf("%d",&q);
  for(i=0; i<q; i++) { 
    scanf("%d",&t);
    count += Liner_Search(t,n,s);
  }    
  
  printf("%d\n",count);
  
  return 0;
}

int Liner_Search(int k,int n,int s[])
{
  int i;

  s[n] = k;
  i = 0;
  while(s[i]!=k)
    i++;
  if(i!=n) return 1;
  else return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    vector<int> v(n);
    vector<int> c(n);
    rep(i, n) cin >> v[i];
    rep(i, n) cin >> c[i];
    rep(i, n) {
        if(v[i] - c[i] > 0) ans += v[i] - c[i]; 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
using namespace std;
string s;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(110, vector<ll>(50, 0));
vector<tuple<ll, ll, ll>> vt;
set<ll> st;
map<char, ll> mp;

typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

Weight dist[100005];
typedef pair<Weight, Edge> P;

int main()
{
	ll a, b;
	cin >> a >> b;
	if (a == 1)a += 13;
	if (b == 1) b += 13;
	if (a < b) cout << "Bob" << endl;
	else if (a > b) cout << "Alice" << endl;
	else cout << "Draw" << endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
template<typename T> bool chmax(T &a, T b) {if(a <= b){a = b; return true;}return false;}
template<typename T> bool chmin(T &a, T b) {if(a >= b){a = b; return true;}return false;}


int main(void){
    double a, c, h, m;
    cin >> a >> c >> h >> m;
    double b;
    double jikan = (h / 12 + 1.0 / 12 * m / 60) * 360; 
    double hun = m / 60 * 360;
    double kaku = jikan < hun ? hun - jikan : jikan - hun;
    kaku = kaku / 180 * M_PI;
    b = sqrt(pow(a,2) + pow(c,2) - 2*a*c*cos(kaku));
    cout << fixed << setprecision(10) << b << endl;
}

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

//アナグラム->辞書式ソート

string sort_string(string str){
    vector<char> v;
    rep(i,10){
        v.emplace_back(str[i]);
    }
    sort(v.begin(), v.end());
    string ans = "";
    rep(i,10){
        ans += v[i];
    }
    return ans;
}

void solve(){
    int n;
    cin >> n;
    string v[n+10];
    rep(i,n){
        cin >> v[i];
    }

    //ハッシュ連想配列
    unordered_map<string, long long> mp;
    long long count=0;
    for(int i=0; i<n; i++){
        string str = sort_string(v[i]);
        if(mp.find(str) == mp.end()){
            mp[str] = 1;
        }
        else{
            count += mp[str];
            mp[str]++;
        }
    }
    cout << count << endl;

}


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

Measured memory_bytes: 19236
import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

S = input()
N = len(S)

C = Counter(S)
if max(C['a'], C['b'], C['c']) - min(C['a'], C['b'], C['c']) <= 1:
    YES()
else:
    NO()


Measured memory_bytes: 3552
/*

*/
#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n,hoge=1000;cin>>n;
  while(n>hoge)hoge+=1000;
  cout<<(hoge-n)<<endl;
}

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

int main(){
  int64_t A,B,N;
  cin >> A >> B >> N;
  int64_t ans=0;
  int64_t x=min(B-1,N);
  ans=(A*x)/B-A*(x/B);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

template <typename T>
struct edge
{
    int src, to;
    T cost;

    edge(int to, T cost) : src(-1), to(to), cost(cost) {}

    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

    edge &operator=(const int &x)
    {
        to = x;
        return *this;
    }

    operator int() const { return to; }
};

//Weighted edge set
template <typename T>
using Edges = vector<edge<T>>;

//Weighted graph
template <typename T>
using WeightedGraph = vector<Edges<T>>;

//Unweighted graph (adjacency matrix)
//Initialize : vector<vector<int>>(N, vector<int>(N, 0))
template <typename T>
using UnweightedGraph = vector<vector<T>>;

//distance matrix
template <typename T>
using Matrix = vector<vector<T>>;

int main()
{
    int N, ans = 0;
    cin >> N;
    UnweightedGraph<int> G(N);
    vector<int> c(N), deg(N), d(N);
    for (int i = 0; i + 1 < N; i++)
    {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
        deg[a]++, deg[b]++;
    }
    for (int i = 0; i < N; i++)
    {
        cin >> c[i];
        ans += c[i];
    }
    sort(c.begin(), c.end());
    ans -= c[N - 1];
    for (int i = 0; i < N; i++)
    {
        int min = (1 << 20), v = 0;
        for (int j = 0; j < N; j++)
        {
            if (deg[j] < min && d[j] == 0)
                min = deg[j], v = j;
        }
        d[v] = c[i];
        for (auto &p : G[v])
        {
            deg[p]--;
        }
        }
    cout << ans << endl;
    for (int i = 0; i < N; i++)
    {
        cout << d[i] << (i == N - 1 ? "\n" : " ");
    }
}

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

ans = sum(B)

for i in range(N - 1):
  if A[i] + 1 == A[i + 1]:
    ans += C[A[i] - 1]

print(ans)

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int n;
    cin >> n;
    map<pair<int,int>,int> count;
    rep(i,0,n){
        int a;
        cin >> a;
        --a;
        ++count[make_pair(min(i,a),max(i,a))];
    }
    int ans=0;
    for(auto &p:count) if(p.second==2) ++ans;
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


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


int main() {

    ll x;
    cin >> x;
    int res = x / 100;
    int t = x % 100;
    if (t <= res * 5) {
        cout << '1' << endl;
    } else cout << '0' << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1001001001;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
//printf("%.10f\n", N);
/*
ll memo[100000];
ll fibo(ll n){
    if(memo[n] != 0)return memo[n];
    if(n <= 1)return n;
    else return memo[n] = fibo(n - 1)+ fibo(n - 2);
}*/

int main(){
    ll N;
    cin >> N;
    vector<ld> per(N);
    vector<vector<ld>> memo(N + 1,vector<ld>(N + 1));
    rep(i,N)cin >> per[i];
    memo[0][0] = 1;
    rep(i,N){
        rep(j,N){
            memo[i + 1][j] += memo[i][j] * (1 - per[i]);
            memo[i + 1][j + 1] += memo[i][j] * per[i];
        }
    }
    ld ans = 0;
    for(ll i = N;i>=N / 2 + 1;i--){
        ans += memo[N][i];
    }/*
    rep(i,N + 1){
        rep(j,N+1)cout << memo[i][j] << " ";
        cout<<endl;
    }*/
    cout << fixed << setprecision(15);
    cout << ans << endl;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
// #define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int a, b, c; cin >> a >> b >> c;
    if(b-a == c-b) cout << "YES" << endl;
    else cout << "NO" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7748
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;
const int N = 2020;
ll a[N];
int n;
ll x;
ll ans[N];

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%lld", &n, &x);
	for (int i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	for (int i = 0; i < n; i++)
	{
		ll y = a[i];
		for (int k = 0; k < n; k++)
		{
			ans[k] += y;
			y = min(y, a[(n + i - k - 1) % n]);
		}
	}
	ll res = (ll)1e18;
	for (int k = 0; k < n; k++)
		res = min(res, ans[k] + x * k);
	printf("%lld\n", res);

	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7
def f(l):
    global ans
    half = len(l) // 2
    left = sum(l[:half])
    left %= MOD
    right = sum(l[half:])
    right %= MOD
    ans += left * right
    ans %= MOD
    if len(l) < 2:
        return
    f(l[:half])
    f(l[half:])
ans = 0
f(a)
print(ans)

Measured memory_bytes: 30872
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int m = sc.nextInt();
        int[] al = new int[a];
        int[] bl = new int[b];
        int amin = Integer.MAX_VALUE;
        int bmin = Integer.MAX_VALUE;
        for(int i = 0; i < a; i++){
            al[i] = sc.nextInt();
            amin = Math.min(amin,al[i]);
        }
        for(int i = 0; i < b; i++){
            bl[i] = sc.nextInt();
            bmin = Math.min(bmin,bl[i]);
        }
        int ans = amin + bmin;
        for(int i = 0; i < m; i++){
            int ax = sc.nextInt()-1;
            int bx = sc.nextInt()-1;
            int c = sc.nextInt();
            ans = Math.min(ans,al[ax]+bl[bx]-c);
        }
        System.out.println(ans);
    }
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	vector<int>v(10); for(auto&&i:v)cin>>i;
	sort(v.rbegin(),v.rend());
	for(auto i=v.begin();i!=v.begin()+3;++i)cout<<*i<<"\n"s;
}


Measured memory_bytes: 3236
#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;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 100005
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007
#define mod 1000000007
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

inline int Set(int N, int pos){return N=N | (1<<pos);}
inline int Reset(int N, int pos){return N=N & ~(1<<pos);}
inline bool Check(int N, int pos){return (bool)(N & (1<<pos));}

inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll fast_exp(ll x, ll n, ll m)
{
    ll res = 1;
    while(n>0)
    {
        if(n%2==1)
            res = (res * x) % m;
        x = (x * x) % m;
        n/=2;
    }
    return res%m;
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;
typedef tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet1;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Start();

    int n, k;
    cin>>n>>k;
    ll h[n+5];
    for(int i = 0; i < n; i++)
        cin>>h[i];
    ll sum = 0;
    sort(h, h+n);
    for(int i = 0; i < n-k; i++)
        sum+=h[i];
    cout<<sum<<endl;

    //End();
    return 0;
}


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

int main(){
  int S;
  cin >> S;
  int h, m, s;
  h = S / 3600;
  m = (S - 3600*h) / 60;
  s = (S - 3600*h) % 60;
  cout << h << ":" << m << ":" << s <<endl;
  return 0;
}


Measured memory_bytes: 3112