akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define bg begin()
#define en end()
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define pr_arr(name, a, b) \
  for (int i = (a); i < (b); i++) { \
    for (int j = (a); j < (b); j++) {\
      if (j > (a)) printf(" "); \
      printf("%lld", name[i][j]); \
    }\
    printf("\n");\
  }\

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

ll ans = 1000000000000;
int N;
ll A[200005];
ll S[200005];

int main(void) {
    scanf("%d", &N);
    rep(i, 0, N) scanf("%lld", &A[i]);

    S[0] = A[0];
    rep(i, 1, N) S[i] = S[i-1]+A[i];

    rep(i, 0, N-1) {
      ll left = S[i];
      ll right = S[N-1] - S[i];
      ans = min(ans, abs(left-right));
    }
   

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

	return 0;
}


Measured memory_bytes: 3328
import math as m
a,b,c=map(float,input().split())
c=m.radians(c)
s=(1/2)*a*b*m.sin(c)
h=b*m.sin(c)
l=m.pow(m.pow(a,2)+m.pow(b,2)-2*a*b*m.cos(c),1/2)

print(f'{s:.8f}')
print(f'{a+b+l:.8f}')
print(f'{h:.8f}')


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

int main() {
    int x, y;
    cin >> x >> y;
    bool ok = false;
    for (int i=0; i<=x; ++i) {
        if (i*2 + (x-i)*4 == y) ok = true;
    }
    string ans;
    if (ok) ans = "Yes";
    else ans = "No";
    cout << ans << endl;
    return 0;
}

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

int main(){
  int k;
  string s;
  cin >> k >> s;
  if(k < s.length()){
  	for(int i=0;i<k;++i){cout << s[i];}
    cout << "..." << endl;
  }
  else{cout << s << endl;}
}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
#define NMAX 100000
int main(){
  int N;
  cin >> N;
  int A[N];
  long maxtotal = 0;

  int minus_num = 0;//マイナス符号の数
  int minimum_abs = -1;//絶対値最小の数

  for(int i=0;i<N;i++){
    cin >> A[i];
    if(A[i]<0){
      if(minimum_abs == -1 || minimum_abs > -A[i])
        minimum_abs = -A[i];
      minus_num++;
    }
    else{
      if(minimum_abs == -1 || minimum_abs > A[i])
        minimum_abs = A[i];
    }
  }
  //cout << minus_num;
  if(minus_num%2 == 0){
    for(int i=0;i<N;i++){
      if(A[i] < 0)maxtotal += -1 * A[i];
      else maxtotal += A[i];
    }
  }else {
    //奇数の場合は絶対値最小の数をマイナスとする
    for(int i=0;i<N;i++){
      if(A[i] < 0)maxtotal += -1 * A[i];
      else maxtotal += A[i];
    }
    maxtotal -= (2*minimum_abs);
  }
  //cout << "maxtotal:" << maxtotal << endl;
  cout << maxtotal;
}


Measured memory_bytes: 640
#include<iostream>
#include <climits>
#include<vector>
#include<list>
#include<numeric>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	vector<ll> S(n);
	REP(i, n) cin >> S[i];
	int q;
	cin >> q;
	vector<ll> T(q);
	REP(i, q) cin >> T[i];
	int res = 0;
	REP(i, q) {
		if (binary_search(S.begin(), S.end(), T[i])) res++;
	}
	cout << res << "\n";

	return 0;
}


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

const int N = 185;

char g[N][N + 1];
int up[N][N][N], tmp[N][N];

void update(int& x, int a)
{
  x = std::max(x, a);
}

int main()
{
  int n, m;
  while (scanf("%d%d", &n, &m) == 2) {
    memset(up, 0, sizeof(up));
    for (int i = 0; i < n; ++ i) {
      scanf("%s", g[i]);
      for (int j = 0; j < m; ++ j) {
        for (int k = j; k < m && g[i][j] == g[i][k]; ++ k) {
          up[i][j][k] = 1;
          if (i && g[i - 1][j] == g[i][j]) {
            up[i][j][k] += up[i - 1][j][k];
          }
        }
      }
    }
    int ans = 0;
    while (up[n - 1][0][m - 1] < n) {
      ans ++;
      for (int i = n - 1; i >= 0; -- i) {
        for (int j = 0; j < m; ++ j) {
          int p = j;
          for (int k = j; k < m; ++ k) {
            int& ref = tmp[j][k] = up[i][j][k];
            if (ref < i + 1) {
              ref += up[i - ref][j][k];
            }
            if (j < k) {
              //for (int p = j; p < k; ++ p) {
              //  update(ref, std::min(up[i][j][p], up[i][p + 1][k]));
              //}
              while (p + 2 <= k && up[i][j][p + 1] > up[i][p + 2][k]) {
                p ++;
              }
              update(ref, std::min(up[i][j][p], up[i][p + 1][k]));
              if (p + 2 <= k) {
                update(ref, std::min(up[i][j][p + 1], up[i][p + 2][k]));
              }
            }
          }
        }
        for (int j = 0; j < m; ++ j) {
          for (int k = j; k < m; ++ k) {
            up[i][j][k] = tmp[j][k];
          }
        }
      }
    }
    printf("%d\n", ans);
  }
}


