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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int a,b,c; cin >> a >> b >> c;
  swap(a,b);
  swap(a,c);
  cout << a << ' '<< b << ' ' << c << endl; 
  return 0;
}


Measured memory_bytes: 256
n = int(input())
for i in range(n):
  t = input()
  nums = [[] for i in range(100)]
  num = ""
  nest = 0
  maxnest = 0
  for e in t:
    if e=="[":
      nest += 1
      maxnest = max(maxnest, nest)
    elif e!="[" and e!="]":
      num += e
    elif e=="]" and len(num):
      nums[nest].append(int(num)//2+1)
      num = ""
      nest -= 1
    else:
      nums[nest+1].sort()
      t = 0
      for i in range(len(nums[nest+1])//2+1):
        t += nums[nest+1][i]
      nums[nest+1] = []
      nums[nest].append(t)
      nest -= 1
  print(nums[1][0])


Measured memory_bytes: 5672
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
	char name[100];
	int t;
}P;

P Q[LEN];
int head, tail, n;

void enqueue(P x){
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}
P dequeue(){
	P x = Q[head];
	head = (head + 1) % LEN;
    return x;
}

int min(int a, int b){ return a < b ? a : b; }


int main(){
	int elapse = 0; //每个任务运行总时间
	int c;  //每次运行时间
	int i, q;  //n是个数，q是每次最大运行时间
	P u;
	scanf("%d %d", &n, &q);

	head = 1; tail = n + 1;
	for (i = 1; i <= n; i++){
		scanf("%s",Q[i].name);
		scanf("%d",&Q[i].t);
	}

	while (head!=tail){
		u = dequeue();
		c = min(q, u.t);
		u.t = u.t - c;
		elapse = elapse + c;
		if (u.t > 0){
			enqueue(u);
		}
		else{
			printf("%s %d\n",u.name,elapse);
		}
		

	}
	return 0;
}


Measured memory_bytes: 11836
#include <iostream>
#include <set>
#include <algorithm>
#include <iterator>

std::set<int64_t> prims(int64_t x)
{
    std::set<int64_t> p = {1};
    int64_t i=2;
    while (i*i<=x)
    {
        if (x%i == 0)
        {
            p.insert(i);
            x /= i;
        }
        else ++i;
    }
    p.insert(x);
    return p;
}

int main()
{
    std::ios_base::sync_with_stdio(0);
    int64_t a,b;
    std::cin >> a >> b;
    auto A = prims(a);
    auto B = prims(b);
    std::set<int64_t> C;
    std::set_intersection(
        A.begin(), A.end(),
        B.begin(), B.end(),
        std::inserter(C, C.end()));
    std::cout << C.size();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<time.h>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
// g++ -o a a.cpp -Wall -lm -std=c++14

int main(){
    int n,m;cin>>n>>m;
    VI p(m),y(m);
    vector<string> NUM(m+1);
    vector<vector<P>> list(n+2);
    rep(i,m){
        cin>>p[i]>>y[i];
        list[p[i]].push_back(P(y[i],i));
    }
    rep(i,n+1){
        sort(ALL(list[i]));
    }
    rep(i,n+1){
        rep(j,list[i].size()){
            string ken=to_string(i);
            int zero=6-(int)ken.length();
            string old=to_string(j+1);
            int zero1=6-(int)old.length();
            NUM[list[i][j].se]=string(zero,'0')+ken+string(zero1,'0')+old;
        }
    }
    rep(i,m){
        cout<<NUM[i]<<endl;
    }
}

Measured memory_bytes: 13952
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,k;
    long long h[1000000];
    cin >> n >> k;
    for(int i=0;i<n;++i) cin >> h[i];
    int sum=0;
    for(int i=0;i<n;++i) {
        if(h[i]>=k) ++sum;
    }
    cout << sum << endl;
}



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

int main() {
  int N, M;
  cin >> N >> M;

  vector<int> K(N);
  vector<int> A(M);

  vector<int> F(M);

  for (int i = 0; i < N; i++) {
    cin >> K.at(i);

    for (int j = 0; j < K.at(i); j++) {
      cin >> A.at(j);

      F.at(A.at(j) - 1)++;
    }
  }

  int count = 0;

  for (int i = 0; i < M; i++) {
    if (F.at(i) == N) count++;
  }
  
  cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int INF = 1e9 + 7;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    if(abs(N - M) > 1){
        cout << 0 << '\n';
        return 0;
    }
    long long ans = 1;
    for(int i = 1; i <= N; ++i) {
        ans *= i;
        ans %= INF;
    }
    for(int i = 1; i <=M; ++i) {
        ans *= i;
        ans %= INF;
    }
    if(N == M){
        ans *= 2;
        ans %= INF;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
const int N=5e5+5;
int n,q,opt,l,r,ans;
int sum[26][N<<2];
char str[N];

void build(int k,int l,int r)
{
	if (l==r)
	{
		sum[str[l]-'a'][k]=1;
		return;
	}
	int mid=l+r>>1;
	build(k<<1,l,mid);
	build(k<<1|1,mid+1,r);
	for (register int i=0; i<26; ++i) sum[i][k]=sum[i][k<<1]+sum[i][k<<1|1];
}

void change(int k,int l,int r,int pos,int x)
{
	if (l==pos && pos==r) 
	{
		for (register int i=0; i<26; ++i) sum[i][k]=0;
		sum[x][k]=1;
		return;
	}
	int mid=l+r>>1;
	if (pos<=mid) change(k<<1,l,mid,pos,x);
	else change(k<<1|1,mid+1,r,pos,x);
	for (register int i=0; i<26; ++i) sum[i][k]=sum[i][k<<1]+sum[i][k<<1|1];
}

int query(int k,int l,int r,int qx,int qy,int x)
{
	if (qx<=l && r<=qy) return sum[x][k];
	int mid=l+r>>1;
	int ans=0;
	if (qx<=mid) ans=query(k<<1,l,mid,qx,qy,x);
	if (mid<qy) ans+=query(k<<1|1,mid+1,r,qx,qy,x);
	return ans;
}

inline char readchar()
{
	char ch=getchar();
	while (ch<'a' || ch>'z') ch=getchar();
	return ch;
}

int main(){
	scanf("%d",&n);
	scanf("%s",str+1);
	build(1,1,n);
	scanf("%d",&q);
	while (q--)
	{
		scanf("%d",&opt);
		if (opt==1)
		{
			scanf("%d",&l);
			char ch=readchar();
			change(1,1,n,l,ch-'a');
		}
		else
		{
			ans=0;
			scanf("%d%d",&l,&r);
			for (register int i=0; i<26; ++i) if (query(1,1,n,l,r,i)) ans++;
			printf("%d\n",ans);	
		}
	}
return 0;
}

Measured memory_bytes: 160000
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();
        int X = sc.nextInt();
        int[] A = new int[M];

        int count = 0;
        int count2 = 0;
        for(int i = 0;i<M;i++){
            A[i] = sc.nextInt();
            if(A[i]<X){
                count += 1;
            }
            else if(A[i]>X){
                count2 += 1;
            }
        }
        System.out.println(Math.min(count,count2));
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, P;
    cin >> A >> P;
    cout << (3 * A + P) / 2 << endl;
    return 0;
}


Measured memory_bytes: 384
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
#define int long long
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
struct Node{
    int x;
    int y;
}a[200005];
int n,x,y;
ll ans;
ll f[1000005],tag[1000005];
bool cmp(Node x,Node y){
    return x.x<y.x;
}
int work(int s){
    int l=1,r=n,sum=-1;
    while(l<=r){
        int mid=(l+r)>>1;
        if(a[mid].x<=s)l=mid+1,sum=mid;
        else r=mid-1;
    }
    return sum;
}
void pushup(int c){
    f[c]=max(f[c<<1],f[c<<1|1]);
}
void build(int c,int l,int r){
    if(l==r){
        f[c]=a[l].y;
        return;
    }
    int mid=(l+r)>>1;
    build(c<<1,l,mid);
    build(c<<1|1,mid+1,r);
    pushup(c);
}
void pushdown(int c){
    f[c<<1]+=tag[c];
    f[c<<1|1]+=tag[c];
    tag[c<<1]+=tag[c];
    tag[c<<1|1]+=tag[c];
    tag[c]=0;
}
void add(int x,int y,int l,int r,int c,int k){
    if(x<=l&&y>=r){
        f[c]+=k;
        tag[c]+=k;
        return;
    }
    pushdown(c);
    int mid=(l+r)>>1;
    if(x<=mid)add(x,y,l,mid,c<<1,k);
    if(y>mid)add(x,y,mid+1,r,c<<1|1,k);
    pushup(c);
}
int query(int x,int y,int l,int r,int c){
    if(x<=l&&y>=r)return f[c];
    pushdown(c);
    int mid=(l+r)>>1,sum=1<<31;
    if(x<=mid)sum=max(sum,query(x,y,l,mid,c<<1));
    if(y>mid)sum=max(sum,query(x,y,mid+1,r,c<<1|1));
    return sum;
}
signed main(){
	in(n);in(x);in(y);
    for(int i=1;i<=n;i++)in(a[i].x),in(a[i].y);
    sort(a+1,a+1+n,cmp);
    build(1,1,n);
    int i=1;
    while(i<=n){
        int s=a[i].x+x*2;
        int id=work(s);
        int g=query(i,i,1,n,1);
        int ci=(g+y-1)/y;
        ans+=ci;
        add(i,id,1,n,1,-(ci*y));
        int l=i,r=id,sum=i;
        while(l<=r){
            int mid=(l+r)>>1;
            if(query(i,mid,1,n,1)<=0)l=mid+1,sum=mid;
            else r=mid-1;
        }
        i=sum+1;
    }
    printf("%lld\n",ans);
	return 0;
}


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

int main(){
  ll n;
  cin >> n;
  ll ans = 0;
  rep(i,n){
    if(i % 3 != 0 && i % 5 != 0){
      ans += i;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
/*
#include<stdio.h>
int main(){
	int i,j,N;
	int A[100];
	int v;
	
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	for(j=0;j<N;j++){
		printf("%d",A[j]);
		if(j!=N-1)printf(" ");
	}
	
	for(i=1;i<N;i++){
		v=A[i];
		j=i-1;
		while(j>=0&&A[j]>v){
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=v;
		
		for(j=0;j<N;j++){
			printf("%d",A[j]);
			if(j!=N-1)printf(" ");
		}
		printf("\n");
	}
	return 0;
}
*/
#include<stdio.h>
int main(){
	int i,j,N;
	int A[100];
	int v;
	
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	for(j=0;j<N;j++){
		printf("%d",A[j]);
		if(j!=N-1)printf(" ");
	}
	
  printf("\n");
	for(i=1;i<N;i++){
		v=A[i];
		j=i-1;
		while(j>=0&&A[j]>v){
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=v;
		
		for(j=0;j<N;j++){
			printf("%d",A[j]);
			if(j!=N-1)printf(" ");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1824
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

long long int T[200000], A[200000];

bool check[200000];

int main(){
	
	int n;
	
	cin >> n;
	
	for(int i = 0; i < n; i++){
		check[i] = false;
	}
	
	for(int i = 0; i < n; i++){
		cin >> T[i];
	}
	
	for(int i = 0; i < n; i++){
		cin >> A[i];
	}
	
	int cur = 0;
	
	for(int i = 0; i < n; i++){
		if(cur < T[i]){
			cur = T[i];
			check[i] = true;
			if(T[i] > A[i]){
				cout << "0" << endl;
				return 0;
			}
		}
	}
	
	cur = 0;
	
	for(int i = n - 1; i >= 0; i--){
		if(cur < A[i]){
			cur = A[i];
			check[i] = true;
			if(T[i] < A[i]){
				cout << "0" << endl;
				return 0;
			}
		}
	}
	
	long long int ans = 1;
	
	for(int i = 0; i < n; i++){
		if(!check[i]){
			ans = ans * min(T[i], A[i]);
			ans = ans % 1000000007;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}



Measured memory_bytes: 1920
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B0Or1Swap solver = new B0Or1Swap();
        solver.solve(1, in, out);
        out.close();
    }

    static class B0Or1Swap {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] p = in.readIntArray(n);
            int[] sorted = Arrays.copyOf(p, n);
            Arrays.sort(sorted);

            int count = 0;
            for (int i = 0; i < n; i++) {
                if (p[i] != sorted[i])
                    count++;
            }

            boolean answer = count <= 2;

            out.println(answer ? "YES" : "NO");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] readIntArray(int n) {
            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = nextInt();
            }
            return x;
        }

    }
}



Measured memory_bytes: 21460
list1 = list(input())
count = 0
#貪欲
for i in range(1,len(list1)):
	if list1[i] == list1[i-1]:
		if list1[i] == "1":
			list1[i] = "0"
		else:
			list1[i] = "1"
		count += 1
print(count)

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

int main(void){
	int a,c,b;
	scanf("%d %d %d",&a,&b,&c);
	if(a==b){
		if(b==c){
			if(a==c){
				printf("Yes\n");
				return 0;
			}
		}
	}
	printf("No\n");
	return 0;
}


Measured memory_bytes: 128
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    print(n**3)
if __name__ == '__main__':
    do()

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n)
        cin >> a.at(i);
    
    rep(i,n/2+(n%2))
        cout << a.at(n-1-i*2) << " ";
    rep(i,n/2)
        cout << a.at(i*2+(n%2)) << " ";
}

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

int main(){
    unsigned long N;
    cin >> N;
    vector<unsigned long> A(N);
    for(auto& i : A)cin >> i;
    sort(A.begin(), A.end());
    unsigned long ans{0}, p{0}, b{0};
    for(const auto& i : A)if(p != i && (p = i)){
        ans += b;
        b = 1;
    }else b ^= 1;
    cout << ans + b << endl;
    return 0;
}


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

long long is(long long N, long long R) {
    if (R < 0 || R > N) return 0;
    if (R == 1) return N;
    else if (R == 2) return N * (N-1) / 2;
    else return N * (N-1) * (N-2) / 6;
}

string S;
int N, K;

long long solve(int i, int k, int how) {
    if (i == N) {
        if (k == 0) return 1;
        else return 0;
    }
    if (k == 0) return 1;

    if (how) return is(N-i, k) * pow(9, k);
    else {
        if (S[i] == '0') return solve(i+1, k, 0);
        else {
            return  solve(i+1, k, 1)
             + solve(i+1, k-1, 1) * (S[i] - '1')
             + solve(i+1, k-1, 0);
        }
    }
}

int main() {
    cin >> S >> K;
    N = S.size();
    cout << solve(0, K, false) << endl;
}


Measured memory_bytes: 512
import math
a, b, h, m = map(int, input().split())
p = math.pi
kaku_a = 2*p*(h*60+m)/(12*60)
kaku_b = 2*p*m/60
beta = abs(kaku_a-kaku_b)
c = math.sqrt(pow(a,2)+pow(b,2)-2*a*b*math.cos(beta))
print(c)

Measured memory_bytes: 9500
#include <iostream>
#include <string>
#define foor for(int i=0;i<n;i++)
#define yn cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define ic int a;cin>>a;
#define ic2 ic int b;cin>>b;
#define ic3 ic2 int c;cin>>c;
int s = 0;
using namespace std;
int main() {
	ic3
		if (a == b || b == c || a == c)if (a != b || b != c || a != c) yn
		else cout << "No" << endl;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int,input().split()))
    
dp = [0]*N
for i in range(1,N):
  dp[i] = max(dp[i], dp[i-1]+abs(H[i]-H[i-1]))
  if(i > 1):
    dp[i] = min(dp[i], dp[i-2]+abs(H[i]-H[i-2]))
print(dp[N-1])

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

int N;
int A[100010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll ans = 0, cum = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0) ans += cum / 2, cum = 0;
    else cum += A[i];
  }
  ans += cum / 2;
  cout << ans << endl;

  return 0;
}

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

typedef long long ll;
const int INF=1e9;
using namespace std;

int main(){
    int n;
    cin >> n;
    char s[n];
    int b=0;
    int w=0;
    for(int i=0;i<n;i++){
        cin >> s[i];
        if(s[i]=='#') b++;
        if(s[i]=='.') w++;
    }
    int bl=0,wr=w;
    int ans=min(bl+wr,INF);
    for(int i=0;i<n;i++){
        if(s[i]=='.') wr--;
        else bl++;
        ans=min(wr+bl,ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <cstdio>
using namespace std;

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/* */
/* 入力開始！ */
/* 入力終了！ */
int main(void)
{
   int i,j,k,l;
   int n;
   char s[25];
   cin >> s;
   for(i=strlen(s)-1;i>-1;i--) {
      cout << s[i];
   }
   cout << endl;

   return 0;
}

Measured memory_bytes: 1132
def cmb(n,r):
    if (n-r)<r: r=n-r
    if r==0: return 1
    if r==1: return n

    numerator = [n-r + k+1 for k in range(r)]
    denominator = [k+1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p-1]
        if pivot>1:
            offset = (n-r)%p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

x,y = map(int,input().split())

MOD = 10**9+7
n = (x+y)//3
a = x-n
b = y-n

if (x+y)%3 != 0 or a < 0 or b < 0:
    print(0)
else:
    a = x-n
    b = y-n
    print(cmb(a+b,b)%MOD)

Measured memory_bytes: 35332
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll number1, ll number2) {//lcmを求める
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/

bool check(char c) {
	return (c == 'A' || c == 'T' || c == 'G' || c == 'C');
}

int main() {

	string s;
	scans(s);
	int ans = AC, tmp = 0;
	bool flag = false;
	for (auto aa : s) {
		if (flag) {
			if (check(aa))++tmp;
			else {
				ans = max(ans, tmp);
				tmp = 0;
				flag = false;
			}
		}
		else {
			if (check(aa)) {
				flag = true;
				++tmp;
			}
		}
	}
	ans = max(ans, tmp);
	printf("%d\n", ans);

	Please AC;
}


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

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	cin >> N;
	vector<int> X(N), Y(N);
	for (int i = 0; i < N; i++) {
		cin >> X[i];
		Y[i] = X[i];
	}

	sort(begin(X), end(X));

	for (int i = 0; i < N; i++) {
		if (Y[i] < X[N/2]) cout << X[N/2] << endl;
		else cout << X[N/2-1] << endl;
	}

	return 0;
}

Measured memory_bytes: 3840
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    h: i64,
    n: usize,
    a: [i64; n],
  }
  let sum: i64 = a.iter().sum();

  puts!("{}\n", if sum >= h { "Yes" } else { "No" });
}


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

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int n = r * 100 + g * 10 + b;
  if (n % 4 == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 384
function F()
  N = parse(BigInt,readline())
  if N == 1
    ans = 0
  else
    n = 10^N
    nn = 9^N+9^N-8^N
    n = n-nn
    ans = mod(n,10^9+7)
  end
  
  
  println(Int(ans))

end

F()


Measured memory_bytes: 172384
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;

int main(){
  int n;
  while(cin>>n,n){
    vector<set<int> > vec(n+1);
    for(int i=0;i<=n;i++){
      int m;
      cin>>m;
      for(int j=0;j<m;j++){
	int t;
	cin>>t;
	vec[i].insert(t);
      }
    }

    int cnt=0;
    int temp=0;
    for(int i=0;i<n;i++){
      if(includes(vec[i].begin(),vec[i].end(),vec[n].begin(),vec[n].end())){
	cnt++;
	temp=i+1;
      }
    }
    if(cnt != 1)
      cout<<-1<<endl;
    else
      cout<<temp<<endl;

  }
  return 0;
}

Measured memory_bytes: 1628
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  int n;
  double ans, limit;

  while (1) {
    scanf("%d", &n);
    if (n == -1) break;
    limit = 0.00001 * n;
    ans = n/2.0;
    while (1) {
      ans = ans - (ans * ans * ans - n) / (3 * ans * ans);
      if (ans * ans * ans - n < limit) break;
    }
    printf("%f\n", ans);
  }
  return 0;
}

Measured memory_bytes: 632
n=int(input())
b=[1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8]

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
a=factorization(n)
s=0
if n==1:
    print(0)
else:
    for i in range(len(a)):
        s+=b[a[i][1]-1]
    print(s)

Measured memory_bytes: 9524
<?php
$N  = fgets(STDIN);
$input_line = fgets(STDIN);
$a = explode(" ", $input_line);
rsort($a, SORT_NUMERIC);
$total = 0;
// var_dump($a);

for($i = 0; $i <= $N + 1; $i++) {
  if($i % 2 == 0) {
    $total += $a[$i];
  } else {
    $total -= $a[$i];
  }
}
echo "$total\n";
exit;
?>



Measured memory_bytes: 4604
#include <iostream>
#include<cstdio>
#include<set>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<cstring>

using namespace std;

int main()
{
    long long k,a,b;
    long long ans=0;
    scanf("%lld %lld %lld",&k,&a,&b);
    if(a>=b || a+1>k){
        ans=1+k;
    }
    else{
        int t=k-(a+1);
        long long x=t/2,y=t%2;
        ans=(x+1)*b-x*a;
        ans+=y;
    }
    ans=max(ans,1+k);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
ans = 0
ans2 = 0
ps = [list(map(str,input().split())) for i in range(M)]
ppp = [tuple(i) for i in ps]
pss = set(sorted(ppp))
check = [[0] for i in range(N+1)]
for i in pss:
    if "AC" in i:
        ans += 1
for i in ps:
    i[0] = int(i[0])
for i in range(len(ps)):
    if ps[i][1] == "WA" and check[ps[i][0]] != [-1]:
        check[ps[i][0]][0] += 1
    if ps[i][1] == "AC" and check[ps[i][0]] != [-1]:
        ans2 += check[ps[i][0]][0]
        check[ps[i][0]][0] = -1
print(ans, ans2)

Measured memory_bytes: 105176
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];
        for(int i=0; i<n; i++){
            x[i] = sc.nextInt();
        }
        for(int i=0; i<n; i++){
            y[i] = sc.nextInt();
        }
        int d1 = 0;
        double d2 = 0;
        double d3 = 0;
        int d_inf = 0;
        for(int i=0; i<n; i++){
            d1 += Math.abs(x[i]-y[i]);
            d2 += Math.pow(x[i]-y[i], 2);
            d3 += Math.abs(Math.pow(x[i]-y[i], 3));
            if(Math.abs(x[i]-y[i]) >= d_inf) d_inf = Math.abs(x[i]-y[i]);
        }
        d2 = Math.sqrt(d2);
        d3 = Math.cbrt(d3);
        System.out.println(d1);  
        System.out.println(d2);  
        System.out.println(d3);  
        System.out.println(d_inf);  
    }
}


