akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <memory>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include <map>
using namespace std;
#define DEB(variable) cout << #variable << '=' << variable << endl

#define FOR(LoopVariable, numberOFbegin, numberOFend) for(long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable, numberOFbegin, numberOFend) for(long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable, numberOFend) for(long long int LoopVariable = 0; (LoopVariable) < (numberOFend); LoopVariable++)

using llint = long long int;

constexpr long long int linf = numeric_limits<long long int>::max() - 5;
constexpr long long int inf = numeric_limits<int>::max() - 5;
constexpr long long int mod = 1000000007;
llint f(llint a,llint b){
    return max(  1+log10(a) ,1+ log10(b));
}
int main() {
    llint n;
    cin >> n;
    llint result = inf;
    FOR(i,1,sqrt(n)+100){
        if(i>n){
            break;
        }
        if(n%i==0){
            result = min(result, f(i, n / i));
        }
    }
    cout << result << endl;
}


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

int main()
{
    int N;

    cin>>N;
    vector<int> A(N,0);
    for(int i=0;i<N;i++)
    {
        cin>>A[i];
    }
    sort(A.begin(),A.end());

    if(unique(A.begin(),A.end())==A.end())
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    cin>>N;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
数値の区切り位置を誤読しない
木はn-1ノード
関数単位で調べる
cout << fixed;
cout << setprecision(n) << ans;
 */

int main() {
    int a,b;
    cin >> a >> b;
    cout << a*b;


    
}

/*
*/


Measured memory_bytes: 3592
#include <stdio.h>

#define MAX 100000

int partition( int *A, int p, int r );

int main(void)
{
	int Arr[MAX] = {};
	int i = 0;
	int flag = 0;
	int order = 0;
	
	scanf("%d\n", &order);
	
	for ( i = 0; i < order; i++ ) {
		scanf("%d ", &Arr[i]);
	}
	
	flag = partition(Arr, 0, order-1);
	for ( i = 0; i < order - 1 ; i++ ) {
		
		if ( i == flag ) {
			printf("[%d] ", Arr[i]);
		} else {
		    printf("%d ", Arr[i]);
		}
	}
	printf("%d\n", Arr[i]);
	return 0;
}

int partition( int *A, int p, int r ) 
{
	int x = 0;
	int i = 0;
	int j = 0;
	int tmp = 0;
	
	x = A[r];
	i = p - 1;
	for ( j = p; j < r; j++ ) {
		if ( A[j] <= x ) {
			i = i+1;
			tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
		}
	}
	
	tmp = A[r];
	A[r] = A[i+1];
	A[i+1] = tmp;
	return i+1;
}


Measured memory_bytes: 2192
#include<bits/stdc++.h>
using namespace std;
long long dp[100005][2];
int mod = 1e9+7;
int main(){
  string s;
  cin>>s;
  // 0 is less  if less always less
  // 1 is equal if equal try equal
  int n = s.length();
  dp[0][0] = 0;
  dp[0][1] = 1;
  for(int i=1;i<=n;++i){
    if(s[i-1]=='1'){
      dp[i][0] = (3ll * dp[i-1][0] + dp[i-1][1])%mod;
      dp[i][1] = (2ll * dp[i-1][1])%mod;
    } else {
      dp[i][0] = (3ll * dp[i-1][0])%mod;
      dp[i][1] = dp[i-1][1];
    }
  }
  cout<<(dp[n][0]+dp[n][1])%mod<<endl;
  
  return 0;
}

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

int main(){
    ll n, m, ans=0;    cin >> n >> m;
    if(n>2 && m>2){
        ans = (n-2)*(m-2);
    }else if(n==1 && m==1){
        ans = 1;
    }else if(n==1){
        ans = m-2;
    }else if(m==1){
        ans = n-2;
    }
    cout << ans << endl;

}



Measured memory_bytes: 256
/*
List of Top 3 Hills
?±±???????????????????????????????????´??°??§??¨?????? 10 ?????????????????????????????????
?????? 10 ?????????????????????????????????
???????????§????????????????????????????????????????????°?????????????????????????????????
*/

#include <iostream>
#include <array>

using namespace std;

int main()
{
	// ?????°??£?¨?
	array< int, 10 > array1;

	// ??\?????????
	for ( int i = 0; i < 10; i++ ) {
		cin >> array1[ i ];
	}

	// ???????????????
	for ( int i = 1; i < 10; i++ ) {
		for ( int j = 0; j < i; j++ ) {
			if ( array1[ j ] > array1[ i ] ) {
				int tmp = array1[ i ];
				array1[ i ] = array1[ j ];
				array1[ j ] = tmp;
			}
		}
	}

	// ????????????
	cout << array1[ 9 ] << endl << array1[ 8 ] << endl << array1[ 7 ] << endl;

	return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;

int N;
int A[100005];
char op[100005];
int dp[100005][5];
//    [i項目][i項目までに開いているかっこの数]

int solve(){
    for(int i=0;i<100005;++i)for(int j=0;j<5;++j)dp[i][j]=-INF;
    dp[0][0] = A[0];
    for(int i=0;i<N-1;++i){
        for(int j=0;j<=3ll;++j){
            int f;
            if(j%2==0)f=1;
            else f=-1;
            int t1 = f*A[i+1];
            //cout<<t1<<endl;
            //cout<<i<<" "<<j<<endl;
            if(op[i+1]=='+'){
                dp[i+1][j] = max(dp[i][j]+t1,dp[i+1][j]);
                if(j!=0)dp[i+1][j-1] = max(dp[i][j]+t1,dp[i+1][j-1]);
            }
            else {
                //cout<<1/0<<endl;
                dp[i+1][j] = max(dp[i][j]-t1,dp[i+1][j]);
                dp[i+1][j+1] = max(dp[i][j]-t1,dp[i+1][j+1]);
                if(j!=0)dp[i+1][j-1] = max(dp[i][j]-t1,dp[i+1][j-1]);
            }
            //cout<<i<<" "<<j<<endl;
            //cout<<dp[i][j]<<" "<<dp[i+1][j]<<" "<<dp[i+1][j+1]<<endl;
        }
    }
    int ans=-INF;
    for(int i=0;i<=3;++i)ans=max(dp[N-1][i],ans);
    return ans;
}


signed main(){
    cin>>N;
    op[0]='+';
    for(int i=0;i<N;++i){
        cin>>A[i];
        if(i!=N-1)cin>>op[i+1];
    }
    cout<<solve()<<endl;
}


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

int main(void)
{

  string s;
  cin>>s;

  int stellanumber=0;
  if(s[0]=='o')
    stellanumber++;
  if(s[1]=='o')
    stellanumber++;
  if(s[2]=='o')
    stellanumber++;
  cout<<100*stellanumber+700<<endl;
}  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	int N; cin>>N;
	int ans = (N*100+108-1)/108;
	if(ans*108/100==N) ote(ans);
	else puts(":(");
}


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

using namespace std;

const int Q = 1 << 18;
int st[2 * Q];

const int inf = 1e9;

void se(int i, int x) {
	i += Q;
	st[i] = x;
	i >>= 1;
	while (i > 0) {
		st[i] = min(st[2 * i], st[2 * i + 1]);
		i >>= 1;
	}
}

int ge(int r) {
	r += Q;
	int res = inf;
	for (int l = Q; l < r; l >>= 1, r >>= 1) {
		if (l & 1) {
			res = min(res, st[l++]);
		}
		if (r & 1) {
			res = min(res, st[--r]);
		}
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, q;
	cin >> n >> q;
	fill(st, st + 2 * Q, inf);
	vector<int>cols(n, -1);
	set<pair<int, int>> rows;
	for (int i = 0; i < q; i++) {
		int t, x;
		cin >> t >> x;
		if (t == 1) {
			cols[x - 1] = i;
		}
		if (t == 2) {
			rows.emplace(x - 1, i);
			se(i, x - 1);
		}
	}
	long long ans = 0;
	for (int i = 1; i <= n - 2; i++) {
		if (cols[i] == -1) {
			ans += rows.size();
		}
		else {
			int fin = n - 2;
			fin = min(fin, ge(cols[i]) - 1);
			ans += fin;
			vector<pair<int, int>> tt;
			for (auto uu : rows) {
				if (uu.first <= fin) {
					tt.push_back(uu);
					se(uu.second, inf);
				}
				else {
					break;
				}
			}
			for (auto uu : tt) {
				rows.erase(uu);
			}
			ans += rows.size();
		}
	}
	cout << (long long)(n - 2) * (n - 2) - ans;
	return 0;
}

Measured memory_bytes: 12120
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut 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 main() {
    input! {
        n:u64,
        a: u64,
        b: u64,
    }

    let x = n / (a + b) * a;
    let y = std::cmp::min(n % (a + b), a);

    println!("{}", x + y);
}


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

int main(){
	double d;
	while(cin>>d){
		if(d>91.00) cout<<"heavy"<<endl;
		else if(d>81.00) cout<<"light heavy"<<endl;
		else if(d>75.00) cout<<"middle"<<endl;
		else if(d>69.00) cout<<"light middle"<<endl;
		else if(d>64.00) cout<<"welter"<<endl;
		else if(d>60.00) cout<<"light welter"<<endl;
		else if(d>57.00) cout<<"light"<<endl;
		else if(d>54.00) cout<<"feather"<<endl;
		else if(d>51.00) cout<<"bantam"<<endl;
		else if(d>48.00) cout<<"fly"<<endl;
		else cout<<"light fly"<<endl;
	}
	return 0;
}

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

int main(){
    int A, B, C, counter = 0;
    cin >> A >> B >> C;
    while(A%2 == 0 && B%2 == 0 && C%2 == 0){
        int tmpA = A;
        int tmpB = B;
        int tmpC = C;
        A = tmpB/2 + tmpC/2;
        B = tmpA/2 + tmpC/2;
        C = tmpA/2 + tmpB/2;
        counter++;
        if(counter > INF){
            cout << "-1" << endl;
            return 0;
        }
    }
    cout << counter << endl;
    return 0;
}

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

int main() {

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

		if (a + b > c + d) {
			printf("Left\n");
		}
		else if (a + b < c + d) {
			printf("Right\n");
		}
		else {
			printf("Balanced\n");
		}

		return 0;
	
}

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

const int N = 5e3 + 11;
int a[N];

int main() {
	ios :: sync_with_stdio(false);
	int n;
	while(cin >> n) {
		if(n == 0) break;
		for(int i = 0; i < n; i ++)
			cin >> a[i];
		int ans = a[0], pre = min(a[0], 0);
		for(int i = 1; i < n; i ++) {
			a[i] += a[i - 1];
			ans = max(ans, a[i] - pre);
			pre = min(pre, a[i]);
		}
		cout << ans << '\n';
	}
	return 0;
}

Measured memory_bytes: 3048
#include <stdio.h>

int main(void)
{
	int a, b, c; 
	
	scanf("%d",&a);	scanf("%d",&b); scanf("%d",&c);
	
	if(a< b && a< c && b< c)
		puts("Yes");
	else
		puts("No");
	
	return 0;
}

Measured memory_bytes: 2684
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
typedef pair<int,int> pii;
const int mod = (int) 1000000007;
const int inf = (int) 2e18;

void paintRed(vector<int>& r, vector<int>& c, vector<vector<char>>& tgrid){
    for(int i=0; i<r.size(); i++)
        for(int j=0; j<tgrid[0].size(); j++)
            tgrid[r[i]][j] = 'R';
    for(int i=0; i<c.size(); i++)
        for(int j=0; j<tgrid.size(); j++)
            tgrid[j][c[i]] = 'R';
}

int countBlacks(vector<vector<char>>& tgrid){
    int ans = 0;
    for(int i=0; i<tgrid.size(); i++)
        for(int j=0; j<tgrid[0].size(); j++)
            if(tgrid[i][j] == '#')
                ans++;
    return ans;
}
 
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<char>> grid(h, vector<char>(w));
    for(int i=0; i<h; i++)
        for(int j=0; j<w; j++)
            cin >> grid[i][j];
    int res = 0;
    for(int i=0; i<(1<<(h+w)); i++){
        vector<int> trows;
        vector<int> tcols;
        for(int j=0; j<h+w; j++){
            if((i>>j) & 1){
                if(j > h-1)
                    tcols.push_back(j-h); 
                else
                    trows.push_back(j);
            }
        }
        vector<vector<char>> tgrid = grid;
        paintRed(trows, tcols, tgrid);
        if(countBlacks(tgrid) == k) res++;
    }
    cout << res << "\n";
}

Measured memory_bytes: 3652
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    boolean flg=true;
    if(n%2!=0){
      flg=false;
    }else{
      char[] c=sc.next().toCharArray();
      char[] a=new char[n/2];
      char[] b=new char[n/2];
      for(int i=0;i<n/2;i++){
        a[i]=c[i];
        b[i]=c[i+n/2];
      }
      for(int i=0;i<n/2;i++){
        if(a[i]!=b[i]){
          flg=false;
          break;
        }
      }
    }
    if(flg){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 22740
/*
Author : Xinyuan
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int  ll;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int nxt() {int x;scanf("%d", &x);return x;}


int main(){
    int k = nxt();
    ll ans = 0;
    for(int i = 1; i <= k; i++) for(int j = 1; j <= k; j++) for(int l = 1; l <= k; l++){
        ans += __gcd(i, __gcd(j, l));
    }
    printf("%d\n", ans);
    return 0;
}



Measured memory_bytes: 3744
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){
    int n;
    cin >> n;
    string s,t,ans;
    cin >> s >> t;
    
    rep(i,n){
        ans.push_back(s[i]);
        ans.push_back(t[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 2000000010;
constexpr ll INF= 2000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

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

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

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

// N^P mod M（ただしM == -1の時はmodを取らない）
template<typename T>
T RS(T N, T P, T M){
    if(P == 0) {
        return 1;
    }
    if(P < 0) {
        return 0;
    }
    if(P % 2 == 0){
        ll t = RS(N, P/2, M);
        if(M == -1) return t * t;
        return t * t % M;
    }
    if(M == -1) {
        return N * RS(N,P - 1,M);
    }
    return N * RS(N, P-1, M) % M;
}

int dp[100010]; //dp[i] = 石がi個の場合のgrundy数

int main() {
    int N,K;
    cin >> N >> K;
    vector<int> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    for(int i = 0;i <= K;i++) {
        set<int> st;
        for(int j = 0;j < N;j++) {
            if(i >= vec.at(j)) {
                st.insert(dp[i - vec.at(j)]);
            }
        }
        int itr = -1;
        bool cnt = false;
        for(auto x:st) {
            if(x - itr != 1) {
                dp[i] = itr + 1;
                cnt = true;
                break;
            }
            itr = x;
        }
        if(cnt == false) {
            dp[i] = itr + 1;
        }
    }
    if(dp[K] == 0) {  
        cout << "Second" << endl;
    }
    else {
        cout << "First" << endl;
    }
}  

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int d;
  	cin >> d;
  	if (d == 25) {
    	cout << "Christmas" << '\n';
    } else if (d == 24) {
    	cout << "Christmas Eve" << '\n';
    } else if (d == 23) {
    	cout << "Christmas Eve Eve" << '\n';
    } else if (d == 22) {
    	cout << "Christmas Eve Eve Eve" << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
N, P = map(int, input().split())
S = list(input())
S = [int(i) for i in S]
count = 0

if P == 2 or P == 5:
    for i in range(N):
        if S[i] % P == 0:
            count += i + 1
else:
    mod_count = [0] * P
    mod_count[0] = 1
    revS = S[::-1]

    modp = 0
    mod10 = 1

    for i in range(N):
        mod10 = (mod10 * 10) % P
        modp = (modp + mod10 * revS[i]) % P

        mod_count[modp] += 1

    for i in range(P):
        count += mod_count[i] * (mod_count[i] - 1) // 2
print(count)

Measured memory_bytes: 8200
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	a, b, x := r.nextInt(), r.nextInt(), r.nextInt()

	aa := a * a
	c := float64(b) - float64(x)/float64(aa)

	var ans float64
	if c <= float64(b)-c {
		ans = c / (float64(a) / 2)
	} else {

		ab := a * b
		h := float64(x) / float64(ab) * 2
		ans = float64(b) / h
	}

	fmt.Fprintf(stdout, "%.10f\n", math.Atan(ans)/math.Pi*180)
}


Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <cctype>
#include <cmath>
#include <vector>
#include <sstream>
#include <bitset>
#include <deque>
#include <iomanip>
using namespace std;
#define pr(x) cout << #x << " = " << x << endl;
#define bug cout << "bugbug" << endl;
#define ppr(x, y) printf("(%d, %d)\n", x, y);
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define SQR(a) ((a)*(a))
#define PCUT puts("\n---------------")

typedef long long ll;
typedef double DBL;
typedef pair<int, int> P;
typedef unsigned int uint;
const int MOD = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 4e3 + 4;
const int maxm = 1e4 + 4;
const double pi = acos(-1.0);
int A, B, n;
int kind[maxn], result[maxn], cnt[2];
char str[maxn];
int main(){
//必须编译过才能交
	int ik, i, j, k, kase;
	scanf("%d%d", &A, &B);
	if (A <= B){
		printf("Impossible");
		fflush(stdout);
		return 0;
	} 
	n = A + B;
	memset(kind, -1, sizeof kind);
	stack<int> s;
	int cur = 0;
	while(cur < n){
		if (s.size() == 0){
			s.push(cur++);
			continue;
		}
		int top = s.top(); 
		printf("? %d %d\n", top, cur);
		fflush(stdout);
		scanf("%s", str);
		if (str[0] == 'Y') s.push(cur);
		else s.pop();
		cur++;
	} 
	kind[s.top()] = 1;
	for (i = 0; i < n; ++i){
		if (i == s.top()) continue;
		printf("? %d %d\n", s.top(), i);
		fflush(stdout);
		scanf("%s", str);
		if (str[0] == 'Y') kind[i] = 1;
		else kind[i] = 0;
	}
	printf("! ");
	for (i = 0; i < n; ++i) printf("%d", kind[i]);
	printf("\n");
	fflush(stdout);
	return 0;
}


Measured memory_bytes: 724
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int Q = sc.nextInt();
    int H = Math.min(sc.nextInt(), Q*2);
    int S = Math.min(sc.nextInt(), H*2);
    int D = Math.min(sc.nextInt(), S*2);
    long N = sc.nextLong();
    
    if (S * 2 <= D) {
      System.out.println(S * N);
    } else if (N % 2 == 0) {	
      System.out.println(D * N / 2);
    } else {
      System.out.println(D * (N / 2) + S);
    }
  }
}

Measured memory_bytes: 35808
using System;
using System.Collections.Generic;
using System.Text;
namespace ReverseSequence
{
    class Program
    {
        static void Main(string[] args)
        {
            var sb = new StringBuilder();
            var stk = new Stack<char>();
            string str = Console.ReadLine();
            for (int i = 0; i < str.Length; i++)
            {
                stk.Push(str[i]);
            }
            for (int i = 0; i < str.Length; i++)
            {
                sb.Append(stk.Pop());
            }
            
            Console.WriteLine(sb);
        }
    }
}



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

typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
const double pi = 3.141592653589793238;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

void printV(vector<int> &v);
void printVV(vector<vector<int>> &vv);


int main() {
  int A, B, C;
  cin >> A >> B >> C;

  cout << " " << C << " " << A << " " << B << endl;

}


// ベクターの中身を全部出力
void printV(vector<int> &v) {
  cout << "  [ ";
  for(int i = 0; i < (int)v.size(); i++) {
    cout << v.at(i) << " ";
  }
  cout << "]" << endl;
}

void printVV(vector<vector<int>> &vv) {
  cout << "{" << endl;
  for(int i = 0; i < (int)vv.size(); i++) {
    cout << "  [ ";
    for(int j = 0; j < (int)vv.at(i).size(); j++) {
      cout << vv.at(i).at(j) << " ";
    }
    cout << "]," << endl;
  }
  cout << "}" << endl;
}


Measured memory_bytes: 256
s = list( input() )
n = len(s)

ans1 = 0
for i in range(n):
    if i % 2 != int(s[i]):
        ans1 += 1

ans2 = 0
for i in range(n):
    if (i+1) % 2 != int(s[i]):
        ans2 += 1

print(min(ans1,ans2))

Measured memory_bytes: 49392
import java.util.*;

import javax.xml.crypto.Data;

import java.math.*;

public class Main {
	
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			if(n == 0) break;
			HashMap<String,Boolean> map = new HashMap<String,Boolean>();
			ArrayList<Data> pq = new ArrayList<Data>();
			ArrayDeque<Data> queue = new ArrayDeque<Data>();
			int[] tmpar = new int[n];
			tmpar[0] = n;
			queue.add(new Data(tmpar));
			while(!queue.isEmpty()) {
				Data tmp = queue.poll();
				StringBuilder sb = new StringBuilder();
				for(int i = 0; i < tmp.list.length; i++) {
					sb.append(" " + tmp.list[i]);
				}
				
				if(map.containsKey(sb.toString())) continue;
				map.put(sb.toString(), true);
				pq.add(tmp);
				
				for(int i = 0; i < tmp.list.length-1; i++) {
					IN:for(int j = i+1; j < tmp.list.length; j++) {
						int[] cp = Arrays.copyOf(tmp.list, tmp.list.length);
						cp[i]--;
						cp[j]++;
						if(cp[i] == 0) break;
						for(int k = 0; k < cp.length-1; k++) {
							if(cp[k] < cp[k+1]) continue IN;
						}
						queue.add(new Data(cp));
					}
				}
			}
			Collections.sort(pq);
			for(int k = 0; k < pq.size(); k++) {
				int[] xx = pq.get(k).list;
				System.out.print(xx[0]);
				for(int i = 1; i < xx.length; i++) {
					if(xx[i] == 0) break;
					System.out.print(" " + xx[i]);
				}
				System.out.println();
			}
		}
	}
		
	static class Data implements Comparable<Data>{
		int[] list;
		Data(int[] a) {
			list = a;
		}
		@Override
		public int compareTo(Data o) {

			for(int i = 0; i < o.list.length; i++) {
				if(this.list[i] - o.list[i] != 0) return  o.list[i]- this.list[i];
			}
			return 0;
			
			
			
		}
	}
	
}

Measured memory_bytes: 240548
#include<stdio.h>

int main(void){
    
    int n,a,c;
    int f[100],Garden[100];
    int i,bflag,Count,cflag;
    bflag = 1;
    Count = 0;
    cflag = 0;
    scanf("%d",&n);
    
    
    for(i=0;i<n;i++){
        scanf("%d",&f[i]);
        //printf("%d",f[i]);
        Garden[i] = 0;
    }
    
    while(1){
        
        for(i=0;i<n;i++){
            if(f[i] != Garden[i]){
                Garden[i] += 1;
                bflag = 0;
                cflag = 1;
            }
            else if(cflag == 1){
                cflag = 0;
                Count += 1;
            }
        }
        
        if(cflag == 1){
            Count += 1;
            cflag = 0;
        }
        if(bflag == 1){
            break;
        }
        bflag = 1;
    }
    /**
    for(i=0;i<n;i++){
        printf("%d",Garden[i]);
    }
    **/
    printf("%d",Count);
    return 0;
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  ll n, m, c;
  cin >> n >> m >> c;

  vector<ll> b(m);
  for (ll i = 0; i < m; ++i) {
    cin >> b[i];
  }

  vector<vector<ll>> a(n, vector<ll>(m));
  for (ll i = 0; i < n; ++i) {
    for (ll j = 0; j < m; ++j) {
      cin >> a[i][j];
    }
  }

  ll ans = 0;
  for (ll i = 0; i < n; ++i) {
    ll sum = 0;
    for (ll j = 0; j < m; ++j) {
      sum += a[i][j]*b[j];
    }
    sum += c;

    if (sum > 0) ++ans;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 764
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**6)

def dfs(x, y, symbol,land):
    if land[y][x] != '.':
        return ([land[y][x]] if not str(land[y][x]).isnumeric() else False), 0
    land[y][x] = symbol
    count = 1
    dxdy = [(1,0),(-1,0),(0,1),(0,-1)]

    owner_list = []
    for dx,dy in dxdy:
        if 0 <= x + dx < len(land[0]) and 0 <= y + dy < len(land):
            ret,c = dfs(x + dx, y + dy, symbol,land)
            count += c

            if ret is not False:
                owner_list += ret
    return (list(set(owner_list)), count)

while True:
    w,h = map(int,input().split())
    if w == 0 and h == 0:
        break
    land = [list(input()) for i in range(0,h)]

    symbol = 0
    count_dict = {'W' :0, 'B' :0}

    for y in range(h):
        for x in range(w):
            if land[y][x] == '.':
                ret, count = dfs(x,y,symbol,land)
                if len(ret) == 1:
                    count_dict[ret[0]] += count
                symbol += 1
    print(count_dict['B'],count_dict['W'])

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

int main(){
  int i, n, atta = 0;
  cin >> n;
  int a[n];
  for( i = 0; i < n; i++ ){
    cin >> a[i];
    if( a[i]%2==1 ){
      atta++;
    }
  }
  if( atta%2==1 ){
    cout << "NO" << endl;
  }else{
    cout << "YES" << endl;
  }
  return 0;
}
  

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
    li x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){ return (int)s.size(); }

int main(){
    cout << setprecision(20);
    string s;cin>>s;
    int n=SIZE(s)+1;
    vi a(n);
    rep(i,n-1) if(s[i]=='<') chmax(a[i+1],a[i]+1);
    per(i,n-1) if(s[i]=='>') chmax(a[i],a[i+1]+1);
    cout << accumulate(all(a),0LL) << endl;
    return 0;
}

Measured memory_bytes: 2820
#include <unistd.h>

int main(int argc,char **argv){
	char s[4];
	read(0,s,3U);
	if(s[0]=='7'||s[1]=='7'||s[2]=='7') write(1,"Yes\n",4U);
	else write(1,"No\n",3U);
	return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char c;bool a1=0,a2=0;
    while (isalpha(c=getchar()))
    if (c=='C'||a1) {
        a1=1;
        if (c=='F') a2=1;
    }
    (a1==1&&a2==1)?puts("Yes"):puts("No");
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(s...)  fprintf(stderr, s)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }

// L[i] := argmax_j j <= i and H[j-1] < H[i]
// R[i] := argmin_j j > i and H[j] < H[i]
template<class T>
struct StockSpan {
    vector<T> H, L, R;
    StockSpan(const vector<T> &_H): H(_H) {
	buildLE();
	//build(greater<T>());
    }
    int range(int i) { return R[i] - L[i]; }
    void buildLE() { // range (H[i] <=)
	const int N = H.size();
	L.resize(N);
	vector<int> S;
	for (int i=0; i<N; i++) {
	    while (!S.empty() && H[i] <= H[S.back()]) S.pop_back();
	    L[i] = S.empty() ? 0 : S.back() + 1;
	    S.push_back(i);
	}
	R.resize(N);
	S.clear();
	for (int i=N; i--; ) {
	    while (!S.empty() && H[i] <= H[S.back()]) S.pop_back();
	    R[i] = S.empty() ? N : S.back();
	    S.push_back(i);
	}
    }

    template<class C>
    void build(C cmp) {
	const int N = H.size();
	L.resize(N);
	vector<int> S;
	for (int i=0; i<N; i++) {
	    while (!S.empty() && cmp(H[i], H[S.back()])) S.pop_back();
	    L[i] = S.empty() ? 0 : S.back() + 1;
	    S.push_back(i);
	}
	R.resize(N);
	S.clear();
	for (int i=N; i--; ) {
	    while (!S.empty() && cmp(H[i], H[S.back()])) S.pop_back();
	    R[i] = S.empty() ? N : S.back();
	    S.push_back(i);
	}
    }
};
int N, A[200111];

int main() {
    scanf("%d", &N);
    REP (i, N) scanf("%d", A+i);

    StockSpan<int>S(VI(A, A+N));
    LL ans = 0;
    REP (i, N) {
	LL a = i - S.L[i] + 1;
	LL b = S.R[i] - i;
	ans +=  a * b * A[i];
    }

    printf("%lld\n", ans);




    return 0;
}



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

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

    vector<int> vec = {};
    for (int i = 0; i < a; ++i){
        int tmp=0;
        cin >> tmp;
        vec.push_back(tmp);
    }
    stable_sort(vec.begin(),vec.end(),greater<int>());
    int alice=0,bob=0;
    for (int i = 0; i < a ;i++){

        if(i%2==0){
            alice+=vec.at(i);
        }
        else bob += vec.at(i);
    }
    cout << alice - bob <<endl;
}





Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int n,a[maxn],b;
int l,r;
ll sum(ll mid)
{
	ll res=0;
	for(int i=1;i<=n;++i)
	res+=abs(a[i]-mid);
	return res;
}
ll ans;
int main()
{
	l=1e9;r=-1e9;
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&a[i]);
		a[i]-=i;
		l=min(l,a[i]);
		r=max(r,a[i]);
	}
	sort(a+1,a+n+1);
	while(r-l>1)
	{
		ll m=(l+r)>>1,mm=(m+r)>>1;
		if(sum(m)>sum(mm))l=m;
		else r=mm;
		//等于的话说明[m,mm]内答案均可
		//但此时为了三分方便,还是把区间缩到一 
	}
	ans=min(sum(l),sum(r));
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
   int N,M;
   cin >> N >> M;
   int a[100001] = {};
   for(int i=0;i<M;i++){
       cin >> a[i];
   }
   int dp[100001] = {1};
   
   bool broken[100001];
   for(int i=0;i<M;i++){
       broken[a[i]] = true;
   }
   
   for(int i=0;i<N;i++){
       if(!broken[i+1]){
           dp[i+1] += dp[i];
           dp[i+1] %= 1000000007;
       }
       if(!broken[i+2]){
           dp[i+2] += dp[i]; 
           dp[i+2] %= 1000000007;
       }
       
   }
   
   cout << dp[N] << endl;
   return 0;
   
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    str s;cin>>s;

    bool flag=true;
    for(int i=0; i<s.size();i++){
      for(int j=0; j<s.size();j++){
        if(i!=j && s[i]==s[j]) flag=false;
      }
    }

    if(flag){
      cout<<"yes"<<endl;
    }else{
      cout<<"no"<<endl;
    }


    return 0;
}


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

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char SMAX(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char SMIN(A &a, const B &b) {return b < a ? a = b , 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I>
inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

const int N = 100 + 7;

int n, ans;
char a[N], b[N], c[N];

int main() {
	scanf("%d%s%s%s", &n, a + 1, b + 1, c + 1);
	for (int i = 1; i <= n; ++i) {
		if(a[i] == b[i] && b[i] == c[i]) ;
		else if(a[i] != b[i] && a[i] != c[i] && b[i] != c[i]) ans += 2;
		else ++ans;
	}
	printf("%d\n", ans);
}

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

using namespace std;
#define ll long long
const int N=2e5+5;
int a[N];
vector<int> adj[N];
bool vis[N][5];
int bfs(int S,int T)
{
    queue< pair < pair<int,int> , int > >Q;
    Q.push({{S,0},0});
    while(!Q.empty())
    {
        int u=Q.front().first.first;
        int rem=Q.front().first.second;
        int d=Q.front().second;
        if(u==T&&rem==0) return d;
        Q.pop();
        if(vis[u][rem]) continue;
        vis[u][rem]=1;
        int nxt=rem-1;
        if(nxt<0)nxt+=3;
        for(auto v:adj[u])
        {
            if(nxt==2)
                Q.push({{v,nxt},d+1});
            else Q.push({{v,nxt},d});
        }
    }
    return -1;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[u].push_back(v);
    }
    int S,T;
    cin>>S>>T;
    cout<<bfs(S,T)<<endl;
    return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
int f[110][100010],n,k,a[110],sum[110],mode=1000000007,sum1[100010];
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum[i]=sum[i-1]+a[i];
	}
	for(int i=0;i<=a[1];i++)
		f[1][i]=1;
	for(int i=2;i<=n;i++)
	{
		for(int j=0;j<=k;j++)
			sum1[j]=(sum1[j-1]+f[i-1][j])%mode;
		for(int j=0;j<=min(sum[i],k);j++)
		{
			f[i][j]=((sum1[min(j,sum[i-1])]-sum1[max(0,j-a[i])-1]))%mode;
			if(f[i][j]<0)
				f[i][j]+=mode;
		}
	}
	cout<<f[n][k]%mode<<endl;
	return 0;
}


