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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

int N, Q;
vector<int> ac_cumsum;

int main(void) {

    cin >> N >> Q;

    string S;
    cin >> S;
    ac_cumsum.resize(N + 1);


    for (int i = 2; i <= N; ++i) {
        if (S[i - 2] == 'A' && S[i - 1] == 'C') {
            ac_cumsum[i] = ac_cumsum[i - 1] + 1;
        }
        else {
            ac_cumsum[i] = ac_cumsum[i - 1];
        }
    }

    rep(i, Q) {
        int l, r;
        cin >> l >> r;
        cout << ac_cumsum[r] - ac_cumsum[l] << endl;
    }

    return 0;
}

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

int main()
{
	int n;
	int array[100];

	while (cin >> n, n){
		int cnt = 0;
		for (int i = 0; i < n; i++){
			cin >> array[i];
		}
		for (int i = 0; i < n - 1; i++){
			for (int j = n - 1; j > i; j--){
				if (array[j] < array[j - 1]){
					swap(array[j], array[j - 1]);
					cnt++;
				}
			}
		}
		cout << cnt << endl;
	}

	return (0);
}

Measured memory_bytes: 1160
#include <iostream>
using namespace std;
bool d[10] = {};

bool f(int n){
      while(n > 0){
            if(d[n % 10])return false;
            n /= 10;
      }
      return true;
}
int main(void){
    int n,k;
    cin >> n >> k;
    for(int i = 0;i < k;i++){
          int c;
          cin >> c;
          d[c] = true;
    }
    
    while(!f(n)){
         n++; 
    }
    cout << n << endl;
    
    
}