Measured memory_bytes: 25088
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(){

    int N, D;
    cin >> N >> D;
    vector< vector<int> > X(N, vector<int>(D));
    for(int i = 0; i < N; i++) for(int j = 0; j < D; j++) cin >> X[i][j];

    int count = 0;
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            double dist = 0;
            for(int k = 0; k < D; k++) dist += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            dist = sqrt(dist);
            if(ceil(dist) == floor(dist)) count++;
        }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), M = sc.nextInt(), X = sc.nextInt();
		int[] A = new int[M];
		for (int i=0; i<M; i++){
			A[i] = sc.nextInt();
		}
		int costA = 0;
		int costB = 0;
		for (int i=X; i<N; i++){
			for (int j=0; j<M; j++){
				if (i==A[j]){
					costA++;
				}
			}
		}
		for (int i=X; i>0; i--){
			for (int j=0; j<M; j++){
				if (i==A[j]){
					costB++;
				}
			}
		}
		System.out.println(Math.min(costA, costB));

	}

}

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

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;

int main(void){

	ll N, M;
	cin >> N >> M;

    vvl next(N);
    vl indeg(N);
    vl val(N);

    for(ll i = 0; i < M; i++){
        ll x, y;
        cin >> x >> y;
        x--;
        y--;
        next[x].push_back(y);
        indeg[y]++;
    }

    queue<ll> q;
    for(ll i = 0; i < N; i++){
        if(!indeg[i])
            q.push(i);
    }

    ll res = 0;
    while(!q.empty()){
        ll cur = q.front();
        q.pop();
        for(const auto &it : next[cur]){
            indeg[it]--;
            if(!indeg[it])
                q.push(it);
            val[it] = max(val[it], val[cur] + 1);
            res = max(val[it], res);
        }
    }

    cout << res << endl;
}


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

#define ll long long
#define mp make_pair
#define X first
#define Y second
#define pb push_back
#define pii pair<int, int>

using namespace std;

int solve();

int main()
{
    #ifdef DEBUG
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif // DEBUG
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
}

const int MAXN = (int)2e5 + 10;
const int M = 22;

int pref[MAXN][M];
int a[MAXN];

bool check(int l, int Mid, int n)
{
    int r = l + Mid - 1;
    if (r > n)
        return 0;
    for (int i = 0; i < M; i++)
        if (pref[r][i] - pref[l - 1][i] > 1)
            return 0;
    return 1;
}

int solve()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j < M; j++)
            pref[i][j] = pref[i - 1][j];
        int cnt = 0;
        int x = a[i];
        while(x)
        {
            if (x & 1)
                pref[i][cnt]++;
            cnt++;
            x >>= 1;
        }
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++)
    {
        int L = 0;
        int R = n + 1;
        while(L + 1 < R)
        {
            int Mid = (L + R) / 2;
            if (check(i, Mid, n))
                L = Mid;
            else
                R = Mid;
        }
        ans += L;
    }
    cout << ans << endl;
}



Measured memory_bytes: 18176
#include <iostream>
#include <cstdlib>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  if(a > 8 || b > 8){
    cout <<  ":(" << endl;
  }else{
    cout << "Yay!" << endl;
 }
  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();
		int M = sc.nextInt();
		sc.close();

		System.out.println(N * (N - 1) / 2 + M * (M - 1) / 2 );
	}
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define N 1000000007
typedef long long ll;
#define all(v) (v).begin(),(v).end()
#define sz(x) int(x.size())

    
int main(){
	ll a,b;
	cin>>a>>b;
	ll ans=0;
	if(b>=a+10){
		if(a%2==0){
			if(b%2==0){
				if((b-a)%4==0){
					ans=b;
				}else{
					ans=(ll)((b-2)^(b-1))^b;
				}
			}else{
				if((b-a+1)%4==0){
					ans=0;
				}else{
					ans=1;
				}
			}
		}else{
			if(b%2==0){
				if((b-a-1)%4==0){
					ans=(ll)(a^b);
				}else{
					ans=(ll)(a^b)^((b-1)^(b-2));
				}
			}else{
				if((b-a)%4==0){
					ans=a;
				}else{
					ans=(ll)(a^b)^(b-1);
				}
			}
		}
	}else if(a==b){
		ans=a;
	}else{
		for(ll i=a;i<=b;i++){
			ans=(ll) ans^i;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
def tri(n):
  return n * (n+1) // 2

N = int(input())
A = list(map(int, input().split()))

SA = [0] * (N+1)
for i in range(N):
  SA[i+1] = SA[i] + A[i]
  
SA.sort()

ans = 0
cnt = 0

for i in range(N+1):
  if i == 0:
    now = SA[i]
    continue
  
  if now == SA[i]:
    cnt += 1
    continue
  elif cnt > 0:
    ans += tri(cnt)
    cnt = 0
  else:
    pass
  now = SA[i]

if cnt > 0:
    ans += tri(cnt)
    
print(ans)
    
    

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

using namespace std;

typedef long long ll;

int main(){
  ll a,b;
  char op;
  
  cin>>a>>op>>b;
  
  if(op=='+'){
    cout<<a+b<<endl;
  }else{
    cout<<a-b<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= 1e7; ++i)
        if ((i * 8) / 100 == a && (i * 10) / 100 == b)
            return cout << i, 0;
    cout << -1;
}


Measured memory_bytes: 256
import scala.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
      val inputs = StdIn.readLine().split(" ").map(_.toInt)
      val (a, b) = (inputs(0), inputs(1))
      if(a < b) println("a < b")
      else if(a > b) println("a > b")
      else println("a == b")
  }
}

Measured memory_bytes: 43760
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;
    

    void calc()
    {
        cin = new Scanner();
        string S = cin.next();
        bool[] used = new bool[26];
        if (S.Length == 26)
        {
            for (int i = S.Length - 1; i >= 0; i--)
            {
                int lim = S[i] - 'a';
                used[lim] = true;

                for (int j = lim + 1; j < 26; j++)
                {
                    if (used[j])
                    {
                        Console.Write(S.Substring(0, i));
                        Console.WriteLine((char)('a' + j));
                        return;
                    }
                }

            }

            Console.WriteLine(-1);
        }
        else
        {
            for (int i = 0; i < S.Length; i++)
            {
                used[S[i] - 'a'] = true;
            }
            for (int i = 0; i < 26; i++)
            {
                if (!used[i])
                {
                    S += (char)('a' + i);
                    break;
                }
            }
            Console.WriteLine(S);
        }

    } 



}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
#include <iostream>