Measured memory_bytes: 40832
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [x, a, b] = input[0].map(Number);

  return Math.abs(x - a) < Math.abs(x - b) ? "A" : "B";
};

console.log(main(read()));


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var An = Console.ReadLine().Split(' ').Select(s => int.Parse(s)-1).ToArray();
            long tot = 0;
            var cnt = new int[N];
            for (var i = 0; i < N; i++) cnt[An[i]]++;
            Func<long, long> choose2 = (n) => n * (n - 1) / 2;
            for (var i = 0; i < N; i++) tot += choose2(cnt[i]);
            for (var i = 0; i < N; i++)
            {
                long ans = tot;
                ans -= choose2(cnt[An[i]]);
                ans += choose2(cnt[An[i]]-1);
                Console.WriteLine(ans);
            }
        }
    }
}


Measured memory_bytes: 35392
#include <iostream>

using namespace std;

int main(){
int a,b;scanf("%d%d",&a,&b);
double ret=0;
for(int i=1;i<=a;i++){
double tmp=1.0/a;
int now=i;
while(now<b){
now*=2;
tmp/=2;
}
ret+=tmp;
}
printf("%.12f\n",ret);
}

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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    scanInt(K);
    string S;
    cin >> S;
    vector<int> V;
    {
        int count = -1;
        char before = '1';
        for (auto& c : S){
            count++;
            if (c != before){
                V.emplace_back(count);
                count = 0;
            }
            before = c;
        }
        V.emplace_back(count + 1);
        if (S.back() == '0'){
            V.emplace_back(0);
        }
    }
    // for (auto& e : V){cout << e << " ";}; cout << endl;
    const int K2 = K * 2;
    int maxsum = 0;
    int sum = 0;
    if (K2 < V.size()){
        REP(j, K2 + 1) sum += V.at(j);
    }else{
        for (auto& e : V) sum += e;
    }
    maxsum = max(maxsum, sum);
    // cout << sum << " " << maxsum << endl;
    for (int j = 2; j + K2 < V.size(); j += 2){
        sum -= V.at(j - 2);
        sum -= V.at(j - 1);
        sum += V.at(j + K2 - 1);
        sum += V.at(j + K2);
        maxsum = max(maxsum, sum);
        // cout << sum << " " << maxsum << endl;
    }
    cout << maxsum << endl;
}


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