Measured memory_bytes: 26712
#include <iostream>
#include <cstdlib>
#include <queue>
#include <iomanip>
using namespace std;
int main(){
	long long int n, m;
	priority_queue<pair<long long int, long long int>, vector<pair<long long int, long long int> >, greater<pair<long long int, long long int> > > que[100000];
	cin >> n >> m;
	long long int p;
	long long int y;
	for(int i = 0;i < m;i++){
		cin >> p >> y;
		que[p - 1].push(make_pair(y, i));
	}
	long long int number[100000];
	long long int count;
	pair<long long int, long long int> e;
	for(long long int i = 0;i < n;i++){
		count = 1;
		while(que[i].size() > 0){
			e = que[i].top();
			que[i].pop();
			number[e.second] = (i + 1) * 1000000 + count;
			count++;
		}
	}
	for(int i = 0;i < m;i++){
		cout << setfill('0') << setw(12) << right << number[i] << endl;
	}
}


Measured memory_bytes: 8576
a,b,h,m = gets.chomp.split(" ").map(&:to_i)
minute = h * 60 + m
rad1 = minute / 2.0
rad2 = minute * 6.0
x1 = a * Math.sin(rad1*Math::PI/180.0)
y1 = a * Math.cos(rad1*Math::PI/180.0)
x2 = b * Math.sin(rad2*Math::PI/180.0)
y2 = b * Math.cos(rad2*Math::PI/180.0)
puts Math.sqrt((x1 - x2)**2 + (y1 - y2)**2) 