int main(int argc, const char * argv[]) {
    int a,b,four,two;
    four=two=0;
    std::cin>>a;
    for(int i=0;i<a;i++){
        std::cin>>b;
        if(b%4==0)++four;
        if(b%4!=0 &&b%2==0)++two;
    }
    if((four+1)*2>a){
        std::cout<<"Yes"<<std::endl;
    }else if((four+1)*2>a-two+1){
        std::cout<<"Yes"<<std::endl;
    }else{
        std::cout<<"No"<<std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;
long long num_size[51];
long long num_size_p[51];
vector<long long> p_sizeN(int N,long long start,long long x){
  if(start>x)return vector<long long>{0,0};
  if(N==0)return vector<long long>{1,1};//p,size
  if(num_size[N]!=-1){
    if(num_size[N]+start<x){
      return vector<long long>{num_size_p[N],num_size[N]};
    }
  }
  long long cur=start;
  long long num_p=0;
  long long size=0;
  cur+=1;size+=1;//B
  do{
  	if(cur>=x)break;
  	vector<long long> n_1_1=p_sizeN(N-1,cur,x);
  	num_p+=n_1_1[0];//P
  	size+=n_1_1[1];cur+=n_1_1[1];//size
  	if(cur>=x)break;
  	cur+=1;num_p+=1;size+=1;//P
  	if(cur>=x)break;
  	n_1_1=p_sizeN(N-1,cur,x);
  	num_p+=n_1_1[0];//P
  	size+=n_1_1[1];cur+=n_1_1[1];//size
  	if(cur>=x)break;
  	cur+=1;size+=1;//B
    num_size[N]=size;
    num_size_p[N]=num_p;
  }while(false);
  return vector<long long>{num_p,size};
};
int main(){
  for(int i=0;i<52;++i){num_size[i]=-1;num_size_p[i]=-1;}
  long long N,X;
  cin>>N>>X;
  cout<<p_sizeN(N,0,X)[0];
  return 0;
}

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

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--) {
        int n;
        cin >> n;
        if (n % 1000) cout << 1000 - n % 1000;
        else cout << 0;
    }
    return 0;
}

