akhauriyash/Code-Regression huggingface dataset:
#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 1000000007ll
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 n, k;
    cin >> n;
    cin >> k;
    li res = 0;
    rin{
        li x;
        cin >> x;
        if (x >= k)++res;
    }
    cout << res << endl;

    return 0;
}


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

using namespace std;
using ll = long long;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<int> A(N), B(N, 0);
    for (int i = 0; i < N; i++)
        cin >> A[i];
    for (int i = 0; i < N; i++){
        if (i - A[i] >= 0)
            B[i - A[i]]++;
    }
    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (i + A[i] < N)
            ans += B[i + A[i]];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4784
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <cmath>

#define rep(i,n) for(int i = 0; i < n; i++)

using namespace std;
typedef long long ll;

const int MAX = 1e+6 + 10;
const int MOD = 1e+9 + 7;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  pair<int,int> pi;
  cin >> pi.first >> pi.second;

  int n,m;
  if((2 * pi.second - pi.first) % 3 == 0){
    n = (2 * pi.second - pi.first) / 3;
  }
  else{
    cout << 0 << endl;
    return 0;
  }
  if((2 * pi.first - pi.second) % 3 == 0){
    m = (2 * pi.first - pi.second) / 3;
  }
  else{
    cout << 0 << endl;
    return 0;
  }
  COMinit();
  cout << COM(n+m,n) << endl;  
}


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

#define fs first
#define se second
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define pb emplace_back

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ") 
{ rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

int main() {
	int a = in(), b = in();

	if (a + b >= 10) {
		cout << "error" << endl;
	} else {
		cout << a + b << endl;
	}
}


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

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  if (a >= k) {
    cout << a - k << " " << b << endl;
    return 0;
  } else {
    k -= a;
    if (b - k > 0) {
      cout << 0 << " " << b - k << endl;
      return 0;
    }
  }
  cout << 0 << " " << 0 << endl;
}

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

int main() {
  int a,b,k,s,l,n,m;
 n=0;
  int p[100],q[100];
  cin>>a>>b>>k;
  if (b>=a) {s=a; l=b;}
else {s=b; l=a;}
for(int i=1;i<=s;i++){
  if ((s%i)==0){ p[n]=i ;
n++;}
}
m=0;
for(int j=0;j<n;j++){
  if( (l%p[j])==0){
 q[m]=p[j];
m++;
}
}
	cout <<q[m-k];
	return 0;
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N / 100 == N % 10) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23120
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        n: usize,
        aa: [usize; n]
    };
    if n == 1 {
        println!("1");
        return;
    }
    let mut arr = [0isize; 100_002];
    for a in aa {
        arr[a] += 1;
        arr[a + 1] += 1;
        arr[a + 2] += 1;
    }
    println!("{}", arr.iter().max().unwrap());
}


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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

// どういうDPか
// dp[i][j] := i枚目のコインを投げたとき，表がj枚である確率

// 計算方法
// 1-index
// dp[0][0] = 1.0
// dp[i][j] = (dp[i-1][j-1] * p[i] + dp[i-1][j] * (1-p[i]))
// 表が出ることと，出なかったことで場合分け

// どういう順番
// 小さい順から
// j > N-j のときの総和

double dp[3030][3030];

int main() {
    int N;
    cin >> N;
    vector<double> p(N+1);
    rep(i, N) cin >> p[i+1];

    dp[0][0] = 1.0;
    for (int i=1; i<=N; ++i) {
        for (int j=0; j<=N; ++j) {
            if (j > 0) {
                dp[i][j] += dp[i-1][j-1] * p[i];
            }
            dp[i][j] += dp[i-1][j] * (1 - p[i]);
            //dp[i][j] = dp[i-1][j-1] * p[i] + dp[i-1][j] * (1 - p[i]);
        }
    }

    double ans = 0;
    for (int i=0; i<=N; ++i) {
        if (i > N-i) ans += dp[N][i];
    }
    printf("%.10f\n", ans);
}


Measured memory_bytes: 71936
n,m = map(int,input().split())
a1 = set()
an = set()
for i in range(m):
  now = list(map(int,input().split()))
  if now[0] == 1:
    a1.add(now[1])
  elif now[0] == n:
    an.add(now[1])
  elif now[1] == 1:
    a1.add(now[0])
  elif now[1] == n:
    an.add(now[0])
a = a1 & an
if len(a) > 0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Measured memory_bytes: 19016
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