Measured memory_bytes: 14584
#include<stdio.h>
#include<stdlib.h>
#define N 2000001
#define A 10001

int main(){

  int *a,*b;
  int cnt[A];
  int n,i,j;
  scanf("%d",&n);
  
  a = malloc(sizeof(int)*n+1);
  b = malloc(sizeof(int)*n+1);
  
  for(i=0; i<A; i++){
    cnt[i]=0;
  }

  for(i=0; i<n; i++){
    scanf("%d",&a[i+1]);
    cnt[a[i+1]]++;
  }

  for(i=1; i<A; i++){
    cnt[i]=cnt[i]+cnt[i-1];
  }
  for(j=1; j<=n; j++){
    b[cnt[a[j]]] = a[j];
    cnt[a[j]]--;
  }

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

  return 0;
}

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

R,G,B = [],[],[]

for i in range(0,N):
    char = S[i]
    if char == "R":
        R.append(i)
    elif char == "G":
        G.append(i)
    elif char == "B":
        B.append(i)

count = len(R) * len(G) * len(B)

N2 = int(N/2 + 0.5)
for i in range(0,N):
    stri = S[i]
    for j in range(0, N2):
        if i+2*j >= N:
            break
        strj = S[i+j]
        strk = S[i+2*j]
        if stri != strj and strj != strk and stri != strk:
#             print("{} {} {}".format(stri,strj,strk))
            count -= 1
print(count)

Measured memory_bytes: 9236
M=10**9+7;I=[1,1]
n,*z=`dd`.split.map &:to_i
a=[]
x=0
z.each_with_index{|j,i|
	if a[j]
		x=a[j]+n-i
	end
	a[j]=i
}
r=j=1
(1..n+1).each{|i|
	p ((r=r*(n+2-i)*I[i]%M)-j)%M
	j=j*x*I[i]%M
	x-=1
	I<<(M-M/-~i)*I[M%-~i]%M
}

Measured memory_bytes: 15812
#include<bits/stdc++.h>
using namespace std;
long long int a[1000005];
long long mod=1e9+7;

long long power(long long a,long long b){
	long long res=1;
	while(b>0){
		if(b&1)
		 res=(res*a)%mod;
		a=(a*a)%mod;
		b=b/2;
	}
	return res;
}
 
int main(){
  int n;
  cin>>n;
  vector<long long> v(n),v1(n);
  for(int i=0;i<n;i++)
     cin>>v[i],v1[i]=v[i];
  
  vector<long long> b(n);
  for(int i=0;i<n;i++){
    for(int j=2;j*j<=v1[i];j++){
      if(v1[i]%j==0){
        long long cnt=0;
        while(v1[i]%j==0){
          cnt+=1;
          v1[i]=v1[i]/j;
        }
        a[j]=max(a[j],cnt);
      }
     }
      if(v1[i]>1)
         a[v1[i]]=max(a[v1[i]],(long long)1);
   }
    long long l=1;
    //cout<<a[2]<<" "<<a[3]<<endl;
    for(int i=2;i<=1000000;i++){
     for(int j=0;j<a[i];j++)
       l=(l*i)%mod;
    }
    //cout<<l<<endl;
    long long s=0;
    for(int i=0;i<n;i++){
      s=(s+(l*power(v[i],mod-2))%mod)%mod;
    }
    cout<<s;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ULL unsigned long long
#define LL long long

using namespace std;

int main(){
	double R;
	
	cin >> R;
	cout << (R*(2.00000)*(3.14159265)) << endl;
	return 0;
}

Measured memory_bytes: 3804
from heapq import heappush, heappop
n,m=map(int,input().split())
hq=[]
for _ in input().split():
  heappush(hq,(-int(_),1))
for iii in range(m):
  b,c=map(int,input().split())
  heappush(hq,(-c,b))
s=0
for iii in range(n):
  a=heappop(hq)
  s-=a[0]
  if a[1]!=1:
    heappush(hq,(a[0],a[1]-1))
print(s)

Measured memory_bytes: 28024
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>
#include <unordered_map>

#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define all(s) s.begin(), s.end()
#define fo(i, start, finish) for(int i = start; i <= finish; i ++)
#define y1 kdfjsalsdkf

const long long MXN = 1e5 + 10;
const long long MNN = 5e3 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long OO = 1e9 + 500;

typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

int n, b[MXN], mx;
int used[MXN];

int main(){
    ios;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> b[i];
        mx = max(b[i], mx);
    }
    if(mx % 2 == 0){
        for(int i = 1; i <= n; i++){
            if(b[i] < mx / 2){
                cout << "Impossible";
                return 0;
            }
            used[b[i]]++;
        }
        if(used[mx / 2] != 1) return cout << "Impossible", 0;
        for(int i = mx; i > mx / 2; i--){
            if(used[i] < 2) return cout << "Impossible", 0;
        }
        cout << "Possible";
    } else {
        for(int i = 1; i <= n; i++){
            if(b[i] < (mx + 1) / 2){
                cout << "Impossible";
                return 0;
            }
            used[b[i]]++;
        }
        if(used[(mx + 1) / 2] != 2) return cout << "Impossible", 0;
        for(int i = mx; i > (mx + 1) / 2; i--){
            if(used[i] < 2) return cout << "Impossible", 0;
        }
        cout << "Possible";
    }
    return 0;
}