Measured memory_bytes: 3648
using namespace std;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(ll i=1;i<n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 998244353
#define mod MOD
#define sec setprecision
constexpr double eps = 1e-9;
constexpr double PI = 3.141592653589793238462643383279;
ll gcd(ll a, ll b) {
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
int ketasuu(ll h) {
	if (h < 0)return(-(ketasuu(-h)));
	else if (h < 10)return(1);
	else return(1 + ketasuu(h / 10));
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll 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;
	}
}
vector<ll> soinnsuubunnkai(ll n) {
	vector<ll>a;
	while (n % 2 == 0) {
		a.push_back(2);
		n /= 2;
	}
	ll f = 3;
	while (f * f <= n) {
		if (n % f == 0) {
			a.push_back(f);
			n /= f;
		}
		else f += 2;
	}
	if (n != 1)
		a.push_back(n);
	return(a);
}
// 二項係数計算
long long com(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
ll pow(ll a, ll b) {
	a = a % mod;
	if (b == 0)return(1);
	else if (b % 2 == 0)return(pow((a * a) % mod, b / 2));
	else return(a * (pow(a, b - 1)));
}
void solve() {
	int a, b;
	cin >> a >> b;
	if ((a + b) % 2 == 0)cout << (a + b) / 2;
	else cout << "IMPOSSIBLE";
}
int main() {
	solve();
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;


int main(void){
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> ok(n);
    for (int i = 0; i < q; i++)
    {
        int a;
        cin >> a;
        ok[a-1] += 1;
    }
    for (int i = 0; i < n; i++)
    {
        if((q - ok[i]) >= k) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    
    

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N;
    cin >> N;
    VEC(VEC(string)) normalStrings {{""}};
    FOR(n, 1, N + 1) {
        VEC(string) v;

        string temp(n, '.');
        temp[0] = 'a';
        FOR(mask, 0, 1 << (n - 1)) {
            int left = 0;
            FOR(j, 0, n - 1)
                if (mask & (1 << j))
                    temp[j + 1] = 'a';
                else
                    left++;

            for (string& s : normalStrings[left]) {
                int cnt = 0;
                FOR(j, 0, n - 1)
                    if (!(mask & (1 << j))) {
                        temp[j + 1] = (char)(s[cnt++] + 1);
                    }

                v.push_back(temp);
            }
        }

        normalStrings.push_back(v);
    }

    sort(ALL(normalStrings.back()));
    for (string& s : normalStrings.back())
        cout << s << endl;
    return 0;
};

Measured memory_bytes: 9284
N=int(input())
S=[1 if x=='R' else (2 if x=='G' else 3) for x in [*input()]]

t=S.count(1)*S.count(2)*S.count(3)
for i in range(N-2):
  j=1
  while i+2*j<N:
    if S[i]*S[i+j]*S[i+2*j]==6:
      t-=1
    j+=1

print(t)


Measured memory_bytes: 9252
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  //input
  int N;
  cin >> N;
  vector <double> x(N);
  vector <string> u(N);
  rep(i,N) cin >> x[i] >> u[i];
  double rate = 380000.0;

  //solve
  double ans = 0;
  rep(i,N){
    if (u[i] == "BTC") ans += rate * x[i];
    else ans += x[i];
  }
  cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 3744
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
namespace io
{
#define SIZ (1 << 21 | 1)
#define gc() (io::iS == io::iT ? (io::iT= (io::iS= io::ibuff) + fread(io::ibuff, 1, SIZ, stdin), (io::iS == io::iT ? EOF : *io::iS++)) : *io::iS++)
#define putc(x) (io::oS == io::oT ? (fwrite(io::obuff, 1, io::oS - io::obuff, stdout), io::oS= io::obuff, (*io::oS++= x)) : *io::oS++= x)
#define exit                                          \
	fwrite(io::obuff, 1, io::oS - io::obuff, stdout); \
	return 0;
	char *iS, *iT, ibuff[SIZ], obuff[SIZ], *oS= obuff, *oT= oS + SIZ - 1, fu[110], c;
	int fr;
	template <class Type>
	inline void read(Type &x)
	{
		x= 0;
		Type y= 1;
		for(c= gc(); (c > '9' || c < '0') && c != '-'; c= gc())
			;
		c == '-' ? y= -1 : x= (c & 15);
		for(c= gc(); c >= '0' && c <= '9'; c= gc()) x= x * 10 + (c & 15);
		x*= y;
	}
	inline void reads(char *x)
	{
		for(c= gc(); c == ' ' || c == '\n'; c= gc())
			;
		for(; c != ' ' && c != '\n' && c != EOF; *x= c, c= gc(), ++x)
			;
	}
	template <class Type>
	inline void print(Type x, char text= '\n')
	{
		if(x < 0) putc('-'), x*= -1;
		if(x == 0) putc('0');
		while(x) fu[++fr]= x % 10 + '0', x/= 10;
		while(fr) putc(fu[fr--]);
		putc(text);
	}
	inline void prints(char *x, char *y= NULL, char text= '\n')
	{
		for(; *x && x != y; ++x) putc(*x);
		putc(text);
	}
}  // namespace io
using io::print;
using io::prints;
using io::read;
using io::reads;
#define N 2001
int n, k, head[N], cnt, dis[N], ans= 2147483647;
struct Edge
{
	int a, b;
} e[N << 1];
inline void add(int a, int b) { e[++cnt].a= head[a], e[cnt].b= b, head[a]= cnt; }
inline void dfs(int x, int y, int z)
{
	dis[x]= dis[y] + 1;
	for(int i= head[x]; i; i= e[i].a)
	{
		if(e[i].b == y || e[i].b == z) continue;
		dfs(e[i].b, x, z);
	}
}
signed main()
{
	read(n), read(k);
	for(int i= 1, a, b; i < n; i++) read(a), read(b), add(a, b), add(b, a);
	dis[0]= -1;
	if(k & 1)
	{
		for(int i= 1; i < n; i++)
		{
			int a= e[(i << 1) - 1].b, b= e[i << 1].b;
			dfs(a, 0, b), dfs(b, 0, a);
			int x= 0;
			for(int j= 1; j <= n; j++)
				if(dis[j] > (k >> 1)) ++x;
			ans= min(ans, x);
		}
	}
	else
	{
		for(int i= 1; i <= n; i++)
		{
			dfs(i, 0, 0);
			int x= 0;
			for(int j= 1; j <= n; j++)
				if(dis[j] > (k >> 1)) ++x;
			ans= min(ans, x);
		}
	}
	print(ans);
	exit;
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
int main()
{
    int i, testcase, n, b, j  ;
    string s ;
    cin >> s;
    char c='x';
    for(j=0; j<s.size(); j++)
    {
        cout << c;
    }
    return 0;
}

Measured memory_bytes: 3624
import std.stdio;
import std.algorithm;

void main() {
	long n, capacity;
	readf(" %s %s", &n, &capacity);

	auto weights = new long[n];
	auto values = new long[n];
	
	foreach (i;0..n) {
		readf(" %s %s", &weights[i], &values[i]);
	}

	auto dp = new long[][n + 1];
	foreach (ref e;dp) {
		e = new long[capacity + 1];
	}

	foreach (i;0..n) {
		foreach (j;0..capacity + 1) {
			if (j < weights[i]) {
				dp[i + 1][j] = dp[i][j];
			} else {
				dp[i + 1][j] = max(dp[i][j], dp[i][j - weights[i]] + values[i]);
			}
		}
	}

	writeln(dp[n][capacity]);
}


Measured memory_bytes: 81532
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	ll a, b, c, d; cin >> a >> b >> c >> d;
	cout << max({a*c, a*d, b*c, b*d}) << endl;
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();

		int l = String.valueOf(a).length();

		String r = String.valueOf(a).substring(l - 1);
		int p = Integer.parseInt(r);

		if (p == 3) {
			System.out.println("bon");
		} else if (p == 0 || p == 1 || p == 6 || p == 8) {
			System.out.println("pon");
		} else {
			System.out.println("hon");
		}
	}
}


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

int main() {
  int a, b, x;
  cin >> a >> b >> x;
  
  if(a <= x && x <= a+b) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll t=1;
ll n,x;
string s;

// <------------- Implement Functions Here ----------> //

long long gcd(long long m,long long n) {
	if(!n) return m;
	return gcd(n,m%n);
}

// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	ll sum = 0;
	for(ll a=1;a<=n;a++) {
		for(ll b=1;b<=n;b++) {
			for(ll c=1;c<=n;c++) {
				sum+=gcd(a,gcd(b,c));
			}
		}
	}
	cout<<sum;newl;
}

int main() {
	fastio;randomINT;
	//cin>>t;
	while(t--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 238028
#include<bits/stdc++.h>
#include <iomanip>
#include <iostream>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll max(ll a, ll b){
    if(a > b) return a;
    else return b;
}
 
ll min(ll a, ll b){
    if(a < b) return a;
    else return b;
}

int main(void){
    string A,B; cin >> A >> B;
    if(A.size() > B.size()){
        cout << "GREATER" << endl;
        return 0;
    }
    else if(A.size() < B.size()){
        cout << "LESS" << endl;
        return 0;
    }
    else{
        for(int i = 0; i < A.size(); i++){
            if(A[i] > B[i]){
                cout << "GREATER" << endl;
                return 0;
            }else if(A[i] < B[i]){
                cout << "LESS" << endl;
                return 0;
            }
        }
    }
    cout << "EQUAL" << endl;
}

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

#define     MX        200005
#define     mod       998244353
#define     ll        long long
#define     ld        double
#define     mem(a,b)  memset(a,b,sizeof(a))
#define     fast()    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     F         first
#define     S         second
#define     mp        make_pair
#define     inf       2e18
#define     PI        acos(-1.0)

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

int n;
pair<int,int>pr[MX];

int check(int mid,int lef,int ri){
    int l=0,m=0,r=0;
    for(int i=1;i<=n;i++){
        if(pr[i].S<mid) l++;
        else if(pr[i].F>mid) r++;
        else m++;
    }
    //if(lef==1 && ri==0) cout<<mid<<" check  "<<l<<" "<<r<<" "<<m<<endl;
    if(l>lef){
        return -1;
    }
    else if(r>ri){
        return 1;
    }
    return 0;
}
int findLower(int lef,int ri){
    int lo=1,hi=1e9,mid,res=-1;
    while(lo<=hi){
        mid=(lo+hi)/2;
        int got = check(mid,lef,ri);
        //if(lef==0 && ri==1) cout<<mid<<" mid  "<<got<<endl;
        if(got==0){
            hi=mid-1;
            res=mid;
        }
        else if(got==1) lo=mid+1;
        else hi=mid-1;
    }
    //cout<<lef<<" "<<ri<<" "<<res<<" "<<check(3,lef,ri)<<endl;
    return res;
}
int findUpper(int lef,int ri){
    int lo=1,hi=1e9,mid,res=-1;
    while(lo<=hi){
        mid=(lo+hi)/2;
        int got= check(mid,lef,ri);

        if(got==0){
            lo= mid+1;
            res=mid;
        }
        else if(got==1) lo =mid+1;
        else hi= mid-1;
    }
    return res;
}


int main(){
    fast();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>pr[i].F>>pr[i].S;
    }
    sort(pr+1,pr+n+1);
    int ans;
    if(n%2) {
        int l = findLower(n/2,n/2);
        int r= findUpper(n/2,n/2);
        //cout<<l<<" "<<r<<endl;
        ans= r-l+1;
    }
    else {
        int l1= findLower(n/2-1,n/2);
        int r1= findUpper(n/2-1,n/2);
        //cout<<l1<<" "<<r1<<endl;
        int l2= findLower(n/2,n/2-1);
        int r2= findUpper(n/2,n/2-1);
        //cout<<l2<<" "<<r2<<endl;
        ans = r2-l2+1+r1-l1;
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 5200
#include <stdio.h>
int main(void){
  
   // Your code here!
  int W,H,x,y,r;
   scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(x+r<=W && x-r>=0 && y+r<=H && y-r>=0){printf("Yes\n");}
  else{printf("No\n");}
}



Measured memory_bytes: 2104
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BTollGates {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n, m, x;
	    in >> n >> m >> x;
	    map<int, int> a;
	    int ina;
	    for(int i=0; i<m; i++){
	        in >> ina;
	        a[ina] = 1;
	    }

	    ll res = inf;
	    int cur = x;
	    ll cnt = 0;
	    while(cur < n){
	        if(a[cur]) cnt++;
	        cur++;
	    }
	    chmin(res, cnt);

	    cnt = 0;
	    cur = x;
	    while(cur > 0){
	        if(a[cur]) cnt++;
	        cur--;
	    }
	    chmin(res, cnt);

	    out << res << endl;
	}
};


int main() {
	BTollGates solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                String S = sc.next();
                int ans = 0;
                for (int i = 0; i < S.length() / 2; i++) {
                        if(S.charAt(i) == 'i' || S.charAt(i) == 'w'){
                                if (S.charAt(i) != S.charAt(S.length() - i - 1)) {
                                        ans++;
                                }
                        } else {
                                if (S.charAt(i) == '(' && S.charAt(S.length() - i - 1) != ')') {
                                        ans++;
                                } else if (S.charAt(i) == ')' && S.charAt(S.length() - i - 1) != '(') {
                                        ans++;
                                }
                        }
                }
                if (S.length() % 2 == 1 &&(S.charAt(S.length() / 2) == '(' || S.charAt(S.length() / 2) == ')')) {
                        ans++;
                }
                System.out.println(ans);
        }
}

Measured memory_bytes: 26088
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <climits>
#include <cassert>
#define fr first
#define sc second
#define MP make_pair
#define ad push_back
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define lli long long int
#define y1 arayikhalatyan
#define j1 jiglypuff
#define ld long double
#define itn int
#define pir pair<int, int> 
#define all(x) (x).begin(), (x).end()
#define str string
using namespace std;

lli gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }
ld dist(ld x1, ld y1, ld x2, ld y2)
{
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
lli S(lli a)
{
	return (a * (a + 1LL)) / 2;
}
char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 1, -1, 0, 0, -1, -1, 1, 1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };


const int N = 1e6 + 30;
const lli mod = 998244353;
const ld pi = acos(-1);
const int T = 238;
const ld e = 1e-6;

lli bp(lli a, lli b = mod - 2LL)
{
	lli ret = 1;
	while (b)
	{
		if (b & 1) ret *= a, ret %= mod;
		a *= a;
		a %= mod;
		b >>= 1;
	}
	return ret;
}
ostream& operator<<(ostream& c, pir a)
{
	c << a.fr << " " << a.sc;
	return c;
}



int n;
string s[N];
vector <pir > fp, ffp;
str pat;
pir f(string s)
{
	int sm = 0, mn = 0;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == '(') sm++;
		else sm--;
		mn = min(mn, sm);
	}
	return { mn, sm };
}
void rev(str& s)
{
	reverse(all(s));
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == '(') s[i] = ')';
		else s[i] = '(';
	}
}
int main()
{
	fastio;
	cin >> n;
	int sum = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
		auto p = f(s[i]);
		sum += p.sc;
		if (p.sc >= 0) fp.ad(MP(p.fr, i));
		else
		{
			rev(s[i]);
			p = f(s[i]);
			ffp.ad(MP(p.fr, i));
			rev(s[i]);
		}

	}
	if (sum != 0) return cout << "No", 0;
	sort(all(fp)), reverse(all(fp));
	sort(all(ffp));
	for (auto p : fp)
	{
		pat += s[p.sc];
	}
	for (auto p : ffp)
	{
		pat += s[p.sc];
	}
	//cout << pat << endl;
	if (f(pat).fr >= 0) cout << "Yes";
	else cout << "No";
	return 0;
}