//Roling Hash
//RollingHash RH(s,base) base:[2,MOD)?????±??°
//RH.set(s,base): vector???????§???????????????????????????§????????????????????????????????????
//RH.get(l,r): [l,r)??????????????\ O(1)
//1000000007, 1000000009, 1000000021
template<long long MOD>
class RollingHash {
public:
	int n;
	long long base;
	vector<long long> pow, hash;
	RollingHash() {}
	RollingHash(const string &s, long long base_ = 10007) { init(s, base_); }
	void init(const string &s, long long base_ = 10007) {
		n = s.size();
		base = base_;
		calc(s.c_str());
	}
	long long get(int x)const { return hash[x]; }
	long long get(int l, int r)const { return (get(r) - get(l)*pow[r - l] % MOD + MOD) % MOD; }
	void calc(const char *s) {
		pow.resize(n + 1);
		pow[0] = 1;
		hash.resize(n + 1);
		hash[0] = 0;
		for (int i = 0; i < n; i++) {
			pow[i + 1] = pow[i] * base % MOD;
			hash[i + 1] = (s[i] + hash[i] * base) % MOD;
		}
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	RollingHash<1000000007> RH(s);
	int ans = s.size();
	int n = s.size();
	for (int a = (n - 2) / 3, b; a >= 1; a--) {
		b = (n - a * 3) / 2;
		if (3 * a + 2 * b != n)continue;
		auto A1 = RH.get(0, a);
		auto B1 = RH.get(a, a + b);
		auto A2 = RH.get(a + b, a + b + a);
		auto B2 = RH.get(a + b + a, a + b + a + b);
		auto A3 = RH.get(a + b + a + b, a + b + a + b + a);
		if (A1 == A2&&A2 == A3&&B1 == B2) {
			chmin(ans, a + b);
		}
	}
	if (ans != n)cout << "Love " << s.substr(0, ans) << '!';
	else cout << "mitomerarenaiWA";
	cout << '\n';
	return 0;
}

Measured memory_bytes: 19948
#include <stdio.h>

int main(void){
  char a = '#';
  int h, w, i, ii, b;
  scanf("%d %d", &h, &w);
  for(b = 0; b < 1; b--)
    {
     if((h != 0)&&(w != 0))
       {
        for(i = 0; i < h; i++)
          {
            for(ii = 0; ii < w; ii++)
             {
	      printf("%c", a);
             }
	    printf("\n");
            }
        printf("\n");
	scanf("%d %d", &h, &w);
       }
       else
       {
	 break;
       }
    } 
  return 0;
}

Measured memory_bytes: 572
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
ans=0

x=[0]*61

for i in range(61):
  for j in a:
    if (j>>i)%2==1:
      x[i]+=1


for i in a:
  for j in range(61):
    if (i>>j)%2==1:
      ans+=(n-x[j])*(2**j)


print(ans%mod)


Measured memory_bytes: 124596
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int H,N;
	cin >> N >> H;
	vector<int> A(N), B(N);
	for(int i=0;i<N;i++){
		cin >> A[i] >> B[i];
	}

	sort(A.begin(),A.end(),greater<int>());
	sort(B.begin(),B.end(),greater<int>());

	const int A_max = *max_element(A.begin(),A.end());

	int num = 0;
	int ib = 0;
	while(H > 0){
		if(B[ib] >= A_max){
			H -= B[ib];
			ib++;
			num++;
		}else{
			num += H/A_max;
			if(H%A_max) num++;
			break;
		}
	}
	cout << num << endl;
	return 0;
}


Measured memory_bytes: 1024
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, h, m float64
	fmt.Scan(&a, &b, &h, &m)

	r := math.Abs(m*360.0/60-(h*60.0+m)*360.0/(60.0*12.0)) * math.Pi / 180.0
	x := a*a + b*b - 2*a*b*math.Cos(r)

	fmt.Println(math.Sqrt(x))
}


Measured memory_bytes: 1820
#include<iostream>
#include<vector>
#include<cstring>
#include<vector>
#include<map>
using namespace std ;
typedef long long ll;
int main()
{
    string s ;
    cin >> s ;
    if(s[2]==s[3] && s[4]==s[5])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

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

int main(){
  long long num;
  cin >> num;
  if(num % 2 == 1) {
    cout << 0 << endl;
    return 0;
  }
  long long zeros = 0;
  for(int i=0; i<40; i++){
    long long testNum = 10;
    for(int j=0; j<i; j++){
      testNum *= 5;
    }
    zeros += num / testNum;
  }
  cout << zeros << endl;
  return 0;
}

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

int ar[100010][5],n;
int dp[100010][5];

int call(int i,int f)
{

    if(i==n)
        return 0;

    if(dp[i][f]!=-1)
        return dp[i][f];

    int ans=0;

    if(f==0)
        ans+=max(ar[i][1]+call(i+1,1),ar[i][2]+call(i+1,2));

    else if(f==1)
        ans+=max(ar[i][0]+call(i+1,0),ar[i][2]+call(i+1,2));
    else
        ans+=max(ar[i][1]+call(i+1,1),ar[i][0]+call(i+1,0));

        dp[i][f]=ans;
        return ans;

}

int main()
{

    cin>>n;

    for(int i=0;i<n;i++)
        cin>>ar[i][0]>>ar[i][1]>>ar[i][2];

    memset(dp,-1,sizeof dp);

    int ans=max(max(call(0,0),call(0,1)),call(0,2));

    cout<<ans<<endl;

}


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

int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    if((a==b && a!=c) || (b==c && b!=a) || (a==c && a!=b))cout<<"Yes";
    else    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n,q;
  cin >> n >> q;

  REP(_,q){
    int u,v;
    cin >> u >> v;

    set<int> st;
    if(n == 1){
      cout << min(u,v) << "\n";
      continue;
    }
    while(u){
      st.insert(u);
      u = (u+n-2)/n;
    }
    while(v){
      if(st.find(v) != st.end()){
        cout << v << "\n";
        break;
      }
      v = (v+n-2)/n;
    }
  }

  return 0;
}