int main(){
  string S;
  cin>>S;
  int w;
  cin>>w;
  for(int i=0;i<S.length();i++){
    if((i)%w==0){
      cout<<S.at(i);
    }
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>
#include <string.h>
#include <bits/stdc++.h>

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define pi pair<int,int>
#define fi first
#define se second

#define FOR(var, to)          for (register s64 var = 0; var < (s64)to; var++)
#define FROMTO(var, from, to) for (register s64 var = from; var <= (s64)to; var++)

#define INIT(var) FOR(i,countof(var)) var[i] = 0
#define INPUT(var) FOR(i,countof(var)) var[i] = ri()

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)

#define MOD 1000000007
#define INF (1 << 30)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

using namespace std;

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

static inline s64 rs64() {
  s64 a;
  scanf("%" SCNd64, &a);
  return a;
}

static inline void wi(int a) {
  printf("%d", a);
}

static inline void wu64(u64 a) {
  printf("%" PRIu64, a);
}

static inline void ws64(s64 a) {
  printf("%" PRId64, a);
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

typedef struct {
    int index;
    int num;
} Num;

int my(const void *a, const void *b) {
  return (((const Num*)a)->num - ((const Num*)b)->num);
}

int main() {
    int a = ri();
    int b = ri();
    int c = ri();
    if (a>b) swap(a,b);
    if (b>c) swap(b,c);
    if (a>b) swap(a,b);
    
    int r1 = c*2-b-a;
    cout << ((r1%2)?r1/2+2:r1/2) << endl;
 return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
using namespace std;

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

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

  int s = *min_element(vec.begin(), vec.end());
  int e = *max_element(vec.begin(), vec.end());

  int vmin = INT_MAX;
  for (int i = s; i <= e; ++i) {
    int tmp = 0;
    for (int j = 0; j < n; ++j)
      tmp += (vec[j] - i) * (vec[j] - i);
    if (tmp < vmin)
      vmin = tmp;
  }

  cout << vmin << endl;

}

Measured memory_bytes: 256
// Author : Mohamed Sameh
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
typedef long long ll ;
using namespace std ;
int n;
int main()
{
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)cin >> a[i];
  sort(all(a));
  int ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = i+1; j < n; j++)
      for (int k = j+1; k < n; k++)
      {
        if (a[i] == a[j])continue;
        if (a[i] == a[k])continue;
        if (a[j] == a[k])continue;
        if (a[i] + a[j] > a[k])ans++;
      }
  cout << ans << '\n';
}


Measured memory_bytes: 3628