/*


  __
*(><)*
  \/ /
  ||/
--||
  ||
  /\
 /  \
/    \
*/



Measured memory_bytes: 45160
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const ll mod=1e9+7;
const int maxn=2e6+10;

int extgcd(int a,int b,int &x, int &y){
    int d=a;
    if(b!=0){
        d=extgcd(b,a%b,y,x);
        y-=(a/b)*x;
    }
    else  x=1,y=0;
    return d;
}


int mod_inverse(int a,int mod){
	int x,y;
	extgcd(a,mod,x,y);
	return (mod+x%mod)%mod;
}

ll p[maxn],c[maxn],ans=0;
int n,k;
string s;

int main(){
	cin>>k>>s;
	n=(int)s.size();
	p[0]=1;
	for(int i=1;i<=k;i++) p[i]=(p[i-1]*25ll)%mod;
	c[0]=1;
	for(int i=1;i<=k;i++){
		c[i]=ll(c[i-1]*ll(n+k+1-i))%mod;
	//	if(i==2) cout<<mod_inverse(i,mod)<<endl;
		c[i]=ll(c[i]*ll(mod_inverse(i,mod)))%mod;
	}
	for(int i=0;i<=k;i++){
		ll now=p[i]*c[i]%mod;
	//	cout<<c[i]<<endl;
		ans=(ans+now)%mod;
	}
	cout<<ans<<endl;
	return 0;
}