Measured memory_bytes: 1280
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007
var mod1 int = 1000000007

type con struct {
	a int
	b int
}

func conunt(d int, a []int) int {
	ans := 0
	for i := 0; i < len(a); i++ {
		if a[i] == d {
			ans++
		}
	}
	return ans
}

func modPlus(a int, b int) int {
	return a%mod1 + b%mod1
}

func modTime(a int, b int) int {
	return a % mod1 * b % mod1
}

func modMinus(a int, b int) int {
	tm := (a - b) % mod1
	if tm < 0 {
		tm += mod1
	}
	return tm
}

func modDiv(a int, b int) int {
	return a % mod1 * modInv(b) % mod1
}

func modInv(a int) int {
	b := mod1
	u := 1
	v := 0
	for {
		if b == 0 {
			break
		}
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= mod1
	if u < 0 {
		u += mod1
	}
	return u
}

var inf = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	//予備
	d := fScan()
	t := fScan()
	s := fScan()
	if d/s > t {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}

Measured memory_bytes: 1776
N = int(input())
A = list(map(int, input().split()))
flag = True

for i in range(N):
    Ai = A[i]
    
    if Ai%2==0:
        if Ai%3!=0 and Ai%5!=0:
            flag = False

if flag:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 38384
#!/usr/bin/env python3
# -*- coding: utf-8 -*-



def main():
    N, A, B = map(int, input().split())
    S = input()

    n = 0
    r = 0
    for c in S:
        if c == "a":
            if n < A+B:
                print("Yes")
                n += 1
            else:
                print("No")
        elif c == "b":
            r += 1
            if n < A+B and r <= B:
                print("Yes")
                n += 1
            else:
                print("No")
        else:
            print("No")

if __name__ == "__main__": main()


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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);

    int a[4], b[4] = {1, 9, 7, 4};
    set<int> s, t;
    for (int i = 0; i < 4; i++) {
        cin >> a[i];
        s.insert(a[i]);
        t.insert(b[i]);
    }
    if (s == t) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int abcnum = 0;
        char[] s = scan.next().toCharArray();
        for(int i=0; i<s.length-2; i++){
            if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
                abcnum++;
            }
        }
        System.out.println(abcnum);
    }
}

Measured memory_bytes: 25684
A=int(input())
B=int(input())
C=int(input())
X=int(input())
ans=0
for i in range(0,A+1):
    for j in range(0,B+1):
        for k in range(0,C+1):
            if 500*i+100*j+50*k==X:
                ans+=1
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<string>
using namespace std;
typedef long long LL;