Measured memory_bytes: 3592
// atcoder/abc127/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

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

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  lli r, d, x;
  while (cin >> r >> d >> x) {
    for (int i = 0; i < 10; ++i) {
      x = r * x - d;
      cout << x << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Code author: Saurabh Singhal
Code copy karne vaale tera muh kaala
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ppb pop_back

using namespace std;
typedef long long int ll;
typedef vector<int> vi_t;
typedef vector<ll> vll_t;
int t=1;
vll_t a,b;
int  main(){
	// #ifndef ONLINE_JUDGE
 //    // for getting input from input.txt
 //    freopen("input.txt", "r", stdin);
 //    // for writing output to output.txt
 //    freopen("output.txt", "w", stdout);
	// #endif
	int n;
	cin>>n;
	vector<int>v(n),w(n);
	for(int i=0;i<n;i++){
		cin>>v[i];
		w[i]=v[i];
	}
	sort(w.begin(),w.end());
	for(int i=0;i<n;i++){
		if(v[i]<=w[(n-1)/2]){
			cout<<w[n/2]<<endl;
		}
		else{
			cout<<w[(n-1)/2]<<endl;
		}
	}
}

Measured memory_bytes: 3712
#include <stdio.h>
#define MAX 3000

int main(){
    
    int x,y;
    
    for(int i = 0;i < MAX;i++){
        scanf("%d %d",&x,&y);
        if(x==0 && y==0)
            break;
        if(x<y){
            printf("%d %d\n",x,y);
        }else{
            printf("%d %d\n",y,x);
        }
    }
    return 0;
}

Measured memory_bytes: 2728
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int A, B, C, X, Y, ans;
    cin >> A >> B >> C >> X >> Y;
    ans = 0;
    int s = min(X, Y);
    int t = min(A + B, 2 * C);
    X -= s;
    Y -= s;
    ans += s * t;
    if(Y == 0) {
        if(A >= 2 * C) {
            ans += 2 * C * X;
        } else {
            ans += A * X;
        }
    } else {
        if(B >= 2 * C) {
            ans += 2 * C * Y;
        } else {
            ans += B * Y;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    ll res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}
ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (int i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (int i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}

ll f[200001];
 
ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a; 
 while(b > 0)
    {
        if(b%2 == 1)
    {
        x=(x*y);
        if(x>MOD) x%=MOD;
    }
    y = (y*y);
    if(y>MOD) y%=MOD; 
    b /= 2;
    }
 return x;
}
 
/* Modular Multiplicative Inverse
 Using Euler's Theorem
 a^(phi(m)) = 1 (mod m)
 a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD)
{
 return pow(n,MOD-2,MOD);
}
 
ll C(ll n, ll r, ll MOD)
{
 
 return (f[n]*((InverseEuler(f[r], MOD) * InverseEuler(f[n-r], MOD)) % MOD)) % MOD;
}
 


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt();
    int q=(n+999)/1000;
    cout<<q*1000-n<<endl;


    return 0;   
}


 
 


Measured memory_bytes: 3620
#coding:utf-8
h = 1
w = 1

while h+w != 0:
    h, w=input().rstrip().split(" ")
    h = int(h)
    w = int(w)
    if h == 0:
        if w==0:
            break
#???
    print("#"*w)
    for i in range(h-2):
        print("#" + "."*(w-2) +"#")
#???
    print("#"*w)
    print("")

Measured memory_bytes: 7632
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>
#include <fstream>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n; cin >> n;
	vector<ll> t(n), a(n);
	rep(i, n)cin >> t[i];
	rep(i, n)cin >> a[i];
	vector<ll> h(n);
	h[0] = t[0];
	rep(i, n - 1)if (t[i + 1] > t[i])h[i + 1] = t[i + 1];
	if (h.back() != 0 && h.back() != a.back())
	{
		cout << 0 << endl;
		return 0;
	}
	h.back() = a.back();
	rrep(i, n - 1)if (a[i] > a[i + 1])
	{
		if (h[i] == 0)
		{
			if (a[i] <= t[i])h[i] = a[i];
			else
			{
				cout << 0 << endl;
				return 0;
			}
		}
		else if (h[i] != a[i])
		{
			cout << 0 << endl;
			return 0;
		}
	}
	ll MOD = 1e9 + 7;
	ll res = 1;
	rep(i, n)
	{
		if (h[i] != 0)continue;
		res *= min(t[i], a[i]);
		res %= MOD;
	}
	cout << res << endl;
}


Measured memory_bytes: 5636
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    int tmp1,tmp2,cnt=0;
    cin >> tmp1;
    int lis[tmp1];
    for(int i=0; i<tmp1; i++){
        cin >> lis[i];
    }
    cin >> tmp2;
    int key[tmp2];
    for(int i=0; i<tmp2; i++){
        cin >> key[i];
        if( *lower_bound(lis, lis+tmp1,key[i]) == key[i]){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using ll = long long int;

ll mod = 1000000007;

int main(){
    ll N; cin >> N;
    vll A(N);
    vvll count(N+1, vll(0));
    int col = 0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        if(A[i] == 0){col++;}
        count[A[i]].emplace_back(i);
    }
    bool j = true;
    for(int i=0; i<N; i++){
        int k = 0;
        if(A[i] == 0){continue;}
        else{
        if(count[A[i]][0] == i){
            for(auto x: count[A[i]-1]){
                if(x<i){k++;}
            }
            if(k<1){j = false;}
        }
        else if(count[A[i]][1] == i){
            for(auto x: count[A[i]-1]){
                if(x<i){k++;}
            }
            if(k<2){j = false;}
        }
        else{
            for(auto x: count[A[i]-1]){
                if(x<i){k++;}
            }
            if(k<3){j = false;}
        }
        }
    }
    for(auto x:count){
        if(x.size() > 3){
            j = false;
        }
    }
    if(j == false){cout << 0;}
    else{
    if(col == 1){cout << 3;}
    else if(col == 2){
        ll res = 6;
        for(int i=0; i<N; i++){
            if(A[i] == 0){continue;}
            else{
                int k = 0;
                for(auto x:count[A[i]-1]){
                    if(x < i){k++;}
                }
                if(count[A[i]][0] == i&&k==2){
                    res *= 2;
                }
            }
            res %= mod;
        }
        res %= mod;
        cout << res;
    }
    else{
        ll res = 6;
        for(int i=0; i<N; i++){
            if(A[i] == 0){continue;}
            else{
                int k = 0;
                for(auto x:count[A[i]-1]){
                    if(x < i){
                        k++;
                    }
                }
                if(count[A[i]][1]==i){
                    k--;
                }
                else if(count[A[i]][2] == i){
                    k -= 2;
                }
                res *= k;
            }
            res %= mod;
        }
        cout << res;
    }
    }
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<string, null_type,less<string>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define pb push_back
#define pf push_front
#define ppf pop_front
#define ppb pop_back
#define fi first 
#define sec second
#define pii pair<ll,ll>
#define endl "\n"
#define ook order_of_key
#define fbo find_by_order
#define md 1000000007
#define MD 998244353
#define MAXN 1000002
#define inf 10000000000
#define PI 3.1415926535897
ll input;

bool comp(const char &a,const char &b)
{
    return a>b;
}
struct cmp {
	bool operator() (const char &a, const char &b) const {
// 		if (a.fi == b.fi) return a.sec < b.sec;
// 		else
// 		return a.fi >b.fi ;
return a>b;
	}
};


int main() {
    int t=1;
    // cin>>t;
    while(t--)
    {
        ll a;
        cin>>a;
        cout<<a*(1+a+a*a)<<endl;
    }
}


Measured memory_bytes: 3588
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
#include <unordered_map>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
int main() {
#define int long long
	long long n, k;
	cin >> n >> k;
	if (k == 0) {
		cout << n * n << endl;
		return 0;
	}
	long long ans = 0;
	for (int i = k + 1; i <= n; ++i) {
		long long bot = k;
		long long top = i-1;
		for (int q = 0; bot + i * q <= n; ++q) {
			if (top + i * q <= n) {
				ans += top - bot + 1;
			}
			else {
				for (int j = bot + i * q; j <= n; ++j) {
					ans++;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int A[2000000],k,*B,C[10000],n;
void CountingSort(int [],int *,int);
int main(){
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    if(k<=A[i])k=A[i];
  }
  B=malloc(sizeof(int)*n+1);

  CountingSort(A,B,k);


  for(i=1;i<=n;i++){
    if(i==n) printf("%d\n",B[i]);
    else  printf("%d ",B[i]);
  }


  return 0;
}

void CountingSort(int A[],int *B,int k){
  int i,j;
  for(i=0;i<=k;i++){
    C[i]=0;
  }

  for(j=0;j<n;j++){
    C[A[j]]++;
  }


  for(i=0;i<=k;i++){
    C[i]=C[i]+C[i-1];
  }

  for(j=n-1;j>=0;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
}

Measured memory_bytes: 16268
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;cin>>s;
  int mini = 100000000;
  for(int i=0;i<(int)s.size()-2;i++){
  	int nos=(s[i]-'0')*100+(s[i+1]-'0')*10+s[i+2]-'0';
    mini = min(mini,abs(nos-753));
  }
  cout<<mini;
}


Measured memory_bytes: 3608
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(x,a,b) for(int x=a;x<=b;x++)
#define drep(x,a,b) for(int x=a;x>=b;x--)
#define rush() int T;scanf("%d",&T);while(T--)
#define wash(x,y) memset(x,y,sizeof(x));

int main(){
	string digit;
	cin>>digit;
	
	int len=digit.length();
	bool flag=true;
	rep(i,1,len-1){
		if(digit[i]!='9'){
			flag=false;
			break;
		}
	}
	
	int ans=-1;
	if(flag){
		ans=(digit[0]-'0')+9*(len-1);
	}
	else if(digit[0]>'1'){
		ans=(digit[0]-'0'-1)+9*(len-1);
	}
	else if(len==1){
		ans=1;
	}
	else{
		ans=9*(len-1);
	}
	
	cout<<ans;
}

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

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);

//	 		String input1 = bf.readLine().trim();
//	 		String input2 = bf.readLine().trim();
	 		StringTokenizer st = new StringTokenizer(bf.readLine());
	 		int n = Integer.parseInt(st.nextToken());
	 		int k = Integer.parseInt(st.nextToken());
	 		ArrayList<Integer> array = new ArrayList<Integer>();
	 		StringTokenizer st2 = new StringTokenizer(bf.readLine());
	 		for(int j=0;j<n;j++){
	 			array.add(Integer.parseInt(st2.nextToken()));
	 		}
 		
	 	for(int j = k;j<n;j++){
	 		if (array.get(j) > array.get(j-k))
	 			out.println("Yes");
	 		else
	 			out.println("No");
	 	}
 		
 		out.println();
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Measured memory_bytes: 54876
using System;
class test{
    static void Main(){
        int a,b,c;
        string[] str = Console.ReadLine().Split(' ');
        a=int.Parse(str[0]);
        b=int.Parse(str[1]);
        c=int.Parse(str[2]);
        if(a<b&&b<c){
            Console.WriteLine("Yes");
        }else{
            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 8828
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	int m = 0, f = 0, r = 0;
	while(!(m == -1 && f == -1 && r == -1)){
		cin >> m >> f >> r;
		if(m == -1 && f == -1 && r == -1) return EXIT_SUCCESS;
		if(m == -1 || f == -1 || m + f < 30){
			cout << 'F';
		}else if(m + f >= 80){
			cout << 'A';
		}else if(m + f >= 65){
			cout << 'B';
		}else if(m + f >= 50){
			cout << 'C';
		}else if(m + f < 50){
			if(r >= 50){
				cout << 'C';
			}else{
				cout << 'D';
			}
		}
		cout << '\n';
	}
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,i=1,t=1,ans=1;
  string s;
  cin >> s;
  n=s.size();
  while (i<n){
    if (t==2){
      t=1;
      i++;
    }else if (s[i]==s[i-1]){
      t=2;
      i+=2;
    }else i++;
    ans++;
  }
  if (i==n+1) ans--;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>

#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define abs(a) (((a) < 0) ? -(a) : (a))

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

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

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

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

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

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

int main() {
	int a = ri();
	int b = ri();
	int c = ri();
	printf("%s", (c >= a && c <= b) ? "Yes" : "No");
	
	return 0;
}


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

signed main(){
    int n; cin >> n;
	string s; cin >> s;
  	if(n%2==1) cout << "No";
  	else{
      	bool ans = true;
    	for(int i=0; i< n/2; ++i) ans &= (s[i] == s[n/2+i]);
      	if(ans) cout << "Yes";
      	else cout  << "No";
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int i,N,K;
    int m,n,sum=0;
    int a[100005];
    scanf("%d %d",&N,&K);
    for(i=0;i<N;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+N);
    if(N==K)
        sum=1;
    if(N!=K)
    {
        for(i=0;i<N;i++)
        {
            if(a[i]!=a[i+1])
           {
               m=(N-K-i)%(K-1);
               n=(N-K-i)/(K-1);
               if(m==0)
               {
                   sum=1+n;
               }
               else
                   sum=2+n;
               break;
           }
           if(a[i]=a[i+N-1])
           {
               sum=1;
               break;
           }
        }
    }
    printf("%d",sum);
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    int H, W;
    cin >> H >> W;
    vector<vector<char> > A(H + 2, vector<char>(W + 2, '#'));
    for (int y = 1; y <= H; ++y) {
        for (int x = 1; x <= W; ++x) {
            cin >> A.at(y).at(x);
        }
    }
    for (int y = 0; y <= H + 1; ++y) {
        for (int x = 0; x <= W + 1; ++x) {
            cout << A.at(y).at(x);
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
using System;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string [] input = ReadArray();

            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            if(a*b%2==0){
                Console.WriteLine("Even");
            }else{
                Console.WriteLine("Odd");
            }
        }
        static string[] ReadArray(){return Console.ReadLine().Split((' '));}
    }
}

Measured memory_bytes: 11092
hoge = input().split()
 
aaa = 0  
if hoge[0] == hoge[1]:
  aaa += 1
if hoge[0] == hoge[2]:
  aaa += 1
if hoge[1] == hoge[2]:
  aaa += 1    
 
if (aaa == 1) or (aaa == 2):
  print("Yes")
else:
  print("No")

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

int main()
{
    int n; cin>>n;
    string s; cin>>s;
    set<string> sp;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            int flg=0;
            for(int k=0;k<n;k++){
                if(flg==0&&s[k]=='0'+i)
                    flg=1;
                else if(flg==1&&s[k]=='0'+j){
                    for(int p=k+1;p<n;p++){
                        string tmp="";
                        tmp+=to_string(i);
                        tmp+=to_string(j);
                        tmp+=s[p];
                        sp.insert(tmp);    
                    }
                    break;
                }
            }
        }
    }
    cout<<sp.size()<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

int main(){
  int N;
  cin >> N;
  cout << N*800-N/15*200 << endl;
  return 0;
}

Measured memory_bytes: 256
n,s = [input() for i in range(2)]
c = 0
for i in range(1000):
    if i < 10:
        a1 = '0'
        a2 = '0'
        a3 = str(i)
    elif i < 100:
        a1 = '0'
        a2 = str(i)[0]
        a3 = str(i)[1]
    else:
        a1 = str(i)[0]
        a2 = str(i)[1]
        a3 = str(i)[2]
    p1 = s.find(a1)
    if p1 >= 0:
        p2 = s.find(a2, p1 + 1)
        if p2 >= 0:
            if s.find(a3, p2 + 1) >= 0:
                c += 1
print(c)


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

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

int main()
{
    int A, B, T;
    cin >> A >> B >> T;
    int ans = 0;
    for(int i = 0; i < T / A;i++){
        ans += B;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
line = list(map(int, input().split()))
print(' '.join(map(str, line)))
for i in range(1, N):
    tmp = line[i]
    j = i - 1
    while j >= 0 and line[j] > tmp:
        line[j + 1] = line[j]
        j -= 1
    line[j + 1] = tmp
    print(' '.join(map(str, line)))


Measured memory_bytes: 5596
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print(-1, -1, -1)

Measured memory_bytes: 9116
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Data.Char

toTuple :: B.ByteString -> (Int, Int)
toTuple bs =
    let
        Just (a, bs') = B.readInt bs
        Just (b, _) = B.readInt $ B.dropWhile isSpace bs'
    in
        (a, b)

main = do
    [n,m] <- map read . words <$> getLine :: IO [Int]
    fts <- VU.replicateM m (toTuple <$> B.getLine)
    let (l,r) = VU.foldl' (\(f,t) (f',t') -> (max f f', min t t')) (1,n) fts
    print $ max 0 (r-l+1)

Measured memory_bytes: 18044
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
const int mod = 1000000007;
using namespace std;
long long a,b,ans;
int main(){
	cin>>a>>b;
	if((a*2)>(b)){
		cout<<b/2<<endl;
	}else{
		ans+=a;
		b-=a*2;
		ans+=b/4;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long X;
  long long a = 0LL;
  long long b = 0LL;
  std::cin >> X;
  a = X/500;
  X = X%500;
  b = X/5;
  std::cout << 1000*a  + 5*b<< '\n';
}


Measured memory_bytes: 256
n = int(input())
a = 0
b = n
ans = 1e9
while (1 < b):
    a += 1
    b -= 1
    sa = str(a)
    sb = str(b)
    sum = 0
    for i in range(len(sa)):
        sum += int(sa[i])
    for i in range(len(sb)):
        sum += int(sb[i])
    ans = min(ans, sum)
print(ans)


Measured memory_bytes: 9188
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>

using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#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 inf 1000000007
#define mod 1000000007
#define ull unsigned long long
#define ll long long
template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}


int N;
ll A[200005];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	cin >> N;
	unordered_map<ll,ll> counter; 
	ll sm = 0;
	rep(i,0,N){
		cin >> A[i];
		sm += A[i];
		++counter[sm];
	}

	sm = 0;
	ll res = 0;
	rep(i,0,N) {
		res += counter[sm];
		sm += A[i];
		--counter[sm];
	}

	cout << res << endl;
}

Measured memory_bytes: 10056
#include <stdio.h>

int N;

 void makestr(char *str,int cnt, char max)
 {
   if(cnt == N)
   {
     printf("%s\n", str);
   }
   else
   {
     for(char add='a';add<=max;add++)
     {
       str[cnt]=add;
       if (add==max)
         makestr(str,cnt+1,1+max);
       else
         makestr(str,cnt+1,max);
     }
   }
 }

 int main(void)
 {
   scanf("%d",&N);
   char str[N+1];
   for (int i=0;i<=N;i++)
     str[i]='\0';
   makestr(str,0,'a');
 }

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

int main(){
    int n;
    cin >> n;
    n %= 10;
    if(n==3){
        cout << "bon" << endl;
    }else if(n==0||n==1||n==6||n==8){
        cout << "pon" << endl;    
    }else{
        cout << "hon" << endl;
    }
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0)
        : x((x % mod + mod) % mod)
    {
    }
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint& operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint& operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    rep(i, 60)
    {
        ll x = 0;
        rep(j, n) if (a[j] >> i & 1)++ x;
        ll now = x * (n - x) % mod;
        rep(j, i) now = now * 2 % mod;
        ans += now;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	min := 1000
	max := 0
	for i := 0; i < N; i++ {
		a := nextInt()
		if a < min {
			min = a
		}
		if a > max {
			max = a
		}
	}
	fmt.Println(max - min)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vi;
typedef long double td;
typedef vector<td> vd;
typedef pair<ll,ll> ii;
typedef vector<ii> vii; typedef vector<bool> vb;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(ll i = ll(a); i < (ll)(b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define show(v,n) cerr << #v << " = "; forn(i,n) cerr << v[i] << " "; cerr << endl;
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl
int MAXN = 500005;

vector <int> v[100005];
vector <int> dp(100005,0);
vector <bool> visto(100005,false);

void DFS(int n)
{
	visto[n]=true;
	for(auto u : v[n])
	{
		if(!visto[u]) DFS(u);
		dp[n]=max(dp[n],dp[u]+1);
	}
}
 
int main()
{ 	
	FIN;
	#ifdef input
		freopen("test1.txt", "r", stdin);
	#endif

	int n, m;
	cin >> n >> m;
	forn(i,m)
	{
		int x, y;
		cin >> x >> y;
		v[x].pb(y);
	}
	forn(i,n+1)
	{
		if(visto[i]==false) DFS(i);
	}
	int ans = 0;
	forn(i,n+1) ans = max(ans,dp[i]);
	cout << ans << endl;
    return 0;
}

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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr ll INF=1e18;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

struct Edge{
	int src,dst;
	ll weight;
	Edge(){}
	Edge(int s,int d,ll w):src(s),dst(d),weight(w){}
};
using Graph=vector<vector<Edge>>;

bool BellmanFord(const Graph& g,int src,vl& dist)
{
	int n=g.size();
	dist[src]=0;
	rep(k,n-1)
		rep(u,n) for(auto e:g[u])
			if(dist[e.dst]>dist[e.src]+e.weight)
				dist[e.dst]=dist[e.src]+e.weight;
	rep(k,n)
		rep(u,n) for(auto e:g[u])
			if(dist[e.dst]>dist[e.src]+e.weight){
				dist[e.dst]=dist[e.src]+e.weight;
				if(e.dst==n-1)
					return false;
			}
	return true;
}

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n,m;cin>>n>>m&&n|m;){
		Graph g(n);
		rep(i,m){
			int u,v,w; cin>>u>>v>>w; u--,v--;
			g[u].emplace_back(u,v,-w);
		}

		vl cost(n,INF);
		if(!BellmanFord(g,0,cost))
			cout<<"inf"<<endl;
		else
			cout<<-cost[n-1]<<endl;
	}
}


Measured memory_bytes: 384
const lines = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

reader.on("line", function (line) {
  lines.push(line);
});
reader.on("close", function () {
  const fiveHanYenNum = lines[0] as number;
  const oneHanYenNum = lines[1] as number;
  const fiftyYenNum = lines[2] as number;
  const applyYen = lines[3] as number;

  console.log(countApply(fiveHanYenNum, oneHanYenNum, fiftyYenNum, applyYen));
});

function countApply(
  fiveHanYenNum: number,
  oneHanYenNum: number,
  fiftyYenNum: number,
  applyYen: number
): number {
  let count = 0;

  for (let i = 0; i <= fiveHanYenNum; i++) {
    for (let j = 0; j <= oneHanYenNum; j++) {
      for (let k = 0; k <= fiftyYenNum; k++) {
        if (500 * i + 100 * j + k * 50 == applyYen) count = count + 1;
      }
    }
  }

  return count;
}


Measured memory_bytes: 7756
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
#define re real()
#define im imag()

typedef complex<double> P;
typedef pair<P,P> L; //sX+tY
const double EPS=1e-10;
double dot(P a,P b){return (conj(a)*b).real();}
double cros(P a,P b){return (conj(a)*b).imag();}
double area(P a,P b,P c){
  b-=a; c-=a;
  return cros(b,c)/2;
}

double area(vector<P> ps){
  double ret=0;
  rep(i,ps.size()-2)
    ret+=area(ps[0],ps[i+1],ps[i+2]);
  return ret;
}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int i,j,k;
  vector<P> ps;
  double x,y;
  while(EOF!=scanf("%lf,%lf",&x,&y)){
    ps.pb(P(x,y));
  }
  printf("%.10f\n",abs(area(ps)));
  return 0;
}

Measured memory_bytes: 1268
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t min = 0;
  int n, k;
  cin >> n >> k;
  vector<int>  monsters(n);
  for (int i = 0; i < n; i++){
    cin >> monsters.at(i);
  }
  sort(monsters.begin(), monsters.end(), std::greater<int>() );
  if (n <= k){
    cout << 0 << endl;
    return 0;
  }
  for (int i = k; i < n; i++){
    min += monsters.at(i);
  }
  cout << min << endl;
}

Measured memory_bytes: 4056
from bisect import bisect_left
from collections import deque
import sys

sys.setrecursionlimit(200001)

N = int(input())

a = list(map(int,input().split()))

graph = [[] for _ in range(N)]

for _ in range(N-1):
    u,v = map(int,input().split())
    u -= 1
    v -= 1
    graph[u].append(v)
    graph[v].append(u)

INF = 10**11
ans = [0]*N
dp = []###INFは空欄として扱って良い
stack = deque([])

def LISonTree(num,pre):
    ###num: 頂点番号
    ###pre: 1つ前にいた頂点番号
    p = bisect_left(dp,a[num])

    ###
    #print(p)
    ###

    if p >= len(dp):
        stack.appendleft((len(dp),INF))
        dp.append(a[num])
    else:
        stack.appendleft((p,dp[p]))
        dp[p] = a[num]
        
    
    q = bisect_left(dp,INF)
    ans[num] = q

    ###
    #print(num,'dp',dp)
    #print(num,'ans',ans)
    ###

    for x in graph[num]:
        if x == pre:
            continue
        LISonTree(x,num)
    
    changed_p, changed_v = stack.popleft()

    dp[changed_p] = changed_v

    ###
    #print(num,'dp',dp)
    ###

LISonTree(0,-1)
#print(ans)

for y in ans:
    print(y)

Measured memory_bytes: 235812
from itertools import chain

h, w = map(int, input().split())

def f(x, h, w):
    h2 = h // 2
    h3 = h - h2
    a,b,c = sorted((x,w*h2,w*h3))
    w2 = w // 2
    w3 = w - w2
    d,e,f = sorted((x,w2*h,w3*h))
    return min(c-a, f-d)

ss = ((w2*h, h, w-w2) for w2 in range(1, (w+3)//2))
ts = ((w*h2, h-h2, w) for h2 in range(1, (h+3)//2))

print(min(f(*xs) for xs in chain(ss, ts)))

Measured memory_bytes: 3064
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;

int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}

/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/



int main()
{	
	char S[5];
	cin >> S;

	int s12, s34;
	s12 = char_to_int(S[0]) * 10 + char_to_int(S[1]);
	s34 = char_to_int(S[2]) * 10 + char_to_int(S[3]);

	if ((s12 == 0 || 13 <= s12) && (s34 == 0 || 13 <= s34)) cout << "NA";
	else if (1 <= s12 && s12 <= 12 && 1 <= s34 && s34 <= 12) cout << "AMBIGUOUS";
	else if (s12 == 0 || 13 <= s12) cout << "YYMM";
	else cout << "MMYY";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define pf push_front
#define all(vv) (vv).begin(), (vv).end()
#define rep(ii, jj, ll, ss) for(int ii = jj; ii < ll; ii += ss)
#define time cerr << '\n' << (double)clock()/CLOCKS_PER_SEC << '\n'; return 0;

int n;
deque <char> ch;
deque <char> d;

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    rep(i, 0, n, 1) {
        char c; cin >> c;
        ch.pb(c);
        if (c == '(') d.pb(c);
        else {
            if (!d.empty() && d.back() == '(') d.pop_back();
            else d.pb(c);
        }
    }
    if (d.empty()) {
        for(auto it:ch) {
            cout << it;
        }
        time;
    }
    else {
        int front = 0, back = 0;
        for(auto it:d) {
            if (it == '(') ++back;
            else if (it == ')') ++front;
        }
        rep(i, 0, front, 1) ch.pf('(');
        rep(i, 0, back, 1) ch.pb(')');
    }
    for(auto it:ch) {
        cout << it;
    }
    time;
}



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

int main() {
    int n, ans, count, k, m;
    cin >> n;
    k = 0;
    ans = 1;

    for(int i = 1; i <= n; i++) {
        count = 0;
        m = i;
        while(true) {
            if(m % 2 == 0) {
                m = m / 2;
                count++;
            }
            else break;
        }

        if(count > k) {
            k = count;
            ans = i;
        }
    }
    cout << ans << 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 a = Integer.parseInt(scan.next());
		int b = Integer.parseInt(scan.next());
		System.out.println(a * b + " " + (a + b) * 2);
		scan.close();
	}
}


Measured memory_bytes: 25960
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}

#[allow(unused_macros)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let a = read!(usize);
    let b = read!(usize);
    let c = read!(usize);
    let d = read!(usize);

    println!("{}", min(a, b) + min(c, d));
}


Measured memory_bytes: 4352
//vowel と、そうでないとき consonant

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;
const ll INF=1000000000000000;

vector<ll> pw2(51,1); vector<ll> pw10(19,1);
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll myceil(ll x,ll y){if(x<=y) return 1;else if(x%y==0) return x/y;else return x/y+1;}
vector<ll> divisor(ll x){
	vector<ll> div;
	for(int i=1;i*i<=x;i++){
		if(i*i!=x && x%i==0){
			div.pb(i);
			div.pb(x/i);
		}
		else if(x%i==0) div.pb(i);
	}
	return div;
}
vector<ll> vectorprime(ll x){
	vector<bool> is_prime(x+1);
	vector<ll> prime;
	rep(i,x+1) is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<=x;i++){
		if(is_prime[i]){
			prime.pb(i);
		}
		for(int j=i*2;j<=x;j+=i) is_prime[j]=false;
	}
	return prime;
}

//a,b x
int main(){
	string s; cin>>s;
	if(s[0]=='a' || s[0]=='e' || s[0]=='i' || s[0]=='o' || s[0]=='u'){
		cout<<"vowel";
	}
	else cout<<"consonant";
		
	
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <chrono>
#include <iostream>
#include <vector>

using namespace std;
using namespace std::chrono;

long long get_c(int n, int k) {
  long long res = 1;
  int a = 1;
  int b = 1;
  int c = 1;
  while (true) {
    if (b <= k && res % b == 0) {
      res /= b;
      ++b;
      continue;
    }
    if (c <= (n - k) && res % c == 0) {
      res /= c;
      ++c;
      continue;
    }
    if (a <= n) {
      res *= a;
      ++a;
      continue;
    }
    break;
  }
  return res;
}

int main() {
  auto start = high_resolution_clock::now();

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  cout << fixed << setprecision(15);

  int n, a, b;
  cin >> n >> a >> b;
  vector<long long> items(n);
  for (int i = 0; i < n; ++i)
    cin >> items[i];
  sort(items.begin(), items.end(), greater<long long>());
  long long sum = 0;
  for (int i = 0; i < a; ++i)
    sum += items[i];

  cout << 1.0 * sum / a << endl;
  long long ans = 0;
  while (a <= b) {
    int out = 0;
    for (int i = a; i < n; ++i)
      if (items[i] == items[a - 1])
        ++out;
    int in = 0;
    for (int i = 0; i < a; ++i)
      if (items[i] == items[a - 1])
        ++in;
    ans += get_c(in + out, in);

    if (a < b && sum * (a + 1) == (sum + items[a]) * a) {
      ++a;
      sum += items[a - 1];
    } else {
      break;
    }
  }
  cout << ans << endl;

  cerr << "Total execution time : " << duration_cast<milliseconds>(high_resolution_clock::now() - start).count() << " ms" << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};




signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    
    string s;
    cin>>s;
    ll ans=700;
    rep(i,3){
        if(s[i]=='o') ans+=100;
    }
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 256