/*
2
a
*/


Measured memory_bytes: 19984
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main() {
    const int n = 1000000;
    vector<int> pyramid_nums;
    int k = 1;
    while(true) {
        int num = k*(k+1)*(k+2) / 6;
        if(num >= n) break;
        pyramid_nums.push_back(num);
        k++;
    }
    vector<int> dp;
    dp.push_back(0);
    for(int k = 1; k < n; ++k) {
        int elem = k;
        for(int p_num : pyramid_nums) {
            if(p_num > k) break;
            if(elem > dp[k - p_num] + 1) elem = dp[k - p_num] + 1;
        }
        dp.push_back(elem);
    }
    vector<int> dp_odd;
    dp_odd.push_back(0);
    for(int k = 1; k < n; ++k) {
        int elem = k;
        for(int p_num : pyramid_nums) {
            if(p_num % 2 == 0) continue;
            if(p_num > k) break;
            if(elem > dp_odd[k - p_num] + 1) elem = dp_odd[k - p_num] + 1;
        }
        dp_odd.push_back(elem);
    }
    while(true) {
        int q; cin >> q;
        if(q == 0) break;
        cout << dp[q] << ' ' << dp_odd[q] << endl;
    }
    return 0;
}

// [Problem] Pollock's conjecture
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1167&lang=jp


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