int main(){
	
	int a,b,c=0;
	cin>>a;b=a;
	while(b){
		c+=b%10;b/=10;
	}
	if(a%c==0){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int a,b,c,d,e,f;
  double x,y;
  while(cin>>a>>b>>c>>d>>e>>f)
    {
      x=1.0*(c*e-b*f)/(a*e-b*d)+0.0001;
	y=(c-a*x)/b+0.0001;
	printf("%.3f %.3f\n",x,y);
    }}

Measured memory_bytes: 1196
#include <cstdio>
int H,W,K;
int dp[3][1001][1001]={};
char in[1001];
int main(){
	scanf("%d%d%d",&H,&W,&K);
	for(int i = 1 ; i <= H ; i++){
		scanf("%s",in);
		for(int j = 0 ; j < W ; j++){
			dp[0][i][j+1] = dp[0][i][j];
			dp[1][i][j+1] = dp[1][i][j];
			dp[2][i][j+1] = dp[2][i][j];
			if(in[j] == 'J')		dp[0][i][j+1] ++;
			else if(in[j] == 'O') 	dp[1][i][j+1] ++;
			else					dp[2][i][j+1] ++;
		}
	}
	for(int i = 1; i <= H ; i++)
		for(int j = 1 ; j <= W ; j++)
			for(int k = 0 ; k < 3 ; k++)
				dp[k][i][j] += dp[k][i-1][j];
	for(int i = 0 ; i < K ; i++){
		int a,b,c,d,r[3]; scanf("%d%d%d%d",&a,&b,&c,&d);
		for(int j = 0 ; j < 3 ; j++) r[j] = dp[j][c][d] - dp[j][c][b-1] - dp[j][a-1][d] + dp[j][a-1][b-1];
		printf("%d %d %d\n",r[0],r[1],r[2]);
	}
	
}

Measured memory_bytes: 12000
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define REP(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int
main(int argc, char *argv[])
{
  int n; char s[202];
  scanf("%d\n%s", &n, s);

  int cnt1 = 0;
  for(int i = n - 1; i >= 0; i--){
    if(')' == s[i]) cnt1++;
    if('(' == s[i] && cnt1 > 0) cnt1--;
  }

  int cnt2 = 0;
  for(int i = 0; i < n; i++){
    if('(' == s[i]) cnt2++;
    if(')' == s[i] && cnt2 > 0) cnt2--;
  }

  for(int i = 0; i < cnt1; i++) printf("(");
  printf("%s", s);
  for(int i = 0; i < cnt2; i++) printf(")");
  printf("\n");

  return 0;
}
  


Measured memory_bytes: 128
#include <iostream>
#include <vector>

namespace {
void solve() {
  int32_t n;
  std::cin >> n;

  std::vector<int64_t> v(n, 0);

  int64_t s = 0, m = 1e9 + 1;
  int32_t c = 0;
  for (int32_t i = 0; i < n; i++) {
    std::cin >> v[i];
    if (v[i] < 0) {
      c++;
      s -= v[i];
      m = std::min(m, -v[i]);
    } else {
      s += v[i];
      m = std::min(m, v[i]);
    }
  }

  std::cout << (c & 1 ? s - m - m : s) << std::endl;
}
} // namespace

int32_t main(void) { solve(); }


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

int main(){

 int N;
 cin >> N;
  
 vector<string> col(N);
 
 for(int i = 0; i < N; i++){
  cin >> col.at(i);
   
  if(col.at(i) == "Y"){
   cout << "Four" << endl;
   break;
  }
   
  else if(i < N - 1){
   continue;
  }
   
  if(col.at(N - 1) != "Y"){
  cout << "Three" << endl;
  }
 }
 
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main()
{
	int a,b,k;
	cin>>a>>b>>k;
	if((b-a+1)<=2*k)
	{
		for(int i=a;i<=b;i++)
			cout<<i<<endl;
	}
	else
	{
		for(int i=a;i<a+k;i++)
			cout<<i<<endl;
		for(int j=b+1-k;j<=b;j++)
			cout<<j<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()

alphabet = ["Z", "A", "B", "C", "D", "E", "F", "G", "H",
            "I", "J", "K", "L", "M", "N", "O", "P", "Q",
            "R", "S", "T", "U", "V", "W", "X", "Y"]

output = []

for chara in S:
    a = alphabet.index(chara)
    b = alphabet[(a + N) % 26]
    output.append(b)

print(''.join(output))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int n,a[200010],totxor;

int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	int i;
	for(i=1;i<=n;++i)
		cin>>a[i];
	totxor=a[1];
	for(i=2;i<=n;++i)
		totxor^=a[i];
	for(i=1;i<=n;++i)
		cout<<(totxor^a[i])<<" ";
	
	return 0;
}

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

int main(){
 int n,b,f,r,v,i,j,k;
 int m[4][3][10];
 
 for(i=0;i<4;i++){
  for(j=0;j<3;j++){
   for(k=0;k<10;k++){
    m[i][j][k]=0;
   }
  }
 }

 cin >> n ;
 for(i=0;i<n;i++){
  cin >> b >> f >> r >> v ;
  m[b-1][f-1][r-1]+=v;
 }

 for(i=0;i<4;i++){
  if(i!=0)cout << "####################" << endl ;
  for(j=0;j<3;j++){
   for(k=0;k<10;k++){
    cout << ' ' << m[i][j][k] ;
   }
  cout << endl ;
  }
 }
 return 0;
}

Measured memory_bytes: 3076
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    vec ra(n+1); // 数字はどのIndexにあるか 
    rep(i,n) ra[a[i]]=i;
    // これ以降aは使わない

    ll ans=0;

    multiset<int> s; // ｘより小さいもののindexが入っている
    s.insert(-1); s.insert(n); // ストッパー
    s.insert(-1); s.insert(n); // ストッパー
    s.insert(ra[n]);
    for(int d=n-1;d>=1;d--){ // 1から小さい順にみてみる
        int i=ra[d]; // dのindexを代入
        auto it=s.lower_bound(i); // indexでみてsのiよりも大きな場所である最小を求める（ｄ＝＝1ならnとなる）
        int r=*it;
        it++;
        int R=*it;
        it--;
        it--; // iよりも大きな場所である最小から-1すると、小さな最大が出る
        int l=*it;
        it--;
        int L=*it;
        ll memo=0;
        if(r!=n&&l!=-1){
            ans+=d*(r-i)*(l-L);
            ans+=d*(i-l)*(R-r);
            memo+=d*(r-i)*(l-L)+d*(i-l)*(R-r);
        }
        else if(l==-1){
            ans+=d*(i+1)*(R-r);
            memo+=d*(i+1)*(R-r);
        }
        else if(r==n){
            ans+=d*(n-i)*(l-L);
            memo+=d*(n-i)*(l-L);
        }
        // cout<<l<<" "<<r<<" "<<memo<<endl;
        s.insert(i);
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 6528
x, y, z, k = list(map(int, input().split()))
A, B, C = [list(map(int, input().split())) for i in range(3)]

A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)

li = []

for p in range(len(A)):
    for q in range(len(B)):
        value = min(- int(- k / ((p + 1) * (q + 1))), len(C))
        for r in range(value):
            tasty = A[p] + B[q] + C[r]
            li.append(tasty)

li.sort(reverse = True)
for i in range(k):
    print(li[i])


Measured memory_bytes: 8708
// B.

#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

typedef long long LL;

int main(int argc, char *argv[]) {
	string s, r;
	cin >> s;
	char prev = 0;
	for (char c : s) {
		if (prev == 'B' && c == 'C') {
			r.resize(r.length() - 1);
			c = 'D';
		}
		r += c;
		prev = c;
	}
	LL ans = 0;
	int acnt = 0;
	prev = 0;
	for (char c : r) {
		if (c == 'A') {
			++acnt;
		} else if (c == 'D') {
			ans += acnt;
		} else {
			acnt = 0;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 776
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <bitset>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

int main() {
    int _;
    cin >> _;
    while (_--) {
        lli N[9];
        REP (i, 0, 9) {
            cin >> hex >> N[i];
        }
        lli ans = 0;
        int curry = 0;
        REP (i, 0, 32) {
            lli sum = curry;
            REP (i, 0, 8) sum += (N[i]) & 1;
            lli shft = 0;
            if ((sum & 1) != (N[8] & 1)) shft = 1;
            ans += (shft << i);
            int tmp = 0;
            REP (i, 0, 8) {
                tmp += ((N[i] ^ shft) & 1);
            }
            REP (i, 0, 9) N[i] >>= 1;
            //curry = curry / 2 + tmp / 2;
            curry = (curry + tmp) / 2;
        }
        cout << hex << (ans & 0xFFFFFFFF) << endl;
    }
    return 0;
}


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

using namespace std;

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

    int Sum = 0;
    vector <int> v;
    for (int i = 0; i < n; i++) {
        int x;  cin >> x;
        Sum += x;
        v.push_back(x);
    }

    int Ans = 1e9;
    for (int i = 1; i <= 100; i++) {
        int res = 0;
        for (auto x : v) res += (x - i)*(x - i);
        Ans = min(Ans, res);
    }

    cout << Ans << '\n';

    return 0;
}


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

namespace ABC100A
{
    class Program
    {
        static void Main(string[] args)
        {
            var cakeNums = Console.ReadLine().Split();
            var cakeNumA = int.Parse(cakeNums[0]);
            var cakeNumB = int.Parse(cakeNums[1]);

            if (cakeNumA <= 8 && cakeNumB <= 8)
            {
                Console.WriteLine("Yay!");
            }
            else
            {
                Console.WriteLine(":(");
            }
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<algorithm>
#include<iterator>
#include<vector>
using namespace std;
int main(){

vector<int> v;

for(int i=0;i<10;i++){

int j;
cin>>j;
v.push_back(j);


}

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

cout<<v[9]<<endl<<v[8]<<endl<<v[7]<<endl;

}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int main(){
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    rep(i,ty-sy) cout<<"U";
    rep(i,tx-sx) cout<<"R";
    rep(i,ty-sy) cout<<"D";
    rep(i,tx-sx+1) cout<<"L";
    rep(i,ty-sy+1) cout<<"U";
    rep(i,tx-sx+1) cout<<"R";
    cout<<"DR";
    rep(i,ty-sy+1) cout<<"D";
    rep(i,tx-sx+1) cout<<"L";
    cout<<"U"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define FOR(i,a,b) for (int i=(a); i<=(b); ++i)
#define int long long

char f[101][101];
bool okw[101],okh[101];

signed main(){
    int h,w;cin>>h>>w;
	FOR(i,0,h-1)FOR(j,0,w-1)cin>>f[i][j];
	FOR(i,0,h-1)okh[i]=false;
	FOR(j,0,w-1)okw[j]=false;
	FOR(i,0,h-1)
	{
		bool ok = true;
		FOR(j,0,w-1)if(f[i][j] == '#')ok=false;
		if(ok)okh[i]=true;
	}

	FOR(j,0,w-1)
	{
		bool ok = true;
		FOR(i,0,h-1)if(f[i][j] == '#')ok=false;
		if(ok)okw[j]=true;
	}
	
	FOR(i,0,h-1)
	{
		if(okh[i])continue;
		FOR(j,0,w-1)
		{
			if(okw[j])continue;
			cout << f[i][j];
		}
		cout << endl;
	}
   
}

Measured memory_bytes: 256
from itertools import product

l = list(input())
f = lambda x: '+' if x == 1 else '-'

for o in product(range(2), repeat=3):
    ret = l[0] + f(o[0]) + l[1] + f(o[1]) + l[2] + f(o[2]) + l[3]
    if eval(ret) == 7:
        print(ret + '=7')
        break


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

const int mod=998244353,iv2=(mod+1>>1);
int n,A[262147],F[262147],sA;

int quickmi(int a,int b)
{
	int t=1;
	for (; b; b>>=1,a=1ll*a*a%mod)
		if (b&1) t=1ll*t*a%mod;
	return t;
}

void FWT(int a[])
{
	for (int i=1; i<(1<<n); i<<=1)
		for (int j=0; j<(1<<n); j+=(i<<1))
			for (int k=0; k<i; k++)
			{
				int t1=a[j+k],t2=a[i+j+k];
				a[j+k]=(t1+t2>=mod?t1+t2-mod:t1+t2);
				a[i+j+k]=(t1<t2?t1-t2+mod:t1-t2);
			}
}

void IFWT(int a[])
{
	for (int i=1; i<(1<<n); i<<=1)
		for (int j=0; j<(1<<n); j+=(i<<1))
			for (int k=0; k<i; k++)
			{
				int t1=1ll*a[j+k]*iv2%mod,t2=1ll*a[i+j+k]*iv2%mod;
				a[j+k]=(t1+t2>=mod?t1+t2-mod:t1+t2);
				a[i+j+k]=(t1<t2?t1-t2+mod:t1-t2);
			}
}

int main()
{
	scanf("%d",&n),sA=0;
	for (int i=0; i<(1<<n); i++) scanf("%d",&A[i]),sA+=A[i];
	sA=quickmi(sA,mod-2);
	for (int i=0; i<(1<<n); i++) A[i]=1ll*sA*A[i]%mod;
	FWT(A),sA=0;
	for (int i=1; i<(1<<n); i++) 
		F[i]=(1ll<<n)*quickmi(A[i]+mod-1,mod-2)%mod,
		sA=(sA+F[i]>=mod?sA+F[i]-mod:sA+F[i]);
	F[0]=(sA==0?0:mod-sA),IFWT(F);
	for (int i=0; i<(1<<n); i++) printf("%d\n",F[i]);
	return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}
//long long int ruizyo(long long int aa, long long int bb){
  //  if(aa==0){
    //    return 1;
    //}
    //else if(aa%2==0){
      //  long long int tt=ruizyo(aa/2,bb);
        //return (tt*tt)%MOD;
    //}
    //else{
      //  return (ruizyo(aa-1,bb)*bb)%MOD;
    //}
//}フェルマ－のア


//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

//visited=vector<vector<bool>>(10,vector<bool>(10,false));アを全部falseに


long long int n,cnt=0,ans=INF,a[51],b[51],c[51],cmp,cmpp,m,ma,mb,h,w,x,y,sum=0,pos,dp[501][410][410];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;

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

       cin >> n >> ma >> mb;
       rep(i,n)cin>>a[i]>>b[i]>>c[i];
       rep(i,51){
           rep(j,401){
               rep(k,401){
                   dp[i][j][k]=INF;
               }
           }
       }
       dp[0][0][0]=0;
       
       rep(i,n){
           rep(ca,401){
               rep(cb,401){
                   if(dp[i][ca][cb]==INF){
                       continue;
                   }
                   else{
                       dp[i+1][ca][cb]=min(dp[i+1][ca][cb],dp[i][ca][cb]);
                       dp[i+1][ca+a[i]][cb+b[i]]=min(dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i]);
                   }
               }
           }
       }
       rrep(ca,1,401){
           rrep(cb,1,401){
               if(ma*cb==mb*ca){
                   ans=min(ans,dp[n][ca][cb]);
               }
           }
       }
       if(ans==INF){
           Cout(-1);
       }
       else{
           Cout(ans);
       }
return 0;
}


Measured memory_bytes: 67840
N = int(input())
a = list(map(int,input().split()))

a_odd = a[0::2]
a_even = a[1::2]

if N %2 == 0:#Nが偶数なら
  print(" ".join(list(map(str,list(reversed(a_even)) + a_odd))))
else:
  print(" ".join(list(map(str,list(reversed(a_odd)) + a_even))))

Measured memory_bytes: 31300
n = int(input())
S = [-1] + [int(x) for x in input().split()] + [10 ** 9 + 1]
q = int(input())
T = [int(x) for x in input().split()]

ans = 0
for t in T:
    ok = 0
    ng = n + 1
    while ng - ok > 1:
        mid = (ok + ng) // 2
        if S[mid] <= t:
            ok = mid
        else:
            ng = mid
    if S[ok] == t:
        ans += 1

print(ans)


Measured memory_bytes: 16892
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct{int p, l, r;}; /*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

  if(T[u].p==NIL) printf("root, ");
  else if(T[u].l==NIL) printf("leaf, ");
  else printf("internal node, ");
  
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
  
}

void calcDepth(int u, int p){
  //printf("success\n");
  //int a;
  D[u] = p;
  if(T[u].l!=NIL) calcDepth(T[u].l,p+1);
  //a = T[u].l;
  if(T[u].r!=NIL) calcDepth(T[u].r,p);
}

int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;
  
  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
    for(j = 0, sib = NIL; j<k; j++){ //子を入力する (input children)
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0) T[id].l = child; //idの一番左の子 (the most left child of id)
      else T[sib].r = child; //左の兄弟に繋げる (connect to left sibling)
      sib = child;//次の子供の左の兄弟 (the left sibling of the next child)
    }
  }

  //根を求める (find the root)
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  
  //それぞれのノードの深さを求める (find depth of each node)
  calcDepth(root, 0);

  //出力 (output)
  for(i=0; i<n; i++) print(i);
  
  return 0;
}



Measured memory_bytes: 3284
#include<iostream>
#include<vector>

using namespace std;

int main(void){
    int N, K;
    cin >> N >> K;
    vector<long long> x(N);
    for(int i = 0; i < N; i++){
        cin >> x[i];
    }
    long long ans = 4E+8;
    for(int offset = 0; offset + K - 1 < N; offset++){
        long long l = x[offset];
        long long r = x[offset + K - 1];
        long long s_ans;
        if(r < 0){
            s_ans = -l;
        }else if(l <= 0 && 0 <= r){
            int m = min(-l, r);
            int M = max(-l, r);
            s_ans = 2 * m + M;
        }else{
            s_ans = r;
        }
        // cout << offset << " " << s_ans << endl;
        ans = min(ans, s_ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'a' = 97

int main()
{
    while (1) {
        int h, w;
        cin >> h >> w;
        if (h == 0 && w == 0) break;
        rep(i, 0, h) {
            rep(j, 0, w) {
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;
    }

}



Measured memory_bytes: 3096
#include<stdio.h>
#define N 2001

int X[N];

int main(){
    int n,x,q,m,calc=0;
    int i,j;

    X[0]=1;//配列の始めを１とおく
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
      scanf("%d",&x);
      calc+=x;
      for(j=calc-x;j>=0;j--){
	if(X[j]==1) X[j+x]=1; //配列Xのなかに、和としてでた数の番地に１をいれる。
      }
    }

    scanf("%d",&q);
    for(i=0;i<q;i++){
      scanf("%d",&m);//入力した番地に１が格納されていれば和は存在する
      if(X[m]==1) printf("yes\n");
      else printf("no\n");
    }

    return 0;
}



Measured memory_bytes: 2104
import itertools

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
NA=NB=0

for i,j in enumerate(list(itertools.permutations(range(1,N+1)))):
  if list(j)==A:
    NA=i
  if list(j)==B:
    NB=i

print(abs(NA-NB))


Measured memory_bytes: 8052
process.stdin.resume();
process.stdin.setEncoding('utf8');
 
var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  var ary = lines[0].split(" ");
  var str = ary[1].concat(ary[0]);
  console.log(str);
});

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

int main() {
	long long n, a[5]={0,0,0,0,0}, r = 0;
	
	scanf("%ld", &n);
	for (int i = 0; i < n; i++) {
		char s[10];
		scanf("%s", s);
		if (s[0] == 'M'){
			a[0]++;
		}
		else if (s[0] == 'A') {
			a[1]++;
		}
		else if (s[0] == 'R') {
			a[2]++;
		}
		else if (s[0] == 'C') {
			a[3]++;
		}
		else if (s[0] == 'H') {
			a[4]++;
		}
	}
	for (int k = 0; k < 3; k++) {
		for (int l = k + 1; l < 4; l++) {
			for (int m = l + 1; m < 5; m++) {
				r += a[k] * a[l] * a[m];
			}
		}
	}
	printf("%ld", r);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n, m = 100000;
    cin >> n;
    VI p(m);
    REP(i,n){
        int a;
        cin >> a;
        p[a-1]++;
    }
    int ans = n, two = 0;
    REP(i,m){
        if (p[i] > 1){
            int x = (p[i] - 1) / 2;
            ans -= 2*x;
            if (p[i] % 2 == 0) two++;
        }
    }
    int x = (two + 1) / 2;
    ans -= 2*x;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

int main(void)
{
  int i,j,n,m,a[1000],s,s1;

  while(1)
    {
      scanf("%d",&n);
      scanf("%d",&m);
      if(n==0&&m==0) break;
      for(i=0;i<=n-1;i++)
	{
	  scanf("%d",&a[i]);
	}
      s1=0;
      for(i=0;i<=n-1;i++)
	{
	  for(j=i+1;j<=n-1;j++)
	    {
	      s=a[i]+a[j];
	      if(s<=m && s1<s) s1=s;
	    }
	}
      if(s1==0) printf("NONE\n");
      else printf("%d\n",s1);
    }
  return 0;
}


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


int main(void){

char s[1000000],t[1000000];
scanf("%s %s",s,t);
int n; int count=0;
n=strlen(s);

for(int i=0;i<n;i++){
        if(s[i]!=t[i]){
                count++;
        }   
}
printf("%d\n",count);
return 0;
}


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

using namespace std;

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] != t[i]) {
            ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3784
#include<iostream>
#include<cmath>

using namespace std;

const int MAX = 100;

int main()
{
	int N = 0,T = 0;
	int c[MAX],t[MAX];

	cin >> N >> T;

	int minCost = 1001;

	int ans = -1;

	for(int i=0;i<N;i++)
	{
		cin >> c[i] >> t[i];

		if(T >= t[i])
		{
			minCost = min(minCost,c[i]);
		}
	}

	if(minCost == 1001)
	{
		cout << "TLE" << endl;
	}
	else
	{
		cout << minCost << endl;
	}

	return 0;
}

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

using namespace std;

int main(int argc, char const *argv[])
{
	vector<long long int> v;
	int n;
	long long int count = 1000000000;
	long long int division = 0;

	cin >> n;

	for (int i = 0; i < n; ++i)
	{
		long long int tmp;
		cin >> tmp;
		v.push_back(tmp);
	}

	for (int i = 0; i < v.size(); ++i)
	{

		while(v[i] % 2 == 0){
			division++;
			v[i] = v[i] / 2;
		}

		if(count > division) count = division;

		division = 0;
	}

	cout << count << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<string>
#include<bits/stdc++.h>
#define fast  ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long int
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define el '\n'
using namespace std;
//const int N=1e6+5;
//int fr[N];
bool isPrime(int num){
    int root=sqrt(num);
    for(int i=2;i<=root;i++){
        if(num%i==0){
            return false;
        }
    }
    return true;
}
void replaceAll( string &s, const string &search, const string &replace ) {
    for( size_t pos = 0; ; pos += replace.length() ) {

        pos = s.find( search, pos );
        if( pos == string::npos ) break;
        s.erase( pos, search.length() );
        s.insert( pos, replace );
    }
}
const int N=2e5+1;
int n,h[N], dp[N];
ll calc(int i){
    if(i>n){
        return 1e9;
    }
    if(i==n-1)return 0;
    if(dp[i]!=-1)return dp[i];
    int val1=calc(1+i)+abs(h[i]-h[i+1]);
    int val2=calc(2+i)+abs(h[i]-h[i+2]);
    return dp[i]=min(val1,val2);
}
int main()
{
    fast;
    cin>>n;
    for(int i=0;i<n;i++)cin>>h[i];
    memset(dp,-1,sizeof dp);
    cout<<calc(0);
    return 0;
}


Measured memory_bytes: 11044
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#define int long long
using namespace std;

signed main() {
	int n, k; cin >> n >> k;
	int ans = 1;
	for (int i = 0; i < n; i++) {
		ans = min(ans * 2, ans + k);
	}
	cout << ans << endl;
}

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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;



int main(){

    int s,w;
    cin >> s >> w;

    cout << (s <= w ? "unsafe" :  "safe") << endl;
    return 0;
}


Measured memory_bytes: 3604