Measured memory_bytes: 256
import numpy as np
N = int(input())
A_list = list(map(int, input().split()))
A_np = np.array(A_list)
A_sort = np.sort(A_np)[::-1]
comfort = 0
for i in range(0,N-1):
  if i == 0:
    comfort = comfort + A_sort[i]
  else:
    comfort = comfort + A_sort[int((i+1)/2)]
print(comfort)

Measured memory_bytes: 49792
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();

        String ans = "";
        for(int i = 0;i<a.length();i++){
            if (i == 5 || i == 13)
                ans += " ";
            else
                ans += a.charAt(i);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 39596
#include<bits/stdc++.h>
using namespace std;
const int N=5e3+10;
typedef long long LL;
int n,gA,sA,bA,gB,sB,bB;
LL f[N*N];

int main()
{
	cin>>n;
	cin>>gA>>sA>>bA;
	cin>>gB>>sB>>bB;
	LL Max=0;
	for (int i=1;i<=n;i++) {
		f[i]=i;
		if (i>=gA) f[i]=max(f[i],f[i-gA]+gB);
		if (i>=sA) f[i]=max(f[i],f[i-sA]+sB);
		if (i>=bA) f[i]=max(f[i],f[i-bA]+bB);
		Max=max(Max,f[i]);
	}
	LL ans=0;
	for (int i=1;i<=Max;i++) {
		f[i]=i;
		if (i>=gB) f[i]=max(f[i],f[i-gB]+gA);
		if (i>=sB) f[i]=max(f[i],f[i-sB]+sA);
		if (i>=bB) f[i]=max(f[i],f[i-bB]+bA);
		ans=max(ans,f[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 195584
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
#define p(x) cout<<(x)<<endl

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

  int ans = 0;
  for(int j = 1; j<=1000; j++) {
    for(int i = 2; i<10; i++) {
      int beki = pow(j, i);
      if (beki <= x) {
        ans = max({beki, ans});
      } else {
        break;
      }
    }
  }
  p(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
	int n, y,i,j=0;
	cin >> n >> y;
	for ( i = 0; i * 10000 <= y&&i<=n; i++) {
		for ( j = 0; i * 10000 + j * 5000 + 1000 * (n - i - j) <= y && i + j <= n; j++) {
			if (i * 10000 + j * 5000 + (n - i - j) * 1000 == y) {
				cout << i << " " << j << " " << n - i - j << endl;
				getchar();
				getchar();
				return 0;
			}
		}
	}
	cout << "-1" <<" "<< "-1"<<" " << "-1" << endl;
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int ans = 0;

    REP(i, 0, a + 1)
    {
        REP(j, 0, b + 1)
        {
            REP(k, 0, c + 1)
            {
                int sum = i * 500 + j * 100 + k * 50;
                if (sum == x)
                    ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long

using namespace std;

const int N_MAX = 200002;
const int BITS = 18;

int n;

int p[N_MAX];

int rm[N_MAX][BITS];

int rmq (int l, int r)
{
    int lg = r - l + 1;
    int b = 0;
    while((1 << (b + 1)) <= lg)
        b++;
    return min(rm[l][b], rm[r - (1 << b) + 1][b]);
}

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> p[i];
    for(int i = 1; i <= n; i++)
        rm[i][0] = p[i];
    for(int b = 1; b < BITS; b++)
        for(int i = 1; i <= n; i++)
            if(i + (1 << b) - 1 <= n)
                rm[i][b] = min(rm[i][b - 1], rm[i + (1 << (b - 1))][b - 1]);
    ll ans = 0;
    for(int i = 1; i <= n; i++)
    {
        int posl, posr;
        int l, r;
        l = 1;
        r = i;
        while(l < r)
        {
            int mid = (l + r) / 2;
            if(rmq(mid, i) < p[i])
                l = mid + 1;
            else
                r = mid;
        }
        posl = l;
        l = i;
        r = n;
        while(l < r)
        {
            int mid = (l + r + 1) / 2;
            if(rmq(i, mid) < p[i])
                r = mid - 1;
            else
                l = mid;
        }
        posr = r;
        ans += 1LL * (i - posl + 1) * (posr - i + 1) * p[i];
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 15104
#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>

#define rep(i,n) for(int i = 0; i < n; ++i)
#define reps(i,f,n) for(int i = f; i <= n; ++i)
#define eb emplace_back
#define all(x) x.begin(), x.end()

using namespace std;
using PII=pair<int,int>;
using PPI=pair<int,PII>;
using ll=long long;

const ll INF = 10000000000000LL;

// c(n,i)を高速に求めるやつ
int main(void){
  int n;
  vector<ll> a, b, c;
  cin >> n;
  a.resize(n);
  for(auto& as: a) cin >> as;
  b = a;
  c = a;
  for(int i = 0; i < n; ++i){
    if(i == 0)continue;
    b[i] += b[i-1];
  }

  for(int i = n-2; i >= 0; --i){
    c[i] += c[i+1];
  }

  ll ans = INF;

  rep(i,n-1){
    ans = min(ans, abs(c[i+1] - b[i]));
  }
  cout << ans << endl;


}


Measured memory_bytes: 4992
//============================================================================
// Name        : AOJ.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>

using namespace std;
typedef long long ll;
int main(){

	int a,b,c,d;

	cin>>a>>b>>c>>d;

	if(abs(a-c)<=d){
		cout<<"Yes"<<endl;
	}else if(abs(b-a)<=d&&abs(b-c)<=d){
			cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}


	// if(abs(a-c)<=d)




	return 0;
}


Measured memory_bytes: 764
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            var result = 0;

            if (a + b == 3)
            {
                result = 3;
            }
            else if (a + b == 4)
            {
                result = 2;
            }
            else if (a + b == 5)
            {
                result = 1;
            }

            Console.WriteLine(result);
        }

        static List<long> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => long.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 13140
import java.util.*;

public class Main {
	public Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new aoj1129().doIt();
	}
	class aoj1129{
		void doIt(){
			while(true){
				ArrayList<Integer> array = new ArrayList<Integer>();
				int n = sc.nextInt();
				int r = sc.nextInt();
				if(n + r == 0)break;
				for(int i = 1;i < n+1;i++){
					array.add(i);
				}
				for(int i = 0;i < r;i++){
					int p = sc.nextInt();
					int c = sc.nextInt();
					for(int j = p + c - 1;j >= p;j--){
						array.add(array.remove(n-(p+c-1)));
					}
				}
				System.out.println(array.get(n-1));
			}
		}
	}
}

Measured memory_bytes: 30148
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.12f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N,K; cin >> N >> K;
    int h[100100];
    rep(i,0,N) cin >> h[i];
    int dp[100100];
    Fill(dp,1001001001);
    dp[0] = 0;
    rep(i,0,N){
        reps(j,1,K){
            if(i+j < N){
                chmin(dp[i+j], dp[i] + abs(h[i+j] - h[i]));
            }
        }
    }
    cout << dp[N-1] << endl;
    return 0;
}


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



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, m, M;
  cin>>n;
  cin >> m >> M;
  int ans = m;
  
  rep (i, n-1) {
    ans+=min(m, M);
    m = M;
    cin>>M;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define endl '\n'
#define _USE_MATH_DEFINES
#include <cmath>
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);	
	double a, b, h, m, ans;
	scanf("%lf %lf %lf %lf",&a,&b,&h,&m);
	double degree = fabs(h*30.0 + m*0.5 - m*6.0);
	degree = degree * M_PI / 180.0;
	ans = 2*a*b*cos(degree);
	a = a * a;
	b = b * b;
	ans = a+b-ans;
	ans = sqrt(ans);
	printf("%.10lf\n",ans);
	
	
	
	return 0;
}



Measured memory_bytes: 4216
#include <cstdio>
#include <list>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int n;
    scanf("%d",&n);
    list<int> L;
    
    for(int i = 0; i < n; i++){
        char S[11];
        scanf("%s",S);
        if(S[0] == 'i'){
            int x;
            scanf("%d",&x);
            L.push_front(x);
        }else if(S[6] == 'F'){
            L.pop_front();
        }else if(S[6] == 'L'){
            L.pop_back();
        }else{
            int x;
            scanf("%d",&x);
            for(list<int>::iterator it = L.begin(); it != L.end(); it++){
                if(*it == x){
                    L.erase(it);
                    break;
                }
            }
        }
    }
    
    int i = 0;
    for(list<int>::iterator it = L.begin(); it != L.end(); it++){
        if(i++) printf(" ");
        printf("%d",*it);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 33900
N, M, C = map(int, input().split())
A = []
cnt = 0
B = list(map(int, input().split()))

for i in range(N):
    A = list(map(int, input().split()))
    if sum(A[j]*B[j] for j in range(M)) + C > 0:
        cnt += 1

print(cnt)

Measured memory_bytes: 3060
// package app;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);

        final int A = sc.nextInt();
        final int B = sc.nextInt();

        int result = Math.max(A + B, Math.max(A * B, A - B));

        System.out.println(result);

    }
}

Measured memory_bytes: 23764