int main(){
    int n,m,a,b;
    cin>>n>>m>>a>>b;
    vector<int> d(n);
    rep(i,n)cin>>d[i];
    
    int del = -1;
    rep(i,n){
        if(d[i]>=a) del = i;
        else break;
    }
    
    if(n-(del+1)<m){
        for(int i=del;i>=0;i--){
            if(d[i]<=b)del--;
            else break;
        }
    }
    cout<<del+1<<endl;
    
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define ll long long
#define ar array
#define AC ios_base::sync_with_stdio(0);
const int M = 1e9+7;
using namespace std;

int main(){
    AC
    int n;
    cin>>n;
    if(n>=30)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>

using namespace std;

int main(){
  int A,B;
  cin >> A >> B;
  string S;
  cin >> S;
  bool ans=true;
  for(int i=0;i<A;i++){
    if(S.at(i)!='0' && S.at(i)!='1' && S.at(i)!='2' && S.at(i)!='3' && S.at(i)!='4' && S.at(i)!='5' && S.at(i)!='6' && S.at(i)!='7' && S.at(i)!='8' && S.at(i)!='9')  ans=false;
  }
  if(S.at(A) != '-')  ans=false;
  for(int i=A+1;i<A+B+1;i++){
    if(S.at(i)!='0' && S.at(i)!='1' && S.at(i)!='2' && S.at(i)!='3' && S.at(i)!='4' && S.at(i)!='5' && S.at(i)!='6' && S.at(i)!='7' && S.at(i)!='8' && S.at(i)!='9')  ans=false;
  }
  if(ans) cout << "Yes" << endl;
  else  cout << "No" << endl;

  return 0;
}


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

int main() {
	int q1, b, c1, c2, q2;
	while(cin >> q1, q1) {
		cin >> b >> c1 >> c2 >> q2;
		int jidori, normal;
		jidori = normal = -1;
		for(int i = 1; i <= q2; i++) {
			if(b >= c1 * i && i + (b - c1 * i) / c2 >= q1) {
				jidori = i;
				normal = (b - c1 * i) / c2;
			}
		}
		if(jidori >= 0 && normal >= 0)
			cout << jidori << " " << normal << endl;
		else
			cout << "NA" << endl;
	}
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define pf printf
#define sc scanf
#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%lld %lld",&n1,&n2)
#define slll(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)

signed main(){
    
        int n;
        int m;
        int x;
        cin >> n >> m >> x;

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

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

        int sum=0,count=0,temp=0,i=0,j=0;

        while(i<n && sum+a[i]<=x){    //considering only first stack and calculating count
            sum+=a[i];
            i++;
        }
        count=i;

        while(j<m && i>=0){          //now adding one element of second stack at a time and subtracting the top element of first stack and calculating the count
            sum+=b[j];
            j++;
            while(sum>x && i>0){
                i--;
                sum-=a[i];
            }
            if(sum<=x && i+j>count)
                count=i+j;
        }
        cout<<count<<endl;
    
}


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

int main(void)
{
    long long int a,b,c,d,i,j,k,n,x[10];
    string s;
    char C[5];

    cin >> a >> b;

    cout << a*a -b;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000;

int main(){
    int a, b, c;
    cin >> a >> b;
    if (b < 10) {
        c = a * 10 + b;
    }

    else if (b < 100) {
        c = a * 100 + b;
    }

    else {
        c = a * 1000 + b;
    }

    for (int i = 1; i < 1000; i++) {
        int ni = i*i;
        if (c == ni) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
} 

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it;}cout<<endl;}


int main() {
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k%2==0) pr(a -b);
    else pr(b-a);
}



Measured memory_bytes: 256
a, b, c = map(int, input().split())

ans = 0
while 1:
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        print(ans)
        exit()
    if a == b == c:
        print(-1)
        exit()
    else:
        a, b, c = b // 2 + c // 2, a // 2 + c // 2, a //2 + b //2
        ans += 1


Measured memory_bytes: 3060
import sys
input = sys.stdin.readline

def main():
    n, m = map(int, input().split())
    g = [[] for i in range(n)]
    ind = [0]*n
    for i in range(n+m-1):
        a, b = map(int, input().split())
        a, b = a-1, b-1
        g[a].append(b)
        ind[b] += 1

    from collections import deque
    q = deque([])
    order = []
    par = [0]*n
    for i in range(n):
        if ind[i] == 0:
            q.append(i)
    while q:
        v = q.popleft()
        order.append(v)
        for u in g[v]:
            ind[u] -= 1
            if ind[u] == 0:
                par[u] = v+1
                q.append(u)
    print(*par, sep='\n')

if __name__ == '__main__':
    main()


Measured memory_bytes: 30040
#include <cstdio>
using namespace std;

int main(void)
{
	int n;
	scanf("%d", &n);

	int sum = 0;
	int a;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		sum += a - 1;
	}

	printf("%d\n", sum);

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define vs (v.begin(),v.end())
#define MOD 1000000007

int main()
{  
  
  ll n;
  cin>>n;
  ld x[n+1]={0};
  for(ll i=1;i<=n;i++)
    cin>>x[i];
  ld dp[n+1][n+1];
  for(ll i=0;i<=n;i++)
    for(ll j=0;j<=n;j++)
      dp[i][j]=0;
     dp[0][0]=1;
  for(ll i=1;i<=n;i++)
  {
    for(ll j=0;j<=n;j++)
    { 
      if(j==0)
      {
         dp[i][j]=dp[i-1][j]*(1-x[i]);
      }
      else
      dp[i][j]=dp[i-1][j]*(1-x[i])+dp[i-1][j-1]*x[i];
    }
  }
  ld ans=0.0;
  for(ll j=(n+1)/2;j<=n;j++)
    ans+=dp[n][j];
  cout<<setprecision(10)<<ans<<endl;
  

  



}
    
   

         




  
   


  
              
              

  

  
  
          
      
    







  
 

Measured memory_bytes: 140928
N,K = map(int, input().split())
A = [int(a) for a in input().split()]

A.sort()
for i in range(N):
    if A[i] >= K:
        A = A[:i]
        break

N = len(A)

def f(n): #aiが必要か不必要か判定
    dp = [0]*K
    dp[0] = 1
    for i in range(N):
        if i == n:
            continue
        for j in range(K-1, A[i]-1, -1):
            dp[j] |= dp[j-A[i]]
            
    res = False
    for j in range(K-A[n], K):
        if dp[j]:
            res = True
            break
    return res

l = -1
r = N
while r-l > 1:
    m = (l+r)//2
    if f(m):
        r = m
    else:
        l = m
        
print(r)

Measured memory_bytes: 40400
#include <stdio.h>
int main(){
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x-r>=0 && y-r>=0){
       if(x+r<=W && y+r<=H){
         puts("Yes");
        }else{
           puts("No");
      }}else{
         puts("No");
          }
   return 0;
}
      

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 200000
#define INF 1000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
	int k,n;
    cin>>k>>n;
    vector<int> a(n);
    REP(i,n){
        IN(a[i]);
    }
    int tmp=0;
    REP(i,n-1){
        tmp=max(tmp,a[i+1]-a[i]);
    }
    tmp=max(tmp,a[0]+k-a[n-1]);
    OUT(k-tmp);
	return 0;
}

Measured memory_bytes: 1024